Browse Source

在订单中新增采购员、商品创建人字段,在采购单新增商品创建人字段

wufeng 2 years ago
parent
commit
0a59dd7ba1

+ 29 - 5
app/admin/controller/After.php

@@ -1362,6 +1362,8 @@ class After extends Base
             'token' => $token,
             'addtime' => date('Y-m-d H:i:s'),
             'updatetime' => date('Y-m-d H:i:s'),
+            'good_createrid' => $goodinfo['createrid'],
+            'good_creater' => $goodinfo['creater'],//商品创建人
         ]);
 //        $addrlist = isset($this->post['addrlist']) && $this->post['addrlist'] !=="" ?$this->post['addrlist']:"";
         $send_num = 0;
@@ -1383,6 +1385,11 @@ class After extends Base
 //        $ri = isset($apply_id["data"]['nickname']) ? $apply_id["data"]['nickname'] : "";
         Db::startTrans();
         try {
+            $supplier_temp_info = Db::name('supplier')
+                ->field('id,person,personid')
+                ->where('code',$cgd['supplierNo'])
+                ->findOrEmpty();
+
             $data = array_merge($old_sale, [
                 'id' => null,
                 "orderCode" => $orderCode,
@@ -1431,7 +1438,10 @@ class After extends Base
 //                'proof_id' => $old_sale['proof_id'],
 //                'paytime' => $old_sale['paytime'],
                 'returnCode' => $info['returnCode'],
-
+                'cgderid' => $supplier_temp_info['personid'],
+                'cgder' => $supplier_temp_info['person'],//采购员(供应商负责人)
+                'good_createrid' => $goodinfo['createrid'],
+                'good_creater' => $goodinfo['creater'],//商品创建人
             ]);
 
             $datainfo = Db::name('sale')->insertGetId($data);
@@ -1473,7 +1483,7 @@ class After extends Base
                         "good_num" => $good_num,
                         "spuCode" => $spuCode,
                         "companyNo" => $supplierNo,
-                        "cost_fee" => isset($good['cost_fee']) ? $good['cost_fee'] : 0,
+                        "cost_fee" => isset($goodinfo['cost_fee']) ? $goodinfo['cost_fee'] : 0,
                         'order_type' => $data['order_type'],
                         'order_source' => $data['order_source'],
                     ], $standing_book_da);
@@ -1700,7 +1710,9 @@ class After extends Base
             "order_type" => 3,//咨询商品
             "order_source" => 6,//6售后补换货
 //            'send_way'=>$zxinfo['send_way']
-            'token' => $token
+            'token' => $token,
+            'good_createrid' => $zxinfo['createrid'],
+            'good_creater' => $zxinfo['creater'],//商品创建人
         ]);
 //        $token=isset($this->post['token'])&&$this->post['token']!=""? trim($this->post['token']):"";
 //        if($token==""){
@@ -1743,6 +1755,10 @@ class After extends Base
 //                Db::rollback();
 //                return error_show(1003,"未找到咨询单信息");
 //            }
+            $supplier_temp_info = Db::name('supplier')
+                ->field('id,person,personid')
+                ->where('code',$old_cgd['supplierNo'])
+                ->findOrEmpty();
 
             $data = array_merge($old_sale, [
                 'id' => null,
@@ -1789,6 +1805,10 @@ class After extends Base
                 'returnCode' => $info['returnCode'],
 //                'total_price' => round($sale_price * $good_num, 2),
 //                'workNo'=>$workNo,
+                'cgderid' => $supplier_temp_info['personid'],
+                'cgder' => $supplier_temp_info['person'],//采购员(供应商负责人)
+                'good_createrid' => $zxinfo['createrid'],
+                'good_creater' => $zxinfo['creater'],//商品创建人
             ]);
 
             $datainfo = Db::name('sale')->insertGetId($data);
@@ -2098,7 +2118,9 @@ class After extends Base
             "order_source"=>$data['order_source'],
             "good_type"=>$data['good_type'],
             "addtime"=>date("Y-m-d H:i:s"),
