dever 2 years ago
parent
commit
ea6c57a848

+ 12 - 12
database/unit.php

@@ -120,7 +120,6 @@ return array
         (
         	'新增' => array('fast'),
         	'分类设置' => array('list', 'unit_type&oper_parent=unit'),
-            '自定义类别' => array('list', 'unit_cate&oper_parent=unit'),
         ),
         
 		'list_button' => array
@@ -135,8 +134,8 @@ return array
 		'value' => array
 		(
 			# 重量单位Weight
-			'"千克","kilogram",1,1199,1,' . DEVER_TIME,
-			'"克","gram",1,1198,1,' . DEVER_TIME,
+			'"千克","kilogram",1,2199,1,' . DEVER_TIME,
+			'"克","gram",1,2198,1,' . DEVER_TIME,
 			'"吨","ton",1,197,1,' . DEVER_TIME,
 			'"公吨","metricton",1,196,1,' . DEVER_TIME,
 			'"长吨","longton",1,195,1,' . DEVER_TIME,
@@ -144,15 +143,16 @@ return array
 			'"盎司","ounce",1,193,1,' . DEVER_TIME,
 
 			# 数量单位Number
-			'"袋","bag",2,1299,1,' . DEVER_TIME,
-			'"件","piece",2,1298,1,' . DEVER_TIME,
-			'"双","pair",2,297,1,' . DEVER_TIME,
-			'"套","set",2,296,1,' . DEVER_TIME,
-			'"打","dozen",2,295,1,' . DEVER_TIME,
-			'"罗","gross",2,294,1,' . DEVER_TIME,
-			'"桶","drum",2,293,1,' . DEVER_TIME,
-			'"包","bale",2,292,1,' . DEVER_TIME,
-			'"卷","roll",2,291,1,' . DEVER_TIME,
+			'"袋","bag",2,2299,1,' . DEVER_TIME,
+			'"件","piece",2,2298,1,' . DEVER_TIME,
+			'"箱","box",2,2297,1,' . DEVER_TIME,
+			'"双","pair",2,296,1,' . DEVER_TIME,
+			'"套","set",2,295,1,' . DEVER_TIME,
+			'"打","dozen",2,294,1,' . DEVER_TIME,
+			'"罗","gross",2,293,1,' . DEVER_TIME,
+			'"桶","drum",2,292,1,' . DEVER_TIME,
+			'"包","bale",2,291,1,' . DEVER_TIME,
+			'"卷","roll",2,290,1,' . DEVER_TIME,
 
 			# 长度单位Length
 			'"米","meter",3,1399,1,' . DEVER_TIME,

+ 0 - 119
database/unit_cate.php

@@ -1,119 +0,0 @@
-<?php
-
-return array
-(
-	# 表名
-	'name' => 'unit_cate',
-	# 显示给用户看的名称
-	'lang' => '单位自定义类别',
-	# 是否显示在后台菜单
-	'order' => 10,
-	'menu' => false,
-
-	# 数据结构
-	'struct' => array
-	(
-		'id' 		=> array
-		(
-			'type' 		=> 'int-11',
-			'name' 		=> 'ID',
-			'default' 	=> '',
-			'desc' 		=> '',
-			'match' 	=> 'is_numeric',
-			'list'		=> true,
-			'order'		=> 'asc',
-		),
-
-		'name'		=> array
-		(
-			'type' 		=> 'varchar-150',
-			'name' 		=> '类别名称',
-			'default' 	=> '',
-			'desc' 		=> '类别名称',
-			'match' 	=> 'is_string',
-			'update'	=> 'text',
-			'search'	=> 'fulltext',
-			'list'		=> true,
-			'edit'		=> true,
-		),
-
-		'reorder'		=> array
-		(
-			'type' 		=> 'int-11',
-			'name' 		=> '排序(数值越大越靠前)',
-			'default' 	=> '1',
-			'desc' 		=> '请输入排序',
-			'match' 	=> 'option',
-			//'update'	=> 'text',
-			'search'	=> 'order',
-			'list_name' => '排序',
-			'list'		=> true,
-			'order'		=> 'desc',
-			'edit'		=> true,
-		),
-		
-		'state'		=> array
-		(
-			'type' 		=> 'tinyint-1',
-			'name' 		=> '状态',
-			'default' 	=> '1',
-			'desc' 		=> '请选择状态',
-			'match' 	=> 'is_numeric',
-		),
-		
-		'cdate'		=> array
-		(
-			'type' 		=> 'int-11',
-			'name' 		=> '录入时间',
-			'match' 	=> array('is_numeric', time()),
-			'desc' 		=> '',
-			# 只有insert时才生效
-			'insert'	=> true,
-			//'search'	=> 'date',
-			//'list'		=> 'date("Y-m-d H:i:s", {cdate})',
-		),
-	),
-
-	'manage' => array
-	(
-		'insert' => false,
-        'edit' => false,
-
-        # 自定义快捷新增和编辑
-        'button' => array
-        (
-            '新增' => array('fast'),
-        ),
-		'list_button' => array
-        (
-        	'edit' => array('编辑'),
-        )
-	),
-
-	'default' => array
-	(
-		'col' => 'name,reorder,state,cdate',
-		'value' => array
-		(
-			'"采购单位",900,1,' . DEVER_TIME,
-			'"订货单位",800,1,' . DEVER_TIME,
-			'"成本单位",700,1,' . DEVER_TIME,
-		),
-	),
-
-	'request' => array
-	(
-		'getAll' => array
-		(
-			# 匹配的正则或函数 选填项
-			'option' => array
-			(
-				'type' => 'yes',
-				'state' => 1,
-			),
-			'type' => 'all',
-			'order' => array('reorder' => 'desc', 'id' => 'desc'),
-			'col' => 'id,id as value, name',
-		),
-	)
-);

+ 0 - 25
lib/Stock.php

@@ -6,31 +6,6 @@ use Dever;
 
 class Stock
 {
-	public function show_api()
-	{
-		$goods = Dever::input('value');
-		list($goods_id, $sku_id) = explode('-', $goods);
-		$where['goods_id'] = $goods_id;
-		$where['sku_id'] = $sku_id;
-		$where['servicer_store_id'] = Dever::input('servicer_store_id');
-		$info = Dever::db('scm_servicer/store_goods_sku')->getOne($where);
-		$result = array();
-		$result['goods_id'] = '暂无';
-		$result['cash'] = '0.00';
-		if ($info) {
-			$goods_info = Dever::load('scm_product/lib/info')->getBaseInfo($goods_id, $sku_id);
-			$supplier_id = Dever::input('supplier_id');
-			if ($supplier_id) {
-				$where['supplier_id'] = $supplier_id;
-				$sku = Dever::db('scm_supplier/goods_sku')->getOne($where);
-				$info['cash'] = isset($sku['cost_price']) && $sku['cost_price'] ? $sku['cost_price'] : $goods_info['cost_price'];
-			}
-			$result['goods_id'] = '库存:' . $info['total'] . $goods_info['unit'];
-			$result['cash'] = $info['cash'];
-		}
-		return array('data' => $result, 'html' => '');
-	}
-
 	public function out_check($id, $name, $data)
 	{
 		$table = Dever::input('table');

+ 50 - 83
module/scm_product/database/info.php

@@ -39,9 +39,25 @@ $score = function()
 	return Dever::load('score/config-state');
 };
 
-$unit_cate = function()
+$unit = function($type = false)
 {
-	return Dever::load('scm/unit_cate-state');
+	return Dever::load('scm/unit-state');
+
+	$data = Dever::load('scm/unit-select');
+	if ($type == true) {
+		$array = array
+		(
+			0 => array('id' => -1, 'name' => '-'),
+		);
+		return array_merge($array, $data);
+	} else {
+		return $data;
+	}
+};
+
+$rate = function($type = false)
+{
+	return Dever::load('scm/rate-state');
 };
 
 $sell_type = array
@@ -210,93 +226,43 @@ $config = array
 			//'control'	=> 'pay_type',
 		),
 
-		'unit'		=> array
+		'rate_id'		=> array
 		(
-			'type' 		=> 'varchar-150',
+			'type' 		=> 'int-11',
+			'name' 		=> '基本税率',
+			'default' 	=> '',
+			'desc' 		=> '基本税率',
+			'match' 	=> 'is_numeric',
+			'update'    => 'select',
+			'option'    => $rate,
+			'tab'		=> 1,
+		),
+
+		'unit_id'		=> array
+		(
+			'type' 		=> 'int-11',
 			'name' 		=> '基本单位-一般为商品的最小单位,如个、袋、克等',
 			'default' 	=> '',
 			'desc' 		=> '基本单位',
 			'match' 	=> 'is_numeric',
-			'update'    => 'linkage',
-			'option'    => Dever::url('lib/unit.get', 'scm'),
+			'update'    => 'select',
+			'option'    => $unit,
 			'tab'		=> 1,
 		),
 
-		'unit'       => array
-        (
-            'type'      => 'text-1000',
-            'name'      => '单位设置',
-            'default'   => '',
-            'desc'      => '单位设置',
-            'match'     => 'is_string',
-            'option'    => $unit_cate,
-            'update'    => array
-            (
-                array
-                (
-                    'col'       => 'name',
-                    'name'      => '文字内容',
-                    'default'   => '',
-                    'desc'      => '文字内容',
-                    'match'     => 'is_string',
-                    'update'    => 'textarea',
-                ),
-
-                array
-                (
-                    'col'       => 'cratio',
-                    'name'      => '标准单位转换比',
-                    'default'   => '#000000',
-                    'desc'      => '文字颜色',
-                    'match'     => 'is_string',
-                    'update'    => 'text',
-                ),
-
-                array
-                (
-                    'col'       => 'bgcolor_type',
-                    'name'      => '是否设置背景颜色',
-                    'default'   => '2',
-                    'desc'      => '是否设置背景颜色',
-                    'match'     => 'is_string',
-                    'update'    => 'radio',
-                    'option'    => $bgcolor_type,
-                    'control'   => 'bgcolor_type',
-                ),
-
-                array
-                (
-                    'col'       => 'bgcolor',
-                    'name'      => '背景颜色',
-                    'default'   => '#000000',
-                    'desc'      => '背景颜色',
-                    'match'     => 'is_string',
-                    'update'    => 'color',
-                    'show'      => 'bgcolor_type=1'
-                ),
-
-                array
-                (
-                    'col'       => 'size',
-                    'name'      => '文字大小-直接输入像素数字',
-                    'default'   => '16',
-                    'desc'      => '结果描述',
-                    'match'     => 'is_numeric',
-                    'update'    => 'text',
-                ),
-
-                array
-                (
-                    'col'      => 'goods_id',
-                    'name'      => '选择商品',
-                    'default'   => '',
-                    'desc'      => '选择商品',
-                    'match'     => 'option',
-                    'update'    => 'select',
-                    'update_search' => 'goods/lib/manage.search',
-                ),
-            ),
-        ),
+		'scm_product-info_unit'=> array
+		(
+			'name' 		=> '单位转换设置',
+			'default' 	=> '',
+			'desc' 		=> '单位转换设置',
+			'match' 	=> 'option',
+			# 同步更新另外一个表的内容,两个表相关联的id,更新另一个表的字段
+			'sync'		=> array('id', 'info_id'),
+			'update'	=> array(1),
+			# 1纵向展示 2横向展示
+			'update_type' => 2,
+			'tab'		=> 1,
+		),
 
 		'commission'		=> array
 		(
@@ -384,7 +350,7 @@ $config = array
 
 		'scm_product-info_spec'=> array
 		(
-			'name' 		=> '规格设置-成本价为平台进货成本价格,采购价为销售采购商品价格,销售价为用户购买价格,划线价为用户购买价的划线价格',
+			'name' 		=> '规格设置-此处所有价格均为基本单位价格,成本价为平台进货成本价格,采购价为经销商采购商品价格,销售价为用户购买价格,划线价为用户购买价的划线价格',
 			'default' 	=> '',
 			'desc' 		=> '规格设置',
 			'match' 	=> 'option',
@@ -559,6 +525,7 @@ $config = array
 				'un_price' => array('name' => '划线价', 'verify' => 'number', 'type' => 'input'),
 				'cost_price' => array('name' => '成本价', 'verify' => 'number', 'type' => 'input'),
 				'buy_price' => array('name' => '采购价', 'verify' => 'number', 'type' => 'input'),
+				//'unit' => array('name' => '单位', 'verify' => 'number', 'type' => 'select', 'option' => Dever::json_encode($unit(true)), 'unit'),
 			),
 			# 接口
 			'api' => array
@@ -695,7 +662,7 @@ $config = array
                 'state' => 1,
             ),
             'type' => 'one',
-            'col' => 'id,name,category,pic,content,video,type,unit,units,spec_type,goods,commission,pay_money,money_id,score_id,sell_type,buy_type,udate,cdate',
+            'col' => 'id,name,category,pic,content,video,type,unit,spec_type,goods,commission,pay_money,money_id,score_id,sell_type,buy_type,udate,cdate',
         ),
 	),
 );

