dever hace 2 años
padre
commit
7a81b147c7

+ 14 - 2
lib/Price.php

@@ -12,7 +12,7 @@ class Price
     }
 
     # 根据单位获取价格
-    public function getByUnit($goods_id, $sku_id, $unit_id, $num, $col = 'cost_price', $supplier_id = false)
+    public function getByUnit($goods_id, $sku_id, $unit_id, $num, $cash, $in_num = 0, $supplier_id = false)
     {
         $goods_info = Dever::load('scm_product/lib/info')->getBaseInfo($goods_id, $sku_id);
         $result = array();
@@ -29,13 +29,25 @@ class Price
 
             $result['unit_id'] = $unit_id;
             $result['base_unit_id'] = $goods_info['unit_id'];
-            $result['base_cash'] = $result['cash'] = isset($sku[$col]) && $sku[$col] ? $sku[$col] : $goods_info[$col];
+            if (!is_numeric($cash)) {
+                $cash = isset($sku[$cash]) && $sku[$cash] ? $sku[$cash] : $goods_info[$cash];
+            }
+            $result['base_cash'] = $result['cash'] = $cash;
             $result['base_num'] = $result['num'] = $num;
+            $result['in_num'] = $in_num;
                 
             $unit = Dever::db('scm_product/info_unit')->find(array('info_id' => $goods_info['id'], 'unit_id' => $unit_id));
+
             if ($unit && $unit_id != $goods_info['unit_id'] && $unit['discount'] > 0) {
                 $result['cash'] = $result['cash'] * $unit['radio'] * $unit['discount'];
                 $result['base_num'] = $num * $unit['radio'];
+                $result['in_num'] = round($in_num / $unit['radio'], 2);
+            }
+            $unit_info = Dever::db('scm/unit')->one($unit_id);
+
+            $result = Dever::number(array(array('cash', 'base_cash', 'num', 'base_num', 'in_num'), $result));
+            if ($result['in_num'] > 0) {
+                $result['goods_id'] = $result['in_num'] . $unit_info['name'];
             }
         }
 

+ 36 - 9
lib/Stock.php

@@ -16,15 +16,26 @@ class Stock
 		$where['sku_id'] = $sku_id;
 		$where[$col] = Dever::input('update_' . $col);
 		$info = Dever::db($table)->getOne($where);
+		$error = false;
+		$total = '';
 		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'] . ',已不足出库');
+				$error = true;
+				$total = $info['total'];
 			}
 		} else {
+			$error = true;
+			$total = 0;
+		}
+		if ($error) {
+			$order_table = Dever::input('order_table');
+			if ($order_table) {
+				$order_id = Dever::param('order_id', $data);
+				Dever::db($order_table)->delete($order_id);
+			}
 			$goods_info = Dever::load('scm_product/lib/info')->getBaseInfo($goods_id, $sku_id);
-			return Dever::alert('【' . $goods_info['aname'] . '】剩余库存:0' . $goods_info['unit'] . ',已不足出库');
+			Dever::alert('【' . $goods_info['aname'] . '】剩余库存:' . $total . $goods_info['unit'] . ',已不足出库');
 		}
 	}
 
@@ -71,7 +82,7 @@ class Stock
 						Dever::db($stock)->insert($update);
 					}
 
-					$result = Dever::load('scm/lib/price')->getByUnit($v['goods_id'], $v['sku_id'], $v['unit_id'], $v['num'], 'cost_price', Dever::input('supplier_id'));
+					$result = Dever::load('scm/lib/price')->getByUnit($v['goods_id'], $v['sku_id'], $v['unit_id'], $v['num'], $v['cash'], Dever::input('supplier_id'));
 					if ($result) {
 						$v['unit_id'] = $result['base_unit_id'];
 						$v['cash'] = $result['base_cash'];
@@ -81,8 +92,8 @@ class Stock
     					Dever::alert('商品不存在');
 					}
 
-					# 入库
 					if ($type == 'in') {
+						# 入库
 						if (!$v['batch']) {
 							$v['batch'] = date('Ymd');
 						}
@@ -100,11 +111,27 @@ class Stock
 						} else {
 							$where['where_id'] = $goods['id'];
 						}
