Browse Source

销售订单(采销的采购单)列表和详情

wufeng 2 years ago
parent
commit
8fd27cd603

+ 2 - 2
app/ExceptionHandle.php

@@ -56,8 +56,8 @@ class ExceptionHandle extends Handle
         switch (strtolower(app('http')->getName())) {
 
             case 'abutment':
-                if ($e instanceof ValidateException) return json_show(1004, $e->getMessage());
-                else return json_show(1005, $e->getMessage());
+                if ($e instanceof ValidateException) return json_show(1004, $e->getMessage());//参数错误
+                else return json_show(1005, $e->getMessage());//业务逻辑错误
                 break;
 
             default:

File diff suppressed because it is too large
+ 591 - 575
app/abutment/controller/Good.php


+ 0 - 39
app/abutment/controller/GoodUp.php

@@ -1,39 +0,0 @@
-<?php
-
-namespace app\abutment\controller;
-
-use app\abutment\logic\GoodUp as GoodUpLogic;
-use app\BaseController;
-use think\exception\ValidateException;
-use think\facade\Config;
-use think\facade\Validate;
-
-//商品上线模块
-class GoodUp extends BaseController
-{
-    //申请商品上线
-    public function create()
-    {
-        $param = $this->request->filter('trim')->only(['spuCodes', 'online_reason', 'online_remark' => '', 'platform_id'], 'post');
-
-        $val = Validate::rule(Config::get('validate_rules.GoodUpCreate'));
-
-        if (!$val->check($param)) throw new ValidateException($val->getError());
-
-        return GoodUpLogic::create($param);
-    }
-
-    //商品上线列表
-    public function list()
-    {
-        $param = $this->request->filter('trim')->only(['keyword' => '', 'page' => 1, 'size' => 15], 'post');
-
-        $val = Validate::rule(Config::get('validate_rules.common'));
-
-        if (!$val->check($param)) throw new ValidateException($val->getError());
-
-        return GoodUpLogic::list($param);
-    }
-
-
-}

+ 334 - 0
app/abutment/controller/Order.php

@@ -0,0 +1,334 @@
+<?php
+
+namespace app\abutment\controller;
+
+use app\BaseController;
+use think\facade\Db;
+
+//销售订单(对应于采销端的采购单)
+class Order extends BaseController
+{
+
+    //列表
+    public function getList()
+    {
+        $this->post = $this->request->filter('trim')->post();
+
+        $page = isset($this->post['page']) && $this->post['page'] !== "" ? intval($this->post['page']) : "1";
+        $size = isset($this->post['size']) && $this->post['size'] !== "" ? intval($this->post['size']) : "10";
+        $where = [['po.is_del', "=", 0], ['po.supplierNo', '=', $this->request->user['supplierNo']]];
+        $bkcode = isset($this->post['bk_code']) && $this->post['bk_code'] != "" ? trim($this->post['bk_code']) : "";
+        if ($bkcode != "") {
+            $where[] = ['po.bkcode', "like", "%{$bkcode}%"];
+        }
+        $status = isset($this->post['status']) && $this->post['status'] !== "" ? intval($this->post['status']) : "";
+        if ($status !== "") {
+            // $where['status'] = $status;
+            $where[] = ['po.status', "=", $status];
+        }
+        $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}%"];
+        }
+
+        $apply_name = isset($this->post['apply_name']) && $this->post['apply_name'] != "" ? trim($this->post['apply_name']) : "";
+        if ($apply_name != "") {
+            // $where['cgder'] =Db::Raw("like '%{$apply_name}%'");
+            $where[] = ['po.cgder', "like", "%{$apply_name}%"];
+        }
+        $wsm_code = isset($this->post['wsm_code']) && $this->post['wsm_code'] != "" ? trim($this->post['wsm_code']) : "";
+        if ($wsm_code != "") {
+            // $where['wsm_code'] = $wsm_code;
+            $where[] = ['po.wsm_code', "=", $wsm_code];
+        }
+        $wsm_in_code = isset($this->post['wsm_in_code']) && $this->post['wsm_in_code'] != "" ? trim($this->post['wsm_in_code']) : "";
+        if ($wsm_in_code != "") {
+            $incode = Db::name("purchease_in")->where(["wsm_in_code" => Db::raw(" like %{$wsm_in_code}%"), "is_del" => 0])->column("cgdNo");
+            if (empty($incode)) {
+                return json_show(1005, "未找到有关入库单信息");
+            }
+            $where[] = ['po.cgdNo', "in", $incode];
+        }
+        $good_name = isset($this->post['good_name']) && $this->post['good_name'] != "" ? trim($this->post['good_name']) : "";
+        if ($good_name != "") {
+            //$where['good_name'] = Db::raw(" like %{$good_name}%");
+            $where[] = ['po.good_name', "like", "%{$good_name}%"];
+        }
+        $good_code = isset($this->post['good_code']) && $this->post['good_code'] != "" ? trim($this->post['good_code']) : "";
+        if ($good_code != "") {
+            // $where['good_code'] = Db::raw(" like %{$good_code}%");
+            $where[] = ['po.spuCode', "like", "%{$good_code}%"];
+        }
+        $supplierNo = isset($this->post['supplierNo']) && $this->post['supplierNo'] != "" ? trim($this->post['supplierNo']) : "";
+        if ($supplierNo != "") {
+            // $where['good_code'] = Db::raw(" like %{$good_code}%");
+            $where[] = ['po.supplierNo', "like", "%{$supplierNo}%"];
+        }
+        $wsm_supplierNo = isset($this->post['wsm_supplierNo']) && $this->post['wsm_supplierNo'] != "" ? trim($this->post['wsm_supplierNo']) : "";
+        if ($wsm_supplierNo != "") {
+            $supplier = Db::name("supplier")->where(["code" => $wsm_supplierNo])->find();
+            if (empty($supplier)) {
+                return json_show(1004, "未找到供应商信息");
+            }
+            $wsmcode = Db::name("warehouse_info")->where(["is_del" => 0, "supplierNo" => $wsm_supplierNo])->column("wsm_code");
+            $where[] = ['po.wsm_code', "in", $wsmcode];
+        }
+        $start = isset($this->post['start']) && $this->post['start'] != "" ? $this->post['start'] : "";
+        if ($start != "") {
+            // $where['addtime'] = Db::raw(" >= '{$start}'");
+            $where[] = ['po.addtime', ">=", $start];
+        }
+        $end = isset($this->post['end']) && $this->post['end'] != "" ? $this->post['end'] : "";
+        if ($end != "") {
+            $where[] = ['po.addtime', "<=", $end];
+        }
+        $last_start = isset($this->post['last_start']) && $this->post['last_start'] != "" ? $this->post['last_start'] : "";
+        if ($last_start != "") {
+            //$where['lasttime'] = Db::raw(" >= '{$last_start}'");
+            $where[] = ['po.lasttime', ">=", $last_start];
+
+        }
+        $last_end = isset($this->post['last_end']) && $this->post['last_end'] != "" ? $this->post['last_end'] : "";
+        if ($last_end != "") {
+            //$where['lasttime'] = Db::raw(" <= '{$last_end}'");
+            $where[] = ['po.lasttime', "<=", $last_end];
+        }
+        $orderCode = isset($this->post['orderCode']) && $this->post['orderCode'] != "" ? $this->post['orderCode'] : "";
+        if ($orderCode != "") {
+            //$where['lasttime'] = Db::raw(" <= '{$last_end}'");
+            $where[] = ['on.orderCode', "like", '%' . $orderCode . '%'];
+        }
+
+        $company_name = isset($this->post['company_name']) && $this->post['company_name'] !== "" ? trim($this->post['company_name']) : "";
+        if ($company_name !== "") $where[] = ["po.cgder_id", 'in', get_company_item_user_by_name($company_name)];
+
+//        if(!empty($role['platform']) ){
+//            $where[]=["po.platform_id","in",$role['platform']];
+//        }
+        $count = Db::name("purchease_order")->alias('po')->leftJoin('order_num on', 'on.cgdNo=po.cgdNo')->where($where)
+            ->where(function ($query) use ($where) {
+                $query->whereOr([['po.order_type', '<>', 1], ['po.order_source', '=', 0]]);
+            })->count();
+        $total = ceil($count / $size);
+        $page = $page >= $total ? $total : $page;
+        $list = Db::name("purchease_order")
+            ->alias('po')
+            ->leftJoin('order_num on', 'on.cgdNo=po.cgdNo')
+            ->leftJoin("depart_user u", "u.uid=po.cgder_id AND u.is_del=0")
+            ->field('po.*,on.orderCode,u.itemid')
+            ->where($where)
+            ->where(function ($query) use ($where) {
+                $query->whereOr([['po.order_type', '<>', 1], ['po.order_source', '=', 0]]);
+            })
+            ->page($page, $size)
+            ->order("po.addtime desc")
+            ->cursor();
+        $data = [];
+        foreach ($list as $value) {
+            $value['wsm_name'] = "";
+            if ($value['wsm_code'] != "") {
+                $wsmcode = Db::name("warehouse_info")->alias("a")->leftJoin("supplier b", "a.supplierNo=b.code")
+                    ->where(["a.wsm_code" => $value['wsm_code']])->field("a.name as wsm_name,b.name,b.code")->find();
+                $value['wsm_name'] = isset($wsmcode['wsm_name']) ? $wsmcode['wsm_name'] : "";
+                $value['wsm_supplier'] = isset($wsmcode['name']) ? $wsmcode['name'] : "";
+                $value['wsm_supplierNo'] = isset($wsmcode['code']) ? $wsmcode['code'] : "";
+            }
+            if ($value['order_type'] == 3) {
+                $goon = Db::name("good_zixun")->where(["spuCode" => $value['spuCode'], "is_del" => 0])->find();
+                $value["speclist"] = isset($goon['specinfo']) && $goon['specinfo'] != "" ? json_decode($goon['specinfo'], true) : "";
+            } else {
+                $goon = Db::name('good_basic')->where(['spuCode' => $value['spuCode']])->find();
+                $spec = Db::name("good_spec")->where(["spuCode" => $goon['spuCode'], "is_del" => 0])->select()->toArray();
+                $speclist = [];
+                if (!empty($spec)) {
+                    foreach ($spec as $val) {
+                        $temp = [];
+                        $temp['id'] = $val['id'];
+                        $temp['spuCode'] = $val['spuCode'];
+                        $temp['spec_id'] = $val['spec_id'];
+                        $temp['spec_value_id'] = $val['spec_value_id'];
+                        $sp = Db::name("specs")->where(["id" => $val['spec_id']])->find();
+                        $temp['spec_name'] = isset($sp["spec_name"]) ? $sp["spec_name"] : "";
+                        $spv = Db::name("spec_value")->where(["id" => $val['spec_value_id']])->find();
+                        $temp['spec_value'] = isset($spv["spec_value"]) ? $spv["spec_value"] : "";
+                        $speclist[] = $temp;
+                    }
+                }
+                $value["speclist"] = empty($speclist) ? [] : $speclist;
+            }
+
+            //采购单详情字段order_type 为1或者2时,取线上商品库 商品创建人   order_type 为3或者4时 取采购反馈的商品库 商品反馈人
+//            $value['cgder_id'] = $goon['createrid'];
+//            $value['cgder'] = $goon['creater'];
+
+            $inorder = Db::name("purchease_in")->where(['cgdNo' => $value['cgdNo'], "is_del" => 0])->select();
+            $value['child'] = empty($inorder) ? [] : $inorder;
+            $value['send_num'] -= $value['th_num'];
+            $value['total_fee'] = round($value['total_fee'] - $value['th_fee'], 2);
+            //补充orderCode
+//            $value['orderCode']=isset($all_orderCodes[$value['cgdNo']])?$all_orderCodes[$value['cgdNo']]:'';
+            $value['company_name'] = implode('/', array_column(GetPart($value['itemid']), 'name'));
+            $data[] = $value;
+        }
+        return json_show(0, "获取成功", ["list" => $data, "count" => $count]);
+    }
+
+    //详情
+    public function info()
+    {
+        $this->post = $this->request->filter('trim')->post();
+
+        $cgdNo = isset($this->post['cgdNo']) && $this->post['cgdNo'] != "" ? trim($this->post['cgdNo']) : "";
+        if ($cgdNo == "") {
+            return json_show(1004, "参数cgdNo 不能为空");
+        }
+        //采购单
+        $data = Db::name("purchease_order")->where(["cgdNo" => $cgdNo, "is_del" => 0, 'supplierNo' => $this->request->user['supplierNo']])->find();
+        if (empty($data)) {
+            return json_show(1004, "未找到数据");
+        }
+        //采购退货单
+        $im = Db::name('purchease_back')->where(['cgdNo' => $data['cgdNo'], 'is_del' => 0])->select();
+        $var = [];
+        foreach ($im as $value) {
+            if ($data['order_type'] == 3) {
+                $goo = Db::name("good_zixun")->where(["spuCode" => $value['spuCode'], "is_del" => 0])->find();
+            } else {
+                $goo = Db::name('good_basic')->where(['spuCode' => $value['spuCode']])->find();
+            }
+            if ($goo == false) {
+                return json_show(1005, "未找到商品数据");
+            }
+            $cat = isset($goo['cat_id']) && $goo['cat_id'] != 0 ? made($goo['cat_id']) : [];
+            $value['cant'] = $cat;
+            $var[] = $value;
+        }
+        //采购工差单
+        $dom = Db::name("purchease_diff")->where(['cgdNo' => $data['cgdNo'], 'is_del' => 0])->find();
+        if ($data['order_type'] == 3) {
+            $goon = Db::name("good_zixun")->where(["spuCode" => $data['spuCode'], "is_del" => 0])->find();
+        } else {
+            $goon = Db::name('good_basic')->where(['spuCode' => $data['spuCode']])->find();
+        }
+        if (empty($goon)) {
+            return json_show(1005, "未找到商品数据");
+        } else {
+            $goon['exclusive'] = isset($goon['is_exclusive']) ? makeExcluse($goon['is_exclusive']) : "";
+            $unit = Db::name("unit")->where(["id" => $goon['good_unit']])->find();
+            $goon['unit'] = isset($unit['unit']) ? $unit['unit'] : '';
+            $spec = Db::name("good_spec")->where(["spuCode" => $goon['spuCode'], "is_del" => 0])->select()->toArray();
+            $speclist = [];
+            if (!empty($spec)) {
+                foreach ($spec as $value) {
+                    $temp = [];
+                    $temp['id'] = $value['id'];
+                    $temp['spuCode'] = $value['spuCode'];
+                    $temp['spec_id'] = $value['spec_id'];
+                    $temp['spec_value_id'] = $value['spec_value_id'];
+                    $temp['is_del'] = $value['is_del'];
+                    $sp = Db::name("specs")->where(["id" => $value['spec_id']])->find();
+                    $temp['spec_name'] = isset($sp["spec_name"]) ? $sp["spec_name"] : "";
+                    $spv = Db::name("spec_value")->where(["id" => $value['spec_value_id']])->find();
+                    $temp['spec_value'] = isset($spv["spec_value"]) ? $spv["spec_value"] : "";
+                    $speclist[] = $temp;
+                }
+            }
+            $goon["speclist"] = empty($speclist) ? [] : $speclist;
+            $proof = Db::name("good_proof")->where(["spuCode" => $goon['spuCode'], "is_del" => 0])->order("updatetime desc")->field("id,proof_type,proof_url")->find();
+            $goon['proof'] = isset($proof) && $proof != false ? $proof : [];
+            $goon['origin_place_cn'] = "";
+            $goon['delivery_place_cn'] = "";
+            if (isset($goon['delivery_place']) && $goon['delivery_place'] !== "") {
+                $place = ["provice_code" => "", "city_code" => "", "area_code" => ""];
+                list($place['provice_code'], $place['city_code'], $place['area_code']) = explode(",", $goon['delivery_place']);
+                $goon['delivery_place_cn'] = GetAddr(json_encode($place));
+            }
+            if (isset($goon['delivery_place']) && $goon['origin_place'] !== "") {
+                $place = ["provice_code" => "", "city_code" => "", "area_code" => ""];
+                list($place['provice_code'], $place['city_code'], $place['area_code']) = explode(",", $goon['origin_place']);
+                $goon['origin_place_cn'] = GetAddr(json_encode($place));
+            }
+            if ($goon['brand_id'] != 0) {
+                $brand = Db::name("brand")->where(["id" => $goon['brand_id']])->find();
+                $goon["brand_name"] = isset($brand['brand_name']) ? $brand['brand_name'] : "";
+            } else {
+                $goon["brand_name"] = "";
+                $goon["brand_id"] = "";
+            }
+
+            $supplier = Db::name("supplier")->where(["code" => $goon['supplierNo']])->find();
+            $goon['supplierName'] = isset($supplier['name']) ? $supplier['name'] : "";
+            $goon['noble_name'] = isset($goon['noble_metal']) && $goon['noble_metal'] != 0 ? $this->noble[$goon['noble_metal']] : "";
+            if (isset($goon['companyNo']) && $goon['companyNo'] != "") {
+                $company = Db::name("business")->where(["companyNo" => $goon['companyNo']])->find();
+            }
+            $goon['company'] = isset($company['company']) ? $company['company'] : "";
+        }
+        $int = isset($goon['cat_id']) && $goon['cat_id'] != 0 ? made($goon['cat_id']) : [];
+        $data['wsm_name'] = "";
+        if ($data['wsm_code'] != "") {
+            $wsmcode = Db::name("warehouse_info")->alias("a")->leftJoin("supplier b", "a.supplierNo=b.code")
+                ->leftJoin("warehouse_addr c", "a.wsm_code=c.wsm_code and c.is_del=0")
+                ->where(["a.wsm_code" => $data['wsm_code']])->field("a.name as wsm_name,b.name,b.code,c.wsm_name as wsm_contactor,c.wsm_mobile,c.wsm_addr,c.addr_code")->find();
+            $data['wsm_name'] = isset($wsmcode['wsm_name']) ? $wsmcode['wsm_name'] : "";
+            $data['wsm_supplier'] = isset($wsmcode['name']) ? $wsmcode['name'] : "";
+            $data['wsm_supplierNo'] = isset($wsmcode['code']) ? $wsmcode['code'] : "";
+            $data['wsm_contactor'] = isset($wsmcode['wsm_contactor']) ? $wsmcode['wsm_contactor'] : "";
+            $data['wsm_mobile'] = isset($wsmcode['wsm_mobile']) ? $wsmcode['wsm_mobile'] : "";
+            // $data['wsm_addr'] =isset($wsmcode['wsm_addr']) ? $wsmcode['wsm_addr']:"";
+            $data['addr_code'] = isset($wsmcode['addr_code']) ? $wsmcode['addr_code'] : "";
+            $data['wsm_addr'] = isset($wsmcode['addr_code']) ? GetAddr($wsmcode['addr_code']) : "";
+            $data['wsm_addr'] .= isset($wsmcode['wsm_addr']) ? $wsmcode['wsm_addr'] : "";
+            $inorder = Db::name("purchease_in")->where(['cgdNo' => $data['cgdNo'], "is_del" => 0])->select();
+            $data['child'] = empty($inorder) ? [] : $inorder;
+        }
+
+        $data['can'] = $int;
+        $data['goodinfo'] = $goon;
+        $data['purcheasediff'] = $dom;
+        $data['send_num'] -= $data['th_num'];
+        $data['total_fee'] = round($data['total_fee'] - $data['th_fee'], 2);
+        if (isset($data['companyNo']) && $data['companyNo'] != "") {
+            $company = Db::name("business")->where(["companyNo" => $data['companyNo']])->find();
+        }
+        $data['company'] = isset($company['company']) ? $company['company'] : "";
+        //$data['info'] = $var;
+        $data['purcheaseback'] = $var;
+
+        //补充orderCode
+        $data['orderCode'] = Db::name('order_num')
+            ->where('cgdNo', $data['cgdNo'])
+            ->value('orderCode', '');
+
+        //补充收货地址
+        $addr = Db::name('order_addr')
+            ->field('id,addr,addr_code,contactor,mobile,receipt_quantity')
+            ->where(['orderCode' => $data['orderCode'], 'is_del' => 0])
+            ->select()
+            ->toArray();
+        if (!empty($addr)) {
+            foreach ($addr as &$vv) {
+                $temp = explode(',', $vv['addr_code']);
+                $temp_ = GetAddr(json_encode(['provice_code' => isset($temp[0]) ? $temp[0] : '', 'city_code' => isset($temp[1]) ? $temp[1] : '', 'area_code' => isset($temp[2]) ? $temp[2] : '']));
+                $vv['addr_code'] = $temp_ . $vv['addr'];
+            }
+        } else $addr = [];
+        $data['addr_info'] = $addr;
+
+        //补充客户名称
+        if (empty($data['orderCode'])) $data['customer'] = [];
+        else {
+            $data['customer'] = Db::name('sale')
+                ->alias('s')
+                ->field('c.companyNo,c.companyName')
+                ->leftJoin('customer_info c', 'c.companyNo=s.customer_code AND c.is_del=0')
+                ->where(['s.orderCode' => $data['orderCode']])
+                ->find();
+        }
+
+        return json_show(0, "获取成功", $data);
+    }
+
+
+}

