MVC大型商贸系统(库存管理)技术解释(六)商品返仓
2015-06-13 21:23
337 查看
MVC大型商贸系统(库存管理)技术解释(六)商品返仓
1、 界面设计:1.1、商品返仓处理
1.2、商品返仓查询
2、 代码:
2.1、商品返仓HTML代码:
<!DOCTYPE html> <html> <head> <meta content="text/javascript;charset=utf-8" /> <title>DealWithReturnRepertory</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/DealWithReturnRepertory.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/DealWithReturnRepertory.js"></script> </head> <body onload="AddRunningDiv();" style="text-align: center"> <div style="display: none"> <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"> <table style="width: 390px; border: none; padding: 0; border-spacing: 0; color: #cccccc"> <tr> <td style="vertical-align: middle">请输入要查询的编号: <input type="text" id="txtRecord_number" style="width: 90px; border-left: none; margin-left: 0" onkeyup="selectRepertoryByBlur(this.value)" /></td> </tr> </table> <div class="easyui-panel" style="width: 390px; height: 180px; border: none"> <table class="easyui-datagrid" id="tbJiLuBianHao" style="width: 340px; border: none; border-spacing: 0;" data-options="fit:true,fitColumns:true,idField:'Return_repertory_id', onDblClickRow:onDblBanHaoRow,singleSelect:true,rownumbers:true,striped:true"> <thead> <tr> <th data-options="field:'Record_number',width:110,align:'center'">记录编号</th> <th data-options="field:'Delivery_department',width:80,align:'center'">发货部门</th> <th data-options="field:'Take_delivery_department',width:80,align:'center'">收货部门</th> <th data-options="field:'Remarks',width:60,align:'center'">备注</th> <th data-options="field:'Delivery_department_id',hidden:true"></th> <th data-options="field:'Take_delivery_department_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:'Shipper',hidden:true"></th> <th data-options="field:'Receiver',hidden:true"></th> <th data-options="field:'Make_bills_id',hidden:true"></th> <th data-options="field:'Make_bills_time1',hidden:true"></th> <th data-options="field:'Executor_id',hidden:true"></th> <th data-options="field:'Execute_time1',hidden:true"></th> <th data-options="field:'Remarks',hidden:true"></th> </tr> </thead> </table> </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="width: 686px; height: 327px;"> <table id="tbGoodsAll" class="easyui-datagrid" style="width: 3360px;" data-options="rownumbers:true, striped:true,idField:'Goods_id',fit:true,fitColumns:false, frozenColumns:[[{field:'check',checkbox:true}]],striped: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:'Vender_bar_code_deny',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:'Copy_record_deny',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_guarantee_period',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:'Count_scale',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:'Manage_season_name',width:80,align:'center'">经营季节</th> <th data-options="field:'Permit_decimal_deny',width:80,align:'center'">允许销售否</th> <th data-options="field:'Product_status',width:80,align:'center'">产品状态</th> <th data-options="field:'Registrant',width:80,align:'center'">登记人</th> <th data-options="field:'Register_time1',width:80,align:'center'">登记时间</th> <th data-options="field:'Review',width:80,align:'center'">审核人</th> <th data-options="field:'Review_time1',width:80,align:'center'">审核时间</th> <th data-options="field:'Update_person',width:80,align:'center'">更新人</th> <th data-options="field:'Update_Time1',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 class="tbga" style="width: 100%; font-size: 16px;"> 请输入商品名称/代码/条码查找:<input onkeyup="blurSelect($('#moHiuChaXun').val())" type="text" id="moHiuChaXun" style="width: 150px; height: 15px;" /> <button onclick="$('#tbGoodsAll').datagrid('checkAll')">全选</button> <button onclick="$('#tbGoodsAll').datagrid('uncheckAll')">全不选</button> <button onclick="getChangPin();">添加</button> </div> </div> <div class="easyui-window" id="wShipper" style="width: 383px; height: 200px; top: 60px; left: 420px;" data-options="closed:true,maximizable:false,minimizable:false,modal:true"> <table class="easyui-datagrid" id="tbShipper" data-options="idField:'Employee_id',fit:true,singleSelect:true,onDblClickRow:onDblClicktbShipper"> <thead> <tr> <th data-options="field:'Employee_number',width:80,align:'center'">编号</th> <th data-options="field:'Employee_name',width:70,align:'center'">姓名</th> <th data-options="field:'Sex',width:50,align:'center'">性别</th> <th data-options="field:'Department_name',width:80,align:'center'">所属部门</th> <th data-options="field:'Duties_name',width:80,align:'center'">所任职务</th> </tr> </thead> </table> </div> <div class="easyui-window" id="wReceiver" style="width: 383px; height: 200px; top: 60px; left: 420px;" data-options="closed:true,maximizable:false,minimizable:false,modal:true"> <table class="easyui-datagrid" id="tbReceiver" data-options="idField:'Employee_id',fit:true,singleSelect:true,onDblClickRow:onDblClicktbReceiver"> <thead> <tr> <th data-options="field:'Employee_number',width:80,align:'center'">编号</th> <th data-options="field:'Employee_name',width:70,align:'center'">姓名</th> <th data-options="field:'Sex',width:50,align:'center'">性别</th> <th data-options="field:'Department_name',width:80,align:'center'">所属部门</th> <th data-options="field:'Duties_name',width:80,align:'center'">所任职务</th> </tr> </thead> </table> </div> <div class="easyui-window" id="wdiaoBo" title="" style="display: none; text-align: center; border-spacing: 0; padding: 0; border: 0 solid white" 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 onclick="parent.rturn();" id="dimg" src="../../Content/image/delete.png" /></span>返仓单处理 </div> <div class="easyui-panel" style="margin-left: 1px; margin-right: 1px; height: 25px; border: none; width: 846px; text-align: center;"> <button class="button1" id="btnJiLuBianHao" onclick="openwRecord_number();" style="width: 100px;">记录编号</button><input type="text" id="Record_number" readonly="readonly" style="width: 120px; color: red; text-align: center; background-color: #e6e6fa" /> <button class="button1" id="btnShipper" onclick="fcOpenwShipper(); " style="width: 100px;">实物付货人</button><input id="txtShiFuHuoRenMC" readonly="readonly" type="text" style="width: 120px; text-align: center; color: #000080; background-color: #e6e6fa" /> <button class="button1" id="btnShouHuoRen" onclick="fcopenwReceiver(); " style="width: 100px;">实物收货人</button><input id="txtShiShouHuoRenMC" readonly="readonly" type="text" style="width: 120px; text-align: center; color: #000080; background-color: #e6e6fa" /> </div> <table style="height: 60px; border-spacing: 4px; border: none"> <tr class="need"> <td id="faHuoBuMenC">发货部门:<input id="cbo_ConsignmentDepartmentCode" class="easyui-combotree" style="width: 200px;" data-options="required:true,missingMessage:'请选择发货部门!',onChange:onChangeConDepar" /> </td> <td> <div style="border-bottom: #000 1px solid; width: 500px;"> <input id="txtConsignmentDepartmentName" readonly="readonly" style="width: 500px; border: none; color: #0000FF; font-size: 16px;" /> </div> </td> </tr> <tr class="need"> <td id="shouHouBuMenC">收货部门:<input id="cboReceivingDepartmentCode" class="easyui-combobox" style="width: 200px;" data-options="required:true,missingMessage:'请选择收货部门!',onChange:onClickRece" /></td> <td> <div class="need" style="border-bottom: #000 1px solid; width: 500px;"> <input id="txtReceivingDepartmentName" readonly="readonly" style="width: 500px; border: none; color: #0000FF; font-size: 16px;" /> </div> </td> </tr> </table> <div class="easyui-panel" style="width: 853px; margin-left: 1px; margin-right: 1px; height: 24px; border: none"> <button class="button1" id="piLiangSuanZheShangPin" onclick="openwAllGoods();">批量选择商品</button> <button class="button1" onclick="$('#wBatch').window('open');" style="margin: 0 148px 0 250px;">商品配货批次</button> 备注:<input id="txtBeiZhu" type="text" style="width: 190px;" /> </div> <div class="easyui-panel" style="width: 853px; height: 350px; 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,onClickRow:ontbClick, fit:true,frozenColumns:[[ {field:'ShanChu',width:40,title:'删除',align:'center',formatter:deleteSelect} ]],striped:true"> <thead> <tr> <th data-options="field:'Return_repertory_detail_id',hidden:true"></th> <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:'Repertory_enter_packages',editor:{type:'numberbox'},width:75,align:'center'">发货件数</th> <th data-options="field:'Repertory_place_send_id',align:'center',width:100, formatter:function(value,row){ return row.Repertory_place_send; }, editor:{ type:'combobox', options:{ valueField:'Repertory_place_send_id', textField:'Repertory_place_send', panelHeight:130 }}">发货库存地点</th> <th data-options="field:'Repertory_place_harvest_id',align:'center',width:100, formatter:function(value,row){ return row.Repertory_place_harvest; }, editor:{ type:'combobox', options:{ valueField: 'Repertory_place_harvest_id', textField: 'Repertory_place_harvest', panelHeight:130 }}">收货库存地点</th> <th data-options="field:'Shipments_quantity',width:80,align:'center',editor:{type:'numberbox',options:{disabled:true}}">发货细数</th> <th data-options="field:'InputTax',width:100,align:'center',editor:{type:'numberbox',options:{prefix:'¥',precision:2,disabled:true}}">含税进价(¥)</th> <th data-options="field:'Quality_content',width:80 ,align:'center'">包装含量</th> <th data-options="field:'Purchase_bid',width:100,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:'Copy_record_deny',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:'Output_ratio',width:80,align:'center'">销项税率</th> <th data-options="field:'Count_scale',width:80,align:'center'">统计比例</th> <th data-options="field:'Quality_grade',width:80,align:'center'">质量等级</th> <th data-options="field:'Manage_season_name',width:80,align:'center'">经营季节</th> <th data-options="field:'Permit_decimal_deny',width:90,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:'Return_repertory_id',hidden:true"></th>*@ </tr> </thead> </table> </div> <table style="text-align: center; width: 750px; height: 60px; border: 0 solid white"> <tr> <td style="width: 155px; text-align: right;" id="txtMake_bills">制单人: </td> <td style="width: 125px; text-align: left;"> <div class="need" style="border-bottom: #f5f5f5 1px solid; width: 150px;"> <input id="cboMakeBills" class="easyui-combobox" data-options="valueField:'Id',textField:'Name',required:true,panelHeight:120,missingMessage:'请选择制单人!',onChange:selMb1" style="width: 150px; border: 1px; color: #0000FF" /> </div> </td> <td style="width: 90px; text-align: right" id="txtTransactor_id">执行人: </td> <td style="width: 165px; text-align: left;"> <div class="need" style="border-bottom: #f5f5f5 1px solid; width: 150px;"> <input class="easyui-combobox" id="cboTransactor" data-options="valueField:'Id',textField:'Name',required:true,panelHeight:120,missingMessage:'请选择执行人!',onChange:selTs1" style="width: 150px; color: #0000FF" /> </div> </td> </tr> <tr> <td style="width: 155px; text-align: right;" id="txtMake_bills_time">制单时间: </td> <td> <div class="need" style="border-bottom: #f5f5f5 1px solid; width: 150px;"> <input class="easyui-datetimebox" id="dtmMakeBills" data-options="formatter:myformatter,required:true,missingMessage:'请选择制单时间!'" style="width: 150px; height: 20px; border: none; color: #0000FF" /> </div> </td> <td style="text-align: right;" id="txtExecute_time">执行时间: </td> <td> <div class="need" style="border-bottom: #f5f5f5 1px solid; width: 150px;"> <input class="easyui-datetimebox" id="dtmExecute" 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="btnAddNew" onclick="AddNew(); "> <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" onclick="update();"> <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" onclick="deleteData();"> <img src="../../Content/image/Delete.png" /> 删除</button> </div> </td> <td> <div style="width: 85px; height: 25px; text-align: center; vertical-align: middle"> <button id="BaoCun" onclick="checkBeForeSave();"> <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" onclick="refreshAfterDelete();"> <img src="../../Content/image/Command-Refresh.png" /> 刷新</button> </div> </td> <td> <div style="width: 85px; height: 25px; text-align: center; vertical-align: middle"> <button id="ShenHe" onclick="reviewReturnRepertory()"> <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" onclick="nowTime();"> <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" onclick="parent.rturn();"> <img src="../../Content/image/Out.png" /> 退出</button> </div> </td> </tr> </table> </div> </div> </div> </body> </html>
2.2、商品返仓JavaScript代码:
<pre name="code" class="javascript">$(document).ready(function () { $("#wdiaoBo").show(500); //显示返仓窗体 createRecordNumber(); BingDingDepart(); }); //收货部门的onChange事件 function onClickRece(id) { $.getJSON("/ReturnRepertory/GetDepartNames?intFar=" + id, function (data) { $('#txtReceivingDepartmentName').val(data); }); } //绑定发货部门下拉树 function BingDingDepart() { $("#cbo_ConsignmentDepartmentCode").combotree({ url: "/ReturnRepertory/GetAllDepartmentMessages" });//绑定发货部门下拉树 } //datagrid的onClick事件(tbSelectGoods) function ontbClick(rowIndex) { endEditing();//执行方法将datagrid里面的下拉框分文本值赋给datagrid上的文本框 if (editIndex != rowIndex) {//如果上次点击的索引与今次的索引不同,把现在点中的行打开编辑,把上次点中的行结束编辑。 $('#tbSelectGoods').datagrid('beginEdit', rowIndex);//打开当前行的编辑 $('#tbSelectGoods').datagrid('endEdit', editIndex);//结束当前行的编辑 editIndex = rowIndex;//执行完后将当前的编辑行赋给上一次编辑行。 getConsignmentDepartment(rowIndex);//调用方法绑定datagrid中的发货部门下拉框。 getReceivingDepartment(rowIndex);//调用方法绑定datagrid中的收货部门下拉框。 endEditing2(rowIndex);//执行计算细数方法 } else {//如果前后点击事件的索引一样,则先将行结束编辑,再开始编辑。 $('#tbSelectGoods').datagrid('endEdit', rowIndex); $('#tbSelectGoods').datagrid('beginEdit', rowIndex); getConsignmentDepartment(rowIndex); getReceivingDepartment(rowIndex); endEditing2(rowIndex); } } //生成记录编号 function createRecordNumber() { $.getJSON("/ReturnRepertory/AddNewReturnRepertory", function (data) {//执行记录编号生成方法 $("#Record_number").val(data.trim());//将生成的记录编号去掉空格后显示在记录编号文本框 }); } //发货部门的onChange事件 function onChangeConDepar(id) { $.getJSON("/ReturnRepertory/GetDepartNames?intFar=" + id, function (data1) { $('#txtConsignmentDepartmentName').val(data1);//显示部门名称 });//根据部门id绑定部门名称 $('#cboReceivingDepartmentCode').combobox({//根据发货部门id绑定收部门(同级) url: "/ReturnRepertory/GetReceivingDepartmentByFarId?intFar=" + id, valueField: 'Department_id', textField: 'Department_name' }); if (TakeDeliveryDepartmentId > 0) {//如果发货部门的id不为空,则给发货部门赋值。 $('#cboReceivingDepartmentCode').combobox('setValue', TakeDeliveryDepartmentId); } $("#cboMakeBills").combobox('reload', '/ReturnRepertory/GetMakeBills?intDepartmentId=' + id);//绑定制单人下拉框 $("#cboTransactor").combobox('reload', '/ReturnRepertory/GetMakeBills?intDepartmentId=' + id);//绑定执行人下拉框 } //进度框 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 }); } //根据发货部门绑定datagrid中的 combobox function getConsignmentDepartment(rowIndex) { if ($('#cbo_ConsignmentDepartmentCode').combobox('getValue') > 0) {//如果发货部门已赋值 var target = $('#tbSelectGoods').datagrid('getEditor', { index: rowIndex, field: 'Repertory_place_send_id' }).target;//获取相应行的发货部门目标 var url = '/ReturnRepertory/SelectRepertoryPlaceSend?departmentId=' + $('#cbo_ConsignmentDepartmentCode').combobox('getValue');//拼接重加载下拉框的路径 target.combobox('reload', url);//重新加载下拉框 } } //根据收货部门绑定datagrid中的combobox function getReceivingDepartment(rowIndex) { if ($('#cboReceivingDepartmentCode').combobox('getValue') > 0) {//如果收货部门已赋值 var target = $('#tbSelectGoods').datagrid('getEditor', { 'index': rowIndex, 'field': 'Repertory_place_harvest_id' }).target;//获取相应的收货部门目标 var url = '/ReturnRepertory/SelectRepertoryPlaceHarvest?departmentId=' + $('#cboReceivingDepartmentCode').combobox('getValue');//拼接重加载下拉框的路径 target.combobox('reload', url);//重新加载下拉框 } } //结束编辑 var editIndex = undefined; function endEditing() { if (editIndex == undefined) {//如果是第一次编辑 return true;//返回true } else if ($("#tbSelectGoods").datagrid("validateRow", editIndex)) {//验证行是否存在, try {//尝试执行 var sendId = $('#tbSelectGoods').datagrid('getEditor', { index: editIndex, field: 'Repertory_place_send_id' }).target;//获取付货部门库存地点 var receiveId = $('#tbSelectGoods').datagrid('getEditor', { index: editIndex, field: 'Repertory_place_harvest_id' }).target;//获取收货部门库存地点 $('#tbSelectGoods').datagrid('getRows')[editIndex]['Repertory_place_send'] = $(sendId).combobox('getText');//获取部门发货部门的文本值,赋给datagrid $('#tbSelectGoods').datagrid('getRows')[editIndex]['Repertory_place_harvest'] = $(receiveId).combobox('getText'); return true; } catch (e) { return true; } } else { return true;//如果不存在,返回true } } function endEditing2(rowIndex) { var editors = $('#tbSelectGoods').datagrid('getEditors', rowIndex);//获取一行中所有编辑器,索引为rowIndex var row = $('#tbSelectGoods').datagrid('selectRow', rowIndex).datagrid('getSelected', rowIndex);//选中rowIndex行,并选中。 var piece = editors[0].target;//选中第一个目标 var content = parseFloat(row.Quality_content);//将‘质地含量’转换成浮点类型 piece.bind('change', function () {//绑定一个‘change’事件 $(editors[3].target).numberbox('setValue', (content * piece.val()));//将计算出来的数赋给目标编辑器 }); } //生成删除列,删除列 function deleteSelect(index, data) { return "<img class='myimg' onclick='deletess(" + data.Goods_id + ");' src='../../Content/image/delete.png' />";//给删除列赋一张图片,并设置onclick事件 } //删除行 function deletess(id) { $('#tbSelectGoods').datagrid('deleteRow', $('#tbSelectGoods').datagrid('getRowIndex', id)); } //添加商品 function getChangPin() { var goods = $("#tbGoodsAll").datagrid("getChecked");//获取所有选中的行 for (var i = 0; i < goods.length; i++) { $.getJSON("/ReturnRepertory/TransformTotbSelectGoods?goodsId=" + goods[i].Goods_id, function (data) {//获取返回的一行数据 <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> if (row.Repertory_enter_packages == '' || row.Repertory_enter_packages == undefined || row.Repertory_place_send_id == '' || row.Repertory_place_send_id == undefined || row.Repertory_place_harvest_id == '' || row.Repertory_place_harvest_id == undefined) {</span></div> $("#tbSelectGoods").datagrid("appendRow", {//给datagrid追加行 Goods_id: data[0]['Goods_id'],//商品id Goods_code: data[0]['Goods_code'],//商品代码 Goods_name: data[0]['Goods_name'],//商品名称 Goods_bar_code: data[0]['Goods_bar_code'], Vender_bar_code_deny: data[0]['Vender_bar_code_deny'], Art_No: data[0]['Art_No'], Goods_abbreviation: data[0]['Goods_abbreviation'], Quality_content: data[0]['Quality_content'], Retail_unit_price: data[0]['Retail_unit_price'], Format_model: data[0]['Format_model'], Plncode_PLN: data[0]['Plncode_PLN'], Goods_tab: data[0]['Goods_tab'], Copy_record_deny: data[0]['Copy_record_deny'], Contract_number: data[0]['Contract_number'], Manufacturer_name: data[0]['Manufacturer_name'], Producing_area_name: data[0]['Producing_area_name'], Unit_of_measurement: data[0]['Unit_of_measurement'], Use_target: data[0]['Use_target'], Goods_colours: data[0]['Goods_colours'], Chinese: data[0]['Chinese'], Goods_classify: data[0]['Goods_classify'], Quality_guarantee_period: data[0]['Quality_guarantee_period'], Input_ratio: data[0]['Input_ratio'], Output_ratio: data[0]['Output_ratio'], Count_scale: data[0]['Count_scale'], Quality_grade: data[0]['Quality_grade'], Manage_season_name: data[0]['Manage_season_name'], Permit_decimal_deny: data[0]['Permit_decimal_deny'], Product_status: data[0]['Product_status'], Registrant: data[0]['Registrant'], Register_time: data[0]['Register_time1'], Review: data[0]['Review'], Review_time: data[0]['Review_time1'], Update_person: data[0]['Update_person'], Update_Time: data[0]['Update_Time1'], Purchase_bid: data[0]['Purchase_bid'], Self_fix_goods_deny: data[0]['Self_fix_goods_deny'], Mini_fix_goods_deny: data[0]['Mini_fix_goods_deny'], InputTax: data[0]['InputTax'] }); }); } $("#tbGoodsAll").datagrid('clearChecked');//清空所有checkbox $("#wAllGoods").window("close");//关闭商品选择窗体 } //模糊查询商品信息 function blurSelect(strBlurMessage) { $("#tbGoodsAll").datagrid({ url: "/ReturnRepertory/BlurSelectGoods?strBlurMessage=" + strBlurMessage }); } //打开批量选择窗体 function openwAllGoods() { var values = $('#tbSelectGoods').datagrid('getRows');//获取所有行 var str = [];//实例化数组 for (var j = 0; j < values.length; j++) {//遍历datagrid数组 str.push(values[j].Goods_id);//获取每行的商品id,插入数组内 } $('#tbGoodsAll').datagrid({ url: "/ReturnRepertory/GoodsAllSelect?strarry=" + str });//将数组传过控件器加载未添加的商品 $('#wAllGoods').window('open'); } //选择实物收货人 var ReceiverId = 0; function onDblClicktbReceiver(rowindex, rowData) { ReceiverId = rowData.Employee_id; $("#txtShiShouHuoRenMC").val(rowData.Employee_name.trim());//获取实付货人名称 $('#wReceiver').window('close'); } //打开实物收货人选择窗体 function fcopenwReceiver() { parent.document.getElementById("labTips").innerHTML = "";//清空“提示信息” var id = $("#cboReceivingDepartmentCode").combotree("getValue");//获取收货部门的id if (id != "") {//判断是否有值 var titles = $('#cboReceivingDepartmentCode').combotree('getText').trim() + "人员";//获取部门名称,拼接“人员”,用于新窗体的标题 $('#tbReceiver').datagrid({ url: '/ReturnRepertory/DepartmentStaffSelectbyDepartmentId?intDepartment=' + id });//根据部门id查询员工 $('#wReceiver').window({ title: titles }).window('open');//设置窗体的标题并打开 } else { parent.document.getElementById("labTips").innerHTML = "<ol type='1'><li style='font-size:15px;margin-left:1px;'> 请选择收货部门!</li></ol>";//给主窗体设置值 } } //选择实物付货人 var ShipperId = 0; function onDblClicktbShipper(rowindex, rowData) { ShipperId = rowData.Employee_id; $("#txtShiFuHuoRenMC").val(rowData.Employee_name.trim());//获取付货人名称 $('#wShipper').window('close'); } //打开实物付货人选择窗体 function fcOpenwShipper() { parent.document.getElementById("labTips").innerHTML = ""; var id = $("#cbo_ConsignmentDepartmentCode").combotree("getValue");//同收货人 if (id != "") {//同收货人 var titles = $('#cbo_ConsignmentDepartmentCode').combotree('getText').trim() + "人员";//同收货人 $('#tbShipper').datagrid({ url: '/ReturnRepertory/DepartmentStaffSelectbyDepartmentId?intDepartment=' + id });//同收货人 $('#wShipper').window({ title: titles }).window('open');//同收货人 } else { parent.document.getElementById("labTips").innerHTML = "<ol type='1'><li style='font-size:15px;margin-left:1px;'> 请选择发货部门!</li></ol>";//同收货人 } } //创建返仓单号 var n = null; function AddNew() { n = 0; if (ReturnRepertoryId > 0) {//如果返仓id存在 refreshAfterDelete();//先删除所有控件数据 createRecordNumber();//生成返仓单 } else { createRecordNumber();//否则直接生成返仓单 } } //日期格式化 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); } //行样式 function rowStyler(index, row) { return "background-color:#e6e6fa;color:#191970;";//设置单元格的背景颜色和字体颜色 } return "background-color:while;color:black;";//设置单元格的背景颜色和字体颜色 } //检漏 function checkLost() { var tem = true; <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> Producing_area_name: data['Producing_area_name'],</span></div> parent.document.getElementById("labTips").innerHTML = ""; if ($('#Record_number').val() == "" || $('#cbo_ConsignmentDepartmentCode').combotree('getValue') == "" || $('#txtShiFuHuoRenMC').val() == "" || $('#cboReceivingDepartmentCode').combobox('getValue') == "" || $('#dtmMakeBills').datetimebox('getValue') == "" || $('#txtShiShouHuoRenMC').val() == "" || $('#dtmExecute').datetimebox('getValue') == "" || $("#cboMakeBills").combobox("getValue") == "" || $("#cboTransactor").combobox("getValue") == "") {//如果其中的一项必选项为空执行 if ($('#Record_number').val() == '') { $('#Record_number').css('border-color', 'red');//设置文本框的边框为红色 } else { $('#Record_number').css('border-color', '#c0c0c0');//设置文本框的边框为灰 } if ($('#txtShiFuHuoRenMC').val() == '') { $('#txtShiFuHuoRenMC').css('border-color', 'red'); } else { $('#txtShiFuHuoRenMC').css('border-color', '#c0c0c0'); } if ($('#txtShiShouHuoRenMC').val() == '') { $('#txtShiShouHuoRenMC').css('border-color', 'red'); } else { $('#txtShiShouHuoRenMC').css('border-color', '#c0c0c0'); } $(".need input").mouseover();//设置鼠标经过事件 tem = false; } else if ($('#tbSelectGoods').datagrid('getRows').length > 0) {//判断datagrid是否已有数据 var rows = $('#tbSelectGoods').datagrid('getRows');//获取datagrid中的数据 var tips = ""; var count = 0; for (var i = 0; i < rows.length; i++) {//遍历datagrid的每行 $("#tbSelectGoods").datagrid("endEdit", $("#tbSelectGoods").datagrid("getRowIndex", rows[i])); if (rows[i].Repertory_place_send_id != "" && rows[i].Repertory_place_harvest_id != "" && !isNaN(rows[i].Shipments_quantity) && rows[i].Shipments_quantity != "") {//判断单元格中的值是否为数字或空 count++; } else { tips += "<li style='font-size:15px;margin-left:1px;'>商品【" + rows[i].Goods_name + "】数据不完整</li>";//拼接动态的列表 tem = false; } } if (count != rows.length) { parent.document.getElementById("labTips").innerHTML = "<ol type='1'>" + tips + "</ol>";//设置‘提示新息’的内容 tem = false; } } else { tem = false; parent.document.getElementById("labTips").innerHTML = ""; parent.document.getElementById("labTips").innerHTML = "<ol type='1'><li style='font-size:15px;margin-left:1px;'> 未选择要调整的商品!</li></ol>"; } return tem; } //打开商品批次窗体 function openwShangPinPiCi() { return false; } //删除返仓单 function deleteData() { if (ReturnRepertoryId > 0) { ui.confirm('确定删除该条数据?', function (r) {//提示是否删除数据 if (r) { $.getJSON("/ReturnRepertory/DeleteReturnRepertory?intReturnRepertoryId=" + ReturnRepertoryId, function (data1) { if (data1 > 0) { refreshAfterDelete();//删除后清空所有控件的数据 ui.success('删除成功!', 1000); } }); } }); } else { openwRecord_number();//生成新的记录编号 } } //打开记录编号窗体 function openwRecord_number() { $("#tbJiLuBianHao").datagrid({ url: '/ReturnRepertory/SelectAllRepertorys' });//绑定返仓单 $("#wRecord_number").window('open'); } //模糊查询返仓单 function selectRepertoryByBlur(value) { $("#tbJiLuBianHao").datagrid({ url: "/ReturnRepertory/SelectRepertorysByBur?strBur=" + value }); } //双击返仓单 绑定返仓信息 var TakeDeliveryDepartmentId = 0;//实例化收货部门id参数 var ReturnRepertoryId = 0;//实例化返仓id function onDblBanHaoRow(rowIndex, rowData) { refreshAfterDelete();//清空所有控件数据 ReturnRepertoryId = rowData.Return_repertory_id;//将返仓id赋给全局变量 ShipperId = rowData.Shipper_id;//将付货人id赋给全局变量 ReceiverId = rowData.receiverId;//收货人id TakeDeliveryDepartmentId = rowData.Take_delivery_department_id;//收货部门id $("#Record_number").val(rowData.Record_number);//记录编号 $("#cbo_ConsignmentDepartmentCode").combotree("setValue", rowData.Delivery_department_id);//发货部门 $("#txtShiFuHuoRenMC").val(rowData.Shipper.trim());//发货人 $("#txtShiShouHuoRenMC").val(rowData.Receiver.trim());//收货人 $("#cboMakeBills").combobox('setValue', rowData.Make_bills_id);//制单人 $("#cboTransactor").combobox("setValue", rowData.Executor_id);//执行人 $("#dtmMakeBills").datetimebox('setValue', rowData.Make_bills_time1);//制单时间 $("#dtmExecute").datetimebox('setValue', rowData.Execute_time1);//执行时间 $("#txtBeiZhu").val(rowData.Remarks);//备注 bindingReturnRepertoryDetailByreturnRepertoryId(rowData.Return_repertory_id);//调用方法绑定返仓明细 $("#wRecord_number").window('close');//关闭记录编号窗体 } //根据返仓id查询返仓明细 function bindingReturnRepertoryDetailByreturnRepertoryId(returnRepertoryId) { $.getJSON("/ReturnRepertory/BindingReturnRepertoryDetail?intReturnRepertoryId=" + returnRepertoryId, function (values) { $.each(values, function (index, data) {//遍历每一行 $('#tbSelectGoods').datagrid('appendRow', {//向datagrid加数据 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'], <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> }</span></div> 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'], Registrant: data['Registrant'], Register_time: data['DengJiTime1'], Review: data['Review'], Review_time: data['ShenHeTime1'], Update_person: data['Update_person'], Update_Time: data['GengXinTime1'], Purchase_bid: '¥' + data['Purchase_bid'], Self_fix_goods_deny: data['Self_fix_goods_deny'], Mini_fix_goods_deny: data['Mini_fix_goods_deny'], Repertory_enter_packages: data['Repertory_enter_packages'], Shipments_quantity: data['Delivery_amount'], Repertory_place_send_id: data['Delivery_repertory_place_id'], Repertory_place_harvest_id: data['Take_delivery_repertory_place_id'], Repertory_place_send: data['Delivery_repertory_place'], Repertory_place_harvest: data['Take_delivery_repertory_place'], InputTax: '¥' + data['InputTax'], Goods_Tab: data['Goods_Tab'], Return_repertory_detail_id: data['Return_repertory_detail_id'] }); }); $('#tbSelectGoods').datagrid('acceptChanges');//接受改变的行 }); } //删除 后的刷新 function refreshAfterDelete() { ReceiverId = 0;//收货人id ShipperId = 0;//发货人id ReturnRepertoryId = 0;//返仓单id TakeDeliveryDepartmentId = 0;//收货部门id $("#tbSelectGoods").datagrid("loadData", { total: 0, rows: [] });//清空datagrid $("#Record_number").val("");//清空记录编号 $("#txtShiFuHuoRenMC").val("");//实付货人 $("#txtShiShouHuoRenMC").val("");//实收货人 $("#txtBeiZhu").val("");//备注 $("#cbo_ConsignmentDepartmentCode").combotree('clear');//清空发货部门下拉树 $("#cboReceivingDepartmentCode").combobox('clear');//收货下拉框 $("#txtConsignmentDepartmentName").val("");//发货人名称 $("#txtReceivingDepartmentName").val("");//收货人名称 $("#cboMakeBills").combobox("clear");//制单人 $("#cboTransactor").combobox("clear");//执行人 $("#dtmMakeBills").datetimebox("clear");//制单时间 $("#dtmExecute").datetimebox("clear");//执行时间 } //保存 function checkBeForeSave() { if (checkLost()) {//检查数据是否都完整 if (ReturnRepertoryId > 0) {//如果返仓id存在 ui.confirm('确定修改?', function (r) { if (r) { updateReturnRepertory();//执行修改返仓单方法 } }); } else { ui.confirm('确定新增?', function (r) { if (r) { SaveReturnRepertory();//执行保存返仓单 } }); } } else { ui.alert("数据不完整!", 1000, false); } } //新增返仓单 function SaveReturnRepertory() { var number = $("#Record_number").val();//获取记录编号 $.getJSON("/ReturnRepertory/SaveReturnRepertory?strRecordNumber=" + $("#Record_number").val() + "&intShipperId=" + ShipperId + "&intReceiverId=" + ReceiverId + "&intSend=" + $("#cbo_ConsignmentDepartmentCode").combotree("getValue") + "&intReceive=" + $("#cboReceivingDepartmentCode").combobox("getValue") + "&strRemark=" + $("#txtBeiZhu").val() + "&intMakeBills=" + $("#cboMakeBills").combobox("getValue") + "&intTransactor=" + $("#cboTransactor").combobox("getValue") + "&dtmExecute=" + $("#dtmExecute").datetimebox("getValue") + "&dtmMakeBills=" + $("#dtmMakeBills").datetimebox("getValue"), function (data) {//新增控件上的数据 var returnRepertoryId = data; var rows = $("#tbSelectGoods").datagrid("getRows"); for (var i = 0; i < rows.length; i++) {//新增datagrid中的数据 $.getJSON("/ReturnRepertory/SaveReturnRepertoryDetail?intReturnRepertoryId=" + returnRepertoryId, "&intGoodsId=" + rows[i].Goods_id + "&dcmShipmentsQuantity=" + rows[i].Shipments_quantity + "&intRepertoryPlaceSendId=" + rows[i].Repertory_place_send_id + "&intRepertoryPlaceHarvestId=" + rows[i].Repertory_place_harvest_id, function () { }); } if (data > 0) { ui.success('新增成功!', 1000); parent.document.getElementById("labTips").innerHTML = "<ol type='1'><li style='font-size:15px;margin-left:1px;'><font style='color:red;font-size:15px'>【" + number.trim() + "】</font><br/>修改成功!</li></ol>"; refreshAfterDelete(); $.getJSON("/ReturnRepertory/AddNewReturnRepertory", function (data1) { $("#Record_number").val(data1.trim()); }); } }); } //修改返仓单 function updateReturnRepertory() { var delrow = $('#tbSelectGoods').datagrid('getChanges', 'deleted');//获取删除的数据 var insertrow = $('#tbSelectGoods').datagrid('getChanges', 'inserted');//获取新增的数据 var updaterow = $('#tbSelectGoods').datagrid('getChanges', 'updated');//获取修改的数据 var count = 0; if (delrow.length > 0) { for (var k = 0; k < delrow.length; k++) { $.getJSON("/ReturnRepertory/DeleteReturnRepertoryDetail1?intRepertoryDetailId=" + delrow[k].Return_repertory_detail_id);//遍历删除要删除的datagrid中的行 count++; } if (insertrow.length > 0) { <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;">}</span></div> for (var j = 0; j < insertrow.length; j++) { $.getJSON("/ReturnRepertory/SaveReturnRepertoryDetail?intReturnRepertoryId=" + ReturnRepertoryId +//新增行 "&intGoodsId=" + insertrow[j].Goods_id + "&dcmShipmentsQuantity=" + insertrow[j].Shipments_quantity + "&intRepertoryPlaceSendId=" + insertrow[j].Repertory_place_send_id + "&intRepertoryPlaceHarvestId=" + insertrow[j].Repertory_place_harvest_id, function () { }); count++; } } if (updaterow.length > 0) { for (var i = 0; i < updaterow.length; i++) { $.getJSON("/ReturnRepertory/UpdateReturnRepertoryDetail?intRepertoryDetailId=" + updaterow[i].Return_repertory_detail_id +//修改行 "&dcmShipmentsQuantity=" + updaterow[i].Shipments_quantity + "&intRepertoryPlaceSendId=" + updaterow[i].Repertory_place_send_id + "&intRepertoryPlaceHarvestId=" + updaterow[i].Repertory_place_harvest_id, function () { }); count++; } } var number = $("#Record_number").val();//获取记录编号的数据 $.getJSON("/ReturnRepertory/UpdateReturnRepertory?intReturnRepertoryId=" + ReturnRepertoryId + "&strRecordNumber=" + $("#Record_number").val() + "&intShipperId=" + ShipperId + "&intReceiverId=" + ReceiverId + "&intSend=" + $("#cbo_ConsignmentDepartmentCode").combotree("getValue") + "&intReceive=" + $("#cboReceivingDepartmentCode").combobox("getValue") + "&strRemark=" + $("#txtBeiZhu").val() + "&intMakeBills=" + $("#cboMakeBills").combobox("getValue") + "&intTransactor=" + $("#cboTransactor").combobox("getValue") + "&dtmExecute=" + $("#dtmExecute").datetimebox("getValue") + "&dtmMakeBills=" + $("#dtmMakeBills").datetimebox("getValue"), function (data) {//修改控件的数据 if (data > 0) { var returnRepertoryId2 = ReturnRepertoryId; refreshAfterDelete();//清空控件数据 ui.success('修改成功!', 1000);//提示修改成功 reloadReturnRepertory(returnRepertoryId2);//重新加载数据 parent.document.getElementById("labTips").innerHTML = "<ol type='1'><li style='font-size:15px;margin-left:1px;'>【<font style='color:red;font-size:15px'>" + number.trim() + "</font>】<br/>修改成功!</li></ol>"; } }); } //重新加载修改后的数据 function reloadReturnRepertory(returnRepertoryId) { $.getJSON("/ReturnRepertory/ReloadReturnRepertory?intReturnRepertoryId=" + returnRepertoryId, function (data) { ReturnRepertoryId = data[0].Return_repertory_id; ShipperId = data[0].Shipper_id; ReceiverId = data[0].receiverId; TakeDeliveryDepartmentId = data[0].Take_delivery_department_id; $("#Record_number").val(data[0].Record_number); $("#cbo_ConsignmentDepartmentCode").combotree("setValue", data[0].Delivery_department_id); $("#txtShiFuHuoRenMC").val(data[0].Shipper.trim()); $("#txtShiShouHuoRenMC").val(data[0].Receiver.trim()); $("#cboMakeBills").combobox('setValue', data[0].Make_bills_id); $("#cboTransactor").combobox("setValue", data[0].Executor_id); $("#dtmMakeBills").datetimebox('setValue', data[0].Make_bills_time1); $("#dtmExecute").datetimebox('setValue', data[0].Execute_time1); $("#txtBeiZhu").val(data[0].Remarks); bindingReturnRepertoryDetailByreturnRepertoryId(data[0].Return_repertory_id); }); } //点击修改按钮 function update() { if (ReturnRepertoryId == 0) {//如果数据还没绑定就绑定 $("#tbJiLuBianHao").datagrid({ url: '/ReturnRepertory/SelectAllRepertorys' }); $("#wRecord_number").window('open'); } } //审核返仓单 function reviewReturnRepertory() { $.getJSON("/ReturnRepertory/ReviewReturnRepertory?intReturnId=" + ReturnRepertoryId, function (data) { if (data != "") { var tips = ""; var datas = data.split('《'); for (var i = 0; i < datas.length - 1; i++) { tips += "<li style='font-size:15px;margin-left:1px;'>" + datas[i] + "</li>"; } ui.error('审核失败!<br/>详情请看【 相关提示】!', 2000, false); parent.document.getElementById("labTips").innerHTML = "<ol type='1'>" + tips + "</ol>"; } else { ui.success('审核成功!', 2000, false); } }); } var k = 0; //onSelect制单人 function selMb1() { if (n == 1) { if (k > 0) { $("#dtmMakeBills").datetimebox("setValue", getDateTime()); } else { k++; } } else { $("#dtmMakeBills").datetimebox("setValue", getDateTime()); } } var j = 0; //onSelect执行人 function selTs1() { if (n == 1) { if (j > 0) { $("#dtmExecute").datetimebox("setValue", getDateTime()); } else { j++; } } else { $("#dtmExecute").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); <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> return time;</span></div>
2.3、商品返仓查询HTML代码:
<div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"><!DOCTYPE html></span></div><html> <head> <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> <meta content="text/javascript;charset=utf-8" /></span></div> <title>SelectReturnRepertory</title> <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> <link href="../../Content/yxsss/js_css/yu.css" rel="stylesheet" /></span></div> <script src="../../Content/yxsss/js_css/yu.js"></script> <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> <link href="../../Content/jquery-easyui-1.3.3/demo/demo.css" rel="stylesheet" /></span></div> <link href="../../Content/jquery-easyui-1.3.3/themes/icon.css" rel="stylesheet" /> <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> <link href="../../Content/MyCSS/SelectAllot.css" rel="stylesheet" /></span></div> <link href="../../Content/jquery-easyui-1.3.3/themes/default/easyui.css" rel="stylesheet" /> <script src="../../Content/jquery-easyui-1.3.3/jquery.min.js"></script> <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> <script src="../../Scripts/MyScript/SelectReturnRepertory.js"></script></span></div> <script src="../../Content/jquery-easyui-1.3.3/jquery.easyui.min.js"></script> <script src="../../Content/jquery-easyui-1.3.3/easyloader.js"></script> </head> <body onload="AddRunningDiv();" style="text-align: center"> <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> <div class="easyui-window" id="wBuMenTiaoZheng" title="" style="display: none; text-align: center; border-spacing: 0; padding: 0; border: none; overflow: hidden;" data-options="fit:true,collapsible:false,minimizable:false,</span></div> <div style="display: none"> maximizable:false,closable:false,draggable:false,resizable:false,shadow:false,modal:true,center:true"> <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> <img onclick="parent.rturn();" id="dimg" src="../../Content/image/delete.png" /></span>查询返仓单</span></div> <div style="padding: 0; background: #e0ffff; color: #4169e1; font-size: 20px; text-align: center; margin: 0 0 auto;"> <span style="float: right"> </div> <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> <table class="table1" style="border: none; margin: 0 0 0 0; padding: 0; width: 850px;"></span></div> <fieldset style="border: 1px #4169e1 solid; height: 60px; margin: 0 0 0 0; text-align: left; padding-left: 10px; overflow: hidden"> <legend style="text-align: left; color: SlateBlue">不定项查询条件</legend> <tr> <td>记录编号:</td> <td> <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> <input class="easyui-combobox" id="cboReceivingDepartment" /></td></span></div> <input type="text" id="txtRecordNumber" /> </td> <td>发货部门:</td> <td> <input class="easyui-combotree" id="cobConsignmentDepartment" /></td> <td>收货部门:</td> <td> </tr> <tr> <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> <td>备 注:</td></span></div> <td>开始时间: </td> <td> <input class="easyui-datebox" id="dtmStart" /> </td> <td>结束时间:</td> <td> <input class="easyui-datebox" id="dtmEnd" /> </td> <td> <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> 查询</span></div> <input type="text" id="txtRemarks" /></td> </tr> </table> </fieldset> <div class="div1" style="width: 250px; height: 30px; float: left; text-align: left; border: 1px solid #c0c0c0; border-style: none none solid none;"> 审核否<input type="checkbox" id="check" /> <button onclick="dynamicSelect();"> </button> <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> <li>发货部门:<input type="text" id="lstCDepartment" style="border-style: none none solid none; text-align: center" readonly="readonly" /></span></div> <button onclick="refresh()"> 刷新 </button> <div class="li1" style="width: 250px; height: 486px; text-align: left; overflow: hidden;"> <ul> <li>记录编号:<input type="text" id="lstRecordNumber" style="border-style: none none solid none; text-align: center" readonly="readonly" /> </li> </li> <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> <li>收 货 人:<input type="text" id="lstReceiver" style="border-style: none none solid none; text-align: center" readonly="readonly" /></span></div> <li>发 货 人:<input type="text" id="lstShipper" style="border-style: none none solid none; text-align: center" readonly="readonly" /> </li> <li>收货部门:<input type="text" id="lstRDepartment" style="border-style: none none solid none; text-align: center" readonly="readonly" /> </li> </li> <li>制 单 人:<input type="text" id="lstMake_bills" style="border-style: none none solid none; text-align: center" readonly="readonly" /> </li> <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> <li>备 注:<input type="text" id="lstRemarks" style="border-style: none none solid none; text-align: center" readonly="readonly" /></span></div> <li>制单时间<input type="text" id="lstMake_billsTime" style="border-style: none none solid none; text-align: center" readonly="readonly" /> </li> <li>执 行 人:<input type="text" id="lstExecutor" style="border-style: none none solid none; text-align: center" readonly="readonly" /> </li> <li>执行时间:<input type="text" id="lstExecutorTime" style="border-style: none none solid none; text-align: center" readonly="readonly" /> </li> </li> </ul> </div> </div> <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> <th data-options="field:'Remarks',width:220,align:'center'">备注</th></span></div> <div style="margin: 0 0 0 252px; height: 200px; border-left: 1px solid #c0c0c0"> <table title="返仓单" id="tbRepertory" class="easyui-datagrid" style="height: 200px;" data-options="rownumbers:true,fit:true,singleSelect:true,idField:'Return_repertory_id', onClickRow:onRepertoryClick"> <thead> <tr> <th data-options="field:'Record_number',width:110,align:'center'">记录编号</th> <th data-options="field:'Delivery_department',width:110,align:'center'">发货部门</th> <th data-options="field:'Take_delivery_department',width:110,align:'center'">收货部门</th> </tr> <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> <th data-options="field:'Goods_code',width:80,align:'center'">商品代码</th></span></div> </thead> </table> </div> <div style="margin: 0 0 0 252px; height: 284px; border-left: 1px solid #c0c0c0"> <table title="返仓单明细" id="tbRepertoryDetails" class="easyui-datagrid" style="height: 285px; width: auto;" data-options="rownumbers:true,fit:true,singleSelect:true,idField:'Return_repertory_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:'Delivery_amount',width:75,align:'center'">发货细数</th> <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> <th data-options="field:'Retail_unit_price',width:80,align:'center'">零售单价</th></span></div> <th data-options="field:'Repertory_enter_packages',width:75,align:'center'">发货件数</th> <th data-options="field:'Delivery_repertory_place',align:'center',width:100">发货库存地点</th> <th data-options="field:'Take_delivery_repertory_place',align:'center',width:100">收货库存地点</th> <th data-options="field:'InputTax',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> <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> <th data-options="field:'Unit_of_measurement',width:80,align:'center'">计量单位</th></span></div> <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:'Copy_record_deny',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> <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> <th data-options="field:'Quality_grade',width:80,align:'center'">质量等级</th></span></div> <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:'Input_ratio',width:80,align:'center'">进项税率</th> <th data-options="field:'Output_ratio',width:80,align:'center'">销项税率</th> <th data-options="field:'Count_scale',width:80,align:'center'">统计比例</th> <th data-options="field:'Manage_season_name',width:80,align:'center'">经营季节</th> <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"></html></span></div> <th data-options="field:'Permit_decimal_deny',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:'Allot_detail_id',hidden:true"></th> </tr> </thead> </table> </div> </div> </div> <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"></body></span></div>
2.4、商品返仓查询JavaScript代码:
<div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;">$(document).ready(function () {</span></div><div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> $("#wBuMenTiaoZheng").hide();</span></div><div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> $("#wBuMenTiaoZheng").fadeIn(500);</span></div><div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> $("#cobConsignmentDepartment").combotree({</span></div><div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> url: '/ReturnRepertory/GetAllDepartmentMessages',</span></div> onSelect: function (data) { <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> $.getJSON("/ReturnRepertory/GetSameRankDepartment?intDepartmentId=" + data.id, function (value) {</span></div> $("#cboReceivingDepartment").combobox({ data: value, valueField: 'Department_id', textField: 'Department_name' }); <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> $("<div class=\"datagrid-mask\"></div>").css({ display: "block", width: "100%", height: $(document).height() }).appendTo("body");</span></div> }); } }); setTimeout("dynamicSelect();", 100); }); function AddRunningDiv() { <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> $("<div class=\"datagrid-mask-msg\"></div>").html("正在加载,请稍候...").appendTo("body").css({ display: "block", left: ($(document.body).outerWidth(true) - 190) / 2, top: ($(document).height() - 45) / 2 });</span></div>} //不定条件查询返仓单 function dynamicSelect() { $.getJSON("/ReturnRepertory/DynamicSelect?" + "strRecordNumber=" + $("#txtRecordNumber").val() + "&intCDepartmentId=" + $("#cobConsignmentDepartment").combotree("getValue") + "&intRDepartmentId=" + $("#cboReceivingDepartment").combobox("getValue") + <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;">function onRepertoryClick(value, data) {</span></div> "&dtmStart=" + $("#dtmStart").datebox("getValue") + "&dtmEnd=" + $("#dtmEnd").datebox("getValue") + "&strRemarks=" + $("#txtRemarks").val() + "&bolReviewDeny=" + $("#check").prop("checked"), function (data) { $("#tbRepertory").datagrid("loadData", data); }); } <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> $("#lstRDepartment").val(data1[0].Take_delivery_department.trim());</span></div> $.getJSON("/ReturnRepertory/GetRepertoryByRepertoryId?intReturnRepertoryId=" + data.Return_repertory_id, function (data1) { $("#lstRecordNumber").val(data1[0].Record_number.trim()); $("#lstCDepartment").val(data1[0].Delivery_department.trim()); $("#lstShipper").val(data1[0].Shipper.trim()); $("#lstReceiver").val(data1[0].Receiver.trim()); $("#lstMake_bills").val(data1[0].Make_bills.trim()); <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> $("#txtRecordNumber").val("");</span></div> $("#lstMake_billsTime").val(data1[0].Make_bills_time.trim()); $("#lstExecutor").val(data1[0].Executor.trim()); $("#lstExecutorTime").val(data1[0].Execute_time.trim()); $("#lstRemarks").val(data1[0].Remarks.trim()); }); $("#tbRepertoryDetails").datagrid({ url: "/ReturnRepertory/GetRepertoryDetailByRepertoryId?intReturnRepertoryId=" + data.Return_repertory_id }); } function refresh() { $("#cobConsignmentDepartment").combotree("clear"); <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> $("#tbRepertory").datagrid("loadData", { total: 0, rows: [] });</span></div> $("#cboReceivingDepartment").combobox("clear"); $("#dtmStart").datebox("clear"); $("#dtmEnd").datebox("clear"); $("#txtRemarks").val(""); $("#lstRecordNumber").val(""); $("#lstCDepartment").val(""); $("#lstShipper").val(""); $("#lstRDepartment").val(""); $("#lstReceiver").val(""); $("#lstMake_bills").val(""); $("#lstMake_billsTime").val(""); $("#lstExecutor").val(""); $("#lstExecutorTime").val(""); $("#lstRemarks").val(""); <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;">}</span></div><div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> $("#tbRepertoryDetails").datagrid("loadData", { total: 0, rows: [] });</span></div>
2.5、商品返仓Csharp-Controller代码:
<div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;">using System;</span></div><div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;">using System.Collections.Generic;</span></div>using System.Data; <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;">using System.Web.Mvc;</span></div>using System.Text; <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;">namespace 大型商贸系统.Controllers</span></div>using BLL_KuCunGuangLi; { <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> public class ReturnRepertoryController : Controller</span></div> { // // GET: /ReturnRepertory/ <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> #region 返仓处理</span></div> readonly ReturnRepertory _myReturnRepertory = new ReturnRepertory(); #region 跳转到返仓处理 <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> #region 审核返仓单</span></div> public ActionResult DealWithReturnRepertory() { return View(); } #endregion <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> var stockIds = new List<int>();//实例化int泛型对象</span></div> public ActionResult ReviewReturnRepertory(int intReturnId) { StringBuilder msg = new StringBuilder();//实例化StringBuilder对象 <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> try</span></div> var shipmentsQuantitys = new List<decimal>();//实例化decimal泛型对象 DataTable srpDetails = _myReturnRepertory.GetRepertoryDetailsToReview(intReturnId);//查询返仓明细单 { <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> string goodName = srpDetails.Rows[i]["Goods_name"].ToString();//获取商品名称</span></div> for (int i = 0; i < srpDetails.Rows.Count; i++)//遍历明细表 { int goodsId = Convert.ToInt32(srpDetails.Rows[i]["Goods_id"]);//获取商品id <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> DataTable sStock = _myReturnRepertory.SelectStock(goodsId, repertoryPlaceId);//根据商品id,和库存地点id查询库存记录</span></div> int repertoryPlaceId = Convert.ToInt32(srpDetails.Rows[i]["Delivery_repertory_place_id"]);//获取库存地点id decimal shipmentsQuantity = Convert.ToDecimal(srpDetails.Rows[i]["Delivery_amount"]);//获取配货数量 if (sStock.Rows.Count > 0) <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> {</span></div> { decimal stockQuantity = Convert.ToDecimal(sStock.Rows[0]["Stock_quantity"]);//获取库存数量 int stockId = Convert.ToInt32(sStock.Rows[0]["Stock_id"]);//获取库存id if (stockQuantity > shipmentsQuantity)//判断库存数是否大于要配货数 <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> "</font>】库存数为【<font style='color:blue';font-size:15px; >" + stockQuantity +</span></div> stockIds.Add(stockId); shipmentsQuantitys.Add(shipmentsQuantity); } else { msg.Append("商品【<font style='color:blue';font-size:15px; >" + goodName + <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> }</span></div> "</font>】,要出库数为【<font style='color:blue';font-size:15px; >" + shipmentsQuantity + "</font>】缺库存数为【<font style='color:red';font-size:15px; >" + (shipmentsQuantity - stockQuantity) + "</font>】《");//如果库存不足,构建详细提示 } else { <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> {</span></div> msg.Append("商品【<font style='color:red;font-size:15px;' >" + goodName + "</font>】没有库存记录!《"); } } } catch (Exception) { msg.Append("该返仓单没有返仓明细数据!《"); } if (msg.ToString() != "") { msg.Append("审核失败,原因如下:《" + msg); } else int[] sk = stockIds.ToArray();//将泛型转换成数组 <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> public ActionResult ReloadReturnRepertory(int intReturnRepertoryId)</span></div> decimal[] sq = shipmentsQuantitys.ToArray(); for (int i = 0; i < sk.Length; i++) { _myReturnRepertory.UpdateStock(sk[i], sq[i]);//修改库存记录 } _myReturnRepertory.UpdateReturnRepertoryToTure(intReturnId);//修改返仓单审核状态 } return Json(msg.ToString(), JsonRequestBehavior.AllowGet); } #endregion #region 修改后的重新加载 { <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> int intReceive,</span></div> DataTable dt = _myReturnRepertory.ReloadReturnRepertory(intReturnRepertoryId);//根据返仓id查询返仓明细 List<Dictionary<string, object>> list = ConvertHelperController.DtToList(dt); return Json(list, JsonRequestBehavior.AllowGet); } #endregion #region 修改返仓单 public ActionResult UpdateReturnRepertory( int intReturnRepertoryId, string strRecordNumber, int intShipperId, int intReceiverId, int intSend, string strRemark, <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> return Json(i, JsonRequestBehavior.AllowGet);</span></div> int intMakeBills, int intTransactor, DateTime dtmExecute, DateTime dtmMakeBills ) { int i = _myReturnRepertory.UpdateReturnRepertory( intReturnRepertoryId, strRecordNumber, intShipperId, intReceiverId, intSend, intReceive, strRemark, intMakeBills, intTransactor, dtmExecute, dtmMakeBills ); } <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> return Json(list, JsonRequestBehavior.AllowGet);</span></div> #endregion #region 删除返仓单 public ActionResult DeleteReturnRepertory(int intReturnRepertoryId) { int i = _myReturnRepertory.DeleteReturnRepertory(intReturnRepertoryId); return Json(i, JsonRequestBehavior.AllowGet); } #endregion #region 绑定返仓相关数据 public ActionResult SelectAllRepertorys() { DataTable dt = _myReturnRepertory.SelectAllRepertorys(); List<Dictionary<string, object>> list = ConvertHelperController.DtToList(dt); } <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> List<Dictionary<string, object>> list = ConvertHelperController.DtToList(dt);</span></div> public ActionResult SelectRepertorysByBur(string strBur) { DataTable dt = _myReturnRepertory.SelectRepertorysByBur(strBur); List<Dictionary<string, object>> list = ConvertHelperController.DtToList(dt); return Json(list, JsonRequestBehavior.AllowGet); } public ActionResult BindingReturnRepertoryDetail(int intReturnRepertoryId) { DataTable dt = _myReturnRepertory.BindingReturnRepertoryDetail(intReturnRepertoryId); return Json(list, JsonRequestBehavior.AllowGet); } #endregion #region 新增保存/修改明细 <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> return Json(id, JsonRequestBehavior.AllowGet);</span></div> //保存返仓单 public ActionResult SaveReturnRepertory(string strRecordNumber, int intShipperId, int intReceiverId, int intSend, int intReceive, string strRemark, int intMakeBills, int intTransactor, DateTime dtmExecute, DateTime dtmMakeBills) { DataTable dt = _myReturnRepertory.SaveReturnRepertory(strRecordNumber, intShipperId, intReceiverId, intSend, intReceive, strRemark, intMakeBills, intTransactor, dtmExecute, dtmMakeBills); int id = Convert.ToInt32(dt.Rows[0][0]); } //保存返仓单明细 <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> _myReturnRepertory.UpdateReturnRepertoryDetail(intRepertoryDetailId, dcmShipmentsQuantity,</span></div> public void SaveReturnRepertoryDetail(int intReturnRepertoryId , int intGoodsId, int dcmShipmentsQuantity, int intRepertoryPlaceSendId, int intRepertoryPlaceHarvestId) { _myReturnRepertory.SaveReturnRepertoryDetail(intReturnRepertoryId, intGoodsId, dcmShipmentsQuantity, intRepertoryPlaceSendId, intRepertoryPlaceHarvestId); } //修改返仓明细 public void UpdateReturnRepertoryDetail(int intRepertoryDetailId, int dcmShipmentsQuantity, int intRepertoryPlaceSendId, int intRepertoryPlaceHarvestId) { intRepertoryPlaceSendId, intRepertoryPlaceHarvestId); } <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> public ActionResult SelectRepertoryPlaceHarvest(int departmentId)</span></div> //删除返仓明细 public void DeleteReturnRepertoryDetail1(int intRepertoryDetailId) { _myReturnRepertory.DeleteReturnRepertoryDetail1(intRepertoryDetailId); } #endregion #region 根据部门id获取员工 public ActionResult GetMakeBills(int intDepartmentId) { DataTable dt = _myReturnRepertory.GetMakeBills(intDepartmentId); List<Dictionary<string, object>> list = ConvertHelperController.DtToList(dt); return Json(list, JsonRequestBehavior.AllowGet); } #endregion #region 根据收货部门查询发货库存地点 { <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> public ActionResult TransformTotbSelectGoods(int goodsId)</span></div> DataTable dt = _myReturnRepertory.SelectRepertoryPlaceHarvest(departmentId); List<Dictionary<string, object>> list = ConvertHelperController.DtToList(dt); return Json(list, JsonRequestBehavior.AllowGet); } #endregion #region 根据发货部门查询发货库存地点 public ActionResult SelectRepertoryPlaceSend(int departmentId) { DataTable dt = _myReturnRepertory.SelectRepertoryPlaceSend(departmentId); List<Dictionary<string, object>> list = ConvertHelperController.DtToList(dt); return Json(list, JsonRequestBehavior.AllowGet); } #endregion #region 根据商品id查询商品 { <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> public ActionResult GoodsAllSelect(string strarry, int id = 0)</span></div> DataTable dt = _myReturnRepertory.TransformTotbSelectGoods(goodsId); List<Dictionary<string, object>> list = ConvertHelperController.DtToList(dt); return Json(list, JsonRequestBehavior.AllowGet); } #endregion #region 模糊查询商品 public ActionResult BlurSelectGoods(string strBlurMessage) { DataTable sdt = _myReturnRepertory.BlurSelectGoods(strBlurMessage); List<Dictionary<string, object>> list = ConvertHelperController.DtToList(sdt); return Json(list, JsonRequestBehavior.AllowGet); } #endregion #region 获取全部商品信息 { DataTable dt = _myReturnRepertory.GoodsAllSelect(id);//如果id=0就查询全部商品,如果id!=0就根据商品id查询商品 <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> DataTable dt = _myReturnRepertory.DepartmentStaffSelectbyDepartmentId(intDepartment);</span></div> string[] str = strarry.Split(',');//根据“,”拆分数组 foreach (string t in str)//遍历数组的每个元素 { for (int i = 0; i < dt.Rows.Count; i++)//遍历商品每行 { if (t == dt.Rows[i]["Goods_id"].ToString())//从商品表中筛选出商品id,判断商品id是否在id数组中存在 { dt.Rows.Remove(dt.Rows[i]);//如果存在就从商品表中移除 } } } List<Dictionary<string, object>> shangPinXinXiAll = ConvertHelperController.DtToList(dt); return Json(shangPinXinXiAll, JsonRequestBehavior.AllowGet); } #endregion #region 根据部门ID查找部门员工 public ActionResult DepartmentStaffSelectbyDepartmentId(int intDepartment) { <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> string prefixs = dt.Rows[0]["Prefixs"].ToString().Trim();//获取前缀</span></div> List<Dictionary<string, object>> yuanGong = ConvertHelperController.DtToList(dt); return Json(yuanGong, JsonRequestBehavior.AllowGet); } #endregion #region 获取全部返仓单 public ActionResult GetAllMessagersOfReturnRepertory() { DataTable dt = _myReturnRepertory.GetAllMessagersOfReturnRepertory(); List<Dictionary<string, object>> list = ConvertHelperController.DtToList(dt); return Json(list, JsonRequestBehavior.AllowGet); } #endregion #region 创建返仓单号 public ActionResult AddNewReturnRepertory() { DataTable dt = _myReturnRepertory.GetOddNumbers(3);//根据id查询返仓单单号前缀 DataTable dt1 = _myReturnRepertory.GetDayMaxCount(1);//根据id查询返仓单单号日最大数 <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> DataTable dt = _myReturnRepertory.GetAllDepartmentMessages();//查询整张部门递归表</span></div> int count = Convert.ToInt32(dt.Rows[0]["Suffix_number"].ToString().Trim());//获取序号长度 string counts = (Convert.ToInt32(dt1.Rows[0][0]) + 1).ToString("D" + count + "");//拼接序号 string recordNumber = prefixs + counts;//拼接返仓单 return Json(recordNumber, JsonRequestBehavior.AllowGet); } #endregion #region 获取所以部门绑定combotree public ActionResult GetAllDepartmentMessages() { DataTable dt = _myReturnRepertory.GetAllDepartmentMessages(); //查询所有的商品信息 List<Dictionary<string, object>> list = ConvertHelperController.Child(dt); return Json(list, JsonRequestBehavior.AllowGet); } #endregion #region 获取部门名称拼接 public ActionResult GetDepartNames(int intFar) { <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> DataTable dt = _myReturnRepertory.GetSameRankDepartment(intDepartmentId);</span></div> string list = ConvertHelperController.DepartmentNameSelect(dt, intFar);//调用ConvertHelperController中的方法筛选拼接部门名称 return Json(list, JsonRequestBehavior.AllowGet);//将返回的数据转换为json格式返回 } #endregion #region 根据发货部门绑定收货部门 public ActionResult GetReceivingDepartmentByFarId(int intFar) { DataTable dt = _myReturnRepertory.GetReceivingDepartmentByFarId(intFar); List<Dictionary<string, object>> list = ConvertHelperController.DtToList(dt); return Json(list, JsonRequestBehavior.AllowGet); } #endregion #endregion #region 返仓查询 public ActionResult SelectReturnRepertory() { return View(); } #region 绑定收货部门 public ActionResult GetSameRankDepartment(int intDepartmentId) { <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> List<Dictionary<string, object>> list = ConvertHelperController.DtToList(dt);</span></div> List<Dictionary<string, object>> list = ConvertHelperController.DtToList(dt); return Json(list, JsonRequestBehavior.AllowGet); } #endregion #region 不定条件查询返仓单 public ActionResult DynamicSelect( string strRecordNumber, string intCDepartmentId, string intRDepartmentId, string dtmStart, string dtmEnd, string strRemarks, bool bolReviewDeny ) { DataTable dt = _myReturnRepertory.DynamicSelect( strRecordNumber, ConvertHelperController.ConverToInt(intCDepartmentId), ConvertHelperController.ConverToInt(intRDepartmentId), ConvertHelperController.StarDate(dtmStart), ConvertHelperController.EndDate(dtmEnd), strRemarks, bolReviewDeny); <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;">}</span></div> return Json(list, JsonRequestBehavior.AllowGet); } #endregion #region 查询返仓单详细信息 public ActionResult GetRepertoryByRepertoryId(int intReturnRepertoryId) { DataTable dt = _myReturnRepertory.GetRepertoryByRepertoryId(intReturnRepertoryId); List<Dictionary<string, object>> list = ConvertHelperController.DtToList(dt); return Json(list, JsonRequestBehavior.AllowGet); } #endregion #region 查询返仓明细 public ActionResult GetRepertoryDetailByRepertoryId(int intReturnRepertoryId) { DataTable dt = _myReturnRepertory.GetRepertoryDetailByRepertoryId(intReturnRepertoryId); List<Dictionary<string, object>> list = ConvertHelperController.DtToList(dt); return Json(list, JsonRequestBehavior.AllowGet); } #endregion #endregion <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> }</span></div>
2.6、商品返仓Csharp-Bll代码:
<div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;">using System.Data;</span></div><div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;">using System.Data.SqlClient;</span></div>using DALPublic; <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;">namespace BLL_KuCunGuangLi</span></div>using System; { <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> public class ReturnRepertory</span></div> { <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> private readonly DalMethod _myAal = new DalMethod();</span></div> #region 获取全部返仓单 <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> {</span></div> public DataTable GetAllMessagersOfReturnRepertory() <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> new SqlParameter("@NB", SqlDbType.Char)</span></div> SqlParameter[] sql = { }; <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> return _myAal.DAL_SelectDB_Par("Inventory_Control_ReturnRepertory", sql);</span></div> sql[0].Value = "GetAllMessagersOfReturnRepertory"; } #endregion #region 创建返仓单号 <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> new SqlParameter("@NB", SqlDbType.Char),</span></div> public DataTable GetOddNumbers(int intOddNumbersId) { SqlParameter[] sql = { <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> return _myAal.DAL_SelectDB_Par("Update_Day_Max_Count", sql);</span></div> new SqlParameter("@Odd_numbers_id", SqlDbType.Int) }; sql[0].Value = "GetOddNumbers"; sql[1].Value = intOddNumbersId; } <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> new SqlParameter("@Day_max_quantity_id", SqlDbType.Int)</span></div> public DataTable GetDayMaxCount(int dayMaxId) { SqlParameter[] sql = { new SqlParameter("@NB", SqlDbType.Char), }; sql[0].Value = "GetDayMaxCount"; <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> SqlParameter[] sql =</span></div> sql[1].Value = dayMaxId; return _myAal.DAL_SelectDB_Par("Update_Day_Max_Count", sql); } #endregion #region 获取所以部门绑定 public DataTable GetAllDepartmentMessages() { { <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> #region 获取部门归属</span></div> new SqlParameter("@NB", SqlDbType.Char) }; sql[0].Value = "GetAllDepartmentMessages"; return _myAal.DAL_SelectDB_Par("Inventory_Control_ReturnRepertory", sql); } #endregion <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> sql[0].Value = "GetConsignmentDepartmentAllByDepartmentId";</span></div> public DataTable GetDepartNames(int intDepartmentFarId) { SqlParameter[] sql = { new SqlParameter("@NB", SqlDbType.Char), new SqlParameter("@Department_id", SqlDbType.Int) }; sql[1].Value = intDepartmentFarId; <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> new SqlParameter("@NB", SqlDbType.Char),</span></div> return _myAal.DAL_SelectDB_Par("Inventory_Control_ReturnRepertory", sql); } #endregion #region 根据发货部门绑定收货部门 public DataTable GetReceivingDepartmentByFarId(int intDepartmentFarId) { SqlParameter[] sql = { new SqlParameter("@Department_Farid", SqlDbType.Int) }; <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> {</span></div> sql[0].Value = "GetReceivingDepartmentByFarId"; sql[1].Value = intDepartmentFarId; return _myAal.DAL_SelectDB_Par("Inventory_Control_ReturnRepertory", sql); } #endregion #region 根据部门ID查找部门员工 public DataTable DepartmentStaffSelectbyDepartmentId(int intDepartmentFarId) { SqlParameter[] sql = <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> public DataTable GoodsAllSelect(int id)</span></div> new SqlParameter("@NB", SqlDbType.Char), new SqlParameter("@Department_id", SqlDbType.Int) }; sql[0].Value = "DepartmentStaffSelectbyDepartmentId"; sql[1].Value = intDepartmentFarId; return _myAal.DAL_SelectDB_Par("Inventory_Control_ReturnRepertory", sql); } #endregion #region 获取全部/按商品id查询商品信息 { <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> public DataTable BlurSelectGoods(string strBlurMessage)</span></div> SqlParameter[] sql = { new SqlParameter("@NB", SqlDbType.Char), new SqlParameter("@Goods_id", SqlDbType.Int) }; sql[0].Value = "GoodsAllSelect"; sql[1].Value = id; return _myAal.DAL_SelectDB_Par("Inventory_Control_ReturnRepertory", sql); } #endregion #region 模糊查询商品 { SqlParameter[] sql = <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> public DataTable TransformTotbSelectGoods(int values)</span></div> { new SqlParameter("@NB", SqlDbType.Char), new SqlParameter("@BlurContent", SqlDbType.Char) }; sql[0].Value = "BlurSelectGoods"; sql[1].Value = strBlurMessage; return _myAal.DAL_SelectDB_Par("Inventory_Control_ReturnRepertory", sql); } #endregion #region 根据商品id查询商品 { SqlParameter[] sql = { <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> SqlParameter[] sql =</span></div> new SqlParameter("@NB", SqlDbType.Char), new SqlParameter("@Goods_id", SqlDbType.Int) }; sql[0].Value = "GoodsAllSelect"; sql[1].Value = values; return _myAal.DAL_SelectDB_Par("Inventory_Control_ReturnRepertory", sql); } #endregion #region 根据发货部门查询发货库存地点 public DataTable SelectRepertoryPlaceSend(int departmentId) { { <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> {</span></div> new SqlParameter("@NB", SqlDbType.Char), new SqlParameter("@Department_id", SqlDbType.Int) }; sql[0].Value = "SelectRepertoryPlaceSend"; sql[1].Value = departmentId; return _myAal.DAL_SelectDB_Par("Inventory_Control_ReturnRepertory", sql); } #endregion #region 根据收货部门查询收货库存地点 public DataTable SelectRepertoryPlaceHarvest(int departmentId) { SqlParameter[] sql = <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> new SqlParameter("@NB", SqlDbType.Char),</span></div> new SqlParameter("@NB", SqlDbType.Char), new SqlParameter("@Department_id", SqlDbType.Int) }; sql[0].Value = "SelectRepertoryPlaceHarvest"; sql[1].Value = departmentId; return _myAal.DAL_SelectDB_Par("Inventory_Control_ReturnRepertory", sql); } #endregion #region 根据部门id获取员工 public DataTable GetMakeBills(int intDepartmentId) { SqlParameter[] sql = { <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> DateTime dtmMakeBills)</span></div> new SqlParameter("@Department_id", SqlDbType.Int) }; sql[0].Value = "GetMakeBills"; sql[1].Value = intDepartmentId; return _myAal.DAL_SelectDB_Par("Inventory_Control_ReturnRepertory", sql); } #endregion #region 保存新增 public DataTable SaveReturnRepertory(string strRecordNumber, int intShipperId, int intReceiverId, int intSend, int intReceive, string strRemark, int intMakeBills, int intTransactor, DateTime dtmExecute, { <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> new SqlParameter("@Make_bills_id", SqlDbType.Int),</span></div> SqlParameter[] sql = { new SqlParameter("@NB", SqlDbType.Char), new SqlParameter("@Delivery_department_id", SqlDbType.Int), new SqlParameter("@Take_delivery_department_id", SqlDbType.Int), new SqlParameter("@Record_number", SqlDbType.Char), new SqlParameter("@Shipper_id", SqlDbType.Int), new SqlParameter("@Receiver_id", SqlDbType.Int), new SqlParameter("@Remarks", SqlDbType.Char), <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> sql[8].Value = dtmMakeBills;</span></div> new SqlParameter("@Make_bills_time", SqlDbType.DateTime), new SqlParameter("@Executor_id", SqlDbType.Int), new SqlParameter("@Execute_time", SqlDbType.DateTime) }; sql[0].Value = "SaveReturnRepertory"; sql[1].Value = intSend; sql[2].Value = intReceive; sql[3].Value = strRecordNumber; sql[4].Value = intShipperId; sql[5].Value = intReceiverId; sql[6].Value = strRemark; sql[7].Value = intMakeBills; <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> new SqlParameter("@Goods_id", SqlDbType.Int),</span></div> sql[9].Value = intTransactor; sql[10].Value = dtmExecute; return _myAal.DAL_SelectDB_Par("Inventory_Control_ReturnRepertory", sql); } public int SaveReturnRepertoryDetail(int intReturnRepertoryId, int intGoodsId, int dcmShipmentsQuantity, int intRepertoryPlaceSendId, int intRepertoryPlaceHarvestId) { SqlParameter[] sql = { new SqlParameter("@NB", SqlDbType.Char), new SqlParameter("@Return_repertory_id", SqlDbType.Int), <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> return _myAal.DAL_OPTableDB_Par("Inventory_Control_ReturnRepertory", sql);</span></div> new SqlParameter("@Delivery_amount", SqlDbType.Int), new SqlParameter("@Delivery_repertory_place_id", SqlDbType.Int), new SqlParameter("@Take_delivery_repertory_place_id", SqlDbType.Int) }; sql[0].Value = "SaveReturnRepertoryDetail"; sql[1].Value = intReturnRepertoryId; sql[2].Value = intGoodsId; sql[3].Value = dcmShipmentsQuantity; sql[4].Value = intRepertoryPlaceSendId; sql[5].Value = intRepertoryPlaceHarvestId; } #endregion #region 绑定返仓相关数据 <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> sql[0].Value = "SelectRepertorysByBur";</span></div> public DataTable SelectAllRepertorys() { SqlParameter[] sql = { new SqlParameter("@NB", SqlDbType.Char) }; sql[0].Value = "SelectAllRepertorys"; return _myAal.DAL_SelectDB_Par("Inventory_Control_ReturnRepertory", sql); } public DataTable SelectRepertorysByBur(string strBur) { SqlParameter[] sql = { new SqlParameter("@NB", SqlDbType.Char), new SqlParameter("@strBur", SqlDbType.Char) }; sql[1].Value = strBur; <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> public int DeleteReturnRepertory(int intReturnRepertoryId)</span></div> return _myAal.DAL_SelectDB_Par("Inventory_Control_ReturnRepertory", sql); } public DataTable BindingReturnRepertoryDetail(int intReturnRepertoryId) { SqlParameter[] sql = { new SqlParameter("@NB", SqlDbType.Char), new SqlParameter("@Return_repertory_id", SqlDbType.Int) }; sql[0].Value = "BindingReturnRepertoryDetail"; sql[1].Value = intReturnRepertoryId; return _myAal.DAL_SelectDB_Par("Inventory_Control_ReturnRepertory", sql); } #endregion #region 删除返仓单 { SqlParameter[] sql = { <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> new SqlParameter("@Return_repertory_detail_id", SqlDbType.Int),</span></div> new SqlParameter("@NB", SqlDbType.Char), new SqlParameter("@Return_repertory_id", SqlDbType.Int) }; sql[0].Value = "DeleteReturnRepertory"; sql[1].Value = intReturnRepertoryId; return _myAal.DAL_OPTableDB_Par("Inventory_Control_ReturnRepertory", sql); } #endregion #region 修改删除返仓明细 public int UpdateReturnRepertoryDetail(int intRepertoryDetailId, int dcmShipmentsQuantity, int intRepertoryPlaceSendId, int intRepertoryPlaceHarvestId) { SqlParameter[] sql = { new SqlParameter("@NB", SqlDbType.Char), <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> {</span></div> new SqlParameter("@Delivery_amount", SqlDbType.Int), new SqlParameter("@Delivery_repertory_place_id", SqlDbType.Int), new SqlParameter("@Take_delivery_repertory_place_id", SqlDbType.Int) }; sql[0].Value = "UpdateReturnRepertoryDetail"; sql[1].Value = intRepertoryDetailId; sql[2].Value = dcmShipmentsQuantity; sql[3].Value = intRepertoryPlaceSendId; sql[4].Value = intRepertoryPlaceHarvestId; return _myAal.DAL_OPTableDB_Par("Inventory_Control_ReturnRepertory", sql); } public void DeleteReturnRepertoryDetail1(int intRepertoryDetailId) { SqlParameter[] sql = <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> new SqlParameter("@NB", SqlDbType.Char),</span></div> new SqlParameter("@NB", SqlDbType.Char), new SqlParameter("@Return_repertory_detail_id", SqlDbType.Int) }; sql[0].Value = "DeleteReturnRepertoryDetail1"; sql[1].Value = intRepertoryDetailId; _myAal.DAL_OPTableDB_Par("Inventory_Control_ReturnRepertory", sql); } #endregion #region 修改返仓单 public int UpdateReturnRepertory(int intReturnRepertoryId, string strRecordNumber, int intShipperId, int intReceiverId, int intSend, int intReceive, string strRemark, int intMakeBills, int intTransactor, DateTime dtmExecute, DateTime dtmMakeBills) { SqlParameter[] sql = { <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> sql[0].Value = "UpdateReturnRepertory";</span></div> new SqlParameter("@Delivery_department_id", SqlDbType.Int), new SqlParameter("@Take_delivery_department_id", SqlDbType.Int), new SqlParameter("@Record_number", SqlDbType.Char), new SqlParameter("@Shipper_id", SqlDbType.Int), new SqlParameter("@Receiver_id", SqlDbType.Int), new SqlParameter("@Remarks", SqlDbType.Char), new SqlParameter("@Make_bills_id", SqlDbType.Int), new SqlParameter("@Make_bills_time", SqlDbType.DateTime), new SqlParameter("@Executor_id", SqlDbType.Int), new SqlParameter("@Execute_time", SqlDbType.DateTime), new SqlParameter("@Return_repertory_id", SqlDbType.Int) }; <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> new SqlParameter("@Return_repertory_id", SqlDbType.Int)</span></div> sql[1].Value = intSend; sql[2].Value = intReceive; sql[3].Value = strRecordNumber; sql[4].Value = intShipperId; sql[5].Value = intReceiverId; sql[6].Value = strRemark; sql[7].Value = intMakeBills; sql[8].Value = dtmMakeBills; sql[9].Value = intTransactor; sql[10].Value = dtmExecute; sql[11].Value = intReturnRepertoryId; return _myAal.DAL_OPTableDB_Par("Inventory_Control_ReturnRepertory", sql); } #endregion #region 修改后的重新加载 public DataTable ReloadReturnRepertory(int intReturnRepertoryId) { SqlParameter[] sql = { new SqlParameter("@NB", SqlDbType.Char), }; <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> public DataTable DynamicSelect(string strRecordNumber, int intCDepartmentId, int intRDepartmentId,</span></div> sql[0].Value = "ReloadReturnRepertory"; sql[1].Value = intReturnRepertoryId; return _myAal.DAL_SelectDB_Par("Inventory_Control_ReturnRepertory", sql); } #endregion #region 绑定收货部门 public DataTable GetSameRankDepartment(int intDepartmentId) { SqlParameter[] sql = { new SqlParameter("@NB", SqlDbType.Char), new SqlParameter("@Department_id", SqlDbType.Int) }; sql[0].Value = "GetSameRankDepartment"; sql[1].Value = intDepartmentId; return _myAal.DAL_SelectDB_Par("Inventory_Control_ReturnRepertory", sql); } #endregion #region 不定条件查询返仓单 DateTime dtmStart, DateTime dtmEnd, string strRemarks, bool bolReviewDeny) { <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> sql[6].Value = strRemarks;</span></div> SqlParameter[] sql = { new SqlParameter("@NB", SqlDbType.Char), new SqlParameter("@Record_number", SqlDbType.Char), new SqlParameter("@Delivery_department_id", SqlDbType.Int), new SqlParameter("@Take_delivery_department_id", SqlDbType.Int), new SqlParameter("@dtmStar", SqlDbType.Date), new SqlParameter("@dtmEnd", SqlDbType.Date), new SqlParameter("@Remarks", SqlDbType.Char), new SqlParameter("@Review_deny", SqlDbType.Bit) }; sql[0].Value = "DynamicSelect"; sql[1].Value = strRecordNumber; sql[2].Value = intCDepartmentId; sql[3].Value = intRDepartmentId; sql[4].Value = dtmStart; sql[5].Value = dtmEnd; <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> new SqlParameter("@NB", SqlDbType.Char),</span></div> sql[7].Value = bolReviewDeny; return _myAal.DAL_SelectDB_Par("Inventory_Control_ReturnRepertory", sql); } #region 查询返仓单详细信息 public DataTable GetRepertoryByRepertoryId(int intReturnRepertoryId) { SqlParameter[] sql = { new SqlParameter("@NB", SqlDbType.Char), new SqlParameter("@Return_repertory_id", SqlDbType.Int) }; sql[0].Value = "GetRepertoryByRepertoryId"; sql[1].Value = intReturnRepertoryId; return _myAal.DAL_SelectDB_Par("Inventory_Control_ReturnRepertory", sql); } #endregion #region 查询返仓明细 public DataTable GetRepertoryDetailByRepertoryId(int intReturnRepertoryId) { SqlParameter[] sql = { <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> public void UpdateStock(int stockId, decimal shipmentsQuantity)</span></div> new SqlParameter("@Return_repertory_id", SqlDbType.Int) }; sql[0].Value = "GetRepertoryDetailByRepertoryId"; sql[1].Value = intReturnRepertoryId; return _myAal.DAL_SelectDB_Par("Inventory_Control_ReturnRepertory", sql); } #endregion public DataTable SelectStock(int goodsId, int repertoryPlaceId) { SqlParameter[] sql = { new SqlParameter("@NB", SqlDbType.Char), new SqlParameter("@Repertory_place_id", SqlDbType.Int), new SqlParameter("@Goods_id", SqlDbType.Int) }; sql[0].Value = "SelectStock"; sql[1].Value = repertoryPlaceId; sql[2].Value = goodsId; return _myAal.DAL_SelectDB_Par("Inventory_Control_ReturnRepertory", sql); } { <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> return _myAal.DAL_SelectDB_Par("Inventory_Control_ReturnRepertory", sql);</span></div> SqlParameter[] sql = { new SqlParameter("@NB", SqlDbType.Char), new SqlParameter("@Stock_id", SqlDbType.Int), new SqlParameter("@Stock_quantity", SqlDbType.Int) }; sql[0].Value = "UpdateStock"; sql[1].Value = stockId; sql[2].Value = shipmentsQuantity; _myAal.DAL_OPTableDB_Par("Inventory_Control_ReturnRepertory", sql); } public DataTable GetRepertoryDetailsToReview(int intReturnId) { SqlParameter[] sql = { new SqlParameter("@NB", SqlDbType.Char), new SqlParameter("@Return_repertory_id", SqlDbType.Int) }; sql[0].Value = "GetRepertoryDetailsToReview"; sql[1].Value = intReturnId; } public void UpdateReturnRepertoryToTure(int intReturnId) <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;">}</span></div> { SqlParameter[] sql = { new SqlParameter("@NB", SqlDbType.Char), new SqlParameter("@Return_repertory_id", SqlDbType.Int) }; sql[0].Value = "UpdateReturnRepertoryToTure"; sql[1].Value = intReturnId; _myAal.DAL_OPTableDB_Par("Inventory_Control_ReturnRepertory", sql); } #endregion <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> }</span></div>
2.7、商品返仓-SQL存储过程
<div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;">ALTER PROCEDURE [dbo].[Inventory_Control_ReturnRepertory] </span></div><div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;">@NB char(200)='',@Department_id int=0,@Department_Farid int=0,@Goods_id int=0,@sql varchar(max)='',@BlurContent char(30)='',</span></div><div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;">@Delivery_department_id int=0,@Take_delivery_department_id int=0,@Record_number nchar(20)='',@Return_repertory_detail_id int=0,</span></div>@Shipper_id int=0,@Receiver_id int=0,@Remarks nchar(50)='',@Make_bills_id int=0,@Make_bills_time datetime='', <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;">@Executor_id int=0,@Execute_time datetime='',@Return_repertory_id int=0,@Delivery_amount int=0,@Delivery_repertory_place_id int=0,</span></div>@Take_delivery_repertory_place_id int=0,@strBur char(15)='',@Review_deny bit=false,@dtmStar date='',@dtmEnd date='', @Repertory_place_id int=0,@Stock_quantity int=0,@Stock_id int=0 AS BEGIN if(@NB='UpdateReturnRepertoryToTure') --审核返仓单 <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;">where Stock_id=@Stock_id</span></div>begin UPDATE Return_repertory SET Review_deny ='true' where Return_repertory_id=@Return_repertory_id end if(@NB='UpdateStock') --减少库存数 begin UPDATE Stock SET Stock_quantity =Stock_quantity-@Stock_quantity end <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> Return_repertory_detail.Delivery_amount</span></div>if(@NB='GetRepertoryDetailsToReview') --根据返仓单id查询返仓明细 begin SELECT Return_repertory_detail.Return_repertory_id, Return_repertory_detail.Goods_id, Goods.Goods_name, Return_repertory_detail.Delivery_repertory_place_id, FROM Return_repertory_detail INNER JOIN <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;">where Repertory_place_id=@Repertory_place_id and Goods_id=@Goods_id</span></div> Goods ON Return_repertory_detail.Goods_id = Goods.Goods_id where Return_repertory_id=@Return_repertory_id end if(@NB='SelectStock') --查询库存表 begin SELECT Stock_quantity, Stock_floor, Stock_id FROM Stock end if(@NB='GetRepertoryDetailByRepertoryId') --查询返仓明细 begin <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> Goods.Goods_rademark_id, Goods.Input_ratio, Goods.Output_ratio, Goods.Count_scale, Goods.Quality_content, Goods.Retail_unit_price, Goods.Purchase_bid, Goods.Mini_fix_goods_deny, </span></div>SELECT Goods.Goods_id, Goods.Goods_code, Goods.Goods_bar_code, Goods.Goods_name, Goods.Goods_abbreviation, Goods.Plncode_PLN, Goods.Art_No, Goods.Format_model, Goods.Goods_colours, Return_repertory_detail.Delivery_amount, CAST(Return_repertory_detail.Delivery_amount AS int) / CAST(Goods.Quality_content AS int) AS Repertory_enter_packages, <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> Attribute_gather_detail.Attribute_gather_detail_name AS Goods_tab, Agreement.Contract_number, Manufacturer.Manufacturer_name, Goods_producing_area.Producing_area_name, </span></div> Repertory_place.Repertory_place_name AS Delivery_repertory_place, Repertory_place_1.Repertory_place_name AS Take_delivery_repertory_place, Return_repertory_detail.Return_repertory_detail_id, Goods.Purchase_bid * (CAST(Goods.Input_ratio AS decimal(18, 5)) / 100 + 1) AS InputTax, Attribute_gather_detail_1.Attribute_gather_detail_name AS Unit_of_measurement, Attribute_gather_detail_2.Attribute_gather_detail_name AS Use_target, Enterprise_name.Chinese, <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> (CASE Self_fix_goods_deny WHEN 'true' THEN '是' WHEN 'false' THEN '否' END) AS Self_fix_goods_deny, (CASE Permit_decimal_deny WHEN 'true' THEN '是' WHEN 'false' THEN '否' END) </span></div> Attribute_gather_detail_3.Attribute_gather_detail_name AS Goods_classify, Attribute_gather_detail_4.Attribute_gather_detail_name AS Quality_guarantee_period, Attribute_gather_detail_5.Attribute_gather_detail_name AS Quality_grade, Manage_season.Manage_season_name, Attribute_gather_detail_6.Attribute_gather_detail_name AS Product_status, AS Permit_decimal_deny, (CASE Copy_record_deny WHEN 'true' THEN '是' WHEN 'false' THEN '否' END)as Copy_record_deny, (CASE Vender_bar_code_deny WHEN 'true' THEN '是' WHEN 'false' THEN '否' END) as Vender_bar_code_deny FROM Repertory_place INNER JOIN <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> Manufacturer ON Goods.Manufacturer_id = Manufacturer.Manufacturer_id INNER JOIN</span></div> Return_repertory_detail INNER JOIN Goods ON Return_repertory_detail.Goods_id = Goods.Goods_id ON Repertory_place.Repertory_place_id = Return_repertory_detail.Delivery_repertory_place_id INNER JOIN Repertory_place AS Repertory_place_1 ON Return_repertory_detail.Take_delivery_repertory_place_id = Repertory_place_1.Repertory_place_id INNER JOIN Attribute_gather_detail ON Goods.Goods_tab_pubid = Attribute_gather_detail.Attribute_gather_detail_id INNER JOIN Agreement ON Goods.Agreement_id = Agreement.Agreement_id INNER JOIN <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> Attribute_gather_detail AS Attribute_gather_detail_3 ON Goods.Goods_classify_pubid = Attribute_gather_detail_3.Attribute_gather_detail_id INNER JOIN</span></div> 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.Use_target_pubid = Attribute_gather_detail_2.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 <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;">SELECT Return_repertory.Record_number, Department.Department_id, Department.Department_name AS Delivery_department, Department_1.Department_name AS Take_delivery_department, </span></div> Attribute_gather_detail AS Attribute_gather_detail_4 ON Goods.Quality_guarantee_period_pubid = Attribute_gather_detail_4.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 Manage_season ON Goods.Manage_season_id = Manage_season.Manage_season_id INNER JOIN Attribute_gather_detail AS Attribute_gather_detail_6 ON Goods.Product_status_pubid = Attribute_gather_detail_6.Attribute_gather_detail_id WHERE (Return_repertory_detail.Return_repertory_id = @Return_repertory_id) end if(@NB='GetRepertoryByRepertoryId') --查询返仓单详细信息 begin <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> Eemployee AS Eemployee_1 ON Return_repertory.Receiver_id = Eemployee_1.Employee_id INNER JOIN</span></div> Eemployee.Employee_name AS Shipper, Eemployee_1.Employee_name AS Receiver, Return_repertory.Remarks, Eemployee_2.Employee_id, Eemployee_2.Employee_name AS Make_bills, Eemployee_3.Employee_name AS Executor, convert(nchar(20),Execute_time,120) as Execute_time, CONVERT(nchar(20), Make_bills_time,120) as Make_bills_time FROM Return_repertory INNER JOIN Department ON Return_repertory.Delivery_department_id = Department.Department_id INNER JOIN Department AS Department_1 ON Return_repertory.Take_delivery_department_id = Department_1.Department_id INNER JOIN Eemployee ON Return_repertory.Shipper_id = Eemployee.Employee_id INNER JOIN Eemployee AS Eemployee_3 ON Department.Department_id = Eemployee_3.Department_id INNER JOIN <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;">if(@Record_number<>'')</span></div> Eemployee AS Eemployee_2 ON Return_repertory.Make_bills_id = Eemployee_2.Employee_id where Return_repertory.Return_repertory_id=@Return_repertory_id end if(@NB='DynamicSelect') --不定条件查询返仓单 begin set @sql='SELECT Return_repertory.Record_number, Department.Department_id, Department.Department_name AS Delivery_department, Department_1.Department_name AS Take_delivery_department, Return_repertory.Remarks, Return_repertory.Return_repertory_id FROM Return_repertory INNER JOIN Department ON Return_repertory.Delivery_department_id = Department.Department_id INNER JOIN Department AS Department_1 ON Return_repertory.Take_delivery_department_id = Department_1.Department_id where Review_deny='+RTRIM(@Review_deny)+' and Execute_time between '''+RTRIM(@dtmStar)+''' and '''+RTRIM(@dtmEnd)+'''' <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> Department.Department_name AS Take_delivery_department, Return_repertory.Delivery_department_id, Return_repertory.Take_delivery_department_id, Return_repertory.Receiver_id, </span></div> set @sql+=' and Record_number like ''%'+RTRIM(@Record_number)+'%''' if(@Delivery_department_id >0) set @sql+=' and Delivery_department_id='+RTRIM(@Delivery_department_id)+'' if(@Take_delivery_department_id>0) set @sql+=' and Take_delivery_department_id='+RTRIM(@Take_delivery_department_id)+'' if(@Remarks <>'') set @sql+=' and Remarks like ''%'+RTRIM(@Remarks)+'%''' exec (@sql) end if(@NB='GetSameRankDepartment') --根据部门id查询同级部门 begin SELECT Department_name, Department_id FROM Department where Department_Farid=(SELECT Department_Farid FROM Department where Department_id=@Department_id) end if(@NB='ReloadReturnRepertory') --重加载修改后的返仓单 begin SELECT Return_repertory.Return_repertory_id, Return_repertory.Record_number, Return_repertory.Remarks, Department_1.Department_name AS Delivery_department, Return_repertory.Shipper_id, Eemployee.Employee_name AS Shipper, Eemployee_1.Employee_name AS Receiver, Return_repertory.Make_bills_id, CONVERT(nchar(20), <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> Record_number =@Record_number, Shipper_id =@Shipper_id, Receiver_id =@Receiver_id, Remarks =@Remarks, </span></div> Return_repertory.Make_bills_time, 120) AS Make_bills_time1, Return_repertory.Executor_id, CONVERT(nchar(20), Return_repertory.Execute_time, 120) AS Execute_time1 FROM Return_repertory INNER JOIN Department AS Department_1 ON Return_repertory.Delivery_department_id = Department_1.Department_id INNER JOIN Department ON Return_repertory.Take_delivery_department_id = Department.Department_id INNER JOIN Eemployee ON Return_repertory.Shipper_id = Eemployee.Employee_id INNER JOIN Eemployee AS Eemployee_1 ON Return_repertory.Receiver_id = Eemployee_1.Employee_id where Return_repertory.Return_repertory_id=@Return_repertory_id end if(@NB='UpdateReturnRepertory') --修改返仓单 begin UPDATE Return_repertory SET Delivery_department_id =@Delivery_department_id, Take_delivery_department_id =@Take_delivery_department_id, Make_bills_id =@Make_bills_id, Make_bills_time =@Make_bills_time, Executor_id =@Executor_id, Execute_time =@Execute_time where Return_repertory_id=@Return_repertory_id end if(@NB='DeleteReturnRepertory') --删除返仓单 begin begin tran <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> Attribute_gather_detail.Attribute_gather_detail_name AS Goods_Tab, Agreement.Contract_number, Manufacturer.Manufacturer_name, Goods_producing_area.Producing_area_name, </span></div>--删除返仓单 DELETE FROM Return_repertory where Return_repertory.Return_repertory_id=@Return_repertory_id ---删除返仓单明细 DELETE FROM Return_repertory_detail where Return_repertory_detail.Return_repertory_id=@Return_repertory_id commit tran end if(@NB='BindingReturnRepertoryDetail') --绑定返仓明细表 begin SELECT 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, Goods.Producing_area_id, Goods.Art_No, Goods.Format_model, Goods.Goods_colours, Goods.Goods_rademark_id, Goods.Input_ratio, Goods.Output_ratio, Goods.Count_scale, Goods.Quality_content, Goods.Permit_decimal_deny, Goods.Retail_unit_price, Goods.Purchase_bid, Goods.Self_fix_goods_deny, Goods.Mini_fix_goods_deny, Goods.Purchase_bid * (CAST(Goods.Input_ratio AS decimal(18, 5)) / 100 + 1) AS InputTax, CONVERT(varchar(20), Goods.Register_time, 120) AS RegisterTime, CONVERT(varchar(20), Goods.Review_time, 120) AS ReviewTime, CONVERT(varchar(20), Goods.Update_Time, 120) AS UpdateTime, Goods_rademark.Goods_rademark_name, <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> Return_repertory_detail.Return_repertory_detail_id</span></div> Attribute_gather_detail_1.Attribute_gather_detail_name AS Unit_of_measurement, Attribute_gather_detail_2.Attribute_gather_detail_name AS Use_target, Enterprise_name.Chinese, Attribute_gather_detail_3.Attribute_gather_detail_name AS Goods_classify, Attribute_gather_detail_4.Attribute_gather_detail_name AS Quality_guarantee_period, Attribute_gather_detail_5.Attribute_gather_detail_name AS Quality_grade, Manage_season.Manage_season_name, Attribute_gather_detail_6.Attribute_gather_detail_id AS Product_status, Return_repertory_detail.Goods_id, Return_repertory_detail.Delivery_repertory_place_id, Return_repertory_detail.Take_delivery_repertory_place_id, Return_repertory_detail.Return_repertory_id, Return_repertory_detail.Delivery_amount, CAST(Return_repertory_detail.Delivery_amount AS decimal(18, 3)) / CAST(Goods.Quality_content AS int) AS Repertory_enter_packages, Repertory_place_1.Repertory_place_name AS Delivery_repertory_place, Repertory_place.Repertory_place_name AS Take_delivery_repertory_place, FROM Goods INNER JOIN Goods_rademark ON Goods.Goods_rademark_id = Goods_rademark.Goods_rademark_id INNER JOIN <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> Attribute_gather_detail AS Attribute_gather_detail_4 ON Goods.Quality_guarantee_period_pubid = Attribute_gather_detail_4.Attribute_gather_detail_id INNER JOIN</span></div> Attribute_gather_detail ON Goods.Goods_tab_pubid = Attribute_gather_detail.Attribute_gather_detail_id INNER JOIN Agreement ON Goods.Agreement_id = Agreement.Agreement_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.Use_target_pubid = Attribute_gather_detail_2.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 Attribute_gather_detail AS Attribute_gather_detail_3 ON Goods.Goods_classify_pubid = Attribute_gather_detail_3.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 <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> Department AS Department_1 ON Return_repertory.Delivery_department_id = Department_1.Department_id INNER JOIN</span></div> Manage_season ON Goods.Manage_season_id = Manage_season.Manage_season_id INNER JOIN Attribute_gather_detail AS Attribute_gather_detail_6 ON Goods.Product_status_pubid = Attribute_gather_detail_6.Attribute_gather_detail_id INNER JOIN Return_repertory_detail ON Goods.Goods_id = Return_repertory_detail.Goods_id INNER JOIN Repertory_place AS Repertory_place_1 ON Return_repertory_detail.Delivery_repertory_place_id = Repertory_place_1.Repertory_place_id INNER JOIN Repertory_place ON Return_repertory_detail.Take_delivery_repertory_place_id = Repertory_place.Repertory_place_id WHERE (Return_repertory_detail.Return_repertory_id = @Return_repertory_id) end if(@NB='SelectRepertorysByBur') --模糊查询返仓单 begin SELECT Return_repertory.Return_repertory_id, Return_repertory.Record_number, Return_repertory.Remarks, Department_1.Department_name AS Delivery_department, Department.Department_name AS Take_delivery_department, Return_repertory.Delivery_department_id, Return_repertory.Take_delivery_department_id, Return_repertory.Receiver_id, Return_repertory.Shipper_id, Eemployee.Employee_name AS Shipper, Eemployee_1.Employee_name AS Receiver FROM Return_repertory INNER JOIN Department ON Return_repertory.Take_delivery_department_id = Department.Department_id INNER JOIN <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> Eemployee AS Eemployee_1 ON Return_repertory.Receiver_id = Eemployee_1.Employee_id</span></div> Eemployee ON Return_repertory.Shipper_id = Eemployee.Employee_id INNER JOIN Eemployee AS Eemployee_1 ON Return_repertory.Receiver_id = Eemployee_1.Employee_id where Record_number like '%'+rtrim(@strBur)+'%' end if(@NB='SelectAllRepertorys') --查询全部返仓单 begin SELECT Return_repertory.Return_repertory_id, Return_repertory.Record_number, Return_repertory.Remarks, Department_1.Department_name AS Delivery_department, Department.Department_name AS Take_delivery_department, Return_repertory.Delivery_department_id, Return_repertory.Take_delivery_department_id, Return_repertory.Receiver_id, Return_repertory.Shipper_id, Eemployee.Employee_name AS Shipper, Eemployee_1.Employee_name AS Receiver, Return_repertory.Make_bills_id, CONVERT(nchar(20), Return_repertory.Make_bills_time, 120) AS Make_bills_time1, Return_repertory.Executor_id, CONVERT(nchar(20), Return_repertory.Execute_time, 120) AS Execute_time1 FROM Return_repertory INNER JOIN Department AS Department_1 ON Return_repertory.Delivery_department_id = Department_1.Department_id INNER JOIN Department ON Return_repertory.Take_delivery_department_id = Department.Department_id INNER JOIN Eemployee ON Return_repertory.Shipper_id = Eemployee.Employee_id INNER JOIN where Review_deny='false' end if(@NB='SaveReturnRepertory') --新增返仓单 begin INSERT INTO Return_repertory <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> Department ON Eemployee.Department_id = Department.Department_id</span></div> (Delivery_department_id, Take_delivery_department_id, Record_number, Shipper_id, Receiver_id, Remarks, Make_bills_id, Make_bills_time, Executor_id, Execute_time, Review_deny) VALUES (@Delivery_department_id,@Take_delivery_department_id,@Record_number,@Shipper_id,@Receiver_id,@Remarks,@Make_bills_id,@Make_bills_time,@Executor_id,@Execute_time,'false') select @@IDENTITY UPDATE Day_max_quantity SET Day_max_count =Day_max_count+1 where Odd_numbers_id=3 end if(@NB='SaveReturnRepertoryDetail') --新增返仓明细 begin INSERT INTO Return_repertory_detail (Return_repertory_id, Goods_id, Delivery_amount, Delivery_repertory_place_id, Take_delivery_repertory_place_id) VALUES (@Return_repertory_id,@Goods_id,@Delivery_amount,@Delivery_repertory_place_id,@Take_delivery_repertory_place_id) end if(@NB='UpdateReturnRepertoryDetail') --修改返仓明细 begin UPDATE Return_repertory_detail SET Delivery_amount =@Delivery_amount, Delivery_repertory_place_id =@Delivery_repertory_place_id, Take_delivery_repertory_place_id =@Take_delivery_repertory_place_id where Return_repertory_detail.Return_repertory_detail_id=@Return_repertory_detail_id end if(@NB='DeleteReturnRepertoryDetail1') --删除返仓明细 begin DELETE FROM Return_repertory_detail where Return_repertory_detail.Return_repertory_detail_id=@Return_repertory_detail_id end if(@NB='GetMakeBills') --根据部门id获取员工 begin SELECT Eemployee.Employee_name as Name, Eemployee.Employee_id as Id FROM Eemployee INNER JOIN where Eemployee.Department_id=@Department_id end if(@NB='SelectRepertoryPlaceHarvest') --根据收货部门查询收货库存地点 begin <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> Enterprise_name INNER JOIN</span></div>SELECT Repertory_place.Repertory_place_id AS Repertory_place_harvest_id, Repertory_place.Repertory_place_name AS Repertory_place_harvest FROM Repertory_place INNER JOIN Department ON Repertory_place.Department_id = Department.Department_id WHERE (Department.Department_id = @Department_id) end if(@NB='SelectRepertoryPlaceSend') --根据收货部门查询发货库存地点 begin SELECT Repertory_place.Repertory_place_name as Repertory_place_send, Repertory_place.Repertory_place_id as Repertory_place_send_id FROM Department INNER JOIN Repertory_place ON Department.Department_id = Repertory_place.Department_id where Department.Department_id=@Department_id end if(@NB='BlurSelectGoods') --模糊查询商品 begin SELECT Attribute_gather_detail_1.Attribute_gather_detail_name AS Use_target, Attribute_gather_detail_2.Attribute_gather_detail_name AS Goods_classify, Attribute_gather_detail_4.Attribute_gather_detail_name AS Quality_grade, Attribute_gather_detail_6.Attribute_gather_detail_name AS Goods_tab, Attribute_gather_detail_5.Attribute_gather_detail_name AS Product_status, Attribute_gather_detail_3.Attribute_gather_detail_name AS Quality_guarantee_period, Agreement.Contract_number, Manufacturer.Manufacturer_name, Enterprise_name.Chinese, Goods_producing_area.Producing_area_name, Goods_rademark.Goods_rademark_name, Manage_season.Manage_season_name, Eemployee_1.Employee_name AS Registrant, Eemployee_2.Employee_name AS Review, Eemployee.Employee_name AS Update_person, Attribute_gather_detail.Attribute_gather_detail_name AS Unit_of_measurement, Goods.* FROM Eemployee INNER JOIN <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> Manage_season ON Goods.Manage_season_id = Manage_season.Manage_season_id ON Eemployee.Employee_id = Goods.Registrant_id INNER JOIN</span></div> Attribute_gather_detail AS Attribute_gather_detail_5 INNER JOIN Goods 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.Use_target_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.Quality_guarantee_period_pubid = Attribute_gather_detail_3.Attribute_gather_detail_id INNER JOIN Attribute_gather_detail AS Attribute_gather_detail_4 ON Goods.Quality_grade_pubid = Attribute_gather_detail_4.Attribute_gather_detail_id ON Attribute_gather_detail_5.Attribute_gather_detail_id = Goods.Product_status_pubid INNER JOIN Attribute_gather_detail AS Attribute_gather_detail_6 ON Goods.Goods_tab_pubid = Attribute_gather_detail_6.Attribute_gather_detail_id INNER JOIN Agreement ON Goods.Agreement_id = Agreement.Agreement_id INNER JOIN Supply_units ON Agreement.Supply_units_id = Supply_units.Supply_units_id ON Enterprise_name.Enterprise_name_id = Supply_units.Enterprise_name_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 <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> Goods.Goods_abbreviation, Goods.Plncode_PLN, Goods.Copy_record_deny, Goods.Goods_tab_pubid, Goods.Agreement_id, Goods.Manufacturer_id, Goods.Producing_area_id, Goods.Art_No, </span></div> Eemployee AS Eemployee_1 ON Goods.Auditor_id = Eemployee_1.Employee_id INNER JOIN Eemployee AS Eemployee_2 ON Goods.Update_person_id = Eemployee_2.Employee_id INNER JOIN Goods_rademark ON Goods.Goods_rademark_id = Goods_rademark.Goods_rademark_id where Goods.Goods_name like '%'+rtrim(@BlurContent)+'%' or Goods.Goods_code like '%'+rtrim(@BlurContent)+'%' or Goods.Goods_bar_code like '%'+rtrim(@BlurContent)+'%' end if(@NB='GoodsAllSelect') --查询商品信息by商品id begin set @sql='SELECT Attribute_gather_detail_1.Attribute_gather_detail_name AS Use_target, Attribute_gather_detail_2.Attribute_gather_detail_name AS Goods_classify, Attribute_gather_detail_4.Attribute_gather_detail_name AS Quality_grade, Attribute_gather_detail_6.Attribute_gather_detail_name AS Goods_tab, Attribute_gather_detail_5.Attribute_gather_detail_name AS Product_status, Attribute_gather_detail_3.Attribute_gather_detail_name AS Quality_guarantee_period, Agreement.Contract_number, Manufacturer.Manufacturer_name, Enterprise_name.Chinese, Goods_producing_area.Producing_area_name, Goods_rademark.Goods_rademark_name, Manage_season.Manage_season_name, Eemployee_1.Employee_name AS Registrant, Eemployee_2.Employee_name AS Review, Eemployee.Employee_name AS Update_person, Attribute_gather_detail.Attribute_gather_detail_name AS Unit_of_measurement, Goods.Goods_id, Goods.Goods_code, Goods.Goods_bar_code, Goods.Vender_bar_code_deny, Goods.Goods_name, Goods.Format_model, Goods.Unit_of_measurement_pubid, Goods.Use_target_pubid, Goods.Goods_colours, Goods.Goods_rademark_id, Goods.Goods_classify_pubid, <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"> Attribute_gather_detail_5.Attribute_gather_detail_id = Goods.Product_status_pubid INNER JOIN</span></div> Goods.Quality_guarantee_period_pubid, Goods.Input_ratio, Goods.Output_ratio, Goods.Count_scale, Goods.Quality_content, Goods.Quality_grade_pubid, Goods.Manage_season_id, Goods.Permit_decimal_deny, Goods.Product_status_pubid, Goods.Registrant_id, convert(nchar(10),Goods.Register_time,120) as Register_time1, Goods.Auditor_id, convert(nchar(10),Goods.Review_time,120) as Review_time1, Goods.Update_person_id, convert(nchar(10),Goods.Update_Time,120) as Update_Time1, Goods.Retail_unit_price, Goods.Purchase_bid, Goods.Self_fix_goods_deny, Goods.Mini_fix_goods_deny,Goods.Purchase_bid * (CAST(Goods.Input_ratio AS decimal(18, 5))/ 100 + 1) AS InputTax FROM Eemployee INNER JOIN Enterprise_name INNER JOIN Attribute_gather_detail AS Attribute_gather_detail_5 INNER JOIN Goods 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.Use_target_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.Quality_guarantee_period_pubid = Attribute_gather_detail_3.Attribute_gather_detail_id INNER JOIN Attribute_gather_detail AS Attribute_gather_detail_4 ON Goods.Quality_grade_pubid = Attribute_gather_detail_4.Attribute_gather_detail_id ON Attribute_gather_detail AS Attribute_gather_detail_6 ON Goods.Goods_tab_pubid = Attribute_gather_detail_6.Attribute_gather_detail_id INNER JOIN <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;">SELECT Department_name as name,Department_Farid as farid,Department_code as code</span></div> Agreement ON Goods.Agreement_id = Agreement.Agreement_id INNER JOIN Supply_units ON Agreement.Supply_units_id = Supply_units.Supply_units_id ON Enterprise_name.Enterprise_name_id = Supply_units.Enterprise_name_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 Manage_season ON Goods.Manage_season_id = Manage_season.Manage_season_id ON Eemployee.Employee_id = Goods.Registrant_id INNER JOIN Eemployee AS Eemployee_1 ON Goods.Auditor_id = Eemployee_1.Employee_id INNER JOIN Eemployee AS Eemployee_2 ON Goods.Update_person_id = Eemployee_2.Employee_id INNER JOIN Goods_rademark ON Goods.Goods_rademark_id = Goods_rademark.Goods_rademark_id' if(@Goods_id>0)set @sql=@sql+' where Goods.Goods_id='+rtrim(@Goods_id)+'' exec(@sql) end if(@NB='DepartmentStaffSelectbyDepartmentId') --根据部门ID查找部门员工 begin SELECT Eemployee.Employee_id, Eemployee.Employee_number, Eemployee.Employee_name,(case Sex when 'true' then '男' else '女' end) as Sex, Duties.Duties_name, Department.Department_name FROM Eemployee INNER JOIN Department ON Eemployee.Department_id = Department.Department_id INNER JOIN Duties ON Eemployee.Duties_id = Duties.Duties_id where Eemployee.Department_id=@Department_id end if(@NB='GetReceivingDepartmentByFarId') --根据发货部门绑定收货部门 begin SELECT Department_id , Department_code , Department_name FROM Department where Department.Department_Farid=(SELECT Department_Farid FROM Department where Department_id=@Department_Farid) end if(@NB='GetReceivingDepartmentAllByDepartmentId') --根据发货部门绑定收货部门 begin FROM Department WHERE (Department_id = @Department_id) end <div style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;">END</span></div>if(@NB='GetConsignmentDepartmentAllByDepartmentId') --获取部门归属 begin SELECT Department_name as name,Department_Farid as farid,Department_code as code FROM Department WHERE (Department_id = @Department_id) end if(@NB='GetAllDepartmentMessages') --获取所有部门 begin SELECT Department_id, Department_Farid, Department_name, Department_code FROM Department end if(@NB='GetAllMessagersOfReturnRepertory') --获取全部返仓单 begin SELECT Return_repertory.Return_repertory_id, Return_repertory.Record_number, Return_repertory.Remarks, Department.Department_name AS Delivery_department, Department_1.Department_name AS Take_delivery_department FROM Department INNER JOIN Return_repertory ON Department.Department_id = Return_repertory.Delivery_department_id CROSS JOIN Department AS Department_1 end <div style="text-align: center;"></div>
3、数据库设计:
用到的主要的表有:商品返仓表,商品返仓明细表,库存地点表,商品表,库存表,部门表:
表名 | 说明 | 类型 | 表编号 |
Return_repertory | 返仓表 | 业务表 | 表1 |
Return_repertory_detail | 返仓明细表 | 业务表 | 表2 |
Repertory_place | 库存地点表 | 基础表 | 表3 |
Stock | 库存表 | 基础表 | 表4 |
Goods | 商品表 | 基础表 | 表5 |
Department | 部门表 | 基础表 | 表6 |
列名 | 数据类型 | 主键/外键 | 说明 |
Return_repertory_id | Int | 主键 | |
Delivery_department_id | Int | 外键 | ‘部门表’,发货部门 |
Take_delivery_department_id | Int | 外键 | ‘部门表’,收货部门 |
Shipper_id | int | 外键 | ‘员工表’,发货人 |
Receiver_id | Int | 外键 | ‘员工表’,收货人 |
Make_bills_id | int | 外键 | ‘员工表’,制单人 |
Transactor_id | Int | 外键 | ‘员工表’,启动人 |
Make_bills_time | Datetime | 制单时间 | |
Execute_time | Datetime | 启动时间 | |
Record_number | Nchar(16) | 记录编号 | |
Remarks | Nchar(30) | 备注 | |
Review_deny | Bit | 审核否 |
列名 | 数据类型 | 主键/外键 | 说明 |
Return_repertory_detail_id | Int | 主键 | |
Return_repertory_id | Int | 外键 | ‘返仓表’,调拨id |
Goods_id | Int | 外键 | ‘商品表’,商品id |
Delivery_amount | Nchar | 返仓数量 | |
Delivery_repertory_place_id | Int | 外键 | ‘库存地点表’,发货部门库存地点 |
Take_delivery_repertory_place_id | Int | 外键 | ‘库存地点表’,收货部门库存地点 |
列名 | 数据类型 | 主键/外键 | 说明 |
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) | 仓库代码 |
列名 | 数据类型 | 主键/外键 | 说明 |
Stock_id | Int | 主键 | |
Repertory_place_id | Int | 外键 | ‘库存地点表’,库存地点 |
Goods_id | Int | ‘商品表’,商品 | |
Stock_quantity | Int | 库存数量 | |
Stock_toplimit | Int | 库存上限 | |
Stock_floor | Int | 库存下限 | |
Repertory_enter_detail_id | Int | 外键 | ‘进仓明细表’,进仓明细 |
列名 | 数据类型 | 主键/外键 | 说明 |
Department_id | Int | 主键 | |
Department_Farid | Int | 外键 | ‘部门表’,部门id |
Department_code | nchar(10) | 部门代码 | |
Department_name | nchar(10) | 部门名称 |
列名 | 数据类型 | 主键/外键 | 说明 |
Employee_id | Int | 主键 | |
Employee_number | nchar(12) | 员工号 | |
Employee_name | nchar(10) | 员工姓名 | |
Department_id | int | 外键 | ‘部门表’,部门名称 |
ID_number | nchar(18) | 身份证号 | |
Duties_id | int | 外键 | ‘职务表’,职务名称 |
Sex | bit | 性别 |
本教程仅供学习,禁止用于商业用途!
相关文章推荐
- 删除一张表里重复的记录
- TCP紧急数据
- DataGridView中的常用技巧
- JAVA 面向对象和集合知识点总结
- 第三章 44题
- C++ const关键字总结
- QT TableWidget应用笔记
- Android之窗口样式设置
- 网络攻防之SQL注入攻击
- 一个Linux中用于监控的简易shell脚本
- 简单工厂模式与抽象工厂模式
- 小程序之计算器 【C++ STL栈实现】 + 【C 数组模拟栈实现】 【适用VC, DEV, codeblack】
- 【leetcode】Unique Binary Search Trees II
- js小结(一)
- Call to localhost/127.0.0.1:9000 failed on connection exception:java.net.ConnectException
- 简单理解——面向切面编程(AOP)
- js递归实现包名转换成对应的json对象
- 随机梯度下降(Stochastic gradient descent)和 批量梯度下降(Batch gradient descent )的公式对比、实现对比
- AWSome Day(上海站)参会记录
- 理解JavaScript中的arguments,callee,caller,apply