This commit is contained in:
2024-09-12 09:05:33 +08:00

View File

@@ -347,6 +347,7 @@ namespace Tnb.ProductionMgr
WmsCarryH carry = await db.Queryable<WmsCarryH>().Where(x=>x.carry_code==input.carry_code).FirstAsync(); WmsCarryH carry = await db.Queryable<WmsCarryH>().Where(x=>x.carry_code==input.carry_code).FirstAsync();
prdMaterialReceiptH = new PrdMaterialReceiptH() prdMaterialReceiptH = new PrdMaterialReceiptH()
{ {
code = code, code = code,
@@ -368,11 +369,21 @@ namespace Tnb.ProductionMgr
{ {
foreach (var item in input.details) foreach (var item in input.details)
{ {
PrdMaterialReceiptD existD = await db.Queryable<PrdMaterialReceiptD>()
.LeftJoin<PrdMaterialReceiptH>((x, y) => x.material_receipt_id == y.id)
.Where((x, y) => x.carry_id == carry.id && y.mo_task_id == moTask.id && x.is_all_feeding == 0)
.Select((x,y)=>x)
.FirstAsync();
if (existD != null)
{
throw new Exception($"{moTask.mo_task_code}任务单存在未投完的签收物料,物料签收子表id{existD.id}");
}
if (!inputMaterials.Contains(item.material_id) && !input.sure) if (!inputMaterials.Contains(item.material_id) && !input.sure)
{ {
throw new Exception("存在不属于生产bom的投入物料确认签收吗"); throw new Exception("存在不属于生产bom的投入物料确认签收吗");
} }
list.Add(new PrdMaterialReceiptD list.Add(new PrdMaterialReceiptD
{ {
material_receipt_id = prdMaterialReceiptH.id, material_receipt_id = prdMaterialReceiptH.id,