Parcourir la source

复用admin/checkIsUpdate接口

wufeng il y a 2 ans
Parent
commit
464ce40171

+ 30 - 0
app/abutment/controller/Good.php

@@ -6,6 +6,7 @@ use app\admin\model\ActionLog;
 use app\admin\model\ChangeLog;
 use app\admin\model\ProcessOrder;
 use app\BaseController;
+use app\youzan\model\PlatformYouzan;
 use think\facade\Db;
 
 //商品模块
@@ -1571,5 +1572,34 @@ class Good extends BaseController
         return json_show(0, "获取成功", $list);
     }
 
+    //判断是否允许修改成本信息和基础信息
+    public function checkIsUpdate()
+    {
+        $spuCode = $this->request->post('spuCode', '', 'trim');
+        if ($spuCode == '') return json_show(1004, '成本商品编号不能为空');
+
+        $is_allow_update = 1;
+        //检查是否有上线记录
+        $rs = Db::name('good_platform')
+            ->field('id')
+            ->where(['spuCode' => $spuCode, 'is_del' => 0])
+            ->whereNotIn('exam_status', [0, 8])
+            ->find();
+
+        if (!empty($rs)) $is_allow_update = 0;
+        else {
+
+            $rs = PlatformYouzan::field('id')
+                ->where(['spuCode' => $spuCode, 'is_del' => PlatformYouzan::$del_normal])
+                ->whereNotIn('exam_status', [PlatformYouzan::$exam_status_8,PlatformYouzan::$exam_status_2])
+                ->findOrEmpty()
+                ->isEmpty();
+            if (!$rs) $is_allow_update = 0;
+        }
+
+        return json_show(0, '请求成功', ['is_allow_update' => $is_allow_update]);
+
+    }
+
 
 }

+ 1 - 1
app/abutment/controller/Order.php

@@ -21,7 +21,7 @@ class Order extends BaseController
 
         $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']], 's.is_stock', '=', 0];
+        $where = [['po.is_del', "=", 0], ['po.supplierNo', '=', $this->request->user['supplierNo']], ['s.is_stock', '=', 0]];
         $bkcode = isset($this->post['bk_code']) && $this->post['bk_code'] != "" ? trim($this->post['bk_code']) : "";
         if ($bkcode != "") {
             $where[] = ['po.bkcode', "like", "%{$bkcode}%"];

+ 1 - 0
app/abutment/route/app.php

@@ -36,6 +36,7 @@ route::rule('goldPriceLastList', 'abutment/Good/goldPriceLastList');//实时金
 route::rule('goldLinst', 'abutment/Good/linst');//贵金属种类列表
 route::rule('catList', 'abutment/Good/wlist');//分类列表
 route::rule('catListTitle', 'abutment/Good/title');//分类列表-全部
+route::rule('checkIsUpdate', 'abutment/Good/checkIsUpdate');//判断是否允许修改成本信息和基础信息
 
 //销售订单(采销的采购单)
 route::rule('getOrderList', 'abutment/Order/getList');//列表