Commit 5509dcbf 刘韬

设置界面左下角添加了进入高级设置入口

优化下料升降轴高度计算
1 个父辈 b0fa6453
...@@ -31,9 +31,9 @@ namespace DeviceLibrary ...@@ -31,9 +31,9 @@ namespace DeviceLibrary
//public bool UserPause { get; set; } //public bool UserPause { get; set; }
public bool IgnoreSafecheck { get; set; } public bool IgnoreSafecheck { get; set; }
public bool IgnoreGratingSignal { get; set; } public bool IgnoreGratingSignal { get; set; }
public int NGBox_Count { get => nGBox_Count; set { nGBox_Count = value; Properties.Settings1.Default.NGBox_Count = value; Properties.Settings1.Default.Save(); } } public int NGBox_Count { get => nGBox_Count; set { nGBox_Count = value; ConfigHelper.Config.Set("NGBox_Count", value); ConfigHelper.Config.SaveChange(); } }
public int MSDBox_Count { get => mSDBox_Count; set { mSDBox_Count = value; Properties.Settings1.Default.MSDBox_Count = value; Properties.Settings1.Default.Save(); } } public int MSDBox_Count { get => mSDBox_Count; set { mSDBox_Count = value; ConfigHelper.Config.Set("MSDBox_Count", value); ConfigHelper.Config.SaveChange(); } }
public int PaperBox_Count { get => paperBox_Count; set { mSDBox_Count = value; Properties.Settings1.Default.PaperBox_Count = value; Properties.Settings1.Default.Save(); } } public int PaperBox_Count { get => paperBox_Count; set { mSDBox_Count = value; ConfigHelper.Config.Set("PaperBox_Count", value); ConfigHelper.Config.SaveChange(); } }
private int nGBox_Count = 0; private int nGBox_Count = 0;
private int mSDBox_Count = 0; private int mSDBox_Count = 0;
...@@ -51,9 +51,9 @@ namespace DeviceLibrary ...@@ -51,9 +51,9 @@ namespace DeviceLibrary
MoveInfo = new MoveInfo(DeviceName); MoveInfo = new MoveInfo(DeviceName);
ResetMoveInfo = MoveInfo; ResetMoveInfo = MoveInfo;
NGBox_Count = Properties.Settings1.Default.NGBox_Count; NGBox_Count = ConfigHelper.Config.Get("NGBox_Count", 0);
MSDBox_Count = Properties.Settings1.Default.MSDBox_Count; MSDBox_Count = ConfigHelper.Config.Get("MSDBox_Count", 0);
PaperBox_Count = Properties.Settings1.Default.PaperBox_Count; PaperBox_Count = ConfigHelper.Config.Get("PaperBox_Count", 0);
} }
catch (Exception e) catch (Exception e)
{ {
......
...@@ -143,7 +143,7 @@ namespace DeviceLibrary ...@@ -143,7 +143,7 @@ namespace DeviceLibrary
Point qrcenter = Label_Pix_Point; Point qrcenter = Label_Pix_Point;
//string file = @"D:\853string\Image_20210604173619489.bmp"; //string file = @"D:\853string\Image_20210604173619489.bmp";
//图像剪切范围矩形 //图像剪切范围矩形
var orgCrop = Rectangle.Inflate(new Rectangle(qrcenter, new Size(1, 1)), 510, 510); var orgCrop = Rectangle.Inflate(new Rectangle(qrcenter, new Size(1, 1)), 560, 560);
//计算剪切后的二维码中心坐标点 //计算剪切后的二维码中心坐标点
qrcenter.X = qrcenter.X - orgCrop.X; qrcenter.X = qrcenter.X - orgCrop.X;
qrcenter.Y = qrcenter.Y - orgCrop.Y; qrcenter.Y = qrcenter.Y - orgCrop.Y;
......
...@@ -25,6 +25,7 @@ namespace DeviceLibrary ...@@ -25,6 +25,7 @@ namespace DeviceLibrary
public bool canRunning { get; set; } public bool canRunning { get; set; }
public bool isBusy { get; set; } public bool isBusy { get; set; }
public bool isAlarm { get; set; } public bool isAlarm { get; set; }
public bool DisableLabel { get; set; }
//public RunStatus runStatus { get; set; } //public RunStatus runStatus { get; set; }
//public bool UserPause { get; set; } //public bool UserPause { get; set; }
public bool IgnoreSafecheck { get; set; } public bool IgnoreSafecheck { get; set; }
......
...@@ -96,13 +96,35 @@ namespace DeviceLibrary ...@@ -96,13 +96,35 @@ namespace DeviceLibrary
break; break;
case MoveStep.Lbl_02_StopUP: case MoveStep.Lbl_02_StopUP:
if (MoveInfo.ReelParam.IsNg) if (MoveInfo.ReelParam.IsNg || DisableLabel)
{ {
MoveInfo.NextMoveStep(MoveStep.Lbl_BeginOut); MoveInfo.NextMoveStep(MoveStep.Lbl_BeginOut);
CylinderMove(MoveInfo, IO_Label_Type.TrayStop_Down, IO_Label_Type.TrayStop_Up, IO_VALUE.HIGH); CylinderMove(MoveInfo, IO_Label_Type.TrayStop_Down, IO_Label_Type.TrayStop_Up, IO_VALUE.HIGH);
CylinderMove(null, IO_Label_Type.Label_Stop_Down, IO_Label_Type.Label_Stop_Up, IO_VALUE.HIGH); CylinderMove(null, IO_Label_Type.Label_Stop_Down, IO_Label_Type.Label_Stop_Up, IO_VALUE.HIGH);
MoveInfo.log("NG盘直接通过"); MoveInfo.log("NG盘直接通过");
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(3000)); MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(3000));
if (RobotManage.offlinemode)
{
ReelLocation reelLocation1 = RobotManage.offlinereelLocation;
if (!string.IsNullOrEmpty(reelLocation1.isTower))
{
MoveInfo.ReelParam.ReelDest = ReelDest.String;
}
else if (!string.IsNullOrEmpty(reelLocation1.isVTTower))
{
MoveInfo.ReelParam.ReelDest = ReelDest.Paper;
}
else if (!string.IsNullOrEmpty(reelLocation1.isVacuum))
{
MoveInfo.ReelParam.ReelDest = ReelDest.MSD;
}
}
return;
}
if (IOValue(IO_Label_Type.Label_Cylinder_Check).Equals(IO_VALUE.HIGH))
{
//Msg.add(crc.GetString("label_extract_fail", "标签吸取失败"), MsgLevel.warning);
Msg.add(crc.GetString("label_tray_notempty", "接标台上有残留标签"), MsgLevel.warning);
return; return;
} }
...@@ -154,7 +176,7 @@ namespace DeviceLibrary ...@@ -154,7 +176,7 @@ namespace DeviceLibrary
} }
if (RobotManage.offlinemode && !MoveInfo.ReelParam.IsNg) if (RobotManage.offlinemode && !MoveInfo.ReelParam.IsNg)
{ {
printTask = DoPrint(MoveInfo.ReelParam, false); printTask = DoPrint(MoveInfo.ReelParam, false);
} }
//开始吸标 //开始吸标
VacuumMoveInfo.NewMove(MoveStep.LblVacuum_01); VacuumMoveInfo.NewMove(MoveStep.LblVacuum_01);
...@@ -236,13 +258,13 @@ namespace DeviceLibrary ...@@ -236,13 +258,13 @@ namespace DeviceLibrary
case MoveStep.Lbl11: case MoveStep.Lbl11:
MoveInfo.NextMoveStep(MoveStep.Lbl13); MoveInfo.NextMoveStep(MoveStep.Lbl13);
var p5 = Config.Label_Z_P5; var p5 = Config.Label_Z_P5;
p5 = p5 - (MoveInfo.ReelParam.PlateH - 8) * Config.Label_Z_Axis_ChangeValue; p5 = p5 - (MoveInfo.ReelParam.PlateRawH - 8) * Config.Label_Z_Axis_ChangeValue;
Label_Z_Axis.AbsMove(MoveInfo, p5, Config.Label_Z_P5_speed); Label_Z_Axis.AbsMove(MoveInfo, p5, Config.Label_Z_P5_speed);
IOMove(IO_Label_Type.LabelCylinder_Work, IO_VALUE.LOW); IOMove(IO_Label_Type.LabelCylinder_Work, IO_VALUE.LOW);
MoveInfo.log("取标气缸下降.关闭吸气."); MoveInfo.log($"取标气缸下降p5:{p5}.关闭吸气.");
break; break;
case MoveStep.Lbl12: case MoveStep.Lbl12:
MoveInfo.NextMoveStep(MoveStep.Lbl13); MoveInfo.NextMoveStep(MoveStep.Lbl13);
//MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000)); //MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
break; break;
case MoveStep.Lbl13: case MoveStep.Lbl13:
...@@ -273,11 +295,11 @@ namespace DeviceLibrary ...@@ -273,11 +295,11 @@ namespace DeviceLibrary
Label_X_Axis.AbsMove(null, Config.Label_X_P2, Config.Label_X_P2_speed); Label_X_Axis.AbsMove(null, Config.Label_X_P2, Config.Label_X_P2_speed);
Label_Y_Axis.AbsMove(null, Config.Label_Y_P2, Config.Label_Y_P2_speed); Label_Y_Axis.AbsMove(null, Config.Label_Y_P2, Config.Label_Y_P2_speed);
Label_R_Axis.AbsMove(null, Config.Label_R_P2, Config.Label_R_P2_speed); Label_R_Axis.AbsMove(null, Config.Label_R_P2, Config.Label_R_P2_speed);
if (MoveInfo.ReelParam.IsNg) if (MoveInfo.ReelParam.IsNg || DisableLabel)
{ {
RobotManage.Line1.LineRun("label", 5, "Lbl_BeginOut"); RobotManage.Line1.LineRun("label", 5, "Lbl_BeginOut");
RobotManage.Line2.LineRun("label", 999, "Lbl_BeginOut"); RobotManage.Line2.LineRun("label", 999, "Lbl_BeginOut");
//MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(3000)); MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1500));
} }
MoveInfo.log("Label_XYR转到取标点,待机"); MoveInfo.log("Label_XYR转到取标点,待机");
break; break;
...@@ -294,17 +316,21 @@ namespace DeviceLibrary ...@@ -294,17 +316,21 @@ namespace DeviceLibrary
MoveInfo.log("贴标阻挡上升."); MoveInfo.log("贴标阻挡上升.");
} }
break; break;
case MoveStep.Lbl16: case MoveStep.Lbl16:
if (SendOutMoveInfo.MoveStep==MoveStep.Wait && RobotManage.filterMachine.isWaitReel) if (SendOutMoveInfo.MoveStep == MoveStep.Wait && RobotManage.filterMachine.isWaitReel)
{ {
MoveInfo.NextMoveStep(MoveStep.L30_LabelFinish); MoveInfo.NextMoveStep(MoveStep.L30_LabelFinish);
RobotManage.filterMachine.preReelParam = MoveInfo.ReelParam; RobotManage.filterMachine.preReelParam = MoveInfo.ReelParam;
SendOutMoveInfo.NewMove(MoveStep.LblSendOut_01); SendOutMoveInfo.NewMove(MoveStep.LblSendOut_01);
MoveInfo.log("送出料盘."); MoveInfo.log("送出料盘.");
if (MoveInfo.ReelParam.IsNg)
{
RobotManage.Line2.LineRun("label", 15, "Lbl_BeginOut");
}
} }
else if (MoveInfo.IsTimeOut(30)) else if (MoveInfo.IsTimeOut(30))
{ {
Msg.add(crc.GetString("wait_xx_timeout", "等待{0}超时{1}秒",RobotManage.filterMachine.DeviceName, MoveInfo.TimeOutSeconds), MsgLevel.warning); Msg.add(crc.GetString("wait_xx_timeout", "等待{0}超时{1}秒", RobotManage.filterMachine.DeviceName, MoveInfo.TimeOutSeconds), MsgLevel.warning);
MoveInfo.log($"等待分盘线超时,SendOutMoveInfo:{SendOutMoveInfo.MoveStep}"); MoveInfo.log($"等待分盘线超时,SendOutMoveInfo:{SendOutMoveInfo.MoveStep}");
} }
break; break;
...@@ -384,10 +410,16 @@ namespace DeviceLibrary ...@@ -384,10 +410,16 @@ namespace DeviceLibrary
break; break;
case MoveStep.LblVacuum_02: case MoveStep.LblVacuum_02:
VacuumMoveInfo.NextMoveStep(MoveStep.LblVacuum_03); VacuumMoveInfo.NextMoveStep(MoveStep.LblVacuum_03);
int waittime = ConfigHelper.Config.Get("Vacuum_WaitTime", 500);
VacuumMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(waittime));
VacuumMoveInfo.log($"标签吸取,等待{waittime}秒.");
break;
case MoveStep.LblVacuum_03:
VacuumMoveInfo.NextMoveStep(MoveStep.LblVacuum_04);
Label_Z_Axis.AbsMove(VacuumMoveInfo, Config.Label_Z_P2, Config.Label_Z_P2_speed); Label_Z_Axis.AbsMove(VacuumMoveInfo, Config.Label_Z_P2, Config.Label_Z_P2_speed);
VacuumMoveInfo.log("标签打印完毕,取标气缸上升,取起标签."); VacuumMoveInfo.log("标签打印完毕,取标气缸上升,取起标签.");
break; break;
case MoveStep.LblVacuum_03: case MoveStep.LblVacuum_04:
VacuumMoveInfo.log($"Label_Cylinder_Check:{IOValue(IO_Label_Type.Label_Cylinder_Check)}"); VacuumMoveInfo.log($"Label_Cylinder_Check:{IOValue(IO_Label_Type.Label_Cylinder_Check)}");
if (IOValue(IO_Label_Type.Label_Cylinder_Check).Equals(IO_VALUE.LOW)) if (IOValue(IO_Label_Type.Label_Cylinder_Check).Equals(IO_VALUE.LOW))
{ {
......
...@@ -220,7 +220,8 @@ namespace DeviceLibrary ...@@ -220,7 +220,8 @@ namespace DeviceLibrary
{ {
isOk = false; isOk = false;
WarnMsg = msg; WarnMsg = msg;
Alarm(AlarmType.AxisMoveError, WarnMsg); if (!UserPause)
Alarm(AlarmType.AxisMoveError, WarnMsg);
Msg.add(WarnMsg, MsgLevel.warning); Msg.add(WarnMsg, MsgLevel.warning);
break; break;
} }
...@@ -336,7 +337,8 @@ namespace DeviceLibrary ...@@ -336,7 +337,8 @@ namespace DeviceLibrary
} }
LogUtil.error(WarnMsg, logType + 100, second); LogUtil.error(WarnMsg, logType + 100, second);
//MoveInfo.errlog(WarnMsg); //MoveInfo.errlog(WarnMsg);
Alarm(AlarmType.IoSingleTimeOut, WarnMsg); if (!UserPause)
Alarm(AlarmType.IoSingleTimeOut, WarnMsg);
Msg.add(WarnMsg, MsgLevel.warning); Msg.add(WarnMsg, MsgLevel.warning);
} }
return true; return true;
......
...@@ -125,6 +125,7 @@ namespace DeviceLibrary ...@@ -125,6 +125,7 @@ namespace DeviceLibrary
LblVacuum_01, LblVacuum_01,
LblVacuum_02, LblVacuum_02,
LblVacuum_03, LblVacuum_03,
LblVacuum_04,
LblVacuum_end, LblVacuum_end,
LblVacuum_failure, LblVacuum_failure,
LblVacuum_printfail, LblVacuum_printfail,
......
...@@ -59,21 +59,34 @@ namespace DeviceLibrary ...@@ -59,21 +59,34 @@ namespace DeviceLibrary
T_TrayPos_Axis = new AxisBean(Config.T_TrayPos_Axis, DeviceName); T_TrayPos_Axis = new AxisBean(Config.T_TrayPos_Axis, DeviceName);
T_Y_Axis = new AxisBean(Config.T_Y_Axis, DeviceName); T_Y_Axis = new AxisBean(Config.T_Y_Axis, DeviceName);
#endregion #endregion
MoveInfo = new MoveInfo(DeviceName); MoveInfo = new MoveInfo(DeviceName);
ResetMoveInfo = MoveInfo; ResetMoveInfo = MoveInfo;
ShelfOutMoveInfo = new MoveInfo("出料串线体"); ShelfOutMoveInfo = new MoveInfo("出料串线体");
ShelfInMoveInfo = new MoveInfo("入料串线体"); ShelfInMoveInfo = new MoveInfo("入料串线体");
ShelfOutLine = new LineRunMonitor("ShelfOutLine",Config.DOList[IO_T1_Type.Line_Out_Run].GetIOAddr()); ShelfOutLine = new LineRunMonitor("ShelfOutLine", Config.DOList[IO_T1_Type.Line_Out_Run].GetIOAddr());
ShelfInLine = new LineRunMonitor("ShelfInLine",Config.DOList[IO_T1_Type.Empty_Line_Run].GetIOAddr()); ShelfInLine = new LineRunMonitor("ShelfInLine", Config.DOList[IO_T1_Type.Empty_Line_Run].GetIOAddr());
RobotManage.wistonAgvClient.EmptyShelfInReady += WistonAgvClient_EmptyShelfInReady; RobotManage.wistonAgvClient.EmptyShelfInReady += WistonAgvClient_EmptyShelfInReady;
RobotManage.wistonAgvClient.FullShelfOutReady += WistonAgvClient_FullShelfOutReady; RobotManage.wistonAgvClient.FullShelfOutReady += WistonAgvClient_FullShelfOutReady;
CenterPos = new Point(Config.String_Center_X, Config.String_Center_Y); CenterPos = new Point(Config.String_Center_X, Config.String_Center_Y);
LastStringCenter = CenterPos; LastStringCenter = CenterPos;
LedProcessInit(); LedProcessInit();
IOMonitor.RegisterIO(IO_T1_Type.Empty_LineIn_Check, Config, IO_VALUE.HIGH, delegate() { EmptyStringIN(); }); IOMonitor.RegisterIO(IO_T1_Type.Empty_LineIn_Check, Config, IO_VALUE.HIGH, delegate () { EmptyStringIN(); });
IOMonitor.RegisterIO(IO_T1_Type.EmptyString_In_Check, Config, IO_VALUE.LOW, delegate () {
//if (IOValue(IO_T1_Type.Empty_LineIn_Check).Equals(IO_VALUE.LOW))
{
//RobotManage.wistonAgvClient.NeedEnter();
}
});
IOMonitor.RegisterIO(IO_T1_Type.T1_Out_Check, Config, IO_VALUE.HIGH, delegate () {
//if (IOValue(IO_T1_Type.Empty_LineIn_Check).Equals(IO_VALUE.LOW))
{
RobotManage.wistonAgvClient.NeedLeave();
}
});
} }
catch (Exception e) catch (Exception e)
{ {
...@@ -87,15 +100,19 @@ namespace DeviceLibrary ...@@ -87,15 +100,19 @@ namespace DeviceLibrary
{ {
this.loginfo("收到满料串Agv抵达信号"); this.loginfo("收到满料串Agv抵达信号");
ShelfOutLine.LineRun("FullStringOut", 40); ShelfOutLine.LineRun("FullStringOut", 40);
Thread.Sleep(1000);
IOMove(IO_T1_Type.T1_Out_Stop, IO_VALUE.HIGH, false, 2000);
WaitIo(IO_T1_Type.T1_Out_Check, IO_VALUE.LOW, 30 * 1000);
ShelfOutLine.LineRun("FullStringOut", 15);
RobotManage.wistonAgvClient.FinishLeave();
} }
private void WistonAgvClient_EmptyShelfInReady(object sender, EventArgs e) private void WistonAgvClient_EmptyShelfInReady(object sender, EventArgs e)
{ {
this.loginfo("收到空料串Agv抵达信号"); this.loginfo("收到空料串Agv抵达信号");
ShelfInLine.LineRun("EmptyStringIN", 40); ShelfInLine.LineRun("EmptyStringIN_agv", 40);
WaitIo(IO_T1_Type.Empty_LineIn_Check, IO_VALUE.HIGH, 30); WaitIo(IO_T1_Type.Empty_LineIn_Check, IO_VALUE.HIGH, 30 * 1000);
Thread.Sleep(2000); ShelfInLine.LineRun("EmptyStringIN_agv", 15);
ShelfInLine.LineStop("EmptyStringIN");
RobotManage.wistonAgvClient.FinishEnter(); RobotManage.wistonAgvClient.FinishEnter();
} }
...@@ -117,10 +134,11 @@ namespace DeviceLibrary ...@@ -117,10 +134,11 @@ namespace DeviceLibrary
continue; continue;
if (runStatus == RunStatus.Running) if (runStatus == RunStatus.Running)
{ {
//IOMonitor(); IOMonitorFUNC();
WorkProcess(); WorkProcess();
ShelfOutProcess(); ShelfOutProcess();
ShelfInProcess(); ShelfInProcess();
} }
else if (runStatus == RunStatus.HomeReset) else if (runStatus == RunStatus.HomeReset)
{ {
...@@ -250,7 +268,7 @@ namespace DeviceLibrary ...@@ -250,7 +268,7 @@ namespace DeviceLibrary
ResetMoveInfo.NextMoveStep(MoveStep.HEND_HomeReset); ResetMoveInfo.NextMoveStep(MoveStep.HEND_HomeReset);
ResetMoveInfo.log("正在回原 顶升下降, 料串叉后退"); ResetMoveInfo.log("正在回原 顶升下降, 料串叉后退");
LocationDown(ResetMoveInfo); LocationDown(ResetMoveInfo);
CylinderMove(ResetMoveInfo, IO_T1_Type.Fork_Cylinder_Bck, IO_T1_Type.Fork_Cylinder_Fwd,IO_VALUE.LOW); CylinderMove(ResetMoveInfo, IO_T1_Type.Fork_Cylinder_Bck, IO_T1_Type.Fork_Cylinder_Fwd, IO_VALUE.LOW);
break; break;
case MoveStep.HEND_HomeReset: case MoveStep.HEND_HomeReset:
ResetMoveInfo.log("回源完成"); ResetMoveInfo.log("回源完成");
...@@ -289,5 +307,19 @@ namespace DeviceLibrary ...@@ -289,5 +307,19 @@ namespace DeviceLibrary
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_T1_Type.T1_Location2_Cylinder_Down, IO_VALUE.HIGH)); MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_T1_Type.T1_Location2_Cylinder_Down, IO_VALUE.HIGH));
} }
} }
bool calledagv = false;
void IOMonitorFUNC()
{
if (!calledagv && IOValue(IO_T1_Type.Empty_LineIn_Check).Equals(IO_VALUE.LOW)&& IOValue(IO_T1_Type.EmptyString_In_Check).Equals(IO_VALUE.LOW))
{
calledagv = true;
RobotManage.wistonAgvClient.NeedEnter();
}
else if (IOValue(IO_T1_Type.Empty_LineIn_Check).Equals(IO_VALUE.HIGH) || IOValue(IO_T1_Type.EmptyString_In_Check).Equals(IO_VALUE.HIGH))
{
calledagv = false;
}
}
} }
} }
...@@ -72,7 +72,7 @@ namespace DeviceLibrary ...@@ -72,7 +72,7 @@ namespace DeviceLibrary
break; break;
case MoveStep.T1_04_DownToReel: case MoveStep.T1_04_DownToReel:
MoveInfo.NextMoveStep(MoveStep.T1_05_ClampReel); MoveInfo.NextMoveStep(MoveStep.T1_05_ClampReel);
int pos = Config.UpdownAxis_P2 - (MoveInfo.ReelParam.PlateH - 8) * Config.UpdownAxis_ChangeValue; int pos = Config.UpdownAxis_P2 - (MoveInfo.ReelParam.PlateRawH - 8) * Config.UpdownAxis_ChangeValue;
MoveInfo.log($"升降轴下降到取料位置,配置位置:{Config.UpdownAxis_P2},计算位置:{pos}"); MoveInfo.log($"升降轴下降到取料位置,配置位置:{Config.UpdownAxis_P2},计算位置:{pos}");
T_Updown_Axis.AbsMove(MoveInfo, pos, Config.UpdownAxis_P2_speed); T_Updown_Axis.AbsMove(MoveInfo, pos, Config.UpdownAxis_P2_speed);
T_TrayPos_Axis.AbsMove(null, Config.TrayPos_P1, Config.TrayPos_P1_speed); T_TrayPos_Axis.AbsMove(null, Config.TrayPos_P1, Config.TrayPos_P1_speed);
...@@ -135,8 +135,11 @@ namespace DeviceLibrary ...@@ -135,8 +135,11 @@ namespace DeviceLibrary
T_Pan_Axis.AbsMove(MoveInfo, Pan_X, Config.Pan_P2_speed); T_Pan_Axis.AbsMove(MoveInfo, Pan_X, Config.Pan_P2_speed);
T_Y_Axis.AbsMove(MoveInfo, Y, Config.Y_P2_speed); T_Y_Axis.AbsMove(MoveInfo, Y, Config.Y_P2_speed);
MoveInfo.log($"下降到料串 CenterPos:{CenterPos}, StringCenter:{LastStringCenter}, Offset:{new Point(offset_x, offset_y)}, AXIS:{new Point(Pan_X, Y)},");
T_Updown_Axis.AbsMove(MoveInfo, Config.UpdownAxis_P3, Config.UpdownAxis_P3_speed); int p3pos = Config.UpdownAxis_P3 - (MoveInfo.ReelParam.PlateRawH - 8) * Config.UpdownAxis_ChangeValue;
T_Updown_Axis.AbsMove(MoveInfo, p3pos, Config.UpdownAxis_P3_speed);
MoveInfo.log($"下降到料串 CenterPos:{CenterPos}, StringCenter:{LastStringCenter}, Offset:{new Point(offset_x, offset_y)}, AXIS:{new Point(Pan_X, Y)},p3pos:{p3pos}");
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000)); MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
} }
else if (MoveInfo.IsTimeOut(30)) else if (MoveInfo.IsTimeOut(30))
...@@ -311,7 +314,7 @@ namespace DeviceLibrary ...@@ -311,7 +314,7 @@ namespace DeviceLibrary
Msg.add(crc.GetString("T1_ShelfReady", "料串准备完毕,等待放入料盘"), MsgLevel.info); Msg.add(crc.GetString("T1_ShelfReady", "料串准备完毕,等待放入料盘"), MsgLevel.info);
break; break;
case MoveStep.Shelf_21_EmptyIn_TrayDown: //料盘放入后调用 case MoveStep.Shelf_21_EmptyIn_TrayDown: //料盘放入后调用
var Height = ShelfInMoveInfo.ReelParam.PlateH + 3; var Height = ShelfInMoveInfo.ReelParam.PlateRawH;
var currpos = T_Batch_Axis.GetAclPosition() - Config.BatchAxis_ChangeValue * Height; var currpos = T_Batch_Axis.GetAclPosition() - Config.BatchAxis_ChangeValue * Height;
if (currpos < Config.BatchAxis_P1 + Config.BatchAxis_ChangeValue * 20) if (currpos < Config.BatchAxis_P1 + Config.BatchAxis_ChangeValue * 20)
{ {
...@@ -440,6 +443,8 @@ namespace DeviceLibrary ...@@ -440,6 +443,8 @@ namespace DeviceLibrary
ShelfOutMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_T1_Type.T1_Out_Check, IO_VALUE.HIGH)); ShelfOutMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_T1_Type.T1_Out_Check, IO_VALUE.HIGH));
break; break;
case MoveStep.Shelf_36_Out_OutLineRun: case MoveStep.Shelf_36_Out_OutLineRun:
ShelfOutMoveInfo.log("呼叫AGV取满料串");
RobotManage.wistonAgvClient.NeedLeave();
ShelfOutMoveInfo.EndMove(); ShelfOutMoveInfo.EndMove();
ShelfOutLine.LineStop("n", "Shelf_35_Out_OutLineRun"); ShelfOutLine.LineStop("n", "Shelf_35_Out_OutLineRun");
break; break;
...@@ -457,9 +462,9 @@ namespace DeviceLibrary ...@@ -457,9 +462,9 @@ namespace DeviceLibrary
// return; // return;
ShelfInLine.LineRun("EmptyStringIN", 30); ShelfInLine.LineRun("EmptyStringIN", 30);
WaitIo(IO_T1_Type.Empty_LineIn_Check, IO_VALUE.HIGH, 10); WaitIo(IO_T1_Type.Empty_LineIn_Check, IO_VALUE.HIGH, 10);
IOMove(IO_T1_Type.EmptyString_In_Stop, IO_VALUE.HIGH, false, 2000); IOMove(IO_T1_Type.EmptyString_In_Stop, IO_VALUE.HIGH, false, 3000);
WaitIo(IO_T1_Type.EmptyString_In_Check, IO_VALUE.HIGH, 10); WaitIo(IO_T1_Type.EmptyString_In_Check, IO_VALUE.HIGH, 10);
Thread.Sleep(1000); Thread.Sleep(3000);
ShelfInLine.LineStop("EmptyStringIN"); ShelfInLine.LineStop("EmptyStringIN");
this.loginfo($"T1等待位进入完成"); this.loginfo($"T1等待位进入完成");
} }
...@@ -523,6 +528,7 @@ namespace DeviceLibrary ...@@ -523,6 +528,7 @@ namespace DeviceLibrary
{ {
//return (null, 0, "调试屏蔽"); //return (null, 0, "调试屏蔽");
Bitmap bmap = Common.DeepClone(Camera._cam.GrabOneImage(RobotManage.t1Machine.Config.String_Camera)); Bitmap bmap = Common.DeepClone(Camera._cam.GrabOneImage(RobotManage.t1Machine.Config.String_Camera));
//Bitmap bmap = new Bitmap(@"D:\logs\853\Image_20210921151717963.bmp");
Bitmap bitmap = new Bitmap(bmap.Width, bmap.Height); Bitmap bitmap = new Bitmap(bmap.Width, bmap.Height);
var rectx = Config.String_Center_X - 500; var rectx = Config.String_Center_X - 500;
...@@ -553,7 +559,7 @@ namespace DeviceLibrary ...@@ -553,7 +559,7 @@ namespace DeviceLibrary
eyemlib.EyemOcsFXYR eyemOcsFXYR = new eyemlib.EyemOcsFXYR(); eyemlib.EyemOcsFXYR eyemOcsFXYR = new eyemlib.EyemOcsFXYR();
int result = eyemlib.eyemMulFuncTool(eyemImage, eyemRect, "__func1", 65, 75, ref eyemOcsFXYR, out _); int result = eyemlib.eyemMulFuncTool(eyemImage, eyemRect, "__func1", ConfigHelper.Config.Get("findcicyle_p1",95), ConfigHelper.Config.Get("findcicyle_p2", 75), ref eyemOcsFXYR, out _);
LogUtil.info($"eyemMulFuncTool:result:{result},fX:{eyemOcsFXYR.fX},fY:{eyemOcsFXYR.fY},fR:{eyemOcsFXYR.fR}"); LogUtil.info($"eyemMulFuncTool:result:{result},fX:{eyemOcsFXYR.fX},fY:{eyemOcsFXYR.fY},fR:{eyemOcsFXYR.fR}");
debugtxt = $"eyemMulFuncTool:\nresult:{result}\nfX:{eyemOcsFXYR.fX}\nfY:{eyemOcsFXYR.fY}\nfR:{eyemOcsFXYR.fR}"; debugtxt = $"eyemMulFuncTool:\nresult:{result}\nfX:{eyemOcsFXYR.fX}\nfY:{eyemOcsFXYR.fY}\nfR:{eyemOcsFXYR.fR}";
bmap.UnlockBits(bitmapData); bmap.UnlockBits(bitmapData);
......
...@@ -30,7 +30,8 @@ namespace DeviceLibrary ...@@ -30,7 +30,8 @@ namespace DeviceLibrary
FeedingMoveinfo.NextMoveStep(MoveStep.Feeding_02_Take_Picture); FeedingMoveinfo.NextMoveStep(MoveStep.Feeding_02_Take_Picture);
FeedingMoveinfo.ReelParam.PlateW = TrayWidth; FeedingMoveinfo.ReelParam.PlateW = TrayWidth;
FeedingMoveinfo.ReelParam.PlateH = TrayHight; FeedingMoveinfo.ReelParam.PlateH = TrayHight;
FeedingMoveinfo.log($"已稳定检测到料盘TrayWidth={TrayWidth},TrayHight={TrayHight}"); FeedingMoveinfo.ReelParam.PlateRawH = TrayRawHight;
FeedingMoveinfo.log($"已稳定检测到料盘TrayWidth={TrayWidth},TrayHight={TrayHight},TrayRawHight={TrayRawHight}.");
} }
break; break;
case MoveStep.Feeding_02_Take_Picture: case MoveStep.Feeding_02_Take_Picture:
...@@ -158,6 +159,7 @@ namespace DeviceLibrary ...@@ -158,6 +159,7 @@ namespace DeviceLibrary
} }
int TrayWidth = 0; int TrayWidth = 0;
int TrayHight = 0; int TrayHight = 0;
int TrayRawHight = 0;
void TrayMonitor() { void TrayMonitor() {
if (IOValue(IO_XRay_Type.Tray_Check).Equals(IO_VALUE.LOW)) if (IOValue(IO_XRay_Type.Tray_Check).Equals(IO_VALUE.LOW))
{ {
...@@ -196,6 +198,7 @@ namespace DeviceLibrary ...@@ -196,6 +198,7 @@ namespace DeviceLibrary
if (v>0) if (v>0)
FeedingMoveinfo.log($"Sensor Tray7:{Tray7},Tray13:{Tray13},Tray15:{Tray15}"); FeedingMoveinfo.log($"Sensor Tray7:{Tray7},Tray13:{Tray13},Tray15:{Tray15}");
TrayHight = CalcHight(v); TrayHight = CalcHight(v);
TrayRawHight = v;
} }
......
...@@ -56,7 +56,7 @@ namespace DeviceLibrary ...@@ -56,7 +56,7 @@ namespace DeviceLibrary
MoveInfo.NextMoveStep(MoveStep.XRay_05_GetImage); MoveInfo.NextMoveStep(MoveStep.XRay_05_GetImage);
RobotManage.XRay.Start(); RobotManage.XRay.Start();
MoveInfo.log($"打开X光"); MoveInfo.log($"打开X光");
//MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000)); MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
break; break;
case MoveStep.XRay_05_GetImage: case MoveStep.XRay_05_GetImage:
if (GrabImage()) if (GrabImage())
...@@ -211,8 +211,9 @@ namespace DeviceLibrary ...@@ -211,8 +211,9 @@ namespace DeviceLibrary
int[] countStr = new int[4]; int[] countStr = new int[4];
int result = 0; int result = 0;
int ShrinkOffset = ConfigHelper.Config.Get<int>("ShrinkOffset",100); int ShrinkOffset = ConfigHelper.Config.Get<int>("ShrinkOffset",100);
var type = Pn_Algo_Match.MatchPN(MoveInfo.ReelParam.PN); var pps = MoveInfo.ReelParam.PN.Split('-');
MoveInfo.log($"匹配到算法.{type}"); var type = Pn_Algo_Match.MatchPN(pps[0]);
MoveInfo.log($"匹配到算法.{pps[0]}={type}");
if (type.StartsWith("IP_Template_PARTS")) if (type.StartsWith("IP_Template_PARTS"))
{ {
if (!File.Exists(type.Substring(17 + 1))) if (!File.Exists(type.Substring(17 + 1)))
......
...@@ -26,6 +26,7 @@ namespace DeviceLibrary ...@@ -26,6 +26,7 @@ namespace DeviceLibrary
WareCode = wareNo; WareCode = wareNo;
PlateW = platew; PlateW = platew;
PlateH = plateh; PlateH = plateh;
PlateRawH = plateh;
IsNg = _IsNg; IsNg = _IsNg;
NgMsg = ngMsg; NgMsg = ngMsg;
...@@ -62,6 +63,7 @@ namespace DeviceLibrary ...@@ -62,6 +63,7 @@ namespace DeviceLibrary
/// 料盘高度 /// 料盘高度
/// </summary> /// </summary>
public int PlateH { get; set; } public int PlateH { get; set; }
public int PlateRawH { get; set; }
/// <summary> /// <summary>
/// 料盘宽度 /// 料盘宽度
/// </summary> /// </summary>
...@@ -116,7 +118,7 @@ namespace DeviceLibrary ...@@ -116,7 +118,7 @@ namespace DeviceLibrary
public void logresult() { public void logresult() {
if (!islog) { if (!islog) {
islog = true; islog = true;
string countfile = $"CountResult-{DateTime.Now:yyyy-MM-dd}.txt"; string countfile = $"logs\\CountResult-{DateTime.Now:yyyy-MM-dd}.txt";
if (!File.Exists(countfile)) { if (!File.Exists(countfile)) {
var sw1 = File.AppendText(countfile); var sw1 = File.AppendText(countfile);
sw1.WriteLine($"Date,ReeID,PN,WxH,ReelDest,NgMsg,QTY,LabelState,2D_Barcode"); sw1.WriteLine($"Date,ReeID,PN,WxH,ReelDest,NgMsg,QTY,LabelState,2D_Barcode");
......
...@@ -12,12 +12,17 @@ namespace DeviceLibrary ...@@ -12,12 +12,17 @@ namespace DeviceLibrary
static on ondelegate; static on ondelegate;
static on offdelegate; static on offdelegate;
static bool enable = false; static bool enable = false;
public static bool Enable { get => enable;set { public static bool Enable
{
get => enable; set
{
enable = value; enable = value;
if (!value) { if (!value)
{
OFF(); OFF();
} }
} } }
}
static AlarmBuzzerState State = AlarmBuzzerState.OFF; static AlarmBuzzerState State = AlarmBuzzerState.OFF;
public static event EventHandler<bool> BuzzerStateChange; public static event EventHandler<bool> BuzzerStateChange;
public static void SetOnOffAction(Action ona, Action offa) { public static void SetOnOffAction(Action ona, Action offa) {
...@@ -29,8 +34,12 @@ namespace DeviceLibrary ...@@ -29,8 +34,12 @@ namespace DeviceLibrary
if (!Enable) if (!Enable)
return; return;
if (State == AlarmBuzzerState.MuteOnce)
{
return;
}
if (force || (State != AlarmBuzzerState.ON && State != AlarmBuzzerState.MuteOnce)) if (force || State != AlarmBuzzerState.ON)
{ {
State = AlarmBuzzerState.ON; State = AlarmBuzzerState.ON;
ondelegate?.Invoke(); ondelegate?.Invoke();
......
...@@ -16,10 +16,12 @@ namespace DeviceLibrary ...@@ -16,10 +16,12 @@ namespace DeviceLibrary
{ {
Socket client; Socket client;
IPEndPoint ipe; IPEndPoint ipe;
Timer timer; Timer timer;
static readonly ILog LOGGER = LogManager.GetLogger("WistonAgvClient"); static readonly ILog LOGGER = LogManager.GetLogger("WistonAgvClient");
object conn = new object(); object conn = new object();
Dictionary<string, bool> commandConfirm; Dictionary<string, bool> commandConfirm;
List<(DateTime, string)> OutCommandHistroy;
List<(DateTime, string)> InCommandHistroy;
public WistonAgvClient() public WistonAgvClient()
{ {
commandLoad(); commandLoad();
...@@ -46,6 +48,7 @@ namespace DeviceLibrary ...@@ -46,6 +48,7 @@ namespace DeviceLibrary
{ {
if (client != null && client.Connected) if (client != null && client.Connected)
{ {
return;
if (waitTimes > 5) { if (waitTimes > 5) {
try try
{ {
...@@ -167,16 +170,26 @@ namespace DeviceLibrary ...@@ -167,16 +170,26 @@ namespace DeviceLibrary
socket.BeginReceive(data, 0, data.Length, SocketFlags.None, socket.BeginReceive(data, 0, data.Length, SocketFlags.None,
asyncResult => asyncResult =>
{ {
if (!socket.Connected) { try
{
if (!socket.Connected)
{
CloseConnect();
log("连接断开了,稍后再次连接,AsynRecive");
return;
}
int length = socket.EndReceive(asyncResult);
var msg = Encoding.UTF8.GetString(data, 0, length);
MsgProcess(msg);
log(string.Format("收到服务器消息:{0}", msg));
AsynRecive(socket);
}
catch (Exception ex)
{
log(string.Format("异常信息:{0}", ex.Message));
CloseConnect(); CloseConnect();
log("连接断开了,稍后再次连接,AsynRecive"); log("连接断开了,稍后再次连接,AsynRecive");
return;
} }
int length = socket.EndReceive(asyncResult);
var msg = Encoding.UTF8.GetString(data, 0, length);
MsgProcess(msg);
log(string.Format("收到服务器消息:{0}", msg));
AsynRecive(socket);
}, null); }, null);
} }
catch (Exception ex) catch (Exception ex)
...@@ -261,5 +274,10 @@ namespace DeviceLibrary ...@@ -261,5 +274,10 @@ namespace DeviceLibrary
LOGGER.Info(msg); LOGGER.Info(msg);
Console.WriteLine(msg); Console.WriteLine(msg);
} }
void AddOutCommandHistroy(string cmd) {
OutCommandHistroy.Add((DateTime.Now, cmd));
if (OutCommandHistroy.Count>10)
OutCommandHistroy.RemoveAt(0);
}
} }
} }
\ No newline at end of file \ No newline at end of file

namespace AutoCountMachine
{
partial class AdvanceConfig
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.SuspendLayout();
//
// AdvanceConfig
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450);
this.Name = "AdvanceConfig";
this.Text = "AdvanceConfig";
this.ResumeLayout(false);
}
#endregion
}
}
\ No newline at end of file \ No newline at end of file
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace AutoCountMachine
{
public partial class AdvanceConfig : Form
{
public AdvanceConfig()
{
InitializeComponent();
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
\ No newline at end of file \ No newline at end of file
...@@ -67,9 +67,9 @@ namespace AutoCountMachine ...@@ -67,9 +67,9 @@ namespace AutoCountMachine
crc.LanguageProcess(this, this.GetType().Name); crc.LanguageProcess(this, this.GetType().Name);
crc.ProcessListItem(menuStrip1.Items, "menuStrip1"); crc.ProcessListItem(menuStrip1.Items, "menuStrip1");
listView1.Columns[1].Text = crc.GetString("table_device", "设备"); listView1.Columns[1].Text = crc.GetString("table_device", "设备");
listView1.Columns[2].Text = crc.GetString("table_info", "信息"); listView1.Columns[2].Text = crc.GetString("table_datetime", "时间");
listView1.Columns[3].Text = crc.GetString("table_datetime", "时间"); listView1.Columns[3].Text = crc.GetString("table_info", "信息");
stateView.Columns[1].Text = crc.GetString("table_module", "模块"); stateView.Columns[1].Text = crc.GetString("table_module", "模块");
stateView.Columns[2].Text = crc.GetString("table_step", "步骤"); stateView.Columns[2].Text = crc.GetString("table_step", "步骤");
...@@ -359,7 +359,7 @@ namespace AutoCountMachine ...@@ -359,7 +359,7 @@ namespace AutoCountMachine
} }
else else
{ {
for (int i = tabControl1.TabPages.Count - 2; i > 0; i--) for (int i = tabControl1.TabPages.Count - 1; i > 1; i--)
{ {
tabControl1.TabPages[i].Parent = null; tabControl1.TabPages[i].Parent = null;
} }
...@@ -471,7 +471,6 @@ namespace AutoCountMachine ...@@ -471,7 +471,6 @@ namespace AutoCountMachine
RobotManage.offlinemode = true; RobotManage.offlinemode = true;
break; break;
} }
} }
...@@ -480,9 +479,6 @@ namespace AutoCountMachine ...@@ -480,9 +479,6 @@ namespace AutoCountMachine
AlarmBuzzer.MuteOnce(); AlarmBuzzer.MuteOnce();
} }
private void 操作员ToolStripMenuItem_Click(object sender, EventArgs e) private void 操作员ToolStripMenuItem_Click(object sender, EventArgs e)
{ {
RoleManger.SetRole(Role.User); RoleManger.SetRole(Role.User);
......
...@@ -54,26 +54,32 @@ namespace AutoCountMachine ...@@ -54,26 +54,32 @@ namespace AutoCountMachine
{ {
if (!state) if (!state)
return; return;
//this.Invoke((EventHandler)delegate if (this.InvokeRequired)
//{ {
cb_printerselect.Items.Clear(); this.Invoke((EventHandler)delegate
cb_labelselect.Items.Clear();
foreach (string sPrint in System.Drawing.Printing.PrinterSettings.InstalledPrinters)//获取所有打印机名称
{ {
cb_printerselect.Items.Add(sPrint); RobotManage_LoadFinishEvent(state, msg);
} });
if (RobotManage.PrintBean != null) return;
}
cb_printerselect.Items.Clear();
cb_labelselect.Items.Clear();
foreach (string sPrint in System.Drawing.Printing.PrinterSettings.InstalledPrinters)//获取所有打印机名称
{
cb_printerselect.Items.Add(sPrint);
}
if (RobotManage.PrintBean != null)
{
foreach (string labelname in RobotManage.PrintBean.GetLabelName())
{ {
foreach (string labelname in RobotManage.PrintBean.GetLabelName()) cb_labelselect.Items.Add(labelname);
{
cb_labelselect.Items.Add(labelname);
}
} }
string PrintName = ConfigHelper.Config.Get(Setting_Init.PrinterName); }
string labelName = ConfigHelper.Config.Get(Setting_Init.LabelName); string PrintName = ConfigHelper.Config.Get(Setting_Init.PrinterName);
cb_printerselect.Text = PrintName; string labelName = ConfigHelper.Config.Get(Setting_Init.LabelName);
cb_labelselect.Text = labelName; cb_printerselect.Text = PrintName;
//}); cb_labelselect.Text = labelName;
} }
private void cb_printerselect_SelectedIndexChanged(object sender, EventArgs e) private void cb_printerselect_SelectedIndexChanged(object sender, EventArgs e)
{ {
...@@ -141,5 +147,31 @@ namespace AutoCountMachine ...@@ -141,5 +147,31 @@ namespace AutoCountMachine
} }
} }
private void btn_line1_run_Click(object sender, EventArgs e)
{
RobotManage.Line1.LineRun("n", 999);
}
private void btn_line1_stop_Click(object sender, EventArgs e)
{
RobotManage.Line1.LineStop ("n");
}
private void btn_line2_run_Click(object sender, EventArgs e)
{
RobotManage.Line2.LineRun("n", 999);
}
private void btn_line2_stop_Click(object sender, EventArgs e)
{
RobotManage.Line2.LineStop("n");
}
private void chb_disablelabel_CheckedChanged(object sender, EventArgs e)
{
RobotManage.labelMachine.DisableLabel = chb_disablelabel.Checked;
LogUtil.info($"手动屏蔽贴标:{chb_disablelabel.Checked}");
}
} }
} }
...@@ -81,6 +81,12 @@ ...@@ -81,6 +81,12 @@
<Reference Include="X-Ray, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" /> <Reference Include="X-Ray, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="AdvanceConfig.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="AdvanceConfig.Designer.cs">
<DependentUpon>AdvanceConfig.cs</DependentUpon>
</Compile>
<Compile Include="eyemlib.cs" /> <Compile Include="eyemlib.cs" />
<Compile Include="UCCOMMON\BoxResetControl.cs"> <Compile Include="UCCOMMON\BoxResetControl.cs">
<SubType>UserControl</SubType> <SubType>UserControl</SubType>
...@@ -151,6 +157,9 @@ ...@@ -151,6 +157,9 @@
<Compile Include="XrayControl.Designer.cs"> <Compile Include="XrayControl.Designer.cs">
<DependentUpon>XrayControl.cs</DependentUpon> <DependentUpon>XrayControl.cs</DependentUpon>
</Compile> </Compile>
<EmbeddedResource Include="AdvanceConfig.resx">
<DependentUpon>AdvanceConfig.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UCCOMMON\BoxResetControl.resx"> <EmbeddedResource Include="UCCOMMON\BoxResetControl.resx">
<DependentUpon>BoxResetControl.cs</DependentUpon> <DependentUpon>BoxResetControl.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
......
...@@ -32,6 +32,7 @@ namespace AutoCountMachine ...@@ -32,6 +32,7 @@ namespace AutoCountMachine
this.tabControl1 = new System.Windows.Forms.TabControl(); this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage2 = new System.Windows.Forms.TabPage(); this.tabPage2 = new System.Windows.Forms.TabPage();
this.panel1 = new System.Windows.Forms.Panel(); this.panel1 = new System.Windows.Forms.Panel();
this.label_count = new System.Windows.Forms.Label();
this.dateTimePicker_end = new System.Windows.Forms.DateTimePicker(); this.dateTimePicker_end = new System.Windows.Forms.DateTimePicker();
this.dateTimePicker_start = new System.Windows.Forms.DateTimePicker(); this.dateTimePicker_start = new System.Windows.Forms.DateTimePicker();
this.dataGridView1 = new System.Windows.Forms.DataGridView(); this.dataGridView1 = new System.Windows.Forms.DataGridView();
...@@ -44,7 +45,7 @@ namespace AutoCountMachine ...@@ -44,7 +45,7 @@ namespace AutoCountMachine
this.btn_setadminpassword = new System.Windows.Forms.Button(); this.btn_setadminpassword = new System.Windows.Forms.Button();
this.cb_autorun = new System.Windows.Forms.CheckBox(); this.cb_autorun = new System.Windows.Forms.CheckBox();
this.cb_EnableBuzzer = new System.Windows.Forms.CheckBox(); this.cb_EnableBuzzer = new System.Windows.Forms.CheckBox();
this.label_count = new System.Windows.Forms.Label(); this.linkLabel1 = new System.Windows.Forms.LinkLabel();
this.tabControl1.SuspendLayout(); this.tabControl1.SuspendLayout();
this.tabPage2.SuspendLayout(); this.tabPage2.SuspendLayout();
this.panel1.SuspendLayout(); this.panel1.SuspendLayout();
...@@ -93,6 +94,16 @@ namespace AutoCountMachine ...@@ -93,6 +94,16 @@ namespace AutoCountMachine
this.panel1.Size = new System.Drawing.Size(758, 529); this.panel1.Size = new System.Drawing.Size(758, 529);
this.panel1.TabIndex = 2; this.panel1.TabIndex = 2;
// //
// label_count
//
this.label_count.AutoSize = true;
this.label_count.Location = new System.Drawing.Point(15, 406);
this.label_count.Name = "label_count";
this.label_count.Size = new System.Drawing.Size(41, 12);
this.label_count.TabIndex = 3;
this.label_count.Tag = "not";
this.label_count.Text = "label1";
//
// dateTimePicker_end // dateTimePicker_end
// //
this.dateTimePicker_end.CustomFormat = "yyyy/MM/dd HH:mm"; this.dateTimePicker_end.CustomFormat = "yyyy/MM/dd HH:mm";
...@@ -192,6 +203,7 @@ namespace AutoCountMachine ...@@ -192,6 +203,7 @@ namespace AutoCountMachine
// //
// tabPage1 // tabPage1
// //
this.tabPage1.Controls.Add(this.linkLabel1);
this.tabPage1.Controls.Add(this.btn_setadminpassword); this.tabPage1.Controls.Add(this.btn_setadminpassword);
this.tabPage1.Controls.Add(this.cb_autorun); this.tabPage1.Controls.Add(this.cb_autorun);
this.tabPage1.Controls.Add(this.cb_EnableBuzzer); this.tabPage1.Controls.Add(this.cb_EnableBuzzer);
...@@ -199,14 +211,14 @@ namespace AutoCountMachine ...@@ -199,14 +211,14 @@ namespace AutoCountMachine
this.tabPage1.Location = new System.Drawing.Point(4, 22); this.tabPage1.Location = new System.Drawing.Point(4, 22);
this.tabPage1.Name = "tabPage1"; this.tabPage1.Name = "tabPage1";
this.tabPage1.Padding = new System.Windows.Forms.Padding(3); this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
this.tabPage1.Size = new System.Drawing.Size(764, 430); this.tabPage1.Size = new System.Drawing.Size(764, 535);
this.tabPage1.TabIndex = 0; this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "设置"; this.tabPage1.Text = "设置";
this.tabPage1.UseVisualStyleBackColor = true; this.tabPage1.UseVisualStyleBackColor = true;
// //
// btn_setadminpassword // btn_setadminpassword
// //
this.btn_setadminpassword.Location = new System.Drawing.Point(32, 100); this.btn_setadminpassword.Location = new System.Drawing.Point(32, 107);
this.btn_setadminpassword.Name = "btn_setadminpassword"; this.btn_setadminpassword.Name = "btn_setadminpassword";
this.btn_setadminpassword.Size = new System.Drawing.Size(141, 33); this.btn_setadminpassword.Size = new System.Drawing.Size(141, 33);
this.btn_setadminpassword.TabIndex = 10; this.btn_setadminpassword.TabIndex = 10;
...@@ -235,15 +247,16 @@ namespace AutoCountMachine ...@@ -235,15 +247,16 @@ namespace AutoCountMachine
this.cb_EnableBuzzer.UseVisualStyleBackColor = true; this.cb_EnableBuzzer.UseVisualStyleBackColor = true;
this.cb_EnableBuzzer.CheckedChanged += new System.EventHandler(this.cb_EnableBuzzer_CheckedChanged); this.cb_EnableBuzzer.CheckedChanged += new System.EventHandler(this.cb_EnableBuzzer_CheckedChanged);
// //
// label_count // linkLabel1
// //
this.label_count.AutoSize = true; this.linkLabel1.AutoSize = true;
this.label_count.Location = new System.Drawing.Point(15, 406); this.linkLabel1.Location = new System.Drawing.Point(20, 500);
this.label_count.Name = "label_count"; this.linkLabel1.Name = "linkLabel1";
this.label_count.Size = new System.Drawing.Size(41, 12); this.linkLabel1.Size = new System.Drawing.Size(14, 14);
this.label_count.TabIndex = 3; this.linkLabel1.TabIndex = 11;
this.label_count.Tag = "not"; this.linkLabel1.TabStop = true;
this.label_count.Text = "label1"; this.linkLabel1.Text = "_";
this.linkLabel1.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel1_LinkClicked);
// //
// SettingControl // SettingControl
// //
...@@ -281,5 +294,6 @@ namespace AutoCountMachine ...@@ -281,5 +294,6 @@ namespace AutoCountMachine
private System.Windows.Forms.DateTimePicker dateTimePicker_start; private System.Windows.Forms.DateTimePicker dateTimePicker_start;
private System.Windows.Forms.RadioButton rb_datafilter_custom; private System.Windows.Forms.RadioButton rb_datafilter_custom;
private System.Windows.Forms.Label label_count; private System.Windows.Forms.Label label_count;
private System.Windows.Forms.LinkLabel linkLabel1;
} }
} }
...@@ -171,5 +171,10 @@ namespace AutoCountMachine ...@@ -171,5 +171,10 @@ namespace AutoCountMachine
{ {
} }
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
ConfigHelper.AdvanceConfigForm.ShowEditDialog();
}
} }
} }
...@@ -39,6 +39,8 @@ namespace AutoCountMachine ...@@ -39,6 +39,8 @@ namespace AutoCountMachine
InitializeComponent(); InitializeComponent();
RobotManage.LoadFinishEvent += RobotManage_LoadFinishEvent; RobotManage.LoadFinishEvent += RobotManage_LoadFinishEvent;
RoleManger.RoleChange += RoleManger_RoleChange; RoleManger.RoleChange += RoleManger_RoleChange;
txt_p1.Text = ConfigHelper.Config.Get("findcicyle_p1", 95).ToString();
txt_p2.Text = ConfigHelper.Config.Get("findcicyle_p2", 75).ToString();
} }
private void RoleManger_RoleChange(object sender, Role e) private void RoleManger_RoleChange(object sender, Role e)
...@@ -87,7 +89,11 @@ namespace AutoCountMachine ...@@ -87,7 +89,11 @@ namespace AutoCountMachine
private void button1_Click(object sender, EventArgs e) private void button1_Click(object sender, EventArgs e)
{ {
var (bitmap, currpos, debugtxt) = RobotManage.t1Machine.GetStringCenterA();
ConfigHelper.Config.Set("findcicyle_p1", int.Parse(txt_p1.Text));
ConfigHelper.Config.Set("findcicyle_p2", int.Parse(txt_p2.Text));
ConfigHelper.Config.SaveChange();
var (bitmap, currpos, debugtxt) = RobotManage.t1Machine.GetStringCenterA();
var distance = (int)Common.distance(RobotManage.t1Machine.CenterPos, currpos); var distance = (int)Common.distance(RobotManage.t1Machine.CenterPos, currpos);
label_eyemMulFuncTool.Text = debugtxt + $"\ndistance:{distance}\nLocation:{(distance< RobotManage.t1Machine.Config.String_Offset_Range_Px?"OK":"NG")}"; label_eyemMulFuncTool.Text = debugtxt + $"\ndistance:{distance}\nLocation:{(distance< RobotManage.t1Machine.Config.String_Offset_Range_Px?"OK":"NG")}";
...@@ -127,5 +133,25 @@ namespace AutoCountMachine ...@@ -127,5 +133,25 @@ namespace AutoCountMachine
{ {
RobotManage.electricGripper.ClosePort(); RobotManage.electricGripper.ClosePort();
} }
private void tabPage4_Click(object sender, EventArgs e)
{
}
private void btn_agvin_Click(object sender, EventArgs e)
{
RobotManage.wistonAgvClient.NeedEnter();
}
private void btn_agvout_Click(object sender, EventArgs e)
{
RobotManage.wistonAgvClient.NeedLeave();
}
private void tabPage3_Click(object sender, EventArgs e)
{
}
} }
} }
...@@ -43,7 +43,7 @@ namespace AutoCountMachine ...@@ -43,7 +43,7 @@ namespace AutoCountMachine
// label1 // label1
// //
this.label1.AutoSize = true; this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(144, 6); this.label1.Location = new System.Drawing.Point(16, 6);
this.label1.Name = "label1"; this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(41, 12); this.label1.Size = new System.Drawing.Size(41, 12);
this.label1.TabIndex = 1; this.label1.TabIndex = 1;
...@@ -52,7 +52,7 @@ namespace AutoCountMachine ...@@ -52,7 +52,7 @@ namespace AutoCountMachine
// label2 // label2
// //
this.label2.AutoSize = true; this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(77, 6); this.label2.Location = new System.Drawing.Point(138, 6);
this.label2.Name = "label2"; this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(47, 12); this.label2.Size = new System.Drawing.Size(47, 12);
this.label2.TabIndex = 1; this.label2.TabIndex = 1;
...@@ -61,7 +61,7 @@ namespace AutoCountMachine ...@@ -61,7 +61,7 @@ namespace AutoCountMachine
// label3 // label3
// //
this.label3.AutoSize = true; this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(6, 6); this.label3.Location = new System.Drawing.Point(71, 6);
this.label3.Name = "label3"; this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(59, 12); this.label3.Size = new System.Drawing.Size(59, 12);
this.label3.TabIndex = 1; this.label3.TabIndex = 1;
...@@ -69,7 +69,7 @@ namespace AutoCountMachine ...@@ -69,7 +69,7 @@ namespace AutoCountMachine
// //
// btn_NGClear // btn_NGClear
// //
this.btn_NGClear.Location = new System.Drawing.Point(143, 121); this.btn_NGClear.Location = new System.Drawing.Point(16, 121);
this.btn_NGClear.Name = "btn_NGClear"; this.btn_NGClear.Name = "btn_NGClear";
this.btn_NGClear.Size = new System.Drawing.Size(45, 40); this.btn_NGClear.Size = new System.Drawing.Size(45, 40);
this.btn_NGClear.TabIndex = 2; this.btn_NGClear.TabIndex = 2;
...@@ -79,7 +79,7 @@ namespace AutoCountMachine ...@@ -79,7 +79,7 @@ namespace AutoCountMachine
// //
// btn_MSDClear // btn_MSDClear
// //
this.btn_MSDClear.Location = new System.Drawing.Point(77, 121); this.btn_MSDClear.Location = new System.Drawing.Point(141, 121);
this.btn_MSDClear.Name = "btn_MSDClear"; this.btn_MSDClear.Name = "btn_MSDClear";
this.btn_MSDClear.Size = new System.Drawing.Size(45, 40); this.btn_MSDClear.Size = new System.Drawing.Size(45, 40);
this.btn_MSDClear.TabIndex = 2; this.btn_MSDClear.TabIndex = 2;
...@@ -89,7 +89,7 @@ namespace AutoCountMachine ...@@ -89,7 +89,7 @@ namespace AutoCountMachine
// //
// btn_PaperClear // btn_PaperClear
// //
this.btn_PaperClear.Location = new System.Drawing.Point(13, 121); this.btn_PaperClear.Location = new System.Drawing.Point(78, 121);
this.btn_PaperClear.Name = "btn_PaperClear"; this.btn_PaperClear.Name = "btn_PaperClear";
this.btn_PaperClear.Size = new System.Drawing.Size(45, 40); this.btn_PaperClear.Size = new System.Drawing.Size(45, 40);
this.btn_PaperClear.TabIndex = 2; this.btn_PaperClear.TabIndex = 2;
...@@ -99,14 +99,14 @@ namespace AutoCountMachine ...@@ -99,14 +99,14 @@ namespace AutoCountMachine
// //
// PaperCountBar // PaperCountBar
// //
this.PaperCountBar.Location = new System.Drawing.Point(13, 21); this.PaperCountBar.Location = new System.Drawing.Point(78, 21);
this.PaperCountBar.Name = "PaperCountBar"; this.PaperCountBar.Name = "PaperCountBar";
this.PaperCountBar.Size = new System.Drawing.Size(45, 94); this.PaperCountBar.Size = new System.Drawing.Size(45, 94);
this.PaperCountBar.TabIndex = 0; this.PaperCountBar.TabIndex = 0;
// //
// MsdCountBar // MsdCountBar
// //
this.MsdCountBar.Location = new System.Drawing.Point(77, 21); this.MsdCountBar.Location = new System.Drawing.Point(141, 21);
this.MsdCountBar.Name = "MsdCountBar"; this.MsdCountBar.Name = "MsdCountBar";
this.MsdCountBar.Size = new System.Drawing.Size(45, 94); this.MsdCountBar.Size = new System.Drawing.Size(45, 94);
this.MsdCountBar.TabIndex = 0; this.MsdCountBar.TabIndex = 0;
...@@ -114,7 +114,7 @@ namespace AutoCountMachine ...@@ -114,7 +114,7 @@ namespace AutoCountMachine
// NgCountBar // NgCountBar
// //
this.NgCountBar.ForeColor = System.Drawing.Color.MediumSeaGreen; this.NgCountBar.ForeColor = System.Drawing.Color.MediumSeaGreen;
this.NgCountBar.Location = new System.Drawing.Point(143, 21); this.NgCountBar.Location = new System.Drawing.Point(16, 21);
this.NgCountBar.MarqueeAnimationSpeed = 0; this.NgCountBar.MarqueeAnimationSpeed = 0;
this.NgCountBar.Name = "NgCountBar"; this.NgCountBar.Name = "NgCountBar";
this.NgCountBar.Size = new System.Drawing.Size(45, 94); this.NgCountBar.Size = new System.Drawing.Size(45, 94);
...@@ -134,7 +134,7 @@ namespace AutoCountMachine ...@@ -134,7 +134,7 @@ namespace AutoCountMachine
this.Controls.Add(this.MsdCountBar); this.Controls.Add(this.MsdCountBar);
this.Controls.Add(this.NgCountBar); this.Controls.Add(this.NgCountBar);
this.Name = "BoxResetControl"; this.Name = "BoxResetControl";
this.Size = new System.Drawing.Size(299, 316); this.Size = new System.Drawing.Size(324, 316);
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();
......
...@@ -33,6 +33,12 @@ namespace AutoCountMachine ...@@ -33,6 +33,12 @@ namespace AutoCountMachine
{ {
InitializeComponent(); InitializeComponent();
this.Tag = "not"; this.Tag = "not";
crc.LanguageChangeEvent += Crc_LanguageChangeEvent;
}
private void Crc_LanguageChangeEvent(object sender, EventArgs e)
{
LoadPosList();
} }
void LoadPosList() void LoadPosList()
......
...@@ -15,6 +15,7 @@ using System.Windows.Forms; ...@@ -15,6 +15,7 @@ using System.Windows.Forms;
namespace AutoCountMachine namespace AutoCountMachine
{ {
using crc = OnlineStore.CodeResourceControl;
public partial class XrayControl : UserControl public partial class XrayControl : UserControl
{ {
readonly System.Windows.Forms.Timer t1 = new System.Windows.Forms.Timer(); readonly System.Windows.Forms.Timer t1 = new System.Windows.Forms.Timer();
...@@ -96,7 +97,7 @@ namespace AutoCountMachine ...@@ -96,7 +97,7 @@ namespace AutoCountMachine
LogUtil.info($"手动点料: {e}"); LogUtil.info($"手动点料: {e}");
this.Invoke((EventHandler<string>)delegate this.Invoke((EventHandler<string>)delegate
{ {
label_countstate.Text = "当前: "+e; label_countstate.Text = crc.GetString("xmanual_current_step","当前: {0}",e);
},this,e); },this,e);
} }
...@@ -152,7 +153,7 @@ namespace AutoCountMachine ...@@ -152,7 +153,7 @@ namespace AutoCountMachine
RobotManage.XRay.Start(); RobotManage.XRay.Start();
} }
else { else {
MessageBox.Show("X光机防护门未关闭,不可开启X光"); MessageBox.Show(crc.GetString("xmanual_door_not_closed","X光机防护门未关闭,不可开启X光"));
} }
} }
...@@ -181,18 +182,18 @@ namespace AutoCountMachine ...@@ -181,18 +182,18 @@ namespace AutoCountMachine
private void btn_ManualCount_Click(object sender, EventArgs e) private void btn_ManualCount_Click(object sender, EventArgs e)
{ {
if (RobotManage.isRunning) { if (RobotManage.isRunning) {
countstate?.Invoke(this, "机器正在运行中,不能使用手动点料"); countstate?.Invoke(this, crc.GetString("xmanual_machine_is_running","机器正在运行中,不能使用手动点料"));
} }
else if (CodeManager.HasRightCode(textBox_scancode.Text)) else if (CodeManager.HasRightCode(textBox_scancode.Text))
{ {
RobotManage.xrayMachine.MoveInfo.ReelParam = new ReelParam(); RobotManage.xrayMachine.MoveInfo.ReelParam = new ReelParam();
RobotManage.xrayMachine.MoveInfo.ReelParam.WareCode = textBox_scancode.Text; RobotManage.xrayMachine.MoveInfo.ReelParam.WareCode = textBox_scancode.Text;
countstate?.Invoke(this, $"开始点料: {textBox_scancode.Text}"); countstate?.Invoke(this, crc.GetString("xmanual_being_countting",$"开始点料:{0} ", textBox_scancode.Text));
Thread td = new Thread(new ThreadStart(Count)); Thread td = new Thread(new ThreadStart(Count));
td.Start(); td.Start();
} }
else { else {
countstate?.Invoke(this, "扫描的二维码不符合规则,请重新扫描"); countstate?.Invoke(this, crc.GetString("xmanual_barcode_uncorrect", "扫描的二维码不符合规则,请重新扫描"));
} }
} }
/// <summary> /// <summary>
...@@ -206,7 +207,7 @@ namespace AutoCountMachine ...@@ -206,7 +207,7 @@ namespace AutoCountMachine
return; return;
ManualCountRunning = true; ManualCountRunning = true;
countstate?.Invoke(this, "关闭防护门"); countstate?.Invoke(this, crc.GetString("xmanual_close_door","关闭防护门"));
RobotManage.xrayMachine.CylinderMove(null, IO_XRay_Type.Entry_Close, IO_XRay_Type.Entry_Open, IO_VALUE.LOW); RobotManage.xrayMachine.CylinderMove(null, IO_XRay_Type.Entry_Close, IO_XRay_Type.Entry_Open, IO_VALUE.LOW);
RobotManage.xrayMachine.CylinderMove(null, IO_XRay_Type.Exit_Close, IO_XRay_Type.Exit_Open, IO_VALUE.LOW); RobotManage.xrayMachine.CylinderMove(null, IO_XRay_Type.Exit_Close, IO_XRay_Type.Exit_Open, IO_VALUE.LOW);
int wait = 0; int wait = 0;
...@@ -217,9 +218,9 @@ namespace AutoCountMachine ...@@ -217,9 +218,9 @@ namespace AutoCountMachine
} }
wait++; wait++;
Thread.Sleep(500); Thread.Sleep(500);
countstate?.Invoke(this, "等待关闭防护门"); countstate?.Invoke(this, crc.GetString("xmanual_wait_close_door", "等待关闭防护门"));
if (wait > 10) { if (wait > 10) {
countstate?.Invoke(this, "等待关闭防护门超时"); countstate?.Invoke(this, crc.GetString("xmanual_wait_close_door_timeout", "等待关闭防护门超时"));
ManualCountRunning = false; ManualCountRunning = false;
return; return;
} }
...@@ -227,20 +228,20 @@ namespace AutoCountMachine ...@@ -227,20 +228,20 @@ namespace AutoCountMachine
try try
{ {
LastCountWareCode = RobotManage.xrayMachine.MoveInfo.ReelParam.WareCode; LastCountWareCode = RobotManage.xrayMachine.MoveInfo.ReelParam.WareCode;
countstate?.Invoke(this, "打开X光"); countstate?.Invoke(this, crc.GetString("xmanual_open_xray", "打开X光"));
RobotManage.xrayMachine.IOMove(IO_XRay_Type.Xray_Lock, IO_VALUE.HIGH); RobotManage.xrayMachine.IOMove(IO_XRay_Type.Xray_Lock, IO_VALUE.HIGH);
Thread.Sleep(1000); Thread.Sleep(1000);
RobotManage.XRay.Start(); RobotManage.XRay.Start();
Thread.Sleep(1000); Thread.Sleep(1000);
countstate?.Invoke(this, "获取图像"); countstate?.Invoke(this, crc.GetString("xmanual_get_image", "获取图像"));
if (RobotManage.xrayMachine.GrabImage()) if (RobotManage.xrayMachine.GrabImage())
{ {
Task.Run(() => Task.Run(() =>
{ {
countstate?.Invoke(this, "开始点料"); countstate?.Invoke(this, crc.GetString("xmanual_being_countting", "开始点料"));
Process p = new Process(); Process p = new Process();
p.StartInfo = new ProcessStartInfo("AlgoMatch\\AlgoMatch.exe"); p.StartInfo = new ProcessStartInfo("AlgoMatch\\AlgoMatch.exe");
p.StartInfo.Arguments =$"singlecount \"{RobotManage.xrayMachine.xrayImagePath}\""; p.StartInfo.Arguments =$"singlecount \"{RobotManage.xrayMachine.xrayImagePath}\" {crc.CurrLanguage}";
p.StartInfo.WorkingDirectory = Application.StartupPath; p.StartInfo.WorkingDirectory = Application.StartupPath;
p.StartInfo.UseShellExecute = false; p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true; p.StartInfo.RedirectStandardOutput = true;
...@@ -255,25 +256,25 @@ namespace AutoCountMachine ...@@ -255,25 +256,25 @@ namespace AutoCountMachine
} }
else else
{ {
countstate?.Invoke(this, "获取图像失败!"); countstate?.Invoke(this, crc.GetString("xmanual_get_image_fail", "获取图像失败!"));
} }
} }
catch (Exception e){ catch (Exception e){
countstate?.Invoke(this, "出错:"+e.ToString()); countstate?.Invoke(this, crc.GetString("xmanual_error", "出错:{0}" ,e.ToString()));
} }
finally finally
{ {
RobotManage.XRay.Stop(); RobotManage.XRay.Stop();
Thread.Sleep(300); Thread.Sleep(300);
RobotManage.xrayMachine.IOMove(IO_XRay_Type.Xray_Lock, IO_VALUE.LOW); RobotManage.xrayMachine.IOMove(IO_XRay_Type.Xray_Lock, IO_VALUE.LOW);
countstate?.Invoke(this, "关闭X光"); countstate?.Invoke(this, crc.GetString("xmanual_close_xray", "关闭X光"));
Thread.Sleep(100); Thread.Sleep(100);
} }
Thread.Sleep(100); Thread.Sleep(100);
RobotManage.xrayMachine.CylinderMove(null, IO_XRay_Type.Entry_Close, IO_XRay_Type.Entry_Open, IO_VALUE.HIGH); RobotManage.xrayMachine.CylinderMove(null, IO_XRay_Type.Entry_Close, IO_XRay_Type.Entry_Open, IO_VALUE.HIGH);
RobotManage.xrayMachine.CylinderMove(null, IO_XRay_Type.Exit_Close, IO_XRay_Type.Exit_Open, IO_VALUE.HIGH); RobotManage.xrayMachine.CylinderMove(null, IO_XRay_Type.Exit_Close, IO_XRay_Type.Exit_Open, IO_VALUE.HIGH);
countstate?.Invoke(this, "防护门已打开"); countstate?.Invoke(this, crc.GetString("xmanual_door_opened", "防护门已打开"));
ManualCountRunning = false; ManualCountRunning = false;
} }
...@@ -290,14 +291,14 @@ namespace AutoCountMachine ...@@ -290,14 +291,14 @@ namespace AutoCountMachine
var reelLocation = ServerConn.DetermineReelStorageLocation(LastCountWareCode); var reelLocation = ServerConn.DetermineReelStorageLocation(LastCountWareCode);
if (reelLocation == null) if (reelLocation == null)
{ {
countstate?.Invoke(this, "打印标签失败"); countstate?.Invoke(this, crc.GetString("xmanual_print_label_fail","打印标签失败"));
} }
else { else {
countstate?.Invoke(this, reelLocation.message); countstate?.Invoke(this, reelLocation.message);
} }
} }
else { else {
countstate?.Invoke(this, "上传点料结果失败"); countstate?.Invoke(this, crc.GetString("xmanual_upload_fail", "上传点料结果失败"));
} }
} }
......
此文件类型无法预览
此文件类型无法预览
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!