Browse Source

库管批量发货接口优化,去除重复发货申请单号

wufeng 2 years ago
parent
commit
6248c79386
1 changed files with 9 additions and 0 deletions
  1. 9 0
      app/admin/controller/Sale.php

+ 9 - 0
app/admin/controller/Sale.php

@@ -2736,6 +2736,7 @@ class Sale extends Base
      * @throws \think\db\exception\DbException
      * @throws \think\db\exception\ModelNotFoundException
      */
+    //工差单审核
     public function diffcheck()
     {
         $token = isset($this->post['token']) && $this->post['token'] !== "" ? trim($this->post['token']) : "";
@@ -3828,11 +3829,19 @@ class Sale extends Base
 
             $good_data = [];
 
+            $temp_out_codes=[];
+
             foreach ($param['list'] as $value) {
 
                 if (!isset($order_out_infos[$value['outCode']])) throw new Exception($value['outCode'] . '该发货单未找到或状态不允许发货');
 
                 if (!isset($sale_infos[$order_out_infos[$value['outCode']]['orderCode']])) throw new Exception($value['outCode'] . '该发货单对应的销售单未找到');
+                
+                //判断发货单是否重复
+                if (isset($temp_out_codes[$value['outCode']])) {
+                    Db::rollback();
+                    return app_show(1005, '下列发货申请单号重复', $value);
+                } else $temp_out_codes[$value['outCode']] = $value['outCode'];
 
                 //【发货单】
                 //查询已有发货单信息及状态