From 493547020b324b554dded27380af5311950c1ae5 Mon Sep 17 00:00:00 2001 From: zhou keda <1315948824@qq.com> Date: Mon, 24 Jun 2024 09:52:57 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=B0=E9=87=8D=E4=BF=AE=E6=94=B9=E5=88=B0?= =?UTF-8?q?=E6=8F=90=E6=8A=A5=E9=82=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Tnb.ProductionMgr/PrdMoTaskService.cs | 27 ++++++++++ .../Tnb.ProductionMgr/RedisDataService.cs | 50 +++++++++---------- 2 files changed, 52 insertions(+), 25 deletions(-) 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; }