From e52dd73ef7b44ec23a49ef2483ee813aa3b7dc96 Mon Sep 17 00:00:00 2001 From: schangxiang@126.com <schangxiang@126.com> Date: 周六, 30 11月 2024 14:35:40 +0800 Subject: [PATCH] 2222 --- LA24030_LuLiPackageLine_Wms/Admin.NET.Application/Service/WmsCommonnQuery/WmsCommonnQueryService.cs | 103 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 102 insertions(+), 1 deletions(-) diff --git a/LA24030_LuLiPackageLine_Wms/Admin.NET.Application/Service/WmsCommonnQuery/WmsCommonnQueryService.cs b/LA24030_LuLiPackageLine_Wms/Admin.NET.Application/Service/WmsCommonnQuery/WmsCommonnQueryService.cs index 0739fe9..635e74a 100644 --- a/LA24030_LuLiPackageLine_Wms/Admin.NET.Application/Service/WmsCommonnQuery/WmsCommonnQueryService.cs +++ b/LA24030_LuLiPackageLine_Wms/Admin.NET.Application/Service/WmsCommonnQuery/WmsCommonnQueryService.cs @@ -7,6 +7,7 @@ using DocumentFormat.OpenXml.Office.CustomUI; using Microsoft.CodeAnalysis.Operations; using Admin.NET.Application.Service.WmsTask.WmsRbLineTask.Dto; +using Admin.NET.Application.Service.WmsCommonnQuery.Dto; namespace Admin.NET.Application; /// <summary> @@ -22,12 +23,14 @@ private readonly SqlSugarRepository<SysConfig> _sysConfigRep; private readonly SqlSugarRepository<Mes_BatchOrderUPI_New> _mesBatchOrderUpiRep; private readonly SqlSugarRepository<Mes_Order_Gather> _mesOrderGatherRep; + private readonly SqlSugarRepository<Mes_Package_UnLine_Record> _mesPackage_UnLine_RecordRep; public WmsCommonnQueryService(SqlSugarRepository<WmsRbLineTask> rep, SqlSugarRepository<WmsStockQuan> wmsStockQuanRep , SqlSugarRepository<Mes_Package_Gather> mesPackageGatherRep , SqlSugarRepository<SysConfig> sysConfigRep , SqlSugarRepository<Mes_BatchOrderUPI_New> mesBatchOrderUpiRep , SqlSugarRepository<Mes_Order_Gather> mesOrderGatherRep + , SqlSugarRepository<Mes_Package_UnLine_Record> mesPackage_UnLine_RecordRep ) { _sysConfigRep = sysConfigRep; @@ -36,6 +39,7 @@ _wmsStockQuanRep = wmsStockQuanRep; _mesBatchOrderUpiRep = mesBatchOrderUpiRep; _mesOrderGatherRep = mesOrderGatherRep; + _mesPackage_UnLine_RecordRep = mesPackage_UnLine_RecordRep; } /// <summary> @@ -73,7 +77,7 @@ 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($"娌℃湁閰嶇疆 鍖呰涓嬬嚎鐧婚檰鏃堕棿 鍊�"); + return null; } var unLineTime = Convert.ToDateTime(sysConfig_wms_unline_time.Value); @@ -85,5 +89,102 @@ return list; // 缁撴灉 } + + + /// <summary> + /// 鏌ヨ 褰撳墠鐢熶骇璁㈠崟璁板綍 锛堝ぇ灞忎娇鐢級 + /// </summary> + /// <returns></returns> + [HttpGet] + [ApiDescriptionSettings(Name = "QueryCurrentOrder")] + [Description("WmsCommonnQuery/QueryCurrentOrder")] + public async Task<Mes_Order_Gather> QueryCurrentOrder() + { + //鑾峰彇涓婄彮鏃堕棿銆� + var sysConfig_wms_wms_unline_oper = await _sysConfigRep.GetFirstAsync(x => x.Code == CommonConst.wms_unline_oper); + if (sysConfig_wms_wms_unline_oper == null || sysConfig_wms_wms_unline_oper.Value == "鏃�") + { + return null; + } + var arr = sysConfig_wms_wms_unline_oper.Value.Split('|'); + var packagecode = arr[0]; + var packObj = await _mesPackageGatherRep.AsQueryable().FirstAsync(x => x.PackageCode == packagecode); + if (packObj == null) + { + throw Oops.Oh($"娌℃湁鎵惧埌鍖厈packagecode}鐨勬眹鎬绘暟鎹�"); + } + + var list = await _mesOrderGatherRep.AsQueryable() + .Where(x => x.Info5 == packObj.Info5) + .FirstAsync(); // 纭繚鑾峰彇缁撴灉涓� List + + return list; // 缁撴灉 + } + + + + + /// <summary> + /// 澶у睆 - 鐧诲綍浜� 鐧诲綍鏃堕棿 LS070700117B0005GS + /// </summary> + /// <param name="input"></param> + /// <returns></returns> + [HttpGet] + [ApiDescriptionSettings(Name = "ScreenLogin")] + [Description("WmsCommonnQuery/ScreenLogin")] + [AllowAnonymous] + public async Task<ScreenLoginUserOutput> ScreenLogin([FromQuery] Mes_Package_LineQueueInput input) + { + // 鍩烘湰鏌ヨ + var list = await _sysConfigRep.AsQueryable() + .Where(x => x.Code == "wms_bz30_qitao" || x.Code == "wms_unline_oper" || x.Code == "wms_unline_time") + .ToListAsync(); + // 妫�鏌ist鏄惁涓虹┖ + if (list == null || !list.Any()) + { + // 杩斿洖榛樿鍊兼垨鑰呮姏鍑哄紓甯� + return new ScreenLoginUserOutput + { + LoginUser = null, + TimeLogin = null, + }; + } + + //鑾峰彇涓婄彮鏃堕棿銆� + DateTime unLineTime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd 00:00:00")); + 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 == "鏃�") + { + + } + else + { + unLineTime = Convert.ToDateTime(sysConfig_wms_unline_time.Value); + } + + + var recordList = await _mesPackage_UnLine_RecordRep.AsQueryable() + .Where(x => x.CreateTime >= unLineTime) + .ToListAsync(); // 纭繚鑾峰彇缁撴灉涓� List + //姹囨�绘暟鎹� + + + TimeSpan ts = DateTime.Now - unLineTime; + + // 杩斿洖缁撴灉 + return new ScreenLoginUserOutput + { + LoginUser = list.FirstOrDefault(x => x.Code == "wms_unline_oper")?.Value, + TimeLogin = list.FirstOrDefault(x => x.Code == "wms_unline_time")?.Value, + AllOrderNum = recordList.GroupBy(x => x.Info5).Count(), + AllPackageArea = recordList.Sum(x => Convert.ToDecimal((x.Info13))), + PackageNum = recordList.GroupBy(x => x.PackageCode).Count(), + WorkTime = ts.TotalHours + }; + } + + + + } -- Gitblit v1.9.3