Commit 317ea9ce LN

工单料去掉getSize处理

1 个父辈 0223cd3f
......@@ -66,37 +66,37 @@ namespace OnlineStore.DeviceLibrary
InOutParam param = tray.InoutPar;
if (tray.InOrOutStore.Equals(2))
{
SecondMoveInfo.MoveParam = param.Clone();
return true;
//紧急料,分盘料,直接返回
if (param.cutReel || param.urgentReel)
{
SecondMoveInfo.MoveParam = param.Clone();
return true;
}
bool isNg = false;
//工单料获取尺寸
int robotIndex = 0;
string code = SecondMoveInfo.MoveParam.WareCode;
string result = SServerManager.GetTraySize(Name, robotIndex, code, out LastWidth, out isNg);
LogUtil.info(Name + "[" + currTrayNum + "] [" + code + "] 获取尺寸【" + LastWidth + "】【" + result + "】");
if (LastWidth > 0)
{
SecondMoveInfo.MoveParam = param.Clone();
return true;
}
else if (isNg)
{
TrayManager.UpdateInStoreNG(currTrayNum, true, result);
LogInfo("更新工单出库料[" + currTrayNum + "] [" + code + "]为NG料:" + result);
tray = TrayManager.GetTrayInfo(currTrayNum);
param = tray.InoutPar;
SecondMoveInfo.MoveParam = param.Clone();
return true;
}
else
{
LogUtil.info(Name + "[" + currTrayNum + "] [" + tray.ToStr() + "] 获取尺寸失败,托盘继续流转");
}
//if (param.cutReel || param.urgentReel)
//{
//return true;
//}
//bool isNg = false;
////工单料获取尺寸
//int robotIndex = 0;
//string code = SecondMoveInfo.MoveParam.WareCode;
//string result = SServerManager.GetTraySize(Name, robotIndex, code, out LastWidth, out isNg);
//LogUtil.info(Name + "[" + currTrayNum + "] [" + code + "] 获取尺寸【" + LastWidth + "】【" + result + "】");
//if (LastWidth > 0)
//{
// SecondMoveInfo.MoveParam = param.Clone();
// return true;
//}
//else if (isNg)
//{
// TrayManager.UpdateInStoreNG(currTrayNum, true, result);
// LogInfo("更新工单出库料[" + currTrayNum + "] [" + code + "]为NG料:" + result);
// tray = TrayManager.GetTrayInfo(currTrayNum);
// param = tray.InoutPar;
// SecondMoveInfo.MoveParam = param.Clone();
// return true;
//}
//else
//{
// LogUtil.info(Name + "[" + currTrayNum + "] [" + tray.ToStr() + "] 获取尺寸失败,托盘继续流转");
//}
}
else if (param.IsNG)
{
......
......@@ -63,64 +63,64 @@ namespace OnlineStore.DeviceLibrary
}
return codeStr;
}
public static string GetTraySize(string deviceName, int robotIndex, string codeStr, out int outSize, out bool isNg)
{
outSize = 0;
isNg = false;
string msg = "";
try
{
if (String.IsNullOrEmpty(codeStr))
{
return msg = deviceName + "未扫到条码";
}
string logName = $"GetTraySize [{robotIndex }] [{codeStr}] :";
if (string.IsNullOrEmpty(serverAddr))
{
LogUtil.error(deviceName + $"{logName}未找到服务器地址");
return msg;
}
Dictionary<string, string> paramMap = new Dictionary<string, string>();
paramMap.Add("robotIndex", robotIndex.ToString());// 参数: robotIndex = 机器人编号,IP为51的机器人为1, 52的机器人为2, 53的机器人为3
paramMap.Add("barcode", codeStr);// barcode = 扫到的条码
string server = GetAddr(Addr_getSize, paramMap);
DateTime startTime = DateTime.Now;
bool isTimeOut = false;
string resultStr = HttpHelper.Post(server, "", Encoding.UTF8, 5000, out isTimeOut);
LogUtil.info("GetTraySize " + FormUtil.GetSpanStr(DateTime.Now - startTime) + " 【" + server + "】【" + resultStr + "】");
if (isTimeOut)
{
return msg = "获取尺寸超时";
}
//返回: { "code": 0, "msg":"ok", data: 7}
ServerData serverResult = JsonHelper.DeserializeJsonToObject<ServerData>(resultStr);
if (serverResult == null)
{
return msg = "没有收到服务器反馈";
}
else if (serverResult.code.Equals(0).Equals(false))
{
// code: 0为正常,其他为异常,
//code不是0,直接NG
isNg = true;
return msg = $" [{ serverResult.code}]:" + serverResult.msg;
}
if (!serverResult.data.Equals(""))
{
// data:料盘直径,= 7时升起气缸
outSize = Convert.ToInt32(serverResult.data);
LogUtil.info(deviceName + $"{ logName} 获得尺寸:" + outSize);
}
}
catch (Exception ex)
{
LogUtil.error(deviceName + " ", ex);
}
return "";
}
//public static string GetTraySize(string deviceName, int robotIndex, string codeStr, out int outSize, out bool isNg)
//{
// outSize = 0;
// isNg = false;
// string msg = "";
// try
// {
// if (String.IsNullOrEmpty(codeStr))
// {
// return msg = deviceName + "未扫到条码";
// }
// string logName = $"GetTraySize [{robotIndex }] [{codeStr}] :";
// if (string.IsNullOrEmpty(serverAddr))
// {
// LogUtil.error(deviceName + $"{logName}未找到服务器地址");
// return msg;
// }
// Dictionary<string, string> paramMap = new Dictionary<string, string>();
// paramMap.Add("robotIndex", robotIndex.ToString());// 参数: robotIndex = 机器人编号,IP为51的机器人为1, 52的机器人为2, 53的机器人为3
// paramMap.Add("barcode", codeStr);// barcode = 扫到的条码
// string server = GetAddr(Addr_getSize, paramMap);
// DateTime startTime = DateTime.Now;
// bool isTimeOut = false;
// string resultStr = HttpHelper.Post(server, "", Encoding.UTF8, 5000, out isTimeOut);
// LogUtil.info("GetTraySize " + FormUtil.GetSpanStr(DateTime.Now - startTime) + " 【" + server + "】【" + resultStr + "】");
// if (isTimeOut)
// {
// return msg = "获取尺寸超时";
// }
// //返回: { "code": 0, "msg":"ok", data: 7}
// ServerData serverResult = JsonHelper.DeserializeJsonToObject<ServerData>(resultStr);
// if (serverResult == null)
// {
// return msg = "没有收到服务器反馈";
// }
// else if (serverResult.code.Equals(0).Equals(false))
// {
// // code: 0为正常,其他为异常,
// //code不是0,直接NG
// isNg = true;
// return msg = $" [{ serverResult.code}]:" + serverResult.msg;
// }
// if (!serverResult.data.Equals(""))
// {
// // data:料盘直径,= 7时升起气缸
// outSize = Convert.ToInt32(serverResult.data);
// LogUtil.info(deviceName + $"{ logName} 获得尺寸:" + outSize);
// }
// }
// catch (Exception ex)
// {
// LogUtil.error(deviceName + " ", ex);
// }
// return "";
//}
public static string UpdateTrayLoc(string deviceName, string barcode, string status, string locInfo)
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!