rabin 2 years ago
parent
commit
e1a1057f42

+ 1 - 0
module/scm_product/database/info.php

@@ -577,6 +577,7 @@ $config = array
 			(
 				'ids' => array('yes-id', 'in'),
 				'name' => array('yes', 'like'),
+				'cate' => array('yes-top_category_id', 'in'),
 				'id_no' => array('yes-id', '!='),
 				'state' => 1,
 			),

+ 24 - 8
module/scm_product/lib/Manage.php

@@ -92,17 +92,33 @@ class Manage
     public function searchProduct_api()
     {
         $where = array();
-
-        $cate = Dever::input('cate');
-        if ($cate) {
-            $where['cate_id'] = $cate;
+        $data = array();
+        $cate = '';
+        $supplier_id = Dever::input('supplier_id');
+        if ($supplier_id) {
+            $supplier_goods = Dever::db('scm_supplier/goods')->one(array('supplier_id' => $supplier_id));
+            if ($supplier_goods) {
+                $where['supplier_id'] = $supplier_id;
+                $data = Dever::search('scm_supplier/goods', $where);
+            } else {
+                $supplier = Dever::db('scm_supplier/info')->find($supplier_id);
+                if ($supplier && $supplier['category']) {
+                    $cate = $supplier['category'];
+                }
+            }
         }
 
-        $id = Dever::input('where_id');
-        if ($id) {
-            $where['id_no'] = $id;
+        if (!$data) {
+            $id = Dever::input('where_id');
+            if ($id) {
+                $where['id_no'] = $id;
+            }
+            if ($cate) {
+                $where['cate'] = $cate;
+            }
+            $data = Dever::search('scm_product/info', $where);
         }
-        $data = Dever::search('scm_product/info', $where);
+        
         if ($data) {
             $old = $data;
             $data = array();

+ 2 - 2
module/scm_servicer/database/in_order_goods.php

@@ -47,13 +47,13 @@ return array
 
         'goods'      => array
         (
-            'type'      => 'varchar-200',
+            'type'      => 'varchar-2000',
             'name'      => '商品',
             'default'   => '',
             'desc'      => '商品',
             'match'     => 'option',
             'update'    => 'select',
-            'update_search' => 'scm_product/lib/manage.searchProduct?{id}',
+            'update_search' => 'scm_product/lib/manage.searchProduct?{id}{supplier_id}',
         ),
 
         'goods_id'      => array

+ 11 - 8
module/scm_servicer/lib/Manage.php

@@ -48,13 +48,16 @@ class Manage
     public function updateGoods($id, $name, $data)
     {
     	$table = Dever::input('table');
-        $goods = Dever::param('goods', $data);
-        $temp = explode('-', $goods);
-        $update['where_id'] = $id;
-        $update['goods_id'] = $temp[0];
-        $update['sku_id'] = $temp[1];
-        Dever::db('scm_servicer/' . $table)->update($update);
-
-        Dever::config('base')->hook = false;
+        $info = Dever::db('scm_servicer/in_order_goods')->find($id);
+        if ($info) {
+            print_r($info);die;
+            $temp = explode('-', $info['goods']);
+            $update['where_id'] = $id;
+            $update['goods_id'] = $temp[0];
+            $update['sku_id'] = $temp[1];
+            Dever::db('scm_servicer/' . $table)->update($update);
+
+            Dever::config('base')->hook = false;
+        }
     }
 }

+ 27 - 0
module/scm_supplier/database/goods.php

@@ -89,6 +89,33 @@ return array
 
     'request' => array
     (
+        # 后台搜索用到,也可以不加,自动生成
+        'search' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'supplier_id' => array('yes-t_1.supplier_id'),
+                'status' => 'yes-t_2.status-1',
+                'state' => 'yes-t_2.state-1',
+                'state_1' => 'yes-t_1.state-1',
+            ),
+            # 联表
+            'join' => array
+            (
+                array
+                (
+                    'table' => 'scm_product/info',
+                    'type' => 'left join',
+                    'on' => array('goods_id','id'),
+                    'col' => 'goods_id',
+                ),
+            ),
+            'type' => 'all',
+            'order' => array('t_2.reorder' => 'desc', 't_2.id' => 'desc'),
+            'col' => '*,t_2.*',
+        ),
+
         'getData' => array
         (
             # 匹配的正则或函数 选填项