MVC大型商贸系统(库存管理)技术解释(七) 商品转库

MVC大型商贸系统(库存管理)技术解释(七)商品转库

1、  界面效果:

1.1、商品转库处理:

1.2、商品转库查询:


2、  代码:

2.1、转库处理HTML代码:

<!DOCTYPE html>
<html>
<head>
    <meta content="text/javascript;charset=utf-8" />
    <title>DealWithTransferRepertory</title>
    <script src="../../Content/yxsss/js_css/yu.js"></script>
    <link href="../../Content/yxsss/js_css/yu.css" rel="stylesheet" />
    <link href="../../Content/jquery-easyui-1.3.3/themes/icon.css" rel="stylesheet" />
    <link href="../../Content/jquery-easyui-1.3.3/demo/demo.css" rel="stylesheet" />
    <link href="../../Content/jquery-easyui-1.3.3/themes/default/easyui.css" rel="stylesheet" />
    <link href="../../Content/MyCSS/DealWithTransferRepertory.css" rel="stylesheet" />
    <script src="../../Content/jquery-easyui-1.3.3/jquery.min.js"></script>
    <script src="../../Content/jquery-easyui-1.3.3/jquery.easyui.min.js"></script>
    <script src="../../Content/jquery-easyui-1.3.3/easyloader.js"></script>
    <script src="../../Scripts/MyScript/DealWithTransferRepertory.js"></script>

</head>
<body οnlοad="AddRunningDiv();" style="text-align: center">
    <div style="display: none">
        <input type="hidden" id="strs" />
        <div class="easyui-window" id="wZhuanKu" title="" data-options="fit:true,collapsible:false,minimizable:false,maximizable:false,
        closable:false,draggable:false,resizable:false,shadow:false,modal:true,center:true">
            <div class="title">
                <span style="float: right">
                    <img οnclick="parent.trans();" id="dimg" src="../../Content/image/delete.png" /></span>转库单处理
            </div>
            <input type="hidden" id="myhidden" />
            <div class="easyui-panel rq" style="margin-left: 0; width: 850px; height: auto; border: none; text-align: left; padding: 5px;">
                <button class="button1" id="btnJiLuBianHao" οnclick="openjiLuBianHao();" style="height: 20px; font-size: 10px;">记录编号</button><input type="text" id="Record_number" style="width: 120px; color: red; text-align: center; font-size: 15px; background-color: #e6e6fa" readonly="readonly" /><br />
                <div style="margin: 5px auto"></div>
                 转库部门:<input id="cobDepartment" class="easyui-combotree" style="width: 200px;" data-options="required:true,missingMessage:'必选项!',onChange:onDepartmentChange" />
                <input id="txtConsignmentDepartmentName" readonly="readonly" style="width: 550px; border-style: none none solid none; color: #0000FF; font-size: 16px; border-width: 1px;" />
            </div>
            <div class="div1 rq" style="margin: 0; height: 80px; border: none; padding: 5px;">
                <div style="width: 400px; height: 80px; float: right; border: none; text-align: left;">
                    <span>
                        <button class="button1" disabled="disabled">发 货 人</button><input class="easyui-combobox" id="cobEmployeeSend" data-options="panelHeight:120,required:true,missingMessage:'必选项!'" style="width: 100px;" /><input type="text" class="input1" id="txtEmployeeSend" /></span><br />
                    <span>
                        <button class="button1" disabled="disabled">接 货 人</button><input class="easyui-combobox" id="cobEmployeeHarvest" data-options="panelHeight:120,required:true,missingMessage:'必选项!'" style="width: 100px;" /><input type="text" class="input1" id="txtEmployeeHarvest" /></span><br />
                    <input type="checkbox" id="check" style="margin-left: 30px;" />清除零库存
                </div>
                <div style="width: auto; height: 80px; border: none; text-align: left; margin-top: -5px;">
                    <span> 原库存地点:<input id="cobFormerPlace" class="easyui-combobox" data-options="onSelect:onFormerPlaceSelect,required:true,missingMessage:'必选项!'" /><input class="input1" id="txtFormerPlaceMC" readonly="readonly" /></span><br />
                    <span> 新库存地点:<input id="cobNewPlace" class="easyui-combobox" data-options="onSelect:onNewPlaceSelect,required:true,missingMessage:'必选项!'" /><input class="input1" id="txtNewPlaceMC" readonly="readonly" /></span><br />
                    <button id="batchSelect" class="button1" οnclick="openwAllGoods()">批量选择商品</button>
                    <button class="button1" οnclick="shiftAll();">全部转出</button>
                </div>
            </div>
            <div class="easyui-panel" style="width: 853px; height: 300px; border: 1px solid #cccccc">
                <table id="tbSelectGoods" class="easyui-datagrid" style="width: 3850px; border: 1px solid #cccccc" data-options="rownumbers:true,idField:'Goods_id',singleSelect:true,
                fit:true,frozenColumns:[[
                     {field:'ShanChu',width:40,title:'删除',align:'center',formatter:deleteSelect} 
                     ]],onClickRow:onClicktbSelGoods">
                    <thead>
                        <tr>
                            <th data-options="field:'Goods_code',width:80,align:'center'">商品代码</th>
                            <th data-options="field:'Goods_bar_code',width:80,align:'center'">商品条码</th>
                            <th data-options="field:'Goods_name',width:80,align:'center'">商品名称</th>
                            <th data-options="field:'NumberOfUnits',width:80,align:'center',editor:{type:'numberbox',options:{precision:0}},styler:mystyler1">发货件数</th>
                            <th data-options="field:'Shipments_quantity',width:80,align:'center',editor:{type:'numberbox'},styler:mystyler">发货细数</th>
                            <th data-options="field:'Stock_quantity',width:80,align:'center'">库存数细数</th>
                            <th data-options="field:'InputTax',width:80,align:'center'">含税进价</th>
                            <th data-options="field:'Quality_content',width:80 ,align:'center'">包装含量</th>
                            <th data-options="field:'Purchase_bid',width:80,align:'center'">采购进价</th>
                            <th data-options="field:'Goods_abbreviation',width:80,align:'center'">商品简称</th>
                            <th data-options="field:'Input_ratio',width:80,align:'center'">进项税率</th>
                            <th data-options="field:'Art_No',width:80,align:'center'">货号</th>
                            <th data-options="field:'Retail_unit_price',width:80,align:'center'">零售单价</th>
                            <th data-options="field:'Vender_bar_code_deny',width:80,align:'center'">厂家条码否</th>
                            <th data-options="field:'Format_model',width:80,align:'center'">规格型号</th>
                            <th data-options="field:'Plncode_PLN',width:80,align:'center'">PLN码</th>
                            <th data-options="field:'Goods_tab',width:80,align:'center'">商品标记</th>
                            <th data-options="field:'Contract_number',width:80,align:'center'">合同号</th>
                            <th data-options="field:'Manufacturer_name',width:80,align:'center'">生产厂家</th>
                            <th data-options="field:'Producing_area_name',width:80,align:'center'">产地</th>
                            <th data-options="field:'Unit_of_measurement',width:80,align:'center'">计量单位</th>
                            <th data-options="field:'Use_target',width:80,align:'center'">使用对象</th>
                            <th data-options="field:'Goods_colours',width:80,align:'center'">商品花色</th>
                            <th data-options="field:'Chinese',width:80,align:'center'">供应单位</th>
                            <th data-options="field:'Goods_classify',width:80,align:'center'">商品分类</th>
                            <th data-options="field:'Quality_guarantee_period',width:80,align:'center'">保质期</th>
                            <th data-options="field:'Quality_grade',width:80,align:'center'">质量等级</th>
                            <th data-options="field:'Product_status',width:80,align:'center'">产品状态</th>
                            <th data-options="field:'Self_fix_goods_deny',width:80,align:'center'">自订货否</th>
                            <th data-options="field:'Mini_fix_goods_deny',width:80,align:'center'">最小订货数</th>
                            <th data-options="field:'Stock_id',hidden:true"></th>
                            <th data-options="field:'Goods_change_repository_detail_id',hidden:true"></th>
                        </tr>
                    </thead>
                </table>
            </div>
            <div>
                <table style="text-align: center; width: 750px; height: 60px; border: 0 solid white">
                    <tr>
                        <td style="width: 155px; text-align: right;">登记人:
                        </td>
                        <td style="width: 125px; text-align: left;">
                            <div class="rq" style="border-bottom: #f5f5f5 1px solid; width: 150px;">
                                <input id="cobRegistrant" class="easyui-combobox" style="width: 150px; border: 1px; color: #0000FF" data-options="panelHeight:120,required:true,missingMessage:'必选项!',onChange:zhidan" />
                            </div>
                        </td>
                        <td style="width: 90px; text-align: right">审核人:
                        </td>
                        <td style="width: 165px; text-align: left;">
                            <div class="rq1" style="border-bottom: #f5f5f5 1px solid; width: 150px;">
                                <input class="easyui-combobox" id="cobAuditor" style="width: 150px; color: #0000FF" data-options="panelHeight:120,required:true,missingMessage:'必选项!',onChange:shenhe" />
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td style="width: 155px; text-align: right;">登记时间:
                        </td>
                        <td>
                            <div class="rq" style="border-bottom: #f5f5f5 1px solid; width: 150px;">
                                <input class="easyui-datetimebox" id="dtmRegister" data-options="formatter:myformatter,required:true,missingMessage:'必选项!'" style="width: 150px; height: 20px; border: none; color: #0000FF" />
                            </div>
                        </td>
                        <td style="text-align: right;">审核时间:
                        </td>
                        <td>
                            <div class="rq1" style="border-bottom: #f5f5f5 1px solid; width: 150px;">
                                <input class="easyui-datetimebox" id="dtmReview" data-options="formatter:myformatter,required:true,missingMessage:'必选项!'" style="width: 150px; height: 20px; border: none; color: #0000FF" />
                            </div>
                        </td>
                    </tr>
                </table>
                <div>
                    <table style="width: 850px">
                        <tr>
                            <td>
                                <div style="width: 85px; height: 25px; text-align: center; vertical-align: middle">
                                    <button id="TianJia" οnclick="addRecordNumber(); ">
                                        <img src="../../Content/image/Add-New.png" />新增</button>
                                </div>
                            </td>
                            <td>
                                <div style="width: 85px; height: 25px; text-align: center; vertical-align: middle">
                                    <button id="XiuGai" οnclick="xiuGai();">
                                        <img src="../../Content/image/Note-Memo.png" />修改</button>
                                </div>
                            </td>
                            <td>
                                <div style="width: 85px; height: 25px; text-align: center; vertical-align: middle">
                                    <button id="ShanChu" οnclick="shanChu();">
                                        <img src="../../Content/image/Delete.png" />删除</button>
                                </div>
                            </td>
                            @* <td>
                            <div style="width: 85px; height: 25px; text-align: center; vertical-align: middle">
                                <button id="JianLou" οnclick="checkLost();">
                                    <img src="../../Content/image/Check.png" />检漏</button>
                            </div>
                        </td>*@
                            <td>
                                <div style="width: 85px; height: 25px; text-align: center; vertical-align: middle">
                                    <button id="BaoCun" οnclick="saveNewOrUpdate();">
                                        <img src="../../Content/image/Save.png" />保存</button>
                                </div>
                            </td>
                            <td>
                                <div style="width: 85px; height: 25px; text-align: center; vertical-align: middle">
                                    <button id="FanQi" οnclick="refreshAfterDelete();">
                                        <img src="../../Content/image/Clean.png" />放弃</button>
                                </div>
                            </td>
                            <td>
                                <div style="width: 85px; height: 25px; text-align: center; vertical-align: middle">
                                    <button id="ShenHe" οnclick="reviewTransferRepertory()">
                                        <img src="../../Content/image/Principal-02.png" />审核</button>
                                </div>
                            </td>
                            <td>
                                <div style="width: 85px; height: 25px; text-align: center; vertical-align: middle">
                                    <button id="DaYin" οnclick="dayin();">
                                        <img src="../../Content/image/Printer.png" />打印</button>
                                </div>
                            </td>
                            <td>
                                <div style="width: 85px; height: 25px; text-align: center; vertical-align: middle">
                                    <button id="TuiChu" οnclick="parent.trans();">
                                        <img src="../../Content/image/Out.png" />退出</button>
                                </div>
                            </td>
                        </tr>
                    </table>
                </div>
            </div>
        </div>
        <div class="easyui-window" id="wRecord_number" title="调拨记录编号" style="width: 404px; height: 246px; top: 60px; left: 90px;" data-options="closed:true,maximizable:false,minimizable:false,modal:true">
            <div class="easyui-panel" style="width: 390px; height: 187px; border: none">
                <table class="easyui-datagrid" id="tbJiLuBianHao" style="width: 340px; border: none; border-spacing: 0;" data-options="fit:true,idField:'Goods_change_repository_id',
               onDblClickRow:onDblBanHaoRow,singleSelect:true,rownumbers:true">
                    <thead>
                        <tr>
                            <th data-options="field:'Record_number',width:95,align:'center'">记录编号</th>
                            <th data-options="field:'Change_department',width:75,align:'center'">转库部门</th>
                            <th data-options="field:'Raw_repertory_place',width:75,align:'center'">原库存地点</th>
                            <th data-options="field:'New_repertory_place',width:75,align:'center'">新库存地点</th>
                            <th data-options="field:'Change_department_id',hidden:true"></th>
                            <th data-options="field:'Raw_repertory_place_id',hidden:true"></th>
                            <th data-options="field:'New_repertory_place_id',hidden:true"></th>
                            <th data-options="field:'Shipper_id',hidden:true"></th>
                            <th data-options="field:'receiverId',hidden:true"></th>
                            <th data-options="field:'Registrant_id',hidden:true"></th>
                            <th data-options="field:'Register_time',hidden:true"></th>
                            <th data-options="field:'ClrEtyReper_deny',hidden:true"></th>
                        </tr>
                    </thead>
                </table>
            </div>
            <div style="width: 385px; border: none; padding: 0; border-spacing: 0; font-size: 14px; vertical-align: middle">
                请输入编号/发货部门代码/名称:<input type="text" id="txtRecord_number" οnkeyup="getTranRepertBlur($('#txtRecord_number').val());" style="width: 160px; margin-top: -5px" />
            </div>
        </div>
        <div class="easyui-window" id="wAllGoods" title="全部商品信息" style="width: 700px; height: 391px;" data-options="closed:true,maximizable:false,minimizable:false,modal:true">
            <div class="easyui-panel" style="margin: auto; height: 326px; width: 680px;">
                <table id="tbGoodsAll" class="easyui-datagrid" style="width: auto;" data-options="rownumbers:true,
               idField:'Goods_id',fit:true,fitColumns:false,checkOnSelect:false,selectOnCheck:false,
                     frozenColumns:[[
                         {field:'XuanZhe',checkbox:true}
                     ]],selectOnCheck:true,checkOnSelect:true">
                    <thead>
                        <tr>
                            <th data-options="field:'Goods_code',width:80,align:'center'">商品代码</th>
                            <th data-options="field:'Goods_name',width:80,align:'center'">商品名称</th>
                            <th data-options="field:'Goods_bar_code',width:80,align:'center'">商品条码</th>
                            <th data-options="field:'Quality_content',width:80,align:'center'">包装含量</th>
                            <th data-options="field:'Retail_unit_price',width:80,align:'center'">零售单价</th>
                            <th data-options="field:'Format_model',width:80,align:'center'">规格型号</th>
                            <th data-options="field:'Goods_abbreviation',width:80,align:'center'">商品简称</th>
                            <th data-options="field:'Plncode_PLN',width:80,align:'center'">PLN码</th>
                            <th data-options="field:'Goods_tab',width:80,align:'center'">商品标记</th>
                            <th data-options="field:'Contract_number',width:80,align:'center'">合同号</th>
                            <th data-options="field:'Manufacturer_name',width:80,align:'center'">生产厂家</th>
                            <th data-options="field:'Producing_area_name',width:80,align:'center'">产地</th>
                            <th data-options="field:'Art_No',width:80,align:'center'">货号</th>
                            <th data-options="field:'Unit_of_measurement',width:80,align:'center'">计量单位</th>
                            <th data-options="field:'Use_target',width:80,align:'center'">使用对象</th>
                            <th data-options="field:'Goods_colours',width:80,align:'center'">商品花色</th>
                            <th data-options="field:'Chinese',width:80,align:'center'">供应单位</th>
                            <th data-options="field:'Goods_rademark_name',width:80,align:'center'">商品商标</th>
                            <th data-options="field:'Goods_classify',width:80,align:'center'">商品分类</th>
                            <th data-options="field:'Quality_content',width:80,align:'center'">质地含量</th>
                            <th data-options="field:'Quality_grade',width:80,align:'center'">质量等级</th>
                            <th data-options="field:'Product_status',width:80,align:'center'">产品状态</th>
                            <th data-options="field:'Retail_unit_price',width:80,align:'center'">零售单价</th>
                            <th data-options="field:'Purchase_bid',width:80,align:'center'">采购进价</th>
                            <th data-options="field:'Self_fix_goods_deny',width:80,align:'center'">自订货否</th>
                            <th data-options="field:'Mini_fix_goods_deny',width:80,align:'center'">最小订货数</th>
                        </tr>
                    </thead>
                </table>
            </div>
            <div>
                <table style="width: 686px; height: 28px; padding: 0; border-spacing: 0">
                    <tr>
                        <td style="vertical-align: middle; font-size: 15px;">请输入商品名称/代码/条码查找:<input type="text" id="txtblur" οnkeyup="blurInquiry($('#txtblur').val())" style="width: 200px; height: 15px;" /></td>
                        <td>
                            <button class="button2" οnclick="$('#tbGoodsAll').datagrid('checkAll');">全选</button>
                            <button class="button2" οnclick="$('#tbGoodsAll').datagrid('uncheckAll');">全不选</button>
                            <button class="button2" οnclick="getChangPin();">添加</button>
                        </td>
                    </tr>
                </table>
            </div>
        </div>
    </div>