-					}
 
-					$where[$type . '_num'] = $v['num'];
-					$method = $type . 'Update';
-					Dever::db($stock . '_sku')->$method($where);
+						$where[$type . '_num'] = $v['num'];
+						$method = $type . 'Update';
+						Dever::db($stock . '_sku')->$method($where);
+					} elseif ($type == 'out') {
+						# 出库
+						$update['sku_id'] = $v['sku_id'];
+						$goods = Dever::db($stock . '_sku')->getList($update);
+						if ($goods) {
+							$num = $v['num'];
+							foreach ($goods as $k1 => $v1) {
+								if ($v1['total'] >= $num) {
+									Dever::db($stock . '_sku')->outUpdate(array('where_id' => $v1['id'], 'out_num' => $num));
+									break;
+								} else {
+									$num = $num - $v1['total'];
+									Dever::db($stock . '_sku')->outUpdate(array('where_id' => $v1['id'], 'out_num' => $v1['total']));
+								}
+							}
+						}
+					}
 
 					//Dever::db($table . '_goods')->update(array('where_id' => $v['id'], 'status' => 2));
 				}

+ 388 - 0
module/scm_product/assets/pc/html/set_servicer_store_goods.html

@@ -0,0 +1,388 @@
+<!doctype html>
+<html>
+<head>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0" />
+<meta name="author" content="siweiyong 2602812659@qq.com"/>
+<title>设置商品</title>
+<link rel="stylesheet" href="../script/lib/miniui/themes/default/miniui.css">
+<link rel="stylesheet" href="../script/lib/layui/css/layui.css" />
+<link rel="stylesheet" href="../script/lib/cashier/common.css">
+<link rel="stylesheet" href="../script/lib/layui/admin/modules/plugin/formselects/formselects.css" media="all" />
+<script src="../script/lib/jquery/jquery.min.js"></script>
+<script src="../script/lib/miniui/miniui.js"></script>
+<script src="../script/lib/layui/layui.js"></script>
+<script><{Dever::script()}></script>
+<script src="../script/dever/core.js"></script>
+</head>
+<body style="background: #F6F7F9;">
+<div class="main">
+<form class="layui-form" lay-filter="form">
+    <div class="layui-row">
+        <div class="main_left layui-col-xs12 layui-col-md3">
+            <div class="layui-row">
+                <div class="top">
+                    <i class="layui-icon layui-icon-app"></i>商品列表
+                </div>
+                <div class="left_main">
+                    <input id="key" class="mini-textbox" onenter="onKeyEnter" value="请输入商品名称" onclick="setVal('key')"/>
+                    <a class="mini-button" onclick="search()">查询</a> 
+                    <button class="layui-btn layui-btn-button" type="button" style="vertical-align: middle;margin-bottom: 2px;" onclick="addGoods()">一键添加</button>
+                    <button class="layui-btn layui-btn-button" type="button" style="vertical-align: middle;margin-bottom: 2px;" onclick="delGoods()">一键删除</button>
+                    <ul id="tree1" class="mini-tree" url="<{$url}>" showTreeIcon="true" textField="name" idField="id" expandOnLoad="true" onNodeClick="onNodeClick">
+                    </ul>
+                </div>
+            </div>
+        </div>
+        <div class="main_right layui-col-xs12 layui-col-md9">
+            <div class="layui-row">
+                <div class="top">
+                    <div style="display:none;">
+                        <label>选择商品分类:</label>
+                        <div class="layui-input-inline">
+
+                            <div><select xm-select="shop_id" xm-select-skin="normal" xm-select-search="<{$search}>" xm-select-search-type="dl" xm-select-radio="" class="update_value form-control layui-input layui-select" name="shop_id" id="shop_id"  ></select></div>
+
+                        </div>
+                        <div class="layui-input-inline">
+                            <button class="layui-btn layui-btn-button" type="button" style="vertical-align: middle;margin-bottom: 2px;" onclick="setShop()">确认选择</button>
+                        </div>
+                    </div>
+                    <div class="layui-input-inline" style="margin-left:20px">
+                        <input id="search_key" class="mini-textbox" value="请输入商品名称" onclick="setVal('search_key')"/>
+                        <a class="mini-button" onclick="searchGoods()">搜索</a> 
+                    </div>
+                </div>
+                <div class="goods_list" style="height:645px;">
+                    <table class="layui-table">
+                        <thead>
+                            <tr>
+                                <th lay-data="{field:'id'}">商品ID</th>
+                                <th lay-data="{field:'name'}">商品名称</th>
+                                <th lay-data="{field:'old_cost_price', edit: 'text'}">成本价</th>
+                                <th lay-data="{field:'cost_price', edit: 'text'}">新成本价</th>
+                                <th lay-data="{field:'operation'}">操作</th>
+                            </tr>
+                        </thead>
+                        <tbody id="goods">
+                            
+                        </tbody>
+                    </table>
+                </div>
+                <div class="towbtn">
+                    <input type="button" id="settlement" value="确认设置">
+                </div>
+            </div>
+        </div>
+    </div>
+</div>
+</form>
+</div>
+<script>
+    var form;
+    var goods = {};
+    var del_goods = {};
+    var tree = {};
+    var commission = '<{$info["commission"]}>';
+    layui.config(
+    {
+        base: '../script/lib/layui/admin/' //静态资源所在路径
+        ,version: true
+    }).extend(
+    {
+        index: 'lib/index', //主入口模块
+        formSelects: 'plugin/formselects/formselects'
+    }).use(['index', 'contlist', 'table', 'form', 'formSelects','layer'], function()
+    {
+        var table = layui.table;
+        form = layui.form; 
+        var formSelects = layui.formSelects;
+
+        mini.parse();
+        tree = mini.get("tree1");
+        for (var i in tree.data) {
+            if (typeof(tree.data[i].children) == 'object') {
+                if (tree.data[i].children.length > 0) {
+                    for (var j in tree.data[i].children) {
+                        if(tree.data[i].children[j].select == 1) {
+                            setGoods(tree.data[i].children[j]);
+                        }
+                    }
+                } else if(tree.data[i].select == 1) {
+                    setGoods(tree.data[i]);
+                }
+            }
+        }
+    });
+
+    $(function()
+    {
+        $("#settlement").click(function(){
+            var url = '<{$submit}>';
+            var id = '<{$id}>';
+            var role = '<{$role}>';
+
+            layui.layer.confirm('确定进行此项设置吗?', function() {
+                var goods_string = JSON.stringify(goods);
+
+                var data = {};
+                data = {id:id, role:role, goods:goods_string};
+                $.post(url, data, function(t) {
+                    t = JSON.parse(t);
+                    if (t.status == 1) {
+                        layui.layer.alert('商品设置成功', function(index){
+                          if (t.data == 'refer') {
+                                history.back();
+                            } else {
+                                location.href = t.data;
+                            }
+                          layer.close(index);
+                        });
+                    } else {
+                        layui.layer.alert(t.msg);
+                    }
+                });
+            });
+        })
+
+        $("#goods").on("keyup", ".cost_price", function() {
+            var num = parseFloat($(this).val());
+            var id = $(this).parent().attr('value');
+            goods[id].cost_price = num;
+            setTotal();
+        })
+    })
+
+    function search() 
+    {
+        var key = mini.get("key").getValue();
+        if (key == "") {
+            tree.clearFilter();
+        } else {
+            key = key.toLowerCase();                
+            tree.filter(function (node) {
+                var name = node.name ? node.name.toLowerCase() : "";
+                if (name.indexOf(key) != -1) {
+                    return true;
+                }
+            });
+        }
+    }
+    function onKeyEnter(e)
+    {
+        search();
+    }
+
+    function onNodeClick()
+    {
+        var tree=mini.get("tree1");
+        node=tree.getSelectedNode();
+        if(node.end) {
+            setGoods(node);
+        }
+    }
+
+    function setVal(e)
+    {
+        mini.get(e).setValue('');
+    }
+
+    function searchGoods() 
+    {
+        var key = mini.get("search_key").getValue();
+
+        if (key == "") {
+            $(".mytr").show();
+        } else {
+            key = key.toLowerCase(); 
+            $(".mytr").show();               
+            $(".goods_name").each(function(t) {
+                var name = $(this).html();
+                name = name.toLowerCase(); 
+                if (name.indexOf(key) == -1) {
+                    $(this).parent().hide();
+                }
+            });
+        }
+    }
+
+    // 一键添加
+    function addGoods()
+    {
+        var key = mini.get("key").getValue();
+        if (key == '请输入商品名称') {
+            key = '';
+        }
+        if (key) {
+            key = key.toLowerCase();
+        }
+        for (var i in tree.data) {
+            if (typeof(tree.data[i].children) == 'object') {
+                if (tree.data[i].children.length > 0) {
+                    for (var j in tree.data[i].children) {
+                        if (key) {
+                            var name = tree.data[i].children[j].name;
+                            if (name.indexOf(key) != -1) {
+                                setGoods(tree.data[i].children[j]);
+                            }
+                        } else {
+                            setGoods(tree.data[i].children[j]);
+                        }
+                    }
+                } else {
+                    if (key) {
+                        var name = tree.data[i].name;
+                        if (name.indexOf(key) != -1) {
+                            setGoods(tree.data[i]);
+                        }
+                    } else {
+                        setGoods(tree.data[i]);
+                    }
+                }
+            }
+        }
+    }
+
+    // 一键删除
+    function delGoods()
+    {
+        if (confirm('确定删除吗?')) {
+            var key = mini.get("key").getValue();
+            if (key == '请输入商品名称') {
+                key = '';
+            }
+            if (key) {
+                key = key.toLowerCase();
+            }
+            for (var i in tree.data) {
+                if (typeof(tree.data[i].children) == 'object') {
+                    if (tree.data[i].children.length > 0) {
+                        for (var j in tree.data[i].children) {
+                            if (key) {
+                                var name = tree.data[i].children[j].name;
+                                if (name.indexOf(key) != -1) {
+                                    unsetGoods(tree.data[i].children[j]);
+                                }
+                            } else {
+                                unsetGoods(tree.data[i].children[j]);
+                            }
+                        }
+                    } else {
+                        if (key) {
+                            var name = tree.data[i].name;
+                            if (name.indexOf(key) != -1) {
+                                unsetGoods(tree.data[i]);
+                            }
+                        } else {
+                            unsetGoods(tree.data[i]);
+                        }
+                    }
+                }
+            }
+            setTotal();
+        }
+    }
+
+    function unsetGoods(node)
+    {
+        if (node.id) {
+            if (goods[node.id]) {
+                goods[node.id].del = 2;
+                goods[node.id].num = 0;
+                goods[node.id].total = 0;
+                get(node.id).remove();
+            }
+        }
+    }
+
+    function setGoods(node)
+    {
+        if (node.id) {
+            var key = node.id;
+            if (!goods[key] || (goods[key] && goods[key].del == 2)) {
+                goods[key] = node;
+                goods[key].old_cost_price = parseFloat(goods[key].old_cost_price);
+                goods[key].cost_price = parseFloat(goods[key].cost_price);
+                goods[key].type = parseInt(goods[key].type);
+                goods[key].total = parseFloat(goods[key].total);
+                goods[key].min = goods[key].min ? parseFloat(goods[key].min) : 1;
+                goods[key].num = 0;
+                goods[key].del = 1;
+                create(node);
+                setTotal();
+            } else if(node.type < 4) {
+                add(key);
+            }
+        }
+    }
+
+    function get(key)
+    {
+        return $('#goods_' + key);
+    }
+
+    function create(node)
+    {
+        if (!get(node.id).length) {
+            var select = '';
+            var addtr = '<tr class="mytr" id="goods_'+node.id+'">';
+            addtr += '<td class="goods_id">'+node.id+'</td>';
+            addtr += '<td class="goods_name">'+node.name+'</td>'; 
+
+            addtr += '<td class="goods_prices">'+node.old_cost_price+'</td>';
+
+            addtr += '<td class="cost_price" value='+node.id+'><input type="tel" class="layui-input cost_price" value="'+node.cost_price+'" /></td>';
+            
+            addtr += '<td><a class="delete_btn" onclick="del(\''+node.id+'\')">删除</a></td>';
+                                  
+            addtr += '</tr>';
+            $("#goods").append(addtr);
+            form.render();
+            //$('.goods_price_template').change();
+        }
+    }
+
+    function setPrice(e, id)
+    {
+        var val = e.val().split('_');
+        goods[id].price_template_id = val[0];
+        e.parent().find('span').html(val[1]);
+        //goods[id].min = val[2];
+        //e.parent().parent().find('.goods_min').val(val[2]);
+    }
+
+    function add(id)
+    {
+        goods[id].num += 1;
+        get(id).find('.goods_num').val(goods[id].num);
+        setTotal();
+    }
+    
+    function dec(id)
+    {
+        goods[id].num -= 1;
+        if (goods[id].num < 1) {
+            goods[id].num = 0;
+        }
+
+        get(id).find('.goods_num').val(goods[id].num);
+        setTotal();
+    }
+
+    function del(id)
+    {
+        //if (confirm('确定删除吗?')) {
+            goods[id].del = 2;
+            goods[id].num = 0;
+            get(id).remove();
+            setTotal();
+        //}
+    }
+
+    function setTotal()
+    {
+        
+    }
+</script>
+</body>
+</html>