-            "updatetime"=>date("Y-m-d H:i:s")
+            "updatetime"=>date("Y-m-d H:i:s"),
+            'good_createrid' => $data['createrid'],
+            'good_creater' => $data['creater'],//商品创建人
         ];
         $up =Db::name("purchease_order")->insertGetId($cg);
         if($up){
@@ -2226,7 +2248,9 @@ class After extends Base
             "order_source"=>$outinfo['order_source'],
             "good_type"=>$cgdinfo['good_type'],
             "addtime"=>date("Y-m-d H:i:s"),
-            "updatetime"=>date("Y-m-d H:i:s")
+            "updatetime"=>date("Y-m-d H:i:s"),
+            'good_createrid' => $good['createrid'],
+            'good_creater' => $good['creater'],//商品创建人
         ];
         $insetrCgd=Db::name("purchease_order")->insert($QrdCgd);
         if($insetrCgd==false) throw new  Exception('新增采购单失败');

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

@@ -990,6 +990,7 @@ class Project extends Base
         }
     }
 
+    //废弃???@wf by 22.09.01(在路由文件中没有找到这个方法)
     public function order(){
         $id = isset($this->post['id'])&& $this->post['id']!=="" ? intval($this->post['id']):"";
         if($id==""){

+ 1 - 2
app/admin/controller/Purch.php

@@ -35,8 +35,7 @@ class Purch extends Base
             // $where['status'] = $status;
             $where[]=['po.status',"=", $status];
         }
-        $cgdNo = isset($this->post['cgdNo']) && $this->post['cgdNo']!="" ? trim($this->post['cgdNo'])
-            :"";
+        $cgdNo = isset($this->post['cgdNo']) && $this->post['cgdNo']!="" ? trim($this->post['cgdNo']) :"";
         if($cgdNo!=""){
             //$where['cgdNo'] = Db::Raw("like '%{$cgdNo}%'");
             $where[]=['po.cgdNo',"like", "%{$cgdNo}%"];

+ 13 - 9
app/admin/controller/Resign.php

@@ -627,8 +627,7 @@ class Resign extends Base
             $feed['updatetime']=date("Y-m-d H:i:s");
             $up = Db::name("purchease")->update($feed);
             if($up){
-                $order=["order_type"=>'BHD',"order_code"=>$feed['bk_code'],"order_id"=>$feed['id'],
-                    "order_status"=>$feed['status'],"before_status"=>$tem];
+                $order=["order_type"=>'BHD',"order_code"=>$feed['bk_code'],"order_id"=>$feed['id'], "order_status"=>$feed['status'],"before_status"=>$tem];
                 ProcessOrder::AddProcess($this->post['token'],$order);
                 $ste = ["order_code"=>$feed['bk_code'],"status"=>$tem,"action_remark"=>'',"action_type"=>"edit"];
                 ActionLog::logAdd($this->post['token'],$ste,"BHD",$feed['status'],$feed);
@@ -653,6 +652,10 @@ class Resign extends Base
                     ActionLog::logAdd($this->post['token'],$ste,"FKD",$feed['status'],$purse);
                     $supplier = Db::name("supplier")->where(["code"=>$purse['supplier']])->find();
                     $inw = makeNo("CG");
+                    $goodinfo=Db::name('good_basic')
+                        ->field('id,createrid,creater')
+                        ->where(['is_del'=>0,'spuCode'=>$feed['spuCode']])
+                        ->findOrEmpty();
                     $data=[
                         "bkcode"=>$purse['bkcode'],
                         'cgdNo'=>$inw,
@@ -684,12 +687,13 @@ class Resign extends Base
                         'supplier_name'=>isset($supplier['name']) ? $supplier['name']:"",
                         'lasttime'=>$purse['expecttime'],
                         "addtime"=>date("Y-m-d H:i:s"),
-                        "updatetime"=>date("Y-m-d H:i:s")
+                        "updatetime"=>date("Y-m-d H:i:s"),
+                        'good_createrid' => $goodinfo['createrid'],
+                        'good_creater' => $goodinfo['creater'],//商品的创建人
                     ];
                     $in= Db::name("purchease_order")->insert($data,true);
                     if($in>0){
-                        $order=["order_type"=>'CGD',"order_code"=>$data['cgdNo'],"order_id"=>$in,
-                            "order_status"=>$data['status'],"before_status"=>0];
+                        $order=["order_type"=>'CGD',"order_code"=>$data['cgdNo'],"order_id"=>$in, "order_status"=>$data['status'],"before_status"=>0];
                         ProcessOrder::AddProcess($this->post['token'],$order);
                         $ste = ["order_code"=>$inw,"status"=>$data['status'],"action_remark"=>'',"action_type"=>"create"];
                         ActionLog::logAdd($this->post['token'],$ste,"CGD",$data['status'],$data);
@@ -812,9 +816,7 @@ class Resign extends Base
             $gold = Db::name("gold_price1")->where(["type"=>$good['noble_metal'],"is_del"=>0,"status"=>1])->order("addtime desc")
                 ->find();
           //  $weight =  $good['noble_weight']*$info['good_num'];
-            $sale_price =  round($good['demo_fee'] / $info['good_num'] + $good['open_fee'] / $info['good_num'] +
-                $good['noble_weight'] * $gold["price"] + $goodnake['cost_fee'] * $good['noble_weight']  +
-                $goodnake['package_fee'] +  $goodnake['mark_fee'] + $goodnake['cert_fee'] +$goodnake['nake_fee'] + $goodnake['delivery_fee'],2);
+            $sale_price =  round($good['demo_fee'] / $info['good_num'] + $good['open_fee'] / $info['good_num'] + $good['noble_weight'] * $gold["price"] + $goodnake['cost_fee'] * $good['noble_weight']  + $goodnake['package_fee'] +  $goodnake['mark_fee'] + $goodnake['cert_fee'] +$goodnake['nake_fee'] + $goodnake['delivery_fee'],2);
             $total_price = round($info['good_num']*$sale_price,2);
         }else{
             $sale_price = $goodnake['nake_total'];
@@ -859,7 +861,9 @@ class Resign extends Base
             "order_source" => 0,//0备库下单
             "good_type"=>1,
             "addtime"=>date("Y-m-d H:i:s"),
-            "updatetime"=>date("Y-m-d H:i:s")
+            "updatetime"=>date("Y-m-d H:i:s"),
+            'good_createrid' => $good['createrid'],
+            'good_creater' => $good['creater'],//商品创建人
         ];
         Db::startTrans();
         try{

+ 61 - 18
app/admin/controller/Sale.php

@@ -156,6 +156,11 @@ class Sale extends Base
         } else {
             $sale_price = 0;
         }
+        $supplier_info = Db::name('supplier')
+            ->field('id,person,personid')
+            ->where('code',$ct['supplierNo'])
+            ->findOrEmpty();
+
         $cgd = [
             "supplierNo" => $ct['supplierNo'],
             "companyNo" => $supplierNo,
@@ -181,8 +186,9 @@ class Sale extends Base
             "order_source" => 1,//1直接下单
             "createrid" => $ct['createrid'],
             "creater" => $ct['creater'],
-            'send_way' => 2
-
+            'send_way' => 2,
+            'good_createrid' => $goodinfo['createrid'],
+            'good_creater' => $goodinfo['creater'],//商品创建人
         ];
         $addrlist = isset($this->post['addrlist']) && $this->post['addrlist'] !== "" ? $this->post['addrlist'] : "";
         $send_num = 0;
@@ -246,7 +252,11 @@ class Sale extends Base
                 "addtime" => date("Y-m-d H:i:s"),
                 "updatetime" => date("Y-m-d H:i:s"),
                 'total_price' => round($sale_price * $good_num, 2),
-                'proof_id' => $proof_id
+                'proof_id' => $proof_id,
+                'cgderid' => $supplier_info['personid'],
+                'cgder' => $supplier_info['person'],//采购员(供应商负责人)
+                'good_createrid' => $goodinfo['createrid'],
+                'good_creater' => $goodinfo['creater'],//商品创建人
             ];
             $paytime == "" ? "" : $data['paytime'] = $paytime;
             $datainfo = Db::name('sale')->insert($data, true);
@@ -534,7 +544,9 @@ class Sale extends Base
             "order_source" => $data['order_source'],
             "good_type" => $data['good_type'],
             "addtime" => date("Y-m-d H:i:s"),
-            "updatetime" => date("Y-m-d H:i:s")
+            "updatetime" => date("Y-m-d H:i:s"),
+            'good_createrid' => $data['good_createrid'],
+            'good_creater' => $data['good_creater'],//商品创建人
         ];
         $up = Db::name("purchease_order")->insert($cg, true);
         if ($up) {
@@ -899,7 +911,9 @@ class Sale extends Base
             "is_diff" => $zxinfo['is_diff'],
             "order_type" => 3,
             "order_source" => 2,//咨询
-            'send_way' => $zxinfo['send_way']
+            'send_way' => $zxinfo['send_way'],
+            'good_createrid' => $zxinfo['createrid'],
+            'good_creater' => $zxinfo['creater'],//商品创建人id
         ];
         $token = isset($this->post['token']) && $this->post['token'] != "" ? trim($this->post['token']) : "";
         if ($token == "") {
@@ -949,6 +963,11 @@ 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,
                 "good_code" => $spuCode,
@@ -990,6 +1009,10 @@ class Sale extends Base
                 "updatetime" => date("Y-m-d H:i:s"),
                 'total_price' => round($sale_price * $good_num, 2),
                 'workNo' => $workNo,
+                'cgderid' => $supplier_temp_info['personid'],
+                'cgder' => $supplier_temp_info['person'],//采购员(采购单对应的供应商负责人)
+                'good_createrid' => $zxinfo['createrid'],
+                'good_creater' => $zxinfo['creater'],//商品创建人id
             ];
             $datainfo = Db::name('sale')->insert($data, true);
             if ($datainfo > 0) {
@@ -1457,8 +1480,14 @@ class Sale extends Base
             "order_type" => 3,//3咨询商品
             "order_source" => 3,//项目
             "send_way" => $goodinfo['send_way'],
-
+            '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'],
@@ -1498,6 +1527,10 @@ class Sale extends Base
             "addtime" => date("Y-m-d H:i:s"),
             "updatetime" => date("Y-m-d H:i:s"),
             'total_price' => round($data['sale_price'] * $data['good_num'], 2),
+            'cgderid' => $supplier_temp_info['personid'],
+            'cgder' => $supplier_temp_info['person'],//采购员(供应商负责人)
+            'good_createrid' => $goodinfo['createrid'],
+            'good_creater' => $goodinfo['creater'],//商品创建人
         ];
         $datainfo = Db::name('sale')->insert($datas, true);
         if ($datainfo > 0) {
@@ -1707,8 +1740,7 @@ class Sale extends Base
         if ($good == false) {
             return 4; //商品信息未找到
         }
-        $goodlass = Db::name("good_ladder")->where(["skuCode" => $data['skuCode'], "is_del" => 0, "status" => 1])->where([["min_num",
-            "<=", $data['good_num']]])->order("min_num desc")->find();
+        $goodlass = Db::name("good_ladder")->where(["skuCode" => $data['skuCode'], "is_del" => 0, "status" => 1])->where([["min_num", "<=", $data['good_num']]])->order("min_num desc")->find();
         if ($goodlass == false) {
             return 4;//商品信息未找到
         }
@@ -1735,6 +1767,13 @@ class Sale extends Base
         }
 
         $orderCode = makeNo("QR");
