|
|
|
@ -70,31 +70,34 @@ namespace SlnMesnac.TouchSocket
|
|
|
|
|
_logger.LogInformation("==========================");
|
|
|
|
|
if (hk.data_type == 1)
|
|
|
|
|
{
|
|
|
|
|
if(hk.rfid == "noread")
|
|
|
|
|
BaseLog log = new BaseLog();
|
|
|
|
|
log.LogLevel = "Info";
|
|
|
|
|
log.ErrMsg = "";
|
|
|
|
|
log.Content = hk.ToJsonString();
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
hk.rfid = hk.ocr;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
string rfidStr = hk.rfid;
|
|
|
|
|
if (!string.IsNullOrEmpty(hk.rfid))
|
|
|
|
|
FilterBuffer(ref hk);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ScanLogSocket scan = new ScanLogSocket()
|
|
|
|
|
{
|
|
|
|
|
AnasysBuffer(ref rfidStr);
|
|
|
|
|
hk.rfid = rfidStr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
code = hk.code,
|
|
|
|
|
data_type = hk.data_type,
|
|
|
|
|
ocr = hk.ocr,
|
|
|
|
|
rfid = hk.rfid,
|
|
|
|
|
timestamp = hk.timestamp,
|
|
|
|
|
url = hk.url
|
|
|
|
|
};
|
|
|
|
|
ba = ScanBack(scan);
|
|
|
|
|
|
|
|
|
|
ScanLogSocket scan = new ScanLogSocket()
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
|
|
|
|
code = hk.code,
|
|
|
|
|
data_type = hk.data_type,
|
|
|
|
|
ocr = hk.ocr,
|
|
|
|
|
rfid = hk.rfid,
|
|
|
|
|
timestamp = hk.timestamp,
|
|
|
|
|
url = hk.url
|
|
|
|
|
};
|
|
|
|
|
ba= ScanBack(scan);
|
|
|
|
|
_logger.LogError(e, e.Message);
|
|
|
|
|
log.LogLevel = "Error";
|
|
|
|
|
log.ErrMsg = e.Message;
|
|
|
|
|
}
|
|
|
|
|
_baseLogService.Insert(log);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
@ -128,8 +131,8 @@ namespace SlnMesnac.TouchSocket
|
|
|
|
|
[WebApi(HttpMethodType.POST)]
|
|
|
|
|
public Back ScanStatus(ScanStatusSocket scanStatus)
|
|
|
|
|
{
|
|
|
|
|
_logger.LogInformation("扫描的状态接口");
|
|
|
|
|
_logger.LogInformation("{Data}",scanStatus.ToJsonString());
|
|
|
|
|
//_logger.LogInformation("扫描的状态接口");
|
|
|
|
|
//_logger.LogInformation("{Data}",scanStatus.ToJsonString());
|
|
|
|
|
BaseLog log = new BaseLog
|
|
|
|
|
{
|
|
|
|
|
LogLevel = "Info",
|
|
|
|
@ -180,37 +183,33 @@ namespace SlnMesnac.TouchSocket
|
|
|
|
|
public Back ScanBack(ScanLogSocket scanLog)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation("扫描数据回传接口");
|
|
|
|
|
_logger.LogInformation("{Data}", scanLog.ToJsonString());
|
|
|
|
|
//_logger.LogInformation("扫描数据回传接口");
|
|
|
|
|
//_logger.LogInformation("{Data}", scanLog.ToJsonString());
|
|
|
|
|
|
|
|
|
|
BaseLog log = new BaseLog();
|
|
|
|
|
log.LogLevel = "Info";
|
|
|
|
|
log.ErrMsg = "";
|
|
|
|
|
log.Content = scanLog.ToJsonString();
|
|
|
|
|
try
|
|
|
|
|
string result = string.Empty;
|
|
|
|
|
if (string.IsNullOrEmpty(scanLog.code) || scanLog.code == "noread")
|
|
|
|
|
{
|
|
|
|
|
var model = new ScanLogModel()
|
|
|
|
|
{
|
|
|
|
|
CreateTime = scanLog.CreateTime,
|
|
|
|
|
DataType = scanLog.data_type,
|
|
|
|
|
Code = scanLog.code,
|
|
|
|
|
Rfid = scanLog.rfid,
|
|
|
|
|
Ocr = scanLog.ocr,
|
|
|
|
|
Url = scanLog.url
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
ScanLogSocketAction?.Invoke(model);
|
|
|
|
|
_scanService.Insert(model);
|
|
|
|
|
|
|
|
|
|
result = scanLog.rfid;
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
_logger.LogError(e, e.Message);
|
|
|
|
|
log.LogLevel = "Error";
|
|
|
|
|
log.ErrMsg = e.Message;
|
|
|
|
|
result = scanLog.code;
|
|
|
|
|
}
|
|
|
|
|
_baseLogService.Insert(log);
|
|
|
|
|
|
|
|
|
|
var model = new ScanLogModel()
|
|
|
|
|
{
|
|
|
|
|
CreateTime = scanLog.CreateTime,
|
|
|
|
|
DataType = scanLog.data_type,
|
|
|
|
|
Code = scanLog.code,
|
|
|
|
|
Rfid = scanLog.rfid,
|
|
|
|
|
Ocr = scanLog.ocr,
|
|
|
|
|
Url = scanLog.url,
|
|
|
|
|
Result = result,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
ScanLogSocketAction?.Invoke(model);
|
|
|
|
|
_scanService.Insert(model);
|
|
|
|
|
|
|
|
|
|
return new Back();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@ -233,6 +232,63 @@ namespace SlnMesnac.TouchSocket
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void FilterBuffer(ref Hk hk)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (hk.rfid == "noread" || string.IsNullOrEmpty(hk.rfid))
|
|
|
|
|
{
|
|
|
|
|
if (!string.IsNullOrEmpty(hk.code) && hk.code != "noread")
|
|
|
|
|
{
|
|
|
|
|
hk.rfid = hk.code;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
string[] buffer = hk.rfid.Split(",");
|
|
|
|
|
|
|
|
|
|
if (buffer.Length > 1)
|
|
|
|
|
{
|
|
|
|
|
hk.rfid = "多条码";
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
string rfidStr = hk.rfid;
|
|
|
|
|
if (!string.IsNullOrEmpty(hk.rfid))
|
|
|
|
|
{
|
|
|
|
|
AnasysBuffer(ref rfidStr);
|
|
|
|
|
|
|
|
|
|
if(rfidStr != hk.code && !string.IsNullOrEmpty(hk.code) && hk.code != "noread")
|
|
|
|
|
{
|
|
|
|
|
hk.rfid = hk.code;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
hk.rfid = rfidStr;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//处理ATR数据
|
|
|
|
|
if (string.IsNullOrEmpty(hk.code) || hk.code == "noread")
|
|
|
|
|
{
|
|
|
|
|
if (hk.rfid != "多条码" && hk.rfid != "noread")
|
|
|
|
|
{
|
|
|
|
|
hk.code = hk.rfid;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch(Exception ex)
|
|
|
|
|
{
|
|
|
|
|
throw new InvalidOperationException($"标签处理逻辑异常:{ex.Message}");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|