称重修改到提报那

This commit is contained in:
2024-06-24 09:52:57 +08:00
parent e1a944099d
commit 493547020b
2 changed files with 52 additions and 25 deletions

View File

@@ -2042,6 +2042,33 @@ namespace Tnb.ProductionMgr
await HttpClientHelper.GetRequestAsync(_eleCtlCfg.WriteTagUrl, dicCommand2);
}
if (prdMoTask.schedule_type == 1)
{
EqpEquipment equipment = await _db.Queryable<EqpEquipment>().SingleAsync(x => x.id == prdMoTask.eqp_id);
EqpDaq eqpDaq3 = await _repository.AsSugarClient().Queryable<EqpDaq>().
LeftJoin<EqpEquipment>((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<string, string> 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();

View File

@@ -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<EqpDaq>().
LeftJoin<EqpEquipment>((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<string, string> 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<EqpDaq>().
// LeftJoin<EqpEquipment>((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<string, string> 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;
}