using Admin.NET.Core.Service; using Admin.NET.Application.Entity; using Microsoft.AspNetCore.Http; using System.Data; using System.Web; using System.Text; using DocumentFormat.OpenXml.Office.CustomUI; using Microsoft.CodeAnalysis.Operations; using Admin.NET.Application.Service.WmsTask.WmsRbLineTask.Dto; namespace Admin.NET.Application; /// /// 通用查询服务 /// [ApiDescriptionSettings(ApplicationConst.WmsCommonnQueryGroupName, Order = 100)] [AllowAnonymous] public class WmsCommonnQueryService : IDynamicApiController, ITransient { private readonly SqlSugarRepository _rep; private readonly SqlSugarRepository _wmsStockQuanRep; private readonly SqlSugarRepository _mesPackageGatherRep; private readonly SqlSugarRepository _sysConfigRep; private readonly SqlSugarRepository _mesBatchOrderUpiRep; private readonly SqlSugarRepository _mesOrderGatherRep; public WmsCommonnQueryService(SqlSugarRepository rep, SqlSugarRepository wmsStockQuanRep , SqlSugarRepository mesPackageGatherRep , SqlSugarRepository sysConfigRep , SqlSugarRepository mesBatchOrderUpiRep , SqlSugarRepository mesOrderGatherRep ) { _sysConfigRep = sysConfigRep; _mesPackageGatherRep = mesPackageGatherRep; _rep = rep; _wmsStockQuanRep = wmsStockQuanRep; _mesBatchOrderUpiRep = mesBatchOrderUpiRep; _mesOrderGatherRep = mesOrderGatherRep; } /// /// 查询不齐套单据 /// /// /// [HttpGet] [ApiDescriptionSettings(Name = "QueryNoKittingList")] [Description("WmsCommonnQuery/QueryNoKittingList")] public async Task> QueryNoKittingList([FromQuery] KittingListInput input) { var list = await _mesOrderGatherRep.AsQueryable() .WhereIF(!string.IsNullOrWhiteSpace(input.Info5), u => u.Info5.Contains(input.Info5.Trim())) .WhereIF(!string.IsNullOrWhiteSpace(input.Info5), u => u.Info5.Contains(input.Info5.Trim())) .Where(x => ((DateTime)x.CreateTime).ToString("yyyyMMdd") == DateTime.Now.ToString("yyyyMMdd")) .Where(x => x.IsKitting == false) .OrderBy(g => g.Id) .ToListAsync(); // 确保获取结果为 List return list; // 结果 } /// /// 查询 历史生产订单记录 (大屏使用) /// /// [HttpGet] [ApiDescriptionSettings(Name = "QueryHistoryOrderList")] [Description("WmsCommonnQuery/QueryHistoryOrderList")] public async Task> QueryHistoryOrderList() { //获取上班时间。 var sysConfig_wms_unline_time = await _sysConfigRep.GetFirstAsync(x => x.Code == CommonConst.wms_unline_time); if (sysConfig_wms_unline_time == null || sysConfig_wms_unline_time.Value == "无") { throw Oops.Oh($"没有配置 包装下线登陆时间 值"); } var unLineTime = Convert.ToDateTime(sysConfig_wms_unline_time.Value); var list = await _mesOrderGatherRep.AsQueryable() .Where(x => x.UnlineTime >= unLineTime) .Where(x => x.IsUnline == true) .OrderByDescending(g => g.Id) .ToListAsync(); // 确保获取结果为 List return list; // 结果 } }