+ 104 - 0
module/scm_product/database/info_unit.php

@@ -0,0 +1,104 @@
+<?php
+
+$unit = function()
+{
+	return Dever::load('scm/unit-state');
+};
+
+return array
+(
+    # 表名
+    'name' => 'info_unit',
+    # 显示给用户看的名称
+    'lang' => '商品单位关联表',
+    'menu' => false,
+    # 数据结构
+    'struct' => array
+    (
+    
+        'id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'ID',
+            'default'   => '',
+            'desc'      => '',
+            'match'     => 'is_numeric',
+            'search'    => 'order',
+            'update'    => 'hidden',
+            //'list'        => true,
+        ),
+
+        'info_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '商品',
+            'default'   => '',
+            'desc'      => '商品',
+            'match'     => 'is_numeric',
+            'update'    => 'hidden',
+            'value'     => Dever::input('search_option_info_id')
+        ),
+
+        'unit_id'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '其他单位',
+			'default' 	=> '',
+			'desc' 		=> '其他单位',
+			'match' 	=> 'is_numeric',
+			'update'    => 'select',
+			'option'    => $unit,
+		),
+
+        'radio'      => array
+        (
+            'type'      => 'varchar-11',
+            'name'      => '基本单位转换比-如基本单位是袋,当前选择单位为箱,一箱24袋,这里填写24即可',
+            'default'   => '1',
+            'desc'      => '基本单位转换比',
+            'match'     => 'is_string',
+            'update'    => 'text',
+        ),
+
+        'discount'      => array
+        (
+            'type'      => 'varchar-11',
+            'name'      => '单位折扣-用于计算该单位价格:单位价格=基本价格*基本单位转换比*单位折扣',
+            'default'   => '0',
+            'desc'      => '价格转换比',
+            'match'     => 'is_string',
+            'update'    => 'text',
+        ),
+
+        'state'     => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '状态',
+            'default'   => '1',
+            'desc'      => '请选择状态',
+            'match'     => 'is_numeric',
+        ),
+        
+        'cdate'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '创建时间',
+            'match'     => array('is_numeric', time()),
+            'desc'      => '',
+            # 只有insert时才生效
+            'insert'    => true,
+            'search'    => 'date',
+            'list'      => 'date("Y-m-d H:i:s", {cdate})',
+        ),
+    ),
+
+    'manage' => array
+    (
+        
+    ),
+
+    'request' => array
+    (
+        
+    ),
+);

