MVC大型商贸系统(库存管理)技术解释(六)商品返仓

MVC大型商贸系统(库存管理)技术解释(六)商品返仓

1、  界面设计:

1.1、商品返仓处理

MVC大型商贸系统(库存管理)技术解释(六)商品返仓_第1张图片

1.2、商品返仓查询

MVC大型商贸系统(库存管理)技术解释(六)商品返仓_第2张图片

2、  代码:

2.1、商品返仓HTML代码:





    
    DealWithReturnRepertory
    
    
    
    
    
    
    
    
    
    


    
请输入要查询的编号:
记录编号 发货部门 收货部门 备注
商品代码 商品名称 商品条码 厂家条码否 包装含量 零售单价 规格型号 商品简称 PLN码 商品标记 复制记录否 合同号 生产厂家 产地 货号 计量单位 使用对象 商品花色 供应单位 商品商标 商品分类 保质期 进项税率 销项税率 统计比例 质地含量 质量等级 经营季节 允许销售否 产品状态 登记人 登记时间 审核人 审核时间 更新人 更新时间 零售单价 采购进价 自订货否 最小订货数
请输入商品名称/代码/条码查找:
编号 姓名 性别 所属部门 所任职务
编号 姓名 性别 所属部门 所任职务

2.2、商品返仓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() {
    $("
").css({ display: "block", width: "100%", height: $(document).height() }).appendTo("body"); $("
").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 "";//给删除列赋一张图片,并设置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) {//获取返回的一行数据
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) {
$("#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 = "
  1. 请选择收货部门!
";//给主窗体设置值 } } //选择实物付货人 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 = "
  1. 请选择发货部门!
";//同收货人 } } //创建返仓单号 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;
Producing_area_name: data['Producing_area_name'],
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 += "
  • 商品【" + rows[i].Goods_name + "】数据不完整
  • ";//拼接动态的列表 tem = false; } } if (count != rows.length) { parent.document.getElementById("labTips").innerHTML = "
      " + tips + "
    ";//设置‘提示新息’的内容 tem = false; } } else { tem = false; parent.document.getElementById("labTips").innerHTML = ""; parent.document.getElementById("labTips").innerHTML = "
    1. 未选择要调整的商品!
    "; } 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'],
    }
    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 = "
    1. 【" + number.trim() + "】
      修改成功!
    "; 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) {
    }
    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 = "
    1. " + number.trim() + "
      修改成功!
    "; } }); } //重新加载修改后的数据 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 += "
  • " + datas[i] + "
  • "; } ui.error('审核失败!
    详情请看【 相关提示】!', 2000, false); parent.document.getElementById("labTips").innerHTML = "
      " + tips + "
    "; } 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);
    return time;


     
       

    2.3、商品返仓查询HTML代码:

    SelectReturnRepertory

    2.4、商品返仓查询JavaScript代码:

    $(document).ready(function () {
    $("#wBuMenTiaoZheng").hide();
    $("#wBuMenTiaoZheng").fadeIn(500);
    $("#cobConsignmentDepartment").combotree({
    url: '/ReturnRepertory/GetAllDepartmentMessages',
    onSelect: function (data) {
    $.getJSON("/ReturnRepertory/GetSameRankDepartment?intDepartmentId=" + data.id, function (value) {
    $("#cboReceivingDepartment").combobox({ data: value, valueField: 'Department_id', textField: 'Department_name' });
    $("
    ").css({ display: "block", width: "100%", height: $(document).height() }).appendTo("body");
    }); } }); setTimeout("dynamicSelect();", 100); }); function AddRunningDiv() {
    $("
    ").html("正在加载,请稍候...").appendTo("body").css({ display: "block", left: ($(document.body).outerWidth(true) - 190) / 2, top: ($(document).height() - 45) / 2 });
    } //不定条件查询返仓单 function dynamicSelect() { $.getJSON("/ReturnRepertory/DynamicSelect?" + "strRecordNumber=" + $("#txtRecordNumber").val() + "&intCDepartmentId=" + $("#cobConsignmentDepartment").combotree("getValue") + "&intRDepartmentId=" + $("#cboReceivingDepartment").combobox("getValue") +
    function onRepertoryClick(value, data) {
    "&dtmStart=" + $("#dtmStart").datebox("getValue") + "&dtmEnd=" + $("#dtmEnd").datebox("getValue") + "&strRemarks=" + $("#txtRemarks").val() + "&bolReviewDeny=" + $("#check").prop("checked"), function (data) { $("#tbRepertory").datagrid("loadData", data); }); }
    $("#lstRDepartment").val(data1[0].Take_delivery_department.trim());
    $.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());
    $("#txtRecordNumber").val("");
    $("#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");
    $("#tbRepertory").datagrid("loadData", { total: 0, rows: [] });
    $("#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("");
    }
    $("#tbRepertoryDetails").datagrid("loadData", { total: 0, rows: [] });

    2.5、商品返仓Csharp-Controller代码:

    using System;
    using System.Collections.Generic;
    using System.Data;
    using System.Web.Mvc;
    using System.Text;
    namespace 大型商贸系统.Controllers
    using BLL_KuCunGuangLi; {
    public class ReturnRepertoryController : Controller
    { // // GET: /ReturnRepertory/
    #region 返仓处理
    readonly ReturnRepertory _myReturnRepertory = new ReturnRepertory(); #region 跳转到返仓处理
    #region 审核返仓单
    public ActionResult DealWithReturnRepertory() { return View(); } #endregion
    var stockIds = new List();//实例化int泛型对象
    public ActionResult ReviewReturnRepertory(int intReturnId) { StringBuilder msg = new StringBuilder();//实例化StringBuilder对象
    try
    var shipmentsQuantitys = new List();//实例化decimal泛型对象 DataTable srpDetails = _myReturnRepertory.GetRepertoryDetailsToReview(intReturnId);//查询返仓明细单 {
    string goodName = srpDetails.Rows[i]["Goods_name"].ToString();//获取商品名称
    for (int i = 0; i < srpDetails.Rows.Count; i++)//遍历明细表 { int goodsId = Convert.ToInt32(srpDetails.Rows[i]["Goods_id"]);//获取商品id
    DataTable sStock = _myReturnRepertory.SelectStock(goodsId, repertoryPlaceId);//根据商品id,和库存地点id查询库存记录
    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)
    {
    { decimal stockQuantity = Convert.ToDecimal(sStock.Rows[0]["Stock_quantity"]);//获取库存数量 int stockId = Convert.ToInt32(sStock.Rows[0]["Stock_id"]);//获取库存id if (stockQuantity > shipmentsQuantity)//判断库存数是否大于要配货数
    "】库存数为【" + stockQuantity +
    stockIds.Add(stockId); shipmentsQuantitys.Add(shipmentsQuantity); } else { msg.Append("商品【" + goodName +
    }
    "
    】,要出库数为【" + shipmentsQuantity + "】缺库存数为【" + (shipmentsQuantity - stockQuantity) + "】《");//如果库存不足,构建详细提示 } else {
    {
    msg.Append("商品【" + goodName + "】没有库存记录!《"); } } } catch (Exception) { msg.Append("该返仓单没有返仓明细数据!《"); } if (msg.ToString() != "") { msg.Append("审核失败,原因如下:《" + msg); } else int[] sk = stockIds.ToArray();//将泛型转换成数组
    public ActionResult ReloadReturnRepertory(int intReturnRepertoryId)
    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 修改后的重新加载 {
    int intReceive,
    DataTable dt = _myReturnRepertory.ReloadReturnRepertory(intReturnRepertoryId);//根据返仓id查询返仓明细 List> 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,
    return Json(i, JsonRequestBehavior.AllowGet);
    int intMakeBills, int intTransactor, DateTime dtmExecute, DateTime dtmMakeBills ) { int i = _myReturnRepertory.UpdateReturnRepertory( intReturnRepertoryId, strRecordNumber, intShipperId, intReceiverId, intSend, intReceive, strRemark, intMakeBills, intTransactor, dtmExecute, dtmMakeBills ); }
    return Json(list, JsonRequestBehavior.AllowGet);
    #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> list = ConvertHelperController.DtToList(dt); }
    List> list = ConvertHelperController.DtToList(dt);
    public ActionResult SelectRepertorysByBur(string strBur) { DataTable dt = _myReturnRepertory.SelectRepertorysByBur(strBur); List> 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 新增保存/修改明细
    return Json(id, JsonRequestBehavior.AllowGet);
    //保存返仓单 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]); } //保存返仓单明细
    _myReturnRepertory.UpdateReturnRepertoryDetail(intRepertoryDetailId, dcmShipmentsQuantity,
    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); }
    public ActionResult SelectRepertoryPlaceHarvest(int departmentId)
    //删除返仓明细 public void DeleteReturnRepertoryDetail1(int intRepertoryDetailId) { _myReturnRepertory.DeleteReturnRepertoryDetail1(intRepertoryDetailId); } #endregion #region 根据部门id获取员工 public ActionResult GetMakeBills(int intDepartmentId) { DataTable dt = _myReturnRepertory.GetMakeBills(intDepartmentId); List> list = ConvertHelperController.DtToList(dt); return Json(list, JsonRequestBehavior.AllowGet); } #endregion #region 根据收货部门查询发货库存地点 {
    public ActionResult TransformTotbSelectGoods(int goodsId)
    DataTable dt = _myReturnRepertory.SelectRepertoryPlaceHarvest(departmentId); List> list = ConvertHelperController.DtToList(dt); return Json(list, JsonRequestBehavior.AllowGet); } #endregion #region 根据发货部门查询发货库存地点 public ActionResult SelectRepertoryPlaceSend(int departmentId) { DataTable dt = _myReturnRepertory.SelectRepertoryPlaceSend(departmentId); List> list = ConvertHelperController.DtToList(dt); return Json(list, JsonRequestBehavior.AllowGet); } #endregion #region 根据商品id查询商品 {
    public ActionResult GoodsAllSelect(string strarry, int id = 0)
    DataTable dt = _myReturnRepertory.TransformTotbSelectGoods(goodsId); List> list = ConvertHelperController.DtToList(dt); return Json(list, JsonRequestBehavior.AllowGet); } #endregion #region 模糊查询商品 public ActionResult BlurSelectGoods(string strBlurMessage) { DataTable sdt = _myReturnRepertory.BlurSelectGoods(strBlurMessage); List> list = ConvertHelperController.DtToList(sdt); return Json(list, JsonRequestBehavior.AllowGet); } #endregion #region 获取全部商品信息 { DataTable dt = _myReturnRepertory.GoodsAllSelect(id);//如果id=0就查询全部商品,如果id!=0就根据商品id查询商品
    DataTable dt = _myReturnRepertory.DepartmentStaffSelectbyDepartmentId(intDepartment);
    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> shangPinXinXiAll = ConvertHelperController.DtToList(dt); return Json(shangPinXinXiAll, JsonRequestBehavior.AllowGet); } #endregion #region 根据部门ID查找部门员工 public ActionResult DepartmentStaffSelectbyDepartmentId(int intDepartment) {
    string prefixs = dt.Rows[0]["Prefixs"].ToString().Trim();//获取前缀
    List> yuanGong = ConvertHelperController.DtToList(dt); return Json(yuanGong, JsonRequestBehavior.AllowGet); } #endregion #region 获取全部返仓单 public ActionResult GetAllMessagersOfReturnRepertory() { DataTable dt = _myReturnRepertory.GetAllMessagersOfReturnRepertory(); List> 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查询返仓单单号日最大数
    DataTable dt = _myReturnRepertory.GetAllDepartmentMessages();//查询整张部门递归表
    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> list = ConvertHelperController.Child(dt); return Json(list, JsonRequestBehavior.AllowGet); } #endregion #region 获取部门名称拼接 public ActionResult GetDepartNames(int intFar) {
    DataTable dt = _myReturnRepertory.GetSameRankDepartment(intDepartmentId);
    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> list = ConvertHelperController.DtToList(dt); return Json(list, JsonRequestBehavior.AllowGet); } #endregion #endregion #region 返仓查询 public ActionResult SelectReturnRepertory() { return View(); } #region 绑定收货部门 public ActionResult GetSameRankDepartment(int intDepartmentId) {
    List> list = ConvertHelperController.DtToList(dt);
    List> 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);
    }
    return Json(list, JsonRequestBehavior.AllowGet); } #endregion #region 查询返仓单详细信息 public ActionResult GetRepertoryByRepertoryId(int intReturnRepertoryId) { DataTable dt = _myReturnRepertory.GetRepertoryByRepertoryId(intReturnRepertoryId); List> list = ConvertHelperController.DtToList(dt); return Json(list, JsonRequestBehavior.AllowGet); } #endregion #region 查询返仓明细 public ActionResult GetRepertoryDetailByRepertoryId(int intReturnRepertoryId) { DataTable dt = _myReturnRepertory.GetRepertoryDetailByRepertoryId(intReturnRepertoryId); List> list = ConvertHelperController.DtToList(dt); return Json(list, JsonRequestBehavior.AllowGet); } #endregion #endregion
    }

    2.6、商品返仓Csharp-Bll代码:

    using System.Data;
    using System.Data.SqlClient;
    using DALPublic;
    namespace BLL_KuCunGuangLi
    using System; {
    public class ReturnRepertory
    {
    private readonly DalMethod _myAal = new DalMethod();
    #region 获取全部返仓单
    {
    public DataTable GetAllMessagersOfReturnRepertory()
    new SqlParameter("@NB", SqlDbType.Char)
    SqlParameter[] sql = { };
    return _myAal.DAL_SelectDB_Par("Inventory_Control_ReturnRepertory", sql);
    sql[0].Value = "GetAllMessagersOfReturnRepertory"; } #endregion #region 创建返仓单号
    new SqlParameter("@NB", SqlDbType.Char),
    public DataTable GetOddNumbers(int intOddNumbersId) { SqlParameter[] sql = {
    return _myAal.DAL_SelectDB_Par("Update_Day_Max_Count", sql);
    new SqlParameter("@Odd_numbers_id", SqlDbType.Int) }; sql[0].Value = "GetOddNumbers"; sql[1].Value = intOddNumbersId; }
    new SqlParameter("@Day_max_quantity_id", SqlDbType.Int)
    public DataTable GetDayMaxCount(int dayMaxId) { SqlParameter[] sql = { new SqlParameter("@NB", SqlDbType.Char), }; sql[0].Value = "GetDayMaxCount";
    SqlParameter[] sql =
    sql[1].Value = dayMaxId; return _myAal.DAL_SelectDB_Par("Update_Day_Max_Count", sql); } #endregion #region 获取所以部门绑定 public DataTable GetAllDepartmentMessages() { {
    #region 获取部门归属
    new SqlParameter("@NB", SqlDbType.Char) }; sql[0].Value = "GetAllDepartmentMessages"; return _myAal.DAL_SelectDB_Par("Inventory_Control_ReturnRepertory", sql); } #endregion
    sql[0].Value = "GetConsignmentDepartmentAllByDepartmentId";
    public DataTable GetDepartNames(int intDepartmentFarId) { SqlParameter[] sql = { new SqlParameter("@NB", SqlDbType.Char), new SqlParameter("@Department_id", SqlDbType.Int) }; sql[1].Value = intDepartmentFarId;
    new SqlParameter("@NB", SqlDbType.Char),
    return _myAal.DAL_SelectDB_Par("Inventory_Control_ReturnRepertory", sql); } #endregion #region 根据发货部门绑定收货部门 public DataTable GetReceivingDepartmentByFarId(int intDepartmentFarId) { SqlParameter[] sql = { new SqlParameter("@Department_Farid", SqlDbType.Int) };
    {
    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 =
    public DataTable GoodsAllSelect(int id)
    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查询商品信息 {
    public DataTable BlurSelectGoods(string strBlurMessage)
    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 =
    public DataTable TransformTotbSelectGoods(int values)
    { 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 = {
    SqlParameter[] sql =
    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) { {
    {
    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 =
    new SqlParameter("@NB", SqlDbType.Char),
    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 = {
    DateTime dtmMakeBills)
    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, {
    new SqlParameter("@Make_bills_id", SqlDbType.Int),
    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),
    sql[8].Value = dtmMakeBills;
    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;
    new SqlParameter("@Goods_id", SqlDbType.Int),
    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),
    return _myAal.DAL_OPTableDB_Par("Inventory_Control_ReturnRepertory", sql);
    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 绑定返仓相关数据
    sql[0].Value = "SelectRepertorysByBur";
    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;
    public int DeleteReturnRepertory(int intReturnRepertoryId)
    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 = {
    new SqlParameter("@Return_repertory_detail_id", SqlDbType.Int),
    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),
    {
    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 =
    new SqlParameter("@NB", SqlDbType.Char),
    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 = {
    sql[0].Value = "UpdateReturnRepertory";
    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) };
    new SqlParameter("@Return_repertory_id", SqlDbType.Int)
    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), };
    public DataTable DynamicSelect(string strRecordNumber, int intCDepartmentId, int intRDepartmentId,
    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) {
    sql[6].Value = strRemarks;
    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;
    new SqlParameter("@NB", SqlDbType.Char),
    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 = {
    public void UpdateStock(int stockId, decimal shipmentsQuantity)
    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); } {
    return _myAal.DAL_SelectDB_Par("Inventory_Control_ReturnRepertory", sql);
    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)
    }
    { 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
    }

    2.7、商品返仓-SQL存储过程

    ALTER PROCEDURE [dbo].[Inventory_Control_ReturnRepertory]
    @NB char(200)='',@Department_id int=0,@Department_Farid int=0,@Goods_id int=0,@sql varchar(max)='',@BlurContent char(30)='',
    @Delivery_department_id int=0,@Take_delivery_department_id int=0,@Record_number nchar(20)='',@Return_repertory_detail_id int=0,
    @Shipper_id int=0,@Receiver_id int=0,@Remarks nchar(50)='',@Make_bills_id int=0,@Make_bills_time datetime='',
    @Executor_id int=0,@Execute_time datetime='',@Return_repertory_id int=0,@Delivery_amount int=0,@Delivery_repertory_place_id int=0,
    @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') --审核返仓单
    where Stock_id=@Stock_id
    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
    Return_repertory_detail.Delivery_amount
    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
    where Repertory_place_id=@Repertory_place_id and Goods_id=@Goods_id
    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
    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,
    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,
    Attribute_gather_detail.Attribute_gather_detail_name AS Goods_tab, Agreement.Contract_number, Manufacturer.Manufacturer_name, Goods_producing_area.Producing_area_name,
    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,
    (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)
    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
    Manufacturer ON Goods.Manufacturer_id = Manufacturer.Manufacturer_id INNER JOIN
    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
    Attribute_gather_detail AS Attribute_gather_detail_3 ON Goods.Goods_classify_pubid = Attribute_gather_detail_3.Attribute_gather_detail_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
    SELECT Return_repertory.Record_number, Department.Department_id, Department.Department_name AS Delivery_department, Department_1.Department_name AS Take_delivery_department,
    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
    Eemployee AS Eemployee_1 ON Return_repertory.Receiver_id = Eemployee_1.Employee_id INNER JOIN
    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
    if(@Record_number<>'')
    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)+''''
    Department.Department_name AS Take_delivery_department, Return_repertory.Delivery_department_id, Return_repertory.Take_delivery_department_id, Return_repertory.Receiver_id,
    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),
    Record_number =@Record_number, Shipper_id =@Shipper_id, Receiver_id =@Receiver_id, Remarks =@Remarks,
    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
    Attribute_gather_detail.Attribute_gather_detail_name AS Goods_Tab, Agreement.Contract_number, Manufacturer.Manufacturer_name, Goods_producing_area.Producing_area_name,
    --删除返仓单 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,
    Return_repertory_detail.Return_repertory_detail_id
    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
    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 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
    Department AS Department_1 ON Return_repertory.Delivery_department_id = Department_1.Department_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 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
    Eemployee AS Eemployee_1 ON Return_repertory.Receiver_id = Eemployee_1.Employee_id
    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
    Department ON Eemployee.Department_id = Department.Department_id
    (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
    Enterprise_name INNER JOIN
    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
    Manage_season ON Goods.Manage_season_id = Manage_season.Manage_season_id ON Eemployee.Employee_id = Goods.Registrant_id 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_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
    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,
    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,
    Attribute_gather_detail_5.Attribute_gather_detail_id = Goods.Product_status_pubid INNER JOIN
    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
    SELECT Department_name as name,Department_Farid as farid,Department_code as code
    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
    END
    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

    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

     

    审核否

    表1、

    列名

    数据类型

    主键/外键

    说明

    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

    外键

    ‘库存地点表’,收货部门库存地点

    表2、

    列名

    数据类型

    主键/外键

    说明

    Repertory_place_id

    Int

    主键

     

    Responsible_person_id

    Int

    外键

    ‘员工表’,仓管员

    Department_id

    Int

    外键

    ‘部门表’,部门id

    Repertory_place_name

    nchar(10)

     

    仓库名称

    Contact_way

    nchar(10)

     

    联系方式

    Address

    nchar(10)

     

    仓库地点

    Effective_deny

    Bit

     

    有效否

    Remarks

    nchar(10)

     

    备注

    Repertory_place_identifier

    nchar(10)

     

    仓库代码

    表3、

    列名

    数据类型

    主键/外键

    说明

    Stock_id

    Int

    主键

     

    Repertory_place_id

    Int

    外键

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

    Goods_id

    Int

     

    ‘商品表’,商品

    Stock_quantity

    Int

     

    库存数量

    Stock_toplimit

    Int

     

    库存上限

    Stock_floor

    Int

     

    库存下限

    Repertory_enter_detail_id

    Int

    外键

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

    表4

    列名

    数据类型

    主键/外键

    说明

    Department_id

    Int

    主键

     

    Department_Farid

    Int

    外键

    ‘部门表’,部门id

    Department_code

    nchar(10)

     

    部门代码

    Department_name

    nchar(10)

     

    部门名称

    表5

    列名

    数据类型

    主键/外键

    说明

    Employee_id

    Int

    主键

     

    Employee_number

    nchar(12)

     

    员工号

    Employee_name

    nchar(10)

     

    员工姓名

    Department_id

    int

    外键

    ‘部门表’,部门名称

    ID_number

    nchar(18)

     

    身份证号

    Duties_id

    int

    外键

    ‘职务表’,职务名称

    Sex 

    bit

     

    性别

    表6、
    MVC大型商贸系统(库存管理)技术解释(六)商品返仓_第3张图片

    本教程仅供学习,禁止用于商业用途!

    你可能感兴趣的:(MVC大型商贸系统(库存管理)技术解释(六)商品返仓)