电梯代码优化

This commit is contained in:
yang.lee
2023-12-12 14:28:38 +08:00
parent 5fde13ece9
commit fbdc7de3b9
17 changed files with 275 additions and 282 deletions

View File

@@ -35,7 +35,7 @@ namespace Tnb.WarehouseMgr
/// </summary>
[OverideVisualDev(ModuleConsts.MODULE_WMSOUTSTOCK_ID)]
[ServiceModule(BizTypeId)]
public class WmsOutStockService : ServiceLoggerBase<WmsOutStockService>, IWmsOutStockService
public class WmsOutStockService : DevServBase<WmsOutStockService>, IWmsOutStockService
{
private const string BizTypeId = "26191522660645";
private readonly ISqlSugarClient _db;
@@ -59,7 +59,7 @@ namespace Tnb.WarehouseMgr
IBillRullService billRullService,
IWmsCarryMoveInStockService wmsCarryMoveInStockService,
IWmsCarryService wareCarryService,
IEventPublisher eventPublisher)
IEventPublisher eventPublisher) : base(repository.AsSugarClient())
{
_db = repository.AsSugarClient();
_dictionaryDataService = dictionaryDataService;
@@ -72,7 +72,6 @@ namespace Tnb.WarehouseMgr
_wareCarryService = wareCarryService;
OverideFuncs.CreateAsync = OutStockApplyFor;
_ = InitializationTask;
}
public async Task<dynamic> OutStockApplyFor(VisualDevModelDataCrInput input)
@@ -115,7 +114,7 @@ namespace Tnb.WarehouseMgr
List<string?> freeLocIds = fLocIds.Except(minTaskNumLocs.Select(x => x.endlocation_id)).ToList();
if (freeLocIds?.Count > 0)
{
int rIdx = Random.Shared.Next(0, freeLocIds.Count);
int rIdx = Random.Shared.Next(0, freeLocIds.Count);
loc = await _db.Queryable<BasLocation>().SingleAsync(it => it.id == freeLocIds[rIdx]);
}
else
@@ -210,7 +209,7 @@ namespace Tnb.WarehouseMgr
if (carryMats.Count > 0)
{
carryMats.ForEach(x => x.id = SnowflakeIdHelper.NextId());
carryMats = carryMats.OrderBy(o => o.create_time).GroupBy(g => new { g.carry_id, g.material_id, g.code_batch , g.material_specification,g.container_no })
carryMats = carryMats.OrderBy(o => o.create_time).GroupBy(g => new { g.carry_id, g.material_id, g.code_batch, g.material_specification, g.container_no })
.Select(x =>
{
WmsCarryMat[] arr = x.ToArray();
@@ -847,7 +846,7 @@ namespace Tnb.WarehouseMgr
string? billDId = otds?.Find(xx => xx.material_id == x.material_id && xx.code_batch == x.code_batch && xx.material_specification == x.material_specification && xx.container_no == x.container_no)?.id;
if (billDId.IsNullOrEmpty())
{
billDId = otds?.Find(xx => xx.material_id == x.material_id )?.id;
billDId = otds?.Find(xx => xx.material_id == x.material_id)?.id;
}
x.id = SnowflakeIdHelper.NextId();
x.bill_id = input.requireId;
@@ -893,7 +892,7 @@ namespace Tnb.WarehouseMgr
List<WmsOutstockCode> osCodes = input.distaskCodes.Adapt<List<WmsOutstockCode>>();
osCodes.ForEach(x =>
{
string? billDId = otds?.Find(xx => xx.material_id == x.material_id && xx.code_batch == x.code_batch && xx.material_specification == x.material_specification && xx.container_no == x.container_no )?.id;
string? billDId = otds?.Find(xx => xx.material_id == x.material_id && xx.code_batch == x.code_batch && xx.material_specification == x.material_specification && xx.container_no == x.container_no)?.id;
if (billDId.IsNullOrEmpty())
{
billDId = otds?.Find(xx => xx.material_id == x.material_id)?.id;