diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdMaterialReceiptService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdMaterialReceiptService.cs index a33cfc93..ca722d90 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdMaterialReceiptService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdMaterialReceiptService.cs @@ -599,7 +599,7 @@ namespace Tnb.ProductionMgr foreach(string carryId in input.carryIds) { WmsCarryH carry = await db.Queryable().SingleAsync(x => x.id == carryId); - + PrdMaterialReceiptH prdMaterialReceiptH = new PrdMaterialReceiptH() { code = code, @@ -618,16 +618,28 @@ namespace Tnb.ProductionMgr }; insertHList.Add(prdMaterialReceiptH); - //CarryQueryOutput carryQueryOutput = await _wmsCarryQueryService.MESCarryQueryResult(new MESCarryQueryResultInput(){carry_code = carry.carry_code}); - List memberCarryIds = await db.Queryable().Where(x=>x.carry_id==carry.id).Select(x=>x.membercarry_id).ToListAsync(); - if (memberCarryIds == null || memberCarryIds.IsEmpty()) + List carryCodes = new List(); + List memberCarryIds = new List(); + List memberCarrys = new List(); + if (carry.carrystd_id == WmsWareHouseConst.CARRY_ZYXCSTD_ID || + carry.carrystd_id == WmsWareHouseConst.CARRY_ZYLJSTD_ID) { - throw Oops.Bah($"未找到载具编号{carry.carry_code}的子载具"); + carryCodes = await db.Queryable().Where(x=>x.carry_id==carry.id).ToListAsync(); } - - List memberCarrys = await db.Queryable().Where(x=>memberCarryIds.Contains(x.id)).ToListAsync(); - List carryCodes = await db.Queryable().Where(x=>memberCarryIds.Contains(x.carry_id)).ToListAsync(); - + else + { + //CarryQueryOutput carryQueryOutput = await _wmsCarryQueryService.MESCarryQueryResult(new MESCarryQueryResultInput(){carry_code = carry.carry_code}); + memberCarryIds = await db.Queryable().Where(x=>x.carry_id==carry.id).Select(x=>x.membercarry_id).ToListAsync(); + if (memberCarryIds == null || memberCarryIds.IsEmpty()) + { + throw Oops.Bah($"未找到载具编号{carry.carry_code}的子载具"); + } + + memberCarrys = await db.Queryable().Where(x=>memberCarryIds.Contains(x.id)).ToListAsync(); + carryCodes = await db.Queryable().Where(x=>memberCarryIds.Contains(x.carry_id)).ToListAsync(); + + } + if (carryCodes != null && carryCodes.Count > 0) { Log.Information($"签收载具信息{JsonConvert.SerializeObject(carryCodes)}"); @@ -654,7 +666,7 @@ namespace Tnb.ProductionMgr barcode = item.barcode, is_all_feeding = 0, member_carry_id = item.carry_id, - member_carry_code = memberCarrys.Find(x=>x.id==item.carry_id).carry_code, + member_carry_code = memberCarrys.Find(x=>x.id==item.carry_id).carry_code ?? "", feeding_num = 0, supplier_id = item.supplier_id, instock_time = item.instock_time, diff --git a/ProductionMgr/Tnb.ProductionMgr/TimeWorkService.cs b/ProductionMgr/Tnb.ProductionMgr/TimeWorkService.cs index 26eec796..382f3f32 100644 --- a/ProductionMgr/Tnb.ProductionMgr/TimeWorkService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/TimeWorkService.cs @@ -916,17 +916,17 @@ namespace Tnb.ProductionMgr result += e.Message; } - try - { - string response2 = HttpUtils.RequestGet($"{config.value}/api/production/time-work/sync-material",null,10*60*1000); - AuthResponse authResponse2 = JsonConvert.DeserializeObject(response2); - result += ","+authResponse2.data.ToString(); - } - catch (Exception e) - { - Log.Error(e.Message,e); - result += e.Message; - } + // try + // { + // string response2 = HttpUtils.RequestGet($"{config.value}/api/production/time-work/sync-material",null,10*60*1000); + // AuthResponse authResponse2 = JsonConvert.DeserializeObject(response2); + // result += ","+authResponse2.data.ToString(); + // } + // catch (Exception e) + // { + // Log.Error(e.Message,e); + // result += e.Message; + // } try { @@ -1286,6 +1286,13 @@ namespace Tnb.ProductionMgr await _db.Ado.CommitTranAsync(); msg = $"新增物料{insertMaterial.Count}条,修改物料{editCount}条"; + + BasSyncRecord basSyncRecord = new BasSyncRecord() + { + msg = msg, + create_time = DateTime.Now + }; + await _db.Insertable(basSyncRecord).ExecuteCommandAsync(); } catch (Exception e) {