Commit 07796b6e 刘韬

1

1 个父辈 79e944f8
此文件类型无法预览
此文件类型无法预览
...@@ -6,6 +6,7 @@ using System.ComponentModel; ...@@ -6,6 +6,7 @@ using System.ComponentModel;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using System.Windows.Forms.Layout; using System.Windows.Forms.Layout;
...@@ -179,7 +180,8 @@ namespace OnlineStore ...@@ -179,7 +180,8 @@ namespace OnlineStore
if ((strCurLanguage == null || strCurLanguage.Equals("")) && (!defaultStr.Equals(""))) if ((strCurLanguage == null || strCurLanguage.Equals("")) && (!defaultStr.Equals("")))
{ {
strCurLanguage = defaultStr; strCurLanguage = defaultStr;
NoIdLog(id, defaultStr); if (HasChinese(defaultStr))
NoIdLog(id, defaultStr);
} }
} }
catch (Exception ex) catch (Exception ex)
...@@ -220,6 +222,10 @@ namespace OnlineStore ...@@ -220,6 +222,10 @@ namespace OnlineStore
} }
} }
static bool HasChinese(string txt)
{
return Regex.IsMatch(txt.ToString(), @"[\u4E00-\u9FA5]+");
}
private static bool checkInterid(string id) { private static bool checkInterid(string id) {
return true; return true;
string[] interstring = new string[] { "_txt", "_lbl" }; string[] interstring = new string[] { "_txt", "_lbl" };
......
...@@ -105,8 +105,14 @@ namespace DeviceLibrary ...@@ -105,8 +105,14 @@ namespace DeviceLibrary
MoveInfo.WaitList.Add(WaitResultInfo.WaitAxis(Config, true)); MoveInfo.WaitList.Add(WaitResultInfo.WaitAxis(Config, true));
var HomeLowSpeed = Config.HomeLowSpeed > 0 ? Config.HomeLowSpeed : Config.HomeHighSpeed / 10; var HomeLowSpeed = Config.HomeLowSpeed > 0 ? Config.HomeLowSpeed : Config.HomeHighSpeed / 10;
var HomeAddSpeed = Config.HomeAddSpeed > 0 ? Config.HomeAddSpeed : Config.HomeHighSpeed * 5; var HomeAddSpeed = Config.HomeAddSpeed > 0 ? Config.HomeAddSpeed : Config.HomeHighSpeed * 5;
for (int i = 0; i < 3; i++)
AxisManager.HomeMove(Config.DeviceName, (short)Config.GetAxisValue(), Config.HomeHighSpeed, HomeLowSpeed, HomeAddSpeed); {
AxisManager.SuddenStop(Config);
var r=AxisManager.HomeMove(Config.DeviceName, (short)Config.GetAxisValue(), Config.HomeHighSpeed, HomeLowSpeed, HomeAddSpeed);
if (r)
break;
Thread.Sleep(100);
}
} }
/// <summary> /// <summary>
...@@ -141,7 +147,50 @@ namespace DeviceLibrary ...@@ -141,7 +147,50 @@ namespace DeviceLibrary
AxisManager.AbsMove(Config.DeviceName, Config.GetAxisValue(), targetPosition, targetSpeed, AddSpeed, DelSpeed);// Config.AddSpeed, Config.DelSpeed); AxisManager.AbsMove(Config.DeviceName, Config.GetAxisValue(), targetPosition, targetSpeed, AddSpeed, DelSpeed);// Config.AddSpeed, Config.DelSpeed);
} }
} }
public Task<bool> AbsMoveASYNC(int targetPosition, int targetSpeed,int waitsecond=5)
{
return Task.Run(new Func<bool>(()=> {
if (IsInPosition(targetPosition))
{
LogUtil.info(AxisName + $" 已在目标点:{targetPosition}");
return true;
}
if (ForceSafeCheck && !IsSafe(targetPosition, out string msg))
{
Msg.add(msg, MsgLevel.alarm);
LogUtil.info(AxisName + $" 不在安全点无法运行:{msg}");
RobotManage.UserPause(msg);
return false;
}
var AddSpeed = Config.AddSpeed > 0 ? Config.AddSpeed : targetSpeed * 4;
var DelSpeed = Config.DelSpeed > 0 ? Config.DelSpeed : targetSpeed * 4;
if (IsBusy) {
return false;
}
int retrytime = 0;
retry:
DateTime start = DateTime.Now;
AxisManager.AbsMove(Config.DeviceName, Config.GetAxisValue(), targetPosition, targetSpeed, AddSpeed, DelSpeed);// Config.AddSpeed, Config.DelSpeed);
while (!IsBusy) {
Task.Delay(100).Wait();
if ((DateTime.Now - start).TotalSeconds > waitsecond)
{
AxisManager.SuddenStop(Config);
break;
}
}
if (Math.Abs(targetPosition- GetAclPosition())>100) {
retrytime++;
if (retrytime >= 4)
return false;
LogUtil.error(AxisName+$"目标位置{targetPosition}当前位置{GetAclPosition()},误差过大,重新开始运动,第{retrytime}次");
goto retry;
}
return true;
}));
}
public void SpeedMove(int targetSpeed) public void SpeedMove(int targetSpeed)
{ {
AxisManager.SpeedMove(Config.DeviceName, Config.GetAxisValue(), targetSpeed, targetSpeed * 4, targetSpeed * 4); AxisManager.SpeedMove(Config.DeviceName, Config.GetAxisValue(), targetSpeed, targetSpeed * 4, targetSpeed * 4);
......
...@@ -49,9 +49,9 @@ namespace DeviceLibrary ...@@ -49,9 +49,9 @@ namespace DeviceLibrary
{ {
instance.RelMove(portName, slvAddr, position, targetSpeed, ptpAcc, ptpDec); instance.RelMove(portName, slvAddr, position, targetSpeed, ptpAcc, ptpDec);
} }
public static void HomeMove(string portName, short slvAddr, int highVel, int lowVel, int acc) public static bool HomeMove(string portName, short slvAddr, int highVel, int lowVel, int acc)
{ {
instance.HomeMove(portName, slvAddr, highVel, lowVel, acc); return instance.HomeMove(portName, slvAddr, highVel, lowVel, acc);
} }
public static void SpeedMove(string portName, short slvAddr, int speed,int acc,int dec) public static void SpeedMove(string portName, short slvAddr, int speed,int acc,int dec)
......
...@@ -74,9 +74,9 @@ namespace DeviceLibrary ...@@ -74,9 +74,9 @@ namespace DeviceLibrary
return (int)HCBoardManager.GetAxisPrfPos(slvAddr); return (int)HCBoardManager.GetAxisPrfPos(slvAddr);
} }
public void HomeMove(string portName, short slvAddr, int highVel, int lowVel, int acc) public bool HomeMove(string portName, short slvAddr, int highVel, int lowVel, int acc)
{ {
HCBoardManager.StartHomeMove(slvAddr,(uint) highVel, (uint)lowVel, (uint)acc); return HCBoardManager.StartHomeMove(slvAddr,(uint) highVel, (uint)lowVel, (uint)acc);
} }
public bool IsHomeMoveEnd(string portName, short slvAddr) public bool IsHomeMoveEnd(string portName, short slvAddr)
{ {
......
...@@ -24,7 +24,7 @@ namespace DeviceLibrary ...@@ -24,7 +24,7 @@ namespace DeviceLibrary
void ServoOn(string portName, short slvAddr); void ServoOn(string portName, short slvAddr);
void ServoOff(string portName, short slvAddr); void ServoOff(string portName, short slvAddr);
void RelMove(string portName, short slvAddr, int position, int targetSpeed , int ptpAcc , int ptpDec ); void RelMove(string portName, short slvAddr, int position, int targetSpeed , int ptpAcc , int ptpDec );
void HomeMove(string portName, short slvAddr, int highVel, int lowVel, int acc); bool HomeMove(string portName, short slvAddr, int highVel, int lowVel, int acc);
void SpeedMove(string portName, short slvAddr, int speed,int acc,int dec); void SpeedMove(string portName, short slvAddr, int speed,int acc,int dec);
void SuddenStop(string portName, short slvAddr); void SuddenStop(string portName, short slvAddr);
......
...@@ -70,13 +70,21 @@ namespace DeviceLibrary ...@@ -70,13 +70,21 @@ namespace DeviceLibrary
try try
{ {
if (needclamp) if (needclamp)
{ {
RobotManage.mainMachine.CylinderMove(null, IO_Type.Tin_Dock_Rotate_Release, IO_Type.Tin_Dock_Rotate_Clamp, IO_VALUE.HIGH); RobotManage.mainMachine.CylinderMove(null, IO_Type.Tin_Dock_Rotate_Release, IO_Type.Tin_Dock_Rotate_Clamp, IO_VALUE.HIGH);
while (!IOManager.IOValue(IO_Type.Tin_Dock_Rotate_Clamp).Equals(IO_VALUE.HIGH)) { while (!IOManager.IOValue(IO_Type.Tin_Dock_Rotate_Clamp).Equals(IO_VALUE.HIGH))
{
Task.Delay(100).Wait();
}
}
else {
RobotManage.mainMachine.CylinderMove(null, IO_Type.Tin_Dock_Rotate_Release, IO_Type.Tin_Dock_Rotate_Clamp, IO_VALUE.LOW);
while (!IOManager.IOValue(IO_Type.Tin_Dock_Rotate_Clamp).Equals(IO_VALUE.LOW))
{
Task.Delay(100).Wait(); Task.Delay(100).Wait();
} }
} }
var len = (int)(StrokeLength * 1.3); var len = (int)(StrokeLength * 1.6);
if (isHorizontal) if (isHorizontal)
len = len * -1; len = len * -1;
if (!axisBean.IsServeoOn) if (!axisBean.IsServeoOn)
...@@ -97,6 +105,9 @@ namespace DeviceLibrary ...@@ -97,6 +105,9 @@ namespace DeviceLibrary
Pause(); Pause();
return true; return true;
} }
if (!axisBean.IsBusy) {
axisBean.RelMove(len, (double)upspeed);
}
} }
Task.Delay(100).Wait(); Task.Delay(100).Wait();
axisBean.SuddenStop(); axisBean.SuddenStop();
...@@ -246,10 +257,14 @@ namespace DeviceLibrary ...@@ -246,10 +257,14 @@ namespace DeviceLibrary
var len = (int)(StrokeLength / 90 * degree); var len = (int)(StrokeLength / 90 * degree);
if (Math.Abs(degreeAdd + degree) > 90) if (Math.Abs(degreeAdd + degree) > 90)
{ {
RobotManage.mainMachine.CylinderMove(null, IO_Type.Tin_Dock_Rotate_Release, IO_Type.Tin_Dock_Rotate_Clamp, IO_VALUE.LOW);
while (!IOManager.IOValue(IO_Type.Tin_Dock_Rotate_Clamp).Equals(IO_VALUE.HIGH))
{
Task.Delay(30).Wait();
}
if (len > 0) if (len > 0)
{ {
TurnToEnd(true).Wait(); TurnToEnd(true).Wait();
} }
else if (len < 0) else if (len < 0)
{ {
...@@ -262,7 +277,7 @@ namespace DeviceLibrary ...@@ -262,7 +277,7 @@ namespace DeviceLibrary
Task.Delay(30).Wait(); Task.Delay(30).Wait();
} }
//moveInfo.log($"len:{len}"); //moveInfo.log($"len:{len}");
axisBean.RelMove(len * -1, (double)upspeed); axisBean.RelMove(len, (double)upspeed);
Task.Delay(50).Wait(); Task.Delay(50).Wait();
while (axisBean.IsBusy) while (axisBean.IsBusy)
{ {
......
...@@ -15,7 +15,7 @@ namespace DeviceLibrary ...@@ -15,7 +15,7 @@ namespace DeviceLibrary
string Port; string Port;
public PrinterHelper() { public PrinterHelper() {
print = new Asa.PrintLabel(Application.StartupPath + "\\Label",300); print = new Asa.PrintLabel(Application.StartupPath + "\\Label",200);
} }
......
...@@ -232,7 +232,7 @@ namespace DeviceLibrary ...@@ -232,7 +232,7 @@ namespace DeviceLibrary
} }
else if (!RobotManage.isRunning) else if (!RobotManage.isRunning)
{ {
sendmsg = "设备未启动"; sendmsg = crc.GetString("Res0059","设备未启动");
} }
lineOperation.msg = sendmsg; lineOperation.msg = sendmsg;
...@@ -652,7 +652,8 @@ namespace DeviceLibrary ...@@ -652,7 +652,8 @@ namespace DeviceLibrary
public string msg { get; set; } public string msg { get; set; }
public Dictionary<string, object> data { get; set; } //public Dictionary<string, object> data { get; set; }
public object data { get; set; }
} }
/// <summary> /// <summary>
///1=设备联机(正常就绪)(入库后,BOX恢复原始状态)(出库后,移载装置恢复原始状态), ///1=设备联机(正常就绪)(入库后,BOX恢复原始状态)(出库后,移载装置恢复原始状态),
...@@ -721,4 +722,4 @@ namespace DeviceLibrary ...@@ -721,4 +722,4 @@ namespace DeviceLibrary
InStoreError = 14, InStoreError = 14,
} }
} }
\ No newline at end of file \ No newline at end of file
...@@ -218,8 +218,15 @@ namespace DeviceLibrary ...@@ -218,8 +218,15 @@ namespace DeviceLibrary
{ {
MoveInfo.NextMoveStep(MoveStep.StoreTS29); MoveInfo.NextMoveStep(MoveStep.StoreTS29);
MoveInfo.log("LabelP=>RFIDP 直接结束"); MoveInfo.log("LabelP=>RFIDP 直接结束");
}
else if (To.posid == MainMachine.RFIDP)
{
MoveInfo.NextMoveStep(MoveStep.StoreTS29);
Z_Axis.AbsMove(MoveInfo, To.Z_Axis_P3, Config.Z_Axis_P1_speed);
MoveInfo.log($"{storeMoveType}:Z轴到达目的地低点:{To.Z_Axis_P3}");
MoveInfo.log("???=>RFIDP 升降轴直接到P3 直接结束");
} }
else else if (To.posid != MainMachine.LabelP)
{ {
var zp2 = To.Z_Axis_P3 - 205000; var zp2 = To.Z_Axis_P3 - 205000;
if (zp2 < 0) if (zp2 < 0)
......
...@@ -7,6 +7,7 @@ using System.Drawing; ...@@ -7,6 +7,7 @@ using System.Drawing;
using System.Drawing.Imaging; using System.Drawing.Imaging;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Runtime.ExceptionServices;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
...@@ -82,15 +83,15 @@ namespace DeviceLibrary ...@@ -82,15 +83,15 @@ namespace DeviceLibrary
} }
break; break;
case TestStorePointPort.上层左侧: case TestStorePointPort.上层左侧:
startindex = RobotManage.AllPositionMapNumList.IndexOf("LA1"); startindex = RobotManage.AllPositionMapNumList.IndexOf("SA1");
haslistindex = TestStorePoint(RobotManage.CameraA.GetImage(2), TestStorePointPort.上层左侧); haslistindex = TestStorePoint(RobotManage.CameraA.GetImage(2), TestStorePointPort.上层左侧);
break; break;
case TestStorePointPort.上层右侧: case TestStorePointPort.上层右侧:
startindex = RobotManage.AllPositionMapNumList.IndexOf("LA1"); startindex = RobotManage.AllPositionMapNumList.IndexOf("SA1");
haslistindex = TestStorePoint(RobotManage.CameraA.GetImage(3), TestStorePointPort.上层右侧); haslistindex = TestStorePoint(RobotManage.CameraA.GetImage(3), TestStorePointPort.上层右侧);
break; break;
case TestStorePointPort.下层左侧: case TestStorePointPort.下层左侧:
startindex = RobotManage.AllPositionMapNumList.IndexOf("LA1"); startindex = RobotManage.AllPositionMapNumList.IndexOf("SH1");
haslistindex = TestStorePoint(RobotManage.CameraA.GetImage(2), TestStorePointPort.下层左侧); haslistindex = TestStorePoint(RobotManage.CameraA.GetImage(2), TestStorePointPort.下层左侧);
break; break;
case TestStorePointPort.下层右侧: case TestStorePointPort.下层右侧:
...@@ -122,7 +123,7 @@ namespace DeviceLibrary ...@@ -122,7 +123,7 @@ namespace DeviceLibrary
return new List<string>(); return new List<string>();
} }
} }
[HandleProcessCorruptedStateExceptions]
public static List<int> TestStorePoint(Bitmap bmp, TestStorePointPort tp) public static List<int> TestStorePoint(Bitmap bmp, TestStorePointPort tp)
{ {
...@@ -137,11 +138,12 @@ namespace DeviceLibrary ...@@ -137,11 +138,12 @@ namespace DeviceLibrary
List<Point> points = CameraData[Name].ObjectPoint; List<Point> points = CameraData[Name].ObjectPoint;
if (bmp == null) if (bmp == null)
return new List<int>(points.Count); return new List<int>(points.Count);
List<int> haslist = new List<int>(); List<int> haslist = new List<int>();
var bd = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadOnly, bmp.PixelFormat); BitmapData bd=null;
try try
{ {
bd = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadOnly, bmp.PixelFormat);
for (int i = 0; i < points.Count; i++) for (int i = 0; i < points.Count; i++)
{ {
var p = points[i]; var p = points[i];
...@@ -166,27 +168,39 @@ namespace DeviceLibrary ...@@ -166,27 +168,39 @@ namespace DeviceLibrary
var s = cl.Average(cc => cc.S); var s = cl.Average(cc => cc.S);
var v = cl.Average(cc => cc.V); var v = cl.Average(cc => cc.V);
var has = s > CameraData[Name].S && h > 80 && h < 150; var has = s > CameraData[Name].S && h > 60 && h < 200;
haslist.Add(has ? 1 : 0); haslist.Add(has ? 1 : 0);
} }
} }
catch (Exception ex) catch (AccessViolationException ex)
{
LogUtil.error("TestStorePoint AccessViolationException:" + ex.ToString());
}catch (Exception ex)
{ {
LogUtil.error("TestStorePoint:" + ex.ToString()); LogUtil.error("TestStorePoint:" + ex.ToString());
} }
finally finally
{ {
bmp.UnlockBits(bd); if (bd!=null)
bmp.UnlockBits(bd);
} }
//Size pointsize = new Size(30, 30); //Size pointsize = new Size(30, 30);
SolidBrush red = new SolidBrush(Color.Red); SolidBrush red = new SolidBrush(Color.Red);
SolidBrush gray = new SolidBrush(Color.Gray); SolidBrush gray = new SolidBrush(Color.Gray);
var g = Graphics.FromImage(bmp); try
for (int i = 0; i < CameraData[Name].ObjectPoint.Count; i++) { {
g.FillEllipse(haslist[i]==1?red:gray, GetCR(CameraData[Name].ObjectPoint[i], 30)); var g = Graphics.FromImage(bmp);
for (int i = 0; i < CameraData[Name].ObjectPoint.Count; i++)
{
g.FillEllipse(haslist[i] == 1 ? red : gray, GetCR(CameraData[Name].ObjectPoint[i], 30));
}
g.Save();
bmp.Save(tp.ToString() + ".bmp");
}
catch (Exception ex)
{
LogUtil.error("TestStorePoint:" + ex.ToString());
} }
g.Save();
bmp.Save(tp.ToString() + ".bmp");
TestStorePointEvent?.Invoke(tp, bmp); TestStorePointEvent?.Invoke(tp, bmp);
return haslist; return haslist;
} }
......
...@@ -75,7 +75,7 @@ namespace DeviceLibrary ...@@ -75,7 +75,7 @@ namespace DeviceLibrary
public string Batch { get; set; } public string Batch { get; set; }
public bool ReelOnFixture { get; internal set; } = false; public bool ReelOnFixture { get; internal set; } = false;
public string OutPosID { get; internal set; } public string OutPosID { get; internal set; }
public DateTime dateTime = DateTime.Now;
public int HeightPos = 0; public int HeightPos = 0;
public ReelParam clone() public ReelParam clone()
{ {
......
...@@ -77,8 +77,9 @@ namespace DeviceLibrary ...@@ -77,8 +77,9 @@ namespace DeviceLibrary
{ {
isOk = false; isOk = false;
WarnMsg = msg; WarnMsg = msg;
Alarm(AlarmType.AxisMoveError, WarnMsg); ///Alarm(AlarmType.AxisMoveError, WarnMsg);
Msg.add(WarnMsg, MsgLevel.alarm); Msg.add(WarnMsg, MsgLevel.alarm);
RobotManage.UserPause(WarnMsg);
break; break;
} }
} }
......
...@@ -73,6 +73,7 @@ namespace DeviceLibrary ...@@ -73,6 +73,7 @@ namespace DeviceLibrary
public bool isInSuddenDown = false; public bool isInSuddenDown = false;
public List<ReelParam> NGInfoList = new List<ReelParam>();
public MainMachine(Robot_Config _config) { public MainMachine(Robot_Config _config) {
Config = _config; Config = _config;
...@@ -206,6 +207,8 @@ namespace DeviceLibrary ...@@ -206,6 +207,8 @@ namespace DeviceLibrary
boxTransport.Process(); boxTransport.Process();
if (RobotManage.InoutDebugMode) if (RobotManage.InoutDebugMode)
AutoInOutTestProcess(); AutoInOutTestProcess();
else if (DemoTestMode)
TFIDSelfTestProcess();
else else
StoreDemoProcess(); StoreDemoProcess();
...@@ -218,8 +221,9 @@ namespace DeviceLibrary ...@@ -218,8 +221,9 @@ namespace DeviceLibrary
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error("Mainprocess:" + ex);
Msg.add(ex.ToString(), MsgLevel.warning); Msg.add(ex.ToString(), MsgLevel.warning);
Msg.setlogones(); //Msg.setlogones();
} }
finally { finally {
var m = Msg.get(); var m = Msg.get();
...@@ -324,8 +328,9 @@ namespace DeviceLibrary ...@@ -324,8 +328,9 @@ namespace DeviceLibrary
ResetMoveInfo.NextMoveStep(MoveStep.H02_HomeReset_01); ResetMoveInfo.NextMoveStep(MoveStep.H02_HomeReset_01);
ResetMoveInfo.log("锁定抽屉"); ResetMoveInfo.log("锁定抽屉");
IOMove(IO_Type.Entry_Drawer_Lock, IO_VALUE.HIGH); //IOMove(IO_Type.Entry_Drawer_Lock, IO_VALUE.HIGH);
IOMove(IO_Type.Out_Drawer_Lock, IO_VALUE.HIGH); IOMove(IO_Type.Out_Drawer_Lock, IO_VALUE.HIGH);
CylinderMove(ResetMoveInfo, IO_Type.Tin_Dock_Rotate_Release, IO_Type.Tin_Dock_Rotate_Clamp, IO_VALUE.LOW);
Msg.add("", MsgLevel.info, ErrInfo.X09_Clear); Msg.add("", MsgLevel.info, ErrInfo.X09_Clear);
break; break;
case MoveStep.H02_HomeReset_01: case MoveStep.H02_HomeReset_01:
...@@ -367,8 +372,8 @@ namespace DeviceLibrary ...@@ -367,8 +372,8 @@ namespace DeviceLibrary
StoreMoveInfo.log("检测到上次正在贴标:" + Setting_Init.Runtime_Step + "," + Setting_Init.Runtime_Posid); StoreMoveInfo.log("检测到上次正在贴标:" + Setting_Init.Runtime_Step + "," + Setting_Init.Runtime_Posid);
//LabelingMoveInfo.NextMoveStep(MoveStep.Labeling01); //LabelingMoveInfo.NextMoveStep(MoveStep.Labeling01);
//StoreMoveInfo.NextMoveStep(MoveStep.StoreIn03); //StoreMoveInfo.NextMoveStep(MoveStep.StoreIn03);
Msg.add("重置前物料正在贴标,无法继续,请手动处理", MsgLevel.warning, ErrInfo.LabelInPaste); Msg.add(crc.GetString("Res0133","重置前物料正在贴标,无法继续,请手动处理"), MsgLevel.warning, ErrInfo.LabelInPaste);
RobotManage.UserPause("重置前物料正在贴标,无法继续,请手动处理"); RobotManage.UserPause(crc.GetString("Res0133","重置前物料正在贴标,无法继续,请手动处理"));
} }
} }
break; break;
...@@ -408,7 +413,7 @@ namespace DeviceLibrary ...@@ -408,7 +413,7 @@ namespace DeviceLibrary
ok = false; ok = false;
DeviceSuddenStop(); DeviceSuddenStop();
} }
Msg.add("打印机维护门未关闭" + (ok ? ignorestring : ""), MsgLevel.alarm); Msg.add(crc.GetString("Res0134","打印机维护门未关闭") + (ok ? ignorestring : ""), MsgLevel.alarm);
} }
if (IOValue(IO_Type.LeftDoor_Check).Equals(IO_VALUE.HIGH)) if (IOValue(IO_Type.LeftDoor_Check).Equals(IO_VALUE.HIGH))
{ {
...@@ -431,7 +436,7 @@ namespace DeviceLibrary ...@@ -431,7 +436,7 @@ namespace DeviceLibrary
if (IOValue(IO_Type.SafeDoor_Disable).Equals(IO_VALUE.LOW) && IOValue(IO_Type.DoorLock_Check).Equals(IO_VALUE.LOW)) if (IOValue(IO_Type.SafeDoor_Disable).Equals(IO_VALUE.LOW) && IOValue(IO_Type.DoorLock_Check).Equals(IO_VALUE.LOW))
{ {
Msg.add("防护门没有锁定", MsgLevel.warning); Msg.add(crc.GetString("Res0135","防护门没有锁定"), MsgLevel.warning);
DeviceSuddenStop(); DeviceSuddenStop();
ok = false; ok = false;
...@@ -509,7 +514,7 @@ namespace DeviceLibrary ...@@ -509,7 +514,7 @@ namespace DeviceLibrary
if (span.TotalSeconds > RobotManage.Config.AirCheckSeconds) if (span.TotalSeconds > RobotManage.Config.AirCheckSeconds)
{ {
ok = false; ok = false;
Msg.add(crc.GetString("Res0103","气压不足"), MsgLevel.warning); Msg.add(crc.GetString("Res0103","气压不足"), MsgLevel.alarm);
} }
} }
else { else {
......
...@@ -42,17 +42,17 @@ namespace DeviceLibrary ...@@ -42,17 +42,17 @@ namespace DeviceLibrary
LabelingMoveInfo.MoveParam = new ReelParam(); LabelingMoveInfo.MoveParam = new ReelParam();
break; break;
//case MoveStep.Labeling03:
// LabelingMoveInfo.NextMoveStep(MoveStep.Labeling04);
// RotateEquip.LockAndTurnDegree(-20);
// break;
case MoveStep.Labeling03: case MoveStep.Labeling03:
LabelingMoveInfo.NextMoveStep(MoveStep.Labeling04); if (RotateEquip.TurnWork==null || RotateEquip.TurnWork.IsCompleted) {
RotateEquip.LockAndTurnDegree(-20); LabelingMoveInfo.NextMoveStep(MoveStep.Labeling04);
break;
case MoveStep.Labeling04:
if (RotateEquip.TurnWork.IsCompleted) {
LabelingMoveInfo.NextMoveStep(MoveStep.Labeling04a);
TakePicture(); TakePicture();
} }
break; break;
case MoveStep.Labeling04a: case MoveStep.Labeling04:
if (IsTackPictureFinish) if (IsTackPictureFinish)
{ {
if (TakePictureTask.Result) if (TakePictureTask.Result)
...@@ -62,7 +62,7 @@ namespace DeviceLibrary ...@@ -62,7 +62,7 @@ namespace DeviceLibrary
ScanCode(); ScanCode();
} }
else { else {
LabelingMoveInfo.NextMoveStep(MoveStep.Labeling04); LabelingMoveInfo.NextMoveStep(MoveStep.Labeling03);
LabelingMoveInfo.log("拍照失败,重试"); LabelingMoveInfo.log("拍照失败,重试");
} }
} }
...@@ -76,8 +76,7 @@ namespace DeviceLibrary ...@@ -76,8 +76,7 @@ namespace DeviceLibrary
CodeList.AddRange(xx); CodeList.AddRange(xx);
if (HasRightCode(CodeList.ToArray(), LabelingMoveInfo.MoveParam)) if (HasRightCode(CodeList.ToArray(), LabelingMoveInfo.MoveParam))
{ {
LabelingMoveInfo.MoveParam.IsNg = false; LabelingMoveInfo.MoveParam.IsNg = false;
LabelingMoveInfo.NextMoveStep(MoveStep.Labeling06); LabelingMoveInfo.NextMoveStep(MoveStep.Labeling06);
LabelingMoveInfo.MoveParam.PlateH = 50; LabelingMoveInfo.MoveParam.PlateH = 50;
...@@ -93,20 +92,20 @@ namespace DeviceLibrary ...@@ -93,20 +92,20 @@ namespace DeviceLibrary
ScanTimes++; ScanTimes++;
if (ScanTimes >= 18*2) if (ScanTimes >= 18*2)
{ {
LabelingMoveInfo.NextMoveStep(MoveStep.Labeling06); LabelingMoveInfo.NextMoveStep(MoveStep.Labeling08);
LabelingMoveInfo.log($"未识别到有效二维码,送到NG口"); LabelingMoveInfo.log($"未识别到有效二维码,送到NG口");
LabelingMoveInfo.MoveParam.IsNg = true; LabelingMoveInfo.MoveParam.IsNg = true;
LabelingMoveInfo.MoveParam.NgMsg = crc.GetString(L.not_detect_reel_code, "未识别到有效二维码"); LabelingMoveInfo.MoveParam.NgMsg = crc.GetString(L.not_detect_reel_code, "未识别到有效二维码");
} }
else { else {
LabelingMoveInfo.NextMoveStep(MoveStep.Labeling04); LabelingMoveInfo.NextMoveStep(MoveStep.Labeling03);
LabelingMoveInfo.log("继续扫码"); LabelingMoveInfo.log("继续扫码");
} }
} }
break; break;
case MoveStep.Labeling06: case MoveStep.Labeling06:
LabelingMoveInfo.NextMoveStep(MoveStep.Labeling07); LabelingMoveInfo.NextMoveStep(MoveStep.Labeling07);
RotateEquip.TurnDegree(-45); RotateEquip.TurnDegree(-75);
//LabelingMoveInfo.log("滚动锡膏"); //LabelingMoveInfo.log("滚动锡膏");
break; break;
case MoveStep.Labeling07: case MoveStep.Labeling07:
...@@ -124,7 +123,7 @@ namespace DeviceLibrary ...@@ -124,7 +123,7 @@ namespace DeviceLibrary
LabelingMoveInfo.log("未找到绿色区域"); LabelingMoveInfo.log("未找到绿色区域");
LabelingMoveInfo.NextMoveStep(MoveStep.Labeling08); LabelingMoveInfo.NextMoveStep(MoveStep.Labeling08);
LabelingMoveInfo.MoveParam.IsNg = true; LabelingMoveInfo.MoveParam.IsNg = true;
LabelingMoveInfo.MoveParam.NgMsg = "未找到绿色区域"; LabelingMoveInfo.MoveParam.NgMsg = crc.GetString("Res0136","未找到绿色区域");
ServerCM.cancelPutInTask("",LabelingMoveInfo.MoveParam.WareCode); ServerCM.cancelPutInTask("",LabelingMoveInfo.MoveParam.WareCode);
}//else }//else
//LabelingMoveInfo.log("本次未找到绿色区域,转动后再次查找,"+ ScanTimes); //LabelingMoveInfo.log("本次未找到绿色区域,转动后再次查找,"+ ScanTimes);
...@@ -241,6 +240,9 @@ namespace DeviceLibrary ...@@ -241,6 +240,9 @@ namespace DeviceLibrary
Setting_Init.Runtime_Step = Runtime_StepE.LabelPasteFinish; Setting_Init.Runtime_Step = Runtime_StepE.LabelPasteFinish;
LabelingMoveInfo.log("贴标完成"); LabelingMoveInfo.log("贴标完成");
RotateEquip.TurnToEnd(false); RotateEquip.TurnToEnd(false);
if (LabelingMoveInfo.MoveParam.IsNg)
Setting_Init.Runtime_Posid = "NG";
} }
break; break;
case MoveStep.Labeling57: case MoveStep.Labeling57:
......
...@@ -15,6 +15,7 @@ namespace DeviceLibrary ...@@ -15,6 +15,7 @@ namespace DeviceLibrary
{ {
partial class MainMachine partial class MainMachine
{ {
public bool DemoTestMode = false;
List<string> DemoTestList; List<string> DemoTestList;
int DemoTestIndex = 0; int DemoTestIndex = 0;
int DemoTestCount = 0; int DemoTestCount = 0;
...@@ -28,7 +29,11 @@ namespace DeviceLibrary ...@@ -28,7 +29,11 @@ namespace DeviceLibrary
case MoveStep.Wait: case MoveStep.Wait:
break; break;
case MoveStep.StoreIn01: case MoveStep.StoreIn01:
DemoTestList = CameraPointTest.GetThingStoreName(TestStorePointPort.上层左侧); StoreMoveInfo.NextMoveStep(MoveStep.StoreOut10);
if (IOManager.IOValue(IO_Type.Tside_Right).Equals(IO_VALUE.HIGH))
DemoTestList = CameraPointTest.GetThingStoreName(TestStorePointPort.上层右侧);
else
DemoTestList = CameraPointTest.GetThingStoreName(TestStorePointPort.上层左侧);
if (DemoTestList.Count == 0) if (DemoTestList.Count == 0)
return; return;
...@@ -46,7 +51,7 @@ namespace DeviceLibrary ...@@ -46,7 +51,7 @@ namespace DeviceLibrary
} }
else if (IOValue(IO_Type.Out_Drawer).Equals(IO_VALUE.LOW)) else if (IOValue(IO_Type.Out_Drawer).Equals(IO_VALUE.LOW))
{ {
Msg.add("出库任务正在执行,请关好抽屉", MsgLevel.warning); Msg.add(crc.GetString("Res0137","出库任务正在执行,请关好抽屉"), MsgLevel.warning);
} }
else { else {
IOMove(IO_Type.Out_Drawer_Lock, IO_VALUE.HIGH); IOMove(IO_Type.Out_Drawer_Lock, IO_VALUE.HIGH);
...@@ -56,7 +61,8 @@ namespace DeviceLibrary ...@@ -56,7 +61,8 @@ namespace DeviceLibrary
StoreMoveInfo.NextMoveStep(MoveStep.StoreOut12); StoreMoveInfo.NextMoveStep(MoveStep.StoreOut12);
var from = CSVPositionReader<ACStorePosition>.GetPositon(DemoTestList[DemoTestIndex]); var from = CSVPositionReader<ACStorePosition>.GetPositon(DemoTestList[DemoTestIndex]);
var to = CSVPositionReader<ACStorePosition>.GetPositon(RFIDP); var to = CSVPositionReader<ACStorePosition>.GetPositon(RFIDP);
boxTransport.Start(new BoxStorePosition(Config, from, StoreMoveInfo.MoveParam), new BoxStorePosition(Config, to, StoreMoveInfo.MoveParam), StoreMoveType.OutStore, true); StoreMoveInfo.MoveParam.ReelOnFixture = false;
boxTransport.Start(new BoxStorePosition(Config, from, StoreMoveInfo.MoveParam), new BoxStorePosition(Config, to, StoreMoveInfo.MoveParam), StoreMoveType.OutStore, true);
StoreMoveInfo.log($"开始转运出库"); StoreMoveInfo.log($"开始转运出库");
break; break;
case MoveStep.StoreOut12: case MoveStep.StoreOut12:
...@@ -71,7 +77,7 @@ namespace DeviceLibrary ...@@ -71,7 +77,7 @@ namespace DeviceLibrary
if (data[0] != 0xFF) if (data[0] != 0xFF)
{ {
ds = Encoding.ASCII.GetString(data).Trim(); ds = Encoding.ASCII.GetString(data).Trim();
if (StoreMoveInfo.MoveParam.WareCode.IndexOf(ds)>-1) //if (StoreMoveInfo.MoveParam.WareCode.IndexOf(ds)>-1)
{ {
StoreMoveInfo.MoveParam.RFID = ds; StoreMoveInfo.MoveParam.RFID = ds;
StoreMoveInfo.log("读取到 RFID:" + ds + " , "+ RobotManage.RFID.HexBuff(data)); StoreMoveInfo.log("读取到 RFID:" + ds + " , "+ RobotManage.RFID.HexBuff(data));
......
...@@ -115,7 +115,6 @@ namespace DeviceLibrary ...@@ -115,7 +115,6 @@ namespace DeviceLibrary
Labeling02, Labeling02,
Labeling03, Labeling03,
Labeling04, Labeling04,
Labeling04a,
Labeling05, Labeling05,
Labeling06, Labeling06,
Labeling07, Labeling07,
......
...@@ -129,8 +129,8 @@ namespace DeviceLibrary ...@@ -129,8 +129,8 @@ namespace DeviceLibrary
} }
CodeManager.LoadConfig(); CodeManager.LoadConfig();
CodeManager.CameraScan(CodeManager.hikNameList); CodeManager.CameraScan(CodeManager.hikNameList);
mainMachine = new MainMachine(RobotManage.Config);
//mainMachine.ScanCode(); //mainMachine.ScanCode();
//Thread.Sleep(5000); //Thread.Sleep(5000);
if (!IOManager.ConnectionIOList(new List<string>())) if (!IOManager.ConnectionIOList(new List<string>()))
...@@ -148,7 +148,7 @@ namespace DeviceLibrary ...@@ -148,7 +148,7 @@ namespace DeviceLibrary
{ {
CameraA.Open(); CameraA.Open();
} }
mainMachine = new MainMachine(RobotManage.Config);
if (!dauxiKS107.OpenPort(Setting_Init.Device_DauxiKS107_Port, out _)) { if (!dauxiKS107.OpenPort(Setting_Init.Device_DauxiKS107_Port, out _)) {
IsLoadOk = false; IsLoadOk = false;
msg += crc.GetString("Res0119","液位传感器初始化失败,端口:") + $"{Setting_Init.Device_DauxiKS107_Port}\n"; msg += crc.GetString("Res0119","液位传感器初始化失败,端口:") + $"{Setting_Init.Device_DauxiKS107_Port}\n";
...@@ -168,7 +168,7 @@ namespace DeviceLibrary ...@@ -168,7 +168,7 @@ namespace DeviceLibrary
if (!RFID.IsConn) if (!RFID.IsConn)
{ {
IsLoadOk = false; IsLoadOk = false;
msg += "RFID连接失败,IP:" + $"{Setting_Init.Device_RFID_IP}\n"; msg += crc.GetString("Res0142","RFID连接失败,IP:") + $"{Setting_Init.Device_RFID_IP}\n";
} }
else else
LogUtil.info("RFID连接成功,IP:"+ Setting_Init.Device_RFID_IP); LogUtil.info("RFID连接成功,IP:"+ Setting_Init.Device_RFID_IP);
......
此文件的差异太大,无法显示。
...@@ -127,6 +127,31 @@ namespace TheMachine ...@@ -127,6 +127,31 @@ namespace TheMachine
stateView.ColumnWidthChanging += listView_ColumnWidthChanging; stateView.ColumnWidthChanging += listView_ColumnWidthChanging;
#endregion #endregion
#region 状态信息ngview初始化
NgInfoView.View = View.Details;
ColumnHeader n1 = new ColumnHeader();
n1.Text = "";
n1.Width = 0;
ColumnHeader n2 = new ColumnHeader();
n2.Text = crc.GetString("Res0002","时间");
n2.Width = 120;
ColumnHeader n3 = new ColumnHeader();
n3.Text = "SerialNumber";
n3.Width = 120;
ColumnHeader n4 = new ColumnHeader();
n4.Text = crc.GetString("Res0145","放置库位");
n4.Width = 120;
ColumnHeader n5 = new ColumnHeader();
n5.Text = crc.GetString("Res0146","NG原因");
n5.Width = 370;
NgInfoView.Columns.Add(n1);
NgInfoView.Columns.Add(n2);
NgInfoView.Columns.Add(n3);
NgInfoView.Columns.Add(n4);
NgInfoView.Columns.Add(n5);
NgInfoView.ColumnWidthChanging += listView_ColumnWidthChanging;
#endregion
LogUtil.info("开始初始化"); LogUtil.info("开始初始化");
cb_EnableBuzzer.Checked = Setting_Init.Device_EnableBuzzer; cb_EnableBuzzer.Checked = Setting_Init.Device_EnableBuzzer;
AlarmBuzzer.BuzzerStateChange += AlarmBuzzer_BuzzerStateChange; AlarmBuzzer.BuzzerStateChange += AlarmBuzzer_BuzzerStateChange;
...@@ -221,6 +246,12 @@ namespace TheMachine ...@@ -221,6 +246,12 @@ namespace TheMachine
stateView.Items.Add(lvi); stateView.Items.Add(lvi);
} }
//NgInfoView.Items.Clear();
//foreach (var moveInfo in RobotManage.mainMachine.NGInfoList)
//{
// ListViewItem lvi = new ListViewItem(new string[] { "", moveInfo.dateTime.ToString("hh:mm:ss"), moveInfo.ReeID, moveInfo.PosID, moveInfo.NgMsg });
// NgInfoView.Items.Add(lvi);
//}
this.ResumeLayout(true); this.ResumeLayout(true);
} }
...@@ -266,7 +297,7 @@ namespace TheMachine ...@@ -266,7 +297,7 @@ namespace TheMachine
addTablePage(); addTablePage();
RobotManage.LoadDebug(); RobotManage.LoadDebug();
//cb_IgnoreGratingSignal.Visible = true; //cb_IgnoreGratingSignal.Visible = true;
cb_IgnoreSafecheck.Visible = true; //cb_IgnoreSafecheck.Visible = true;
} }
else else
{ {
...@@ -399,7 +430,7 @@ namespace TheMachine ...@@ -399,7 +430,7 @@ namespace TheMachine
} }
else if (msg.errInfo == ErrInfo.LabelInPaste) else if (msg.errInfo == ErrInfo.LabelInPaste)
{ {
if (FrmAlarm.ShowAlarmDialog("贴标区内可能有物料未完成贴标,请手动取出") == DialogResult.OK) if (FrmAlarm.ShowAlarmDialog(crc.GetString("Res0143","贴标区内可能有物料未完成贴标,请手动取出")) == DialogResult.OK)
{ {
LogUtil.info("用户确认已处理"); LogUtil.info("用户确认已处理");
Setting_Init.Runtime_Step = Runtime_StepE.None; Setting_Init.Runtime_Step = Runtime_StepE.None;
...@@ -630,6 +661,10 @@ namespace TheMachine ...@@ -630,6 +661,10 @@ namespace TheMachine
stateView.Columns[2].Text = crc.GetString("Res0004","步骤"); stateView.Columns[2].Text = crc.GetString("Res0004","步骤");
stateView.Columns[3].Text = crc.GetString("Res0001","信息"); stateView.Columns[3].Text = crc.GetString("Res0001","信息");
NgInfoView.Columns[1].Text = crc.GetString("Res0002","时间");
NgInfoView.Columns[3].Text = crc.GetString("Res0145","放置库位");
NgInfoView.Columns[4].Text = crc.GetString("Res0146","NG原因");
启用调试模式ToolStripMenuItem.Text = !RobotManage.IsConfigMode ? crc.GetString("Res0012","启用配置模式") : crc.GetString("Res0013","停用配置模式"); 启用调试模式ToolStripMenuItem.Text = !RobotManage.IsConfigMode ? crc.GetString("Res0012","启用配置模式") : crc.GetString("Res0013","停用配置模式");
btn_run.Text = crc.GetString("Res0017","启动"); btn_run.Text = crc.GetString("Res0017","启动");
...@@ -719,5 +754,15 @@ namespace TheMachine ...@@ -719,5 +754,15 @@ namespace TheMachine
IOManager.IOMove(IO_Type.PrinterDoor_Lock, IO_VALUE.LOW); IOManager.IOMove(IO_Type.PrinterDoor_Lock, IO_VALUE.LOW);
RobotManage.mainMachine.PrintDoorOpen = true; RobotManage.mainMachine.PrintDoorOpen = true;
} }
private void cb_cycledemo_CheckedChanged(object sender, EventArgs e)
{
RobotManage.mainMachine.DemoTestMode = cb_cycledemo.Checked;
if (cb_cycledemo.Checked && RobotManage.mainMachine.StoreMoveInfo.MoveStep == MoveStep.Wait)
RobotManage.mainMachine.StoreMoveInfo.NextMoveStep(MoveStep.StoreIn01);
else if (!cb_cycledemo.Checked)
RobotManage.mainMachine.StoreMoveInfo.NextMoveStep(MoveStep.Wait);
}
} }
} }
\ No newline at end of file \ No newline at end of file
using DeviceLibrary; using DeviceLibrary;
using OnlineStore; using OnlineStore;
using OnlineStore.Common; using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary; using OnlineStore.LoadCSVLibrary;
...@@ -110,9 +110,9 @@ namespace TheMachine ...@@ -110,9 +110,9 @@ namespace TheMachine
var result = RobotManage.RFID.WriteEPC(Encoding.ASCII.GetBytes(epc)); var result = RobotManage.RFID.WriteEPC(Encoding.ASCII.GetBytes(epc));
if (result) if (result)
{ {
MessageBox.Show("写入成功"); MessageBox.Show(crc.GetString("Res0144","写入成功"));
return; return;
} }
} }
} }
} }
\ No newline at end of file \ No newline at end of file
...@@ -51,6 +51,7 @@ namespace TheMachine.UC ...@@ -51,6 +51,7 @@ namespace TheMachine.UC
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(537, 234); this.tableLayoutPanel1.Size = new System.Drawing.Size(537, 234);
this.tableLayoutPanel1.TabIndex = 0; this.tableLayoutPanel1.TabIndex = 0;
this.tableLayoutPanel1.Tag = "not";
// //
// button_reset // button_reset
// //
......
...@@ -21,12 +21,14 @@ namespace TheMachine.UC ...@@ -21,12 +21,14 @@ namespace TheMachine.UC
InitializeComponent(); InitializeComponent();
this.Tag = "not"; this.Tag = "not";
crc.LanguageChangeEvent += Crc_LanguageChangeEvent; crc.LanguageChangeEvent += Crc_LanguageChangeEvent;
crc.LanguageProcess(this);
} }
private void Crc_LanguageChangeEvent(object sender, EventArgs e) private void Crc_LanguageChangeEvent(object sender, EventArgs e)
{ {
if (Config == null) if (Config == null)
return; return;
LoadLedList(); LoadLedList();
crc.LanguageProcess(this);
} }
private DeviceConfig _Config; private DeviceConfig _Config;
public DeviceConfig Config public DeviceConfig Config
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!