</body>
</html>

2.2、转库JavaScript代码:

$(document).ready(function () {
    $("#wZhuanKu").show(500);//显示转库窗体
    bingDingDepTree();//绑定转库部门
    addRecordNumber();//新增记录编号
    parent.document.getElementById("labTips").innerHTML = "";//清空“提示信息”
    n = 0;
});
//绑定转库部门下拉树
function bingDingDepTree() {
    $("#cobDepartment").combotree({ url: "/TransferRepertory/AllDepartmentSelect" });
}
var n = null;
//进度框
function AddRunningDiv() {
    $("<div class=\"datagrid-mask\"></div>").css({ display: "block", width: "100%", height: $(document).height() }).appendTo("body");
    $("<div class=\"datagrid-mask-msg\"></div>").html("正在加载,请稍候...").appendTo("body").css({ display: "block", left: ($(document.body).outerWidth(true) - 190) / 2, top: ($(document).height() - 45) / 2 });
}
//转库部门改变
function onDepartmentChange(id) {
    $.getJSON("/TransferRepertory/DepartmentNameSelect?intDeparId=" + id, function (data) {
        $("#txtConsignmentDepartmentName").val(data);//拼接部门名称
    });
    $.getJSON("/TransferRepertory/GetRepertoryPlace?intDeparId=" + id, function (data) {//获取该部门的库存地点
        $("#cobFormerPlace").combobox({
            data: data,
            valueField: 'Repertory_place_id',
            textField: 'Repertory_place_name',
            panelHeight: 'auto',
            panelMaxHeight: '100',
            onChange: function (intPlaceId) {
                onFormerPlaceSelect();
                $.getJSON("/TransferRepertory/GetEmployee?intPlaceId=" + intPlaceId, function (data1) {//获取仓库管理员
                    $("#cobEmployeeSend").combobox({
                        data: data1,
                        valueField: 'Employee_id',
                        textField: 'Employee_name',
                        panelHeight: 'auto',
                        panelMaxHeight: '100',
                        onChange: function (intEmployeeId) {
                            $.getJSON("/TransferRepertory/GetEmployeeName?intEmployeeId=" + intEmployeeId, function (data2) {//获取仓库管理员名称和工号
                                $("#txtEmployeeSend").val(data2);
                            });
                        }
                    });
                    if (shipper_id > 0) {
                        $("#cobEmployeeSend").combobox("setValue", shipper_id);//如果收货人已存在这赋值
                        shipper_id = 0;
                    } else {
                        $("#cobEmployeeSend").combobox("clear");//否则清空
                        $("#txtEmployeeSend").val("");
                    }
                });

            }
        });
        $("#cobNewPlace").combobox({
            data: data,
            valueField: 'Repertory_place_id',
            textField: 'Repertory_place_name',
            panelHeight: 'auto',
            panelMaxHeight: '100',
            onChange: function (intPlaceId) {
                onNewPlaceSelect();
                $.getJSON("/TransferRepertory/GetEmployee?intPlaceId=" + intPlaceId, function (data1) {//获取仓库管理员
                    $("#cobEmployeeHarvest").combobox({
                        data: data1,
                        valueField: 'Employee_id',
                        textField: 'Employee_name',
                        panelHeight: 'auto',
                        panelMaxHeight: '100',
                        onChange: function (intEmployeeId) {
                            $.getJSON("/TransferRepertory/GetEmployeeName?intEmployeeId=" + intEmployeeId, function (data2) {//获取仓库管理员名称和工号
                                $("#txtEmployeeHarvest").val(data2);
                            });
                            if (changeId > 0) {
                                binDingTransferRepertoryDetails(changeId);
                            }
                        }
                    });
                    if (receiver_id > 0) {
                        $("#cobEmployeeHarvest").combobox("setValue", receiver_id);
                        receiver_id = 0;
                    }
                });
            }
        });
        if (formerPlaceId > 0) {//如果原库存地点id存在则赋值
            $("#cobFormerPlace").combobox("setValue", formerPlaceId);
            formerPlaceId = 0;
        }
        if (newPlaceId > 0) {//新库存地点
            $("#cobNewPlace").combobox("setValue", newPlaceId);
            newPlaceId = 0;
        }
    });
    $.getJSON("/TransferRepertory/GetEmployeeByDeparId?intDeparId=" + id, function (data) {
        $("#cobRegistrant").combobox({ data: data, valueField: 'Employee_id', textField: 'Employee_name' });//绑定员工下拉框
        $("#cobAuditor").combobox({ data: data, valueField: 'Employee_id', textField: 'Employee_name' });//绑定员工下拉框
        if (registrant_id > 0) {
            $("#cobRegistrant").combobox("setValue", registrant_id);//绑定登记人
        }
    });
}
//部门改变-清空

//编辑行
var editIndex = 0;
function onClicktbSelGoods(rowIndex) {
    if (editIndex != rowIndex) {
        $('#tbSelectGoods').datagrid('beginEdit', rowIndex).datagrid("endEdit", editIndex);//开启编辑新行,结束旧行
        compute(rowIndex);//调用方法计算细数
        editIndex = rowIndex;
    } else {
        $('#tbSelectGoods').datagrid('endEdit', rowIndex).datagrid('beginEdit', rowIndex);//先结束当前行再开启编辑
        compute(rowIndex);
    }
    var shipmentsQuantity = $("#tbSelectGoods").datagrid("getEditor", { index: rowIndex, field: 'Shipments_quantity' });//获取索引为rowIndex,列为Shipments_quantity单元格的值(配货数量)
    var numberOfUnits = $("#tbSelectGoods").datagrid("getEditor", { index: rowIndex, field: 'NumberOfUnits' });//获取件数
    var stockQuantity = $("#tbSelectGoods").datagrid("getRows")[rowIndex]["Stock_quantity"];//获取库存数量
    var qualityContent = $("#tbSelectGoods").datagrid("getRows")[rowIndex]["Quality_content"];//获取质地含量
    var numberOfUnits1 = (stockQuantity / qualityContent) + 1;//库存数除以质地含量算出件数
    $(shipmentsQuantity.target).numberbox({ max: stockQuantity });//设定配货数量最大值
    $(numberOfUnits.target).numberbox({ max: numberOfUnits1 });//设定件数最大数
}
//新增记录编号
function addRecordNumber() {
    changeId = 0;
    refreshAfterDelete();//清空控件数据
    addRecordNumber();//生成新记录编号
}
//原库存地点名称
function onFormerPlaceSelect() {
    $.getJSON("/TransferRepertory/GetRepertoryPlaceName?intPlaceId=" + $("#cobFormerPlace").combobox("getValue"), function (value) {
        $("#txtFormerPlaceMC").val(value);
    });
}
//新库存地点名称
function onNewPlaceSelect() {
    $.getJSON("/TransferRepertory/GetRepertoryPlaceName?intPlaceId=" + $("#cobNewPlace").combobox("getValue"), function (value) {
        $("#txtNewPlaceMC").val(value);
    });
}

//日期格式化
function myformatter(date) {
    var y = date.getFullYear();//获取年
    var m = date.getMonth() + 1;//获取月
    var d = date.getDate();//获取日
    var h = date.getHours();//获取小时
    var min = date.getMinutes();//获取分钟
    var s = date.getSeconds();//获取秒
    m = f(m);
    d = f(d);
    h = f(h);
    min = f(min);
    s = f(s);
    return y + "-" + m + "-" + d + " " + h + ":" + min + ":" + s;
}
function f(k) {
    return (k < 10 ? ('0' + k) : k);//三元符,如果K<10,返回0k,否则返回k;
}
//打开批量选择
function openwAllGoods() {
    parent.document.getElementById("labTips").innerHTML = "";//清空“提示信息”
    var deparId = $("#cobFormerPlace").combobox("getValue");
    if (deparId > 0) {//判断转库部门是否已选择
        var rows = $("#tbSelectGoods").datagrid("getRows");//获取datagrid所有行
        var strs = "";
        for (var i = 0; i < rows.length; i++) {
            strs += rows[i].Goods_id + ',';//将每行的商品id追加到一个字符串
        }
        $("#tbGoodsAll").datagrid({
            url: "/TransferRepertory/GetGoodsAll?intRepertory=" + deparId +
                "&strGoodsIds=" + strs
        });//按条件绑定返回的数据
        $("#wAllGoods").window("open");
    } else {
        parent.document.getElementById("labTips").innerHTML = "<ol type='1'><li style='font-size:15px;margin-left:1px;'> 请选择原库存地点部门!</li></ol>";
        ui.error('请选择原库存地点!', 1000, false);//提示错误 
    }
}
//批量选择中的模糊查询
function blurInquiry(strBlur) {
    $("#tbGoodsAll").datagrid({
        url: "/TransferRepertory/GetGoodsByBlur?strBlur=" + strBlur +
            "&intRepertory=" + $("#cobFormerPlace").combobox("getValue")
    });
}
//获取选择的商品
function getChangPin() {
    var goods = $("#tbGoodsAll").datagrid("getChecked");
    for (var i = 0; i < goods.length; i++) {
        $.getJSON("/TransferRepertory/GetGoodsByGoodsId?goodsId=" + goods[i].Goods_id +
            "&intRepertory=" + $("#cobFormerPlace").combobox("getValue"), function (result) {
                $.each(result, function (index, data) {
                    $("#tbSelectGoods").datagrid("appendRow", {
                        Goods_id: data['Goods_id'],
                        Goods_code: data['Goods_code'],
                        Goods_name: data['Goods_name'],
                        Goods_bar_code: data['Goods_bar_code'],
                        Vender_bar_code_deny: data['Vender_bar_code_deny'],
                        Art_No: data['Art_No'],
                        Goods_abbreviation: data['Goods_abbreviation'],
                        Quality_content: data['Quality_content'],
                        Retail_unit_price: data['Retail_unit_price'],
                        Format_model: data['Format_model'],
                        Plncode_PLN: data['Plncode_PLN'],
                        Goods_tab: data['Goods_tab'],
                        Copy_record_deny: data['Copy_record_deny'],
                        Contract_number: data['Contract_number'],
                        Manufacturer_name: data['Manufacturer_name'],
                        Producing_area_name: data['Producing_area_name'],
                        Unit_of_measurement: data['Unit_of_measurement'],
                        Use_target: data['Use_target'],
                        Goods_colours: data['Goods_colours'],
                        Chinese: data['Chinese'],
                        Goods_classify: data['Goods_classify'],
                        Quality_guarantee_period: data['Quality_guarantee_period'],
                        Input_ratio: data['Input_ratio'],
                        Output_ratio: data['Output_ratio'],
                        Count_scale: data['Count_scale'],
                        Quality_grade: data['Quality_grade'],
                        Manage_season_name: data['Manage_season_name'],
                        Permit_decimal_deny: data['Permit_decimal_deny'],
                        Product_status: data['Product_status'],
                        Purchase_bid: '¥' + data['Purchase_bid'],
                        Self_fix_goods_deny: data['Self_fix_goods_deny'],
                        Mini_fix_goods_deny: data['Mini_fix_goods_deny'],
                        InputTax: '¥' + data['InputTax'],
                        Stock_quantity: data['Stock_quantity'],
                        Stock_id: data['Stock_id']
                    });
                });
            });
    }
    $("#tbGoodsAll").datagrid('clearChecked');
    $("#wAllGoods").window("close");
}
//生成删除列,删除列
function deleteSelect(index, data) {
    return "<img class='myimg' οnclick='javaScript:deletess(" + data.Goods_id + ");' src='../../Content/image/delete.png' />";
}
//移除datagrid的行
function deletess(id) {
    $('#tbSelectGoods').datagrid('deleteRow', $('#tbSelectGoods').datagrid('getRowIndex', id));
}
//计算细数
function compute(index) {
    var numberOfUnit = $("#tbSelectGoods").datagrid("getEditor", { index: index, field: 'NumberOfUnits' });
    var shipmentsQuantity = $("#tbSelectGoods").datagrid("getEditor", { index: index, field: 'Shipments_quantity' });
    var rows = $("#tbSelectGoods").datagrid("getRows");
    var qualityContent = rows[index].Quality_content;
    numberOfUnit.target.bind('change', function () {
        if (numberOfUnit.target.val() != '') {
            $(shipmentsQuantity.target).numberbox("setValue", '');
            count();
        }

    });
    shipmentsQuantity.target.bind('change', function () {
        count1();
    });

    function count1() {
        $(numberOfUnit.target).numberbox("setValue", (shipmentsQuantity.target.val() / qualityContent));
    }

    function count() {
        $(shipmentsQuantity.target).numberbox("setValue", qualityContent * (numberOfUnit.target.val()));
    }
}
//转出全部
function shiftAll() {
    var rows = $("#tbSelectGoods").datagrid("getRows");
    for (var i = 0; i < rows.length; i++) {
        rows[i].Shipments_quantity = rows[i].Stock_quantity;
        var k = parseInt(parseInt(rows[i].Stock_quantity) / parseInt(rows[i].Quality_content));
        if (parseInt(rows[i].Stock_quantity) % parseInt(rows[i].Quality_content) > 0) {
            rows[i].NumberOfUnits = k + 1;
        } else {
            rows[i].NumberOfUnits = k;
        }
        $('#tbSelectGoods').datagrid("refreshRow", i);
    }
}
//检漏
function checkLost() {
    var temp = true;
    $("#tbSelectGoods").datagrid("endEdit", $("#tbSelectGoods").datagrid("getRowIndex", $("#tbSelectGoods").datagrid("getSelected")));
    if ($("#Record_number").val() == "" || $("#cobDepartment").combotree("getValue") == "" ||
        $("#cobFormerPlace").combobox("getValue") == "" || $("#cobNewPlace").combobox("getValue") == "" ||
        $("#cobEmployeeSend").combobox("getValue") == "" || $("#cobEmployeeHarvest").combobox("getValue") == "" ||
        $("#cobRegistrant").combobox("getValue") == "" || $("#dtmRegister").datetimebox("getValue") == "") {
        if ($("#Record_number").val() == "") {
            $("#Record_number").css('border-color', 'red');
        } else {
            $("#Record_number").css('border-color', '#c0c0c0');
        }
        $(".rq input").mouseover();
        temp = false;
    } else if ($('#tbSelectGoods').datagrid('getRows').length > 0) {
        var rows = $('#tbSelectGoods').datagrid('getRows');
        var tips = "";
        var count = 0;
        for (var i = 0; i < rows.length; i++) {
            if (rows[i].Shipments_quantity != undefined) {
                count++;
            } else {
                tips += "<li style='font-size:15px;margin-left:1px;'>商品【" + rows[i].Goods_name.trim() + "】数据不完整</li>";
            }
        }
        if (count == rows.length) {
        } else {
            temp = false;
            parent.document.getElementById("labTips").innerHTML = "<ol type='1'>" + tips + "</ol>";
        }
    } else {
        ui.error('未选择要调整的商品!', 1000, false);
        parent.document.getElementById("labTips").innerHTML = "";
        parent.document.getElementById("labTips").innerHTML = "<ol type='1'><li style='font-size:15px;margin-left:1px;'> 未选择要调整的商品!</li></ol>";
        temp = false;
    }
    return temp;
}
//保存新增/修改
function saveNewOrUpdate() {
    if (checkLost()) {
        if ($("#cobFormerPlace").combobox("getValue") != $("#cobNewPlace").combobox("getValue")) {
            if (changeId > 0) {
                ui.confirm("确定修改?", function (k) {
                    if (k) {
                        saveUpdate(changeId);
                    }
                });
            } else {
                ui.confirm("确定新增?", function (k) {
                    if (k) {
                        saveNew();
                    }
                });
            }
        } else {
            ui.alert("原库存与新库存不能相同!", 1000, false);
        }
    } else {
        ui.alert("数据不完整!", 1000, false);
    }
}
//新增
function saveNew() {
    $.getJSON("/TransferRepertory/SaveNewTransferRepertory?" +
        "strRnumber=" + $("#Record_number").val() +
        "&intDepartment=" + $("#cobDepartment").combotree("getValue") +
        "&intFormerPlace=" + $("#cobFormerPlace").combobox("getValue") +
        "&intNewPlace=" + $("#cobNewPlace").combobox("getValue") +
        "&intEmployeeSend=" + $("#cobEmployeeSend").combobox("getValue") +
        "&intEmployeeHarvest=" + $("#cobEmployeeHarvest").combobox("getValue") +
        "&intRegistrant=" + $("#cobRegistrant").combobox("getValue") +
        "&dtmRegister=" + $("#dtmRegister").datetimebox("getValue") +
        "&check=" + $("#check").prop("checked"), function (data) {
            var rows = $("#tbSelectGoods").datagrid("getRows");
            var strs = "";
            for (var i = 0; i < rows.length; i++) {
                strs += data + ",";
                strs += rows[i].Goods_id + ",";
                strs += rows[i].Shipments_quantity + ".";
            }
            $("#strs").val(strs);
            $.getJSON("/TransferRepertory/SaveNewTransferRepertoryDetails?strs=" +
                strs + "&sendPlaceId=" + $("#cobFormerPlace").combobox("getValue"));
            if (data > 0) {
                ui.success("新增成功!", 1000, false);
                parent.document.getElementById("labTips").innerHTML = "";
                parent.document.getElementById("labTips").innerHTML = "<ol type='1'><li style='font-size:15px;margin-left:1px;color:red'> 新增成功!</li></ol>";
                refreshAfterDelete();
                addRecordNumber();
            } else {
                ui.error("新增失败!", 1000, false);
                parent.document.getElementById("labTips").innerHTML = "";
                parent.document.getElementById("labTips").innerHTML = "<ol type='1'><li style='font-size:15px;margin-left:1px;color:red'> 新增失败!</li></ol>";
            }
        });
}


