cqp 2 tháng trước cách đây
mục cha
commit
57552017ea
1 tập tin đã thay đổi với 5 bổ sung4 xóa
  1. 5 4
      app/Service/CheckService.php

+ 5 - 4
app/Service/CheckService.php

@@ -1189,7 +1189,7 @@ class CheckService extends Service
         if(empty($result)) return [false,'出库单明细信息不存在或已被删除'];
 
         $prefix = OutBoundOrder::prefix;
-        $insert = [];
+        $insert = $tmp = [];
         $time = time();
         foreach ($result as $value){
             $key = $value['product_id'] . $value['storehouse_id'];
@@ -1212,8 +1212,8 @@ class CheckService extends Service
             }
 
             if(empty($value['purchase_order_id'])){
-                //没采购信息 则加入一条记录平流水
-                $insert[$key] = [
+                //没采购或盘点入库信息 则加入一条记录平流水
+                $tmp[] = [
                     'product_id' => $value['product_id'],
                     'number' => $value['number'],
                     'order_type' => PurchaseOrderInfoForOutBound::prefix,
@@ -1226,8 +1226,9 @@ class CheckService extends Service
                 ];
             }
         }
+        $insert_final = array_merge_recursive(array_values($insert),$tmp);
 
-        $bool = InOutRecord::insert($insert);
+        $bool = InOutRecord::insert($insert_final);
         if(! $bool) return [false, '流水写入失败'];
 
         //更新采购出库占用