Commit 73f9bc4a LN

获取尺寸失败时ng

1 个父辈 11f4be57
......@@ -385,7 +385,7 @@ namespace OnlineStore.AssemblyLine
rdbUrg.Checked = tray.InoutPar.urgentReel;
chbSmall.Checked = tray.InoutPar.smallReel;
txtTrayLoc.Text = tray.InoutPar.rfidLoc.ToString();
chbInStoNG.Checked = tray.InoutPar.InStoreNg;
chbInStoNG.Checked = tray.InoutPar.IsNG;
}
else
{
......
......@@ -66,26 +66,43 @@ namespace OnlineStore.DeviceLibrary
InOutParam param = tray.InoutPar;
if (tray.InOrOutStore.Equals(2))
{
//获取尺寸
//紧急料,分盘料,直接返回
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);
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.InStoreNg)
else if (param.IsNG)
{
SecondMoveInfo.MoveParam = param.Clone();
return true;
}
}
return false;
}
......@@ -121,13 +138,13 @@ namespace OnlineStore.DeviceLibrary
{
reIndex = i;
currCode = cc;
SecondMoveInfo.MoveParam = new InOutParam(cc.TrayNumber, cc.WareCode, cc.PosId, cc.PlateH, cc.PlateW, cc.InStoreNg);
SecondMoveInfo.MoveParam = new InOutParam(cc.TrayNumber, cc.WareCode, cc.PosId, cc.PlateH, cc.PlateW, cc.IsNG);
break;
}
}
if (reIndex >= 0)
{
if (currCode.PosId.Equals(tray.InoutPar.PosId) && tray.InOrOutStore.Equals(1) && tray.InoutPar.InStoreNg.Equals(false))
if (currCode.PosId.Equals(tray.InoutPar.PosId) && tray.InOrOutStore.Equals(1) && tray.InoutPar.IsNG.Equals(false))
{
if (!LineServer.BoxCanInStore(DeviceID))
{
......@@ -530,7 +547,7 @@ namespace OnlineStore.DeviceLibrary
{
MoveInfo.NextMoveStep(LineMoveStep.MI_04_DownWait);
InLog("入库 " + MoveInfo.SLog + ": 等待200ms后夹紧");
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(200));
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(200));
}
//只有当BOX可以进行出入库时,移栽物品,防止卡住
else if (MoveInfo.IsStep(LineMoveStep.MI_04_DownWait))
......@@ -549,20 +566,18 @@ namespace OnlineStore.DeviceLibrary
CylinderMove(null, IO_Type.TopCylinder_Up, IO_Type.TopCylinder_Down);
}
else if (MoveInfo.IsStep(LineMoveStep.MI_06_CylinderUp))
{
// MoveInfo.NextMoveStep(LineMoveStep.MI_07_ClampCheck);
// InLog("入库 " + MoveInfo.SLog + ": 等待夹爪料盘检测信号=HIGH");
// MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.ClampCylinder_Check, IO_VALUE.HIGH));
//}
//else if (MoveInfo.IsStep(LineMoveStep.MI_07_ClampCheck))
//{
{
int num = MoveInfo.MoveParam.TrayNumber;
MoveInfo.NextMoveStep(LineMoveStep.MI_10_WaitBox);
LogInfo("入库【" + posId + "】 " + MoveInfo.SLog + ": 物品已移走,更新托盘【" + num + "】为空盘,删除入库任务");
MoveInfo.WaitList.Add(WaitResultInfo.WaitBoxCanReviceTray());
TrayManager.UpdateTrayInfo(num);
RemoveInStore(MoveInfo.MoveParam);
if (OnlyProOutTray)
{
//更新位置在皮带线
SServerManager.UpdateTrayLoc(Name, MoveInfo.MoveParam.WareCode, LocStatus.INBELT, "D7");
}
InLog("放托盘(放开阻挡): " + MoveInfo.SLog + " 物品已移走,顶升气缸1下降");
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_14_TopDown);
CylinderMove(SecondMoveInfo, IO_Type.TopCylinder_Up, IO_Type.TopCylinder_Down);
......@@ -633,7 +648,7 @@ namespace OnlineStore.DeviceLibrary
string code = MoveInfo.MoveParam.WareCode;
if (OnlyProOutTray)
{
if (MoveInfo.MoveParam.InStoreNg)
if (MoveInfo.MoveParam.IsNG)
{
OutLog( MoveInfo.SLog + ",NG料已放到出料口,发送 cancelPutInTask ");
string msg = SServerManager.cancelPutInTask(Name, code);
......@@ -706,12 +721,12 @@ namespace OnlineStore.DeviceLibrary
//判断是否验证成功,如果验证失败,不入库
if (LineServer.RightInPosId(DeviceID, cc.PosId))
{
SecondMoveInfo.MoveParam = new InOutParam(cc.TrayNumber, cc.WareCode, cc.PosId, cc.PlateH, cc.PlateW, cc.InStoreNg);
SecondMoveInfo.MoveParam = new InOutParam(cc.TrayNumber, cc.WareCode, cc.PosId, cc.PlateH, cc.PlateW, cc.IsNG);
return true;
}
else
{
SecondMoveInfo.MoveParam = new InOutParam(cc.TrayNumber, cc.WareCode, cc.PosId, cc.PlateH, cc.PlateW, cc.InStoreNg);
SecondMoveInfo.MoveParam = new InOutParam(cc.TrayNumber, cc.WareCode, cc.PosId, cc.PlateH, cc.PlateW, cc.IsNG);
LogUtil.error(Name + "托盘号【" + currTrayNum + "】入库信息【" + cc.ToStr() + "】料仓未验证成功,重新发送验证消息");
LineServer.CheckInStorePos(DeviceID, cc);
return true;
......
......@@ -62,21 +62,7 @@ namespace OnlineStore.DeviceLibrary
SaveMapToFile();
}
//public static void ClearInOutParam()
//{
// LogUtil.info("-------------------点击:清空托盘。清空前打印托盘信息:");
// List<EquipDataInfo> tray = new List<EquipDataInfo> (paramdataMap.Values);
// foreach (EquipDataInfo t in tray)
// {
// LogUtil.info(t.ToStr());
// }
// paramdataMap = new ConcurrentDictionary<int, EquipDataInfo>();
// SaveMapToFile();
// LogUtil.info("-------------------点击:清空托盘。托盘内容已清空");
//}
private static string FilePath = "";
public static void InitFileData()
......
......@@ -63,9 +63,10 @@ namespace OnlineStore.DeviceLibrary
}
return codeStr;
}
public static string GetTraySize(string deviceName, int robotIndex, string codeStr, out int outSize)
public static string GetTraySize(string deviceName, int robotIndex, string codeStr, out int outSize, out bool isNg)
{
outSize = 0;
isNg = false;
string msg = "";
try
{
......@@ -73,9 +74,10 @@ namespace OnlineStore.DeviceLibrary
{
return msg = deviceName + "未扫到条码";
}
string logName = $"GetTraySize [{robotIndex }] [{codeStr}] :";
if (string.IsNullOrEmpty(serverAddr))
{
LogUtil.error(deviceName + "GetTraySize [" + robotIndex + "] [" + codeStr + "] :未找到服务器地址");
LogUtil.error(deviceName + $"{logName}未找到服务器地址");
return msg;
}
Dictionary<string, string> paramMap = new Dictionary<string, string>();
......@@ -84,27 +86,33 @@ namespace OnlineStore.DeviceLibrary
string server = GetAddr(Addr_getSize, paramMap);
DateTime startTime = DateTime.Now;
string resultStr = HttpHelper.Post(server, "");
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 = deviceName + " 【" + robotIndex + "】 条码【 " + codeStr + "】没有收到服务器反馈";
return msg = "没有收到服务器反馈";
}
else if (serverResult.code.Equals(0).Equals(false))
{
// code: 0为正常,其他为异常,
// msg:消息,
return msg = deviceName + " 【" + robotIndex + "】 条码【 " + codeStr + "】返回:" + "[" + serverResult.code + "]" + serverResult.msg;
//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 + "【" + robotIndex + "】 条码【 " + codeStr + "】,获得尺寸:" + outSize);
LogUtil.info(deviceName + $"{ logName} 获得尺寸:" + outSize);
}
}
catch (Exception ex)
......@@ -449,7 +457,7 @@ namespace OnlineStore.DeviceLibrary
cancelPutInTask(deviceName, codeStr);
result.Param = new InOutParam(0, codeStr, "", height, width, true);
result.Param.rfid = rfid;
result.Param.InStoreNg = true;
result.Param.IsNG = true;
result.Param.NgMsg = "没有收到服务器反馈";
return result;
}
......@@ -475,7 +483,7 @@ namespace OnlineStore.DeviceLibrary
result.Msg = serverResult.msg;
result.Param = new InOutParam(0, codeStr, "", height, width, true);
result.Param.rfid = rfid;
result.Param.InStoreNg = true;
result.Param.IsNG = true;
result.Param.NgMsg = "" + serverResult.msg;
return result;
}
......@@ -502,7 +510,7 @@ namespace OnlineStore.DeviceLibrary
MoveEquip moveEquip = LineManager.Line.MoveEquipMap[storeId];
if (LineManager.Line.IsReviceInPosId(moveEquip, posId))
{
result.Param.InStoreNg = true;
result.Param.IsNG = true;
result.Param.NgMsg = "入库库位重复";
result.Msg = deviceName + ("收到服务器入库命令 " + "入库库位重复: " + result.Param.ToStr() + " ,入库失败!");
return result;
......@@ -511,7 +519,7 @@ namespace OnlineStore.DeviceLibrary
}
else
{
result.Param.InStoreNg = true;
result.Param.IsNG = true;
result.Param.NgMsg = "未找到料仓[" + storeId + "]";
result.Msg = deviceName + ("收到服务器入库命令 " + "未找到料仓[" + storeId + "]: " + result.Param.ToStr() + " ,入库失败!");
return result;
......@@ -526,7 +534,7 @@ namespace OnlineStore.DeviceLibrary
}
public static void SendPosToStoreCheck(string deviceName, InOutParam param)
{
if (param == null || param.InStoreNg)
if (param == null || param.IsNG)
{
return;
}
......
......@@ -97,10 +97,10 @@ namespace OnlineStore.DeviceLibrary
public static void UpdateInStoreNG(int trayNum, bool isNg, string msg)
{
LogUtil.info("更新托盘【" + trayNum + "】InStoreNG=【" + isNg + "】NgMsg=【" + msg + "】");
LogUtil.info("更新托盘【" + trayNum + "】IsNG=【" + isNg + "】NgMsg=【" + msg + "】");
if (TrayInfoMap.ContainsKey(trayNum))
{
TrayInfoMap[trayNum].InoutPar.InStoreNg = isNg;
TrayInfoMap[trayNum].InoutPar.IsNG = isNg;
TrayInfoMap[trayNum].ShowMsg = msg;
TrayInfoMap[trayNum].LastUpdateTime = DateTime.Now;
......@@ -167,7 +167,7 @@ namespace OnlineStore.DeviceLibrary
LogUtil.info("加载到缓存托盘:" + tray.ToStr());
TrayInfoMap.TryAdd(tray.TrayNum, tray);
if (tray.InOrOutStore.Equals(1) && tray.InoutPar.InStoreNg.Equals(false) && (!tray.InoutPar.PosId.Equals("")))
if (tray.InOrOutStore.Equals(1) && tray.InoutPar.IsNG.Equals(false) && (!tray.InoutPar.PosId.Equals("")))
{
int storeId = tray.InoutPar.GetStoreId();
if (storeId > 0 && LineManager.Line.MoveEquipMap.ContainsKey(storeId))
......@@ -217,7 +217,7 @@ namespace OnlineStore.DeviceLibrary
}
//如果是入库托盘,需要清理入库消息
if (tray.InOrOutStore.Equals(1) && tray.InoutPar.InStoreNg.Equals(false) && (!tray.InoutPar.PosId.Equals("")))
if (tray.InOrOutStore.Equals(1) && tray.InoutPar.IsNG.Equals(false) && (!tray.InoutPar.PosId.Equals("")))
{
int storeId = tray.InoutPar.GetStoreId();
if (storeId > 0 && LineManager.Line.MoveEquipMap.ContainsKey(storeId))
......
......@@ -25,7 +25,7 @@ namespace OnlineStore.DeviceLibrary
this.PlateW = plateW;
this.PlateH = plateH;
this.TrayNumber = trayCode;
this.InStoreNg = instoreNg;
this.IsNG = instoreNg;
this.urgentReel = urgentReel;
this.cutReel = cutReel;
......@@ -63,11 +63,11 @@ namespace OnlineStore.DeviceLibrary
/// <summary>
/// 是否是入库NG的料盘
/// </summary>
public bool InStoreNg = false;
public bool IsNG = false;
public string NgMsg = "";
public string ToStr()
{
return $" [{ TrayNumber }] [{ WareCode }] [{ PosId }] [{ PlateW }x{ PlateH }],InStoreNg [{ InStoreNg }],urgentReel [{ urgentReel }],cutReel [{ cutReel }],smallReel [{ smallReel }],rfid [{ rfid }],rfidLoc [{ rfidLoc }]";
return $" [{ TrayNumber }] [{ WareCode }] [{ PosId }] [{ PlateW }x{ PlateH }],InStoreNg [{ IsNG }],urgentReel [{ urgentReel }],cutReel [{ cutReel }],smallReel [{ smallReel }],rfid [{ rfid }],rfidLoc [{ rfidLoc }]";
}
public string ToShortStr()
{
......
......@@ -30,17 +30,19 @@ namespace OnlineStore.DeviceLibrary
if (InOrOutStore.Equals(1))
{
type = inoutPar.InStoreNg ? "入料失败:" + ShowMsg + "[" + inoutPar.PosId + "][" + inoutPar.WareCode + "] [" + inoutPar.PlateW + "x" + inoutPar.PlateH + "] " : "入料:" + "" + inoutPar.ToStr() + "";
type = inoutPar.IsNG ? "入料失败:" + ShowMsg + "[" + inoutPar.PosId + "][" + inoutPar.WareCode + "] [" + inoutPar.PlateW + "x" + inoutPar.PlateH + "] " : "入料:" + "" + inoutPar.ToStr() + "";
}
else if (InOrOutStore.Equals(2))
{
string outType = "出料:";
string ngstr = InoutPar.IsNG ? "NG(" + InoutPar.NgMsg + ")" : "";
string outType = "出料" + ngstr + ":";
if (inoutPar.urgentReel)
{
outType = "紧急料:";
}else if (inoutPar.cutReel)
{
outType = "分盘料:";
outType = "紧急料" + ngstr + ":";
}
else if (inoutPar.cutReel)
{
outType = "分盘料" + ngstr + ":";
}
type = outType + inoutPar.ToStr();
}
......
......@@ -98,7 +98,7 @@ namespace OnlineStore.DeviceLibrary
LineRunStatus runs = (LineRunStatus)box.SRunStatus;
if (runs.Equals(LineRunStatus.Busy))
{
if (status.Equals(LineStatus.InStoreEnd) || status.Equals(LineStatus.InStoreExecute) || box.WaitInStoreList.Contains(posId))
if (status.Equals(LineStatus.OutStoreExecute) || status.Equals(LineStatus.OutStoreBoxEnd) || box.WaitInStoreList.Contains(posId))
{
return true;
}
......@@ -131,7 +131,12 @@ namespace OnlineStore.DeviceLibrary
/// <returns></returns>
public static bool BoxCanReviceTray(int id, out string NotOkMsg)
{
NotOkMsg = " [料仓" + id + "可以入库:离线] ";
string str = "可以入库";
if (id.Equals(7))
{
str = "取料";
}
NotOkMsg = $" [料仓{id}{str}:离线] ";
BoxInfo box = GetBoxInfo(id);
if (box != null)
{
......@@ -139,17 +144,17 @@ namespace OnlineStore.DeviceLibrary
TimeSpan span = DateTime.Now - box.LastMsgTime;
if (span.TotalSeconds > ClientKeepSecond)
{
NotOkMsg = " [料仓" + id + "可以入库:离线] ";
NotOkMsg = $" [料仓{id}{str}:离线] ";
return false;
}
else if (!box.HasTray.Equals(0))
{
NotOkMsg = " [料仓" + id + "可以入库:仓门口有料] ";
NotOkMsg = $" [料仓{id}{str}:仓门口有料] ";
return false;
}
else if (!box.SAlarmType.Equals(LineAlarmType.None))
{
NotOkMsg = " [料仓" + id + "可以入库:报警中] ";
NotOkMsg = $" [料仓{id}{str}:报警中] ";
return false;
}
......@@ -163,7 +168,7 @@ namespace OnlineStore.DeviceLibrary
}
else
{
NotOkMsg = " [料仓" + id + "可以入库:忙碌中] ";
NotOkMsg = $" [料仓{id}{str}:忙碌中] ";
}
}
else
......@@ -174,7 +179,7 @@ namespace OnlineStore.DeviceLibrary
}
else
{
NotOkMsg = " [料仓" + id + "可以入库:忙碌中] ";
NotOkMsg = $" [料仓{id}{str}:忙碌中] ";
}
}
}
......@@ -288,7 +293,7 @@ namespace OnlineStore.DeviceLibrary
paramList.Add(S_PlateW, param.PlateW);
paramList.Add(S_WareCode, param.WareCode);
paramList.Add(S_RFID, param.rfid);
paramList.Add(S_NG, param.InStoreNg);
paramList.Add(S_NG, param.IsNG);
string msg = ToParamStr(paramList);
TcpClientBean client = ClientMap[id];
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!