//修改
function saveUpdate(changeId) {
    var delrow = $('#tbSelectGoods').datagrid('getChanges', 'deleted');//获取要删除的行
    var insertrow = $('#tbSelectGoods').datagrid('getChanges', 'inserted');//获取要新增的行
    var updaterow = $('#tbSelectGoods').datagrid('getChanges', 'updated');//获取要修改的行
    for (var i = 0; i < insertrow.length; i++) {//新增要新增的行
        $.getJSON("/TransferRepertory/InsertRows?intTranReperId=" + changeId +
             "&intGoodsId=" + insertrow[i].Goods_id + "&strRnumber=" + insertrow[i].Shipments_quantity +
            "&intStockId=" + insertrow[i].Stock_id);
    }
    for (var j = 0; j < delrow.length; j++) {//删除要删除的行
        $.getJSON("/TransferRepertory/DeleteRows?changeDetailId=" + delrow[j].Goods_change_repository_detail_id);
    }
    for (var k = 0; k < updaterow.length; k++) {//修改要删除的行
        $.getJSON("/TransferRepertory/UpdateRows?changeDetailId=" + updaterow[k].Goods_change_repository_detail_id +
          "&intRnumber=" + updaterow[k].Shipments_quantity);
    }
    $.getJSON("/TransferRepertory/UpdateTransferRepertory?" +//修改转库单
        "intDepartment=" + $("#cobDepartment").combotree("getValue") +
        "&intFormerPlace=" + $("#cobFormerPlace").combobox("getValue") +
        "&intNewPlace=" + $("#cobNewPlace").combobox("getValue") +
        "&intEmployeeSend=" + $("#cobEmployeeSend").combobox("getValue") +
        "&intEmployeeHarvest=" + $("#cobEmployeeHarvest").combobox("getValue") +
        "&intRegistrant=" + $("#cobRegistrant").combobox("getValue") +
        "&dtmRegister=" + $("#dtmRegister").datetimebox("getValue") +
        "&check=" + $("#check").prop("checked") +
        "&intTranReperId=" + changeId, function (data) {
            if (data > 0) {
                ui.success("修改成功!", 1000, false);
                parent.document.getElementById("labTips").innerHTML = "";
                parent.document.getElementById("labTips").innerHTML = "<ol type='1'><li style='font-size:15px;margin-left:1px;color:red'> 修成功!</li></ol>";
                var changeId1 = changeId;
                refreshAfterDelete();
                setTimeout("refreshAfterUpdate(" + changeId1 + ")", 100);
            } else {
                ui.error("修改失败!", 1000, false);
                $("#tbSelectGoods").datagrid("rejectChanges");
                parent.document.getElementById("labTips").innerHTML = "";
                parent.document.getElementById("labTips").innerHTML = "<ol type='1'><li style='font-size:15px;margin-left:1px;color:red'> 修改失败!</li></ol>";
            }
        });
}
//删除后的刷新(清空所有控件的数据)
function refreshAfterDelete() {
    $("#tbSelectGoods").datagrid("loadData", { total: 0, rows: [] });
    $("#Record_number").val("");
    $("#txtFormerPlaceMC").val("");
    $("#txtNewPlaceMC").val("");
    $("#txtEmployeeSend").val("");
    $("#txtEmployeeHarvest").val("");
    $("#txtConsignmentDepartmentName").val("");
    $("#cobDepartment").combotree("clear");
    $("#cobFormerPlace").combobox("clear");
    $("#cobNewPlace").combobox("clear");
    $("#cobEmployeeSend").combobox("clear");
    $("#cobEmployeeHarvest").combobox("clear");
    $("#cobRegistrant").combobox("clear");
    $("#cobAuditor").combobox("clear");
    $("#dtmRegister").datetimebox("clear");
    $("#dtmReview").datetimebox("clear");
    $("#check").prop("checked", false);
    formerPlaceId = 0;
    newPlaceId = 0;
    shipper_id = 0;
    receiver_id = 0;
    registrant_id = 0;
    changeId = 0;

}
//修改后的重新价载
function refreshAfterUpdate(changeId1) {
    changeId = changeId1;
    $.getJSON("/TransferRepertory/GetTranRepertByTranReperId?intTranReperId=" + changeId1, function (data) {
        $("#Record_number").val(data[0].Record_number);
        $("#cobDepartment").combotree("setValue", data[0].Change_department_id);
        formerPlaceId = data[0].Raw_repertory_place_id;
        newPlaceId = data[0].New_repertory_place_id;
        shipper_id = data[0].Shipper_id;
        receiver_id = data[0].receiverId;
        registrant_id = data[0].Registrant_id;
        $("#dtmRegister").datetimebox("setValue", data[0].Register_time);
        $("#txtFormerPlaceMC").val(data[0].Raw_repertory_place);
        $("#txtNewPlaceMC").val(data[0].New_repertory_place);
        $("#check").prop("checked", data[0].ClrEtyReper_deny);
        binDingTransferRepertoryDetails(data[0].Goods_change_repository_id);
    });
}
//打开记录编号窗体
function openjiLuBianHao() {
    $("#tbJiLuBianHao").datagrid({ url: "/TransferRepertory/GetAllTransferRepertory" });
    $("#wRecord_number").window("open");

}//模糊查询转库单
function getTranRepertBlur(strBlur) {
    $("#tbJiLuBianHao").datagrid({ url: "/TransferRepertory/GetTranRepertBlur?strBlur=" + strBlur });
}
//点击修改
function xiuGai() {
    openjiLuBianHao();
}
//双击记录编号表
var formerPlaceId = 0;
var newPlaceId = 0;
var shipper_id = 0;
var receiver_id = 0;
var registrant_id = 0;
var changeId = 0;
function onDblBanHaoRow(rowIndex, rowData) {
    n = 1;
    formerPlaceId = rowData.Raw_repertory_place_id;
    newPlaceId = rowData.New_repertory_place_id;
    shipper_id = rowData.Shipper_id;
    receiver_id = rowData.receiverId;
    registrant_id = rowData.Registrant_id;
    changeId = rowData.Goods_change_repository_id;
    $("#Record_number").val(rowData.Record_number);
    $("#cobDepartment").combotree("setValue", rowData.Change_department_id);
    $("#dtmRegister").datetimebox("setValue", rowData.Register_time);
    $("#wRecord_number").window("close");
}

//绑定转库明细
function binDingTransferRepertoryDetails(changeId) {
    $("#tbSelectGoods").datagrid({ url: "/TransferRepertory/GetTransferRepertoryDetails?intGcrId=" + changeId }, "acceptChanges");
}
//删除转库单
function shanChu() {
    ui.confirm('确定删除?', function (k) {
        if (k) {
            $.getJSON("/TransferRepertory/DeleteTransferRepertory?intChangeId=" + changeId, function (data) {
                if (data > 0) {
                    ui.success("删除成功!", 1000, false);
                    refreshAfterDelete();
                    parent.document.getElementById("labTips").innerHTML = "";
                    parent.document.getElementById("labTips").innerHTML = "<ol type='1'><li style='font-size:15px;margin-left:1px;color:red'> 删除成功!</li></ol>";
                } else {
                    ui.error("删除失败!", 1000, false);
                    parent.document.getElementById("labTips").innerHTML = "";
                    parent.document.getElementById("labTips").innerHTML = "<ol type='1'><li style='font-size:15px;margin-left:1px;color:red'> 删除失败!</li></ol>";
                }
            });
        }
    });
}
//审核转库单
function reviewTransferRepertory() {
    if (changeId > 0) {
        if ($("#cobAuditor").combobox("getValue") == "" || $("#dtmReview").datetimebox("getValue") == "") {
            $(".rq1 input").mouseover();
        } else {
            $.getJSON("/TransferRepertory/ReviewTransferRepertory?intTranReperId=" + changeId +
                "&intAuditor=" + $("#cobAuditor").combobox("getValue") +
                "&dtmReview=" + $("#dtmReview").datetimebox("getValue"), function (data) {
                    if (data == "审核成功!") {
                        ui.success('审核成功!', 1000, false);
                        tag = 1;
                        refreshAfterDelete();
                    } else {
                        var strs = data.split('+');
                        var tips = "";
                        for (var i = 0; i < strs.length; i++) {
                            tips += "<li style='font-size:15px;margin-left:1px;'>" + strs[i] + "</li>";
                        }
                        ui.error('审核失败!<br/>详情请看【 相关提示】!', 2000, false);
                        parent.document.getElementById("labTips").innerHTML = "<ol type='1'>" + tips + "</ol>";
                    }
                });
        }
    } else {
        openjiLuBianHao();
    }
    $("#cobAuditor").combobox({ disabled: false });
    $("#dtmReview").datetimebox({ disabled: false });
}
//单元格样式
function mystyler(value, row, index) {
    var stockQuantity = $("#tbSelectGoods").datagrid("getRows")[index]["Stock_quantity"];
    if (stockQuantity == value) {
        return 'background-color:#FAEBD7;color:red;';
    }
}
function mystyler1(value, row, index) {
    var stockQuantity = $("#tbSelectGoods").datagrid("getRows")[index]["Stock_quantity"];
    var qualityContent = $("#tbSelectGoods").datagrid("getRows")[index]["Quality_content"];
    if ((stockQuantity / qualityContent) <= value) {
        return 'background-color:#FFF0F5;color:red;';
    }
}
function dayin() {
    //$.getJSON("/TransferRepertory/NewStock");
}
var k = 0;
//onSelect制单人
function zhidan() {
    if (n == 1) {
        if (k > 0) {
            $("#dtmRegister").datetimebox("setValue", getDateTime());
        } else {
            k++;
        }
    } else {
        $("#dtmRegister").datetimebox("setValue", getDateTime());
    }
}

var j = 0;
//onSelect审核人
function shenhe() {
    if (n == 1) {
        if (j > 0) {
            $("#dtmReview").datetimebox("setValue", getDateTime());
        } else {
            j++;
        }
    } else {
        $("#dtmReview").datetimebox("setValue", getDateTime());
    }
}
//获取系统时间
function getDateTime() {
    var date = new Date();
    var y = date.getFullYear();
    var m = date.getMonth() + 1;
    var d = date.getDate();
    var h = date.getHours();
    var min = date.getMinutes();
    var s = date.getSeconds();
    var time = y + "-" + f(m) + "-" + f(d) + " " + f(h) + ":" + f(min) + ":" + f(s);
    return time;
}

2.3、调拨查询HTML代码:

<!DOCTYPE html>
<html>
<head>
    <meta content="text/javascript;charset=utf-8" />
    <title>SelectTransferRepertory</title>
    
    <link href="../../Content/jquery-easyui-1.3.3/themes/icon.css" rel="stylesheet" />
    <link href="../../Content/jquery-easyui-1.3.3/demo/demo.css" rel="stylesheet" />
    <link href="../../Content/jquery-easyui-1.3.3/themes/default/easyui.css" rel="stylesheet" />
    <link href="../../Content/MyCSS/SelectTransferRepertory.css" rel="stylesheet" />
    <script src="../../Content/jquery-easyui-1.3.3/jquery.min.js"></script>
    <script src="../../Content/jquery-easyui-1.3.3/jquery.easyui.min.js"></script>
    <script src="../../Scripts/MyScript/SelectTransferRepertory.js"></script>
</head>
    <body οnlοad="AddRunningDiv();" style="text-align: center">
        <div id="selectTrans" style="display: none">
            <div class="easyui-window" id="wTransferRepertory" title="" style="text-align: center; border-spacing: 0; padding: 0; border: none; overflow: hidden;"
                 data-options="fit:true,collapsible:false,minimizable:false,maximizable:false,closable:false,draggable:false,resizable:false,shadow:false,modal:true,center:true">
                <div style="padding: 0; background: #e0ffff; color: #4169e1; font-size: 20px; margin: 0 0 auto;">
                    <span style="float: right"><img οnclick="parent.trans();" id="dimg" src="../../Content/image/delete.png" /></span>查询转库单
                </div>
                <fieldset style="width: 200px; height: 370px; padding: 3px; margin-bottom: 0; float: left; text-align: left; overflow: hidden">
                    <legend>不定查询条件</legend>
                    <dl id="dl1" style="text-align: left;">
                        <dt>记录编号:</dt>
                        <dd>
                            <input type="text" id="txtRnumber" /></dd>
                        <dt>转库部门:</dt>
                        <dd>
                            <input class="easyui-combotree" id="cboDepartment" /></dd>
                        <dt>原库存地:</dt>
                        <dd>
                            <input class="easyui-combobox" id="cboRawPlace" /></dd>
                        <dt>新库存地:</dt>
                        <dd>
                            <input class="easyui-combobox" id="cboNewPlace" /></dd>
                        <dt>开始时间:</dt>
                        <dd>
                            <input class="easyui-datebox" id="dtmStar" data-options="formatter:myformatter" /></dd>
                        <dt>结束时间:</dt>
                        <dd>
                            <input class="easyui-datebox" id="dtmEnd" data-options="formatter:myformatter" /></dd>
                    </dl>
                    <span style="float: left; margin: 10px auto auto 15px;">审核否:<input id="check" checked="checked" type="checkbox" /></span>
                    <span style="float: right; margin-right: 25px;">
                        <button class="button1" οnclick="selectIransfer()">查 询</button><br />
                        <button class="button1" οnclick="refresh()">刷 新</button></span>
                </fieldset>
                <div style="margin-left: 206px; height: 376px;">
                    <div style="height: 50%">
                        <table title="转库单" id="tbTransferRepertory" class="easyui-datagrid" style="width: 602px; height: 200px;" data-options="rownumbers:true,fit:true,singleSelect:true,
                    idField:'Goods_change_repository_id',onClickRow:selectTransDetailByTrans">
                            <thead>
                                <tr>
                                    <th data-options="field:'Record_number',width:110,align:'center'">记录编号</th>
                                    <th data-options="field:'Department_name',width:110,align:'center'">转库部门</th>
                                    <th data-options="field:'Raw_repertory_place',width:110,align:'center'">原库存地点</th>
                                    <th data-options="field:'New_repertory_place',width:110,align:'center'">新库存地点</th>
                                    <th data-options="field:'Register_time',width:150,align:'center'">登记时间</th>
                                    <th data-options="field:'Review_deny',hidden:true"></th>

                                </tr>
                            </thead>
                        </table>
                    </div>
                    <div style="border: 1px solid #ccc; height: 50%">
                        <div style="margin-left: 2px; height: 100%; width: 100%; text-align: left">
                            <div class="li2" style="width: 50%; height: 100%; float: right; border: 1px solid white">
                                <dl style="text-align: left; margin-left: 50px; font-size: 15px; line-height: 10px;">
                                    <dt>清空零库存否:</dt>
                                    <dd>
                                        <input class="input1" id="txtClrEtyReperDeny" readonly="readonly" /></dd>
                                    <dt>发 货 人:</dt>
                                    <dd>
                                        <input class="input1" id="txtShipper" readonly="readonly" /></dd>
                                    <dt>收 货 人:</dt>
                                    <dd>
                                        <input class="input1" id="txtReceiver" readonly="readonly" /></dd>
                                    <dt>登 记 人:</dt>
                                    <dd>
                                        <input class="input1" id="txtRegistrant" readonly="readonly" /></dd>
                                    <dt>备注:</dt>
                                    <dd>
                                        <input class="input1" id="txtRemarks" readonly="readonly" /></dd>

                                </dl>
                            </div>
                            <div class="li1" style="width: 50%; height: 100%; border: 1px dashed; border-color: white blue white white;">
                                <dl style="text-align: left; margin-left: 50px; font-size: 15px; line-height: 10px;">
                                    <dt>转库部门:</dt>
                                    <dd>
                                        <input class="input1" id="txtChangeDepartment" readonly="readonly" /></dd>
                                    <dt>原库存地:</dt>
                                    <dd>
                                        <input class="input1" id="txtRawPlace" readonly="readonly" /></dd>
                                    <dt>新库存地:</dt>
                                    <dd>
                                        <input class="input1" id="txtNewPlace" readonly="readonly" /></dd>
                                    <dt>审 核 人:</dt>
                                    <dd>
                                        <input class="input1" id="txtAuditor" readonly="readonly" /></dd>
                                    <dt>审核时间:</dt>
                                    <dd>
                                        <input class="input1" id="txtReviewTime" readonly="readonly" /></dd>

                                </dl>
                            </div>
                        </div>
                    </div>
                </div>
                <div style="border: #cccccc solid 1px; height: 190px; clear: both; border: none">
                    <table title="转库明细" id="tbTransDetail" class="easyui-datagrid" style="margin: 0 auto 0; height: 190px;" data-options="rownumbers:true,fit:true,singleSelect:true,idField:'Goods_change_repository_detail_id'">
                        <thead>
                            <tr>
                                <th  data-options="field:'Goods_name',width:80,align:'center'">商品名称</th>
                                <th data-options="field:'Goods_bar_code',width:80,align:'center'">商品条码</th>
                                <th data-options="field:'Goods_code',width:80,align:'center'">商品代码</th>
                                <th data-options="field:'Repertory_enter_packages',width:75,align:'center'">发货件数</th>
                                <th data-options="field:'Change_number',width:75,align:'center'">发货细数</th>
                                <th data-options="field:'Tax_inclusive_price1',width:80,align:'center'">含税进价</th>
                                <th data-options="field:'Goods_abbreviation',width:80,align:'center'">商品简称</th>
                                <th data-options="field:'Quality_content',width:80 ,align:'center'">包装含量</th>
                                <th data-options="field:'Art_No',width:80,align:'center'">货号</th>
                                <th data-options="field:'Retail_unit_price',width:80,align:'center'">零售单价</th>
                                <th data-options="field:'Vender_bar_code_deny',width:80,align:'center'">厂家条码否</th>
                                <th data-options="field:'Format_model',width:80,align:'center'">规格型号</th>
                                <th data-options="field:'Plncode_PLN',width:80,align:'center'">PLN码</th>
                                <th data-options="field:'Contract_number',width:80,align:'center'">合同号</th>
                                <th data-options="field:'Manufacturer_name',width:80,align:'center'">生产厂家</th>
                                <th data-options="field:'Producing_area_name',width:80,align:'center'">产地</th>
                                <th data-options="field:'Unit_of_measurement',width:80,align:'center'">计量单位</th>
                                <th data-options="field:'Goods_classify',width:80,align:'center'">商品分类</th>
                                <th data-options="field:'Input_ratio',width:80,align:'center'">进项税率</th>
                                <th data-options="field:'Output_ratio',width:80,align:'center'">销项税率</th>
                                <th data-options="field:'Quality_grade',width:80,align:'center'">质量等级</th>
                                <th data-options="field:'Purchase_bid1',width:80,align:'center'">采购进价</th>
                            </tr>
                        </thead>
                    </table>
                </div>
            </div>
        </div>
        <div>
    </body>