+ 6 - 5
module/scm_product/lib/Info.php

@@ -61,8 +61,8 @@ class Info
         }
 
         # 获取单位信息
-        if ($info['unit'] > 0) {
-            $info['unit'] = Dever::db('scm_product/unit')->find($info['unit']);
+        if ($info['unit_id'] > 0) {
+            $info['unit'] = Dever::db('scm/unit')->find($info['unit_id']);
         }
 
         return $info;
@@ -317,8 +317,9 @@ class Info
             $where['id'] = $sku;
         }
 
-        if ($info['unit']) {
-            $unit = Dever::db('scm_product/unit')->find($info['unit']);
+        $info['unit'] = '';
+        if ($info['unit_id']) {
+            $unit = Dever::db('scm/unit')->find($info['unit_id']);
             if ($unit) {
                 $info['unit'] = $unit['name'];
             }
@@ -374,7 +375,7 @@ class Info
                         'price' => $goods_info['price'],
                         'buy_price' => $goods_info['buy_price'],
                         'cover' => $goods_info['cover'],
-                        'unit' => $goods_info['unit'],
+                        'unit_id' => $goods_info['unit_id'],
                         'num' => $v['num'],
                     );
                 }

+ 86 - 0
module/scm_product/lib/Manage.php

@@ -198,4 +198,90 @@ class Manage
             
         }
     }
