diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdMaterialReceiptService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdMaterialReceiptService.cs index d0fea55b..230a32f7 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdMaterialReceiptService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdMaterialReceiptService.cs @@ -93,7 +93,7 @@ namespace Tnb.ProductionMgr OrganizeEntity workline = await _organizeService.GetAnyParentByWorkstationId(station_id, DictConst.RegionCategoryWorklineCode); PrdMoTask prdMoTask = await db.Queryable().Where(x => x.workline_id == workline.Id && x.worker_id == _userManager.UserId && x.mo_task_status==DictConst.InProgressEnCode) .FirstAsync(); - + if (prdMoTask == null) { throw Oops.Bah("未找到进行中的任务单"); @@ -101,11 +101,42 @@ namespace Tnb.ProductionMgr List ids = await db.Queryable() .Where(x => x.mo_task_id == prdMoTask.id).Select(x=>x.id).ToListAsync(); + + WmsCarryH wmsCarryH = await db.Queryable().SingleAsync(x => x.carry_code == qrCode); + if (wmsCarryH == null) + { + throw Oops.Bah($"未找到该载具{qrCode}"); + } + + if (wmsCarryH.carrystd_id==WmsWareHouseConst.CARRY_ZYXCSTD_ID || wmsCarryH.carrystd_id==WmsWareHouseConst.CARRY_ZYLJSTD_ID) + { + FeedingDetailOutput result = await db.Queryable() + .LeftJoin((a, b) => b.id==a.carry_id) + .Where((a,b) => b.carry_code == qrCode && a.is_all_feeding == 0 && ids.Contains(a.material_receipt_id)) + .Select((a, b) => new FeedingDetailOutput + { + carry_id = b.id, + carry_name = b.carry_name, + children = SqlFunc.Subqueryable() + .LeftJoin((c, d) => c.material_id == d.id) + .Where((c, d) => a.carry_id == c.carry_id && c.is_all_feeding == 0 && ids.Contains(c.material_receipt_id)) + .ToList((c, d) => new CarryCodeDetailOutput() + { + unit_id = d.unit_id, + // barcode = c.barcode, + // code_batch = c.code_batch, + code_batch = c.batch, + codeqty = c.num - SqlFunc.IsNull(c.feeding_num,0), + material_id = c.material_id, + material_code = d.code, + material_name = d.name + }) + }).FirstAsync(); + return result; - - // if (await db.Queryable() - // .AnyAsync(x => x.member_carry_code == qrCode && x.is_all_feeding == 0 && ids.Contains(x.material_receipt_id))) - // { + } + else + { FeedingDetailOutput result = await db.Queryable() .LeftJoin((a, b) => b.carry_code==a.member_carry_code) .Where((a) => a.member_carry_code == qrCode && a.is_all_feeding == 0 && ids.Contains(a.material_receipt_id)) @@ -129,33 +160,7 @@ namespace Tnb.ProductionMgr }) }).FirstAsync(); return result; - // } - // else - // { - // FeedingDetailOutput result = await db.Queryable() - // .LeftJoin((a, b) => b.carry_code==qrCode) - // .LeftJoin() - // .Where((a) => a.carry_code == qrCode && ids.Contains(a.id)) - // .Select((a, b) => new FeedingDetailOutput - // { - // carry_id = a.carry_id, - // carry_name = b.carry_name, - // children = SqlFunc.Subqueryable() - // .LeftJoin((c, d) => c.material_id == d.id) - // .Where((c, d) => a.id == c.material_receipt_id && c.is_all_feeding == 0).ToList((c, d) => new CarryCodeDetailOutput() - // { - // unit_id = d.unit_id, - // // barcode = c.barcode, - // // code_batch = c.code_batch, - // code_batch = c.batch, - // codeqty = c.num - SqlFunc.IsNull(c.feeding_num,0), - // material_id = c.material_id, - // material_code = d.code, - // material_name = d.name - // }) - // }).FirstAsync(); - // return result; - // } + } } [HttpPost] diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/WmsWareHouseConst.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/WmsWareHouseConst.cs index 03775ecf..4ef76273 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/WmsWareHouseConst.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/WmsWareHouseConst.cs @@ -267,6 +267,14 @@ /// public const string CARRY_LXSTD_ID = "26037262680357"; /// + /// 载具规格-载运小车 + /// + public const string CARRY_ZYXCSTD_ID = "26103233723941"; + /// + /// 载具规格-载运料架 + /// + public const string CARRY_ZYLJSTD_ID = "34995839046677"; + /// /// 打印状态-未打印 /// public const string PRINT_STATUS_NOTPRINTED = "26191366982437";