</html>

2.4、商品查询JavaScript代码:

$(document).ready(function () {
    $("#selectTrans").fadeIn();
    $("#cboDepartment").combotree({
        url: "/TransferRepertory/AllDepartmentSelect",
        onChange: function (id) {
            $("#cboRawPlace").combobox({
                url: "/TransferRepertory/GetRepertoryPlace?intDeparId=" + id,
                valueField: 'Repertory_place_id',
                textField: 'Repertory_place_name'
            });
            $("#cboNewPlace").combobox({
                url: "/TransferRepertory/GetRepertoryPlace?intDeparId=" + id,
                valueField: 'Repertory_place_id',
                textField: 'Repertory_place_name'
            });
        }

    });
    setTimeout("selectIransfer()", 100);
});
function AddRunningDiv() {
    $("<div class=\"datagrid-mask\"></div>").css({ display: "block", width: "100%", height: $(document).height() }).appendTo("body");
    $("<div class=\"datagrid-mask-msg\"></div>").html("正在加载,请稍候...").appendTo("body").css({ display: "block", left: ($(document.body).outerWidth(true) - 190) / 2, top: ($(document).height() - 45) / 2 });
}
//不定条件查询转库单
function selectIransfer() {
    $.getJSON("/TransferRepertory/SelectTransferRepertoryIntRends?" +
        "strRnumber=" + $("#txtRnumber").val() +
        "&intDeparId=" + $("#cboDepartment").combotree("getValue") +
        "&intRawPlace=" + $("#cboRawPlace").combobox("getValue") +
        "&intNewPlace=" + $("#cboNewPlace").combobox("getValue") +
        "&dtmStar=" + $("#dtmStar").datebox("getValue") +
        "&dtmEnd=" + $("#dtmEnd").datebox("getValue") +
        "&check=" + $("#check").prop("checked"), function (data) {
            if (data != "") {
                $("#tbTransferRepertory").datagrid("loadData", data);
            } else {
                $("#tbTransferRepertory").datagrid("loadData", { total: 0, rows: [] });
                $("#tbTransDetail").datagrid("loadData", { total: 0, rows: [] });
                $("#txtClrEtyReperDeny").val("");
                $("#txtShipper").val("");
                $("#txtReceiver").val("");
                $("#txtRegistrant").val("");
                $("#txtRemarks").val("");
                $("#txtChangeDepartment").val("");
                $("#txtRawPlace").val("");
                $("#txtNewPlace").val("");
                $("#txtAuditor").val("");
                $("#txtReviewTime").val("");
            }
        });
}

function selectTransDetailByTrans(index, data) {
    $.getJSON("/TransferRepertory/SelectTransByTrans?" +
        "intTranId=" + data.Goods_change_repository_id +
        "&bolReview=" + data.Review_deny, function (data1) {
            $("#txtClrEtyReperDeny").val(data1[0]["ClrEtyReper_deny"]);
            $("#txtShipper").val(data1[0]["Shipper"]);
            $("#txtReceiver").val(data1[0]["Receiver"]);
            $("#txtRegistrant").val(data1[0]["Registrant"]);
            $("#txtChangeDepartment").val(data1[0]["Change_department"]);
            $("#txtRawPlace").val(data1[0]["Raw_repertory_place"]);
            $("#txtNewPlace").val(data1[0]["New_repertory_place"]);
            $("#txtRemarks").val(data1[0]["Remarks"]);
            $("#txtAuditor").val(data1[0]["Auditor"]);
            $("#txtReviewTime").val(data1[0]["Review_time"]);
        });
    $("#tbTransDetail").datagrid({ url: "/TransferRepertory/SelectTtansDetail?intTransId=" + data.Goods_change_repository_id });
}
//日期格式化
function myformatter(date) {
    var y = date.getFullYear();
    var m = date.getMonth() + 1;
    var d = date.getDate();
    m = f(m);
    d = f(d);
    return y + "-" + m + "-" + d;
}
function f(k) {
    return (k < 10 ? ('0' + k) : k);
}

function refresh() {
    $("#txtRnumber").val("");
    $("#cboDepartment").combobox("clear");
    $("#cboRawPlace").combobox("clear");
    $("#cboNewPlace").combobox("clear");
    $("#dtmStar").datebox("clear");
    $("#dtmEnd").datebox("clear");
    $("#tbTransferRepertory").datagrid("loadData", { total: 0, rows: [] });
    $("#tbTransDetail").datagrid("loadData", { total: 0, rows: [] });
    $("#txtClrEtyReperDeny").val("");
    $("#txtShipper").val("");
    $("#txtReceiver").val("");
    $("#txtRegistrant").val("");
    $("#txtRemarks").val("");
    $("#txtChangeDepartment").val("");
    $("#txtRawPlace").val("");
    $("#txtNewPlace").val("");
    $("#txtAuditor").val("");
    $("#txtReviewTime").val("");
}

2.5、转库Csharp-controller

using System;
using System.Collections.Generic;
using System.Data;
using System.Web.Mvc;
using BLL_KuCunGuangLi;

namespace 大型商贸系统.Controllers
{

    public class TransferRepertoryController : Controller
    {
        //
        // GET: /TransferRepertory/

        #region 转库单处理
        
        readonly ITransferRepertorys _myItransfer = new TransferRepertory();
        readonly IDiaoBos _myBos=new DiaoBo();

        public ActionResult DealWithTransferRepertory()
        {
            return View();
        }


        #region 审核转库单

        public ActionResult ReviewTransferRepertory(int intTranReperId, int intAuditor, DateTime dtmReview)
        {
            DataTable dt = _myItransfer.GetTranRepertDetailToReview(intTranReperId);//查询出转库单的明细
            var stockIdsTag = new List<int>();//实例化泛型数据类型
            var changeNumberTag = new List<int>();
            string msg = "";
            var clrEtyReperDeny = false;
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                clrEtyReperDeny = Convert.ToBoolean(dt.Rows[0]["ClrEtyReper_deny"]);//获取是否清空零库存
                var stockQuantity = Convert.ToInt32(dt.Rows[i]["Stock_quantity"]);//获取库存数量
                var changeNumber = (int)dt.Rows[i]["Change_number"];//获取转库数量
                var stockId = Convert.ToInt32(dt.Rows[i]["Stock_id"]);//获取库存id
                var goodsName = dt.Rows[i]["Goods_name"].ToString();//获取商品名称
                if (stockQuantity >= changeNumber)//判断库存数是否大于后等于转库数
                {
                    stockIdsTag.Add(stockId);
                    changeNumberTag.Add(changeNumber);
                }
                else
                {
                    msg += "商品【" + goodsName + "】库存不足!+";
                }

            }
            if (msg == "")
            {
                if (clrEtyReperDeny)
                {
                    for (int i = 0; i < stockIdsTag.Count; i++)
                    {
                        _myItransfer.ChangeStockQuantity(stockIdsTag[i], changeNumberTag[i]);//如果属于清空零库存的执行
                    }
                }
                else
                {
                    for (int i = 0; i < stockIdsTag.Count; i++)
                    {
                        _myItransfer.ChangeStockQuantity1(stockIdsTag[i], changeNumberTag[i]);//不属于清空零库存的执行
                    }
                }
                _myItransfer.UpdateStockQuantity(intTranReperId, intAuditor, dtmReview);//修改审核状态
                msg = "审核成功!";
            }
            else
            {
                msg = "审核失败!原因如下:+" + msg;
            }
            return Json(msg, JsonRequestBehavior.AllowGet);
        }

        #endregion
        #region 根据转库ID查询转库信息

        public ActionResult GetTranRepertByTranReperId(int intTranReperId)
        {
            DataTable dt = _myItransfer.GetTranRepertByTranReperId(intTranReperId);
            List<Dictionary<string, object>> list = ConvertHelperController.DtToList(dt);
            return Json(list, JsonRequestBehavior.AllowGet);
        }

        #endregion
        #region 修改转库单

        #region 修改-转库单

        public int UpdateTransferRepertory(int intDepartment,
            int intFormerPlace,
            int intNewPlace,
            int intEmployeeSend,
            int intEmployeeHarvest,
            int intRegistrant,
            DateTime dtmRegister,
            bool check,
            int intTranReperId)
        {
            int k = _myItransfer.UpdateTransferRepertory(intDepartment, intFormerPlace, intNewPlace, intEmployeeSend,
                intEmployeeHarvest, intRegistrant, dtmRegister, check, intTranReperId);
            return k;
        }

        #endregion


        #region 修改明细

        public void UpdateRows(int changeDetailId, int intRnumber)
        {
            _myItransfer.UpdateRows(changeDetailId, intRnumber);
        }

        #endregion


        #region 删除明细

        public void DeleteRows(int changeDetailId)
        {
            _myItransfer.DeleteRows(changeDetailId);
        }

        #endregion


        #region 新增明细

        public void InsertRows(int intTranReperId, int intGoodsId, string strRnumber, int intStockId)
        {
            _myItransfer.InsertRows(intTranReperId, intGoodsId, strRnumber, intStockId);
        }

        #endregion


        #endregion
        #region 删除转库单/转库明细

        public ActionResult DeleteTransferRepertory(int intChangeId)
        {
            _myItransfer.DeleteTransferRepertoryDetail(intChangeId);
            int j = _myItransfer.DeleteTransferRepertory(intChangeId);
            return Json(j, JsonRequestBehavior.AllowGet);
        }

        #endregion
        #region 查询转库明细

        public ActionResult GetTransferRepertoryDetails(int intGcrId)
        {
            DataTable dt = _myItransfer.GetTransferRepertoryDetails(intGcrId);
            List<Dictionary<string, object>> list = ConvertHelperController.DtToList(dt);
            return Json(list, JsonRequestBehavior.AllowGet);
        }

        #endregion
        #region 模糊查询转库单

        public ActionResult GetTranRepertBlur(string strBlur)
        {
            DataTable dt = _myItransfer.GetTranRepertBlur(strBlur);
            List<Dictionary<string, object>> list = ConvertHelperController.DtToList(dt);
            return Json(list, JsonRequestBehavior.AllowGet);
        }

        #endregion
        #region 查询全部转库单

        public ActionResult GetAllTransferRepertory()
        {
            DataTable dt = _myItransfer.GetAllTransferRepertory();
            List<Dictionary<string, object>> list = ConvertHelperController.DtToList(dt);
            return Json(list, JsonRequestBehavior.AllowGet);
        }

        #endregion
        #region 新增转库单明细

        public void SaveNewTransferRepertoryDetails(string strs, int sendPlaceId)
        {
            string[] values = strs.Split('.');
            for (int i = 0; i < values.Length-1; i++)
            {
                string[] data = values[i].Split(',');
                int id = Convert.ToInt32(data[0]);
                int goodId = Convert.ToInt32(data[1]);
                string changeNum = data[2];
                DataTable dt = _myBos.GetStockQuantity(sendPlaceId, goodId);
                int intStockId = Convert.ToInt32(dt.Rows[0]["Stock_id"]);
                _myItransfer.SaveNewTransferRepertoryDetails(id, goodId, changeNum, intStockId);
            }
        }

        #endregion
        #region 新增转库单

        public ActionResult SaveNewTransferRepertory(string strRnumber,
            int intDepartment,
            int intFormerPlace,
            int intNewPlace,
            int intEmployeeSend,
            int intEmployeeHarvest,
            int intRegistrant,
            DateTime dtmRegister,
            bool check)
        {
            DataTable i = _myItransfer.SaveNewTransferRepertory(strRnumber,
                intDepartment, intFormerPlace, intNewPlace, intEmployeeSend,
                intEmployeeHarvest, intRegistrant, dtmRegister, check);
            string k = i.Rows[0][0].ToString();
            return Json(k, JsonRequestBehavior.AllowGet);
        }

        #endregion
        #region 查询商品by商品id

        public ActionResult GetGoodsByGoodsId(int goodsId, int intRepertory)
        {
            DataTable dt = _myItransfer.GetGoodsByGoodsId(goodsId, intRepertory);
            List<Dictionary<string, object>> list = ConvertHelperController.DtToList(dt);
            return Json(list, JsonRequestBehavior.AllowGet);
        }

        #endregion
        #region 模糊查询商品

        public ActionResult GetGoodsByBlur(string strBlur, int intRepertory)
        {
            DataTable dt = _myItransfer.GetGoodsByBlur(strBlur, intRepertory);
            List<Dictionary<string, object>> list = ConvertHelperController.DtToList(dt);
            return Json(list, JsonRequestBehavior.AllowGet);
        }

        #endregion
        #region 查询绑定批量选择

