调整齐套分拣模块代码

This commit is contained in:
alex
2023-06-26 16:10:10 +08:00
parent a3b6e3f8d0
commit b25aca740a
43 changed files with 571 additions and 77 deletions

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.BasicData.Entities": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50313;http://localhost:50314"
}
}
}

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.BasicData.Interfaces": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50305;http://localhost:50306"
}
}
}

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.BasicData": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50307;http://localhost:50308"
}
}
}

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.EquipMgr.Entities": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50299;http://localhost:50300"
}
}
}

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.EquipMgr.Interfaces": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50303;http://localhost:50304"
}
}
}

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.EquipMgr": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50301;http://localhost:50302"
}
}
}

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.PerMgr.Entities": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50319;http://localhost:50320"
}
}
}

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.PerMgr.Interfaces": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50321;http://localhost:50322"
}
}
}

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.PerMgr": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50317;http://localhost:50318"
}
}
}

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.ProductionMgr.Entities": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50311;http://localhost:50312"
}
}
}

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.ProductionMgr.Interfaces": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50315;http://localhost:50316"
}
}
}

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.ProductionMgr": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50309;http://localhost:50310"
}
}
}

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.QcMgr.Entities": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50295;http://localhost:50296"
}
}
}

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.QcMgr.Interfaces": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50297;http://localhost:50298"
}
}
}

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.QcMgr": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50291;http://localhost:50292"
}
}
}

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.WarehouseMgr.Entities": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50287;http://localhost:50288"
}
}
}

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.WarehouseMgr.Interfaces": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50293;http://localhost:50294"
}
}
}

View File

@@ -95,11 +95,10 @@ namespace Tnb.WarehouseMgr
throw new AppFriendlyException($"需要出库[{os.pr_qty}],实际库存{codeQty},数量不足", 500);
}
var partCarryMats = carryCodesPart.Adapt<List<WmsCarryMat>>();
partCarryMats.ForEach(x =>
for (int i = 0; i < partCarryMats.Count; i++)
{
x.need_qty = (int)os.pr_qty;
x.real_qty = codeQty;
});
partCarryMats[i].need_qty = carryCodesPart[i].codeqty;
}
carryMats.AddRange(partCarryMats);
}
}
@@ -110,12 +109,12 @@ namespace Tnb.WarehouseMgr
.Select(x =>
{
WmsCarryMat? carryMat = x.FirstOrDefault()!;
carryMat.real_qty = x.Sum(d => d.real_qty);
carryMat.need_qty = x.Sum(d => d.need_qty);
return carryMat;
})
.ToList();
await _db.Insertable(carryMats).ExecuteCommandAsync();
var dic = carryMats.DistinctBy(x => x.carry_id).ToDictionary(x => x.carry_id, x => x.real_qty);
var dic = carryMats.DistinctBy(x => x.carry_id).ToDictionary(x => x.carry_id, x => x.need_qty);
var allOutIds = new List<string>();
var sortingOutIds = new List<string>();
foreach (var pair in dic)

View File

