Commit 93e0e06e LN

bug修改

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