|
|
@@ -109,7 +109,6 @@ class ProductController extends BaseController
|
|
|
util::complete();
|
|
|
}
|
|
|
|
|
|
-
|
|
|
//取出今天有入库的花材 ssh 20221224
|
|
|
public function actionGetStockIn()
|
|
|
{
|
|
|
@@ -136,7 +135,7 @@ class ProductController extends BaseController
|
|
|
$field = 'id,py,cover,name,ratio,cost,addPrice,classId,skMore,skPrice,itemId,smallUnit,smallRatio,presellDate,bigUnit,smallUnit,ratioType,variety,price,stock,stockWarning,discountPrice,presell,presellDate';
|
|
|
$itemInfoData = ProductClass::getAllByCondition($where, ['inTurn' => SORT_DESC, 'actualSold' => SORT_DESC], $field);
|
|
|
$itemInfoData = ProductClass::groupProductInfo($itemInfoData, $level);
|
|
|
- $data = ProductService::assembleItemData($classInfo, $itemInfoData, true);
|
|
|
+ $data = ProductService::assembleItemData($classInfo, $itemInfoData);
|
|
|
util::success($data);
|
|
|
}
|
|
|
|
|
|
@@ -180,7 +179,6 @@ class ProductController extends BaseController
|
|
|
$status = Yii::$app->request->get('status', 1);
|
|
|
//默认显示未删除商品
|
|
|
$delStatus = Yii::$app->request->get('delStatus', 0);
|
|
|
- $warning = Yii::$app->request->get('warning', 0);
|
|
|
|
|
|
//获取所有当前供货商的分类 (全部、常用)
|
|
|
//根据分类组装分类下的花材信息
|
|
|
@@ -209,49 +207,40 @@ class ProductController extends BaseController
|
|
|
$level = $custom->level ?? 1;
|
|
|
}
|
|
|
|
|
|
- if ($warning == 1) {
|
|
|
+ if ($requestType == 'hasStockList') {
|
|
|
+ //有库存的花材列表
|
|
|
+ $field = 'id,py,name,classId,itemId,price,skPrice,stock';
|
|
|
+ $itemInfoData = ProductClass::getAllByCondition($where, ['inTurn' => SORT_DESC, 'actualSold' => SORT_DESC], $field);
|
|
|
+ } elseif ($requestType == 'changePrice') {
|
|
|
+ //修改价格列表
|
|
|
+ $field = 'id,py,cover,name,cost,itemId,classId,addPrice,skPrice,discountPrice,skMore,variety,price,stock,presell';
|
|
|
+ $itemInfoData = ProductClass::getAllByCondition($where, ['inTurn' => SORT_DESC, 'actualSold' => SORT_DESC], $field);
|
|
|
+ $itemInfoData = ProductClass::changePriceGroup($itemInfoData, $level);
|
|
|
+ } elseif ($requestType == 'itemList') {
|
|
|
+ //花材列表
|
|
|
+ $field = 'id,py,cover,name,cost,itemId,classId,skPrice,variety,price,stock,presell';
|
|
|
+ $itemInfoData = ProductClass::getAllByCondition($where, ['inTurn' => SORT_DESC, 'actualSold' => SORT_DESC], $field);
|
|
|
+ $itemInfoData = ProductClass::itemListGroup($itemInfoData, $level);
|
|
|
+ } elseif ($requestType == 'cg') {
|
|
|
+ //采购花材
|
|
|
+ $field = 'id,py,cover,name,itemId,classId,variety,price,stock,presell,ratioType,smallUnit,bigUnit,ratio';
|
|
|
+ $itemInfoData = ProductClass::getAllByCondition($where, ['inTurn' => SORT_DESC, 'actualSold' => SORT_DESC], $field);
|
|
|
+ $itemInfoData = ProductClass::cgItemGroup($itemInfoData, $level);
|
|
|
+ } elseif ($requestType == 'warning') {
|
|
|
//库存预警
|
|
|
- $field = 'id,py,cover,name,ratio,cost,addPrice,classId,skMore,skPrice,itemId,smallUnit,smallRatio,bigUnit,smallUnit,ratioType,variety,price,stock,stockWarning,discountPrice,presell,presellDate';
|
|
|
+ $field = 'id,py,cover,name,cost,itemId,classId,skPrice,variety,price,stock,presell,stockWarning';
|
|
|
$itemInfoData = Product::find()->where("mainId={$this->mainId}")
|
|
|
->andWhere('`stock`<`stockWarning`')
|
|
|
->andWhere("delStatus=0")
|
|
|
->select($field)->asArray()->all();
|
|
|
+ $itemInfoData = ProductClass::warningGroup($itemInfoData, $level);
|
|
|
} else {
|
|
|
- if ($requestType == 'hasStockList') {
|
|
|
- //有库存的花材列表
|
|
|
- $field = 'id,py,name,classId,itemId,price,skPrice,stock';
|
|
|
- $itemInfoData = ProductClass::getAllByCondition($where, ['inTurn' => SORT_DESC, 'actualSold' => SORT_DESC], $field);
|
|
|
- } elseif ($requestType == 'changePrice') {
|
|
|
- //修改价格列表
|
|
|
- $field = 'id,py,cover,name,cost,itemId,classId,addPrice,skPrice,discountPrice,skMore,variety,price,stock,presell';
|
|
|
- $itemInfoData = ProductClass::getAllByCondition($where, ['inTurn' => SORT_DESC, 'actualSold' => SORT_DESC], $field);
|
|
|
- $itemInfoData = ProductClass::changePriceGroup($itemInfoData, $level);
|
|
|
- } elseif ($requestType == 'itemList') {
|
|
|
- //花材列表
|
|
|
- $field = 'id,py,cover,name,cost,itemId,classId,skPrice,variety,price,stock,presell';
|
|
|
- $itemInfoData = ProductClass::getAllByCondition($where, ['inTurn' => SORT_DESC, 'actualSold' => SORT_DESC], $field);
|
|
|
- $itemInfoData = ProductClass::itemListGroup($itemInfoData, $level);
|
|
|
- } elseif ($requestType == 'cg') {
|
|
|
- //采购花材
|
|
|
- $field = 'id,py,cover,name,itemId,classId,variety,price,stock,presell,ratioType,smallUnit,bigUnit,ratio';
|
|
|
- $itemInfoData = ProductClass::getAllByCondition($where, ['inTurn' => SORT_DESC, 'actualSold' => SORT_DESC], $field);
|
|
|
- $itemInfoData = ProductClass::cgItemGroup($itemInfoData, $level);
|
|
|
- } elseif ($requestType == 'warning') {
|
|
|
- //库存预警
|
|
|
- $field = 'id,py,cover,name,cost,itemId,classId,skPrice,variety,price,stock,presell,stockWarning';
|
|
|
- $itemInfoData = Product::find()->where("mainId={$this->mainId}")
|
|
|
- ->andWhere('`stock`<`stockWarning`')
|
|
|
- ->andWhere("delStatus=0")
|
|
|
- ->select($field)->asArray()->all();
|
|
|
- $itemInfoData = ProductClass::warningGroup($itemInfoData, $level);
|
|
|
- } else {
|
|
|
- //通用
|
|
|
- $field = 'id,py,cover,name,ratio,cost,addPrice,classId,skMore,skPrice,itemId,smallUnit,smallRatio,bigUnit,smallUnit,ratioType,variety,price,stock,stockWarning,discountPrice,presell,presellDate';
|
|
|
- $itemInfoData = ProductClass::getAllByCondition($where, ['inTurn' => SORT_DESC, 'actualSold' => SORT_DESC], $field);
|
|
|
- $itemInfoData = ProductClass::groupProductInfo($itemInfoData, $level);
|
|
|
- }
|
|
|
+ //通用
|
|
|
+ $field = 'id,py,cover,name,ratio,cost,addPrice,classId,skMore,skPrice,itemId,smallUnit,smallRatio,bigUnit,smallUnit,ratioType,variety,price,stock,stockWarning,discountPrice,presell,presellDate';
|
|
|
+ $itemInfoData = ProductClass::getAllByCondition($where, ['inTurn' => SORT_DESC, 'actualSold' => SORT_DESC], $field);
|
|
|
+ $itemInfoData = ProductClass::groupProductInfo($itemInfoData, $level);
|
|
|
}
|
|
|
- $data = ProductService::assembleItemData($classInfo, $itemInfoData, true);
|
|
|
+ $data = ProductService::assembleItemData($classInfo, $itemInfoData);
|
|
|
util::success($data);
|
|
|
}
|
|
|
|