From ee4806a4b2ec94ec63b4cb9b58447d9863baebe5 Mon Sep 17 00:00:00 2001 From: wxw <Administrator@DESKTOP-5BIMHQ3> Date: 星期四, 27 三月 2025 09:02:41 +0800 Subject: [PATCH] 修改问题 --- Wms/WMS.BLL/DataServer/StockDetailServer.cs | 153 +++++++++------------------------------------------ 1 files changed, 27 insertions(+), 126 deletions(-) diff --git a/Wms/WMS.BLL/DataServer/StockDetailServer.cs b/Wms/WMS.BLL/DataServer/StockDetailServer.cs index 9d629d2..f2f2563 100644 --- a/Wms/WMS.BLL/DataServer/StockDetailServer.cs +++ b/Wms/WMS.BLL/DataServer/StockDetailServer.cs @@ -38,146 +38,47 @@ /// <param name="bitBoxMark">闆剁鏍囪</param> /// <param name="inspectStatus">璐ㄩ噺鐘舵��</param> /// <returns></returns> - public List<StockDetailDto> GetBindList(string skuNo, string skuName, string palletNo, string lotNo, string boxNo, string status, string inspectMark, string bitPalletMark, string bitBoxMark, string inspectStatus, string ownerNo, string ownerName, string startTime, string endTime) + public List<StockDetailDto> GetBindList(string wareHouseName, string areaName, string locatNo, string palletNo, string lotNo) { - string str = "select detail.*,house.WareHouseNo + '-' + house.WareHouseName as WareHouseName,roadway.RoadwayNo + '-' + roadway.RoadwayName as RoadwayName,area.AreaNo + '-' + area.AreaName as AreaName from DataStockDetail detail left join SysStorageRoadway roadway on detail.RoadwayNo = roadway.RoadwayNo left join SysWareHouse house on detail.WareHouseNo = house.WareHouseNo left join SysStorageArea area on detail.AreaNo = area.AreaNo where detail.IsDel = @isdel"; - //鍒ゆ柇鐗╂枡鍙锋槸鍚︿负绌� - if (!string.IsNullOrEmpty(skuNo)) + string str = $@"select + detail.*, + house.WareHouseNo + '-' + house.WareHouseName as WareHouseName, + roadway.RoadwayNo + '-' + roadway.RoadwayName as RoadwayName, + area.AreaNo + '-' + area.AreaName as AreaName + from DataStockDetail detail + left join SysStorageRoadway roadway on detail.RoadwayNo = roadway.RoadwayNo + left join SysWareHouse house on detail.WareHouseNo = house.WareHouseNo + left join SysStorageArea area on detail.AreaNo = area.AreaNo + where detail.IsDel = '0'"; + + //鍒ゆ柇鎵�灞炰粨搴撴槸鍚︿负绌� + if (!string.IsNullOrEmpty(wareHouseName)) { - str += " and detail.SkuNo like @skuno"; + str += $" and (house.WareHouseNo like '%{wareHouseName}%' or house.WareHouseName like '%{wareHouseName}%')"; } - //鍒ゆ柇鐗╂枡鍚嶇О鏄惁涓虹┖ - if (!string.IsNullOrEmpty(skuName)) + //鍒ゆ柇鎵�灞炲尯鍩熸槸鍚︿负绌� + if (!string.IsNullOrEmpty(areaName)) { - str += " and detail.SkuName like @skuname"; + str += $" and (area.AreaNo like '%{areaName}%' or area.AreaName like '%{areaName}%')"; + } + //鍒ゆ柇鎵�灞炲偍浣嶆槸鍚︿负绌� + if (!string.IsNullOrEmpty(locatNo)) + { + str += $" and detail.LocatNo like '%{locatNo}%'"; } //鍒ゆ柇鎵樼洏鍙锋槸鍚︿负绌� if (!string.IsNullOrEmpty(palletNo)) { - str += " and detail.PalletNo like @palletno"; + str += $" and detail.PalletNo like '%{palletNo}%'"; } //鍒ゆ柇鎵规鏄惁涓虹┖ if (!string.IsNullOrEmpty(lotNo)) { - str += " and detail.LotNo like @lotno"; + str += $" and detail.LotNo like '%{lotNo}%'"; } - //鍒ゆ柇闆舵墭鏍囪鏄惁涓虹┖ - if (!string.IsNullOrEmpty(bitPalletMark)) - { - str += " and detail.BitPalletMark = @bitpalletmark"; - } - //鍒ゆ柇璐т富缂栫爜鏄惁涓虹┖ - if (!string.IsNullOrEmpty(ownerNo)) - { - str += " and detail.OwnerNo like @ownerNo"; - } - //鍒ゆ柇璐т富鍚嶇О鏄惁涓虹┖ - if (!string.IsNullOrEmpty(ownerName)) - { - str += " and detail.OwnerName like @ownerName"; - } - if (!string.IsNullOrEmpty(startTime)) - { - str += $" and detail.CompleteTime >= '{startTime}'"; - } - if (!string.IsNullOrEmpty(endTime)) - { - endTime = Convert.ToDateTime(endTime).AddDays(1).ToString(); - str += $" and detail.CompleteTime < '{endTime}'"; - } - - int i = 0; - //鍦ㄧ鐮佹槑缁嗕腑鑾峰彇鐩稿簲鏁版嵁 - string boxstr = "select StockDetailId from DataBoxInfo Where IsDel = @isdel"; - //鍒ゆ柇绠辩爜鏄惁涓虹┖ - if (!string.IsNullOrEmpty(boxNo)) - { - boxstr += " and BoxNo like @boxno"; - i = 1; - } - //鍒ゆ柇绠辨敮鐘舵�佹槸鍚︿负绌� - if (!string.IsNullOrEmpty(status)) - { - boxstr += " and Status = @status"; - i = 1; - } - //鍒ゆ柇妫�楠屾爣璁版槸鍚︿负绌� - if (!string.IsNullOrEmpty(inspectMark)) - { - boxstr += " and InspectMark = @inspectmark"; - str += " and detail.InspectMark = @inspectmark"; - i = 1; - } - //鍒ゆ柇闆剁鏍囪鏄惁涓虹┖ - if (!string.IsNullOrEmpty(bitBoxMark)) - { - boxstr += " and BitBoxMark = @bitboxmark"; - i = 1; - } - //鍒ゆ柇璐ㄩ噺鐘舵�佹槸鍚︿负绌� - if (!string.IsNullOrEmpty(inspectStatus)) - { - boxstr += " and InspectStatus = @inspectstatus"; - str += " and detail.InspectStatus = @inspectstatus"; - i = 1; - } - //灏嗙鐮佹暟鎹繘琛屾帓搴� - boxstr += " order by StockDetailId"; - //鏌ュ嚭绠辩爜鏄庣粏涓俊鎭� - List<int> stockDetailId = Db.Ado.SqlQuery<int>(boxstr, new - { - isdel = "0", //鏄惁鍒犻櫎 - boxno = "%" + boxNo + "%", //绠辩爜 - status, //绠辨敮鐘舵�� - inspectmark = inspectMark, //妫�楠屾爣璁� - bitboxmark = bitBoxMark, //闆剁鏍囪 - inspectstatus = inspectStatus //璐ㄩ噺鐘舵�� - }); - //鍘婚噸 - // List<int> newArr = null; - string arr = ""; - //鍒ゆ柇鏄惁鏈夋煡绠辩爜淇℃伅 - if (i == 1) - { - if (stockDetailId.Count > 0) - { - //鍘婚噸 - arr += stockDetailId[0].ToString(); - - for (int a = 1; a < stockDetailId.Count; a++) - { - if (stockDetailId[a] != stockDetailId[a - 1]) - { - arr += ',' + stockDetailId[a].ToString(); - } - } - } - if (!string.IsNullOrEmpty(arr)) - { - str += $" and Id in ({arr})"; - } - else - { - str += " and Id = ''"; - } - } - //鎺掑簭 - str += " order by PalletNo,SkuNo,LotNo"; - List<StockDetailDto> boxInforList = Db.Ado.SqlQuery<StockDetailDto>(str, new - { - isdel = "0", //鏄惁鍒犻櫎 - skuno = "%" + skuNo + "%", //鐗╂枡鍙� - skuname = "%" + skuName + "%", //鐗╂枡鍚嶇О - palletno = "%" + palletNo + "%", //鎵樼洏 - lotno = "%" + lotNo + "%", //鎵规鍙� - bitpalletmark = bitPalletMark, //闆舵墭鏍囪 - inspectmark = inspectMark, //妫�楠屾爣璁� - inspectstatus = inspectStatus, //璐ㄩ噺鐘舵�� - ownerNo = "%" + ownerNo + "%", //璐т富缂栫爜 - ownerName = "%" + ownerName + "%" //璐т富鍚嶇О - //stockdetailid = "(" + arr + ")" //搴撳瓨鏄庣粏id - }); + str += " order by PalletNo"; + List<StockDetailDto> boxInforList = Db.Ado.SqlQuery<StockDetailDto>(str).ToList(); return boxInforList; } -- Gitblit v1.8.0