Browse Source

发货申请单优化

wufeng 2 years ago
parent
commit
cb907c47a7

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

@@ -644,25 +644,25 @@ class Order extends HomeBaseController
 
 
                                             //库存品,推给库管和库管-张凯旋
-                                            if($is_stock[$v_outCode['orderCode']] == 1){
-                                                $roleid = config('app.wsm_cgder_role');
-                                                $uids = Db::name('user_role')
-                                                    ->where('is_del', 0)
-                                                    ->whereIn('roleid', $roleid)
-                                                    ->column('uid');
-                                                ProcessOrder::AddProcess(['id' => $uid, 'nickname' => $nickname], [
-                                                    "order_type" => 'CKD',
-                                                    "order_code" => $v_outCode['outCode'],//出库单号
-                                                    "order_id" => $v_outCode['id'],
-                                                    "order_status" => 1,
-                                                    "before_status" => 0,
-//                                                    'wait_id' => $wait['personid'],
-//                                                    'wait_name' => $wait['person'],
-//                                                    'holder_id' => $wait['personid'],
-                                                    'handle_user_list' => implode(',', $uids)
-                                                ]);
-                                            }else{
-                                                //非库存品和采返商品,推给供应商负责人
+//                                            if($is_stock[$v_outCode['orderCode']] == 1){
+//                                                $roleid = config('app.wsm_cgder_role');
+//                                                $uids = Db::name('user_role')
+//                                                    ->where('is_del', 0)
+//                                                    ->whereIn('roleid', $roleid)
+//                                                    ->column('uid');
+//                                                ProcessOrder::AddProcess(['id' => $uid, 'nickname' => $nickname], [
+//                                                    "order_type" => 'CKD',
+//                                                    "order_code" => $v_outCode['outCode'],//出库单号
+//                                                    "order_id" => $v_outCode['id'],
+//                                                    "order_status" => 1,
+//                                                    "before_status" => 0,
+////                                                    'wait_id' => $wait['personid'],
+////                                                    'wait_name' => $wait['person'],
+////                                                    'holder_id' => $wait['personid'],
+//                                                    'handle_user_list' => implode(',', $uids)
+//                                                ]);
+//                                            }else{
+                                                //推给供应商负责人
                                                 $wait = $supplier_cgderid[$cgdinfo[$cgdNo]['supplierNo']];
                                                 ProcessOrder::AddProcess(['id' => $uid, 'nickname' => $nickname], [
                                                     "order_type" => 'CKD',
@@ -674,7 +674,7 @@ class Order extends HomeBaseController
                                                     'wait_name' => $wait['person'],
                                                     'holder_id' => $wait['personid'],
                                                 ]);
-                                            }
+//                                            }
 
                                         }
                                     }

+ 44 - 34
app/admin/controller/Purchin.php

@@ -370,11 +370,11 @@ class Purchin extends Base
                                     }else{
 
                                         //查询是否有非库存品订单
-                                        $is_stock = Db::name('sale')
-                                            ->where([
-                                                ['is_del','=',0],
-                                                ['orderCode','in',array_column($out,'orderCode')]
-                                            ])->column('is_stock','orderCode');
+//                                        $is_stock = Db::name('sale')
+//                                            ->where([
+//                                                ['is_del','=',0],
+//                                                ['orderCode','in',array_column($out,'orderCode')]
+//                                            ])->column('is_stock','orderCode');
 
                                         $supplier = Db::name('supplier')
                                             ->field('person,personid')
@@ -389,38 +389,48 @@ class Purchin extends Base
                                                 "action_type" => "status"//新建create,编辑edit,更改状态status
                                             ], "CKD", 1, $this->post);
 
