change - 调试,解决报错

master
SoulStar 17 hours ago
parent b340b4c216
commit 2024be0b91

@ -15,6 +15,7 @@ using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using static System.Runtime.CompilerServices.RuntimeHelpers;
namespace Sln.Iot.Business
{
@ -66,6 +67,7 @@ namespace Sln.Iot.Business
{
//转换托盘码
string traycode = Encoding.ASCII.GetString(trayBytesResult.Content);
traycode = traycode.Replace("\0", "");
_log.Info("RFID01" + traycode);
byte[] prodBytes = pordBytesResult.Content;
string[] prodcode = new string[6];
@ -73,9 +75,10 @@ namespace Sln.Iot.Business
for (int i = 0; i < 6; i++)
{
prodcode[i] = Encoding.ASCII.GetString(prodBytes[(i * 20)..(i * 20 + 20)]);
prodcode[i] = prodcode[i].Replace("\0", "");
}
connect1.SendValidateUnitsRequest("", traycode, prodcode);
//connect1.SendValidateUnitsRequest("", traycode, prodcode);
//生成work唯一guid(tid)
Guid tid = new Guid();

@ -65,6 +65,7 @@ namespace Sln.Iot.Business
{
//转换托盘码
string traycode = Encoding.ASCII.GetString(trayBytesResult.Content);
traycode = traycode.Replace("\0", "");
_log.Info("RFID02" + traycode);
//sql更新

@ -59,6 +59,7 @@ namespace Sln.Iot.Business
{
//转换托盘码
string traycode = Encoding.ASCII.GetString(trayBytesResult.Content);
traycode = traycode.Replace("\0", "");
_log.Info("RFID03" + traycode);
//sql更新

@ -65,6 +65,7 @@ namespace Sln.Iot.Business
{
//转换托盘吗
string traycode = Encoding.ASCII.GetString(trayBytesResult.Content);
traycode = traycode.Replace("\0", "");
_log.Info("RFID04" + traycode);
//sql更新
@ -117,6 +118,7 @@ namespace Sln.Iot.Business
{
//转换托盘吗
string traycode = Encoding.ASCII.GetString(trayBytesResult.Content);
traycode = traycode.Replace("\0", "");
//sql更新
string nowTime = DateTime.Now.ToString();

@ -67,6 +67,7 @@ namespace Sln.Iot.Business
{
//转换托盘吗
string traycode = Encoding.ASCII.GetString(trayBytesResult.Content);
traycode = traycode.Replace("\0", "");
_log.Info("RFID05" + traycode);
//sql更新

@ -74,6 +74,7 @@ namespace Sln.Iot.Business
{
//转换托盘吗
string traycode = Encoding.ASCII.GetString(trayBytesResult.Content);
traycode = traycode.Replace("\0", "");
_log.Info("RFID06" + traycode);
//sql更新

@ -14,6 +14,7 @@ using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
using static System.Runtime.CompilerServices.RuntimeHelpers;
namespace Sln.Iot.Business
{
@ -24,15 +25,24 @@ namespace Sln.Iot.Business
private readonly PLCConnect _plc = PLCConnect.Instance;
private readonly SerilogHelper _log = SerilogHelper.Instance;
private TrayBindingService trayBindingService = TrayBindingService.Instance;
private ErrorAnalyseBusiness _errorAnalyse;
private RecipeBusiness _recipeBusiness;
public TestBusiness()
{
_errorAnalyse = new ErrorAnalyseBusiness();
_recipeBusiness = new RecipeBusiness();
//_errorAnalyse = new ErrorAnalyseBusiness();
//_recipeBusiness = new RecipeBusiness();
//_timer = new Timer(TimerCallback, null, 0, 1000);
//sql更新
//取出work唯一guid(tid)
var traycode = "M3\0\0\0\0\0\0\0\0\0\0";
traycode = traycode.Replace("\0", "");
bool res = trayBindingService.UpDateTime(DateTime.Now.ToString(), traycode, "1");
}
/// <summary>

@ -61,10 +61,12 @@ public class GetActiveRecipeRequestReceived1 : BaseGetActiveRecipeRequestReceive
if (res1.IsSuccess)
{
restr1 = Encoding.ASCII.GetString(res1.Content);
restr1 = restr1.Replace("\0", "");
}
if (res2.IsSuccess)
{
restr2 = Encoding.ASCII.GetString(res2.Content);
restr2 = restr2.Replace("\0", "");
}
CFXMessage response = new GetActiveRecipeResponse()

@ -66,7 +66,7 @@ namespace Sln.Iot.Repository.service
var res = _helperV1.SqlExcute($"DELETE FROM Vacuum1Error WHERE ErrorName = '{Message}'");
if (res == 0)
{
throw new Exception("删除数据不成功,可能没有指定ErrorMessage的错误");
throw new Exception("删除数据不成功,可能数据库中没有指定ErrorMessage的错误");
}
return restr;
}
@ -135,7 +135,7 @@ namespace Sln.Iot.Repository.service
var res = _helperV2.SqlExcute($"DELETE FROM Vacuum2Error WHERE ErrorName = '{Message}'");
if (res == 0)
{
throw new Exception("删除数据不成功,可能没有指定ErrorMessage的错误");
throw new Exception("删除数据不成功,可能数据库中没有指定ErrorMessage的错误");
}
return restr;
}
@ -204,7 +204,7 @@ namespace Sln.Iot.Repository.service
var res = _helperL.SqlExcute($"DELETE FROM LiftError WHERE ErrorName = '{Message}'");
if (res == 0)
{
throw new Exception("删除数据不成功,可能没有指定ErrorMessage的错误");
throw new Exception("删除数据不成功,可能数据库中没有指定ErrorMessage的错误");
}
return restr;
}
@ -273,7 +273,7 @@ namespace Sln.Iot.Repository.service
var res = _helperO.SqlExcute($"DELETE FROM OvenError WHERE ErrorName = '{Message}'");
if (res == 0)
{
throw new Exception("删除数据不成功,可能没有指定ErrorMessage的错误");
throw new Exception("删除数据不成功,可能数据库中没有指定ErrorMessage的错误");
}
return restr;
}

@ -1,4 +1,5 @@
using Sln.Iot.Model.Entity;
using Microsoft.IdentityModel.Tokens;
using Sln.Iot.Model.Entity;
using Sln.Iot.Repository.dao;
using Sln.Iot.Serilog;
using System;
@ -35,6 +36,10 @@ namespace Sln.Iot.Repository.service
{
try
{
if (guid.IsNullOrEmpty())
{
return false;
}
var res = _helper.Insert(new OvenPlcData()
{
GUID = guid,
@ -57,6 +62,10 @@ namespace Sln.Iot.Repository.service
{
try
{
if (guid.IsNullOrEmpty())
{
return false;
}
var res = _helper.Update(new OvenPlcData()
{
GUID = guid,
@ -82,6 +91,10 @@ namespace Sln.Iot.Repository.service
{
try
{
if (guid.IsNullOrEmpty())
{
return false;
}
var res = _helper.Update(new OvenPlcData()
{
GUID = guid,
@ -107,6 +120,10 @@ namespace Sln.Iot.Repository.service
{
try
{
if (guid.IsNullOrEmpty())
{
return new UnitsProcess3Entity();
}
var res = _helper.QuerySingle(x => x.GUID == guid);
if (res == null)
{

@ -1,4 +1,5 @@
using Dm;
using Microsoft.IdentityModel.Tokens;
using Sln.Iot.Model.Entity;
using Sln.Iot.Repository.dao;
using Sln.Iot.Serilog;
@ -36,6 +37,10 @@ namespace Sln.Iot.Repository.service
{
try
{
if (guid.IsNullOrEmpty())
{
return false;
}
var res = _helper.Insert(new VacuumInjectionPlcData()
{
GUID = guid,
@ -67,6 +72,10 @@ namespace Sln.Iot.Repository.service
{
try
{
if (guid.IsNullOrEmpty())
{
return new UnitsProcess1Entity();
}
var res = _helper.QuerySingle(x => x.GUID == guid);
if(res == null)
{

@ -38,7 +38,7 @@ namespace Sln.Iot.Serilog
//启用Serilog中间件
#region 通过配置文件读取日志存放位置
var appConfig = AppConfigSetting.Load();
var logPath = Path.Combine(appConfig.logPath, "Logs");
var logPath = Path.Combine(Environment.CurrentDirectory, "Logs");
#endregion
Log.Logger = new LoggerConfiguration().MinimumLevel.Information().WriteTo.Console()

@ -96,7 +96,7 @@ namespace Sln.Iot
//业务类启动
BusinessStart business = new BusinessStart();
log.Info($"系统启动成功,日志存放位置:{appConfig.logPath}");
log.Info($"系统启动成功,日志存放位置:{Environment.CurrentDirectory}");
//CFXTest cFXTest = new CFXTest();
//cFXTest.Test1();

Loading…
Cancel
Save