Commit b1b020de 刘韬

1

1 个父辈 43fb10e8
正在显示 68 个修改的文件 包含 1104 行增加7280 行删除
......@@ -35,6 +35,9 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="ConfigHelper">
<HintPath>..\..\..\ConfigHelper\ConfigHelper\bin\Debug\ConfigHelper.dll</HintPath>
</Reference>
<Reference Include="log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\增广夹爪\Rmaxis\bin\Debug\log4net.dll</HintPath>
......
using System;
using ConfigHelper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
......@@ -53,5 +54,15 @@ namespace OnlineStore.Common
public static string QRCodeCount= "QRCodeCount";
public static string CodeType= "CodeType";
public static string CodeParamPath= "CodeParamPath";
[MyConfigComment("X高压端口")]
public static MyConfig<string> XRay_Port = "COM2";
[MyConfigComment("X高压电压")]
public static MyConfig<double> XRay_Voltage = 50;
[MyConfigComment("X高压电流")]
public static MyConfig<double> XRay_Current = 0.6;
[MyConfigComment("X高压点亮后延迟,毫秒")]
public static MyConfig<int> XRay_Light_Delay = 2500;
}
}
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace DeviceLibrary
{
using crc = OnlineStore.CodeResourceControl;
public partial class FilterMachine : MachineBase, IRobot
{
private Config_Filter _config;
public new Config_Filter Config
{
get => _config;
set
{
base.Config = value;
_config = value;
}
}
public override string DeviceName { get; } = "分盘线";
public bool canRunning { get; set; }
public bool isBusy { get; set; }
public bool isAlarm { get; set; }
//public RunStatus runStatus { get; set; }
//public bool UserPause { get; set; }
public bool IgnoreSafecheck { get; set; }
public bool IgnoreGratingSignal { get; set; }
public int NGBox_Count { get => nGBox_Count; set { nGBox_Count = value; ConfigHelper.Config.Set("NGBox_Count", value); } }
public int MSDBox_Count { get => mSDBox_Count; set { mSDBox_Count = value; ConfigHelper.Config.Set("MSDBox_Count", value); } }
public int PaperBox_Count { get => paperBox_Count; set { paperBox_Count = value; ConfigHelper.Config.Set("PaperBox_Count", value); } }
private int nGBox_Count = 0;
private int mSDBox_Count = 0;
private int paperBox_Count = 0;
public bool Init(out string msg)
{
msg = "";
try
{
string configFile = "config\\FilterConfig.csv";
Config = new Config_Filter(0, "", configFile);
Config = (Config_Filter)CSVConfigReader.LoadConfig<IO_Filter_Type>(Config);
MoveInfo = new MoveInfo(DeviceName);
ResetMoveInfo = MoveInfo;
NGBox_Count = ConfigHelper.Config.Get("NGBox_Count", 0);
MSDBox_Count = ConfigHelper.Config.Get("MSDBox_Count", 0);
PaperBox_Count = ConfigHelper.Config.Get("PaperBox_Count", 0);
}
catch (Exception e)
{
msg = e.Message;
return false;
}
return true;
}
protected override void LoopProcess()
{
mstart = true;
while (mstart)
{
try
{
//HomeReset();
canRunning = DeviceCheck();
if (canRunning)
{
//BtnProcess();
canRunning = SafeCheck();
}
Thread.Sleep(stepDelaytime);
if (!canRunning || !mstart)
continue;
if (runStatus == RunStatus.Running)
{
WorkProcess();
}
else if (runStatus == RunStatus.HomeReset)
{
HomeReset();
}
}
catch (Exception ex)
{
Msg.add(ex.Message, MsgLevel.warning);
LogUtil.error(DeviceName + " " + ex.ToString());
}
finally
{
ProcessMsgEventFire(Msg);
//ProcessMoveinfoEventFire(MoveInfo.List);
Msg.Clear();
}
}
LogUtil.info($"{DeviceName} 主线程已退出.");
}
public bool DeviceCheck()
{
bool ok = true;
if (alarmType == AlarmType.SuddenStop)
{
Msg.add(crc.GetString("system_need_reset","系统需要重置"), MsgLevel.warning);
ok = false;
}
if (NGBox_Count >= Config.NG_BOX_MAXCOUNT) {
Msg.add(crc.GetString("ng_box_full", "NG箱已满"), MsgLevel.warning);
ok = false;
}
if (MSDBox_Count >= Config.MSD_BOX_MAXCOUNT)
{
Msg.add(crc.GetString("msd_box_full", "MSD箱已满"), MsgLevel.warning);
ok = false;
}
if (PaperBox_Count >= Config.PAPER_BOX_MAXCOUNT)
{
Msg.add(crc.GetString("paper_box_full", "Paper箱已满"), MsgLevel.warning);
ok = false;
}
if (alarmType != AlarmType.SuddenStop)
{
TimeSpan span = DateTime.Now - checkAlarmTime;
//在回原点,复位,出入库时,检测报警间隔减小
if ((!runStatus.Equals(RunStatus.Stop) && span.TotalSeconds > 3) || span.TotalSeconds > 1)
{
foreach (ConfigMoveAxis configMoveAxis in Config.moveAxisList)
{
if (AxisManager.GetAlarmStatus(configMoveAxis.DeviceName, configMoveAxis.GetAxisValue()) == 1)
{
Msg.add(crc.GetString("axis_run_alert","{0}:运动报警", configMoveAxis.Explain), MsgLevel.warning);
ok = false;
LogUtil.error(string.Join(",", HuichuanLibrary.HCBoardManager.GetAxisErrorDetail(configMoveAxis.GetAxisValue())));
}
}
}
}
return ok;
}
public void BeginHomeReset(bool firstRun = false)
{
if (!firstRun)
{
StopMove();
Thread.Sleep(500);
}
OpenAllServo();
alarmType = AlarmType.None;
runStatus = RunStatus.HomeReset;
ResetMoveInfo.NewMove(MoveStep.H01_HomeReset);
ResetMoveInfo.log("开始回原");
ResetMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
}
private void HomeReset()
{
if (CheckWait(ResetMoveInfo))
return;
switch (ResetMoveInfo.MoveStep)
{
case MoveStep.H01_HomeReset:
ResetMoveInfo.NextMoveStep(MoveStep.H02_HomeReset);
ResetMoveInfo.log("正在回原, 所有阻挡上升");
CylinderMove(ResetMoveInfo, IO_Filter_Type.NG_TaryStop_Down, IO_Filter_Type.NG_TaryStop_Up, IO_VALUE.HIGH);
CylinderMove(ResetMoveInfo, IO_Filter_Type.Paper_TaryStop_Down, IO_Filter_Type.Paper_TaryStop_Up, IO_VALUE.HIGH);
CylinderMove(ResetMoveInfo, IO_Filter_Type.MSD_TaryStop_Down, IO_Filter_Type.MSD_TaryStop_Up, IO_VALUE.HIGH);
break;
case MoveStep.H02_HomeReset:
ResetMoveInfo.NextMoveStep(MoveStep.H03_HomeReset);
ResetMoveInfo.log("正在回原");
IOMove(IO_Filter_Type.Line3_Run, IO_VALUE.HIGH);
break;
case MoveStep.H03_HomeReset:
ResetMoveInfo.NextMoveStep(MoveStep.H04_HomeReset);
ResetMoveInfo.log("正在回原");
CylinderMove(ResetMoveInfo, IO_Filter_Type.NG_GetOut_Bck, IO_Filter_Type.NG_GetOut_Fwd, IO_VALUE.LOW);
CylinderMove(ResetMoveInfo, IO_Filter_Type.Paper_GetOut_Bck, IO_Filter_Type.Paper_GetOut_Fwd, IO_VALUE.LOW);
CylinderMove(ResetMoveInfo, IO_Filter_Type.MSD_GetOut_Bck, IO_Filter_Type.MSD_GetOut_Fwd, IO_VALUE.LOW);
break;
case MoveStep.H04_HomeReset:
ResetMoveInfo.NextMoveStep(MoveStep.H05_HomeReset);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
break;
case MoveStep.H05_HomeReset:
ResetMoveInfo.NextMoveStep(MoveStep.HEND_HomeReset);
ResetMoveInfo.log("正在回原, 所有阻挡下升");
CylinderMove(ResetMoveInfo, IO_Filter_Type.NG_TaryStop_Down, IO_Filter_Type.NG_TaryStop_Up, IO_VALUE.LOW);
CylinderMove(ResetMoveInfo, IO_Filter_Type.Paper_TaryStop_Down, IO_Filter_Type.Paper_TaryStop_Up, IO_VALUE.LOW);
CylinderMove(ResetMoveInfo, IO_Filter_Type.MSD_TaryStop_Down, IO_Filter_Type.MSD_TaryStop_Up, IO_VALUE.LOW);
IOMove(IO_Filter_Type.Line3_Run, IO_VALUE.LOW);
break;
case MoveStep.HEND_HomeReset:
ResetMoveInfo.log("回源完成");
ResetMoveInfo.EndMove();
MoveInfo.NewMove(MoveStep.Filter_01_WaitReel);
runStatus = RunStatus.Running;
break;
}
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using OnlineStore.LoadCSVLibrary;
namespace DeviceLibrary
{
using crc = OnlineStore.CodeResourceControl;
public partial class FilterMachine
{
public bool isWaitReel { get => MoveInfo.MoveStep == MoveStep.Filter_01_WaitReel; }
public void LineRun(int sec = 0) {
IOMove(IO_Filter_Type.Line3_Run, IO_VALUE.HIGH, false, sec);
}
public IO_VALUE Tray_Check
{
get => IOValue(IO_Filter_Type.NG_TaryStop_Check);
}
void WorkProcess()
{
if (CheckWait(MoveInfo))
return;
switch (MoveInfo.MoveStep)
{
case MoveStep.Filter_01_WaitReel:
//MoveInfo.log("上料区阻挡上升");
if (IOValue(IO_Filter_Type.NG_TaryStop_Check,IO_VALUE.HIGH) && preReelParam != null)
{
MoveInfo.ReelParam = preReelParam;
preReelParam = null;
MoveInfo.log("检测到料盘 ReelParam:" + MoveInfo.ReelParam.ToStr());
MoveInfo.StopwatchReset();
//MoveInfo.ReelParam.ReelDest = ReelDest.String;
if (MoveInfo.ReelParam.ReelDest == ReelDest.NG || MoveInfo.ReelParam.ReelDest == ReelDest.Unknow)
{
RobotManage.DefectiveCount++;
MoveInfo.NextMoveStep(MoveStep.Filter_10_NGReel_PushOut);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(2000));
}
else if (MoveInfo.ReelParam.ReelDest == ReelDest.MSD)
{
MoveInfo.NextMoveStep(MoveStep.Filter_20_MSDReel_wait);
}
else if (MoveInfo.ReelParam.ReelDest == ReelDest.VT_Tower)
{
MoveInfo.NextMoveStep(MoveStep.Filter_30_PaperReel_wait);
}
else if (MoveInfo.ReelParam.ReelDest == ReelDest.Tower)
{
MoveInfo.NextMoveStep(MoveStep.Filter_40_Reel_through_wait);
}
IOMove(IO_Filter_Type.Line3_Run, IO_VALUE.HIGH);
}
else if (IOValue(IO_Filter_Type.NG_TaryStop_Check).Equals(IO_VALUE.HIGH) && preReelParam == null)
{
Msg.add(crc.GetString("wait_reelinfo", "{0}等待料盘信息", DeviceName), MsgLevel.warning);
}
else
{
Msg.add(crc.GetString("wait_reel_entry", "{0}等待料盘进入", DeviceName), MsgLevel.info);
}
break;
///NG料送出
case MoveStep.Filter_10_NGReel_PushOut:
MoveInfo.NextMoveStep(MoveStep.Filter_11_NGReel_End);
MoveInfo.log("NG料推出");
NGBox_Count++;
CylinderMove(MoveInfo, IO_Filter_Type.NG_GetOut_Bck, IO_Filter_Type.NG_GetOut_Fwd, IO_VALUE.HIGH);
IOMove(IO_Filter_Type.Line3_Run, IO_VALUE.LOW);
break;
case MoveStep.Filter_11_NGReel_End:
MoveInfo.NextMoveStep(MoveStep.Filter_END);
MoveInfo.log("NG料推出完毕");
CylinderMove(MoveInfo, IO_Filter_Type.NG_GetOut_Bck, IO_Filter_Type.NG_GetOut_Fwd, IO_VALUE.LOW);
break;
///Paper料送出
case MoveStep.Filter_30_PaperReel_wait:
MoveInfo.NextMoveStep(MoveStep.Filter_31_PaperReel_PushOut);
MoveInfo.log("Paper料进入,NG阻挡上升");
CylinderMove(MoveInfo, IO_Filter_Type.NG_TaryStop_Down, IO_Filter_Type.NG_TaryStop_Up, IO_VALUE.HIGH);
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Filter_Type.Paper_TaryStop_Check, IO_VALUE.HIGH));
break;
case MoveStep.Filter_31_PaperReel_PushOut:
MoveInfo.NextMoveStep(MoveStep.Filter_32_PaperReel_PushOut);
MoveInfo.log("Paper料等到到位");
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(3000));
break;
case MoveStep.Filter_32_PaperReel_PushOut:
MoveInfo.NextMoveStep(MoveStep.Filter_33_PaperReel_End);
MoveInfo.log("Paper料推出");
PaperBox_Count++;
IOMove(IO_Filter_Type.Line3_Run, IO_VALUE.LOW);
CylinderMove(MoveInfo, IO_Filter_Type.NG_TaryStop_Down, IO_Filter_Type.NG_TaryStop_Up, IO_VALUE.LOW);
CylinderMove(MoveInfo, IO_Filter_Type.Paper_GetOut_Bck, IO_Filter_Type.Paper_GetOut_Fwd, IO_VALUE.HIGH);
break;
case MoveStep.Filter_33_PaperReel_End:
MoveInfo.log("Paper料推出完毕");
CylinderMove(MoveInfo, IO_Filter_Type.Paper_GetOut_Bck, IO_Filter_Type.Paper_GetOut_Fwd, IO_VALUE.LOW);
MoveInfo.NextMoveStep(MoveStep.Filter_END);
break;
///MSD料送出
case MoveStep.Filter_20_MSDReel_wait:
MoveInfo.NextMoveStep(MoveStep.Filter_21_MSDReel_wait);
MoveInfo.log("MSD料推出,NG阻挡上升");
CylinderMove(MoveInfo, IO_Filter_Type.NG_TaryStop_Down, IO_Filter_Type.NG_TaryStop_Up, IO_VALUE.HIGH);
CylinderMove(MoveInfo, IO_Filter_Type.Paper_TaryStop_Down, IO_Filter_Type.Paper_TaryStop_Up, IO_VALUE.HIGH);
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Filter_Type.MSD_TaryStop_Check, IO_VALUE.HIGH));
break;
case MoveStep.Filter_21_MSDReel_wait:
MoveInfo.NextMoveStep(MoveStep.Filter_22_MSDReel_PushOut);
MoveInfo.log("MSD料进入,等待");
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(3000));
break;
case MoveStep.Filter_22_MSDReel_PushOut:
MoveInfo.NextMoveStep(MoveStep.Filter_23_MSDReel_End);
MoveInfo.log("MSD料推出");
MSDBox_Count++;
IOMove(IO_Filter_Type.Line3_Run, IO_VALUE.LOW);
CylinderMove(MoveInfo, IO_Filter_Type.NG_TaryStop_Down, IO_Filter_Type.NG_TaryStop_Up, IO_VALUE.LOW);
CylinderMove(MoveInfo, IO_Filter_Type.Paper_TaryStop_Down, IO_Filter_Type.Paper_TaryStop_Up, IO_VALUE.LOW);
CylinderMove(MoveInfo, IO_Filter_Type.MSD_GetOut_Bck, IO_Filter_Type.MSD_GetOut_Fwd, IO_VALUE.HIGH);
break;
case MoveStep.Filter_23_MSDReel_End:
MoveInfo.NextMoveStep(MoveStep.Filter_END);
MoveInfo.log("MSD料推出完毕");
CylinderMove(MoveInfo, IO_Filter_Type.MSD_GetOut_Bck, IO_Filter_Type.MSD_GetOut_Fwd, IO_VALUE.LOW);
break;
///料穿过
case MoveStep.Filter_40_Reel_through_wait:
MoveInfo.NextMoveStep(MoveStep.Filter_41_Reel_through_wait);
MoveInfo.log("料穿过,NG,Paper阻挡上升");
CylinderMove(MoveInfo, IO_Filter_Type.NG_TaryStop_Down, IO_Filter_Type.NG_TaryStop_Up, IO_VALUE.HIGH);
CylinderMove(MoveInfo, IO_Filter_Type.Paper_TaryStop_Down, IO_Filter_Type.Paper_TaryStop_Up, IO_VALUE.HIGH);
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Filter_Type.MSD_TaryStop_Check, IO_VALUE.HIGH));
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(3000));
break;
case MoveStep.Filter_41_Reel_through_wait:
MoveInfo.NextMoveStep(MoveStep.Filter_41_Reel_through);
CylinderMove(MoveInfo, IO_Filter_Type.NG_TaryStop_Down, IO_Filter_Type.NG_TaryStop_Up, IO_VALUE.LOW);
IOMove(IO_Filter_Type.Line3_Run, IO_VALUE.LOW);
MoveInfo.log("料穿过,NG阻挡下降");
break;
case MoveStep.Filter_41_Reel_through:
if (RobotManage.t1Machine.TrayCanIN())
{
MoveInfo.NextMoveStep(MoveStep.Filter_42_Reel_through_Wait);
IOMove(IO_Filter_Type.Line3_Run, IO_VALUE.HIGH);
MoveInfo.log("料穿过,MSD阻挡上升,NG,Paper阻挡下降");
CylinderMove(MoveInfo, IO_Filter_Type.NG_TaryStop_Down, IO_Filter_Type.NG_TaryStop_Up, IO_VALUE.LOW);
CylinderMove(MoveInfo, IO_Filter_Type.MSD_TaryStop_Down, IO_Filter_Type.MSD_TaryStop_Up, IO_VALUE.HIGH);
//CylinderMove(MoveInfo, IO_Filter_Type.Paper_TaryStop_Down, IO_Filter_Type.Paper_TaryStop_Up, IO_VALUE.LOW);
RobotManage.t1Machine.preReelParam = MoveInfo.ReelParam;
RobotManage.t1Machine.LineRun();
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(4000));
}
else if (MoveInfo.IsTimeOut(10)) {
Msg.add(crc.GetString("wait_xx_free","等待{0}空闲", RobotManage.t1Machine.DeviceName), MsgLevel.warning);
}
break;
case MoveStep.Filter_42_Reel_through_Wait:
MoveInfo.NextMoveStep(MoveStep.Filter_END);
MoveInfo.log("料穿过完成");
IOMove(IO_Filter_Type.Line3_Run, IO_VALUE.LOW);
//MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(5000));
break;
case MoveStep.Filter_END:
MoveInfo.NewMove(MoveStep.Filter_01_WaitReel);
MoveInfo.log("分料完成");
IOMove(IO_Filter_Type.Line3_Run, IO_VALUE.LOW);
CylinderMove(MoveInfo, IO_Filter_Type.NG_TaryStop_Down, IO_Filter_Type.NG_TaryStop_Up, IO_VALUE.LOW);
CylinderMove(MoveInfo, IO_Filter_Type.MSD_TaryStop_Down, IO_Filter_Type.MSD_TaryStop_Up, IO_VALUE.LOW);
CylinderMove(MoveInfo, IO_Filter_Type.Paper_TaryStop_Down, IO_Filter_Type.Paper_TaryStop_Up, IO_VALUE.LOW);
MoveInfo.StopwatchLog();
break;
}
}
}
}
using CodeLibrary;
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace DeviceLibrary
{
public partial class LabelMachine
{
Led AlarmLed;
Led RunningLed;
System.Threading.Timer ledtimer;
private void LedProcessInit()
{
AlarmLed = new Led(Config.DOList[IO_Label_Type.Alarm_Led].GetIOAddr(),DeviceName);
RunningLed = new Led(Config.DOList[IO_Label_Type.Run_Led].GetIOAddr(), DeviceName);
ledtimer = new System.Threading.Timer(new TimerCallback(LedProcess), null, 0, 1000);
GC.KeepAlive(ledtimer);
}
void LedProcess(object o)
{
AlarmLed.LedState = LedState.off;
RunningLed.LedState = LedState.off;
if (runStatus == RunStatus.Running)
{
RunningLed.LedState = LedState.on;
//无法运行,量报警灯
if (!canRunning)
{
AlarmLed.LedState = LedState.on;
RunningLed.LedState = LedState.off;
}
if (MoveInfo.MoveStep == MoveStep.Lbl_WaitCheckLabel)
{
AlarmLed.LedState = LedState.blink;
}
else
{
}
}
else if (runStatus == RunStatus.HomeReset)
{
RunningLed.LedState = LedState.blink;
}
if (alarmType != AlarmType.None)
{
AlarmLed.LedState = LedState.on;
}
if (UserPause)
{
AlarmLed.LedState = LedState.off;
RunningLed.LedState = LedState.off;
//StandbyLed.LedState = LedState.blink;
}
Led.LedGroup[DeviceName].ForEach((x) => { x.run(); });
}
}
}
using CodeLibrary;
using Newtonsoft.Json;
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DeviceLibrary
{
public partial class LabelMachine
{
SolidBrush blue = new SolidBrush(Color.BlueViolet);
SolidBrush red = new SolidBrush(Color.Red);
SolidBrush yellow = new SolidBrush(Color.Yellow);
SolidBrush AliceBlue = new SolidBrush(Color.AliceBlue);
Font font = new Font(FontFamily.GenericSansSerif, 60);
Pen Greenpen = new Pen(Color.Green, 10);
//Size pointsize = new Size(15, 15);
int pointsize = 16;
/// <summary>
/// 计算贴标位置
/// </summary>
/// <param name="Label_Pix_Point">二维码坐标</param>
/// <returns>XY轴贴标点,R轴角度,是否反转标签</returns>
public (Point, double, bool) ClacLabel(Point Label_Pix_Point)
{
bool ReverseLabel = false;
int Right_Batch_X = Config.Right_Batch_X;
if (MoveInfo.ReelParam.PlateW == 13)
{
Right_Batch_X = Right_Batch_X + Config.Label_Offset_Pixel_13;
}
else if (MoveInfo.ReelParam.PlateW == 15)
{
Right_Batch_X = Right_Batch_X + Config.Label_Offset_Pixel_15;
}
//照片中料盘中心点像素位置
Point Center_Pix_Point = new Point(Right_Batch_X, Config.Right_Batch_Y);
//二维码坐标
//Point Label_Pix_Point = new Point(X, Y);
//中心点到二维码角度,右侧为0度,+180转换到左侧为0度
var angle = Common.getAngle(Center_Pix_Point, Label_Pix_Point) + 180;
//中心点到二维码距离
var distance = Common.distance(Center_Pix_Point, Label_Pix_Point);
//中心点到标签中心的角度
double rr = 20;
var lr = Math.Cos(rr * Math.PI / 180);
//中心点到标签中心的距离
var ll = lr * distance;
//标签中心到盘心的坐标
var labelCenterAngle = rr + angle;
if (labelCenterAngle < 0)
labelCenterAngle = 360 + labelCenterAngle;
//标签中心的坐标
var labelCenter = Common.PointWithAngle(Center_Pix_Point, labelCenterAngle - 180, ll);
/*
//从二维码坐标开始, 往中心点坐标推移一定的距离,获得推移后的坐标
Point AxisPixPoint = Common.PointWithAngle(Label_Pix_Point, angle, Config.Label_R_Offset_Pixel);
//匹配角度与贴标旋转轴的角度差
var labelAngle = angle - Config.Label_R_Angle_Diff+360;
if (labelAngle > 360)
labelAngle -= 360;
*/
//因为标签不统一暂时改为以二维码为中心贴标
labelCenter = Label_Pix_Point;
labelCenterAngle = angle;
//贴标位置轴的像素坐标
Point AxisPixPoint = Common.PointWithAngle(labelCenter, labelCenterAngle, Config.Label_R_Offset_Pixel);
//计算贴标角度的脉冲值
//if (labelCenterAngle > Config.Label_R_MaxAngle)
//{
// ReverseLabel = true;
// labelCenterAngle -= 180;
//}
int labelAxisPos = (int)((double)Config.Label_R_360 / 335 * (double)labelCenterAngle);
MoveInfo.log($"计算结果,Label_R_360:{Config.Label_R_360},贴标角度:{labelCenterAngle},R轴:{labelAxisPos}");
//计算贴标像素点位与图像中心点的差
Point p1 = new Point(AxisPixPoint.X - Config.Right_Batch_X, AxisPixPoint.Y - Center_Pix_Point.Y);
//计算像素*脉冲像素比得到脉冲值+中心点基准脉冲
var x = (int)(p1.X * Config.Cam_Pixel_X_Ratio) + Config.Label_X_Base;
var y = (int)(p1.Y * Config.Cam_Pixel_Y_Ratio) + Config.Label_Y_Base;
p1.X = x;
p1.Y = y;
MoveInfo.log($"计算结果,图像像素中心{Center_Pix_Point},二维码像素坐标{Label_Pix_Point},角度{angle},贴标角度{labelCenterAngle},贴标像素点位为{AxisPixPoint},轴点位为{p1},R轴{labelAxisPos},盘宽{MoveInfo.ReelParam.PlateW}");
if (saveLabelDebugBmp)
{
//IOMove(IO_Label_Type.Camera_Led, IO_VALUE.HIGH);
//Task.Delay(10).Wait();
Bitmap bitmap = Camera._cam.GrabOneImage(Config.CameraName);
//IOMove(IO_Label_Type.Camera_Led, IO_VALUE.LOW);
bitmap.RotateFlip(RotateFlipType.Rotate180FlipNone);
//Bitmap bitmap = new Bitmap("d:\\出料模块-20210424-043753-0162.bmp");
printLabelDebugBitmap(bitmap, Label_Pix_Point, Center_Pix_Point, AxisPixPoint, angle, p1, labelCenterAngle, labelAxisPos, labelCenter);
bitmap.Dispose();
}
return (p1, labelAxisPos, ReverseLabel);
}
void printLabelDebugBitmap(Bitmap srcbitmap, Point Label_Pix_Point, Point Center_Pix_Point, Point AxisPixPoint, double angle, Point AxisP1, double labelAngle, double labelAxisPos, Point labelCenter)
{
Bitmap bitmap = new Bitmap(srcbitmap.Width, srcbitmap.Height, PixelFormat.Format32bppArgb);
Graphics g = Graphics.FromImage(bitmap);
g.DrawImage(srcbitmap, 0, 0);
srcbitmap.Dispose();
g.FillEllipse(blue, Common.EllipseCenter(Label_Pix_Point, pointsize));
g.FillEllipse(yellow, Common.EllipseCenter(Center_Pix_Point, pointsize));
g.FillEllipse(red, Common.EllipseCenter(AxisPixPoint, pointsize));
g.FillEllipse(AliceBlue, Common.EllipseCenter(labelCenter, pointsize));
g.DrawLine(Greenpen, AxisPixPoint, Label_Pix_Point);
g.DrawString($"angle:{angle}", font, blue, 0, 0);
g.DrawString($"AxisP1:{AxisP1}", font, red, 0, 80);
g.DrawString($"labelAngle:{labelAngle}/{labelAxisPos}", font, red, 0, 160);
g.Save();
Directory.CreateDirectory("/image/LabelDebug/");
bitmap.Save("/image/LabelDebug/" + DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss") + ".jpg", ImageFormat.Jpeg);
g.Dispose();
}
NamedPipeClient namedPipeClient = new NamedPipeClient("OcrService", ".");
/// <summary>
/// 计算贴标位置
/// </summary>
/// <param name="Label_Pix_Point">二维码坐标</param>
/// <returns>XY轴贴标点,R轴角度,是否反转标签</returns>
public (Point, double, bool) ClacLabel2(Point Label_Pix_Point, Bitmap bitmap, ReelParam reelParam)
{
OcrProcess.Run();
Point qrcenter = Label_Pix_Point;
//string file = @"D:\853string\Image_20210604173619489.bmp";
//图像剪切范围矩形
var orgCrop = Rectangle.Inflate(new Rectangle(qrcenter, new Size(1, 1)), ConfigHelper.Config.Get("LabelCutSize",560), ConfigHelper.Config.Get("LabelCutSize", 560));
//计算剪切后的二维码中心坐标点
qrcenter.X = qrcenter.X - orgCrop.X;
qrcenter.Y = qrcenter.Y - orgCrop.Y;
///var bitmap = new Bitmap(file);
var b1 = Common.ImageCrop(bitmap, orgCrop);
//pictureBox1.Image = b1;// crop(bitmap, new Rectangle(0,0,bitmap.Width,bitmap.Height));
bitmap.Dispose();
Directory.CreateDirectory("/image/LabelDebug/");
string filename = "/image/LabelDebug/" + reelParam.ReeID + "-" + DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss") + ".temp.bmp";
b1.Save(filename);
//调用算法服务
var resp = namedPipeClient.Request(filename);
MoveInfo.log($"贴标OCR file:{filename}, 计算结果:" + resp);
//File.Delete(file + ".temp.bmp");
var l = JsonConvert.DeserializeObject<List<TextBlock>>(resp);
List<TextBlock> newlist = new List<TextBlock>();
List<TextBlock> highscorelist = new List<TextBlock>();
//过滤合规数据
foreach (var t in l.ToArray())
{
//Console.WriteLine(Sim(t.Text, "PN+VC63.33034.L0L-018139"));
var s1 = Common.Sim(t.Text.Length >= 27 ? t.Text.Substring(0, 27) : t.Text, "PN+VC:"+ reelParam.PN);
var s2 = Common.Sim(t.Text.Length >= 6 ? t.Text.Substring(0, 6) : t.Text, "PN+VC:");
var s3 = Common.Sim(t.Text.Length >= 7 ? t.Text.Substring(0, 7) : "", "VPN:RTL");
MoveInfo.log($"text:{t.Text}");
MoveInfo.log($"s1:{s1}, s2:{s2}, s3:{s3}");
if ((s1 > 0.7 || s2 > 0.9) && s3 < 0.7 && t.Text.Length < 33)
{
newlist.Add(t);
MoveInfo.log($"s1:{s1}, s2:{s2} , {t.Text}");
}
if (s1 > 0.9)
{
//newlist.Clear();
highscorelist.Add(t);
MoveInfo.log($"s1:{s1}>0.93 , {t.Text}");
//break;
}
}
if (highscorelist.Count > 0)
newlist = highscorelist;
//List<Point> RightPoint
Point labelPoint = Point.Empty;
double labelAngle = 0;
double lastDistance = 0;
TextBlock lasttextBlock = new TextBlock();
if (newlist.Count == 0)
{
MoveInfo.log($"贴标OCR 筛选结果失败");
return ClacLabel(Label_Pix_Point);
}
MoveInfo.log($"贴标OCR 筛选结果:" + JsonConvert.SerializeObject(newlist));
Graphics graphics = Graphics.FromImage(b1);
graphics.FillEllipse(AliceBlue, Common.EllipseCenter(qrcenter,pointsize));
foreach (var lp in newlist)
{
//textBox1.Text += JsonConvert.SerializeObject(lp) + "\r\n";
//字符起始位置左下角定位点
var sp = lp.BoxPoints;
var (dc, topindex) = Common.DistanceWithBoxAndPoint(sp, qrcenter);
if (dc > lastDistance)
{
lastDistance = dc;
lasttextBlock = lp;
var lf = (topindex == 0) ? 3 : topindex - 1;//左下角点位
var ld = (lf == 0) ? 3 : lf - 1;//横向点位
labelPoint = sp[lf];
labelAngle = Common.getAngle(sp[lf], sp[ld]) + 90;
}
for (int i = 0; i < lp.BoxPoints.Count; i++)
{
if (i == 0)
graphics.FillEllipse(blue, Common.EllipseCenter(lp.BoxPoints[i], pointsize));
else
graphics.FillEllipse(red, Common.EllipseCenter(lp.BoxPoints[i], pointsize));
}
}
graphics.FillEllipse(yellow, Common.EllipseCenter(labelPoint, pointsize) );
MoveInfo.log($"贴标OCR lasttextBlock:" + JsonConvert.SerializeObject(lasttextBlock));
//graphics.FillEllipse(red, new Rectangle(lc.X, lc.Y, pointsize.Width, pointsize.Height));
//纵向偏移
labelPoint = Common.PointWithAngle(labelPoint, labelAngle, Config.Label_Offset_Y);
//横向偏移
labelPoint = Common.PointWithAngle(labelPoint, labelAngle - 90, Config.Label_Offset_X);
graphics.FillEllipse(yellow, Common.EllipseCenter(labelPoint, pointsize));
graphics.Save();
graphics.Dispose();
b1.Save(filename+".result.jpg",ImageFormat.Jpeg);
b1.Dispose();
if (labelAngle < 0)
labelAngle = 360 + labelAngle;
//计算贴标角度的脉冲值
if (labelAngle > Config.Label_R_MaxAngle)
{
if (labelAngle > Config.Label_R_MaxAngle + (360 - labelAngle) / 2)
labelAngle = 0;
else
labelAngle = Config.Label_R_MaxAngle;
}
int labelAxisPos = (int)((double)Config.Label_R_360 / Config.Label_R_MaxAngle * (double)labelAngle);
//换算为剪切前的像素位置
labelPoint.Offset(orgCrop.X, orgCrop.Y);
//计算贴标像素点位与图像中心点的差
Point p2 = new Point(labelPoint.X - Config.Right_Batch_X, labelPoint.Y - Config.Right_Batch_Y);
//MoveInfo.log($"计算结果,Label_R_360:{Config.Label_R_360},贴标角度:{labelAngle},R轴:{labelAxisPos},贴标计算像素位置:{labelPoint},换算全图像素位置:{p1}");
//计算像素*脉冲像素比得到脉冲值+中心点基准脉冲
var x = (int)(p2.X * Config.Cam_Pixel_X_Ratio) + Config.Label_X_Base;
var y = (int)(p2.Y * Config.Cam_Pixel_Y_Ratio) + Config.Label_Y_Base;
Point p1 = new Point(x, y);
MoveInfo.log($"计算结果,Label_R_360:{Config.Label_R_360},贴标角度:{labelAngle},R轴:{labelAxisPos},贴标计算像素位置:{p2},换算伺服脉冲位置:{p1}");
return (p1, labelAxisPos, false);
}
}
}
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace DeviceLibrary
{
using crc = OnlineStore.CodeResourceControl;
public partial class LabelMachine : MachineBase, IRobot
{
private Config_Label _config;
public new Config_Label Config
{
get => _config; set
{
base.Config = value;
_config = value;
}
}
public override string DeviceName { get; } = "贴标机构";
public bool canRunning { get; set; }
public bool isBusy { get; set; }
public bool isAlarm { get; set; }
public bool DisableLabel { get; set; }
//public RunStatus runStatus { get; set; }
//public bool UserPause { get; set; }
public bool IgnoreSafecheck { get; set; }
public bool IgnoreGratingSignal { get; set; }
AxisBean Label_X_Axis;
AxisBean Label_Y_Axis;
AxisBean Label_Z_Axis;
AxisBean Label_R_Axis;
public MoveInfo SendOutMoveInfo;
public MoveInfo VacuumMoveInfo;
public bool Init(out string msg)
{
msg = "";
try
{
string configFile = "config\\LabelConfig.csv";
Config = new Config_Label(0, "", configFile);
Config = (Config_Label)CSVConfigReader.LoadConfig<IO_Label_Type>(Config);
#region 初始化伺服轴
Label_X_Axis = new AxisBean(Config.Label_X_Axis, DeviceName);
Label_Y_Axis = new AxisBean(Config.Label_Y_Axis, DeviceName);
Label_Z_Axis = new AxisBean(Config.Label_Z_Axis, DeviceName);
Label_R_Axis = new AxisBean(Config.Label_R_Axis, DeviceName);
#endregion
MoveInfo = new MoveInfo(DeviceName);
SendOutMoveInfo = new MoveInfo("贴标送出");
VacuumMoveInfo = new MoveInfo("贴标吸标");
SendOutMoveInfo.Hide = true;
VacuumMoveInfo.Hide = true;
ResetMoveInfo = MoveInfo;
LedProcessInit();
}
catch (Exception e)
{
msg = e.Message;
return false;
}
return true;
}
public override void Run()
{
base.Run();
IOMove(IO_Label_Type.Camera_Led, IO_VALUE.HIGH);
}
public override void Stop()
{
IOMove(IO_Label_Type.Camera_Led, IO_VALUE.LOW);
base.Stop();
}
protected override void LoopProcess()
{
mstart = true;
while (mstart)
{
try
{
canRunning = DeviceCheck();
if (canRunning)
{
//BtnProcess();
canRunning = SafeCheck();
}
Thread.Sleep(stepDelaytime);
if (!canRunning || !mstart)
continue;
if (runStatus == RunStatus.Running)
{
WorkProcess();
SendOutProcess();
VacuumLabelProcess();
}
else if (runStatus == RunStatus.HomeReset)
{
HomeReset();
}
}
catch (Exception ex)
{
Msg.add(ex.Message, MsgLevel.warning);
LogUtil.error(DeviceName + " " + ex.ToString());
Thread.Sleep(stepDelaytime*5);
}
finally
{
ProcessMsgEventFire(Msg);
//ProcessMoveinfoEventFire(MoveInfo.List);
Msg.Clear();
}
}
LogUtil.info($"{DeviceName} 主线程已退出.");
}
public bool DeviceCheck()
{
bool ok = true;
if (IOManager.GetDIValue("", 0, 45).Equals(IO_VALUE.LOW))
{
Alarm(AlarmType.SuddenStop);
Msg.add(crc.GetString("emergency_stop", "急停中"), MsgLevel.warning);
Thread.Sleep(1000);
ok = false;
}
else if (alarmType == AlarmType.SuddenStop)
{
Msg.add(crc.GetString("system_need_reset", "系统需要重置"), MsgLevel.warning);
Thread.Sleep(1000);
ok = false;
}
if (alarmType != AlarmType.SuddenStop)
{
TimeSpan span = DateTime.Now - checkAlarmTime;
//在回原点,复位,出入库时,检测报警间隔减小
if ((!runStatus.Equals(RunStatus.Stop) && span.TotalSeconds > 3) || span.TotalSeconds > 1)
{
if (Config.moveAxisList != null)
{
foreach (ConfigMoveAxis configMoveAxis in Config.moveAxisList)
{
if (AxisManager.GetAlarmStatus(configMoveAxis.DeviceName, configMoveAxis.GetAxisValue()) == 1)
{
Msg.add(crc.GetString("axis_run_alert", "{0}:运动报警", configMoveAxis.Explain), MsgLevel.warning);
ok = false;
LogUtil.error(string.Join(",", HuichuanLibrary.HCBoardManager.GetAxisErrorDetail(configMoveAxis.GetAxisValue())));
}
}
}
}
}
return ok;
}
public void BeginHomeReset(bool firstRun = false)
{
if (!firstRun)
{
StopMove();
Thread.Sleep(500);
}
OpenAllServo();
alarmType = AlarmType.None;
runStatus = RunStatus.HomeReset;
ResetMoveInfo.NewMove(MoveStep.H01_HomeReset);
ResetMoveInfo.log("开始回原");
ResetMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
}
private void HomeReset()
{
if (CheckWait(ResetMoveInfo))
return;
switch (ResetMoveInfo.MoveStep)
{
case MoveStep.H01_HomeReset:
ResetMoveInfo.NextMoveStep(MoveStep.H02_HomeReset);
ResetMoveInfo.log("正在回原, 皮带线阻挡上升,贴标机构阻挡上升,z轴");
CylinderMove(ResetMoveInfo, IO_Label_Type.TrayStop_Down, IO_Label_Type.TrayStop_Up);
CylinderMove(ResetMoveInfo, IO_Label_Type.Label_Stop_Down, IO_Label_Type.Label_Stop_Up);
Label_Z_Axis.HomeMove(ResetMoveInfo);
break;
case MoveStep.H02_HomeReset:
ResetMoveInfo.NextMoveStep(MoveStep.H03_HomeReset);
ResetMoveInfo.log("正在回原 y轴");
IOMove(IO_Label_Type.Line1_Run, IO_VALUE.HIGH);
IOMove(IO_Label_Type.Line2_Run, IO_VALUE.HIGH);
Label_X_Axis.HomeMove(ResetMoveInfo);
break;
case MoveStep.H03_HomeReset:
ResetMoveInfo.NextMoveStep(MoveStep.H04_HomeReset);
ResetMoveInfo.log("正在回原 xyzr轴");
Label_R_Axis.HomeMove(ResetMoveInfo);
Label_Y_Axis.HomeMove(ResetMoveInfo);
break;
case MoveStep.H04_HomeReset:
ResetMoveInfo.NextMoveStep(MoveStep.H05_HomeReset);
ResetMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500));
break;
case MoveStep.H05_HomeReset:
ResetMoveInfo.NextMoveStep(MoveStep.H06_HomeReset);
ResetMoveInfo.log("正在回原 等待2秒钟");
Label_R_Axis.AbsMove(ResetMoveInfo, Config.Label_R_P2, Config.Label_R_P2_speed);
Label_Z_Axis.AbsMove(ResetMoveInfo, Config.Label_Z_P1, Config.Label_Z_P1_speed);
ResetMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(2000));
break;
case MoveStep.H06_HomeReset:
ResetMoveInfo.NextMoveStep(MoveStep.H07_HomeReset);
ResetMoveInfo.log("正在回原 xyzr轴到待机点");
Label_Y_Axis.AbsMove(ResetMoveInfo, Config.Label_Y_P2, Config.Label_Y_P2_speed);
break;
case MoveStep.H07_HomeReset:
ResetMoveInfo.NextMoveStep(MoveStep.HEND_HomeReset);
ResetMoveInfo.log("正在回原 线体停止,阻挡下降");
Label_X_Axis.AbsMove(ResetMoveInfo, Config.Label_X_P2, Config.Label_X_P2_speed);
IOMove(IO_Label_Type.Line1_Run, IO_VALUE.LOW);
IOMove(IO_Label_Type.Line2_Run, IO_VALUE.LOW);
CylinderMove(ResetMoveInfo, IO_Label_Type.TrayStop_Up, IO_Label_Type.TrayStop_Down);
CylinderMove(ResetMoveInfo, IO_Label_Type.Label_Stop_Up, IO_Label_Type.Label_Stop_Down);
break;
case MoveStep.HEND_HomeReset:
ResetMoveInfo.log("回源完成");
ResetMoveInfo.EndMove();
MoveInfo.NewMove(MoveStep.Lbl_01_Wait_ATray);
runStatus = RunStatus.Running;
break;
}
}
public IO_VALUE Label_TaryStop_Check
{
get => IOValue(IO_Label_Type.Label_TaryStop_Check);
}
public void InLineRunControl(IO_VALUE iO_VALUE)
{
IOMove(IO_Label_Type.Line1_Run, iO_VALUE);
}
}
}
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using CodeLibrary;
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
namespace DeviceLibrary
{
using crc = OnlineStore.CodeResourceControl;
public partial class LabelMachine
{
//保存贴标位置调试图像
public bool saveLabelDebugBmp = true;
public void test() {
Console.WriteLine(preReelParam);
}
double labelRAxisPos = 0;
Point p1;
bool ReverseLabel = false;
//是否允许进入贴标线体
public bool TrayCanIN()
{
return IOValue(IO_Label_Type.Tray_Check).Equals(IO_VALUE.LOW) && IOValue(IO_Label_Type.TrayStop_Down).Equals(IO_VALUE.HIGH) && preReelParam==null;
//return IOValue(IO_Label_Type.Line_HasTray_Check).Equals(IO_VALUE.LOW);
}
//贴标入口料盘到位检测
public IO_VALUE Tray_Check
{
//阻挡检测
get => IOValue(IO_Label_Type.Tray_Check);
//对射检测
//get=> IOValue(IO_Label_Type.Line_HasTray_Check);
}
/// <summary>
/// 0=扫码失败,1=打印与实际二维码不一致
/// </summary>
[Flags]
enum WaitCheckLabeltypeE
{
None = 0,
Scan_QRCode_Fail = 1,
Scan_Code_And_Print_are_different = 2,
Failed_to_extract_label = 4,
};
WaitCheckLabeltypeE WaitCheckLabeltype;
Task printTask = null;
int reelcount = 0;
void WorkProcess()
{
if (CheckWait(MoveInfo))
return;
switch (MoveInfo.MoveStep)
{
case MoveStep.Lbl_01_Wait_ATray:
var Label_TaryStop_Check = IOValue(IO_Label_Type.Label_TaryStop_Check);
//LogUtil.OutputDebugString($"Tray_Check:{IOValue(IO_Label_Type.Tray_Check)},Label_TaryStop_Check:{Label_TaryStop_Check},preReelParam:{preReelParam!=null}");
if (IOValue(IO_Label_Type.Tray_Check,IO_VALUE.HIGH) && Label_TaryStop_Check.Equals(IO_VALUE.LOW) && preReelParam != null)
{
MoveInfo.NextMoveStep(MoveStep.Lbl_02_StopUP);
MoveInfo.ReelParam = preReelParam;
preReelParam = null;
MoveInfo.log("检测到料盘 ReelParam:" + MoveInfo.ReelParam.ToStr());
MoveInfo.StopwatchReset();
}
//else if (Tray_Check.Equals(IO_VALUE.HIGH) && MoveInfo.IsTimeOut(30))
//{
// MoveInfo.NextMoveStep(MoveStep.Lbl_02_StopUP);
// MoveInfo.ReelParam.IsNg = true;
// MoveInfo.ReelParam.NgMsg = "超时NG:没有等到料盘信息";
// MoveInfo.log("检测到料盘 超时NG:没有等到料盘信息");
//}
else if (Tray_Check.Equals(IO_VALUE.HIGH)) {
Msg.add(crc.GetString("label_detect_reel_wait_reelinfo", "已检测到料盘, 等待料盘数据信息到位"), MsgLevel.info);
}
else if (Label_TaryStop_Check.Equals(IO_VALUE.HIGH))
{
Msg.add(crc.GetString("label_has_reel", "贴标区有料未送出"), MsgLevel.warning);
MoveInfo.log("贴标区有料未送出");
MoveInfo.NextMoveStep(MoveStep.Lbl_01_Wait_ATray);
}
else
{
Msg.add(crc.GetString("wait_reel_entry", "{0}等待料盘进入", DeviceNameShow), MsgLevel.info);
MoveInfo.log("等待上料区进入料盘");
MoveInfo.NextMoveStep(MoveStep.Lbl_01_Wait_ATray);
}
break;
case MoveStep.Lbl_02_StopUP:
if (MoveInfo.ReelParam.IsNg || DisableLabel)
{
MoveInfo.NextMoveStep(MoveStep.Lbl_BeginOut);
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);
MoveInfo.log("NG盘直接通过");
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(3000));
if (RobotManage.offlinemode)
{
ReelLocation reelLocation1 = RobotManage.offlinereelLocation;
if (!string.IsNullOrEmpty(reelLocation1.isTower))
{
MoveInfo.ReelParam.ReelDest = ReelDest.Tower;
}
else if (!string.IsNullOrEmpty(reelLocation1.isVTTower))
{
MoveInfo.ReelParam.ReelDest = ReelDest.VT_Tower;
}
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;
}
MoveInfo.NextMoveStep(MoveStep.Lbl_03_LineRun);
MoveInfo.log("上料区阻挡上升,贴标区阻挡下降");
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.LOW);
ReelLocation reelLocation;
if (RobotManage.offlinemode)
{
reelLocation = RobotManage.offlinereelLocation;
//printTask = DoPrint(MoveInfo.ReelParam, false);
}
else
{
reelLocation = ServerConn.DetermineReelStorageLocation(MoveInfo.ReelParam.WareCode);
}
if (reelLocation == null)
{
MoveInfo.NextMoveStep(MoveStep.Lbl_BeginOut);
MoveInfo.ReelParam.IsNg = true;
MoveInfo.ReelParam.NgMsg = "获取料盘目的地失败";
MoveInfo.ReelParam.logresult();
MoveInfo.log("获取料盘目的地失败");
}
else
{
if (reelLocation.isTower=="1")
{
MoveInfo.ReelParam.ReelDest = ReelDest.Tower;
if (ConfigHelper.Config.Get<bool>("ForceVTTower",false)) {
MoveInfo.log("强制转到VTTOWER");
MoveInfo.ReelParam.ReelDest = ReelDest.VT_Tower;
}
}
else if (reelLocation.isVTTower == "1")
{
MoveInfo.ReelParam.ReelDest = ReelDest.VT_Tower;
}
else if (reelLocation.isVacuum == "1")
{
MoveInfo.ReelParam.ReelDest = ReelDest.MSD;
}
else
{
MoveInfo.NextMoveStep(MoveStep.Lbl_BeginOut);
MoveInfo.ReelParam.IsNg = true;
MoveInfo.ReelParam.NgMsg = "服务器没有返回明确目标";
MoveInfo.ReelParam.logresult();
MoveInfo.log("服务器没有返回明确目标");
}
MoveInfo.log(MoveInfo.ReelParam.ToStr());
if (RobotManage.offlinemode && !MoveInfo.ReelParam.IsNg)
{
printTask = DoPrint(MoveInfo.ReelParam, false);
}
if (!MoveInfo.ReelParam.IsNg)
{
//开始吸标
VacuumMoveInfo.ReelParam = MoveInfo.ReelParam;
VacuumMoveInfo.NewMove(MoveStep.LblVacuum_01);
}
}
break;
case MoveStep.Lbl_03_LineRun:
MoveInfo.NextMoveStep(MoveStep.Lbl_03_StopDown_and_wait);
MoveInfo.log("线体1,2开始运行");
RobotManage.Line1.LineRun("label", 999, "Lbl_03_LineRun");
RobotManage.Line2.LineRun("label", 999, "Lbl_03_LineRun");
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(2000));
break;
case MoveStep.Lbl_03_StopDown_and_wait:
MoveInfo.NextMoveStep(MoveStep.Lbl_04_LineStopWait);
MoveInfo.log("等待区阻挡下降");
CylinderMove(MoveInfo, IO_Label_Type.TrayStop_Down, IO_Label_Type.TrayStop_Up, IO_VALUE.LOW);
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Label_Type.Label_TaryStop_Check, IO_VALUE.HIGH));
break;
case MoveStep.Lbl_04_LineStopWait:
MoveInfo.NextMoveStep(MoveStep.Lbl_04_LineStop);
MoveInfo.StopwatchLog(false, "到达阻挡");
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500));
break;
case MoveStep.Lbl_04_LineStop:
MoveInfo.NextMoveStep(MoveStep.Lbl_05_ScanCode);
MoveInfo.log($"线体1,2停止运行,并拍照 Label_TaryStop_Check:{IOValue(IO_Label_Type.Label_TaryStop_Check)}");
RobotManage.Line1.LineStop("label", "Lbl_04_LineStop");
RobotManage.Line2.LineStop("label", "Lbl_04_LineStop");
CylinderMove(MoveInfo, IO_Label_Type.TrayStop_Down, IO_Label_Type.TrayStop_Up, IO_VALUE.LOW);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
break;
case MoveStep.Lbl_05_ScanCode:
//MoveInfo.NextMoveStep(MoveStep.Lbl_06_Get_Reelinfo);
MoveInfo.NextMoveStep(MoveStep.Lbl05);
WaitCheckLabeltype = WaitCheckLabeltypeE.None;
ScanTask2 = ScanCode2();
//Task.Delay(1000).Wait();
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
break;
//case MoveStep.Lbl_05_Wait:
// if (SendOutMoveInfo.MoveStep == MoveStep.Wait)
// {
// CylinderMove(MoveInfo, IO_Label_Type.Label_Stop_Down, IO_Label_Type.Label_Stop_Up, IO_VALUE.HIGH);
// MoveInfo.log("贴标阻挡上升");
// }
// else
// {
// Msg.add(crc.GetString("wait_goto_xx", "等待料盘到达{0}", RobotManage.filterMachine.DeviceName), MsgLevel.warning);
// MoveInfo.log("贴标阻挡上升,等待到达分盘线");
// }
// break;
case MoveStep.Lbl05:
if (VacuumMoveInfo.MoveStep == MoveStep.LblVacuum_end)
{
MoveInfo.NextMoveStep(MoveStep.Lbl06);
//Label_X_Axis.AbsMove(MoveInfo, Config.Label_X_Base, Config.Label_X_Base_speed);
//Label_Y_Axis.AbsMove(MoveInfo, Config.Label_Y_Base, Config.Label_X_Base_speed);
//Label_Z_Axis.AbsMove(MoveInfo, Config.Label_Z_P4, Config.Label_Z_P4_speed);
//MoveInfo.log("Label_XYZ转到贴标准备点.");
}
else if (VacuumMoveInfo.MoveStep == MoveStep.LblVacuum_failure)
{
MoveInfo.NextMoveStep(MoveStep.Lbl_WaitCheckLabel);
WaitCheckLabeltype = WaitCheckLabeltypeE.Failed_to_extract_label;
}
else if (VacuumMoveInfo.MoveStep == MoveStep.LblVacuum_printfail)
{
MoveInfo.NextMoveStep(MoveStep.Lbl_BeginOut);
}
break;
case MoveStep.Lbl06:
if (ScanTask2.IsCompleted)
{
MoveInfo.NextMoveStep(MoveStep.Lbl11);
Label_X_Axis.AbsMove(MoveInfo, p1.X, Config.Label_X_Base_speed);
Label_Y_Axis.AbsMove(MoveInfo, p1.Y, Config.Label_X_Base_speed);
Label_R_Axis.AbsMove(MoveInfo, (int)labelRAxisPos, Config.Label_R_P2_speed);
Label_Z_Axis.AbsMove(MoveInfo, Config.Label_Z_P4, Config.Label_Z_P4_speed);
//MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(2000));
MoveInfo.log("Label_XYZ转到贴标点.");
}
else if (MoveInfo.IsTimeOut(15))
{
MoveInfo.NextMoveStep(MoveStep.Lbl_WaitCheckLabel);
MoveInfo.log($"等待扫码超时,重新扫码");
WaitCheckLabeltype = WaitCheckLabeltypeE.Scan_QRCode_Fail;
}
break;
case MoveStep.Lbl10:
break;
case MoveStep.Lbl11:
MoveInfo.NextMoveStep(MoveStep.Lbl12);
var p5 = Config.Label_Z_P5;
p5 = p5 - (MoveInfo.ReelParam.PlateRawH - 10) * Config.Label_Z_Axis_ChangeValue;
Label_Z_Axis.AbsMove(MoveInfo, p5, Config.Label_Z_P5_speed);
MoveInfo.log($"取标气缸下降p5:{p5}={Config.Label_Z_P5}-({MoveInfo.ReelParam.PlateRawH}-10)*{Config.Label_Z_Axis_ChangeValue}.关闭吸气.");
break;
case MoveStep.Lbl12:
MoveInfo.NextMoveStep(MoveStep.Lbl13);
IOMove(IO_Label_Type.LabelCylinder_Work, IO_VALUE.LOW);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500));
break;
case MoveStep.Lbl13:
MoveInfo.NextMoveStep(MoveStep.Lbl_BeginOut);
Label_Z_Axis.AbsMove(MoveInfo, Config.Label_Z_P2, Config.Label_Z_P2_speed);
MoveInfo.ReelParam.LabelState = "Ok";
MoveInfo.log("取标气缸上升.");
break;
case MoveStep.Lbl_WaitCheckLabel:
if ((WaitCheckLabeltype & WaitCheckLabeltypeE.Scan_QRCode_Fail) == WaitCheckLabeltypeE.Scan_QRCode_Fail)
Msg.add(crc.GetString("label_scan_qrcode_fail","未识别到有效二维码"), MsgLevel.warning);
if ((WaitCheckLabeltype & WaitCheckLabeltypeE.Scan_Code_And_Print_are_different) == WaitCheckLabeltypeE.Scan_Code_And_Print_are_different)
Msg.add(crc.GetString("label_qrcode_different", "扫描到的Reelid与发出打印的可能不一致"), MsgLevel.warning);
if ((WaitCheckLabeltype & WaitCheckLabeltypeE.Failed_to_extract_label) == WaitCheckLabeltypeE.Failed_to_extract_label)
Msg.add(crc.GetString("label_extract_fail", "标签吸取失败"), MsgLevel.warning);
MoveInfo.log("Lbl_WaitCheckLabel:"+ WaitCheckLabeltype.ToString());
if (IOValue(IO_Label_Type.Reset_BTN).Equals(IO_VALUE.HIGH)) {
MoveInfo.ReelParam.LabelState = WaitCheckLabeltype.ToString();
MoveInfo.NextMoveStep(MoveStep.Lbl_BeginOut);
IOMove(IO_Label_Type.LabelCylinder_Work, IO_VALUE.LOW);
RobotManage.Line2.LineRun("label", 999, "Lbl_WaitCheckLabel");
MoveInfo.log("人工完成贴标.");
}
break;
case MoveStep.Lbl_BeginOut:
MoveInfo.NextMoveStep(MoveStep.Lbl15);
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_R_Axis.AbsMove(null, Config.Label_R_P2, Config.Label_R_P2_speed);
if (MoveInfo.ReelParam.IsNg || DisableLabel)
{
RobotManage.Line1.LineRun("label", 5, "Lbl_BeginOut");
RobotManage.Line2.LineRun("label", 999, "Lbl_BeginOut");
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1500));
}
MoveInfo.log("Label_XYR转到取标点,待机");
break;
case MoveStep.Lbl15:
if (MoveInfo.ReelParam.WareCode == "testlabel") {
MoveInfo.NextMoveStep(MoveStep.L30_LabelFinish);
MoveInfo.log("贴标测试结束.");
}
else
{
MoveInfo.NextMoveStep(MoveStep.Lbl16);
CylinderMove(null, IO_Label_Type.Label_Stop_Down, IO_Label_Type.Label_Stop_Up, IO_VALUE.HIGH);
CylinderMove(MoveInfo, IO_Label_Type.TrayStop_Down, IO_Label_Type.TrayStop_Up, IO_VALUE.LOW);
MoveInfo.log("贴标阻挡上升.");
}
break;
case MoveStep.Lbl16:
if (SendOutMoveInfo.MoveStep == MoveStep.Wait && RobotManage.filterMachine.isWaitReel)
{
MoveInfo.NextMoveStep(MoveStep.L30_LabelFinish);
RobotManage.filterMachine.preReelParam = MoveInfo.ReelParam;
SendOutMoveInfo.NewMove(MoveStep.LblSendOut_01);
MoveInfo.log("送出料盘.");
if (MoveInfo.ReelParam.IsNg)
{
RobotManage.Line2.LineRun("label", 15, "Lbl_BeginOut");
}
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1500));
}
else if (MoveInfo.IsTimeOut(30))
{
Msg.add(crc.GetString("wait_xx_timeout", "等待{0}超时{1}秒", RobotManage.filterMachine.DeviceName, MoveInfo.TimeOutSeconds), MsgLevel.warning);
MoveInfo.log($"等待分盘线超时,SendOutMoveInfo:{SendOutMoveInfo.MoveStep}");
}
break;
case MoveStep.L30_LabelFinish:
MoveInfo.NewMove(MoveStep.Lbl_01_Wait_ATray);
MoveInfo.StopwatchLog();
break;
}
}
void SendOutProcess()
{
if (CheckWait(SendOutMoveInfo))
return;
switch (SendOutMoveInfo.MoveStep)
{
case MoveStep.LblSendOut_01:
SendOutMoveInfo.NewMove(MoveStep.LblSendOut_02);
RobotManage.Line2.LineRun("sendout", 999, "LblSendOut_01");
RobotManage.filterMachine.LineRun();
SendOutMoveInfo.log("送出料盘.");
break;
case MoveStep.LblSendOut_02:
if (RobotManage.filterMachine.Tray_Check.Equals(IO_VALUE.HIGH) || RobotManage.filterMachine.preReelParam == null)
{
SendOutMoveInfo.NewMove(MoveStep.LblSendOut_03);
RobotManage.Line2.LineStop("sendout", "LblSendOut_02");
SendOutMoveInfo.log("完成贴标.");
}
else if (SendOutMoveInfo.IsTimeOut(30))
{
SendOutMoveInfo.NewMove(MoveStep.LblSendOut_03);
RobotManage.Line2.LineStop("sendout", "LblSendOut_02");
RobotManage.filterMachine.preReelParam = null;
SendOutMoveInfo.log("等待料盘到达分盘线超时.完成贴标.");
}
else if (SendOutMoveInfo.IsTimeOut(5))
{
Msg.add(crc.GetString("wait_goto_xx", "等待料盘到达{0}",RobotManage.filterMachine.DeviceName), MsgLevel.warning);
SendOutMoveInfo.log("等待到达分盘线");
}
break;
case MoveStep.LblSendOut_03:
SendOutMoveInfo.EndMove();
break;
}
}
void VacuumLabelProcess()
{
if (CheckWait(VacuumMoveInfo))
return;
switch (VacuumMoveInfo.MoveStep)
{
case MoveStep.LblVacuum_01:
if (IOValue(IO_Label_Type.Label_Cylinder_Check).Equals(IO_VALUE.HIGH))
{
VacuumMoveInfo.NextMoveStep(MoveStep.LblVacuum_02);
Label_Z_Axis.AbsMove(VacuumMoveInfo, Config.Label_Z_P3, Config.Label_Z_P3_speed);
//IOMove(IO_Label_Type.LabelCylinder_Work, IO_VALUE.HIGH);
VacuumMoveInfo.log("标签打印完毕,取标气缸下降,开始吸气.");
}
else if (VacuumMoveInfo.IsTimeOut(25))
{
Msg.add(crc.GetString("label_print_timeout","标签打印超时{0}秒", VacuumMoveInfo.TimeOutSeconds), MsgLevel.warning);
VacuumMoveInfo.log("标签打印超时, 放弃贴标NG处理");
MoveInfo.ReelParam.IsNg = true;
MoveInfo.ReelParam.NgMsg = "Label Print Timeout";
MoveInfo.ReelParam.logresult();
}
else if (VacuumMoveInfo.IsTimeOut(15))
{
Msg.add(crc.GetString("label_print_timeout", "标签打印超时{0}秒", VacuumMoveInfo.TimeOutSeconds), MsgLevel.warning);
VacuumMoveInfo.log("标签打印超时");
}
break;
case MoveStep.LblVacuum_02:
VacuumMoveInfo.NextMoveStep(MoveStep.LblVacuum_03);
IOMove(IO_Label_Type.LabelCylinder_Work, IO_VALUE.HIGH);
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);
VacuumMoveInfo.log("标签打印完毕,取标气缸上升,取起标签.");
break;
case MoveStep.LblVacuum_04:
VacuumMoveInfo.log($"Label_Cylinder_Check:{IOValue(IO_Label_Type.Label_Cylinder_Check)}");
if (IOValue(IO_Label_Type.Label_Cylinder_Check).Equals(IO_VALUE.LOW))
{
VacuumMoveInfo.NextMoveStep(MoveStep.LblVacuum_end);
VacuumMoveInfo.log("吸标成功.");
}
else if (VacuumMoveInfo.IsTimeOut(10))
{
VacuumMoveInfo.NextMoveStep(MoveStep.LblVacuum_failure);
VacuumMoveInfo.log("吸标失败.");
}
break;
case MoveStep.LblVacuum_end:
break;
case MoveStep.LblVacuum_failure:
break;
case MoveStep.LblVacuum_printfail:
break;
}
}
public void LabelTest(){
MoveInfo.NextMoveStep(MoveStep.Lbl_04_LineStop);
MoveInfo.log("开始打印贴标测试.");
MoveInfo.ReelParam = new ReelParam("testlabel", 7, 8);
MoveInfo.ReelParam.QTY = 9999;
//DoPrint(MoveInfo.ReelParam);
}
}
}
using CodeLibrary;
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DeviceLibrary
{
using crc = OnlineStore.CodeResourceControl;
public partial class LabelMachine
{
public void InitPrint()
{
RobotManage.PrintBean.PrintStatusChanged += Print_PrintStatusChanged;
RobotManage.LoadPrintSetting();
}
public Asa.PrintLabel.PrinterStatus LastPrintStatus = Asa.PrintLabel.PrinterStatus.Unknown;
void Print_PrintStatusChanged(Asa.PrintLabel.PrinterStatus sta, string msg)
{
if (sta.Equals(LastPrintStatus).Equals(false))
{
LogUtil.info("PrintLabel 收到打印机新状态:【" + sta + "】【" + msg + "】,替换原来的状态【" + LastPrintStatus + "】 ");
}
else
{
if (sta == Asa.PrintLabel.PrinterStatus.Idle)
{
Task.Run(() => {
while (true)
{
if (MoveInfo.IsStep(MoveStep.Lbl_WaitPrint))
{
MoveInfo.NextMoveStep(MoveStep.Lbl_Printted);
break;
}
Task.Delay(500).Wait();
}
});
}
LogUtil.info(" PrintLabel 收到打印机新状态:【" + sta + "】【" + msg + "】,与之前状态一样 ");
}
LastPrintStatus = sta;
}
public string LastPrintLabel = "";
void StartPrintLabel(string wareCode, string wareCount, bool ReverseLabel=false)
{
try
{
LastPrintStatus = Asa.PrintLabel.PrinterStatus.Unknown;
LogUtil.info("调用 PrintLabel 打印标签 StartPrintLabel ,[" + wareCode + "] [" + wareCount + "] 开始");
Dictionary<string, string> text = new Dictionary<string, string>();
text.Add("Code", wareCode);
text.Add("Count", wareCount);
text.Add("DateTime", System.DateTime.Now.ToString("F"));
text.Add("FactoryCode", "");
LastPrintLabel = wareCode;
RobotManage.PrintBean.Rotate180 = ReverseLabel;
RobotManage.PrintBean.Print(text);
LogUtil.info("PrintLabel 打印标签 StartPrintLabel 结束 ");
}
catch (Exception ex)
{
LogUtil.error("PrintLabel 打印标签 StartPrintLabel 错误:" + ex.ToString());
}
}
public Task DoPrint(ReelParam labelParam, bool ReverseLabel = false)
{
LogUtil.info($"调用 PrintLabel 打印标签 WareCode:{labelParam.WareCode}, QTY:{labelParam.QTY}, ReverseLabel:{ReverseLabel}");
StartPrintLabel(labelParam.WareCode, labelParam.QTY.ToString(), ReverseLabel);
return Task.Run(() =>
{ });
}
/// <summary>
/// 扫码线程
/// </summary>
Task<(List<CodeInfo>,Bitmap)> ScanTask;
Task<(Point, double, bool)> ScanTask2;
Task<(List<CodeInfo>, Bitmap)> ScanCode()
{
MoveInfo.log("开始贴标扫码线程");
return Task.Run(new Func<(List<CodeInfo>, Bitmap)>(() =>
{
try
{
Bitmap bitmap;
//IOMove(IO_Label_Type.Camera_Led, IO_VALUE.HIGH);
//Task.Delay(10).Wait();
List<CodeInfo> LastCodeList = CodeManager.CameraScan(new List<string> { Config.CameraName },out bitmap);
if (LastCodeList.Count <= 0)
{
Task.Delay(500).Wait();
LastCodeList = CodeManager.CameraScan(new List<string> { Config.CameraName });
}
//IOMove(IO_Label_Type.Camera_Led, IO_VALUE.LOW);
return (LastCodeList,bitmap);
}
catch {
return (new List<CodeInfo>(),null);
}
}));
}
Task<(Point, double, bool)> ScanCode2()
{
MoveInfo.log("开始贴标扫码线程");
return Task.Run(new Func<(Point, double, bool)>(() =>
{
try
{
Bitmap bitmap;
Task.Delay(700).Wait();
List<CodeInfo> LastCodeList = CodeManager.CameraScan(new List<string> { Config.CameraName }, out bitmap);
if (LastCodeList.Count <= 0)
{
Task.Delay(1000).Wait();
LastCodeList = CodeManager.CameraScan(new List<string> { Config.CameraName }, out bitmap);
}
if (LastCodeList.Count == 0)
{
MoveInfo.NextMoveStep(MoveStep.Lbl_WaitCheckLabel);
MoveInfo.log($"未识别到有效二维码");
WaitCheckLabeltype = WaitCheckLabeltypeE.Scan_QRCode_Fail;
}
else
{
if (MoveInfo.ReelParam.WareCode != LastCodeList[0].CodeStr)
{
MoveInfo.NextMoveStep(MoveStep.Lbl_WaitCheckLabel);
Msg.add(crc.GetString("label_qrcode_different", "扫描到的Reelid与发出打印的可能不一致"), MsgLevel.warning);
MoveInfo.log($"扫描到的Reelid与发出打印的不一致,系统:{MoveInfo.ReelParam.WareCode},实际:{LastCodeList[0].CodeStr}");
WaitCheckLabeltype = WaitCheckLabeltypeE.Scan_Code_And_Print_are_different;
//MoveInfo.ReelParam.IsNg = true;
//MoveInfo.ReelParam.NgMsg = "扫描到的Reelid与发出打印的不一致";
//MoveInfo.ReelParam.logresult();
}
else
{
//MoveInfo.NextMoveStep(MoveStep.Lbl_Printted);
MoveInfo.ReelParam.codeInfos = LastCodeList;
MoveInfo.log($"已完成扫码, Count={LastCodeList.Count}");
MoveInfo.ReelParam.logresult();
}
MoveInfo.ReelParam.logresult();
//标签坐标
Point Label_Pix_Point = new Point(MoveInfo.ReelParam.codeInfos[0].X, MoveInfo.ReelParam.codeInfos[0].Y);
//照片坐标反转180度
var x = 5472 - Label_Pix_Point.X;
var y = 3648 - Label_Pix_Point.Y;
Label_Pix_Point.X = x;
Label_Pix_Point.Y = y;
//图像也旋转180度
bitmap.RotateFlip(RotateFlipType.Rotate180FlipNone);
(p1, labelRAxisPos, ReverseLabel) = ClacLabel2(Label_Pix_Point, bitmap, MoveInfo.ReelParam);
return (p1, labelRAxisPos, ReverseLabel);
}
return (Point.Empty, 0, false);
}
catch
{
return (Point.Empty, 0, false);
}
}));
}
}
}
......@@ -87,8 +87,7 @@ namespace DeviceLibrary
//lastSafeCheckStatus = false;
var al = new Dictionary<string, List<AxisBean>>(AxisBean.List);
AxisBean.StopMultiAxis(AxisBean.List[RobotManage.labelMachine.DeviceName]);
AxisBean.StopMultiAxis(AxisBean.List[RobotManage.t1Machine.DeviceName]);
AxisBean.StopMultiAxis(AxisBean.List[RobotManage.xrayMachine.DeviceName]);
//AxisBean.StopMultiAxis();
MoveInfo.List.ForEach((m) => { m.CanWhileCount = 5; });
......@@ -262,8 +261,6 @@ namespace DeviceLibrary
else if (wait.WaitType.Equals(WaitEnum.W008_BatchAxis))
{
AxisBean axisBean=null;
axisBean = RobotManage.t1Machine.T_Batch_Axis;
//if (wait.AxisInfo.ProName == "Right_Batch_Axis")
// axisBean = Right_Batch_Axis;
//else
......
......@@ -28,64 +28,13 @@ namespace DeviceLibrary
Feeding_10_Wait_Reset,
Lbl_01_Wait_ATray,
Lbl_02_StopUP,
Lbl_03_LineRun,
Lbl_03_StopDown_and_wait,
Lbl_04_LineStopWait,
Lbl_04_LineStop,
Lbl_05_ScanCode,
Lbl_05_Wait,
Lbl_06_Get_Reelinfo,
//Lbl_01_StartPrint,
Lbl_WaitCheckLabel,
Lbl_WaitPrint,
Lbl_Printted,
Lbl01,
Lbl02,
Lbl03,
Lbl04,
Lbl05,
Lbl06,
Lbl10,
Lbl11_wait,
Lbl11,
Lbl12,
Lbl13,
Lbl_BeginOut,
Lbl15,
Lbl16,
L30_LabelFinish,
Shelf_EmptyIn_WaitWorkLeave,
Shelf_10_EmptyIn_Wait_StopDown,
Shelf_10_EmptyIn_StopDown,
Shelf_11_EmptyIn_WaitTime,
Shelf_11_EmptyIn_LiftUp,
Shelf_13_EmptyIn_SidingRun,
Shelf_14_EmptyIn_LiftDown,
Shelf_15_EmptyIn_LocationUp,
Shelf_16_EmptyIn_ForkFwd,
Shelf_17_EmptyIn_CheckLocation,
Shelf_18_EmptyIn_WaitManCheck,
Shelf_19_EmptyIn_BatchUp,
Shelf_20_EmptyIn_ShelfReady,
Shelf_21_EmptyIn_TrayDown,
Shelf_Work_WaitShelfLeave,
Shelf_Out_Wait,
Shelf_30_Out_BatchDown,
Shelf_31_Out_ForkBck,
Shelf_32_Out_LocationDown,
Shelf_33_Out_OutStopDown,
Shelf_34_Out_OutStopDown,
Shelf_35_Out_OutLineRun,
Shelf_36_Out_OutLineRun,
XRay_01_LocationDown,
XRay_02_RunIn,
XRay_03_CloseDoor,
XRay_04_OpenXray,
XRay_04_CheckXray,
XRay_05_GetImage,
XRay_06_WaitMatchPN,
XRay_06_WaitMatchPN2,
......@@ -100,49 +49,20 @@ namespace DeviceLibrary
XRay_Extra_04,
XRay_End,
Filter_01_WaitReel,
Filter_02_WaitReel,
Filter_10_NGReel_PushOut,
Filter_11_NGReel_End,
Filter_20_MSDReel_wait,
Filter_21_MSDReel_wait,
Filter_22_MSDReel_PushOut,
Filter_23_MSDReel_End,
Filter_30_PaperReel_wait,
Filter_31_PaperReel_PushOut,
Filter_32_PaperReel_PushOut,
Filter_33_PaperReel_End,
Filter_40_Reel_through_wait,
Filter_41_Reel_through_wait,
Filter_41_Reel_through,
Filter_42_Reel_through_Wait,
Filter_END,
T1_01_WaitReel,
T1_02_WaitReelInpos,
T1_03_LocationUp,
T1_04_DownToReel,
T1_05_ClampReel,
T1_06_UpToTop,
T1_07_PanToOut,
T1_08_DownToShelf,
T1_09_ReleaseReel,
T1_10_PutReelFinish,
LblSendOut_01,
LblSendOut_02,
LblSendOut_03,
LblVacuum_01,
LblVacuum_02,
LblVacuum_03,
LblVacuum_04,
LblVacuum_end,
LblVacuum_failure,
LblVacuum_printfail,
T1_08_UpReelOk,
T1_08_UpReelFail,
T1_09_ReleaseReel_Fail,
T1_09_ReleaseReel_Test,
Shelf_19_LocationString,
Shelf_19_LocationString_wait,
SideMove_01,
SideMove_02,
SideMove_03,
SideMove_04,
SideMove_05,
SideMove_06,
SideMove_07,
SideMove_08,
SideMove_09,
SideMove_10,
SideMove_11,
SideMove_12,
SideMove_13,
SideMove_14,
}
......
......@@ -18,10 +18,7 @@ namespace DeviceLibrary
public static class RobotManage
{
public static XRayMachine xrayMachine;
public static LabelMachine labelMachine;
public static FilterMachine filterMachine;
public static T1Machine t1Machine;
public static XRay XRay=new XRay("XRay");
public static XRay XRay=new XRay("XRay", XRayType.Spellman_RS232);
public static XrayImage xrayImage = new Asa.XrayImage("XrayImage", XrayImage.DeviceType.HAOBO_V2);
public static Config_XRay Config;
public static bool IsLoadOk = true;
......@@ -34,30 +31,19 @@ namespace DeviceLibrary
public delegate void LoadFinish(bool state,string msg);
public static event LoadFinish LoadFinishEvent;
public static bool isRunning = false;
public static Asa.PrintLabel PrintBean;
public static ElectricGripper electricGripper;
public static List<IRobot> robots = new List<IRobot>();
public static WistonAgvClient wistonAgvClient;
public static bool offlinemode = false;
public static ReelLocation offlinereelLocation = new ReelLocation();
public static LineRunMonitor Line1;
public static LineRunMonitor Line2;
public static int ProductivityCount = 0;
public static int DefectiveCount = 0;
//static string baseDir = Application.StartupPath;
public static void Init() {
try
{
string msgs = "";
xrayMachine = new XRayMachine();
labelMachine = new LabelMachine();
filterMachine = new FilterMachine();
t1Machine = new T1Machine();
wistonAgvClient = new WistonAgvClient();
robots.AddRange(new IRobot[] { xrayMachine, labelMachine, filterMachine, t1Machine });
robots.AddRange(new IRobot[] { xrayMachine });
//robots.AddRange(new IRobot[] { xrayMachine });
robots.ForEach((device)=> {
LogUtil.info(device.DeviceName + " init");
......@@ -70,9 +56,7 @@ namespace DeviceLibrary
});
CodeManager.LoadConfig();
PrintBean = new Asa.PrintLabel(Application.StartupPath + "\\Label",100);
labelMachine.InitPrint();
if (!XRay.Open(ConfigHelper.Config.Get("XRay_Port"), string.Format("{0:yyyy-MM-dd}", DateTime.Now)))
if (!XRay.Open(Setting_Init.XRay_Port, string.Format("{0:yyyy-MM-dd}", DateTime.Now)))
{
msgs += crc.GetString("device_xray_open_failed","X光管通讯失败:{0}\n", ConfigHelper.Config.Get("XRay_Port"));
IsLoadOk = false;
......@@ -82,35 +66,24 @@ namespace DeviceLibrary
Thread.Sleep(500);
if (!XRay.SetVC(ConfigHelper.Config.Get("XRay_Voltage"), ConfigHelper.Config.Get("XRay_Current")))
if (!XRay.SetVC(Setting_Init.XRay_Voltage.ToString(), Setting_Init.XRay_Current.ToString()))
{
msgs += crc.GetString("device_xray_setvc_failed", "X光电压电流设置失败:{0},{1}\n", ConfigHelper.Config.Get("XRay_Voltage"), ConfigHelper.Config.Get("XRay_Current"));
msgs += crc.GetString("device_xray_setvc_failed", "X光电压电流设置失败:{0},{1}\n", Setting_Init.XRay_Voltage.ToString(), Setting_Init.XRay_Current.ToString());
IsLoadOk = false;
}
else
LogUtil.info($"xray V:{ConfigHelper.Config.Get("XRay_Voltage")} ,C:{ConfigHelper.Config.Get("XRay_Current")} set ok");
LogUtil.info($"xray V:{Setting_Init.XRay_Voltage} ,C:{Setting_Init.XRay_Current} set ok");
if (!xrayImage.Open()) {
msgs += crc.GetString("device_xrayimage_open_failed", $"图像平板打开失败\n");
IsLoadOk = false;
}
//xrayImage.Close();
var ElectricGripperPort = ConfigHelper.Config.Get("ElectricGripperPort");
electricGripper = new ElectricGripper(ElectricGripperPort);
if (!electricGripper.OpenPort()) {
msgs += crc.GetString("device_electricGripper_open_failed", "电夹爪通讯失败:{0}\n", ElectricGripperPort);
IsLoadOk = false;
}
electricGripper.HomeReset();
//mainMachine = new MainMachine(RobotManage.Config);
if (!IOManager.ConnectionIO())
{
IsLoadOk = false;
msgs += crc.GetString("device_io_open_failed", "IO板卡初始化失败\n");
}
Line1 = new LineRunMonitor("line1", labelMachine.Config.DOList[IO_Label_Type.Line1_Run].GetIOAddr());
Line2 = new LineRunMonitor("line2", labelMachine.Config.DOList[IO_Label_Type.Line2_Run].GetIOAddr());
LogUtil.info($"XRay StartDate:{UseData.GetStartDateTime},TotalSecond:{UseData.GetTotalUseSeconds},TotalTimes:{UseData.GetTimes}");
var wiston_spnlist = ConfigHelper.Config.Get<string[]>("wiston_spnlist");
......@@ -167,7 +140,6 @@ namespace DeviceLibrary
public static void ShutDown() {
LogUtil.info("开始关闭系统.");
IOManager.CloseAllConnection();
electricGripper.ClosePort();
}
public static void UserPause(bool userpause) {
//xrayMachine.UserPause = userpause;
......@@ -177,14 +149,5 @@ namespace DeviceLibrary
else
LogUtil.info("用户取消暂停");
}
public static void LoadPrintSetting()
{
string PrintName = ConfigHelper.Config.Get(Setting_Init.PrinterName);
string labelName = ConfigHelper.Config.Get(Setting_Init.LabelName);
PrintBean.LoadLabel(labelName);
PrintBean.Printer(PrintName, false);
LogUtil.info("PrintLabel 打印机初始化完成【" + labelName + "】【" + PrintName + "】");
}
}
}
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace DeviceLibrary
{
partial class T1Machine
{
Led AlarmLed;
Led RunningLed;
System.Threading.Timer ledtimer;
void LedProcessInit()
{
AlarmLed = new Led(Config.DOList[IO_T1_Type.Alarm_Led].GetIOAddr(), DeviceName);
RunningLed = new Led(Config.DOList[IO_T1_Type.Run_Led].GetIOAddr(), DeviceName);
ledtimer = new System.Threading.Timer(new TimerCallback(LedProcess), null, 0, 1000);
GC.KeepAlive(ledtimer);
}
void LedProcess(object o)
{
AlarmLed.LedState = LedState.off;
RunningLed.LedState = LedState.off;
if (runStatus == RunStatus.Running)
{
RunningLed.LedState = LedState.on;
//无法运行,量报警灯
if (!canRunning)
{
AlarmLed.LedState = LedState.on;
RunningLed.LedState = LedState.off;
}
if (ShelfInMoveInfo.MoveStep == MoveStep.T1_08_UpReelFail
|| ShelfInMoveInfo.MoveStep == MoveStep.T1_09_ReleaseReel_Fail) {
//AlarmLed.LedState = LedState.on;
Alarm(AlarmType.IoSingleTimeOut);
}
}
else if (runStatus == RunStatus.HomeReset)
{
RunningLed.LedState = LedState.blink;
}
if (alarmType != AlarmType.None || RobotManage.filterMachine.alarmType != AlarmType.None)
{
AlarmLed.LedState = LedState.on;
}
if (UserPause)
{
AlarmLed.LedState = LedState.off;
RunningLed.LedState = LedState.off;
//StandbyLed.LedState = LedState.blink;
}
Led.LedGroup[DeviceName].ForEach((x) => { x.run(); });
}
}
}
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace DeviceLibrary
{
using crc = OnlineStore.CodeResourceControl;
public partial class T1Machine : MachineBase, IRobot
{
private Config_T1 _config;
public new Config_T1 Config
{
get => _config; set
{
base.Config = value;
_config = value;
}
}
public override string DeviceName { get; } = "出料机构";
public bool canRunning { get; set; }
public bool isBusy { get; set; }
public bool isAlarm { get; set; }
//public RunStatus runStatus { get; set; }
//public bool UserPause { get; set; }
public bool IgnoreSafecheck { get; set; }
public bool IgnoreGratingSignal { get; set; }
public AxisBean T_Batch_Axis;
public AxisBean T_Pan_Axis;
public AxisBean T_Updown_Axis;
AxisBean T_TrayPos_Axis;
public AxisBean T_Y_Axis;
MoveInfo ShelfOutMoveInfo;
MoveInfo ShelfInMoveInfo;
public LineRunMonitor ShelfOutLine;
public LineRunMonitor ShelfInLine;
public event EventHandler<Bitmap> TrayStringLocation;
public Point CenterPos = Point.Empty;
public bool Init(out string msg)
{
msg = "";
try
{
string configFile = "config\\T1Config.csv";
Config = new Config_T1(0, "", configFile);
Config = (Config_T1)CSVConfigReader.LoadConfig<IO_T1_Type>(Config);
#region 初始化伺服轴
T_Batch_Axis = new AxisBean(Config.T_Batch_Axis, DeviceName);
T_Pan_Axis = new AxisBean(Config.T_Pan_Axis, DeviceName);
T_Updown_Axis = new AxisBean(Config.T_Updown_Axis, DeviceName);
T_TrayPos_Axis = new AxisBean(Config.T_TrayPos_Axis, DeviceName);
T_Y_Axis = new AxisBean(Config.T_Y_Axis, DeviceName);
#endregion
MoveInfo = new MoveInfo(DeviceName);
ResetMoveInfo = MoveInfo;
ShelfOutMoveInfo = new MoveInfo("出料串线体");
ShelfInMoveInfo = new MoveInfo("入料串线体");
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());
RobotManage.wistonAgvClient.EmptyShelfInReady += WistonAgvClient_EmptyShelfInReady;
RobotManage.wistonAgvClient.FullShelfOutReady += WistonAgvClient_FullShelfOutReady;
CenterPos = new Point(Config.String_Center_X, Config.String_Center_Y);
LastStringCenter = CenterPos;
LedProcessInit();
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)
{
msg = e.Message;
return false;
}
return true;
}
private void WistonAgvClient_FullShelfOutReady(object sender, EventArgs e)
{
this.loginfo("收到满料串Agv抵达信号");
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)
{
this.loginfo("收到空料串Agv抵达信号");
ShelfInLine.LineRun("EmptyStringIN_agv", 40);
WaitIo(IO_T1_Type.Empty_LineIn_Check, IO_VALUE.HIGH, 30 * 1000);
ShelfInLine.LineRun("EmptyStringIN_agv", 15);
RobotManage.wistonAgvClient.FinishEnter();
}
protected override void LoopProcess()
{
mstart = true;
while (mstart)
{
try
{
canRunning = DeviceCheck();
if (canRunning)
{
//BtnProcess();
canRunning = SafeCheck();
}
Thread.Sleep(stepDelaytime);
if (!canRunning || !mstart)
continue;
if (runStatus == RunStatus.Running)
{
IOMonitorFUNC();
WorkProcess();
ShelfOutProcess();
ShelfInProcess();
}
else if (runStatus == RunStatus.HomeReset)
{
HomeReset();
}
}
catch (Exception ex)
{
Msg.add(ex.Message, MsgLevel.warning);
LogUtil.error(DeviceName + " " + ex.ToString());
}
finally
{
ProcessMsgEventFire(Msg);
//ProcessMoveinfoEventFire(MoveInfo.List);
Msg.Clear();
}
}
LogUtil.info($"{DeviceName} 主线程已退出.");
}
public bool DeviceCheck()
{
bool ok = true;
if (IOValue(IO_T1_Type.SuddenStop_BTN).Equals(IO_VALUE.LOW))
{
Alarm(AlarmType.SuddenStop);
Msg.add(crc.GetString("emergency_stop", "急停中"), MsgLevel.warning);
Thread.Sleep(1000);
ok = false;
}
else if (alarmType == AlarmType.SuddenStop)
{
Msg.add(crc.GetString("system_need_reset", "系统需要重置"), MsgLevel.info);
Thread.Sleep(1000);
ok = false;
}
if (alarmType != AlarmType.SuddenStop)
{
TimeSpan span = DateTime.Now - checkAlarmTime;
//在回原点,复位,出入库时,检测报警间隔减小
if ((!runStatus.Equals(RunStatus.Stop) && span.TotalSeconds > 3) || span.TotalSeconds > 1)
{
foreach (ConfigMoveAxis configMoveAxis in Config.moveAxisList)
{
if (AxisManager.GetAlarmStatus(configMoveAxis.DeviceName, configMoveAxis.GetAxisValue()) == 1)
{
Msg.add(crc.GetString("axis_run_alert", "{0}:运动报警", configMoveAxis.Explain), MsgLevel.warning);
ok = false;
LogUtil.error(string.Join(",", HuichuanLibrary.HCBoardManager.GetAxisErrorDetail(configMoveAxis.GetAxisValue())));
}
}
//if (RobotManage.electricGripper.ErrorCode > 0)
//{
// Msg.add($"电夹爪出错 ErrorCode:{RobotManage.electricGripper.ErrorCode}", MsgLevel.warning);
// ok = false;
//}
}
}
return ok;
}
public void BeginHomeReset(bool firstRun = false)
{
if (!firstRun)
{
StopMove();
Thread.Sleep(500);
}
OpenAllServo();
alarmType = AlarmType.None;
runStatus = RunStatus.HomeReset;
ResetMoveInfo.NewMove(MoveStep.H01_HomeReset);
ResetMoveInfo.log("开始回原");
ResetMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
}
private void HomeReset()
{
if (CheckWait(ResetMoveInfo))
return;
switch (ResetMoveInfo.MoveStep)
{
case MoveStep.H01_HomeReset:
ResetMoveInfo.NextMoveStep(MoveStep.H02_HomeReset);
ResetMoveInfo.log("正在回原, 皮带线阻挡上升,贴标机构阻挡上升");
CylinderMove(MoveInfo, IO_T1_Type.End_Lift_Cylinder_Down, IO_T1_Type.End_Lift_Cylinder_Up, IO_VALUE.LOW);
CylinderMove(MoveInfo, IO_T1_Type.EmptyString_Lift_Down, IO_T1_Type.EmptyString_Lift_Up, IO_VALUE.LOW);
CylinderMove(MoveInfo, IO_T1_Type.T1_Lift_Down, IO_T1_Type.T1_Lift_Up, IO_VALUE.HIGH);
RobotManage.electricGripper.HomeReset();
//CylinderMove(ResetMoveInfo, IO_Label_Type.TrayStop_Down, IO_Label_Type.TrayStop_Up);
//CylinderMove(ResetMoveInfo, IO_Label_Type.Label_Stop_Down, IO_Label_Type.Label_Stop_Up);
break;
case MoveStep.H02_HomeReset:
ResetMoveInfo.NextMoveStep(MoveStep.H03_HomeReset);
ResetMoveInfo.log("正在回原 所有线体运转");
IOMove(IO_T1_Type.Line4_Run, IO_VALUE.HIGH);
IOMove(IO_T1_Type.Empty_Line_Run, IO_VALUE.HIGH);
IOMove(IO_T1_Type.Line_Out_Run, IO_VALUE.HIGH);
break;
case MoveStep.H03_HomeReset:
ResetMoveInfo.NextMoveStep(MoveStep.H04_HomeReset);
ResetMoveInfo.log("正在回原 所有轴回原点");
T_Batch_Axis.HomeMove(ResetMoveInfo);
T_Pan_Axis.HomeMove(ResetMoveInfo);
T_Updown_Axis.HomeMove(ResetMoveInfo);
T_TrayPos_Axis.HomeMove(ResetMoveInfo);
T_Y_Axis.HomeMove(ResetMoveInfo);
break;
case MoveStep.H04_HomeReset:
ResetMoveInfo.NextMoveStep(MoveStep.H05_HomeReset);
ResetMoveInfo.log("正在回原 所有线体停止");
IOMove(IO_T1_Type.Line4_Run, IO_VALUE.LOW);
IOMove(IO_T1_Type.Empty_Line_Run, IO_VALUE.LOW);
IOMove(IO_T1_Type.Line_Out_Run, IO_VALUE.LOW);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
break;
case MoveStep.H05_HomeReset:
ResetMoveInfo.NextMoveStep(MoveStep.H06_HomeReset);
ResetMoveInfo.log("正在回原 所有轴到待机点");
T_Batch_Axis.AbsMove(ResetMoveInfo, Config.BatchAxis_P1, Config.BatchAxis_P1_speed);
T_Pan_Axis.AbsMove(ResetMoveInfo, Config.Pan_P1, Config.Pan_P1_speed);
T_Updown_Axis.AbsMove(ResetMoveInfo, Config.UpdownAxis_P1, Config.UpdownAxis_P1_speed);
T_TrayPos_Axis.AbsMove(ResetMoveInfo, Config.TrayPos_P1, Config.TrayPos_P1_speed);
T_Y_Axis.AbsMove(ResetMoveInfo, Config.Y_P1, Config.Y_P1_speed);
break;
case MoveStep.H06_HomeReset:
ResetMoveInfo.NextMoveStep(MoveStep.HEND_HomeReset);
ResetMoveInfo.log("正在回原 顶升下降, 料串叉后退");
LocationDown(ResetMoveInfo);
CylinderMove(ResetMoveInfo, IO_T1_Type.Fork_Cylinder_Bck, IO_T1_Type.Fork_Cylinder_Fwd, IO_VALUE.LOW);
break;
case MoveStep.HEND_HomeReset:
ResetMoveInfo.log("回源完成");
ResetMoveInfo.EndMove();
MoveInfo.NewMove(MoveStep.T1_01_WaitReel);
ShelfInMoveInfo.NewMove(MoveStep.Shelf_EmptyIn_WaitWorkLeave);
//ShelfOutMoveInfo.NewMove(MoveStep.Shelf_Out_Wait);
runStatus = RunStatus.Running;
break;
}
}
/// <summary>
/// 提升工位定位销上升
/// </summary>
public void LocationUp(MoveInfo MoveInfo)
{
IOMove(IO_T1_Type.T1_Location_Cylinder_Down, IO_VALUE.LOW);
IOMove(IO_T1_Type.T1_Location_Cylinder_Up, IO_VALUE.HIGH);
if (MoveInfo != null)
{
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_T1_Type.T1_Location1_Cylinder_Up, IO_VALUE.HIGH));
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_T1_Type.T1_Location2_Cylinder_Up, IO_VALUE.HIGH));
}
}
/// <summary>
/// 提升工位定位销下降
/// </summary>
public void LocationDown(MoveInfo MoveInfo)
{
IOMove(IO_T1_Type.T1_Location_Cylinder_Down, IO_VALUE.HIGH);
IOMove(IO_T1_Type.T1_Location_Cylinder_Up, IO_VALUE.LOW);
if (MoveInfo != null)
{
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_T1_Type.T1_Location1_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;
if (!ConfigHelper.Config.Get("wiston_disable_agv_NeedEnter", false))
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;
}
}
}
}
using CodeLibrary;
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Runtime.ExceptionServices;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using static Asa.eyemLib;
using static DeviceLibrary.eyemlib;
namespace DeviceLibrary
{
using crc = OnlineStore.CodeResourceControl;
partial class T1Machine
{
public IO_VALUE End_Line_Tray_Check { get => IOValue(IO_T1_Type.End_Line_Tray_Check); }
public bool TrayCanIN()
{
return IOValue(IO_T1_Type.End_Line_Tray_Check).Equals(IO_VALUE.LOW) && IOValue(IO_T1_Type.End_Lift_Cylinder_Down).Equals(IO_VALUE.HIGH)
&& (MoveInfo.MoveStep== MoveStep.T1_01_WaitReel || MoveInfo.MoveStep >= MoveStep.T1_07_PanToOut);
}
public void LineRun(int sec = 0)
{
IOMove(IO_T1_Type.Line4_Run, IO_VALUE.HIGH, false, sec);
}
void WorkProcess()
{
if (CheckWait(MoveInfo))
return;
switch (MoveInfo.MoveStep)
{
case MoveStep.T1_01_WaitReel:
if (IOValue(IO_T1_Type.End_Line_Tray_Check,IO_VALUE.HIGH) && preReelParam != null)
{
MoveInfo.ReelParam = preReelParam;
preReelParam = null;
MoveInfo.log("检测到料盘 ReelParam:" + MoveInfo.ReelParam.ToStr());
MoveInfo.NextMoveStep(MoveStep.T1_02_WaitReelInpos);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(2000));
MoveInfo.StopwatchReset();
}
else
{
Msg.add(crc.GetString("wait_reel_entry", "{0}等待料盘进入", DeviceName), MsgLevel.info);
}
break;
case MoveStep.T1_02_WaitReelInpos:
MoveInfo.NextMoveStep(MoveStep.T1_03_LocationUp);
LocationString();
//IOMove(IO_T1_Type.Line4_Run, IO_VALUE.LOW);
MoveInfo.log($"将料盘推到位 width:{MoveInfo.ReelParam.PlateW},POS:{Config.GetTrayPos(MoveInfo.ReelParam.PlateW)}位置");
T_TrayPos_Axis.AbsMove(MoveInfo, Config.GetTrayPos(MoveInfo.ReelParam.PlateW), Config.TrayPos_P1_speed);
T_Pan_Axis.AbsMove(MoveInfo, Config.Pan_P1, Config.Pan_P1_speed);
T_Y_Axis.AbsMove(MoveInfo, Config.Y_P1, Config.Y_P1_speed);
RobotManage.electricGripper.Release();
//MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
break;
case MoveStep.T1_03_LocationUp:
MoveInfo.NextMoveStep(MoveStep.T1_04_DownToReel);
MoveInfo.log($"料盘顶升");
IOMove(IO_T1_Type.Line4_Run, IO_VALUE.LOW);
CylinderMove(MoveInfo, IO_T1_Type.End_Lift_Cylinder_Down, IO_T1_Type.End_Lift_Cylinder_Up, IO_VALUE.HIGH);
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_T1_Type.End_Lift_Tray_Check, IO_VALUE.HIGH));
break;
case MoveStep.T1_04_DownToReel:
MoveInfo.NextMoveStep(MoveStep.T1_05_ClampReel);
int pos = Config.UpdownAxis_P2 - (MoveInfo.ReelParam.PlateRawH - 8) * Config.UpdownAxis_ChangeValue;
MoveInfo.log($"升降轴下降到取料位置,配置位置:{Config.UpdownAxis_P2},计算位置:{pos}");
T_Updown_Axis.AbsMove(MoveInfo, pos, Config.UpdownAxis_P2_speed);
T_TrayPos_Axis.AbsMove(null, Config.TrayPos_P1, Config.TrayPos_P1_speed);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
break;
case MoveStep.T1_05_ClampReel:
//if (RobotManage.electricGripper.Clamp(null))
//{
MoveInfo.NextMoveStep(MoveStep.T1_06_UpToTop);
RobotManage.electricGripper.Clamp(null);
MoveInfo.log($"夹爪张开");
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1500));
//}
//else
//{
// Msg.add("夹爪忙碌中...", MsgLevel.warning);
// MoveInfo.log($"夹爪忙碌中...");
//}
break;
case MoveStep.T1_06_UpToTop:
MoveInfo.NextMoveStep(MoveStep.T1_07_PanToOut);
MoveInfo.log($"升降轴上升, 料盘提升下降");
T_Updown_Axis.AbsMove(MoveInfo, Config.UpdownAxis_P1, Config.UpdownAxis_P1_speed);
//MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_T1_Type.End_Lift_Tray_Check, IO_VALUE.LOW));
//MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
break;
case MoveStep.T1_07_PanToOut:
if (IOValue(IO_T1_Type.End_Lift_Tray_Check).Equals(IO_VALUE.LOW))
{
MoveInfo.NextMoveStep(MoveStep.T1_08_UpReelOk);
MoveInfo.log($"横移到料串");
CylinderMove(MoveInfo, IO_T1_Type.End_Lift_Cylinder_Down, IO_T1_Type.End_Lift_Cylinder_Up, IO_VALUE.LOW);
}
else if (MoveInfo.IsTimeOut(2))
{
MoveInfo.NextMoveStep(MoveStep.T1_08_UpReelFail);
}
//MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
break;
case MoveStep.T1_08_UpReelOk:
if (ShelfInMoveInfo.MoveStep == MoveStep.Shelf_20_EmptyIn_ShelfReady)
{
MoveInfo.NextMoveStep(MoveStep.T1_08_DownToShelf);
T_Pan_Axis.AbsMove(MoveInfo, Config.Pan_P2, Config.Pan_P2_speed);
}
else if (MoveInfo.IsTimeOut(30))
{
Msg.add(crc.GetString("wait_shelf_ready", "等待料串准备完成"), MsgLevel.warning);
}
break;
case MoveStep.T1_08_UpReelFail:
Msg.add(crc.GetString("T1_grip_fail","出料机构抓料失败,请人工处理"), MsgLevel.warning);
if (IOValue(IO_T1_Type.Reset_BTN).Equals(IO_VALUE.HIGH))
{
MoveInfo.NextMoveStep(MoveStep.T1_10_PutReelFinish);
CylinderMove(MoveInfo, IO_T1_Type.End_Lift_Cylinder_Down, IO_T1_Type.End_Lift_Cylinder_Up, IO_VALUE.LOW);
}
break;
case MoveStep.T1_08_DownToShelf:
if (ShelfInMoveInfo.MoveStep == MoveStep.Shelf_20_EmptyIn_ShelfReady)
{
MoveInfo.NextMoveStep(MoveStep.T1_09_ReleaseReel);
var offset_x = LastStringCenter.X - CenterPos.X;
var offset_y = LastStringCenter.Y - CenterPos.Y;
offset_x = offset_x * -1;
offset_y = offset_y * -1;
var Y = Config.Y_P2 + offset_y * Config.Cam_Pixel_Y_Ratio;
var Pan_X = Config.Pan_P2 + offset_x * Config.Cam_Pixel_X_Ratio;
T_Pan_Axis.AbsMove(MoveInfo, Pan_X, Config.Pan_P2_speed);
T_Y_Axis.AbsMove(MoveInfo, Y, Config.Y_P2_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},AxisBase:{Config.Pan_P2},{Config.Y_P2},, StringCenter:{LastStringCenter}, Offset:{new Point(offset_x, offset_y)}, AXIS:{new Point(Pan_X, Y)},p3pos:{p3pos}");
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
}
else if (MoveInfo.IsTimeOut(30))
{
Msg.add(crc.GetString("wait_shelf_ready", "等待料串准备完成"), MsgLevel.warning);
}
break;
case MoveStep.T1_09_ReleaseReel:
MoveInfo.NextMoveStep(MoveStep.T1_09_ReleaseReel_Test);
RobotManage.electricGripper.Release();
MoveInfo.log($"夹爪放松");
//MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_T1_Type.T1_Tray_Check, IO_VALUE.HIGH));
//MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
break;
case MoveStep.T1_09_ReleaseReel_Test:
if (IOValue(IO_T1_Type.T1_Tray_Check).Equals(IO_VALUE.HIGH))
{
MoveInfo.NextMoveStep(MoveStep.T1_10_PutReelFinish);
}
else if (MoveInfo.IsTimeOut(2))
{
MoveInfo.NextMoveStep(MoveStep.T1_09_ReleaseReel_Fail);
}
//MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
break;
case MoveStep.T1_09_ReleaseReel_Fail:
Msg.add(crc.GetString("T1_put_fail", "出料机构放失败,请人工处理"), MsgLevel.warning);
if (IOValue(IO_T1_Type.Reset_BTN).Equals(IO_VALUE.HIGH))
{
MoveInfo.NextMoveStep(MoveStep.T1_10_PutReelFinish);
}
break;
case MoveStep.T1_10_PutReelFinish:
ShelfInMoveInfo.ReelParam = MoveInfo.ReelParam;
MoveInfo.NewMove(MoveStep.T1_01_WaitReel);
MoveInfo.log($"放料完成");
T_Updown_Axis.AbsMove(MoveInfo, Config.UpdownAxis_P1, Config.UpdownAxis_P1_speed);
T_Pan_Axis.AbsMove(MoveInfo, Config.Pan_P1, Config.Pan_P1_speed);
T_TrayPos_Axis.AbsMove(MoveInfo, Config.TrayPos_P1, Config.TrayPos_P1_speed);
ShelfInMoveInfo.NextMoveStep(MoveStep.Shelf_21_EmptyIn_TrayDown);
MoveInfo.StopwatchLog();
break;
}
}
/// <summary>
/// 最后的料串中心点距离
/// </summary>
int Lastdistance = 0;
/// <summary>
/// 最后的有效料串中心点位置
/// </summary>
Point LastStringCenter = Point.Empty;
/// <summary>
/// 料串高度修正次数
/// </summary>
int TrayStringFixTimes = 0;
Task CheckLocationTask = null;
void ShelfInProcess()
{
if (CheckWait(ShelfInMoveInfo))
return;
switch (ShelfInMoveInfo.MoveStep)
{
case MoveStep.Shelf_EmptyIn_WaitWorkLeave:
if (ShelfOutMoveInfo.MoveStep == MoveStep.Wait)
{
Msg.add(crc.GetString("T1_wait_empty", "等待空料串进入线体"), MsgLevel.info);
}
else {
Msg.add(crc.GetString("T1_wait_release", "等待料串释放中"), MsgLevel.info);
return;
}
if (IOValue(IO_T1_Type.T1_Lift_Tray_Check).Equals(IO_VALUE.HIGH))
{
ShelfInMoveInfo.NextMoveStep(MoveStep.Shelf_15_EmptyIn_LocationUp);
ShelfInMoveInfo.log("工位有料,提升准备");
}
else if (IOValue(IO_T1_Type.EmptyString_In_Check).Equals(IO_VALUE.HIGH))
{
ShelfInMoveInfo.NextMoveStep(MoveStep.Shelf_10_EmptyIn_Wait_StopDown);
ShelfInMoveInfo.log("工位无料,入口等待位有料,开始进入");
}
else if (IOValue(IO_T1_Type.Empty_LineIn_Check).Equals(IO_VALUE.HIGH))
{
ShelfInMoveInfo.NextMoveStep(MoveStep.Shelf_10_EmptyIn_StopDown);
ShelfInMoveInfo.log("工位无料,入口位有料,开始进入");
}
break;
case MoveStep.Shelf_10_EmptyIn_StopDown:
ShelfInMoveInfo.NextMoveStep(MoveStep.Shelf_10_EmptyIn_Wait_StopDown);
ShelfInMoveInfo.log("入料线体启动, 等待料串到等待位置");
IOMove(IO_T1_Type.EmptyString_In_Stop, IO_VALUE.HIGH, false, 2000);
ShelfInLine.LineRun("n", 999, "Shelf_10_EmptyIn_Wait_StopDown");
ShelfInMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_T1_Type.EmptyString_In_Check, IO_VALUE.HIGH));
break;
case MoveStep.Shelf_10_EmptyIn_Wait_StopDown:
if (IOValue(IO_T1_Type.T1_Lift_Tray_Check).Equals(IO_VALUE.LOW))
{
ShelfInMoveInfo.NextMoveStep(MoveStep.Shelf_11_EmptyIn_WaitTime);
ShelfInMoveInfo.log("入料线体启动, 等待料串到横移等待位置");
IOMove(IO_T1_Type.EmptyString_Wait_Stop, IO_VALUE.HIGH, false, 2000);
ShelfInLine.LineRun("n", 999, "Shelf_11_EmptyIn_WaitTime");
ShelfInMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_T1_Type.EmptyString_End_Check, IO_VALUE.HIGH));
}
break;
case MoveStep.Shelf_11_EmptyIn_WaitTime:
ShelfInMoveInfo.NextMoveStep(MoveStep.Shelf_11_EmptyIn_LiftUp);
ShelfInMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
break;
case MoveStep.Shelf_11_EmptyIn_LiftUp:
ShelfInMoveInfo.NextMoveStep(MoveStep.Shelf_13_EmptyIn_SidingRun);
ShelfInMoveInfo.log("入料线体停止, 横移顶升上升");
ShelfInLine.LineStop("n", "Shelf_13_EmptyIn_SidingRun");
CylinderMove(ShelfInMoveInfo, IO_T1_Type.EmptyString_Lift_Down, IO_T1_Type.EmptyString_Lift_Up, IO_VALUE.HIGH);
CylinderMove(ShelfInMoveInfo, IO_T1_Type.T1_Lift_Down, IO_T1_Type.T1_Lift_Up, IO_VALUE.HIGH);
break;
case MoveStep.Shelf_13_EmptyIn_SidingRun:
ShelfInMoveInfo.NextMoveStep(MoveStep.Shelf_14_EmptyIn_LiftDown);
ShelfInMoveInfo.log("横移到位, 停止横移");
IOMove(IO_T1_Type.T1_Sliding_Run, IO_VALUE.HIGH);
IOMove(IO_T1_Type.EmptyString_Sliding_Run, IO_VALUE.HIGH);
IOMove(IO_T1_Type.T1String_Sliding_Run, IO_VALUE.HIGH);
ShelfInMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_T1_Type.T1_Lift_Tray_Check, IO_VALUE.HIGH));
break;
case MoveStep.Shelf_14_EmptyIn_LiftDown:
ShelfInMoveInfo.NextMoveStep(MoveStep.Shelf_15_EmptyIn_LocationUp);
ShelfInMoveInfo.log("入横移顶升下降");
CylinderMove(ShelfInMoveInfo, IO_T1_Type.EmptyString_Lift_Down, IO_T1_Type.EmptyString_Lift_Up, IO_VALUE.LOW);
//CylinderMove(ShelfInMoveInfo, IO_T1_Type.T1_Lift_Down, IO_T1_Type.T1_Lift_Up, IO_VALUE.LOW);
break;
case MoveStep.Shelf_15_EmptyIn_LocationUp:
ShelfInMoveInfo.NextMoveStep(MoveStep.Shelf_16_EmptyIn_ForkFwd);
ShelfInMoveInfo.log("定位气缸上升");
LocationUp(ShelfInMoveInfo);
ShelfInMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(2000));
break;
case MoveStep.Shelf_16_EmptyIn_ForkFwd:
ShelfInMoveInfo.NextMoveStep(MoveStep.Shelf_19_EmptyIn_BatchUp);
ShelfInMoveInfo.log("料架叉前进,横移皮带停止");
CylinderMove(ShelfOutMoveInfo, IO_T1_Type.Fork_Cylinder_Bck, IO_T1_Type.Fork_Cylinder_Fwd, IO_VALUE.HIGH);
IOMove(IO_T1_Type.T1_Sliding_Run, IO_VALUE.LOW);
IOMove(IO_T1_Type.EmptyString_Sliding_Run, IO_VALUE.LOW);
IOMove(IO_T1_Type.T1String_Sliding_Run, IO_VALUE.LOW);
break;
case MoveStep.Shelf_19_EmptyIn_BatchUp:
ShelfInMoveInfo.NextMoveStep(MoveStep.Shelf_19_LocationString);
ShelfInMoveInfo.log("T1 批量轴上升到P2");
TrayStringFixTimes = 0;
BatchAxisToP2(ShelfInMoveInfo, false);
break;
case MoveStep.Shelf_19_LocationString:
ShelfInMoveInfo.NextMoveStep(MoveStep.Shelf_19_LocationString_wait);
LocationString();
break;
case MoveStep.Shelf_19_LocationString_wait:
if (CheckLocationTask.IsCompleted)
{
ShelfInMoveInfo.NextMoveStep(MoveStep.Shelf_20_EmptyIn_ShelfReady);
}
else if (ShelfInMoveInfo.IsTimeOut(5))
{
LastStringCenter = CenterPos;
ShelfInMoveInfo.NextMoveStep(MoveStep.Shelf_20_EmptyIn_ShelfReady);
}
break;
case MoveStep.Shelf_20_EmptyIn_ShelfReady: //等待料盘放入
Msg.add(crc.GetString("T1_ShelfReady", "料串准备完毕,等待放入料盘"), MsgLevel.info);
break;
case MoveStep.Shelf_21_EmptyIn_TrayDown: //料盘放入后调用
var Height = ShelfInMoveInfo.ReelParam.PlateRawH;
var currpos = T_Batch_Axis.GetAclPosition() - Config.BatchAxis_ChangeValue * Height;
if (currpos < Config.BatchAxis_P1 + Config.BatchAxis_ChangeValue * 20)
{
ShelfInMoveInfo.NextMoveStep(MoveStep.Shelf_Work_WaitShelfLeave);
ShelfOutMoveInfo.NewMove(MoveStep.Shelf_Out_Wait);
ShelfInMoveInfo.log($"批量轴已下降到底,料串已满,Left_Batch_P1={Config.BatchAxis_P1},needpos={currpos}");
}
//else if (TrayStringFixTimes < 3 && currpos < Config.BatchAxis_P1 + Config.BatchAxis_ChangeValue * 100)
//{
// ShelfInMoveInfo.NextMoveStep(MoveStep.Shelf_20_EmptyIn_ShelfReady);
// TrayStringFixTimes++;
// ShelfInMoveInfo.log($"批量轴已下降过半,重新提升料串 TrayStringFixTimes:{TrayStringFixTimes}");
// BatchAxisToP2(false);
//}
else
{
ShelfInMoveInfo.NextMoveStep(MoveStep.Shelf_20_EmptyIn_ShelfReady);
//T_Batch_Axis.AbsMove(ShelfInMoveInfo, currpos, Config.BatchAxis_P1_speed);
BatchAxisToP1();
ShelfInMoveInfo.log($"批量轴已下降一张料盘位置,等待料盘放入,needpos={currpos},{ShelfInMoveInfo.ReelParam.ToStr()}");
}
break;
case MoveStep.Shelf_Work_WaitShelfLeave:
if ((IOValue(IO_T1_Type.T1_Lift_Tray_Check).Equals(IO_VALUE.LOW)))
{
ShelfInMoveInfo.NextMoveStep(MoveStep.Shelf_EmptyIn_WaitWorkLeave);
}
Msg.add(crc.GetString("T1_Shelffull_waitempty", "料串已满等待空料串"), MsgLevel.info);
break;
}
}
/// <summary>
/// 定位料串中心位置
/// </summary>
void LocationString() {
if (CheckLocationTask != null && !CheckLocationTask.IsCompleted)
return;
var aclposA = T_Batch_Axis.GetAclPosition();
ShelfInMoveInfo.log($"计算料串中心位置 P2:{Config.BatchAxis_P2}, AclPos:{aclposA}");
bool isFirstA = true;
if (Math.Abs(Config.BatchAxis_P2 - aclposA) > Config.BatchAxis_ChangeValue * 4)
isFirstA = false;
CheckLocationTask = Task.Run(() => {
(Bitmap Bitmap, Point CurrentPoint, string debugstring) = GetStringCenter(isFirstA);
var distance = (int)Common.distance(CenterPos, CurrentPoint);
TrayStringLocation?.Invoke(this, Bitmap);
if (isFirstA && (int)Common.distance(LastStringCenter, CurrentPoint) < Config.String_Offset_Range_Px)
{
LastStringCenter = CurrentPoint;
ShelfInMoveInfo.log($"计算料串中心位置 First LastStringCenter:{LastStringCenter}");
///Lastdistance = distance;
}
else if ((int)Common.distance(LastStringCenter, CurrentPoint) < Config.String_Offset_Range_Px)
{
LastStringCenter = CurrentPoint;
ShelfInMoveInfo.log($"计算料串中心位置 LastStringCenter:{LastStringCenter}");
}
else
{
ShelfInMoveInfo.log($"计算料串中心位置 失败");
//LastStringCenter = CenterPos;
}
Task.Delay(1000).Wait();
});
}
public bool ReleaseShelf()
{
if (ShelfInMoveInfo.MoveStep != MoveStep.Shelf_20_EmptyIn_ShelfReady)
{
return false;
}
ShelfInMoveInfo.NextMoveStep(MoveStep.Shelf_Work_WaitShelfLeave);
ShelfOutMoveInfo.NewMove(MoveStep.Shelf_Out_Wait);
ShelfInMoveInfo.log($"用户强制释放料架");
return true;
}
void ShelfOutProcess()
{
if (CheckWait(ShelfOutMoveInfo))
return;
switch (ShelfOutMoveInfo.MoveStep)
{
case MoveStep.Shelf_Out_Wait:
if (IOValue(IO_T1_Type.T1_Lift_Tray_Check).Equals(IO_VALUE.LOW))
{
ConfigIO io = Config.getWaitIO(IO_T1_Type.T1_Lift_Tray_Check);
WarnMsg = $"{crc.GetString("wait", "等待")}(" + io.DisplayStr + "=LOW" + $")";
Msg.add(WarnMsg, MsgLevel.warning);
return;
}
if (IOValue(IO_T1_Type.T1_Out_Check).Equals(IO_VALUE.HIGH))
{
ConfigIO io = Config.getWaitIO(IO_T1_Type.T1_Out_Check);
WarnMsg = $"{crc.GetString("wait", "等待")}(" + io.DisplayStr + "=HIGH" + $")";
Msg.add(WarnMsg, MsgLevel.warning);
return;
}
ShelfOutMoveInfo.NextMoveStep(MoveStep.Shelf_30_Out_BatchDown);
ShelfOutMoveInfo.log("出口工位有料,出口等待位无料,开始送出");
break;
case MoveStep.Shelf_30_Out_BatchDown:
ShelfOutMoveInfo.NextMoveStep(MoveStep.Shelf_31_Out_ForkBck);
ShelfOutMoveInfo.log("批量轴下降到P1");
T_Batch_Axis.AbsMove(ShelfOutMoveInfo, Config.BatchAxis_P1, Config.BatchAxis_P1_speed);
break;
case MoveStep.Shelf_31_Out_ForkBck:
ShelfOutMoveInfo.NextMoveStep(MoveStep.Shelf_32_Out_LocationDown);
ShelfOutMoveInfo.log("料架叉后退");
CylinderMove(ShelfOutMoveInfo, IO_T1_Type.Fork_Cylinder_Bck, IO_T1_Type.Fork_Cylinder_Fwd, IO_VALUE.LOW);
break;
case MoveStep.Shelf_32_Out_LocationDown:
ShelfOutMoveInfo.NextMoveStep(MoveStep.Shelf_33_Out_OutStopDown);
ShelfOutMoveInfo.log("顶升工位下降");
CylinderMove(ShelfInMoveInfo, IO_T1_Type.T1_Lift_Down, IO_T1_Type.T1_Lift_Up, IO_VALUE.LOW);
break;
case MoveStep.Shelf_33_Out_OutStopDown:
ShelfOutMoveInfo.NextMoveStep(MoveStep.Shelf_34_Out_OutStopDown);
ShelfOutMoveInfo.log("顶升气缸下降");
LocationDown(ShelfOutMoveInfo);
break;
case MoveStep.Shelf_34_Out_OutStopDown:
ShelfOutMoveInfo.NextMoveStep(MoveStep.Shelf_35_Out_OutLineRun);
ShelfOutMoveInfo.log("阻挡气缸下降,链条运转");
//IOMove(IO_T1_Type.Line_Out_Run, IO_VALUE.HIGH);
ShelfOutLine.LineRun("n", 999, "Shelf_34_Out_OutLineRun");
ShelfOutMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_T1_Type.T1_Wait_Check, IO_VALUE.HIGH));
break;
case MoveStep.Shelf_35_Out_OutLineRun:
ShelfOutMoveInfo.NextMoveStep(MoveStep.Shelf_36_Out_OutLineRun);
IOMove(IO_T1_Type.T1_Wait_Stop, IO_VALUE.HIGH, false, 2000);
ShelfOutMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_T1_Type.T1_Out_Check, IO_VALUE.HIGH));
break;
case MoveStep.Shelf_36_Out_OutLineRun:
ShelfOutMoveInfo.log("呼叫AGV取满料串");
RobotManage.wistonAgvClient.NeedLeave();
ShelfOutMoveInfo.EndMove();
ShelfOutLine.LineStop("n", "Shelf_35_Out_OutLineRun");
break;
}
}
void EmptyStringIN()
{
this.loginfo($"T1空料串入口感应到料串,Empty_LineIn_Check:{IOValue(IO_T1_Type.Empty_LineIn_Check)}");
if (IOValue(IO_T1_Type.EmptyString_In_Check).Equals(IO_VALUE.HIGH))
{
this.loginfo($"T1等待位有料不允许进入");
return;
}
//if (IOValue(IO_T1_Type.Empty_LineIn_Check).Equals(IO_VALUE.HIGH))
// return;
ShelfInLine.LineRun("EmptyStringIN", 30);
WaitIo(IO_T1_Type.Empty_LineIn_Check, IO_VALUE.HIGH, 10);
IOMove(IO_T1_Type.EmptyString_In_Stop, IO_VALUE.HIGH, false, 3000);
WaitIo(IO_T1_Type.EmptyString_In_Check, IO_VALUE.HIGH, 10);
Thread.Sleep(3000);
ShelfInLine.LineStop("EmptyStringIN");
this.loginfo($"T1等待位进入完成");
}
int StartMovePosition = 0;
void BatchAxisToP2(MoveInfo moveInfo ,bool isFirstMove = true)
{
int targetP2 = Config.BatchAxis_P2;
int targetSpeed = Config.BatchAxis_P2_speed;
if (!isFirstMove)
{
int currPosition = T_Batch_Axis.GetAclPosition();
if (currPosition != -1)
{
//targetP2 = currPosition + Config.Right_Batch_ChangeValue * 80;
if (targetP2 > Config.BatchAxis_P2)
{
targetP2 = Config.BatchAxis_P2;
}
moveInfo.log("BatchAxisToP2 目标P2: " + targetP2 + "(" + currPosition + ")");
}
//targetSpeed = Config.BatchAxis_P3Speed / 2;
}
moveInfo.TimeOutSeconds = 200;
moveInfo.CanWhileCount = 0;
// 需要增加定时器,获取验证信号并停止伺服
StartMovePosition = T_Batch_Axis.GetAclPosition();
moveInfo.WaitList.Add(WaitResultInfo.WaitBatchAxisMove(Config.T_Batch_Axis, targetP2, targetSpeed));
Config.T_Batch_Axis.TargetPosition = targetP2;
T_Batch_Axis.AbsMove(null, targetP2, targetSpeed);
//开始检测信号
T_Batch_Axis.BatchAxisStartCheck(IO_T1_Type.T1_Tray_Check, Config, IO_VALUE.HIGH);
}
void BatchAxisToP1()
{
int targetP1 = Config.BatchAxis_P1;
int targetSpeed = Config.BatchAxis_P2_speed/2;
ShelfInMoveInfo.TimeOutSeconds = 200;
ShelfInMoveInfo.CanWhileCount = 0;
// 需要增加定时器,获取验证信号并停止伺服
StartMovePosition = T_Batch_Axis.GetAclPosition();
ShelfInMoveInfo.WaitList.Add(WaitResultInfo.WaitBatchAxisMove(Config.T_Batch_Axis, targetP1, targetSpeed));
Config.T_Batch_Axis.TargetPosition = targetP1;
T_Batch_Axis.AbsMove(null, targetP1, targetSpeed);
//开始检测信号
T_Batch_Axis.BatchAxisStartCheck(IO_T1_Type.T1_Tray_Check, Config, IO_VALUE.LOW);
}
public (Bitmap, Point, string) GetStringCenter(bool isFirst = false)
{
//if (isFirst)
// return GetStringCenterA();
//else
return GetStringCenterC();
}
[HandleProcessCorruptedStateExceptions]
public (Bitmap, Point, string) GetStringCenterA()
{
//return (null, 0, "调试屏蔽");
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);
var rectx = Config.String_Center_X - 500;
var recty = Config.String_Center_Y - 500;
string debugtxt = "";
var currpos = Point.Empty;
//Bitmap bmap = new Bitmap("D:\\853string\\Image_20210605142037637.bmp");
//pictureBox1.Image = (Bitmap)bmap.Clone();
try
{
Rectangle rect = new Rectangle(0, 0, bmap.Width, bmap.Height);
var bitmapData = bmap.LockBits(rect, ImageLockMode.ReadOnly, bmap.PixelFormat);
var eyemImage = new EyemImage();
eyemImage.ucpImage = bitmapData.Scan0;
eyemImage.iWidth = rect.Width;
eyemImage.iHeight = rect.Height;
eyemImage.iChannels = 1;
eyemImage.iDepth = 0;
//创建扫描区域
EyemRect eyemRect = new EyemRect();
eyemRect.iXs = Config.String_Center_X - 175;
eyemRect.iYs = Config.String_Center_Y - 175;
eyemRect.iWidth = 175 * 2;
eyemRect.iHeight = 175 * 2;
eyemlib.EyemOcsFXYR eyemOcsFXYR = new eyemlib.EyemOcsFXYR();
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}");
debugtxt = $"eyemMulFuncTool:\nresult:{result}\nfX:{eyemOcsFXYR.fX}\nfY:{eyemOcsFXYR.fY}\nfR:{eyemOcsFXYR.fR}";
bmap.UnlockBits(bitmapData);
currpos = new Point((int)eyemOcsFXYR.fX, (int)eyemOcsFXYR.fY);
var centerpos = new Point(Config.String_Center_X, Config.String_Center_Y);
var distance = (int)Common.distance(centerpos, currpos);
//try
//{
Graphics graphics = Graphics.FromImage(bitmap);
graphics.DrawImage(bmap, new PointF(0, 0));
graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
Pen greenpen = new Pen(Color.Green, 15);
Pen redpen = new Pen(Color.FromArgb(255, Color.Red), 10);
int r = 102;
graphics.DrawEllipse(greenpen, Config.String_Center_X - r, Config.String_Center_Y - r, r * 2, r * 2);
graphics.DrawEllipse(greenpen, Config.String_Center_X - 8, Config.String_Center_Y - 8, 8 * 2, 8 * 2);
graphics.DrawEllipse(redpen, eyemOcsFXYR.fX - eyemOcsFXYR.fR, eyemOcsFXYR.fY - eyemOcsFXYR.fR, eyemOcsFXYR.fR * 2, eyemOcsFXYR.fR * 2);
graphics.DrawEllipse(redpen, eyemOcsFXYR.fX - 5, eyemOcsFXYR.fY - 5, 5 * 2, 5 * 2);
SolidBrush blue = new SolidBrush(Color.BlueViolet);
Font font = new Font(FontFamily.GenericSansSerif, 30);
graphics.DrawString($"center:X:{Config.String_Center_X},Y:{Config.String_Center_Y}", font, blue, rectx, recty);
graphics.DrawString($"result:{result},fX:{eyemOcsFXYR.fX},fY:{eyemOcsFXYR.fY},fR:{eyemOcsFXYR.fR}", font, blue, rectx, font.Height + recty);
graphics.DrawString($"distance:{distance}", font, blue, rectx, font.Height * 2 + recty);
graphics.Save();
bmap.Dispose();
graphics.Dispose();
}
catch(Exception e) {
LogUtil.info("GetStringCenterA" + e.ToString());
debugtxt = "GetStringCenterA" + e.ToString();
}
Bitmap newbitmap = bitmap.Clone(new Rectangle(rectx, recty, 1000, 1000), PixelFormat.Format24bppRgb);
bitmap.Dispose();
Directory.CreateDirectory("\\image\\TrayString\\");
newbitmap.Save("\\image\\TrayString\\" + DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss") + ".jpg", ImageFormat.Jpeg);
return (newbitmap, currpos, debugtxt);
}
[HandleProcessCorruptedStateExceptions]
public (Bitmap, Point, string) GetStringCenterC()
{
Directory.CreateDirectory("\\image\\TrayString\\");
//return (null, 0, "调试屏蔽");
Bitmap bmap = Common.DeepClone(Camera._cam.GrabOneImage(RobotManage.t1Machine.Config.String_Camera));
bmap.RotateFlip(RotateFlipType.Rotate270FlipNone);
Bitmap bitmap = new Bitmap(bmap.Width, bmap.Height);
var rectx = Config.String_Center_X - 500;
var recty = Config.String_Center_Y - 500;
var file = "\\image\\TrayString\\" + DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss") + ".Png";
bmap.Save(file, ImageFormat.Png);
//bmap.Dispose();
string debugtxt = "";
var currpos = Point.Empty;
//bmap = new Bitmap("D:\\料串\\2021-10-28-14-25-01.jpg");
//pictureBox1.Image = (Bitmap)bmap.Clone();
try
{
Rectangle rect = new Rectangle(0, 0, bmap.Width, bmap.Height);
//var bitmapData = bmap.LockBits(rect, ImageLockMode.ReadOnly, bmap.PixelFormat);
var eyemImage = new EyemImage();
//eyemImage.ucpImage = bitmapData.Scan0;
//eyemImage.iWidth = rect.Width;
//eyemImage.iHeight = rect.Height;
//eyemImage.iChannels = 1;
//eyemImage.iDepth = 0;
var a = eyemImageRead(file, -1, out eyemImage);
//创建扫描区域
EyemRect eyemRect = new EyemRect();
eyemRect.iXs = Config.String_Center_X - 175;
eyemRect.iYs = Config.String_Center_Y - 175;
eyemRect.iWidth = 175 * 2;
eyemRect.iHeight = 175 * 2;
//创建中心识别区域
EyemRect limRect = new EyemRect();
limRect.iXs = Config.String_Center_X - 175;
limRect.iYs = Config.String_Center_Y - 175;
limRect.iWidth = 175 * 2;
limRect.iHeight = 175 * 2;
eyemlib.EyemOcsDXYR eyemOcsDXYR = new eyemlib.EyemOcsDXYR();
double dp = ConfigHelper.Config.Get("DetectCircle_dp", 1);
double dMinDist = ConfigHelper.Config.Get("DetectCircle_dMinDist", 80);
double dParam1 = ConfigHelper.Config.Get("DetectCircle_dParam1", 100);
double dParam2 = ConfigHelper.Config.Get("DetectCircle_dParam2", 50);
double dMinRadius = ConfigHelper.Config.Get("DetectCircle_dMinRadius", 30);
double dMaxRadius = ConfigHelper.Config.Get("DetectCircle_dMaxRadius", 42);
int result = eyemlib.eyemDetectCircleUseHough(eyemImage, eyemRect, limRect,out eyemOcsDXYR, out _, dp, dMinDist, dParam1, dParam2, dMinRadius, dMaxRadius, 3,true);
LogUtil.info($"eyemDetectCircleUseHough:result:{result},fX:{eyemOcsDXYR.fX},fY:{eyemOcsDXYR.fY},fR:{eyemOcsDXYR.fR}");
debugtxt = $"eyemDetectCircleUseHough:\nresult:{result}\nfX:{eyemOcsDXYR.fX}\nfY:{eyemOcsDXYR.fY}\nfR:{eyemOcsDXYR.fR}";
//bmap.UnlockBits(bitmapData);
eyemImageFree(ref eyemImage);
currpos = new Point((int)eyemOcsDXYR.fX, (int)eyemOcsDXYR.fY);
var centerpos = new Point(Config.String_Center_X, Config.String_Center_Y);
var distance = (int)Common.distance(centerpos, currpos);
//try
//{
Graphics graphics = Graphics.FromImage(bitmap);
graphics.DrawImage(bmap, new PointF(0, 0));
graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
Pen greenpen = new Pen(Color.Green, 15);
Pen redpen = new Pen(Color.FromArgb(255, Color.Red), 10);
int r = 102;
graphics.DrawEllipse(greenpen, Config.String_Center_X - r, Config.String_Center_Y - r, r * 2, r * 2);
graphics.DrawEllipse(greenpen, Config.String_Center_X - 8, Config.String_Center_Y - 8, 8 * 2, 8 * 2);
graphics.DrawEllipse(redpen, (float)(eyemOcsDXYR.fX - eyemOcsDXYR.fR), (float)(eyemOcsDXYR.fY - eyemOcsDXYR.fR), (float)(eyemOcsDXYR.fR * 2), (float)(eyemOcsDXYR.fR * 2));
graphics.DrawEllipse(redpen, (float)(eyemOcsDXYR.fX - 5), (float)(eyemOcsDXYR.fY - 5), 5 * 2, 5 * 2);
SolidBrush blue = new SolidBrush(Color.BlueViolet);
Font font = new Font(FontFamily.GenericSansSerif, 30);
graphics.DrawString($"center:X:{Config.String_Center_X},Y:{Config.String_Center_Y}", font, blue, rectx, recty);
graphics.DrawString($"result:{result},dX:{eyemOcsDXYR.fX},dY:{eyemOcsDXYR.fY},dR:{eyemOcsDXYR.fR}", font, blue, rectx, font.Height + recty);
graphics.DrawString($"distance:{distance}", font, blue, rectx, font.Height * 2 + recty);
graphics.Save();
bmap.Dispose();
graphics.Dispose();
}
catch (Exception e)
{
LogUtil.info("GetStringCenterC" + e.ToString());
debugtxt = "GetStringCenterC" + e.ToString();
}
Bitmap newbitmap = bitmap.Clone(new Rectangle(rectx, recty, 1000, 1000), PixelFormat.Format24bppRgb);
newbitmap.Save("\\image\\TrayString\\" + DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss") + ".jpg", ImageFormat.Jpeg);
//newbitmap.Dispose();
bitmap.Dispose();
return (newbitmap, currpos, debugtxt);
}
private static Bitmap ConvertTo24(Bitmap bmpIn)
{
Bitmap converted = new Bitmap(bmpIn.Width, bmpIn.Height, PixelFormat.Format24bppRgb);
using (Graphics g = Graphics.FromImage(converted))
{
// Prevent DPI conversion
g.PageUnit = GraphicsUnit.Pixel;
// Draw the image
g.DrawImageUnscaled(bmpIn,0,0);
}
return converted;
}
[HandleProcessCorruptedStateExceptions]
public (Bitmap, Point, string) GetStringCenterB()
{
//return (null, 0, "调试屏蔽");
var centerpos = new Point(Config.String_Center_X, Config.String_Center_Y);
Bitmap bmap = Common.DeepClone(Camera._cam.GrabOneImage(RobotManage.t1Machine.Config.String_Camera));
Rectangle rectangle = new Rectangle(centerpos.X - 640 / 2, centerpos.Y - 640 / 2, 640, 640);
Bitmap newbitmap = Common.ImageCrop(bmap, rectangle);
bmap.Dispose();
string filename = "\\image\\TrayString\\" + DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss") + ".jpg";
newbitmap.Save(filename, ImageFormat.Jpeg);
float fx = 0, fy = 0;
int r = centerDetector(filename, ref fx, ref fy);
LogUtil.info($"centerDetector r:{r},x:{fx},y:{fy}");
if (r != 0 || fx == 0)
{
return (newbitmap, Point.Empty, "未检测到盘心");
}
var debugtxt = $"centerDetector:\nresult:{r}\nfX:{fx}\nfY:{fy}";
var currpos = new Point((int)fx+ rectangle.X, (int)fy+ rectangle.Y);
var distance = (int)Common.distance(centerpos, currpos);
Pen greenpen = new Pen(Color.Green, 15);
Pen redpen = new Pen(Color.FromArgb(255, Color.Red), 10);
Graphics graphics = Graphics.FromImage(newbitmap);
graphics.DrawEllipse(greenpen, Config.String_Center_X - 8, Config.String_Center_Y - 8, 8 * 2, 8 * 2);
graphics.DrawEllipse(redpen, (int)fx - 5, (int)fy - 5, 5 * 2, 5 * 2);
graphics.Save();
return (newbitmap, currpos, debugtxt);
}
[DllImport("yolov5.dll", CharSet = CharSet.Ansi)]
public static extern int centerDetector([MarshalAs(UnmanagedType.LPStr)] string filename, ref float x, ref float y);
}
}
......@@ -79,10 +79,7 @@ namespace DeviceLibrary
AlarmLed.LedState = LedState.on;
}
if (alarmType != AlarmType.None
|| RobotManage.labelMachine.alarmType != AlarmType.None
|| RobotManage.filterMachine.alarmType != AlarmType.None
|| RobotManage.t1Machine.alarmType != AlarmType.None)
if (alarmType != AlarmType.None)
{
AlarmBuzzer.ON();
}
......
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CodeLibrary;
using Newtonsoft.Json;
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
namespace DeviceLibrary
{
using crc = OnlineStore.CodeResourceControl;
public partial class XRayMachine
{
int suckReelRetryTimes = 0;
ReelParam ExitLine_Reel_Info
{
get => JsonConvert.DeserializeObject<ReelParam>(ConfigHelper.Config.Get("Runtime_ExitLine_Reel"));
set => ConfigHelper.Config.Set("Runtime_ExitLine_Reel", value == null ? null : JsonConvert.SerializeObject(value));
}
ReelParam SideMove_Reel_Info
{
get => JsonConvert.DeserializeObject<ReelParam>(ConfigHelper.Config.Get("Runtime_SideMove_Reel"));
set => ConfigHelper.Config.Set("Runtime_SideMove_Reel", value == null ? null : JsonConvert.SerializeObject(value));
}
bool ExitLine_Reel_IsSafe {
get => SideMoveInfo.MoveStep == MoveStep.Wait || SideMoveInfo.MoveStep >= MoveStep.SideMove_07;
}
void SideMoveProcess()
{
if (CheckWait(SideMoveInfo))
return;
switch (SideMoveInfo.MoveStep)
{
case MoveStep.Wait:
if (IOValue(IO_XRay_Type.ExitLine_Reel_Check).Equals(IO_VALUE.HIGH) && ExitLine_Reel_Info != null)
{
SideMoveInfo.NextMoveStep(MoveStep.SideMove_01);
SideMoveInfo.ReelParam = ExitLine_Reel_Info.clone();
SideMoveInfo.log("检测到料盘到位");
}
else
{
Msg.add("横移机构等待料盘", MsgLevel.info);
}
break;
case MoveStep.SideMove_01:
SideMoveInfo.NextMoveStep(MoveStep.SideMove_02);
ExitLine_Location_Axis.AbsMove(SideMoveInfo, Config.ExitLine_Location_P1, Config.ExitLine_Location_P1_speed);
SideMove_Z_Axis.AbsMove(SideMoveInfo, Config.SideMove_Z_P1, Config.SideMove_Z_P1_speed);
SideMoveInfo.log("出料档停退到P1");
suckReelRetryTimes = 0;
break;
case MoveStep.SideMove_02:
SideMoveInfo.NextMoveStep(MoveStep.SideMove_03);
SideMove_X_Axis.AbsMove(SideMoveInfo, Config.SideMove_X_P2, Config.SideMove_X_P2_speed);
SideMoveInfo.log("横移到取料点P2");
break;
case MoveStep.SideMove_03:
SideMoveInfo.NextMoveStep(MoveStep.SideMove_04);
var p2 = Config.SideMove_Z_P2 - (SideMoveInfo.ReelParam.PlateH - 8 - suckReelRetryTimes*4) * 1000;
SideMove_Z_Axis.AbsMove(SideMoveInfo, p2, Config.SideMove_Z_P2_speed);
CylinderMove(SideMoveInfo, IO_XRay_Type.SideMove_SuckerReel_Off, IO_XRay_Type.SideMove_SuckerReel_On, IO_VALUE.HIGH);
SideMoveInfo.log("升降轴到取料点P2:"+ p2);
break;
case MoveStep.SideMove_04:
SideMoveInfo.NextMoveStep(MoveStep.SideMove_05);
break;
case MoveStep.SideMove_05:
SideMoveInfo.NextMoveStep(MoveStep.SideMove_06);
SideMove_Z_Axis.AbsMove(SideMoveInfo, Config.SideMove_Z_P1, Config.SideMove_Z_P1_speed);
SideMoveInfo.log("升降轴到P1");
break;
case MoveStep.SideMove_06:
if (IOValue(IO_XRay_Type.SideMove_SuckerReel_Check).Equals(IO_VALUE.HIGH))
{
SideMoveInfo.NextMoveStep(MoveStep.SideMove_07);
SideMove_Reel_Info = ExitLine_Reel_Info.clone();
ExitLine_Reel_Info = null;
SideMoveInfo.log("吸盘成功");
}
else
{
if (suckReelRetryTimes > 3)
{
Msg.add("吸盘失败", MsgLevel.warning);
SideMoveInfo.log("吸盘失败, suckReelRetryTimes:" + suckReelRetryTimes);
}
else
{
SideMoveInfo.NextMoveStep(MoveStep.SideMove_03);
suckReelRetryTimes++;
SideMoveInfo.log("吸盘失败, suckReelRetryTimes:" + suckReelRetryTimes);
}
}
break;
case MoveStep.SideMove_07:
SideMoveInfo.NextMoveStep(MoveStep.SideMove_08);
SideMove_X_Axis.AbsMove(SideMoveInfo, Config.SideMove_X_P3, Config.SideMove_X_P3_speed);
SideMoveInfo.log("横移到放料点P3");
break;
case MoveStep.SideMove_08:
SideMoveInfo.NextMoveStep(MoveStep.SideMove_09);
SideMoveInfo.log("等待可以放料");
break;
case MoveStep.SideMove_09:
SideMoveInfo.NextMoveStep(MoveStep.SideMove_10);
var p3 = Config.SideMove_Z_P3 - (SideMoveInfo.ReelParam.PlateH - 8 - suckReelRetryTimes * 4) * 1000;
SideMove_Z_Axis.AbsMove(SideMoveInfo, p3, Config.SideMove_Z_P3_speed);
SideMoveInfo.log("升降轴到放料点P2:" + p3);
break;
case MoveStep.SideMove_10:
SideMoveInfo.NextMoveStep(MoveStep.SideMove_11);
CylinderMove(SideMoveInfo, IO_XRay_Type.SideMove_SuckerReel_Off, IO_XRay_Type.SideMove_SuckerReel_On, IO_VALUE.LOW);
SideMoveInfo.log("释放料盘");
break;
case MoveStep.SideMove_11:
SideMoveInfo.NextMoveStep(MoveStep.SideMove_12);
SideMove_Reel_Info = null;
break;
case MoveStep.SideMove_12:
SideMoveInfo.NextMoveStep(MoveStep.SideMove_13);
SideMove_Z_Axis.AbsMove(SideMoveInfo, Config.SideMove_Z_P1, Config.SideMove_Z_P1_speed);
SideMoveInfo.log("升降轴到P1");
break;
case MoveStep.SideMove_13:
SideMoveInfo.NextMoveStep(MoveStep.SideMove_14);
SideMove_X_Axis.AbsMove(SideMoveInfo, Config.SideMove_X_P1, Config.SideMove_X_P1_speed);
SideMoveInfo.log("横移到待机点P1");
break;
case MoveStep.SideMove_14:
SideMoveInfo.NextMoveStep(MoveStep.Wait);
break;
default:
break;
}
}
}
}
......@@ -63,7 +63,7 @@ namespace DeviceLibrary
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(100));
break;
case MoveStep.XRay_04_OpenXray:
MoveInfo.NextMoveStep(MoveStep.XRay_05_GetImage);
MoveInfo.NextMoveStep(MoveStep.XRay_04_CheckXray);
RobotManage.XRay.Start();
MoveInfo.log($"打开X光");
......@@ -75,7 +75,23 @@ namespace DeviceLibrary
MoveInfo.log($"判断为需要多次拍照的料盘,PN:{pn}");
countlist.Clear();
}
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(ConfigHelper.Config.Get("xray_light_delay", 1000)));
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(Setting_Init.XRay_Light_Delay));
break;
case MoveStep.XRay_04_CheckXray:
var runtimedata = RobotManage.XRay.GetRuntimeData();
if (runtimedata.HighVoltage > Setting_Init.XRay_Voltage * 0.8
&& runtimedata.BeamCurrent > Setting_Init.XRay_Current * 0.7)
{
MoveInfo.NextMoveStep(MoveStep.XRay_05_GetImage);
MoveInfo.log("X光点亮成功:" + runtimedata);
}
else if (MoveInfo.IsTimeOut(15))
{
MoveInfo.NextMoveStep(MoveStep.XRay_04_OpenXray);
RobotManage.XRay.Stop();
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
MoveInfo.log("X光超时未打到电压电流.重新打开:" + runtimedata);
}
break;
case MoveStep.XRay_05_GetImage:
if (GrabImage())
......@@ -122,7 +138,7 @@ namespace DeviceLibrary
case MoveStep.XRay_06_WaitMatchPN:
case MoveStep.XRay_06_WaitMatchPN2:
Msg.add(crc.GetString("new_reel", "新物料,等待匹配算法!"), MsgLevel.warning);
if (IOValue(IO_Label_Type.Reset_BTN).Equals(IO_VALUE.HIGH))
if (IOValue(IO_XRay_Type.Reset_BTN).Equals(IO_VALUE.HIGH))
{
MoveInfo.log("用户确认继续1");
MoveInfo.NextMoveStep(MoveStep.XRay_07_TryAgain);
......@@ -158,25 +174,25 @@ namespace DeviceLibrary
MoveInfo.log($"打开出口门");
break;
case MoveStep.XRay_09_SentToLabelStop:
if (RobotManage.labelMachine.TrayCanIN())
if (ExitLine_Reel_IsSafe && ExitLine_Reel_Info==null)
{
MoveInfo.NextMoveStep(MoveStep.XRay_10_CloseOutDoor);
MoveInfo.log($"打开出口门,送出到贴标机构");
Line_In_Axis.SpeedMove(Config.Line_In_Relative_speed*2);
RobotManage.Line1.LineRun("xray", 999, "XRay_09_SentToLabelStop");
Line_In_Axis.SpeedMove(Config.Line_In_Relative_speed * 2);
IOMove(IO_XRay_Type.ExitLine_Reel_Run, IO_VALUE.HIGH);
MoveInfo.StopwatchLog(false, "开始送出");
}
else if (MoveInfo.IsTimeOut(30)) {
Msg.add(crc.GetString("wait_xx_free", "等待{0}空闲", RobotManage.labelMachine.DeviceNameShow), MsgLevel.warning);
else if (MoveInfo.IsTimeOut(30))
{
Msg.add(crc.GetString("wait_xx_free", "等待{0}空闲", SideMoveInfo.Name), MsgLevel.warning);
MoveInfo.log("等待贴标机构入口空闲");
}
break;
case MoveStep.XRay_10_CloseOutDoor:
if (RobotManage.labelMachine.Tray_Check.Equals(IO_VALUE.HIGH))
if (IOValue(IO_XRay_Type.ExitLine_Reel_Check).Equals(IO_VALUE.HIGH))
{
//RobotManage.labelMachine.InLineRunControl(IO_VALUE.LOW);
RobotManage.Line1.LineStop("xray", "XRay_10_CloseOutDoor");
IOMove(IO_XRay_Type.ExitLine_Reel_Run, IO_VALUE.LOW);
MoveInfo.NextMoveStep(MoveStep.XRay_11_GetCoutResult);
MoveInfo.log($"关闭出口门,停止X光机内线体");
Line_In_Axis.SuddenStop();
......@@ -185,25 +201,26 @@ namespace DeviceLibrary
}
else if (MoveInfo.IsTimeOut(10))
{
Msg.add(crc.GetString("wait_goto_xx", "等待料盘到达{0}",RobotManage.labelMachine.DeviceNameShow), MsgLevel.warning);
Msg.add(crc.GetString("wait_goto_xx", "等待料盘到达{0}", SideMoveInfo.Name), MsgLevel.warning);
MoveInfo.log("等待料盘到达贴标线入口");
}
break;
case MoveStep.XRay_11_GetCoutResult:
if (GetResultTask == null || GetResultTask.IsCompleted)
{
RobotManage.labelMachine.preReelParam = MoveInfo.ReelParam;
ExitLine_Reel_Info = MoveInfo.ReelParam;
MoveInfo.NextMoveStep(MoveStep.XRay_End);
MoveInfo.log($"获得点料结果 QTY:{MoveInfo.ReelParam.QTY}");
MoveInfo.StopwatchLog(false, "获得点料结果");
}
else if (MoveInfo.IsTimeOut(30)) {
else if (MoveInfo.IsTimeOut(30))
{
MoveInfo.NextMoveStep(MoveStep.XRay_End);
MoveInfo.log("获取点料结果超时");
MoveInfo.ReelParam.IsNg = true;
MoveInfo.ReelParam.NgMsg = "获取点料结果超时";
MoveInfo.ReelParam.logresult();
RobotManage.labelMachine.preReelParam = MoveInfo.ReelParam;
ExitLine_Reel_Info = MoveInfo.ReelParam;
}
break;
case MoveStep.XRay_End:
......
......@@ -23,6 +23,7 @@ namespace DeviceLibrary
_config = value;
}
}
public MoveInfo SideMoveInfo;
public override string DeviceName { get; } = "点料";
public bool canRunning { get; set; }
public bool isBusy { get; set; }
......@@ -34,6 +35,9 @@ namespace DeviceLibrary
AxisBean Line_Entry_Axis;
AxisBean Line_In_Axis;
AxisBean ExitLine_Location_Axis;
AxisBean SideMove_X_Axis;
AxisBean SideMove_Z_Axis;
public bool Init(out string msg)
{
......@@ -48,11 +52,15 @@ namespace DeviceLibrary
#region 初始化伺服轴
Line_Entry_Axis = new AxisBean(Config.Line_Entry_Axis, DeviceName);
Line_In_Axis = new AxisBean(Config.Line_In_Axis, DeviceName);
ExitLine_Location_Axis = new AxisBean(Config.ExitLine_Location_Axis, DeviceName);
SideMove_X_Axis = new AxisBean(Config.SideMove_X_Axis, DeviceName);
SideMove_Z_Axis = new AxisBean(Config.SideMove_Z_Axis, DeviceName);
#endregion
MoveInfo = new MoveInfo(DeviceName);
SideMoveInfo = new MoveInfo("移栽机构");
ResetMoveInfo = MoveInfo;
LedProcessInit();
Asa.XrayImage.setProcessLevel(4.0);
//Asa.XrayImage.setProcessLevel(4.0);
IOMonitor.RegisterIO(IO_XRay_Type.Exit_Open, Config, IO_VALUE.LOW, delegate () { XRayDoorOpen(); });
IOMonitor.RegisterIO(IO_XRay_Type.Entry_Open, Config, IO_VALUE.LOW, delegate () { XRayDoorOpen(); });
AlarmBuzzer.SetOnOffAction(() => { IOMove(IO_XRay_Type.Alarm_Buzzer, IO_VALUE.HIGH); }, () => { IOMove(IO_XRay_Type.Alarm_Buzzer, IO_VALUE.LOW); });
......@@ -104,8 +112,8 @@ namespace DeviceLibrary
if (runStatus == RunStatus.Running)
{
FeedingProcess();
WorkProcess();
SideMoveProcess();
}
else if (runStatus == RunStatus.HomeReset)
{
......
类型,分类编号,说明,名称,属性值,设备名称,电器定义,目标速度,加速时间,减速时间,原点低速度,原点高速,原点加速度,脉冲最小误差,脉冲最大误差,脉冲最小限位,脉冲最大限位
PRO,30,NG料盒最大容量,NG_BOX_MAXCOUNT,50,,,,,,,,,,,,
PRO,30,MSD料盒最大容量,MSD_BOX_MAXCOUNT,50,,,,,,,,,,,,
PRO,30,Paper料盒最大容量,PAPER_BOX_MAXCOUNT,50,,,,,,,,,,,,
DI,0,NG料阻挡料盘检测,NG_TaryStop_Check,26,HC,X26,,,,,,,,,,
DI,0,NG料阻挡上升端,NG_TaryStop_Up,27,HC,X27,,,,,,,,,,
DI,0,NG料阻挡下降端,NG_TaryStop_Down,28,HC,X28,,,,,,,,,,
DI,0,NG料推送前进端,NG_GetOut_Fwd,29,HC,X29,,,,,,,,,,
DI,0,NG料推送后退端,NG_GetOut_Bck,30,HC,X30,,,,,,,,,,
DI,0,纸质料阻挡料盘检测,Paper_TaryStop_Check,31,HC,X31,,,,,,,,,,
DI,0,纸质料阻挡上升端,Paper_TaryStop_Up,32,HC,X32,,,,,,,,,,
DI,0,纸质料阻挡下降端,Paper_TaryStop_Down,33,HC,X33,,,,,,,,,,
DI,0,纸质料推送前进端,Paper_GetOut_Fwd,34,HC,X34,,,,,,,,,,
DI,0,纸质料推送后退端,Paper_GetOut_Bck,35,HC,X35,,,,,,,,,,
DI,0,MSD料阻挡料盘检测,MSD_TaryStop_Check,36,HC,X36,,,,,,,,,,
DI,0,MSD料阻挡上升端,MSD_TaryStop_Up,37,HC,X37,,,,,,,,,,
DI,0,MSD料阻挡下降端,MSD_TaryStop_Down,38,HC,X38,,,,,,,,,,
DI,0,MSD料推送前进端,MSD_GetOut_Fwd,39,HC,X39,,,,,,,,,,
DI,0,MSD料推送后退端,MSD_GetOut_Bck,40,HC,X40,,,,,,,,,,
,,,,,,,,,,,,,,,,
DO,0,皮带线3启动,Line3_Run,21,HC,Y21,,,,,,,,,,
DO,0,NG料阻挡上升,NG_TaryStop_Up,28,HC,Y28,,,,,,,,,,
DO,0,NG料阻挡下降,NG_TaryStop_Down,29,HC,Y29,,,,,,,,,,
DO,0,NG料推送前进,NG_GetOut_Fwd,30,HC,Y30,,,,,,,,,,
DO,0,NG料推送后退,NG_GetOut_Bck,31,HC,Y31,,,,,,,,,,
DO,0,纸质料阻挡上升,Paper_TaryStop_Up,32,HC,Y32,,,,,,,,,,
DO,0,纸质料阻挡下降,Paper_TaryStop_Down,33,HC,Y33,,,,,,,,,,
DO,0,纸质料推送前进,Paper_GetOut_Fwd,34,HC,Y34,,,,,,,,,,
DO,0,纸质料推送后退,Paper_GetOut_Bck,35,HC,Y35,,,,,,,,,,
DO,0,MSD料阻挡上升,MSD_TaryStop_Up,36,HC,Y36,,,,,,,,,,
DO,0,MSD料阻挡下降,MSD_TaryStop_Down,37,HC,Y37,,,,,,,,,,
DO,0,MSD料推送前进,MSD_GetOut_Fwd,38,HC,Y38,,,,,,,,,,
DO,0,MSD料推送后退,MSD_GetOut_Bck,39,HC,Y39,,,,,,,,,,
类型,分类编号,说明,名称,属性值,设备名称,电器定义,目标速度,加速时间,减速时间,原点低速度,原点高速,原点加速度,脉冲最小误差,脉冲最大误差,脉冲最小限位,脉冲最大限位
PRO,30,IO信号超时时间(秒),IOSingle_TimerOut,15,,,,,,,,,,,,
PRO,30,气压检测超时,AirCheckSeconds,5,,,,,,,,,,,,
PRO,20,右侧提升轴每毫米脉冲,Right_Batch_ChangeValue,5555,,,,,,,,,,,,
PRO,20,左侧提升轴每毫米脉冲,Left_Batch_ChangeValue,5555,,,,,,,,,,,,
PRO,30,右侧相机名称,RightCameraName,123123,,,,,,,,,,,,
PRO,30,右侧轴心坐标X,Right_Batch_X,222,,,,,,,,,,,,
PRO,30,右侧轴心坐标Y,Right_Batch_Y,333,,,,,,,,,,,,
PRO,30,贴标R轴0位角度差,Label_R_Angle_Diff,90,,,,,,,,,,,,
PRO,30,贴标R轴360度脉冲,Label_R_360,9,,,,,,,,,,,,
PRO,30,贴标X轴基准点,Label_X_Base,8,,,,,,,,,,,,
PRO,30,贴标Y轴基准点,Label_Y_Base,7,,,,,,,,,,,,
PRO,30,图像/X轴比值,Cam_Pixel_X_Ratio,6,,,,,,,,,,,,
PRO,30,图像/Y轴比值,Cam_Pixel_Y_Ratio,5,,,,,,,,,,,,
PRO,30,像素偏离位置7寸,Label_Offset_Pixel_7,200,,,,,,,,,,,,
PRO,30,像素偏离位置13寸,Label_Offset_Pixel_13,200,,,,,,,,,,,,
PRO,30,像素偏离位置15寸,Label_Offset_Pixel_15,200,,,,,,,,,,,,
,,,,,,,,,,,,,,,,
类型,分类编号,说明,名称,属性值,设备名称,电器定义,目标速度,加速时间,减速时间,原点低速度,原点高速,原点加速度,脉冲最小误差,脉冲最大误差,脉冲最小限位,脉冲最大限位
AXIS,,贴标移栽机构X轴,Label_X_Axis,3,HC,,90000,3000000,3000000,500,17000,50000,10,1000,0,0
AXIS,,贴标移栽机构Y轴,Label_Y_Axis,2,HC,,90000,3000000,3000000,500,17000,50000,10,1000,0,0
AXIS,,贴标移栽机构Z轴,Label_Z_Axis,4,HC,,90000,3000000,3000000,1000,13000,40000,10,1000,0,0
AXIS,,贴标移栽机构R轴,Label_R_Axis,5,HC,,700,8100,8100,20,50,300,500,100,0,0
,,,,,,,,,,,,,,,,
PRO,30,相机名称,CameraName,GigE:MV-CE200-10GC (00E78064892),,,,,,,,,,,,
PRO,30,图像料盘中心坐标X,Right_Batch_X,3205,,,,,,,,,,,,
PRO,30,图像料盘中心坐标Y,Right_Batch_Y,1889,,,,,,,,,,,,
PRO,0,贴标R轴0位角度差,Label_R_Angle_Diff,0,,,,,,,,,,,,
PRO,30,图像/X轴比值,Cam_Pixel_X_Ratio,141,,,,,,,,,,,,
PRO,30,图像/Y轴比值,Cam_Pixel_Y_Ratio,141,,,,,,,,,,,,
PRO,30,像素偏离位置7寸,Label_Offset_Pixel_7,0,,,,,,,,,,,,
PRO,30,像素偏离位置13寸,Label_Offset_Pixel_13,-595,,,,,,,,,,,,
PRO,30,像素偏离位置15寸,Label_Offset_Pixel_15,200,,,,,,,,,,,,
PRO,30,贴标R轴偏移像素,Label_R_Offset_Pixel,70,,,,,,,,,,,,
PRO,0,贴标R轴原点角度,Label_R_Zero_Angle,0,,,,,,,,,,,,
PRO,30,贴标Z轴高度转换系数(1mm对应的脉冲),Label_Z_Axis_ChangeValue,128,,,,,,,,,,,,
PRO,30,贴标标签偏移X像素,Label_Offset_X,250,,,,,,,,,,,,
PRO,30,贴标标签偏移Y像素,Label_Offset_Y,230,,,,,,,,,,,,
PRO,30,贴标R轴最大角度,Label_R_MaxAngle,330,,,,,,,,,,,,
,,,,,,,,,,,,,,,,
PRO,13,贴标X轴待机点P1,Label_X_P1,244500,,,700000,,,,,,,,,
PRO,13,贴标X轴取标点P2,Label_X_P2,244500,,,700000,,,,,,,,,
PRO,13,贴标X轴料盘中心基准点,Label_X_Base,359627,,,700000,,,,,,,,,
,,,,,,,,,,,,,,,,
PRO,12,贴标Y轴待机点P1,Label_Y_P1,111830,,,700000,,,,,,,,,
PRO,12,贴标Y轴取标点P2,Label_Y_P2,49563,,,700000,,,,,,,,,
PRO,12,贴标Y轴料盘中心基准点,Label_Y_Base,367433,,,700000,,,,,,,,,
,,,,,,,,,,,,,,,,
PRO,14,贴标Z轴待机点P1,Label_Z_P1,78338,,,700000,,,,,,,,,
PRO,14,贴标Z轴取标前点P2,Label_Z_P2,41000,,,700000,,,,,,,,,
PRO,14,贴标Z轴取标点P3,Label_Z_P3,99900,,,700000,,,,,,,,,
PRO,14,贴标Z轴贴标前点P4,Label_Z_P4,85226,,,700000,,,,,,,,,
PRO,14,贴标Z轴贴标点P5,Label_Z_P5,132000,,,700000,,,,,,,,,
,,,,,,,,,,,,,,,,
PRO,15,贴标R轴待机点P1,Label_R_P1,560,,,1200,,,,,,,,,
PRO,15,贴标R轴取标点P2,Label_R_P2,562,,,1200,,,,,,,,,
PRO,15,贴标R轴360度脉冲,Label_R_360,681,,,900,,,,,,,,,
,,,,,,,,,,,,,,,,
DI,0,急停(贴标设备),SuddenStop_BTN,16,HC,X16,,,,,,,,,,
DI,0,贴标机构复位,Reset_BTN,17,HC,X17,,,,,,,,,,
DI,0,皮带线阻挡1料盘检测,Tray_Check,18,HC,X18,,,,,,,,,,
DI,0,皮带线阻挡1上升端,TrayStop_Up,19,HC,X19,,,,,,,,,,
DI,0,皮带线阻挡1下降端,TrayStop_Down,20,HC,X20,,,,,,,,,,
DI,0,皮带线料盘检测,Line_HasTray_Check,21,HC,X21,,,,,,,,,,
DI,0,贴标阻挡料盘检测,Label_TaryStop_Check,22,HC,X22,,,,,,,,,,
DI,0,贴标阻挡上升端,Label_Stop_Up,23,HC,X23,,,,,,,,,,
DI,0,贴标阻挡下降端,Label_Stop_Down,24,HC,X24,,,,,,,,,,
DI,0,吸嘴取标检测,Label_Cylinder_Check,25,HC,X25,,,,,,,,,,
,,,,,,,,,,,,,,,,
DO,0,贴标机构运行指示灯,Run_Led,16,HC,Y16,,,,,,,,,,
DO,0,贴标机构故障指示灯,Alarm_Led,17,HC,Y17,,,,,,,,,,
DO,0,贴标机构相机光源打开,Camera_Led,18,HC,Y18,,,,,,,,,,
DO,0,皮带线1启动,Line1_Run,19,HC,Y19,,,,,,,,,,
DO,0,皮带线2启动,Line2_Run,20,HC,Y20,,,,,,,,,,
,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,
DO,0,皮带线阻挡1上升,TrayStop_Up,23,HC,Y23,,,,,,,,,,
DO,0,皮带线阻挡1下降,TrayStop_Down,24,HC,Y24,,,,,,,,,,
DO,0,贴标阻挡上升,Label_Stop_Up,25,HC,Y25,,,,,,,,,,
DO,0,贴标阻挡下降,Label_Stop_Down,26,HC,Y26,,,,,,,,,,
DO,0,吸嘴取标,LabelCylinder_Work,27,HC,Y27,,,,,,,,,,
类型,分类编号,说明,名称,属性值,设备名称,电器定义,目标速度,加速时间,减速时间,原点低速度,原点高速,原点加速度,脉冲最小误差,脉冲最大误差,脉冲最小限位,脉冲最大限位
AXIS,,出料提升轴,T_Batch_Axis,6,HC,,8000,30000,30000,500,4000,15000,10,1000,0,0
AXIS,,出料移栽轴,T_Pan_Axis,7,HC,,20000,200000,200000,500,4000,15000,10,1000,0,0
AXIS,,出料升降轴,T_Updown_Axis,8,HC,,20000,200000,200000,500,4000,15000,10,1000,0,0
AXIS,,皮带线出口定位,T_TrayPos_Axis,9,HC,,35000,100000,100000,1000,5000,20000,500,100,0,0
AXIS,,出料移栽Y轴,T_Y_Axis,10,HC,,20000,30000,30000,500,4000,15000,10,100,0,0
,,,,,,,,,,,,,,,,
PRO,16,提升轴待机点 P1,BatchAxis_P1,500,,,8000,,,,,,,,,
PRO,16,提升轴上升目标点_P2,BatchAxis_P2,78451,,,8000,,,,,,,,,
,,,,,,,,,,,,,,,,
PRO,17,横移待机取料点P1,Pan_P1,5326,,,100000,,,,,,,,,
PRO,17,横移放料点P2,Pan_P2,75933,,,100000,,,,,,,,,
,,,,,,,,,,,,,,,,
PRO,20,Y轴待机取料点P1,Y_P1,51136,,,100000,,,,,,,,,
PRO,20,Y轴放料基准点P2,Y_P2,51136,,,100000,,,,,,,,,
,,,,,,,,,,,,,,,,
PRO,18,升降轴待机点P1,UpdownAxis_P1,7,,,100000,,,,,,,,,
PRO,18,升降轴取料点P2,UpdownAxis_P2,36905,,,100000,,,,,,,,,
PRO,18,升降轴放料点P3,UpdownAxis_P3,6800,,,100000,,,,,,,,,
,,,,,,,,,,,,,,,,
PRO,19,料盘定位待机点P1,TrayPos_P1,0,,,50000,,,,,,,,,
,,,,,,,,,,,,,,,,
PRO,30,提升轴高度转换系数(1mm对应的脉冲),BatchAxis_ChangeValue,128,,,,,,,,,,,,
PRO,30,升降轴高度转换系数(1mm对应的脉冲),UpdownAxis_ChangeValue,128,,,,,,,,,,,,
PRO,30,入口阻挡定位列表,TrayPos_List,7=18164;13=5400;15=1600;,,,,,,,,,,,,
PRO,30,料串定位相机,String_Camera,GigE:MV-CE200-10GC (00E78064926),,,,,,,,,,,,
PRO,30,料串中心点X坐标,String_Center_X,721,,,,,,,,,,,,
PRO,30,料串中心点Y坐标,String_Center_Y,800,,,,,,,,,,,,
PRO,30,料串允许偏离像素值,String_Offset_Range_Px,60,,,,,,,,,,,,
PRO,30,料串图像/X轴比值,Cam_Pixel_X_Ratio,19,,,,,,,,,,,,
PRO,30,料串图像/Y轴比值,Cam_Pixel_Y_Ratio,143,,,,,,,,,,,,
,,,,,,,,,,,,,,,,
DI,0,皮带线出口料盘检测,End_Line_Tray_Check,41,HC,X41,,,,,,,,,,
DI,0,皮带线出口顶升料盘检测,End_Lift_Tray_Check,42,HC,X42,,,,,,,,,,
DI,0,出口顶升气缸上升端,End_Lift_Cylinder_Up,43,HC,X43,,,,,,,,,,
DI,0,出口顶升气缸下降端,End_Lift_Cylinder_Down,44,HC,X44,,,,,,,,,,
DI,0,急停(T1机构),SuddenStop_BTN,45,HC,X45,,,,,,,,,,
DI,0,T1机构复位,Reset_BTN,46,HC,X46,,,,,,,,,,
DI,0,空料串线体入口检测,Empty_LineIn_Check,47,HC,X47,,,,,,,,,,
DI,0,空料串线体阻挡料串检测,EmptyString_In_Check,48,HC,X48,,,,,,,,,,
DI,0,空料串线体横移料串检测,EmptyString_End_Check,49,HC,X49,,,,,,,,,,
DI,0,空料串线体顶升上升端,EmptyString_Lift_Up,50,HC,X50,,,,,,,,,,
DI,0,空料串线体顶升下降端,EmptyString_Lift_Down,51,HC,X51,,,,,,,,,,
DI,0,T1定位工位料串检测,T1_Lift_Tray_Check,52,HC,X52,,,,,,,,,,
DI,0,T1定位气缸1上升端,T1_Location1_Cylinder_Up,53,HC,X53,,,,,,,,,,
DI,0,T1定位气缸1下降端,T1_Location1_Cylinder_Down,54,HC,X54,,,,,,,,,,
DI,0,T1定位气缸2上升端,T1_Location2_Cylinder_Up,55,HC,X55,,,,,,,,,,
DI,0,T1定位气缸2下降端,T1_Location2_Cylinder_Down,56,HC,X56,,,,,,,,,,
DI,0,T1定位工位顶升上升端,T1_Lift_Up,57,HC,X57,,,,,,,,,,
DI,0,T1定位工位顶升下降端,T1_Lift_Down,58,HC,X58,,,,,,,,,,
DI,0,T1料叉气缸前进端,Fork_Cylinder_Fwd,59,HC,X59,,,,,,,,,,
DI,0,T1料叉气缸后退端,Fork_Cylinder_Bck,60,HC,X60,,,,,,,,,,
DI,0,T1出口前阻挡料串检测,T1_Wait_Check,61,HC,X61,,,,,,,,,,
DI,0,T1出口料串检测,T1_Out_Check,62,HC,X62,,,,,,,,,,
DI,0,T1伺服定位料盘检测,T1_Tray_Check,63,HC,X63,,,,,,,,,,
,,,,,,,,,,,,,,,,
DO,0,皮带线4启动,Line4_Run,22,HC,Y22,,,,,,,,,,
DO,0,出口顶升气缸上升,End_Lift_Cylinder_Up,40,HC,Y40,,,,,,,,,,
DO,0,出口顶升气缸下降,End_Lift_Cylinder_Down,41,HC,Y41,,,,,,,,,,
DO,0,T1运行指示灯,Run_Led,42,HC,Y42,,,,,,,,,,
DO,0,T1故障指示灯,Alarm_Led,43,HC,Y43,,,,,,,,,,
DO,0,空料串线体运转,Empty_Line_Run,44,HC,Y44,,,,,,,,,,
DO,0,T1出料串线体运转,Line_Out_Run,45,HC,Y45,,,,,,,,,,
DO,0,空料串线体横移电机运转,EmptyString_Sliding_Run,46,HC,Y46,,,,,,,,,,
DO,0,T1定位工位横移电机运转,T1String_Sliding_Run,47,HC,Y47,,,,,,,,,,
DO,0,T1线体过渡滚筒运转,T1_Sliding_Run,48,HC,Y48,,,,,,,,,,
DO,0,空料串线体顶升上升,EmptyString_Lift_Up,49,HC,Y49,,,,,,,,,,
DO,0,空料串线体顶升下降,EmptyString_Lift_Down,50,HC,Y50,,,,,,,,,,
DO,0,T1定位工位顶升上升,T1_Lift_Up,51,HC,Y51,,,,,,,,,,
DO,0,T1定位工位顶升下降,T1_Lift_Down,52,HC,Y52,,,,,,,,,,
DO,0,T1定位气缸上升,T1_Location_Cylinder_Up,53,HC,Y53,,,,,,,,,,
DO,0,T1定位气缸下降,T1_Location_Cylinder_Down,54,HC,Y54,,,,,,,,,,
DO,0,T1料叉气缸前进端,Fork_Cylinder_Fwd,55,HC,Y55,,,,,,,,,,
DO,0,T1料叉气缸后退端,Fork_Cylinder_Bck,56,HC,Y56,,,,,,,,,,
DO,0,空料串线体入口阻挡下降,EmptyString_In_Stop,57,HC,Y57,,,,,,,,,,
DO,0,空料串线体横移阻挡下降,EmptyString_Wait_Stop,58,HC,Y58,,,,,,,,,,
DO,0,T1出口前阻挡下降,T1_Wait_Stop,59,HC,Y59,,,,,,,,,,
DO,0,T1出口阻挡下降,T1_Out_Stop,60,HC,Y60,,,,,,,,,,
......@@ -21,33 +21,42 @@ DI,0,急停(点料设备),SuddenStop_BTN,0,HC,X00,,,,,,,,,,
DI,0,复位,Reset_BTN,1,HC,X01,,,,,,,,,,
DI,0,启动,Start_BTN,2,HC,X02,,,,,,,,,,
DI,0,气压检测,Airpressure_Check,3,HC,X03,,,,,,,,,,
DI,0,上料人工确认,Manual_Confirm_BTN,4,HC,X04,,,,,,,,,,
DI,0,上料区料盘检测,Tray_Check,5,HC,X05,,,,,,,,,,
DI,0,上料区7寸料盘检测,Tray7_Check,6,HC,X06,,,,,,,,,,
DI,0,上料区13寸料盘检测,Tray13_Check,7,HC,X07,,,,,,,,,,
DI,0,上料区15寸料盘检测,Tray15_Check,8,HC,X08,,,,,,,,,,
DI,0,上料区定位气缸上升端,Location_Cylinder_Up,9,HC,X09,,,,,,,,,,
DI,0,上料区定位气缸下降端,Location_Cylinder_Down,10,HC,X10,,,,,,,,,,
DI,0,点料机入口门打开端,Entry_Open,11,HC,X11,,,,,,,,,,
DI,0,点料机入口门关闭端,Entry_Close,12,HC,X12,,,,,,,,,,
DI,0,点料机出口门打开端,Exit_Open,13,HC,X13,,,,,,,,,,
DI,0,点料机出口门关闭端,Exit_Close,14,HC,X14,,,,,,,,,,
DI,0,点料机内部料盘检测,Tray_Inside_Check,15,HC,X15,,,,,,,,,,
DI,0,点料机入口门打开端,Entry_Open,4,HC,X04,,,,,,,,,,
DI,0,点料机入口门关闭端,Entry_Close,5,HC,X05,,,,,,,,,,
DI,0,点料机出口门打开端,Exit_Open,6,HC,X06,,,,,,,,,,
DI,0,点料机出口门关闭端,Exit_Close,7,HC,X07,,,,,,,,,,
DI,0,点料机内部料盘检测,Tray_Inside_Check,8,HC,X08,,,,,,,,,,
DI,0,点料机门禁,,9,HC,X09,,,,,,,,,,
DI,0,出料皮带线料盘检测,,10,HC,X10,,,,,,,,,,
DI,0,过渡横移吸盘压力检测,,11,HC,X11,,,,,,,,,,
,,,,,,,,,,,,,,,,
DI,0,上料区光栅检测,,16,HC,X16,,,,,,,,,,
DI,0,上料人工确认,Manual_Confirm_BTN,17,HC,X17,,,,,,,,,,
DI,0,上料区料盘检测,Tray_Check,18,HC,X18,,,,,,,,,,
DI,0,上料区7寸料盘检测,Tray7_Check,19,HC,X19,,,,,,,,,,
DI,0,上料区13寸料盘检测,Tray13_Check,20,HC,X20,,,,,,,,,,
DI,0,上料区15寸料盘检测,Tray15_Check,21,HC,X21,,,,,,,,,,
DI,0,上料区定位气缸上升端,Location_Cylinder_Up,22,HC,X22,,,,,,,,,,
DI,0,上料区定位气缸下降端,Location_Cylinder_Down,23,HC,X23,,,,,,,,,,
,,,,,,,,,,,,,,,,
DO,0,待机状态(指示灯),Standby_Led,0,HC,Y00,,,,,,,,,,
DO,0,运行状态(指示灯),Run_Led,1,HC,Y01,,,,,,,,,,
DO,0,故障状态(指示灯),Alarm_Led,2,HC,Y02,,,,,,,,,,
DO,0,故障状态(蜂鸣器),Alarm_Buzzer,3,HC,Y03,,,,,,,,,,
DO,0,上料区料盘检测OK,Pass_Led,4,HC,Y04,,,,,,,,,,
DO,0,上料区料盘检测NG,NG_Led,5,HC,Y05,,,,,,,,,,
DO,0,上料区相机光源打开,Camera_Led,6,HC,Y06,,,,,,,,,,
DO,0,X光机互锁信号ON,Xray_Lock,7,HC,Y07,,,,,,,,,,
DO,0,上料区定位气缸上升,Location_Cylinder_Up,8,HC,Y08,,,,,,,,,,
DO,0,上料区定位气缸下降,Location_Cylinder_Down,9,HC,Y09,,,,,,,,,,
DO,0,点料机入口门打开,Entry_Open,10,HC,Y10,,,,,,,,,,
DO,0,点料机入口门关闭,Entry_Close,11,HC,Y11,,,,,,,,,,
DO,0,点料机出口门打开,Exit_Open,12,HC,Y12,,,,,,,,,,
DO,0,点料机出口门关闭,Exit_Close,13,HC,Y13,,,,,,,,,,
DO,0,出料皮带线启动,,4,HC,Y04,,,,,,,,,,
DO,0,X光机互锁信号ON,Xray_Lock,5,HC,Y05,,,,,,,,,,
DO,0,点料机入口门打开,Entry_Open,6,HC,Y06,,,,,,,,,,
DO,0,点料机入口门关闭,Entry_Close,7,HC,Y07,,,,,,,,,,
DO,0,点料机出口门打开,Exit_Open,8,HC,Y08,,,,,,,,,,
DO,0,点料机出口门关闭,Exit_Close,9,HC,Y09,,,,,,,,,,
DO,0,上料区定位气缸上升,Location_Cylinder_Up,10,HC,Y10,,,,,,,,,,
DO,0,上料区定位气缸下降,Location_Cylinder_Down,11,HC,Y11,,,,,,,,,,
DO,0,过渡横移吸盘吸料,,12,HC,Y12,,,,,,,,,,
DO,0,过渡横移吸盘放料,,13,HC,Y13,,,,,,,,,,
,,,,,,,,,,,,,,,,
DO,0,上料区料盘检测OK,Pass_Led,16,HC,Y16,,,,,,,,,,
DO,0,上料区料盘检测NG,NG_Led,17,HC,Y17,,,,,,,,,,
DO,0,上料区相机光源打开,Camera_Led,18,HC,Y18,,,,,,,,,,
,,,,,,,,,,,,,,,,
ADIO,0,左侧7寸料盘模拟量检测,Tray7_L_ADIO,0,HC,A00,,,,,,,,,,
ADIO,0,左侧13寸料盘模拟量检测,Tray13_L_ADIO,1,HC,A01,,,,,,,,,,
......
......@@ -81,7 +81,7 @@
<Reference Include="System.Xml" />
<Reference Include="X-Ray, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\X-Ray\X-Ray\bin\Debug\X-Ray.dll</HintPath>
<HintPath>..\..\..\X-Ray\X-Ray\bin\Debug\X-Ray.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
......@@ -94,20 +94,12 @@
<Compile Include="AutoScan\common\SensorDebounce.cs" />
<Compile Include="AutoScan\common\ServerConn.cs" />
<Compile Include="AutoScan\common\TextBlock.cs" />
<Compile Include="AutoScan\FilterMachine.partial.cs" />
<Compile Include="AutoScan\LabelMachine.partial.cs" />
<Compile Include="AutoScan\LabelMachine.Ledprocess.cs" />
<Compile Include="AutoScan\LabelMachine.claclabel.cs" />
<Compile Include="AutoScan\T1Machine.cs" />
<Compile Include="AutoScan\FilterMachine.cs" />
<Compile Include="AutoScan\LabelMachine.cs" />
<Compile Include="AutoScan\common\LabelParam.cs" />
<Compile Include="AutoScan\MachineBase.cs" />
<Compile Include="AutoScan\common\MoveInfo.cs" />
<Compile Include="AutoScan\MoveStep.cs" />
<Compile Include="AutoScan\T1Machine.partial.cs" />
<Compile Include="AutoScan\XRayMachine.cs" />
<Compile Include="AutoScan\T1Machine.Ledprocess.cs" />
<Compile Include="AutoScan\XRayMachine.SideMove.cs" />
<Compile Include="AutoScan\XRayMachine.XRay.cs" />
<Compile Include="AutoScan\XRayMachine.Feeding.cs" />
<Compile Include="DeviceLibrary\AlarmBuzzer.cs" />
......@@ -156,30 +148,8 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="Config\I40Config.csv">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<Content Include="Config\XrayConfig.csv">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Config\LabelConfig.csv">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Compile Include="AutoScan\LabelMachine.print.cs" />
<Compile Include="AutoScan\XRayMachine.Ledprocess.cs" />
<None Include="app.config" />
<None Include="Config\general.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<Content Include="Config\T1Config.csv">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Config\FilterConfig.csv">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<None Include="Config\HBXRAYPLATE.config" />
<None Include="packages.config" />
<None Include="Properties\Settings1.settings">
<Generator>SettingsSingleFileGenerator</Generator>
......
......@@ -22,6 +22,18 @@ namespace OnlineStore.LoadCSVLibrary
set { fieldName = value; }
}
}
public class EditableAttribute : Attribute
{
public EditableAttribute(int axisname)
{
Axisname = axisname;
}
public int Axisname
{
get;
set;
}
}
}
......@@ -13,7 +13,7 @@ namespace OnlineStore.LoadCSVLibrary
public class CSVReaderBase
{
public static char Spilt_Char = ',';
// public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
/// <summary>
/// 获取一个类所有的《字段,AttributeName列名》集合
/// </summary>
......
类型,分类编号,说明,名称,属性值,设备名称,电器定义,目标速度,加速时间,减速时间,原点低速度,原点高速,原点加速度,脉冲最小误差,脉冲最大误差,脉冲最小限位,脉冲最大限位
AXIS,,入口皮带线,Line_Entry_Axis,0,HC,,500,2000,2000,50,100,500,10,100,0,0
AXIS,,中间皮带线,Line_In_Axis,1,HC,,500,2000,2000,50,100,500,10,100,0,0
AXIS,,皮带线出口定位,ExitLine_Location_Axis,2,HC,,500,2000,2000,50,100,500,10,100,0,0
AXIS,,横移X轴,SideMove_X_Axis,3,HC,,500,2000,2000,50,100,500,10,100,0,0
AXIS,,横移Z轴,SideMove_Z_Axis,4,HC,,500,2000,2000,50,100,500,10,100,0,0
,,,,,,,,,,,,,,,,
PRO,10,入口伺服相对运动量,Line_Entry_Relative,4000,,,2000,,,,,,,,,
PRO,11,机内伺服相对运动量,Line_In_Relative,6300,,,2000,,,,,,,,,
PRO,12,皮带线出口定位待机点P1,ExitLine_Location_P1,0,,,2000,,,,,,,,,
PRO,12,皮带线出口定位7寸挡停,ExitLine_Location_7,0,,,2000,,,,,,,,,
PRO,12,皮带线出口定位13寸挡停,ExitLine_Location_13,0,,,2000,,,,,,,,,
PRO,12,皮带线出口定位15寸挡停,ExitLine_Location_15,0,,,2000,,,,,,,,,
PRO,13,横移X轴待机点P1,SideMove_X_P1,6300,,,2000,,,,,,,,,
PRO,13,横移X轴取料点P2,SideMove_X_P2,6300,,,2000,,,,,,,,,
PRO,13,横移X轴放料点P3,SideMove_X_P3,6300,,,2000,,,,,,,,,
PRO,14,横移Z轴待机点P1,SideMove_Z_P1,6300,,,2000,,,,,,,,,
PRO,14,横移Z轴取料点P2,SideMove_Z_P2,6300,,,2000,,,,,,,,,
PRO,14,横移Z轴放料点P3,SideMove_Z_P3,6300,,,2000,,,,,,,,,
,,,,,,,,,,,,,,,,
PRO,0,IO信号超时时间(秒),IOSingle_TimerOut,15,,,,,,,,,,,,
PRO,0,气压检测超时,AirCheckSeconds,5,,,,,,,,,,,,
PRO,30,相机名称,CameraName,GigE:MV-CE200-10GC (00E76280379),,,,,,,,,,,,
,,,,,,,,,,,,,,,,
PRO,31,左侧7寸料盘模拟量基准,Tray7_L_ADIO_base,-750,,,,,,,,,,,,
PRO,31,左侧13寸料盘模拟量基准,Tray13_L_ADIO_base,-750,,,,,,,,,,,,
PRO,31,左侧15寸料盘模拟量基准,Tray15_L_ADIO_base,-750,,,,,,,,,,,,
PRO,31,右侧7寸料盘模拟量基准,Tray7_R_ADIO_base,-750,,,,,,,,,,,,
PRO,31,右侧13寸料盘模拟量基准,Tray13_R_ADIO_base,-750,,,,,,,,,,,,
PRO,31,右侧15寸料盘模拟量基准,Tray15_R_ADIO_base,-750,,,,,,,,,,,,
PRO,32,料盘高度模拟量转换,Tray_ADIO_Value,86,,,,,,,,,,,,
,,,,,,,,,,,,,,,,
DI,0,急停(点料设备),SuddenStop_BTN,0,HC,X00,,,,,,,,,,
DI,0,复位,Reset_BTN,1,HC,X01,,,,,,,,,,
DI,0,启动,Start_BTN,2,HC,X02,,,,,,,,,,
DI,0,气压检测,Airpressure_Check,3,HC,X03,,,,,,,,,,
DI,0,点料机入口门打开端,Entry_Open,4,HC,X04,,,,,,,,,,
DI,0,点料机入口门关闭端,Entry_Close,5,HC,X05,,,,,,,,,,
DI,0,点料机出口门打开端,Exit_Open,6,HC,X06,,,,,,,,,,
DI,0,点料机出口门关闭端,Exit_Close,7,HC,X07,,,,,,,,,,
DI,0,点料机内部料盘检测,Tray_Inside_Check,8,HC,X08,,,,,,,,,,
DI,0,点料机门禁,Xray_Door_Check,9,HC,X09,,,,,,,,,,
DI,0,出料皮带线料盘检测,ExitLine_Reel_Check,10,HC,X10,,,,,,,,,,
DI,0,过渡横移吸盘压力检测,SideMove_SuckerReel_Check,11,HC,X11,,,,,,,,,,
,,,,,,,,,,,,,,,,
DI,0,上料区光栅检测,SafetyLightCurtains,16,HC,X16,,,,,,,,,,
DI,0,上料人工确认,Manual_Confirm_BTN,17,HC,X17,,,,,,,,,,
DI,0,上料区料盘检测,Tray_Check,18,HC,X18,,,,,,,,,,
DI,0,上料区7寸料盘检测,Tray7_Check,19,HC,X19,,,,,,,,,,
DI,0,上料区13寸料盘检测,Tray13_Check,20,HC,X20,,,,,,,,,,
DI,0,上料区15寸料盘检测,Tray15_Check,21,HC,X21,,,,,,,,,,
DI,0,上料区定位气缸上升端,Location_Cylinder_Up,22,HC,X22,,,,,,,,,,
DI,0,上料区定位气缸下降端,Location_Cylinder_Down,23,HC,X23,,,,,,,,,,
,,,,,,,,,,,,,,,,
DO,0,待机状态(指示灯),Standby_Led,0,HC,Y00,,,,,,,,,,
DO,0,运行状态(指示灯),Run_Led,1,HC,Y01,,,,,,,,,,
DO,0,故障状态(指示灯),Alarm_Led,2,HC,Y02,,,,,,,,,,
DO,0,故障状态(蜂鸣器),Alarm_Buzzer,3,HC,Y03,,,,,,,,,,
DO,0,出料皮带线启动,ExitLine_Reel_Run,4,HC,Y04,,,,,,,,,,
DO,0,X光机互锁信号ON,Xray_Lock,5,HC,Y05,,,,,,,,,,
DO,0,点料机入口门打开,Entry_Open,6,HC,Y06,,,,,,,,,,
DO,0,点料机入口门关闭,Entry_Close,7,HC,Y07,,,,,,,,,,
DO,0,点料机出口门打开,Exit_Open,8,HC,Y08,,,,,,,,,,
DO,0,点料机出口门关闭,Exit_Close,9,HC,Y09,,,,,,,,,,
DO,0,上料区定位气缸上升,Location_Cylinder_Up,10,HC,Y10,,,,,,,,,,
DO,0,上料区定位气缸下降,Location_Cylinder_Down,11,HC,Y11,,,,,,,,,,
DO,0,过渡横移吸盘吸料,SideMove_SuckerReel_On,12,HC,Y12,,,,,,,,,,
DO,0,过渡横移吸盘放料,SideMove_SuckerReel_Off,13,HC,Y13,,,,,,,,,,
,,,,,,,,,,,,,,,,
DO,0,上料区料盘检测OK,Pass_Led,16,HC,Y16,,,,,,,,,,
DO,0,上料区料盘检测NG,NG_Led,17,HC,Y17,,,,,,,,,,
DO,0,上料区相机光源打开,Camera_Led,18,HC,Y18,,,,,,,,,,
,,,,,,,,,,,,,,,,
ADIO,0,左侧7寸料盘模拟量检测,Tray7_L_ADIO,0,HC,A00,,,,,,,,,,
ADIO,0,左侧13寸料盘模拟量检测,Tray13_L_ADIO,1,HC,A01,,,,,,,,,,
ADIO,0,左侧15寸料盘模拟量检测,Tray15_L_ADIO,2,HC,A02,,,,,,,,,,
ADIO,0,右侧7寸料盘模拟量检测,Tray7_R_ADIO,4,HC,A03,,,,,,,,,,
ADIO,0,右侧13寸料盘模拟量检测,Tray13_R_ADIO,5,HC,A04,,,,,,,,,,
ADIO,0,右侧15寸料盘模拟量检测,Tray15_R_ADIO,6,HC,A05,,,,,,,,,,
......@@ -32,10 +32,15 @@
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup>
<StartupObject>
</StartupObject>
</PropertyGroup>
<PropertyGroup />
<ItemGroup>
<Reference Include="log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304, processorArchitecture=AMD64">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\增广夹爪\Rmaxis\bin\Debug\log4net.dll</HintPath>
<HintPath>..\SharedDLL\log4net.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
......@@ -48,22 +53,21 @@
</ItemGroup>
<ItemGroup>
<Compile Include="CSVExection.cs" />
<Compile Include="position\ACSAStorePosition.cs" />
<Compile Include="position\CSVPositionReader.cs" />
<Compile Include="position\CarReelPostion.cs" />
<Compile Include="position\StorePostionBase.cs" />
<Compile Include="Program.cs" />
<Compile Include="storeConfig\ConfigItemBase.cs" />
<Compile Include="storeConfig\ConfigProAttribute.cs" />
<Compile Include="storeConfig\config\Config_T1.cs" />
<Compile Include="storeConfig\config\Config_Filter.cs" />
<Compile Include="storeConfig\config\IO_T1_Type.cs" />
<Compile Include="storeConfig\config\IO_Filter_Type.cs" />
<Compile Include="storeConfig\config\IO_VALUE.cs" />
<Compile Include="storeConfig\config\Label_Config.cs" />
<Compile Include="storeConfig\config\IO_Label_Type.cs" />
<Compile Include="storeConfig\config\Config_XRay.cs" />
<Compile Include="storeConfig\config\IO_XRay_Type.cs" />
<Compile Include="storeConfig\config\Robot_Config.cs" />
<Compile Include="CSVAttribute.cs" />
<Compile Include="storeConfig\CSVConfigReader.cs" />
<Compile Include="CSVReaderBase.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="storeConfig\DeviceConfig.cs" />
<Compile Include="storeConfig\config\DeviceConfig.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Common\Common.csproj">
......@@ -71,6 +75,11 @@
<Name>Common</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="Config\XrayConfig.csv">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
......
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OnlineStore.LoadCSVLibrary
{
class Program
{
static void Main(string[] args)
{
string configFile = "config\\XrayConfig.csv";
var Config = new Config_XRay(0, "", configFile);
Config = (Config_XRay)CSVConfigReader.LoadConfig<IO_XRay_Type>(Config);
Console.Read();
}
}
}
......@@ -20,112 +20,28 @@ namespace OnlineStore.LoadCSVLibrary
/// <summary>
/// 中轴位置(旋转轴库位点)P2
/// </summary>
[CSVAttribute("中轴位置P2")]
public int MiddleAxis_Position_P2 { get; set; }
/// <summary>
/// 升降轴(库位出料前点)P5
/// </summary>
[CSVAttribute("升降轴库位出料前点P5")]
public int UpDownAxis_OHPosition_P5 { get; set; }
/// <summary>
/// 升降轴(库位出料缓冲点)P6
/// </summary>
[CSVAttribute("升降轴库位出料缓冲点P6")]
public int UpDownAxis_OLPosition_P6 { get; set; }
[CSVAttribute("旋转轴位置P2"), Editable(0)]
public int XAxis_Position_P2 { get; set; }
/// <summary>
/// 升降轴(库位入料前点)P3
/// </summary>
[CSVAttribute("升降轴库位入料前点P3")]
[CSVAttribute("升降轴库位入料高点P3"), Editable(1)]
public int UpDownAxis_IHPosition_P3 { get; set; }
/// <summary>
/// 升降轴(库位入料缓冲点)P4
/// </summary>
[CSVAttribute("升降轴库位入料缓冲点P4")]
[CSVAttribute("升降轴库位入料低点P4"), Editable(1)]
public int UpDownAxis_ILPosition_P4 { get; set; }
/// <summary>
/// 进出轴(库位点取料点)P3
/// </summary>
[CSVAttribute("进出轴库位点取料点P3")]
[CSVAttribute("进出轴库位点取料点P3"), Editable(2)]
public int InOutAxis_Position_P3 { get; set; }
/// <summary>
/// 压紧轴(压紧点)P2
/// </summary>
[CSVAttribute("压紧轴压紧点P2")]
public int CompressAxis_Position_P2 { get; set; }
/// <summary>
/// 压紧轴(压紧前点)P3
/// </summary>
[CSVAttribute("压紧轴压紧前点P3")]
public int CompressAxis_CPosition_P3 { get; set; }
/// <summary>
/// 轴3(进出轴) 进料口取料点P2
/// </summary>
[CSVAttribute("进出轴进料口取料点P2")]
public int InOutAxis_DoorPosition_P2 { get; set; }
public static bool CheckPosition(ACStorePosition position, AC_SA_Config Config)
{
try
{
if (Config.Middle_Axis.PositionIsHasLimit())
{
int mMin = Config.Middle_Axis.PositionMin;
int mMax = Config.Middle_Axis.PositionMax;
if (mMin > position.MiddleAxis_Position_P2 || mMax < position.MiddleAxis_Position_P2)
{
LogUtil.error(position.PositionNum + " MiddleAxis_Position_P2位置超出" + Config.Middle_Axis.Explain + "上下限(" + mMin + "-" + mMax + ")");
return false;
}
}
if (Config.InOut_Axis.PositionIsHasLimit())
public static bool CheckPosition(ACStorePosition position, Robot_Config Config)
{
int iMin = Config.InOut_Axis.PositionMin;
int iMax = Config.InOut_Axis.PositionMax;
if (iMin > position.InOutAxis_DoorPosition_P2 || iMax < position.InOutAxis_DoorPosition_P2)
{
LogUtil.error(position.PositionNum + " InOutAxis_DoorPosition_P2位置超出" + Config.InOut_Axis.Explain + "上下限(" + iMin + "-" + iMax + ")");
return false;
}
if (iMin > position.InOutAxis_Position_P3 || iMax < position.InOutAxis_Position_P3)
{
LogUtil.error(position.PositionNum + " InOutAxis_Position_P3位置超出" + Config.InOut_Axis.Explain + "上下限(" + iMin + "-" + iMax + ")");
return false;
}
}
if (Config.UpDown_Axis.PositionIsHasLimit())
{
int uMin = Config.UpDown_Axis.PositionMin;
int uMax = Config.UpDown_Axis.PositionMax;
if (uMin > position.UpDownAxis_IHPosition_P3 || uMax < position.UpDownAxis_IHPosition_P3)
{
LogUtil.error(position.PositionNum + " UpDownAxis_IHPosition_P3位置超出" + Config.UpDown_Axis.Explain + "上下限(" + uMin + "-" + uMax + ")");
return false;
}
if (uMin > position.UpDownAxis_ILPosition_P4 || uMax < position.UpDownAxis_ILPosition_P4)
{
LogUtil.error(position.PositionNum + " UpDownAxis_ILPosition_P4位置超出" + Config.UpDown_Axis.Explain + "上下限(" + uMin + "-" + uMax + ")");
return false;
}
if (uMin > position.UpDownAxis_OHPosition_P5 || uMax < position.UpDownAxis_OHPosition_P5)
{
LogUtil.error(position.PositionNum + " UpDownAxis_OHPosition_P5位置超出" + Config.UpDown_Axis.Explain + "上下限(" + uMin + "-" + uMax + ")");
return false;
}
if (uMin > position.UpDownAxis_OLPosition_P6 || uMax < position.UpDownAxis_OLPosition_P6)
{
LogUtil.error(position.PositionNum + " UpDownAxis_OLPosition_P6位置超出" + Config.UpDown_Axis.Explain + "上下限(" + uMin + "-" + uMax + ")");
return false;
}
}
}
catch (Exception ex)
{
LogUtil.error("验证" + position.PositionNum + "的位置范围出错:" + ex.ToString());
}
return true;
}
......

using log4net;
using OnlineStore.Common;
using System;
using System.Collections.Generic;
using System.Data;
......@@ -11,7 +12,7 @@ using System.Text;
namespace OnlineStore.LoadCSVLibrary
{
public class CSVPositionReader<T> : CSVReaderBase where T : StorePostionBase
public class CSVPositionReader<T> : CSVReaderBase where T: StorePostionBase
{
/// <summary>
/// 所有的位置集合,key=位置
......@@ -128,6 +129,79 @@ namespace OnlineStore.LoadCSVLibrary
}
return result;
}
public static Dictionary<String, T> LoadCSVFile(string filePath)
{
Type type = typeof(T);
Dictionary<string, string> proTitleMap = getProAttributeMap(typeof(T));
if (proTitleMap.Count <= 4)
{
LOGGER.Error(typeof(T).ToString() + "只读取到" + proTitleMap.Count + "个属性");
}
List<string> cvsTitleList = new List<string>(proTitleMap.Values);
List<string> propertyList = new List<string>(proTitleMap.Keys);
Dictionary<String, T> result = new Dictionary<String, T>();
string[] lines = ReadCSVFile(filePath);
int index = 0;
Dictionary<string, int> titleIndex = new Dictionary<string, int>();
foreach (var line in lines)
{
var array = line.Split(Spilt_Char);
if (index == 0)
{
titleIndex = GetTitleIndex(line, cvsTitleList);
}
else
{
try
{
if (array.Length >= titleIndex.Count)
{
if (array.Length > 0 && array[0].Equals(""))
{
continue;
}
var bllIns = type.Assembly.CreateInstance(type.FullName);
//取得属性集合
PropertyInfo[] props = type.GetProperties();
int listIndex = 0;
string PositionNum = "";
foreach (string key in cvsTitleList)
{
int titIndex = titleIndex[key];
string value = array[titIndex];
string proName = propertyList[listIndex];
PropertyInfo prop = props.First(c => c.Name == proName);//获取同名属性
if (prop != null)
{//如果属性存在
prop.SetValue(bllIns, Convert.ChangeType(value, prop.PropertyType), null);//赋值****在这里需要考虑类型问题
}
if (proName.Equals("PositionNum"))
{
PositionNum = value;
}
listIndex++;
}
result.Add(PositionNum, (T)bllIns);
}
else
{
LOGGER.Error("读取csv,index=" + index + ",数据格式不匹配!,line=" + line);
}
}
catch (Exception ex)
{
LOGGER.Debug("CSV 读取行【" + line + "】行转换失败");
}
}
index++;
}
return result;
}
/// <summary>
/// 根据Key获得一个位置信息
/// </summary>
......@@ -135,6 +209,7 @@ namespace OnlineStore.LoadCSVLibrary
{
if (positionNum == null)
{
LogUtil.info($"库位名称为空");
return null;
}
StorePostionBase result = null;
......@@ -145,15 +220,14 @@ namespace OnlineStore.LoadCSVLibrary
}
else
{
LogUtil.info($"未找到库位:{positionNum}");
return null;
}
}
public static bool SavePostion(string filePath, T position)
{
Type type = typeof(T);
Dictionary<string, string> proTitleMap = getProAttributeMap(typeof(T));
Dictionary<string, string> proTitleMap = getProAttributeMap(position.GetType());
if (proTitleMap.Count <= 4)
{
LOGGER.Error(typeof(T).ToString() + "只读取到" + proTitleMap.Count + "个属性");
......@@ -175,7 +249,7 @@ namespace OnlineStore.LoadCSVLibrary
}
else
{
if (array.Length == titleIndex.Count)
if (array.Length >= titleIndex.Count)
{
if (csvIndex < 0)
{
......@@ -184,9 +258,6 @@ namespace OnlineStore.LoadCSVLibrary
string value = array[csvIndex];
if (value.Equals(position.PositionNum))
{
//更新缓存
allPositionMap.Remove(position.PositionNum);
allPositionMap.Add(position.PositionNum, position);
string newValue = PostionToString(position, titleIndex, proTitleMap);
lines[index] = newValue;
return WriteCSVFile(filePath, lines);
......@@ -231,27 +302,6 @@ namespace OnlineStore.LoadCSVLibrary
return newStr;
}
//private void ReadTest( )
//{
// Dictionary<string, string> dic = new Dictionary<string, string>();
// string path = Application.StartupPath + @"\Test.csv";
// dic.Add("AxisPosition", "中轴位置");
// dic.Add("ModbusHighPosition", "电钢高位");
// dic.Add("ModbusLowPosition", "电钢低位");
// Dictionary<string, KTKStorePostion> ddd = LoadCVSLibrary.CSVReaderHelper<KTKStorePostion>.ReadCVS(path, dic, typeof(KTKStorePostion));
// if (ddd != null)
// {
// MessageBox.Show("读取成功!");
// }
// else
// {
// MessageBox.Show("读取失败,请检查数据格式!");
// }
//}
}
......
......@@ -2,24 +2,27 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OnlineStore.LoadCSVLibrary
{
public enum IO_VALUE
public class StringPostion :StorePostionBase
{
/// <summary>
/// 未知
/// 上料X轴
/// </summary>
None = -1,
[CSVAttribute("上料X轴"),Editable(1)]
public int X_P2 { get; set; }
/// <summary>
/// 低位
/// 上料Y轴
/// </summary>
LOW = 0,
[CSVAttribute("上料Y轴"), Editable(2)]
public int Y_P2 { get; set; }
/// <summary>
/// 高位
/// 上料Z轴
/// </summary>
HIGH = 1,
[CSVAttribute("上料Z轴"), Editable(3)]
public int Z_P2 { get; set; }
}
}
......@@ -13,20 +13,12 @@ namespace OnlineStore.LoadCSVLibrary
/// </summary>
[CSVAttribute("位置")]
public string PositionNum { get; set; }
/// <summary>
/// 优先级
/// </summary>
[CSVAttribute("优先级")]
public int Priority { get; set; }
/// <summary>
/// 高
/// </summary>
[CSVAttribute("高度")]
public int BagHigh { get; set; }
/// <summary>
/// 宽
/// 备注
/// </summary>
[CSVAttribute("宽度")]
public int BagWidth { get; set; }
[CSVAttribute("备注")]
public string memo { get; set; }
}
}
using OnlineStore.Common;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
......@@ -139,10 +140,9 @@ namespace OnlineStore.LoadCSVLibrary
public static DeviceConfig LoadConfig<T>(DeviceConfig config)
{
LogUtil.info("开始读取文件:" + config.ConfigFilePath);
if (config == null || config.ConfigFilePath.Equals(""))
if (config == null || !File.Exists(config.ConfigFilePath))
{
throw new Exception("没有配置配置文件路径");
//return null;
throw new Exception("没有找到配置文件:"+ config.ConfigFilePath);
}
List<ConfigBase> configBasesList = ReadConfig(config.ConfigFilePath);
config.LoadConfig<T>(configBasesList);
......
......@@ -65,6 +65,10 @@ namespace OnlineStore.LoadCSVLibrary
public class ConfigMoveAxis : ConfigBase
{
/// <summary>
/// 屏蔽伺服
/// </summary>
public bool Disable = false;
/// <summary>
/// 伺服ON的Do信号
/// </summary>
public string ServerOnDO = "";
......@@ -113,7 +117,7 @@ namespace OnlineStore.LoadCSVLibrary
}
public bool IsSameAxis(string portName, int slv)
{
if (DeviceName.Equals(portName) && slv.Equals(GetAxisValue()))
if (slv.Equals(GetAxisValue()))
{
return true;
}
......@@ -172,10 +176,7 @@ namespace OnlineStore.LoadCSVLibrary
{
get
{
return ElectricalDefinition + "-" + Explain + "-" + ProName + "";
}
set
{
return ElectricalDefinition + "-" + Explain;// + "-" + ProName + "";
}
}
ushort value = 0;
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace OnlineStore.LoadCSVLibrary
{
public class AC_SA_Config : StoreConfig
{
public AC_SA_Config()
: base()
{
}
public AC_SA_Config(int id, string cid, string type, string filepath)
: base(id, cid, type, filepath)
{
}
/// <summary>
/// 预警温度
/// </summary>
[ConfigProAttribute("WarnTemperate")]
public int WarnTemperate { get; set; }
/// <summary>
/// 预警湿度
/// </summary>
[ConfigProAttribute("WarnHumidity")]
public int WarnHumidity { get; set; }
/// <summary>
/// 气压检测IO关闭需要持续的时间(=3表示需要关闭三秒以上才算关闭)
/// </summary>
[ConfigProAttribute("AirCheckSeconds")]
public int AirCheckSeconds { get; set; }
/// <summary>
/// IsHasCompress_Axis是否使用压紧轴
/// </summary>
[ConfigProAttribute("IsHasCompress_Axis")]
public int IsHasCompress_Axis { get; set; }
/// <summary>
/// PRO 是否使用定位气缸 IsHasLocationCylinder 0
/// </summary>
[ConfigProAttribute("IsHasLocationCylinder")]
public int IsHasLocationCylinder { get; set; }
/// <summary>
/// PRO 是否有左右侧门 IsHasDoorLimit 0
/// </summary>
[ConfigProAttribute("IsHasDoorLimit")]
public int IsHasDoorLimit { get; set; }
/// <summary>
/// PRO 扫码枪IP Scanner_Ip 192.168.200.13
/// </summary>
[ConfigProAttribute("Scanner_Ip",false)]
public string Scanner_Ip { get; set; }
/// <summary>
/// PRO 扫码枪端口号 Scanner_Port 51236
/// </summary>
[ConfigProAttribute("Scanner_Port",false)]
public int Scanner_Port { get; set; }
/// <summary>
/// PRO (轴一)旋转轴原点目标速度 MiddleAxis_TargetSpeed 30000
/// </summary>
[ConfigProAttribute("MiddleAxis_TargetSpeed")]
public int MiddleAxis_TargetSpeed { get; set; }
/// <summary>
/// PRO (轴一)旋转轴加速度 MiddleAxis_AddSpeed 500
/// </summary>
[ConfigProAttribute("MiddleAxis_AddSpeed")]
public short MiddleAxis_AddSpeed { get; set; }
/// <summary>
/// PRO (轴一)旋转轴减速度 MiddleAxis_DelSpeed 500
/// </summary>
[ConfigProAttribute("MiddleAxis_DelSpeed")]
public short MiddleAxis_DelSpeed { get; set; }
/// <summary>
/// PRO (轴二)升降轴轴原点目标速度 UpdownAxis_TargetSpeed 120000
/// </summary>
[ConfigProAttribute("UpdownAxis_TargetSpeed")]
public int UpdownAxis_TargetSpeed { get; set; }
/// <summary>
/// PRO (轴二)升降轴轴加速度 UpdownAxis_AddSpeed 200
/// </summary>
[ConfigProAttribute("UpdownAxis_AddSpeed")]
public short UpdownAxis_AddSpeed { get; set; }
/// <summary>
/// PRO (轴二)升降轴轴减速度 UpdownAxis_DelSpeed 200
/// </summary>
[ConfigProAttribute("UpdownAxis_DelSpeed")]
public short UpdownAxis_DelSpeed { get; set; }
/// <summary>
/// PRO (轴三)进出轴原点目标速度 InoutAxis_TargetSpeed 12000
/// </summary>
[ConfigProAttribute("InoutAxis_TargetSpeed")]
public int InoutAxis_TargetSpeed { get; set; }
/// <summary>
/// PRO (轴三)进出轴加速度 InoutAxis_AddSpeed 200
/// </summary>
[ConfigProAttribute("InoutAxis_AddSpeed")]
public short InoutAxis_AddSpeed { get; set; }
/// <summary>
/// PRO (轴三)进出轴减速度 InoutAxis_DelSpeed 200
/// </summary>
[ConfigProAttribute("InoutAxis_DelSpeed")]
public short InoutAxis_DelSpeed { get; set; }
/// <summary>
/// PRO (轴一)旋转轴原点低速度 MiddleAxis_HomeLowSpeed 50
/// </summary>
[ConfigProAttribute("MiddleAxis_HomeLowSpeed")]
public short MiddleAxis_HomeLowSpeed { get; set; }
/// <summary>
/// PRO (轴一)旋转轴原点高速 MiddleAxis_HomeHighSpeed 100
/// </summary>
[ConfigProAttribute("MiddleAxis_HomeHighSpeed")]
public short MiddleAxis_HomeHighSpeed { get; set; }
/// <summary>
/// PRO (轴一)旋转轴原点加速度 MiddleAxis_HomeAddSpeed 30
/// </summary>
[ConfigProAttribute("MiddleAxis_HomeAddSpeed")]
public short MiddleAxis_HomeAddSpeed { get; set; }
/// <summary>
/// PRO (轴二)升降轴轴原点低速度 UpdownAxis_HomeLowSpeed 50
/// </summary>
[ConfigProAttribute("UpdownAxis_HomeLowSpeed")]
public short UpdownAxis_HomeLowSpeed { get; set; }
/// <summary>
/// PRO (轴二)升降轴轴原点高速 UpdownAxis_HomeHighSpeed 100
/// </summary>
[ConfigProAttribute("UpdownAxis_HomeHighSpeed")]
public short UpdownAxis_HomeHighSpeed { get; set; }
/// <summary>
/// PRO (轴二)升降轴轴原点加速度 UpdownAxis_HomeAddSpeed 30
/// </summary>
[ConfigProAttribute("UpdownAxis_HomeAddSpeed")]
public short UpdownAxis_HomeAddSpeed { get; set; }
/// <summary>
/// PRO (轴三)进出轴原点低速 InoutAxis_HomeLowSpeed 50
/// </summary>
[ConfigProAttribute("InoutAxis_HomeLowSpeed")]
public short InoutAxis_HomeLowSpeed { get; set; }
/// <summary>
/// PRO (轴三)进出轴原点高速 InoutAxis_HomeHighSpeed 100
/// </summary>
[ConfigProAttribute("InoutAxis_HomeHighSpeed")]
public short InoutAxis_HomeHighSpeed { get; set; }
/// <summary>
/// PRO (轴三)进出轴原点加速度 InoutAxis_HomeAddSpeed 30
/// </summary>
[ConfigProAttribute("InoutAxis_HomeAddSpeed")]
public short InoutAxis_HomeAddSpeed { get; set; }
/// <summary>
/// PRO 升降轴(轴2)P1速度 UpDownAxis_P1_Speed
/// </summary>
[ConfigProAttribute("UpDownAxis_P1_Speed")]
public int UpDownAxis_P1_Speed { get; set; }
/// <summary>
/// PRO 升降轴(轴2)P2速度 UpDownAxis_P2_Speed
/// </summary>
[ConfigProAttribute("UpDownAxis_P2_Speed")]
public int UpDownAxis_P2_Speed { get; set; }
/// <summary>
/// PRO 升降轴(轴2)P3速度 UpDownAxis_P3_Speed
/// </summary>
[ConfigProAttribute("UpDownAxis_P3_Speed")]
public int UpDownAxis_P3_Speed { get; set; }
/// <summary>
/// PRO 升降轴(轴2)P4速度 UpDownAxis_P4_Speed
/// </summary>
[ConfigProAttribute("UpDownAxis_P4_Speed")]
public int UpDownAxis_P4_Speed { get; set; }
/// <summary>
/// PRO 升降轴(轴2)P5速度 UpDownAxis_P5_Speed
/// </summary>
[ConfigProAttribute("UpDownAxis_P5_Speed")]
public int UpDownAxis_P5_Speed { get; set; }
/// <summary>
/// PRO 升降轴(轴2)P6速度 UpDownAxis_P6_Speed
/// </summary>
[ConfigProAttribute("UpDownAxis_P6_Speed")]
public int UpDownAxis_P6_Speed { get; set; }
/// <summary>
/// PRO 升降轴(轴2)P7速度 UpDownAxis_P7_Speed
/// </summary>
[ConfigProAttribute("UpDownAxis_P7_Speed")]
public int UpDownAxis_P7_Speed { get; set; }
/// <summary>
/// PRO 升降轴(轴2)P8速度 UpDownAxis_P8_Speed
/// </summary>
[ConfigProAttribute("UpDownAxis_P8_Speed")]
public int UpDownAxis_P8_Speed { get; set; }
/// <summary>
/// PRO 旋转轴(轴1)P1速度 MiddleAxis_P1_Speed
/// </summary>
[ConfigProAttribute("MiddleAxis_P1_Speed")]
public int MiddleAxis_P1_Speed { get; set; }
/// <summary>
/// PRO 旋转轴(轴1)P2速度 MiddleAxis_P2_Speed
/// </summary>
[ConfigProAttribute("MiddleAxis_P2_Speed")]
public int MiddleAxis_P2_Speed { get; set; }
/// <summary>
/// PRO 进出轴(轴3)P1速度 InOutAxis_P1_Speed
/// </summary>
[ConfigProAttribute("InOutAxis_P1_Speed")]
public int InOutAxis_P1_Speed { get; set; }
/// <summary>
/// PRO 进出轴(轴3)P2速度 InOutAxis_P2_Speed
/// </summary>
[ConfigProAttribute("InOutAxis_P2_Speed")]
public int InOutAxis_P2_Speed { get; set; }
/// <summary>
/// PRO 进出轴(轴3)P3速度 InOutAxis_P3_Speed
/// </summary>
[ConfigProAttribute("InOutAxis_P3_Speed")]
public int InOutAxis_P3_Speed { get; set; }
/// <summary>
/// PRO (轴一)旋转轴停止时可误差的脉冲数的最小值 MiddleAxis_ErrorCountMin 200
/// </summary>
[ConfigProAttribute("MiddleAxis_ErrorCountMin")]
public int MiddleAxis_ErrorCountMin { get; set; }
/// <summary>
/// PRO (轴二)升降轴轴停止时可误差的脉冲数的最小值 UpdownAxis_ErrorCountMin 200
/// </summary>
[ConfigProAttribute("UpdownAxis_ErrorCountMin")]
public int UpdownAxis_ErrorCountMin { get; set; }
/// <summary>
/// PRO (轴三)进出轴停止时可误差的脉冲数的最小值 InoutAxis_ErrorCountMin 200
/// </summary>
[ConfigProAttribute("InoutAxis_ErrorCountMin")]
public int InoutAxis_ErrorCountMin { get; set; }
/// <summary>
/// PRO (轴一)旋转轴停止时可误差的脉冲数的最大值 MiddleAxis_ErrorCountMax 500
/// </summary>
[ConfigProAttribute("MiddleAxis_ErrorCountMax")]
public int MiddleAxis_ErrorCountMax { get; set; }
/// <summary>
/// PRO (轴二)升降轴轴停止时可误差的脉冲数的最大值 UpdownAxis_ErrorCountMax 500
/// </summary>
[ConfigProAttribute("UpdownAxis_ErrorCountMax")]
public int UpdownAxis_ErrorCountMax { get; set; }
/// <summary>
/// PRO (轴三)进出轴停止时可误差的脉冲数的最大值 InoutAxis_ErrorCountMax 500
/// </summary>
[ConfigProAttribute("InoutAxis_ErrorCountMax")]
public int InoutAxis_ErrorCountMax { get; set; }
/// <summary>
/// PRO,BOX出入库次数多少次时,会自动重置旋转轴,Box_ResetMCount,10,,,,,
/// </summary>
[ConfigProAttribute("Box_ResetMCount")]
public int Box_ResetMCount { get; set; }
/// <summary>
/// PRO,BOX出入库次数多少次时,会自动重置操作(会重置所有轴),Box_ResetACount,100,,,,,
/// </summary>
[ConfigProAttribute("Box_ResetACount")]
public int Box_ResetACount { get; set; }
/// <summary>
/// PRO IO信号超时时间(毫秒) IOSingle_TimerOut 5000
/// </summary>
[ConfigProAttribute("IOSingle_TimerOut", false)]
public int IOSingle_TimerOut { get; set; }
/// <summary>
/// 升降轴 进料口取料点 P1
/// </summary>
[ConfigProAttribute("UpDownAxis_DoorOPosition_P1")]
public int UpDownAxis_DoorOPosition_P1 { get; set; }
/// <summary>
/// 升降轴 进料口出料前点 P2
/// </summary>
[ConfigProAttribute("UpDownAxis_DoorIPosition_P2")]
public int UpDownAxis_DoorIPosition_P2 { get; set; }
/// <summary>
/// 升降轴 进料口取料缓冲点 P7
/// </summary>
[ConfigProAttribute("UpDownAxis_DoorOBPosition_P7")]
public int UpDownAxis_DoorOBPosition_P7 { get; set; }
/// <summary>
/// 升降轴 进料口出料缓冲点 P8
/// </summary>
[ConfigProAttribute("UpDownAxis_DoorIBPosition_P8")]
public int UpDownAxis_DoorIBPosition_P8 { get; set; }
/// <summary>
/// PRO 旋转轴(轴1)P1 待机原位点 MiddleAxis_P1_Position
/// </summary>
[ConfigProAttribute("MiddleAxis_P1_Position")]
public int MiddleAxis_P1_Position { get; set; }
/// <summary>
/// PRO 进出轴(轴3)P1待机原位点 InOutAxis_P1_Position
/// </summary>
[ConfigProAttribute("InOutAxis_P1_Position")]
public int InOutAxis_P1_Position { get; set; }
/// <summary>
/// PRO 押金轴(轴4)P1待机原位点 CompressAxis_P1_Position
/// </summary>
[ConfigProAttribute("CompressAxis_P1_Position")]
public int CompressAxis_P1_Position { get; set; }
/// <summary>
/// PRO 是否使用料盘检测信号 IsUse_Tray_Check
/// </summary>
[ConfigProAttribute("IsUse_Tray_Check")]
public int IsUse_Tray_Check { get; set; }
/// <summary>
/// 设备是否处于调试状态(1=调试,0=正常)
/// </summary>
[ConfigProAttribute("IsInDebug")]
public int IsInDebug { get; set; }
/// <summary>
///轴2升降轴 运动上下轴
/// </summary>
[ConfigProAttribute("UpDown_Axis")]
public ConfigMoveAxis UpDown_Axis { get; set; }
/// <summary>
/// 轴1旋转轴 运动中轴
/// </summary>
[ConfigProAttribute("Middle_Axis")]
public ConfigMoveAxis Middle_Axis { get; set; }
/// <summary>
/// 轴3进出轴
/// </summary>
[ConfigProAttribute("InOut_Axis")]
public ConfigMoveAxis InOut_Axis { get; set; }
/// <summary>
/// 轴3压紧轴
/// </summary>
[ConfigProAttribute("Comp_Axis")]
public ConfigMoveAxis Comp_Axis { get; set; }
/// <summary>
/// PRO (轴四)压紧轴目标速度 CompAxis_TargetSpeed 100
/// </summary>
[ConfigProAttribute("CompAxis_TargetSpeed")]
public int CompAxis_TargetSpeed { get; set; }
/// <summary>
/// PRO (轴四)压紧轴加速度 CompAxis_AddSpeed 300
/// </summary>
[ConfigProAttribute("CompAxis_AddSpeed")]
public short CompAxis_AddSpeed { get; set; }
/// <summary>
/// PRO (轴四)压紧轴减速度 CompAxis_DelSpeed 300
/// </summary>
[ConfigProAttribute("CompAxis_DelSpeed")]
public short CompAxis_DelSpeed { get; set; }
/// <summary>
/// PRO (轴四)压紧轴原点低速 CompAxis_HomeLowSpeed 20
/// </summary>
[ConfigProAttribute("CompAxis_HomeLowSpeed")]
public int CompAxis_HomeLowSpeed { get; set; }
/// <summary>
/// PRO (轴四)压紧轴原点高速 CompAxis_HomeHighSpeed 60
/// </summary>
[ConfigProAttribute("CompAxis_HomeHighSpeed")]
public int CompAxis_HomeHighSpeed { get; set; }
/// <summary>
/// PRO (轴四)压紧轴原点加速度 CompAxis_HomeAddSpeed 200
/// </summary>
[ConfigProAttribute("CompAxis_HomeAddSpeed")]
public int CompAxis_HomeAddSpeed { get; set; }
/// <summary>
/// PRO (轴一)旋转轴最小限位 MiddleAxis_PositionMin
/// </summary>
[ConfigProAttribute("MiddleAxis_PositionMin", false)]
public int MiddleAxis_PositionMin { get; set; }
/// <summary>
/// PRO (轴二)升降轴最小限位 UpdownAxis_PositionMin
/// </summary>
[ConfigProAttribute("UpdownAxis_PositionMin", false)]
public int UpdownAxis_PositionMin { get; set; }
/// <summary>
/// PRO (轴三)进出轴最小限位 InoutAxis_PositionMin
/// </summary>
[ConfigProAttribute("InoutAxis_PositionMin", false)]
public int InoutAxis_PositionMin { get; set; }
/// <summary>
/// PRO (轴一)旋转轴最大限位 MiddleAxis_PositionMax
/// </summary>
[ConfigProAttribute("MiddleAxis_PositionMax", false)]
public int MiddleAxis_PositionMax { get; set; }
/// <summary>
/// PRO (轴二)升降轴最大限位 UpdownAxis_PositionMax
/// </summary>
[ConfigProAttribute("UpdownAxis_PositionMax", false)]
public int UpdownAxis_PositionMax { get; set; }
/// <summary>
/// PRO (轴三)进出轴最大限位 InoutAxis_PositionMax
/// </summary>
[ConfigProAttribute("InoutAxis_PositionMax", false)]
/// <summary>
/// PRO 需要吹气的温度(温度标准) Max_Temperature 10
/// </summary>
[ConfigProAttribute("Max_Temperature", false)]
public int Max_Temperature { get; set; }
/// <summary>
/// PRO 需要吹气的湿度(湿度标准) Max_Humidity 10
/// </summary>
[ConfigProAttribute("Max_Humidity", false)]
public int Max_Humidity { get; set; }
/// <summary>
/// PRO 每次吹气的时间(分钟) BlowAir_Time 10
/// </summary>
[ConfigProAttribute("BlowAir_Time", false)]
public int BlowAir_Time { get; set; }
/// <summary>
/// PRO 两次吹气间隔(分钟) BlowAir_Interval 10
/// </summary>
[ConfigProAttribute("BlowAir_Interval", false)]
public int BlowAir_Interval { get; set; }
public int InoutAxis_PositionMax { get; set; }
/// <summary>
/// PRO,温湿度端口号,Humiture_Port,COM1,,,,,,,
/// </summary>
[ConfigProAttribute("Humiture_Port", true )]
public string Humiture_Port { get; set; }
/// <summary>
/// PRO 模拟量IO模块的IP地址 AIDevice_IP 192.168.200.11
/// </summary>
[ConfigProAttribute("AIDevice_IP", true)]
public string AIDevice_IP { get; set; }
/// <summary>
/// PRO,模拟信号1默认高度,AIDI1_DefaultPosition,1,,,,,,,
/// </summary>
[ConfigProAttribute("AIDI1_DefaultPosition", true)]
public double AIDI1_DefaultPosition { get; set; }
/// <summary>
/// PRO,模拟信号2默认高度,AIDI2_DefaultPosition,1,,,,,,,
/// </summary>
[ConfigProAttribute("AIDI2_DefaultPosition", true)]
public double AIDI2_DefaultPosition { get; set; }
/// <summary>
/// PRO,模拟信号3默认高度,AIDI3_DefaultPosition,1,,,,,,,
/// </summary>
[ConfigProAttribute("AIDI3_DefaultPosition", false )]
public double AIDI3_DefaultPosition { get; set; }
/// <summary>
/// PRO,模拟信号4默认高度,AIDI4_DefaultPosition,1,,,,,,,
/// </summary>
[ConfigProAttribute("AIDI4_DefaultPosition", false )]
public double AIDI4_DefaultPosition { get; set; }
/// <summary>
/// PRO 模拟信号1的地址 AIDI1_Addr 7
/// </summary>
[ConfigProAttribute("AIDI1_Addr", true)]
public int AIDI1_Addr { get; set; }
/// <summary>
/// PRO 模拟信号2的地址 AIDI2_Addr 8
/// </summary>
[ConfigProAttribute("AIDI2_Addr", true)]
public int AIDI2_Addr { get; set; }
/// <summary>
/// PRO 模拟信号3的地址 AIDI3_Addr 5
/// </summary>
[ConfigProAttribute("AIDI3_Addr", false )]
public int AIDI3_Addr { get; set; }
/// <summary>
/// PRO 模拟信号4的地址 AIDI4_Addr 6
/// </summary>
[ConfigProAttribute("AIDI4_Addr", false )]
public int AIDI4_Addr { get; set; }
/// <summary>
/// PRO IO模块对应的DI数量 IO_DILength 192.168.200.10#16;192.168.200.11#4
/// </summary>
[ConfigProAttribute("IO_DILength")]
public string IO_DILength { get; set; }
/// <summary>
/// PRO 模块对应的DO数量 IO_DOLength 192.168.200.10#16;192.168.200.11#4
/// </summary>
[ConfigProAttribute("IO_DOLength")]
public string IO_DOLength { get; set; }
protected override void initMustHavePro()
{
MustHaveDIList = new List<string>();
MustHaveDOList = new List<string>();
MustHaveDIList.Add(IO_Type.SuddenStop_BTN);
MustHaveDIList.Add(IO_Type.Reset_BTN);
MustHaveDIList.Add(IO_Type.AutoRun_Signal);
MustHaveDIList.Add(IO_Type.Airpressure_Check);
MustHaveDIList.Add(IO_Type.TrayCheck_Door);
MustHaveDIList.Add(IO_Type.TrayCheck_Fixture);
MustHaveDIList.Add(IO_Type.Door_Up);
MustHaveDIList.Add(IO_Type.Door_Down);
MustHaveDOList.Add(IO_Type.AutoRun_HddLed);
MustHaveDOList.Add(IO_Type.Alarm_HddLed);
MustHaveDOList.Add(IO_Type.RunSign_HddLed);
MustHaveDOList.Add(IO_Type.StartOrStopBlow);
MustHaveDOList.Add(IO_Type.Run_Signal);
MustHaveDOList.Add(IO_Type.Door_Up);
MustHaveDOList.Add(IO_Type.Door_Down);
MustHaveDOList.Add(IO_Type.Axis_Brake);
}
public static void ConfigAxis(AC_SA_Config Config)
{
Config.Middle_Axis.TargetSpeed = Config.MiddleAxis_TargetSpeed;
Config.Middle_Axis.AddSpeed = Config.MiddleAxis_AddSpeed;
Config.Middle_Axis.DelSpeed = Config.MiddleAxis_DelSpeed;
Config.Middle_Axis.HomeAddSpeed = Config.MiddleAxis_HomeAddSpeed;
Config.Middle_Axis.HomeHighSpeed = Config.MiddleAxis_HomeHighSpeed;
Config.Middle_Axis.HomeLowSpeed = Config.MiddleAxis_HomeLowSpeed;
Config.InOut_Axis.TargetSpeed = Config.InoutAxis_TargetSpeed;
Config.InOut_Axis.DelSpeed = Config.InoutAxis_AddSpeed;
Config.InOut_Axis.AddSpeed = Config.InoutAxis_DelSpeed;
Config.InOut_Axis.HomeAddSpeed = Config.InoutAxis_HomeAddSpeed;
Config.InOut_Axis.HomeHighSpeed = Config.InoutAxis_HomeHighSpeed;
Config.InOut_Axis.HomeLowSpeed = Config.InoutAxis_HomeLowSpeed;
Config.UpDown_Axis.TargetSpeed = Config.UpdownAxis_TargetSpeed;
Config.UpDown_Axis.AddSpeed = Config.UpdownAxis_AddSpeed;
Config.UpDown_Axis.DelSpeed = Config.UpdownAxis_DelSpeed;
Config.UpDown_Axis.HomeAddSpeed = Config.UpdownAxis_HomeAddSpeed;
Config.UpDown_Axis.HomeHighSpeed = Config.UpdownAxis_HomeHighSpeed;
Config.UpDown_Axis.HomeLowSpeed = Config.UpdownAxis_HomeLowSpeed;
Config.Comp_Axis.TargetSpeed = Config.CompAxis_TargetSpeed;
Config.Comp_Axis.AddSpeed = Config.CompAxis_AddSpeed;
Config.Comp_Axis.DelSpeed = Config.CompAxis_DelSpeed;
Config.Comp_Axis.HomeAddSpeed = Config.CompAxis_HomeAddSpeed;
Config.Comp_Axis.HomeHighSpeed = Config.CompAxis_HomeHighSpeed;
Config.Comp_Axis.HomeLowSpeed = Config.CompAxis_HomeLowSpeed;
Config.Middle_Axis.CanErrorCountMin = Config.MiddleAxis_ErrorCountMin;
Config.InOut_Axis.CanErrorCountMin = Config.InoutAxis_ErrorCountMin;
Config.UpDown_Axis.CanErrorCountMin = Config.UpdownAxis_ErrorCountMin;
Config.Middle_Axis.CanErrorCountMax = Config.MiddleAxis_ErrorCountMax;
Config.InOut_Axis.CanErrorCountMax = Config.InoutAxis_ErrorCountMax;
Config.UpDown_Axis.CanErrorCountMax = Config.UpdownAxis_ErrorCountMax;
Config.Middle_Axis.PositionMin = Config.MiddleAxis_PositionMin;
Config.Middle_Axis.PositionMax = Config.MiddleAxis_PositionMax;
Config.InOut_Axis.PositionMin = Config.InoutAxis_PositionMin;
Config.InOut_Axis.PositionMax = Config.InoutAxis_PositionMax;
Config.UpDown_Axis.PositionMin = Config.UpdownAxis_PositionMin;
Config.UpDown_Axis.PositionMax = Config.UpdownAxis_PositionMax;
//Config.InOut_Axis.ResolveSpeed = Config.InoutAxis_ResolveSpeed;
//Config.UpDown_Axis.ResolveSpeed = Config.UpdownAxis_ResolveSpeed;
//Config.Middle_Axis.ResolveSpeed = Config.MiddleAxis_ResolveSpeed;
Config.Middle_Axis.DefaultPosition = Config.MiddleAxis_P1_Position;
Config.InOut_Axis.DefaultPosition = Config.InOutAxis_P1_Position;
Config.UpDown_Axis.DefaultPosition = Config.UpDownAxis_DoorOPosition_P1;
Config.Comp_Axis.DefaultPosition = Config.CompressAxis_P1_Position;
Config.Comp_Axis.CanErrorCountMax = 1000;
Config.Comp_Axis.CanErrorCountMin = 10;
Config.Comp_Axis.PositionMin = 0;
Config.Comp_Axis.PositionMax = 0;
}
private Dictionary<string, ushort> DILengthMap = null;
private Dictionary<string, ushort> DOLengthMap = null;
public ushort GetDILength(string ip)
{
try
{
if (DILengthMap == null)
{
DILengthMap = new Dictionary<string, ushort>();
string[] arrayList = IO_DILength.Split(';');
foreach (string str in arrayList)
{
string[] arrStr = str.Split('#');
if (arrStr.Length == 2)
{
string ioip = arrStr[0];
ushort length = Convert.ToUInt16(arrStr[1]);
DILengthMap.Add(ioip, length);
}
}
}
}
catch (Exception ex)
{
}
if (DILengthMap.ContainsKey(ip))
{
return DILengthMap[ip];
}
return 16;
}
public ushort GetDOLength(string ip)
{
try
{
if (DOLengthMap == null)
{
DOLengthMap = new Dictionary<string, ushort>();
string[] arrayList = IO_DOLength.Split(';');
foreach (string str in arrayList)
{
string[] arrStr = str.Split('#');
if (arrStr.Length == 2)
{
string ioip = arrStr[0];
ushort length = Convert.ToUInt16(arrStr[1]);
DOLengthMap.Add(ioip, length);
}
}
}
}
catch (Exception ex)
{
}
if (DOLengthMap.ContainsKey(ip))
{
return DOLengthMap[ip];
}
return 16;
}
}
}
using log4net;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace OnlineStore.LoadCSVLibrary
{
public class Config_T1 : DeviceConfig
{
public Config_T1()
: base()
{
}
public Config_T1(int id, string type, string filepath)
: base(id, type, filepath)
{
}
public override List<ConfigMoveAxis> moveAxisList { get; set; }
/// <summary>
/// AXIS,,出料提升轴,T_Batch_Axis,6,HC,,8000,15000,15000,500,4000,15000,10,100,0,0
/// </summary>
[ConfigProAttribute("T_Batch_Axis")]
public ConfigMoveAxis T_Batch_Axis { get; set; }
/// <summary>
/// AXIS,,出料移栽轴,T_Pan_Axis,7,HC,,20000,30000,30000,500,4000,15000,10,100,0,0
/// </summary>
[ConfigProAttribute("T_Pan_Axis")]
public ConfigMoveAxis T_Pan_Axis { get; set; }
/// <summary>
/// AXIS,,出料升降轴,T_Updown_Axis,8,HC,,20000,30000,30000,500,4000,15000,10,100,0,0
/// </summary>
[ConfigProAttribute("T_Updown_Axis")]
public ConfigMoveAxis T_Updown_Axis { get; set; }
/// <summary>
/// AXIS,,皮带线出口定位,T_TrayPos_Axis,9,HC,,35000,60000,60000,1000,5000,20000,500,100,0,0
/// </summary>
[ConfigProAttribute("T_TrayPos_Axis")]
public ConfigMoveAxis T_TrayPos_Axis { get; set; }
/// <summary>
/// AXIS,,出料移栽Y轴,T_Y_Axis,10,HC,,20000,30000,30000,500,4000,15000,10,100,0,0
/// </summary>
[ConfigProAttribute("T_Y_Axis")]
public ConfigMoveAxis T_Y_Axis { get; set; }
/// <summary>
/// PRO,30,TrayPos定位列表,TrayPos_List,8=999;12=99;20=999,,,,,,,,,,,,
/// </summary>
[ConfigProAttribute("TrayPos_List")]
public string TrayPos_List { get; set; }
/// <summary>
/// PRO,30,提升轴待机点 P1,BatchAxis_P1,500,,,,,,,,,,,,
/// </summary>
[ConfigProAttribute("BatchAxis_P1")]
public int BatchAxis_P1 { get; set; }
/// <summary>
/// PRO,30,提升轴上升目标点_P2,BatchAxis_P2,562083,,,,,,,,,,,,
/// </summary>
[ConfigProAttribute("BatchAxis_P2")]
public int BatchAxis_P2 { get; set; }
/// <summary>
/// PRO,30,提升轴高度转换系数(1mm对应的脉冲),BatchAxis_ChangeValue,996,,,,,,,,,,,,
/// </summary>
[ConfigProAttribute("BatchAxis_ChangeValue")]
public int BatchAxis_ChangeValue { get; set; }
/// <summary>
/// PRO,30,升降轴待机点P1,UpdownAxis_P1,7,,,,,,,,,,,,
/// </summary>
[ConfigProAttribute("UpdownAxis_P1")]
public int UpdownAxis_P1 { get; set; }
/// <summary>
/// PRO,30,升降轴取料点P2,UpdownAxis_P2,6,,,,,,,,,,,,
/// </summary>
[ConfigProAttribute("UpdownAxis_P2")]
public int UpdownAxis_P2 { get; set; }
/// <summary>
/// PRO,30,升降轴高度转换系数(1mm对应的脉冲),UpdownAxis_ChangeValue,5,,,,,,,,,,,,
/// </summary>
[ConfigProAttribute("UpdownAxis_ChangeValue")]
public int UpdownAxis_ChangeValue { get; set; }
/// <summary>
/// PRO,30,升降轴放料点P3,UpdownAxis_P3,200,,,,,,,,,,,,
/// </summary>
[ConfigProAttribute("UpdownAxis_P3")]
public int UpdownAxis_P3 { get; set; }
/// <summary>
/// PRO,30,提升轴待机点 P1,BatchAxis_P1,500,,,8000,,,,,,,,,
/// </summary>
[ConfigProAttribute("BatchAxis_P1_speed")]
public int BatchAxis_P1_speed { get; set; }
/// <summary>
/// PRO,30,提升轴上升目标点_P2,BatchAxis_P2,562083,,,8000,,,,,,,,,
/// </summary>
[ConfigProAttribute("BatchAxis_P2_speed")]
public int BatchAxis_P2_speed { get; set; }
/// <summary>
/// PRO,30,横移待机取料点P1,Pan_P1,9,,,20000,,,,,,,,,
/// </summary>
[ConfigProAttribute("Pan_P1")]
public int Pan_P1 { get; set; }
/// <summary>
/// PRO,30,横移放料点P2,Pan_P2,9,,,20000,,,,,,,,,
/// </summary>
[ConfigProAttribute("Pan_P2")]
public int Pan_P2 { get; set; }
/// <summary>
/// PRO,30,升降轴待机点P1,UpdownAxis_P1,7,,,20000,,,,,,,,,
/// </summary>
[ConfigProAttribute("UpdownAxis_P1_speed")]
public int UpdownAxis_P1_speed { get; set; }
/// <summary>
/// PRO,30,升降轴取料点P2,UpdownAxis_P2,6,,,20000,,,,,,,,,
/// </summary>
[ConfigProAttribute("UpdownAxis_P2_speed")]
public int UpdownAxis_P2_speed { get; set; }
/// <summary>
/// PRO,30,升降轴放料点P3,UpdownAxis_P3,200,,,20000,,,,,,,,,
/// </summary>
[ConfigProAttribute("UpdownAxis_P3_speed")]
public int UpdownAxis_P3_speed { get; set; }
/// <summary>
/// PRO,30,横移待机取料点P1,Pan_P1,9,,,20000,,,,,,,,,
/// </summary>
[ConfigProAttribute("Pan_P1_speed")]
public int Pan_P1_speed { get; set; }
/// <summary>
/// PRO,30,横移放料点P2,Pan_P2,9,,,20000,,,,,,,,,
/// </summary>
[ConfigProAttribute("Pan_P2_speed")]
public int Pan_P2_speed { get; set; }
/// <summary>
/// PRO,30,料盘定位待机点P1,TrayPos_P1,0,,,35000,,,,,,,,,
/// </summary>
[ConfigProAttribute("TrayPos_P1")]
public int TrayPos_P1 { get; set; }
/// <summary>
/// PRO,30,料盘定位待机点P1,TrayPos_P1,0,,,35000,,,,,,,,,
/// </summary>
[ConfigProAttribute("TrayPos_P1_speed")]
public int TrayPos_P1_speed { get; set; }
/// <summary>
/// PRO,30,料串中心点X坐标,String_Center_X,1000,,,,,,,,,,,,
/// </summary>
[ConfigProAttribute("String_Center_X")]
public int String_Center_X { get; set; }
/// <summary>
/// PRO,30,料串中心点Y坐标,String_Center_Y,1000,,,,,,,,,,,,
/// </summary>
[ConfigProAttribute("String_Center_Y")]
public int String_Center_Y { get; set; }
/// <summary>
/// PRO,30,料串允许偏离像素值,String_Offset_Range_Px,1000,,,,,,,,,,,,
/// </summary>
[ConfigProAttribute("String_Offset_Range_Px")]
public int String_Offset_Range_Px { get; set; }
/// <summary>
/// PRO,30,料串定位相机,String_Camera,GigE:MV-CE200-10GC (00F98806639),,,,,,,,,,,,
/// </summary>
[ConfigProAttribute("String_Camera")]
public string String_Camera { get; set; }
/// <summary>
/// PRO,20,Y轴待机取料点P1,Y_P1,5700,,,20000,,,,,,,,,
/// </summary>
[ConfigProAttribute("Y_P1")]
public int Y_P1 { get; set; }
/// <summary>
/// PRO,20,Y轴放料基准点P2,Y_P2,77614,,,20000,,,,,,,,,
/// </summary>
[ConfigProAttribute("Y_P2")]
public int Y_P2 { get; set; }
/// <summary>
/// PRO,30,料串图像/X轴比值,Cam_Pixel_X_Ratio,147,,,,,,,,,,,,
/// </summary>
[ConfigProAttribute("Cam_Pixel_X_Ratio")]
public int Cam_Pixel_X_Ratio { get; set; }
/// <summary>
/// PRO,30,料串图像/Y轴比值,Cam_Pixel_Y_Ratio,147,,,,,,,,,,,,
/// </summary>
[ConfigProAttribute("Cam_Pixel_Y_Ratio")]
public int Cam_Pixel_Y_Ratio { get; set; }
/// <summary>
/// PRO,20,Y轴待机取料点P1,Y_P1,5700,,,20000,,,,,,,,,
/// </summary>
[ConfigProAttribute("Y_P1_speed")]
public int Y_P1_speed { get; set; }
/// <summary>
/// PRO,20,Y轴放料基准点P2,Y_P2,77614,,,20000,,,,,,,,,
/// </summary>
[ConfigProAttribute("Y_P2_speed")]
public int Y_P2_speed { get; set; }
private Dictionary<int, int> TrayPos_ListMap = null;
public int GetTrayPos(int width = 8)
{
TrayPos_ListMap = LoadPMap(TrayPos_ListMap, TrayPos_List);
if (TrayPos_ListMap.ContainsKey(width))
{
return TrayPos_ListMap[width];
}
else if (TrayPos_ListMap.ContainsKey(0))
{
return TrayPos_ListMap[0];
}
return -1;
}
}
}
......@@ -20,25 +20,39 @@ namespace OnlineStore.LoadCSVLibrary
{
}
public override List<ConfigMoveAxis> moveAxisList { get; set; }
/// <summary>
/// AXIS,,入口皮带线,Line_Entry_Axis,0,HC,,500,1000,1000,100,200,1000,10,100,0,0
/// AXIS,,入口皮带线,Line_Entry_Axis,0,HC,,500,2000,2000,50,100,500,10,100,0,0
/// </summary>
[ConfigProAttribute("Line_Entry_Axis")]
public ConfigMoveAxis Line_Entry_Axis { get; set; }
/// <summary>
/// AXIS,,中间皮带线,Line_In_Axis,1,HC,,1000,1000,1000,200,500,500,10,100,0,0
/// AXIS,,中间皮带线,Line_In_Axis,1,HC,,500,2000,2000,50,100,500,10,100,0,0
/// </summary>
[ConfigProAttribute("Line_In_Axis")]
public ConfigMoveAxis Line_In_Axis { get; set; }
/// <summary>
/// PRO,0,进入伺服相对运动量,Line_Entry_Relative,5555,,,1000,,,,,,,,,
/// AXIS,,皮带线出口定位,ExitLine_Location_Axis,2,HC,,500,2000,2000,50,100,500,10,100,0,0
/// </summary>
[ConfigProAttribute("ExitLine_Location_Axis")]
public ConfigMoveAxis ExitLine_Location_Axis { get; set; }
/// <summary>
/// AXIS,,横移X轴,SideMove_X_Axis,3,HC,,500,2000,2000,50,100,500,10,100,0,0
/// </summary>
[ConfigProAttribute("SideMove_X_Axis")]
public ConfigMoveAxis SideMove_X_Axis { get; set; }
/// <summary>
/// AXIS,,横移Z轴,SideMove_Z_Axis,4,HC,,500,2000,2000,50,100,500,10,100,0,0
/// </summary>
[ConfigProAttribute("SideMove_Z_Axis")]
public ConfigMoveAxis SideMove_Z_Axis { get; set; }
/// <summary>
/// PRO,10,入口伺服相对运动量,Line_Entry_Relative,4000,,,2000,,,,,,,,,
/// </summary>
[ConfigProAttribute("Line_Entry_Relative")]
public int Line_Entry_Relative { get; set; }
/// <summary>
/// PRO,0,机内伺服相对运动量,Line_In_Relative,5555,,,1000,,,,,,,,,
/// PRO,10,机内伺服相对运动量,Line_In_Relative,6300,,,2000,,,,,,,,,
/// </summary>
[ConfigProAttribute("Line_In_Relative")]
public int Line_In_Relative { get; set; }
......@@ -53,56 +67,162 @@ namespace OnlineStore.LoadCSVLibrary
[ConfigProAttribute("AirCheckSeconds")]
public int AirCheckSeconds { get; set; }
/// <summary>
/// PRO,30,右侧相机名称,CameraName,123123,,,,,,,,,,,,
/// PRO,30,相机名称,CameraName,GigE:MV-CE200-10GC (00E76280379),,,,,,,,,,,,
/// </summary>
[ConfigProAttribute("CameraName")]
public string CameraName { get; set; }
/// <summary>
/// PRO,10,进入伺服相对运动量,Line_Entry_Relative,5555,,,1000,,,,,,,,,
/// </summary>
[ConfigProAttribute("Line_Entry_Relative_speed")]
public int Line_Entry_Relative_speed { get; set; }
/// <summary>
/// PRO,10,机内伺服相对运动量,Line_In_Relative,5555,,,1000,,,,,,,,,
/// </summary>
[ConfigProAttribute("Line_In_Relative_speed")]
public int Line_In_Relative_speed { get; set; }
/// <summary>
/// PRO,31,左侧7寸料盘模拟量基准,Tray7_L_ADIO_base,99,,,,,,,,,,,,
/// PRO,31,左侧7寸料盘模拟量基准,Tray7_L_ADIO_base,-750,,,,,,,,,,,,
/// </summary>
[ConfigProAttribute("Tray7_L_ADIO_base")]
public int Tray7_L_ADIO_base { get; set; }
/// <summary>
/// PRO,31,左侧13寸料盘模拟量基准,Tray13_L_ADIO_base,99,,,,,,,,,,,,
/// PRO,31,左侧13寸料盘模拟量基准,Tray13_L_ADIO_base,-750,,,,,,,,,,,,
/// </summary>
[ConfigProAttribute("Tray13_L_ADIO_base")]
public int Tray13_L_ADIO_base { get; set; }
/// <summary>
/// PRO,31,左侧15寸料盘模拟量基准,Tray15_L_ADIO_base,99,,,,,,,,,,,,
/// PRO,31,左侧15寸料盘模拟量基准,Tray15_L_ADIO_base,-750,,,,,,,,,,,,
/// </summary>
[ConfigProAttribute("Tray15_L_ADIO_base")]
public int Tray15_L_ADIO_base { get; set; }
/// <summary>
/// PRO,31,右侧7寸料盘模拟量基准,Tray7_R_ADIO_base,99,,,,,,,,,,,,
/// PRO,31,右侧7寸料盘模拟量基准,Tray7_R_ADIO_base,-750,,,,,,,,,,,,
/// </summary>
[ConfigProAttribute("Tray7_R_ADIO_base")]
public int Tray7_R_ADIO_base { get; set; }
/// <summary>
/// PRO,31,右侧13寸料盘模拟量基准,Tray13_R_ADIO_base,994,,,,,,,,,,,,
/// PRO,31,右侧13寸料盘模拟量基准,Tray13_R_ADIO_base,-750,,,,,,,,,,,,
/// </summary>
[ConfigProAttribute("Tray13_R_ADIO_base")]
public int Tray13_R_ADIO_base { get; set; }
/// <summary>
/// PRO,31,右侧15寸料盘模拟量基准,Tray15_R_ADIO_base,99,,,,,,,,,,,,
/// PRO,31,右侧15寸料盘模拟量基准,Tray15_R_ADIO_base,-750,,,,,,,,,,,,
/// </summary>
[ConfigProAttribute("Tray15_R_ADIO_base")]
public int Tray15_R_ADIO_base { get; set; }
/// <summary>
/// PRO,32,料盘高度模拟量转换,Tray_ADIO_Value,999,,,,,,,,,,,,
/// PRO,32,料盘高度模拟量转换,Tray_ADIO_Value,86,,,,,,,,,,,,
/// </summary>
[ConfigProAttribute("Tray_ADIO_Value")]
public int Tray_ADIO_Value { get; set; }
/// <summary>
/// PRO,10,入口伺服相对运动量,Line_Entry_Relative,4000,,,2000,,,,,,,,,
/// </summary>
[ConfigProAttribute("Line_Entry_Relative_speed")]
public int Line_Entry_Relative_speed { get; set; }
/// <summary>
/// PRO,10,机内伺服相对运动量,Line_In_Relative,6300,,,2000,,,,,,,,,
/// </summary>
[ConfigProAttribute("Line_In_Relative_speed")]
public int Line_In_Relative_speed { get; set; }
/// <summary>
/// PRO,12,皮带线出口定位待机点P1,ExitLine_Location_P1,0,,,2000,,,,,,,,,
/// </summary>
[ConfigProAttribute("ExitLine_Location_P1")]
public int ExitLine_Location_P1 { get; set; }
/// <summary>
/// PRO,12,皮带线出口定位7寸挡停,ExitLine_Location_7,0,,,2000,,,,,,,,,
/// </summary>
[ConfigProAttribute("ExitLine_Location_7")]
public int ExitLine_Location_7 { get; set; }
/// <summary>
/// PRO,12,皮带线出口定位13寸挡停,ExitLine_Location_13,0,,,2000,,,,,,,,,
/// </summary>
[ConfigProAttribute("ExitLine_Location_13")]
public int ExitLine_Location_13 { get; set; }
/// <summary>
/// PRO,12,皮带线出口定位15寸挡停,ExitLine_Location_15,0,,,2000,,,,,,,,,
/// </summary>
[ConfigProAttribute("ExitLine_Location_15")]
public int ExitLine_Location_15 { get; set; }
/// <summary>
/// PRO,13,横移X轴待机点P1,SideMove_X_P1,6300,,,2000,,,,,,,,,
/// </summary>
[ConfigProAttribute("SideMove_X_P1")]
public int SideMove_X_P1 { get; set; }
/// <summary>
/// PRO,13,横移X轴取料点P2,SideMove_X_P2,6300,,,2000,,,,,,,,,
/// </summary>
[ConfigProAttribute("SideMove_X_P2")]
public int SideMove_X_P2 { get; set; }
/// <summary>
/// PRO,13,横移X轴放料点P3,SideMove_X_P3,6300,,,2000,,,,,,,,,
/// </summary>
[ConfigProAttribute("SideMove_X_P3")]
public int SideMove_X_P3 { get; set; }
/// <summary>
/// PRO,14,横移Z轴待机点P1,SideMove_Z_P1,6300,,,2000,,,,,,,,,
/// </summary>
[ConfigProAttribute("SideMove_Z_P1")]
public int SideMove_Z_P1 { get; set; }
/// <summary>
/// PRO,14,横移Z轴取料点P2,SideMove_Z_P2,6300,,,2000,,,,,,,,,
/// </summary>
[ConfigProAttribute("SideMove_Z_P2")]
public int SideMove_Z_P2 { get; set; }
/// <summary>
/// PRO,14,横移Z轴放料点P3,SideMove_Z_P3,6300,,,2000,,,,,,,,,
/// </summary>
[ConfigProAttribute("SideMove_Z_P3")]
public int SideMove_Z_P3 { get; set; }
/// <summary>
/// PRO,12,皮带线出口定位待机点P1,ExitLine_Location_P1,0,,,2000,,,,,,,,,
/// </summary>
[ConfigProAttribute("ExitLine_Location_P1_speed")]
public int ExitLine_Location_P1_speed { get; set; }
/// <summary>
/// PRO,12,皮带线出口定位7寸挡停,ExitLine_Location_7,0,,,2000,,,,,,,,,
/// </summary>
[ConfigProAttribute("ExitLine_Location_7_speed")]
public int ExitLine_Location_7_speed { get; set; }
/// <summary>
/// PRO,12,皮带线出口定位13寸挡停,ExitLine_Location_13,0,,,2000,,,,,,,,,
/// </summary>
[ConfigProAttribute("ExitLine_Location_13_speed")]
public int ExitLine_Location_13_speed { get; set; }
/// <summary>
/// PRO,12,皮带线出口定位15寸挡停,ExitLine_Location_15,0,,,2000,,,,,,,,,
/// </summary>
[ConfigProAttribute("ExitLine_Location_15_speed")]
public int ExitLine_Location_15_speed { get; set; }
/// <summary>
/// PRO,13,横移X轴待机点P1,SideMove_X_P1,6300,,,2000,,,,,,,,,
/// </summary>
[ConfigProAttribute("SideMove_X_P1_speed")]
public int SideMove_X_P1_speed { get; set; }
/// <summary>
/// PRO,13,横移X轴取料点P2,SideMove_X_P2,6300,,,2000,,,,,,,,,
/// </summary>
[ConfigProAttribute("SideMove_X_P2_speed")]
public int SideMove_X_P2_speed { get; set; }
/// <summary>
/// PRO,13,横移X轴放料点P3,SideMove_X_P3,6300,,,2000,,,,,,,,,
/// </summary>
[ConfigProAttribute("SideMove_X_P3_speed")]
public int SideMove_X_P3_speed { get; set; }
/// <summary>
/// PRO,14,横移Z轴待机点P1,SideMove_Z_P1,6300,,,2000,,,,,,,,,
/// </summary>
[ConfigProAttribute("SideMove_Z_P1_speed")]
public int SideMove_Z_P1_speed { get; set; }
/// <summary>
/// PRO,14,横移Z轴取料点P2,SideMove_Z_P2,6300,,,2000,,,,,,,,,
/// </summary>
[ConfigProAttribute("SideMove_Z_P2_speed")]
public int SideMove_Z_P2_speed { get; set; }
/// <summary>
/// PRO,14,横移Z轴放料点P3,SideMove_Z_P3,6300,,,2000,,,,,,,,,
/// </summary>
[ConfigProAttribute("SideMove_Z_P3_speed")]
public int SideMove_Z_P3_speed { get; set; }
}
}
using log4net;
using OnlineStore.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
namespace OnlineStore.LoadCSVLibrary
{
public class DeviceConfig
{
/// <summary>
/// ID
/// </summary>
public int Id { get; set; }
/// <summary>
/// 设备类型
/// </summary>
public string DType { get; set; }
/// <summary>
/// 配置文件路径
/// </summary>
public string ConfigFilePath { get; set; }
public Dictionary<String, ConfigIO> DIList { get; set; } = new Dictionary<string, ConfigIO>();
public Dictionary<String, ConfigIO> DOList { get; set; } = new Dictionary<string, ConfigIO>();
public Dictionary<String, ConfigIO> ADIOList { get; set; }= new Dictionary<string, ConfigIO>();
public List<ConfigMoveAxis> moveAxisList = new List<ConfigMoveAxis>();
public List<ConfigBase> configList = new List<ConfigBase>();
public static Dictionary<String, ConfigIO> AllDOlist { get; set; }
public static Dictionary<String, ConfigIO> AllDOEleclist { get; set; }
public DeviceConfig()
{
}
static DeviceConfig()
{
AllDOlist = new Dictionary<string, ConfigIO>();
AllDOEleclist = new Dictionary<string, ConfigIO>();
}
public DeviceConfig(int id , string type, string filepath)
{
this.Id = id;
this.DType = type;
this.ConfigFilePath = filepath;
}
public virtual void LoadConfig<T>(List<ConfigBase> configList)
{
this.configList = configList;
List<string> ioTypeList = GetTypeList<T>();
StringBuilder builder = new StringBuilder("\r\n");
StringBuilder proBuilder = new StringBuilder("\r\n");
//DIList = new Dictionary<string, ConfigIO>();
//DOList = new Dictionary<string, ConfigIO>();
//moveAxisList = new List<ConfigMoveAxis>();
//取得属性集合
PropertyInfo[] props = GetType().GetProperties();
Dictionary<string, string> proMap = CSVReaderBase.getConfigProAttributeMap(GetType());
List<string> checkProList = new List<string>(proMap.Keys);//用来检测attribute属性都应该要配置值
foreach (ConfigBase con in configList)
{
try
{
if (con.ProType == ConfigItemType.AXIS || con.ProType == ConfigItemType.PRO)
{
if (proMap.ContainsKey(con.ProName))
{
string proName = proMap[con.ProName];
checkProList.Remove(con.ProName);
PropertyInfo prop = props.First(c => c.Name == proName);//获取同名属性
if (prop != null)
{
if (con.ProType == ConfigItemType.AXIS)
{
//如果属性存在
prop.SetValue(this, Convert.ChangeType(con, prop.PropertyType), null);//赋值****在这里需要考虑类型问题
ConfigMoveAxis axis = (ConfigMoveAxis)con;
moveAxisList.Add(axis);
}
else if (con.ProType == ConfigItemType.PRO)
{
prop.SetValue(this, Convert.ChangeType(con.ProValue, prop.PropertyType));//赋值
if (con.TargetSpeed > 0)
{
if (proMap.ContainsKey(proName + "_speed"))
{
checkProList.Remove(proName + "_speed");
PropertyInfo speedprop = props.First(c => c.Name == proName + "_speed");
if (speedprop != null)
{
speedprop.SetValue(this, Convert.ChangeType(con.TargetSpeed, typeof(int)));
}
}
else
{
AddProSpeedBuffer(con, proBuilder);
}
}
}
}
else
{
LogUtil.error("配置文件:" + this.ConfigFilePath + ",属性名=" + con.ProName + "的属性未找到匹配字段!");
}
}
else
{
AddProBuffer(con, proBuilder);
LogUtil.error("配置文件:" + this.ConfigFilePath + ",属性名=" + con.ProName + "的属性未找到匹配字段!");
}
}
else if (con.ProType == ConfigItemType.DI)
{
ConfigIO io = (ConfigIO)con;
if (DIList.ContainsKey(io.ProName))
{
LogUtil.debug("配置DI:[" + io.ToString() + "] ProName重复 ");
}
else
{
this.DIList.Add(con.ProName, io);
}
if (!ioTypeList.Contains(con.ProName))
{
AddBuffer(con, builder);
}
}
else if (con.ProType == ConfigItemType.DO)
{
ConfigIO io = (ConfigIO)con;
if (DOList.ContainsKey(io.ProName))
{
LogUtil.debug("配置DO:[" + io.ToString() + "] ProName重复 ");
}
else
{
this.DOList.Add(con.ProName, io);
if (!AllDOlist.ContainsKey(con.ProName))
AllDOlist.Add(con.ProName, io);
if (!AllDOEleclist.ContainsKey(io.ElectricalDefinition))
AllDOEleclist.Add(io.ElectricalDefinition, io);
}
if (!ioTypeList.Contains(con.ProName))
{
AddBuffer(con, builder);
}
}
else if (con.ProType == ConfigItemType.ADIO)
{
ConfigIO io = (ConfigIO)con;
if (ADIOList.ContainsKey(io.ProName))
{
LogUtil.debug("配置ADIO:[" + io.ToString() + "] ProName重复 ");
}
else
{
this.ADIOList.Add(con.ProName, io);
}
if (!ioTypeList.Contains(con.ProName))
{
AddBuffer(con, builder);
}
}
}
catch(Exception ex)
{
LogUtil.error("解析配置【"+con.ConfigStr+"】出错:" + ex.ToString());
throw new Exception("解析配置【" + con.ConfigStr + "】出错");
}
}
if (String.IsNullOrEmpty(proBuilder.ToString()).Equals(false) && proBuilder.ToString().Equals("\r\n").Equals(false))
{
LogUtil.error(proBuilder.ToString());
Console.Write(proBuilder.ToString());
}
if (String.IsNullOrEmpty(builder.ToString()).Equals(false) && builder.ToString().Equals("\r\n").Equals(false))
{
LogUtil.error(builder.ToString());
Console.Write(builder.ToString());
}
if (checkProList.Count >= 0)
{
//常规属性检测
foreach (string str in checkProList)
{
PropertyInfo prop = props.First(c => c.Name == str);//获取同名属性
//判断是否必须要配置
object[] array = prop.GetCustomAttributes(false);
if (array.Length > 0)
{
ConfigProAttribute att = (ConfigProAttribute)array[0];
if (att != null)
{
if (att.IsMust)
{
throw new CVSFieldNotMatchingExection(this.ToString() + "的属性【" + str + "】必须配置值!");
}
else
{
if (prop.PropertyType.Equals(typeof(int)))
{
prop.SetValue(this, Convert.ChangeType(0, prop.PropertyType), null);//赋值****在这里需要考虑类型问题
}
else
{
prop.SetValue(this, Convert.ChangeType("", prop.PropertyType), null);//赋值****在这里需要考虑类型问题
}
}
}
}
}
////DI检测
//foreach (string di in MustHaveDIList)
//{
// if (!DIList.ContainsKey(di))
// {
// throw new CVSFieldNotMatchingExection(this.ToString() + "的DI属性" + di + "必须配置值!");
// }
//}
////DO检测
//foreach (string io in MustHaveDOList)
//{
// if (!this.DOList.ContainsKey(io))
// {
// throw new CVSFieldNotMatchingExection(this.ToString() + "的DO属性" + io + "必须配置值!");
// }
//}
}
}
private void AddProBuffer(ConfigBase con, StringBuilder builder)
{
builder.Append(" /// <summary>\r\n");
builder.Append(" /// " + con.ConfigStr + "\r\n");
builder.Append(" /// </summary>\r\n");
builder.Append(" [ConfigProAttribute(\"" + con.ProName + "\")]\r\n");
builder.Append(" public int " + con.ProName + " { get; set; }\r\n");
}
private void AddProSpeedBuffer(ConfigBase con, StringBuilder builder)
{
builder.Append(" /// <summary>\r\n");
builder.Append(" /// " + con.ConfigStr + "\r\n");
builder.Append(" /// </summary>\r\n");
builder.Append(" [ConfigProAttribute(\"" + con.ProName + "_speed\")]\r\n");
builder.Append(" public int " + con.ProName + "_speed { get; set; }\r\n");
}
private void AddBuffer(ConfigBase con, StringBuilder builder)
{
builder.Append(" /// <summary>\r\n");
builder.Append(" /// " + con.ConfigStr + "\r\n");
builder.Append(" /// </summary>\r\n");
builder.Append(" public static string " + con.ProName + "=\"" + con.ProName + "\";\r\n");
}
public ConfigIO getWaitIO(string ioType)
{
if (DIList.ContainsKey(ioType))
{
return DIList[ioType];
}
else if (DOList.ContainsKey(ioType))
{
return DOList[ioType];
}
return null;
}
public static List<string> GetTypeList<T>()
{
var TypeList = new List<string>();
var p = typeof(T).GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.Static);
foreach (var item in p)
{
TypeList.Add(item.Name);
}
return TypeList;
}
}
public class DeviceType
{
/// <summary>
/// 流水线线体
/// </summary>
public static string Line = "Line";
public static string XRay = "MoveEquip";
public static string OutputDevice = "OutputDevice";
public static string InputDevice = "InputDevice";
}
}
using log4net;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace OnlineStore.LoadCSVLibrary
{
public class DischargeLine_Config : DeviceConfig
{
public DischargeLine_Config()
: base()
{
}
public DischargeLine_Config(int id, string cid, string type, string filepath)
: base(id, cid, LoadCSVLibrary.DeviceType.DischargeLine, filepath)
{
}
/// <summary>
/// 设备是否处于调试状态(1=调试,0=正常)
/// </summary>
[ConfigProAttribute("IsDebug")]
public int IsDebug { get; set; }
/// <summary>
/// PRO,0,扫码的相机名称(多个用#分隔),CameraNameList,Name1#Name1,,,,,
/// </summary>
[ConfigProAttribute("CameraNameList")]
public string CameraNameList { get; set; }
private List<string> CameraList = null;
public List<string> GetCameraList()
{
if (CameraList == null)
{
CameraList = new List<string>();
string[] arrayList = CameraNameList.Split('#');
foreach (string str in arrayList)
{
string camera = str.Trim();
if (string.IsNullOrEmpty(camera).Equals(false))
{
CameraList.Add(camera);
}
}
}
return CameraList;
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OnlineStore.LoadCSVLibrary
{
public class IO_Filter_Type
{
/// <summary>
/// DO,0,皮带线3启动,Line3_Run,21,HC,Y21,,,,,,,,,,
/// </summary>
public static string Line3_Run = "Line3_Run";
/// <summary>
/// DI,0,NG料阻挡料盘检测,NG_TaryStop_Check,26,HC,X26,,,,,,,,,,
/// </summary>
public static string NG_TaryStop_Check = "NG_TaryStop_Check";
/// <summary>
/// DI,0,NG料阻挡上升端,NG_TaryStop_Up,27,HC,X27,,,,,,,,,,
/// </summary>
public static string NG_TaryStop_Up = "NG_TaryStop_Up";
/// <summary>
/// DI,0,NG料阻挡下降端,NG_TaryStop_Down,28,HC,X28,,,,,,,,,,
/// </summary>
public static string NG_TaryStop_Down = "NG_TaryStop_Down";
/// <summary>
/// DI,0,NG料推送前进端,NG_GetOut_Fwd,29,HC,X29,,,,,,,,,,
/// </summary>
public static string NG_GetOut_Fwd = "NG_GetOut_Fwd";
/// <summary>
/// DI,0,NG料推送后退端,NG_GetOut_Bck,30,HC,X30,,,,,,,,,,
/// </summary>
public static string NG_GetOut_Bck = "NG_GetOut_Bck";
/// <summary>
/// DI,0,纸质料阻挡料盘检测,Paper_TaryStop_Check,31,HC,X31,,,,,,,,,,
/// </summary>
public static string Paper_TaryStop_Check = "Paper_TaryStop_Check";
/// <summary>
/// DI,0,纸质料阻挡上升端,Paper_TaryStop_Up,16,HC,X32,,,,,,,,,,
/// </summary>
public static string Paper_TaryStop_Up = "Paper_TaryStop_Up";
/// <summary>
/// DI,0,纸质料阻挡下降端,Paper_TaryStop_Down,17,HC,X33,,,,,,,,,,
/// </summary>
public static string Paper_TaryStop_Down = "Paper_TaryStop_Down";
/// <summary>
/// DI,0,纸质料推送前进端,Paper_GetOut_Fwd,18,HC,X34,,,,,,,,,,
/// </summary>
public static string Paper_GetOut_Fwd = "Paper_GetOut_Fwd";
/// <summary>
/// DI,0,纸质料推送后退端,Paper_GetOut_Bck,19,HC,X35,,,,,,,,,,
/// </summary>
public static string Paper_GetOut_Bck = "Paper_GetOut_Bck";
/// <summary>
/// DI,0,MSD料阻挡料盘检测,MSD_TaryStop_Check,20,HC,X36,,,,,,,,,,
/// </summary>
public static string MSD_TaryStop_Check = "MSD_TaryStop_Check";
/// <summary>
/// DI,0,MSD料阻挡上升端,MSD_TaryStop_Up,21,HC,X37,,,,,,,,,,
/// </summary>
public static string MSD_TaryStop_Up = "MSD_TaryStop_Up";
/// <summary>
/// DI,0,MSD料阻挡下降端,MSD_TaryStop_Down,22,HC,X38,,,,,,,,,,
/// </summary>
public static string MSD_TaryStop_Down = "MSD_TaryStop_Down";
/// <summary>
/// DI,0,MSD料推送前进端,MSD_GetOut_Fwd,23,HC,X39,,,,,,,,,,
/// </summary>
public static string MSD_GetOut_Fwd = "MSD_GetOut_Fwd";
/// <summary>
/// DI,0,MSD料推送后退端,MSD_GetOut_Bck,24,HC,X40,,,,,,,,,,
/// </summary>
public static string MSD_GetOut_Bck = "MSD_GetOut_Bck";
/// <summary>
/// DO,0,NG料阻挡上升,NG_TaryStop_Up,28,HC,Y28,,,,,,,,,,
/// </summary>
//public static string NG_TaryStop_Up = "NG_TaryStop_Up";
/// <summary>
/// DO,0,NG料阻挡下降,NG_TaryStop_Down,29,HC,Y29,,,,,,,,,,
/// </summary>
//public static string NG_TaryStop_Down = "NG_TaryStop_Down";
/// <summary>
/// DO,0,NG料推送前进,NG_GetOut_Fwd,30,HC,Y30,,,,,,,,,,
/// </summary>
//public static string NG_GetOut_Fwd = "NG_GetOut_Fwd";
/// <summary>
/// DO,0,NG料推送后退,NG_GetOut_Bck,31,HC,Y31,,,,,,,,,,
/// </summary>
//public static string NG_GetOut_Bck = "NG_GetOut_Bck";
/// <summary>
/// DO,0,纸质料阻挡上升,Paper_TaryStop_Up,32,HC,Y32,,,,,,,,,,
/// </summary>
//public static string Paper_TaryStop_Up = "Paper_TaryStop_Up";
/// <summary>
/// DO,0,纸质料阻挡下降,Paper_TaryStop_Down,33,HC,Y33,,,,,,,,,,
/// </summary>
//public static string Paper_TaryStop_Down = "Paper_TaryStop_Down";
/// <summary>
/// DO,0,纸质料推送前进,Paper_GetOut_Fwd,34,HC,Y34,,,,,,,,,,
/// </summary>
//public static string Paper_GetOut_Fwd = "Paper_GetOut_Fwd";
/// <summary>
/// DO,0,纸质料推送后退,Paper_GetOut_Bck,35,HC,Y35,,,,,,,,,,
/// </summary>
//public static string Paper_GetOut_Bck = "Paper_GetOut_Bck";
/// <summary>
/// DO,0,MSD料阻挡上升,MSD_TaryStop_Up,36,HC,Y36,,,,,,,,,,
/// </summary>
//public static string MSD_TaryStop_Up = "MSD_TaryStop_Up";
/// <summary>
/// DO,0,MSD料阻挡下降,MSD_TaryStop_Down,37,HC,Y37,,,,,,,,,,
/// </summary>
//public static string MSD_TaryStop_Down = "MSD_TaryStop_Down";
/// <summary>
/// DO,0,MSD料推送前进,MSD_GetOut_Fwd,38,HC,Y38,,,,,,,,,,
/// </summary>
//public static string MSD_GetOut_Fwd = "MSD_GetOut_Fwd";
/// <summary>
/// DO,0,MSD料推送后退,MSD_GetOut_Bck,39,HC,Y39,,,,,,,,,,
/// </summary>
//public static string MSD_GetOut_Bck = "MSD_GetOut_Bck";
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OnlineStore.LoadCSVLibrary
{
public class IO_Label_Type
{
/// <summary>
/// DI,0,急停(贴标设备),SuddenStop_BTN,16,HC,X16,,,,,,,,,,
/// </summary>
public static string SuddenStop_BTN = "SuddenStop_BTN";
/// <summary>
/// DI,0,贴标机构复位,Reset_BTN,17,HC,X17,,,,,,,,,,
/// </summary>
public static string Reset_BTN = "Reset_BTN";
/// <summary>
/// DI,0,皮带线阻挡1料盘检测,Tray_Check,18,HC,X18,,,,,,,,,,
/// </summary>
public static string Tray_Check = "Tray_Check";
/// <summary>
/// DI,0,皮带线阻挡1上升端,TrayStop_Up,19,HC,X19,,,,,,,,,,
/// </summary>
public static string TrayStop_Up = "TrayStop_Up";
/// <summary>
/// DI,0,皮带线阻挡1下降端,TrayStop_Down,20,HC,X20,,,,,,,,,,
/// </summary>
public static string TrayStop_Down = "TrayStop_Down";
/// <summary>
/// DI,0,皮带线料盘检测,Line_HasTray_Check,21,HC,X21,,,,,,,,,,
/// </summary>
public static string Line_HasTray_Check = "Line_HasTray_Check";
/// <summary>
/// DI,0,贴标阻挡料盘检测,Label_TaryStop_Check,22,HC,X22,,,,,,,,,,
/// </summary>
public static string Label_TaryStop_Check = "Label_TaryStop_Check";
/// <summary>
/// DI,0,贴标阻挡上升端,Label_Stop_Up,23,HC,X23,,,,,,,,,,
/// </summary>
public static string Label_Stop_Up = "Label_Stop_Up";
/// <summary>
/// DI,0,贴标阻挡下降端,Label_Stop_Down,24,HC,X24,,,,,,,,,,
/// </summary>
public static string Label_Stop_Down = "Label_Stop_Down";
/// <summary>
/// DI,0,吸嘴取标检测,Label_Cylinder_Check,25,HC,X25,,,,,,,,,,
/// </summary>
public static string Label_Cylinder_Check = "Label_Cylinder_Check";
/// <summary>
/// DO,0,贴标机构运行指示灯,Run_Led,16,HC,Y16,,,,,,,,,,
/// </summary>
public static string Run_Led = "Run_Led";
/// <summary>
/// DO,0,贴标机构故障指示灯,Alarm_Led,17,HC,Y17,,,,,,,,,,
/// </summary>
public static string Alarm_Led = "Alarm_Led";
/// <summary>
/// DO,0,贴标机构相机光源打开,Camera_Led,18,HC,Y18,,,,,,,,,,
/// </summary>
public static string Camera_Led = "Camera_Led";
/// <summary>
/// DO,0,皮带线1启动,Line1_Run,19,HC,Y19,,,,,,,,,,
/// </summary>
public static string Line1_Run = "Line1_Run";
/// <summary>
/// DO,0,皮带线2启动,Line2_Run,20,HC,Y20,,,,,,,,,,
/// </summary>
public static string Line2_Run = "Line2_Run";
/// <summary>
/// DO,0,皮带线阻挡1上升,TrayStop_Up,23,HC,Y23,,,,,,,,,,
/// </summary>
//public static string TrayStop_Up = "TrayStop_Up";
/// <summary>
/// DO,0,皮带线阻挡1下降,TrayStop_Down,24,HC,Y24,,,,,,,,,,
/// </summary>
// public static string TrayStop_Down = "TrayStop_Down";
/// <summary>
/// DO,0,贴标阻挡上升,LabelStop_Up,25,HC,Y25,,,,,,,,,,
/// </summary>
//public static string Label_Stop_Up = "Label_Stop_Up";
/// <summary>
/// DO,0,贴标阻挡下降,LabelStop_Down,26,HC,Y26,,,,,,,,,,
/// </summary>
//public static string Label_Stop_Down = "Label_Stop_Down";
/// <summary>
/// DO,0,吸嘴取标,LabelCylinder_Work,27,HC,Y27,,,,,,,,,,
/// </summary>
public static string LabelCylinder_Work = "LabelCylinder_Work";
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OnlineStore.LoadCSVLibrary
{
public class IO_T1_Type
{
/// <summary>
/// DO,0,皮带线4启动,Line4_Run,22,HC,Y22,,,,,,,,,,
/// </summary>
public static string Line4_Run = "Line4_Run";
/// <summary>
/// DI,0,皮带线出口料盘检测,End_Line_Tray_Check,41,HC,X41,,,,,,,,,,
/// </summary>
public static string End_Line_Tray_Check = "End_Line_Tray_Check";
/// <summary>
/// DI,0,皮带线出口顶升料盘检测,End_Lift_Tray_Check,42,HC,X42,,,,,,,,,,
/// </summary>
public static string End_Lift_Tray_Check = "End_Lift_Tray_Check";
/// <summary>
/// DI,0,出口顶升气缸上升端,End_Lift_Cylinder_Up,43,HC,X43,,,,,,,,,,
/// </summary>
public static string End_Lift_Cylinder_Up = "End_Lift_Cylinder_Up";
/// <summary>
/// DI,0,出口顶升气缸下降端,End_Lift_Cylinder_Down,44,HC,X44,,,,,,,,,,
/// </summary>
public static string End_Lift_Cylinder_Down = "End_Lift_Cylinder_Down";
/// <summary>
/// DI,0,急停(T1机构),SuddenStop_BTN,45,HC,X45,,,,,,,,,,
/// </summary>
public static string SuddenStop_BTN = "SuddenStop_BTN";
/// <summary>
/// DI,0,T1机构复位,Reset_BTN,46,HC,X46,,,,,,,,,,
/// </summary>
public static string Reset_BTN = "Reset_BTN";
/// <summary>
/// DI,0,空料串线体入口检测,Empty_LineIn_Check,47,HC,X47,,,,,,,,,,
/// </summary>
public static string Empty_LineIn_Check = "Empty_LineIn_Check";
/// <summary>
/// DI,0,空料串线体阻挡料串检测,EmptyString_In_Check,48,HC,X48,,,,,,,,,,
/// </summary>
public static string EmptyString_In_Check = "EmptyString_In_Check";
/// <summary>
/// DI,0,空料串线体横移料串检测,EmptyString_End_Check,49,HC,X49,,,,,,,,,,
/// </summary>
public static string EmptyString_End_Check = "EmptyString_End_Check";
/// <summary>
/// DI,0,空料串线体顶升上升端,EmptyString_Lift_Up,50,HC,X50,,,,,,,,,,
/// </summary>
public static string EmptyString_Lift_Up = "EmptyString_Lift_Up";
/// <summary>
/// DI,0,空料串线体顶升下降端,EmptyString_Lift_Down,51,HC,X51,,,,,,,,,,
/// </summary>
public static string EmptyString_Lift_Down = "EmptyString_Lift_Down";
/// <summary>
/// DI,0,T1定位工位料串检测,T1_Lift_Tray_Check,52,HC,X52,,,,,,,,,,
/// </summary>
public static string T1_Lift_Tray_Check = "T1_Lift_Tray_Check";
/// <summary>
/// DI,0,T1定位气缸1上升端,T1_Location1_Cylinder_Up,53,HC,X53,,,,,,,,,,
/// </summary>
public static string T1_Location1_Cylinder_Up = "T1_Location1_Cylinder_Up";
/// <summary>
/// DI,0,T1定位气缸1下降端,T1_Location1_Cylinder_Down,54,HC,X54,,,,,,,,,,
/// </summary>
public static string T1_Location1_Cylinder_Down = "T1_Location1_Cylinder_Down";
/// <summary>
/// DI,0,T1定位气缸2上升端,T1_Location2_Cylinder_Up,55,HC,X55,,,,,,,,,,
/// </summary>
public static string T1_Location2_Cylinder_Up = "T1_Location2_Cylinder_Up";
/// <summary>
/// DI,0,T1定位气缸2下降端,T1_Location2_Cylinder_Down,56,HC,X56,,,,,,,,,,
/// </summary>
public static string T1_Location2_Cylinder_Down = "T1_Location2_Cylinder_Down";
/// <summary>
/// DI,0,T1定位工位顶升上升端,T1_Lift_Up,57,HC,X57,,,,,,,,,,
/// </summary>
public static string T1_Lift_Up = "T1_Lift_Up";
/// <summary>
/// DI,0,T1定位工位顶升下降端,T1_Lift_Down,58,HC,X58,,,,,,,,,,
/// </summary>
public static string T1_Lift_Down = "T1_Lift_Down";
/// <summary>
/// DI,0,T1料叉气缸前进端,Fork_Cylinder_Fwd,59,HC,X59,,,,,,,,,,
/// </summary>
public static string Fork_Cylinder_Fwd = "Fork_Cylinder_Fwd";
/// <summary>
/// DI,0,T1料叉气缸后退端,Fork_Cylinder_Bck,60,HC,X60,,,,,,,,,,
/// </summary>
public static string Fork_Cylinder_Bck = "Fork_Cylinder_Bck";
/// <summary>
/// DI,0,T1出口前阻挡料串检测,T1_Wait_Check,61,HC,X61,,,,,,,,,,
/// </summary>
public static string T1_Wait_Check = "T1_Wait_Check";
/// <summary>
/// DI,0,T1出口料串检测,T1_Out_Check,62,HC,X62,,,,,,,,,,
/// </summary>
public static string T1_Out_Check = "T1_Out_Check";
/// <summary>
/// DI,0,T1伺服定位料盘检测,T1_Tray_Check,63,HC,X63,,,,,,,,,,
/// </summary>
public static string T1_Tray_Check = "T1_Tray_Check";
/// <summary>
/// DO,0,出口顶升气缸上升,End_Lift_Cylinder_Up,40,HC,Y40,,,,,,,,,,
/// </summary>
//public static string End_Lift_Cylinder_Up = "End_Lift_Cylinder_Up";
/// <summary>
/// DO,0,出口顶升气缸下降,End_Lift_Cylinder_Down,41,HC,Y41,,,,,,,,,,
/// </summary>
//public static string End_Lift_Cylinder_Down = "End_Lift_Cylinder_Down";
/// <summary>
/// DO,0,T1运行指示灯,Run_Led,42,HC,Y42,,,,,,,,,,
/// </summary>
public static string Run_Led = "Run_Led";
/// <summary>
/// DO,0,T1故障指示灯,Alarm_Led,43,HC,Y43,,,,,,,,,,
/// </summary>
public static string Alarm_Led = "Alarm_Led";
/// <summary>
/// DO,0,空料串线体运转,End_Line_Run,44,HC,Y44,,,,,,,,,,
/// </summary>
public static string Empty_Line_Run = "Empty_Line_Run";
/// <summary>
/// DO,0,T1出料串线体运转,Line_Out_Run,45,HC,Y45,,,,,,,,,,
/// </summary>
public static string Line_Out_Run = "Line_Out_Run";
/// <summary>
/// DO,0,空料串线体横移电机运转,EmptyString_Sliding_Run,46,HC,Y46,,,,,,,,,,
/// </summary>
public static string EmptyString_Sliding_Run = "EmptyString_Sliding_Run";
/// <summary>
/// DO,0,T1定位工位横移电机运转,T1String_Sliding_Run,47,HC,Y47,,,,,,,,,,
/// </summary>
public static string T1String_Sliding_Run = "T1String_Sliding_Run";
/// <summary>
/// DO,0,T1线体过渡滚筒运转,T1_Sliding_Run,48,HC,Y48,,,,,,,,,,
/// </summary>
public static string T1_Sliding_Run = "T1_Sliding_Run";
/// <summary>
/// DO,0,空料串线体顶升上升,EmptyString_Lift_Up,49,HC,Y49,,,,,,,,,,
/// </summary>
//public static string EmptyString_Lift_Up = "EmptyString_Lift_Up";
/// <summary>
/// DO,0,空料串线体顶升下降,EmptyString_Lift_Down,50,HC,Y50,,,,,,,,,,
/// </summary>
//public static string EmptyString_Lift_Down = "EmptyString_Lift_Down";
/// <summary>
/// DO,0,T1定位工位顶升上升,T1_Lift_Up,51,HC,Y51,,,,,,,,,,
/// </summary>
//public static string T1_Lift_Up = "T1_Lift_Up";
/// <summary>
/// DO,0,T1定位工位顶升下降,T1_Lift_Down,52,HC,Y52,,,,,,,,,,
/// </summary>
//public static string T1_Lift_Down = "T1_Lift_Down";
/// <summary>
/// DO,0,T1定位气缸上升,T1_Location_Cylinder_Up,53,HC,Y53,,,,,,,,,,
/// </summary>
public static string T1_Location_Cylinder_Up = "T1_Location_Cylinder_Up";
/// <summary>
/// DO,0,T1定位气缸下降,T1_Location_Cylinder_Down,54,HC,Y54,,,,,,,,,,
/// </summary>
public static string T1_Location_Cylinder_Down = "T1_Location_Cylinder_Down";
/// <summary>
/// DO,0,T1料叉气缸前进端,Fork_Cylinder_Fwd,55,HC,Y55,,,,,,,,,,
/// </summary>
//public static string Fork_Cylinder_Fwd = "Fork_Cylinder_Fwd";
/// <summary>
/// DO,0,T1料叉气缸后退端,Fork_Cylinder_Bck,56,HC,Y56,,,,,,,,,,
/// </summary>
//public static string Fork_Cylinder_Bck = "Fork_Cylinder_Bck";
/// <summary>
/// DO,0,空料串线体入口阻挡下降,EmptyString_In_Stop,57,HC,Y57,,,,,,,,,,
/// </summary>
public static string EmptyString_In_Stop = "EmptyString_In_Stop";
/// <summary>
/// DO,0,空料串线体横移阻挡下降,EmptyString_Wait_Stop,58,HC,Y58,,,,,,,,,,
/// </summary>
public static string EmptyString_Wait_Stop = "EmptyString_Wait_Stop";
/// <summary>
/// DO,0,T1出口前阻挡下降,T1_Wait_Stop,59,HC,Y59,,,,,,,,,,
/// </summary>
public static string T1_Wait_Stop = "T1_Wait_Stop";
/// <summary>
/// DO,0,T1出口阻挡下降,T1_Out_Stop,60,HC,Y60,,,,,,,,,,
/// </summary>
public static string T1_Out_Stop = "T1_Out_Stop";
}
}
......@@ -10,6 +10,8 @@ namespace OnlineStore.LoadCSVLibrary
public class IO_XRay_Type
{
/// <summary>
/// DI,0,急停(点料设备),SuddenStop_BTN,0,HC,X00,,,,,,,,,,
/// </summary>
......@@ -27,53 +29,69 @@ namespace OnlineStore.LoadCSVLibrary
/// </summary>
public static string Airpressure_Check = "Airpressure_Check";
/// <summary>
/// DI,0,上料人工确认,Manual_Confirm_BTN,4,HC,X04,,,,,,,,,,
/// DI,0,点料机入口门打开端,Entry_Open,4,HC,X04,,,,,,,,,,
/// </summary>
public static string Manual_Confirm_BTN = "Manual_Confirm_BTN";
public static string Entry_Open = "Entry_Open";
/// <summary>
/// DI,0,上料区料盘检测,Tray_Check,5,HC,X05,,,,,,,,,,
/// DI,0,点料机入口门关闭端,Entry_Close,5,HC,X05,,,,,,,,,,
/// </summary>
public static string Tray_Check = "Tray_Check";
public static string Entry_Close = "Entry_Close";
/// <summary>
/// DI,0,上料区7寸料盘检测,Tray7_Check,6,HC,X06,,,,,,,,,,
/// DI,0,点料机出口门打开端,Exit_Open,6,HC,X06,,,,,,,,,,
/// </summary>
public static string Tray7_Check = "Tray7_Check";
public static string Exit_Open = "Exit_Open";
/// <summary>
/// DI,0,上料区13寸料盘检测,Tray13_Check,7,HC,X07,,,,,,,,,,
/// DI,0,点料机出口门关闭端,Exit_Close,7,HC,X07,,,,,,,,,,
/// </summary>
public static string Tray13_Check = "Tray13_Check";
public static string Exit_Close = "Exit_Close";
/// <summary>
/// DI,0,上料区15寸料盘检测,Tray15_Check,8,HC,X08,,,,,,,,,,
/// DI,0,点料机内部料盘检测,Tray_Inside_Check,8,HC,X08,,,,,,,,,,
/// </summary>
public static string Tray15_Check = "Tray15_Check";
public static string Tray_Inside_Check = "Tray_Inside_Check";
/// <summary>
/// DI,0,上料区定位气缸上升端,Location_Cylinder_Up,9,HC,X09,,,,,,,,,,
/// DI,0,点料机门禁,Xray_Door_Check,9,HC,X09,,,,,,,,,,
/// </summary>
public static string Location_Cylinder_Up = "Location_Cylinder_Up";
public static string Xray_Door_Check = "Xray_Door_Check";
/// <summary>
/// DI,0,上料区定位气缸下降端,Location_Cylinder_Down,10,HC,X10,,,,,,,,,,
/// DI,0,出料皮带线料盘检测,ExitLine_Reel_Check,10,HC,X10,,,,,,,,,,
/// </summary>
public static string Location_Cylinder_Down = "Location_Cylinder_Down";
public static string ExitLine_Reel_Check = "ExitLine_Reel_Check";
/// <summary>
/// DI,0,点料机入口门打开端,Entry_Open,11,HC,X11,,,,,,,,,,
/// DI,0,过渡横移吸盘压力检测,SideMove_SuckerReel_Check,11,HC,X11,,,,,,,,,,
/// </summary>
public static string Entry_Open = "Entry_Open";
public static string SideMove_SuckerReel_Check = "SideMove_SuckerReel_Check";
/// <summary>
/// DI,0,点料机入口门关闭端,Entry_Close,12,HC,X12,,,,,,,,,,
/// DI,0,上料区光栅检测,SafetyLightCurtains,16,HC,X16,,,,,,,,,,
/// </summary>
public static string Entry_Close = "Entry_Close";
public static string SafetyLightCurtains = "SafetyLightCurtains";
/// <summary>
/// DI,0,点料机出口门打开端,Exit_Open,13,HC,X13,,,,,,,,,,
/// DI,0,上料人工确认,Manual_Confirm_BTN,17,HC,X17,,,,,,,,,,
/// </summary>
public static string Exit_Open = "Exit_Open";
public static string Manual_Confirm_BTN = "Manual_Confirm_BTN";
/// <summary>
/// DI,0,点料机出口门关闭端,Exit_Close,14,HC,X14,,,,,,,,,,
/// DI,0,上料区料盘检测,Tray_Check,18,HC,X18,,,,,,,,,,
/// </summary>
public static string Exit_Close = "Exit_Close";
public static string Tray_Check = "Tray_Check";
/// <summary>
/// DI,0,点料机内部料盘检测,Tray_Inside_Check,15,HC,X15,,,,,,,,,,
/// DI,0,上料区7寸料盘检测,Tray7_Check,19,HC,X19,,,,,,,,,,
/// </summary>
public static string Tray_Inside_Check = "Tray_Inside_Check";
public static string Tray7_Check = "Tray7_Check";
/// <summary>
/// DI,0,上料区13寸料盘检测,Tray13_Check,20,HC,X20,,,,,,,,,,
/// </summary>
public static string Tray13_Check = "Tray13_Check";
/// <summary>
/// DI,0,上料区15寸料盘检测,Tray15_Check,21,HC,X21,,,,,,,,,,
/// </summary>
public static string Tray15_Check = "Tray15_Check";
/// <summary>
/// DI,0,上料区定位气缸上升端,Location_Cylinder_Up,22,HC,X22,,,,,,,,,,
/// </summary>
public static string Location_Cylinder_Up = "Location_Cylinder_Up";
/// <summary>
/// DI,0,上料区定位气缸下降端,Location_Cylinder_Down,23,HC,X23,,,,,,,,,,
/// </summary>
public static string Location_Cylinder_Down = "Location_Cylinder_Down";
/// <summary>
/// DO,0,待机状态(指示灯),Standby_Led,0,HC,Y00,,,,,,,,,,
/// </summary>
......@@ -91,47 +109,34 @@ namespace OnlineStore.LoadCSVLibrary
/// </summary>
public static string Alarm_Buzzer = "Alarm_Buzzer";
/// <summary>
/// DO,0,上料区料盘检测OK,Pass_Led,4,HC,Y04,,,,,,,,,,
/// </summary>
public static string Pass_Led = "Pass_Led";
/// <summary>
/// DO,0,上料区料盘检测NG,NG_Led,5,HC,Y05,,,,,,,,,,
/// </summary>
public static string NG_Led = "NG_Led";
/// <summary>
/// DO,0,上料区相机光源打开,Camera_Led,6,HC,Y06,,,,,,,,,,
/// DO,0,出料皮带线启动,ExitLine_Reel_Run,4,HC,Y04,,,,,,,,,,
/// </summary>
public static string Camera_Led = "Camera_Led";
public static string ExitLine_Reel_Run = "ExitLine_Reel_Run";
/// <summary>
/// DO,0,X光机互锁信号ON,Xray_Lock,7,HC,Y07,,,,,,,,,,
/// DO,0,X光机互锁信号ON,Xray_Lock,5,HC,Y05,,,,,,,,,,
/// </summary>
public static string Xray_Lock = "Xray_Lock";
/*
/// <summary>
/// DO,0,上料区定位气缸上升,Location_Cylinder_Up,8,HC,Y08,,,,,,,,,,
/// </summary>
public static string Location_Cylinder_Up = "Location_Cylinder_Up";
/// <summary>
/// DO,0,上料区定位气缸下降,Location_Cylinder_Down,9,HC,Y09,,,,,,,,,,
/// DO,0,过渡横移吸盘吸料,SideMove_SuckerReel_On,12,HC,Y12,,,,,,,,,,
/// </summary>
public static string Location_Cylinder_Down = "Location_Cylinder_Down";
public static string SideMove_SuckerReel_On = "SideMove_SuckerReel_On";
/// <summary>
/// DO,0,点料机入口门打开,Entry_Open,10,HC,Y10,,,,,,,,,,
/// DO,0,过渡横移吸盘放料,SideMove_SuckerReel_Off,13,HC,Y13,,,,,,,,,,
/// </summary>
public static string Entry_Open = "Entry_Open";
public static string SideMove_SuckerReel_Off = "SideMove_SuckerReel_Off";
/// <summary>
/// DO,0,点料机入口门关闭,Entry_Close,11,HC,Y11,,,,,,,,,,
/// DO,0,上料区料盘检测OK,Pass_Led,16,HC,Y16,,,,,,,,,,
/// </summary>
public static string Entry_Close = "Entry_Close";
public static string Pass_Led = "Pass_Led";
/// <summary>
/// DO,0,点料机出口门打开,Exit_Open,12,HC,Y12,,,,,,,,,,
/// DO,0,上料区料盘检测NG,NG_Led,17,HC,Y17,,,,,,,,,,
/// </summary>
public static string Exit_Open = "Exit_Open";
public static string NG_Led = "NG_Led";
/// <summary>
/// DO,0,点料机出口门关闭,Exit_Close,13,HC,Y13,,,,,,,,,,
/// DO,0,上料区相机光源打开,Camera_Led,18,HC,Y18,,,,,,,,,,
/// </summary>
public static string Exit_Close = "Exit_Close";
*/
public static string Camera_Led = "Camera_Led";
/// <summary>
/// ADIO,0,左侧7寸料盘模拟量检测,Tray7_L_ADIO,0,HC,A00,,,,,,,,,,
......@@ -146,17 +151,32 @@ namespace OnlineStore.LoadCSVLibrary
/// </summary>
public static string Tray15_L_ADIO = "Tray15_L_ADIO";
/// <summary>
/// ADIO,0,右侧7寸料盘模拟量检测,Tray7_R_ADIO,3,HC,A03,,,,,,,,,,
/// ADIO,0,右侧7寸料盘模拟量检测,Tray7_R_ADIO,4,HC,A03,,,,,,,,,,
/// </summary>
public static string Tray7_R_ADIO = "Tray7_R_ADIO";
/// <summary>
/// ADIO,0,右侧13寸料盘模拟量检测,Tray13_R_ADIO,4,HC,A04,,,,,,,,,,
/// ADIO,0,右侧13寸料盘模拟量检测,Tray13_R_ADIO,5,HC,A04,,,,,,,,,,
/// </summary>
public static string Tray13_R_ADIO = "Tray13_R_ADIO";
/// <summary>
/// ADIO,0,右侧15寸料盘模拟量检测,Tray15_R_ADIO,5,HC,A05,,,,,,,,,,
/// ADIO,0,右侧15寸料盘模拟量检测,Tray15_R_ADIO,6,HC,A05,,,,,,,,,,
/// </summary>
public static string Tray15_R_ADIO = "Tray15_R_ADIO";
}
}
public enum IO_VALUE
{
/// <summary>
/// 未知
/// </summary>
None = -1,
/// <summary>
/// 低位
/// </summary>
LOW = 0,
/// <summary>
/// 高位
/// </summary>
HIGH = 1,
}
}
using log4net;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace OnlineStore.LoadCSVLibrary
{
public class Config_Label : DeviceConfig
{
public Config_Label()
: base()
{
}
public Config_Label(int id, string type, string filepath)
: base(id, type, filepath)
{
}
public override List<ConfigMoveAxis> moveAxisList { get; set; }
/// <summary>
/// AXIS,,贴标移栽机构X轴,Label_X_Axis,4,HC,,100,700,700,50,250,500,10,100,0,0
/// </summary>
[ConfigProAttribute("Label_X_Axis")]
public ConfigMoveAxis Label_X_Axis { get; set; }
/// <summary>
/// AXIS,,贴标移栽机构Y轴,Label_Y_Axis,5,HC,,100,700,700,50,150,500,10,100,0,0
/// </summary>
[ConfigProAttribute("Label_Y_Axis")]
public ConfigMoveAxis Label_Y_Axis { get; set; }
/// <summary>
/// AXIS,,贴标移栽机构Z轴,Label_Z_Axis,6,HC,,100,800,800,50,150,500,10,100,0,0
/// </summary>
[ConfigProAttribute("Label_Z_Axis")]
public ConfigMoveAxis Label_Z_Axis { get; set; }
/// <summary>
/// AXIS,,贴标移栽机构R轴,Label_R_Axis,7,HC,,10,2000,2000,1,5,200,500,100,0,0
/// </summary>
[ConfigProAttribute("Label_R_Axis")]
public ConfigMoveAxis Label_R_Axis { get; set; }
/// <summary>
/// PRO,30,相机名称,RightCameraName,123123,,,,,,,,,,,,
/// </summary>
[ConfigProAttribute("CameraName")]
public string CameraName { get; set; }
/// <summary>
/// PRO,30,右侧轴心坐标X,Right_Batch_X,222,,,,,,,,,,,,
/// </summary>
[ConfigProAttribute("Right_Batch_X")]
public int Right_Batch_X { get; set; }
/// <summary>
/// PRO,30,右侧轴心坐标Y,Right_Batch_Y,333,,,,,,,,,,,,
/// </summary>
[ConfigProAttribute("Right_Batch_Y")]
public int Right_Batch_Y { get; set; }
/// <summary>
/// PRO,30,贴标R轴0位角度差,Label_R_Angle_Diff,90,,,,,,,,,,,,
/// </summary>
[ConfigProAttribute("Label_R_Angle_Diff")]
public int Label_R_Angle_Diff { get; set; }
/// <summary>
/// PRO,30,贴标R轴360度脉冲,Label_R_360,9,,,,,,,,,,,,
/// </summary>
[ConfigProAttribute("Label_R_360")]
public int Label_R_360 { get; set; }
/// <summary>
/// PRO,30,贴标X轴基准点,Label_X_Base,8,,,,,,,,,,,,
/// </summary>
[ConfigProAttribute("Label_X_Base")]
public int Label_X_Base { get; set; }
/// <summary>
/// PRO,30,贴标Y轴基准点,Label_Y_Base,7,,,,,,,,,,,,
/// </summary>
[ConfigProAttribute("Label_Y_Base")]
public int Label_Y_Base { get; set; }
/// <summary>
/// PRO,30,图像/X轴比值,Cam_Pixel_X_Ratio,6,,,,,,,,,,,,
/// </summary>
[ConfigProAttribute("Cam_Pixel_X_Ratio")]
public double Cam_Pixel_X_Ratio { get; set; }
/// <summary>
/// PRO,30,图像/Y轴比值,Cam_Pixel_Y_Ratio,5,,,,,,,,,,,,
/// </summary>
[ConfigProAttribute("Cam_Pixel_Y_Ratio")]
public double Cam_Pixel_Y_Ratio { get; set; }
/// <summary>
/// PRO,30,像素偏离位置7寸,Label_Offset_Pixel_7,200,,,,,,,,,,,,
/// </summary>
[ConfigProAttribute("Label_Offset_Pixel_7")]
public int Label_Offset_Pixel_7 { get; set; }
/// <summary>
/// PRO,30,像素偏离位置13寸,Label_Offset_Pixel_13,200,,,,,,,,,,,,
/// </summary>
[ConfigProAttribute("Label_Offset_Pixel_13")]
public int Label_Offset_Pixel_13 { get; set; }
/// <summary>
/// PRO,30,像素偏离位置15寸,Label_Offset_Pixel_15,200,,,,,,,,,,,,
/// </summary>
[ConfigProAttribute("Label_Offset_Pixel_15")]
public int Label_Offset_Pixel_15 { get; set; }
/// <summary>
/// PRO,30,贴标R轴偏移像素,Label_R_Offset_Pixel,200,,,,,,,,,,,,
/// </summary>
[ConfigProAttribute("Label_R_Offset_Pixel")]
public int Label_R_Offset_Pixel { get; set; }
/// <summary>
/// PRO,30,贴标R轴原点角度,Label_R_Offset_Pixel,200,,,,,,,,,,,,
/// </summary>
[ConfigProAttribute("Label_R_Zero_Angle")]
public int Label_R_Zero_Angle { get; set; }
/// <summary>
/// PRO,30,贴标Z轴高度转换系数(1mm对应的脉冲),Label_Z_Axis_ChangeValue,10000,,,,,,,,,,,,
/// </summary>
[ConfigProAttribute("Label_Z_Axis_ChangeValue")]
public int Label_Z_Axis_ChangeValue { get; set; }
/// <summary>
/// PRO,30,贴标标签偏移X像素,Label_Offset_X,170,,,,,,,,,,,,
/// </summary>
[ConfigProAttribute("Label_Offset_X")]
public int Label_Offset_X { get; set; }
/// <summary>
/// PRO,30,贴标标签偏移Y像素,Label_Offset_Y,170,,,,,,,,,,,,
/// </summary>
[ConfigProAttribute("Label_Offset_Y")]
public int Label_Offset_Y { get; set; }
/// <summary>
/// PRO,30,贴标R轴最大角度,Label_R_MaxAngle,330,,,,,,,,,,,,
/// </summary>
[ConfigProAttribute("Label_R_MaxAngle")]
public int Label_R_MaxAngle { get; set; }
/// <summary>
/// PRO,13,贴标X轴待机点P1,Label_X_P1,17,,,77,,,,,,,,,
/// </summary>
[ConfigProAttribute("Label_X_P1")]
public int Label_X_P1 { get; set; }
/// <summary>
/// PRO,13,贴标X轴取标点P2,Label_X_P2,18,,,77,,,,,,,,,
/// </summary>
[ConfigProAttribute("Label_X_P2")]
public int Label_X_P2 { get; set; }
/// <summary>
/// PRO,14,贴标Y轴待机点P1,Label_Y_P1,21,,,44,,,,,,,,,
/// </summary>
[ConfigProAttribute("Label_Y_P1")]
public int Label_Y_P1 { get; set; }
/// <summary>
/// PRO,14,贴标Y轴取标点P2,Label_Y_P2,22,,,44,,,,,,,,,
/// </summary>
[ConfigProAttribute("Label_Y_P2")]
public int Label_Y_P2 { get; set; }
/// <summary>
/// PRO,15,贴标Z轴待机点P1,Label_Z_P1,25,,,44,,,,,,,,,
/// </summary>
[ConfigProAttribute("Label_Z_P1")]
public int Label_Z_P1 { get; set; }
/// <summary>
/// PRO,15,贴标Z轴取标点P2,Label_Z_P2,26,,,44,,,,,,,,,
/// </summary>
[ConfigProAttribute("Label_Z_P2")]
public int Label_Z_P2 { get; set; }
/// <summary>
/// PRO,15,贴标Z轴贴标点P3,Label_Z_P3,27,,,44,,,,,,,,,
/// </summary>
[ConfigProAttribute("Label_Z_P3")]
public int Label_Z_P3 { get; set; }
/// <summary>
/// PRO,16,贴标R轴待机点P1,Label_R_P1,29,,,22,,,,,,,,,
/// </summary>
[ConfigProAttribute("Label_R_P1")]
public int Label_R_P1 { get; set; }
/// <summary>
/// PRO,16,贴标R轴取标点P2,Label_R_P2,30,,,22,,,,,,,,,
/// </summary>
[ConfigProAttribute("Label_R_P2")]
public int Label_R_P2 { get; set; }
/// <summary>
/// PRO,13,贴标X轴待机点P1,Label_X_P1,17,,,77,,,,,,,,,
/// </summary>
[ConfigProAttribute("Label_X_P1_speed")]
public int Label_X_P1_speed { get; set; }
/// <summary>
/// PRO,13,贴标X轴取标点P2,Label_X_P2,18,,,77,,,,,,,,,
/// </summary>
[ConfigProAttribute("Label_X_P2_speed")]
public int Label_X_P2_speed { get; set; }
/// <summary>
/// PRO,14,贴标Y轴待机点P1,Label_Y_P1,21,,,44,,,,,,,,,
/// </summary>
[ConfigProAttribute("Label_Y_P1_speed")]
public int Label_Y_P1_speed { get; set; }
/// <summary>
/// PRO,14,贴标Y轴取标点P2,Label_Y_P2,22,,,44,,,,,,,,,
/// </summary>
[ConfigProAttribute("Label_Y_P2_speed")]
public int Label_Y_P2_speed { get; set; }
/// <summary>
/// PRO,15,贴标Z轴待机点P1,Label_Z_P1,25,,,44,,,,,,,,,
/// </summary>
[ConfigProAttribute("Label_Z_P1_speed")]
public int Label_Z_P1_speed { get; set; }
/// <summary>
/// PRO,15,贴标Z轴取标点P2,Label_Z_P2,26,,,44,,,,,,,,,
/// </summary>
[ConfigProAttribute("Label_Z_P2_speed")]
public int Label_Z_P2_speed { get; set; }
/// <summary>
/// PRO,15,贴标Z轴贴标点P3,Label_Z_P3,27,,,44,,,,,,,,,
/// </summary>
[ConfigProAttribute("Label_Z_P3_speed")]
public int Label_Z_P3_speed { get; set; }
/// <summary>
/// PRO,16,贴标R轴待机点P1,Label_R_P1,29,,,22,,,,,,,,,
/// </summary>
[ConfigProAttribute("Label_R_P1_speed")]
public int Label_R_P1_speed { get; set; }
/// <summary>
/// PRO,16,贴标R轴取标点P2,Label_R_P2,30,,,22,,,,,,,,,
/// </summary>
[ConfigProAttribute("Label_R_P2_speed")]
public int Label_R_P2_speed { get; set; }
/// <summary>
/// PRO,15,贴标Z轴贴标前点P4,Label_Z_P4,27,,,44,,,,,,,,,
/// </summary>
[ConfigProAttribute("Label_Z_P4")]
public int Label_Z_P4 { get; set; }
/// <summary>
/// PRO,15,贴标Z轴贴标点P5,Label_Z_P5,27,,,44,,,,,,,,,
/// </summary>
[ConfigProAttribute("Label_Z_P5")]
public int Label_Z_P5 { get; set; }
/// <summary>
/// PRO,15,贴标Z轴贴标前点P4,Label_Z_P4,27,,,44,,,,,,,,,
/// </summary>
[ConfigProAttribute("Label_Z_P4_speed")]
public int Label_Z_P4_speed { get; set; }
/// <summary>
/// PRO,15,贴标Z轴贴标点P5,Label_Z_P5,27,,,44,,,,,,,,,
/// </summary>
[ConfigProAttribute("Label_Z_P5_speed")]
public int Label_Z_P5_speed { get; set; }
/// <summary>
/// PRO,12,贴标X轴基准点,Label_X_Base,8,,,5,,,,,,,,,
/// </summary>
[ConfigProAttribute("Label_X_Base_speed")]
public int Label_X_Base_speed { get; set; }
/// <summary>
/// PRO,13,贴标Y轴基准点,Label_Y_Base,7,,,5,,,,,,,,,
/// </summary>
[ConfigProAttribute("Label_Y_Base_speed")]
public int Label_Y_Base_speed { get; set; }
/// <summary>
/// PRO,15,贴标R轴360度脉冲,Label_R_360,9,,,5,,,,,,,,,
/// </summary>
[ConfigProAttribute("Label_R_360_speed")]
public int Label_R_360_speed { get; set; }
}
}
......@@ -9,30 +9,18 @@ using System.Threading.Tasks;
namespace OnlineStore.LoadCSVLibrary
{
public class Config_Filter : DeviceConfig
public class Robot_Config : DeviceConfig
{
public Config_Filter()
public Robot_Config()
: base()
{
}
public Config_Filter(int id, string type, string filepath)
public Robot_Config(int id, string type, string filepath)
: base(id, type, filepath)
{
}
/// <summary>
/// PRO,30,NG料盒最大容量,NG_BOX_MAXCOUNT,50,,,,,,,,,,,,
/// </summary>
[ConfigProAttribute("NG_BOX_MAXCOUNT")]
public int NG_BOX_MAXCOUNT { get; set; }
/// <summary>
/// PRO,30,MSD料盒最大容量,MSD_BOX_MAXCOUNT,50,,,,,,,,,,,,
/// </summary>
[ConfigProAttribute("MSD_BOX_MAXCOUNT")]
public int MSD_BOX_MAXCOUNT { get; set; }
/// <summary>
/// PRO,30,Paper料盒最大容量,PAPER_BOX_MAXCOUNT,50,,,,,,,,,,,,
/// </summary>
[ConfigProAttribute("PAPER_BOX_MAXCOUNT")]
public int PAPER_BOX_MAXCOUNT { get; set; }
}
}

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.31112.23
# Visual Studio Version 17
VisualStudioVersion = 17.9.34902.65
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SO853-AutoCountMachine", "SO853-AutoCountMachine\SO853-AutoCountMachine.csproj", "{9B1ED5AF-2A34-43FD-AA2B-5BFB529B848D}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SO1451-AutoCountMachine", "SO853-AutoCountMachine\SO1451-AutoCountMachine.csproj", "{9B1ED5AF-2A34-43FD-AA2B-5BFB529B848D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LoadCSVLibrary", "LoadCVSLibrary\LoadCSVLibrary.csproj", "{064BEBF5-8FAA-4EA2-A5F3-A06E6E7D9251}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Common", "Common\Common.csproj", "{43CDD09E-FCF3-4960-A01D-3BBFE9933122}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DeviceLibrary", "DeviceLibrary\DeviceLibrary.csproj", "{E6879E1B-9F25-427C-8E3B-A6E977036313}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DeviceLibrary", "DeviceLibrary\DeviceLibrary.csproj", "{BB23296C-AA1D-45C6-9FA6-5A37B2ABFE9B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
......@@ -29,10 +29,10 @@ Global
{43CDD09E-FCF3-4960-A01D-3BBFE9933122}.Debug|Any CPU.Build.0 = Debug|Any CPU
{43CDD09E-FCF3-4960-A01D-3BBFE9933122}.Release|Any CPU.ActiveCfg = Release|Any CPU
{43CDD09E-FCF3-4960-A01D-3BBFE9933122}.Release|Any CPU.Build.0 = Release|Any CPU
{E6879E1B-9F25-427C-8E3B-A6E977036313}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E6879E1B-9F25-427C-8E3B-A6E977036313}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E6879E1B-9F25-427C-8E3B-A6E977036313}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E6879E1B-9F25-427C-8E3B-A6E977036313}.Release|Any CPU.Build.0 = Release|Any CPU
{BB23296C-AA1D-45C6-9FA6-5A37B2ABFE9B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BB23296C-AA1D-45C6-9FA6-5A37B2ABFE9B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BB23296C-AA1D-45C6-9FA6-5A37B2ABFE9B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BB23296C-AA1D-45C6-9FA6-5A37B2ABFE9B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
......

namespace AutoCountMachine
{
partial class FilterControl
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region 组件设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.btn_Reset = new System.Windows.Forms.Button();
this.cylinderButton13 = new AutoCountMachine.CylinderButton();
this.cylinderButton12 = new AutoCountMachine.CylinderButton();
this.cylinderButton10 = new AutoCountMachine.CylinderButton();
this.cylinderButton7 = new AutoCountMachine.CylinderButton();
this.cylinderButton6 = new AutoCountMachine.CylinderButton();
this.cylinderButton5 = new AutoCountMachine.CylinderButton();
this.cylinderButton4 = new AutoCountMachine.CylinderButton();
this.ioControl1 = new AutoCountMachine.IOControl();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.configControl1 = new AutoCountMachine.ConfigControl();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
this.tabPage2.SuspendLayout();
this.SuspendLayout();
//
// tabControl1
//
this.tabControl1.Controls.Add(this.tabPage1);
this.tabControl1.Controls.Add(this.tabPage2);
this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tabControl1.Location = new System.Drawing.Point(0, 0);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(1202, 559);
this.tabControl1.TabIndex = 0;
//
// tabPage1
//
this.tabPage1.Controls.Add(this.btn_Reset);
this.tabPage1.Controls.Add(this.cylinderButton13);
this.tabPage1.Controls.Add(this.cylinderButton12);
this.tabPage1.Controls.Add(this.cylinderButton10);
this.tabPage1.Controls.Add(this.cylinderButton7);
this.tabPage1.Controls.Add(this.cylinderButton6);
this.tabPage1.Controls.Add(this.cylinderButton5);
this.tabPage1.Controls.Add(this.cylinderButton4);
this.tabPage1.Controls.Add(this.ioControl1);
this.tabPage1.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.tabPage1.Location = new System.Drawing.Point(4, 22);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
this.tabPage1.Size = new System.Drawing.Size(1194, 533);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "I/O控制";
this.tabPage1.UseVisualStyleBackColor = true;
//
// btn_Reset
//
this.btn_Reset.Location = new System.Drawing.Point(544, 472);
this.btn_Reset.Name = "btn_Reset";
this.btn_Reset.Size = new System.Drawing.Size(85, 38);
this.btn_Reset.TabIndex = 299;
this.btn_Reset.Text = "重置";
this.btn_Reset.UseVisualStyleBackColor = true;
this.btn_Reset.Click += new System.EventHandler(this.btn_Reset_Click);
//
// cylinderButton13
//
this.cylinderButton13.BackColor = System.Drawing.Color.White;
this.cylinderButton13.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.cylinderButton13.IO_HIGH = "MSD_GetOut_Fwd";
this.cylinderButton13.IO_LOW = "MSD_GetOut_Bck";
this.cylinderButton13.Location = new System.Drawing.Point(544, 355);
this.cylinderButton13.Name = "cylinderButton13";
this.cylinderButton13.Size = new System.Drawing.Size(261, 35);
this.cylinderButton13.TabIndex = 298;
this.cylinderButton13.Text = "MSD_GetOut_Fwd";
this.cylinderButton13.UseVisualStyleBackColor = false;
//
// cylinderButton12
//
this.cylinderButton12.BackColor = System.Drawing.Color.White;
this.cylinderButton12.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.cylinderButton12.IO_HIGH = "MSD_TaryStop_Up";
this.cylinderButton12.IO_LOW = "MSD_TaryStop_Down";
this.cylinderButton12.Location = new System.Drawing.Point(544, 314);
this.cylinderButton12.Name = "cylinderButton12";
this.cylinderButton12.Size = new System.Drawing.Size(261, 35);
this.cylinderButton12.TabIndex = 298;
this.cylinderButton12.Text = "MSD_TaryStop_Up";
this.cylinderButton12.UseVisualStyleBackColor = false;
//
// cylinderButton10
//
this.cylinderButton10.BackColor = System.Drawing.Color.White;
this.cylinderButton10.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.cylinderButton10.IO_HIGH = "Line3_Run";
this.cylinderButton10.IO_LOW = "";
this.cylinderButton10.Location = new System.Drawing.Point(544, 412);
this.cylinderButton10.Name = "cylinderButton10";
this.cylinderButton10.Size = new System.Drawing.Size(261, 35);
this.cylinderButton10.TabIndex = 297;
this.cylinderButton10.Text = "Line3_Run";
this.cylinderButton10.UseVisualStyleBackColor = false;
//
// cylinderButton7
//
this.cylinderButton7.BackColor = System.Drawing.Color.White;
this.cylinderButton7.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.cylinderButton7.IO_HIGH = "Paper_GetOut_Fwd";
this.cylinderButton7.IO_LOW = "Paper_GetOut_Bck";
this.cylinderButton7.Location = new System.Drawing.Point(544, 273);
this.cylinderButton7.Name = "cylinderButton7";
this.cylinderButton7.Size = new System.Drawing.Size(261, 35);
this.cylinderButton7.TabIndex = 294;
this.cylinderButton7.Text = "Paper_GetOut_Fwd";
this.cylinderButton7.UseVisualStyleBackColor = false;
//
// cylinderButton6
//
this.cylinderButton6.BackColor = System.Drawing.Color.White;
this.cylinderButton6.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.cylinderButton6.IO_HIGH = "Paper_TaryStop_Up";
this.cylinderButton6.IO_LOW = "Paper_TaryStop_Down";
this.cylinderButton6.Location = new System.Drawing.Point(544, 232);
this.cylinderButton6.Name = "cylinderButton6";
this.cylinderButton6.Size = new System.Drawing.Size(261, 35);
this.cylinderButton6.TabIndex = 293;
this.cylinderButton6.Text = "Paper_TaryStop_Up";
this.cylinderButton6.UseVisualStyleBackColor = false;
//
// cylinderButton5
//
this.cylinderButton5.BackColor = System.Drawing.Color.White;
this.cylinderButton5.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.cylinderButton5.IO_HIGH = "NG_GetOut_Fwd";
this.cylinderButton5.IO_LOW = "NG_GetOut_Bck";
this.cylinderButton5.Location = new System.Drawing.Point(544, 191);
this.cylinderButton5.Name = "cylinderButton5";
this.cylinderButton5.Size = new System.Drawing.Size(261, 35);
this.cylinderButton5.TabIndex = 292;
this.cylinderButton5.Text = "NG_GetOut_Fwd";
this.cylinderButton5.UseVisualStyleBackColor = false;
//
// cylinderButton4
//
this.cylinderButton4.BackColor = System.Drawing.Color.White;
this.cylinderButton4.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.cylinderButton4.IO_HIGH = "NG_TaryStop_Up";
this.cylinderButton4.IO_LOW = "NG_TaryStop_Down";
this.cylinderButton4.Location = new System.Drawing.Point(544, 150);
this.cylinderButton4.Name = "cylinderButton4";
this.cylinderButton4.Size = new System.Drawing.Size(261, 35);
this.cylinderButton4.TabIndex = 291;
this.cylinderButton4.Text = "NG_TaryStop_Up";
this.cylinderButton4.UseVisualStyleBackColor = false;
//
// ioControl1
//
this.ioControl1.Config = null;
this.ioControl1.Dock = System.Windows.Forms.DockStyle.Fill;
this.ioControl1.Location = new System.Drawing.Point(3, 3);
this.ioControl1.Margin = new System.Windows.Forms.Padding(4);
this.ioControl1.Name = "ioControl1";
this.ioControl1.Size = new System.Drawing.Size(1188, 527);
this.ioControl1.TabIndex = 0;
//
// tabPage2
//
this.tabPage2.Controls.Add(this.configControl1);
this.tabPage2.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.tabPage2.Location = new System.Drawing.Point(4, 22);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Size = new System.Drawing.Size(1194, 533);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "参数配置";
this.tabPage2.UseVisualStyleBackColor = true;
//
// configControl1
//
this.configControl1.Location = new System.Drawing.Point(3, 3);
this.configControl1.Name = "configControl1";
this.configControl1.Size = new System.Drawing.Size(663, 293);
this.configControl1.TabIndex = 0;
//
// FilterControl
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.Controls.Add(this.tabControl1);
this.Name = "FilterControl";
this.Size = new System.Drawing.Size(1202, 559);
this.Load += new System.EventHandler(this.XrayControl_Load);
this.tabControl1.ResumeLayout(false);
this.tabPage1.ResumeLayout(false);
this.tabPage2.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.TabControl tabControl1;
private System.Windows.Forms.TabPage tabPage1;
private IOControl ioControl1;
private CylinderButton cylinderButton7;
private CylinderButton cylinderButton6;
private CylinderButton cylinderButton5;
private CylinderButton cylinderButton4;
private CylinderButton cylinderButton10;
private CylinderButton cylinderButton13;
private CylinderButton cylinderButton12;
private System.Windows.Forms.Button btn_Reset;
private System.Windows.Forms.TabPage tabPage2;
private ConfigControl configControl1;
}
}
using DeviceLibrary;
using OnlineStore.LoadCSVLibrary;
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 FilterControl : UserControl
{
DeviceConfig _Config;
public DeviceConfig Config
{
get { return _Config; }
set
{
_Config = value;
ioControl1.Config = value;
configControl1.Config = value;
}
}
public FilterControl()
{
InitializeComponent();
RoleManger.RoleChange += RoleManger_RoleChange;
}
private void RoleManger_RoleChange(object sender, Role e)
{
tabPage2.Controls[0].Enabled = false;
if (e != Role.Admin)
return;
tabPage2.Controls[0].Enabled = true;
}
private void XrayControl_Load(object sender, EventArgs e)
{
}
private void btn_Reset_Click(object sender, EventArgs e)
{
if (RobotManage.filterMachine.runStatus != RunStatus.HomeReset)
{
RobotManage.filterMachine.BeginHomeReset();
}
}
}
}
<?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
......@@ -40,6 +40,13 @@ namespace AutoCountMachine
this.toolStripSeparator6 = new System.Windows.Forms.ToolStripSeparator();
this.算法匹配最后物料toolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator();
this.toolStripSeparator13 = new System.Windows.Forms.ToolStripSeparator();
this.toolStripSeparator12 = new System.Windows.Forms.ToolStripSeparator();
this.toolStripSeparator11 = new System.Windows.Forms.ToolStripSeparator();
this.toolStripSeparator10 = new System.Windows.Forms.ToolStripSeparator();
this.toolStripSeparator9 = new System.Windows.Forms.ToolStripSeparator();
this.toolStripSeparator7 = new System.Windows.Forms.ToolStripSeparator();
this.toolStripSeparator8 = new System.Windows.Forms.ToolStripSeparator();
this.退出ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.操作权限ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.操作员ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
......@@ -53,9 +60,7 @@ namespace AutoCountMachine
this.tabPage1 = new System.Windows.Forms.TabPage();
this.label_Productivity = new System.Windows.Forms.Label();
this.btn_PauseBuzzer = new System.Windows.Forms.Button();
this.boxResetControl1 = new AutoCountMachine.BoxResetControl();
this.cmb_runmode = new System.Windows.Forms.ComboBox();
this.btn_releaseshelf = new System.Windows.Forms.Button();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.listView_reelnfo = new System.Windows.Forms.ListView();
this.groupBox1 = new System.Windows.Forms.GroupBox();
......@@ -65,13 +70,6 @@ namespace AutoCountMachine
this.btn_stop = new System.Windows.Forms.Button();
this.btn_run = new System.Windows.Forms.Button();
this.listView1 = new System.Windows.Forms.ListView();
this.toolStripSeparator7 = new System.Windows.Forms.ToolStripSeparator();
this.toolStripSeparator8 = new System.Windows.Forms.ToolStripSeparator();
this.toolStripSeparator9 = new System.Windows.Forms.ToolStripSeparator();
this.toolStripSeparator10 = new System.Windows.Forms.ToolStripSeparator();
this.toolStripSeparator11 = new System.Windows.Forms.ToolStripSeparator();
this.toolStripSeparator12 = new System.Windows.Forms.ToolStripSeparator();
this.toolStripSeparator13 = new System.Windows.Forms.ToolStripSeparator();
this.menuStrip1.SuspendLayout();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
......@@ -166,6 +164,41 @@ namespace AutoCountMachine
this.toolStripSeparator4.Name = "toolStripSeparator4";
this.toolStripSeparator4.Size = new System.Drawing.Size(205, 6);
//
// toolStripSeparator13
//
this.toolStripSeparator13.Name = "toolStripSeparator13";
this.toolStripSeparator13.Size = new System.Drawing.Size(205, 6);
//
// toolStripSeparator12
//
this.toolStripSeparator12.Name = "toolStripSeparator12";
this.toolStripSeparator12.Size = new System.Drawing.Size(205, 6);
//
// toolStripSeparator11
//
this.toolStripSeparator11.Name = "toolStripSeparator11";
this.toolStripSeparator11.Size = new System.Drawing.Size(205, 6);
//
// toolStripSeparator10
//
this.toolStripSeparator10.Name = "toolStripSeparator10";
this.toolStripSeparator10.Size = new System.Drawing.Size(205, 6);
//
// toolStripSeparator9
//
this.toolStripSeparator9.Name = "toolStripSeparator9";
this.toolStripSeparator9.Size = new System.Drawing.Size(205, 6);
//
// toolStripSeparator7
//
this.toolStripSeparator7.Name = "toolStripSeparator7";
this.toolStripSeparator7.Size = new System.Drawing.Size(205, 6);
//
// toolStripSeparator8
//
this.toolStripSeparator8.Name = "toolStripSeparator8";
this.toolStripSeparator8.Size = new System.Drawing.Size(205, 6);
//
// 退出ToolStripMenuItem
//
this.退出ToolStripMenuItem.Name = "退出ToolStripMenuItem";
......@@ -255,9 +288,7 @@ namespace AutoCountMachine
//
this.tabPage1.Controls.Add(this.label_Productivity);
this.tabPage1.Controls.Add(this.btn_PauseBuzzer);
this.tabPage1.Controls.Add(this.boxResetControl1);
this.tabPage1.Controls.Add(this.cmb_runmode);
this.tabPage1.Controls.Add(this.btn_releaseshelf);
this.tabPage1.Controls.Add(this.groupBox2);
this.tabPage1.Controls.Add(this.groupBox1);
this.tabPage1.Location = new System.Drawing.Point(4, 30);
......@@ -290,16 +321,6 @@ namespace AutoCountMachine
this.btn_PauseBuzzer.Visible = false;
this.btn_PauseBuzzer.Click += new System.EventHandler(this.btn_PauseBuzzer_Click);
//
// boxResetControl1
//
this.boxResetControl1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.boxResetControl1.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.boxResetControl1.Location = new System.Drawing.Point(790, 249);
this.boxResetControl1.Margin = new System.Windows.Forms.Padding(5);
this.boxResetControl1.Name = "boxResetControl1";
this.boxResetControl1.Size = new System.Drawing.Size(207, 279);
this.boxResetControl1.TabIndex = 5;
//
// cmb_runmode
//
this.cmb_runmode.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
......@@ -317,17 +338,6 @@ namespace AutoCountMachine
this.cmb_runmode.TabIndex = 4;
this.cmb_runmode.SelectedIndexChanged += new System.EventHandler(this.cmb_runmode_SelectedIndexChanged);
//
// btn_releaseshelf
//
this.btn_releaseshelf.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btn_releaseshelf.Location = new System.Drawing.Point(817, 23);
this.btn_releaseshelf.Name = "btn_releaseshelf";
this.btn_releaseshelf.Size = new System.Drawing.Size(152, 37);
this.btn_releaseshelf.TabIndex = 3;
this.btn_releaseshelf.Text = "强制释放料架";
this.btn_releaseshelf.UseVisualStyleBackColor = true;
this.btn_releaseshelf.Click += new System.EventHandler(this.btn_releaseshelf_Click);
//
// groupBox2
//
this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
......@@ -435,41 +445,6 @@ namespace AutoCountMachine
this.listView1.TabIndex = 7;
this.listView1.UseCompatibleStateImageBehavior = false;
//
// toolStripSeparator7
//
this.toolStripSeparator7.Name = "toolStripSeparator7";
this.toolStripSeparator7.Size = new System.Drawing.Size(205, 6);
//
// toolStripSeparator8
//
this.toolStripSeparator8.Name = "toolStripSeparator8";
this.toolStripSeparator8.Size = new System.Drawing.Size(205, 6);
//
// toolStripSeparator9
//
this.toolStripSeparator9.Name = "toolStripSeparator9";
this.toolStripSeparator9.Size = new System.Drawing.Size(205, 6);
//
// toolStripSeparator10
//
this.toolStripSeparator10.Name = "toolStripSeparator10";
this.toolStripSeparator10.Size = new System.Drawing.Size(205, 6);
//
// toolStripSeparator11
//
this.toolStripSeparator11.Name = "toolStripSeparator11";
this.toolStripSeparator11.Size = new System.Drawing.Size(205, 6);
//
// toolStripSeparator12
//
this.toolStripSeparator12.Name = "toolStripSeparator12";
this.toolStripSeparator12.Size = new System.Drawing.Size(205, 6);
//
// toolStripSeparator13
//
this.toolStripSeparator13.Name = "toolStripSeparator13";
this.toolStripSeparator13.Size = new System.Drawing.Size(205, 6);
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
......@@ -519,9 +494,7 @@ namespace AutoCountMachine
private System.Windows.Forms.ToolStripMenuItem 点料算法匹配toolStripMenuItem;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.ListView listView_reelnfo;
private System.Windows.Forms.Button btn_releaseshelf;
private System.Windows.Forms.ComboBox cmb_runmode;
private BoxResetControl boxResetControl1;
private System.Windows.Forms.Button btn_PauseBuzzer;
private System.Windows.Forms.TabPage tabPage2;
private System.Windows.Forms.ToolStripMenuItem 操作权限ToolStripMenuItem;
......
......@@ -17,13 +17,9 @@ namespace AutoCountMachine
public partial class Form1 : Form
{
XrayControl xrayControl = new XrayControl();
LabelControl labelControl = new LabelControl();
FilterControl filterControl = new FilterControl();
T1Control t1Control = new T1Control();
Dictionary<string, List<Msg>> MsgPool = new Dictionary<string, List<Msg>>();
readonly System.Windows.Forms.Timer t1 = new System.Windows.Forms.Timer();
//EventHandler<List<Msg>> MsgEventHandler;
public Form1()
{
......@@ -314,12 +310,6 @@ namespace AutoCountMachine
{
xrayControl.Config = RobotManage.xrayMachine.Config;
AddForm("device_xray_name",crc.GetString("device_xray_name", "点料机"), xrayControl);
labelControl.Config = RobotManage.labelMachine.Config;
AddForm("device_label_name", crc.GetString("device_label_name", "贴标机"), labelControl);
filterControl.Config = RobotManage.filterMachine.Config;
AddForm("device_filter_name", crc.GetString("device_filter_name", "分料线"), filterControl);
t1Control.Config = RobotManage.t1Machine.Config;
AddForm("device_t1_name", crc.GetString("device_t1_name", "出料线"), t1Control);
RoleManger.SetRole(Role.User);
LanguageProcess();
}
......@@ -429,25 +419,6 @@ namespace AutoCountMachine
Pn_Algo_Match.LoadFile();
});
}
private void btn_releaseshelf_Click(object sender, EventArgs e)
{
if (!RobotManage.isRunning)
{
MessageBox.Show(crc.GetString("device_shelf_cantrelease", "系统未启动,不能释放"));
return;
}
if (RobotManage.t1Machine.ReleaseShelf())
{
MessageBox.Show(crc.GetString("device_shelf_release_success", "料架开始释放"));
}
else
{
MessageBox.Show(crc.GetString("device_shelf_release_failed", "料架释放失败"));
}
}
private void cmb_runmode_SelectedIndexChanged(object sender, EventArgs e)
{
RobotManage.offlinereelLocation = new ReelLocation();
......

namespace AutoCountMachine
{
partial class LabelControl
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region 组件设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.btn_line2_stop = new System.Windows.Forms.Button();
this.btn_line1_stop = new System.Windows.Forms.Button();
this.btn_line2_run = new System.Windows.Forms.Button();
this.btn_line1_run = new System.Windows.Forms.Button();
this.cylinderButton11 = new AutoCountMachine.CylinderButton();
this.cylinderButton2 = new AutoCountMachine.CylinderButton();
this.cylinderButton3 = new AutoCountMachine.CylinderButton();
this.cylinderButton1 = new AutoCountMachine.CylinderButton();
this.btn_Reset = new System.Windows.Forms.Button();
this.ioControl1 = new AutoCountMachine.IOControl();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.panel1 = new System.Windows.Forms.Panel();
this.configControl1 = new AutoCountMachine.ConfigControl();
this.axisMoveControl1 = new DeviceLibrary.AxisMoveControl();
this.tabPage3 = new System.Windows.Forms.TabPage();
this.panel2 = new System.Windows.Forms.Panel();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.btn_labeledit = new System.Windows.Forms.Button();
this.cb_labelselect = new System.Windows.Forms.ComboBox();
this.cb_printerselect = new System.Windows.Forms.ComboBox();
this.button2 = new System.Windows.Forms.Button();
this.btn_LabelTest = new System.Windows.Forms.Button();
this.checkBox_saveLabelDebugBmp = new System.Windows.Forms.CheckBox();
this.button1 = new System.Windows.Forms.Button();
this.chb_disablelabel = new System.Windows.Forms.CheckBox();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
this.tabPage2.SuspendLayout();
this.panel1.SuspendLayout();
this.tabPage3.SuspendLayout();
this.panel2.SuspendLayout();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
// tabControl1
//
this.tabControl1.Controls.Add(this.tabPage1);
this.tabControl1.Controls.Add(this.tabPage2);
this.tabControl1.Controls.Add(this.tabPage3);
this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tabControl1.Location = new System.Drawing.Point(0, 0);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(1202, 559);
this.tabControl1.TabIndex = 0;
//
// tabPage1
//
this.tabPage1.Controls.Add(this.btn_line2_stop);
this.tabPage1.Controls.Add(this.btn_line1_stop);
this.tabPage1.Controls.Add(this.btn_line2_run);
this.tabPage1.Controls.Add(this.btn_line1_run);
this.tabPage1.Controls.Add(this.cylinderButton11);
this.tabPage1.Controls.Add(this.cylinderButton2);
this.tabPage1.Controls.Add(this.cylinderButton3);
this.tabPage1.Controls.Add(this.cylinderButton1);
this.tabPage1.Controls.Add(this.btn_Reset);
this.tabPage1.Controls.Add(this.ioControl1);
this.tabPage1.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.tabPage1.Location = new System.Drawing.Point(4, 25);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
this.tabPage1.Size = new System.Drawing.Size(1194, 530);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "I/O控制";
this.tabPage1.UseVisualStyleBackColor = true;
//
// btn_line2_stop
//
this.btn_line2_stop.Location = new System.Drawing.Point(687, 378);
this.btn_line2_stop.Name = "btn_line2_stop";
this.btn_line2_stop.Size = new System.Drawing.Size(127, 35);
this.btn_line2_stop.TabIndex = 304;
this.btn_line2_stop.Text = "线体2关";
this.btn_line2_stop.UseVisualStyleBackColor = true;
this.btn_line2_stop.Click += new System.EventHandler(this.btn_line2_stop_Click);
//
// btn_line1_stop
//
this.btn_line1_stop.Location = new System.Drawing.Point(687, 337);
this.btn_line1_stop.Name = "btn_line1_stop";
this.btn_line1_stop.Size = new System.Drawing.Size(127, 35);
this.btn_line1_stop.TabIndex = 304;
this.btn_line1_stop.Text = "线体1关";
this.btn_line1_stop.UseVisualStyleBackColor = true;
this.btn_line1_stop.Click += new System.EventHandler(this.btn_line1_stop_Click);
//
// btn_line2_run
//
this.btn_line2_run.Location = new System.Drawing.Point(553, 378);
this.btn_line2_run.Name = "btn_line2_run";
this.btn_line2_run.Size = new System.Drawing.Size(127, 35);
this.btn_line2_run.TabIndex = 304;
this.btn_line2_run.Text = "线体2开";
this.btn_line2_run.UseVisualStyleBackColor = true;
this.btn_line2_run.Click += new System.EventHandler(this.btn_line2_run_Click);
//
// btn_line1_run
//
this.btn_line1_run.Location = new System.Drawing.Point(553, 337);
this.btn_line1_run.Name = "btn_line1_run";
this.btn_line1_run.Size = new System.Drawing.Size(127, 35);
this.btn_line1_run.TabIndex = 304;
this.btn_line1_run.Text = "线体1开";
this.btn_line1_run.UseVisualStyleBackColor = true;
this.btn_line1_run.Click += new System.EventHandler(this.btn_line1_run_Click);
//
// cylinderButton11
//
this.cylinderButton11.BackColor = System.Drawing.Color.White;
this.cylinderButton11.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.cylinderButton11.IO_HIGH = "Y18";
this.cylinderButton11.IO_LOW = "";
this.cylinderButton11.Location = new System.Drawing.Point(553, 296);
this.cylinderButton11.Name = "cylinderButton11";
this.cylinderButton11.Size = new System.Drawing.Size(261, 35);
this.cylinderButton11.TabIndex = 301;
this.cylinderButton11.Tag = "not";
this.cylinderButton11.Text = "Y18";
this.cylinderButton11.UseVisualStyleBackColor = false;
//
// cylinderButton2
//
this.cylinderButton2.BackColor = System.Drawing.Color.White;
this.cylinderButton2.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.cylinderButton2.IO_HIGH = "Label_Stop_Up";
this.cylinderButton2.IO_LOW = "Label_Stop_Down";
this.cylinderButton2.Location = new System.Drawing.Point(553, 214);
this.cylinderButton2.Name = "cylinderButton2";
this.cylinderButton2.Size = new System.Drawing.Size(261, 35);
this.cylinderButton2.TabIndex = 298;
this.cylinderButton2.Tag = "not";
this.cylinderButton2.Text = "Label_Stop_Up";
this.cylinderButton2.UseVisualStyleBackColor = false;
//
// cylinderButton3
//
this.cylinderButton3.BackColor = System.Drawing.Color.White;
this.cylinderButton3.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.cylinderButton3.IO_HIGH = "LabelCylinder_Work";
this.cylinderButton3.IO_LOW = "";
this.cylinderButton3.Location = new System.Drawing.Point(553, 255);
this.cylinderButton3.Name = "cylinderButton3";
this.cylinderButton3.Size = new System.Drawing.Size(261, 35);
this.cylinderButton3.TabIndex = 300;
this.cylinderButton3.Tag = "not";
this.cylinderButton3.Text = "LabelCylinder_Work";
this.cylinderButton3.UseVisualStyleBackColor = false;
//
// cylinderButton1
//
this.cylinderButton1.BackColor = System.Drawing.Color.White;
this.cylinderButton1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.cylinderButton1.IO_HIGH = "TrayStop_Up";
this.cylinderButton1.IO_LOW = "TrayStop_Down";
this.cylinderButton1.Location = new System.Drawing.Point(553, 173);
this.cylinderButton1.Name = "cylinderButton1";
this.cylinderButton1.Size = new System.Drawing.Size(261, 35);
this.cylinderButton1.TabIndex = 299;
this.cylinderButton1.Tag = "not";
this.cylinderButton1.Text = "TrayStop_Up";
this.cylinderButton1.UseVisualStyleBackColor = false;
//
// btn_Reset
//
this.btn_Reset.Location = new System.Drawing.Point(553, 474);
this.btn_Reset.Name = "btn_Reset";
this.btn_Reset.Size = new System.Drawing.Size(85, 38);
this.btn_Reset.TabIndex = 1;
this.btn_Reset.Text = "重置";
this.btn_Reset.UseVisualStyleBackColor = true;
this.btn_Reset.Click += new System.EventHandler(this.btn_Reset_Click);
//
// ioControl1
//
this.ioControl1.Config = null;
this.ioControl1.Dock = System.Windows.Forms.DockStyle.Fill;
this.ioControl1.Location = new System.Drawing.Point(3, 3);
this.ioControl1.Margin = new System.Windows.Forms.Padding(4);
this.ioControl1.Name = "ioControl1";
this.ioControl1.Size = new System.Drawing.Size(1188, 524);
this.ioControl1.TabIndex = 0;
this.ioControl1.Tag = "not";
//
// tabPage2
//
this.tabPage2.Controls.Add(this.panel1);
this.tabPage2.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.tabPage2.Location = new System.Drawing.Point(4, 25);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
this.tabPage2.Size = new System.Drawing.Size(1194, 530);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "伺服配置";
this.tabPage2.UseVisualStyleBackColor = true;
//
// panel1
//
this.panel1.AutoScroll = true;
this.panel1.Controls.Add(this.configControl1);
this.panel1.Controls.Add(this.axisMoveControl1);
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel1.Location = new System.Drawing.Point(3, 3);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(1188, 524);
this.panel1.TabIndex = 2;
//
// configControl1
//
this.configControl1.Location = new System.Drawing.Point(558, 3);
this.configControl1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.configControl1.Name = "configControl1";
this.configControl1.Size = new System.Drawing.Size(637, 569);
this.configControl1.TabIndex = 0;
this.configControl1.Tag = "not";
//
// axisMoveControl1
//
this.axisMoveControl1.Location = new System.Drawing.Point(3, 3);
this.axisMoveControl1.Name = "axisMoveControl1";
this.axisMoveControl1.Size = new System.Drawing.Size(699, 402);
this.axisMoveControl1.TabIndex = 1;
this.axisMoveControl1.Tag = "not";
//
// tabPage3
//
this.tabPage3.Controls.Add(this.panel2);
this.tabPage3.Location = new System.Drawing.Point(4, 25);
this.tabPage3.Name = "tabPage3";
this.tabPage3.Size = new System.Drawing.Size(1194, 530);
this.tabPage3.TabIndex = 2;
this.tabPage3.Text = "标签设置";
this.tabPage3.UseVisualStyleBackColor = true;
//
// panel2
//
this.panel2.Controls.Add(this.chb_disablelabel);
this.panel2.Controls.Add(this.groupBox1);
this.panel2.Controls.Add(this.button2);
this.panel2.Controls.Add(this.btn_LabelTest);
this.panel2.Controls.Add(this.checkBox_saveLabelDebugBmp);
this.panel2.Controls.Add(this.button1);
this.panel2.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel2.Location = new System.Drawing.Point(0, 0);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(1194, 530);
this.panel2.TabIndex = 6;
//
// groupBox1
//
this.groupBox1.Controls.Add(this.label2);
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Controls.Add(this.btn_labeledit);
this.groupBox1.Controls.Add(this.cb_labelselect);
this.groupBox1.Controls.Add(this.cb_printerselect);
this.groupBox1.Location = new System.Drawing.Point(13, 14);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(319, 160);
this.groupBox1.TabIndex = 1;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "打印设置";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(19, 78);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(52, 15);
this.label2.TabIndex = 2;
this.label2.Text = "标签名";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(19, 40);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(52, 15);
this.label1.TabIndex = 2;
this.label1.Text = "打印机";
//
// btn_labeledit
//
this.btn_labeledit.Location = new System.Drawing.Point(179, 115);
this.btn_labeledit.Name = "btn_labeledit";
this.btn_labeledit.Size = new System.Drawing.Size(107, 31);
this.btn_labeledit.TabIndex = 1;
this.btn_labeledit.Text = "标签编辑";
this.btn_labeledit.UseVisualStyleBackColor = true;
this.btn_labeledit.Click += new System.EventHandler(this.btn_labeledit_Click);
//
// cb_labelselect
//
this.cb_labelselect.FormattingEnabled = true;
this.cb_labelselect.Location = new System.Drawing.Point(88, 75);
this.cb_labelselect.Name = "cb_labelselect";
this.cb_labelselect.Size = new System.Drawing.Size(198, 23);
this.cb_labelselect.TabIndex = 0;
this.cb_labelselect.Tag = "not";
this.cb_labelselect.SelectedIndexChanged += new System.EventHandler(this.cb_labelselect_SelectedIndexChanged);
//
// cb_printerselect
//
this.cb_printerselect.FormattingEnabled = true;
this.cb_printerselect.Location = new System.Drawing.Point(88, 37);
this.cb_printerselect.Name = "cb_printerselect";
this.cb_printerselect.Size = new System.Drawing.Size(198, 23);
this.cb_printerselect.TabIndex = 0;
this.cb_printerselect.Tag = "not";
this.cb_printerselect.SelectedIndexChanged += new System.EventHandler(this.cb_printerselect_SelectedIndexChanged);
//
// button2
//
this.button2.Location = new System.Drawing.Point(211, 279);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(121, 42);
this.button2.TabIndex = 5;
this.button2.Text = "button2";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// btn_LabelTest
//
this.btn_LabelTest.Location = new System.Drawing.Point(25, 208);
this.btn_LabelTest.Name = "btn_LabelTest";
this.btn_LabelTest.Size = new System.Drawing.Size(127, 36);
this.btn_LabelTest.TabIndex = 2;
this.btn_LabelTest.Text = "贴标测试";
this.btn_LabelTest.UseVisualStyleBackColor = true;
this.btn_LabelTest.Click += new System.EventHandler(this.btn_LabelTest_Click);
//
// checkBox_saveLabelDebugBmp
//
this.checkBox_saveLabelDebugBmp.AutoSize = true;
this.checkBox_saveLabelDebugBmp.Checked = true;
this.checkBox_saveLabelDebugBmp.CheckState = System.Windows.Forms.CheckState.Checked;
this.checkBox_saveLabelDebugBmp.Location = new System.Drawing.Point(25, 181);
this.checkBox_saveLabelDebugBmp.Name = "checkBox_saveLabelDebugBmp";
this.checkBox_saveLabelDebugBmp.Size = new System.Drawing.Size(149, 19);
this.checkBox_saveLabelDebugBmp.TabIndex = 4;
this.checkBox_saveLabelDebugBmp.Text = "保存贴标调试图像";
this.checkBox_saveLabelDebugBmp.UseVisualStyleBackColor = true;
this.checkBox_saveLabelDebugBmp.CheckedChanged += new System.EventHandler(this.checkBox_saveLabelDebugBmp_CheckedChanged);
//
// button1
//
this.button1.Location = new System.Drawing.Point(211, 208);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(121, 36);
this.button1.TabIndex = 3;
this.button1.Text = "button1";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// chb_disablelabel
//
this.chb_disablelabel.AutoSize = true;
this.chb_disablelabel.Location = new System.Drawing.Point(375, 14);
this.chb_disablelabel.Name = "chb_disablelabel";
this.chb_disablelabel.Size = new System.Drawing.Size(89, 19);
this.chb_disablelabel.TabIndex = 6;
this.chb_disablelabel.Text = "跳过贴标";
this.chb_disablelabel.UseVisualStyleBackColor = true;
this.chb_disablelabel.CheckedChanged += new System.EventHandler(this.chb_disablelabel_CheckedChanged);
//
// LabelControl
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.Controls.Add(this.tabControl1);
this.Name = "LabelControl";
this.Size = new System.Drawing.Size(1202, 559);
this.Load += new System.EventHandler(this.XrayControl_Load);
this.tabControl1.ResumeLayout(false);
this.tabPage1.ResumeLayout(false);
this.tabPage2.ResumeLayout(false);
this.panel1.ResumeLayout(false);
this.tabPage3.ResumeLayout(false);
this.panel2.ResumeLayout(false);
this.panel2.PerformLayout();
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.TabControl tabControl1;
private System.Windows.Forms.TabPage tabPage1;
private System.Windows.Forms.TabPage tabPage2;
private IOControl ioControl1;
private ConfigControl configControl1;
private DeviceLibrary.AxisMoveControl axisMoveControl1;
private System.Windows.Forms.TabPage tabPage3;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button btn_labeledit;
private System.Windows.Forms.ComboBox cb_labelselect;
private System.Windows.Forms.ComboBox cb_printerselect;
private System.Windows.Forms.Button btn_LabelTest;
private System.Windows.Forms.Button btn_Reset;
private CylinderButton cylinderButton11;
private CylinderButton cylinderButton3;
private CylinderButton cylinderButton2;
private CylinderButton cylinderButton1;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.CheckBox checkBox_saveLabelDebugBmp;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.Button btn_line2_stop;
private System.Windows.Forms.Button btn_line1_stop;
private System.Windows.Forms.Button btn_line2_run;
private System.Windows.Forms.Button btn_line1_run;
private System.Windows.Forms.CheckBox chb_disablelabel;
}
}
using CodeLibrary;
using DeviceLibrary;
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
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 LabelControl : UserControl
{
readonly Timer t1 = new Timer();
DeviceConfig _Config;
public DeviceConfig Config
{
get { return _Config; }
set
{
_Config = value;
ioControl1.Config = value;
configControl1.Config = value;
axisMoveControl1.LoadData(value);
}
}
public LabelControl()
{
InitializeComponent();
RobotManage.LoadFinishEvent += RobotManage_LoadFinishEvent;
RoleManger.RoleChange += RoleManger_RoleChange;
}
private void RoleManger_RoleChange(object sender, Role e)
{
tabPage2.Controls[0].Enabled = false;
tabPage3.Controls[0].Enabled = false;
if (e != Role.Admin)
return;
tabPage2.Controls[0].Enabled = true;
tabPage3.Controls[0].Enabled = true;
}
private void XrayControl_Load(object sender, EventArgs e)
{
}
private void RobotManage_LoadFinishEvent(bool state, string msg)
{
if (!state)
return;
if (this.InvokeRequired)
{
this.Invoke((EventHandler)delegate
{
RobotManage_LoadFinishEvent(state, msg);
});
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())
{
cb_labelselect.Items.Add(labelname);
}
}
string PrintName = ConfigHelper.Config.Get(Setting_Init.PrinterName);
string labelName = ConfigHelper.Config.Get(Setting_Init.LabelName);
cb_printerselect.Text = PrintName;
cb_labelselect.Text = labelName;
}
private void cb_printerselect_SelectedIndexChanged(object sender, EventArgs e)
{
ConfigHelper.Config.Set(Setting_Init.PrinterName, (sender as ComboBox).Text);
RobotManage.LoadPrintSetting();
}
private void cb_labelselect_SelectedIndexChanged(object sender, EventArgs e)
{
ConfigHelper.Config.Set(Setting_Init.LabelName, (sender as ComboBox).Text);
RobotManage.LoadPrintSetting();
}
private void btn_labeledit_Click(object sender, EventArgs e)
{
RobotManage.PrintBean.EditLabel();
RobotManage_LoadFinishEvent(true, "");
RobotManage.LoadPrintSetting();
}
private void btn_LabelTest_Click(object sender, EventArgs e)
{
if (RobotManage.labelMachine.runStatus != RunStatus.Running)
{
MessageBox.Show("需要设备启动后才可使用");
return;
}
RobotManage.labelMachine.LabelTest();
}
private void btn_Reset_Click(object sender, EventArgs e)
{
if (RobotManage.labelMachine.runStatus != RunStatus.HomeReset) {
RobotManage.labelMachine.BeginHomeReset();
}
}
private void button1_Click(object sender, EventArgs e)
{
RobotManage.labelMachine.saveLabelDebugBmp = true;
var xxx = new Point(2471, 2181);
xxx.X = 5472 - xxx.X;
xxx.Y = 3648 - xxx.Y;
RobotManage.labelMachine.ClacLabel(xxx);
}
private void checkBox_saveLabelDebugBmp_CheckedChanged(object sender, EventArgs e)
{
RobotManage.labelMachine.saveLabelDebugBmp = checkBox_saveLabelDebugBmp.Checked;
}
private void button2_Click(object sender, EventArgs e)
{
Bitmap bmap = new Bitmap("D:\\853string\\Image_20210604173703078.bmp");
EyemDecode.codeType = "QR_CODE|DATA_MATRIX|CODE_39|CODE_128";
for (int i = 5; i < 14; i = i + 2)
{
var result = EyemDecode.Decoder(ref bmap, null,i);
Console.WriteLine($"{i}:{result.Count}");
foreach (var x in result) {
Console.WriteLine(x.CodeStr);
}
}
}
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}");
}
}
}
<?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
......@@ -52,6 +52,7 @@ namespace AutoCountMachine
return;
}
Environment.CurrentDirectory = Application.StartupPath;
Config.LoadMyConfig(new Setting_Init().GetType());
CheckConfigFile();
XmlConfigurator.Configure();
......
......@@ -102,12 +102,6 @@
<Compile Include="NGALGOControl.designer.cs">
<DependentUpon>NGALGOControl.cs</DependentUpon>
</Compile>
<Compile Include="UCCOMMON\BoxResetControl.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="UCCOMMON\BoxResetControl.Designer.cs">
<DependentUpon>BoxResetControl.cs</DependentUpon>
</Compile>
<Compile Include="UCCOMMON\FrmPassword.cs">
<SubType>Form</SubType>
</Compile>
......@@ -151,26 +145,8 @@
<Compile Include="UCCOMMON\IOControl.Designer.cs">
<DependentUpon>IOControl.cs</DependentUpon>
</Compile>
<Compile Include="FilterControl.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="FilterControl.Designer.cs">
<DependentUpon>FilterControl.cs</DependentUpon>
</Compile>
<Compile Include="T1Control.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="T1Control.Designer.cs">
<DependentUpon>T1Control.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="LabelControl.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="LabelControl.Designer.cs">
<DependentUpon>LabelControl.cs</DependentUpon>
</Compile>
<Compile Include="XrayControl.cs">
<SubType>UserControl</SubType>
</Compile>
......@@ -183,9 +159,6 @@
<EmbeddedResource Include="NGALGOControl.resx">
<DependentUpon>NGALGOControl.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UCCOMMON\BoxResetControl.resx">
<DependentUpon>BoxResetControl.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UCCOMMON\ConfigControl.resx">
<DependentUpon>ConfigControl.cs</DependentUpon>
</EmbeddedResource>
......@@ -198,12 +171,6 @@
<EmbeddedResource Include="UCCOMMON\IOControl.resx">
<DependentUpon>IOControl.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="FilterControl.resx">
<DependentUpon>FilterControl.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="T1Control.resx">
<DependentUpon>T1Control.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
......@@ -214,9 +181,6 @@
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<EmbeddedResource Include="LabelControl.resx">
<DependentUpon>LabelControl.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="SettingControl.resx">
<DependentUpon>SettingControl.cs</DependentUpon>
</EmbeddedResource>
......

namespace AutoCountMachine
{
partial class T1Control
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region 组件设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.btn_closeclamp = new System.Windows.Forms.Button();
this.btn_Full_Linestop = new System.Windows.Forms.Button();
this.btn_Full_Linerun = new System.Windows.Forms.Button();
this.btn_Empty_Linestop = new System.Windows.Forms.Button();
this.btn_Empty_Linerun = new System.Windows.Forms.Button();
this.btn_Reset = new System.Windows.Forms.Button();
this.btn_release = new System.Windows.Forms.Button();
this.btn_clamp = new System.Windows.Forms.Button();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.panel1 = new System.Windows.Forms.Panel();
this.axisMoveControl1 = new DeviceLibrary.AxisMoveControl();
this.tabPage3 = new System.Windows.Forms.TabPage();
this.label_eyemMulFuncTool = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button();
this.btn_eyemMulFuncTool1 = new System.Windows.Forms.Button();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.tabPage4 = new System.Windows.Forms.TabPage();
this.btn_agvout = new System.Windows.Forms.Button();
this.btn_agvin = new System.Windows.Forms.Button();
this.cylinderButton14 = new AutoCountMachine.CylinderButton();
this.cylinderButton13 = new AutoCountMachine.CylinderButton();
this.cylinderButton12 = new AutoCountMachine.CylinderButton();
this.cylinderButton6 = new AutoCountMachine.CylinderButton();
this.cylinderButton5 = new AutoCountMachine.CylinderButton();
this.cylinderButton4 = new AutoCountMachine.CylinderButton();
this.cylinderButton11 = new AutoCountMachine.CylinderButton();
this.cylinderButton10 = new AutoCountMachine.CylinderButton();
this.cylinderButton9 = new AutoCountMachine.CylinderButton();
this.cylinderButton8 = new AutoCountMachine.CylinderButton();
this.cylinderButton7 = new AutoCountMachine.CylinderButton();
this.cylinderButton1 = new AutoCountMachine.CylinderButton();
this.ioControl1 = new AutoCountMachine.IOControl();
this.configControl1 = new AutoCountMachine.ConfigControl();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
this.tabPage2.SuspendLayout();
this.panel1.SuspendLayout();
this.tabPage3.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.tabPage4.SuspendLayout();
this.SuspendLayout();
//
// tabControl1
//
this.tabControl1.Controls.Add(this.tabPage1);
this.tabControl1.Controls.Add(this.tabPage2);
this.tabControl1.Controls.Add(this.tabPage3);
this.tabControl1.Controls.Add(this.tabPage4);
this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tabControl1.Location = new System.Drawing.Point(0, 0);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(1024, 559);
this.tabControl1.TabIndex = 0;
//
// tabPage1
//
this.tabPage1.Controls.Add(this.btn_closeclamp);
this.tabPage1.Controls.Add(this.btn_Full_Linestop);
this.tabPage1.Controls.Add(this.btn_Full_Linerun);
this.tabPage1.Controls.Add(this.btn_Empty_Linestop);
this.tabPage1.Controls.Add(this.btn_Empty_Linerun);
this.tabPage1.Controls.Add(this.btn_Reset);
this.tabPage1.Controls.Add(this.btn_release);
this.tabPage1.Controls.Add(this.btn_clamp);
this.tabPage1.Controls.Add(this.cylinderButton14);
this.tabPage1.Controls.Add(this.cylinderButton13);
this.tabPage1.Controls.Add(this.cylinderButton12);
this.tabPage1.Controls.Add(this.cylinderButton6);
this.tabPage1.Controls.Add(this.cylinderButton5);
this.tabPage1.Controls.Add(this.cylinderButton4);
this.tabPage1.Controls.Add(this.cylinderButton11);
this.tabPage1.Controls.Add(this.cylinderButton10);
this.tabPage1.Controls.Add(this.cylinderButton9);
this.tabPage1.Controls.Add(this.cylinderButton8);
this.tabPage1.Controls.Add(this.cylinderButton7);
this.tabPage1.Controls.Add(this.cylinderButton1);
this.tabPage1.Controls.Add(this.ioControl1);
this.tabPage1.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.tabPage1.Location = new System.Drawing.Point(4, 25);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
this.tabPage1.Size = new System.Drawing.Size(1016, 530);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "I/O控制";
this.tabPage1.UseVisualStyleBackColor = true;
//
// btn_closeclamp
//
this.btn_closeclamp.Location = new System.Drawing.Point(653, 455);
this.btn_closeclamp.Name = "btn_closeclamp";
this.btn_closeclamp.Size = new System.Drawing.Size(107, 35);
this.btn_closeclamp.TabIndex = 306;
this.btn_closeclamp.Text = "夹爪断连";
this.btn_closeclamp.UseVisualStyleBackColor = true;
this.btn_closeclamp.Click += new System.EventHandler(this.btn_closeclamp_Click);
//
// btn_Full_Linestop
//
this.btn_Full_Linestop.Location = new System.Drawing.Point(658, 249);
this.btn_Full_Linestop.Name = "btn_Full_Linestop";
this.btn_Full_Linestop.Size = new System.Drawing.Size(102, 34);
this.btn_Full_Linestop.TabIndex = 305;
this.btn_Full_Linestop.Text = "满料串线体关";
this.btn_Full_Linestop.UseVisualStyleBackColor = true;
this.btn_Full_Linestop.Click += new System.EventHandler(this.btn_Full_Linestop_Click);
//
// btn_Full_Linerun
//
this.btn_Full_Linerun.Location = new System.Drawing.Point(545, 249);
this.btn_Full_Linerun.Name = "btn_Full_Linerun";
this.btn_Full_Linerun.Size = new System.Drawing.Size(102, 34);
this.btn_Full_Linerun.TabIndex = 305;
this.btn_Full_Linerun.Text = "满料串线体开";
this.btn_Full_Linerun.UseVisualStyleBackColor = true;
this.btn_Full_Linerun.Click += new System.EventHandler(this.btn_Full_Linerun_Click);
//
// btn_Empty_Linestop
//
this.btn_Empty_Linestop.Location = new System.Drawing.Point(658, 209);
this.btn_Empty_Linestop.Name = "btn_Empty_Linestop";
this.btn_Empty_Linestop.Size = new System.Drawing.Size(102, 34);
this.btn_Empty_Linestop.TabIndex = 305;
this.btn_Empty_Linestop.Text = "空料串线体关";
this.btn_Empty_Linestop.UseVisualStyleBackColor = true;
this.btn_Empty_Linestop.Click += new System.EventHandler(this.btn_Empty_Linestop_Click);
//
// btn_Empty_Linerun
//
this.btn_Empty_Linerun.Location = new System.Drawing.Point(545, 209);
this.btn_Empty_Linerun.Name = "btn_Empty_Linerun";
this.btn_Empty_Linerun.Size = new System.Drawing.Size(102, 34);
this.btn_Empty_Linerun.TabIndex = 305;
this.btn_Empty_Linerun.Text = "空料串线体开";
this.btn_Empty_Linerun.UseVisualStyleBackColor = true;
this.btn_Empty_Linerun.Click += new System.EventHandler(this.btn_Empty_Linerun_Click);
//
// btn_Reset
//
this.btn_Reset.Location = new System.Drawing.Point(545, 475);
this.btn_Reset.Name = "btn_Reset";
this.btn_Reset.Size = new System.Drawing.Size(85, 38);
this.btn_Reset.TabIndex = 290;
this.btn_Reset.Text = "重置";
this.btn_Reset.UseVisualStyleBackColor = true;
this.btn_Reset.Click += new System.EventHandler(this.btn_Reset_Click);
//
// btn_release
//
this.btn_release.Location = new System.Drawing.Point(653, 413);
this.btn_release.Name = "btn_release";
this.btn_release.Size = new System.Drawing.Size(107, 35);
this.btn_release.TabIndex = 304;
this.btn_release.Text = "夹爪放松";
this.btn_release.UseVisualStyleBackColor = true;
this.btn_release.Click += new System.EventHandler(this.btn_release_Click);
//
// btn_clamp
//
this.btn_clamp.Location = new System.Drawing.Point(545, 413);
this.btn_clamp.Name = "btn_clamp";
this.btn_clamp.Size = new System.Drawing.Size(102, 35);
this.btn_clamp.TabIndex = 304;
this.btn_clamp.Text = "夹爪撑开";
this.btn_clamp.UseVisualStyleBackColor = true;
this.btn_clamp.Click += new System.EventHandler(this.btn_clamp_Click);
//
// tabPage2
//
this.tabPage2.Controls.Add(this.panel1);
this.tabPage2.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.tabPage2.Location = new System.Drawing.Point(4, 25);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
this.tabPage2.Size = new System.Drawing.Size(1016, 530);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "伺服配置";
this.tabPage2.UseVisualStyleBackColor = true;
//
// panel1
//
this.panel1.AutoScroll = true;
this.panel1.Controls.Add(this.axisMoveControl1);
this.panel1.Controls.Add(this.configControl1);
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel1.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.panel1.Location = new System.Drawing.Point(3, 3);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(1010, 524);
this.panel1.TabIndex = 2;
//
// axisMoveControl1
//
this.axisMoveControl1.Location = new System.Drawing.Point(3, 3);
this.axisMoveControl1.Name = "axisMoveControl1";
this.axisMoveControl1.Size = new System.Drawing.Size(556, 402);
this.axisMoveControl1.TabIndex = 1;
this.axisMoveControl1.Tag = "not";
//
// tabPage3
//
this.tabPage3.Controls.Add(this.label_eyemMulFuncTool);
this.tabPage3.Controls.Add(this.button1);
this.tabPage3.Controls.Add(this.btn_eyemMulFuncTool1);
this.tabPage3.Controls.Add(this.pictureBox1);
this.tabPage3.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.tabPage3.Location = new System.Drawing.Point(4, 25);
this.tabPage3.Name = "tabPage3";
this.tabPage3.Padding = new System.Windows.Forms.Padding(3);
this.tabPage3.Size = new System.Drawing.Size(1016, 530);
this.tabPage3.TabIndex = 2;
this.tabPage3.Text = "料串定位";
this.tabPage3.UseVisualStyleBackColor = true;
this.tabPage3.Click += new System.EventHandler(this.tabPage3_Click);
//
// label_eyemMulFuncTool
//
this.label_eyemMulFuncTool.Location = new System.Drawing.Point(831, 277);
this.label_eyemMulFuncTool.Name = "label_eyemMulFuncTool";
this.label_eyemMulFuncTool.Size = new System.Drawing.Size(128, 173);
this.label_eyemMulFuncTool.TabIndex = 2;
this.label_eyemMulFuncTool.Text = "信息:";
//
// button1
//
this.button1.Location = new System.Drawing.Point(833, 45);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(136, 40);
this.button1.TabIndex = 1;
this.button1.Text = "料串中心检测";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click_1);
//
// btn_eyemMulFuncTool1
//
this.btn_eyemMulFuncTool1.Location = new System.Drawing.Point(833, 108);
this.btn_eyemMulFuncTool1.Name = "btn_eyemMulFuncTool1";
this.btn_eyemMulFuncTool1.Size = new System.Drawing.Size(136, 40);
this.btn_eyemMulFuncTool1.TabIndex = 1;
this.btn_eyemMulFuncTool1.Text = "伺服定位";
this.btn_eyemMulFuncTool1.UseVisualStyleBackColor = true;
this.btn_eyemMulFuncTool1.Click += new System.EventHandler(this.button1_Click);
//
// pictureBox1
//
this.pictureBox1.Location = new System.Drawing.Point(6, 6);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(819, 521);
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.pictureBox1.TabIndex = 0;
this.pictureBox1.TabStop = false;
//
// tabPage4
//
this.tabPage4.Controls.Add(this.btn_agvout);
this.tabPage4.Controls.Add(this.btn_agvin);
this.tabPage4.Location = new System.Drawing.Point(4, 25);
this.tabPage4.Name = "tabPage4";
this.tabPage4.Padding = new System.Windows.Forms.Padding(3);
this.tabPage4.Size = new System.Drawing.Size(1016, 530);
this.tabPage4.TabIndex = 3;
this.tabPage4.Text = "AGV";
this.tabPage4.UseVisualStyleBackColor = true;
this.tabPage4.Click += new System.EventHandler(this.tabPage4_Click);
//
// btn_agvout
//
this.btn_agvout.Location = new System.Drawing.Point(62, 138);
this.btn_agvout.Name = "btn_agvout";
this.btn_agvout.Size = new System.Drawing.Size(122, 29);
this.btn_agvout.TabIndex = 0;
this.btn_agvout.Text = "取满料串";
this.btn_agvout.UseVisualStyleBackColor = true;
this.btn_agvout.Click += new System.EventHandler(this.btn_agvout_Click);
//
// btn_agvin
//
this.btn_agvin.Location = new System.Drawing.Point(62, 79);
this.btn_agvin.Name = "btn_agvin";
this.btn_agvin.Size = new System.Drawing.Size(122, 29);
this.btn_agvin.TabIndex = 0;
this.btn_agvin.Text = "送空料串";
this.btn_agvin.UseVisualStyleBackColor = true;
this.btn_agvin.Click += new System.EventHandler(this.btn_agvin_Click);
//
// cylinderButton14
//
this.cylinderButton14.BackColor = System.Drawing.Color.White;
this.cylinderButton14.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.cylinderButton14.IO_HIGH = "T1_Wait_Stop";
this.cylinderButton14.IO_LOW = "";
this.cylinderButton14.Location = new System.Drawing.Point(766, 413);
this.cylinderButton14.Name = "cylinderButton14";
this.cylinderButton14.Size = new System.Drawing.Size(192, 35);
this.cylinderButton14.TabIndex = 303;
this.cylinderButton14.Tag = "not";
this.cylinderButton14.Text = "T1_Wait_Stop";
this.cylinderButton14.UseVisualStyleBackColor = false;
//
// cylinderButton13
//
this.cylinderButton13.BackColor = System.Drawing.Color.White;
this.cylinderButton13.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.cylinderButton13.IO_HIGH = "T1_Out_Stop";
this.cylinderButton13.IO_LOW = "";
this.cylinderButton13.Location = new System.Drawing.Point(766, 454);
this.cylinderButton13.Name = "cylinderButton13";
this.cylinderButton13.Size = new System.Drawing.Size(192, 35);
this.cylinderButton13.TabIndex = 303;
this.cylinderButton13.Tag = "not";
this.cylinderButton13.Text = "T1_Out_Stop";
this.cylinderButton13.UseVisualStyleBackColor = false;
//
// cylinderButton12
//
this.cylinderButton12.BackColor = System.Drawing.Color.White;
this.cylinderButton12.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.cylinderButton12.IO_HIGH = "EmptyString_Wait_Stop";
this.cylinderButton12.IO_LOW = "";
this.cylinderButton12.Location = new System.Drawing.Point(766, 372);
this.cylinderButton12.Name = "cylinderButton12";
this.cylinderButton12.Size = new System.Drawing.Size(192, 35);
this.cylinderButton12.TabIndex = 302;
this.cylinderButton12.Tag = "not";
this.cylinderButton12.Text = "EmptyString_Wait_Stop";
this.cylinderButton12.UseVisualStyleBackColor = false;
//
// cylinderButton6
//
this.cylinderButton6.BackColor = System.Drawing.Color.White;
this.cylinderButton6.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.cylinderButton6.IO_HIGH = "T1_Sliding_Run";
this.cylinderButton6.IO_LOW = "";
this.cylinderButton6.Location = new System.Drawing.Point(545, 372);
this.cylinderButton6.Name = "cylinderButton6";
this.cylinderButton6.Size = new System.Drawing.Size(215, 35);
this.cylinderButton6.TabIndex = 301;
this.cylinderButton6.Tag = "not";
this.cylinderButton6.Text = "T1_Sliding_Run";
this.cylinderButton6.UseVisualStyleBackColor = false;
//
// cylinderButton5
//
this.cylinderButton5.BackColor = System.Drawing.Color.White;
this.cylinderButton5.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.cylinderButton5.IO_HIGH = "T1String_Sliding_Run";
this.cylinderButton5.IO_LOW = "";
this.cylinderButton5.Location = new System.Drawing.Point(545, 331);
this.cylinderButton5.Name = "cylinderButton5";
this.cylinderButton5.Size = new System.Drawing.Size(215, 35);
this.cylinderButton5.TabIndex = 301;
this.cylinderButton5.Tag = "not";
this.cylinderButton5.Text = "T1String_Sliding_Run";
this.cylinderButton5.UseVisualStyleBackColor = false;
//
// cylinderButton4
//
this.cylinderButton4.BackColor = System.Drawing.Color.White;
this.cylinderButton4.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.cylinderButton4.IO_HIGH = "EmptyString_Sliding_Run";
this.cylinderButton4.IO_LOW = "";
this.cylinderButton4.Location = new System.Drawing.Point(545, 290);
this.cylinderButton4.Name = "cylinderButton4";
this.cylinderButton4.Size = new System.Drawing.Size(215, 35);
this.cylinderButton4.TabIndex = 300;
this.cylinderButton4.Tag = "not";
this.cylinderButton4.Text = "EmptyString_Sliding_Run";
this.cylinderButton4.UseVisualStyleBackColor = false;
//
// cylinderButton11
//
this.cylinderButton11.BackColor = System.Drawing.Color.White;
this.cylinderButton11.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.cylinderButton11.IO_HIGH = "EmptyString_In_Stop";
this.cylinderButton11.IO_LOW = "";
this.cylinderButton11.Location = new System.Drawing.Point(766, 331);
this.cylinderButton11.Name = "cylinderButton11";
this.cylinderButton11.Size = new System.Drawing.Size(192, 35);
this.cylinderButton11.TabIndex = 300;
this.cylinderButton11.Tag = "not";
this.cylinderButton11.Text = "EmptyString_In_Stop";
this.cylinderButton11.UseVisualStyleBackColor = false;
//
// cylinderButton10
//
this.cylinderButton10.BackColor = System.Drawing.Color.White;
this.cylinderButton10.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.cylinderButton10.IO_HIGH = "Fork_Cylinder_Fwd";
this.cylinderButton10.IO_LOW = "Fork_Cylinder_Bck";
this.cylinderButton10.Location = new System.Drawing.Point(766, 290);
this.cylinderButton10.Name = "cylinderButton10";
this.cylinderButton10.Size = new System.Drawing.Size(192, 35);
this.cylinderButton10.TabIndex = 300;
this.cylinderButton10.Tag = "not";
this.cylinderButton10.Text = "Fork_Cylinder_Fwd";
this.cylinderButton10.UseVisualStyleBackColor = false;
//
// cylinderButton9
//
this.cylinderButton9.BackColor = System.Drawing.Color.White;
this.cylinderButton9.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.cylinderButton9.IO_HIGH = "T1_Location_Cylinder_Up";
this.cylinderButton9.IO_LOW = "T1_Location_Cylinder_Down";
this.cylinderButton9.Location = new System.Drawing.Point(766, 249);
this.cylinderButton9.Name = "cylinderButton9";
this.cylinderButton9.Size = new System.Drawing.Size(192, 35);
this.cylinderButton9.TabIndex = 300;
this.cylinderButton9.Tag = "not";
this.cylinderButton9.Text = "T1_Location_Cylinder_Up";
this.cylinderButton9.UseVisualStyleBackColor = false;
//
// cylinderButton8
//
this.cylinderButton8.BackColor = System.Drawing.Color.White;
this.cylinderButton8.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.cylinderButton8.IO_HIGH = "T1_Lift_Up";
this.cylinderButton8.IO_LOW = "T1_Lift_Down";
this.cylinderButton8.Location = new System.Drawing.Point(766, 208);
this.cylinderButton8.Name = "cylinderButton8";
this.cylinderButton8.Size = new System.Drawing.Size(192, 35);
this.cylinderButton8.TabIndex = 300;
this.cylinderButton8.Tag = "not";
this.cylinderButton8.Text = "T1_Lift_Up";
this.cylinderButton8.UseVisualStyleBackColor = false;
//
// cylinderButton7
//
this.cylinderButton7.BackColor = System.Drawing.Color.White;
this.cylinderButton7.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.cylinderButton7.IO_HIGH = "EmptyString_Lift_Up";
this.cylinderButton7.IO_LOW = "EmptyString_Lift_Down";
this.cylinderButton7.Location = new System.Drawing.Point(766, 167);
this.cylinderButton7.Name = "cylinderButton7";
this.cylinderButton7.Size = new System.Drawing.Size(192, 35);
this.cylinderButton7.TabIndex = 300;
this.cylinderButton7.Tag = "not";
this.cylinderButton7.Text = "EmptyString_Lift_Up";
this.cylinderButton7.UseVisualStyleBackColor = false;
//
// cylinderButton1
//
this.cylinderButton1.BackColor = System.Drawing.Color.White;
this.cylinderButton1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.cylinderButton1.IO_HIGH = "End_Lift_Cylinder_Up";
this.cylinderButton1.IO_LOW = "End_Lift_Cylinder_Down";
this.cylinderButton1.Location = new System.Drawing.Point(545, 167);
this.cylinderButton1.Name = "cylinderButton1";
this.cylinderButton1.Size = new System.Drawing.Size(215, 35);
this.cylinderButton1.TabIndex = 300;
this.cylinderButton1.Tag = "not";
this.cylinderButton1.Text = "End_Lift_Cylinder_Up";
this.cylinderButton1.UseVisualStyleBackColor = false;
//
// ioControl1
//
this.ioControl1.Dock = System.Windows.Forms.DockStyle.Fill;
this.ioControl1.Location = new System.Drawing.Point(3, 3);
this.ioControl1.Margin = new System.Windows.Forms.Padding(4);
this.ioControl1.Name = "ioControl1";
this.ioControl1.Size = new System.Drawing.Size(1010, 524);
this.ioControl1.TabIndex = 0;
this.ioControl1.Tag = "not";
//
// configControl1
//
this.configControl1.Location = new System.Drawing.Point(565, 12);
this.configControl1.Name = "configControl1";
this.configControl1.Size = new System.Drawing.Size(688, 422);
this.configControl1.TabIndex = 0;
this.configControl1.Tag = "not";
//
// T1Control
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.Controls.Add(this.tabControl1);
this.Name = "T1Control";
this.Size = new System.Drawing.Size(1024, 559);
this.Load += new System.EventHandler(this.XrayControl_Load);
this.tabControl1.ResumeLayout(false);
this.tabPage1.ResumeLayout(false);
this.tabPage2.ResumeLayout(false);
this.panel1.ResumeLayout(false);
this.tabPage3.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.tabPage4.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.TabControl tabControl1;
private System.Windows.Forms.TabPage tabPage1;
private System.Windows.Forms.TabPage tabPage2;
private IOControl ioControl1;
private ConfigControl configControl1;
private DeviceLibrary.AxisMoveControl axisMoveControl1;
private CylinderButton cylinderButton1;
private CylinderButton cylinderButton14;
private CylinderButton cylinderButton13;
private CylinderButton cylinderButton12;
private CylinderButton cylinderButton6;
private CylinderButton cylinderButton5;
private CylinderButton cylinderButton4;
private CylinderButton cylinderButton11;
private CylinderButton cylinderButton10;
private CylinderButton cylinderButton9;
private CylinderButton cylinderButton8;
private CylinderButton cylinderButton7;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Button btn_release;
private System.Windows.Forms.Button btn_clamp;
private System.Windows.Forms.Button btn_Reset;
private System.Windows.Forms.TabPage tabPage3;
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.Button btn_eyemMulFuncTool1;
private System.Windows.Forms.Label label_eyemMulFuncTool;
private System.Windows.Forms.Button btn_Full_Linestop;
private System.Windows.Forms.Button btn_Full_Linerun;
private System.Windows.Forms.Button btn_Empty_Linestop;
private System.Windows.Forms.Button btn_Empty_Linerun;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button btn_closeclamp;
private System.Windows.Forms.TabPage tabPage4;
private System.Windows.Forms.Button btn_agvout;
private System.Windows.Forms.Button btn_agvin;
}
}
using Asa;
using CodeLibrary;
using DeviceLibrary;
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Imaging;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using static Asa.eyemLib;
using static AutoCountMachine.eyemlib;
namespace AutoCountMachine
{
public partial class T1Control : UserControl
{
readonly Timer t1 = new Timer();
DeviceConfig _Config;
public DeviceConfig Config
{
get { return _Config; }
set
{
_Config = value;
ioControl1.Config = value;
configControl1.Config = value;
axisMoveControl1.LoadData(value);
}
}
public T1Control()
{
InitializeComponent();
RobotManage.LoadFinishEvent += RobotManage_LoadFinishEvent;
RoleManger.RoleChange += RoleManger_RoleChange;
}
private void RoleManger_RoleChange(object sender, Role e)
{
tabPage2.Controls[0].Enabled = false;
if (e != Role.Admin)
return;
tabPage2.Controls[0].Enabled = true;
}
private void RobotManage_LoadFinishEvent(bool state, string msg)
{
if (state)
RobotManage.t1Machine.TrayStringLocation += T1Machine_TrayStringLocation;
}
private void T1Machine_TrayStringLocation(object sender, Bitmap e)
{
Invoke((EventHandler<Bitmap>)delegate{
pictureBox1.Image = e;
}, sender, e);
}
private void XrayControl_Load(object sender, EventArgs e)
{
}
private void btn_clamp_Click(object sender, EventArgs e)
{
RobotManage.electricGripper.Clamp();
}
private void btn_release_Click(object sender, EventArgs e)
{
RobotManage.electricGripper.Release();
}
private void btn_Reset_Click(object sender, EventArgs e)
{
if (RobotManage.t1Machine.runStatus != RunStatus.HomeReset)
{
RobotManage.t1Machine.BeginHomeReset();
}
}
private void button1_Click(object sender, EventArgs e)
{
var (bitmap, currpos, debugtxt) = RobotManage.t1Machine.GetStringCenterC();
var offset_x = currpos.X - RobotManage.t1Machine.CenterPos.X;
var offset_y = currpos.Y - RobotManage.t1Machine.CenterPos.Y;
offset_x = offset_x * -1;
offset_y = offset_y * -1;
var Y = RobotManage.t1Machine.Config.Y_P2 + offset_y * RobotManage.t1Machine.Config.Cam_Pixel_Y_Ratio;
var Pan_X = RobotManage.t1Machine.Config.Pan_P2 + offset_x * RobotManage.t1Machine.Config.Cam_Pixel_X_Ratio;
RobotManage.t1Machine.T_Pan_Axis.AbsMove(null, Pan_X, RobotManage.t1Machine.Config.Pan_P2_speed);
RobotManage.t1Machine.T_Y_Axis.AbsMove(null, Y, RobotManage.t1Machine.Config.Y_P2_speed);
RobotManage.t1Machine.MoveInfo.log($"下降到料串 CenterPos:{RobotManage.t1Machine.CenterPos}, StringCenter:{currpos}, Offset:{new Point(offset_x, offset_y)}, AXIS:{new Point(Pan_X, Y)}");
}
private void btn_Empty_Linerun_Click(object sender, EventArgs e)
{
RobotManage.t1Machine.ShelfInLine.LineRun("n",999);
}
private void btn_Empty_Linestop_Click(object sender, EventArgs e)
{
RobotManage.t1Machine.ShelfInLine.LineStop("n");
}
private void btn_Full_Linerun_Click(object sender, EventArgs e)
{
RobotManage.t1Machine.ShelfOutLine.LineRun("n",999);
}
private void btn_Full_Linestop_Click(object sender, EventArgs e)
{
RobotManage.t1Machine.ShelfOutLine.LineStop("n");
}
private void button1_Click_1(object sender, EventArgs e)
{
var (bitmap, currpos, debugtxt) = RobotManage.t1Machine.GetStringCenterC();
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")}";
pictureBox1.Image = bitmap;
}
private void btn_closeclamp_Click(object sender, EventArgs e)
{
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)
{
}
}
}
<?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
......@@ -37,18 +37,7 @@ namespace AutoCountMachine
private void Timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
this.Invoke((EventHandler)delegate {
NgCountBar.ForeColor = Color.MediumSeaGreen;
MsdCountBar.ForeColor = Color.MediumSeaGreen;
PaperCountBar.ForeColor = Color.MediumSeaGreen;
if (RobotManage.filterMachine.NGBox_Count > RobotManage.filterMachine.Config.NG_BOX_MAXCOUNT * 0.8)
NgCountBar.ForeColor = Color.Red;
if (RobotManage.filterMachine.MSDBox_Count > RobotManage.filterMachine.Config.MSD_BOX_MAXCOUNT * 0.8)
MsdCountBar.ForeColor = Color.Red;
if (RobotManage.filterMachine.PaperBox_Count > RobotManage.filterMachine.Config.PAPER_BOX_MAXCOUNT * 0.8)
PaperCountBar.ForeColor = Color.Red;
NgCountBar.Value = RobotManage.filterMachine.NGBox_Count;
MsdCountBar.Value = RobotManage.filterMachine.MSDBox_Count;
PaperCountBar.Value = RobotManage.filterMachine.PaperBox_Count;
});
}
......@@ -58,12 +47,6 @@ namespace AutoCountMachine
{
this.Invoke((EventHandler)delegate
{
NgCountBar.Maximum = RobotManage.filterMachine.Config.NG_BOX_MAXCOUNT;
MsdCountBar.Maximum = RobotManage.filterMachine.Config.MSD_BOX_MAXCOUNT;
PaperCountBar.Maximum = RobotManage.filterMachine.Config.PAPER_BOX_MAXCOUNT;
MsdCountBar.ForeColor = Color.MediumSeaGreen;
PaperCountBar.ForeColor = Color.MediumSeaGreen;
timer.Enabled = true;
timer.Start();
});
......
......@@ -44,6 +44,7 @@ namespace AutoCountMachine
this.tabPage4 = new System.Windows.Forms.TabPage();
this.panel2 = new System.Windows.Forms.Panel();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.btn_Calibration = new System.Windows.Forms.Button();
this.btn_getXrayimage = new System.Windows.Forms.Button();
this.btn_openXray = new System.Windows.Forms.Button();
this.btn_closeXray = new System.Windows.Forms.Button();
......@@ -54,7 +55,6 @@ namespace AutoCountMachine
this.btn_ManualCount = new System.Windows.Forms.Button();
this.cylinderButton4 = new AutoCountMachine.CylinderButton();
this.cylinderButton5 = new AutoCountMachine.CylinderButton();
this.btn_Calibration = new System.Windows.Forms.Button();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
this.tabPage2.SuspendLayout();
......@@ -162,6 +162,7 @@ namespace AutoCountMachine
//
// panel1
//
this.panel1.AutoScroll = true;
this.panel1.Controls.Add(this.axisMoveControl1);
this.panel1.Controls.Add(this.configControl1);
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
......@@ -180,6 +181,8 @@ namespace AutoCountMachine
//
// configControl1
//
this.configControl1.Config = null;
this.configControl1.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.configControl1.Location = new System.Drawing.Point(559, 3);
this.configControl1.Name = "configControl1";
this.configControl1.Size = new System.Drawing.Size(653, 504);
......@@ -238,6 +241,16 @@ namespace AutoCountMachine
this.pictureBox1.TabIndex = 0;
this.pictureBox1.TabStop = false;
//
// btn_Calibration
//
this.btn_Calibration.Location = new System.Drawing.Point(510, 424);
this.btn_Calibration.Name = "btn_Calibration";
this.btn_Calibration.Size = new System.Drawing.Size(129, 33);
this.btn_Calibration.TabIndex = 1;
this.btn_Calibration.Text = "Calibration";
this.btn_Calibration.UseVisualStyleBackColor = true;
this.btn_Calibration.Click += new System.EventHandler(this.btn_Calibration_Click);
//
// btn_getXrayimage
//
this.btn_getXrayimage.Location = new System.Drawing.Point(510, 133);
......@@ -289,7 +302,7 @@ namespace AutoCountMachine
this.label_tips_scancode.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label_tips_scancode.Location = new System.Drawing.Point(63, 47);
this.label_tips_scancode.Name = "label_tips_scancode";
this.label_tips_scancode.Size = new System.Drawing.Size(104, 16);
this.label_tips_scancode.Size = new System.Drawing.Size(103, 16);
this.label_tips_scancode.TabIndex = 294;
this.label_tips_scancode.Text = "请扫描二维码";
//
......@@ -299,7 +312,7 @@ namespace AutoCountMachine
this.label_countstate.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label_countstate.Location = new System.Drawing.Point(63, 131);
this.label_countstate.Name = "label_countstate";
this.label_countstate.Size = new System.Drawing.Size(88, 16);
this.label_countstate.Size = new System.Drawing.Size(87, 16);
this.label_countstate.TabIndex = 293;
this.label_countstate.Text = "当前: 待机";
//
......@@ -350,16 +363,6 @@ namespace AutoCountMachine
this.cylinderButton5.Text = "Entry_Open";
this.cylinderButton5.UseVisualStyleBackColor = false;
//
// btn_Calibration
//
this.btn_Calibration.Location = new System.Drawing.Point(510, 424);
this.btn_Calibration.Name = "btn_Calibration";
this.btn_Calibration.Size = new System.Drawing.Size(129, 33);
this.btn_Calibration.TabIndex = 1;
this.btn_Calibration.Text = "Calibration";
this.btn_Calibration.UseVisualStyleBackColor = true;
this.btn_Calibration.Click += new System.EventHandler(this.btn_Calibration_Click);
//
// XrayControl
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!