Commit e6be5cee LN

增加日志打印,入库bug修改

1 个父辈 50681474
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
<add key ="UseTrayCheck" value ="0"/> <add key ="UseTrayCheck" value ="0"/>
<!--是否调试状态--> <!--是否调试状态-->
<add key="IsInDebug" value="1" /> <add key="IsInDebug" value="1" />
<add key ="Server_Log_Open" value ="1"/>
</appSettings> </appSettings>
<log4net> <log4net>
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender"> <appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
......
...@@ -72,6 +72,10 @@ namespace OnlineStore.Common ...@@ -72,6 +72,10 @@ namespace OnlineStore.Common
LOGGER.Error("JsonHelper.DeserializeJsonToObject 出错【result=" + result + "】" + ex); LOGGER.Error("JsonHelper.DeserializeJsonToObject 出错【result=" + result + "】" + ex);
} }
} }
if (isLog == 1)
{
LOGGER.Info("Post【" + url + "】【" + json + "】收到【" + result + "】");
}
} }
} }
catch (Exception ex) catch (Exception ex)
...@@ -83,10 +87,10 @@ namespace OnlineStore.Common ...@@ -83,10 +87,10 @@ namespace OnlineStore.Common
private static int isLog = ConfigAppSettings.GetIntValue(Setting_Init.Server_Log_Open); private static int isLog = ConfigAppSettings.GetIntValue(Setting_Init.Server_Log_Open);
public static string Post(string url, string paramData, Encoding encoding) public static string Post(string url, string paramData, Encoding encoding)
{ {
if (isLog == 1) //if (isLog == 1)
{ //{
LOGGER.Info("给服务器发送数据【" + paramData + "】 "); // LOGGER.Info("给服务器发送数据【" + paramData + "】 ");
} //}
if (paramData != "null" && paramData != null) if (paramData != "null" && paramData != null)
{ {
// LogUtil.debug(LOGGER, "HTTP POST to " + url + " \n\t >> " + paramData); // LogUtil.debug(LOGGER, "HTTP POST to " + url + " \n\t >> " + paramData);
...@@ -119,7 +123,7 @@ namespace OnlineStore.Common ...@@ -119,7 +123,7 @@ namespace OnlineStore.Common
} }
if (isLog == 1) if (isLog == 1)
{ {
LOGGER.Info("收到服务器数据【" + result + "】"); LOGGER.Info("Post【"+ url + "】【"+ paramData + "】收到【" + result + "】");
} }
return result; return result;
} }
......
...@@ -464,36 +464,36 @@ namespace OnlineStore.DeviceLibrary ...@@ -464,36 +464,36 @@ namespace OnlineStore.DeviceLibrary
} }
return ""; return "";
} }
public void OpenDoor(int type=1,StoreMoveInfo moveInfo=null) //public void OpenDoor(int type=1,StoreMoveInfo moveInfo=null)
{ //{
if (type.Equals(1)) // if (type.Equals(1))
{ // {
} // }
else // else
{ // {
} // }
if (moveInfo != null) // if (moveInfo != null)
{ // {
} // }
} //}
public void CloseDoor(int type = 1, StoreMoveInfo moveInfo=null) //public void CloseDoor(int type = 1, StoreMoveInfo moveInfo=null)
{ //{
if (type.Equals(1)) // if (type.Equals(1))
{ // {
} // }
else // else
{ // {
} // }
if (moveInfo != null) // if (moveInfo != null)
{ // {
} // }
} //}
/// <summary> /// <summary>
/// 原点返回处理 /// 原点返回处理
...@@ -1188,10 +1188,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -1188,10 +1188,10 @@ namespace OnlineStore.DeviceLibrary
//TODO:判断BOX是否处于可以入库状态,如果调试或急停中,需要返回给服务器; //TODO:判断BOX是否处于可以入库状态,如果调试或急停中,需要返回给服务器;
if (CanStarInOut()) if (CanStarInOut())
{ {
InOutParam param = new InOutParam(inoutInfo);
StartInStoreMove(param);
//如果当前正在出入库中,需要记录下来,等待空闲时执行 //如果当前正在出入库中,需要记录下来,等待空闲时执行
LogUtil.info(LOGGER, StoreName + " 收到服务器入库命令:【" + inoutInfo.ToStr() + "】开始入库!"); LogUtil.info(LOGGER, StoreName + " 收到服务器入库命令:【" + inoutInfo.ToStr() + "】开始入库!");
InOutParam param = new InOutParam(inoutInfo);
StartInStoreMove(param);
} }
else else
{ {
...@@ -1202,88 +1202,88 @@ namespace OnlineStore.DeviceLibrary ...@@ -1202,88 +1202,88 @@ namespace OnlineStore.DeviceLibrary
} }
public bool ReviceLineCheckInStoreCMD(string posId, string plateH, string plateW, string message) //public bool ReviceLineCheckInStoreCMD(string posId, string plateH, string plateW, string message)
{ //{
string logName = "入库库位验证【 " + message + "】【" + posId + "】:"; // string logName = "入库库位验证【 " + message + "】【" + posId + "】:";
try // try
{ // {
if (storeRunStatus.Equals(StoreRunStatus.Wait))
{
LogUtil.info(LOGGER, logName+ " 设备未启动,验证失败");
return false;
}
// CodeMsg = "收到二维码【 " + message + "】,发送给服务器获取入库PosID";
LogUtil.debug(LOGGER, logName+"发送给服务器验证入库PosID");
//发送扫码内容到服务器进行入库操作
Operation operation = getLineBoxStatus();
operation.op = 1;
operation.data = new Dictionary<string, string>() { { "code", message }, { "boxId", StoreID.ToString() } };
operation.data.Add("inPos", posId);
string server = ConfigAppSettings.GetValue(Setting_Init.http_server);
Operation resultOperation = HttpHelper.Post(StoreManager.GetPostApi(server), operation, false);
if (resultOperation == null)
{
// CodeMsg = "二维码【" + message + "】没有收到服务器反馈";
LogUtil.info(LOGGER, logName + " 没有收到服务器反馈 ");
}
else if (!string.IsNullOrEmpty(resultOperation.msg))
{
//如果有提示消息,直接显示提示
LogUtil.info(LOGGER, logName + "服务器反馈 :" + resultOperation.msg);
} // if (storeRunStatus.Equals(StoreRunStatus.Wait))
else if (resultOperation.op.Equals(1)) // {
{ // LogUtil.info(LOGGER, logName+ " 设备未启动,验证失败");
LogUtil.info(LOGGER, logName + " 成功"); // return false;
return true; // }
} // // CodeMsg = "收到二维码【 " + message + "】,发送给服务器获取入库PosID";
} // LogUtil.debug(LOGGER, logName+"发送给服务器验证入库PosID");
catch (Exception ex) // //发送扫码内容到服务器进行入库操作
{ // Operation operation = getLineBoxStatus();
LogUtil.info(LOGGER, logName + " 出错:" + ex.ToString()); // operation.op = 1;
// operation.data = new Dictionary<string, string>() { { "code", message }, { "boxId", StoreID.ToString() } };
// operation.data.Add("inPos", posId);
// string server = ConfigAppSettings.GetValue(Setting_Init.http_server);
// Operation resultOperation = HttpHelper.Post(StoreManager.GetPostApi(server), operation, false);
// if (resultOperation == null)
// {
// // CodeMsg = "二维码【" + message + "】没有收到服务器反馈";
// LogUtil.info(LOGGER, logName + " 没有收到服务器反馈 ");
// }
// else if (!string.IsNullOrEmpty(resultOperation.msg))
// {
// //如果有提示消息,直接显示提示
// LogUtil.info(LOGGER, logName + "服务器反馈 :" + resultOperation.msg);
} // }
return false; // else if (resultOperation.op.Equals(1))
}
public void ReviceLineInStoreCMD(string posId, string plateH, string plateW, string message)
{
string logName = "流水线入库命令【 " + message + "】【" + posId + "】:";
//if (!LineConnect.WaitInStoreList.Contains(posId))
//{
// LogUtil.error(logName + "库位未验证通过,重新验证库位");
// bool result = ReviceLineCheckInStoreCMD(posId, plateH, plateW, message);
// if (!result)
// { // {
// return; // LogUtil.info(LOGGER, logName + " 成功");
// return true;
// }
// } // }
// catch (Exception ex)
// {
// LogUtil.info(LOGGER, logName + " 出错:" + ex.ToString());
// }
// return false;
//} //}
//else //public void ReviceLineInStoreCMD(string posId, string plateH, string plateW, string message)
//{ //{
// LineConnect.WaitInStoreList.Remove(posId); // string logName = "流水线入库命令【 " + message + "】【" + posId + "】:";
// //if (!LineConnect.WaitInStoreList.Contains(posId))
// //{
// // LogUtil.error(logName + "库位未验证通过,重新验证库位");
// // bool result = ReviceLineCheckInStoreCMD(posId, plateH, plateW, message);
// // if (!result)
// // {
// // return;
// // }
// //}
// //else
// //{
// // LineConnect.WaitInStoreList.Remove(posId);
// //}
// //根据发送的posId获取位置列表
// ACSquareSPosition position = CSVPositionReader<ACSquareSPosition>.GetPositon(posId);
// if (position == null)
// { //出入库没有找到服务器发送的库位,需要打印日志方便查询原因
// WarnMsg = "入库未找到库位:二维码【" + message + "】库位【" + posId + "】 ";
// LogUtil.error(logName + "未找到库位");
// // LogUtil.info(LOGGER, "收到流水线入库:入库未找到库位:二维码【" + message + "】库位【" + posId + "】");
// return;
// }
// //TODO:判断BOX是否处于可以入库状态,如果调试或急停中,需要返回给服务器;
// if (CanStarInOut())
// {
// InOutParam param = new InOutParam(new InOutPosInfo( message, posId, plateH, plateW));
// LogUtil.info(logName + " 开始入库!");
// StartInStoreMove(param);
// //如果当前正在出入库中,需要记录下来,等待空闲时执行
// }
// else
// {
// LogUtil.info(logName + " 正在忙碌中,无法入库!");
// }
//} //}
//根据发送的posId获取位置列表
ACSquareSPosition position = CSVPositionReader<ACSquareSPosition>.GetPositon(posId);
if (position == null)
{ //出入库没有找到服务器发送的库位,需要打印日志方便查询原因
WarnMsg = "入库未找到库位:二维码【" + message + "】库位【" + posId + "】 ";
LogUtil.error(logName + "未找到库位");
// LogUtil.info(LOGGER, "收到流水线入库:入库未找到库位:二维码【" + message + "】库位【" + posId + "】");
return;
}
//TODO:判断BOX是否处于可以入库状态,如果调试或急停中,需要返回给服务器;
if (CanStarInOut())
{
InOutParam param = new InOutParam(new InOutPosInfo( message, posId, plateH, plateW));
LogUtil.info(logName + " 开始入库!");
StartInStoreMove(param);
//如果当前正在出入库中,需要记录下来,等待空闲时执行
}
else
{
LogUtil.info(logName + " 正在忙碌中,无法入库!");
}
}
#endregion #endregion
......
...@@ -83,7 +83,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -83,7 +83,7 @@ namespace OnlineStore.DeviceLibrary
this.PosId = posId; this.PosId = posId;
this.PlateW = platew; this.PlateW = platew;
this.PlateH = plateh; this.PlateH = plateh;
this.ShelfType = shelftype;
} }
/// <summary> /// <summary>
...@@ -116,7 +116,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -116,7 +116,7 @@ namespace OnlineStore.DeviceLibrary
{ {
inType = "左侧"; inType = "左侧";
} }
else else if (ShelfType.Equals(2))
{ {
inType = "右侧"; inType = "右侧";
} }
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!