diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdMaterialReceiptService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdMaterialReceiptService.cs index 05be114d..748e640c 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdMaterialReceiptService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdMaterialReceiptService.cs @@ -206,6 +206,88 @@ namespace Tnb.ProductionMgr return result; } } + + [HttpPost] + public async Task GetInfoByQrCodeForBackMaterial(Dictionary dic) + { + string qrCode = dic["qrcode"]; + + ISqlSugarClient db = _repository.AsSugarClient(); + + 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) + { + List result = await db.Queryable() + .LeftJoin((a, b) => b.id==a.carry_id) + .Where((a,b) => b.carry_code == qrCode && a.is_all_feeding == 0 ) + .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 ) + .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 + }) + }).ToListAsync(); + if (result.Count > 1) + { + throw Oops.Bah("找到多条签收记录"); + }else if (result.Count == 1) + { + return result[0]; + } + + } + else + { + List 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 ) + .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.member_carry_code == c.member_carry_code && 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 + }) + }).ToListAsync(); + if (result.Count > 1) + { + throw Oops.Bah("找到多条签收记录"); + }else if (result.Count == 1) + { + return result[0]; + } + } + + return null; + } [HttpPost] public async Task SaveData(MaterialReceiptInput input) diff --git a/ProductionMgr/Tnb.ProductionMgr/RedisDataService.cs b/ProductionMgr/Tnb.ProductionMgr/RedisDataService.cs index 2300da77..f79fd93d 100644 --- a/ProductionMgr/Tnb.ProductionMgr/RedisDataService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/RedisDataService.cs @@ -125,7 +125,7 @@ namespace Tnb.ProductionMgr // Log.Information($"{device},{eqpDaq3.label_name}称重完成返回结果:{responseresult}"); // } // } - string equipStatus = await _redisData.GetHash(device, "1 启动2停止 3手动4急停"); + string equipStatus = await _redisData.GetHash(device, "1 启动 2 停止 3手动 4 急停"); Log.Information($"换箱机状态:{equipStatus}"); if (equipStatus != "1") {