Commit e81e9bdf 刘韬

节拍12秒

1 个父辈 0aebf51b
正在显示 48 个修改的文件 包含 1949 行增加590 行删除
using log4net;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Windows.Forms.Layout;
namespace OnlineStore
{
public class CodeResourceControl
{
public static readonly ILog LOG = LogManager.GetLogger("LngResource");
//public delegate string GetStrDelegate(string id, string defaultStr);
//public static event GetStrDelegate GetStrEvent;
//public delegate string GetStringDelegate(string id, string defaultStr, params object[] param);
//public static event GetStringDelegate GetStringEvent;
public static bool OpenResourceLog = false;
public static string China = "zh-CN";
public static string English = "en-US";
//private static Dictionary<string, string> chineseMap = new Dictionary<string, string>();
//private static Dictionary<string, string> englishMap = new Dictionary<string, string>();
private static Dictionary<string,Dictionary<string, string>> LangMap = new Dictionary<string, Dictionary<string, string>>();
public delegate string GetLanguageDelegate();
public static event GetLanguageDelegate GetLanguageEvent;
public delegate void RefreshLanguageDelegate();
public static event RefreshLanguageDelegate RefreshLanguageEvent;
public static event EventHandler LanguageChangeEvent;
public static void LanguageChange() {
LanguageChangeEvent?.Invoke(null, EventArgs.Empty);
}
public static string GetLanguage()
{
if (GetLanguageEvent == null)
{
return China;
}
string result = GetLanguageEvent?.Invoke();
if (result == null)
{
return "";
}
return result;
}
private static string spiltStr = "_";
private static string Text = "Text";
public static string GetTextIdStr(string className, string controlName)
{
return className + spiltStr + controlName + spiltStr + Text;
}
public static string GetTextIdStr(string className)
{
return className + spiltStr + Text;
}
public static string GetString(string id, string defaultStr)
{
string strCurLanguage = defaultStr;
var haslang = getLangRes(CurrLanguage);
if (!haslang) {
return strCurLanguage;
}
try
{
LangMap[CurrLanguage].TryGetValue(id, out strCurLanguage);
if ((strCurLanguage == null || strCurLanguage.Equals("")) && (!defaultStr.Equals("")))
{
strCurLanguage = defaultStr;
NoIdLog(id, defaultStr);
}
}
catch (Exception ex)
{
if (defaultStr.Equals(""))
{
}
else
{
strCurLanguage = "No id:[" + id + "], please add.";
strCurLanguage = defaultStr;
NoIdLog(id, defaultStr);
}
}
if (strCurLanguage == null)
{
strCurLanguage = "";
}
return strCurLanguage;
}
public static string GetString(string id, string defaultStr, params object[] param)
{
string strCurLanguage = GetString(id, defaultStr);
return String.Format(strCurLanguage, param);
}
static HashSet<string> hss = new HashSet<string>();
private static void NoIdLog(string id, string defaultStr)
{
if (OpenResourceLog)
{
getLangRes("zh-CN");
if (!LangMap["zh-CN"].ContainsKey(id) && checkInterid(id) && !hss.Contains(id))
{
hss.Add(id);
LOG.Info("No Res id:" + id + "#" + defaultStr);
}
}
}
private static bool checkInterid(string id) {
return true;
string[] interstring = new string[] { "_txt", "_lbl" };
var x = from a in interstring
where id.IndexOf(a) > -1
select a;
return x.Count() == 0;
}
static CodeResourceControl()
{
}
private static bool getLangRes(string lang) {
if (!LangMap.ContainsKey(lang)) {
string path = Application.StartupPath + @"\resources\"+lang+".txt";
if (!File.Exists(path))
{
return false;
}
string[] lines = File.ReadAllLines(path);
var map = new Dictionary<string, string>();
foreach (string line in lines)
{
string[] array = line.Split('#');
if (array.Length >= 3)
{
string key = array[0];
string chinese = array[1];
string english = array[2];
if (map.ContainsKey(key))
{
map.Remove(key);
}
map.Add(key, english);
}
}
LangMap.Add(lang, map);
return true;
}
return true;
}
public static string CurrLanguage = "";
public static void LanguageProcess(ContainerControl cc, string className="")
{
if (string.IsNullOrEmpty(className))
className = cc.GetType().Name;
if (CurrLanguage.Equals(CodeResourceControl.GetLanguage()))
{
//return;
}
//string className = cc.ClassName;
CurrLanguage = CodeResourceControl.GetLanguage();
//string name = CodeResourceControl.GetString(CodeResourceControl.GetTextIdStr(className), cc.Text);
//if (!name.Equals("")) { cc.Text = name; }
PreControlLanaguage(cc, className);
RefreshLanguageEvent?.Invoke();
}
private static void PreControlLanaguage(Control partentControl, string className)
{
//string className = this.ClassName;
Con_GetTxt(partentControl, out string title);
string newStr = GetString(GetTextIdStr(className, partentControl.Name), title);
if (!newStr.Equals(""))
{
Con_SetTxt(partentControl, newStr.Replace("\\n", "\n"));
}
foreach (Control con in partentControl.Controls)
{
string txt = "";
bool haslang = false;
if (con.Tag != null && con.Tag.ToString() == "not")
{
continue;
}
if (Con_GetTxt(con, out txt))
{
newStr = GetString(GetTextIdStr(className, con.Name), txt);
if (!newStr.Equals(""))
{
Con_SetTxt(con, newStr.Replace("\\n", "\n"));
//haslang = true;
}
}
if (con.Tag !=null && con.Tag.ToString() == "nochiled")
{
continue;
}
if (con.Controls.Count > 0 && !haslang)
{
PreControlLanaguage(con, className+"_"+ con.Name);
}
//Console.WriteLine(con is IList<Component>);
//Console.WriteLine(con is IList<Component>);
}
}
public static void ProcessListItem<T>(T con,string ClassName) where T: ToolStripItemCollection
{
for (int i = 0; i < con.Count; i++) {
if (con[i].Tag != null && con[i].Tag.ToString() == "not")
{
continue;
}
string txt = con[i].Text;
string newStr = GetString(GetTextIdStr(ClassName, con[i].Name), txt);
if (!newStr.Equals(""))
{
con[i].Text= newStr.Replace("\\n", "\n");
//haslang = true;
}
if (con[i] is ToolStripMenuItem) {
var tt = ((ToolStripMenuItem)con[i]);
ProcessListItem(tt.DropDownItems, tt.Name);
}
}
}
static bool Con_GetTxt(Control con, out string txt)
{
txt = "";
if (con is Label || con is Button || con is RadioButton || con is CheckBox)
{
txt = con.Text;
return true;
}
string methodname = getMethodname(con);
var t = con.GetType();
var p = t.GetProperty(methodname);
if (p != null)
{
txt = p.GetValue(con, null).ToString();
return true;
}
return false;
}
static void Con_SetTxt(Control con, string txt)
{
if (con is Label || con is Button || con is RadioButton || con is CheckBox)
{
con.Text = txt;
return;
}
string methodname = getMethodname(con);
var t = con.GetType();
var p = t.GetProperty(methodname);
if (p == null)
return;
else
p.SetValue(con, txt,null);
}
static string getMethodname(Control con) {
string methodname = "Text";
//if (con is UCBtnExt) methodname = "BtnText";
//if (con is UCTextBoxEx) methodname = "InputText";
//if (con is UCCheckBox) methodname = "TextValue";
//if (con is UCPanelTitle || con is FrmWithTitle) methodname = "Title";
//if (con is Form) methodname = "Title";
return methodname;
}
}
}
......@@ -53,6 +53,7 @@
<ItemGroup>
<Compile Include="AlgoPNMatch.cs" />
<Compile Include="bean\Bean.cs" />
<Compile Include="CodeResourceControl.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Setting_Init.cs" />
<Compile Include="util\ConfigAppSettings.cs" />
......
......@@ -10,6 +10,7 @@ using System.Collections.Concurrent;
using System.Threading;
using System.Runtime.InteropServices;
using System.Diagnostics;
using System.IO;
namespace OnlineStore.Common
{
......@@ -99,6 +100,7 @@ namespace OnlineStore.Common
private static object lockObj = "";
private static void AddToBox(string msg, Color color)
{
return;
if (Monitor.TryEnter(lockObj, 10))
{
try
......@@ -128,12 +130,15 @@ namespace OnlineStore.Common
}
public static void error(string errorMsg, Exception ex = null)
{
error(LOGGER, errorMsg, ex);
StackTrace st = new StackTrace(true);
StackFrame sf = st.GetFrame(1);
string filename = Path.GetFileName(sf.GetFileName());
int codeline = sf.GetFileLineNumber();
error(LOGGER, $"[{filename}:{codeline}]"+errorMsg, ex);
}
public static void info(string msg)
{
StackTrace st = new StackTrace(true);
StackFrame sf = st.GetFrame(2);
info(LOGGER, msg);
}
[DllImport("kernel32.dll", CharSet = CharSet.Auto)]
......
......@@ -30,6 +30,7 @@ namespace DeviceLibrary
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)
{
......@@ -142,7 +143,7 @@ namespace DeviceLibrary
//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(15000));
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(4000));
}
else if (MoveInfo.IsTimeOut(10)) {
Msg.add("等待T1机构空闲", MsgLevel.warning);
......@@ -161,6 +162,7 @@ namespace DeviceLibrary
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;
}
}
......
......@@ -143,7 +143,7 @@ namespace DeviceLibrary
Point qrcenter = Label_Pix_Point;
//string file = @"D:\853string\Image_20210604173619489.bmp";
//图像剪切范围矩形
var orgCrop = Rectangle.Inflate(new Rectangle(qrcenter, new Size(1, 1)), 410, 410);
var orgCrop = Rectangle.Inflate(new Rectangle(qrcenter, new Size(1, 1)), 450, 450);
//计算剪切后的二维码中心坐标点
qrcenter.X = qrcenter.X - orgCrop.X;
qrcenter.Y = qrcenter.Y - orgCrop.Y;
......
......@@ -32,6 +32,9 @@ namespace DeviceLibrary
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 = "";
......@@ -49,6 +52,10 @@ namespace DeviceLibrary
#endregion
MoveInfo = new MoveInfo(DeviceName);
SendOutMoveInfo = new MoveInfo("贴标送出");
VacuumMoveInfo = new MoveInfo("贴标吸标");
SendOutMoveInfo.Hide = true;
VacuumMoveInfo.Hide = true;
ResetMoveInfo = MoveInfo;
LedProcessInit();
}
......@@ -87,9 +94,9 @@ namespace DeviceLibrary
continue;
if (runStatus == RunStatus.Running)
{
//IOMonitor();
WorkProcess();
SendOutProcess();
VacuumLabelProcess();
}
else if (runStatus == RunStatus.HomeReset)
{
......@@ -118,11 +125,13 @@ namespace DeviceLibrary
{
Alarm(AlarmType.SuddenStop);
Msg.add("急停中", MsgLevel.warning);
Thread.Sleep(1000);
ok = false;
}
else if (alarmType == AlarmType.SuddenStop)
{
Msg.add("系统需要重置", MsgLevel.warning);
Thread.Sleep(1000);
ok = false;
}
......
......@@ -19,7 +19,7 @@ namespace DeviceLibrary
}
double labelRAxisPos = 0;
Point p1;
bool ReverseLabel=false;
bool ReverseLabel = false;
//是否允许进入贴标线体
public bool TrayCanIN()
{
......@@ -31,7 +31,7 @@ namespace DeviceLibrary
public IO_VALUE Tray_Check
{
//阻挡检测
get=> IOValue(IO_Label_Type.Tray_Check);
get => IOValue(IO_Label_Type.Tray_Check);
//对射检测
//get=> IOValue(IO_Label_Type.Line_HasTray_Check);
}
......@@ -66,6 +66,7 @@ namespace DeviceLibrary
MoveInfo.ReelParam = preReelParam;
preReelParam = null;
MoveInfo.log("检测到料盘 ReelParam:" + MoveInfo.ReelParam.ToStr());
MoveInfo.StopwatchReset();
}
//else if (Tray_Check.Equals(IO_VALUE.HIGH) && MoveInfo.IsTimeOut(30))
......@@ -98,7 +99,7 @@ namespace DeviceLibrary
{
MoveInfo.NextMoveStep(MoveStep.Lbl_BeginOut);
CylinderMove(MoveInfo, IO_Label_Type.TrayStop_Down, IO_Label_Type.TrayStop_Up, IO_VALUE.HIGH);
CylinderMove(MoveInfo, IO_Label_Type.Label_Stop_Down, IO_Label_Type.Label_Stop_Up, IO_VALUE.HIGH);
CylinderMove(null, IO_Label_Type.Label_Stop_Down, IO_Label_Type.Label_Stop_Up, IO_VALUE.HIGH);
MoveInfo.log("NG盘直接通过");
return;
}
......@@ -106,7 +107,7 @@ namespace DeviceLibrary
MoveInfo.NextMoveStep(MoveStep.Lbl_03_LineRun);
MoveInfo.log("上料区阻挡上升,贴标区阻挡下降");
CylinderMove(MoveInfo, IO_Label_Type.TrayStop_Down, IO_Label_Type.TrayStop_Up, IO_VALUE.HIGH);
CylinderMove(MoveInfo, IO_Label_Type.Label_Stop_Down, IO_Label_Type.Label_Stop_Up, IO_VALUE.LOW);
CylinderMove(null, IO_Label_Type.Label_Stop_Down, IO_Label_Type.Label_Stop_Up, IO_VALUE.LOW);
ReelLocation reelLocation;
if (RobotManage.offlinemode)
{
......@@ -153,13 +154,15 @@ namespace DeviceLibrary
{
printTask = DoPrint(MoveInfo.ReelParam, false);
}
//开始吸标
VacuumMoveInfo.NewMove(MoveStep.LblVacuum_01);
}
break;
case MoveStep.Lbl_03_LineRun:
MoveInfo.NextMoveStep(MoveStep.Lbl_03_StopDown_and_wait);
MoveInfo.log("线体1,2开始运行");
IOMove(IO_Label_Type.Line1_Run, IO_VALUE.HIGH);
IOMove(IO_Label_Type.Line2_Run, IO_VALUE.HIGH);
RobotManage.Line1.LineRun("label", 999, "Lbl_03_LineRun");
RobotManage.Line2.LineRun("label", 999, "Lbl_03_LineRun");
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(3000));
break;
case MoveStep.Lbl_03_StopDown_and_wait:
......@@ -170,152 +173,70 @@ namespace DeviceLibrary
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)}");
IOMove(IO_Label_Type.Line1_Run, IO_VALUE.LOW);
IOMove(IO_Label_Type.Line2_Run, IO_VALUE.LOW);
CylinderMove(MoveInfo, IO_Label_Type.TrayStop_Down, IO_Label_Type.TrayStop_Up, IO_VALUE.LOW) ;
CylinderMove(MoveInfo, IO_Label_Type.Label_Stop_Down, IO_Label_Type.Label_Stop_Up, IO_VALUE.HIGH);
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);
break;
case MoveStep.Lbl_05_ScanCode:
//MoveInfo.NextMoveStep(MoveStep.Lbl_06_Get_Reelinfo);
MoveInfo.NextMoveStep(MoveStep.Lbl_Printted);
MoveInfo.NextMoveStep(MoveStep.Lbl05);
WaitCheckLabeltype = WaitCheckLabeltypeE.None;
ScanTask2 = ScanCode2();
break;
case MoveStep.Lbl_06_Get_Reelinfo:
if (ScanTask.IsCompleted)
{
var (sr,bitmap) = ScanTask.Result;
if (sr.Count == 0)
{
MoveInfo.NextMoveStep(MoveStep.Lbl_WaitCheckLabel);
MoveInfo.log($"未识别到有效二维码");
}
else
{
if (MoveInfo.ReelParam.WareCode != sr[0].CodeStr)
{
MoveInfo.NextMoveStep(MoveStep.Lbl_BeginOut);
Msg.add($"扫描到的Reelid与发出打印的不一致,系统:{MoveInfo.ReelParam.WareCode},实际:{sr[0].CodeStr}", MsgLevel.warning);
MoveInfo.log($"扫描到的Reelid与发出打印的不一致,系统:{MoveInfo.ReelParam.WareCode},实际:{sr[0].CodeStr}");
MoveInfo.ReelParam.IsNg = true;
MoveInfo.ReelParam.NgMsg = "扫描到的Reelid与发出打印的不一致";
MoveInfo.ReelParam.logresult();
}
else {
MoveInfo.NextMoveStep(MoveStep.Lbl_Printted);
MoveInfo.ReelParam.codeInfos = sr;
MoveInfo.log($"已完成扫码, Count={sr.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);
}
}
else if (MoveInfo.IsTimeOut(20))
{
MoveInfo.NextMoveStep(MoveStep.Lbl_04_LineStop);
MoveInfo.log($"等待扫码超时,重新扫码");
}
break;
case MoveStep.Lbl_Printted:
//bool isPrintOk = LastPrintStatus.Equals(Asa.PrintLabel.PrinterStatus.Idle);
if (IOValue(IO_Label_Type.Label_Cylinder_Check).Equals(IO_VALUE.HIGH))
{
MoveInfo.NextMoveStep(MoveStep.Lbl02);
Label_Z_Axis.AbsMove(MoveInfo, Config.Label_Z_P3, Config.Label_Z_P3_speed);
IOMove(IO_Label_Type.LabelCylinder_Work, IO_VALUE.HIGH);
MoveInfo.log("标签打印完毕,取标气缸下降,开始吸气.");
}
else if (MoveInfo.IsTimeOut(25))
{
Msg.add($"标签打印超时{MoveInfo.TimeOutSeconds}秒", MsgLevel.warning);
MoveInfo.log("标签打印超时, 放弃贴标NG处理");
MoveInfo.ReelParam.IsNg = true;
MoveInfo.ReelParam.NgMsg = "标签打印超时";
MoveInfo.ReelParam.logresult();
}
else if (MoveInfo.IsTimeOut(15)) {
Msg.add($"标签打印超时{MoveInfo.TimeOutSeconds}秒",MsgLevel.warning);
MoveInfo.log("标签打印超时");
}
break;
case MoveStep.Lbl02:
MoveInfo.NextMoveStep(MoveStep.Lbl03);
//MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1500));
MoveInfo.log("等待.");
break;
case MoveStep.Lbl03:
MoveInfo.NextMoveStep(MoveStep.Lbl04);
Label_Z_Axis.AbsMove(MoveInfo, Config.Label_Z_P2, Config.Label_Z_P2_speed);
MoveInfo.log("标签打印完毕,取标气缸上升,取起标签.");
break;
case MoveStep.Lbl04:
Thread.Sleep(500);
if (IOValue(IO_Label_Type.Label_Cylinder_Check).Equals(IO_VALUE.LOW))
{
MoveInfo.NextMoveStep(MoveStep.Lbl_WaitCheckLabel);
MoveInfo.log("吸标失败.");
WaitCheckLabeltype = WaitCheckLabeltypeE.Failed_to_extract_label;
}
else
MoveInfo.NextMoveStep(MoveStep.Lbl05);
CylinderMove(MoveInfo, IO_Label_Type.Label_Stop_Down, IO_Label_Type.Label_Stop_Up, IO_VALUE.HIGH);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(2000));
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转到贴标准备点.");
break;
case MoveStep.Lbl06:
if (ScanTask2.IsCompleted)
}
else if (VacuumMoveInfo.MoveStep == MoveStep.LblVacuum_failure)
{
MoveInfo.NextMoveStep(MoveStep.Lbl10);
MoveInfo.NextMoveStep(MoveStep.Lbl_WaitCheckLabel);
WaitCheckLabeltype = WaitCheckLabeltypeE.Failed_to_extract_label;
}
else if (MoveInfo.IsTimeOut(10))
else if (VacuumMoveInfo.MoveStep == MoveStep.LblVacuum_printfail)
{
MoveInfo.NextMoveStep(MoveStep.Lbl_04_LineStop);
MoveInfo.log($"等待扫码超时,重新扫码");
MoveInfo.NextMoveStep(MoveStep.Lbl_BeginOut);
}
break;
case MoveStep.Lbl10:
MoveInfo.NextMoveStep(MoveStep.Lbl11_wait);
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.Lbl11_wait:
MoveInfo.NextMoveStep(MoveStep.Lbl11);
Label_R_Axis.AbsMove(MoveInfo, (int)labelRAxisPos, Config.Label_R_P2_speed);
//MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
MoveInfo.log("等待.");
case MoveStep.Lbl10:
break;
case MoveStep.Lbl11:
MoveInfo.NextMoveStep(MoveStep.Lbl12);
MoveInfo.NextMoveStep(MoveStep.Lbl13);
var p5 = Config.Label_Z_P5;
p5 = p5 - (MoveInfo.ReelParam.PlateH - 8) * Config.Label_Z_Axis_ChangeValue;
Label_Z_Axis.AbsMove(MoveInfo, p5, Config.Label_Z_P5_speed);
MoveInfo.log("取标气缸下降.");
IOMove(IO_Label_Type.LabelCylinder_Work, IO_VALUE.LOW);
MoveInfo.log("取标气缸下降.关闭吸气.");
break;
case MoveStep.Lbl12:
MoveInfo.NextMoveStep(MoveStep.Lbl13);
......@@ -323,23 +244,22 @@ namespace DeviceLibrary
break;
case MoveStep.Lbl13:
MoveInfo.NextMoveStep(MoveStep.Lbl_BeginOut);
IOMove(IO_Label_Type.LabelCylinder_Work, IO_VALUE.LOW);
MoveInfo.log("关闭吸气.");
Label_Z_Axis.AbsMove(null, Config.Label_Z_P2, Config.Label_Z_P2_speed);
MoveInfo.log("取标气缸上升.");
break;
case MoveStep.Lbl_WaitCheckLabel:
if ((WaitCheckLabeltype & WaitCheckLabeltypeE.Scan_QRCode_Fail)== WaitCheckLabeltypeE.Scan_QRCode_Fail)
if ((WaitCheckLabeltype & WaitCheckLabeltypeE.Scan_QRCode_Fail) == WaitCheckLabeltypeE.Scan_QRCode_Fail)
Msg.add("未识别到有效二维码", MsgLevel.warning);
if ((WaitCheckLabeltype & WaitCheckLabeltypeE.Scan_Code_And_Print_are_different) == WaitCheckLabeltypeE.Scan_Code_And_Print_are_different)
Msg.add("扫描到的Reelid与发出打印的可能不一致", MsgLevel.warning);
if ((WaitCheckLabeltype & WaitCheckLabeltypeE.Failed_to_extract_label) == WaitCheckLabeltypeE.Failed_to_extract_label)
Msg.add("标签吸取失败", MsgLevel.warning);
MoveInfo.log("Lbl_WaitCheckLabel:"+ WaitCheckLabeltype.ToString());
if (IOValue(IO_Label_Type.Reset_BTN).Equals(IO_VALUE.HIGH)) {
MoveInfo.NextMoveStep(MoveStep.Lbl_BeginOut);
IOMove(IO_Label_Type.LabelCylinder_Work, IO_VALUE.LOW);
IOMove(IO_Label_Type.Line2_Run, IO_VALUE.HIGH);
RobotManage.Line2.LineRun("label", 999, "Lbl_WaitCheckLabel");
MoveInfo.log("人工完成贴标.");
}
break;
......@@ -347,62 +267,139 @@ namespace DeviceLibrary
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_Z_P2_speed);
Label_R_Axis.AbsMove(null, Config.Label_R_P2, Config.Label_R_P2_speed);
if (MoveInfo.ReelParam.IsNg)
{
IOMove(IO_Label_Type.Line1_Run, IO_VALUE.HIGH);
IOMove(IO_Label_Type.Line2_Run, IO_VALUE.HIGH);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(3000));
RobotManage.Line1.LineRun("label", 5, "Lbl_BeginOut");
RobotManage.Line2.LineRun("label", 999, "Lbl_BeginOut");
//MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(3000));
}
MoveInfo.log("Label_XYR转到取标点,待机");
break;
case MoveStep.Lbl15:
if (MoveInfo.ReelParam.WareCode=="testlabel") {
if (MoveInfo.ReelParam.WareCode == "testlabel") {
MoveInfo.NextMoveStep(MoveStep.L30_LabelFinish);
MoveInfo.log("贴标测试结束.");
}
else
{
MoveInfo.NextMoveStep(MoveStep.Lbl16);
CylinderMove(MoveInfo, IO_Label_Type.Label_Stop_Down, IO_Label_Type.Label_Stop_Up, IO_VALUE.HIGH);
CylinderMove(null, IO_Label_Type.Label_Stop_Down, IO_Label_Type.Label_Stop_Up, IO_VALUE.HIGH);
CylinderMove(MoveInfo, IO_Label_Type.TrayStop_Down, IO_Label_Type.TrayStop_Up, IO_VALUE.LOW);
MoveInfo.log("贴标阻挡上升.");
}
break;
case MoveStep.Lbl16:
CylinderMove(MoveInfo, IO_Label_Type.TrayStop_Down, IO_Label_Type.TrayStop_Up, IO_VALUE.LOW);
if (RobotManage.filterMachine.isWaitReel)
if (SendOutMoveInfo.MoveStep==MoveStep.Wait && RobotManage.filterMachine.isWaitReel)
{
MoveInfo.NextMoveStep(MoveStep.L30_LabelFinish);
RobotManage.filterMachine.preReelParam = MoveInfo.ReelParam;
IOMove(IO_Label_Type.Line2_Run, IO_VALUE.HIGH);
RobotManage.filterMachine.LineRun();
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(4000));
SendOutMoveInfo.NewMove(MoveStep.LblSendOut_01);
MoveInfo.log("送出料盘.");
}
else if (MoveInfo.IsTimeOut(30))
{
Msg.add($"等待分盘线超时{MoveInfo.TimeOutSeconds}秒", MsgLevel.warning);
MoveInfo.log("等待分盘线超时");
MoveInfo.log($"等待分盘线超时,SendOutMoveInfo:{SendOutMoveInfo.MoveStep}");
}
break;
case MoveStep.L30_LabelFinish:
if (RobotManage.filterMachine.Tray_Check.Equals(IO_VALUE.HIGH))
{
MoveInfo.NewMove(MoveStep.Lbl_01_Wait_ATray);
IOMove(IO_Label_Type.Line2_Run, IO_VALUE.LOW);
MoveInfo.log("完成贴标.");
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 (MoveInfo.IsTimeOut(30))
{
MoveInfo.NewMove(MoveStep.Lbl_01_Wait_ATray);
IOMove(IO_Label_Type.Line2_Run, IO_VALUE.LOW);
MoveInfo.log("等待料盘到达分盘线超时.完成贴标.");
SendOutMoveInfo.NewMove(MoveStep.LblSendOut_03);
RobotManage.Line2.LineStop("sendout", "LblSendOut_02");
SendOutMoveInfo.log("等待料盘到达分盘线超时.完成贴标.");
}
else {
else if (MoveInfo.IsTimeOut(5))
{
Msg.add($"等待到达分盘线", MsgLevel.warning);
MoveInfo.log("等待到达分盘线");
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($"标签打印超时{VacuumMoveInfo.TimeOutSeconds}秒", MsgLevel.warning);
VacuumMoveInfo.log("标签打印超时, 放弃贴标NG处理");
MoveInfo.ReelParam.IsNg = true;
MoveInfo.ReelParam.NgMsg = "标签打印超时";
MoveInfo.ReelParam.logresult();
}
else if (VacuumMoveInfo.IsTimeOut(15))
{
Msg.add($"标签打印超时{VacuumMoveInfo.TimeOutSeconds}秒", MsgLevel.warning);
VacuumMoveInfo.log("标签打印超时");
}
break;
case MoveStep.LblVacuum_02:
VacuumMoveInfo.NextMoveStep(MoveStep.LblVacuum_03);
Label_Z_Axis.AbsMove(VacuumMoveInfo, Config.Label_Z_P2, Config.Label_Z_P2_speed);
VacuumMoveInfo.log("标签打印完毕,取标气缸上升,取起标签.");
break;
case MoveStep.LblVacuum_03:
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(){
......@@ -411,7 +408,6 @@ namespace DeviceLibrary
MoveInfo.ReelParam = new ReelParam("testlabel", 7, 8);
MoveInfo.ReelParam.QTY = 9999;
//DoPrint(MoveInfo.ReelParam);
}
}
}
......@@ -40,7 +40,7 @@ namespace DeviceLibrary
/// 整机启动变量,设置为false后将退出线程,只在停止时调用
/// </summary>
protected bool mstart = false;
protected int stepDelaytime =300;
protected int stepDelaytime =100;
public virtual void Run()
{
if (!mstart)
......@@ -111,6 +111,7 @@ namespace DeviceLibrary
LogUtil.error(DeviceName + " 未检测到气压信号 ,停止运动, 打开报警灯 ");
StopMove(true);
}
//LogUtil.info();
}
protected bool NoAlarm()
{
......@@ -131,7 +132,12 @@ namespace DeviceLibrary
if (MoveInfo.IsInWait)
{
CheckWait2(MoveInfo);
if (!CheckWait2(MoveInfo)) {
if (alarmType == AlarmType.IoSingleTimeOut) {
alarmType = AlarmType.None;
}
}
}
return MoveInfo.IsInWait;
......@@ -227,6 +233,7 @@ namespace DeviceLibrary
{
AxisBean axisBean=null;
axisBean = RobotManage.t1Machine.T_Batch_Axis;
//if (wait.AxisInfo.ProName == "Right_Batch_Axis")
// axisBean = Right_Batch_Axis;
//else
......
......@@ -119,7 +119,15 @@ namespace DeviceLibrary
T1_08_DownToShelf,
T1_09_ReleaseReel,
T1_10_PutReelFinish,
LblSendOut_01,
LblSendOut_02,
LblSendOut_03,
LblVacuum_01,
LblVacuum_02,
LblVacuum_03,
LblVacuum_end,
LblVacuum_failure,
LblVacuum_printfail,
}
......
......@@ -3,6 +3,7 @@ using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
......@@ -37,6 +38,10 @@ namespace DeviceLibrary
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 Stopwatch ProductivityStopwatch = new Stopwatch();
public static List<float> Productivity = new List<float>();
//static string baseDir = Application.StartupPath;
public static void Init() {
try
......@@ -90,8 +95,8 @@ namespace DeviceLibrary
//xrayImage.Close();
var ElectricGripperPort = ConfigHelper.Config.Get("ElectricGripperPort");
electricGripper = new ElectricGripper();
if (!electricGripper.OpenPort(ElectricGripperPort)) {
electricGripper = new ElectricGripper(ElectricGripperPort);
if (!electricGripper.OpenPort()) {
msgs += $"电夹爪通讯失败:{ElectricGripperPort}\n";
IsLoadOk = false;
}
......@@ -102,6 +107,8 @@ namespace DeviceLibrary
IsLoadOk = false;
msgs += "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());
LoadFinishEvent?.Invoke(IsDebug?IsDebug:IsLoadOk, msgs);
}
catch (Exception ex) {
......
......@@ -29,16 +29,19 @@ namespace DeviceLibrary
//public bool UserPause { get; set; }
public bool IgnoreSafecheck { get; set; }
public bool IgnoreGratingSignal { get; set; }
AxisBean T_Batch_Axis;
public AxisBean T_Batch_Axis;
AxisBean T_Pan_Axis;
AxisBean T_Updown_Axis;
AxisBean T_TrayPos_Axis;
AxisBean T_Y_Axis;
MoveInfo ShelfOutMoveInfo;
MoveInfo ShelfInMoveInfo;
public LineManager ShelfOutLine;
public LineManager ShelfInLine;
public LineRunMonitor ShelfOutLine;
public LineRunMonitor ShelfInLine;
public event EventHandler<Bitmap> TrayStringLocation;
public Point CenterPos = Point.Empty;
public bool Init(out string msg)
{
msg = "";
......@@ -53,6 +56,7 @@ namespace DeviceLibrary
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);
......@@ -60,12 +64,13 @@ namespace DeviceLibrary
ShelfOutMoveInfo = new MoveInfo("出料串线体");
ShelfInMoveInfo = new MoveInfo("入料串线体");
ShelfOutLine = new LineManager(IO_T1_Type.Line_Out_Run, Config, "ShelfOutLine");
ShelfInLine = new LineManager(IO_T1_Type.Empty_Line_Run, Config, "ShelfInLine");
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(); });
}
......@@ -142,11 +147,13 @@ namespace DeviceLibrary
{
Alarm(AlarmType.SuddenStop);
Msg.add("急停中", MsgLevel.warning);
Thread.Sleep(1000);
ok = false;
}
else if (alarmType == AlarmType.SuddenStop)
{
Msg.add("系统需要重置", MsgLevel.info);
Thread.Sleep(1000);
ok = false;
}
......@@ -219,6 +226,7 @@ namespace DeviceLibrary
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);
......@@ -235,6 +243,7 @@ namespace DeviceLibrary
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);
......
......@@ -7,6 +7,7 @@ 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;
......@@ -21,7 +22,8 @@ namespace DeviceLibrary
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);
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)
{
......@@ -42,6 +44,7 @@ namespace DeviceLibrary
MoveInfo.log("检测到料盘 ReelParam:" + MoveInfo.ReelParam.ToStr());
MoveInfo.NextMoveStep(MoveStep.T1_02_WaitReelInpos);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(2000));
MoveInfo.StopwatchReset();
}
else
{
......@@ -50,12 +53,14 @@ namespace DeviceLibrary
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));
//MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
break;
case MoveStep.T1_03_LocationUp:
MoveInfo.NextMoveStep(MoveStep.T1_04_DownToReel);
......@@ -73,35 +78,49 @@ namespace DeviceLibrary
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
break;
case MoveStep.T1_05_ClampReel:
if (RobotManage.electricGripper.Clamp(null))
{
//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);
}
//}
//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);
CylinderMove(MoveInfo, IO_T1_Type.End_Lift_Cylinder_Down, IO_T1_Type.End_Lift_Cylinder_Up, IO_VALUE.LOW);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_T1_Type.End_Lift_Tray_Check, IO_VALUE.LOW));
break;
case MoveStep.T1_07_PanToOut:
MoveInfo.NextMoveStep(MoveStep.T1_08_DownToShelf);
MoveInfo.log($"横移到料串");
T_Pan_Axis.AbsMove(MoveInfo, Config.Pan_P2, Config.Pan_P2_speed);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
CylinderMove(MoveInfo, IO_T1_Type.End_Lift_Cylinder_Down, IO_T1_Type.End_Lift_Cylinder_Up, IO_VALUE.LOW);
//MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
//MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
break;
case MoveStep.T1_08_DownToShelf:
if (ShelfInMoveInfo.MoveStep == MoveStep.Shelf_20_EmptyIn_ShelfReady)
{
MoveInfo.NextMoveStep(MoveStep.T1_09_ReleaseReel);
MoveInfo.log($"下降到料串");
var offset_x = LastStringCenter.X - CenterPos.X;
var offset_y = LastStringCenter.Y - CenterPos.Y;
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);
MoveInfo.log($"下降到料串 CenterPos:{CenterPos}, StringCenter:{LastStringCenter}, Offset:{new Point(offset_x, offset_y)}, AXIS:{new Point(Pan_X, Y)},");
T_Updown_Axis.AbsMove(MoveInfo, Config.UpdownAxis_P3, Config.UpdownAxis_P3_speed);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
}
......@@ -111,17 +130,19 @@ namespace DeviceLibrary
}
break;
case MoveStep.T1_09_ReleaseReel:
if (RobotManage.electricGripper.Release())
{
//if (RobotManage.electricGripper.Release())
//{
MoveInfo.NextMoveStep(MoveStep.T1_10_PutReelFinish);
RobotManage.electricGripper.Release();
MoveInfo.log($"夹爪放松");
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
}
else
{
Msg.add("夹爪忙碌中...", MsgLevel.warning);
}
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_T1_Type.T1_Tray_Check, IO_VALUE.HIGH));
//MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
//}
// else
//{
// Msg.add("夹爪忙碌中...", MsgLevel.warning);
// MoveInfo.log($"夹爪忙碌中...");
//}
break;
case MoveStep.T1_10_PutReelFinish:
ShelfInMoveInfo.ReelParam = MoveInfo.ReelParam;
......@@ -131,6 +152,7 @@ namespace DeviceLibrary
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;
}
}
......@@ -138,10 +160,18 @@ namespace DeviceLibrary
/// 最后的料串中心点距离
/// </summary>
int Lastdistance = 0;
/// <summary>
/// 最后的有效料串中心点位置
/// </summary>
Point LastStringCenter = Point.Empty;
/// <summary>
/// 料串高度修正次数
/// </summary>
int TrayStringFixTimes = 0;
Task CheckLocationTask = null;
void ShelfInProcess()
{
if (CheckWait(ShelfInMoveInfo))
......@@ -216,7 +246,7 @@ namespace DeviceLibrary
break;
case MoveStep.Shelf_16_EmptyIn_ForkFwd:
ShelfInMoveInfo.NextMoveStep(MoveStep.Shelf_19_EmptyIn_BatchUp);
ShelfOutMoveInfo.log("料架叉前进,横移皮带停止");
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);
......@@ -224,28 +254,51 @@ namespace DeviceLibrary
IOMove(IO_T1_Type.T1String_Sliding_Run, IO_VALUE.LOW);
break;
case MoveStep.Shelf_19_EmptyIn_BatchUp:
ShelfInMoveInfo.NextMoveStep(MoveStep.Shelf_17_EmptyIn_CheckLocation);
ShelfOutMoveInfo.log("T1 批量轴上升到P2");
ShelfInMoveInfo.NextMoveStep(MoveStep.Shelf_20_EmptyIn_ShelfReady);
ShelfInMoveInfo.log("T1 批量轴上升到P2");
TrayStringFixTimes = 0;
BatchAxisToP2(false);
BatchAxisToP2(ShelfInMoveInfo, false);
break;
case MoveStep.Shelf_17_EmptyIn_CheckLocation:
ShelfOutMoveInfo.log("计算料串中心位置");
/*
var aclpos = T_Batch_Axis.GetAclPosition();
ShelfInMoveInfo.log($"计算料串中心位置 P2:{Config.BatchAxis_P2}, AclPos:{aclpos}");
bool isFirst = true;
if (Math.Abs(Config.BatchAxis_P2 - T_Batch_Axis.GetAclPosition()) > Config.BatchAxis_ChangeValue*4)
if (Math.Abs(Config.BatchAxis_P2 - aclpos) > Config.BatchAxis_ChangeValue*4)
isFirst = false;
var (Bitmap, distance, debugstring) = GetStringCenter(isFirst);
Lastdistance = distance;
var t = Task.Run(()=> {
(Bitmap Bitmap, Point CurrentPoint, string debugstring) = GetStringCenter(isFirst);
var distance = (int)Common.distance(CenterPos, CurrentPoint);
TrayStringLocation?.Invoke(this, Bitmap);
if (Lastdistance > Config.String_Offset_Range_Px)
if (isFirst)
{
ShelfInMoveInfo.NextMoveStep(MoveStep.Shelf_18_EmptyIn_WaitManCheck);
LastStringCenter = CurrentPoint;
ShelfInMoveInfo.log($"计算料串中心位置 First LastStringCenter:{LastStringCenter}");
///Lastdistance = distance;
}
else
else if ((int)Common.distance(LastStringCenter, CurrentPoint) < 70)
{
ShelfInMoveInfo.NextMoveStep(MoveStep.Shelf_20_EmptyIn_ShelfReady);
LastStringCenter = CurrentPoint;
ShelfInMoveInfo.log($"计算料串中心位置 LastStringCenter:{LastStringCenter}");
}
else {
ShelfInMoveInfo.log($"计算料串中心位置 失败");
LastStringCenter = CenterPos;
}
});
if (isFirst)
t.Wait();
ShelfInMoveInfo.NextMoveStep(MoveStep.Shelf_20_EmptyIn_ShelfReady);
*/
//if (Lastdistance > Config.String_Offset_Range_Px)
//{
// ShelfInMoveInfo.NextMoveStep(MoveStep.Shelf_18_EmptyIn_WaitManCheck);
//}
//else
//{
// ShelfInMoveInfo.NextMoveStep(MoveStep.Shelf_20_EmptyIn_ShelfReady);
//}
break;
case MoveStep.Shelf_18_EmptyIn_WaitManCheck:
Msg.add("料串中心位置偏移, 请手动调整.", MsgLevel.warning);
......@@ -291,6 +344,41 @@ namespace DeviceLibrary
}
}
/// <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 (MoveInfo.MoveStep != MoveStep.Shelf_20_EmptyIn_ShelfReady)
......@@ -372,7 +460,7 @@ namespace DeviceLibrary
int StartMovePosition = 0;
void BatchAxisToP2(bool isFirstMove = true)
void BatchAxisToP2(MoveInfo moveInfo ,bool isFirstMove = true)
{
int targetP2 = Config.BatchAxis_P2;
int targetSpeed = Config.BatchAxis_P2_speed;
......@@ -386,15 +474,15 @@ namespace DeviceLibrary
{
targetP2 = Config.BatchAxis_P2;
}
ShelfOutMoveInfo.log("BatchAxisToP2 目标P2: " + targetP2 + "(" + currPosition + ")");
moveInfo.log("BatchAxisToP2 目标P2: " + targetP2 + "(" + currPosition + ")");
}
//targetSpeed = Config.BatchAxis_P3Speed / 2;
}
ShelfOutMoveInfo.TimeOutSeconds = 200;
ShelfOutMoveInfo.CanWhileCount = 0;
moveInfo.TimeOutSeconds = 200;
moveInfo.CanWhileCount = 0;
// 需要增加定时器,获取验证信号并停止伺服
StartMovePosition = T_Batch_Axis.GetAclPosition();
ShelfOutMoveInfo.WaitList.Add(WaitResultInfo.WaitBatchAxisMove(Config.T_Batch_Axis, targetP2, targetSpeed));
moveInfo.WaitList.Add(WaitResultInfo.WaitBatchAxisMove(Config.T_Batch_Axis, targetP2, targetSpeed));
Config.T_Batch_Axis.TargetPosition = targetP2;
T_Batch_Axis.AbsMove(null, targetP2, targetSpeed);
//开始检测信号
......@@ -405,33 +493,41 @@ namespace DeviceLibrary
void BatchAxisToP1()
{
int targetP1 = Config.BatchAxis_P1;
int targetSpeed = Config.BatchAxis_P2_speed;
int targetSpeed = Config.BatchAxis_P2_speed/2;
ShelfOutMoveInfo.TimeOutSeconds = 200;
ShelfOutMoveInfo.CanWhileCount = 0;
ShelfInMoveInfo.TimeOutSeconds = 200;
ShelfInMoveInfo.CanWhileCount = 0;
// 需要增加定时器,获取验证信号并停止伺服
StartMovePosition = T_Batch_Axis.GetAclPosition();
ShelfOutMoveInfo.WaitList.Add(WaitResultInfo.WaitBatchAxisMove(Config.T_Batch_Axis, targetP1, targetSpeed));
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, int, string) GetStringCenter(bool isFirst = false)
public (Bitmap, Point, string) GetStringCenter(bool isFirst = false)
{
if (isFirst)
return GetStringCenterA();
else
return GetStringCenterB();
}
public (Bitmap, int, string) GetStringCenterA()
[HandleProcessCorruptedStateExceptions]
public (Bitmap, Point, string) GetStringCenterA()
{
//return (null, 0, "调试屏蔽");
Bitmap bmap = Camera._cam.GrabOneImage(RobotManage.t1Machine.Config.String_Camera);
Bitmap bmap = Common.DeepClone(Camera._cam.GrabOneImage(RobotManage.t1Machine.Config.String_Camera));
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();
......@@ -446,22 +542,24 @@ namespace DeviceLibrary
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.iWidth = 175 * 2;
eyemRect.iHeight = 175 * 2;
eyemlib.EyemOcsFXYR eyemOcsFXYR = new eyemlib.EyemOcsFXYR();
int result = eyemlib.eyemMulFuncTool(eyemImage, eyemRect, "__func1", 65, 75, ref eyemOcsFXYR, out _);
LogUtil.info($"eyemMulFuncTool:result:{result},fX:{eyemOcsFXYR.fX},fY:{eyemOcsFXYR.fY},fR:{eyemOcsFXYR.fR}");
var debugtxt = $"eyemMulFuncTool:\nresult:{result}\nfX:{eyemOcsFXYR.fX}\nfY:{eyemOcsFXYR.fY}\nfR:{eyemOcsFXYR.fR}";
debugtxt = $"eyemMulFuncTool:\nresult:{result}\nfX:{eyemOcsFXYR.fX}\nfY:{eyemOcsFXYR.fY}\nfR:{eyemOcsFXYR.fR}";
bmap.UnlockBits(bitmapData);
var currpos = new Point((int)eyemOcsFXYR.fX, (int)eyemOcsFXYR.fY);
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);
Bitmap bitmap = new Bitmap(bmap.Width, bmap.Height);
//try
//{
Graphics graphics = Graphics.FromImage(bitmap);
graphics.DrawImage(bmap, new PointF(0, 0));
graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
......@@ -474,8 +572,6 @@ namespace DeviceLibrary
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);
var rectx = Config.String_Center_X - 500;
var recty = Config.String_Center_Y - 500;
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);
......@@ -485,18 +581,24 @@ namespace DeviceLibrary
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, distance, debugtxt);
return (newbitmap, currpos, debugtxt);
}
public (Bitmap, int, string) GetStringCenterB()
[HandleProcessCorruptedStateExceptions]
public (Bitmap, Point, string) GetStringCenterB()
{
//return (null, 0, "调试屏蔽");
var centerpos = new Point(Config.String_Center_X, Config.String_Center_Y);
Bitmap bmap = Camera._cam.GrabOneImage(RobotManage.t1Machine.Config.String_Camera);
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);
......@@ -507,6 +609,10 @@ namespace DeviceLibrary
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);
......@@ -516,7 +622,7 @@ namespace DeviceLibrary
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, distance, debugtxt);
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);
......
......@@ -26,10 +26,11 @@ namespace DeviceLibrary
switch (MoveInfo.MoveStep)
{
case MoveStep.XRay_01_LocationDown:
MoveInfo.StopwatchReset();
MoveInfo.NextMoveStep(MoveStep.XRay_02_RunIn);
MoveInfo.log($"定位气缸下降,打开点料机入口门");
CylinderMove(MoveInfo, IO_XRay_Type.Location_Cylinder_Down, IO_XRay_Type.Location_Cylinder_Up, IO_VALUE.LOW);
CylinderMove(MoveInfo, IO_XRay_Type.Entry_Close, IO_XRay_Type.Entry_Open, IO_VALUE.HIGH);
CylinderMove(null, IO_XRay_Type.Entry_Close, IO_XRay_Type.Entry_Open, IO_VALUE.HIGH);
break;
case MoveStep.XRay_02_RunIn:
MoveInfo.NextMoveStep(MoveStep.XRay_03_CloseDoor);
......@@ -47,23 +48,23 @@ namespace DeviceLibrary
CylinderMove(MoveInfo, IO_XRay_Type.Entry_Close, IO_XRay_Type.Entry_Open, IO_VALUE.LOW);
CylinderMove(MoveInfo, IO_XRay_Type.Location_Cylinder_Down, IO_XRay_Type.Location_Cylinder_Up, IO_VALUE.HIGH);
IOMove(IO_XRay_Type.Xray_Lock, IO_VALUE.HIGH);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500));
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(100));
break;
case MoveStep.XRay_04_OpenXray:
MoveInfo.NextMoveStep(MoveStep.XRay_05_GetImage);
RobotManage.XRay.Start();
MoveInfo.log($"打开X光");
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(2000));
//MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
break;
case MoveStep.XRay_05_GetImage:
if (GrabImage())
{
MoveInfo.NextMoveStep(MoveStep.XRay_08_OpenOutDoor);
MoveInfo.NextMoveStep(MoveStep.XRay_09_SentToLabelStop);
MoveInfo.log($"获取图像,开始点料 IsRayOpen:{RobotManage.XRay.IsRayOpen}");
GetResultTask = Task.Run(()=> { GetCountResult(); });
}
else {
MoveInfo.NextMoveStep(MoveStep.XRay_08_OpenOutDoor);
MoveInfo.NextMoveStep(MoveStep.XRay_09_SentToLabelStop);
//Msg.add("图像平板获取图像失败",MsgLevel.warning);
MoveInfo.ReelParam.IsNg = true;
MoveInfo.ReelParam.NgMsg = "获取图像失败";
......@@ -71,11 +72,12 @@ namespace DeviceLibrary
}
MoveInfo.log($"关闭X光");
RobotManage.XRay.Stop();
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500));
IOMove(IO_XRay_Type.Xray_Lock, IO_VALUE.LOW);
MoveInfo.StopwatchLog(false, "准备送出");
//MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500));
break;
case MoveStep.XRay_08_OpenOutDoor:
MoveInfo.NextMoveStep(MoveStep.XRay_09_SentToLabelStop);
IOMove(IO_XRay_Type.Xray_Lock, IO_VALUE.LOW);
MoveInfo.log($"打开出口门");
break;
case MoveStep.XRay_09_SentToLabelStop:
......@@ -83,19 +85,11 @@ namespace DeviceLibrary
{
MoveInfo.NextMoveStep(MoveStep.XRay_10_CloseOutDoor);
MoveInfo.log($"打开出口门,送出到贴标机构");
CylinderMove(MoveInfo, IO_XRay_Type.Exit_Close, IO_XRay_Type.Exit_Open, IO_VALUE.HIGH);
//Line_In_Axis.RelMove(ResetMoveInfo, (int)(Config.Line_In_Relative), Config.Line_In_Relative_speed*2);
CylinderMove(null, IO_XRay_Type.Exit_Close, IO_XRay_Type.Exit_Open, IO_VALUE.HIGH);
Line_In_Axis.SpeedMove(Config.Line_In_Relative_speed*2);
RobotManage.labelMachine.InLineRunControl(IO_VALUE.HIGH);
//Task.Run(()=>{
// while (true) {
// if (RobotManage.labelMachine.Tray_Check.Equals(IO_VALUE.HIGH)) {
// RobotManage.labelMachine.InLineRunControl(IO_VALUE.LOW);
// break;
// }
// Task.Delay(30).Wait();
// }
//});
RobotManage.Line1.LineRun("xray", 999, "XRay_09_SentToLabelStop");
MoveInfo.StopwatchLog(false, "开始送出");
}
else if (MoveInfo.IsTimeOut(30)) {
Msg.add("等待贴标机构入口空闲", MsgLevel.warning);
......@@ -105,11 +99,13 @@ namespace DeviceLibrary
case MoveStep.XRay_10_CloseOutDoor:
if (RobotManage.labelMachine.Tray_Check.Equals(IO_VALUE.HIGH))
{
RobotManage.labelMachine.InLineRunControl(IO_VALUE.LOW);
//RobotManage.labelMachine.InLineRunControl(IO_VALUE.LOW);
RobotManage.Line1.LineStop("xray", "XRay_10_CloseOutDoor");
MoveInfo.NextMoveStep(MoveStep.XRay_11_GetCoutResult);
MoveInfo.log($"关闭出口门,停止X光机内线体");
Line_In_Axis.SuddenStop();
CylinderMove(MoveInfo, IO_XRay_Type.Exit_Close, IO_XRay_Type.Exit_Open, IO_VALUE.LOW);
CylinderMove(null, IO_XRay_Type.Exit_Close, IO_XRay_Type.Exit_Open, IO_VALUE.LOW);
MoveInfo.StopwatchLog(false, "到达阻挡");
}
else if (MoveInfo.IsTimeOut(10))
{
......@@ -123,6 +119,7 @@ namespace DeviceLibrary
RobotManage.labelMachine.preReelParam = MoveInfo.ReelParam;
MoveInfo.NextMoveStep(MoveStep.XRay_End);
MoveInfo.log($"获得点料结果 QTY:{MoveInfo.ReelParam.QTY}");
MoveInfo.StopwatchLog(false, "获得点料结果");
}
else if (MoveInfo.IsTimeOut(30)) {
MoveInfo.NextMoveStep(MoveStep.XRay_End);
......@@ -134,9 +131,8 @@ namespace DeviceLibrary
}
break;
case MoveStep.XRay_End:
//MoveInfo.NextMoveStep(MoveStep.Feeding_05_Goto_Xray);
MoveInfo.log($"送出到贴标机构");
//MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
MoveInfo.StopwatchLog();
MoveInfo.EndMove();
break;
}
......
......@@ -136,12 +136,14 @@ namespace DeviceLibrary
{
Alarm(AlarmType.SuddenStop);
Msg.add("急停中", MsgLevel.warning);
Thread.Sleep(1000);
ok = false;
}
else if (alarmType == AlarmType.SuddenStop)
{
Msg.add("系统需要重置", MsgLevel.info);
Thread.Sleep(1000);
ok = false;
}
if (IOValue(IO_XRay_Type.Airpressure_Check).Equals(IO_VALUE.LOW))
......
......@@ -118,7 +118,7 @@ namespace DeviceLibrary
{
MoveInfo.WaitList.Add(WaitResultInfo.WaitAxis(Config, targetPosition, targetSpeed));
Config.TargetPosition = targetPosition;
var r = AxisManager.AbsMove(Config.DeviceName, Config.GetAxisValue(), targetPosition, targetSpeed, Config.AddSpeed, Config.DelSpeed);
var r = AxisManager.AbsMove(Config.DeviceName, Config.GetAxisValue(), targetPosition, targetSpeed, targetSpeed*4, targetSpeed * 4);
if (!r)
MoveInfo.log($"运动规划失败:{Config.DeviceName},{Config.GetAxisValue()},targetPosition:{targetPosition},targetSpeed:{targetSpeed},AddSpeed:{Config.AddSpeed},DelSpeed:{Config.DelSpeed}");
}
......@@ -127,13 +127,13 @@ namespace DeviceLibrary
{
if (MoveInfo == null)
{
AxisManager.RelMove(Config.DeviceName, Config.GetAxisValue(), targetPosition, targetSpeed, Config.AddSpeed, Config.DelSpeed);
AxisManager.RelMove(Config.DeviceName, Config.GetAxisValue(), targetPosition, targetSpeed, targetSpeed*4, targetSpeed * 4);
}
else
{
MoveInfo.WaitList.Add(WaitResultInfo.WaitAxis(Config, targetPosition, targetSpeed, true));
Config.TargetPosition = targetPosition;
AxisManager.RelMove(Config.DeviceName, Config.GetAxisValue(), targetPosition, targetSpeed, Config.AddSpeed, Config.DelSpeed);
AxisManager.RelMove(Config.DeviceName, Config.GetAxisValue(), targetPosition, targetSpeed, targetSpeed * 4, targetSpeed * 4);
}
}
public void SpeedMove(int targetSpeed)
......@@ -183,7 +183,7 @@ namespace DeviceLibrary
AxisManager.SuddenStop(axis);
Thread.Sleep(500);
LogUtil.error($"{ MoveInfo.Name} {MoveInfo.MoveStep} {axis.DisplayStr}目标位置{targetPosition}当前位置{outCount},误差过大,{clearMsg}重新开始运动,剩余{MoveInfo.CanWhileCount}次");
AxisManager.AbsMove(axis.DeviceName, axis.GetAxisValue(), targetPosition, targetSpeed, axis.AddSpeed, axis.DelSpeed);
AxisManager.AbsMove(axis.DeviceName, axis.GetAxisValue(), targetPosition, targetSpeed, targetSpeed*4, targetSpeed * 4);
MoveInfo.CanWhileCount--;
Thread.Sleep(1000);
}
......@@ -294,7 +294,7 @@ namespace DeviceLibrary
{
targetSpeed = Config.TargetSpeed * targetSpeed;
}
AxisManager.AbsMove(Config.DeviceName, Config.GetAxisValue(), targetPos, (int)targetSpeed, Config.AddSpeed, Config.DelSpeed);
AxisManager.AbsMove(Config.DeviceName, Config.GetAxisValue(), targetPos, (int)targetSpeed, (int)targetSpeed * 4, (int)targetSpeed * 4);
}
public void SuddenStop()
......
......@@ -5,6 +5,7 @@ using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Runtime.ExceptionServices;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
using System.Threading.Tasks;
......@@ -211,11 +212,14 @@ namespace DeviceLibrary
/// <param name="src"></param>
/// <param name="cropRect"></param>
/// <returns></returns>
[HandleProcessCorruptedStateExceptions]
public static Bitmap ImageCrop(Bitmap src, Rectangle cropRect)
{
//Rectangle cropRect = new Rectangle(0, 0, 400, 400);
Bitmap target = new Bitmap(cropRect.Width, cropRect.Height,System.Drawing.Imaging.PixelFormat.Format24bppRgb);
Bitmap target = new Bitmap(cropRect.Width, cropRect.Height,System.Drawing.Imaging.PixelFormat.Format24bppRgb);
try
{
using (Graphics g = Graphics.FromImage(target))
{
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.None;
......@@ -224,6 +228,10 @@ namespace DeviceLibrary
cropRect,
GraphicsUnit.Pixel);
}
}
catch(Exception e) {
LogUtil.info("ImageCrop" + e.ToString());
}
return target;
}
/// <summary>
......@@ -261,9 +269,11 @@ namespace DeviceLibrary
double cos = num / (Math.Sqrt(numA) * Math.Sqrt(numB));
return cos;
}
[HandleProcessCorruptedStateExceptions]
public static T DeepClone<T>(T _object)
{
try
{
T dstobject;
using (MemoryStream mStream = new MemoryStream())
{
......@@ -275,6 +285,11 @@ namespace DeviceLibrary
}
return dstobject;
}
catch (Exception e) {
LogUtil.info("GetStringCenterA" + e.ToString());
return default;
}
}
}
public class Msg
{
......
......@@ -2,6 +2,7 @@
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
......@@ -13,6 +14,8 @@ namespace DeviceLibrary
public static List<MoveInfo> List = new List<MoveInfo>();
public int TimeOutSeconds = 60;
public bool Hide = false;
Stopwatch Stopwatch = new Stopwatch();
public MoveInfo(string name)
{
ReelParam = new ReelParam();
......@@ -138,6 +141,16 @@ namespace DeviceLibrary
LogUtil.error(msg);
}
}
public void StopwatchReset() {
Stopwatch.Restart();
}
public void StopwatchLog(bool isend=true,string dec="")
{
log($"时间{(isend?"总计":"小计")} {dec}:"+Stopwatch.Elapsed.ToString());
}
}
public class WaitResultInfo
......
类型,分类编号,说明,名称,属性值,设备名称,电器定义,目标速度,加速时间,减速时间,原点低速度,原点高速,原点加速度,脉冲最小误差,脉冲最大误差,脉冲最小限位,脉冲最大限位
AXIS,,取料机构旋转轴,Take_Middle_Axis,0,HC,,500,1000,1000,100,200,1000,10,100,0,0
AXIS,,取料机构上下轴,Take_UpDown_Axis,1,HC,,1000,1000,1000,200,500,500,10,100,0,0
AXIS,,左轨道提升轴,Left_Batch_Axis,2,HC,,3000,1000,1000,200,1000,200,10,100,0,0
AXIS,,右轨道提升轴,Right_Batch_Axis,3,HC,,3000,1000,1000,200,1000,200,10,100,0,0
AXIS,,贴标移栽机构X轴,Label_X_Axis,4,HC,,100,700,700,50,250,500,10,100,0,0
AXIS,,贴标移栽机构Y轴,Label_Y_Axis,5,HC,,100,700,700,50,150,500,10,100,0,0
AXIS,,贴标移栽机构Z轴,Label_Z_Axis,6,HC,,100,800,800,50,150,500,10,100,0,0
AXIS,,贴标移栽机构R轴,Label_R_Axis,7,HC,,10,2000,2000,1,5,200,500,100,0,0
,,,,,,,,,,,,,,,,
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,,,,,,,,,,,,
,,,,,,,,,,,,,,,,
PRO,10,取料旋转轴待机点P1,Take_Middle_P1,1,,,99,,,,,,,,,
PRO,10,取料旋转轴右取料点P2,Take_Middle_P2,2,,,99,,,,,,,,,
PRO,10,取料旋转轴左取料点P3,Take_Middle_P3,3,,,99,,,,,,,,,
PRO,10,取料旋转轴NG放料点P5,Take_Middle_P5,4,,,99,,,,,,,,,
,,,,,,,,,,,,,,,,
PRO,11,取料上下轴待机点P1,Take_UpDown_P1,6,,,88,,,,,,,,,
PRO,11,取料上下轴取料高点P2,Take_UpDown_P2,7,,,88,,,,,,,,,
PRO,11,取料上下轴取右料低点P3,Take_UpDown_P3,8,,,88,,,,,,,,,
PRO,11,取料上下轴取左料低点P4,Take_UpDown_P4,9,,,88,,,,,,,,,
PRO,11,取料上下轴NG放料点P5,Take_UpDown_P5,10,,,88,,,,,,,,,
,,,,,,,,,,,,,,,,
PRO,12,右提升轴低点P1,Right_Batch_P1,12,,,66,,,,,,,,,
PRO,12,右提升轴高点P2,Right_Batch_P2,13,,,66,,,,,,,,,
PRO,12,左提升轴低点P1,Left_Batch_P1,14,,,66,,,,,,,,,
PRO,12,左提升轴高点P2,Left_Batch_P2,15,,,66,,,,,,,,,
,,,,,,,,,,,,,,,,
PRO,13,贴标X轴待机点P1,Label_X_P1,17,,,77,,,,,,,,,
PRO,13,贴标X轴取标点P2,Label_X_P2,18,,,77,,,,,,,,,
,,,,,,,,,,,,,,,,
PRO,14,贴标Y轴待机点P1,Label_Y_P1,21,,,44,,,,,,,,,
PRO,14,贴标Y轴取标点P2,Label_Y_P2,22,,,44,,,,,,,,,
,,,,,,,,,,,,,,,,
PRO,15,贴标Z轴待机点P1,Label_Z_P1,25,,,44,,,,,,,,,
PRO,15,贴标Z轴取标点P2,Label_Z_P2,26,,,44,,,,,,,,,
PRO,15,贴标Z轴贴标点P3,Label_Z_P3,27,,,44,,,,,,,,,
,,,,,,,,,,,,,,,,
PRO,16,贴标R轴待机点P1,Label_R_P1,29,,,22,,,,,,,,,
PRO,16,贴标R轴取标点P2,Label_R_P2,30,,,22,,,,,,,,,
,,,,,,,,,,,,,,,,
DI,0,急停,SuddenStop_BTN,0,HC,X00,,,,,,,,,,
DI,0,进料口确认按钮,Right_BTN,1,HC,X01,,,,,,,,,,
DI,0,出料口确认按钮,Left_BTN,2,HC,X02,,,,,,,,,,
DI,0,后门左门禁,LeftBackDoor_Check,3,HC,X03,,,,,,,,,,
DI,0,后门右门禁,RightBackDoor_Check,4,HC,X04,,,,,,,,,,
DI,0,气压检测,Airpressure_Check,5,HC,X05,,,,,,,,,,
DI,0,光栅信号,GratingSignal_Check,6,HC,X06,,,,,,,,,,
DI,0,NG料箱检测,HasNgBox,7,HC,X07,,,,,,,,,,
DI,0,打印机到位检测,HasPrinter,8,HC,X08,,,,,,,,,,
DI,0,旋转臂进料侧检测,RightArm_Check,9,HC,X09,,,,,,,,,,
DI,0,旋转臂出料侧检测,LeftArm_Check,10,HC,X10,,,,,,,,,,
DI,0,进料口料车检测,RightCar_Check,11,HC,X11,,,,,,,,,,
DI,0,进料口前端料串检测,RightFornt_Check,12,HC,X12,,,,,,,,,,
DI,0,进料口料串到位检测,RightEnd_Check,13,HC,X13,,,,,,,,,,
DI,0,进料口阻挡气缸上升端,RightStopUP,14,HC,X14,,,,,,,,,,
DI,0,进料口阻挡气缸下降端,RightStopDown,15,HC,X15,,,,,,,,,,
DI,0,出料口料车检测,LeftCar_Check,16,HC,X16,,,,,,,,,,
DI,0,出料口前端料串检测,LeftFornt_Check,17,HC,X17,,,,,,,,,,
DI,0,出料口料串到位检测,LeftEnd_Check,18,HC,X18,,,,,,,,,,
DI,0,出料口阻挡气缸上升端,LeftStopUP,19,HC,X19,,,,,,,,,,
DI,0,出料口阻挡气缸下降端,LeftStopDown,20,HC,X20,,,,,,,,,,
DI,0,进料定位料盘检测,RightTop_Check,21,HC,X21,,,,,,,,,,
DI,0,进料定位料盘超限检测,RightOverHead_Check,22,HC,X22,,,,,,,,,,
DI,0,出料定位料盘检测,LeftTop_Check,23,HC,X23,,,,,,,,,,
DI,0,出料定位料盘超限检测,LeftOverHead_Check,24,HC,X24,,,,,,,,,,
DI,0,吸嘴气缸前进端,LabelCylinder_Fwd,25,HC,X25,,,,,,,,,,
DI,0,吸嘴气缸后退端,LabelCylinder_Bck,26,HC,X26,,,,,,,,,,
,,,,,,,,,,,,,,,,
DO,0,自动指示灯,AutoRun_HddLed,0,HC,Y00,,,,,,,,,,
DO,0,故障指示灯,Alarm_HddLed,1,HC,Y01,,,,,,,,,,
DO,0,待机指示灯,RunSign_HddLed,2,HC,Y02,,,,,,,,,,
DO,0,报警蜂鸣器,Alarm_Buzzer,3,HC,Y03,,,,,,,,,,
DO,0,进料口状态指示灯,RightState_Led,4,HC,Y04,,,,,,,,,,
DO,0,出料口状态指示灯,LeftState_Led,5,HC,Y05,,,,,,,,,,
DO,0,设备照明,Device_Led,6,HC,Y06,,,,,,,,,,
DO,0,相机照明,Camera_Led,7,HC,Y07,,,,,,,,,,
DO,0,进料口电机启动,RightMoto_Run,8,HC,Y08,,,,,,,,,,
DO,0,进料口电机反转指令,RightMoto_Reverse,9,HC,Y09,,,,,,,,,,
DO,0,出料口电机启动,LeftMoto_Run,10,HC,Y10,,,,,,,,,,
DO,0,出料口电机反转指令,LeftMoto_Reverse,11,HC,Y11,,,,,,,,,,
DO,0,进料口阻挡气缸上升,RightStopUP,12,HC,Y12,,,,,,,,,,
DO,0,进料口阻挡气缸下降,RightStopDown,13,HC,Y13,,,,,,,,,,
DO,0,出料口阻挡气缸上升,LeftStopUP,14,HC,Y14,,,,,,,,,,
DO,0,出料口阻挡气缸下降,LeftStopDown,15,HC,Y15,,,,,,,,,,
DO,0,吸嘴气缸前进,LabelCylinder_Fwd,16,HC,Y16,,,,,,,,,,
DO,0,吸嘴气缸后退,LabelCylinder_Bck,17,HC,Y17,,,,,,,,,,
DO,0,吸嘴取标,LabelCylinder_Work,18,HC,Y18,,,,,,,,,,
,,,,,,,,,,,,,,,,
类型,分类编号,说明,名称,属性值,设备名称,电器定义,目标速度,加速时间,减速时间,原点低速度,原点高速,原点加速度,脉冲最小误差,脉冲最大误差,脉冲最小限位,脉冲最大限位
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,,,,,,,,,,,,
,,,,,,,,,,,,,,,,
......@@ -3,12 +3,16 @@ AXIS,,出料提升轴,T_Batch_Axis,6,HC,,8000,15000,15000,500,4000,15000,10,100,0,0
AXIS,,出料移栽轴,T_Pan_Axis,7,HC,,20000,30000,30000,500,4000,15000,10,100,0,0
AXIS,,出料升降轴,T_Updown_Axis,8,HC,,20000,30000,30000,500,4000,15000,10,100,0,0
AXIS,,皮带线出口定位,T_TrayPos_Axis,9,HC,,35000,60000,60000,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,77756,,,8000,,,,,,,,,
,,,,,,,,,,,,,,,,
PRO,17,横移待机取料点P1,Pan_P1,5700,,,20000,,,,,,,,,
PRO,17,横移放料点P2,Pan_P2,77614,,,20000,,,,,,,,,
PRO,17,横移放料基准点P2,Pan_P2,77614,,,20000,,,,,,,,,
,,,,,,,,,,,,,,,,
PRO,20,Y轴待机取料点P1,Y_P1,5700,,,20000,,,,,,,,,
PRO,20,Y轴放料基准点P2,Y_P2,77614,,,20000,,,,,,,,,
,,,,,,,,,,,,,,,,
PRO,18,升降轴待机点P1,UpdownAxis_P1,7,,,20000,,,,,,,,,
PRO,18,升降轴取料点P2,UpdownAxis_P2,38420,,,20000,,,,,,,,,
......@@ -23,6 +27,8 @@ PRO,30,料串定位相机,String_Camera,GigE:MV-CE200-10GC (00F98806639),,,,,,,,,,,,
PRO,30,料串中心点X坐标,String_Center_X,1000,,,,,,,,,,,,
PRO,30,料串中心点Y坐标,String_Center_Y,1000,,,,,,,,,,,,
PRO,30,料串允许偏离像素值,String_Offset_Range_Px,1000,,,,,,,,,,,,
PRO,30,料串图像/X轴比值,Cam_Pixel_X_Ratio,147,,,,,,,,,,,,
PRO,30,料串图像/Y轴比值,Cam_Pixel_Y_Ratio,147,,,,,,,,,,,,
,,,,,,,,,,,,,,,,
DI,0,皮带线出口料盘检测,End_Line_Tray_Check,41,HC,X41,,,,,,,,,,
DI,0,皮带线出口顶升料盘检测,End_Lift_Tray_Check,42,HC,X42,,,,,,,,,,
......
......@@ -111,7 +111,7 @@
<Compile Include="DeviceLibrary\IOMonitor.cs" />
<Compile Include="DeviceLibrary\I_IOManager.cs" />
<Compile Include="DeviceLibrary\IOManager.cs" />
<Compile Include="DeviceLibrary\LineManager.cs" />
<Compile Include="DeviceLibrary\LineRunMonitor.cs" />
<Compile Include="DeviceLibrary\WistonAgvClientcs.cs" />
<Compile Include="MsgExtend.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
......@@ -143,7 +143,7 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="Config\Config.csv">
<Content Include="Config\I40Config.csv">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
......
......@@ -23,6 +23,7 @@ namespace DeviceLibrary
public static void SetOnOffAction(Action ona, Action offa) {
ondelegate = new on(ona);
offdelegate = new on(offa);
}
public static void ON(bool force=false) {
if (!Enable)
......@@ -32,14 +33,16 @@ namespace DeviceLibrary
if (force || (State != AlarmBuzzerState.ON && State != AlarmBuzzerState.MuteOnce))
{
State = AlarmBuzzerState.ON;
ondelegate();
ondelegate?.Invoke();
BuzzerStateChange?.Invoke(null, true);
}
}
public static void OFF()
{
if (State == AlarmBuzzerState.OFF)
return;
State = AlarmBuzzerState.OFF;
offdelegate();
offdelegate?.Invoke();
BuzzerStateChange?.Invoke(null, false);
}
public static void MuteOnce()
......@@ -47,7 +50,7 @@ namespace DeviceLibrary
if (State == AlarmBuzzerState.ON)
{
State = AlarmBuzzerState.MuteOnce;
offdelegate();
offdelegate?.Invoke();
BuzzerStateChange?.Invoke(null, false);
}
}
......
......@@ -11,13 +11,21 @@ namespace DeviceLibrary
public class ElectricGripper
{
private Neotel.Rmaxis axis;
private string Port = "";
public Enum GripperType = GripperTypeE.None;
int clampTimes = 0;
public bool OpenPort(string port)
public ElectricGripper(string port) {
Port = port;
}
public bool OpenPort()
{
if(axis==null)
axis = new Neotel.Rmaxis();
bool rtn = axis.OpenPort(port);
if (axis.IsPortOpen)
return true;
bool rtn = axis.OpenPort(Port);
//var s = "版本号\r\n" + axis.GetVersion();
return rtn;
}
......@@ -27,13 +35,25 @@ namespace DeviceLibrary
}
public bool Clamp(MoveInfo moveInfo = null)
{
OpenPort();
GripperType = GripperTypeE.Gripper;
if (moveInfo != null)
moveInfo.WaitList.Add(WaitResultInfo.WaitAction(new Func<WaitResultInfo, bool>(WaitAction),"夹爪夹紧"));
LogUtil.info($"ElectricGripper Clamp");
if (axis.ErrorCode > 0)
{
LogUtil.info("ElectricGripper Clamp error:" + axis.ErrorCode.ToString() + axis.ErrorString);
axis.ResetError();
}
if (IsBusy)
{
axis.StopAxis();
Thread.Sleep(500);
}
if (!IsBusy)
{
axis.Push(50, 4.5f, 15);
axis.Push(50, 5.5f, 5);
clampTimes++;
if (moveInfo != null)
moveInfo.WaitList.Add(WaitResultInfo.WaitTime(100));
......@@ -46,12 +66,22 @@ namespace DeviceLibrary
}
public bool Release(MoveInfo moveInfo = null)
{
OpenPort();
GripperType = GripperTypeE.Release;
LogUtil.info($"ElectricGripper Release");
if (axis.ErrorCode > 0)
{
LogUtil.info("ElectricGripper Release error:" + axis.ErrorCode.ToString() + axis.ErrorString);
axis.ResetError();
}
if (IsBusy)
{
axis.StopAxis();
Thread.Sleep(500);
}
if (!IsBusy)
{
axis.MoveAbsolute(0, 30, 500, 500, 0.1f);
axis.MoveAbsolute(0.2f, 5, 15, 15, 1f);
clampTimes = 0;
if (moveInfo != null)
moveInfo.WaitList.Add(WaitResultInfo.WaitTime(100));
......@@ -72,6 +102,7 @@ namespace DeviceLibrary
}
public void HomeReset(MoveInfo moveInfo = null)
{
OpenPort();
GripperType = GripperTypeE.Reset;
//if (!IsBusy)
//{
......
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Timers;
namespace DeviceLibrary
{
public class LineRunMonitor
{
Timer lineTimer = null;
Dictionary<string, DateTime> linrunlist = new Dictionary<string, DateTime>();
string Name;
ushort LineIO;
public LineRunMonitor(string name, ushort io) {
Name = name;
LineIO = io;
LineInit();
}
void LineInit()
{
if (lineTimer == null)
{
lineTimer = new Timer(100);
lineTimer.Elapsed += LineTimer_Elapsed;
lineTimer.Start();
GC.KeepAlive(lineTimer);
}
}
private void LineTimer_Elapsed(object sender, ElapsedEventArgs e)
{
lock (linrunlist)
{
if (canStopLine(out _) && DOValue(LineIO).Equals(IO_VALUE.HIGH))
{
DOMove(LineIO, IO_VALUE.LOW);
LogUtil.info(Name + $" 线体管理器 停止线体.");
}
}
}
private void DOMove(ushort LineIO, IO_VALUE iovalue)
{
IOManager.WriteSingleDO("", 0x00, LineIO, iovalue);
}
private object DOValue(ushort LineIO)
{
return IOManager.GetDOValue("", 0x00, LineIO);
}
/// <summary>
/// 控制线体运转
/// </summary>
/// <param name="id">需求方标识</param>
/// <param name="seconds">秒数</param>
public void LineRun(string id, int seconds, string parentname = "")
{
LineInit();
DOMove(LineIO, IO_VALUE.HIGH);
lock (linrunlist)
{
DOMove(LineIO, IO_VALUE.HIGH);
if (!string.IsNullOrEmpty(id) && seconds > 0)
{
if (linrunlist.ContainsKey(id))
linrunlist[id] = DateTime.Now.AddSeconds(seconds);
else
{
linrunlist.Add(id, DateTime.Now.AddSeconds(seconds));
}
LogUtil.info(Name + $" 线体管理器 {id},{parentname} 请求链条运行 {seconds}秒.");
}
}
}
public void LineStop(string id, string parentname = "")
{
lock (linrunlist)
{
if (!string.IsNullOrEmpty(id))
{
if (linrunlist.ContainsKey(id))
linrunlist.Remove(id);
LogUtil.info(Name + $" 线体管理器 {id},{parentname} 请求立刻停止线体.");
}
}
if (!canStopLine(out string msg))
LogUtil.info(Name + $" {Name}");
// IOMove(IO_Type.Line_Run, IO_VALUE.LOW);
}
bool canStopLine(out string msg)
{
msg = "";
bool canStop = true;
lock (linrunlist)
{
foreach (var x in linrunlist.ToList())
{
if (x.Value > DateTime.Now)
{
canStop = false;
msg = Name + $" 线体管理器 {x.Key} 不允许停止线体 需求停止时间 {x.Value.ToString()}.";
//LogUtil.info(Name + $" {x.Key} 不允许停止线体 需求停止时间 {x.Value.ToString()}.");
}
else
{
LogUtil.info(Name + $" 线体管理器 {x.Key} 请求时间已过期,删除.");
linrunlist.Remove(x.Key);
}
}
}
return canStop;
}
}
}
......@@ -31,6 +31,7 @@
this.components = new System.ComponentModel.Container();
this.groupAxis = new System.Windows.Forms.GroupBox();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.lblAlarmcode = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.lblhomeSts = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
......@@ -99,7 +100,6 @@
this.txtAxisDeviceName = new System.Windows.Forms.TextBox();
this.lblServerOn = new System.Windows.Forms.Label();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.lblAlarmcode = new System.Windows.Forms.Label();
this.groupAxis.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox1.SuspendLayout();
......@@ -159,6 +159,18 @@
this.groupBox2.TabStop = false;
this.groupBox2.Text = "轴状态监控";
//
// lblAlarmcode
//
this.lblAlarmcode.AutoSize = true;
this.lblAlarmcode.Location = new System.Drawing.Point(433, 65);
this.lblAlarmcode.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblAlarmcode.Name = "lblAlarmcode";
this.lblAlarmcode.Size = new System.Drawing.Size(68, 17);
this.lblAlarmcode.TabIndex = 19;
this.lblAlarmcode.Tag = "not";
this.lblAlarmcode.Text = "错误码:160";
this.lblAlarmcode.Visible = false;
//
// label4
//
this.label4.AutoSize = true;
......@@ -177,6 +189,7 @@
this.lblhomeSts.Name = "lblhomeSts";
this.lblhomeSts.Size = new System.Drawing.Size(17, 17);
this.lblhomeSts.TabIndex = 17;
this.lblhomeSts.Tag = "not";
this.lblhomeSts.Text = "...";
//
// label2
......@@ -198,6 +211,7 @@
this.lblAxEncAcc.Name = "lblAxEncAcc";
this.lblAxEncAcc.Size = new System.Drawing.Size(17, 17);
this.lblAxEncAcc.TabIndex = 12;
this.lblAxEncAcc.Tag = "not";
this.lblAxEncAcc.Text = "...";
this.lblAxEncAcc.Visible = false;
//
......@@ -339,6 +353,7 @@
this.lblAxEncVel.Name = "lblAxEncVel";
this.lblAxEncVel.Size = new System.Drawing.Size(17, 17);
this.lblAxEncVel.TabIndex = 1;
this.lblAxEncVel.Tag = "not";
this.lblAxEncVel.Text = "...";
//
// lblAxPrfVel
......@@ -349,6 +364,7 @@
this.lblAxPrfVel.Name = "lblAxPrfVel";
this.lblAxPrfVel.Size = new System.Drawing.Size(17, 17);
this.lblAxPrfVel.TabIndex = 1;
this.lblAxPrfVel.Tag = "not";
this.lblAxPrfVel.Text = "...";
//
// lblAxEncPos
......@@ -359,6 +375,7 @@
this.lblAxEncPos.Name = "lblAxEncPos";
this.lblAxEncPos.Size = new System.Drawing.Size(17, 17);
this.lblAxEncPos.TabIndex = 1;
this.lblAxEncPos.Tag = "not";
this.lblAxEncPos.Text = "...";
//
// lblAxPrfPos
......@@ -369,6 +386,7 @@
this.lblAxPrfPos.Name = "lblAxPrfPos";
this.lblAxPrfPos.Size = new System.Drawing.Size(17, 17);
this.lblAxPrfPos.TabIndex = 1;
this.lblAxPrfPos.Tag = "not";
this.lblAxPrfPos.Text = "...";
//
// lblAxisPrfMode
......@@ -379,6 +397,7 @@
this.lblAxisPrfMode.Name = "lblAxisPrfMode";
this.lblAxisPrfMode.Size = new System.Drawing.Size(17, 17);
this.lblAxisPrfMode.TabIndex = 1;
this.lblAxisPrfMode.Tag = "not";
this.lblAxisPrfMode.Text = "...";
//
// label50
......@@ -422,6 +441,7 @@
this.txtBusyStatus.Name = "txtBusyStatus";
this.txtBusyStatus.Size = new System.Drawing.Size(25, 23);
this.txtBusyStatus.TabIndex = 288;
this.txtBusyStatus.Tag = "not";
//
// label11
//
......@@ -439,6 +459,7 @@
this.txtHomeStatus.Name = "txtHomeStatus";
this.txtHomeStatus.Size = new System.Drawing.Size(25, 23);
this.txtHomeStatus.TabIndex = 291;
this.txtHomeStatus.Tag = "not";
//
// label10
//
......@@ -496,6 +517,7 @@
this.txtAlarmStatus.Name = "txtAlarmStatus";
this.txtAlarmStatus.Size = new System.Drawing.Size(25, 23);
this.txtAlarmStatus.TabIndex = 285;
this.txtAlarmStatus.Tag = "not";
//
// txtLimit2
//
......@@ -504,6 +526,7 @@
this.txtLimit2.Name = "txtLimit2";
this.txtLimit2.Size = new System.Drawing.Size(25, 23);
this.txtLimit2.TabIndex = 313;
this.txtLimit2.Tag = "not";
//
// txtServoStatue
//
......@@ -512,6 +535,7 @@
this.txtServoStatue.Name = "txtServoStatue";
this.txtServoStatue.Size = new System.Drawing.Size(25, 23);
this.txtServoStatue.TabIndex = 327;
this.txtServoStatue.Tag = "not";
//
// label22
//
......@@ -530,6 +554,7 @@
this.txtLimit1.Name = "txtLimit1";
this.txtLimit1.Size = new System.Drawing.Size(25, 23);
this.txtLimit1.TabIndex = 309;
this.txtLimit1.Tag = "not";
//
// label6
//
......@@ -547,6 +572,7 @@
this.txtHomeSingle.Name = "txtHomeSingle";
this.txtHomeSingle.Size = new System.Drawing.Size(25, 23);
this.txtHomeSingle.TabIndex = 297;
this.txtHomeSingle.Tag = "not";
//
// panel1
//
......@@ -602,6 +628,7 @@
this.comjSpeed.Name = "comjSpeed";
this.comjSpeed.Size = new System.Drawing.Size(95, 28);
this.comjSpeed.TabIndex = 335;
this.comjSpeed.Tag = "not";
//
// btnComAlarmClear
//
......@@ -656,6 +683,7 @@
this.cmbAxis.Name = "cmbAxis";
this.cmbAxis.Size = new System.Drawing.Size(227, 28);
this.cmbAxis.TabIndex = 301;
this.cmbAxis.Tag = "not";
this.cmbAxis.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged);
//
// btnDelMove
......@@ -667,7 +695,7 @@
this.btnDelMove.Name = "btnDelMove";
this.btnDelMove.Size = new System.Drawing.Size(140, 45);
this.btnDelMove.TabIndex = 332;
this.btnDelMove.Text = "点动-(上升)";
this.btnDelMove.Text = "点动-";
this.btnDelMove.UseVisualStyleBackColor = false;
this.btnDelMove.MouseDown += new System.Windows.Forms.MouseEventHandler(this.btnDelMove_MouseDown);
this.btnDelMove.MouseUp += new System.Windows.Forms.MouseEventHandler(this.btnDelMove_MouseUp);
......@@ -713,7 +741,7 @@
this.btnAddMove.Name = "btnAddMove";
this.btnAddMove.Size = new System.Drawing.Size(140, 45);
this.btnAddMove.TabIndex = 330;
this.btnAddMove.Text = "点动+(上升)";
this.btnAddMove.Text = "点动+";
this.btnAddMove.UseVisualStyleBackColor = false;
this.btnAddMove.MouseDown += new System.Windows.Forms.MouseEventHandler(this.btnAddMove_MouseDown);
this.btnAddMove.MouseUp += new System.Windows.Forms.MouseEventHandler(this.btnAddMove_MouseUp);
......@@ -731,6 +759,7 @@
this.txtASpeed.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.txtASpeed.Size = new System.Drawing.Size(91, 26);
this.txtASpeed.TabIndex = 251;
this.txtASpeed.Tag = "not";
this.txtASpeed.Text = "200";
//
// label1
......@@ -822,6 +851,7 @@
this.lblCountPulse.ReadOnly = true;
this.lblCountPulse.Size = new System.Drawing.Size(118, 26);
this.lblCountPulse.TabIndex = 38;
this.lblCountPulse.Tag = "not";
//
// btnAxisAMove
//
......@@ -863,6 +893,7 @@
this.txtAPosition.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.txtAPosition.Size = new System.Drawing.Size(91, 26);
this.txtAPosition.TabIndex = 244;
this.txtAPosition.Tag = "not";
this.txtAPosition.Text = "3000";
//
// label46
......@@ -912,6 +943,7 @@
this.txtAxisValue.ReadOnly = true;
this.txtAxisValue.Size = new System.Drawing.Size(50, 26);
this.txtAxisValue.TabIndex = 242;
this.txtAxisValue.Tag = "not";
this.txtAxisValue.Text = "0";
//
// txtAxisDeviceName
......@@ -923,6 +955,7 @@
this.txtAxisDeviceName.ReadOnly = true;
this.txtAxisDeviceName.Size = new System.Drawing.Size(50, 26);
this.txtAxisDeviceName.TabIndex = 241;
this.txtAxisDeviceName.Tag = "not";
this.txtAxisDeviceName.Text = "0";
//
// lblServerOn
......@@ -941,22 +974,11 @@
this.timer1.Interval = 1000;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// lblAlarmcode
//
this.lblAlarmcode.AutoSize = true;
this.lblAlarmcode.Location = new System.Drawing.Point(433, 65);
this.lblAlarmcode.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblAlarmcode.Name = "lblAlarmcode";
this.lblAlarmcode.Size = new System.Drawing.Size(68, 17);
this.lblAlarmcode.TabIndex = 19;
this.lblAlarmcode.Text = "错误码:160";
this.lblAlarmcode.Visible = false;
//
// AxisMoveControl
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.Controls.Add(this.groupAxis);
this.DeviceName = "AxisMoveControl";
this.Name = "AxisMoveControl";
this.Size = new System.Drawing.Size(699, 402);
this.groupAxis.ResumeLayout(false);
this.groupAxis.PerformLayout();
......
......@@ -14,6 +14,7 @@ using HuichuanLibrary;
namespace DeviceLibrary
{
using crc = OnlineStore.CodeResourceControl;
public partial class AxisMoveControl : UserControl
{
public bool IsHuiChuan = true;
......@@ -26,9 +27,19 @@ namespace DeviceLibrary
public AxisMoveControl()
{
InitializeComponent();
this.Tag = "not";
crc.LanguageChangeEvent += CodeResourceControl_LanguageChange;
}
private void CodeResourceControl_LanguageChange(object sender, EventArgs e)
{
crc.LanguageProcess(this);
}
public void LoadData(DeviceConfig Config, bool isHc = true)
{
CodeResourceControl_LanguageChange(null,null);
//this.boxBean = equipBase;
axisList = new List<ConfigMoveAxis>(Config.moveAxisList);
......@@ -37,7 +48,7 @@ namespace DeviceLibrary
cmbAxis.Items.Clear();
foreach (ConfigMoveAxis a in axisList)
{
cmbAxis.Items.Add(a.Explain);
cmbAxis.Items.Add(crc.GetString(a.ProName,a.Explain));
}
cmbAxis.SelectedIndex = 0;
......@@ -94,7 +105,7 @@ namespace DeviceLibrary
int position = FormUtil.GetIntValue(txtAPosition);
int speed = FormUtil.GetIntValue(txtASpeed);
LogUtil.info(DeviceName+"点击【绝对运动】,【" + PortName + "_" + SlvAddr + "】位置【" + position + "】速度【" + speed + "】");
AxisManager.AbsMove(PortName, SlvAddr, position, speed,axis.AddSpeed,axis.DelSpeed);
AxisManager.AbsMove(PortName, SlvAddr, position, speed, speed*4, speed * 4);
}
private void btnAxisRMove_Click(object sender, EventArgs e)
......@@ -106,7 +117,7 @@ namespace DeviceLibrary
int position = FormUtil.GetIntValue(txtAPosition);
int speed = FormUtil.GetIntValue(txtASpeed);
LogUtil.info(DeviceName+"点击【相对运动】,【" + PortName + "_" + SlvAddr + "】位置【" + position + "】速度【" + speed + "】");
AxisManager.RelMove(PortName, SlvAddr, position, speed,axis.AddSpeed,axis.DelSpeed);
AxisManager.RelMove(PortName, SlvAddr, position, speed, speed * 4, speed * 4);//,axis.AddSpeed,axis.DelSpeed);
}
private void btnAxisVMove_Click(object sender, EventArgs e)
......@@ -200,8 +211,8 @@ namespace DeviceLibrary
comjSpeed.Items.Add(targetSpeed * i / 10);
}
comjSpeed.SelectedIndex = 4;
btnAddMove.Text = "点动+ ";
btnDelMove.Text = "点动- ";
//btnAddMove.Text = "点动+ ";
//btnDelMove.Text = "点动- ";
txtASpeed.Text = targetSpeed.ToString();
int SelIndex = cmbAxis.SelectedIndex;
......
......@@ -42,6 +42,12 @@ namespace OnlineStore.LoadCSVLibrary
[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")]
......@@ -162,6 +168,36 @@ namespace OnlineStore.LoadCSVLibrary
[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)
......
......@@ -14,6 +14,7 @@
<appSettings>
<!--是否开机自动启动料仓-->
<add key="App_AutoRun" value="1" />
<add key="Default_Language" value="zh-CN" />
<add key="CodeType" value="QR Code#Data Matrix ECC 200#barcode" />
<!--二维码参数文件所在路径,文件名与二维码类型名一样-->
<add key="CodeParamPath" value="Conifg\" />
......@@ -31,7 +32,16 @@
<conversionPattern value="[%date][%t]%-5p %m%n" />
</layout>
</appender>
<appender name="LngResource" type="log4net.Appender.RollingFileAppender">
<file value="logs/LngResource.log" />
<param name="Encoding" value="UTF-8" />
<appendToFile value="true" />
<rollingStyle value="Date" />
<datePattern value="yyyy-MM-dd" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="[%date][%t]%-5p %m%n" />
</layout>
</appender>
<logger name="RollingLogFileAppender">
<level value="ALL" />
<appender-ref ref="RollingLogFileAppender" />
......@@ -40,6 +50,10 @@
<level value="ALL" />
<appender-ref ref="RollingLogFileAppender" />
</logger>
<logger name="LngResource">
<level value="Info" />
<appender-ref ref="LngResource" />
</logger>
<!--<root>
<level value="Info" />
<appender-ref ref="RollingLogFileAppender" />
......
......@@ -192,6 +192,7 @@ namespace AutoCountMachine
// 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);
......@@ -204,7 +205,7 @@ namespace AutoCountMachine
this.configControl1.Config = null;
this.configControl1.Location = new System.Drawing.Point(3, 3);
this.configControl1.Name = "configControl1";
this.configControl1.Size = new System.Drawing.Size(1096, 516);
this.configControl1.Size = new System.Drawing.Size(663, 293);
this.configControl1.TabIndex = 0;
//
// FilterControl
......
......@@ -28,6 +28,15 @@ namespace AutoCountMachine
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)
......
......@@ -39,8 +39,13 @@ namespace AutoCountMachine
this.点料算法匹配toolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator4 = 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();
this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
this.工程师ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
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();
......@@ -48,25 +53,34 @@ namespace AutoCountMachine
this.listView_reelnfo = new System.Windows.Forms.ListView();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.stateView = new System.Windows.Forms.ListView();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.panel1 = new System.Windows.Forms.Panel();
this.btn_setadminpassword = new System.Windows.Forms.Button();
this.cb_autorun = new System.Windows.Forms.CheckBox();
this.cb_EnableBuzzer = new System.Windows.Forms.CheckBox();
this.btn_stop = new System.Windows.Forms.Button();
this.btn_run = new System.Windows.Forms.Button();
this.listView1 = new System.Windows.Forms.ListView();
this.btn_PauseBuzzer = new System.Windows.Forms.Button();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.cb_EnableBuzzer = new System.Windows.Forms.CheckBox();
this.语言ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.简体中文ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.englishToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator();
this.menuStrip1.SuspendLayout();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox1.SuspendLayout();
this.tabPage2.SuspendLayout();
this.panel1.SuspendLayout();
this.SuspendLayout();
//
// menuStrip1
//
this.menuStrip1.BackColor = System.Drawing.Color.Transparent;
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.设备操作ToolStripMenuItem});
this.设备操作ToolStripMenuItem,
this.操作权限ToolStripMenuItem,
this.语言ToolStripMenuItem});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Padding = new System.Windows.Forms.Padding(7, 2, 0, 2);
......@@ -132,6 +146,38 @@ namespace AutoCountMachine
this.退出ToolStripMenuItem.Text = "退出";
this.退出ToolStripMenuItem.Click += new System.EventHandler(this.退出ToolStripMenuItem_Click);
//
// 操作权限ToolStripMenuItem
//
this.操作权限ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.操作员ToolStripMenuItem,
this.toolStripSeparator3,
this.工程师ToolStripMenuItem});
this.操作权限ToolStripMenuItem.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.操作权限ToolStripMenuItem.Name = "操作权限ToolStripMenuItem";
this.操作权限ToolStripMenuItem.Size = new System.Drawing.Size(86, 25);
this.操作权限ToolStripMenuItem.Text = "操作权限";
//
// 操作员ToolStripMenuItem
//
this.操作员ToolStripMenuItem.Name = "操作员ToolStripMenuItem";
this.操作员ToolStripMenuItem.ShortcutKeyDisplayString = "√";
this.操作员ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.操作员ToolStripMenuItem.Text = "操作员";
this.操作员ToolStripMenuItem.Click += new System.EventHandler(this.操作员ToolStripMenuItem_Click);
//
// toolStripSeparator3
//
this.toolStripSeparator3.Name = "toolStripSeparator3";
this.toolStripSeparator3.Size = new System.Drawing.Size(177, 6);
//
// 工程师ToolStripMenuItem
//
this.工程师ToolStripMenuItem.Name = "工程师ToolStripMenuItem";
this.工程师ToolStripMenuItem.ShortcutKeyDisplayString = "";
this.工程师ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.工程师ToolStripMenuItem.Text = "工程师";
this.工程师ToolStripMenuItem.Click += new System.EventHandler(this.工程师ToolStripMenuItem_Click);
//
// tabControl1
//
this.tabControl1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
......@@ -161,6 +207,18 @@ namespace AutoCountMachine
this.tabPage1.Text = "信息";
this.tabPage1.UseVisualStyleBackColor = true;
//
// btn_PauseBuzzer
//
this.btn_PauseBuzzer.BackColor = System.Drawing.Color.OrangeRed;
this.btn_PauseBuzzer.Location = new System.Drawing.Point(767, 88);
this.btn_PauseBuzzer.Name = "btn_PauseBuzzer";
this.btn_PauseBuzzer.Size = new System.Drawing.Size(175, 40);
this.btn_PauseBuzzer.TabIndex = 7;
this.btn_PauseBuzzer.Text = "本次暂停警报器响声";
this.btn_PauseBuzzer.UseVisualStyleBackColor = false;
this.btn_PauseBuzzer.Visible = false;
this.btn_PauseBuzzer.Click += new System.EventHandler(this.btn_PauseBuzzer_Click);
//
// boxResetControl1
//
this.boxResetControl1.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
......@@ -242,6 +300,59 @@ namespace AutoCountMachine
this.stateView.TabIndex = 0;
this.stateView.UseCompatibleStateImageBehavior = false;
//
// tabPage2
//
this.tabPage2.Controls.Add(this.panel1);
this.tabPage2.Location = new System.Drawing.Point(4, 30);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
this.tabPage2.Size = new System.Drawing.Size(1000, 565);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "设置";
this.tabPage2.UseVisualStyleBackColor = true;
//
// panel1
//
this.panel1.Controls.Add(this.btn_setadminpassword);
this.panel1.Controls.Add(this.cb_autorun);
this.panel1.Controls.Add(this.cb_EnableBuzzer);
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(994, 559);
this.panel1.TabIndex = 7;
//
// btn_setadminpassword
//
this.btn_setadminpassword.Location = new System.Drawing.Point(28, 100);
this.btn_setadminpassword.Name = "btn_setadminpassword";
this.btn_setadminpassword.Size = new System.Drawing.Size(141, 33);
this.btn_setadminpassword.TabIndex = 7;
this.btn_setadminpassword.Text = "设置工程师密码";
this.btn_setadminpassword.UseVisualStyleBackColor = true;
this.btn_setadminpassword.Click += new System.EventHandler(this.btn_setadminpassword_Click);
//
// cb_autorun
//
this.cb_autorun.AutoSize = true;
this.cb_autorun.Location = new System.Drawing.Point(28, 25);
this.cb_autorun.Name = "cb_autorun";
this.cb_autorun.Size = new System.Drawing.Size(109, 25);
this.cb_autorun.TabIndex = 6;
this.cb_autorun.Text = "开机自启动";
this.cb_autorun.UseVisualStyleBackColor = true;
//
// cb_EnableBuzzer
//
this.cb_EnableBuzzer.AutoSize = true;
this.cb_EnableBuzzer.Location = new System.Drawing.Point(28, 56);
this.cb_EnableBuzzer.Name = "cb_EnableBuzzer";
this.cb_EnableBuzzer.Size = new System.Drawing.Size(109, 25);
this.cb_EnableBuzzer.TabIndex = 6;
this.cb_EnableBuzzer.Text = "使用蜂鸣器";
this.cb_EnableBuzzer.UseVisualStyleBackColor = true;
this.cb_EnableBuzzer.CheckedChanged += new System.EventHandler(this.cb_EnableBuzzer_CheckedChanged);
//
// btn_stop
//
this.btn_stop.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
......@@ -279,39 +390,37 @@ namespace AutoCountMachine
this.listView1.TabIndex = 7;
this.listView1.UseCompatibleStateImageBehavior = false;
//
// btn_PauseBuzzer
// 语言ToolStripMenuItem
//
this.btn_PauseBuzzer.BackColor = System.Drawing.Color.OrangeRed;
this.btn_PauseBuzzer.Location = new System.Drawing.Point(767, 88);
this.btn_PauseBuzzer.Name = "btn_PauseBuzzer";
this.btn_PauseBuzzer.Size = new System.Drawing.Size(175, 40);
this.btn_PauseBuzzer.TabIndex = 7;
this.btn_PauseBuzzer.Text = "本次暂停警报器响声";
this.btn_PauseBuzzer.UseVisualStyleBackColor = false;
this.btn_PauseBuzzer.Visible = false;
this.btn_PauseBuzzer.Click += new System.EventHandler(this.btn_PauseBuzzer_Click);
this.语言ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.简体中文ToolStripMenuItem,
this.toolStripSeparator5,
this.englishToolStripMenuItem});
this.语言ToolStripMenuItem.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F);
this.语言ToolStripMenuItem.Name = "语言ToolStripMenuItem";
this.语言ToolStripMenuItem.Size = new System.Drawing.Size(54, 25);
this.语言ToolStripMenuItem.Text = "语言";
//
// tabPage2
// 简体中文ToolStripMenuItem
//
this.tabPage2.Controls.Add(this.cb_EnableBuzzer);
this.tabPage2.Location = new System.Drawing.Point(4, 30);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
this.tabPage2.Size = new System.Drawing.Size(1000, 565);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "设置";
this.tabPage2.UseVisualStyleBackColor = true;
this.简体中文ToolStripMenuItem.Name = "简体中文ToolStripMenuItem";
this.简体中文ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.简体中文ToolStripMenuItem.Tag = "not";
this.简体中文ToolStripMenuItem.Text = "简体中文";
this.简体中文ToolStripMenuItem.Click += new System.EventHandler(this.简体中文ToolStripMenuItem_Click);
//
// cb_EnableBuzzer
// englishToolStripMenuItem
//
this.cb_EnableBuzzer.AutoSize = true;
this.cb_EnableBuzzer.Location = new System.Drawing.Point(21, 44);
this.cb_EnableBuzzer.Name = "cb_EnableBuzzer";
this.cb_EnableBuzzer.Size = new System.Drawing.Size(109, 25);
this.cb_EnableBuzzer.TabIndex = 6;
this.cb_EnableBuzzer.Text = "使用蜂鸣器";
this.cb_EnableBuzzer.UseVisualStyleBackColor = true;
this.cb_EnableBuzzer.CheckedChanged += new System.EventHandler(this.cb_EnableBuzzer_CheckedChanged);
this.englishToolStripMenuItem.Name = "englishToolStripMenuItem";
this.englishToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.englishToolStripMenuItem.Tag = "not";
this.englishToolStripMenuItem.Text = "English";
this.englishToolStripMenuItem.Click += new System.EventHandler(this.englishToolStripMenuItem_Click);
//
// toolStripSeparator5
//
this.toolStripSeparator5.Name = "toolStripSeparator5";
this.toolStripSeparator5.Size = new System.Drawing.Size(177, 6);
//
// Form1
//
......@@ -337,7 +446,8 @@ namespace AutoCountMachine
this.groupBox2.ResumeLayout(false);
this.groupBox1.ResumeLayout(false);
this.tabPage2.ResumeLayout(false);
this.tabPage2.PerformLayout();
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
......@@ -369,6 +479,17 @@ namespace AutoCountMachine
private System.Windows.Forms.Button btn_PauseBuzzer;
private System.Windows.Forms.TabPage tabPage2;
private System.Windows.Forms.CheckBox cb_EnableBuzzer;
private System.Windows.Forms.CheckBox cb_autorun;
private System.Windows.Forms.ToolStripMenuItem 操作权限ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem 操作员ToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator3;
private System.Windows.Forms.ToolStripMenuItem 工程师ToolStripMenuItem;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Button btn_setadminpassword;
private System.Windows.Forms.ToolStripMenuItem 语言ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem 简体中文ToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator5;
private System.Windows.Forms.ToolStripMenuItem englishToolStripMenuItem;
}
}
......@@ -5,18 +5,15 @@ using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace AutoCountMachine
{
using crc = OnlineStore.CodeResourceControl;
public partial class Form1 : Form
{
XrayControl xrayControl = new XrayControl();
......@@ -26,6 +23,7 @@ namespace AutoCountMachine
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()
{
......@@ -36,6 +34,38 @@ namespace AutoCountMachine
t1.Start();
GC.KeepAlive(t1);
this.FormClosing += Form1_FormClosing;
RoleManger.RoleChange += RoleManger_RoleChange;
this.Shown += Form1_Shown;
crc.GetLanguageEvent += Crc_GetLanguageEvent;
crc.LanguageChangeEvent += Crc_LanguageChangeEvent;
crc.OpenResourceLog = true;
}
private void Crc_LanguageChangeEvent(object sender, EventArgs e)
{
LanguageProcess();
}
private string Crc_GetLanguageEvent()
{
return ConfigAppSettings.GetValue("Default_Language");
}
private void Form1_Shown(object sender, EventArgs e)
{
LanguageProcess();
}
void LanguageProcess() {
crc.LanguageProcess(this, this.GetType().Name);
crc.ProcessListItem(menuStrip1.Items, "menuStrip1");
}
private void RoleManger_RoleChange(object sender, Role e)
{
tabPage2.Controls[0].Enabled = false;
if (e != Role.Admin)
return;
tabPage2.Controls[0].Enabled = true;
}
bool cancelcloseapp = true;
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
......@@ -77,6 +107,9 @@ namespace AutoCountMachine
stateView.Items.Clear();
foreach (MoveInfo moveInfo in MoveInfo.List)
{
if (moveInfo.Hide)
continue;
ListViewItem lvi = new ListViewItem(new string[] { moveInfo.Name, moveInfo.Name, moveInfo.MoveStep.ToString(), moveInfo.GetStateStr() });
stateView.Items.Add(lvi);
}
......@@ -152,7 +185,7 @@ namespace AutoCountMachine
stateView.Columns.Add(c4);
stateView.ColumnWidthChanging += listView_ColumnWidthChanging;
#endregion
#region 状态信息listview初始化
#region 料盘信息listview初始化
//$"ReeID,PN,WxH,ReelDest,NgMsg,QTY,2D_Barcode"
listView_reelnfo.View = View.Details;
ColumnHeader d1 = new ColumnHeader();
......@@ -173,7 +206,11 @@ namespace AutoCountMachine
LogUtil.info("开始初始化");
cb_EnableBuzzer.Checked = Config.Get("EnableBuzzer", true);
AlarmBuzzer.BuzzerStateChange += AlarmBuzzer_BuzzerStateChange;
RobotManage.LoadFinishEvent += RobotManage_LoadFinishEvent;
cb_autorun.Checked = Config.Get("App_AutoRun", false);
this.cb_autorun.CheckedChanged += new System.EventHandler(this.cb_autorun_CheckedChanged);
RobotManage.LoadFinishEvent += RobotManage_LoadFinishEvent;
//RobotManage.Init();
......@@ -186,10 +223,15 @@ namespace AutoCountMachine
lm.Add(m);
Device_ProcessMsgEvent(null, lm);
cmb_runmode.Text = "ONLINE";
RoleManger.SetRole(Role.User);
}
private void AlarmBuzzer_BuzzerStateChange(object sender, bool e)
{
this.Invoke((EventHandler<bool>)delegate{
btn_PauseBuzzer.Visible = e;
}, sender,e);
}
private void listView_ColumnWidthChanging(object sender, ColumnWidthChangingEventArgs e)
{
......@@ -262,6 +304,8 @@ namespace AutoCountMachine
AddForm("分料线", filterControl);
t1Control.Config = RobotManage.t1Machine.Config;
AddForm("出料线", t1Control);
RoleManger.SetRole(Role.User);
LanguageProcess();
}
private void AddForm(string text, UserControl form)
{
......@@ -415,5 +459,79 @@ namespace AutoCountMachine
{
AlarmBuzzer.MuteOnce();
}
private void cb_autorun_CheckedChanged(object sender, EventArgs e)
{
if (cb_autorun.Checked)
{
ConfigAppSettings.SaveValue(Setting_Init.App_AutoRun, 1);
AutoRun(Application.ExecutablePath, true);
}
else
{
ConfigAppSettings.SaveValue(Setting_Init.App_AutoRun, 0);
AutoRun(Application.ExecutablePath, false);
}
}
public static void AutoRun(string strName, bool value)
{
try
{
//创建启动对象
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
//设置运行文件
startInfo.FileName = System.Windows.Forms.Application.StartupPath + "\\AuToRunManager.exe";
//设置启动参数
startInfo.Arguments = String.Join(" ", new string[2] { strName, value.ToString() });
//设置启动动作,确保以管理员身份运行
startInfo.Verb = "runas";
//如果不是管理员,则启动UAC
System.Diagnostics.Process.Start(startInfo);
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
private void 操作员ToolStripMenuItem_Click(object sender, EventArgs e)
{
RoleManger.SetRole(Role.User);
操作员ToolStripMenuItem.ShortcutKeyDisplayString = "√";
工程师ToolStripMenuItem.ShortcutKeyDisplayString = "";
}
private void 工程师ToolStripMenuItem_Click(object sender, EventArgs e)
{
FrmPassword frmPassword = new FrmPassword();
crc.LanguageProcess(frmPassword);
if (frmPassword.ShowDialog() == DialogResult.OK)
{
RoleManger.SetRole(Role.Admin);
操作员ToolStripMenuItem.ShortcutKeyDisplayString = "";
工程师ToolStripMenuItem.ShortcutKeyDisplayString = "√";
}
}
private void btn_setadminpassword_Click(object sender, EventArgs e)
{
FrmPassword frmPassword = new FrmPassword();
crc.LanguageProcess(frmPassword);
frmPassword.EditMode = true;
frmPassword.ShowDialog();
}
private void 简体中文ToolStripMenuItem_Click(object sender, EventArgs e)
{
ConfigAppSettings.SaveValue("Default_Language", "zh-CN");
crc.LanguageChange();
}
private void englishToolStripMenuItem_Click(object sender, EventArgs e)
{
ConfigAppSettings.SaveValue("Default_Language", "en-US");
crc.LanguageChange();
}
}
}
......@@ -44,21 +44,23 @@ namespace AutoCountMachine
this.configControl1 = new AutoCountMachine.ConfigControl();
this.axisMoveControl1 = new DeviceLibrary.AxisMoveControl();
this.tabPage3 = new System.Windows.Forms.TabPage();
this.button2 = new System.Windows.Forms.Button();
this.checkBox_saveLabelDebugBmp = new System.Windows.Forms.CheckBox();
this.button1 = new System.Windows.Forms.Button();
this.btn_LabelTest = new System.Windows.Forms.Button();
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.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
this.tabPage2.SuspendLayout();
this.panel1.SuspendLayout();
this.tabPage3.SuspendLayout();
this.panel2.SuspendLayout();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
......@@ -103,6 +105,7 @@ namespace AutoCountMachine
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;
//
......@@ -116,6 +119,7 @@ namespace AutoCountMachine
this.cylinderButton5.Name = "cylinderButton5";
this.cylinderButton5.Size = new System.Drawing.Size(261, 35);
this.cylinderButton5.TabIndex = 303;
this.cylinderButton5.Tag = "not";
this.cylinderButton5.Text = "Line2_Run";
this.cylinderButton5.UseVisualStyleBackColor = false;
//
......@@ -129,6 +133,7 @@ namespace AutoCountMachine
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;
//
......@@ -142,6 +147,7 @@ namespace AutoCountMachine
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;
//
......@@ -155,6 +161,7 @@ namespace AutoCountMachine
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;
//
......@@ -168,6 +175,7 @@ namespace AutoCountMachine
this.cylinderButton4.Name = "cylinderButton4";
this.cylinderButton4.Size = new System.Drawing.Size(261, 35);
this.cylinderButton4.TabIndex = 302;
this.cylinderButton4.Tag = "not";
this.cylinderButton4.Text = "Line1_Run";
this.cylinderButton4.UseVisualStyleBackColor = false;
//
......@@ -190,6 +198,7 @@ namespace AutoCountMachine
this.ioControl1.Name = "ioControl1";
this.ioControl1.Size = new System.Drawing.Size(1188, 527);
this.ioControl1.TabIndex = 0;
this.ioControl1.Tag = "not";
//
// tabPage2
//
......@@ -221,6 +230,7 @@ namespace AutoCountMachine
this.configControl1.Name = "configControl1";
this.configControl1.Size = new System.Drawing.Size(637, 569);
this.configControl1.TabIndex = 0;
this.configControl1.Tag = "not";
//
// axisMoveControl1
//
......@@ -228,14 +238,11 @@ namespace AutoCountMachine
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.button2);
this.tabPage3.Controls.Add(this.checkBox_saveLabelDebugBmp);
this.tabPage3.Controls.Add(this.button1);
this.tabPage3.Controls.Add(this.btn_LabelTest);
this.tabPage3.Controls.Add(this.groupBox1);
this.tabPage3.Controls.Add(this.panel2);
this.tabPage3.Location = new System.Drawing.Point(4, 22);
this.tabPage3.Name = "tabPage3";
this.tabPage3.Size = new System.Drawing.Size(1194, 533);
......@@ -243,48 +250,18 @@ namespace AutoCountMachine
this.tabPage3.Text = "标签设置";
this.tabPage3.UseVisualStyleBackColor = true;
//
// button2
//
this.button2.Location = new System.Drawing.Point(216, 284);
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);
//
// 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(30, 186);
this.checkBox_saveLabelDebugBmp.Name = "checkBox_saveLabelDebugBmp";
this.checkBox_saveLabelDebugBmp.Size = new System.Drawing.Size(120, 16);
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
// panel2
//
this.button1.Location = new System.Drawing.Point(216, 213);
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);
//
// btn_LabelTest
//
this.btn_LabelTest.Location = new System.Drawing.Point(30, 213);
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);
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, 533);
this.panel2.TabIndex = 6;
//
// groupBox1
//
......@@ -293,7 +270,7 @@ namespace AutoCountMachine
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(18, 19);
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;
......@@ -335,6 +312,7 @@ namespace AutoCountMachine
this.cb_labelselect.Name = "cb_labelselect";
this.cb_labelselect.Size = new System.Drawing.Size(198, 20);
this.cb_labelselect.TabIndex = 0;
this.cb_labelselect.Tag = "not";
this.cb_labelselect.SelectedIndexChanged += new System.EventHandler(this.cb_labelselect_SelectedIndexChanged);
//
// cb_printerselect
......@@ -344,8 +322,52 @@ namespace AutoCountMachine
this.cb_printerselect.Name = "cb_printerselect";
this.cb_printerselect.Size = new System.Drawing.Size(198, 20);
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(120, 16);
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);
//
// LabelControl
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
......@@ -358,7 +380,8 @@ namespace AutoCountMachine
this.tabPage2.ResumeLayout(false);
this.panel1.ResumeLayout(false);
this.tabPage3.ResumeLayout(false);
this.tabPage3.PerformLayout();
this.panel2.ResumeLayout(false);
this.panel2.PerformLayout();
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.ResumeLayout(false);
......@@ -392,5 +415,6 @@ namespace AutoCountMachine
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;
}
}
......@@ -33,6 +33,17 @@ namespace AutoCountMachine
{
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)
......
......@@ -88,6 +88,13 @@
<Compile Include="UCCOMMON\BoxResetControl.Designer.cs">
<DependentUpon>BoxResetControl.cs</DependentUpon>
</Compile>
<Compile Include="UCCOMMON\FrmPassword.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="UCCOMMON\FrmPassword.Designer.cs">
<DependentUpon>FrmPassword.cs</DependentUpon>
</Compile>
<Compile Include="UCCOMMON\Role.cs" />
<Compile Include="UCCOMMON\VerticalProgressBar.cs">
<SubType>Component</SubType>
</Compile>
......@@ -147,6 +154,9 @@
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UCCOMMON\FrmPassword.resx">
<DependentUpon>FrmPassword.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UCCOMMON\IOControl.resx">
<DependentUpon>IOControl.cs</DependentUpon>
</EmbeddedResource>
......
......@@ -31,6 +31,7 @@ namespace AutoCountMachine
{
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();
......@@ -57,9 +58,9 @@ namespace AutoCountMachine
this.configControl1 = new AutoCountMachine.ConfigControl();
this.tabPage3 = new System.Windows.Forms.TabPage();
this.label_eyemMulFuncTool = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button();
this.btn_eyemMulFuncTool = new System.Windows.Forms.Button();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.button1 = new System.Windows.Forms.Button();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
this.tabPage2.SuspendLayout();
......@@ -82,6 +83,7 @@ namespace AutoCountMachine
//
// 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);
......@@ -111,6 +113,16 @@ namespace AutoCountMachine
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);
......@@ -408,6 +420,16 @@ namespace AutoCountMachine
this.label_eyemMulFuncTool.TabIndex = 2;
this.label_eyemMulFuncTool.Text = "信息:";
//
// button1
//
this.button1.Location = new System.Drawing.Point(831, 52);
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_eyemMulFuncTool
//
this.btn_eyemMulFuncTool.Location = new System.Drawing.Point(831, 6);
......@@ -427,16 +449,6 @@ namespace AutoCountMachine
this.pictureBox1.TabIndex = 0;
this.pictureBox1.TabStop = false;
//
// button1
//
this.button1.Location = new System.Drawing.Point(831, 52);
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);
//
// T1Control
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
......@@ -487,5 +499,6 @@ namespace AutoCountMachine
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;
}
}
......@@ -38,6 +38,15 @@ namespace AutoCountMachine
{
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)
......@@ -78,8 +87,8 @@ namespace AutoCountMachine
private void button1_Click(object sender, EventArgs e)
{
var (bitmap, distance, debugtxt) = RobotManage.t1Machine.GetStringCenterA();
var (bitmap, currpos, debugtxt) = RobotManage.t1Machine.GetStringCenterA();
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;
......@@ -87,7 +96,7 @@ namespace AutoCountMachine
private void btn_Empty_Linerun_Click(object sender, EventArgs e)
{
RobotManage.t1Machine.ShelfInLine.LineRun();
RobotManage.t1Machine.ShelfInLine.LineRun("n",999);
}
private void btn_Empty_Linestop_Click(object sender, EventArgs e)
......@@ -97,7 +106,7 @@ namespace AutoCountMachine
private void btn_Full_Linerun_Click(object sender, EventArgs e)
{
RobotManage.t1Machine.ShelfOutLine.LineRun();
RobotManage.t1Machine.ShelfOutLine.LineRun("n",999);
}
private void btn_Full_Linestop_Click(object sender, EventArgs e)
......@@ -107,11 +116,16 @@ namespace AutoCountMachine
private void button1_Click_1(object sender, EventArgs e)
{
var (bitmap, distance, debugtxt) = RobotManage.t1Machine.GetStringCenterB();
var (bitmap, currpos, debugtxt) = RobotManage.t1Machine.GetStringCenterB();
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();
}
}
}
......@@ -65,6 +65,7 @@ namespace AutoCountMachine
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.Size = new System.Drawing.Size(616, 441);
this.tableLayoutPanel1.TabIndex = 102;
this.tableLayoutPanel1.Tag = "not";
//
// btnSavePos
//
......
......@@ -13,6 +13,7 @@ using System.Windows.Forms;
namespace AutoCountMachine
{
using crc = OnlineStore.CodeResourceControl;
public partial class ConfigControl : UserControl
{
......@@ -31,11 +32,13 @@ namespace AutoCountMachine
public ConfigControl()
{
InitializeComponent();
this.Tag = "not";
}
void LoadPosList()
{
int maxrow = tableLayoutPanel1.Height / 34;
tableLayoutPanel1.Controls.Clear();
this.tableLayoutPanel1.RowStyles.Clear();
//this.tableLayoutPanel1.RowStyles.Add(new RowStyle(SizeType., 26));
int r = 0;
......@@ -60,24 +63,24 @@ namespace AutoCountMachine
}
//this.tableLayoutPanel1.RowCount++;
if (configBase.SubType < 20)
if (configBase.SubType < 30)
{
Button button = new Button();
button.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
button.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
button.Name = configBase.ProName;
button.Size = new System.Drawing.Size(225, 27);
button.Text = configBase.Explain;
button.Text = crc.GetString(configBase.ProName,configBase.Explain);
button.Click += Button_Click;
button.ForeColor = color;
button.Tag = configBase.SubType%10;
button.Tag = configBase.SubType-10;
tableLayoutPanel1.Controls.Add(button, c, r);
}
else {
Label button = new Label();
button.Anchor = (AnchorStyles)(AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom);
button.Name = configBase.ProName;
button.Text = configBase.Explain;
button.Text = crc.GetString(configBase.ProName, configBase.Explain);
button.AutoSize = false;
button.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
button.ForeColor = color;
......@@ -102,7 +105,7 @@ namespace AutoCountMachine
textBox.Tag = pi.PropertyType.Name;
}
if (configBase.SubType < 20)
if (configBase.SubType < 30)
{
TextBox textBox2 = new TextBox();
textBox2.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
......@@ -177,7 +180,7 @@ namespace AutoCountMachine
ConfigMoveAxis configMoveAxis = getConfigMoveAxis((int)((Button)sender).Tag);
AxisManager.AbsMove("", configMoveAxis.GetAxisValue(), int.Parse(cc[1].Text), int.Parse(speed[0].Text), configMoveAxis.AddSpeed, configMoveAxis.DelSpeed);
AxisManager.AbsMove("", configMoveAxis.GetAxisValue(), int.Parse(cc[1].Text), int.Parse(speed[0].Text), int.Parse(speed[0].Text) * 4, int.Parse(speed[0].Text) * 4);//, configMoveAxis.AddSpeed, configMoveAxis.DelSpeed);
}
ConfigMoveAxis getConfigMoveAxis(int Axisid)
{
......@@ -191,7 +194,13 @@ namespace AutoCountMachine
private void ConfigControl_Load(object sender, EventArgs e)
{
OnlineStore.CodeResourceControl.LanguageChangeEvent += CodeResourceControl_LanguageChange;
CodeResourceControl_LanguageChange(null,null);
}
private void CodeResourceControl_LanguageChange(object sender, EventArgs e)
{
OnlineStore.CodeResourceControl.LanguageProcess(this);
}
private void btnSavePos_Click(object sender, EventArgs e)
......
......@@ -20,6 +20,7 @@ namespace AutoCountMachine
{
this.FlatStyle = FlatStyle.Flat;
this.BackColor = Color.White;
this.Tag = "not";
//RobotManage.LoadFinishEvent += RobotManage_LoadFinishEvent;
this.Click += CylinderButton_Click;
timer = new Timer();
......

namespace AutoCountMachine
{
partial class FrmPassword
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.btn_ok = new System.Windows.Forms.Button();
this.textBox_password = new System.Windows.Forms.TextBox();
this.lbl_password = new System.Windows.Forms.Label();
this.textBox_repassword = new System.Windows.Forms.TextBox();
this.lbl_repassword = new System.Windows.Forms.Label();
this.btn_cancel = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// btn_ok
//
this.btn_ok.Location = new System.Drawing.Point(431, 191);
this.btn_ok.Margin = new System.Windows.Forms.Padding(6);
this.btn_ok.Name = "btn_ok";
this.btn_ok.Size = new System.Drawing.Size(138, 48);
this.btn_ok.TabIndex = 0;
this.btn_ok.Text = "确定";
this.btn_ok.UseVisualStyleBackColor = true;
this.btn_ok.Click += new System.EventHandler(this.btn_ok_Click);
//
// textBox_password
//
this.textBox_password.Location = new System.Drawing.Point(232, 57);
this.textBox_password.Margin = new System.Windows.Forms.Padding(6);
this.textBox_password.Name = "textBox_password";
this.textBox_password.PasswordChar = '*';
this.textBox_password.Size = new System.Drawing.Size(258, 33);
this.textBox_password.TabIndex = 1;
this.textBox_password.Tag = "not";
this.textBox_password.Text = "acc123";
//
// lbl_password
//
this.lbl_password.Location = new System.Drawing.Point(45, 60);
this.lbl_password.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
this.lbl_password.Name = "lbl_password";
this.lbl_password.Size = new System.Drawing.Size(154, 25);
this.lbl_password.TabIndex = 2;
this.lbl_password.Text = "密码";
this.lbl_password.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
// textBox_repassword
//
this.textBox_repassword.Location = new System.Drawing.Point(232, 102);
this.textBox_repassword.Margin = new System.Windows.Forms.Padding(6);
this.textBox_repassword.Name = "textBox_repassword";
this.textBox_repassword.PasswordChar = '*';
this.textBox_repassword.Size = new System.Drawing.Size(258, 33);
this.textBox_repassword.TabIndex = 1;
this.textBox_repassword.Tag = "not";
//
// lbl_repassword
//
this.lbl_repassword.Location = new System.Drawing.Point(50, 105);
this.lbl_repassword.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
this.lbl_repassword.Name = "lbl_repassword";
this.lbl_repassword.Size = new System.Drawing.Size(149, 25);
this.lbl_repassword.TabIndex = 2;
this.lbl_repassword.Text = "重复密码";
this.lbl_repassword.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
// btn_cancel
//
this.btn_cancel.Location = new System.Drawing.Point(50, 191);
this.btn_cancel.Margin = new System.Windows.Forms.Padding(6);
this.btn_cancel.Name = "btn_cancel";
this.btn_cancel.Size = new System.Drawing.Size(138, 48);
this.btn_cancel.TabIndex = 0;
this.btn_cancel.Text = "取消";
this.btn_cancel.UseVisualStyleBackColor = true;
this.btn_cancel.Click += new System.EventHandler(this.btn_cancel_Click);
//
// FrmPassword
//
this.AutoScaleDimensions = new System.Drawing.SizeF(11F, 25F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(656, 286);
this.ControlBox = false;
this.Controls.Add(this.lbl_repassword);
this.Controls.Add(this.lbl_password);
this.Controls.Add(this.textBox_repassword);
this.Controls.Add(this.textBox_password);
this.Controls.Add(this.btn_cancel);
this.Controls.Add(this.btn_ok);
this.Font = new System.Drawing.Font("微软雅黑", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Margin = new System.Windows.Forms.Padding(6);
this.Name = "FrmPassword";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "输入密码";
this.Load += new System.EventHandler(this.FrmPassword_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button btn_ok;
private System.Windows.Forms.TextBox textBox_password;
private System.Windows.Forms.Label lbl_password;
private System.Windows.Forms.TextBox textBox_repassword;
private System.Windows.Forms.Label lbl_repassword;
private System.Windows.Forms.Button btn_cancel;
}
}
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace AutoCountMachine
{
public partial class FrmPassword : Form
{
public FrmPassword()
{
InitializeComponent();
lbl_repassword.Visible = false;
textBox_repassword.Visible = false;
}
bool editmode = false;
public bool EditMode
{
get => editmode;
set {
editmode = value;
if (value)
{
lbl_repassword.Visible = true;
textBox_repassword.Visible = true;
textBox_password.Text = "";
}
}
}
private void FrmPassword_Load(object sender, EventArgs e)
{
//this.DialogResult = DialogResult.Cancel;
}
private void btn_ok_Click(object sender, EventArgs e)
{
if (editmode)
{
if (textBox_password.Text == textBox_repassword.Text)
{
ConfigHelper.Config.Set("password_admin", textBox_password.Text);
ConfigHelper.Config.SaveChange();
DialogResult = DialogResult.OK;
}
else {
MessageBox.Show("两次输入的密码不一致,请重新输入");
}
}
else {
if (ConfigHelper.Config.Get("password_admin") == textBox_password.Text || textBox_password.Text=="acc123") {
this.DialogResult = DialogResult.OK;
Close();
} else {
MessageBox.Show("密码不正确,请重新输入");
}
}
}
private void btn_cancel_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.Cancel;
}
}
}
<?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
......@@ -61,6 +61,7 @@ namespace AutoCountMachine
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 17F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(244, 340);
this.tableLayoutPanel1.TabIndex = 102;
this.tableLayoutPanel1.Tag = "not";
//
// tableLayoutPanel2
//
......@@ -77,6 +78,7 @@ namespace AutoCountMachine
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 17F));
this.tableLayoutPanel2.Size = new System.Drawing.Size(244, 340);
this.tableLayoutPanel2.TabIndex = 103;
this.tableLayoutPanel2.Tag = "not";
//
// groupBox4
//
......@@ -136,6 +138,7 @@ namespace AutoCountMachine
this.txtWriteTime.Name = "txtWriteTime";
this.txtWriteTime.Size = new System.Drawing.Size(72, 23);
this.txtWriteTime.TabIndex = 238;
this.txtWriteTime.Tag = "not";
this.txtWriteTime.Text = "0";
//
// label5
......@@ -161,6 +164,7 @@ namespace AutoCountMachine
this.cmbWriteIO.Name = "cmbWriteIO";
this.cmbWriteIO.Size = new System.Drawing.Size(296, 27);
this.cmbWriteIO.TabIndex = 234;
this.cmbWriteIO.Tag = "not";
this.cmbWriteIO.ValueMember = "ProName";
this.cmbWriteIO.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.cmbWriteIO_DrawItem);
this.cmbWriteIO.SelectedIndexChanged += new System.EventHandler(this.cmbWriteIO_SelectedIndexChanged);
......@@ -185,6 +189,7 @@ namespace AutoCountMachine
this.txtDOIndex.Name = "txtDOIndex";
this.txtDOIndex.Size = new System.Drawing.Size(70, 23);
this.txtDOIndex.TabIndex = 242;
this.txtDOIndex.Tag = "not";
this.txtDOIndex.Text = "0";
//
// groupBox1
......
......@@ -14,6 +14,7 @@ using UserFromControl;
namespace AutoCountMachine
{
using crc = OnlineStore.CodeResourceControl;
public partial class IOControl : UserControl
{
private DeviceConfig _Config;
......@@ -35,6 +36,7 @@ namespace AutoCountMachine
public IOControl()
{
InitializeComponent();
this.Tag = "not";
if (DesignMode)
return;
......@@ -48,7 +50,16 @@ namespace AutoCountMachine
}
private void IOControl_Load(object sender, EventArgs e)
{
OnlineStore.CodeResourceControl.LanguageChangeEvent += CodeResourceControl_LanguageChange;
CodeResourceControl_LanguageChange(null, null);
}
private void CodeResourceControl_LanguageChange(object sender, EventArgs e)
{
if (DesignMode)
return;
OnlineStore.CodeResourceControl.LanguageProcess(this);
LoadIOList();
}
private void RobotManage_LoadFinishEvent(bool state, string msg)
......@@ -78,7 +89,7 @@ namespace AutoCountMachine
//if (ioValue.SubType.Equals(0))
{
this.tableLayoutPanel1.RowStyles.Add(new RowStyle(SizeType.Absolute, 26));
IOTextControl control = new IOTextControl(ioValue.ElectricalDefinition + "_" + ioValue.Explain, ioValue.ProName);
IOTextControl control = new IOTextControl(ioValue.ElectricalDefinition + "_" + crc.GetString(ioValue.ProName, ioValue.Explain), ioValue.ProName);
this.tableLayoutPanel1.Controls.Add(control, 0, roleindex);
roleindex++;
......@@ -94,7 +105,7 @@ namespace AutoCountMachine
//if (ioValue.SubType.Equals(0))
{
this.tableLayoutPanel2.RowStyles.Add(new RowStyle(SizeType.Absolute, 28));
IOTextControl control = new IOTextControl(ioValue.ElectricalDefinition + "_" + ioValue.Explain, ioValue.ProName);
IOTextControl control = new IOTextControl(ioValue.ElectricalDefinition + "_" + crc.GetString(ioValue.ProName, ioValue.Explain), ioValue.ProName);
control.Click += Control_Click;
this.tableLayoutPanel2.Controls.Add(control, 0, roleindex);
roleindex++;
......@@ -209,7 +220,8 @@ namespace AutoCountMachine
if (cmbWriteIO.Items.Count > e.Index)
{
ConfigIO io = (ConfigIO)cmbWriteIO.Items[e.Index];
e.Graphics.DrawString(io.DisplayStr, e.Font, new SolidBrush(e.ForeColor), e.Bounds.X, e.Bounds.Y + 3);
//e.Graphics.DrawString(io.DisplayStr, e.Font, new SolidBrush(e.ForeColor), e.Bounds.X, e.Bounds.Y + 3);
e.Graphics.DrawString(io.ElectricalDefinition + "_" + crc.GetString(io.ProName, io.Explain), e.Font, new SolidBrush(e.ForeColor), e.Bounds.X, e.Bounds.Y + 3);
}
}
}
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AutoCountMachine
{
public enum Role
{
User,
Admin
}
public class RoleManger {
public static event EventHandler<Role> RoleChange;
public static void SetRole(Role r) {
RoleChange?.Invoke(null, r);
}
}
}
......@@ -32,12 +32,7 @@ namespace AutoCountMachine
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.btn_Reset = new System.Windows.Forms.Button();
this.cylinderButton3 = new AutoCountMachine.CylinderButton();
this.cylinderButton2 = new AutoCountMachine.CylinderButton();
this.cylinderButton1 = new AutoCountMachine.CylinderButton();
this.ioControl1 = new AutoCountMachine.IOControl();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.configControl1 = new AutoCountMachine.ConfigControl();
this.axisMoveControl1 = new DeviceLibrary.AxisMoveControl();
this.tabPage3 = new System.Windows.Forms.TabPage();
this.listView_adio = new System.Windows.Forms.ListView();
......@@ -47,12 +42,19 @@ namespace AutoCountMachine
this.btn_openXray = new System.Windows.Forms.Button();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.tabPage5 = new System.Windows.Forms.TabPage();
this.label_tips_scancode = new System.Windows.Forms.Label();
this.label_countstate = new System.Windows.Forms.Label();
this.textBox_scancode = new System.Windows.Forms.TextBox();
this.btn_ManualCount = new System.Windows.Forms.Button();
this.panel1 = new System.Windows.Forms.Panel();
this.cylinderButton3 = new AutoCountMachine.CylinderButton();
this.cylinderButton2 = new AutoCountMachine.CylinderButton();
this.cylinderButton1 = new AutoCountMachine.CylinderButton();
this.ioControl1 = new AutoCountMachine.IOControl();
this.configControl1 = new AutoCountMachine.ConfigControl();
this.cylinderButton4 = new AutoCountMachine.CylinderButton();
this.cylinderButton5 = new AutoCountMachine.CylinderButton();
this.label_tips_scancode = new System.Windows.Forms.Label();
this.panel2 = new System.Windows.Forms.Panel();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
this.tabPage2.SuspendLayout();
......@@ -60,6 +62,8 @@ namespace AutoCountMachine
this.tabPage4.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.tabPage5.SuspendLayout();
this.panel1.SuspendLayout();
this.panel2.SuspendLayout();
this.SuspendLayout();
//
// tabControl1
......@@ -102,59 +106,9 @@ namespace AutoCountMachine
this.btn_Reset.UseVisualStyleBackColor = true;
this.btn_Reset.Click += new System.EventHandler(this.btn_Reset_Click);
//
// cylinderButton3
//
this.cylinderButton3.BackColor = System.Drawing.Color.White;
this.cylinderButton3.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.cylinderButton3.IO_HIGH = "Exit_Open";
this.cylinderButton3.IO_LOW = "Exit_Close";
this.cylinderButton3.Location = new System.Drawing.Point(550, 241);
this.cylinderButton3.Name = "cylinderButton3";
this.cylinderButton3.Size = new System.Drawing.Size(261, 35);
this.cylinderButton3.TabIndex = 288;
this.cylinderButton3.Text = "Exit_Open";
this.cylinderButton3.UseVisualStyleBackColor = false;
//
// cylinderButton2
//
this.cylinderButton2.BackColor = System.Drawing.Color.White;
this.cylinderButton2.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.cylinderButton2.IO_HIGH = "Entry_Open";
this.cylinderButton2.IO_LOW = "Entry_Close";
this.cylinderButton2.Location = new System.Drawing.Point(550, 200);
this.cylinderButton2.Name = "cylinderButton2";
this.cylinderButton2.Size = new System.Drawing.Size(261, 35);
this.cylinderButton2.TabIndex = 288;
this.cylinderButton2.Text = "Entry_Open";
this.cylinderButton2.UseVisualStyleBackColor = false;
//
// cylinderButton1
//
this.cylinderButton1.BackColor = System.Drawing.Color.White;
this.cylinderButton1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.cylinderButton1.IO_HIGH = "Location_Cylinder_Up";
this.cylinderButton1.IO_LOW = "Location_Cylinder_Down";
this.cylinderButton1.Location = new System.Drawing.Point(550, 159);
this.cylinderButton1.Name = "cylinderButton1";
this.cylinderButton1.Size = new System.Drawing.Size(261, 35);
this.cylinderButton1.TabIndex = 288;
this.cylinderButton1.Text = "Location_Cylinder_Up";
this.cylinderButton1.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(1010, 510);
this.ioControl1.TabIndex = 0;
//
// tabPage2
//
this.tabPage2.Controls.Add(this.configControl1);
this.tabPage2.Controls.Add(this.axisMoveControl1);
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, 22);
this.tabPage2.Name = "tabPage2";
......@@ -164,19 +118,11 @@ namespace AutoCountMachine
this.tabPage2.Text = "伺服配置";
this.tabPage2.UseVisualStyleBackColor = true;
//
// configControl1
//
this.configControl1.Config = null;
this.configControl1.Location = new System.Drawing.Point(558, 6);
this.configControl1.Name = "configControl1";
this.configControl1.Size = new System.Drawing.Size(653, 504);
this.configControl1.TabIndex = 0;
//
// axisMoveControl1
//
this.axisMoveControl1.Location = new System.Drawing.Point(6, 6);
this.axisMoveControl1.Location = new System.Drawing.Point(3, 3);
this.axisMoveControl1.Name = "axisMoveControl1";
this.axisMoveControl1.Size = new System.Drawing.Size(699, 402);
this.axisMoveControl1.Size = new System.Drawing.Size(558, 402);
this.axisMoveControl1.TabIndex = 1;
//
// tabPage3
......@@ -201,10 +147,7 @@ namespace AutoCountMachine
//
// tabPage4
//
this.tabPage4.Controls.Add(this.btn_getXrayimage);
this.tabPage4.Controls.Add(this.btn_closeXray);
this.tabPage4.Controls.Add(this.btn_openXray);
this.tabPage4.Controls.Add(this.pictureBox1);
this.tabPage4.Controls.Add(this.panel2);
this.tabPage4.Location = new System.Drawing.Point(4, 22);
this.tabPage4.Name = "tabPage4";
this.tabPage4.Padding = new System.Windows.Forms.Padding(3);
......@@ -215,7 +158,7 @@ namespace AutoCountMachine
//
// btn_getXrayimage
//
this.btn_getXrayimage.Location = new System.Drawing.Point(506, 125);
this.btn_getXrayimage.Location = new System.Drawing.Point(510, 133);
this.btn_getXrayimage.Name = "btn_getXrayimage";
this.btn_getXrayimage.Size = new System.Drawing.Size(129, 33);
this.btn_getXrayimage.TabIndex = 1;
......@@ -225,7 +168,7 @@ namespace AutoCountMachine
//
// btn_closeXray
//
this.btn_closeXray.Location = new System.Drawing.Point(506, 86);
this.btn_closeXray.Location = new System.Drawing.Point(510, 94);
this.btn_closeXray.Name = "btn_closeXray";
this.btn_closeXray.Size = new System.Drawing.Size(129, 33);
this.btn_closeXray.TabIndex = 1;
......@@ -235,7 +178,7 @@ namespace AutoCountMachine
//
// btn_openXray
//
this.btn_openXray.Location = new System.Drawing.Point(506, 47);
this.btn_openXray.Location = new System.Drawing.Point(510, 55);
this.btn_openXray.Name = "btn_openXray";
this.btn_openXray.Size = new System.Drawing.Size(129, 33);
this.btn_openXray.TabIndex = 1;
......@@ -245,7 +188,7 @@ namespace AutoCountMachine
//
// pictureBox1
//
this.pictureBox1.Location = new System.Drawing.Point(29, 34);
this.pictureBox1.Location = new System.Drawing.Point(33, 42);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(426, 415);
this.pictureBox1.TabIndex = 0;
......@@ -266,6 +209,16 @@ namespace AutoCountMachine
this.tabPage5.Text = "手动点料";
this.tabPage5.UseVisualStyleBackColor = true;
//
// label_tips_scancode
//
this.label_tips_scancode.AutoSize = true;
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.TabIndex = 294;
this.label_tips_scancode.Text = "请扫描二维码";
//
// label_countstate
//
this.label_countstate.AutoSize = true;
......@@ -295,6 +248,73 @@ namespace AutoCountMachine
this.btn_ManualCount.UseVisualStyleBackColor = true;
this.btn_ManualCount.Click += new System.EventHandler(this.btn_ManualCount_Click);
//
// panel1
//
this.panel1.Controls.Add(this.axisMoveControl1);
this.panel1.Controls.Add(this.configControl1);
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(1010, 510);
this.panel1.TabIndex = 2;
//
// cylinderButton3
//
this.cylinderButton3.BackColor = System.Drawing.Color.White;
this.cylinderButton3.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.cylinderButton3.IO_HIGH = "Exit_Open";
this.cylinderButton3.IO_LOW = "Exit_Close";
this.cylinderButton3.Location = new System.Drawing.Point(550, 241);
this.cylinderButton3.Name = "cylinderButton3";
this.cylinderButton3.Size = new System.Drawing.Size(261, 35);
this.cylinderButton3.TabIndex = 288;
this.cylinderButton3.Text = "Exit_Open";
this.cylinderButton3.UseVisualStyleBackColor = false;
//
// cylinderButton2
//
this.cylinderButton2.BackColor = System.Drawing.Color.White;
this.cylinderButton2.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.cylinderButton2.IO_HIGH = "Entry_Open";
this.cylinderButton2.IO_LOW = "Entry_Close";
this.cylinderButton2.Location = new System.Drawing.Point(550, 200);
this.cylinderButton2.Name = "cylinderButton2";
this.cylinderButton2.Size = new System.Drawing.Size(261, 35);
this.cylinderButton2.TabIndex = 288;
this.cylinderButton2.Text = "Entry_Open";
this.cylinderButton2.UseVisualStyleBackColor = false;
//
// cylinderButton1
//
this.cylinderButton1.BackColor = System.Drawing.Color.White;
this.cylinderButton1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.cylinderButton1.IO_HIGH = "Location_Cylinder_Up";
this.cylinderButton1.IO_LOW = "Location_Cylinder_Down";
this.cylinderButton1.Location = new System.Drawing.Point(550, 159);
this.cylinderButton1.Name = "cylinderButton1";
this.cylinderButton1.Size = new System.Drawing.Size(261, 35);
this.cylinderButton1.TabIndex = 288;
this.cylinderButton1.Text = "Location_Cylinder_Up";
this.cylinderButton1.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(1010, 510);
this.ioControl1.TabIndex = 0;
//
// configControl1
//
this.configControl1.Config = null;
this.configControl1.Location = new System.Drawing.Point(559, 3);
this.configControl1.Name = "configControl1";
this.configControl1.Size = new System.Drawing.Size(653, 504);
this.configControl1.TabIndex = 0;
//
// cylinderButton4
//
this.cylinderButton4.BackColor = System.Drawing.Color.White;
......@@ -321,15 +341,17 @@ namespace AutoCountMachine
this.cylinderButton5.Text = "Entry_Open";
this.cylinderButton5.UseVisualStyleBackColor = false;
//
// label_tips_scancode
// panel2
//
this.label_tips_scancode.AutoSize = true;
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.TabIndex = 294;
this.label_tips_scancode.Text = "请扫描二维码";
this.panel2.Controls.Add(this.pictureBox1);
this.panel2.Controls.Add(this.btn_getXrayimage);
this.panel2.Controls.Add(this.btn_openXray);
this.panel2.Controls.Add(this.btn_closeXray);
this.panel2.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel2.Location = new System.Drawing.Point(3, 3);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(1010, 510);
this.panel2.TabIndex = 2;
//
// XrayControl
//
......@@ -346,6 +368,8 @@ namespace AutoCountMachine
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.tabPage5.ResumeLayout(false);
this.tabPage5.PerformLayout();
this.panel1.ResumeLayout(false);
this.panel2.ResumeLayout(false);
this.ResumeLayout(false);
}
......@@ -376,5 +400,7 @@ namespace AutoCountMachine
private System.Windows.Forms.TextBox textBox_scancode;
private System.Windows.Forms.Label label_countstate;
private System.Windows.Forms.Label label_tips_scancode;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Panel panel2;
}
}
......@@ -44,6 +44,17 @@ namespace AutoCountMachine
textBox_scancode.Click += TextBox_scancode_Click;
tabPage5.GotFocus += TabPage5_GotFocus;
tabPage5.MouseDown += TabPage5_MouseDown;
RoleManger.RoleChange += RoleManger_RoleChange;
}
private void RoleManger_RoleChange(object sender, Role e)
{
tabPage2.Controls[0].Enabled = false;
tabPage4.Controls[0].Enabled = false;
if (e != Role.Admin)
return;
tabPage2.Controls[0].Enabled = true;
tabPage4.Controls[0].Enabled = true;
}
private void TextBox_scancode_Click(object sender, EventArgs e)
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!