wugg 1 år sedan
förälder
incheckning
3b6325deec

+ 26 - 3
app/admin/controller/OrderOutChild.php

@@ -258,8 +258,26 @@ class OrderOutChild extends Base
 
         $list = Db::name('order_out_child')
             ->alias('a')
-            ->field('a.outChildCode 发货工单号,a.outCode 发货单编号,a.orderCode 销售订单编号,"" 供应商端,case a.status when 1 then "待发货" when 2 then "发货完成" when 3 then "已收货" when 4 then "已全部退货" end "状态" ,case a.order_type when 1 then "备库" when 2 then "非库存" when 3 then "咨询商品" when 4 then "报备商品" end "商品类型",case a.order_source when 1 then "直接下单" when 2 then "咨询" when 3 then "项目" when 4 then "平台" when 5 then "有赞" when 6 then "售后补换货" when 7 then "报备转单" when 8 then "支付渠道" end "订单来源",a.num 总数量,a.wsm_code 仓库编号,c.name 仓库名称,a.spuCode 商品成本编码,a.skuCode 商品上线编码,a.companyNo 业务公司编号,a.companyName 业务公司名称,a.customer_code 客户编号,a.customer_name 客户名称,a.supplierNo 供应商编号,a.supplierName 供应商名称,a.addtime 下单时间,a.apply_name 申请人,case p.use_type when 0 then "无" when 1 then "to B" when 2 then "to C" end 对接类型,a.post_name 物流公司,a.post_code 物流单号,a.post_fee 物流费用')
+            ->field('a.outChildCode 发货工单号,
+            a.outCode 发货单编号,
+            a.orderCode 销售订单编号,
+            "" 供应商端,
+            case a.status when 1 then "待发货" when 2 then "发货完成" when 3 then "已收货" when 4 then "已全部退货" end "状态" ,
+            case a.order_type when 1 then "备库" when 2 then "非库存" when 3 then "咨询商品" when 4 then "报备商品" end "商品类型",
+            case a.order_source when 1 then "直接下单" when 2 then "咨询" when 3 then "项目" when 4 then "平台" when 5 then "有赞" when 6 then "售后补换货" when 7 then "报备转单" when 8 then "支付渠道" end "订单来源",
+            a.num 总数量,a.wsm_code 仓库编号,
+            c.name 仓库名称,a.spuCode 商品成本编码,
+            a.skuCode 商品上线编码,a.good_name 商品名称,a.companyNo 业务公司编号,
+            a.companyName 业务公司名称,a.customer_code 客户编号,
+            a.customer_name 客户名称,a.supplierNo 供应商编号,
+            a.supplierName 供应商名称,a.addtime 下单时间,
+            a.apply_name 申请人,
+            case p.use_type when 0 then "无" when 1 then "to B" when 2 then "to C" end 对接类型,
+            a.post_name 物流公司,a.post_code 物流单号,a.post_fee 物流费用,
+            e.addr 收货地址,e.addr_code,e.contactor 收货联系人,e.mobile 联系方式,m.cgdNo 采购单号')
             ->leftJoin('warehouse_info c', 'c.wsm_code=a.wsm_code AND c.is_del=0')
+            ->leftJoin('order_addr e', 'a.addrid=e.id')
+            ->leftJoin('order_send m', 'a.outCode=m.outCode')
             ->leftJoin('sale d', 'd.orderCode=a.orderCode AND d.is_del=0')
             ->leftJoin('platform p', 'p.id=d.platform_id AND p.is_del=0')
             ->order(['a.addtime' => 'desc', 'a.id' => 'desc'])
@@ -277,8 +295,13 @@ class OrderOutChild extends Base
 //        $data = [];
         foreach ($list as &$value) {
             $value['供应商端'] = isset($supp_account[$value['供应商编号']]) ? '已开通' : '未开通';
-//            $value['company_name'] = $company_name[$value['apply_id']] ?? '';
-//            unset($value['apply_id']);
+                $addinfo =$value['addr_code']!=''?json_decode($value['addr_code'],true)??$value['addr_code']: '' ;
+                if(is_string($addinfo)&&$addinfo!=''){
+                    $addinfo=["provice_code"=>'',"city_code"=>'',"area_code"=>''];
+                    list($addinfo['provice_code'],$addinfo['city_code'],$addinfo['area_code']) = explode(",",$value['addr_code']);
+                 }
+//                $addr['addr_cn'] =GetAddr(json_encode($addinfo));
+			$value['收货地址'] = GetAddr(json_encode($addinfo)).$value['收货地址'];unset($value['addr_code']);
         }
 
         if (empty($list)) $list[] = ['没有相关可导出的数据'];

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

@@ -1311,9 +1311,12 @@ class Purch extends Base
                 $specinfo = isset($temp['specinfo']) ? json_decode($temp['specinfo'], true) : [];
 
                 $speclist = [];
-                foreach ($specinfo as $val) {
+                if(!empty($specinfo)){
+                	   foreach ($specinfo as $val) {
                     $speclist[] = $val['spec_name'] . ':' . $val['spec_value_name'];
                 }
+                }
+
                 $value['税率'] = $temp['tax'] . '%';
             } else {
                 $good_unit = Db::name('good_basic')

+ 3 - 2
app/admin/controller/User.php

@@ -436,7 +436,7 @@ class User extends Base
         $list = [];
         foreach ($data as $value) {
             $tmp_where=["uid" => $value['id'],"is_del" => 0];
-            if ($value['level'] != 1) $tmp_where['a.companyNo'] = ['', $value['companyCode']];
+            if ($value['level'] != 1) $tmp_where['a.companyNo'] = $value['companyCode'];
             $roleArr = Db::name("user_role")
                 ->alias("a")
                 ->leftJoin("role b", "a.roleid=b.id")
@@ -530,7 +530,7 @@ class User extends Base
                 $roledata = [
                     "uid" => $post['id'],
                     "roleid" => $post['roleid'],
-//                    "nickname" => $post['nickname'],
+                    "nickname" => $userinfo['data']['nickname']??"",
                     "companyNo" => $post['companyNo'] != '' ? $post['companyNo'] : '',
                     "company_type" => $company_type,
                     "is_main" => $is_main,
@@ -566,6 +566,7 @@ class User extends Base
                     ->where('id', $userrole['id'])
                     ->update([
                         "company_type" => $company_type,
+                        "nickname" => $userinfo['data']['nickname']??"",
                         "is_main" => $is_main,
                         'roleid' => $post['roleid'],
                         'updatetime' => date("Y-m-d H:i:s"),

+ 1 - 1
app/admin/model/ProcessOrder.php

@@ -50,7 +50,7 @@ class ProcessOrder extends \think\Model
         if (strtolower(app('http')->getName()) == 'abutment') $insert['source'] = 2;
 
         //区分操作账号等级
-        $insert['level'] = request()->level;
+        $insert['level'] =$uid==0?2: request()->level;
 
         if (self::insert($insert)) {
             Workflow::SaveFlow($data);

+ 1 - 2
app/command/ImportOrderFromCAnalysisData.php

@@ -9,7 +9,6 @@ use think\console\Input;
 use think\console\input\Argument;
 use think\console\input\Option;
 use think\console\Output;
-use think\Exception;
 use think\facade\Cache;
 use think\facade\Db;
 use think\facade\Validate;
@@ -37,7 +36,7 @@ class ImportOrderFromCAnalysisData extends Command
 //                ->lock(true)
                 ->find();
 
-            if (empty($rs)) throw new Exception('无符合条件的记录');
+            if (empty($rs)) throw new \Exception('无符合条件的记录');
 
             //1.数据校验
             $val = Validate::rule([

+ 33 - 29
app/command/ImportOrderFromCHandleData.php

@@ -15,7 +15,6 @@ use think\console\Input;
 use think\console\input\Argument;
 use think\console\input\Option;
 use think\console\Output;
-use think\Exception;
 use think\facade\Cache;
 use think\facade\Config;
 use think\facade\Db;
@@ -68,7 +67,7 @@ class ImportOrderFromCHandleData extends Command
                         ->find();
                 }
 
-                if (empty($extend_data)) throw new Exception('没有对应的解析数据');
+                if (empty($extend_data)) throw new \Exception('没有对应的解析数据');
 
                 //复用sale::create()方法 -- start
 
@@ -80,14 +79,14 @@ class ImportOrderFromCHandleData extends Command
                     ->where(["companyNo" => $customer_code])
                     ->find();
 
-                if ($customer == false) throw new Exception('未找到客户数据');
+                if ($customer == false) throw new \Exception('未找到客户数据');
 
                 $supplierNo = $extend_data['companyNo'];
                 $supplier = Db::connect('mysql_sys')
                     ->name("business")
                     ->where(["companyNo" => $supplierNo])
                     ->find();
-                if ($supplier == false) throw new Exception('未找到平台供应商数据');
+                if ($supplier == false) throw new \Exception('未找到平台供应商数据');
 
                 $goodtype = 1;//1正常商品
 
@@ -95,12 +94,12 @@ class ImportOrderFromCHandleData extends Command
                 $platform_id = $extend_data['platform_id'];
 			$tmp = Db::name('platform')
             ->where(['is_del' => 0, 'id' => $extend_data['platform_id']])
-            ->field('id,is_select_pay_rate')
+            ->field('id,is_select_pay_rate,status')
             ->findOrEmpty();
-        if (empty($tmp)) throw new Exception('平台不存在');
-        if ($tmp['status'] != 1) throw new Exception('平台已禁用');
-	    if($tmp['is_select_pay_rate']==1 && channel_is_company($extend_data['platform_id'],$supplierNo))
-	    	throw new Exception("平台渠道含有{$supplier['company']}");
+        if (empty($tmp)) throw new \Exception('平台不存在');
+        if ($tmp['status'] != 1) throw new \Exception('平台已禁用');
+//	    if($tmp['is_select_pay_rate']==1 && channel_is_company($extend_data['platform_id'],$supplierNo))
+//	    	throw new \Exception("平台渠道含有{$supplier['company']}");
                 $platform_order = $extend_data['platform_code'];
                 $good_num = $extend_data['num'];
                 $arrtime = $extend_data['platform_time'];
@@ -112,7 +111,7 @@ class ImportOrderFromCHandleData extends Command
                     ->where(['a.skuCode' => $extend_data['skuCode'], 'a.exam_status' =>3])//exam_status==3已上线
                     ->field("b.*,a.skuCode,a.spuCode,a.platform_code,a.plat_code")
                     ->find();
-                if ($ct == false) throw new Exception('未找到商品数据');
+                if ($ct == false) throw new \Exception('未找到商品数据');
 
                 $goodinfo = $ct;
                 $is_stock = $ct['is_stock'];
@@ -130,10 +129,10 @@ class ImportOrderFromCHandleData extends Command
 //                            ->field("a.id,a.usable_stock,a.wait_out_stock,a.wsm_code")
 //                            ->find();
 //
-//                        if ($stock == false || $stock['usable_stock'] < $good_num) throw new Exception('库存数量不足');
+//                        if ($stock == false || $stock['usable_stock'] < $good_num) throw new \Exception('库存数量不足');
 //							$stock_num =Db::name("good_stock_info")->where(["stockid"=>$stock['id']])->sum('balance_num');
 //				            if($stock_num <  $good_num){
-//				              throw new Exception('bn库存数量不足');
+//				              throw new \Exception('bn库存数量不足');
 //				            }
 //			            $stock_num = Db::name("good_stock")->alias("a")
 //			            ->leftJoin("warehouse_info b", "a.wsm_code=b.wsm_code")
@@ -141,7 +140,7 @@ class ImportOrderFromCHandleData extends Command
 //			            ->where(["spuCode" => $spuCode, "a.is_del" => 0, "a.status" => 1, "b.wsm_type" => 5, "b.companyNo" =>$supplierNo])
 //			            ->sum('balance_num');
                     if ($ct['usable_stock'] < $good_num) {
-                        throw new Exception('商品库存数量不足');
+                        throw new \Exception('商品库存数量不足');
                     }
                     $origin_price = 0;
 
@@ -151,7 +150,7 @@ class ImportOrderFromCHandleData extends Command
                         ->where([["spuCode", "=", $spuCode], ["min_num", "<=", $good_num], ["is_del", "=", 0]])
                         ->order("min_num desc")
                         ->find();
-                    if ($origin == false) throw new Exception('未找到相关成本价格');
+                    if ($origin == false) throw new \Exception('未找到相关成本价格');
 
                     $origin_price = $origin['nake_total'];
 
@@ -164,7 +163,7 @@ class ImportOrderFromCHandleData extends Command
                         ->where([["min_num", "<=", $good_num]])
                         ->order("min_num desc")
                         ->find();
-                    if ($good == false) throw new Exception('未找到相关阶梯价格');
+                    if ($good == false) throw new \Exception('未找到相关阶梯价格');
 
                     //$sale_price = $good['sale_price']; //不改动售价
 
@@ -178,7 +177,7 @@ class ImportOrderFromCHandleData extends Command
 
                         //$saleprice(最终售价) = (打样费/购买数量 + 开模费/购买数量 + 商品重量* 最新金价 + 工艺费* 商品重量+包装费+加标费+证书费+产品裸价+物流费)/(1-成本售价/100);
                         $gold_sale_price = $ct['demo_fee'] / $good_num + $ct['open_fee'] / $good_num + $ct['noble_weight'] * $gold["price"] + $good['cost_fee'] * $ct['noble_weight'] + $origin['package_fee'] + $origin['mark_fee'] + $origin['cert_fee'] + $origin['nake_fee'] + $origin['delivery_fee'];
-                        if ($sale_price < $gold_sale_price) throw new Exception('价格不符合根据实时金价计算出的最终售价');
+                        if ($sale_price < $gold_sale_price) throw new \Exception('价格不符合根据实时金价计算出的最终售价');
 
                         $ct['cgd_gold_price'] = $gold['price'];
 
@@ -194,9 +193,9 @@ class ImportOrderFromCHandleData extends Command
                             ->leftJoin("good_activity b", "a.activity_code=b.activity_code")
                             ->where(["a.skuCode" => $skuCode, "a.activity_code" => $extend_data['activity_code'], "a.is_del" => 0, "a.status" => 1, "b.status" => 6, "b.is_del" => 0])
                             ->find();
-                        if ($act == false) throw new Exception('未找到相关活动价');
-                        if ($act['moq_num'] > $good_num) throw new Exception('商品不满足活动价起订量' . $act['moq_num']);
-                        if ($act['activity_stock'] < $good_num) throw new Exception('商品活动库存剩余' . $act['activity_stock']);
+                        if ($act == false) throw new \Exception('未找到相关活动价');
+                        if ($act['moq_num'] > $good_num) throw new \Exception('商品不满足活动价起订量' . $act['moq_num']);
+                        if ($act['activity_stock'] < $good_num) throw new \Exception('商品活动库存剩余' . $act['activity_stock']);
                         //$sale_price = $act['activity_price'];//不能改动价格
                     }
                 }
@@ -248,6 +247,7 @@ class ImportOrderFromCHandleData extends Command
                     "good_code" => $spuCode,
                     "skuCode" => $skuCode,
                     "customer_code" => $customer_code,
+                    "customerName" => $customer['companyName'],
                     "good_name" => isset($goodinfo['good_name']) && $goodinfo['good_name'] !== '' ? $goodinfo['good_name'] : '',
                     "good_num" => $good_num,
                     "cat_id" => $goodinfo['cat_id'],
@@ -262,7 +262,10 @@ class ImportOrderFromCHandleData extends Command
                     "send_status" => 1,
                     "good_type" => $goodtype,
                     "send_type" => $sendtype,
-                    "supplierNo" => $extend_data['companyNo'],
+                    "supplierNo" =>$supplierNo,
+                    "supplierName" => $supplier['company']??"",
+                    "supNo" => $ct['supplierNo'],
+                    "supName" =>$supplier_temp_info['name']??"",
                     "is_del" => 0,
                     "zxNo" => "",
                     "platform_order" => $platform_order,
@@ -299,7 +302,7 @@ class ImportOrderFromCHandleData extends Command
                         $actupp = Db::name("activity_info")
                             ->where(["skuCode" => $skuCode, "activity_code" => $extend_data['activity_code'], "is_del" => 0, "status" => 1])
                             ->save($actup);
-                        if ($actupp == false) throw new Exception('活动库存修改失败');
+                        if ($actupp == false) throw new \Exception('活动库存修改失败');
 
                     }
 
@@ -318,7 +321,7 @@ class ImportOrderFromCHandleData extends Command
 
                         //非库存品
                         $bol = $this->createCgd($cgd, $rm, $ri, $standing_book_data);
-                        if ($bol == false) throw new Exception('订单创建失败');
+                        if ($bol == false) throw new \Exception('订单创建失败');
 
                     }
                     else {
@@ -329,7 +332,7 @@ class ImportOrderFromCHandleData extends Command
                         ];
                         $update = Db::name("good")->where(["spuCode" => $ct['spuCode'], "usable_stock" => $ct['usable_stock']])->update($stockUp);
                         if ($update == false) {
-                            throw new Exception('商品更新可用库存失败');
+                            throw new \Exception('商品更新可用库存失败');
                         }
 
                     }
@@ -356,7 +359,7 @@ class ImportOrderFromCHandleData extends Command
                                 $order = Db::name("order_num")
                                     ->where(["orderCode" => $orderCode, "status" => 1])
                                     ->find();
-                                if ($order == false) throw new Exception('未找到可以发货得采购单数据');
+                                if ($order == false) throw new \Exception('未找到可以发货得采购单数据');
 	                                $tep = [
 	                                    "cgdNo" => $order['cgdNo'],
 	                                    "outCode" => $outCode,
@@ -366,10 +369,10 @@ class ImportOrderFromCHandleData extends Command
 	                                    "updatetime" => date("Y-m-d H:i:s")
 	                                ];
 	                                $sen = Db::name("order_send")->save($tep);
-	                                if ($sen == false) throw new Exception('发货地址添加创建失败');
+	                                if ($sen == false) throw new \Exception('发货地址添加创建失败');
 
 	                                $cgdinfo = Db::name("purchease_order")->where(["cgdNo" => $order['cgdNo']])->find();
-	                                if ($cgdinfo == false) throw new Exception('未匹配到采购数据');
+	                                if ($cgdinfo == false) throw new \Exception('未匹配到采购数据');
 
                             	}
 
@@ -389,11 +392,12 @@ class ImportOrderFromCHandleData extends Command
                                 "wsm_code" => $is_stock == 1 ? '' : $cgdinfo['wsm_code'],
                                 "order_type" => $order_type,
                                 "status" => $is_stock == 1 ? 1 : 0,
+                                "send_status" => $is_stock == 1 ? 1 : 0,
                                 "addtime" => date("Y-m-d H:i:s"),
                                 "updatetime" => date("Y-m-d H:i:s")
                             ];
                             $ou = Db::name("order_out")->insertGetId($out);
-                            if ($ou == false) throw new Exception('发货地址添加创建失败');
+                            if ($ou == false) throw new \Exception('发货地址添加创建失败');
                             else {
                             if($is_stock == 1)OrderOutChild::makeChild($outCode);//非库存品无法立即分单
 
@@ -427,7 +431,7 @@ class ImportOrderFromCHandleData extends Command
 
                                 $standing_book_data['outCode'] = $outCode;
                             }
-                        } else throw new Exception('发货地址添加失败');
+                        } else throw new \Exception('发货地址添加失败');
                     }
                 }
 