+ 0 - 158
app/abutment/logic/GoodUp.php

@@ -1,158 +0,0 @@
-<?php
-
-namespace app\abutment\logic;
-
-use app\admin\model\ActionLog;
-use app\admin\model\ProcessOrder;
-use think\Exception;
-use think\exception\ValidateException;
-use think\facade\Db;
-
-//商品上线模块
-class GoodUp
-{
-
-    //申请商品上线
-    public static function create(array $data = [])
-    {
-        //校验平台是否存在
-        $rs = Db::name('platform')
-            ->field('id,platform_type')
-            ->where(['id' => $data['platform_id'], 'is_del' => 0])
-            ->findOrEmpty();
-        if (empty($rs)) throw new ValidateException('该平台id不存在');
-
-
-        //校验是否存在已上线商品
-        $res = Db::name('good_platform')
-            ->where(['platform_code' => $data['platform_id'], 'is_del' => 0])
-            ->where('exam_status', '<=', 6)
-            ->whereIn('spuCode', $data['spuCodes'])
-            ->column('spuCode');
-
-        if (!empty($res)) return json_show(1005, '以下商品编码已存在该平台的上线申请', $res);
-
-        //校验商品数据
-        $good_data = Db::name('good_basic')
-            ->field('id,spuCode')
-            ->where('is_del', 0)
-            ->whereIn('spuCode', $data['spuCodes'])
-            ->select()
-            ->toArray();
-
-        if (empty($good_data)) return json_show(1005, '未找到商品数据');
-
-        if ($rs['platform_type'] == 1) return \app\youzan\logic\Goodup::create([
-            'platform_id' => $data['platform_id'],
-            'online_reason' => $data['online_reason'],
-            'online_remark' => $data['online_remark'],
-            'good_data' => $good_data,
-            'createrid' => request()->user['user_id'],
-            'creater' => request()->user['nickname'],
-        ]);
-
-        $spuCode_count = Db::name("good_nake")
-            ->where(["is_del" => 0])
-            ->whereIn('spuCode', $data['spuCodes'])
-            ->group('spuCode')
-            ->column('count(`id`) total', 'spuCode');
-
-        $i = 0;
-        Db::startTrans();
-        try {
-            foreach ($good_data as $value) {
-
-                //改变编码规则,将原来的skuCode后两位换成序列号
-                //str_pad字符串填充
-                $skuCode = makeNo("SN");
-                $skuCode = substr($skuCode, 0, -2) . str_pad($i, 2, '0', STR_PAD_LEFT);
-                $tmp = [
-                    "spuCode" => $value['spuCode'],
-                    "skuCode" => $skuCode,
-                    "platform_code" => $data['platform_id'],
-                    "online_reason" => $data['online_reason'],
-                    "online_remark" => $data['online_remark'],
-                    "exam_status" => $spuCode_count[$value['spuCode']] > 0 ? 2 : 1,
-                    "is_online" => 0,
-                    "status" => 1,
-                    "is_del" => 0,
-                    "creater" => $value['creater'],
-                    "createrid" => $value['createrid'],
-                    "addtime" => date("Y-m-d H:i:s"),
-                    "updatetime" => date("Y-m-d H:i:s")
-                ];
-                $i++;
-                //修改状态,添加待办
-                $create = Db::name("good_platform")->insertGetId($tmp);
-                if ($create > 0) {
-                    ActionLog::logAdd(['id' => request()->user['user_id'], 'nickname' => request()->user['nickname']], [
-                        "order_code" => $skuCode,//咨询单详情编号
-                        "status" => $tmp['exam_status'],//这里的status是之前的值
-                        "action_remark" => '',//备注
-                        "action_type" => "create"//新建create,编辑edit,更改状态status
-                    ], "SPSX", $tmp['exam_status'], $tmp);
-
-                    ProcessOrder::AddProcess(['id' => request()->user['user_id'], 'nickname' => request()->user['nickname']], [
-                        "order_type" => 'SPSX',
-                        "order_code" => $skuCode,//咨询单详情编号
-                        "order_id" => $create,
-                        "order_status" => $tmp['exam_status'], "before_status" => $tmp['exam_status']
-                    ]);
-                    $iso = Db::name("good")
-                        ->field('id')
-                        ->where(["spuCode" => $value['spuCode'], "is_del" => 0])
-                        ->find();
-                    if ($iso == false) {
-                        unset($value['id']);
-
-                        $value['addtime'] = date("Y-m-d H:i:s");
-                        $value['updatetime'] = date("Y-m-d H:i:s");
-                    } else {
-                        $value['id'] = $iso['id'];
-                        $value['updatetime'] = date("Y-m-d H:i:s");
-                    }
-                    $up = Db::name("good")->save($value);
-                    if (!$up) throw new Exception('提交失败');
-                } else  throw new Exception('提交失败');
-            }
-
-            Db::commit();
-            return json_show(0, "提交商品上线申请成功");
-        } catch (Exception $e) {
-            Db::rollback();
-            throw new ValidateException('提交商品上线申请失败,' . $e->getMessage());
-        }
-
-    }
-
-    //列表
-    public static function list(array $param = [])
-    {
-
-        $db = Db::name('good_platform')
-            ->alias('a')
-            ->leftJoin('good_basic b', 'b.spuCode=a.spuCode AND b.is_del=0')
-            ->leftJoin('platform p', 'p.id=a.platform_code AND p.is_del=0')
-            ->leftJoin('brand c', 'c.id=b.brand_id AND c.is_del=0')
-            ->leftJoin('business d', 'd.companyNo=b.companyNo AND d.is_del=0')
-            ->where(['a.createrid' => request()->user['user_id'], 'a.is_del' => 0]);
-
-        if ($param['keyword'] != '') $db->whereLike('a.spuCode|b.good_name', '%' . $param['keyword'] . '%');
-
-        $count = $db->count('a.id');
-
-        $list = $db
-            ->field('a.id,a.spuCode,a.skuCode,b.good_thumb_img,b.good_name,p.platform_name,a.exam_status,b.cat_id,"" cat_name,b.is_stock,c.brand_name,b.companyNo,d.company,a.plat_code,a.creater,a.addtime')
-            ->order(['a.addtime' => 'desc', 'a.id' => 'desc'])
-            ->page($param['page'], $param['size'])
-            ->withAttr('cat_name', function ($val, $da) {
-                return implode('/', array_column(made($da['cat_id']), 'name'));
-            })
-            ->select()
-            ->toArray();
-
-        return json_show(0, '请求成功', ['count' => $count, 'list' => $list]);
-    }
-
-
-}

