dever 2 years ago
parent
commit
3731977822

+ 194 - 0
database/unit.php

@@ -0,0 +1,194 @@
+<?php
+
+$type = function()
+{
+	$array = array();
+	$data = Dever::load('scm/unit_type-state');
+	if($data)
+	{
+		$array += $data;
+	}
+	return $array;
+};
+
+return array
+(
+	# 表名
+	'name' => 'unit',
+	# 显示给用户看的名称
+	'lang' => '单位设置',
+	# 是否显示在后台菜单
+	'order' => 10,
+	'config_type' => $type,
+
+	# 数据结构
+	'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,
+		),
+
+		'en_name'		=> array
+		(
+			'type' 		=> 'varchar-150',
+			'name' 		=> '单位英文名称',
+			'default' 	=> '',
+			'desc' 		=> '单位英文名称',
+			'match' 	=> 'is_string',
+			'update'	=> 'text',
+			'search'	=> 'fulltext',
+			'list'		=> true,
+			'edit'		=> true,
+		),
+
+		'type_id'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '单位分类',
+			'default' 	=> '1',
+			'desc' 		=> '单位分类',
+			'match' 	=> 'is_numeric',
+			'update'	=> 'radio',
+			'option'	=> $type,
+			'search'	=> 'select',
+			'list'		=> 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'),
+        	'分类设置' => array('list', 'unit_type&oper_parent=unit'),
+            '自定义类别' => array('list', 'unit_cate&oper_parent=unit'),
+        ),
+        
+		'list_button' => array
+        (
+        	'edit' => array('编辑'),
+        )
+	),
+
+	'default' => array
+	(
+		'col' => 'name,en_name,type_id,reorder,state,cdate',
+		'value' => array
+		(
+			# 重量单位Weight
+			'"千克","kilogram",1,1199,1,' . DEVER_TIME,
+			'"克","gram",1,1198,1,' . DEVER_TIME,
+			'"吨","ton",1,197,1,' . DEVER_TIME,
+			'"公吨","metricton",1,196,1,' . DEVER_TIME,
+			'"长吨","longton",1,195,1,' . DEVER_TIME,
+			'"短吨","shortton",1,194,1,' . DEVER_TIME,
+			'"盎司","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,
+
+			# 长度单位Length
+			'"米","meter",3,1399,1,' . DEVER_TIME,
+			'"英尺","foot",3,398,1,' . DEVER_TIME,
+			'"码","yard",3,399,1,' . DEVER_TIME,
+
+			# 面积单位Area
+			'"平方米","squaremeter",4,499,1,' . DEVER_TIME,
+			'"平方英尺","squarefeet",4,498,1,' . DEVER_TIME,
+			'"平方码","squareyard",4,497,1,' . DEVER_TIME,
+
+			# 体积单位Voiume
+			'"立方米","cubicmeter",5,599,1,' . DEVER_TIME,
+			'"立方英尺","cubicfoot",5,598,1,' . DEVER_TIME,
+			'"立方码","cubicyard",5,597,1,' . DEVER_TIME,
+
+			# 容积单位Capality
+			'"公升","litre",6,699,1,' . DEVER_TIME,
+			'"加仑","gallon",6,698,1,' . DEVER_TIME,
+			'"蒲式耳","bushel",6,697,1,' . DEVER_TIME,
+		),
+	),
+
+	'request' => array
+	(
+		'getAll' => array
+		(
+			# 匹配的正则或函数 选填项
+			'option' => array
+			(
+				'type_id' => 'yes',
+				'state' => 1,
+			),
+			'type' => 'all',
+			'order' => array('reorder' => 'desc', 'id' => 'desc'),
+			'col' => 'id,id as value, name',
+		),
+	)
+);

+ 39 - 6
module/scm_product/database/unit.php → database/unit_cate.php

