This commit is contained in:
alex
2023-06-26 16:10:24 +08:00
parent b25aca740a
commit 9b87134b01

View File

@@ -76,21 +76,17 @@ 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);
}
}
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 =>
{
@@ -100,7 +96,7 @@ namespace Tnb.WarehouseMgr
})
.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);
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();