소스 검색

发货单优化

wufeng 2 년 전
부모
커밋
c0dabaadb4
4개의 변경된 파일21개의 추가작업 그리고 32개의 파일을 삭제
  1. 1 10
      app/abutment/controller/Order.php
  2. 2 10
      app/admin/controller/Purchin.php
  3. 17 11
      app/admin/controller/Sale.php
  4. 1 1
      app/admin/route/app.php

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

@@ -661,7 +661,7 @@ class Order extends HomeBaseController
 //                                                    'holder_id' => $wait['personid'],
                                                     'handle_user_list' => implode(',', $uids)
                                                 ]);
-                                            }elseif ($is_stock[$v_outCode['orderCode']] == 0 || $cgdinfo[$cgdNo]['order_type']==3){
+                                            }else{
                                                 //非库存品和采返商品,推给供应商负责人
                                                 $wait = $supplier_cgderid[$cgdinfo[$cgdNo]['supplierNo']];
                                                 ProcessOrder::AddProcess(['id' => $uid, 'nickname' => $nickname], [
@@ -674,15 +674,6 @@ class Order extends HomeBaseController
                                                     'wait_name' => $wait['person'],
                                                     'holder_id' => $wait['personid'],
                                                 ]);
-                                            }else{
-                                                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,
-                                                    'holder_id' => $v_outCode['apply_id']
-                                                ]);
                                             }
 
                                         }

+ 2 - 10
app/admin/controller/Purchin.php

@@ -407,7 +407,7 @@ class Purchin extends Base
 //                                                    'holder_id' => $supplier['personid'],
                                                     'handle_user_list' => implode(',', $uids)
                                                 ]);
-                                            } elseif ($is_stock[$v_outCode['orderCode']] == 0 || $cgdinfo['order_type'] = 3) {
+                                            } else {
                                                 //非库存品和采返商品,推给供应商负责人
                                                 ProcessOrder::AddProcess(['id' => $this->uid, 'nickname' => $this->uname], [
                                                     "order_type" => 'CKD',
@@ -419,16 +419,8 @@ class Purchin extends Base
                                                     'wait_name' => $supplier['person'],
                                                     'holder_id' => $supplier['personid'],
                                                 ]);
-                                            } 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,
-                                                    'holder_id' => $v_outCode['apply_id']
-                                                ]);
                                             }
+                                        }
 
                                         }
                                     }

+ 17 - 11
app/admin/controller/Sale.php

@@ -822,8 +822,8 @@ class Sale extends Base
 //                                    'holder_id'=>$out['apply_id'],
                                     'handle_user_list' => implode(',', $uids)
                                 ];
-                            }elseif ($etid['is_stock']==0 || $etid['order_type']==3){
-                                //非库存品和采返商品,推给供应商负责人
+                            }else{
+                                //非库存品,推给供应商负责人
                                 $supplier = Db::name('supplier')
                                     ->field('person,personid')
                                     ->where('code',$cgdinfo['supplierNo'])
@@ -2928,7 +2928,7 @@ class Sale extends Base
                             ->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)];
-                    }elseif ($der['is_stock'] == 0 || $der['order_type'] == 3){
+                    }else{
                         //非库存品和采返商品,推给供应商负责人
                         $supplier = Db::name('supplier')
                             ->alias('a')
@@ -3010,8 +3010,8 @@ class Sale extends Base
 
                 $order = [];
                 if ($status == 1) {
-                    //非库存品和采返商品,推给供应商负责人
-                    if ($dr['order_type'] == 3 || $dr['is_stock'] == 0) {
+                    //非库存品,推给供应商负责人
+                    if ($dr['is_stock'] == 0) {
                         $supplier = Db::name('supplier')
                             ->alias('a')
                             ->field('a.id,a.person,a.personid')
@@ -3020,7 +3020,7 @@ 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'] ?? ''];
-                    } elseif ($dr['is_stock'] == 1) {
+                    } else{
                         $roleid = config('app.wsm_cgder_role');
                         $uids = Db::name('user_role')
                             ->where('is_del', 0)
@@ -3393,6 +3393,7 @@ class Sale extends Base
         return app_show(0, "获取成功", $info);
     }
 
+    //发货申请单列表
     public function saleout()
     {
         $page = isset($this->post['page']) && $this->post['page'] !== "" ? intval($this->post['page']) : "1";
@@ -3455,9 +3456,14 @@ class Sale extends Base
 //                    $role['write']) . ")";
 //        }
 
-        $role = $this->checkDataShare();
-        if (!empty($role[DataGroupModel::$type_全部])) $condition .= " (b.is_stock=1 and n.contactor = {$this->uid}) or (b.is_stock=0 and wpo.cgder_id = {$this->uid}) or a.apply_id in (" . implode(',', $role[DataGroupModel::$type_全部]) . ")";
+//        $role = $this->checkDataShare();
+//        if (!empty($role[DataGroupModel::$type_全部])) $condition .= " (b.is_stock=1 and n.contactor = {$this->uid}) or (b.is_stock=0 and wpo.cgder_id = {$this->uid}) or a.apply_id in (" . implode(',', $role[DataGroupModel::$type_全部]) . ")";
 
+        //库管只能看到库存品订单,供应商负责人只能看到非库存品订单
+        if(!in_array($this->roleid,[1,33])){
+            if(in_array($this->roleid,config('app.wsm_cgder_role'))) $condition .="a.apply_id = {$this->uid} or (b.is_stock=1 and n.contactor = {$this->uid})";
+            else $condition.="a.apply_id = {$this->uid} or (b.is_stock=0 and wpo.cgder_id = {$this->uid})";
+        }
 //        if(!empty($role['platform']) ){
 //            $where[]=["b.platform_id","in",$role['platform']];
 //        }
@@ -3538,8 +3544,8 @@ class Sale extends Base
             $value['sendtime'] = $value['status'] < 2 ? '' : $value['sendtime'];
 
             //是否具有编辑权限
-            $value['is_allow_update'] = 0;
-            if (in_array($this->roleid, [1, 33]) || in_array($value['apply_id'], $role[DataGroupModel::$type_可编辑])) $value['is_allow_update'] = 1;
+//            $value['is_allow_update'] = 0;
+//            if (in_array($this->roleid, [1, 33]) || in_array($value['apply_id'], $role[DataGroupModel::$type_可编辑])) $value['is_allow_update'] = 1;
 
             $data[] = $value;
         }
@@ -3815,7 +3821,7 @@ class Sale extends Base
                                 ->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)];
-                        } elseif ($der['is_stock'] == 0 || $der['order_type'] == 3) {
+                        } else{
                             //非库存品和采返商品,推给供应商负责人
                             $supplier = Db::name('supplier')
                                 ->field('person,personid')

+ 1 - 1
app/admin/route/app.php

@@ -100,7 +100,7 @@ Route::rule('salestatus','admin/Sale/status');
 Route::rule('salefee','admin/Sale/fee');
 Route::rule('saleout','admin/Sale/out');
 Route::rule('salecustomer','admin/Sale/customer');
-Route::rule('xsaleout','admin/Sale/saleout');
+Route::rule('xsaleout','admin/Sale/saleout');//发货申请单列表
 Route::rule('saleoutinfo','admin/Sale/outinfo');
 Route::rule('saleaddr','admin/Sale/addAddr');
 Route::rule('salegetprice','admin/Sale/getPrice');