-                                            if ($is_stock[$v_outCode['orderCode']] == 1) {
-                                                //库存品,推给库管和库管-张凯旋
-                                                $roleid = config('app.wsm_cgder_role');
-                                                $uids = Db::name('user_role')
-                                                    ->where('is_del', 0)
-                                                    ->whereIn('roleid', $roleid)
-                                                    ->column('uid');
-                                                ProcessOrder::AddProcess(['id' => $this->uid, 'nickname' => $this->uname], [
-                                                    "order_type" => 'CKD',
-                                                    "order_code" => $v_outCode['outCode'],//出库单号
-                                                    "order_id" => $v_outCode['id'],
-                                                    "order_status" => 1,
-                                                    "before_status" => 0,
+//                                            if ($is_stock[$v_outCode['orderCode']] == 1) {
+//                                                //库存品,推给库管和库管-张凯旋
+//                                                $roleid = config('app.wsm_cgder_role');
+//                                                $uids = Db::name('user_role')
+//                                                    ->where('is_del', 0)
+//                                                    ->whereIn('roleid', $roleid)
+//                                                    ->column('uid');
+//                                                ProcessOrder::AddProcess(['id' => $this->uid, 'nickname' => $this->uname], [
+//                                                    "order_type" => 'CKD',
+//                                                    "order_code" => $v_outCode['outCode'],//出库单号
+//                                                    "order_id" => $v_outCode['id'],
+//                                                    "order_status" => 1,
+//                                                    "before_status" => 0,
+////                                                    'wait_id' => $supplier['personid'],
+////                                                    'wait_name' => $supplier['person'],
+////                                                    'holder_id' => $supplier['personid'],
+//                                                    'handle_user_list' => implode(',', $uids)
+//                                                ]);
+//                                            } else {
+//                                                //非库存品和采返商品,推给供应商负责人
+//                                                ProcessOrder::AddProcess(['id' => $this->uid, 'nickname' => $this->uname], [
+//                                                    "order_type" => 'CKD',
+//                                                    "order_code" => $v_outCode['outCode'],//出库单号
+//                                                    "order_id" => $v_outCode['id'],
+//                                                    "order_status" => 1,
+//                                                    "before_status" => 0,
 //                                                    'wait_id' => $supplier['personid'],
 //                                                    'wait_name' => $supplier['person'],
 //                                                    'holder_id' => $supplier['personid'],
-                                                    'handle_user_list' => implode(',', $uids)
-                                                ]);
-                                            } else {
-                                                //非库存品和采返商品,推给供应商负责人
-                                                ProcessOrder::AddProcess(['id' => $this->uid, 'nickname' => $this->uname], [
-                                                    "order_type" => 'CKD',
-                                                    "order_code" => $v_outCode['outCode'],//出库单号
-                                                    "order_id" => $v_outCode['id'],
-                                                    "order_status" => 1,
-                                                    "before_status" => 0,
-                                                    'wait_id' => $supplier['personid'],
-                                                    'wait_name' => $supplier['person'],
-                                                    'holder_id' => $supplier['personid'],
-                                                ]);
-                                            }
-                                        }
+//                                                ]);
+//                                            }
+                                            //推给供应商负责人
+                                            ProcessOrder::AddProcess(['id' => $this->uid, 'nickname' => $this->uname], [
+                                                "order_type" => 'CKD',
+                                                "order_code" => $v_outCode['outCode'],//出库单号
+                                                "order_id" => $v_outCode['id'],
+                                                "order_status" => 1,
+                                                "before_status" => 0,
+                                                'wait_id' => $supplier['personid'],
+                                                'wait_name' => $supplier['person'],
+                                                'holder_id' => $supplier['personid'],
+                                            ]);
 
                                         }
                                     }

+ 65 - 65
app/admin/controller/Sale.php

@@ -408,7 +408,7 @@ class Sale extends Base
 
                                 if($out['status']==1 ){
                                     //节点1待库管发货
-                                    if($data['is_stock']==0){
+//                                    if($data['is_stock']==0){
                                         //非库存品,推给供应商负责人
                                         $supp = Db::name('supplier')
                                             ->field('person,personid')
@@ -423,20 +423,20 @@ class Sale extends Base
                                             'wait_id'=>$supp['personid'],
                                             'wait_name'=>$supp['person'],
                                         ]);
