using HslCommunication; using MailKit.Search; using SqlSugar; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using WIDESEA_Common.WareHouseEnum; using WIDESEA_Core; using WIDESEA_Core.BaseRepository; using WIDESEA_Core.BaseServices; using WIDESEA_Core.Helper; using WIDESEA_DTO.SquareCabin; using WIDESEA_IWMsInfoServices; using WIDESEA_Model.Models; using static WIDESEA_DTO.SquareCabin.TowcsDto; namespace WIDESEA_WMsInfoServices { public class InventoryInfoService : ServiceBase>, IInventoryInfoService { public InventoryInfoService(IRepository BaseDal) : base(BaseDal) { } public IRepository Repository => BaseDal; /// /// 获取库存 /// /// public WebResponseContent GetInventory() { WebResponseContent content = new WebResponseContent(); try { List lists = new List(); #region 冷冻库 string WareCodeLD = WarehouseEnum.冷冻库.ObjToInt().ToString("000"); List inventoryInfosLD = BaseDal.QueryData(x => x.WarehouseCode == WareCodeLD); object LDQty = new { name = WarehouseEnum.冷冻库.ObjToString(), count = inventoryInfosLD.Sum(x => x.StockQuantity).ObjToInt() }; lists.Add(LDQty); #endregion #region 麻精库 string WareCodeMJ = WarehouseEnum.麻精库.ObjToInt().ToString("000"); List inventoryInfosMJ = BaseDal.QueryData(x => x.WarehouseCode == WareCodeMJ); object MJQty = new { name = WarehouseEnum.麻精库.ObjToString(), count = inventoryInfosMJ.Sum(x => x.StockQuantity).ObjToInt() }; lists.Add(MJQty); #endregion #region 大件库 string WareCodeDJ = WarehouseEnum.大件库.ObjToInt().ToString("000"); List inventoryInfosDJ = BaseDal.QueryData(x => x.WarehouseCode == WareCodeDJ); object DJQty = new { name = WarehouseEnum.大件库.ObjToString(), count = inventoryInfosDJ.Sum(x => x.StockQuantity).ObjToInt() }; lists.Add(DJQty); #endregion content.OK(data: lists); } catch (Exception ex) { content.Error(ex.Message); } return content; } } }