diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdPackReportService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdPackReportService.cs index de750ee1..df260d9a 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdPackReportService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdPackReportService.cs @@ -470,7 +470,7 @@ namespace Tnb.ProductionMgr minpacking = b.minpacking, main_num = k.number_of_primary_unit, deputy_num = k.number_of_auxiliary_unit, - third_equip_code = l.equip_code, + third_equip_code = f.code, weight_name = l.label_point, category_id = b.category_id, as_location_id = f.as_location_id, diff --git a/ProductionMgr/Tnb.ProductionMgr/RedisDataService.cs b/ProductionMgr/Tnb.ProductionMgr/RedisDataService.cs index 47de788a..df5c20a9 100644 --- a/ProductionMgr/Tnb.ProductionMgr/RedisDataService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/RedisDataService.cs @@ -61,11 +61,15 @@ namespace Tnb.ProductionMgr [HttpPost] public async Task GetWeight(string device, string jihao) { - EqpDaq eqpDaq1 = await _repository.AsSugarClient().Queryable().Where(x => x.equip_code == device && x.label_name.Contains("允许称重")).FirstAsync(); + EqpDaq eqpDaq1 = await _repository.AsSugarClient().Queryable(). + LeftJoin((x,y)=>x.equip_id==y.id). + Where((x,y) => y.code == device && x.label_name.Contains("允许称重")).FirstAsync(); if (eqpDaq1 == null) { throw Oops.Bah("未在数据采集中设置允许称重标签点"); } + + device = eqpDaq1.equip_code; Dictionary dicCommand = new(StringComparer.OrdinalIgnoreCase) { ["DevName"] = device, diff --git a/ProductionMgr/Tnb.ProductionMgr/TimeWorkService.cs b/ProductionMgr/Tnb.ProductionMgr/TimeWorkService.cs index 42562444..611bd375 100644 --- a/ProductionMgr/Tnb.ProductionMgr/TimeWorkService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/TimeWorkService.cs @@ -40,13 +40,15 @@ namespace Tnb.ProductionMgr private readonly IBillRullService _billRullService; private readonly RedisData _redisData; private readonly IWmsEmptyOutstockService _wmsEmptyOutstockService; + private readonly IWareHouseService _wareHouseService; public TimeWorkService( RedisData redisData, ISqlSugarRepository repository, IBillRullService billRullService, IOrganizeService organizeService, - IWmsEmptyOutstockService wmsEmptyOutstockService + IWmsEmptyOutstockService wmsEmptyOutstockService, + IWareHouseService wareHouseService ) { _redisData = redisData; @@ -55,6 +57,7 @@ namespace Tnb.ProductionMgr _organizeService = organizeService; _billRullService = billRullService; _wmsEmptyOutstockService = wmsEmptyOutstockService; + _wareHouseService = wareHouseService; } [HttpGet] @@ -225,7 +228,7 @@ namespace Tnb.ProductionMgr List eqpIds = equipments.Select(x => x.id).ToList(); List eqpDaqs = await _db.Queryable().Where(x => eqpIds.Contains(x.equip_id) && x.label_name.Contains("允许入空箱")).ToListAsync(); - BasFactoryConfig config = await _db.Queryable().FirstAsync(x => x.enabled == 1 && x.key == FactoryConfigConst.DOMAIN); + //BasFactoryConfig config = await _db.Queryable().FirstAsync(x => x.enabled == 1 && x.key == FactoryConfigConst.DOMAIN); foreach (var equipment in equipments) { EqpDaq eqpDaq = eqpDaqs.FirstOrDefault(x => x.equip_id==equipment.id); @@ -255,10 +258,11 @@ namespace Tnb.ProductionMgr postData.biz_type = WmsWareHouseConst.BIZTYPE_WMSDELIVERY_ID; postData.task_type = WmsWareHouseConst.WMS_PRETASK_OUTSTOCK_TYPE_ID; Log.Information($"【FixedPointDelivery】注塑定点配送,参数:{JsonConvert.SerializeObject(postData)}"); - string sendResult = HttpUtils.RequestPost($"{config.value}/api/wms/ware-house/common-create-pretask", JsonConvert.SerializeObject(postData), null); + Result result = await _wareHouseService.CommonCreatePretask(postData); + // string sendResult = HttpUtils.RequestPost($"{config.value}/api/wms/ware-house/common-create-pretask", JsonConvert.SerializeObject(postData), null); // string sendResult = HttpUtils.RequestPost($"http://localhost:9232/api/wms/ware-house/common-create-pretask", JsonConvert.SerializeObject(postData), null); - AuthResponse authResponse = JsonConvert.DeserializeObject(sendResult); - if(authResponse.code == 200 && authResponse.data.ObjToBool()) + // AuthResponse authResponse = JsonConvert.DeserializeObject(sendResult); + if(result.code == HttpStatusCode.OK) { msg += $"{equipment.name}注塑定点配送成功,"; Log.Information($"【FixedPointDelivery】{equipment.name}注塑定点配送成功"); @@ -266,8 +270,8 @@ namespace Tnb.ProductionMgr } else { - msg += $"{equipment.name}注塑定点配送失败:{authResponse.msg},"; - Log.Error($"【FixedPointDelivery】{equipment.name}注塑定点配送失败:{authResponse.msg}"); + msg += $"{equipment.name}注塑定点配送失败:{result.msg},"; + Log.Error($"【FixedPointDelivery】{equipment.name}注塑定点配送失败:{result.msg}"); } }