From 89bef2fb48857f3b5c6170b388347d8529ca6297 Mon Sep 17 00:00:00 2001 From: wxw <Administrator@DESKTOP-5BIMHQ3> Date: 星期六, 12 七月 2025 11:14:47 +0800 Subject: [PATCH] 开发车间出入库记录页面 --- HTML/views/HouseWithinSetting/LogWorkShop.html | 445 ++++--------------------------------------------- Wms/Model/ModelVm/LogVm/LogWorkShopVm.cs | 6 Wms/WMS.IBLL/ILogServer/ILogWorkShopServer.cs | 4 Wms/Wms/Controllers/BllCheckController.cs | 2 Wms/Model/ModelDto/LogDto/LogWorkShopDto.cs | 7 Wms/WMS.BLL/LogServer/LogWorkShopServer.cs | 76 +++---- 6 files changed, 87 insertions(+), 453 deletions(-) diff --git a/HTML/views/HouseWithinSetting/LogWorkShop.html b/HTML/views/HouseWithinSetting/LogWorkShop.html index 3f76978..1f5abd7 100644 --- a/HTML/views/HouseWithinSetting/LogWorkShop.html +++ b/HTML/views/HouseWithinSetting/LogWorkShop.html @@ -34,6 +34,16 @@ <div class="layui-card"> <div class="layui-form layui-card-header layuiadmin-card-header-auto" id="top"> <div class="layui-form-item" style="margin-bottom: 0px;"> + <div class="layui-inline"> + <label class="layui-form-label">绫诲瀷</label> + <div class="layui-input-inline"> + <select name="Type" id="Type" lay-filter="Type" lay-search> + <option value=""></option> + <option value="0">鍏ュ簱</option> + <option value="1">鍑哄簱</option> + </select> + </div> + </div> <div class="layui-inline zongdan"> <label class="layui-form-label" style="width: 60px;">鐗╂枡缂栫爜</label> <div class="layui-input-inline" style="width: 170px; margin-right: 0px;"> @@ -79,84 +89,30 @@ lay-filter="LAY-app-contlist-search"> <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>鎼滅储 </button> - <button class="layui-btn layui-btn-sm layuiadmin-btn-list" lay-submit lay-filter="daochu"> - <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>瀵煎嚭 - </button> </div> </div> </div> - + <div id="center"></div> <div class="layui-card-body"> <div style="position: relative;"> - <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief"> - <ul class="layui-tab-title" id="tab"> - <li class="layui-this">鎵樼洏鏄庣粏</li> - <li>绠辩爜鏄庣粏</li> - </ul> - - <div id="center"> + <div class="position-relative"><!-- class="position-relative" --><!-- 鑷畾涔夎〃澶村姞涓� --> + <table id="LAY-app-content-list" lay-filter="LAY-app-content-list"></table> + <!-- #region 鑷畾涔夎〃澶� --> + <div class="headerSetIcon"> + <button class="layui-btn layui-btn-primary layui-btn-sm" data-type="customCols"> + <i class="layui-icon"></i> + </button> </div> - - <div class="layui-tab-content"> - <div class="layui-tab-item layui-show"> - <div class="position-relative"><!-- class="position-relative" --><!-- 鑷畾涔夎〃澶村姞涓� --> - <table id="LAY-app-content-list" lay-filter="LAY-app-content-list"></table> - <!-- #region 鑷畾涔夎〃澶� --> - <div class="headerSetIcon"> - <button class="layui-btn layui-btn-primary layui-btn-sm" data-type="customCols"> - <i class="layui-icon"></i> - </button> - </div> - <!-- #endregion --> - </div> - </div> - <div class="layui-tab-item"> - <div class="position-relative"><!-- class="position-relative" --><!-- 鑷畾涔夎〃澶村姞涓� --> - <table id="LAY-app-content-list2" lay-filter="LAY-app-content-list2"></table> - <!-- #region 鑷畾涔夎〃澶� --> - <div class="headerSetIcon"> - <button class="layui-btn layui-btn-primary layui-btn-sm" - data-type="customCols2"> - <i class="layui-icon"></i> - </button> - </div> - <!-- #endregion --> - - <!-- #region 鑷畾涔夎〃澶� --> - <script type="text/html" id="templetProductionTime"> - {{# function GetBtn(d){ - return formatDate2(d.ProductionTime); - } - }} - {{ GetBtn(d) }} - </script> - <script type="text/html" id="templetExpirationTime"> - {{# function GetBtn(d){ - return formatDate2(d.ExpirationTime); - } - }} - {{ GetBtn(d) }} - </script> - - <script type="text/html" id="templetInspectTime"> - {{# function GetBtn1(d){ - return formatDate(d.InspectTime); - } - }} - {{ GetBtn1(d) }} - </script> - <!-- #endregion --> - </div> - </div> - </div> + <!-- #endregion --> </div> </div> <script type="text/html" id="TypeTpl"> {{# if(d.Type=='0'){ }} - <button class="layui-btn layui-btn-radius layui-btn-danger layui-btn-xs">鍏ュ簱</button> + <button class="layui-btn layui-btn-radius layui-btn-xs">鍏ュ簱</button> + {{# } else if(d.Type == '1') { }} - <button class="layui-btn layui-btn-radius layui-btn-xs">鍑哄簱</button> + <button class="layui-btn layui-btn-radius layui-btn-danger layui-btn-xs">鍑哄簱</button> {{# } }} </script> @@ -182,7 +138,7 @@ element = layui.element; laydate = layui.laydate; - var h1 = GetTableTabHeight(); + var h1 = GetTableHeight(); // var h1 = GetTkableTopHeight(); // console.log(h1) @@ -221,22 +177,22 @@ }; var $ = layui.$; - var yemianid = 0; - refreshTable("", "", "", "", "", "", "", "", "", "", "", "", "", ""); + refreshTable("", "", "", "", "", ""); // 琛ㄥ崟闇�瑕佺殑鍙橀噺 var infoOptions; //#region 鑷畾涔夎〃澶� var TotalColsArr = [[ { field: '', title: '搴忓彿', type: 'numbers', align: 'center', fixed: 'left', "disabled": true }, - { field: 'Type', title: '鍏ュ簱/鍑哄簱', align: 'center', templet: '#TypeTpl', width: 90, }, - { field: 'PalletNo', title: '鎵樼洏鍙�', align: 'center', width: 100, }, - { field: 'SkuNo', title: '鐗╂枡缂栫爜', align: 'center', width: 120, }, - { field: 'SkuName', title: '鐗╂枡鍚嶇О', align: 'center', width: 120, }, - { field: 'LotNo', title: '鎵规鍙�', align: 'center', width: 100, }, - { field: 'Qty', title: '鏁伴噺', align: 'center', width: 90, }, - { field: 'CreateUserName', title: '鎿嶄綔浜�', align: 'center', width: 100, }, - { field: 'CreateTime', title: '鎿嶄綔鏃堕棿', align: 'center', width: 100, }, + { field: 'Type', title: '绫诲瀷', align: 'center', templet: '#TypeTpl'}, + { field: 'PalletNo', title: '鎵樼洏鍙�', align: 'center'}, + { field: 'SkuNo', title: '鐗╂枡缂栫爜', align: 'center' }, + { field: 'SkuName', title: '鐗╂枡鍚嶇О', align: 'center'}, + { field: 'LotNo', title: '鎵规鍙�', align: 'center'}, + { field: 'BoxNo', title: '绠辩爜', align: 'center'}, + { field: 'Qty', title: '鏁伴噺', align: 'center'}, + { field: 'CreateUserName', title: '鎿嶄綔浜�', align: 'center' }, + { field: 'CreateTime', title: '鎿嶄綔鏃堕棿', align: 'center' }, ]]; var TotalColsSysArr = encodeURIComponent(encodeURIComponent(JSON.stringify(TotalColsArr)))//灏嗚〃澶存暟鎹繘琛寀rl缂栫爜 //#endregion @@ -278,6 +234,7 @@ SkuName: SkuName, //鐗╂枡鍚嶇О palletNo: PalletNo, //鎵樼洏鍙� LotNo: LotNo, //鎵规鍙� + BoxNo:BoxNo,//绠辩爜 Type: Type, //绫诲瀷 }; sendData(IP + "/BllCheck/GetLogWorkShopList", param, 'post', function (res) { @@ -303,111 +260,6 @@ //#endregion } - // 琛ㄥ崟闇�瑕佺殑鍙橀噺 - var infoOptions2; - - //鑾峰彇鏄庣粏淇℃伅 - //#region 鑷畾涔夎〃澶� - var DetailColsArr = [[ - { field: '', title: '搴忓彿', type: 'numbers', fixed: 'left', "disabled": true }, - { field: 'SkuNo', title: '鐗╂枡缂栫爜', align: 'center' }, - { field: 'SkuName', title: '鐗╂枡鍚嶇О', align: 'center' }, - { field: 'PalletNo', title: '鎵樼洏鍙�', align: 'center', width: 110 }, - { field: 'BoxNo', title: '绠辩爜', align: 'center', width: 100 }, - { field: 'Status', title: '绠辨敮鐘舵��', align: 'center', templet: '#BoxStatus' }, - { field: 'LotNo', title: '鎵规鍙�', align: 'center' }, - { field: 'LotText', title: '鎵规鎻忚堪', align: 'center' }, - { field: 'Qty', title: '鏁伴噺', width: 90, align: 'center' }, - { field: 'FullQty', title: '鏁寸鏁伴噺', width: 100, align: 'center' }, - { field: 'ProductionTime', title: '鐢熶骇鏃ユ湡', align: 'center', templet: '#templetProductionTime' }, - { field: 'ExpirationTime', title: '鏈夋晥鏈�', align: 'center', templet: '#templetExpirationTime' }, - { field: 'InspectMark', title: '鎶芥鏍囪', align: 'center', templet: '#InspectMarkStatus' }, - { field: 'BitBoxMark', templet: '#BitPalletMarkStatus1', title: '闆剁鏍囪', align: 'center' }, - { field: 'InspectStatus', templet: '#InspectStatus1', title: '璐ㄦ鐘舵��', align: 'center' }, - { field: 'InspectTime', title: '澶嶆鏃堕棿', align: 'center', templet: '#templetInspectTime' }, - { field: 'caozuo', title: '鎿嶄綔', fixed: 'right', align: 'center', toolbar: '#table-content-list', "disabled": true } - ]]; - var DetailColsSysArr = encodeURIComponent(encodeURIComponent(JSON.stringify(DetailColsArr)))//灏嗚〃澶存暟鎹繘琛寀rl缂栫爜 - //#endregion - function refreshTable2(Id, SkuNo, SkuName, LotNo, PalletNo, BoxNo, Status, InspectMark, BitBoxMark, InspectStatus, - StartTime, EndTime, WareHouseNo, AreaNo) { - //#region 鑷畾涔夎〃澶� - var colsJson2 - var param1 = { - Href: 'Statistical/GetBoxInfo' - }; - sendData(IP + "/Sys/GetTableColsByUserId", param1, 'post', function (res) { - if (res.code == 0) { - if (res.data == '' || res.data == undefined || res.data == null) { - colsJson2 = DetailColsArr - } else { - colsJson2 = eval(res.data); - } - } else { - colsJson2 = DetailColsArr - } - infoOptions2 = { - elem: '#LAY-app-content-list2', - height: h1, - id: 'LAY-app-content-list2', - page: true, - limit: pageCnt, - limits: pageLimits, - even: true, - cellMinWidth: 80, //鍏ㄥ眬瀹氫箟甯歌鍗曞厓鏍肩殑鏈�灏忓搴︼紝layui 2.2.1 鏂板 - done: function () { - //鑷畾涔夊垪瀹� - SetTableColW('LAY-app-content-list2', 'Statistical/GetBoxInfo', DetailColsSysArr); - }, - cols: colsJson2 - }; - - var param = { - Id: Id, - SkuNo: SkuNo, - SkuName: SkuName, - LotNo: LotNo, - PalletNo: PalletNo, - BoxNo: BoxNo, - Status: Status, - InspectMark: InspectMark, - BitBoxMark: BitBoxMark, - InspectStatu: InspectStatus, - StartTime: StartTime, - EndTime: EndTime, - WareHouseNo: WareHouseNo, - AreaNo: AreaNo, - } - sendData(IP + "/Statistical/GetBoxInfo", param, 'get', function (res) { - if (res.code == 0) //鎴愬姛 - { - var list = res.data; - $.extend(infoOptions2, { - data: list - }); - infoOptions2.page = { - curr: 1 - } - tableIns2 = table.render(infoOptions2); - } - else //涓嶆垚鍔� - { - layer.msg('鑾峰彇鏄庣粏鍒楄〃淇℃伅澶辫触锛�', { - icon: 2, - time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 - }, function () { }); - } - }) - }); - //#endregion - } - - //var url = IP + "/Statistical/GetInventoryList1"; - - - - //鎺ュ彈鍏ㄥ眬鍙橀噺 - let quanid = ''; //鐩戝惉鎼滅储 form.on('submit(LAY-app-contlist-search)', function (data) { var SkuNo = $("#SkuNo").val(); @@ -416,233 +268,12 @@ var PalletNo = $("#PalletNo").val(); var BoxNo = $("#BoxNo").val(); - var Status = $("#Status").val(); - var InspectMark = $("#InspectMark").val(); - var BitPalletMark = $("#BitPalletMark").val(); - var BitBoxMark = $("#BitBoxMark").val(); - var InspectStatus = $("#InspectStatus").val(); + var Type = $("#Type").val(); + - var OwnerNo = $("#OwnerNo").val(); - var OwnerName = $("#OwnerName").val(); - - var StartTime = $("#StartTime").val(); - var EndTime = $("#EndTime").val(); - var WareHouseNo = $("#WareHouseNo").val(); - var AreaNo = $("#AreaNo").val(); - - if (yemianid == 0) { - console.log("鎬诲崟"); - refreshTable(SkuNo, SkuName, PalletNo, LotNo, BoxNo, Status, InspectMark, BitPalletMark, BitBoxMark, - InspectStatus, OwnerNo, OwnerName, StartTime, EndTime, WareHouseNo, AreaNo); - } else if (yemianid == 1) { - quanid = ''; - console.log("鏄庣粏"); - refreshTable2(quanid, SkuNo, SkuName, LotNo, PalletNo, BoxNo, Status, InspectMark, BitBoxMark, - InspectStatus, StartTime, EndTime, WareHouseNo, AreaNo); - } - + refreshTable(SkuNo, SkuName, PalletNo, LotNo, BoxNo, Type); }); - //瑙﹀彂琛屽弻鍑讳簨浠� - table.on('rowDouble(LAY-app-content-list)', function (obj) { - $(".layui-tab-title>li").attr("class", ""); - $('.layui-tab-title>li').eq(1).attr('class', 'layui-this'); - $('.layui-tab-content .layui-tab-item').attr('class', 'layui-tab-item') - $('.layui-tab-content .layui-tab-item').eq(1).attr('class', 'layui-tab-item layui-show') - console.log(obj.data.Id); - quanid = obj.data.Id; - refreshTable2(obj.data.Id); - yemianid = 1; - }); - - //鐩戝惉Tab鍒囨崲锛屼互鏀瑰彉鍦板潃hash鍊� - element.on('tab(docDemoTabBrief)', function (data) { - var SkuNo = $("#SkuNo").val(); - var SkuName = $("#SkuName").val(); - var LotNo = $("#LotNo").val(); - var PalletNo = $("#PalletNo").val(); - - var BoxNo = $("#BoxNo").val(); - var Status = $("#Status").val(); - var InspectMark = $("#InspectMark").val(); - var BitPalletMark = $("#BitPalletMark").val(); - var BitBoxMark = $("#BitBoxMark").val(); - var InspectStatus = $("#InspectStatus").val(); - - var OwnerNo = $("#OwnerNo").val(); - var OwnerName = $("#OwnerName").val(); - - var StartTime = $("#StartTime").val(); - var EndTime = $("#EndTime").val(); - - console.log(data.index); - yemianid = data.index - if (yemianid == 0) { - console.log("鎬诲崟"); - refreshTable(SkuNo, SkuName, PalletNo, LotNo, BoxNo, Status, InspectMark, BitPalletMark, BitBoxMark, InspectStatus, OwnerNo, OwnerName, StartTime, EndTime); - } else if (yemianid == 1) { - console.log("鏄庣粏"); - refreshTable2(quanid, SkuNo, SkuName, LotNo, PalletNo, BoxNo, Status, InspectMark, BitBoxMark, InspectStatus, StartTime, EndTime); - } - }); - var doing = true; - // ------------------------------------璇︽儏--------------------------------------------------- - table.on('tool(LAY-app-content-list2)', function (obj) { - console.log(obj) - var data = obj.data; - //璇︽儏 - if (obj.event === 'edit') { - BoxNo = data.BoxNo; - console.log(data) - layer.open({ - type: 2, - title: '绠辨敮璇︽儏淇℃伅', - content: 'BoxSupportInfor.html?BoxNo=' + BoxNo, - maxmin: true, - area: ['80%', '85%'], - btn: ['鍏抽棴'], - yes: function (index, layero) { - var iframeWindow = window['layui-layer-iframe' + index], - submitID = 'layuiadmin-app-form-edit', - submit = layero.find('iframe').contents().find('#' + submitID); - if (doing) { - doing = false; - - layer.close(index); //鍏抽棴寮瑰眰 - refreshTable(); - doing = true; - - - } - } - }); - } - }); - - form.on('submit(daochu)', function () { - layer.confirm('纭畾瀵煎嚭褰撳墠鏁版嵁鍚楋紵', function (index) { - if (yemianid == 0) { - console.log("鎵樼洏鏄庣粏"); - var param = { - SkuNo: $("#SkuNo").val(), - SkuName: $("#SkuName").val(), - LotNo: $("#LotNo").val(), - PalletNo: $("#PalletNo").val(), - - BoxNo: $("#BoxNo").val(), - Status: $("#Status").val(), - InspectMark: $("#InspectMark").val(), - BitPalletMark: $("#BitPalletMark").val(), - BitBoxMark: $("#BitBoxMark").val(), - InspectStatus: $("#InspectStatus").val(), - - StartTime: $("#StartTime").val(), - EndTime: $("#EndTime").val(), - }; - - sendData(IP + "/Statistical/GetBindListDaoChu", param, 'get', function (res) { - console.log(res); - if (res.code == 0) { //鎴愬姛 - var list = res.data; - table.exportFile(tableIns.config.id, list, 'xls', "鎵樼洏鏄庣粏淇℃伅" + getNowTime(),); //data 涓鸿瀹炰緥涓殑浠绘剰鏁伴噺鐨勬暟鎹� - layer.msg('瀵煎嚭鎴愬姛锛�', { - icon: 1, - time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 - }, function () { - - }); - - } else { //涓嶆垚鍔� - layer.msg('鑾峰彇淇℃伅澶辫触锛�', { - icon: 2, - time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 - }, function () { }); - } - }); - } else if (yemianid == 1) { - console.log("绠辩爜鏄庣粏"); - var param = { - Id: quanid, - SkuNo: $("#SkuNo").val(), - SkuName: $("#SkuName").val(), - LotNo: $("#LotNo").val(), - LocatNo: $("#LocatNo").val(), - PalletNo: $("#PalletNo").val(), - Status: $("#Status").val(), - InspectStatus: $("#InspectStatus").val(), - IsSamolingTray: $("#IsSamolingTray").val(), - StartTime: $("#StartTime").val(), - EndTime: $("#EndTime").val(), - }; - sendData(IP + "/Statistical/GetBoxInfoDaoChu", param, 'get', function (res) { - console.log(res); - if (res.code == 0) { //鎴愬姛 - var list = res.data; - table.exportFile(tableIns2.config.id, list, 'xls', "绠辩爜鏄庣粏淇℃伅" + getNowTime(),); //data 涓鸿瀹炰緥涓殑浠绘剰鏁伴噺鐨勬暟鎹� - layer.msg('瀵煎嚭鎴愬姛锛�', { - icon: 1, - time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 - }, function () { - - }); - - } else { //涓嶆垚鍔� - layer.msg('鑾峰彇淇℃伅澶辫触锛�', { - icon: 2, - time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 - }, function () { }); - } - }); - } - }); - - - }); - - - //鑾峰彇浠撳簱涓嬫媺妗嗕俊鎭� - sendData(IP + "/Sys/GetWarehouseDic", {}, 'get', function (res) { - if (res.code == 0) { //鎴愬姛 - for (var i = 0; i < res.data.length; i++) { - $("#WareHouseNo").append('<option value =' + res.data[i].WareHouseNo + '>' + res.data[i].WareHouseNo + '-' + - res.data[i].WareHouseName + '</option>'); - } - form.render('select'); - } else { //涓嶆垚鍔� - layer.msg(res.msg, { - icon: 2, - time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 - }, function () { }); - } - }); - - getAR(""); - form.on('select(getWareHouseNo)', function (data) { - console.log(data); - getAR(data.value); - }); - function getAR(val) { - //鑾峰彇 鍖哄煙涓嬫媺妗� - sendData(IP + "/Sys/GetStorageAreaByHouseNo?wareHouseNo=" + val, {}, 'get', function (res) { - $("#AreaNo").empty(); - $("#AreaNo").append('<option value =""></option>'); - if (res.code == 0) { //鎴愬姛 - for (var i = 0; i < res.data.length; i++) { - $("#AreaNo").append('<option value =' + res.data[i].AreaNo + '>' + res.data[i].AreaNo + '-' + - res.data[i].AreaName + '</option>'); - } - form.render('select'); - } else { //涓嶆垚鍔� - layer.msg('鑾峰彇鍖哄煙淇℃伅澶辫触', { - icon: 2, - time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 - }, function () { - //鍥炶皟 - form.render('select'); - }); - } - }); - - }; + //#region 鑷畾涔夎〃澶� //鑷畾涔夎〃澶� diff --git a/Wms/Model/ModelDto/LogDto/LogWorkShopDto.cs b/Wms/Model/ModelDto/LogDto/LogWorkShopDto.cs index d998669..bed85f7 100644 --- a/Wms/Model/ModelDto/LogDto/LogWorkShopDto.cs +++ b/Wms/Model/ModelDto/LogDto/LogWorkShopDto.cs @@ -21,6 +21,13 @@ public string PalletNo { get; set; } /// <summary> + /// Desc:绠辩爜 + /// Default: + /// Nullable:True + /// </summary> + public string BoxNo { get; set; } + + /// <summary> /// Desc:鎵规鍙� /// Default: /// Nullable:True diff --git a/Wms/Model/ModelVm/LogVm/LogWorkShopVm.cs b/Wms/Model/ModelVm/LogVm/LogWorkShopVm.cs index 4177034..2e774b8 100644 --- a/Wms/Model/ModelVm/LogVm/LogWorkShopVm.cs +++ b/Wms/Model/ModelVm/LogVm/LogWorkShopVm.cs @@ -40,5 +40,11 @@ /// Nullable:True /// </summary> public string SkuName { get; set; } + /// <summary> + /// Desc:绠辩爜 + /// Default: + /// Nullable:True + /// </summary> + public string BoxNo { get; set; } } } diff --git a/Wms/WMS.BLL/LogServer/LogWorkShopServer.cs b/Wms/WMS.BLL/LogServer/LogWorkShopServer.cs index c6ad64c..4225d22 100644 --- a/Wms/WMS.BLL/LogServer/LogWorkShopServer.cs +++ b/Wms/WMS.BLL/LogServer/LogWorkShopServer.cs @@ -2,11 +2,14 @@ using SqlSugar; using System; using System.Collections.Generic; +using System.Linq.Expressions; using System.Text; +using System.Threading.Tasks; using WMS.DAL; using WMS.Entity.Context; using WMS.Entity.DataEntity; using WMS.Entity.LogEntity; +using WMS.Entity.SysEntity; using WMS.IBLL.IBllCheckServer; using WMS.IBLL.ILogServer; @@ -19,54 +22,39 @@ { } - public List<LogWorkShopDto> GetLogWorkShopList(string type, string palletNo,string lotNo,string skuNo,string skuName,int page, int limit, out int count) + public List<LogWorkShopDto> GetLogWorkShopList(string type, string palletNo,string lotNo,string skuNo,string skuName,string boxNo,int page, int limit, out int count) { try { - string sqlString = string.Empty; - string sqlCount = string.Empty; - string sqlPub = string.Empty; - sqlCount += "SELECT COUNT(tb1.ID) FROM LogWorkShop AS tb1 "; - sqlString += $@"select - tb1.Type,tb1.PalletNo,tb1.LotNo,tb1.SkuNo,tb1.SkuName,tb1.CreateUser,tb1.CreateTime,SUM(tb1.Qty) as Qty,tb2.RealName as CreateUserName - from LogWorkShop as tb1 - left join SysUserInfor as tb2 on tb1.CreateUser=tb2.Id "; - sqlPub += $"where 1=1 "; + Expression<Func<LogWorkShop, bool>> item = Expressionable.Create<LogWorkShop>() + .AndIF(!string.IsNullOrWhiteSpace(type), it => it.Type == type) + .AndIF(!string.IsNullOrWhiteSpace(palletNo), it => it.PalletNo.Contains(palletNo.Trim())) + .AndIF(!string.IsNullOrWhiteSpace(lotNo), it => it.LotNo.Contains(lotNo.Trim())) + .AndIF(!string.IsNullOrWhiteSpace(skuNo), it => it.SkuNo.Contains(skuNo.Trim())) + .AndIF(!string.IsNullOrWhiteSpace(skuName), it => it.SkuName.Contains(skuName.Trim())) + .AndIF(!string.IsNullOrWhiteSpace(boxNo), it => it.BoxNo.Contains(boxNo.Trim())) + .ToExpression();//娉ㄦ剰 杩欎竴鍙� 涓嶈兘灏� - if (!string.IsNullOrEmpty(type)) - { - sqlPub += $"AND tb1.Type = '{type}' "; - } - if (!string.IsNullOrEmpty(palletNo)) - { - sqlPub += $"AND tb1.PalletNo like '%{palletNo.Trim()}%' "; - } - if (!string.IsNullOrEmpty(lotNo)) - { - sqlPub += $"AND tb1.LotNo like '%{lotNo.Trim()}%' "; - } - if (!string.IsNullOrEmpty(skuNo)) - { - sqlPub += $"AND tb1.SkuNo like '%{skuNo.Trim()}%' "; - } - if (!string.IsNullOrEmpty(skuName)) - { - sqlPub += $"AND tb1.SkuName like '%{skuName.Trim()}%' "; - } - sqlPub += " group by tb1.Type,tb1.PalletNo,tb1.LotNo,tb1.SkuNo,tb1.SkuName,tb1.CreateUser,tb1.CreateTime "; - sqlCount += sqlPub; - if (page == 0) - { - page = 1; - } - sqlString += sqlPub + $" offset {((page - 1) * limit)} rows fetch next {limit} rows only;"; - - var com = new Common(); - count = com.GetRowCount(sqlCount); - - var modelList = Db.Ado.SqlQuery<LogWorkShopDto>(sqlString); - - return modelList; + var total = 0; + var data = GetAllWhereAsync(item) + .LeftJoin<SysUserInfor>((a, b) => a.CreateUser == b.Id) + .Select((a, b) => new LogWorkShopDto() + { + PalletNo = a.PalletNo, + SkuNo = a.SkuNo, + SkuName = a.SkuName, + LotNo = a.LotNo, + Qty = a.Qty, + Type = a.Type, + BoxNo = a.BoxNo, + CreateUserName = b.RealName, + CreateTime = a.CreateTime.ToString("yyyy-MM-dd HH:mm:ss") + }) + .OrderByDescending(a => a.CreateTime) + .ToOffsetPage(page, limit, ref total); + count = total; + + return data; } catch (Exception e) { diff --git a/Wms/WMS.IBLL/ILogServer/ILogWorkShopServer.cs b/Wms/WMS.IBLL/ILogServer/ILogWorkShopServer.cs index defce54..7388f4d 100644 --- a/Wms/WMS.IBLL/ILogServer/ILogWorkShopServer.cs +++ b/Wms/WMS.IBLL/ILogServer/ILogWorkShopServer.cs @@ -1,12 +1,14 @@ 锘縰sing Model.ModelDto.LogDto; +using SqlSugar; using System; using System.Collections.Generic; using System.Text; +using System.Threading.Tasks; namespace WMS.IBLL.ILogServer { public interface ILogWorkShopServer { - List<LogWorkShopDto> GetLogWorkShopList(string type, string palletNo, string lotNo, string skuNo, string skuName, int page, int limit, out int count); + List<LogWorkShopDto> GetLogWorkShopList(string type, string palletNo, string lotNo, string skuNo, string skuName, string boxNo, int page, int limit, out int count); } } diff --git a/Wms/Wms/Controllers/BllCheckController.cs b/Wms/Wms/Controllers/BllCheckController.cs index 656f107..a68b92a 100644 --- a/Wms/Wms/Controllers/BllCheckController.cs +++ b/Wms/Wms/Controllers/BllCheckController.cs @@ -373,7 +373,7 @@ { try { - var _list = _logWorkShop.GetLogWorkShopList(model.Type, model.PalletNo, model.LotNo, model.SkuNo, model.SkuName, model.Page, model.Limit, out int count); + var _list = _logWorkShop.GetLogWorkShopList(model.Type, model.PalletNo, model.LotNo, model.SkuNo, model.SkuName,model.BoxNo, model.Page, model.Limit, out int count); return Ok(new { code = 0, count = count, msg = "鑾峰彇杞﹂棿鍑哄叆搴撹褰�", data = _list }); } -- Gitblit v1.8.0