Browse Source

发货单中拆单状态变动

wufeng 2 years ago
parent
commit
6d71df8228

+ 1 - 1
app/abutment/controller/Order.php

@@ -362,7 +362,7 @@ class Order extends HomeBaseController
 
 
         //补充相关名称
-        $userCommon = new User();
+        $userCommon = User::getIns();
         $names = $userCommon->handle('getCodeAndName',['code'=>$codes]);
 
         if ($data['wsm_code'] != "") {

+ 7 - 7
app/admin/controller/OrderOutChild.php

@@ -199,7 +199,7 @@ class OrderOutChild extends Base
             ->alias('a')
             ->field('a.*,b.supplierNo companyNo,b.supplierName companyName,b.customer_code,b.customerName,b.supNo supplierNo,b.supName supplierName,b.good_code,b.skuCode,b.good_name,b.order_source,b.good_num,b.wsend_num')
             ->leftJoin('sale b', 'b.orderCode=a.orderCode AND b.is_del=0')
-            ->where(['a.is_del' => 0, 'a.outCode' => $param['outCode'], 'a.send_status' => 0])
+            ->where(['a.is_del' => 0, 'a.outCode' => $param['outCode'], 'a.send_status' => 1])
             ->findOrEmpty();
 
         if (empty($info)) return json_show(1004, '该发货单不存在或状态有误');
@@ -264,8 +264,8 @@ class OrderOutChild extends Base
             }
 
             Db::name('order_out')
-                ->where(['id' => $info['id'], 'is_del' => 0, 'outCode' => $param['outCode'], 'send_status' => 0])
-                ->update(['send_status' => 1, 'status' => 1]);
+                ->where(['id' => $info['id'], 'is_del' => 0, 'outCode' => $param['outCode'], 'send_status' => 1])
+                ->update(['send_status' => 2, 'status' => 1]);
 
             Db::commit();
             return json_show(0, '分单完成');
@@ -397,16 +397,16 @@ class OrderOutChild extends Base
                 $order_out[$child[$value['outChildCode']]['outCode']]['already_send_num'] += $child[$value['outChildCode']]['num'];
 
                 //发货单
-                //send_status 2部分发货,3全部发货
+                //send_status 3部分发货,4全部发货
                 Db::name('order_out')
                     ->where(['id' => $order_out[$child[$value['outChildCode']]['outCode']]['id']])
-                    ->update(['send_status' => $order_out[$child[$value['outChildCode']]['outCode']]['already_send_num'] >= $order_out[$child[$value['outChildCode']]['outCode']]['send_num'] ? 3 : 2, 'updatetime' => $date]);
+                    ->update(['send_status' => $order_out[$child[$value['outChildCode']]['outCode']]['already_send_num'] >= $order_out[$child[$value['outChildCode']]['outCode']]['send_num'] ? 4 : 3, 'updatetime' => $date]);
 
                 $sale[$child[$value['outChildCode']]['orderCode']]['send_num'] += $child[$value['outChildCode']]['num'];
                 $sale[$child[$value['outChildCode']]['orderCode']]['wsend_num'] -= $child[$value['outChildCode']]['num'];
 
                 //销售单
-                $send_status = $sale[$child[$value['outChildCode']]['orderCode']]['send_num'] >= $sale[$child[$value['outChildCode']]['orderCode']]['good_num'] ? 3 : 2;
+                $send_status = $sale[$child[$value['outChildCode']]['orderCode']]['send_num'] >= $sale[$child[$value['outChildCode']]['orderCode']]['good_num'] ? 4 : 3;
                 Db::name('sale')
                     ->where(['is_del' => 0, 'id' => $sale[$child[$value['outChildCode']]['orderCode']]['id']])
                     ->update([
@@ -415,7 +415,7 @@ class OrderOutChild extends Base
                         'send_status' => $send_status,
                     ]);
 
-                if ($sale[$child[$value['outChildCode']]['orderCode']]['order_source'] == 5 && $send_status == 3) {
+                if ($sale[$child[$value['outChildCode']]['orderCode']]['order_source'] == 5 && $send_status == 4) {
                     $yz_tmp[] = [
                         'post_name' => $value['post_name'],
                         'post_code' => $value['post_code'],

+ 3 - 3
app/admin/controller/Purchin.php

@@ -472,7 +472,7 @@ class Purchin extends Base
                                 $out =Db::name("order_out")->where(["outCode"=>$send,"status"=>0,"is_del"=>0])->select()
                                 ->toArray();
                                 if(!empty($out)){
-                                    $up =Db::name("order_out")->where(["outCode"=>$send,"status"=>0,"is_del"=>0])->update(["status"=>1,'wsm_code'=>$cgdinfo['wsm_code'],"updatetime"=>date('Y-m-d H:i:s')]);
+                                    $up =Db::name("order_out")->where(["outCode"=>$send,"status"=>0,"is_del"=>0])->update(["status"=>1,"send_status"=>1,'wsm_code'=>$cgdinfo['wsm_code'],"updatetime"=>date('Y-m-d H:i:s')]);
                                     if($up==false){
                                         Db::rollback();
                                         return error_show(1004,"出库单出库失败");
@@ -703,8 +703,8 @@ class Purchin extends Base
                     "wsm_code" => $cgdinfo['wsm_code'],
                     "wsm_reaper" => $recep['wsm_name'] ?? '',
                     "send_num" => $item['send_num'],
-                    "post_company" => $item['post_company'],
-                    "post_code" => $item['post_code'],
+                    "post_company" => $item['post_company'] ?? '',
+                    "post_code" => $item['post_code'] ?? '',
                     "post_fee" => $item['post_fee'],
                     "sendtime" => $item['post_time'],
                     "apply_id" => $this->uid,

+ 1 - 1
app/admin/model/OrderOutChild.php

@@ -55,7 +55,7 @@ class OrderOutChild extends Model
 		];
 		$childout=self::insert($child);
 		if($childout==false)throw new \Exception("分单失败");
-		$outup=self::name("order_out")->where(["outCode"=>$outCode,"is_del"=>0])->update(["send_status"=>1,"status"=>1,"updatetime"=>date("Y-m-d H:i:s")]);
+		$outup=self::name("order_out")->where(["outCode"=>$outCode,"is_del"=>0])->update(["send_status"=>2,"status"=>1,"updatetime"=>date("Y-m-d H:i:s")]);
 		if($outup==false)throw new \Exception("发货单信息更新失败");
 		$bnadd = GoodStockInfo::ChildAddBn($child['outChildCode'],$wsmlist['id']);
 		if($bnadd==false)throw new \Exception("库存更新失败");