@@ -3,9 +3,9 @@
 return array
 (
 	# 表名
-	'name' => 'unit',
+	'name' => 'unit_cate',
 	# 显示给用户看的名称
-	'lang' => '单位管理',
+	'lang' => '单位自定义类别',
 	# 是否显示在后台菜单
 	'order' => 10,
 	'menu' => false,
@@ -27,9 +27,9 @@ return array
 		'name'		=> array
 		(
 			'type' 		=> 'varchar-150',
-			'name' 		=> '单位名称',
+			'name' 		=> '类别名称',
 			'default' 	=> '',
-			'desc' 		=> '单位名称',
+			'desc' 		=> '类别名称',
 			'match' 	=> 'is_string',
 			'update'	=> 'text',
 			'search'	=> 'fulltext',
@@ -76,11 +76,44 @@ return array
 
 	'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',
+		),
 	)
 );

+ 134 - 0
database/unit_type.php

@@ -0,0 +1,134 @@
+<?php
+
+return array
+(
+	# 表名
+	'name' => 'unit_type',
+	# 显示给用户看的名称
+	'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,
+		),
+
+		'en_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' => 'id,name,en_name,reorder,state,cdate',
+		'value' => array
+		(
+			'1,"重量单位","weight",1000,1,' . DEVER_TIME,
+			'2,"数量单位","number",900,1,' . DEVER_TIME,
+			'3,"长度单位","length",800,1,' . DEVER_TIME,
+			'4,"面积单位","area",700,1,' . DEVER_TIME,
+			'5,"体积单位","voiume",600,1,' . DEVER_TIME,
+			'6,"容积单位","capality",500,1,' . DEVER_TIME,
+		),
+	),
+
+	'request' => array
+	(
+		'getAll' => array
+		(
+			# 匹配的正则或函数 选填项
+			'option' => array
+			(
+				'state' => 1,
+			),
+			'type' => 'all',
+			'order' => array('reorder' => 'desc', 'id' => 'desc'),
+			'col' => 'id,id as value, name',
+		),
+	)
+);

+ 58 - 0
lib/Order.php

@@ -0,0 +1,58 @@
+<?php
+
+namespace Scm\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);
+        }
+    }
+}

+ 118 - 0
lib/Stock.php

@@ -0,0 +1,118 @@
+<?php
+
+namespace Scm\Lib;
+
+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');
+		$col = Dever::input('col');
+		$goods = Dever::param('goods', $data);
+		list($goods_id, $sku_id) = explode('-', $goods);
+		$where['goods_id'] = $goods_id;
+		$where['sku_id'] = $sku_id;
+		$where[$col] = Dever::input('update_' . $col);
+		$info = Dever::db($table)->getOne($where);
+		if ($info) {
+			$num = Dever::param('num', $data);
+			if ($info['total'] < $num) {
+				$goods_info = Dever::load('scm_product/lib/info')->getBaseInfo($goods_id, $sku_id);
+				return Dever::alert('【' . $goods_info['aname'] . '】剩余库存:' . $info['total'] . $goods_info['unit'] . ',已不足出库');
+			}
+		} else {
+			$goods_info = Dever::load('scm_product/lib/info')->getBaseInfo($goods_id, $sku_id);
+			return Dever::alert('【' . $goods_info['aname'] . '】剩余库存:0' . $goods_info['unit'] . ',已不足出库');
+		}
+	}
+
+    # 更新库存
+    public function update_commit($id, $name, $data)
+    {
+    	$table = Dever::input('table');
+    	$type = Dever::input('type');
+    	$col = Dever::input('col');
+    	$stock = Dever::input('stock');
+
+    	$info = Dever::db($table)->find($id);
+    	if ($table && $type && $info && $info['status'] == 1) {
+    		$audit = Dever::param('audit', $data);
+    		$admin = Dever::load('manage/auth.info');
+    		if ($admin) {
+    			$update['audit_admin'] = $admin['id'];
+    		}
+    		$update['status'] = $audit;
+    		$update['where_id'] = $id;
+    		Dever::db($table)->update($update);
+    		if ($audit == 2) {
+    			# 审核通过 更新库存
+    			$this->up($table, $type, $col, $stock, $info);
+    		}
+    		Dever::db($table . '_goods')->updates(array('option_order_id' => $info['id'], 'set_status' => $update['status']));
+    	}
+    }
+
+    public function up($table, $type, $col, $stock, $info)
+    {
+    	if ($col && $stock && isset($info[$col])) {
+    		$order_goods = Dever::db($table . '_goods')->select(array('order_id' => $info['id'], 'status' => 1));
+			if ($order_goods) {
+				foreach ($order_goods as $k => $v) {
+					$update = array('goods_id' => $v['goods_id'], $col => $info[$col]);
+					$goods = Dever::db($stock)->find($update);
+					if (!$goods) {
+						Dever::db($stock)->insert($update);
+					}
+					$update['sku_id'] = $v['sku_id'];
+					$goods = Dever::db($stock . '_sku')->find($update);
+					if (!$goods) {
+						if ($type == 'in') {
+							if (!$v['batch']) {
+								$v['batch'] = date('Ymd');
+							}
+							$where['batch'] = $v['batch'];
+							$where['cash'] = $v['cash'];
+						}
+						$id = Dever::db($stock . '_sku')->insert($update);
+						$where['where_id'] = $id;
+					} else {
+						$where['where_id'] = $goods['id'];
+					}
+
+					$where[$type . '_num'] = $v['num'];
+					$method = $type . 'Update';
+					Dever::db($stock . '_sku')->$method($where);
+
+					//Dever::db($table . '_goods')->update(array('where_id' => $v['id'], 'status' => 2));
+				}
+			}
+		}
+    }
+}

