Commit a41ebcbe 刘韬

1

1 个父辈 4b497d99
...@@ -410,11 +410,13 @@ namespace DeviceLibrary ...@@ -410,11 +410,13 @@ namespace DeviceLibrary
/// 扫码线程 /// 扫码线程
/// </summary> /// </summary>
Task<List<CodeInfo>> ScanTask; Task<List<CodeInfo>> ScanTask;
string lastcode = "";
public void ScanCode() { public void ScanCode() {
StringMoveInfo.log("开始扫码"); StringMoveInfo.log("开始扫码");
//RightMoveInfo.OneWaitCanEndStep = true; //RightMoveInfo.OneWaitCanEndStep = true;
//RightMoveInfo.WaitList.Add(WaitResultInfo.WaitScanCode()); //RightMoveInfo.WaitList.Add(WaitResultInfo.WaitScanCode());
//RightMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000)); //RightMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
int retry = 0;
try try
{ {
ScanTask = Task.Run(new Func<List<CodeInfo>>(()=> ScanTask = Task.Run(new Func<List<CodeInfo>>(()=>
...@@ -425,10 +427,23 @@ namespace DeviceLibrary ...@@ -425,10 +427,23 @@ namespace DeviceLibrary
List<CodeInfo> LastCodeList; List<CodeInfo> LastCodeList;
if (Setting_Init.SocketScanner_enable) { if (Setting_Init.SocketScanner_enable) {
retry:
LastCodeList = new List<CodeInfo>(); LastCodeList = new List<CodeInfo>();
if (RobotManage.socketScanner.Scan(Setting_Init.SocketScanner_trigger_code, Setting_Init.SocketScanner_pattern_code, out string code)) { if (RobotManage.socketScanner.Scan(Setting_Init.SocketScanner_trigger_code, Setting_Init.SocketScanner_pattern_code, out string code)) {
if (lastcode != code)
LastCodeList.Add(new CodeInfo(code, 0, 0)); {
lastcode = code;
LastCodeList.Add(new CodeInfo(code, 0, 0));
}
else {
LogUtil.info($"前后2次条码相同:{code}");
if (retry < 2)
{
retry++;
LogUtil.info($"重试,第{retry}次");
goto retry;
}
}
} }
} }
else else
......
...@@ -143,6 +143,7 @@ namespace DeviceLibrary ...@@ -143,6 +143,7 @@ namespace DeviceLibrary
break; break;
case MoveStep.StringLoad_02: case MoveStep.StringLoad_02:
StringMoveInfo.NextMoveStep(MoveStep.StringLoad_02a); StringMoveInfo.NextMoveStep(MoveStep.StringLoad_02a);
lastcode = "";
newreel = true; newreel = true;
downCheck1 = false; downCheck1 = false;
downCheck2 = false; downCheck2 = false;
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!