diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs index 150a5537..9607afe7 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs @@ -2042,6 +2042,33 @@ namespace Tnb.ProductionMgr await HttpClientHelper.GetRequestAsync(_eleCtlCfg.WriteTagUrl, dicCommand2); } + if (prdMoTask.schedule_type == 1) + { + EqpEquipment equipment = await _db.Queryable().SingleAsync(x => x.id == prdMoTask.eqp_id); + EqpDaq eqpDaq3 = await _repository.AsSugarClient().Queryable(). + LeftJoin((x,y)=>x.equip_id==y.id). + Where((x,y) => y.code == equipment.code && x.label_name.Contains("称重完成")).FirstAsync(); + + if (eqpDaq3 == null) + { + throw Oops.Bah("未在数据采集中设置称重完成标签点"); + } + + Dictionary dicCommand3 = new(StringComparer.OrdinalIgnoreCase) + { + ["DevName"] = eqpDaq3.equip_code, + ["token"] = _eleCtlCfg.token, + ["TagName"] = eqpDaq3.label_name, + ["Value"] = "true", + }; + Log.Information($"称重完成参数:{JsonConvert.SerializeObject(dicCommand3)}"); + for (int i = 0; i < 1; i++) + { + string responseresult = await HttpClientHelper.GetRequestAsync(_eleCtlCfg.WriteTagUrl, dicCommand3,false); + Log.Information($"{eqpDaq3.equip_code},{eqpDaq3.label_name}称重完成返回结果:{responseresult}"); + } + } + await _db.Ado.CommitTranAsync(); diff --git a/ProductionMgr/Tnb.ProductionMgr/RedisDataService.cs b/ProductionMgr/Tnb.ProductionMgr/RedisDataService.cs index c26838d5..e9f95742 100644 --- a/ProductionMgr/Tnb.ProductionMgr/RedisDataService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/RedisDataService.cs @@ -100,31 +100,31 @@ namespace Tnb.ProductionMgr decimal result = res != null && res["Value"] != null ? decimal.Parse(res["Value"]!.ToString()) : throw Oops.Bah("数据格式错误"); - if (result > 0) - { - EqpDaq eqpDaq3 = await _repository.AsSugarClient().Queryable(). - LeftJoin((x,y)=>x.equip_id==y.id). - Where((x,y) => y.code == eqpcode && x.label_name.Contains("称重完成")).FirstAsync(); - - if (eqpDaq3 == null) - { - throw Oops.Bah("未在数据采集中设置称重完成标签点"); - } - - Dictionary dicCommand2 = new(StringComparer.OrdinalIgnoreCase) - { - ["DevName"] = device, - ["token"] = _eleCtlCfg.token, - ["TagName"] = eqpDaq3.label_name, - ["Value"] = "true", - }; - Log.Information($"称重完成参数:{JsonConvert.SerializeObject(dicCommand2)}"); - for (int i = 0; i < 1; i++) - { - string responseresult = await HttpClientHelper.GetRequestAsync(_eleCtlCfg.WriteTagUrl, dicCommand2,false); - Log.Information($"{device},{eqpDaq3.label_name}称重完成返回结果:{responseresult}"); - } - } + // if (result > 0) + // { + // EqpDaq eqpDaq3 = await _repository.AsSugarClient().Queryable(). + // LeftJoin((x,y)=>x.equip_id==y.id). + // Where((x,y) => y.code == eqpcode && x.label_name.Contains("称重完成")).FirstAsync(); + // + // if (eqpDaq3 == null) + // { + // throw Oops.Bah("未在数据采集中设置称重完成标签点"); + // } + // + // Dictionary dicCommand2 = new(StringComparer.OrdinalIgnoreCase) + // { + // ["DevName"] = device, + // ["token"] = _eleCtlCfg.token, + // ["TagName"] = eqpDaq3.label_name, + // ["Value"] = "true", + // }; + // Log.Information($"称重完成参数:{JsonConvert.SerializeObject(dicCommand2)}"); + // for (int i = 0; i < 1; i++) + // { + // string responseresult = await HttpClientHelper.GetRequestAsync(_eleCtlCfg.WriteTagUrl, dicCommand2,false); + // Log.Information($"{device},{eqpDaq3.label_name}称重完成返回结果:{responseresult}"); + // } + // } return result; }