diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdFeedingService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdFeedingService.cs index 0412945a..4151c0a2 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdFeedingService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdFeedingService.cs @@ -420,11 +420,20 @@ namespace Tnb.ProductionMgr PrdMaterialReceiptD? detail = null; if (carry.carrystd_id == WmsWareHouseConst.CARRY_ZYXCSTD_ID || carry.carrystd_id == WmsWareHouseConst.CARRY_ZYLJSTD_ID) { - detail = await db.Queryable().Where(x => x.carry_id == carry.id && x.is_all_feeding == 0).FirstAsync(); + detail = await db.Queryable() + .LeftJoin((x,y)=>x.material_receipt_id==y.id) + .Where((x,y) => x.carry_id == carry.id && x.is_all_feeding == 0 && y.mo_task_id==moTask.id).FirstAsync(); } else { - detail = await db.Queryable().Where(x => x.member_carry_code == input.carry_code && x.is_all_feeding == 0).FirstAsync(); + detail = await db.Queryable() + .LeftJoin((x,y)=>x.material_receipt_id==y.id) + .Where((x,y) => x.member_carry_code == input.carry_code && x.is_all_feeding == 0 && y.mo_task_id==moTask.id).FirstAsync(); + } + + if (detail == null) + { + throw Oops.Bah($"未找到任务单{moTask.mo_task_code}下载具{carry.carry_code}的签收记录"); } if (prdMaterialReceiptH == null)