This commit is contained in:
FanLian
2023-07-14 14:19:25 +08:00
3 changed files with 18 additions and 7 deletions

View File

@@ -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<CallerAttribute>()?.Name;
if (!callerName.IsNullOrEmpty())
var callerName = serviceType.GetCustomAttribute<CallerAttribute>()?.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;
}
}
}

View File

@@ -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<WmsOutstockH>().SetColumns(it => new WmsOutstockH { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it=>it.id == outstock.id).ExecuteCommandAsync();
await _db.Updateable<WmsOutstockH>().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<string>(locIds).ToList();

View File

@@ -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<WmsCarryMat> carryMats = new();
List<WmsCarryCode> carryCodes = new();
List<string> carryIds = new();
var whereExpr = Expressionable.Create<WmsCarryH, WmsCarryCode, BasLocation>()
.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<WmsCarryH>().InnerJoin<WmsCarryCode>((a, b) => a.id == b.carry_id).InnerJoin<BasLocation>((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<WmsCarryCode>()
.ToListAsync();
if (carryCodesPart?.Count > 0)