using Model.ModelDto.DataDto; using Model.ModelDto.SysDto; using SqlSugar; using System; using System.Collections.Generic; using System.Text; using WMS.DAL; using WMS.Entity.Context; using WMS.Entity.DataEntity; using WMS.IBLL.IBllCheckServer; namespace WMS.BLL.BllCheckServer { public class WarehouseOutsidePalletsServer : DbHelper, IWarehouseOutsidePalletsServer { private static readonly SqlSugarScope Db = DataContext.Db; public WarehouseOutsidePalletsServer() : base(Db) { } /// /// 获取库外托盘信息列表 /// /// 物料号 /// 物料名称 /// 批次 /// 托盘号 /// public List GetPalletsOutside(string skuNo, string skuName, string lotNo, string palletNo, int page, int limit, out int count) { string sqlCount = "SELECT DISTINCT COUNT(DataStockDetail.ID) " + "FROM DataStockDetail " + "where IsDel = 0 and isnull(LocatNo,'') = '' and isnull(WareHouseNo,'') = '' "; string str = "select Id,LotNo,LotText,SupplierLot,SkuNo,SkuName,Standard,Qty,LockQty,FrozenQty,PalletNo," + "Status,InspectMark,BitPalletMark,InspectStatus " + "from DataStockDetail " + "where IsDel = @isdel and isnull(LocatNo,'') = @locatno and isnull(WareHouseNo,'') = @wareHouseNo"; //判断物料号是否为空 if (!string.IsNullOrEmpty(skuNo)) { str += " and SkuNo like @skuno"; } //判断物料名称是否为空 if (!string.IsNullOrEmpty(skuName)) { str += " and SkuName like @skuname"; } //判断批次是否为空 if (!string.IsNullOrEmpty(lotNo)) { str += " and LotNo like @lotno"; } //判断托盘号是否为空 if (!string.IsNullOrEmpty(palletNo)) { str += " and PalletNo like @palletno"; } //排序 str += " order by LotNo,SkuNo,PalletNo"; if (page == 0) { page = 1; } str += $" offset {((page - 1) * limit)} rows fetch next {limit} rows only;"; List mateDataStockDtos = Db.Ado.SqlQuery(str, new { isdel = "0", //是否删除 locatno = "", //储位地址 wareHouseNo = "", //仓库 skuno = skuNo, //物料号 skuname = skuName, // 物料名称 lotno = lotNo, //批次 palletno = palletNo //托盘号 }); var com = new Common(); count = com.GetRowCount(sqlCount); return mateDataStockDtos; } } }