+
+
+        $supplier_temp_info = Db::name('supplier')
+            ->field('id,person,personid')
+            ->where('code',$good['supplierNo'])
+            ->findOrEmpty();
+
         $datas = [
             "orderCode" => $orderCode,
             "good_code" => $data['spuCode'],
@@ -1774,6 +1813,10 @@ class Sale extends Base
             "addtime" => date("Y-m-d H:i:s"),
             "updatetime" => date("Y-m-d H:i:s"),
             'total_price' => round($sale_price * $data['good_num'], 2),
+            'cgderid' => $supplier_temp_info['personid'],
+            'cgder' => $supplier_temp_info['person'],//采购员(供应商负责人)
+            'good_createrid' => $good['createrid'],
+            'good_creater' => $good['creater'],//商品创建人
         ];
         $datainfo = Db::name('sale')->insert($datas, true);
         if ($datainfo > 0) {
@@ -1818,7 +1861,9 @@ class Sale extends Base
                 "creater" => $good['creater'],
                 "order_type" => $good['is_stock'] == 1 ? 1 : 2,
                 'order_source' => 3,//3项目
-                'send_way' => 2
+                'send_way' => 2,
+                'good_createrid' => $good['createrid'],
+                'good_creater' => $good['creater'],//商品创建人
             ];
             if ($good['is_stock'] == 0) {
                 $bol = $this->createCgd($cgd, $standing_book_data);
@@ -1979,13 +2024,11 @@ class Sale extends Base
         if ($orderCode !== "") {
             $where[] = ['s.orderCode', "like", "%$orderCode%"];
         }
-        $apply_name = isset($this->post['apply_name']) && $this->post['apply_name'] !== "" ? trim($this->post['apply_name'])
-            : "";
+        $apply_name = isset($this->post['apply_name']) && $this->post['apply_name'] !== "" ? trim($this->post['apply_name']) : "";
         if ($apply_name !== "") {
             $where[] = ['s.apply_name', "like", "%$apply_name%"];
         }
-        $good_name = isset($this->post['good_name']) && $this->post['good_name'] !== "" ? trim($this->post['good_name'])
-            : "";
+        $good_name = isset($this->post['good_name']) && $this->post['good_name'] !== "" ? trim($this->post['good_name']) : "";
         if ($good_name !== "") {
             $where[] = ['s.good_name', "like", "%$good_name%"];
         }
@@ -2001,8 +2044,7 @@ class Sale extends Base
         if ($supplierNo !== "") {
             $where[] = ['s.supplierNo', "like", "%$supplierNo%"];
         }
-        $ordertype = isset($this->post['order_type']) && $this->post['order_type'] !== "" ? intval($this->post['order_type'])
-            : "";
+        $ordertype = isset($this->post['order_type']) && $this->post['order_type'] !== "" ? intval($this->post['order_type']) : "";
         if ($ordertype !== "") {
             $where[] = ['s.order_type', "=", $ordertype];
         }
@@ -3745,8 +3787,7 @@ class Sale extends Base
 
     public function RelaCgd($outinfo, array &$standing_book_da = [])
     {
-        $cgd = Db::name("order_bk")->where([["spuCode", "=", $outinfo['spuCode']], ["is_del", "=", 0], ["balance_num", ">=",
-            $outinfo['good_num']], ['companyNo', "=", $outinfo['companyNo']]])->lock(true)->find();
+        $cgd = Db::name("order_bk")->where([["spuCode", "=", $outinfo['spuCode']], ["is_del", "=", 0], ["balance_num", ">=", $outinfo['good_num']], ['companyNo', "=", $outinfo['companyNo']]])->lock(true)->find();
         if ($cgd == false) {
             return false;
         }
@@ -3796,7 +3837,9 @@ class Sale extends Base
             "order_source" => $outinfo['order_source'],
             "good_type" => $cgdinfo['good_type'],
             "addtime" => date("Y-m-d H:i:s"),
-            "updatetime" => date("Y-m-d H:i:s")
+            "updatetime" => date("Y-m-d H:i:s"),
+            'good_createrid' => $good['createrid'],
+            'good_creater' => $good['creater'],//商品创建人
         ];
         $insetrCgd = Db::name("purchease_order")->insert($QrdCgd);
         if ($insetrCgd == false) {

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

@@ -96,6 +96,11 @@ class Salezx extends \app\BaseController
         $ri= isset($apply_id["data"]['nickname']) ?  $apply_id["data"]['nickname'] : "";
         Db::startTrans();
       try {
+          $supplier_temp_info=Db::name("supplier")
+              ->field('id,person,personid')
+              ->where(["code"=>$good['supplierNo']])
+              ->findOrEmpty();
+
             $data=[
                 "orderCode"=>$orderCode,
                 "good_code"=>$good_code,
@@ -125,6 +130,10 @@ class Salezx extends \app\BaseController
                 "addtime"=>date("Y-m-d H:i:s"),
                 "updatetime"=>date("Y-m-d H:i:s"),
                 'total_price'=>round($goodinfo['sale_price']*$good_num,2),
+                'cgderid' => $supplier_temp_info['personid'],
+                'cgder' => $supplier_temp_info['person'],//采购员(采购单对应的供应商负责人)
+                'good_createrid' => $good['createrid'],
+                'good_creater' => $good['creater'],//商品创建人id
             ];
             $datainfo = Db::name('sale')->insert($data,true);
             $vat=[];
@@ -323,7 +332,9 @@ class Salezx extends \app\BaseController
                     "order_source"=>$data['order_source'],
                     "good_type"=>$good['good_type'],
                     "addtime"=>date("Y-m-d H:i:s"),
-                    "updatetime"=>date("Y-m-d H:i:s")
+                    "updatetime"=>date("Y-m-d H:i:s"),
+                    'good_createrid' => $good['createrid'],
+                    'good_creater' => $good['creater'],//商品创建人
                 ];
                     $up =Db::name("purchease_order")->insert($cg,true);
                     if($up){

+ 19 - 3
app/command/ImportOrderFromCHandleData.php

@@ -199,12 +199,20 @@ class ImportOrderFromCHandleData extends Command
                         "creater" => $ct['creater'],
                         'send_way' => 2,
                         'gold_price' => $ct['cgd_gold_price'],
+                        'good_createrid' => $goodinfo['createrid'],
+                        'good_creater' => $goodinfo['creater'],//商品创建人
                     ];
 
                     $send_num = $extend_data['num'];
                     $remark = $extend_data['order_remark'];
                     $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,
                         "good_code" => $spuCode,
@@ -245,6 +253,10 @@ class ImportOrderFromCHandleData extends Command
                         "addtime" => date("Y-m-d H:i:s"),
                         "updatetime" => date("Y-m-d H:i:s"),
                         'total_price' => round($sale_price * $good_num, 2),
+                        'cgderid' => $supplier_temp_info['personid'],
+                        'cgder' => $supplier_temp_info['person'],//采购员(供应商负责人)
+                        'good_createrid' => $goodinfo['createrid'],
+                        'good_creater' => $goodinfo['creater'],//商品创建人
                     ];
                     $paytime == "" ? "" : $data['paytime'] = $paytime;
                     $datainfo = Db::name('sale')->insert($data, true);
@@ -280,7 +292,7 @@ class ImportOrderFromCHandleData extends Command
 
                         } else {
                             //库存品
-                            $bol = $this->RelaCgd(['orderCode' => $orderCode, "good_num" => $good_num, "spuCode" => $spuCode, "companyNo" => $supplierNo, 'order_type' => $order_type, 'order_source' => $order_source], $standing_book_data);
+                            $bol = $this->RelaCgd(['orderCode' => $orderCode, "good_num" => $good_num, "spuCode" => $spuCode, "companyNo" => $supplierNo, 'order_type' => $order_type, 'order_source' => $order_source,'good_createrid'=>$ct['createrid'],'good_creater'=>$ct['creater']], $standing_book_data);
                             if ($bol == false) throw new Exception('库存商品关联采购单失败');
 
                             if (isset($stock)) {
@@ -507,7 +519,9 @@ class ImportOrderFromCHandleData extends Command
             "order_source" => $data['order_source'],
             "good_type" => $data['good_type'],
             "addtime" => date("Y-m-d H:i:s"),
-            "updatetime" => date("Y-m-d H:i:s")
+            "updatetime" => date("Y-m-d H:i:s"),
+            'good_createrid' => $data['good_createrid'],
+            'good_creater' => $data['good_createrid'],//商品创建人
         ];
         $up = Db::name("purchease_order")->insert($cg, true);
         if ($up) {
@@ -636,7 +650,9 @@ class ImportOrderFromCHandleData extends Command
             "order_source" => $outinfo['order_source'],
             "good_type" => $cgdinfo['good_type'],
             "addtime" => date("Y-m-d H:i:s"),
-            "updatetime" => date("Y-m-d H:i:s")
+            "updatetime" => date("Y-m-d H:i:s"),
+            'good_createrid' => $outinfo['good_createrid'],
+            'good_creater' => $outinfo['good_creater'],//商品创建人
         ];
         $insetrCgd = Db::name("purchease_order")->insert($QrdCgd);
         if ($insetrCgd == false) return false;

+ 21 - 3
app/command/handleYzOrderData.php

@@ -234,6 +234,12 @@ class handleYzOrderData extends Command
                 $rm = isset($user['id']) ? $user['id'] : 0;
                 $ri = isset($user['nickname']) ? $user['nickname'] : 'youzan';
 
+
+                $supplier_temp_info = Db::name('supplier')
+                    ->field('id,person,personid')
+                    ->where('code',$ct['supplierNo'])
+                    ->findOrEmpty();
+
                 $data = [
                     "orderCode" => $orderCode,
                     "good_code" => $spuCode,
@@ -274,6 +280,10 @@ class handleYzOrderData extends Command
                     "addtime" => date("Y-m-d H:i:s"),
                     "updatetime" => date("Y-m-d H:i:s"),
                     'total_price' => bcmul((string)$sale_price, (string)$good_num, 2),
+                    'cgderid' => $supplier_temp_info['personid'],
+                    'cgder' => $supplier_temp_info['person'],//采购员(供应商负责人)
+                    'good_createrid' => $goodinfo['createrid'],
+                    'good_creater' => $goodinfo['creater'],//商品创建人
                 ];
                 $paytime == "" ? "" : $data['paytime'] = $paytime;
                 $datainfo = Db::name('sale')->insertGetId($data);
@@ -330,6 +340,8 @@ class handleYzOrderData extends Command
                             "creater" => $ct['creater'],
                             'send_way' => 2,
                             'gold_price' => $ct['cgd_gold_price'],
+                            'good_createrid' => $goodinfo['createrid'],
+                            'good_creater' => $goodinfo['creater'],//商品创建人
                         ];
 
                         //非库存品
