Browse Source

Merge branch 'version1.5' into dev_wf

wufeng 2 years ago
parent
commit
368b78d04c

+ 1 - 0
app/admin/controller/Allot.php

@@ -440,6 +440,7 @@ class Allot extends Base
             return error_show(1002,"删除失败");
         }
     }
+    // 0 待发起流程 1 待入库方同意 2 待出库方发货 3待入库方验货 4待验货审核 5 调拨完成  6 调拨驳回
     public function status(){
         $id = isset($this->post['id']) && $this->post['id'] !=="" ? intval($this->post['id']) :"" ;
         if($id==""){

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

@@ -148,16 +148,16 @@ class Resign extends Base
         }
         $supplier=Db::name("supplier")->where("code","=",$good['supplierNo'])->find();
         if($supplier==false)  return error_show(1004,"未找到供应商数据");
-        $bk= Db::name("purchease")->where([["spuCode","=",$good_code],["status","<>",2],["is_del","=",0]])->find();
-        if($bk!=false) return error_show(1004,"存在未完成备库单数据");
-        $cgd =Db::name("purchease_order")->where([["spuCode","=",$good_code],["status","in",[0,1]],["is_del","=",0]])->find();
-        if($cgd!=false) return error_show(1004,"存在未完成采购单数据");
+//        $bk= Db::name("purchease")->where([["spuCode","=",$good_code],["status","<>",2],["is_del","=",0]])->find();
+//        if($bk!=false) return error_show(1004,"存在未完成备库单数据");
+//        $cgd =Db::name("purchease_order")->where([["spuCode","=",$good_code],["status","in",[0,1]],["is_del","=",0]])->find();
+//        if($cgd!=false) return error_show(1004,"存在未完成采购单数据");
         //查验仓库库存数量
         $stock =Db::name("good_stock")->alias("a")->leftJoin("warehouse_info b","a.wsm_code=b.wsm_code")->where
         (["spuCode"=>$good_code, "a.is_del"=>0,"a.status"=>1,"b.companyNo"=>$good['companyNo']])->field("a.id,a.usable_stock,a.wait_out_stock")->find();
-        if(isset($stock['usable_stock'])&& $stock['usable_stock']!=0){
-            return error_show(1003,"库存数量为 {$stock['usable_stock']} 无法备库");
-        }
+//        if(isset($stock['usable_stock'])&& $stock['usable_stock']!=0){
+//            return error_show(1003,"库存数量为 {$stock['usable_stock']} 无法备库");
+//        }
         //校验数量
         $goodnake = Db::name("good_nake")
             ->field('id,min_num')
@@ -244,11 +244,11 @@ class Resign extends Base
             return error_show($data['code'],$data['message']);
         }
         //查验仓库库存数量
-        $stock =Db::name("good_stock")->alias("a")->leftJoin("warehouse_info b","a.wsm_code=b.wsm_code")->where
-        (["spuCode"=>$info['spuCode'], "a.is_del"=>0,"a.status"=>1,"b.companyNo"=>$info['companyNo']])->field("a.id,a.usable_stock,a.wait_out_stock")->find();
-        if(isset($stock['usable_stock'])&& $stock['usable_stock']!=0){
-            return error_show(1003,"库存数量为 {$stock['usable_stock']} 无法备库");
-        }
+//        $stock =Db::name("good_stock")->alias("a")->leftJoin("warehouse_info b","a.wsm_code=b.wsm_code")->where
+//        (["spuCode"=>$info['spuCode'], "a.is_del"=>0,"a.status"=>1,"b.companyNo"=>$info['companyNo']])->field("a.id,a.usable_stock,a.wait_out_stock")->find();
+//        if(isset($stock['usable_stock'])&& $stock['usable_stock']!=0){
+//            return error_show(1003,"库存数量为 {$stock['usable_stock']} 无法备库");
+//        }
         $userinfo = $data['data'];
         $bk_code=makeNo("BK");
         $info['bk_code']=$bk_code;

+ 19 - 22
app/admin/controller/Sale.php

