debug - 报错修改

master
SoulStar 4 days ago
parent 2024be0b91
commit 92d8a6e8a9

@ -68,7 +68,7 @@ namespace Sln.Iot.Business
//转换托盘码 //转换托盘码
string traycode = Encoding.ASCII.GetString(trayBytesResult.Content); string traycode = Encoding.ASCII.GetString(trayBytesResult.Content);
traycode = traycode.Replace("\0", ""); traycode = traycode.Replace("\0", "");
_log.Info("RFID01" + traycode); _log.Info($"RFID01 [{traycode}]");
byte[] prodBytes = pordBytesResult.Content; byte[] prodBytes = pordBytesResult.Content;
string[] prodcode = new string[6]; string[] prodcode = new string[6];
//分割转换产品码 //分割转换产品码
@ -81,7 +81,7 @@ namespace Sln.Iot.Business
//connect1.SendValidateUnitsRequest("", traycode, prodcode); //connect1.SendValidateUnitsRequest("", traycode, prodcode);
//生成work唯一guid(tid) //生成work唯一guid(tid)
Guid tid = new Guid(); Guid tid = Guid.NewGuid();
//sql更新 //sql更新
bool res = trayBindingService.TrayBindingRefresh(tid, traycode, prodcode); bool res = trayBindingService.TrayBindingRefresh(tid, traycode, prodcode);
if (!res) if (!res)

@ -66,14 +66,17 @@ namespace Sln.Iot.Business
//转换托盘码 //转换托盘码
string traycode = Encoding.ASCII.GetString(trayBytesResult.Content); string traycode = Encoding.ASCII.GetString(trayBytesResult.Content);
traycode = traycode.Replace("\0", ""); traycode = traycode.Replace("\0", "");
_log.Info("RFID02" + traycode); _log.Info($"RFID02 [{traycode}]");
//sql更新 //sql更新
//待开发 记录数据
//取出work唯一guid(tid) //取出work唯一guid(tid)
string stid = trayBindingService.TidGet(traycode); string stid = trayBindingService.TidGet(traycode);
Guid.TryParse(stid, out Guid tid); if(!Guid.TryParse(stid, out Guid tid))
{
tid = Guid.Parse("11111111-1111-4111-9111-111111111111");
_log.Error("找不到对应的托盘信息赋值默认GUID");
}
bool res = false; bool res = false;
if (!res) if (!res)

