Commit 93e0e06e LN

bug修改

1 个父辈 44919ea1
...@@ -404,6 +404,10 @@ namespace DeviceLibrary ...@@ -404,6 +404,10 @@ namespace DeviceLibrary
public static string ProcessCode(List<CodeInfo> codeInfos) public static string ProcessCode(List<CodeInfo> codeInfos)
{ {
if (codeInfos == null||codeInfos.Count<=0)
{
return "";
}
string codeStr = ""; string codeStr = "";
foreach(CodeInfo code in codeInfos) foreach(CodeInfo code in codeInfos)
{ {
......
...@@ -293,6 +293,10 @@ namespace DeviceLibrary ...@@ -293,6 +293,10 @@ namespace DeviceLibrary
/// 已使用的真实料架号 /// 已使用的真实料架号
/// </summary> /// </summary>
public string usedRfidList = ""; public string usedRfidList = "";
/// <summary>
/// 工单号,工单号为空表示紧急出料
/// </summary>
public string orderNo = "";
public string getShelfLoc(string name) public string getShelfLoc(string name)
{ {
......
...@@ -81,9 +81,14 @@ namespace DeviceLibrary ...@@ -81,9 +81,14 @@ namespace DeviceLibrary
} }
} }
private static bool preStatus=false;
private static void Client_ConnectedEvent(bool status) private static void Client_ConnectedEvent(bool status)
{ {
if (preStatus.Equals(status))
{
return;
}
preStatus = status;
LogUtil.info("Client_ConnectedEvent := " + status); LogUtil.info("Client_ConnectedEvent := " + status);
} }
......
...@@ -36,10 +36,10 @@ namespace DeviceLibrary ...@@ -36,10 +36,10 @@ namespace DeviceLibrary
} }
public void Reset() public void Reset(string msg="")
{ {
MoveInfo.NewMove(MoveStep.Wait); MoveInfo.NewMove(MoveStep.Wait);
MoveInfo.log("执行重置,清理当前条码:"+LastCode); MoveInfo.log($"{msg} 执行重置,清理当前条码:"+ CodeManager.ProcessCode(LastCode));
LastCode = new List<CodeLibrary.CodeInfo>(); LastCode = new List<CodeLibrary.CodeInfo>();
SetWarnMsg(); SetWarnMsg();
} }
...@@ -54,10 +54,7 @@ namespace DeviceLibrary ...@@ -54,10 +54,7 @@ namespace DeviceLibrary
} }
public void ReelLeave() public void ReelLeave()
{ {
MoveInfo.NewMove(MoveStep.Wait); Reset("料盘已离开");
MoveInfo.log("料盘已离开:执行重置,清理当前条码:" + LastCode);
LastCode = new List<CodeLibrary.CodeInfo> ();
SetWarnMsg();
} }
bool pause = false; bool pause = false;
...@@ -164,8 +161,8 @@ namespace DeviceLibrary ...@@ -164,8 +161,8 @@ namespace DeviceLibrary
else else
{ {
SetWarnMsg($"{Name}: 扫码失败"); SetWarnMsg($"{Name}: 扫码失败");
MoveInfo.errlog("扫码失败 , 等待3秒后重新扫码"); MoveInfo.errlog("扫码失败 , 等待2秒后重新扫码");
Thread.Sleep(1000); Thread.Sleep(2000);
} }
} }
}); });
...@@ -193,7 +190,7 @@ namespace DeviceLibrary ...@@ -193,7 +190,7 @@ namespace DeviceLibrary
{ {
while (MoveInfo.MoveStep.Equals(MoveStep.IN03_GetPos)) while (MoveInfo.MoveStep.Equals(MoveStep.IN03_GetPos))
{ {
string shelfRfid = RobotManage.mainMachine.getReadyShelf(";"); string shelfRfid = RobotManage.mainMachine.getReadyShelf();
if (String.IsNullOrEmpty(shelfRfid)) if (String.IsNullOrEmpty(shelfRfid))
{ {
//无可用料架 //无可用料架
......
...@@ -212,7 +212,7 @@ namespace DeviceLibrary ...@@ -212,7 +212,7 @@ namespace DeviceLibrary
Running, Running,
SystemPause, SystemPause,
THoutRangeOver30m, THoutRangeOver30m,
//THoutRange, THoutRange,
InOut, InOut,
} }
} }
\ No newline at end of file \ No newline at end of file
...@@ -23,78 +23,81 @@ namespace DeviceLibrary ...@@ -23,78 +23,81 @@ namespace DeviceLibrary
} }
return true; return true;
} }
private void putReelProcess()
void StoreProcess()
{ {
if (CheckWait(StoreMoveInfo)) foreach (InReelBean inReel in inReelBeans)
return;
switch (StoreMoveInfo.MoveStep)
{ {
case MoveStep.Wait: if (inReel.ReelReady())
{
foreach (InReelBean inReel in inReelBeans) TrayInfo tray = inReel.CurrTray;
//取料
if (tray.ngReel)
{ {
if (inReel.ReelReady()) //NG门关上再放料
if (IOManager.IOValue(IO_Type.Left_NGDoor_Close_Check).Equals(IO_VALUE.HIGH) && IOManager.IOValue(IO_Type.Right_NGDoor_Close_Check).Equals(IO_VALUE.HIGH))
{ {
TrayInfo tray = inReel.CurrTray; string ngPos = getNextNgPos(tray.w);
//取料 if (ngPos == "")
if (tray.ngReel)
{ {
//NG门关上再放料 //暂无NG空位
if (IOManager.IOValue(IO_Type.Left_NGDoor_Close_Check).Equals(IO_VALUE.HIGH) && IOManager.IOValue(IO_Type.Right_NGDoor_Close_Check).Equals(IO_VALUE.HIGH)) Msg.add("[" + inReel.Name + "]获取NG库位号失败", MsgLevel.warning, ErrInfo.Empty);
{ ProcessMsgEvent?.Invoke(Msg.get());
string ngPos = getNextNgPos(tray.w);
if (ngPos == "")
{
//暂无NG空位
Msg.add("[" + inReel.Name + "]获取NG库位号失败",MsgLevel.warning,ErrInfo.Empty);
ProcessMsgEvent?.Invoke(Msg.get());
}
else
{
//送料到NG
StoreMoveInfo.NewMove(MoveStep.PutReel01_Ready);
StoreMoveInfo.MoveParam = new ReelParam(tray.barcode, tray.w, tray.h, inReel.PosName, ngPos, tray.ngReel, tray.ngMsg);
StoreMoveInfo.MoveParam.ReelOnFixture = false;
StoreMoveInfo.log("NG料准备放料:" + StoreMoveInfo.MoveParam.ToStr());
break;
}
}
} }
else else
{ {
//获取料架 //送料到NG
string pos = GetShelfPosId(tray); StoreMoveInfo.NewMove(MoveStep.PutReel01_Ready);
if (pos != "") StoreMoveInfo.MoveParam = new ReelParam(tray.barcode, tray.w, tray.h, inReel.PosName, ngPos, tray.ngReel, tray.ngMsg);
{ StoreMoveInfo.MoveParam.ReelOnFixture = false;
//送料到料架 StoreMoveInfo.log("NG料准备放料:" + StoreMoveInfo.MoveParam.ToStr());
StoreMoveInfo.NewMove(MoveStep.PutReel01_Ready); break;
StoreMoveInfo.MoveParam = new ReelParam(tray.barcode, tray.w, tray.h, inReel.PosName, pos, tray.ngReel, tray.ngMsg);
StoreMoveInfo.MoveParam.ReelOnFixture = false;
StoreMoveInfo.log("出库料准备放料:" + StoreMoveInfo.MoveParam.ToStr());
break;
}
else
{
string msg = "[" + inReel.Name + "]未找到匹配库位";
if (string.IsNullOrEmpty(tray.realRfid))
{
msg = "[" + inReel.Name + "]未找到匹配库位,需要新料架["+tray.rfid+"]";
}
else
{
msg = "[" + inReel.Name + "]未找到匹配库位,找不到料架["+tray.realRfid + "]";
}
//暂无NG空位
Msg.add("[" + inReel.Name + "]未找到匹配库位["+ tray .ToStr()+ "]", MsgLevel.warning, ErrInfo.Empty);
ProcessMsgEvent?.Invoke(Msg.get());
}
} }
} }
} }
else
{
//获取料架
string pos = GetShelfPosId(tray);
if (pos != "")
{
//送料到料架
StoreMoveInfo.NewMove(MoveStep.PutReel01_Ready);
StoreMoveInfo.MoveParam = new ReelParam(tray.barcode, tray.w, tray.h, inReel.PosName, pos, tray.ngReel, tray.ngMsg);
StoreMoveInfo.MoveParam.ReelOnFixture = false;
StoreMoveInfo.log("出库料准备放料:" + StoreMoveInfo.MoveParam.ToStr());
break;
}
else
{
string msg = "[" + inReel.Name + "]未找到匹配库位";
if (string.IsNullOrEmpty(tray.realRfid))
{
msg = "[" + inReel.Name + "]未找到匹配库位,需要新料架[" + tray.rfid + "]";
}
else
{
msg = "[" + inReel.Name + "]未找到匹配库位,找不到料架[" + tray.realRfid + "]";
}
//暂无NG空位
Msg.add("[" + inReel.Name + "]未找到匹配库位[" + tray.ToStr() + "]", MsgLevel.warning, ErrInfo.Empty);
ProcessMsgEvent?.Invoke(Msg.get());
}
}
}
}
}
void StoreProcess()
{
if (CheckWait(StoreMoveInfo))
return;
switch (StoreMoveInfo.MoveStep)
{
case MoveStep.Wait:
putReelProcess();
break; break;
// //放料,准备放料 // //放料,准备放料
// PutReel01_Ready, // PutReel01_Ready,
......
...@@ -114,15 +114,15 @@ namespace DeviceLibrary ...@@ -114,15 +114,15 @@ namespace DeviceLibrary
public void log(string msg) { public void log(string msg) {
msg = $"[{Name}][{moveStep}][{MoveParam.TargetPos}-{MoveParam.WareCode}]: {msg}"; string logMsg = $"[{Name}][{moveStep}][{MoveParam.TargetPos}-{MoveParam.WareCode}]: {msg}";
if (MoveParam.TargetPos.Equals("") && MoveParam.WareCode.Equals("")) if (MoveParam.TargetPos.Equals("") && MoveParam.WareCode.Equals(""))
{ {
msg = $"[{Name}][{moveStep}]: {msg}"; logMsg = $"[{Name}][{moveStep}]: {msg}";
} }
if (String.Compare(lastmsg,msg, StringComparison.Ordinal)!=0) if (String.Compare(lastmsg,msg, StringComparison.Ordinal)!=0)
{ {
lastmsg = msg; lastmsg = logMsg;
LogUtil.info(msg); LogUtil.info(logMsg);
} }
} }
......
...@@ -660,6 +660,13 @@ namespace TheMachine ...@@ -660,6 +660,13 @@ namespace TheMachine
} }
private void outSheftReset(string name) private void outSheftReset(string name)
{ {
//设备未复位
if (RobotManage.mainMachine.runStatus.Equals(RunStatus.Stop))
{
MessageBox.Show("设备还未启动,无法复位", "提示");
return;
}
OutShelfBean outShelf = RobotManage.mainMachine.getOutShelf(name); OutShelfBean outShelf = RobotManage.mainMachine.getOutShelf(name);
DialogResult result = MessageBox.Show("确定复位出料机构" + name + "?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1); DialogResult result = MessageBox.Show("确定复位出料机构" + name + "?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
if (result.Equals(DialogResult.OK)) if (result.Equals(DialogResult.OK))
...@@ -715,30 +722,25 @@ namespace TheMachine ...@@ -715,30 +722,25 @@ namespace TheMachine
private void btnUpScan_Click(object sender, EventArgs e) private void btnUpScan_Click(object sender, EventArgs e)
{ {
string[] camers = Setting_Init.CameraScan_IN_1; string[] cameras = Setting_Init.CameraScan_IN_1;
List<CodeLibrary.CodeInfo> codeInfos = CodeManager.CameraScan(camers.ToList()); ScanTest(cameras);
}
private void ScanTest(string[] cameras)
{
List<CodeLibrary.CodeInfo> codeInfos = CodeManager.CameraScan(cameras.ToList());
string lastCode = ""; string lastCode = "";
foreach (CodeLibrary.CodeInfo ca in codeInfos) foreach (CodeLibrary.CodeInfo ca in codeInfos)
{ {
lastCode += ca.CodeStr + "#"; lastCode += ca.CodeStr + "#";
} }
LogUtil.info("[" +String.Join(",",camers) + "]扫码测试结果:\r\n" + lastCode); LogUtil.info("[" + String.Join(",", cameras) + "]扫码测试结果:\r\n" + lastCode);
MessageBox.Show("[" + String.Join(",", camers) + crc.GetString("Res0109", "]扫码测试结果:") + lastCode); MessageBox.Show("[" + String.Join(",", cameras) + crc.GetString("Res0109", "]扫码测试结果:") + lastCode);
} }
private void btnDownScan_Click(object sender, EventArgs e) private void btnDownScan_Click(object sender, EventArgs e)
{ {
string[] camers = Setting_Init.CameraScan_IN_2; string[] camers = Setting_Init.CameraScan_IN_2;
List<CodeLibrary.CodeInfo> codeInfos = CodeManager.CameraScan(camers.ToList()); ScanTest(camers);
string lastCode = "";
foreach (CodeLibrary.CodeInfo ca in codeInfos)
{
lastCode += ca.CodeStr + "#";
}
LogUtil.info("[" + String.Join(",", camers) + "]扫码测试结果:\r\n" + lastCode);
MessageBox.Show("[" + String.Join(",", camers) + crc.GetString("Res0109", "]扫码测试结果:") + lastCode);
} }
private void chbDIsAgv_CheckedChanged(object sender, EventArgs e) private void chbDIsAgv_CheckedChanged(object sender, EventArgs e)
...@@ -746,8 +748,8 @@ namespace TheMachine ...@@ -746,8 +748,8 @@ namespace TheMachine
if (chbDIsAgv.Checked.Equals(AgvClient.DisAgv)) if (chbDIsAgv.Checked.Equals(AgvClient.DisAgv))
{ {
return; return;
} }
LogUtil.info("勾选:" + chbDIsAgv.Text + " =" +( chbDIsAgv.Checked ? "√" : "×")); LogUtil.info("勾选:" + chbDIsAgv.Text + " =" + (chbDIsAgv.Checked ? "√" : "×"));
AgvClient.setDisAgv(chbDIsAgv.Checked); AgvClient.setDisAgv(chbDIsAgv.Checked);
} }
...@@ -755,23 +757,28 @@ namespace TheMachine ...@@ -755,23 +757,28 @@ namespace TheMachine
private void btnClearNgPos_Click(object sender, EventArgs e) private void btnClearNgPos_Click(object sender, EventArgs e)
{ {
LogUtil.info("用户点击了【"+btnClearNgPos.Text+"】"); LogUtil.info("用户点击了【"+btnClearNgPos.Text+"】");
RobotManage.mainMachine.ClearNgPos();
} }
private void button1_Click(object sender, EventArgs e) private void button1_Click(object sender, EventArgs e)
{ {
string name = "IN_1"; string name = "IN_1";
InReelBean InBean = RobotManage.mainMachine.getInReelBean(name); InBeanReset(name);
DialogResult result = MessageBox.Show("确定复位"+ name + "?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
if (result.Equals(DialogResult.OK))
{
LogUtil.info("手动操作:"+name+"复位");
InBean.Reset();
}
} }
private void button2_Click(object sender, EventArgs e) private void button2_Click(object sender, EventArgs e)
{ {
string name = "IN_2"; string name = "IN_2";
InBeanReset(name);
}
private void InBeanReset(string name)
{ //设备未复位
if (RobotManage.mainMachine.runStatus.Equals(RunStatus.Stop))
{
MessageBox.Show("设备还未启动,无法复位", "提示");
return;
}
InReelBean InBean = RobotManage.mainMachine.getInReelBean(name); InReelBean InBean = RobotManage.mainMachine.getInReelBean(name);
DialogResult result = MessageBox.Show("确定复位" + name + "?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1); DialogResult result = MessageBox.Show("确定复位" + name + "?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
if (result.Equals(DialogResult.OK)) if (result.Equals(DialogResult.OK))
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!