+ 3 - 2
module/scm_product/assets/pc/html/set_supplier_goods.html

@@ -120,13 +120,14 @@
         $("#settlement").click(function(){
             var url = '<{$submit}>';
             var id = '<{$id}>';
-            var role = '<{$role}>';
+            var project = '<{$project}>';
+            var goods = '<{$goods}>';
 
             layui.layer.confirm('确定进行此项设置吗?', function() {
                 var goods_string = JSON.stringify(goods);
 
                 var data = {};
-                data = {id:id, role:role, goods:goods_string};
+                data = {id:id, project:project, goods:goods, goods:goods_string};
                 $.post(url, data, function(t) {
                     t = JSON.parse(t);
                     if (t.status == 1) {

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

@@ -234,7 +234,8 @@ class Manage
     public function showInfo_api()
     {
         $goods = Dever::input('value');
-        list($goods_id, $sku_id) = explode('-', $goods);
+        $cash_col = Dever::input('cash_col', 'cost_price');
+        list($goods_id, $sku_id, $cash) = explode('-', $goods);
         $goods_info = Dever::load('scm_product/lib/info')->getBaseInfo($goods_id, $sku_id);
         $option = array();
         $result = array();
@@ -246,6 +247,8 @@ class Manage
             $where['goods_id'] = $goods_id;
             $where['sku_id'] = $sku_id;
 
+            $result['cash'] = $goods_info[$cash_col];
+
             $info = array();
 
             # 仓库
@@ -255,16 +258,19 @@ class Manage
                 $info = Dever::db('scm_servicer/store_goods_sku')->getOne($where);
             }
 
+            if ($info) {
+                $result['cash'] = $info['cash'];
+                $result['goods_id'] = $info['total'] . $goods_info['unit'];
+            }
+
             # 获取供应商供货价
             $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'];
+                if ($sku && isset($sku[$cash_col]) && $sku[$cash_col]) {
+                    $result['cash'] = $sku['cost_price'];
+                }
             }
 
             $result['unit_id'] = $goods_info['unit_id'];
@@ -281,6 +287,8 @@ class Manage
                     }
                 }
             }
+            $result['cash'] = Dever::number($result['cash']);
+            $result['num'] = '1.00';
         }
         
         return array('data' => $result, 'html' => '', 'option' => $option);
@@ -291,8 +299,15 @@ class Manage
     {
         $unit = Dever::input('value');
         $goods = Dever::input('goods');
-        list($goods_id, $sku_id) = explode('-', $goods);
-        
-        return array('data' => Dever::load('scm/lib/price')->getByUnit($goods_id, $sku_id, $unit, 1, 'cost_price', Dever::input('supplier_id')), 'html' => '');
+        $temp = explode('-', $goods);
+        $goods_id = $temp[0];
+        $sku_id = $temp[1];
+        $cash = $temp[2];
+        $in_num = 0;
+        if (isset($temp[3])) {
+            $in_num = $temp[3];
+        }
+
+        return array('data' => Dever::load('scm/lib/price')->getByUnit($goods_id, $sku_id, $unit, 1, $cash, $in_num, Dever::input('supplier_id')), 'html' => '');
     }
 }

+ 10 - 7
module/scm_product/lib/Set.php

@@ -10,17 +10,18 @@ class Set
     public function goods_api()
     {
         $id = Dever::input('id', 1);
-        $role = Dever::input('role');
+        $project = Dever::input('project');
+        $goods = Dever::input('goods');
         $price_id = Dever::input('price_id', -1);
         $type = Dever::input('type', 1);
         $source = '';
-        $table = 'scm_'.$role.'/goods_sku';
+        $table = 'scm_'.$project.'/' . $goods;
         if ($type == 2) {
             $source = $table;
             $table = '';
         }
         $goods_category = Dever::input('goods_category');
-        $where[$role . '_id'] = $id;
+        $where[$project . '_id'] = $id;
         return Dever::outDiy(Dever::load('scm_product/lib/info')->getSetList($table, $where, $goods_category, 'goods_id', array(), $price_id, $source));
     }
 
@@ -29,13 +30,15 @@ class Set
     {
         $data = array();
         $data['id'] = Dever::input('id', 1);
-        $data['role'] = Dever::input('role');
-        $info = Dever::db('scm_' . $data['role'] . '/info')->find($data['id']);
+        $data['project'] = Dever::input('project');
+        $data['info'] = Dever::input('info');
+        $data['goods'] = Dever::input('goods');
+        $info = Dever::db('scm_' . $data['project'] . '/' . $data['info'])->find($data['id']);
         $data['info'] = $info;
 
         $data['host'] = Dever::url('lib/set.home', 'scm_product');
 
-        $uri = 'lib/set.goods?id=' . $data['id'] . '&role=' . $data['role'];
+        $uri = 'lib/set.goods?id=' . $data['id'] . '&project=' . $data['project'] . '&goods=' . $data['goods'];
 
         if (isset($info['category'])) {
         	$uri .= '&goods_category=' . $info['category'];
@@ -46,7 +49,7 @@ class Set
         $data['url'] = Dever::url($uri, 'scm_product');
         $data['submit'] = Dever::url('lib/set.action_commit?json=1', 'scm_product');
 
-        return Dever::render('set_' . $data['role'] . '_goods', $data);
+        return Dever::render('set_' . $data['project'] . '_goods', $data);
     }
 
     # 配置商品

+ 6 - 0
module/scm_product/lib/Sku.php

@@ -44,6 +44,12 @@ class Sku
                         if (isset($copy['value'])) {
                             $copy['value'] = $copy['id'];
                         }
+                        if (isset($copy['cash'])) {
+                            $copy['value'] .= '-' . $copy['cash'];
+                            if (isset($copy['in_num'])) {
+                                $copy['value'] .= '-' . $copy['in_num'];
+                            }
+                        }
                     }
                     
                     $data[] = $copy;

+ 2 - 1
module/scm_seller/database/info.php

@@ -440,9 +440,10 @@ return array
         (
         	'location' => array('商品设置', Dever::url('lib/set.home?role=seller', 'scm_product'), '{stock} == 1'),
             'br3' => array('<br />'),
-            'location1' => array('订货下单', Dever::url('lib/seller.buyGoods', 'scm_role'), '{stock} == 1'),
             'location2' => array('入库下单', Dever::url('lib/seller.buyGoods', 'scm_role'), '{stock} == 1'),
             'location3' => array('出库下单', Dever::url('lib/seller.buyGoods', 'scm_role'), '{stock} == 1'),
+            'location1' => array('订货下单', Dever::url('lib/seller.buyGoods', 'scm_role'), '{stock} == 1'),
+            'location4' => array('代客下单', Dever::url('lib/seller.buyGoods', 'scm_role'), '{stock} == 1'),
             'br4' => array('<br />'),
             'fast_add' => array('账户操作', 'push&project=account&oper_table=info&oper_project=scm_seller&uid={id}', '{account}'),
             'list' => array('账户流水', 'info_log&project=account&oper_table=info&oper_project=scm_seller&search_option_uid={id}', '{account}'),

+ 6 - 0
module/scm_servicer/assets/manage/html/out_order_goods.html

@@ -0,0 +1,6 @@
+
+<form class="layui-form form10" action="" target="f10" method="post">
+<iframe id="f10" name="f10" style="display:none;"></iframe>
+<div class="layui-form-item" id="show">
+</div>
+</form>

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

@@ -97,7 +97,7 @@ return array
         'batch'      => array
         (
             'type'      => 'varchar-800',
-            'name'      => '批次号',
+            'name'      => '入库批次号',
             'default'   => '',
             'desc'      => '批次号',
             'match'     => 'option',

+ 6 - 4
module/scm_servicer/database/out_order.php

@@ -38,6 +38,8 @@ $in_type = array
     //3 => '生成经销商入库单',
 );
 
+$col = Dever::input('col');
+
 return array
 (
     # 表名
@@ -51,8 +53,8 @@ return array
     ),
     'end' => array
     (
-        'insert' => 'scm_product/lib/order.updateOrderNum?table=scm_servicer/out_order&prefix=CO',
-        'update' => 'scm_product/lib/stock.update_commit?table=scm_servicer/out_order&stock=scm_servicer/store_goods&type=out&col=servicer_store_id',
+        'insert' => 'scm/lib/order.updateOrderNum?table=scm_servicer/out_order&prefix=CO',
+        'update' => 'scm/lib/stock.update_commit?table=scm_servicer/out_order&stock=scm_servicer/store_goods&type=out&col=servicer_store_id',
     ),
 
     # 数据结构
@@ -207,7 +209,7 @@ return array
             'desc'      => '审核状态',
             'match'     => 'is_numeric',
             'option'    => $audit,
-            //'update'    => 'radio',
+            'update'    => $col ? 'radio' : false,
         ),
 
         'audit_desc'        => array
@@ -217,7 +219,7 @@ return array
             'default'   => '',
             'desc'      => '审核备注',
             'match'     => 'option',
-            //'update'    => 'textarea',
+            'update'    => $col ? 'textarea' : false,
         ),
 
         'audit_admin'     => array

