Browse Source

发货单申请优化

wufeng 2 years ago
parent
commit
2fada70479
3 changed files with 93 additions and 104 deletions
  1. 19 19
      app/abutment/controller/Order.php
  2. 28 39
      app/admin/controller/Purchin.php
  3. 46 46
      app/admin/controller/Sale.php

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

@@ -644,24 +644,24 @@ 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], [
@@ -674,7 +674,7 @@ class Order extends HomeBaseController
                                                     'wait_name' => $wait['person'],
                                                     'holder_id' => $wait['personid'],
                                                 ]);
-//                                            }
+                                            }
 
                                         }
                                     }

+ 28 - 39
app/admin/controller/Purchin.php

@@ -389,48 +389,37 @@ 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,
-////                                                    '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,
+                                            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'],
-//                                                ]);
-//                                            }
-                                            //推给供应商负责人
-                                            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'],
+                                                ]);
+                                            }
 
                                         }
                                     }

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

@@ -807,22 +807,22 @@ 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')
@@ -838,7 +838,7 @@ class Sale extends Base
                                     'wait_name'=>$supplier['person'],
                                     'holder_id'=>$supplier['personid'],
                                 ];
-//                            }
+                            }
                         }
 
                         if(empty($process)) $process=[
@@ -2920,15 +2920,15 @@ 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')
@@ -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']];
 
@@ -3011,7 +3011,7 @@ 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']];