        public ActionResult GetGoodsAll(int intRepertory, string strGoodsIds)
        {
            string[] ids = strGoodsIds.Split(',');
            DataTable dt = _myItransfer.GetGoodsAll(intRepertory);
            foreach (var id in ids)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    if (id == dt.Rows[i]["Goods_id"].ToString())
                    {
                        dt.Rows.Remove(dt.Rows[i]);
                    }
                }
            }
            List<Dictionary<string, object>> list = ConvertHelperController.DtToList(dt);
            return Json(list, JsonRequestBehavior.AllowGet);
        }

        #endregion
        #region 获取部门员工信息

        public ActionResult GetEmployeeByDeparId(int intDeparId)
        {
            DataTable dt = _myItransfer.GetEmployeeByDeparId(intDeparId);
            List<Dictionary<string, object>> list = ConvertHelperController.DtToList(dt);
            return Json(list, JsonRequestBehavior.AllowGet);
        }

        #endregion
        #region 获取员工信息

        public ActionResult GetEmployeeName(int intEmployeeId)
        {
            DataTable dt = _myItransfer.GetEmployeeName(intEmployeeId);
            string name = dt.Rows[0][0].ToString().Trim();
            return Json(name, JsonRequestBehavior.AllowGet);
        }

        #endregion
        #region 绑定发/收货人

        public ActionResult GetEmployee(int intPlaceId)
        {
            DataTable dt = _myItransfer.GetEmployee(intPlaceId);
            List<Dictionary<string, object>> list = ConvertHelperController.DtToList(dt);
            return Json(list, JsonRequestBehavior.AllowGet);
        }

        #endregion
        #region 根据库存地点id获取库存名称

        public ActionResult GetRepertoryPlaceName(int intPlaceId)
        {
            DataTable dt = _myItransfer.GetRepertoryPlaceName(intPlaceId);
            string name = dt.Rows[0][0].ToString().Trim();
            return Json(name, JsonRequestBehavior.AllowGet);
        }

        #endregion
        #region 获取部门库存地点

        public ActionResult GetRepertoryPlace(int intDeparId)
        {
            DataTable dt = _myItransfer.GetRepertoryPlace(intDeparId);
            List<Dictionary<string, object>> list = ConvertHelperController.DtToList(dt);
            return Json(list, JsonRequestBehavior.AllowGet);
        }

        #endregion
        #region 部门名称拼接

        public ActionResult DepartmentNameSelect(int intDeparId)
        {
            DataTable dt = _myItransfer.AllDepartmentSelect();
            string names = ConvertHelperController.DepartmentNameSelect(dt, intDeparId);
            return Json(names, JsonRequestBehavior.AllowGet);
        }

        #endregion

        #region 获取全部部门信息

        public ActionResult AllDepartmentSelect()
        {
            DataTable dt = _myItransfer.AllDepartmentSelect();
            return Json(Child(dt), JsonRequestBehavior.AllowGet);
        }

        private List<Dictionary<string, object>> Child(DataTable dt, int fid = 0)
        {
            var dv = new DataView(dt) { RowFilter = "Department_Farid=" + fid };
            DataTable dtChild = dv.ToTable();
            var listReturn = new List<Dictionary<string, object>>();
            if (dtChild.Rows.Count > 0)
            {
                for (int i = 0; i < dtChild.Rows.Count; i++)
                {
                    object[] value = { Convert.ToInt32(dtChild.Rows[i]["Department_id"]), dtChild.Rows[i]["Department_name"] };
                    var childList = new Dictionary<string, object> { { "id", value[0] }, { "text", value[1] } };
                    if (Child(dt, (int)value[0]) != null)
                    {
                        childList.Add("state", "closed");
                        childList.Add("children", Child(dt, (int)value[0]));
                    }
                    listReturn.Add(childList);
                }
            }
            else
            {
                return null;
            }
            return listReturn;
        }

        #endregion
        #region 创建转库记录编号

        public ActionResult AddNewTransferRepertory()
        {
            DataTable dt = _myItransfer.GetOddNumbers(5);
            DataTable dt1 = _myItransfer.GetDayMaxCount(11);
            string prefixs = dt.Rows[0]["Prefixs"].ToString().Trim();
            int count = Convert.ToInt32(dt.Rows[0]["Suffix_number"].ToString().Trim());
            string counts = (Convert.ToInt32(dt1.Rows[0][0]) + 1).ToString("D"+count+"");
            return Json((prefixs + counts), JsonRequestBehavior.AllowGet);
        }

        #endregion





        #endregion

        #region 转库单查询

        public ActionResult SelectTransferRepertory()
        {
            return View();
        }

        #region 根据转库单id查询转库明细

        public ActionResult SelectTtansDetail(int intTransId)
        {
            DataTable dt = _myItransfer.SelectTtansDetail(intTransId);
            dt.Columns.Add("Tax_inclusive_price1", typeof(string));
            dt.Columns.Add("Purchase_bid1", typeof(string));
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                dt.Rows[i]["Tax_inclusive_price1"] = "<font style='color:red'>¥</font>" + dt.Rows[i]["Tax_inclusive_price"];
                dt.Rows[i]["Purchase_bid1"] = "<font style='color:red'>¥</font>" + dt.Rows[i]["Purchase_bid"];
            }
            List<Dictionary<string, object>> list = ConvertHelperController.DtToList(dt);
            return Json(list, JsonRequestBehavior.AllowGet);
        }

        #endregion


        #region 根据转库单查询转库明细

        public ActionResult SelectTransByTrans(int intTranId, bool bolReview)
        {
            DataTable dt = _myItransfer.SelectTransByTrans(intTranId, bolReview);
            List<Dictionary<string, object>> list = ConvertHelperController.DtToList(dt);
            return Json(list, JsonRequestBehavior.AllowGet);
        }

        #endregion
        #region 不定条件查询

        public ActionResult SelectTransferRepertoryIntRends(string strRnumber,
            string intDeparId,
            string intRawPlace,
            string intNewPlace,
            string dtmStar,
            string dtmEnd,
            string check)
        {
            DataTable dt = _myItransfer.SelectTransferRepertoryIntRends(
                strRnumber, ConvertHelperController.ConverToInt(intDeparId),
                ConvertHelperController.ConverToInt(intRawPlace),
                ConvertHelperController.ConverToInt(intNewPlace),
                ConvertHelperController.StarDate(dtmStar),
                ConvertHelperController.EndDate(dtmEnd),
                Convert.ToBoolean(check)
                );
            List<Dictionary<string, object>> list = ConvertHelperController.DtToList(dt);
            return Json(list, JsonRequestBehavior.AllowGet);
        }

        #endregion


        #endregion


    }
}

2.7、转库接口代码:

using System;
using System.Data;
namespace BLL_KuCunGuangLi
{
    public interface ITransferRepertorys
    {
        DataTable GetOddNumbers(int intOddNumbersId);//获取记录编号前缀
        DataTable GetDayMaxCount(int intOddNumbersId);//获取转库日最大单数
        DataTable AllDepartmentSelect();//获取所以部门信息
        DataTable GetRepertoryPlace(int intDeparId);//根据部门Id获取库存地点
        DataTable GetRepertoryPlaceName(int intPlaceId);//根据库存地点id获取库存名称
        DataTable GetEmployee(int intPlaceId);//绑定发/收货人
        DataTable GetEmployeeName(int intEmployeeId);//查询发/收货人信息
        DataTable GetEmployeeByDeparId(int intDeparId);//获取部门员工信息
        DataTable GetGoodsAll(int intRepertory);//查询绑定批量选择
        DataTable GetGoodsByBlur(string strBlur, int intRepertory);//模糊查询商品
        DataTable GetGoodsByGoodsId(int goodsId, int intRepertory);//查询商品by商品id
        DataTable SaveNewTransferRepertory(string strRnumber, int intDepartment, int intFormerPlace, int intNewPlace, int intEmployeeSend, int intEmployeeHarvest, int intRegistrant, System.DateTime dtmRegister, bool check);//新增转库单
        void SaveNewTransferRepertoryDetails(int intTranReperId, int intGoodsId, string strRnumber, int intStockId);//新增转库单明细
        DataTable GetAllTransferRepertory();//查询全部转库单
        DataTable GetTranRepertBlur(string strBlur);//模糊查询转库单
        DataTable GetTransferRepertoryDetails(int intGcrId);//查询转库明细
        int DeleteTransferRepertoryDetail(int intChangeId);//删除转库明细
        int DeleteTransferRepertory(int intChangeId);//删除转库单
        void InsertRows(int intTranReperId, int intGoodsId, string strRnumber, int intStockId);//修改-新增转库明细
        void DeleteRows(int changeDetailId);//修改-删除转库明细
        void UpdateRows(int changeDetailId, int intRnumber);//修改-修改转库明细
        int UpdateTransferRepertory(int intDepartment, int intFormerPlace, int intNewPlace, int intEmployeeSend, int intEmployeeHarvest, int intRegistrant, System.DateTime dtmRegister, bool check, int intTranReperId);//修改-修改转库单
        DataTable GetTranRepertByTranReperId(int intTranReperId);//根据转库ID查询转库信息
        DataTable GetTranRepertDetailToReview(int intTranReperId);//审核-查询转库明细
        void ChangeStockQuantity(int stockIdsTag, int changeNumberTag);//审核-修改库存数-清空零库存
        void ChangeStockQuantity1(int stockIdsTag, int changeNumberTag);//审核-修改库存数-不清空零库存
        void UpdateStockQuantity(int intTranReperId, int intAuditor, DateTime dtmReview);//审核-修改转库单
        DataTable SelectTransferRepertoryIntRends(string strRnumber, int intDeparId, int intRawPlace, int intNewPlace, DateTime dtmStar, DateTime dtmEnd, bool check);//不定条件查询
        DataTable SelectTransByTrans(int intTranId, bool bolReview);//根据转库单查询转库明细
        DataTable SelectTtansDetail(int intTransId);//根据转库单id查询转库明细

   
    }
}

2.8、转库BLL代码:

using System;
using System.Data;
using System.Data.SqlClient;
using DALPublic;
using Microsoft.SqlServer.Server;

namespace BLL_KuCunGuangLi
{
    public class TransferRepertory : ITransferRepertorys
    {
        private readonly DalMethod _myDal = new DalMethod();
        public DataTable GetOddNumbers(int intOddNumbersId)
        {
            SqlParameter[] sql =
            {
                new SqlParameter("@NB", SqlDbType.Char),
                new SqlParameter("@Odd_numbers_id", SqlDbType.Int)
            };
            sql[0].Value = "GetOddNumbers";
            sql[1].Value = intOddNumbersId;
            return _myDal.DAL_SelectDB_Par("Update_Day_Max_Count", sql);
        }
        public DataTable GetDayMaxCount(int dayMaxId)
        {
            SqlParameter[] sql =
            {
                new SqlParameter("@NB", SqlDbType.Char),
                new SqlParameter("@Day_max_quantity_id", SqlDbType.Int)
            };
            sql[0].Value = "GetDayMaxCount";
            sql[1].Value = dayMaxId;
            return _myDal.DAL_SelectDB_Par("Update_Day_Max_Count", sql);
        }
        public DataTable AllDepartmentSelect()
        {
            SqlParameter[] sql =
            {
                new SqlParameter("@NB",SqlDbType.Char)
            };
            sql[0].Value = "AllDepartmentSelect";
            return _myDal.DAL_SelectDB_Par("Inventory_Control_TransferRepertory", sql);
        }
        public DataTable GetRepertoryPlace(int intDeparId)
        {
            SqlParameter[] sql =
            {
                new SqlParameter("@NB",SqlDbType.Char), 
                new SqlParameter("@Department_id",SqlDbType.Int)
            };
            sql[0].Value = "GetRepertoryPlace";
            sql[1].Value = intDeparId;
            return _myDal.DAL_SelectDB_Par("Inventory_Control_TransferRepertory", sql);
        }
        public DataTable GetRepertoryPlaceName(int intPlaceId)
        {
            SqlParameter[] sql =
            {
                new SqlParameter("@NB",SqlDbType.Char), 
                new SqlParameter("@Repertory_place_id",SqlDbType.Int)
            };
            sql[0].Value = "GetRepertoryPlaceName";
            sql[1].Value = intPlaceId;
            return _myDal.DAL_SelectDB_Par("Inventory_Control_TransferRepertory", sql);
        }
        public DataTable GetEmployee(int intPlaceId)
        {
            SqlParameter[] sql =
            {
                new SqlParameter("@NB",SqlDbType.Char), 
                new SqlParameter("@Repertory_place_id",SqlDbType.Int)
            };
            sql[0].Value = "GetEmployee";
            sql[1].Value = intPlaceId;
            return _myDal.DAL_SelectDB_Par("Inventory_Control_TransferRepertory", sql);
        }
        public DataTable GetEmployeeName(int intEmployeeId)
        {
            SqlParameter[] sql =
            {
                new SqlParameter("@NB",SqlDbType.Char), 
                new SqlParameter("@Employee_id",SqlDbType.Int)
            };
            sql[0].Value = "GetEmployeeName";
            sql[1].Value = intEmployeeId;
            return _myDal.DAL_SelectDB_Par("Inventory_Control_TransferRepertory", sql);
        }
        public DataTable GetEmployeeByDeparId(int intDeparId)
        {
            SqlParameter[] sql =
            {
                new SqlParameter("@NB",SqlDbType.Char), 
                new SqlParameter("@Department_id",SqlDbType.Int)
            };
            sql[0].Value = "GetEmployeeByDeparId";
            sql[1].Value = intDeparId;
            return _myDal.DAL_SelectDB_Par("Inventory_Control_TransferRepertory", sql);
        }
        public DataTable GetGoodsAll(int intRepertory)
        {
            SqlParameter[] sql =
            {
                new SqlParameter("@NB",SqlDbType.Char), 
                new SqlParameter("@Repertory_place_id",SqlDbType.Int)
            };
            sql[0].Value = "GetGoodsAll";
            sql[1].Value = intRepertory;
            return _myDal.DAL_SelectDB_Par("Inventory_Control_TransferRepertory", sql);
        }
        public DataTable GetGoodsByBlur(string strBlur, int intRepertory)
        {
            SqlParameter[] sql =
            {
                new SqlParameter("@NB", SqlDbType.Char),
                new SqlParameter("@strBlur", SqlDbType.Char),
                new SqlParameter("@Repertory_place_id",SqlDbType.Int)
            };
            sql[0].Value = "GetGoodsByBlur";
            sql[1].Value = strBlur;
            sql[2].Value = intRepertory;
            return _myDal.DAL_SelectDB_Par("Inventory_Control_TransferRepertory", sql);
        }
        public DataTable GetGoodsByGoodsId(int goodsId, int intRepertory)
        {
            SqlParameter[] sql =
            {
                new SqlParameter("@NB", SqlDbType.Char),
                new SqlParameter("@Goods_id", SqlDbType.Int),
                 new SqlParameter("@Repertory_place_id",SqlDbType.Int)
            };
            sql[0].Value = "GetGoodsByGoodsId";
            sql[1].Value = goodsId;
            sql[2].Value = intRepertory;
            return _myDal.DAL_SelectDB_Par("Inventory_Control_TransferRepertory", sql);
        }
        public DataTable SaveNewTransferRepertory(string strRnumber, int intDepartment, int intFormerPlace, int intNewPlace,
            int intEmployeeSend, int intEmployeeHarvest, int intRegistrant, DateTime dtmRegister, bool check)
        {
            SqlParameter[] sql =
            {
                new SqlParameter("@NB",SqlDbType.Char),
                new SqlParameter("@Change_department_id",SqlDbType.Int), 
                new SqlParameter("@Raw_repertory_place_id",SqlDbType.Int),
                new SqlParameter("@New_repertory_place_id",SqlDbType.Int),
                new SqlParameter("@Shipper_id",SqlDbType.Int),
                new SqlParameter("@Receiver_id",SqlDbType.Int),
                new SqlParameter("@Register_time",SqlDbType.DateTime), 
                new SqlParameter("@Registrant_id",SqlDbType.Int),
                new SqlParameter("@Record_number",SqlDbType.Char), 
                new SqlParameter("@check",SqlDbType.Bit)
            };
            sql[0].Value = "SaveNewTransferRepertory";
            sql[1].Value = intDepartment;
            sql[2].Value = intFormerPlace;
            sql[3].Value = intNewPlace;
            sql[4].Value = intEmployeeSend;
            sql[5].Value = intEmployeeHarvest;
            sql[6].Value = dtmRegister;
            sql[7].Value = intRegistrant;
            sql[8].Value = strRnumber;
            sql[9].Value = check;
            return _myDal.DAL_SelectDB_Par("Inventory_Control_TransferRepertory", sql);
        }
        public void SaveNewTransferRepertoryDetails(int intTranReperId, int intGoodsId, string strRnumber, int intStockId)
        {
            SqlParameter[] sql =
            {
                new SqlParameter("@NB",SqlDbType.Char),
                new SqlParameter("@Goods_change_repository_id",SqlDbType.Int),
                new SqlParameter("@Goods_id",SqlDbType.Int),
                new SqlParameter("@Change_number",SqlDbType.Char), 
                new SqlParameter("@StockId",SqlDbType.Int)
            };
            sql[0].Value = "SaveNewTransferRepertoryDetails";
            sql[1].Value = intTranReperId;
            sql[2].Value = intGoodsId;
            sql[3].Value = strRnumber;
            sql[4].Value = intStockId;
            _myDal.DAL_OPTableDB_Par("Inventory_Control_TransferRepertory", sql);
        }
        public DataTable GetAllTransferRepertory()
        {
            SqlParameter[] sql =
            {
                new SqlParameter("@NB",SqlDbType.Char)
            };
            sql[0].Value = "GetAllTransferRepertory";
            return _myDal.DAL_SelectDB_Par("Inventory_Control_TransferRepertory", sql);
        }
        public DataTable GetTranRepertBlur(string strBlur)
        {
            SqlParameter[] sql =
            {
                new SqlParameter("@NB",SqlDbType.Char),
                new SqlParameter("@strBlur",SqlDbType.Char)
            };
            sql[0].Value = "GetTranRepertBlur";
            sql[1].Value = strBlur;
            return _myDal.DAL_SelectDB_Par("Inventory_Control_TransferRepertory", sql);
        }
        public DataTable GetTransferRepertoryDetails(int intGcrId)
        {
            SqlParameter[] sql =
            {
                new SqlParameter("@NB", SqlDbType.Char),
                new SqlParameter("@Goods_change_repository_id",SqlDbType.Int)
            };
            sql[0].Value = "GetTransferRepertoryDetails";
            sql[1].Value = intGcrId;
            return _myDal.DAL_SelectDB_Par("Inventory_Control_TransferRepertory", sql);
        }
        public int DeleteTransferRepertoryDetail(int intChangeId)
        {
            SqlParameter[] sql =
            {
                new SqlParameter("@NB",SqlDbType.Char),
                new SqlParameter("@Goods_change_repository_id",SqlDbType.Int)
            };
            sql[0].Value = "DeleteTransferRepertoryDetail";
            sql[1].Value = intChangeId;
            return _myDal.DAL_OPTableDB_Par("Inventory_Control_TransferRepertory", sql);
        }
        public int DeleteTransferRepertory(int intChangeId)
        {
            SqlParameter[] sql =
            {
                new SqlParameter("@NB",SqlDbType.Char),
                new SqlParameter("@Goods_change_repository_id",SqlDbType.Int)
            };
            sql[0].Value = "DeleteTransferRepertory";
            sql[1].Value = intChangeId;
            return _myDal.DAL_OPTableDB_Par("Inventory_Control_TransferRepertory", sql);
        }
        public void InsertRows(int intTranReperId, int intGoodsId, string strRnumber, int intStockId)
        {
            SqlParameter[] sql =
            {
                new SqlParameter("@NB",SqlDbType.Char),
                new SqlParameter("@Goods_change_repository_id",SqlDbType.Int),
                new SqlParameter("@Goods_id",SqlDbType.Int),
                new SqlParameter("@Change_number",SqlDbType.Char), 
                new SqlParameter("@StockId",SqlDbType.Int)
            };
            sql[0].Value = "InsertRows";
            sql[1].Value = intTranReperId;
            sql[2].Value = intGoodsId;
            sql[3].Value = strRnumber;
            sql[4].Value = intStockId;
            _myDal.DAL_OPTableDB_Par("Inventory_Control_TransferRepertory", sql);
        }
        public void DeleteRows(int changeDetailId)
        {
            SqlParameter[] sql =
            {
                new SqlParameter("@NB",SqlDbType.Char),
                new SqlParameter("@Goods_change_repository_detail_id",SqlDbType.Int)
            };
            sql[0].Value = "DeleteRows";
            sql[1].Value = changeDetailId;
            _myDal.DAL_OPTableDB_Par("Inventory_Control_TransferRepertory", sql);
        }
        public void UpdateRows(int changeDetailId, int intRnumber)
        {
            SqlParameter[] sql =
            {
                new SqlParameter("@NB",SqlDbType.Char),
                new SqlParameter("@Goods_change_repository_detail_id",SqlDbType.Int), 
                new SqlParameter("@Change_number",SqlDbType.Int)
            };
            sql[0].Value = "UpdateRows";
            sql[1].Value = changeDetailId;
            sql[2].Value = intRnumber;
            _myDal.DAL_OPTableDB_Par("Inventory_Control_TransferRepertory", sql);
        }
        public int UpdateTransferRepertory(int intDepartment, int intFormerPlace, int intNewPlace, int intEmployeeSend,
            int intEmployeeHarvest, int intRegistrant, DateTime dtmRegister, bool check, int intTranReperId)
        {
            SqlParameter[] sql =
            {
                new SqlParameter("@NB",SqlDbType.Char),
                new SqlParameter("@Change_department_id",SqlDbType.Int), 
                new SqlParameter("@Raw_repertory_place_id",SqlDbType.Int),
                new SqlParameter("@New_repertory_place_id",SqlDbType.Int),
                new SqlParameter("@Shipper_id",SqlDbType.Int),
                new SqlParameter("@Receiver_id",SqlDbType.Int),
                new SqlParameter("@Register_time",SqlDbType.DateTime), 
                new SqlParameter("@Registrant_id",SqlDbType.Int),
                new SqlParameter("@Goods_change_repository_id",SqlDbType.Int), 
                new SqlParameter("@check",SqlDbType.Bit)
            };
            sql[0].Value = "UpdateTransferRepertory";
            sql[1].Value = intDepartment;
            sql[2].Value = intFormerPlace;
            sql[3].Value = intNewPlace;
            sql[4].Value = intEmployeeSend;
            sql[5].Value = intEmployeeHarvest;
            sql[6].Value = dtmRegister;
            sql[7].Value = intRegistrant;
            sql[8].Value = intTranReperId;
            sql[9].Value = check;
            return _myDal.DAL_OPTableDB_Par("Inventory_Control_TransferRepertory", sql);
        }
        public DataTable GetTranRepertByTranReperId(int intTranReperId)
        {
            SqlParameter[] sql =
            {
                new SqlParameter("@NB",SqlDbType.Char),
                new SqlParameter("@Goods_change_repository_id",SqlDbType.Int)
            };
            sql[0].Value = "GetTranRepertByTranReperId";
            sql[1].Value = intTranReperId;
            return _myDal.DAL_SelectDB_Par("Inventory_Control_TransferRepertory", sql);
        }
        public DataTable GetTranRepertDetailToReview(int intTranReperId)
        {
            SqlParameter[] sql =
            {
                new SqlParameter("@NB",SqlDbType.Char),
                new SqlParameter("@Goods_change_repository_id",SqlDbType.Int), 
            };
            sql[0].Value = "GetTranRepertDetailToReview";
            sql[1].Value = intTranReperId;
            return _myDal.DAL_SelectDB_Par("Inventory_Control_TransferRepertory", sql);
        }
        public void ChangeStockQuantity(int stockIdsTag, int changeNumberTag)
        {
            SqlParameter[] sql =
            {
                new SqlParameter("@NB",SqlDbType.Char), 
                new SqlParameter("@Stock_id",SqlDbType.Int), 
                new SqlParameter("@Stock_quantity",SqlDbType.Int), 
            };
            sql[0].Value = "ChangeStockQuantity";
            sql[1].Value = stockIdsTag;
            sql[2].Value = changeNumberTag;
            _myDal.DAL_OPTableDB_Par("Inventory_Control_TransferRepertory", sql);
        }
        public void ChangeStockQuantity1(int stockIdsTag, int changeNumberTag)
        {
            SqlParameter[] sql =
            {
                new SqlParameter("@NB",SqlDbType.Char), 
                new SqlParameter("@Stock_id",SqlDbType.Int), 
                new SqlParameter("@Stock_quantity",SqlDbType.Int), 
            };
            sql[0].Value = "ChangeStockQuantity1";
            sql[1].Value = stockIdsTag;
            sql[2].Value = changeNumberTag;
            _myDal.DAL_OPTableDB_Par("Inventory_Control_TransferRepertory", sql);
        }