+ 3 - 3
module/scm_servicer/database/out_order_goods.php

@@ -18,7 +18,7 @@ return array
     # 验证库存
     'start' => array
     (
-    	'insert' => 'scm/lib/stock.out_check?table=scm_servicer/store_goods_sku&col=servicer_store_id',
+    	'insert' => 'scm/lib/stock.out_check?table=scm_servicer/store_goods_sku&order_table=scm_servicer/out_order&col=servicer_store_id',
     ),
     'end' => array
     (
@@ -97,7 +97,7 @@ return array
         'batch'      => array
         (
             'type'      => 'varchar-800',
-            'name'      => '批次号',
+            'name'      => '出库批次号',
             'default'   => '',
             'desc'      => '批次号',
             'match'     => 'option',
@@ -166,7 +166,7 @@ return array
     (
         'insert' => false,
         'delete' => false,
-        'page_list' => 'in_order_goods',
+        'page_list' => 'out_order_goods',
     ),
 
     'request' => array

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

@@ -275,7 +275,7 @@ $config = array
                 'state' => 1,
             ),
             'type' => 'all',
-            'order' => array('id' => 'desc'),
+            'order' => array('sdate' => 'asc', 'batch' => 'asc', 'id' => 'desc'),
             'col' => '*,in_num-out_num as total|sku_id',
         ),
 

