|
|
@@ -133,10 +133,6 @@ class ProductController extends BaseController
|
|
|
}
|
|
|
$where['delStatus'] = $delStatus;
|
|
|
|
|
|
- if ($warning == 1) {
|
|
|
- $where['stock<'] = '`stockWarning`';
|
|
|
- }
|
|
|
-
|
|
|
//客户等级
|
|
|
$customId = Yii::$app->request->get('customId', 0);
|
|
|
$level = 1;
|
|
|
@@ -145,7 +141,19 @@ class ProductController extends BaseController
|
|
|
$level = $custom->level ?? 1;
|
|
|
}
|
|
|
|
|
|
- $itemInfoData = ProductClass::getAllByCondition($where, ['inTurn' => SORT_DESC, 'actualSold' => SORT_DESC], "*");
|
|
|
+ if ($warning == 1) {
|
|
|
+ //库存预警
|
|
|
+// $sql = "SELECT * FROM `" . Product::tableName() . "` WHERE mainId={$this->mainId} and delStatus=0 and stock<stockWarning";
|
|
|
+// $command = Yii::$app->db->createCommand($sql);
|
|
|
+// $itemInfoData = $command->queryAll();
|
|
|
+
|
|
|
+ $itemInfoData = Product::find()->where("mainId={$this->mainId}")->andWhere('`stock`<`stockWarning`')
|
|
|
+ ->andWhere("delStatus=0")
|
|
|
+ ->select('*')->asArray()->all();
|
|
|
+
|
|
|
+ } else {
|
|
|
+ $itemInfoData = ProductClass::getAllByCondition($where, ['inTurn' => SORT_DESC, 'actualSold' => SORT_DESC], "*");
|
|
|
+ }
|
|
|
$itemInfoData = ProductClass::groupProductInfo($itemInfoData, $level);
|
|
|
|
|
|
$data = ProductService::assembleData($classIds, $itemInfoData, true);
|