执行代码清理,修复warning
This commit is contained in:
@@ -28,6 +28,14 @@ namespace Tnb.ProductionMgr
|
||||
[HttpPost]
|
||||
public async Task<dynamic> GetWeight(string device, string jihao)
|
||||
{
|
||||
bool flag = await _redisCache.HashExist(device, jihao);
|
||||
if (!flag)
|
||||
{
|
||||
throw Oops.Bah("没有找到" + device + "----" + jihao + "的数据");
|
||||
}
|
||||
|
||||
string data = await _redisCache.GetHash(device, jihao);
|
||||
JObject? res = JsonConvert.DeserializeObject<JObject>(data);
|
||||
/*
|
||||
var dic =await _redisCache.HGetAll("TY4C-JICHU");
|
||||
string a = "";
|
||||
@@ -45,20 +53,7 @@ namespace Tnb.ProductionMgr
|
||||
await _redisCache.HSet("TY4C-JICHU", b[0], b[1]);
|
||||
}*/
|
||||
|
||||
decimal result = 0;
|
||||
bool flag = await _redisCache.HashExist(device, jihao);
|
||||
if (!flag)
|
||||
throw Oops.Bah("没有找到" + device + "----" + jihao + "的数据");
|
||||
var data = await _redisCache.GetHash(device, jihao);
|
||||
var res = JsonConvert.DeserializeObject<JObject>(data);
|
||||
if (res != null && res["Value"] != null)
|
||||
{
|
||||
result = decimal.Parse(res["Value"]!.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
throw Oops.Bah("数据格式错误");
|
||||
}
|
||||
decimal result = res != null && res["Value"] != null ? decimal.Parse(res["Value"]!.ToString()) : throw Oops.Bah("数据格式错误");
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user