        public void UpdateStockQuantity(int intTranReperId, int intAuditor, DateTime dtmReview)
        {
            SqlParameter[] sql =
            {
                new SqlParameter("@NB",SqlDbType.Char),
                new SqlParameter("@Goods_change_repository_id",SqlDbType.Int),
                new SqlParameter("@Auditor_id",SqlDbType.Int),
                new SqlParameter("@Review_time",SqlDbType.DateTime), 
            };
            sql[0].Value = "UpdateStockQuantity";
            sql[1].Value = intTranReperId;
            sql[2].Value = intAuditor;
            sql[3].Value = dtmReview;
            _myDal.DAL_OPTableDB_Par("Inventory_Control_TransferRepertory", sql);
        }

        public DataTable SelectTransferRepertoryIntRends(string strRnumber, int intDeparId, int intRawPlace, int intNewPlace,
            DateTime dtmStar, DateTime dtmEnd, bool check)
        {

            SqlParameter[] sql =
            {
                new SqlParameter("@NB",SqlDbType.NChar), 
                new SqlParameter("@Review_deny",SqlDbType.Bit), 
                new SqlParameter("@dtmStar",SqlDbType.Date),
                new SqlParameter("@dtmEnd",SqlDbType.Date),
                new SqlParameter("@Record_number",SqlDbType.NChar),
                new SqlParameter("@Change_department_id",SqlDbType.Int),
                new SqlParameter("@Raw_repertory_place_id",SqlDbType.Int),
                new SqlParameter("@New_repertory_place_id",SqlDbType.Int), 
            };
            object[] parans = { "SelectTransferRepertoryIntRends", check, dtmStar, dtmEnd, strRnumber, intDeparId, intRawPlace, intNewPlace };
            for (int i = 0; i < sql.Length; i++)
            {
                sql[i].Value = parans[i];
            }
            return _myDal.DAL_SelectDB_Par("Inventory_Control_TransferRepertory", sql);
        }

        public DataTable SelectTransByTrans(int intTranId, bool bolReview)
        {
            SqlParameter[] sql =
            {
                new SqlParameter("@NB",SqlDbType.NChar), 
                new SqlParameter("@Goods_change_repository_id",SqlDbType.Int), 
                new SqlParameter("@Review_deny",SqlDbType.Bit), 

            };
            object[] parans = { "SelectTransByTrans", intTranId, bolReview };
            for (int i = 0; i < sql.Length; i++)
            {
                sql[i].Value = parans[i];
            }
            return _myDal.DAL_SelectDB_Par("Inventory_Control_TransferRepertory", sql);
        }

        public DataTable SelectTtansDetail(int intTransId)
        {
            SqlParameter[] sql =
            {
                new SqlParameter("@NB",SqlDbType.NChar),
                new SqlParameter("@Goods_change_repository_id",SqlDbType.Int), 
            };
            object[] parans = { "SelectTtansDetail", intTransId };
            for (int i = 0; i < sql.Length; i++)
            {
                sql[i].Value = parans[i];
            }
            return _myDal.DAL_SelectDB_Par("Inventory_Control_TransferRepertory", sql);
        }

      
    }
}

3、数据库设计:

3.1、存储过程:

ALTER PROCEDURE [dbo].[Inventory_Control_TransferRepertory]
@NB char(100)='',@Department_Farid int=0,@Department_id int=0,@Repertory_place_id int=0,@Employee_id int=0,
@strBlur char(20)='',@Goods_id int=0,@Change_department_id int=0,@Raw_repertory_place_id int=0,@New_repertory_place_id int=0,
@Shipper_id int=0,@Receiver_id int=0,@Register_time datetime='',@Registrant_id int=0,@Record_number char(20)='',@check bit=false,
@Goods_change_repository_id int=0,@Change_number char(20)='',@StockId int=0,@Goods_change_repository_detail_id int=0,
@Stock_id int=0,@Stock_quantity int=0,@Auditor_id int=0,@Review_time datetime='',@Review_deny bit='false',
@sql varchar(max)='',@dtmStar datetime='',@dtmEnd datetime=''
AS
BEGIN
if(@NB='SelectTtansDetail')
begin 
SELECT     Stock.Stock_quantity, Goods_change_repository_detail.Goods_change_repository_detail_id, Goods_change_repository_detail.Change_number, 
                      CEILING(Goods_change_repository_detail.Change_number / Goods.Quality_content) AS Repertory_enter_packages, Goods.Purchase_bid, Goods.Quality_content, Goods.Goods_name, 
                      Goods.Goods_bar_code, Goods.Goods_code, (CASE Goods.Vender_bar_code_deny WHEN 'true' THEN '是' ELSE '否' END) AS Vender_bar_code_deny, 
                      Goods.Purchase_bid * (CAST(Goods.Input_ratio AS decimal(18, 5)) / 100 + 1) AS Tax_inclusive_price, Goods.Goods_abbreviation, Goods.Art_No, Goods.Retail_unit_price, Goods.Format_model, 
                      Agreement.Contract_number, Goods.Plncode_PLN, Manufacturer.Manufacturer_name, Enterprise_name.Chinese, Goods_producing_area.Producing_area_name, 
                      Attribute_gather_detail.Attribute_gather_detail_name AS Unit_of_measurement, Attribute_gather_detail_1.Attribute_gather_detail_name AS Goods_classify, 
                      Attribute_gather_detail_2.Attribute_gather_detail_name AS Quality_grade, Goods.Input_ratio, Goods.Output_ratio
FROM         Goods_change_repository_detail INNER JOIN
                      Goods ON Goods_change_repository_detail.Goods_id = Goods.Goods_id INNER JOIN
                      Stock ON Goods_change_repository_detail.StockId = Stock.Stock_id INNER JOIN
                      Agreement ON Goods.Agreement_id = Agreement.Agreement_id INNER JOIN
                      Manufacturer ON Goods.Manufacturer_id = Manufacturer.Manufacturer_id INNER JOIN
                      Supply_units ON Agreement.Supply_units_id = Supply_units.Supply_units_id INNER JOIN
                      Enterprise_name ON Supply_units.Enterprise_name_id = Enterprise_name.Enterprise_name_id INNER JOIN
                      Goods_producing_area ON Goods.Producing_area_id = Goods_producing_area.Producing_area_id INNER JOIN
                      Attribute_gather_detail ON Goods.Unit_of_measurement_pubid = Attribute_gather_detail.Attribute_gather_detail_id INNER JOIN
                      Attribute_gather_detail AS Attribute_gather_detail_1 ON Goods.Goods_classify_pubid = Attribute_gather_detail_1.Attribute_gather_detail_id INNER JOIN
                      Attribute_gather_detail AS Attribute_gather_detail_2 ON Goods.Quality_grade_pubid = Attribute_gather_detail_2.Attribute_gather_detail_id
WHERE     (Goods_change_repository_detail.Goods_change_repository_id = @Goods_change_repository_id)
end
if(@NB='SelectTransByTrans' )		--根据转库单id查询转库单信息
begin
if(@Review_deny='false')
SELECT     rtrim(Department.Department_name) AS Change_department, 
rtrim(Repertory_place.Repertory_place_name) AS Raw_repertory_place, 
rtrim(Repertory_place_1.Repertory_place_name) AS New_repertory_place, 
                      rtrim(Eemployee.Employee_name) AS Shipper, rtrim(Eemployee_1.Employee_name) AS Receiver, 
                      rtrim(Eemployee_2.Employee_name) AS Registrant,
                      rtrim(convert(nchar(20),Register_time,120)) as  Register_time,
                      rtrim(Goods_change_repository.Record_number)as Record_number, 
                      rtrim(case ClrEtyReper_deny when 'true' then '是' else '否' end) as ClrEtyReper_deny,
                      RTRIM(Goods_change_repository.Remarks) as Remarks
FROM         Goods_change_repository INNER JOIN
                      Department ON Goods_change_repository.Change_department_id = Department.Department_id INNER JOIN
                      Repertory_place ON Goods_change_repository.Raw_repertory_place_id = Repertory_place.Repertory_place_id INNER JOIN
                      Repertory_place AS Repertory_place_1 ON Goods_change_repository.New_repertory_place_id = Repertory_place_1.Repertory_place_id INNER JOIN
                      Eemployee ON Goods_change_repository.Shipper_id = Eemployee.Employee_id INNER JOIN
                      Eemployee AS Eemployee_1 ON Goods_change_repository.Receiver_id = Eemployee_1.Employee_id INNER JOIN
                      Eemployee AS Eemployee_2 ON Goods_change_repository.Registrant_id = Eemployee_2.Employee_id
          where Goods_change_repository_id=@Goods_change_repository_id
else
SELECT     rtrim(Department.Department_name) AS Change_department, 
rtrim(Repertory_place.Repertory_place_name) AS Raw_repertory_place, 
rtrim(Repertory_place_1.Repertory_place_name) AS New_repertory_place, 
                      rtrim(Eemployee.Employee_name) AS Shipper, rtrim(Eemployee_1.Employee_name) AS Receiver, 
                      rtrim(Eemployee_2.Employee_name) AS Registrant,
                      rtrim(convert(nchar(20),Register_time,120)) as  Register_time,
                      rtrim(Goods_change_repository.Record_number)as Record_number, 
                      rtrim(case ClrEtyReper_deny when 'true' then '是' else '否' end) as ClrEtyReper_deny,
                      RTRIM(Goods_change_repository.Remarks) as Remarks,
                      rtrim(Eemployee_3.Employee_name) AS Auditor, rtrim(convert(nchar(20),Goods_change_repository.Review_time,120)) as Review_time
FROM         Goods_change_repository INNER JOIN
                      Department ON Goods_change_repository.Change_department_id = Department.Department_id INNER JOIN
                      Repertory_place ON Goods_change_repository.Raw_repertory_place_id = Repertory_place.Repertory_place_id INNER JOIN
                      Repertory_place AS Repertory_place_1 ON Goods_change_repository.New_repertory_place_id = Repertory_place_1.Repertory_place_id INNER JOIN
                      Eemployee ON Goods_change_repository.Shipper_id = Eemployee.Employee_id INNER JOIN
                      Eemployee AS Eemployee_1 ON Goods_change_repository.Receiver_id = Eemployee_1.Employee_id INNER JOIN
                      Eemployee AS Eemployee_2 ON Goods_change_repository.Registrant_id = Eemployee_2.Employee_id INNER JOIN
                      Eemployee AS Eemployee_3 ON Goods_change_repository.Auditor_id = Eemployee_3.Employee_id
                      where Goods_change_repository_id=@Goods_change_repository_id
end
else
if(@NB='SelectTransferRepertoryIntRends')
begin
 set @sql='SELECT     Goods_change_repository.Record_number, Department.Department_name, Goods_change_repository.Goods_change_repository_id, 
                      Repertory_place.Repertory_place_name AS Raw_repertory_place, Repertory_place_1.Repertory_place_name AS New_repertory_place, Goods_change_repository.Review_deny, 
                      convert(nchar(20),Register_time ,120) as Register_time
