wugg 1 年間 前
コミット
764bc97f41
1 ファイル変更7 行追加8 行削除
  1. 7 8
      app/admin/controller/AfterChild.php

+ 7 - 8
app/admin/controller/AfterChild.php

@@ -216,9 +216,8 @@ class AfterChild extends Base
         ]);
         $defective_sum =array_sum(array_column($param['list'],"defective_num"));
         if($defective_sum>0){
-        	$defective_wsm = Db::name("warehouse_info")->where(["companyNo"=>$order_return['companyNo'],
-        	"wsm_type"=>4,"is_del"=>0,"status"=>1])->findOrEmpty();
-        	if(empty($defective_wsm)) return  json_show(1004, '退货工单次品仓库不存在');
+        	$defective_wsm = Db::name("order_returninfo")->where(["returnCode"=>$param['returnCode']])->findOrEmpty();
+        	if(empty($defective_wsm)|| $defective_wsm['return_wsm']=='') return  json_show(1004, '退货工单次品仓库不存在');
         }
 
         Db::startTrans();
@@ -271,7 +270,7 @@ class AfterChild extends Base
                         'send_wsm_code' => $info[$value['id']]['send_wsm_code'],
                         'send_num' => $info[$value['id']]['send_num'],
                         'return_num' => $info[$value['id']]['return_num'],
-                        'return_wsm_code' => $defective_wsm['wsm_code'],
+                        'return_wsm_code' => $defective_wsm['return_wsm'],
                         'can_sell_num' => $value['can_sell_num'],
                         'defective_num' => $value['defective_num'],
                         'loss_num' => $value['loss_num'],
@@ -451,14 +450,14 @@ class AfterChild extends Base
                     }
 					if($defective_sum>0){
 	                    $defective_stock= Db::name('good_stock')
-	                    ->where(['is_del' => 0, 'spuCode' => $spuCode, 'wsm_code' => $defective_wsm['wsm_code']])
+	                    ->where(['is_del' => 0, 'spuCode' => $spuCode, 'wsm_code' => $defective_wsm['return_wsm']])
 	                    ->findOrEmpty();
 	                    if(empty($defective_stock)){
 	                         $defective_stockid = Db::name('good_stock')
 	                                ->insertGetId([
 	                                    'project_code' => '',
 	                                    'spuCode' => $spuCode,
-	                                    'wsm_code' => $defective_wsm['wsm_code'],
+	                                    'wsm_code' => $defective_wsm['return_wsm'],
 	                                    'wait_in_stock' => 0,
 	                                    'wait_out_stock' => 0,
 	                                    'usable_stock' => $defective_sum,
@@ -561,14 +560,14 @@ class AfterChild extends Base
                         ->column('id', 'wsm_code');
 					if($defective_sum>0){
 	                    $defective_stock= Db::name('good_stock')
-	                    ->where(['is_del' => 0, 'spuCode' => $spuCode, 'wsm_code' => $defective_wsm['wsm_code']])
+	                    ->where(['is_del' => 0, 'spuCode' => $spuCode, 'wsm_code' => $defective_wsm['return_wsm']])
 	                    ->findOrEmpty();
 	                    if(empty($defective_stock)){
 	                         $defective_stockid = Db::name('good_stock')
 	                                ->insertGetId([
 	                                    'project_code' => '',
 	                                    'spuCode' => $spuCode,
-	                                    'wsm_code' => $defective_wsm['wsm_code'],
+	                                    'wsm_code' => $defective_wsm['return_wsm'],
 	                                    'wait_in_stock' => 0,
 	                                    'wait_out_stock' => 0,
 	                                    'usable_stock' => $defective_sum,