Commit e6be5cee LN

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

1 个父辈 50681474
...@@ -33,7 +33,8 @@ ...@@ -33,7 +33,8 @@
<!--是否启用物料检测信号--> <!--是否启用物料检测信号-->
<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)) // if (storeRunStatus.Equals(StoreRunStatus.Wait))
{ // {
LogUtil.info(LOGGER, logName+ " 设备未启动,验证失败"); // LogUtil.info(LOGGER, logName+ " 设备未启动,验证失败");
return false; // return false;
} // }
// CodeMsg = "收到二维码【 " + message + "】,发送给服务器获取入库PosID"; // // CodeMsg = "收到二维码【 " + message + "】,发送给服务器获取入库PosID";
LogUtil.debug(LOGGER, logName+"发送给服务器验证入库PosID"); // LogUtil.debug(LOGGER, logName+"发送给服务器验证入库PosID");
//发送扫码内容到服务器进行入库操作 // //发送扫码内容到服务器进行入库操作
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() } };
operation.data.Add("inPos", posId); // operation.data.Add("inPos", posId);
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)
{ // {
// CodeMsg = "二维码【" + message + "】没有收到服务器反馈"; // // CodeMsg = "二维码【" + message + "】没有收到服务器反馈";
LogUtil.info(LOGGER, logName + " 没有收到服务器反馈 "); // LogUtil.info(LOGGER, logName + " 没有收到服务器反馈 ");
} // }
else if (!string.IsNullOrEmpty(resultOperation.msg)) // else if (!string.IsNullOrEmpty(resultOperation.msg))
{ // {
//如果有提示消息,直接显示提示 // //如果有提示消息,直接显示提示
LogUtil.info(LOGGER, logName + "服务器反馈 :" + resultOperation.msg); // LogUtil.info(LOGGER, logName + "服务器反馈 :" + resultOperation.msg);
} // }
else if (resultOperation.op.Equals(1)) // else if (resultOperation.op.Equals(1))
{ // {
LogUtil.info(LOGGER, logName + " 成功"); // LogUtil.info(LOGGER, logName + " 成功");
return true; // return true;
} // }
} // }
catch (Exception ex) // catch (Exception ex)
{ // {
LogUtil.info(LOGGER, logName + " 出错:" + ex.ToString()); // LogUtil.info(LOGGER, logName + " 出错:" + ex.ToString());
} // }
return false; // return false;
} //}
public void ReviceLineInStoreCMD(string posId, string plateH, string plateW, string message) //public void ReviceLineInStoreCMD(string posId, string plateH, string plateW, string message)
{ //{
string logName = "流水线入库命令【 " + message + "】【" + posId + "】:"; // string logName = "流水线入库命令【 " + message + "】【" + posId + "】:";
//if (!LineConnect.WaitInStoreList.Contains(posId)) // //if (!LineConnect.WaitInStoreList.Contains(posId))
//{ // //{
// LogUtil.error(logName + "库位未验证通过,重新验证库位"); // // LogUtil.error(logName + "库位未验证通过,重新验证库位");
// bool result = ReviceLineCheckInStoreCMD(posId, plateH, plateW, message); // // bool result = ReviceLineCheckInStoreCMD(posId, plateH, plateW, message);
// if (!result) // // if (!result)
// { // // {
// return; // // return;
// } // // }
//} // //}
//else // //else
//{ // //{
// LineConnect.WaitInStoreList.Remove(posId); // // LineConnect.WaitInStoreList.Remove(posId);
//} // //}
//根据发送的posId获取位置列表 // //根据发送的posId获取位置列表
ACSquareSPosition position = CSVPositionReader<ACSquareSPosition>.GetPositon(posId); // ACSquareSPosition position = CSVPositionReader<ACSquareSPosition>.GetPositon(posId);
if (position == null) // if (position == null)
{ //出入库没有找到服务器发送的库位,需要打印日志方便查询原因 // { //出入库没有找到服务器发送的库位,需要打印日志方便查询原因
WarnMsg = "入库未找到库位:二维码【" + message + "】库位【" + posId + "】 "; // WarnMsg = "入库未找到库位:二维码【" + message + "】库位【" + posId + "】 ";
LogUtil.error(logName + "未找到库位"); // LogUtil.error(logName + "未找到库位");
// LogUtil.info(LOGGER, "收到流水线入库:入库未找到库位:二维码【" + message + "】库位【" + posId + "】"); // // LogUtil.info(LOGGER, "收到流水线入库:入库未找到库位:二维码【" + message + "】库位【" + posId + "】");
return; // return;
} // }
//TODO:判断BOX是否处于可以入库状态,如果调试或急停中,需要返回给服务器; // //TODO:判断BOX是否处于可以入库状态,如果调试或急停中,需要返回给服务器;
if (CanStarInOut()) // if (CanStarInOut())
{ // {
InOutParam param = new InOutParam(new InOutPosInfo( message, posId, plateH, plateW)); // InOutParam param = new InOutParam(new InOutPosInfo( message, posId, plateH, plateW));
LogUtil.info(logName + " 开始入库!"); // LogUtil.info(logName + " 开始入库!");
StartInStoreMove(param); // StartInStoreMove(param);
//如果当前正在出入库中,需要记录下来,等待空闲时执行 // //如果当前正在出入库中,需要记录下来,等待空闲时执行
} // }
else // else
{ // {
LogUtil.info(logName + " 正在忙碌中,无法入库!"); // 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!