Commit 981e0e18 几米阳光

出入库处理修改

1 个父辈 50efea0e
...@@ -1411,6 +1411,19 @@ namespace OnlineStore.DeviceLibrary ...@@ -1411,6 +1411,19 @@ namespace OnlineStore.DeviceLibrary
return; return;
} }
IsScanCode = false; IsScanCode = false;
ReviceInStoreProcess(message, resultOperation);
}
catch (Exception ex)
{
IsScanCode = false;
LOGGER.Error(StoreName + ex.StackTrace);
}
}
private void ReviceInStoreProcess(string message, Operation resultOperation)
{
try
{
Dictionary<string, string> data = resultOperation.data; Dictionary<string, string> data = resultOperation.data;
if (data != null && data.ContainsKey(ParamDefine.posId) && data.ContainsKey(ParamDefine.plateH) && data.ContainsKey(ParamDefine.plateW)) if (data != null && data.ContainsKey(ParamDefine.posId) && data.ContainsKey(ParamDefine.plateH) && data.ContainsKey(ParamDefine.plateW))
{ {
...@@ -1441,9 +1454,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -1441,9 +1454,7 @@ namespace OnlineStore.DeviceLibrary
//TODO:判断BOX是否处于可以入库状态,如果调试或急停中,需要返回给服务器; //TODO:判断BOX是否处于可以入库状态,如果调试或急停中,需要返回给服务器;
if (CanStarInOut()) if (CanStarInOut())
{ {
IsScanCode = false;
InOutStoreParam param = new InOutStoreParam(message, posId, plateH, plateW, 0); InOutStoreParam param = new InOutStoreParam(message, posId, plateH, plateW, 0);
StartInStoreMove(param); StartInStoreMove(param);
//如果当前正在出入库中,需要记录下来,等待空闲时执行 //如果当前正在出入库中,需要记录下来,等待空闲时执行
LogUtil.info(LOGGER, StoreName + " 收到服务器入库命令:库位号【" + posId + "】二维码【" + message + "】 开始入库!"); LogUtil.info(LOGGER, StoreName + " 收到服务器入库命令:库位号【" + posId + "】二维码【" + message + "】 开始入库!");
...@@ -1451,14 +1462,11 @@ namespace OnlineStore.DeviceLibrary ...@@ -1451,14 +1462,11 @@ namespace OnlineStore.DeviceLibrary
else else
{ {
LogUtil.info(LOGGER, StoreName + " 收到服务器入库命令:库位号【" + posId + "】二维码【" + message + "】 正在忙碌中,无法入库!"); LogUtil.info(LOGGER, StoreName + " 收到服务器入库命令:库位号【" + posId + "】二维码【" + message + "】 正在忙碌中,无法入库!");
IsScanCode = false;
}
} }
} }
catch (Exception ex) }catch(Exception ex)
{ {
IsScanCode = false; LogUtil.error("处理入库命令出错:" + ex.ToString());
LOGGER.Error(StoreName + ex.StackTrace);
} }
} }
...@@ -1918,10 +1926,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -1918,10 +1926,10 @@ namespace OnlineStore.DeviceLibrary
string server = ConfigAppSettings.GetValue(Setting_Init.http_server); string server = ConfigAppSettings.GetValue(Setting_Init.http_server);
Operation resultOperation = HttpHelper.Post(StoreManager.GetPostApi(server), lineOperation, false); Operation resultOperation = HttpHelper.Post(StoreManager.GetPostApi(server), lineOperation, false);
//增加报警处理 //增加报警处理
if (resultOperation.data != null && resultOperation.data.ContainsKey(ParamDefine.inTimeout)&&resultOperation.data[ParamDefine.inTimeout].ToLower().Equals("alarm")) if (resultOperation.data != null && resultOperation.data.ContainsKey(ParamDefine.inTimeout) && resultOperation.data[ParamDefine.inTimeout].ToLower().Equals("alarm"))
{ {
WarnMsg = "盘点入库超时报警"; WarnMsg = "盘点入库超时报警";
LogUtil.error(LOGGER,"收到服务器端报警:盘点入库超时报警",1000); LogUtil.error(LOGGER, "收到服务器端报警:盘点入库超时报警", 1000);
Alarm(StoreAlarmType.CheckInStoreTimeOut, StoreAlarmType.CheckInStoreTimeOut.ToString(), WarnMsg, StoreMoveType.None); Alarm(StoreAlarmType.CheckInStoreTimeOut, StoreAlarmType.CheckInStoreTimeOut.ToString(), WarnMsg, StoreMoveType.None);
} }
else else
...@@ -1934,12 +1942,33 @@ namespace OnlineStore.DeviceLibrary ...@@ -1934,12 +1942,33 @@ namespace OnlineStore.DeviceLibrary
} }
} }
//发送状态信息到服务器 //发送状态信息到服务器
if (resultOperation == null || (resultOperation.op != 2)) if (resultOperation == null || (resultOperation.op <= 0))
{ {
//判断服务端是否返回出库操作 //判断服务端是否返回出库操作
return; return;
} }
if (resultOperation.op.Equals(2))
{
ReviceOutStoreProcess(resultOperation);
} else if (resultOperation.op.Equals(1))
{
ReviceInStoreProcess("", resultOperation);
}
else
{
LogUtil.error("收到服务器命令:op=" + resultOperation.op + ",未找到对应处理");
}
TimeSpan span = DateTime.Now - time;
if (span.TotalMilliseconds > 10)
{
LogUtil.info(StoreName + "执行TimerProcess 共处理了【" + span.TotalMilliseconds + "】毫秒");
}
}
private void ReviceOutStoreProcess(Operation resultOperation)
{
try
{
Dictionary<string, string> data = resultOperation.data; Dictionary<string, string> data = resultOperation.data;
if (data != null && data.ContainsKey(ParamDefine.posId) if (data != null && data.ContainsKey(ParamDefine.posId)
&& data.ContainsKey(ParamDefine.plateH) && data.ContainsKey(ParamDefine.plateW)) && data.ContainsKey(ParamDefine.plateH) && data.ContainsKey(ParamDefine.plateW))
...@@ -1952,7 +1981,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -1952,7 +1981,7 @@ namespace OnlineStore.DeviceLibrary
{ {
needInAfterOut = data[ParamDefine.needInAfterOut].ToLower().Equals("true"); needInAfterOut = data[ParamDefine.needInAfterOut].ToLower().Equals("true");
} }
LogUtil.info(LOGGER, "收到服务器出库消息:poaIs=" + posIdStr + ",platew=" + plateWStr + ",plateh=" + plateHStr+ ",needInAfterOut="+needInAfterOut); LogUtil.info(LOGGER, "收到服务器出库消息:poaIs=" + posIdStr + ",platew=" + plateWStr + ",plateh=" + plateHStr + ",needInAfterOut=" + needInAfterOut);
char splitChar = '|'; char splitChar = '|';
string[] posIdArray = posIdStr.Split(splitChar); string[] posIdArray = posIdStr.Split(splitChar);
string[] plateWArray = plateWStr.Split(splitChar); string[] plateWArray = plateWStr.Split(splitChar);
...@@ -1983,10 +2012,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -1983,10 +2012,10 @@ namespace OnlineStore.DeviceLibrary
} }
else else
{ {
FixtureCodeInfo currInOutFixture = new FixtureCodeInfo(0, "", posId, plateW, plateH,needInAfterOut); FixtureCodeInfo currInOutFixture = new FixtureCodeInfo(0, "", posId, plateW, plateH, needInAfterOut);
if (CanStarInOut()) if (CanStarInOut())
{ {
bool result = StartOutStoreMove(new InOutStoreParam("", posId, position,needInAfterOut)); bool result = StartOutStoreMove(new InOutStoreParam("", posId, position, needInAfterOut));
if (!result) if (!result)
{ {
LogUtil.info(LOGGER, StoreName + " 执行出库【" + currInOutFixture.ToStr() + "】失败,加入等待队列"); LogUtil.info(LOGGER, StoreName + " 执行出库【" + currInOutFixture.ToStr() + "】失败,加入等待队列");
...@@ -2001,11 +2030,11 @@ namespace OnlineStore.DeviceLibrary ...@@ -2001,11 +2030,11 @@ namespace OnlineStore.DeviceLibrary
} }
} }
TimeSpan span = DateTime.Now - time;
if (span.TotalMilliseconds > 10)
{
LogUtil.info(StoreName + "执行TimerProcess 共处理了【" + span.TotalMilliseconds + "】毫秒");
} }
} catch (Exception ex)
{
LogUtil.error("处理服务器出库命令出错:" + ex.ToString());
} }
} }
#endregion #endregion
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!