|
|
@@ -125,19 +125,26 @@ class CheckOrderController extends BaseController
|
|
|
util::fail('花材格式不正确');
|
|
|
}
|
|
|
|
|
|
-// if ($this->mainId == 2126) {
|
|
|
-// foreach ($ghsItemInfo as $key => $val) {
|
|
|
-// $pId = $val['productId'] ?? 0;
|
|
|
-// $info = ProductClass::getById($pId, true);
|
|
|
-// if ($info->mainId != 2126) {
|
|
|
-// unset($ghsItemInfo[$key]);
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-
|
|
|
//判断花材格式,是否属于当前门店
|
|
|
ProductClass::valid($ghsItemInfo, $this->mainId);
|
|
|
|
|
|
+ $post = Yii::$app->request->post();
|
|
|
+ $changeType = $post['changeType'] ?? 'modify';
|
|
|
+ //分配库存时用到添加方式的盘点
|
|
|
+ if ($changeType == 'add') {
|
|
|
+ $ids = array_column($ghsItemInfo, 'productId');
|
|
|
+ $infoList = ProductClass::getByIds($ids, null, 'id');
|
|
|
+ if (!empty($infoList)) {
|
|
|
+ foreach ($ghsItemInfo as $itemKey => $itemVal) {
|
|
|
+ $productId = $itemVal['productId'] ?? 0;
|
|
|
+ $bigNum = $itemVal['bigNum'] ?? 0;
|
|
|
+ $addBigNum = $infoList[$productId]['stock'] ?? 0;
|
|
|
+ $newBigNum = bcadd($bigNum, $addBigNum, 2);
|
|
|
+ $ghsItemInfo[$itemKey]['bigNum'] = $newBigNum;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
foreach ($ghsItemInfo as $key => $item) {
|
|
|
//如果盘点数是99999则转为0
|
|
|
if (isset($item['bigNum']) && $item['bigNum'] == 99999) {
|