-                                    }else{
-                                        //库存品,推给31库管和41库管-张凯旋
-                                        $uids = Db::name('user_role')
-                                            ->where(['is_del' => 0, 'roleid' => config('app.wsm_cgder_role'), 'status' => 1])
-                                            ->column('uid');
-                                        ProcessOrder::AddProcess(['id'=>$rm,'nickname'=>$ri], [
-                                            "order_type" => 'CKD',
-                                            "order_code" => $outCode,//出库单号
-                                            "order_id" => $ou,
-                                            "order_status" => $out['status'],
-                                            "before_status" => $out['status'],
-                                            'handle_user_list' => implode(',', $uids),
-                                        ]);
-                                    }
+//                                    }else{
+//                                        //库存品,推给31库管和41库管-张凯旋
+//                                        $uids = Db::name('user_role')
+//                                            ->where(['is_del' => 0, 'roleid' => config('app.wsm_cgder_role'), 'status' => 1])
+//                                            ->column('uid');
+//                                        ProcessOrder::AddProcess(['id'=>$rm,'nickname'=>$ri], [
+//                                            "order_type" => 'CKD',
+//                                            "order_code" => $outCode,//出库单号
+//                                            "order_id" => $ou,
+//                                            "order_status" => $out['status'],
+//                                            "before_status" => $out['status'],
+//                                            'handle_user_list' => implode(',', $uids),
+//                                        ]);
+//                                    }
                                 }else{
                                     ProcessOrder::AddProcess(['id'=>$rm,'nickname'=>$ri], [
                                         "order_type" => 'CKD',
@@ -807,23 +807,23 @@ class Sale extends Base
                         $process=[];
                         if($status == 1){
                             //库存品,推给库管和库管-张凯旋
-                            if($etid['is_stock']==1){
-                                $roleid = config('app.wsm_cgder_role');
-                                $uids = Db::name('user_role')
-                                    ->where('is_del', 0)
-                                    ->whereIn('roleid', $roleid)
-                                    ->column('uid');
-                                $process=[
-                                    "order_type" => 'CKD',
-                                    "order_code" => $outCode,//出库单号
-                                    "order_id" => $ou,
-                                    "order_status" => $status,
-                                    "before_status" => 0,
-//                                    'holder_id'=>$out['apply_id'],
-                                    'handle_user_list' => implode(',', $uids)
-                                ];
-                            }else{
-                                //非库存品,推给供应商负责人
+//                            if($etid['is_stock']==1){
+//                                $roleid = config('app.wsm_cgder_role');
+//                                $uids = Db::name('user_role')
+//                                    ->where('is_del', 0)
+//                                    ->whereIn('roleid', $roleid)
+//                                    ->column('uid');
+//                                $process=[
+//                                    "order_type" => 'CKD',
+//                                    "order_code" => $outCode,//出库单号
+//                                    "order_id" => $ou,
+//                                    "order_status" => $status,
+//                                    "before_status" => 0,
+////                                    'holder_id'=>$out['apply_id'],
+//                                    'handle_user_list' => implode(',', $uids)
+//                                ];
+//                            }else{
+                                //推给供应商负责人
                                 $supplier = Db::name('supplier')
                                     ->field('person,personid')
                                     ->where('code',$cgdinfo['supplierNo'])
@@ -838,7 +838,7 @@ class Sale extends Base
                                     'wait_name'=>$supplier['person'],
                                     'holder_id'=>$supplier['personid'],
                                 ];
-                            }
+//                            }
                         }
 
                         if(empty($process)) $process=[
@@ -2920,16 +2920,16 @@ class Sale extends Base
                 //库存品——>推到库管,非库存品——>推送供应商负责人
                 $order=[];
                 if($data['status'] == 1){
-                    if($der['is_stock'] == 1){
-                        //库存品,推给库管和库管-张凯旋
-                        $roleid = config('app.wsm_cgder_role');
-                        $uids = Db::name('user_role')
-                            ->where('is_del', 0)
-                            ->whereIn('roleid', $roleid)
-                            ->column('uid');
-                        $order = ["order_type" => "CKD", "order_code" => $outCode, "order_id" => $datainfo, "order_status" => $data['status'], "before_status" => 0, 'handle_user_list' => implode(',', $uids)];
-                    }else{
-                        //非库存品和采返商品,推给供应商负责人
+//                    if($der['is_stock'] == 1){
+//                        //库存品,推给库管和库管-张凯旋
+//                        $roleid = config('app.wsm_cgder_role');
+//                        $uids = Db::name('user_role')
+//                            ->where('is_del', 0)
+//                            ->whereIn('roleid', $roleid)
+//                            ->column('uid');
+//                        $order = ["order_type" => "CKD", "order_code" => $outCode, "order_id" => $datainfo, "order_status" => $data['status'], "before_status" => 0, 'handle_user_list' => implode(',', $uids)];
+//                    }else{
+                        //推给供应商负责人
                         $supplier = Db::name('supplier')
                             ->alias('a')
                             ->field('a.id,a.person,a.personid')
@@ -2938,7 +2938,7 @@ class Sale extends Base
                             ->where('c.orderCode', $orderCode)
                             ->findOrEmpty();
                         $order = ["order_type" => "CKD", "order_code" => $outCode, "order_id" => $datainfo, "order_status" => $data['status'], "before_status" => 0, 'holder_id' => $data['apply_id'], 'wait_id' => $supplier['personid'] ?? 0, 'wait_name' => $supplier['person'] ?? ''];
-                    }
+//                    }
                 }
                 if(empty($order)) $order = ["order_type" => "CKD", "order_code" => $outCode, "order_id" => $datainfo, "order_status" => $data['status'], "before_status" => 0, 'holder_id' => $data['apply_id']];
 
@@ -3010,8 +3010,8 @@ class Sale extends Base
 
                 $order = [];
                 if ($status == 1) {
-                    //非库存品,推给供应商负责人
-                    if ($dr['is_stock'] == 0) {
+                    //推给供应商负责人
+//                    if ($dr['is_stock'] == 0) {
                         $supplier = Db::name('supplier')
                             ->alias('a')
                             ->field('a.id,a.person,a.personid')
@@ -3020,14 +3020,14 @@ class Sale extends Base
                             ->where('c.orderCode', $codeinfo['orderCode'])
                             ->findOrEmpty();
                         $order = ["order_type" => "CKD", "order_code" => $outCode, "order_id" => $codeinfo['id'], "order_status" => $codeinfo['status'], "before_status" => 0, 'holder_id' => $codeinfo['apply_id'], 'wait_id' => $supplier['personid'] ?? 0, 'wait_name' => $supplier['person'] ?? ''];
-                    } else{
-                        $roleid = config('app.wsm_cgder_role');
-                        $uids = Db::name('user_role')
-                            ->where('is_del', 0)
-                            ->whereIn('roleid', $roleid)
-                            ->column('uid');
-                        $order = ["order_type" => "CKD", "order_code" => $outCode, "order_id" => $codeinfo['id'], "order_status" => $codeinfo['status'], "before_status" => 0, 'handle_user_list' => implode(',', $uids)];
-                    }
+//                    } else{
+//                        $roleid = config('app.wsm_cgder_role');
+//                        $uids = Db::name('user_role')
+//                            ->where('is_del', 0)
+//                            ->whereIn('roleid', $roleid)
+//                            ->column('uid');
+//                        $order = ["order_type" => "CKD", "order_code" => $outCode, "order_id" => $codeinfo['id'], "order_status" => $codeinfo['status'], "before_status" => 0, 'handle_user_list' => implode(',', $uids)];
+//                    }
                 }
 
                 if (empty($order)) $order = ["order_type" => "CKD", "order_code" => $outCode, "order_id" => $codeinfo['id'], "order_status" => $codeinfo['status'], "before_status" => 0, 'holder_id' => $codeinfo['apply_id']];
@@ -3813,22 +3813,22 @@ class Sale extends Base
                     //是否库存品,待办数据推送到的人有区别,
                     $process = [];
                     if ($data['status'] == 1) {
-                        if ($der['is_stock'] == 1) {
-                            //库存品,推给库管和库管-张凯旋
-                            $roleid = config('app.wsm_cgder_role');
-                            $uids = Db::name('user_role')
-                                ->where('is_del', 0)
-                                ->whereIn('roleid', $roleid)
-                                ->column('uid');
-                            $process = ["order_type" => 'CKD', "order_code" => $data['outCode'], "order_id" => $datainfo, "order_status" => $data['status'], "before_status" => 0, 'holder_id' => $data['apply_id'], 'handle_user_list' => implode(',', $uids)];
-                        } else{
-                            //非库存品和采返商品,推给供应商负责人
+//                        if ($der['is_stock'] == 1) {
+//                            //库存品,推给库管和库管-张凯旋
+//                            $roleid = config('app.wsm_cgder_role');
+//                            $uids = Db::name('user_role')
+//                                ->where('is_del', 0)
+//                                ->whereIn('roleid', $roleid)
+//                                ->column('uid');
+//                            $process = ["order_type" => 'CKD', "order_code" => $data['outCode'], "order_id" => $datainfo, "order_status" => $data['status'], "before_status" => 0, 'holder_id' => $data['apply_id'], 'handle_user_list' => implode(',', $uids)];
+//                        } else{
+                            //推给供应商负责人
                             $supplier = Db::name('supplier')
                                 ->field('person,personid')
                                 ->where('code', $cgd['supplierNo'])
                                 ->findOrEmpty();
                             $process = ["order_type" => 'CKD', "order_code" => $data['outCode'], "order_id" => $datainfo, "order_status" => $data['status'], "before_status" => 0, 'holder_id' => $data['apply_id'], 'wait_id' => $supplier['personid'], 'wait_name' => $supplier['person'],];
-                        }
+//                        }
                     }
                     if (empty($process)) $process = ["order_type" => 'CKD', "order_code" => $data['outCode'], "order_id" => $datainfo, "order_status" => $data['status'], "before_status" => 0, 'holder_id' => $data['apply_id']];
 

+ 12 - 12
app/admin/controller/Salezx.php

@@ -594,16 +594,16 @@ class Salezx extends \app\BaseController
 
                 //是否库存品,待办数据推送到的人有区别,
                 $ord = [];
-                if ($order['is_stock'] == 1) {
-                    //库存品,推给库管和库管-张凯旋
-                    $roleid = config('app.wsm_cgder_role');
-                    $uids = Db::name('user_role')
-                        ->where('is_del', 0)
-                        ->whereIn('roleid', $roleid)
-                        ->column('uid');
-                    $ord = ["order_type" => "CKD", "order_code" => $der['outCode'], "order_id" => $der['id'], "order_status" => $der['status'], 'holder_id' => $der['apply_id'], 'handle_user_list' => implode(',', $uids)];
-                } elseif ($order['is_stock'] == 0 || $order['order_typee'] == 3) {
-                    //非库存品和采返商品,推给供应商负责人
+//                if ($order['is_stock'] == 1) {
+//                    //库存品,推给库管和库管-张凯旋
+//                    $roleid = config('app.wsm_cgder_role');
+//                    $uids = Db::name('user_role')
+//                        ->where('is_del', 0)
+//                        ->whereIn('roleid', $roleid)
+//                        ->column('uid');
+//                    $ord = ["order_type" => "CKD", "order_code" => $der['outCode'], "order_id" => $der['id'], "order_status" => $der['status'], 'holder_id' => $der['apply_id'], 'handle_user_list' => implode(',', $uids)];
+//                } elseif ($order['is_stock'] == 0 || $order['order_typee'] == 3) {
+                    //推给供应商负责人
                     $supplier = Db::name('supplier')
                         ->alias('a')
                         ->field('a.id,a.person,a.personid')
@@ -612,8 +612,8 @@ class Salezx extends \app\BaseController
                         ->where('c.orderCode', $der['orderCode'])
                         ->findOrEmpty();
                     $ord = ["order_type" => "CKD", "order_code" => $der['outCode'], "order_id" => $der['id'], "order_status" => $der['status'], 'holder_id' => $der['apply_id'], 'wait_id' => $supplier['personid'], 'wait_name' => $supplier['person']];
-                }
-                if (empty($ord)) $ord = ["order_type" => "CKD", "order_code" => $der['outCode'], "order_id" => $der['id'], "order_status" => $der['status'], 'holder_id' => $der['apply_id']];
+//                }
+//                if (empty($ord)) $ord = ["order_type" => "CKD", "order_code" => $der['outCode'], "order_id" => $der['id'], "order_status" => $der['status'], 'holder_id' => $der['apply_id']];
                 ProcessOrder::AddProcess($this->post['token'], $ord);
 //                    $send =Db::name("order_out")->where(["wsm_code"=>$der['wsm_code'],'orderCode'=>$der['orderCode']])->sum("send_num");
 //                    $order['send_num']+= $der['send_num'];

+ 17 - 17
app/command/handleYzOrderData.php

@@ -488,22 +488,22 @@ class handleYzOrderData extends Command
                                 ], "CKD", 0, $out);
 
                                 if ($out['status'] == 1) {
-                                    if ($is_stock == 1) {
-                                        //库存品,待办数据推给库管
-                                        $uids = Db::name('user_role')
-                                            ->where(['is_del' => 0, 'roleid' => config('app.wsm_cgder_role'), 'status' => 1])
-                                            ->column('uid');
-                                        ProcessOrder::AddProcess(['id' => $rm, 'nickname' => $ri], [
-                                            "order_type" => 'CKD',
-                                            "order_code" => $outCode,//出库单号
-                                            "order_id" => $ou,
-                                            "order_status" => $out['status'],
-                                            "before_status" => 0,
-                                            'holder_id' => $data['apply_id'],
-                                            'handle_user_list' => implode(',', $uids),
-                                        ]);
-                                    } else {
-                                        //非库存品推给供应商负责人
+//                                    if ($is_stock == 1) {
+//                                        //库存品,待办数据推给库管
+//                                        $uids = Db::name('user_role')
+//                                            ->where(['is_del' => 0, 'roleid' => config('app.wsm_cgder_role'), 'status' => 1])
+//                                            ->column('uid');
+//                                        ProcessOrder::AddProcess(['id' => $rm, 'nickname' => $ri], [
+//                                            "order_type" => 'CKD',
+//                                            "order_code" => $outCode,//出库单号
+//                                            "order_id" => $ou,
+//                                            "order_status" => $out['status'],
+//                                            "before_status" => 0,
+//                                            'holder_id' => $data['apply_id'],
+//                                            'handle_user_list' => implode(',', $uids),
+//                                        ]);
+//                                    } else {
+//                                        //非库存品推给供应商负责人
                                         $supp = Db::name('supplier')
                                             ->field('person,personid')
                                             ->where('code', $ct['supplierNo'])
@@ -518,7 +518,7 @@ class handleYzOrderData extends Command
                                             'wait_id' => $supp['personid'],
                                             'wait_name' => $supp['person'],
                                         ]);
-                                    }
+//                                    }
 
 
                                 }else ProcessOrder::AddProcess(['id' => $rm, 'nickname' => $ri], [