FROM         Goods_change_repository INNER JOIN
                      Department ON Goods_change_repository.Change_department_id = Department.Department_id INNER JOIN
                      Repertory_place ON Goods_change_repository.Raw_repertory_place_id = Repertory_place.Repertory_place_id INNER JOIN
                      Repertory_place AS Repertory_place_1 ON Goods_change_repository.New_repertory_place_id = Repertory_place_1.Repertory_place_id
WHERE     (Goods_change_repository.Review_deny = '+rtrim(@Review_deny)+') AND (Goods_change_repository.Register_time BETWEEN '''+rtrim(@dtmStar)+''' AND '''+rtrim(@dtmEnd)+''')'
if(@Record_number<>'') set @sql=@sql+' and Record_number like ''%'+rtrim(@Record_number)+'%'''
if(@Change_department_id<>0) set @sql=@sql+' and Change_department_id='+RTRIM(@Change_department_id)+''
if(@Raw_repertory_place_id<>0) set @sql=@sql+' and Raw_repertory_place_id='+RTRIM(@Raw_repertory_place_id)+''
if(@New_repertory_place_id<>0) set @sql=@sql+' and New_repertory_place_id='+rtrim(@New_repertory_place_id)+''
--select @sql
 exec(@sql)
 end
if(@NB='UpdateStockQuantity')		--审核-修改转库单
begin
UPDATE    Goods_change_repository
SET              Auditor_id =@Auditor_id, Review_time =@Review_time, Review_deny ='true'
where Goods_change_repository_id=@Goods_change_repository_id
end
if(@NB='ChangeStockQuantity1')		--审核-修改库存数-不清空零库存
begin
UPDATE    Stock
SET              Stock_quantity =Stock_quantity-@Stock_quantity
WHERE     (Stock_id = @Stock_id)
end
if(@NB='ChangeStockQuantity')		--审核-修改库存数-清空零库存
begin
begin tran
UPDATE    Stock
SET              Stock_quantity =Stock_quantity-@Stock_quantity
WHERE     (Stock_id = @Stock_id)

DELETE FROM Stock
where Stock_id=(SELECT     Stock_id
FROM         Stock where Stock_quantity<=0 and Stock_id=@Stock_id)
commit tran
end
if(@NB='GetTranRepertDetailToReview')		--审核-查询转库明细
begin
SELECT     Stock.Stock_quantity, Goods_change_repository_detail.Change_number, Stock.Stock_toplimit, Stock.Stock_id, Goods_change_repository.ClrEtyReper_deny, Goods.Goods_name
FROM         Goods_change_repository_detail INNER JOIN
                      Stock ON Goods_change_repository_detail.StockId = Stock.Stock_id INNER JOIN
                      Goods_change_repository ON Goods_change_repository_detail.Goods_change_repository_id = Goods_change_repository.Goods_change_repository_id INNER JOIN
                      Goods ON Stock.Goods_id = Goods.Goods_id
WHERE     (Goods_change_repository_detail.Goods_change_repository_id = @Goods_change_repository_id)
end
if(@NB='GetTranRepertByTranReperId')		--根据转库ID查询转库单
begin
SELECT     Goods_change_repository.Goods_change_repository_id, Goods_change_repository.Shipper_id, Goods_change_repository.Receiver_id, Goods_change_repository.Registrant_id, 
                      Goods_change_repository.Register_time, Goods_change_repository.Record_number, Goods_change_repository.ClrEtyReper_deny, 
                      Repertory_place_1.Repertory_place_name AS Raw_repertory_place, Repertory_place.Repertory_place_name AS New_repertory_place, Goods_change_repository.Change_department_id, 
                      Goods_change_repository.Raw_repertory_place_id, Goods_change_repository.New_repertory_place_id
FROM         Goods_change_repository INNER JOIN
                      Repertory_place AS Repertory_place_1 ON Goods_change_repository.Raw_repertory_place_id = Repertory_place_1.Repertory_place_id INNER JOIN
                      Repertory_place ON Goods_change_repository.New_repertory_place_id = Repertory_place.Repertory_place_id
                      where Goods_change_repository_id=@Goods_change_repository_id
end
if(@NB='UpdateTransferRepertory')		--修改-修改转库单
begin
UPDATE    Goods_change_repository
SET              Change_department_id =@Change_department_id, Raw_repertory_place_id =@Raw_repertory_place_id, New_repertory_place_id =@New_repertory_place_id, Shipper_id =@Shipper_id, Receiver_id =@Receiver_id, Registrant_id =@Registrant_id, Register_time =@Register_time, ClrEtyReper_deny =@check
where Goods_change_repository_id=@Goods_change_repository_id
end
if(@NB='UpdateRows')		--修改-修改转库明细
begin
UPDATE    Goods_change_repository_detail
SET              Change_number =@Change_number
where Goods_change_repository_detail_id=@Goods_change_repository_detail_id

end
if(@NB='DeleteRows')		--修改-删除转库明细
begin
DELETE FROM Goods_change_repository_detail
where Goods_change_repository_detail_id=@Goods_change_repository_detail_id
end
if(@NB='InsertRows')		--修改-新增转库明细
begin
INSERT INTO Goods_change_repository_detail
                      (Goods_change_repository_id, Goods_id, Change_number, StockId)
VALUES     (@Goods_change_repository_id,@Goods_id,@Change_number,@StockId)
end
if(@NB='DeleteTransferRepertory')		--删除转库单
begin
DELETE FROM Goods_change_repository
where Goods_change_repository_id=@Goods_change_repository_id
end
if(@NB='DeleteTransferRepertoryDetail')		--删除转库明细
begin
DELETE FROM Goods_change_repository_detail
where Goods_change_repository_id=@Goods_change_repository_id
end
if(@NB='GetTransferRepertoryDetails')			--获取转库明细
begin
SELECT     Goods.Goods_code, Goods.Goods_bar_code, (CASE Goods.Vender_bar_code_deny WHEN 'true' THEN '是' ELSE '否' END) AS Vender_bar_code_deny, Goods.Goods_name, 
                      Goods.Goods_abbreviation, Goods.Plncode_PLN, Attribute_gather_detail.Attribute_gather_detail_name AS Goods_tab, Goods.Goods_tab_pubid, Manufacturer.Manufacturer_name, 
                      Goods_producing_area.Producing_area_name, Goods.Art_No, Goods.Format_model, Attribute_gather_detail_1.Attribute_gather_detail_id, 
                      Attribute_gather_detail_1.Attribute_gather_detail_name AS Unit_of_measurement, Attribute_gather_detail_2.Attribute_gather_detail_name AS Goods_classify, Goods.Product_status_pubid, 
                      Attribute_gather_detail_3.Attribute_gather_detail_name AS Product_status, (CASE Goods.Self_fix_goods_deny WHEN 'true' THEN '是' ELSE '否' END) AS Self_fix_goods_deny, 
                      Goods.Mini_fix_goods_deny, Goods.Purchase_bid, Goods.Retail_unit_price, Goods.Quality_content, Agreement.Contract_number, 
                      Attribute_gather_detail_4.Attribute_gather_detail_name AS Use_target, Enterprise_name.Chinese, Goods_rademark.Goods_rademark_name, 
                      Attribute_gather_detail_6.Attribute_gather_detail_name AS Quality_grade, Goods.Goods_colours, Attribute_gather_detail_7.Attribute_gather_detail_name AS Quality_guarantee_period, 
                      Goods.Input_ratio, Goods.Purchase_bid * (CAST(Goods.Input_ratio AS decimal(18, 5)) / 100 + 1) AS InputTax, Goods_change_repository_detail.Change_number AS Shipments_quantity, 
                      Goods_change_repository_detail.Change_number / Goods.Quality_content AS NumberOfUnits, Goods_change_repository_detail.Goods_change_repository_id, Stock.Stock_quantity, 
                      Goods_change_repository_detail.Goods_change_repository_detail_id, Goods.Goods_id
FROM         Goods INNER JOIN
                      Attribute_gather_detail ON Goods.Goods_tab_pubid = Attribute_gather_detail.Attribute_gather_detail_id INNER JOIN
                      Manufacturer ON Goods.Manufacturer_id = Manufacturer.Manufacturer_id INNER JOIN
                      Goods_producing_area ON Goods.Producing_area_id = Goods_producing_area.Producing_area_id INNER JOIN
                      Attribute_gather_detail AS Attribute_gather_detail_1 ON Goods.Unit_of_measurement_pubid = Attribute_gather_detail_1.Attribute_gather_detail_id INNER JOIN
                      Attribute_gather_detail AS Attribute_gather_detail_2 ON Goods.Goods_classify_pubid = Attribute_gather_detail_2.Attribute_gather_detail_id INNER JOIN
                      Attribute_gather_detail AS Attribute_gather_detail_3 ON Goods.Product_status_pubid = Attribute_gather_detail_3.Attribute_gather_detail_id INNER JOIN
                      Agreement ON Goods.Agreement_id = Agreement.Agreement_id INNER JOIN
                      Attribute_gather_detail AS Attribute_gather_detail_4 ON Goods.Use_target_pubid = Attribute_gather_detail_4.Attribute_gather_detail_id INNER JOIN
                      Supply_units ON Agreement.Supply_units_id = Supply_units.Supply_units_id INNER JOIN
                      Enterprise_name ON Supply_units.Enterprise_name_id = Enterprise_name.Enterprise_name_id INNER JOIN
                      Goods_rademark ON Goods.Goods_rademark_id = Goods_rademark.Goods_rademark_id INNER JOIN
                      Attribute_gather_detail AS Attribute_gather_detail_6 ON Goods.Quality_grade_pubid = Attribute_gather_detail_6.Attribute_gather_detail_id INNER JOIN
                      Attribute_gather_detail AS Attribute_gather_detail_5 ON Goods.Quality_grade_pubid = Attribute_gather_detail_5.Attribute_gather_detail_id INNER JOIN
                      Attribute_gather_detail AS Attribute_gather_detail_7 ON Goods.Quality_guarantee_period_pubid = Attribute_gather_detail_7.Attribute_gather_detail_id INNER JOIN
                      Goods_change_repository_detail ON Goods.Goods_id = Goods_change_repository_detail.Goods_id INNER JOIN
                      Stock ON Goods_change_repository_detail.StockId = Stock.Stock_id
WHERE     (Goods_change_repository_detail.Goods_change_repository_id = @Goods_change_repository_id)
end
if(@NB='GetTranRepertBlur')		--模糊查询转库单
begin
SELECT     Goods_change_repository.Goods_change_repository_id, Department.Department_name AS Change_department, Goods_change_repository.Change_department_id, 
                      Goods_change_repository.Raw_repertory_place_id, Repertory_place_1.Repertory_place_name AS Raw_repertory_place, Goods_change_repository.New_repertory_place_id, 
                      Repertory_place.Repertory_place_name AS New_repertory_place, Goods_change_repository.Record_number, Goods_change_repository.Shipper_id, Goods_change_repository.Receiver_id, 
                      Goods_change_repository.Registrant_id, Goods_change_repository.Register_time, Goods_change_repository.ClrEtyReper_deny
FROM         Goods_change_repository INNER JOIN
                      Department ON Goods_change_repository.Change_department_id = Department.Department_id INNER JOIN
                      Repertory_place AS Repertory_place_1 ON Goods_change_repository.Raw_repertory_place_id = Repertory_place_1.Repertory_place_id INNER JOIN
                      Repertory_place ON Goods_change_repository.New_repertory_place_id = Repertory_place.Repertory_place_id                      where Record_number like '%'+rtrim(@strBlur)+'%' or Department.Department_name like '%'+rtrim(@strBlur)+'%' or Department.Department_code like '%'+rtrim(@strBlur)+'%'
end
if(@NB='GetAllTransferRepertory')		--查询全部转库单
begin
SELECT     Goods_change_repository.Goods_change_repository_id, Department.Department_name AS Change_department, Goods_change_repository.Change_department_id, 
                      Goods_change_repository.Raw_repertory_place_id, Repertory_place_1.Repertory_place_name AS Raw_repertory_place, Goods_change_repository.New_repertory_place_id, 
                      Repertory_place.Repertory_place_name AS New_repertory_place, Goods_change_repository.Record_number, Goods_change_repository.Shipper_id, Goods_change_repository.Receiver_id, 
                      Goods_change_repository.Registrant_id, Goods_change_repository.Register_time, Goods_change_repository.ClrEtyReper_deny
FROM         Goods_change_repository INNER JOIN
                      Department ON Goods_change_repository.Change_department_id = Department.Department_id INNER JOIN
                      Repertory_place AS Repertory_place_1 ON Goods_change_repository.Raw_repertory_place_id = Repertory_place_1.Repertory_place_id INNER JOIN
                      Repertory_place ON Goods_change_repository.New_repertory_place_id = Repertory_place.Repertory_place_id  
                                       where Goods_change_repository.Review_deny='false'
                                          end
if(@NB='SaveNewTransferRepertoryDetails')		--新增转库明细
begin
INSERT INTO Goods_change_repository_detail
                      (Goods_change_repository_id, Goods_id, Change_number, StockId)
VALUES     (@Goods_change_repository_id,@Goods_id,@Change_number,@StockId)
end
if(@NB='SaveNewTransferRepertory')		--新增转库单
begin
begin tran
INSERT INTO Goods_change_repository
                      (Change_department_id, Raw_repertory_place_id, New_repertory_place_id, Shipper_id, Receiver_id, Register_time, Registrant_id, Record_number, Review_deny, ClrEtyReper_deny)
VALUES     (@Change_department_id,@Raw_repertory_place_id,@New_repertory_place_id,@Shipper_id,@Receiver_id,@Register_time,@Registrant_id,@Record_number, 'false',@check)select @@IDENTITY
UPDATE    Day_max_quantity
SET              Day_max_count =Day_max_count+1
WHERE     (Day_max_quantity_id = 11)
commit tran
end
if(@NB='GetEmployeeByDeparId')		--获取部门员工
begin
SELECT     Employee_id, Employee_name
FROM         Eemployee
where Department_id=@Department_id
end
if(@NB='GetGoodsByGoodsId')		--绑定要转库的商品
begin
SELECT     Goods.Goods_id, Goods.Goods_code, Goods.Goods_bar_code, Goods.Goods_name, Goods.Goods_abbreviation, Goods.Plncode_PLN, 
                      Attribute_gather_detail.Attribute_gather_detail_name AS Goods_tab, Goods.Goods_tab_pubid, Manufacturer.Manufacturer_name, Goods_producing_area.Producing_area_name, Goods.Art_No, 
                      Goods.Format_model, Attribute_gather_detail_1.Attribute_gather_detail_id, Attribute_gather_detail_1.Attribute_gather_detail_name AS Unit_of_measurement, 
                      Attribute_gather_detail_2.Attribute_gather_detail_name AS Goods_classify, Goods.Product_status_pubid, Attribute_gather_detail_3.Attribute_gather_detail_name AS Product_status, 
                      Goods.Retail_unit_price, Goods.Quality_content, Agreement.Contract_number, Attribute_gather_detail_4.Attribute_gather_detail_name AS Use_target, Enterprise_name.Chinese, 
                      Goods_rademark.Goods_rademark_name, Attribute_gather_detail_6.Attribute_gather_detail_name AS Quality_grade, Goods.Goods_colours, 
                      Attribute_gather_detail_7.Attribute_gather_detail_name AS Quality_guarantee_period, Goods.Input_ratio, Goods.Purchase_bid * (CAST(Goods.Input_ratio AS decimal(18, 5)) / 100 + 1) AS InputTax, 
                      SUM(Stock.Stock_quantity) AS Stock_quantity
FROM         Goods INNER JOIN
                      Stock ON Goods.Goods_id = Stock.Goods_id INNER JOIN
                      Repertory_place ON Stock.Repertory_place_id = Repertory_place.Repertory_place_id INNER JOIN
                      Attribute_gather_detail ON Goods.Goods_tab_pubid = Attribute_gather_detail.Attribute_gather_detail_id INNER JOIN
                      Manufacturer ON Goods.Manufacturer_id = Manufacturer.Manufacturer_id INNER JOIN
                      Goods_producing_area ON Goods.Producing_area_id = Goods_producing_area.Producing_area_id INNER JOIN
                      Attribute_gather_detail AS Attribute_gather_detail_1 ON Goods.Unit_of_measurement_pubid = Attribute_gather_detail_1.Attribute_gather_detail_id INNER JOIN
                      Attribute_gather_detail AS Attribute_gather_detail_2 ON Goods.Goods_classify_pubid = Attribute_gather_detail_2.Attribute_gather_detail_id INNER JOIN
                      Attribute_gather_detail AS Attribute_gather_detail_3 ON Goods.Product_status_pubid = Attribute_gather_detail_3.Attribute_gather_detail_id INNER JOIN
                      Agreement ON Goods.Agreement_id = Agreement.Agreement_id INNER JOIN
                      Attribute_gather_detail AS Attribute_gather_detail_4 ON Goods.Use_target_pubid = Attribute_gather_detail_4.Attribute_gather_detail_id INNER JOIN
                      Supply_units ON Agreement.Supply_units_id = Supply_units.Supply_units_id INNER JOIN
                      Enterprise_name ON Supply_units.Enterprise_name_id = Enterprise_name.Enterprise_name_id INNER JOIN
                      Goods_rademark ON Goods.Goods_rademark_id = Goods_rademark.Goods_rademark_id INNER JOIN
                      Attribute_gather_detail AS Attribute_gather_detail_6 ON Goods.Quality_grade_pubid = Attribute_gather_detail_6.Attribute_gather_detail_id INNER JOIN
                      Attribute_gather_detail AS Attribute_gather_detail_5 ON Goods.Quality_grade_pubid = Attribute_gather_detail_5.Attribute_gather_detail_id INNER JOIN
                      Attribute_gather_detail AS Attribute_gather_detail_7 ON Goods.Quality_guarantee_period_pubid = Attribute_gather_detail_7.Attribute_gather_detail_id
