Browse Source

细节再优化

wufeng 2 years ago
parent
commit
8dd01599dc
2 changed files with 21 additions and 22 deletions
  1. 21 1
      app/admin/controller/After.php
  2. 0 21
      app/admin/controller/AfterChild.php

+ 21 - 1
app/admin/controller/After.php

@@ -598,7 +598,27 @@ class After extends Base
                 if ($param['status'] == 10) $info['loop_total'] += 1;//只要走到节点10(业务公司修改,待供应商确认),就增加次数
 
                 //判断 退回供应商 or 退回业务公司
-                if ($info['status'] == 2 && $param['status'] == 11) $info['return_tag'] = 2;
+                if ($info['status'] == 2 && $param['status'] == 11) {
+                    $info['return_tag'] = 2;
+
+                    //退入次品仓,维护
+                    $wsm = Db::name('warehouse_info')->where(['is_del' => 0, 'wsm_code' => $param['wsm_code']])->findOrEmpty();
+                    if (empty($wsm)) throw new Exception('返回仓库不存在');
+
+                    Db::name('order_returninfo')->insert([
+                        'returnCode' => $param['returnCode'],
+                        'return_wsm' => $param['wsm_code'],
+                        'contactor' => $wsm['contactor_name'],
+                        'mobile' => $wsm['mobile'],
+                        'addr' => $wsm['addr'],
+                        'addr_code' => $wsm['addrs_code'],
+                        'post_code' => '',
+                        'post_company' => '',
+                        'post_fee' => 0,
+                        'gys_remark' => '',
+                        'addtime' => $date,
+                    ]);
+                }
                 else $info['return_tag'] = 1;
 
                 $var = $info['status'];

+ 0 - 21
app/admin/controller/AfterChild.php

@@ -518,27 +518,6 @@ class AfterChild extends Base
                 ->where(['is_del' => 0, 'returnCode' => $param['returnCode'], 'status' => 12])
                 ->update(['status' => 5, 'updatetime' => $date]);
 
-            $ins = [];
-            foreach ($info as $child) {
-
-                //    ->column('a.id,a.return_wsm_code,a.outChildCode,b.wsm_code,a.status,a.return_num,c.addr,c.addrs_code,c.mobile,c.contactor_name', 'a.id');
-                $ins[] = [
-                    'returnCode' => $param['returnCode'],
-                    'return_wsm' => $child['return_wsm_code'],
-                    'contactor' => $child['contactor_name'],
-                    'mobile' => $child['mobile'],
-                    'addr' => $child['addr'],
-                    'addr_code' => $child['addrs_code'],
-                    'post_code' => '',
-                    'post_company' => '',
-                    'post_fee' => '',
-                    'gys_remark' => '',
-                    'addtime' => $date,
-                ];
-
-            }
-            if ($ins) Db::name('order_returninfo')->insertAll($ins);
-
             Db::commit();
             return json_show(0, '库管收货成功');
         } catch (Exception $exception) {