+ 78 - 0
lib/Unit.php

@@ -0,0 +1,78 @@
+<?php
+
+namespace Scm\Lib;
+
+use Dever;
+
+class Unit
+{
+	private $default = array(
+        'value' => -1,
+        'name' => '请选择',
+    );
+
+	/**
+     * 获取单位
+     *
+     * @return mixed
+     */
+    public function get_api()
+    {
+        # 联动总数
+        $level_total = 2;
+
+        # 当前联动级别
+        $level_num = Dever::input('level_num');
+
+        # 一般为id
+        $level_id = Dever::input('level_id');
+
+        # 是否是搜索列表页
+        $level_search = Dever::input('level_search');
+        $default = $this->default;
+
+        if ($level_id < 0) {
+            Dever::alert('error');
+        }
+
+        $config = Dever::db('scm/unit')->config['config_type'];
+
+        # 联动
+        if ($level_num == 1) {
+        	$data = array();
+            foreach ($config as $k => $v) {
+            	$d['value'] = $k;
+            	$d['name'] = $v;
+            	$data[] = $d;
+            }
+        } elseif ($level_num == 2) {
+            $data = Dever::db('scm/unit')->getAll(array('type' => $level_id));
+        }
+
+        if (!$data) {
+            Dever::alert('error');
+        }
+
+        if ($level_search || $level_num >= 1) {
+            array_unshift($data, $default);
+        }
+
+        $result['level_total'] = $level_total;
+        $result['list'] = $data;
+        return $result;
+    }
+
+    # 添加新单位
+    public function add_api()
+    {
+    	$where['name'] = Dever::input('value');
+    	if (!$where['name']) {
+    		Dever::alert('请输入单位名称');
+    	}
+        $info = Dever::db('scm/unit')->find($where);
+        if (!$info) {
+        	$info['id'] = Dever::db('scm/unit')->insert($where);
+        }
+        return $info;
+    }
+}

+ 101 - 46
module/scm_product/database/info.php

@@ -8,17 +8,6 @@ $status = array
 
 $id = Dever::input('where_id');
 
