From 14e1e58a3c6a0a4a299bfb1cda4e1f021fa4915f Mon Sep 17 00:00:00 2001 From: alex Date: Fri, 14 Jul 2023 14:07:44 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=B6=88=E9=99=A4warning?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WarehouseMgr/Tnb.WarehouseMgr/BaseWareHouseService.cs | 8 +++++--- WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs | 2 +- WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/WarehouseMgr/Tnb.WarehouseMgr/BaseWareHouseService.cs b/WarehouseMgr/Tnb.WarehouseMgr/BaseWareHouseService.cs index 0afd2d19..e9d315a5 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/BaseWareHouseService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/BaseWareHouseService.cs @@ -34,10 +34,12 @@ namespace Tnb.WarehouseMgr var serviceTypes = App.EffectiveTypes.Where(u => u.IsClass && !u.IsInterface && !u.IsAbstract && typeof(IWHStorageService).IsAssignableFrom(u)).ToList(); foreach (var serviceType in serviceTypes) { - var callerName = serviceType.GetCustomAttribute()?.Name; - if (!callerName.IsNullOrEmpty()) + var callerName = serviceType.GetCustomAttribute()?.Name ?? string.Empty; + if (callerName.IsNullOrEmpty() && !serviceType.IsNull()) { - _stroageMap[callerName!] = (IWHStorageService)Activator.CreateInstance(serviceType)!; + var obj = Activator.CreateInstance(serviceType) as IWHStorageService; + if (obj == null) continue; + _stroageMap[callerName] = obj; } } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs index e61ae73f..ae11f831 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs @@ -296,7 +296,7 @@ namespace Tnb.WarehouseMgr { var curPreTaskCodes = preTaskCodes.FindAll(x => x.bill_id == disTask.pretask_id); var curDisTaskCodes = curPreTaskCodes.Adapt>(); - curPreTaskCodes.ForEach(x => + curDisTaskCodes.ForEach(x => { x.id = SnowflakeIdHelper.NextId(); x.bill_id = disTask.id; diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs index bc7caca0..5219afc2 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs @@ -150,7 +150,7 @@ namespace Tnb.WarehouseMgr carryMats = carryMats.OrderBy(o => o.create_time).GroupBy(g => new { g.carry_id, g.material_id, g.code_batch }) .Select(x => { - WmsCarryMat? carryMat = x.FirstOrDefault()!; + WmsCarryMat? carryMat = x.FirstOrDefault(); carryMat.need_qty = x.Sum(d => d.need_qty); return carryMat; }) @@ -505,7 +505,7 @@ namespace Tnb.WarehouseMgr { outstockDs.ForEach(x => x.line_status = WmsWareHouseConst.BILLSTATUS_ON_ID); await _db.Updateable(outstockDs).UpdateColumns(it => it.line_status).ExecuteCommandAsync(); - await _db.Updateable().SetColumns(it => new WmsOutstockH { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it=>it.id == outstock.id).ExecuteCommandAsync(); + await _db.Updateable().SetColumns(it => new WmsOutstockH { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == outstock.id).ExecuteCommandAsync(); GenPreTaskUpInput genPreTaskAfterUpInput = new(); genPreTaskAfterUpInput.CarryIds = preTasks.Select(x => x.carry_id).ToList(); genPreTaskAfterUpInput.LocationIds = new HashSet(locIds).ToList(); From eda4a0231d1f366aa942f4ec9640dcbcd0fcd7aa Mon Sep 17 00:00:00 2001 From: alex Date: Fri, 14 Jul 2023 14:18:45 +0800 Subject: [PATCH 2/2] 1 --- .../Tnb.WarehouseMgr/WmsSetSortingService.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsSetSortingService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsSetSortingService.cs index cfc398cd..8b98fc02 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsSetSortingService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsSetSortingService.cs @@ -21,6 +21,7 @@ using Tnb.WarehouseMgr.Entities.Consts; using Tnb.WarehouseMgr.Entities.Dto; using Tnb.WarehouseMgr.Entities.Enums; using Tnb.WarehouseMgr.Interfaces; +using UAParser; namespace Tnb.WarehouseMgr { @@ -69,11 +70,19 @@ namespace Tnb.WarehouseMgr List carryMats = new(); List carryCodes = new(); List carryIds = new(); + + var whereExpr = Expressionable.Create() + .And((a, b, c) => a.is_lock == 0) + .And((a, b, c) => !string.IsNullOrEmpty(a.location_id)) + .And((a, b, c) => a.status == (int)EnumCarryStatus.占用); foreach (var os in setSortingDList) { + whereExpr.And((a, b, c) => b.material_id == os.material_id) + .And((a, b, c) => c.wh_id == os.warehouse_id) + .AndIF(!string.IsNullOrEmpty(os.code_batch), (a, b, c) => b.code_batch == os.code_batch); + var carryCodesPart = await _db.Queryable().InnerJoin((a, b) => a.id == b.carry_id).InnerJoin((a, b, c) => a.location_id == c.id) - .Where((a, b, c) => b.material_id == os.material_id && a.is_lock == 0 && !string.IsNullOrEmpty(a.location_id) && a.status == (int)EnumCarryStatus.占用 && c.wh_id == os.warehouse_id) - .WhereIF(!string.IsNullOrEmpty(os.code_batch), (a, b) => b.code_batch == os.code_batch) + .Where(whereExpr.ToExpression()) .Select() .ToListAsync(); if (carryCodesPart?.Count > 0)