@@ -472,7 +476,7 @@ class ImportOrderFromCHandleData extends Command
 
                 $output->writeln(date('Y-m-d H:i:s') . '|处理成功');
 
-                } catch (\think\Exception $exception) {
+                } catch (\Exception $exception) {
                     Db::rollback();
                     $order_import_from_c_db
                         ->where(['id' => $c_data['id'], 'status' => OIFCModel::$status_wait_relation])

+ 4 - 4
app/command/InterMakeOrder.php

@@ -60,10 +60,10 @@ class InterMakeOrder extends Command
         $payinfo = Db::name("platform")->where(["id"=> $param['platform_id'],"is_del"=>0])->findOrEmpty();
             if (empty($payinfo)) throw new \Exception("未找到平台信息");
             if ($payinfo['status'] != 1) throw new \Exception("平台信息已禁用");
-            if($payinfo['is_select_pay_rate']==1){
-	            $supplierArr = Db::name("platform_pay_rate")->where(["platform_id" => $param['platform_id'], "status" => 1, "is_del" => 0])->column("companyNo");
-	            if (in_array($param['companyNo'], $supplierArr)) throw new \Exception("平台支付渠道含有该业务公司,平台无法使用!");
-            }
+//            if($payinfo['is_select_pay_rate']==1){
+//	            $supplierArr = Db::name("platform_pay_rate")->where(["platform_id" => $param['platform_id'], "status" => 1, "is_del" => 0])->column("companyNo");
+//	            if (in_array($param['companyNo'], $supplierArr)) throw new \Exception("平台支付渠道含有该业务公司,平台无法使用!");
+//            }
 		$supplierinfo = $userCommon->handle("hqInfo",["code"=>$param['supplierNo']]);
 		if(!isset($supplierinfo['data'])|| empty($supplierinfo['data']))throw new \Exception("未找到供应商数据");
 		$person =$supplierinfo['data']['child']??["person"=>'',"person_id"=>0];

+ 2 - 1
app/command/SplitSale.php

@@ -36,7 +36,7 @@ class SplitSale extends Command
 
             if ($rs) return true;
 
-            Cache::store('redis')->set($key, 1, 60 * 5);
+            Cache::store('redis')->set($key, 1, 60 * 15);
 
             Db::startTrans();
 
@@ -100,6 +100,7 @@ class SplitSale extends Command
                     //支付渠道相关信息
                     $pay_rates = Db::name('pay_log')
                         ->where(['is_del' => 0, 'pay_id' => $sale['pay_id'], 'orderCode' => $sale['orderCode']])
+	                    ->where( 'companyNo', 'not in',["KH","GYS"])
                         ->field(true)
                         ->order(['weight' => 'desc'])
                         ->select()

+ 5 - 176
app/command/handleYzOrderData.php

@@ -41,34 +41,9 @@ class handleYzOrderData extends Command
             Db::startTrans();
             try {
 
-//                //判断价格是否符合系统售价
-//                $platform_yz_info = Db::name('platform_youzan')
-//                    ->field('id,sale_price,platform_id')
-//                    ->where(['skuCode' => $c_data['skuCode'], 'is_del' => 0])
-//                    ->findOrEmpty();
-
-//                if ($c_data['discount_price'] < $platform_yz_info['sale_price'] && $c_data['is_approved'] == '0') {
-//                    Db::rollback();
-//                    $this->callbackYz(['status' => 2, 'id' => $c_data['id'], 'reason' => '价格低于系统售价' . $platform_yz_info['sale_price']]);
-//                    Cache::store('redis')->set("YzTimeLimit",0);
-//                    return false;//停止执行后续代码
-//                }
 
                 $standing_book_data = [];
 
-//                //先找用户确认信息
-//                $extend_data = Db::name('order_import_from_c_extend')
-//                    ->where(['order_import_from_c_id' => $c_data['id'], 'is_del' => 0, 'type' => 2])
-//                    ->find();
-//                if (empty($extend_data)) {
-//                    $extend_data = Db::name('order_import_from_c_extend')
-//                        ->where(['order_import_from_c_id' => $c_data['id'], 'is_del' => 0, 'type' => 1])
-//                        ->find();
-//                }
-//
-//                if (empty($extend_data)) throw new Exception('没有对应的解析数据');
-
-                //复用sale::create()方法 -- start
 
                 $orderCode = makeNo("QR");
 
@@ -81,7 +56,7 @@ class handleYzOrderData extends Command
                     ->leftJoin('customer_org1 co', 'co.name=p.platform_name AND co.is_del=0')
                     ->leftJoin('good g', 'g.spuCode=py.spuCode AND g.is_del=0')
                     ->where('py.skuCode', $c_data['skuCode'])
-                    ->where('py.exam_status', 3)//exam_status==3已上线
+                    ->where('py.exam_status', 6)//exam_status==3已上线
                     ->find();
 
                 if ($ct) {
@@ -94,22 +69,7 @@ class handleYzOrderData extends Command
 
                 } else throw new Exception('未找到商品数据');
 
-
-//                $customer_code = $customer_code = Db::name('customer_info')
-//                    ->where(['itemid' => $ct['id'], 'companyName' => $ct['name'] . '客户', 'is_del' => 0])
-//                    ->value('companyNo', '');
-//
-//                $customer = Db::name("customer_info")
-//                    ->where(["companyNo" => $customer_code])
-//                    ->find();
-
-//                if ($customer == false) throw new Exception('未找到客户数据');
-
                 $supplierNo = $ct['companyNo'];
-//                $supplier = Db::name("business")
-//                    ->where(["companyNo" => $supplierNo])
-//                    ->find();
-//                if ($supplier == false) throw new Exception('未找到平台供应商数据');
 
                 $goodtype = 1;//1正常商品
 
@@ -119,15 +79,7 @@ class handleYzOrderData extends Command
                 $platform_order = $c_data['tid'];
                 $good_num = $c_data['num'];
                 $arrtime = $paytime = $c_data['addtime'];
-//                $paytime = $c_data['addtime'];
-//                $workNo = $extend_data['po_code'];
-//                $ct = Db::name('good_platform')
-//                    ->alias('a')
-//                    ->join('good b', 'b.spuCode=a.spuCode', 'left')
-//                    ->where(['a.skuCode' => $extend_data['skuCode'], 'a.exam_status' => 6])//exam_status==6已上线
-//                    ->field("b.*,a.skuCode,a.spuCode,a.platform_code,a.plat_code")
-//                    ->find();
-//                if ($ct == false) throw new Exception('未找到商品数据');
+
 
                 $goodinfo = $ct;
                 $is_stock = $ct['is_stock'];
@@ -135,26 +87,9 @@ class handleYzOrderData extends Command
                 $order_source = 5;//有赞
                 $spuCode = $ct['spuCode'];
                 $skuCode = $ct['skuCode'];
-//                $is_activity = empty($extend_data['activity_name']) ? 0 : 1;
+
 
                 if ($is_stock == 1) {
-//                    $stock = Db::name("good_stock")
-//                        ->alias("a")
-//                        ->leftJoin("warehouse_info b", "a.wsm_code=b.wsm_code")
-//                        ->where(["spuCode" => $spuCode, "a.is_del" => 0, "a.status" => 1, 'b.wsm_type' => 5, "b.companyNo" => $supplierNo])
-//                        ->field("a.id,a.usable_stock,a.wait_out_stock")
-//                        ->find();
-//
-//                    if ($stock == false || $stock['usable_stock'] < $good_num) throw new Exception('库存数量不足');
-//                    $stock_num = 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_num>0")
-//                        ->where(["spuCode" => $spuCode, "a.is_del" => 0, "a.status" => 1, "b.wsm_type" => 5, "b.companyNo" => $supplierNo])
-//                        ->sum('balance_num');
-//                    if ($stock_num < $good_num) {
-//                        throw new Exception('bn库存数量不足');
-//                    }
                     if($ct['usable_stock'] < $good_num){
 			               throw new Exception('商品库存数量不足');
 			            }
@@ -171,26 +106,6 @@ class handleYzOrderData extends Command
 
                 }
 
-
-                //活动相关信息
-//                $act = Db::name('activity_info')
-//                    ->alias('ai')
-//                    ->field('ai.id,ai.activity_stock,ai.moq_num,ai.activity_stock')
-//                    ->join('good_activity ga', 'ga.activity_code=ai.activity_code')
-//                    ->where([
-//                        'ai.skuCode' => $skuCode,
-//                        'ai.spuCode' => $spuCode,
-//                        'ai.is_del' => 0,
-//                        'ai.status' => 1,
-//                        'ga.status' => 6,
-//                        'ga.is_del' => 0,
-//                        'ga.platform_code' => $platform_id,
-//                        'ga.is_stock' => $is_stock
-//                    ])
-//                    ->where(function ($query) {
-//                        return $query->where('ga.start', '<=', date('Y-m-d H:i:s'))->where('ga.end', '>=', date('Y-m-d H:i:s'));
-//                    })
-//                    ->find();
 				$is_activity = 0;
                 $sale_price = $c_data['discount_price'];
 	            if (isset($c_data['coupon']) && is_discount($c_data['coupon'])) {
@@ -205,8 +120,6 @@ class handleYzOrderData extends Command
                 if (!empty($act)) {
                     $is_activity = 1;
                     $sale_price = $act['final_price'];//取活动的相关价格
-//                    if ($act['moq_num'] > $good_num) throw new Exception('商品不满足活动价起订量' . $act['moq_num']);
-//                    if ($act['activity_stock'] < $good_num) throw new Exception('商品活动库存剩余' . $act['activity_stock']);
                 }else{
 
 	                if ($sale_price < $ct['sale_price'] && $c_data['is_approved'] == '0') {
@@ -218,51 +131,6 @@ class handleYzOrderData extends Command
 
                 }
 
-//                $is_activity = (int)(!empty($act));
-
-//                if ($is_activity == 1) {
-//                    $act = Db::name("activity_info")
-//                        ->alias("a")
-//                        ->leftJoin("good_activity b", "a.activity_code=b.activity_code")
-//                        ->where(["a.skuCode" => $skuCode, "a.activity_code" => $extend_data['activity_code'], "a.is_del" => 0, "a.status" => 1, "b.status" => 6, "b.is_del" => 0])
-//                        ->find();
-//                    if ($act == false) throw new Exception('未找到相关活动价');
-//                    if ($act['moq_num'] > $good_num) throw new Exception('商品不满足活动价起订量' . $act['moq_num']);
-//                    if ($act['activity_stock'] < $good_num) throw new Exception('商品活动库存剩余' . $act['activity_stock']);
-                //$sale_price = $act['activity_price'];//不能改动价格
-//                }
-
-
-
-
-//                if ($goodtype == 1) {
-//                    $good = Db::name("good_ladder")
-//                        ->where(["skuCode" => $skuCode, "is_del" => 0, "status" => 1])
-//                        ->where([["min_num", "<=", $good_num]])
-//                        ->order("min_num desc")
-//                        ->find();
-//                    if ($good == false) throw new Exception('未找到相关阶梯价格');
-
-                //$sale_price = $good['sale_price']; //不改动售价
-
-                //理论上不会出现实时金价的订单
-//                    if ($ct['is_gold_price'] == 1 && $is_stock != 1) {
-//                        $gold = Db::name("gold_price1")
-//                            ->field('id,price')
-//                            ->where(["type" => $ct['noble_metal'], "is_del" => 0, "status" => 1])
-//                            ->order("addtime desc")
-//                            ->find();
-//
-//                        //$saleprice(最终售价) = (打样费/购买数量 + 开模费/购买数量 + 商品重量* 最新金价 + 工艺费* 商品重量+包装费+加标费+证书费+产品裸价+物流费)/(1-成本售价/100);
-//                        $gold_sale_price = $ct['demo_fee'] / $good_num + $ct['open_fee'] / $good_num + $ct['noble_weight'] * $gold["price"] + $good['cost_fee'] * $ct['noble_weight'] + $origin['package_fee'] + $origin['mark_fee'] + $origin['cert_fee'] + $origin['nake_fee'] + $origin['delivery_fee'];
-//                        if ($sale_price < $gold_sale_price) throw new Exception('价格不符合根据实时金价计算出的最终售价');
-//
-//                        $ct['cgd_gold_price'] = $gold['price'];
-//
-//                    }
-
-
-//                }
 
 
                 $remark = $c_data['buyer_messages'];
@@ -398,47 +266,7 @@ class handleYzOrderData extends Command
                         if ($bol == false) throw new Exception('订单创建失败');
 
                     } else {
-                        //库存品
-//                        $cgd = [
-//                            'orderCode' => $orderCode,
-//                            "good_num" => $good_num,
-//                            "spuCode" => $spuCode,
-//                            "companyNo" => $supplierNo,
-//                            'order_type' => $order_type,
-//                            'order_source' => $order_source,
-//                            'good_createrid' => $goodinfo['createrid'],
-//                            'good_creater' => $goodinfo['creater'],//商品创建人
-//                        ];
-//                        $bol = $this->RelaCgd($cgd, $standing_book_data);
-//                        if ($bol == false) throw new Exception('库存商品关联采购单失败');
-
-//                        if (isset($stock)) {
-//                            $stck = [
-//                                "usable_stock" => $stock['usable_stock'] - $good_num,
-//                                "wait_out_stock" => $stock['wait_out_stock'] + $good_num,
-//                                "updatetime" => date("Y-m-d H:i:s")
-//                            ];
-//                            $upad = Db::name("good_stock")
-//                                ->where($stock)
-//                                ->update($stck);
-//                            if ($upad == false) throw new Exception('库存商品更新库存失败');
-//		                        $stockinfo =GoodStockInfo::OrderBn($orderCode,$stock['id'],$good_num);
-//		                    if($stockinfo==false){
-//		                             Db::rollback();
-//		                            return error_show(1002, "Bn库存更新库存失败");
-//		                     }
-//                            //商品变动日志表,good_log_code字段存储采购单号
-//                            $good_data[] = ['good_log_code' => $orderCode, "stock_id" => $datainfo, "type" => 2, 'stock' => $good_num, "stock_name" => "usable_stock"];
-//                            $good_data[] = ['good_log_code' => $orderCode, "stock_id" => $datainfo, "type" => 1, 'stock' => $good_num, "stock_name" => "wait_out_stock"];
-//                            GoodLog::LogAdd(['id' => $rm, 'nickname' => $ri], $good_data, "XSQRD");
-//                        }
-//                        $stockid = Db::name("good_stock")->alias("a")
-//                            ->leftJoin("warehouse_info b", "a.wsm_code=b.wsm_code")
-//                            ->where(["spuCode" => $spuCode, "a.is_del" => 0, "a.status" => 1, "b.wsm_type" => 5, "b.companyNo" => $supplierNo])
-//                            ->column('a.id');
-//                        $stockinfo = GoodStockInfo::OrderBn($orderCode, $stockid, intval($good_num));
-//                        if ($stockinfo == false)  throw new Exception('库存商品更新库存失败');
-					 //库存品
+
 	                        $stockUp =[
 		                        "usable_stock"=>$ct['usable_stock']-$good_num,
 		                        "updatetime"=>date("Y-m-d H:i:s"),
@@ -522,6 +350,7 @@ class handleYzOrderData extends Command
                                 "wsm_code" => $is_stock==1? '':$cgdinfo['wsm_code'],
                                 "order_type" => $order_type,
                                 "status" => $is_stock == 1 ? 1 : 0,
+                                "send_status" => $is_stock == 1 ? 1 : 0,
                                 "addtime" => date("Y-m-d H:i:s"),
                                 "updatetime" => date("Y-m-d H:i:s")
                             ];