-$unit = function()
-{
-	$array = array();
-	$data = Dever::load('scm_product/unit-state');
-	if($data)
-	{
-		$array += $data;
-	}
-	return $array;
-};
-
 $type = array
 (
 	1 => '实物商品',
@@ -42,24 +31,17 @@ $commission_type = array
 
 $account = function()
 {
-	$array = array();
-	$data = Dever::load('account/config-state');
-	if($data)
-	{
-		$array += $data;
-	}
-	return $array;
+	return Dever::load('account/config-state');
 };
 
 $score = function()
 {
-	$array = array();
-	$data = Dever::load('score/config-state');
-	if($data)
-	{
-		$array += $data;
-	}
-	return $array;
+	return Dever::load('score/config-state');
+};
+
+$unit_cate = function()
+{
+	return Dever::load('scm/unit_cate-state');
 };
 
 $sell_type = array
@@ -84,7 +66,7 @@ $config = array
 	'name' => 'info',
 	# 显示给用户看的名称
 	'lang' => '商品资料',
-	'order' => 200,
+	'order' => 500,
 	'auto' => 10000000,
 	'set' => array
 	(
@@ -143,21 +125,6 @@ $config = array
 			//'edit'		=> true,
 		),
 
-		'unit'		=> array
-		(
-			'type' 		=> 'int-11',
-			'name' 		=> '商品单位',
-			'default' 	=> '',
-			'desc' 		=> '商品单位',
-			'match' 	=> 'is_numeric',
-			'search'	=> 'select',
-			'lang'		=> '请选择',
-			'update'	=> 'select',
-			'option'	=> $unit,
-			'option_add' => array('[添加新单位]', 'scm_product/lib/unit.add'),
-			'tab'		=> 1,
-		),
-
 		'type'		=> array
 		(
 			'type' 		=> 'int-11',
@@ -243,6 +210,94 @@ $config = array
 			//'control'	=> 'pay_type',
 		),
 
+		'unit'		=> array
+		(
+			'type' 		=> 'varchar-150',
+			'name' 		=> '基本单位-一般为商品的最小单位,如个、袋、克等',
+			'default' 	=> '',
+			'desc' 		=> '基本单位',
+			'match' 	=> 'is_numeric',
+			'update'    => 'linkage',
+			'option'    => Dever::url('lib/unit.get', 'scm'),
+			'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',
+                ),
+            ),
+        ),
+
 		'commission'		=> array
 		(
 			'type' 		=> 'varchar-20',
@@ -251,7 +306,7 @@ $config = array
 			'desc' 		=> '销售佣金',
 			'match' 	=> 'is_string',
 			'update'	=> 'text',
-			'tab'		=> 1,
+			'tab'		=> 4,
 		),
 
 		'commission_type'		=> array
@@ -265,7 +320,7 @@ $config = array
 			'option'	=> $commission_type,
 			'search'	=> 'select',
 			//'list'		=> true,
-			'tab'		=> 1,
+			'tab'		=> 4,
 			'control'	=> 'commission_type',
 		),
 
@@ -278,7 +333,7 @@ $config = array
 			'match' 	=> 'is_numeric',
 			'update'	=> 'radio',
 			'option'	=> $account,
-			'tab'		=> 1,
+			'tab'		=> 4,
 			'show'		=> 'commission_type=1',
 		),
 
@@ -291,7 +346,7 @@ $config = array
 			'match' 	=> 'is_numeric',
 			'update'	=> 'radio',
 			'option'	=> $score,
-			'tab'		=> 1,
+			'tab'		=> 4,
 			'show'		=> 'commission_type=2',
 		),
 
@@ -640,7 +695,7 @@ $config = array
                 'state' => 1,
             ),
             'type' => 'one',
-            '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',
+            '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',
         ),
 	),
 );

+ 1 - 1
module/scm_product/database/price.php

@@ -37,7 +37,7 @@ return array
 	'lang' => '价格模板',
 	'info' => '在商品中设置的价格是默认价格,如果一个SKU想设置不同的价格,则可以通过价格模板设置',
 	# 是否显示在后台菜单
-	'order' => 9,
+	'order' => 100,
 
 	# 数据结构
 	'struct' => array

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