+ 1 - 1
module/scm_servicer/lib/In.php

@@ -122,7 +122,7 @@ class In
                 $status_name = Dever::status($status, $v['status']);
 
                 if ($v['unit_id'] != $goods_info['base_unit_id']) {
-                    $unit = Dever::load('scm/lib/price')->getByUnit($v['goods_id'], $v['sku_id'], $v['unit_id'], $v['num'], 'cost_price', $info['supplier_id']);
+                    $unit = Dever::load('scm/lib/price')->getByUnit($v['goods_id'], $v['sku_id'], $v['unit_id'], $v['num'], $v['cash'], $info['supplier_id']);
                     if ($unit) {
                         $base_unit = Dever::db('scm/unit')->find($goods_info['base_unit_id']);
                         $goods_info['unit'] .= '(审核成功将转换成:'.$unit['base_num'].''.$base_unit['name'].')';

+ 16 - 8
module/scm_servicer/lib/Out.php

@@ -35,9 +35,9 @@ class Out
     {
         $id = Dever::input('order_id');
 
-        $config = Dever::db('scm_servicer/in_order')->config['set'];
+        $config = Dever::db('scm_servicer/out_order')->config['set'];
 
-        $info = Dever::db('scm_servicer/in_order')->one($id);
+        $info = Dever::db('scm_servicer/out_order')->one($id);
 
         $status = Dever::status($config['status'], $info['status']);
 
@@ -45,7 +45,7 @@ class Out
 
         $store = Dever::db('scm_servicer/store')->one($info['servicer_store_id']);
 
-        $supplier = Dever::db('scm_supplier/info')->one($info['supplier_id']);
+        $type = Dever::db('scm_servicer/out_order_type')->one($info['type']);
 
         $cdate = date('Y-m-d H:i', $info['cdate']);
 
@@ -60,11 +60,11 @@ class Out
                 (
                     array('配送商', $member['name']),
                     array('仓库', $store['name']),
-                    array('供应商', $supplier['name']),
                 ),
 
                 array
                 (
+                    array('出库类型', $type['name']),
                     array('订单状态', $status),
                     array('订单备注', $info['info']),
                 ),
@@ -100,18 +100,26 @@ class Out
         $body_total['price'] = 0;
         $body_total['num'] = 0;
 
-        $data = Dever::db('scm_servicer/in_order_goods')->select(array('order_id' => $id));
+        $data = Dever::db('scm_servicer/out_order_goods')->select(array('order_id' => $id));
 
         if ($data) {
-            $status = Dever::db('scm_servicer/in_order_goods')->config['status'];
+            $status = Dever::db('scm_servicer/out_order_goods')->config['status'];
             foreach ($data as $k => $v) {
-                $goods_info = Dever::load('scm_product/lib/info')->getBaseInfo($v['goods_id'], $v['sku_id']);
+                $goods_info = Dever::load('scm_product/lib/info')->getBaseInfo($v['goods_id'], $v['sku_id'], $v['unit_id']);
                 $status_name = Dever::status($status, $v['status']);
 
+                if ($v['unit_id'] != $goods_info['base_unit_id']) {
+                    $unit = Dever::load('scm/lib/price')->getByUnit($v['goods_id'], $v['sku_id'], $v['unit_id'], $v['num'], $v['cash']);
+                    if ($unit) {
+                        $base_unit = Dever::db('scm/unit')->find($goods_info['base_unit_id']);
+                        $goods_info['unit'] .= '(审核成功将转换成:'.$unit['base_num'].''.$base_unit['name'].')';
+                    }
+                }
+                
                 $detail = array
                 (
                     'pic' => $goods_info['cover'],
-                    'name' => $goods_info['name'],
+                    'name' => $goods_info['name'] . ' [批次:'.$v['batch'].']',
                     'sku' => $goods_info['spec_name'],
                     'price' => $v['cash'],
                     'num' => $v['num'] . $goods_info['unit'],

+ 5 - 0
module/scm_servicer/template/manage/out_order_goods.php

@@ -0,0 +1,5 @@
+<?php
+
+$view
+->fetch('#show', 'scm_servicer/lib/out.show')
+->display();

+ 1 - 1
module/scm_supplier/database/info.php

@@ -339,7 +339,7 @@ return array
         ),
         'list_button' => array
         (
-        	'location' => array('商品设置', Dever::url('lib/set.home?role=supplier', 'scm_product')),
+        	'location' => array('商品设置', Dever::url('lib/set.home?project=supplier&goods=goods_sku&info=info', 'scm_product')),
         )
 	),