+
+    # 根据商品获取信息,后台入库出库单使用
+    public function showInfo_api()
+    {
+        $goods = Dever::input('value');
+        list($goods_id, $sku_id) = explode('-', $goods);
+        $goods_info = Dever::load('scm_product/lib/info')->getBaseInfo($goods_id, $sku_id);
+        $option = array();
+        $result = array();
+        $result['goods_id'] = '暂无';
+        $result['unit_id'] = 1;
+        $result['cash'] = '0.00';
+
+        if ($goods_info) {
+            $where['goods_id'] = $goods_id;
+            $where['sku_id'] = $sku_id;
+
+            $info = array();
+
+            # 仓库
+            $servicer_store_id = Dever::input('servicer_store_id');
+            if ($servicer_store_id) {
+                $where['servicer_store_id'] = $servicer_store_id;
+                $info = Dever::db('scm_servicer/store_goods_sku')->getOne($where);
+            }
+
+            # 获取供应商供货价
+            $supplier_id = Dever::input('supplier_id');
+            if ($supplier_id) {
+                $where['supplier_id'] = $supplier_id;
+                $sku = Dever::db('scm_supplier/goods_sku')->getOne($where);
+            }
+            $result['cash'] = isset($sku['cost_price']) && $sku['cost_price'] ? $sku['cost_price'] : $goods_info['cost_price'];
+
+            if ($info) {
+                $result['goods_id'] = $info['total'] . $goods_info['unit'];
+            }
+
+            $result['unit_id'] = $goods_info['unit_id'];
+            
+            if ($result['unit_id']) {
+                $unit = Dever::db('scm_product/info_unit')->select(array('info_id' => $goods_info['id']));
+                $option['unit_id'] = '';
+                $unit_info = Dever::db('scm/unit')->find($result['unit_id']);
+                $option['unit_id'] .= '<option value="'.$unit_info['id'].'" selected>'.$unit_info['name'].'</option>';
+                if ($unit) {
+                    foreach ($unit as $k => $v) {
+                        $unit_info = Dever::db('scm/unit')->find($v['unit_id']);
+                        $option['unit_id'] .= '<option value="'.$unit_info['id'].'">'.$unit_info['name'].'</option>';
+                    }
+                }
+            }
+        }
+        
+        return array('data' => $result, 'html' => '', 'option' => $option);
+    }
+
+    # 根据单位获取价格
+    public function showPriceByUnit_api()
+    {
+        $unit = Dever::input('value');
+        $goods = Dever::input('goods');
+        list($goods_id, $sku_id) = explode('-', $goods);
+        $goods_info = Dever::load('scm_product/lib/info')->getBaseInfo($goods_id, $sku_id);
+        $result = array();
+
+        if ($goods_info) {
+            $where['goods_id'] = $goods_id;
+            $where['sku_id'] = $sku_id;
+
+            # 获取供应商供货价
+            $supplier_id = Dever::input('supplier_id');
+            if ($supplier_id) {
+                $where['supplier_id'] = $supplier_id;
+                $sku = Dever::db('scm_supplier/goods_sku')->getOne($where);
+            }
+            $result['cash'] = isset($sku['cost_price']) && $sku['cost_price'] ? $sku['cost_price'] : $goods_info['cost_price'];
+                
+            $unit = Dever::db('scm_product/info_unit')->find(array('info_id' => $goods_info['id'], 'unit_id' => $unit));
+            if ($unit && $unit['discount'] > 0) {
+                $result['cash'] = $result['cash'] * $unit['radio'] * $unit['discount'];
+            }
+        }
+        
+        return array('data' => $result, 'html' => '');
+    }
 }