@@ -184,8 +184,8 @@ class Sale extends Base
             "gold_price" => isset($ct['cgd_gold_price']) ? $ct['cgd_gold_price'] : 0,
             "order_type" => $is_stock == 1 ? 1 : 2,
             "order_source" => 1,//1直接下单
-            "createrid" => $ct['createrid'],
-            "creater" => $ct['creater'],
+            "createrid" =>$supplier_info['personid'],
+            "creater" =>$supplier_info['person'],
             'send_way' => 2,
             'good_createrid' => $goodinfo['createrid'],
             'good_creater' => $goodinfo['creater'],//商品创建人
@@ -871,7 +871,10 @@ class Sale extends Base
             return error_show(1003, "业务公司数据未找到");
         }
         $remark = isset($this->post['remark']) && $this->post['remark'] != "" ? trim($this->post['remark']) : "";
-
+		 $supplier_temp_info=Db::name("supplier")
+                ->field('id,person,personid')
+                ->where(["code"=>$zxinfo['supplierNo']])
+                ->findOrEmpty();
         $orderCode = makeNo("QR");
         $spuCode = $zxinfo['spuCode'];
         $skuCode = "";
@@ -894,8 +897,8 @@ class Sale extends Base
             "nake_fee" => $zxinfo['nake_fee'],
             "delivery_fee" => $zxinfo['delivery_fee'],
             "good_num" => $good_num,
-            "createrid" => $zxinfo['createrid'],
-            "creater" => $zxinfo['creater'],
+            "createrid" =>$supplier_temp_info['personid'],
+            "creater" =>$supplier_temp_info['person'],
             "good_type" => 1,
             "weight" => $zxinfo['good_weight'],
             "gold_price" => $zxinfo['gold_price'],
@@ -954,10 +957,6 @@ class Sale extends Base
                     return error_show(1003, "咨询单更新业务公司失败");
                 }
             }
-            $supplier_temp_info=Db::name("supplier")
-                ->field('id,person,personid')
-                ->where(["code"=>$zxinfo['supplierNo']])
-                ->findOrEmpty();
 
             $data = [
                 "orderCode" => $orderCode,
@@ -1451,7 +1450,11 @@ class Sale extends Base
             return false;
         }
         $orderCode = makeNo("QR");