+ 3 - 2
app/abutment/middleware/apiMiddleware.php

@@ -49,8 +49,9 @@ class apiMiddleware
         //只做记录,不做输出
         RequestLogModel::where('request_id', request()->request_id)->save([
             'response' => $response->getContent(),
-            'supplierNo' => request()->user['supplierNo'],
-            'uid' => request()->user['uid'],
+            'supplierNo' => request()->user['supplierNo'] ?? '',
+            'uid' => request()->user['uid'] ?? 0,
+            //如果是白名单接口(例如登录接口),这个时候是没有supplierNo和uid字段的
         ]);
     }
 

+ 3 - 3
app/abutment/route/app.php

@@ -24,8 +24,8 @@ route::rule('updateGoodBasicsInfo', 'abutment/Good/updateGoodBasicsInfo');//修
 route::rule('updateGoodPriceInfo', 'abutment/Good/updateGoodPriceInfo');//修改商品价格信息
 route::rule('getGoodDetail', 'abutment/Good/read');//获取商品详情
 
-//商品上线模块
-route::rule('createGoodUp', 'abutment/GoodUp/create');//申请商品上线
-route::rule('getGoodUpList', 'abutment/GoodUp/list');//商品上线列表
+//销售订单(采销的采购单)
+route::rule('getOrderList', 'abutment/Order/getList');//列表
+route::rule('getOrderInfo', 'abutment/Order/info');//详情
 
 

Some files were not shown because too many files changed in this diff