+ 0 - 58
module/scm_product/lib/Order.php

@@ -1,58 +0,0 @@
-<?php
-
-namespace Scm_product\Lib;
-
-use Dever;
-
-class Order
-{
-    public function updateGoods($id, $name, $data)
-    {
-        $table = Dever::input('table');
-        $goods = Dever::param('goods', $data);
-        $cash = Dever::param('cash', $data);
-        if ($table && $goods) {
-            $temp = explode('-', $goods);
-            $update = array();
-            $update['where_id'] = $id;
-            $update['goods_id'] = $temp[0];
-            $update['sku_id'] = $temp[1];
-            $batch = Dever::param('batch', $data);
-            if (!$batch) {
-                $update['batch'] = date('Ymd');
-            }
-            if (isset($temp[2]) && !$cash) {
-                //$update['cash'] = $temp[2];
-            }
-            
-            Dever::db($table)->update($update);
-
-            Dever::config('base')->hook = false;
-        }
-    }
-
-    public function updateOrderNum($id, $name, $data)
-    {
-        $table = Dever::input('table');
-        $prefix = Dever::input('prefix');
-        if ($table && $prefix) {
-            $update['order_num'] = $this->getOrderNum($table, $prefix);
-            $update['where_id'] = $id;
-            Dever::db($table)->update($update);
-            Dever::config('base')->hook = false;
-        }
-    }
-
-    # 生成订单号
-    public function getOrderNum($table, $prefix = 'C')
-    {
-        $prefix = $prefix . ucfirst(substr($table, 0, 1));
-        $where['order_num'] = Dever::order($prefix);
-        $state = Dever::db($table)->one($where);
-        if (!$state) {
-            return $where['order_num'];
-        } else {
-            return $this->getOrderNum($table);
-        }
-    }
-}

