|
|
@@ -7,14 +7,118 @@ use biz\item\classes\PtItemClass;
|
|
|
|
|
|
use bizGhs\item\classes\ItemClass;
|
|
|
use bizGhs\item\services\ItemService;
|
|
|
+use bizHd\custom\classes\CustomClass;
|
|
|
use bizHd\product\classes\ProductClass;
|
|
|
use common\components\dict;
|
|
|
+use common\components\stringUtil;
|
|
|
use common\components\util;
|
|
|
use Yii;
|
|
|
|
|
|
class ItemController extends BaseController
|
|
|
{
|
|
|
|
|
|
+ //列出所有花材 ssh 20240222
|
|
|
+ public function actionGetItemList()
|
|
|
+ {
|
|
|
+ $get = Yii::$app->request->get();
|
|
|
+ $search = $get['search'] ?? '';
|
|
|
+ $requestType = $get['requestType'] ?? 'kd';
|
|
|
+ $classId = $get['classId'] ?? 0;
|
|
|
+ $lookStock = $get['lookStock'] ?? 0;
|
|
|
+
|
|
|
+ $where['mainId'] = $this->mainId;
|
|
|
+ if ($requestType == 'kd') {
|
|
|
+ $where['delStatus'] = 0;
|
|
|
+ $where['status'] = 1;
|
|
|
+ } elseif ($requestType == 'itemList') {
|
|
|
+ $where['delStatus'] = 0;
|
|
|
+ if ($lookStock == 1) {
|
|
|
+ $where['stock>'] = 0;
|
|
|
+ }
|
|
|
+ if ($lookStock == 2) {
|
|
|
+ $where['stock'] = 0;
|
|
|
+ }
|
|
|
+ unset($where['status']);
|
|
|
+ } elseif ($requestType == 'changePrice') {
|
|
|
+ $where['delStatus'] = 0;
|
|
|
+ $where['stock>'] = 0;
|
|
|
+ } elseif ($requestType == 'hasStockList') {
|
|
|
+ $where['delStatus'] = 0;
|
|
|
+ $where['stock>'] = 0;
|
|
|
+ } elseif ($requestType == 'book') {
|
|
|
+ $where['delStatus'] = 0;
|
|
|
+ unset($where['status']);
|
|
|
+ } elseif ($requestType == 'outList') {
|
|
|
+ $where['delStatus'] = 0;
|
|
|
+ $where['status'] = 2;
|
|
|
+ $where['removeStatus'] = 0;
|
|
|
+ } elseif ($requestType == 'stopList') {
|
|
|
+ $where['delStatus'] = 1;
|
|
|
+ unset($where['status']);
|
|
|
+ $where['removeStatus'] = 0;
|
|
|
+ } elseif ($requestType == 'removeList') {
|
|
|
+ $where['delStatus'] = 1;
|
|
|
+ unset($where['status']);
|
|
|
+ $where['removeStatus'] = 1;
|
|
|
+ } elseif ($requestType == 'cg') {
|
|
|
+ $where['delStatus'] = 0;
|
|
|
+ unset($where['status']);
|
|
|
+ } elseif ($requestType == 'changeStock') {
|
|
|
+ $where['delStatus'] = 0;
|
|
|
+ unset($where['status']);
|
|
|
+ } elseif ($requestType == 'check') {
|
|
|
+ $where['delStatus'] = 0;
|
|
|
+ unset($where['status']);
|
|
|
+ } elseif ($requestType == 'stockOut') {
|
|
|
+ $where['delStatus'] = 0;
|
|
|
+ $where['status'] = 1;
|
|
|
+ } elseif ($requestType == 'break') {
|
|
|
+ $where['delStatus'] = 0;
|
|
|
+ $where['status'] = 1;
|
|
|
+ } else {
|
|
|
+ util::fail('没有定义的请求方式');
|
|
|
+ }
|
|
|
+ if (!empty($search)) {
|
|
|
+ if (stringUtil::isLetter($search)) {
|
|
|
+ $search = strtolower($search);
|
|
|
+ $where['py'] = ['like', $search];
|
|
|
+ } else {
|
|
|
+ $where['name'] = ['like', $search];
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (!empty($classId)) {
|
|
|
+ if ($classId == -1) {
|
|
|
+ $where['discountPrice>'] = 0;
|
|
|
+ } elseif ($classId == -2) {
|
|
|
+ $where['reachNum>'] = 0;
|
|
|
+ } elseif ($classId == -3) {
|
|
|
+ $where['presell'] = 1;
|
|
|
+ } else {
|
|
|
+ $where['classId'] = $classId;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $customId = $get['customId'] ?? 0;
|
|
|
+ $custom = CustomClass::getById($customId, true);
|
|
|
+ if (!empty($custom)) {
|
|
|
+ if ($custom->shopId != $this->shopId) {
|
|
|
+ util::fail('不是你的客户哦,编号55236');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $level = $custom->level ?? 1;
|
|
|
+ $field = '*';
|
|
|
+
|
|
|
+ $result = ProductClass::getList($field, $where, ['inTurn' => SORT_DESC, 'actualSold' => SORT_DESC]);
|
|
|
+ $list = $result['list'] ?? [];
|
|
|
+ if ($requestType == 'kd') {
|
|
|
+ $list = ProductClass::kdItemGroup($list, $level);
|
|
|
+ } else {
|
|
|
+ util::fail('没有数据');
|
|
|
+ }
|
|
|
+ $result['list'] = $list;
|
|
|
+ util::success($result);
|
|
|
+ }
|
|
|
+
|
|
|
//增加和减少半扎 ssh 20250417
|
|
|
public function actionChangeHalf()
|
|
|
{
|