Browse Source

Merge branch 'wugg-dev' of wugg/phpstock into version1.5

wugg 2 years ago
parent
commit
39a7eec503
1 changed files with 17 additions and 10 deletions
  1. 17 10
      app/admin/controller/Sale.php

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

@@ -782,7 +782,7 @@ class Sale extends Base
                         "sendtime" => date("Y-m-d H:i:s"),
                         "send_num" => $num,
                         "check_num" => 0,
-                        "error_num" => 1,
+                        "error_num" => 0,
                         "wsm_code" => $cgdinfo['wsm_code']??'',
                         "order_type" => $etid['order_type'],
                         "status" => $status,
@@ -4419,7 +4419,11 @@ class Sale extends Base
         $status = [0 => '待发货', 1 => '待库管发货', 2 => '已发货待收货', 3 => '已收货', 4 => '已全部退货'];
         $list = Db::name("order_out")
             ->alias('a')
-            ->field('"" as 序号,a.addtime as 创建时间,po.cgdNo as 采购单编号,po.status as 采购单状态,po.cgder as 采购员,b.orderCode as 确认单号,b.addtime as 确认单时间,b.good_code as 产品编号,b.good_name as 产品名称,"" as 规格,"" as 单位,po.supplier_name as 供应商名称,po.supplierNo as 供应商编号,po.nake_fee as 裸价,a.post_fee as 物流费,b.send_type as 发货方式,po.good_price as 采购单价,b.remark as 确认单备注,po.good_num as 采购数量,po.total_fee as 采购货款,a.send_num 发货数量,oa.contactor as 收货人,oa.mobile as 联系方式,oa.addr as 收货地址,oa.addr_code,oa.arrive_time as 到货时间,a.outCode as 发货申请单号,po.order_type,b.platform_order 平台订单号,a.post_name 发货申请单物流公司,a.post_code 发货申请单物流单号,a.post_fee 发货申请单物流费用,a.remark 发货申请单备注,a.apply_name 申请人,b.cat_id 商品分类')
+            ->field('"" as 序号,a.addtime as 创建时间,po.cgdNo as 采购单编号,po.status as 采购单状态,po.cgder as 采购员,b.orderCode as 确认单号,b.addtime as 确认单时间,
+            b.good_code as 产品编号,b.good_name as 产品名称,"" as 规格,"" as 单位,po.supplier_name as 供应商名称,po.supplierNo as 供应商编号,po.nake_fee as 裸价,
+            a.post_fee as 物流费,b.send_type as 发货方式,po.good_price as 采购单价,b.remark as 确认单备注,po.good_num as 采购数量,po.total_fee as 采购货款,a.send_num 发货数量,
+            oa.contactor as 收货人,oa.mobile as 联系方式,oa.addr as 收货地址,oa.addr_code,oa.arrive_time as 到货时间,a.outCode as 发货申请单号,po.order_type,
+            b.platform_order 平台订单号,a.post_name 发货申请单物流公司,a.post_code 发货申请单物流单号,a.post_fee 发货申请单物流费用,a.remark 发货申请单备注,a.apply_name 申请人,b.cat_id 商品分类')
             ->whereIn('a.outCode', $outCodes)
             ->order("a.addtime desc")
             ->withAttr('序号', function () use (&$i) {
@@ -4439,21 +4443,20 @@ class Sale extends Base
         foreach ($list as &$value) {
 
             if ($value['order_type'] == 3) {
-                $temp = Db::name("good_zixun")
+                $good = Db::name("good_zixun")
                     ->where(["spuCode" => $value['产品编号'], "is_del" => 0])
-                    ->field('id,specinfo,good_unit')
+                    ->field('id,specinfo,good_unit,supplierNo')
                     ->find();
-                $good_unit = isset($temp['good_unit']) ? $temp['good_unit'] : 0;
-                $specinfo = isset($temp['specinfo']) ? json_decode($temp['specinfo'], true) : [];
-
+                $specinfo = isset($good['specinfo']) ? json_decode($good['specinfo'], true) : [];
                 $speclist = [];
                 foreach ($specinfo as $val) {
                     $speclist[] = $val['spec_name'] . ':' . $val['spec_value_name'];
                 }
             } else {
-                $good_unit = Db::name('good_basic')
+                $good = Db::name('good_basic')
                     ->where(['spuCode' => $value['产品编号']])
-                    ->value('good_unit', 0);
+                    ->field('good_unit,supplierNo')
+                    ->find();
                 $spec = Db::name("good_spec")
                     ->field('id,spec_id,spec_value_id')
                     ->where(["spuCode" => $value['产品编号'], "is_del" => 0])
@@ -4466,7 +4469,11 @@ class Sale extends Base
                     }
                 }
             }
-
+            $value['供应商编号'] = $good['supplierNo']??"";
+            $supplier= Db::name("supplier")->where(["code"=>$value['供应商编号']])->field("name,person")->find();
+            $value['供应商名称'] =  $supplier['name']??"";
+            $value['采购员'] = $supplier['person']??"";
+            $good_unit = isset($good['good_unit']) ? $good['good_unit'] : 0;
             $value['规格'] = empty($speclist) ? '' : implode(',', $speclist);;
             $value['单位'] = $good_unit ? Db::name('unit')->where(['id' => $good_unit, 'is_del' => 0])->value('unit', '') : '';
             $value['商品分类'] = implode('/', array_column(made($value['商品分类']), 'name'));