Commit e299a231 LN

扫码时最多扫2次,通知服务器没扫到码,等待料盘拿走后,再重新开始扫码

1 个父辈 65f4f104
...@@ -39,6 +39,8 @@ ...@@ -39,6 +39,8 @@
<add key ="UseBuzzer" value ="1"/> <add key ="UseBuzzer" value ="1"/>
<add key ="StartScan_CMD" value ="S"/> <add key ="StartScan_CMD" value ="S"/>
<add key ="ShowLanguageMsg" value ="1"/> <add key ="ShowLanguageMsg" value ="1"/>
<!--每盘料扫码的次数-->
<add key ="MaxScanCount" value ="2"/>
</appSettings> </appSettings>
<log4net> <log4net>
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender"> <appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
......
...@@ -121,3 +121,8 @@ DeCodeType=解码类型,0=halcon,1=zxing解码 西安料仓解析方式。2= ...@@ -121,3 +121,8 @@ DeCodeType=解码类型,0=halcon,1=zxing解码 西安料仓解析方式。2=
20200302 20200302
进出轴回待机点需要判断原点信号亮。 进出轴回待机点需要判断原点信号亮。
20200304
扫码时最多扫2次,通知服务器没扫到码,等待料盘拿走后,再重新开始扫码
...@@ -102,5 +102,7 @@ namespace OnlineStore.Common ...@@ -102,5 +102,7 @@ namespace OnlineStore.Common
public static string Tool_TargetPosition = "Tool_TargetPosition"; public static string Tool_TargetPosition = "Tool_TargetPosition";
public static string ShowLanguageMsg = "ShowLanguageMsg"; public static string ShowLanguageMsg = "ShowLanguageMsg";
public static string Default_Language= "Default_Language"; public static string Default_Language= "Default_Language";
public static string MaxScanCount = "MaxScanCount";
} }
} }
...@@ -169,7 +169,7 @@ namespace OnlineStore.Common ...@@ -169,7 +169,7 @@ namespace OnlineStore.Common
{ {
m_clientSocket.BeginReceive(m_receiveBuffer, 0, m_receiveBuffer.Length, 0, new AsyncCallback(ReceiveCallBack), null); m_clientSocket.BeginReceive(m_receiveBuffer, 0, m_receiveBuffer.Length, 0, new AsyncCallback(ReceiveCallBack), null);
LogUtil.info(LOGGER, "Connect to " + ServerIp + ":" + ServerPort + " success!"); LogUtil.info(LOGGER, "ReConnect to " + ServerIp + ":" + ServerPort + " success!");
} }
isInProcess = false; isInProcess = false;
......
...@@ -43,6 +43,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -43,6 +43,8 @@ namespace OnlineStore.DeviceLibrary
/// </summary> /// </summary>
public bool IsHasCompress_Axis = true; public bool IsHasCompress_Axis = true;
public bool UseBuzzer = ConfigAppSettings.GetIntValue(Setting_Init.UseBuzzer).Equals(1); public bool UseBuzzer = ConfigAppSettings.GetIntValue(Setting_Init.UseBuzzer).Equals(1);
public int MaxScanCount = ConfigAppSettings.GetIntValue(Setting_Init.MaxScanCount);
public int CurrScanCount = 1;
//public ScanSocket scanSocket = new ScanSocket(); //public ScanSocket scanSocket = new ScanSocket();
private System.Timers.Timer serverConnectTimer = new System.Timers.Timer(); private System.Timers.Timer serverConnectTimer = new System.Timers.Timer();
private System.Timers.Timer IoCheckTimer = new System.Timers.Timer(); private System.Timers.Timer IoCheckTimer = new System.Timers.Timer();
...@@ -173,6 +175,12 @@ namespace OnlineStore.DeviceLibrary ...@@ -173,6 +175,12 @@ namespace OnlineStore.DeviceLibrary
mainTimer.Enabled = false; mainTimer.Enabled = false;
alarmType = StoreAlarmType.None; alarmType = StoreAlarmType.None;
if (MaxScanCount <= 0)
{
MaxScanCount = 2;
ConfigAppSettings.SaveValue(Setting_Init.MaxScanCount, MaxScanCount);
}
//急停按钮和气压检测需要一起判断 //急停按钮和气压检测需要一起判断
IO_VALUE suddenBtn = IOManager.IOValue(IO_Type.SuddenStop_BTN); IO_VALUE suddenBtn = IOManager.IOValue(IO_Type.SuddenStop_BTN);
IO_VALUE airCheck = IOManager.IOValue(IO_Type.Airpressure_Check); IO_VALUE airCheck = IOManager.IOValue(IO_Type.Airpressure_Check);
...@@ -261,6 +269,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -261,6 +269,7 @@ namespace OnlineStore.DeviceLibrary
CurrInOutCount = 0; CurrInOutCount = 0;
CurrInOutACount = 0; CurrInOutACount = 0;
CurrScanCount = 0;
IOManager.IOMove(IO_Type.Alarm_HddLed, IO_VALUE.LOW); IOManager.IOMove(IO_Type.Alarm_HddLed, IO_VALUE.LOW);
IOManager.IOMove(IO_Type.AutoRun_HddLed, IO_VALUE.HIGH); IOManager.IOMove(IO_Type.AutoRun_HddLed, IO_VALUE.HIGH);
IOManager.IOMove(IO_Type.RunSign_HddLed, IO_VALUE.LOW); IOManager.IOMove(IO_Type.RunSign_HddLed, IO_VALUE.LOW);
...@@ -1056,8 +1065,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -1056,8 +1065,8 @@ namespace OnlineStore.DeviceLibrary
{ {
isWaitScan = false; isWaitScan = false;
IsScanCode = true; IsScanCode = true;
CurrScanCount++;
LogUtil.info(StoreName + "检测到" + height + "寸料盘,开始扫码"); LogUtil.info(StoreName + "检测到" + height + "寸料盘,开始扫码,次数 ["+ CurrScanCount + "]");
GetCameraCode(); GetCameraCode();
} }
} }
...@@ -1069,6 +1078,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -1069,6 +1078,7 @@ namespace OnlineStore.DeviceLibrary
} }
else else
{ {
CurrScanCount = 0;
isWaitScan = false; isWaitScan = false;
} }
} }
...@@ -1157,8 +1167,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -1157,8 +1167,9 @@ namespace OnlineStore.DeviceLibrary
// LogUtil.info(LOGGER, StoreName + "已经累计出入库" + CurrInOutCount + "次,需要复位一下旋转轴"); // LogUtil.info(LOGGER, StoreName + "已经累计出入库" + CurrInOutCount + "次,需要复位一下旋转轴");
// } // }
//} //}
else else if(!IsDebug)
{ {
//调试状态不处理出库任务
FixtureCodeInfo currInOutFixture = null; FixtureCodeInfo currInOutFixture = null;
lock (waitOutListLock) lock (waitOutListLock)
{ {
...@@ -1317,6 +1328,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -1317,6 +1328,7 @@ namespace OnlineStore.DeviceLibrary
{ {
try try
{ {
string server = ConfigAppSettings.GetValue(Setting_Init.http_server);
IOManager.IOMove(IO_Type.Camera_Led, IO_VALUE.LOW); IOManager.IOMove(IO_Type.Camera_Led, IO_VALUE.LOW);
string message = ProcessCode(codeList); string message = ProcessCode(codeList);
message = ScanCodeManager.ReplaceCode(message); message = ScanCodeManager.ReplaceCode(message);
...@@ -1326,7 +1338,22 @@ namespace OnlineStore.DeviceLibrary ...@@ -1326,7 +1338,22 @@ namespace OnlineStore.DeviceLibrary
IsScanCode = false; IsScanCode = false;
CodeMsg =ResourceControl.GetChinaString(ResourceControl.NoCodeMsg, "没有收到二维码信息,请重新放入料盘"); CodeMsg =ResourceControl.GetChinaString(ResourceControl.NoCodeMsg, "没有收到二维码信息,请重新放入料盘");
CodeMsgEn = ResourceControl.GetEnglishString(ResourceControl.NoCodeMsg, "没有收到二维码信息,请重新放入料盘"); CodeMsgEn = ResourceControl.GetEnglishString(ResourceControl.NoCodeMsg, "没有收到二维码信息,请重新放入料盘");
LogUtil.info(LOGGER, StoreName + "没有收到二维码信息,请重新放入料盘"); if (CurrScanCount >= MaxScanCount)
{
LogUtil.info(LOGGER, StoreName + "没有收到二维码信息 【" + CurrScanCount + "】次,请重新放入料盘,通知服务器未扫到条码");
//TODO 向服务器发送未扫到码消息
//发送扫码内容到服务器进行入库操作
Operation operationT = getLineBoxStatus();
operationT.op = 1;
operationT.data = new Dictionary<string, string>() { { "code", message }, { "boxId", StoreID.ToString() } };
HttpHelper.Post(StoreManager.GetPostApi(server), operationT, false);
}
else
{
LogUtil.info(LOGGER, StoreName + "没有收到二维码信息 【" + CurrScanCount + "】次,请重新放入料盘");
}
return; return;
} }
...@@ -1343,7 +1370,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -1343,7 +1370,7 @@ namespace OnlineStore.DeviceLibrary
Operation operation = getLineBoxStatus(); Operation operation = getLineBoxStatus();
operation.op = 1; operation.op = 1;
operation.data = new Dictionary<string, string>() { { "code", message }, { "boxId", StoreID.ToString() } }; operation.data = new Dictionary<string, string>() { { "code", message }, { "boxId", StoreID.ToString() } };
string server = ConfigAppSettings.GetValue(Setting_Init.http_server); // string server = ConfigAppSettings.GetValue(Setting_Init.http_server);
Operation resultOperation = HttpHelper.Post(StoreManager.GetPostApi(server), operation, false); Operation resultOperation = HttpHelper.Post(StoreManager.GetPostApi(server), operation, false);
if (resultOperation == null) if (resultOperation == null)
{ {
...@@ -1440,20 +1467,27 @@ namespace OnlineStore.DeviceLibrary ...@@ -1440,20 +1467,27 @@ namespace OnlineStore.DeviceLibrary
private DateTime LastScanTime = DateTime.Now; private DateTime LastScanTime = DateTime.Now;
public bool IsTestCamera = false;
public void GetCameraCode() public void GetCameraCode()
{ {
TimeSpan span = DateTime.Now - LastScanTime; TimeSpan span = DateTime.Now - LastScanTime;
if (IsTestCamera && IsScanCode && (span.TotalSeconds < 60)) if ( IsScanCode && (span.TotalSeconds < 12))
{ {
LogUtil.info("上次扫码还未执行完毕,请稍后!"); LogUtil.info("上次扫码还未执行完毕,请稍后!");
return; return;
} }
IOManager.IOMove(IO_Type.Camera_Led, IO_VALUE.HIGH); IOManager.IOMove(IO_Type.Camera_Led, IO_VALUE.HIGH);
LastScanTime = DateTime.Now;
dlScanSocket.BeginScan(); dlScanSocket.BeginScan();
} }
private bool CanStartCode()
{
TimeSpan span = DateTime.Now - LastScanTime;
if (IsScanCode && span.TotalSeconds < 12)
{
return false;
}
return true;
}
private string ProcessCode(string[] codeList) private string ProcessCode(string[] codeList)
{ {
string message = ""; string message = "";
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!