@ -60,13 +60,16 @@ namespace Sln.Iot.Business
//转换托盘码 //转换托盘码
string traycode = Encoding.ASCII.GetString(trayBytesResult.Content); string traycode = Encoding.ASCII.GetString(trayBytesResult.Content);
traycode = traycode.Replace("\0", ""); traycode = traycode.Replace("\0", "");
_log.Info("RFID03" + traycode); _log.Info($"RFID03 [{traycode}]");
//sql更新 //sql更新
//取出work唯一guid(tid) //取出work唯一guid(tid)
string stid = trayBindingService.TidGet(traycode); string stid = trayBindingService.TidGet(traycode);
Guid.TryParse(stid, out Guid tid); if (!Guid.TryParse(stid, out Guid tid))
{
tid = Guid.Parse("11111111-1111-4111-9111-111111111111");
_log.Error("找不到对应的托盘信息赋值默认GUID");
}
bool res = trayBindingService.UpDateTime(DateTime.Now.ToString(), traycode, "1"); bool res = trayBindingService.UpDateTime(DateTime.Now.ToString(), traycode, "1");
if (!res) if (!res)
{ {

@ -66,12 +66,16 @@ namespace Sln.Iot.Business
//转换托盘吗 //转换托盘吗
string traycode = Encoding.ASCII.GetString(trayBytesResult.Content); string traycode = Encoding.ASCII.GetString(trayBytesResult.Content);
traycode = traycode.Replace("\0", ""); traycode = traycode.Replace("\0", "");
_log.Info("RFID04" + traycode); _log.Info($"RFID04 [{traycode}]");
//sql更新 //sql更新
//取出work唯一guid(tid) //取出work唯一guid(tid)
string stid = trayBindingService.TidGet(traycode); string stid = trayBindingService.TidGet(traycode);
Guid.TryParse(stid, out Guid tid); if (!Guid.TryParse(stid, out Guid tid))
{
tid = Guid.Parse("11111111-1111-4111-9111-111111111111");
_log.Error("找不到对应的托盘信息赋值默认GUID");
}
bool res = trayBindingService.UpDateTime(DateTime.Now.ToString(), traycode, "2"); bool res = trayBindingService.UpDateTime(DateTime.Now.ToString(), traycode, "2");
if (!res) if (!res)

@ -68,12 +68,16 @@ namespace Sln.Iot.Business
//转换托盘吗 //转换托盘吗
string traycode = Encoding.ASCII.GetString(trayBytesResult.Content); string traycode = Encoding.ASCII.GetString(trayBytesResult.Content);
traycode = traycode.Replace("\0", ""); traycode = traycode.Replace("\0", "");
_log.Info("RFID05" + traycode); _log.Info($"RFID05 [{traycode}]");
//sql更新 //sql更新
//取出work唯一guid(tid) //取出work唯一guid(tid)
string stid = trayBindingService.TidGet(traycode); string stid = trayBindingService.TidGet(traycode);
Guid.TryParse(stid, out Guid tid); if (!Guid.TryParse(stid, out Guid tid))
{
tid = Guid.Parse("11111111-1111-4111-9111-111111111111");
_log.Error("找不到对应的托盘信息赋值默认GUID");
}
bool res = trayBindingService.UpDateTime(DateTime.Now.ToString(), traycode, "4"); bool res = trayBindingService.UpDateTime(DateTime.Now.ToString(), traycode, "4");
if (!res) if (!res)

@ -75,14 +75,17 @@ namespace Sln.Iot.Business
//转换托盘吗 //转换托盘吗
string traycode = Encoding.ASCII.GetString(trayBytesResult.Content); string traycode = Encoding.ASCII.GetString(trayBytesResult.Content);
traycode = traycode.Replace("\0", ""); traycode = traycode.Replace("\0", "");
_log.Info("RFID06" + traycode); _log.Info($"RFID06 [{traycode}]");
//sql更新 //sql更新
//取出work唯一guid(tid) //取出work唯一guid(tid)
string stid = trayBindingService.TidGet(traycode); string stid = trayBindingService.TidGet(traycode);
Guid.TryParse(stid, out Guid tid); if (!Guid.TryParse(stid, out Guid tid))
{
tid = Guid.Parse("11111111-1111-4111-9111-111111111111");
_log.Error("找不到对应的托盘信息赋值默认GUID");
}
//待开发
string[] prodcode = trayBindingService.ProdCodeGet(traycode); string[] prodcode = trayBindingService.ProdCodeGet(traycode);
bool res = trayBindingService.TrayCodeDelete(traycode); bool res = trayBindingService.TrayCodeDelete(traycode);

@ -62,13 +62,17 @@ namespace Sln.Iot.Repository.service
{ {
try try
{ {
var restr = _helperV1.QuerySingle(x => x.ErrorName == Message).ErrorGuid; var restr = _helperV1.QuerySingle(x => x.ErrorName == Message);
if (restr == null)
{
return string.Empty;
};
var res = _helperV1.SqlExcute($"DELETE FROM Vacuum1Error WHERE ErrorName = '{Message}'"); var res = _helperV1.SqlExcute($"DELETE FROM Vacuum1Error WHERE ErrorName = '{Message}'");
if (res == 0) if (res == 0)
{ {
throw new Exception("删除数据不成功可能数据库中没有指定ErrorMessage的错误"); _log.Info("删除数据不成功可能数据库中没有指定ErrorMessage的错误");
} }
return restr; return restr.ErrorGuid;
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -131,13 +135,17 @@ namespace Sln.Iot.Repository.service
{ {
try try
{ {
var restr = _helperV2.QuerySingle(x => x.ErrorName == Message).ErrorGuid; var restr = _helperV2.QuerySingle(x => x.ErrorName == Message);
if(restr == null)
{
return string.Empty;
};
var res = _helperV2.SqlExcute($"DELETE FROM Vacuum2Error WHERE ErrorName = '{Message}'"); var res = _helperV2.SqlExcute($"DELETE FROM Vacuum2Error WHERE ErrorName = '{Message}'");
if (res == 0) if (res == 0)
{ {
throw new Exception("删除数据不成功可能数据库中没有指定ErrorMessage的错误"); _log.Info("删除数据不成功可能数据库中没有指定ErrorMessage的错误");
} }
return restr; return restr.ErrorGuid;
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -200,13 +208,17 @@ namespace Sln.Iot.Repository.service
{ {
try try
{ {
var restr = _helperL.QuerySingle(x => x.ErrorName == Message).ErrorGuid; var restr = _helperL.QuerySingle(x => x.ErrorName == Message);
if (restr == null)
{
return string.Empty;
};
var res = _helperL.SqlExcute($"DELETE FROM LiftError WHERE ErrorName = '{Message}'"); var res = _helperL.SqlExcute($"DELETE FROM LiftError WHERE ErrorName = '{Message}'");
if (res == 0) if (res == 0)
{ {
throw new Exception("删除数据不成功可能数据库中没有指定ErrorMessage的错误"); _log.Info("删除数据不成功可能数据库中没有指定ErrorMessage的错误");
} }
return restr; return restr.ErrorGuid;
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -269,13 +281,17 @@ namespace Sln.Iot.Repository.service
{ {
try try
{ {
var restr = _helperO.QuerySingle(x => x.ErrorName == Message).ErrorGuid; var restr = _helperO.QuerySingle(x => x.ErrorName == Message);
if (restr == null)
{
return string.Empty;
};
var res = _helperO.SqlExcute($"DELETE FROM OvenError WHERE ErrorName = '{Message}'"); var res = _helperO.SqlExcute($"DELETE FROM OvenError WHERE ErrorName = '{Message}'");
if (res == 0) if (res == 0)
{ {
throw new Exception("删除数据不成功可能数据库中没有指定ErrorMessage的错误"); _log.Info("删除数据不成功可能数据库中没有指定ErrorMessage的错误");
} }
return restr; return restr.ErrorGuid;
} }
catch (Exception ex) catch (Exception ex)
{ {

Loading…
Cancel
Save