@@ -189,6 +189,13 @@ class Manage
 
     public function searchRole_api()
     {
+        $in_type = Dever::input('in_type');
         $service_id = Dever::input('service_id');
+        $servicer_store_id = Dever::input('servicer_store_id');
+
+        if ($in_type == 2) {
+            # 生成仓库入库单
+            
+        }
     }
 }

+ 3 - 2
module/scm_product/lib/Order.php

@@ -10,6 +10,7 @@ class Order
     {
         $table = Dever::input('table');
         $goods = Dever::param('goods', $data);
+        $cash = Dever::param('cash', $data);
         if ($table && $goods) {
             $temp = explode('-', $goods);
             $update = array();
@@ -20,8 +21,8 @@ class Order
             if (!$batch) {
                 $update['batch'] = date('Ymd');
             }
-            if (isset($temp[2])) {
-                $update['cash'] = $temp[2];
+            if (isset($temp[2]) && !$cash) {
+                //$update['cash'] = $temp[2];
             }
             
             Dever::db($table)->update($update);

+ 6 - 2
module/scm_product/lib/Stock.php

@@ -14,6 +14,9 @@ class Stock
 		$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');
@@ -22,9 +25,10 @@ class Stock
 				$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'];
 			}
-			return '单价:' . $info['cash'] . '元 库存:' . $info['total'] . $goods_info['unit'];
+			$result['goods_id'] = '库存:' . $info['total'] . $goods_info['unit'];
+			$result['cash'] = $info['cash'];
 		}
-		return '暂无';
+		return array('data' => $result, 'html' => '');
 	}
 
 	public function out_check($id, $name, $data)

+ 0 - 22
module/scm_product/lib/Unit.php

@@ -1,22 +0,0 @@
-<?php
-
-namespace Scm_product\Lib;
-
-use Dever;
-
-class Unit
-{
-    # 添加新单位
-    public function add_api()
-    {
-    	$where['name'] = Dever::input('value');
-    	if (!$where['name']) {
-    		Dever::alert('请输入单位名称');
-    	}
-        $info = Dever::db('scm_product/unit')->find($where);
-        if (!$info) {
-        	$info['id'] = Dever::db('scm_product/unit')->insert($where);
-        }
-        return $info;
-    }
-}

+ 3 - 1
module/scm_servicer/database/in_order_goods.php

@@ -85,11 +85,12 @@ return array
         'batch'      => array
         (
             'type'      => 'varchar-800',
-            'name'      => '批次号-不输入将自动生成',
+            'name'      => '批次号',
             'default'   => '',
             'desc'      => '批次号',
             'match'     => 'option',
             'update'    => 'text',
+            'value'     => date('Ymd'),
         ),
 
         'cash'      => array
@@ -99,6 +100,7 @@ return array
             'default'   => '',
             'desc'      => '单价',
             'match'     => 'option',
+            'update'    => 'text',
         ),
 
         'num'        => array

+ 1 - 1
module/scm_servicer/database/out_order.php

@@ -158,7 +158,7 @@ return array
             'desc'      => '入库组织',
             'match'     => 'is_numeric',
             'update'    => 'select',
-            'update_search' => 'scm_product/lib/manage.searchRole?servicer_id='.$servicer_id.'&{in_type}',
+            'update_search' => 'scm_product/lib/manage.searchRole?servicer_id='.$servicer_id.'&{in_type,servicer_store_id}',
             'show'		=> 'type=1',
             'show'   => 'in_type=2,3',
             //'list'      => 'Dever::load("scm_servicer/store-one#name", {servicer_store_id})',

+ 2 - 1
module/scm_servicer/database/out_order_goods.php

@@ -85,7 +85,7 @@ return array
         'batch'      => array
         (
             'type'      => 'varchar-800',
-            'name'      => '批次号-不输入将自动生成',
+            'name'      => '批次号-为空将自动生成',
             'default'   => '',
             'desc'      => '批次号',
             'match'     => 'option',
@@ -99,6 +99,7 @@ return array
             'default'   => '',
             'desc'      => '单价',
             'match'     => 'option',
+            'update'    => 'text',
         ),
 
         'num'        => array