@@ -344,7 +356,9 @@ class handleYzOrderData extends Command
                             "spuCode" => $spuCode,
                             "companyNo" => $supplierNo,
                             'order_type' => $order_type,
-                            'order_source' => $order_source
+                            'order_source' => $order_source,
+                            'good_createrid' => $goodinfo['good_createrid'],
+                            'good_creater' => $goodinfo['good_creater'],//商品创建人
                         ];
                         $bol = $this->RelaCgd($cgd, $standing_book_data);
                         if ($bol == false) throw new Exception('库存商品关联采购单失败');
@@ -586,7 +600,9 @@ class handleYzOrderData extends Command
             "order_source" => $data['order_source'],
             "good_type" => $data['good_type'],
             "addtime" => date("Y-m-d H:i:s"),
-            "updatetime" => date("Y-m-d H:i:s")
+            "updatetime" => date("Y-m-d H:i:s"),
+            'good_createrid' => $data['good_createrid'],
+            'good_creater' => $data['good_creater'],//商品创建人
         ];
         $up = Db::name("purchease_order")->insert($cg, true);
         if ($up) {
@@ -712,7 +728,9 @@ class handleYzOrderData extends Command
             "order_source" => $outinfo['order_source'],
             "good_type" => $cgdinfo['good_type'],
             "addtime" => date("Y-m-d H:i:s"),
-            "updatetime" => date("Y-m-d H:i:s")
+            "updatetime" => date("Y-m-d H:i:s"),
+            'good_createrid' => $outinfo['good_createrid'],
+            'good_creater' => $outinfo['good_creater'],//商品创建人
         ];
         $insetrCgd = Db::name("purchease_order")->insert($QrdCgd);
         if ($insetrCgd == false) return false;