@@ -87,49 +87,61 @@ namespace Tnb.WarehouseMgr
if (carryMats.Count > 0)
{
carryMats.ForEach(x => x.id = SnowflakeIdHelper.NextId());
for (int i = 0; i < partCarryMats.Count; i++)
{
partCarryMats[i].need_qty = carryCodesPart[i].codeqty;
}
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()!;
carryMat.real_qty = x.Sum(d => d.real_qty);
carryMat.need_qty = x.Sum(d => d.need_qty);
return carryMat;
})
.ToList();
await _db.Insertable(carryMats).ExecuteCommandAsync();
var dic = carryMats.DistinctBy(x => x.carry_id).ToDictionary(x => x.carry_id, x => x.real_qty);
var allOutIds = new List<string>();
var sortingOutIds = new List<string>();
foreach (var pair in dic)
{
var codes = carryCodes.FindAll(x => x.carry_id == pair.Key);
if (codes?.Count > 0)
{
if (pair.Value == codes.Sum(d => d.codeqty))
{
allOutIds.Add(pair.Key);
}
else
{
sortingOutIds.Add(pair.Key);
}
}
}
carryIds = allOutIds.Concat(sortingOutIds).ToList();
await _db.Updateable<WmsCarryH>().SetColumns(it => new WmsCarryH { out_status = ((int)EnumOutStatus.).ToString() }).Where(it => allOutIds.Contains(it.id)).ExecuteCommandAsync();
carryIds = carryMats.Select(x => x.carry_id).Distinct().ToList();
await _db.Updateable<WmsCarryH>().SetColumns(it => new WmsCarryH { out_status = ((int)EnumOutStatus.).ToString() }).Where(it => carryIds.Contains(it.id)).ExecuteCommandAsync();
//天益项目不需要
//await _db.Updateable<WmsCarryH>().SetColumns(it => new WmsCarryH { out_status = ((int)EnumOutStatus.分拣出).ToString() }).Where(it => sortingOutIds.Contains(it.id)).ExecuteCommandAsync();
}
var carrys = await _db.Queryable<WmsCarryH>().Where(it => carryIds.Contains(it.id)).ToListAsync();
if (carrys?.Count > 0)
var carrys = await _db.Queryable<WmsCarryH>().Where(it => carryIds.Contains(it.id)).ToArrayAsync();
if (carrys?.Length > 0)
{
List<WmsPretaskH> preTasks = new();
List<string> locIds = new();
string firstLocationId = "27010980724501", secondLocationId = "27010987857941";
if (carrys.Length > 6)
{
var leftCarrys = carrys[..6];
var rightCarrys = carrys[6..];
await _genPreTask(leftCarrys, locIds, firstLocationId, preTasks);
await _genPreTask(rightCarrys, locIds, secondLocationId, preTasks);
}
else
{
await _genPreTask(carrys, locIds, firstLocationId, preTasks);
}
var isOk = await _wareHouseService.GenPreTask(preTasks, null);
GenPreTaskUpInput genPreTaskAfterUpInput = new();
genPreTaskAfterUpInput.CarryIds = preTasks.Select(x => x.carry_id).ToList();
genPreTaskAfterUpInput.LocationIds = new HashSet<string>(locIds).ToList();
await _wareHouseService.GenInStockTaskHandleAfter(genPreTaskAfterUpInput, it => new WmsCarryH { is_lock = 1 }, it => new BasLocation { is_lock = 1 });
}
}
}
}
private async Task _genPreTask(WmsCarryH[] carrys, List<string> locIds, string eLocationId, List<WmsPretaskH> preTasks)
{
var loc = await _db.Queryable<BasLocation>().SingleAsync(it => it.id == eLocationId);
foreach (var carry in carrys)
{
WmsPointH sPoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == carry.location_id);
WmsPointH ePoint = null!;
//ePoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == input.data[nameof(WmsPointH.location_id)].ToString());
WmsPointH ePoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == eLocationId);
if (sPoint != null && ePoint != null)
{
@@ -166,24 +178,15 @@ namespace Tnb.WarehouseMgr
preTask.create_time = DateTime.Now;
return preTask;
}).ToList();
//if (loc.is_sign == 0)
//{
// curPreTasks[^1].is_sign = 0; // 修改最后一个元素的是否签收值
//}
if (loc.is_sign == 0)
{
curPreTasks[^1].is_sign = 0; // 修改最后一个元素的是否签收值
}
preTasks.AddRange(curPreTasks);
}
}
}
var isOk = await _wareHouseService.GenPreTask(preTasks, null);
GenPreTaskUpInput genPreTaskAfterUpInput = new();
genPreTaskAfterUpInput.CarryIds = preTasks.Select(x => x.carry_id).ToList();
genPreTaskAfterUpInput.LocationIds = new HashSet<string>(locIds).ToList();
await _wareHouseService.GenInStockTaskHandleAfter(genPreTaskAfterUpInput, it => new WmsCarryH { is_lock = 1 }, it => new BasLocation { is_lock = 1 });
}
}
}
}
}

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.Apps.Interfaces": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50247;http://localhost:50263"
}
}
}

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.Apps": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50240;http://localhost:50264"
}
}
}

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.CollectiveOAuth": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50269;http://localhost:50270"
}
}
}

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.Common.Core": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50271;http://localhost:50273"
}
}
}

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.Common": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50246;http://localhost:50267"
}
}
}

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.SqlSugar": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50289;http://localhost:50290"
}
}
}

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.Thirdparty": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50276;http://localhost:50277"
}
}
}

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.WebSockets": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50272;http://localhost:50274"
}
}
}

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.Extend.Entitys": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50285;http://localhost:50286"
}
}
}

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.Extend.Interfaces": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50283;http://localhost:50284"
}
}
}

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.Message.Entitys": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50244;http://localhost:50268"
}
}
}

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.Message.Interfaces": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50239;http://localhost:50259"
}
}
}

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.Message": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50241;http://localhost:50262"
}
}
}

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.OAuth": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50278;http://localhost:50279"
}
}
}

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.Systems.Entitys": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50280;http://localhost:50281"
}
}
}

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.TaskScheduler.Entitys": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50245;http://localhost:50257"
}
}
}

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.TaskScheduler.Interfaces": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50251;http://localhost:50258"
}
}
}

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.TaskScheduler": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50250;http://localhost:50255"
}
}
}

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.VisualDev.Engine": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50248;http://localhost:50254"
}
}
}

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.VisualDev.Entitys": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50243;http://localhost:50260"
}
}
}

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.VisualDev.Interfaces": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50252;http://localhost:50256"
}
}
}

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.VisualDev": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50242;http://localhost:50266"
}
}
}

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.WorkFlow.Entitys": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50253;http://localhost:50261"
}
}
}

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.WorkFlow.Interfaces": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50249;http://localhost:50265"
}
}
}