-        $cgd = [
+        $supplier_temp_info = Db::name('supplier')
+            ->field('id,person,personid')
+            ->where('code',$goodinfo['supplierNo'])
+            ->findOrEmpty();
+		 $cgd = [
             "supplierNo" => $goodinfo['supplierNo'],
             "companyNo" => $data['companyNo'],
             "spuCode" => $data['spuCode'],
@@ -1469,8 +1472,8 @@ class Sale extends Base
             "nake_fee" => $goodinfo['nake_fee'],
             "good_num" => $data['good_num'],
             "delivery_fee" => $goodinfo['delivery_fee'],
-            "createrid" => $goodinfo['createrid'],
-            "creater" => $goodinfo['creater'],
+            "createrid" =>$supplier_temp_info['personid'],
+            "creater" =>$supplier_temp_info['person'],
             "weight" => $goodinfo['good_weight'],
             "gold_price" => $goodinfo['gold_price'],
             "good_type" => 1,
@@ -1480,11 +1483,6 @@ class Sale extends Base
             'good_createrid' => $goodinfo['createrid'],
             'good_creater' => $goodinfo['creater'],//商品创建人
         ];
-        $supplier_temp_info = Db::name('supplier')
-            ->field('id,person,personid')
-            ->where('code',$goodinfo['supplierNo'])
-            ->findOrEmpty();
-
         $datas = [
             "orderCode" => $orderCode,
             "good_code" => $data['spuCode'],
@@ -1860,8 +1858,8 @@ class Sale extends Base
                 "good_type" => 1,
                 "weight" => $good['noble_weight'],
                 "gold_price" => isset($good['cgd_gold_price']) ? $good['cgd_gold_price'] : 0,
-                "createrid" => $good['createrid'],
-                "creater" => $good['creater'],
+                "createrid" => $supplier_temp_info['personid'],
+                "creater" => $supplier_temp_info['person'],
                 "order_type" => $good['is_stock'] == 1 ? 1 : 2,
                 'order_source' => 3,//3项目
                 'send_way' => 2,
@@ -1887,7 +1885,7 @@ class Sale extends Base
 //            }
             $stock_arr = Db::name("good_stock")->alias("a")
 	            ->leftJoin("warehouse_info b", "a.wsm_code=b.wsm_code")
-	            ->leftJoin("good_stock_info c", "a.id=c.stockid and c.balance_name>0")
+	            ->leftJoin("good_stock_info c", "a.id=c.stockid and c.balance_num>0")
 	            ->where(["spuCode" => $good['spuCode'], "a.is_del" => 0, "a.status" => 1, "b.wsm_type" => 5, "b.companyNo" =>$data['companyNo']])
 	            ->column('stockid,balance_num');
                 $stock_num = array_sum(array_column($stock_arr,"balance_num"));
@@ -3347,8 +3345,7 @@ class Sale extends Base
             // $where[]=["a.apply_id","in",$role['write']];
             $cgdArr =\think\facade\Config::get("app");
         	$cgdids =implode(",",$cgdArr['wsm_cgder_role']);
-            $condition .= " (b.is_stock=1 and {$this->roleid} in ($cgdids)) or (b.is_stock=0 and wpo.cgder_id = {$this->uid}) or a.apply_id in (" . implode(',',
-                    $role['write']) . ")";
+            $condition .= " (b.is_stock=1 and {$this->roleid} in ($cgdids)) or (b.is_stock=0 and wpo.cgder_id = {$this->uid}) or a.apply_id in (" . implode(',', $role['write']) . ")";
         }
 //        if(!empty($role['platform']) ){
 //            $where[]=["b.platform_id","in",$role['platform']];

+ 6 - 6
app/command/ImportOrderFromCHandleData.php

@@ -192,6 +192,10 @@ class ImportOrderFromCHandleData extends Command
                             //$sale_price = $act['activity_price'];//不能改动价格
                         }
                     }
+                     $supplier_temp_info = Db::name('supplier')
+                        ->field('id,person,personid')
+                        ->where('code', $ct['supplierNo'])
+                        ->findOrEmpty();
                     $cgd = [
                         "supplierNo" => $ct['supplierNo'],
                         "companyNo" => $supplierNo,
@@ -213,8 +217,8 @@ class ImportOrderFromCHandleData extends Command
                         "good_type" => $goodtype,
                         "order_type" => $order_type,
                         "order_source" => $order_source,
-                        "createrid" => $ct['createrid'],
-                        "creater" => $ct['creater'],
+                        "createrid" =>$supplier_temp_info['personid'],
+                         "creater" =>$supplier_temp_info['person'],
                         'send_way' => 2,
                         'gold_price' => $ct['cgd_gold_price'],
                         'good_createrid' => $goodinfo['createrid'],
@@ -227,10 +231,6 @@ class ImportOrderFromCHandleData extends Command
                     $rm = $c_data['createrid'];
                     $ri = $c_data['creater'];
 
-                    $supplier_temp_info = Db::name('supplier')
-                        ->field('id,person,personid')
-                        ->where('code', $ct['supplierNo'])
-                        ->findOrEmpty();
 
                     $data = [
                         "orderCode" => $orderCode,

+ 2 - 2
app/command/handleYzOrderData.php

@@ -345,8 +345,8 @@ class handleYzOrderData extends Command
                             "good_type" => $goodtype,
                             "order_type" => $order_type,
                             "order_source" => $order_source,
-                            "createrid" => $ct['createrid'],
-                            "creater" => $ct['creater'],
+                            "createrid" =>$supplier_temp_info['personid'],
+                             "creater" =>$supplier_temp_info['person'],
                             'send_way' => 2,
                             'gold_price' => $ct['cgd_gold_price'],
                             'good_createrid' => $goodinfo['createrid'],