+ 0 - 25
module/scm_product/lib/Stock.php

@@ -6,31 +6,6 @@ use Dever;
 
 class Stock
 {
-	public function show_api()
-	{
-		$goods = Dever::input('value');
-		list($goods_id, $sku_id) = explode('-', $goods);
-		$where['goods_id'] = $goods_id;
-		$where['sku_id'] = $sku_id;
-		$where['servicer_store_id'] = Dever::input('servicer_store_id');
-		$info = Dever::db('scm_servicer/store_goods_sku')->getOne($where);
-		$result = array();
-		$result['goods_id'] = '暂无';
-		$result['cash'] = '0.00';
-		if ($info) {
-			$goods_info = Dever::load('scm_product/lib/info')->getBaseInfo($goods_id, $sku_id);
-			$supplier_id = Dever::input('supplier_id');
-			if ($supplier_id) {
-				$where['supplier_id'] = $supplier_id;
-				$sku = Dever::db('scm_supplier/goods_sku')->getOne($where);
-				$info['cash'] = isset($sku['cost_price']) && $sku['cost_price'] ? $sku['cost_price'] : $goods_info['cost_price'];
-			}
-			$result['goods_id'] = '库存:' . $info['total'] . $goods_info['unit'];
-			$result['cash'] = $info['cash'];
-		}
-		return array('data' => $result, 'html' => '');
-	}
-
 	public function out_check($id, $name, $data)
 	{
 		$table = Dever::input('table');

+ 7 - 2
module/scm_servicer/database/in_order.php

@@ -47,10 +47,15 @@ return array
     (
     	'status' => $status,
     ),
+    # 验证供应商商品是否存在
+    'start' => array
+    (
+        'insert' => 'scm/lib/order.check',
+    ),
     'end' => array
     (
-        'insert' => 'scm_product/lib/order.updateOrderNum?table=scm_servicer/in_order&prefix=CI',
-        'update' => 'scm_product/lib/stock.update_commit?table=scm_servicer/in_order&stock=scm_servicer/store_goods&type=in&col=servicer_store_id',
+        'insert' => 'scm/lib/order.updateOrderNum?table=scm_servicer/in_order&prefix=CI',
+        'update' => 'scm/lib/stock.update_commit?table=scm_servicer/in_order&stock=scm_servicer/store_goods&type=in&col=servicer_store_id',
     ),
 
     # 数据结构

+ 16 - 4
module/scm_servicer/database/in_order_goods.php

@@ -22,8 +22,8 @@ return array
     ),
     'end' => array
     (
-        'insert' => 'scm_product/lib/order.updateGoods?table=scm_servicer/in_order_goods',
-        'update' => 'scm_product/lib/order.updateGoods?table=scm_servicer/in_order_goods',
+        'insert' => 'scm/lib/order.updateGoods?table=scm_servicer/in_order_goods',
+        'update' => 'scm/lib/order.updateGoods?table=scm_servicer/in_order_goods',
     ),
     # 数据结构
     'struct' => array
@@ -59,13 +59,13 @@ return array
             'match'     => 'option',
             'update'    => 'select',
             'update_search' => 'scm_product/lib/manage.searchProduct?{supplier_id}',
-            'bind'        => array('onchange', 'loading', array('url' => Dever::url('lib/stock.show', 'scm_product'), 'col' => 'servicer_store_id,supplier_id')),
+            'bind'        => array('onchange', 'loading', array('url' => Dever::url('lib/manage.showInfo', 'scm_product'), 'col' => 'servicer_store_id,supplier_id')),
         ),
 
         'goods_id'      => array
         (
             'type'      => 'int-11',
-            'name'      => '商品信息',
+            'name'      => '库存',
             'default'   => '',
             'desc'      => '商品',
             'match'     => 'is_numeric',
@@ -82,6 +82,18 @@ return array
             'match'     => 'is_numeric',
         ),
 
+        'unit_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '单位',
+            'default'   => '',
+            'desc'      => '单位',
+            'match'     => 'is_numeric',
+            'update'    => 'select',
+            'option'    => array(0 => '请选择商品'),
+            'bind'        => array('onchange', 'loading', array('url' => Dever::url('lib/manage.showPriceByUnit', 'scm_product'), 'col' => 'supplier_id,goods')),
+        ),
+
         'batch'      => array
         (
             'type'      => 'varchar-800',

+ 1 - 1
module/scm_supplier/lib/Manage.php

@@ -20,7 +20,7 @@ class Manage
 		$where['supplier_id'] = Dever::input('update_supplier_id');
 		$info = Dever::db('scm_supplier/goods_sku')->getOne($where);
 		if (!$info) {
-			$supplier = Dever::db('scm_supplier/supplier')->one($where['supplier_id']);
+			$supplier = Dever::db('scm_supplier/info')->one($where['supplier_id']);
 			$goods_info = Dever::load('scm_product/lib/info')->getBaseInfo($goods_id, $sku_id);
 			return Dever::alert($supplier['name'] . '无此商品:【' . $goods_info['aname'] . '】');
 		}