WHERE     (Repertory_place.Repertory_place_id = @Repertory_place_id) AND (Stock.Goods_id = @Goods_id)
GROUP BY Goods.Goods_id, Goods.Goods_code, Goods.Goods_bar_code, Goods.Goods_name, Goods.Goods_abbreviation, Goods.Plncode_PLN, Attribute_gather_detail.Attribute_gather_detail_name, 
                      Goods.Goods_tab_pubid, Manufacturer.Manufacturer_name, Goods_producing_area.Producing_area_name, Goods.Art_No, Goods.Format_model, 
                      Attribute_gather_detail_1.Attribute_gather_detail_id, Attribute_gather_detail_1.Attribute_gather_detail_name, Attribute_gather_detail_2.Attribute_gather_detail_name, Goods.Product_status_pubid, 
                      Attribute_gather_detail_3.Attribute_gather_detail_name, Goods.Mini_fix_goods_deny, Goods.Purchase_bid, Goods.Retail_unit_price, Goods.Quality_content, Agreement.Contract_number, 
                      Attribute_gather_detail_4.Attribute_gather_detail_name, Enterprise_name.Chinese, Goods_rademark.Goods_rademark_name, Attribute_gather_detail_6.Attribute_gather_detail_name, 
                      Goods.Goods_colours, Attribute_gather_detail_7.Attribute_gather_detail_name, Goods.Input_ratio, Goods.Purchase_bid * (CAST(Goods.Input_ratio AS decimal(18, 5)) / 100 + 1)
                      end
if(@NB='GetGoodsByBlur')		--模糊查询原库存地点的商品
begin
SELECT     Goods.Goods_id, Goods.Goods_code, Goods.Goods_bar_code, Goods.Vender_bar_code_deny, Goods.Goods_name, Goods.Goods_abbreviation, Goods.Plncode_PLN, Goods.Copy_record_deny, 
                      Attribute_gather_detail.Attribute_gather_detail_name AS Goods_tab, Goods.Goods_tab_pubid, Manufacturer.Manufacturer_name, Goods_producing_area.Producing_area_name, Goods.Art_No, 
                      Goods.Format_model, Attribute_gather_detail_1.Attribute_gather_detail_id, Attribute_gather_detail_1.Attribute_gather_detail_name AS Unit_of_measurement, 
                      Attribute_gather_detail_2.Attribute_gather_detail_name AS Goods_classify, Goods.Product_status_pubid, Attribute_gather_detail_3.Attribute_gather_detail_name AS Product_status, 
                      Goods.Self_fix_goods_deny, Goods.Mini_fix_goods_deny, Goods.Purchase_bid, Goods.Retail_unit_price, Goods.Quality_content, Agreement.Contract_number, 
                      Attribute_gather_detail_4.Attribute_gather_detail_name AS Use_target, Goods.Goods_colours, Enterprise_name.Chinese, Goods_rademark.Goods_rademark_name, 
                      Attribute_gather_detail_6.Attribute_gather_detail_name AS Quality_grade
FROM         Goods INNER JOIN
                      Stock ON Goods.Goods_id = Stock.Goods_id INNER JOIN
                      Repertory_place ON Stock.Repertory_place_id = Repertory_place.Repertory_place_id INNER JOIN
                      Attribute_gather_detail ON Goods.Goods_tab_pubid = Attribute_gather_detail.Attribute_gather_detail_id INNER JOIN
                      Manufacturer ON Goods.Manufacturer_id = Manufacturer.Manufacturer_id INNER JOIN
                      Goods_producing_area ON Goods.Producing_area_id = Goods_producing_area.Producing_area_id INNER JOIN
                      Attribute_gather_detail AS Attribute_gather_detail_1 ON Goods.Unit_of_measurement_pubid = Attribute_gather_detail_1.Attribute_gather_detail_id INNER JOIN
                      Attribute_gather_detail AS Attribute_gather_detail_2 ON Goods.Goods_classify_pubid = Attribute_gather_detail_2.Attribute_gather_detail_id INNER JOIN
                      Attribute_gather_detail AS Attribute_gather_detail_3 ON Goods.Product_status_pubid = Attribute_gather_detail_3.Attribute_gather_detail_id INNER JOIN
                      Agreement ON Goods.Agreement_id = Agreement.Agreement_id INNER JOIN
                      Attribute_gather_detail AS Attribute_gather_detail_4 ON Goods.Use_target_pubid = Attribute_gather_detail_4.Attribute_gather_detail_id INNER JOIN
                      Supply_units ON Agreement.Supply_units_id = Supply_units.Supply_units_id INNER JOIN
                      Enterprise_name ON Supply_units.Enterprise_name_id = Enterprise_name.Enterprise_name_id INNER JOIN
                      Goods_rademark ON Goods.Goods_rademark_id = Goods_rademark.Goods_rademark_id INNER JOIN
                      Attribute_gather_detail AS Attribute_gather_detail_6 ON Goods.Quality_grade_pubid = Attribute_gather_detail_6.Attribute_gather_detail_id INNER JOIN
                      Attribute_gather_detail AS Attribute_gather_detail_5 ON Goods.Quality_grade_pubid = Attribute_gather_detail_5.Attribute_gather_detail_id

WHERE     (Repertory_place.Repertory_place_id = @Repertory_place_id) and (Goods.Goods_name like '%'+RTRIM(@strBlur)+'%'
              or Goods.Goods_code like+'%'+RTRIM(@strBlur)+'%' or Goods.Goods_bar_code like '%'+RTRIM(@strBlur)+'%')
end
if(@NB='GetGoodsAll')		--查询原库存地点所有商品
begin
SELECT     Goods.Goods_id, Goods.Goods_code, Goods.Goods_bar_code, Goods.Goods_name, Goods.Goods_abbreviation, Goods.Plncode_PLN,
                      Attribute_gather_detail.Attribute_gather_detail_name AS Goods_tab, Goods.Goods_tab_pubid, Manufacturer.Manufacturer_name, Goods_producing_area.Producing_area_name, Goods.Art_No, 
                      Goods.Format_model, Attribute_gather_detail_1.Attribute_gather_detail_id, Attribute_gather_detail_1.Attribute_gather_detail_name AS Unit_of_measurement, 
                      Attribute_gather_detail_2.Attribute_gather_detail_name AS Goods_classify, Goods.Product_status_pubid, Attribute_gather_detail_3.Attribute_gather_detail_name AS Product_status, 
                       Goods.Purchase_bid, Goods.Retail_unit_price, Goods.Quality_content, Agreement.Contract_number, 
                      Attribute_gather_detail_4.Attribute_gather_detail_name AS Use_target, Goods.Goods_colours, Enterprise_name.Chinese, Goods_rademark.Goods_rademark_name, 
                      Attribute_gather_detail_6.Attribute_gather_detail_name AS Quality_grade
FROM         Goods INNER JOIN
                      Stock ON Goods.Goods_id = Stock.Goods_id INNER JOIN
                      Repertory_place ON Stock.Repertory_place_id = Repertory_place.Repertory_place_id INNER JOIN
                      Attribute_gather_detail ON Goods.Goods_tab_pubid = Attribute_gather_detail.Attribute_gather_detail_id INNER JOIN
                      Manufacturer ON Goods.Manufacturer_id = Manufacturer.Manufacturer_id INNER JOIN
                      Goods_producing_area ON Goods.Producing_area_id = Goods_producing_area.Producing_area_id INNER JOIN
                      Attribute_gather_detail AS Attribute_gather_detail_1 ON Goods.Unit_of_measurement_pubid = Attribute_gather_detail_1.Attribute_gather_detail_id INNER JOIN
                      Attribute_gather_detail AS Attribute_gather_detail_2 ON Goods.Goods_classify_pubid = Attribute_gather_detail_2.Attribute_gather_detail_id INNER JOIN
                      Attribute_gather_detail AS Attribute_gather_detail_3 ON Goods.Product_status_pubid = Attribute_gather_detail_3.Attribute_gather_detail_id INNER JOIN
                      Agreement ON Goods.Agreement_id = Agreement.Agreement_id INNER JOIN
                      Attribute_gather_detail AS Attribute_gather_detail_4 ON Goods.Use_target_pubid = Attribute_gather_detail_4.Attribute_gather_detail_id INNER JOIN
                      Supply_units ON Agreement.Supply_units_id = Supply_units.Supply_units_id INNER JOIN
                      Enterprise_name ON Supply_units.Enterprise_name_id = Enterprise_name.Enterprise_name_id INNER JOIN
                      Goods_rademark ON Goods.Goods_rademark_id = Goods_rademark.Goods_rademark_id INNER JOIN
                      Attribute_gather_detail AS Attribute_gather_detail_6 ON Goods.Quality_grade_pubid = Attribute_gather_detail_6.Attribute_gather_detail_id INNER JOIN
                      Attribute_gather_detail AS Attribute_gather_detail_5 ON Goods.Quality_grade_pubid = Attribute_gather_detail_5.Attribute_gather_detail_id
WHERE     (Repertory_place.Repertory_place_id = @Repertory_place_id)
GROUP BY Goods.Goods_id, Goods.Goods_code, Goods.Goods_bar_code, Goods.Goods_name, Goods.Goods_abbreviation, Goods.Plncode_PLN, Attribute_gather_detail.Attribute_gather_detail_name, 
                      Goods.Goods_tab_pubid, Manufacturer.Manufacturer_name, Goods_producing_area.Producing_area_name, Goods.Art_No, Goods.Format_model, 
                      Attribute_gather_detail_1.Attribute_gather_detail_id, Attribute_gather_detail_1.Attribute_gather_detail_name, Attribute_gather_detail_2.Attribute_gather_detail_name, Goods.Product_status_pubid, 
                      Attribute_gather_detail_3.Attribute_gather_detail_name, Goods.Mini_fix_goods_deny, Goods.Purchase_bid, Goods.Retail_unit_price, Goods.Quality_content, Agreement.Contract_number, 
                      Attribute_gather_detail_4.Attribute_gather_detail_name, Goods.Goods_colours, Enterprise_name.Chinese, Goods_rademark.Goods_rademark_name, 
                      Attribute_gather_detail_6.Attribute_gather_detail_name
end
if(@NB='GetEmployeeName')		--根据员工ID查询员工名称
begin
SELECT     rtrim(Employee_name)+'【'+rtrim(Employee_number)+'】' as Employee_name
FROM         Eemployee
where Employee_id=@Employee_id
end
if(@NB='GetRepertoryPlaceName')		--根据仓库ID查询仓库名称
begin
SELECT     rtrim(Repertory_place_name)+'【'+rtrim(Repertory_place_identifier)+'】' as Repertory_place_name
FROM         Repertory_place
where Repertory_place_id=@Repertory_place_id
end
if(@NB='GetEmployee')		--根据仓库地点查询仓库管理员
begin
SELECT     Eemployee.Employee_id, Eemployee.Employee_name
FROM         Eemployee INNER JOIN
                      Repertory_place ON Eemployee.Employee_id = Repertory_place.Responsible_person_id
 where Repertory_place_id=@Repertory_place_id                     
end
if(@NB='GetRepertoryPlace')		--获取库存地点
begin
SELECT     Repertory_place_id, Repertory_place_name
FROM         Repertory_place
where Department_id=@Department_id
end
if(@NB='AllDepartmentSelect')		--查询全部部门信息
begin
SELECT     Department_id , Department_Farid , Department_name, Department_code
FROM         Department
end
END

3.2、主要用到的表:

转库表,转库明细表,商品表,部门表,库存地点表,库存表:

 

表名

说明

类型

表编号

Goods_change_repository

转库表

业务表

 表1

Goods_change_repository_detail

转库明细表

业务表

表2

Repertory_place

库存地点表

基础表

表3

Stock

库存表

基础表

表4

Goods

商品表

基础表

表5

Department

部门表

基础表

表6


列名

数据类型

主键/外键

说明

Goods_change_repository_id

Int

主键

 

Change_department_id

Int

外键

‘部门表’,转库部门

Raw_repertory_place_id

Int

外键

‘库存地点表’,发货点

New_repertory_place_id

Int

外键

‘库存地点表’,收货点

Shipper_id

int

外键

‘员工表’,发货人

Receiver_id

Int

外键

‘员工表’,收货人

Registrant_id

int

外键

‘员工表’,制单人

Auditor_id

Int

外键

‘员工表’,审核人

Register_time

Datetime

 

制单时间

Review_time

Datetime

 

审核时间

Record_number

Nchar(16)

 

记录编号

Remarks

Nchar(30)

 

备注

Review_deny

Bit

 

审核否

ClrEtyReper_deny

Bit

 

清空零库存否

表1、

列名

数据类型

主键/外键

说明

Goods_change_repository_detail_id

Int

主键

 

Goods_change_repository_id

Int

外键

‘转库表’,调拨id

Goods_id

Int

外键

‘商品表’,商品

Change_number

Nchar

 

转库数量

StockId

Int

外键

‘库存表’,转库库存量

表2、

列名

数据类型

主键/外键

说明

Repertory_place_id

Int

主键

 

Responsible_person_id

Int

外键

‘员工表’,仓管员

Department_id

Int

外键

‘部门表’,部门id

Repertory_place_name

nchar(10)

 

仓库名称

Contact_way

nchar(10)

 

联系方式

Address

nchar(10)

 

仓库地点

Effective_deny

Bit

 

有效否

Remarks

nchar(10)

 

备注

Repertory_place_identifier

nchar(10)

 

仓库代码

表3、

列名

数据类型

主键/外键

说明

Stock_id

Int

主键

 

Repertory_place_id

Int

外键

‘库存地点表’,库存地点

Goods_id

Int

 

‘商品表’,商品

Stock_quantity

Int

 

库存数量

Stock_toplimit

Int

 

库存上限

Stock_floor

Int

 

库存下限

Repertory_enter_detail_id

Int

外键

‘进仓明细表’,进仓明细

表4、

列名

数据类型

主键/外键

说明

Goods_id

Int

主键

 

Goods_code

nchar(10)

 

商品代码

Goods_bar_code

nchar(10)

 

条码

Vender_bar_code_deny

Bit

 

厂家条码否

Goods_name

nchar(10)

 

商品名称

Goods_abbreviation

int

外键

商品简称

Plncode_PLN

nchar(10)

 

PLN 码

Copy_record_deny

Bit

 

复制记录否

Goods_tab_pubid

Int

外键

‘属性明细表’,商品标记

Agreement_id

Int

外键

‘合同表’,合同

Manufacturer_id

Int

外键

‘商品厂家’,生产厂家

Producing_area_id

Int

外键

‘产地表’,产地

Art_No

nchar(10)

 

货号

Format_model

nchar(10)

 

规格型号

Unit_of_measurement_pubid

Int

外键

‘属性明细’,计量单位

Use_target_pubid

Int

外键

‘属性明细’,使用对象

Goods_colours

nchar(10)

 

商品花色

Goods_rademark_id

Int

外键

‘商品商标表’,商品商标

Goods_classify_pubid

Int

外键

‘属性明细’,商品分类

Quality_guarantee_period_pubid

Int

外键

‘属性明细’,保质期

Input_ratio

decimal(18, 0)

 

进项税率

Output_ratio

decimal(18, 0)

 

销项税率

Count_scale

nchar(10)

 

统计比例

Quality_content

Int

 

质地含量

Quality_grade_pubid

Int

外键

质量等级

Manage_season_id

Int

外键

‘经营季节表’,经营季节

Permit_decimal_deny

Bit

 

允许小数否

Product_status_pubid

Int

外键

‘属性明细’,产品状态

Registrant_id

Int

外键

‘员工表’,登记人

Register_time

Datetime

 

登记时间

Auditor_id

Int

外键

‘员工表’,审核人

Review_time

Datetime

 

审核时间

Update_person_id

Int

外键

‘员工表‘,更新人

Update_Time

Datetime

 

更新时间

Retail_unit_price

Nchar(10)

 

零售单价

Purchase_bid

nchar(10)

 

采购进价

Self_fix_goods_deny

bit

 

自订货否

Mini_fix_goods_deny

nchar(10)

 

最小订货否

表5、

列名

数据类型

主键/外键

说明

Department_id

Int

主键

 

Department_Farid

Int

外键

‘部门表’,部门id

Department_code

nchar(10)

 

部门代码

Department_name

nchar(10)

 

部门名称

表6



初学者的分享,仅供学习,禁止用于商业用途。



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值