Commit e57b9fab 刘韬

增加取标贴标吹气

1 个父辈 d0fcb671
using log4net; using ConfigHelper;
using log4net;
using OnlineStore.Common; using OnlineStore.Common;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
...@@ -13,6 +14,29 @@ using System.Windows.Forms.Layout; ...@@ -13,6 +14,29 @@ using System.Windows.Forms.Layout;
namespace OnlineStore namespace OnlineStore
{ {
public class CrcObject {
public string msg;
public string key;
public CrcObject(string key, string msg)
{
this.key = key;
this.msg = msg;
}
public override string ToString()
{
return msg.ToString();
}
public static implicit operator string(CrcObject m1)
{
if (m1 == null)
return null;
return m1.msg;
}
}
public class crc : CodeResourceControl public class crc : CodeResourceControl
{ {
...@@ -166,12 +190,12 @@ namespace OnlineStore ...@@ -166,12 +190,12 @@ namespace OnlineStore
{ {
return GetString(id.ToString(), defaultStr); return GetString(id.ToString(), defaultStr);
} }
public static string GetString(string id, string defaultStr) public static CrcObject GetString(string id, string defaultStr)
{ {
string strCurLanguage = defaultStr; string strCurLanguage = defaultStr;
var haslang = getLangRes(CurrLanguage); var haslang = getLangRes(CurrLanguage);
if (!haslang) { if (!haslang) {
return strCurLanguage; return new CrcObject(id, strCurLanguage);
} }
try try
{ {
...@@ -200,7 +224,7 @@ namespace OnlineStore ...@@ -200,7 +224,7 @@ namespace OnlineStore
{ {
strCurLanguage = ""; strCurLanguage = "";
} }
return strCurLanguage; return new CrcObject(id, strCurLanguage);
} }
public static string GetString(string id, string defaultStr, params object[] param) public static string GetString(string id, string defaultStr, params object[] param)
{ {
...@@ -314,7 +338,7 @@ namespace OnlineStore ...@@ -314,7 +338,7 @@ namespace OnlineStore
var newStr = GetString(GetTextIdStr(className, con.Name), txt); var newStr = GetString(GetTextIdStr(className, con.Name), txt);
if (!newStr.Equals("")) if (!newStr.Equals(""))
{ {
Con_SetTxt(con, newStr.Replace("\\n", "\n")); Con_SetTxt(con, newStr.ToString().Replace("\\n", "\n"));
//haslang = true; //haslang = true;
} }
} }
......
...@@ -35,6 +35,8 @@ namespace OnlineStore.Common ...@@ -35,6 +35,8 @@ namespace OnlineStore.Common
public static MyConfig<string> Device_DauxiKS107_Port = "COM3"; public static MyConfig<string> Device_DauxiKS107_Port = "COM3";
[MyConfigComment("RFID IP")] [MyConfigComment("RFID IP")]
public static MyConfig<string> Device_RFID_IP = "192.168.110.21"; public static MyConfig<string> Device_RFID_IP = "192.168.110.21";
[MyConfigComment("RFID IP2")]
public static MyConfig<string> Device_RFID_IP2 = "192.168.110.21";
[MyConfigComment("是否启用校准库位")] [MyConfigComment("是否启用校准库位")]
public static MyConfig<bool> Device_Use_Fixpos = false; public static MyConfig<bool> Device_Use_Fixpos = false;
[MyConfigComment("屏蔽日志窗口")] [MyConfigComment("屏蔽日志窗口")]
......
...@@ -291,6 +291,8 @@ namespace OnlineStore.Common ...@@ -291,6 +291,8 @@ namespace OnlineStore.Common
public static string disable = "disable"; public static string disable = "disable";
public static string queueTaskCount="queueTaskCount"; public static string queueTaskCount="queueTaskCount";
public static string selfAudit = "selfAudit";
public static string selfAuditException = "selfAuditException";
public static string inDoorStatus= "inDoorStatus"; public static string inDoorStatus= "inDoorStatus";
public static string outDoorStatus= "outDoorStatus"; public static string outDoorStatus= "outDoorStatus";
public static string open= "open"; public static string open= "open";
......
...@@ -107,7 +107,7 @@ ...@@ -107,7 +107,7 @@
<Compile Include="theMachine\MainMachine _AutoInOutTest.cs" /> <Compile Include="theMachine\MainMachine _AutoInOutTest.cs" />
<Compile Include="theMachine\MainMachine_Labeling.cs" /> <Compile Include="theMachine\MainMachine_Labeling.cs" />
<Compile Include="theMachine\MainMachine_RFIDSelftest.cs" /> <Compile Include="theMachine\MainMachine_RFIDSelftest.cs" />
<Compile Include="theMachine\MainMachine_StoreDemo.cs" /> <Compile Include="theMachine\MainMachine_Store.cs" />
<Compile Include="theMachine\MainMachine _IOMonitor.cs" /> <Compile Include="theMachine\MainMachine _IOMonitor.cs" />
<Compile Include="theMachine\MainMachine _LedProcess.cs" /> <Compile Include="theMachine\MainMachine _LedProcess.cs" />
<Compile Include="theMachine\MainMachine.cs" /> <Compile Include="theMachine\MainMachine.cs" />
......
using OnlineStore.Common; using OnlineStore;
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary; using OnlineStore.LoadCSVLibrary;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
...@@ -36,6 +37,9 @@ namespace DeviceLibrary ...@@ -36,6 +37,9 @@ namespace DeviceLibrary
Msg = ""; Msg = "";
string portName = Config.DeviceName; string portName = Config.DeviceName;
short slvAddr = Config.GetAxisValue(); short slvAddr = Config.GetAxisValue();
if (AxisManager.IsServeoOn(portName, slvAddr)) {
return true;
}
AxisManager.AlarmClear(portName, slvAddr); AxisManager.AlarmClear(portName, slvAddr);
Thread.Sleep(50); Thread.Sleep(50);
AxisManager.ServoOn(portName, slvAddr); AxisManager.ServoOn(portName, slvAddr);
...@@ -79,7 +83,7 @@ namespace DeviceLibrary ...@@ -79,7 +83,7 @@ namespace DeviceLibrary
else else
{ {
AxisManager.ServoOff(portName, slvAddr); AxisManager.ServoOff(portName, slvAddr);
msg = "打开轴" + Config.Explain + "失败 "; msg = crc.GetString("Res0158.2bf5c941","打开轴") + Config.Explain + crc.GetString("Res0159.33d2a704","失败 ");
LogUtil.info(AxisName + msg); LogUtil.info(AxisName + msg);
return false; return false;
} }
...@@ -128,7 +132,7 @@ namespace DeviceLibrary ...@@ -128,7 +132,7 @@ namespace DeviceLibrary
if (ForceSafeCheck && !IsSafe(targetPosition,out string msg)) if (ForceSafeCheck && !IsSafe(targetPosition,out string msg))
{ {
Msg.add(msg, MsgLevel.alarm); Msg.add(Config.ProName,msg, MsgLevel.alarm);
RobotManage.UserPause(msg); RobotManage.UserPause(msg);
return; return;
} }
...@@ -158,7 +162,7 @@ namespace DeviceLibrary ...@@ -158,7 +162,7 @@ namespace DeviceLibrary
if (ForceSafeCheck && !IsSafe(targetPosition, out string msg)) if (ForceSafeCheck && !IsSafe(targetPosition, out string msg))
{ {
Msg.add(msg, MsgLevel.alarm); Msg.add(Config.ProName, msg, MsgLevel.alarm);
LogUtil.info(AxisName + $" 不在安全点无法运行:{msg}"); LogUtil.info(AxisName + $" 不在安全点无法运行:{msg}");
RobotManage.UserPause(msg); RobotManage.UserPause(msg);
return false; return false;
...@@ -224,7 +228,7 @@ namespace DeviceLibrary ...@@ -224,7 +228,7 @@ namespace DeviceLibrary
int isAlarm = AxisManager.GetAlarmStatus(deviceName, axisNo); int isAlarm = AxisManager.GetAlarmStatus(deviceName, axisNo);
if (isAlarm.Equals(1)) if (isAlarm.Equals(1))
{ {
clearMsg = "清理报警,"; clearMsg = crc.GetString("Res0160.cbd5d752","清理报警,");
AxisManager.AlarmClear(deviceName, axisNo); AxisManager.AlarmClear(deviceName, axisNo);
Thread.Sleep(200); Thread.Sleep(200);
AxisManager.ServoOn(deviceName, axisNo); AxisManager.ServoOn(deviceName, axisNo);
...@@ -273,7 +277,7 @@ namespace DeviceLibrary ...@@ -273,7 +277,7 @@ namespace DeviceLibrary
} }
else else
{ {
msg = MoveInfo.Name + " " + MoveInfo.MoveStep + axis.DisplayStr + ",收到原点完成信号,当前位置[" + outCount + "],误差过大,需要报警"; msg = MoveInfo.Name + " " + MoveInfo.MoveStep + axis.DisplayStr + crc.GetString("Res0161.405c5a9e",",收到原点完成信号,当前位置[") + outCount + crc.GetString("Res0162.6658614e","],误差过大,需要报警");
LogUtil.error(msg); LogUtil.error(msg);
} }
} }
......
using OnlineStore.Common; using OnlineStore;
using OnlineStore.Common;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.IO.Ports; using System.IO.Ports;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
...@@ -17,13 +19,12 @@ public class DauxiKS107Controller ...@@ -17,13 +19,12 @@ public class DauxiKS107Controller
private SerialPort _serialPort = null; private SerialPort _serialPort = null;
string comPortName; string comPortName;
System.Timers.Timer timer; System.Timers.Timer timer;
public bool IsAlarm; public int Distance;
public DauxiKS107Controller() public DauxiKS107Controller()
{ {
timer = new System.Timers.Timer(5*60*1000); timer = new System.Timers.Timer(5*1000);
timer.Elapsed += Timer_Elapsed; timer.Elapsed += Timer_Elapsed;
timer.AutoReset = true; timer.AutoReset = true;
IsAlarm = false;
} }
~DauxiKS107Controller() { ~DauxiKS107Controller() {
LogUtil.info($"液位传感器退出"); LogUtil.info($"液位传感器退出");
...@@ -34,11 +35,29 @@ public class DauxiKS107Controller ...@@ -34,11 +35,29 @@ public class DauxiKS107Controller
} }
private void Timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) private void Timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{ {
Quary(out int value, out string errmsg); bool readok = true;
LogUtil.info($"读取到液位:{value}mm,err:{errmsg}"); for (int i = 0; i < 5; i++)
{
if (Quary(out int value, out string errmsg))
{
Debug.WriteLine($"读取到液位:{value}mm,err:{errmsg}");
readok = true;
if (value > 0) if (value > 0)
{ {
IsAlarm = value < 180; Distance = value;
return;
}
}
else {
readok = false;
}
}
if (!readok)
{
LogUtil.info($"液位传感器读取失败,重新打开");
if (!OpenPort(comPortName, out string errmsg)) {
LogUtil.info($"液位传感器打开失败:"+ errmsg);
}
} }
} }
...@@ -50,14 +69,19 @@ public class DauxiKS107Controller ...@@ -50,14 +69,19 @@ public class DauxiKS107Controller
{ {
comPortName = _comport; comPortName = _comport;
//如果串口是打开的,先关闭
if (_serialPort == null)
{
_serialPort = new SerialPort(comPortName, baudRate, parity, dataBits, stopBits); _serialPort = new SerialPort(comPortName, baudRate, parity, dataBits, stopBits);
_serialPort.RtsEnable = true; //自动请求 _serialPort.RtsEnable = true; //自动请求
_serialPort.ReadTimeout = 100;//超时 _serialPort.ReadTimeout = 100;//超时
errmsg = ""; }
bool ok = false;
//如果串口是打开的,先关闭
if (_serialPort.IsOpen) if (_serialPort.IsOpen)
_serialPort.Close(); _serialPort.Close();
errmsg = "";
bool ok = false;
try try
{ {
//打开串口 //打开串口
...@@ -84,7 +108,7 @@ public class DauxiKS107Controller ...@@ -84,7 +108,7 @@ public class DauxiKS107Controller
static byte[] quarycommand = new byte[] { 0xe8, 0x02, 0xb0 }; static byte[] quarycommand = new byte[] { 0xe8, 0x02, 0xb0 };
public bool Quary(out int value, out string errmsg) { public bool Quary(out int value, out string errmsg) {
errmsg = ""; errmsg = "";
byte[] buf = new byte[50]; byte[] buf = new byte[8];
value = 0; value = 0;
try try
{ {
...@@ -98,6 +122,7 @@ public class DauxiKS107Controller ...@@ -98,6 +122,7 @@ public class DauxiKS107Controller
} }
else else
{ {
errmsg = crc.GetString("Res0170.6832e9a0","返回数据不正确:")+BitConverter.ToString(buf);
return false; return false;
} }
} }
...@@ -108,4 +133,3 @@ public class DauxiKS107Controller ...@@ -108,4 +133,3 @@ public class DauxiKS107Controller
return true; return true;
} }
} }
...@@ -32,6 +32,7 @@ namespace DeviceLibrary ...@@ -32,6 +32,7 @@ namespace DeviceLibrary
upspeed = _upspeed; upspeed = _upspeed;
StrokeLength = _StrokeLength; StrokeLength = _StrokeLength;
SafetyDevice.AddDevice(this); SafetyDevice.AddDevice(this);
TurnWork = Task.Run(() => { });
} }
public bool isAtTOP public bool isAtTOP
{ {
......
...@@ -32,7 +32,8 @@ namespace DeviceLibrary ...@@ -32,7 +32,8 @@ namespace DeviceLibrary
string WarnMsg = ""; string WarnMsg = "";
private System.Timers.Timer serverConnectTimer = new System.Timers.Timer(); private System.Timers.Timer serverConnectTimer = new System.Timers.Timer();
public bool selfAudit = false;
public bool selfAuditException = false;
object serverclock = new object(); object serverclock = new object();
public ServerCommunication() public ServerCommunication()
{ {
...@@ -347,7 +348,20 @@ namespace DeviceLibrary ...@@ -347,7 +348,20 @@ namespace DeviceLibrary
queueTaskCount = -1; queueTaskCount = -1;
} }
} }
if (dataMap.ContainsKey(ParamDefine.selfAudit))
{
if (!string.IsNullOrEmpty(dataMap[ParamDefine.selfAudit].ToString()))
selfAudit = true;
}
else
selfAudit = false;
if (dataMap.ContainsKey(ParamDefine.selfAuditException))
{
if (dataMap[ParamDefine.selfAuditException].ToString()=="true")
selfAuditException = true;
}
else
selfAuditException = false;
if (dataMap.ContainsKey(ParamDefine.openInLock) && dataMap[ParamDefine.openInLock].Equals(ParamDefine.doit)) if (dataMap.ContainsKey(ParamDefine.openInLock) && dataMap[ParamDefine.openInLock].Equals(ParamDefine.doit))
{ {
...@@ -359,11 +373,19 @@ namespace DeviceLibrary ...@@ -359,11 +373,19 @@ namespace DeviceLibrary
{ {
LogUtil.info(StoreName + "收到服务器命令:closeInLock=doit"); LogUtil.info(StoreName + "收到服务器命令:closeInLock=doit");
IOManager.IOMove(IO_Type.Entry_Drawer_Lock, IO_VALUE.HIGH); IOManager.IOMove(IO_Type.Entry_Drawer_Lock, IO_VALUE.HIGH);
if (!selfAuditException)
{
RobotManage.mainMachine.newDrawer = false;
RobotManage.mainMachine.NGInfoList = new List<ReelParam>(); RobotManage.mainMachine.NGInfoList = new List<ReelParam>();
Setting_Init.Runtime_NGINFOLIST = JsonConvert.SerializeObject(RobotManage.mainMachine.NGInfoList); Setting_Init.Runtime_NGINFOLIST = JsonConvert.SerializeObject(RobotManage.mainMachine.NGInfoList);
RobotManage.mainMachine.StoreMoveInfo.NewMove(MoveStep.StoreIn01); RobotManage.mainMachine.StoreMoveInfo.NewMove(MoveStep.StoreIn01);
RobotManage.mainMachine.StoreMoveInfo.log(StoreName + " 服务器锁定抽屉,开始入库"); RobotManage.mainMachine.StoreMoveInfo.log(StoreName + " 服务器锁定抽屉,开始入库");
result = ""; }
else
{
RobotManage.mainMachine.StoreMoveInfo.log(StoreName + " 服务器锁定抽屉,有自检错误,不允许入库");
result = crc.GetString("Res0171.14f1eca7","有自检错误,仅锁入库抽屉");
}
} }
if (dataMap.ContainsKey(ParamDefine.openOutLock) && dataMap[ParamDefine.openOutLock].Equals(ParamDefine.doit)) if (dataMap.ContainsKey(ParamDefine.openOutLock) && dataMap[ParamDefine.openOutLock].Equals(ParamDefine.doit))
...@@ -412,7 +434,7 @@ namespace DeviceLibrary ...@@ -412,7 +434,7 @@ namespace DeviceLibrary
&& RobotManage.mainMachine.StoreMoveInfo.MoveStep == MoveStep.Wait) && RobotManage.mainMachine.StoreMoveInfo.MoveStep == MoveStep.Wait)
{ {
map[ParamDefine.inDoorStatus] = ParamDefine.close; map[ParamDefine.inDoorStatus] = ParamDefine.close;
}else if (IOManager.IOValue(IO_Type.Entry_Drawer_Lock).Equals(IO_VALUE.LOW) }else if ((RobotManage.mainMachine.newDrawer || IOManager.IOValue(IO_Type.Entry_Drawer_Lock).Equals(IO_VALUE.LOW))
&& RobotManage.mainMachine.StoreMoveInfo.MoveStep == MoveStep.Wait) && RobotManage.mainMachine.StoreMoveInfo.MoveStep == MoveStep.Wait)
{ {
map[ParamDefine.inDoorStatus] = ParamDefine.open; map[ParamDefine.inDoorStatus] = ParamDefine.open;
...@@ -554,7 +576,17 @@ namespace DeviceLibrary ...@@ -554,7 +576,17 @@ namespace DeviceLibrary
} }
else else
{ {
RobotManage.mainMachine.AddOutStoreTask(code.ToString(), posId);
var ngReel = false;
object ngMsg = "";
if (data.ContainsKey("ngReel") && data["ngReel"].ToString().ToLower() == "true")
{
ngReel = true;
data.TryGetValue("ngMsg", out ngMsg);
}
RobotManage.mainMachine.AddOutStoreTask(code.ToString(), posId, ngReel, ngMsg.ToString());
} }
} }
TimeSpan span = DateTime.Now - time; TimeSpan span = DateTime.Now - time;
...@@ -633,6 +665,103 @@ namespace DeviceLibrary ...@@ -633,6 +665,103 @@ namespace DeviceLibrary
} }
return msg; return msg;
} }
public JobInfo SelfAudit_getNetPos()
{
string msg = "";
try
{
Dictionary<string, string> paramMap = new Dictionary<string, string>();
paramMap.Add("cid", CID);
string server = GetAddr("/rest/device/selfAudit/getNetPos", paramMap);
DateTime startTime = DateTime.Now;
string resultStr = HttpHelper.Post(server, "");
LogUtil.info("SelfAudit:" + FormUtil.GetSpanStr(DateTime.Now - startTime) + " 【" + server + "】【" + resultStr + "】");
ResultData data = JsonHelper.DeserializeJsonToObject<ResultData>(resultStr);
if (data == null)
{
return null;
}
else if (data.code.Equals(0).Equals(false))
{
return null;
}
try
{
//data 中包含:posName 库位号,barcode 条码,batchNo 盘点批次号
var d = JsonConvert.DeserializeObject<Dictionary<string, string>>(data.data.ToString());
var posName = d["posName"];
var barcode = d["barcode"];
var batchNo = d["batchNo"];
var j = new JobInfo(barcode, posName);
j.batchNo = batchNo;
return j;
}
catch (Exception ex) {
LogUtil.info("SelfAudit:" + data.data.ToString());
return null;
}
}
catch (Exception ex)
{
LogUtil.error("SelfAudit: " + ex.ToString());
}
return null;
}
public string SelfAudit_posOutEnd(string posName)
{
string msg = "";
try
{
Dictionary<string, string> paramMap = new Dictionary<string, string>();
paramMap.Add("posName", posName);
string server = GetAddr("/rest/device/selfAudit/posOutEnd", paramMap);
string resultStr = HttpHelper.Post(server, "");
ResultData data = JsonHelper.DeserializeJsonToObject<ResultData>(resultStr);
if (data == null)
return msg = " DisabledPos【 " + posName + "】 没有收到服务器反馈";
else if (data.code.Equals(0).Equals(false))
return msg = " DisabledPos【 " + posName + "】 :" + data.msg;
return "";
}
catch (Exception ex)
{
LogUtil.error("DisabledPos: " + ex.ToString());
}
return msg;
}
public string SelfAudit_posSelfAuditEnd(string posName,string barcode,string actualBarcode)
{
string msg = "";
try
{
Dictionary<string, string> paramMap = new Dictionary<string, string>();
paramMap.Add("posName", posName);
paramMap.Add("barcode", barcode);
paramMap.Add("actualBarcode", actualBarcode);
string server = GetAddr("/rest/device/selfAudit/posSelfAuditEnd", paramMap);
string resultStr = HttpHelper.Post(server, "");
ResultData data = JsonHelper.DeserializeJsonToObject<ResultData>(resultStr);
if (data == null)
return msg = " posSelfAuditEnd【 " + posName + "】没有收到服务器反馈";
else if (data.code.Equals(0).Equals(false))
return msg = " posSelfAuditEnd【 " + posName + "】:" + data.msg;
return resultStr;
}
catch (Exception ex)
{
LogUtil.error("DisabledPos: " + ex.ToString());
}
return msg;
}
private static string GetAddr(string addr, Dictionary<string, string> paramsMap) private static string GetAddr(string addr, Dictionary<string, string> paramsMap)
{ {
if (server.EndsWith("/")) if (server.EndsWith("/"))
......
...@@ -28,7 +28,7 @@ namespace DeviceLibrary ...@@ -28,7 +28,7 @@ namespace DeviceLibrary
public event Action<string, StoreMoveType, bool> InOutEndProcessEvent; public event Action<string, StoreMoveType, bool> InOutEndProcessEvent;
public bool IsComplateOrFree { get => MoveInfo.MoveStep == MoveStep.Wait && !movelock; } public bool IsComplateOrFree { get => MoveInfo.MoveStep == MoveStep.Wait && !movelock; }
public bool IsTakedReel { get => MoveInfo.MoveStep >= MoveStep.StoreTS20; } public bool IsTakedReel { get => MoveInfo.MoveStep >= MoveStep.StoreTS20 || MoveInfo.MoveStep == MoveStep.Wait; }
public bool IsPutOnOut {get=> MoveInfo.MoveStep >= MoveStep.StoreTS16; } public bool IsPutOnOut {get=> MoveInfo.MoveStep >= MoveStep.StoreTS16; }
public ReelTransport(Robot_Config _Config, MainMachine _mainMachine) public ReelTransport(Robot_Config _Config, MainMachine _mainMachine)
...@@ -57,12 +57,15 @@ namespace DeviceLibrary ...@@ -57,12 +57,15 @@ namespace DeviceLibrary
bool ignoreFixtureCheck = false; bool ignoreFixtureCheck = false;
int ToCheckOffset = 0; int ToCheckOffset = 0;
int FromCheckOffset = 0; int FromCheckOffset = 0;
public bool isSelfAudit = false;
public bool CheckHasMatetial = false;
public bool Start(BoxStorePosition from, BoxStorePosition to, StoreMoveType _storeMoveType, bool premove=false) public bool Start(BoxStorePosition from, BoxStorePosition to, StoreMoveType _storeMoveType, bool premove=false)
{ {
if (MoveInfo.MoveStep != MoveStep.Wait) if (MoveInfo.MoveStep != MoveStep.Wait)
return false; return false;
isSelfAudit = false;
CheckHasMatetial = false;
ignoreFixtureCheck = false; ignoreFixtureCheck = false;
storeMoveType = _storeMoveType; storeMoveType = _storeMoveType;
PreMove = premove; PreMove = premove;
...@@ -113,6 +116,7 @@ namespace DeviceLibrary ...@@ -113,6 +116,7 @@ namespace DeviceLibrary
IgnoreX09 = false; IgnoreX09 = false;
MoveInfo.NextMoveStep(MoveStep.StoreTS02); MoveInfo.NextMoveStep(MoveStep.StoreTS02);
MoveInfo.log($"{storeMoveType}:开始"); MoveInfo.log($"{storeMoveType}:开始");
CheckPosStatus(MoveInfo, From.posid, true);
break; break;
case MoveStep.StoreTS02: case MoveStep.StoreTS02:
MoveInfo.NextMoveStep(MoveStep.StoreTS03); MoveInfo.NextMoveStep(MoveStep.StoreTS03);
...@@ -138,25 +142,38 @@ namespace DeviceLibrary ...@@ -138,25 +142,38 @@ namespace DeviceLibrary
if (CheckPosStatus(MoveInfo, From.posid)) if (CheckPosStatus(MoveInfo, From.posid))
{ {
MoveInfo.NextMoveStep(MoveStep.StoreTS05); MoveInfo.NextMoveStep(MoveStep.StoreTS05);
if (From.posid != MainMachine.LabelP)
{
var zp2 = From.Z_Axis_P3 - 205000; var zp2 = From.Z_Axis_P3 - 205000;
if (zp2 < 0) if (zp2 < 0)
zp2 = 0; zp2 = 0;
Z_Axis.AbsMove(MoveInfo, zp2, Config.Z_Axis_P1_speed); Z_Axis.AbsMove(MoveInfo, zp2, Config.Z_Axis_P1_speed);
MoveInfo.log($"{storeMoveType}:Z轴到达取料前点,{From.Z_Axis_P2}"); MoveInfo.log($"{storeMoveType}:Z轴到达取料前点,{From.Z_Axis_P2}");
}
RobotManage.mainMachine.CylinderMove(MoveInfo, IO_Type.Taking_Release, IO_Type.Taking_Clamp, IO_VALUE.LOW); RobotManage.mainMachine.CylinderMove(MoveInfo, IO_Type.Taking_Release, IO_Type.Taking_Clamp, IO_VALUE.LOW);
MoveInfo.log($"{storeMoveType}:松开夹爪"); MoveInfo.log($"{storeMoveType}:松开夹爪");
IgnoreX09 = false; IgnoreX09 = false;
} }
break; break;
case MoveStep.StoreTS05: case MoveStep.StoreTS05:
if (!ignoreFixtureCheck && FromCheckOffset > 0 && !IgnoreX09 && IOManager.IOValue(FromCheckOffset > 0 ? IO_Type.Taking_Left_Check : IO_Type.Taking_Right_Check).Equals(IO_VALUE.LOW)) if (!ignoreFixtureCheck && FromCheckOffset != 0 && !IgnoreX09 && IOManager.IOValue(FromCheckOffset > 0 ? IO_Type.Taking_Left_Check : IO_Type.Taking_Right_Check).Equals(IO_VALUE.LOW))
{
if (isSelfAudit)
{
CheckHasMatetial = false;
MoveInfo.log($"{storeMoveType}:自检时没有检测到物料");
MoveInfo.NextMoveStep(MoveStep.StoreTS26);
}
else
{ {
Msg.add(crc.GetString("Res0062", "取料时没有检测到物料信号,请检查."), MsgLevel.alarm, ErrInfo.X09_BoxNotDetect); Msg.add(crc.GetString("Res0062", "取料时没有检测到物料信号,请检查."), MsgLevel.alarm, ErrInfo.X09_BoxNotDetect);
MoveInfo.log($"取料时没有检测到物料信号,请检查."); MoveInfo.log($"取料时没有检测到物料信号,请检查.");
RobotManage.UserPause(crc.GetString("Res0063", "取料时没有检测到物料信号,请检查")); //RobotManage.UserPause(crc.GetString("Res0063", "取料时没有检测到物料信号,请检查"));
}
} }
else else
{ {
CheckHasMatetial = true;
Msg.add("", MsgLevel.info, ErrInfo.X09_Clear); Msg.add("", MsgLevel.info, ErrInfo.X09_Clear);
IgnoreX09 = false; IgnoreX09 = false;
MoveInfo.NextMoveStep(MoveStep.StoreTS06); MoveInfo.NextMoveStep(MoveStep.StoreTS06);
...@@ -203,6 +220,7 @@ namespace DeviceLibrary ...@@ -203,6 +220,7 @@ namespace DeviceLibrary
break; break;
case MoveStep.StoreTS20: case MoveStep.StoreTS20:
MoveInfo.NextMoveStep(MoveStep.StoreTS21); MoveInfo.NextMoveStep(MoveStep.StoreTS21);
CheckPosStatus(MoveInfo, To.posid,true);
Y_Axis.AbsMove(MoveInfo, To.Y_Axis_P2 + ToCheckOffset, Config.Y_Axis_P1_speed); Y_Axis.AbsMove(MoveInfo, To.Y_Axis_P2 + ToCheckOffset, Config.Y_Axis_P1_speed);
X_Axis.AbsMove(MoveInfo, To.X_Axis_P2, Config.X_Axis_P1_speed); X_Axis.AbsMove(MoveInfo, To.X_Axis_P2, Config.X_Axis_P1_speed);
MoveInfo.log($"{storeMoveType}:XY轴到达目的地检测,X:{To.X_Axis_P2},Y:{To.Y_Axis_P2}+{ToCheckOffset}"); MoveInfo.log($"{storeMoveType}:XY轴到达目的地检测,X:{To.X_Axis_P2},Y:{To.Y_Axis_P2}+{ToCheckOffset}");
...@@ -235,20 +253,24 @@ namespace DeviceLibrary ...@@ -235,20 +253,24 @@ namespace DeviceLibrary
zp2 = 0; zp2 = 0;
Z_Axis.AbsMove(MoveInfo, zp2, Config.Z_Axis_P1_speed); Z_Axis.AbsMove(MoveInfo, zp2, Config.Z_Axis_P1_speed);
} }
else if (To.posid == MainMachine.LabelP)
{
RobotManage.mainMachine.FlipEquip.LiftUp(MoveInfo);
}
break; break;
case MoveStep.StoreTS23: case MoveStep.StoreTS23:
if (!ignoreFixtureCheck && ToCheckOffset > 0 && IOManager.IOValue(ToCheckOffset > 0 ? IO_Type.Taking_Left_Check : IO_Type.Taking_Right_Check).Equals(IO_VALUE.HIGH)) if (!ignoreFixtureCheck && ToCheckOffset > 0 && IOManager.IOValue(ToCheckOffset > 0 ? IO_Type.Taking_Left_Check : IO_Type.Taking_Right_Check).Equals(IO_VALUE.HIGH))
{ {
Msg.add(crc.GetString("Res0064", "放料时发现库位已经有料,请检查."), MsgLevel.alarm); Msg.add(crc.GetString("Res0064", "放料时发现库位已经有料,请检查."), MsgLevel.alarm);
MoveInfo.log($"放料时发现库位已经有料,请检查."); MoveInfo.log($"放料时发现库位已经有料,请检查.");
RobotManage.UserPause(crc.GetString("Res0065", "放料时发现库位已经有料,请检查")); //RobotManage.UserPause(crc.GetString("Res0065", "放料时发现库位已经有料,请检查"));
} }
else else
{ {
Msg.add("", MsgLevel.info, ErrInfo.X09_Clear); Msg.add("", MsgLevel.info, ErrInfo.X09_Clear);
IgnoreX09 = false; IgnoreX09 = false;
MoveInfo.NextMoveStep(MoveStep.StoreTS24); MoveInfo.NextMoveStep(MoveStep.StoreTS24);
MoveInfo.log($"{storeMoveType}:检测料"); MoveInfo.log($"{storeMoveType}:检测有无物料,有物料");
} }
break; break;
...@@ -298,7 +320,7 @@ namespace DeviceLibrary ...@@ -298,7 +320,7 @@ namespace DeviceLibrary
else else
{ {
MoveInfo.log($"{storeMoveType}:XY返回待机点"); MoveInfo.log($"{storeMoveType}:XY返回待机点");
Y_Axis.AbsMove(MoveInfo, Config.Y_Axis_P1, Config.Y_Axis_P1_speed); //Y_Axis.AbsMove(MoveInfo, Config.Y_Axis_P1, Config.Y_Axis_P1_speed);
X_Axis.AbsMove(MoveInfo, Config.X_Axis_P1, Config.X_Axis_P1_speed); X_Axis.AbsMove(MoveInfo, Config.X_Axis_P1, Config.X_Axis_P1_speed);
} }
MoveInfo.log($"{storeMoveType}:完成放料"); MoveInfo.log($"{storeMoveType}:完成放料");
...@@ -319,7 +341,7 @@ namespace DeviceLibrary ...@@ -319,7 +341,7 @@ namespace DeviceLibrary
return false; return false;
} }
bool CheckPosStatus(MoveInfo moveInfo,string posid) { bool CheckPosStatus(MoveInfo moveInfo,string posid,bool precheck=false) {
if (posid.StartsWith("L")) if (posid.StartsWith("L"))
{ {
if (IOManager.IOValue(IO_Type.Entry_Drawer).Equals(IO_VALUE.HIGH) && if (IOManager.IOValue(IO_Type.Entry_Drawer).Equals(IO_VALUE.HIGH) &&
...@@ -372,7 +394,7 @@ namespace DeviceLibrary ...@@ -372,7 +394,7 @@ namespace DeviceLibrary
return true; return true;
else else
{ {
RobotManage.mainMachine.TPMove.ToLow(moveInfo); RobotManage.mainMachine.TPMove.ToLow(precheck?null:moveInfo);
moveInfo.log($"{posid},上层库位移至左侧"); moveInfo.log($"{posid},上层库位移至左侧");
return false; return false;
} }
...@@ -383,7 +405,7 @@ namespace DeviceLibrary ...@@ -383,7 +405,7 @@ namespace DeviceLibrary
return true; return true;
else else
{ {
RobotManage.mainMachine.TPMove.ToHigh(moveInfo); RobotManage.mainMachine.TPMove.ToHigh(precheck ? null : moveInfo);
moveInfo.log($"{posid},上层库位移至右侧"); moveInfo.log($"{posid},上层库位移至右侧");
return false; return false;
} }
...@@ -394,7 +416,7 @@ namespace DeviceLibrary ...@@ -394,7 +416,7 @@ namespace DeviceLibrary
return true; return true;
else else
{ {
RobotManage.mainMachine.TPMove.ToLow(moveInfo); RobotManage.mainMachine.TPMove.ToLow(precheck ? null : moveInfo);
moveInfo.log($"{posid},上层库位移至左侧"); moveInfo.log($"{posid},上层库位移至左侧");
return false; return false;
} }
......
...@@ -7,16 +7,19 @@ using System.Drawing; ...@@ -7,16 +7,19 @@ 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.Reflection;
using System.Runtime.ExceptionServices; using System.Runtime.ExceptionServices;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Text; using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Xml.Linq;
namespace DeviceLibrary namespace DeviceLibrary
{ {
[Serializable] [Serializable]
public enum TestStorePointPort { public enum TestStorePointPort {
入口, 出口, 上层左侧, 上层右侧, 下层左侧, 下层右侧,贴标 入口, 出口, 上层左侧, 上层右侧, 下层左侧, 下层右侧,贴标,接标台
} }
[Serializable] [Serializable]
public class tstoredata { public class tstoredata {
...@@ -69,6 +72,7 @@ namespace DeviceLibrary ...@@ -69,6 +72,7 @@ namespace DeviceLibrary
Dictionary<int, string> ngmsglist = new Dictionary<int, string>(); Dictionary<int, string> ngmsglist = new Dictionary<int, string>();
RobotManage.mainMachine.NGInfoList.ForEach(ng=> { RobotManage.mainMachine.NGInfoList.ForEach(ng=> {
var sindex = RobotManage.AllPositionMapNumList.IndexOf(ng.PosID)-startindex; var sindex = RobotManage.AllPositionMapNumList.IndexOf(ng.PosID)-startindex;
if (!ngmsglist.ContainsKey(sindex))
ngmsglist.Add(sindex, ng.NgMsg); ngmsglist.Add(sindex, ng.NgMsg);
}); });
int index = 0; int index = 0;
...@@ -150,7 +154,7 @@ namespace DeviceLibrary ...@@ -150,7 +154,7 @@ 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 Enumerable.Repeat(0, points.Count).ToList();
List<int> haslist = new List<int>(); List<int> haslist = new List<int>();
BitmapData bd=null; BitmapData bd=null;
...@@ -217,6 +221,87 @@ namespace DeviceLibrary ...@@ -217,6 +221,87 @@ namespace DeviceLibrary
TestStorePointEvent?.Invoke(tp, bmp); TestStorePointEvent?.Invoke(tp, bmp);
return haslist; return haslist;
} }
public static TestStorePointPort GetTestStorePointPort(string posname) {
TestStorePointPort testStorePointPort;
if (Regex.IsMatch(posname, "^S[A-G]"))
testStorePointPort= TestStorePointPort.上层左侧;
else if (Regex.IsMatch(posname, "^S[H-N][1-6]$"))
testStorePointPort = TestStorePointPort.下层左侧;
else
testStorePointPort = TestStorePointPort.下层右侧;
LogUtil.info($"GetTestStorePointPort: {posname}={testStorePointPort}");
return testStorePointPort;
}
/// <summary>
/// 检测标签是否被取走
/// </summary>
/// <returns></returns>
public static bool TestHasLabelOnDock(bool checkstatus) {
var r = CameraPointTest.CameraData[TestStorePointPort.接标台.ToString()].PointList;
Point checkpoint = r[0];
var bmp = RobotManage.CameraA.GetImage(0);
if (bmp == null)
return true;
//bmp = new Bitmap("d:\\新建分组1_监控点1_106_20220818172856_3997146.bmp");
BitmapData bd = null;
try
{
bd = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadOnly, bmp.PixelFormat);
var p = checkpoint;
p.X = p.X - 8;
p.Y = p.Y - 8;
var cl = new List<ColorHSV>();
for (int j = 0; j < 16; j++)
{
for (int k = 0; k < 16; k++)
{
var x = p.X + j;
var y = p.Y + k;
var addr = y * bd.Stride + x * 4;
var cr = Marshal.ReadByte(bd.Scan0, addr + 2);
var cg = Marshal.ReadByte(bd.Scan0, addr + 1);
var cb = Marshal.ReadByte(bd.Scan0, addr);
var hh = ColorHelper.RgbToHsv(new ColorRGB(cr, cg, cb));
cl.Add(hh);
}
}
var h = cl.Average(cc => cc.H);
var s = cl.Average(cc => cc.S);
var v = cl.Average(cc => cc.V);
var has = (h>180 && h<260) || s<10;
has = s < 15;
LogUtil.info($"TestHasLabelOnDock checkstatus:{checkstatus}, h:{h},s:{s},v:{v},config_s:{CameraData[TestStorePointPort.接标台.ToString()].S}");
if (has != checkstatus)
{
Directory.CreateDirectory("\\image\\LabelDock");
bmp.Save("\\image\\LabelDock\\"+ checkstatus +"_"+ DateTime.Now.ToString("yyyyMMddHHmmss")+".jpg");
}
return has;
}
catch (AccessViolationException ex)
{
LogUtil.error("TestHasLabelOnDock AccessViolationException:" + ex.ToString());
}
catch (Exception ex)
{
LogUtil.error("TestHasLabelOnDock:" + ex.ToString());
}
finally
{
if (bd != null)
bmp.UnlockBits(bd);
}
return false;
}
/// <summary> /// <summary>
/// 按中心点扩展一个矩形区域 /// 按中心点扩展一个矩形区域
/// </summary> /// </summary>
......
using CodeLibrary; using CodeLibrary;
using OnlineStore;
using OnlineStore.Common; using OnlineStore.Common;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
...@@ -322,6 +323,7 @@ namespace DeviceLibrary ...@@ -322,6 +323,7 @@ namespace DeviceLibrary
{ {
public static List<Msg> msg = new List<Msg>(); public static List<Msg> msg = new List<Msg>();
public string msgtxt; public string msgtxt;
public string msgkey;
public MsgLevel msgLevel; public MsgLevel msgLevel;
public ErrInfo errInfo; public ErrInfo errInfo;
public DateTime datetime; public DateTime datetime;
...@@ -335,13 +337,26 @@ namespace DeviceLibrary ...@@ -335,13 +337,26 @@ namespace DeviceLibrary
List<Msg> mm = new List<Msg>(msg); List<Msg> mm = new List<Msg>(msg);
return mm; return mm;
} }
public static void add(string m, MsgLevel ml, ErrInfo errInfo= ErrInfo.Empty) public static void add(string m, MsgLevel ml, ErrInfo errInfo = ErrInfo.Empty)
{ {
lock (msg) lock (msg)
{ {
var fm = msg.Find((x) => x.msgtxt == m); var fm = msg.Find((x) => x.msgtxt == m);
if (fm==null) if (fm == null)
msg.Add(new Msg { msgtxt = m, msgLevel = ml, datetime = DateTime.Now, errInfo = errInfo }); msg.Add(new Msg { msgtxt = m, msgkey = "", msgLevel = ml, datetime = DateTime.Now, errInfo = errInfo });
}
}
public static void add(CrcObject m, MsgLevel ml, ErrInfo errInfo= ErrInfo.Empty)
{
add(m.key, m.msg, ml, errInfo);
}
public static void add(string key,string m, MsgLevel ml, ErrInfo errInfo = ErrInfo.Empty)
{
lock (msg)
{
var fm = msg.Find((x) => x.msgtxt == m);
if (fm == null)
msg.Add(new Msg { msgtxt = m, msgkey = key, msgLevel = ml, datetime = DateTime.Now, errInfo = errInfo });
} }
} }
static bool _setlogones = false; static bool _setlogones = false;
......
...@@ -79,6 +79,10 @@ namespace DeviceLibrary ...@@ -79,6 +79,10 @@ namespace DeviceLibrary
/// 料盘高 /// 料盘高
/// </summary> /// </summary>
public int plateH { get; set; } public int plateH { get; set; }
public string batchNo { get; set; }
public bool isNG { get; set; }
public string NgMsg { get; set; }
public string ToStr() public string ToStr()
{ {
......
...@@ -48,7 +48,7 @@ namespace DeviceLibrary ...@@ -48,7 +48,7 @@ namespace DeviceLibrary
MoveInfo.WaitList.ForEach((w) => { MoveInfo.WaitList.ForEach((w) => {
if (w.WaitType.Equals(WaitEnum.W014_Msg)) { if (w.WaitType.Equals(WaitEnum.W014_Msg)) {
w.IsEnd = true; w.IsEnd = true;
Msg.add(w.ActionMsg, w.Data); Msg.add("WaitType."+ w.WaitType, w.ActionMsg, w.Data);
} }
}); });
foreach (WaitResultInfo wait in MoveInfo.WaitList) foreach (WaitResultInfo wait in MoveInfo.WaitList)
...@@ -78,7 +78,7 @@ namespace DeviceLibrary ...@@ -78,7 +78,7 @@ 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("WaitType."+wait.WaitType,WarnMsg, MsgLevel.alarm);
RobotManage.UserPause(WarnMsg); RobotManage.UserPause(WarnMsg);
break; break;
} }
...@@ -118,7 +118,7 @@ namespace DeviceLibrary ...@@ -118,7 +118,7 @@ namespace DeviceLibrary
else if (wait.WaitType.Equals(WaitEnum.W013_Action)) else if (wait.WaitType.Equals(WaitEnum.W013_Action))
{ {
wait.IsEnd = wait.Action.Invoke(wait); wait.IsEnd = wait.Action.Invoke(wait);
LogUtil.info($"{Name} 自定义等待 IsEnd={wait.IsEnd},Type={wait.Action.GetType()}"); LogUtil.info($"{Name} 自定义等待 IsEnd={wait.IsEnd},Msg={wait.ActionMsg}");
} }
else if (wait.WaitType.Equals(WaitEnum.W008_BatchAxis)) else if (wait.WaitType.Equals(WaitEnum.W008_BatchAxis))
{ {
...@@ -183,7 +183,7 @@ namespace DeviceLibrary ...@@ -183,7 +183,7 @@ namespace DeviceLibrary
} }
else if (span.TotalSeconds > MoveInfo.TimeOutSeconds) else if (span.TotalSeconds > MoveInfo.TimeOutSeconds)
{ {
WarnMsg = MoveInfo.Name + "[" + MoveInfo.MoveStep + "]" + "等待" + "}" + NotOkMsg + "超时" + "[" + Math.Round(span.TotalSeconds, 1) + "]" + "秒"; WarnMsg = MoveInfo.Name + "[" + MoveInfo.MoveStep + "]" + "等待" + "}" + NotOkMsg + "超时";
int second = (int)(MoveInfo.TimeOutSeconds / span.TotalSeconds) * 10; int second = (int)(MoveInfo.TimeOutSeconds / span.TotalSeconds) * 10;
if (second > 120) if (second > 120)
...@@ -197,7 +197,7 @@ namespace DeviceLibrary ...@@ -197,7 +197,7 @@ namespace DeviceLibrary
LogUtil.error(WarnMsg, logType + 100, second); LogUtil.error(WarnMsg, logType + 100, second);
//MoveInfo.errlog(WarnMsg); //MoveInfo.errlog(WarnMsg);
//Alarm(AlarmType.IoSingleTimeOut, WarnMsg); //Alarm(AlarmType.IoSingleTimeOut, WarnMsg);
Msg.add(WarnMsg, MsgLevel.alarm); Msg.add("MoveStep.",WarnMsg, MsgLevel.alarm);
} }
return true; return true;
} }
...@@ -259,8 +259,8 @@ namespace DeviceLibrary ...@@ -259,8 +259,8 @@ namespace DeviceLibrary
// return; // return;
(IoLowType, IoHighType) = (IoHighType, IoLowType); (IoLowType, IoHighType) = (IoHighType, IoLowType);
} }
//if (IOManager.DOValue(IoHighType).Equals(IO_VALUE.HIGH)) if (IOManager.IOValue(IoHighType).Equals(IO_VALUE.HIGH) && IOManager.IOValue(IoLowType).Equals(IO_VALUE.LOW))
// return; return;
IOMove(IoLowType, IO_VALUE.LOW); IOMove(IoLowType, IO_VALUE.LOW);
IOMove(IoHighType, IO_VALUE.HIGH); IOMove(IoHighType, IO_VALUE.HIGH);
if (moveInfo != null) if (moveInfo != null)
...@@ -270,7 +270,7 @@ namespace DeviceLibrary ...@@ -270,7 +270,7 @@ namespace DeviceLibrary
} }
} }
public IO_VALUE IOValue(string ioType) => IOManager.IOValue(ioType); public IO_VALUE IOValue(string ioType) => IOManager.IOValue(ioType);
void IOMove(string IoType, IO_VALUE value, bool isCheck = false, int msTime = 0) public void IOMove(string IoType, IO_VALUE value, bool isCheck = false, int msTime = 0)
{ {
if (msTime <= 0) if (msTime <= 0)
{ {
......
...@@ -42,6 +42,12 @@ namespace DeviceLibrary ...@@ -42,6 +42,12 @@ namespace DeviceLibrary
//{ //{
// RightDoorOpen = false; // RightDoorOpen = false;
//} //}
if (RobotManage.dauxiKS107.Distance < 180) {
Msg.add(crc.GetString("Res0163.f6ad5099","冷凝液回收桶已满"), MsgLevel.warning);
}
if (IOValue(IO_Type.Airpressure_Check).Equals(IO_VALUE.LOW)) { if (IOValue(IO_Type.Airpressure_Check).Equals(IO_VALUE.LOW)) {
Msg.add(crc.GetString("Res0079","未检测到气压信号."), MsgLevel.warning); Msg.add(crc.GetString("Res0079","未检测到气压信号."), MsgLevel.warning);
} }
......
...@@ -73,6 +73,8 @@ namespace DeviceLibrary ...@@ -73,6 +73,8 @@ namespace DeviceLibrary
/// </summary> /// </summary>
public bool isInSuddenDown = false; public bool isInSuddenDown = false;
bool selfAuditMode = false;
public List<ReelParam> NGInfoList = new List<ReelParam>(); public List<ReelParam> NGInfoList = new List<ReelParam>();
...@@ -99,7 +101,7 @@ namespace DeviceLibrary ...@@ -99,7 +101,7 @@ namespace DeviceLibrary
//Y_Axis.ForceSafeCheck = true; //Y_Axis.ForceSafeCheck = true;
Y_Axis.interference += Y_Axis_interference; Y_Axis.interference += Y_Axis_interference;
Z_Axis = new AxisBean(Config.Z_Axis, Name); Z_Axis = new AxisBean(Config.Z_Axis, Name);
Z_Axis.interference += Z_Axis_interference;
Flip_Axis = new AxisBean(Config.Flip_Axis, Name); Flip_Axis = new AxisBean(Config.Flip_Axis, Name);
Rotate_Axis = new AxisBean(Config.Rotate_Axis, Name); Rotate_Axis = new AxisBean(Config.Rotate_Axis, Name);
Crc_LanguageChangeEvent(null, EventArgs.Empty); Crc_LanguageChangeEvent(null, EventArgs.Empty);
...@@ -141,13 +143,17 @@ namespace DeviceLibrary ...@@ -141,13 +143,17 @@ namespace DeviceLibrary
} }
private void Entry_Drawer_Open() private void Entry_Drawer_Open()
{ {
nglist = new List<string>(); nglist = new List<string>();
}private void RightDoor_Close() }
private void RightDoor_Close()
{ {
IOMove(IO_Type.RightDoor_Lock, IO_VALUE.HIGH); IOMove(IO_Type.RightDoor_Lock, IO_VALUE.HIGH);
}private void LeftDoor_Close() RobotManage.mainMachine.NGInfoList = new List<ReelParam>();
}
private void LeftDoor_Close()
{ {
IOMove(IO_Type.LeftDoor_Lock, IO_VALUE.HIGH); IOMove(IO_Type.LeftDoor_Lock, IO_VALUE.HIGH);
}private void PrinterDoor_Close() }private void PrinterDoor_Close()
...@@ -157,6 +163,7 @@ namespace DeviceLibrary ...@@ -157,6 +163,7 @@ namespace DeviceLibrary
private void Entry_Drawer_Close() private void Entry_Drawer_Close()
{ {
IOMove(IO_Type.Entry_Drawer_Lock, IO_VALUE.HIGH); IOMove(IO_Type.Entry_Drawer_Lock, IO_VALUE.HIGH);
newDrawer = true;
CameraPointTest.GetThingStoreName(TestStorePointPort.入口); CameraPointTest.GetThingStoreName(TestStorePointPort.入口);
} }
private void Out_Drawer_Close() private void Out_Drawer_Close()
...@@ -184,6 +191,15 @@ namespace DeviceLibrary ...@@ -184,6 +191,15 @@ namespace DeviceLibrary
return (true, crc.GetString("Res0093","Z轴不在待机位,不允许移动")); return (true, crc.GetString("Res0093","Z轴不在待机位,不允许移动"));
} }
private (bool, string) Z_Axis_interference(int arg1, int arg2)
{
if (X_Axis.IsBusy)
return (true, "The other axes are moving, and this axis cannot be moved");
if (Y_Axis.IsBusy)
return (true, "The other axes are moving, and this axis cannot be moved");
return (false, "");
}
private void Crc_LanguageChangeEvent(object sender, EventArgs e) private void Crc_LanguageChangeEvent(object sender, EventArgs e)
{ {
StoreMoveInfo.Name = crc.GetString("Res0088","进出库调度"); StoreMoveInfo.Name = crc.GetString("Res0088","进出库调度");
...@@ -202,7 +218,7 @@ namespace DeviceLibrary ...@@ -202,7 +218,7 @@ namespace DeviceLibrary
while (mstart) { while (mstart) {
try try
{ {
Thread.Sleep(200); Thread.Sleep(100);
ioMonitor(); ioMonitor();
canRunning = DeviceCheck(); canRunning = DeviceCheck();
if (canRunning) if (canRunning)
...@@ -217,11 +233,10 @@ namespace DeviceLibrary ...@@ -217,11 +233,10 @@ namespace DeviceLibrary
continue; continue;
if (runStatus == RunStatus.Running) if (runStatus == RunStatus.Running)
{ {
boxTransport.Process(); boxTransport.Process();
if (RobotManage.InoutDebugMode) if (RobotManage.InoutDebugMode)
AutoInOutTestProcess(); AutoInOutTestProcess();
else if (DemoTestMode) else if (selfAuditMode)
TFIDSelfTestProcess(); TFIDSelfTestProcess();
else else
StoreDemoProcess(); StoreDemoProcess();
...@@ -236,7 +251,7 @@ namespace DeviceLibrary ...@@ -236,7 +251,7 @@ namespace DeviceLibrary
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error("Mainprocess:" + ex); LogUtil.error("Mainprocess:" + ex);
Msg.add(ex.ToString(), MsgLevel.warning); Msg.add("Mainprocess", ex.ToString(), MsgLevel.warning);
//Msg.setlogones(); //Msg.setlogones();
} }
finally { finally {
...@@ -275,7 +290,7 @@ namespace DeviceLibrary ...@@ -275,7 +290,7 @@ namespace DeviceLibrary
} }
public void Start() { public void Start() {
ServerCM.StartConnectServer(); ServerCM.StartConnectServer();
Msg.add("", MsgLevel.info, ErrInfo.X09_Clear); Msg.add("","", MsgLevel.info, ErrInfo.X09_Clear);
LeftDoorOpen = false; LeftDoorOpen = false;
RightDoorOpen = false; RightDoorOpen = false;
PrintDoorOpen = false; PrintDoorOpen = false;
...@@ -301,7 +316,7 @@ namespace DeviceLibrary ...@@ -301,7 +316,7 @@ namespace DeviceLibrary
Alarm(AlarmType.None); Alarm(AlarmType.None);
StopMove(true); StopMove(true);
LedProcess(null); LedProcess(null);
Msg.add("", MsgLevel.info, ErrInfo.X09_Clear); Msg.add("","", MsgLevel.info, ErrInfo.X09_Clear);
} }
public void BeginHomeReset(bool firstRun=false) { public void BeginHomeReset(bool firstRun=false) {
...@@ -342,10 +357,11 @@ namespace DeviceLibrary ...@@ -342,10 +357,11 @@ 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);
IOMove(IO_Type.Label_PasteBlow, IO_VALUE.LOW);
CylinderMove(ResetMoveInfo, IO_Type.Tin_Dock_Rotate_Release, IO_Type.Tin_Dock_Rotate_Clamp, IO_VALUE.LOW); 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:
ResetMoveInfo.NextMoveStep(MoveStep.H02_HomeReset); ResetMoveInfo.NextMoveStep(MoveStep.H02_HomeReset);
...@@ -381,11 +397,12 @@ namespace DeviceLibrary ...@@ -381,11 +397,12 @@ namespace DeviceLibrary
ResetMoveInfo.NextMoveStep(MoveStep.HEND_HomeReset); ResetMoveInfo.NextMoveStep(MoveStep.HEND_HomeReset);
if (IOValue(IO_Type.Taking_Clamp).Equals(IO_VALUE.LOW)) if (IOValue(IO_Type.Taking_Clamp).Equals(IO_VALUE.LOW))
{ {
if (Setting_Init.Runtime_Step >= Runtime_StepE.Printed && Setting_Init.Runtime_Step < Runtime_StepE.LabelPasteFinish) if (false && Setting_Init.Runtime_Step >= Runtime_StepE.Printed && Setting_Init.Runtime_Step < Runtime_StepE.LabelPasteFinish)
{ {
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);
LabelingMoveInfo.MoveParam.IsNg = true;
Msg.add(crc.GetString("Res0133","重置前物料正在贴标,无法继续,请手动处理"), MsgLevel.warning, ErrInfo.LabelInPaste); Msg.add(crc.GetString("Res0133","重置前物料正在贴标,无法继续,请手动处理"), MsgLevel.warning, ErrInfo.LabelInPaste);
RobotManage.UserPause(crc.GetString("Res0133","重置前物料正在贴标,无法继续,请手动处理")); RobotManage.UserPause(crc.GetString("Res0133","重置前物料正在贴标,无法继续,请手动处理"));
} }
...@@ -427,7 +444,7 @@ namespace DeviceLibrary ...@@ -427,7 +444,7 @@ namespace DeviceLibrary
ok = false; ok = false;
DeviceSuddenStop(); DeviceSuddenStop();
} }
Msg.add(crc.GetString("Res0134","打印机维护门未关闭") + (ok ? ignorestring : ""), MsgLevel.alarm); Msg.add("printdoor",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))
{ {
...@@ -436,7 +453,7 @@ namespace DeviceLibrary ...@@ -436,7 +453,7 @@ namespace DeviceLibrary
ok = false; ok = false;
DeviceSuddenStop(); DeviceSuddenStop();
} }
Msg.add(crc.GetString("Res0097","左侧防护门没有关闭") + (ok ? ignorestring : ""), MsgLevel.alarm); Msg.add("leftsafedoor",crc.GetString("Res0097","左侧防护门没有关闭") + (ok ? ignorestring : ""), MsgLevel.alarm);
} }
if (IOValue(IO_Type.RightDoor_Check).Equals(IO_VALUE.HIGH)) if (IOValue(IO_Type.RightDoor_Check).Equals(IO_VALUE.HIGH))
{ {
...@@ -445,7 +462,7 @@ namespace DeviceLibrary ...@@ -445,7 +462,7 @@ namespace DeviceLibrary
ok = false; ok = false;
DeviceSuddenStop(); DeviceSuddenStop();
} }
Msg.add(crc.GetString("Res0098","右侧防护门没有关闭") + (ok ? ignorestring : ""), MsgLevel.alarm); Msg.add("rightsafedoor", crc.GetString("Res0098","右侧防护门没有关闭") + (ok ? ignorestring : ""), MsgLevel.alarm);
} }
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))
...@@ -453,8 +470,26 @@ namespace DeviceLibrary ...@@ -453,8 +470,26 @@ namespace DeviceLibrary
Msg.add(crc.GetString("Res0135","防护门没有锁定"), MsgLevel.warning); Msg.add(crc.GetString("Res0135","防护门没有锁定"), MsgLevel.warning);
DeviceSuddenStop(); DeviceSuddenStop();
ok = false; ok = false;
}
if (StoreMoveInfo.MoveStep != MoveStep.Wait && IOValue(IO_Type.Entry_Drawer_Lock).Equals(IO_VALUE.LOW))
{
Msg.add(crc.GetString("Res0164.37b8d13a","出入库时请关好入库抽屉"), MsgLevel.alarm);
DeviceSuddenStop();
ok = false;
} }
if (StoreMoveInfo.MoveStep != MoveStep.Wait && StoreMoveInfo.MoveStep < MoveStep.StoreOut14 && IOValue(IO_Type.Out_Drawer_Lock).Equals(IO_VALUE.LOW))
{
Msg.add(crc.GetString("Res0165.970b4edb","出入库时请关好出库抽屉"), MsgLevel.alarm);
DeviceSuddenStop();
ok = false;
}
if (ServerCM.selfAuditException)
{
Msg.add(crc.GetString("Res0172.8f1fa034","自检测到有错误物料,请处理"), MsgLevel.alarm);
}
if (!lastSafeCheckStatus && ok) if (!lastSafeCheckStatus && ok)
{ {
...@@ -514,6 +549,12 @@ namespace DeviceLibrary ...@@ -514,6 +549,12 @@ namespace DeviceLibrary
ok = false; ok = false;
} }
} }
if (ok && !AxisBean.RunMultiAxis(true, out string msg, AxisBean.List))
{
ok = false;
Msg.add(msg, MsgLevel.warning);
}
if (RobotManage.InoutDebugMode) if (RobotManage.InoutDebugMode)
{ {
Msg.add(crc.GetString("Res0102","进出库调试模式"), MsgLevel.info); Msg.add(crc.GetString("Res0102","进出库调试模式"), MsgLevel.info);
...@@ -548,7 +589,7 @@ namespace DeviceLibrary ...@@ -548,7 +589,7 @@ namespace DeviceLibrary
{ {
if (runStatus == RunStatus.Running || ResetMoveInfo.IsStep(MoveStep.H06_HomeReset)) if (runStatus == RunStatus.Running || ResetMoveInfo.IsStep(MoveStep.H06_HomeReset))
{ {
Msg.add(crc.GetString(configMoveAxis.ProName, configMoveAxis.Explain) + $"[{configMoveAxis.GetAxisValue()}]:" Msg.add(configMoveAxis.ProName,crc.GetString(configMoveAxis.ProName, configMoveAxis.Explain) + $"[{configMoveAxis.GetAxisValue()}]:"
+ crc.GetString("Res0104", "运动报警"), MsgLevel.alarm); + crc.GetString("Res0104", "运动报警"), MsgLevel.alarm);
RobotManage.UserPause(crc.GetString("Res0105","压紧轴报警"), true); RobotManage.UserPause(crc.GetString("Res0105","压紧轴报警"), true);
AxisManager.AlarmClear(configMoveAxis.DeviceName, configMoveAxis.GetAxisValue()); AxisManager.AlarmClear(configMoveAxis.DeviceName, configMoveAxis.GetAxisValue());
...@@ -557,7 +598,7 @@ namespace DeviceLibrary ...@@ -557,7 +598,7 @@ namespace DeviceLibrary
} }
else else
{ {
Msg.add(crc.GetString(configMoveAxis.ProName, configMoveAxis.Explain) + $"[{configMoveAxis.GetAxisValue()}]:" Msg.add(configMoveAxis.ProName, crc.GetString(configMoveAxis.ProName, configMoveAxis.Explain) + $"[{configMoveAxis.GetAxisValue()}]:"
+ crc.GetString("Res0104","运动报警"), MsgLevel.alarm, ErrInfo.SuddenStop); + crc.GetString("Res0104","运动报警"), MsgLevel.alarm, ErrInfo.SuddenStop);
ButtenEvent?.Invoke(null, ErrInfo.SuddenStop); ButtenEvent?.Invoke(null, ErrInfo.SuddenStop);
} }
......
...@@ -36,7 +36,7 @@ namespace DeviceLibrary ...@@ -36,7 +36,7 @@ namespace DeviceLibrary
LabelingMoveInfo.NextMoveStep(MoveStep.Labeling03); LabelingMoveInfo.NextMoveStep(MoveStep.Labeling03);
CylinderMove(LabelingMoveInfo, IO_Type.Tin_Dock_Left, IO_Type.Tin_Dock_Right, IO_VALUE.HIGH); CylinderMove(LabelingMoveInfo, IO_Type.Tin_Dock_Left, IO_Type.Tin_Dock_Right, IO_VALUE.HIGH);
CylinderMove(LabelingMoveInfo, IO_Type.Label_Dock_Back, IO_Type.Label_Dock_Front, IO_VALUE.HIGH); CylinderMove(LabelingMoveInfo, IO_Type.Label_Dock_Back, IO_Type.Label_Dock_Front, IO_VALUE.HIGH);
//LabelingMoveInfo.log("锡膏横移到右侧"); LabelingMoveInfo.log("锡膏横移到右侧");
ScanTimes = 0; ScanTimes = 0;
CodeList = new List<CodeInfo>(); CodeList = new List<CodeInfo>();
LabelingMoveInfo.MoveParam = new ReelParam(); LabelingMoveInfo.MoveParam = new ReelParam();
...@@ -47,8 +47,10 @@ namespace DeviceLibrary ...@@ -47,8 +47,10 @@ namespace DeviceLibrary
// RotateEquip.LockAndTurnDegree(-20); // RotateEquip.LockAndTurnDegree(-20);
// break; // break;
case MoveStep.Labeling03: case MoveStep.Labeling03:
if (RotateEquip.TurnWork==null || RotateEquip.TurnWork.IsCompleted) { if (RotateEquip.TurnWork == null || RotateEquip.TurnWork.IsCompleted)
{
LabelingMoveInfo.NextMoveStep(MoveStep.Labeling04); LabelingMoveInfo.NextMoveStep(MoveStep.Labeling04);
LabelingMoveInfo.log("TakePicture");
TakePicture(); TakePicture();
} }
break; break;
...@@ -86,6 +88,34 @@ namespace DeviceLibrary ...@@ -86,6 +88,34 @@ namespace DeviceLibrary
ServerCM.SendInStoreRequest(new string[] { LabelingMoveInfo.MoveParam.WareCode }, LabelingMoveInfo.MoveParam, true); ServerCM.SendInStoreRequest(new string[] { LabelingMoveInfo.MoveParam.WareCode }, LabelingMoveInfo.MoveParam, true);
Setting_Init.Runtime_Posid = LabelingMoveInfo.MoveParam.PosID; Setting_Init.Runtime_Posid = LabelingMoveInfo.MoveParam.PosID;
Setting_Init.Runtime_RFID = LabelingMoveInfo.MoveParam.RFID; Setting_Init.Runtime_RFID = LabelingMoveInfo.MoveParam.RFID;
if (LabelingMoveInfo.MoveParam.IsNg) {
LabelingMoveInfo.NextMoveStep(MoveStep.Labeling08);
LabelingMoveInfo.log($"获取库位失败,送到NG口:{LabelingMoveInfo.MoveParam.NgMsg}");
return;
}
PrintTask = RobotManage.printerHelper.PrintLabel(LabelingMoveInfo.MoveParam);
Setting_Init.Runtime_Step = Runtime_StepE.Printed;
LabelingMoveInfo.log("开始打印标签:" + LabelingMoveInfo.MoveParam.ToDetailStr());
Task.Run(() =>
{
for (int i = 0; i < 100; i++)
{
if (PrintTask.IsCompleted)
{
var (result, msg) = PrintTask.Result;
if (result)
{
LabelingMoveInfo.log("在线程中检测到打印完成");
Task.Delay(2000).Wait();
CylinderMove(null, IO_Type.Label_Dock_Back, IO_Type.Label_Dock_Front, IO_VALUE.LOW);
IOMove(IO_Type.Label_TakeBlow, IO_VALUE.HIGH, false, 1000);
break;
}
}
Task.Delay(50).Wait();
}
});
return; return;
} }
} }
...@@ -105,13 +135,20 @@ namespace DeviceLibrary ...@@ -105,13 +135,20 @@ namespace DeviceLibrary
break; break;
case MoveStep.Labeling06: case MoveStep.Labeling06:
LabelingMoveInfo.NextMoveStep(MoveStep.Labeling07); LabelingMoveInfo.NextMoveStep(MoveStep.Labeling07);
RotateEquip.TurnDegree(-75); RotateEquip.TurnDegree(-90);
//LabelingMoveInfo.log("滚动锡膏"); //LabelingMoveInfo.log("滚动锡膏");
break; break;
case MoveStep.Labeling07: case MoveStep.Labeling07:
if (RotateEquip.TurnWork.IsCompleted) if (RotateEquip.TurnWork.IsCompleted)
{ {
LabelingMoveInfo.NextMoveStep(MoveStep.Labeling06); LabelingMoveInfo.NextMoveStep(MoveStep.Labeling06);
{
LabelingMoveInfo.NextMoveStep(MoveStep.Labeling08);
LabelingMoveInfo.log("旋转固定贴标位置");
return;
}
var hc = CameraPointTest.ScanRectangle(); var hc = CameraPointTest.ScanRectangle();
ScanTimes++; ScanTimes++;
if (hc) if (hc)
...@@ -139,11 +176,11 @@ namespace DeviceLibrary ...@@ -139,11 +176,11 @@ namespace DeviceLibrary
{ {
if (LabelingMoveInfo.MoveParam.IsNg) if (LabelingMoveInfo.MoveParam.IsNg)
{ {
LabelingMoveInfo.NextMoveStep(MoveStep.Labeling50); LabelingMoveInfo.NextMoveStep(MoveStep.Labeling56);
LabelingMoveInfo.log("物料NG直接退出"); LabelingMoveInfo.log("物料NG直接退出");
} }
else { else {
LabelingMoveInfo.NextMoveStep(MoveStep.Labeling10); LabelingMoveInfo.NextMoveStep(MoveStep.Labeling11);
LabelingMoveInfo.log("开始贴标"); LabelingMoveInfo.log("开始贴标");
} }
} }
...@@ -155,6 +192,12 @@ namespace DeviceLibrary ...@@ -155,6 +192,12 @@ namespace DeviceLibrary
LabelingMoveInfo.log("开始打印标签:" + LabelingMoveInfo.MoveParam.ToDetailStr()); LabelingMoveInfo.log("开始打印标签:" + LabelingMoveInfo.MoveParam.ToDetailStr());
break; break;
case MoveStep.Labeling11: case MoveStep.Labeling11:
if (IOValue(IO_Type.Label_Dock_Back).Equals(IO_VALUE.HIGH)) {
LabelingMoveInfo.NextMoveStep(MoveStep.Labeling13);
LabelingMoveInfo.log("检测到接标托盘已到位,开始贴标");
return;
}
if (PrintTask.IsCompleted) if (PrintTask.IsCompleted)
{ {
var (result, msg) = PrintTask.Result; var (result, msg) = PrintTask.Result;
...@@ -163,14 +206,21 @@ namespace DeviceLibrary ...@@ -163,14 +206,21 @@ namespace DeviceLibrary
LabelingMoveInfo.NextMoveStep(MoveStep.Labeling12); LabelingMoveInfo.NextMoveStep(MoveStep.Labeling12);
LabelingMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(2000)); LabelingMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(2000));
LabelingMoveInfo.log("打印成功,等待标签被取走"); LabelingMoveInfo.log("打印成功,等待标签被取走");
Task.Run(() => {
Task.Delay(2000).Wait();
IOMove(IO_Type.Label_TakeBlow, IO_VALUE.HIGH, false, 1000);
});
} }
else else
{ {
Msg.add(crc.GetString("Res0106","打印机反馈:") + msg, MsgLevel.alarm); Msg.add("printinfo", crc.GetString("Res0106", "打印机反馈:") + msg, MsgLevel.alarm);
RobotManage.UserPause(crc.GetString("Res0106","打印机反馈:") + msg); RobotManage.UserPause(crc.GetString("Res0106", "打印机反馈:") + msg);
LabelingMoveInfo.NextMoveStep(MoveStep.Labeling10); LabelingMoveInfo.NextMoveStep(MoveStep.Labeling10);
LabelingMoveInfo.log("打印失败,再次打印"); LabelingMoveInfo.log("打印失败,再次打印");
} }
} else if (LabelingMoveInfo.IsTimeOut(10)) {
Msg.add(crc.GetString("Res0166.79cee376","打印响应超时"), MsgLevel.alarm);
} }
break; break;
case MoveStep.Labeling12: case MoveStep.Labeling12:
...@@ -179,9 +229,20 @@ namespace DeviceLibrary ...@@ -179,9 +229,20 @@ namespace DeviceLibrary
LabelingMoveInfo.log("开始贴标"); LabelingMoveInfo.log("开始贴标");
break; break;
case MoveStep.Labeling13: case MoveStep.Labeling13:
if (CameraPointTest.TestHasLabelOnDock(true))
{
LabelingMoveInfo.NextMoveStep(MoveStep.Labeling14); LabelingMoveInfo.NextMoveStep(MoveStep.Labeling14);
CylinderMove(LabelingMoveInfo, IO_Type.Label_Dock_Down, IO_Type.Label_Dock_Up, IO_VALUE.HIGH); CylinderMove(LabelingMoveInfo, IO_Type.Label_Dock_Down, IO_Type.Label_Dock_Up, IO_VALUE.HIGH);
//LabelingMoveInfo.log("接标台上升"); //LabelingMoveInfo.log("接标台上升");
}
else {
LabelingMoveInfo.NextMoveStep(MoveStep.Labeling56);
Msg.add(crc.GetString("Res0173.8a024375","没有检测到打印出的标签"), MsgLevel.alarm, ErrInfo.LabelInPaste);
LabelingMoveInfo.MoveParam.IsNg = true;
Setting_Init.Runtime_Posid = "NG";
LabelingMoveInfo.MoveParam.NgMsg = crc.GetString("Res0173.8a024375","没有检测到打印出的标签");
RobotManage.UserPause(crc.GetString("Res0173.8a024375","没有检测到打印出的标签"));
}
break; break;
case MoveStep.Labeling14: case MoveStep.Labeling14:
LabelingMoveInfo.NextMoveStep(MoveStep.Labeling15); LabelingMoveInfo.NextMoveStep(MoveStep.Labeling15);
...@@ -207,31 +268,61 @@ namespace DeviceLibrary ...@@ -207,31 +268,61 @@ namespace DeviceLibrary
//LabelingMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000)); //LabelingMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
break; break;
case MoveStep.Labeling51: case MoveStep.Labeling51:
if (CameraPointTest.TestHasLabelOnDock(false))
{
LabelingMoveInfo.NextMoveStep(MoveStep.Labeling56);
Msg.add(crc.GetString("Res0167.8453b300","取标失败"), MsgLevel.alarm, ErrInfo.LabelInPaste);
LabelingMoveInfo.MoveParam.IsNg = true;
Setting_Init.Runtime_Posid = "NG";
LabelingMoveInfo.MoveParam.NgMsg = crc.GetString("Res0167.8453b300","取标失败");
IOMove(IO_Type.Label_Vacuum, IO_VALUE.LOW);
RobotManage.UserPause(crc.GetString("Res0167.8453b300","取标失败"));
return;
}
LabelingMoveInfo.NextMoveStep(MoveStep.Labeling52); LabelingMoveInfo.NextMoveStep(MoveStep.Labeling52);
CylinderMove(null, IO_Type.Labeling_Down, IO_Type.Labeling_Up, IO_VALUE.LOW); CylinderMove(null, IO_Type.Labeling_Down, IO_Type.Labeling_Up, IO_VALUE.LOW);
IOMove(IO_Type.Label_PasteBlow, IO_VALUE.HIGH);
//LabelingMoveInfo.log("贴标下降"); //LabelingMoveInfo.log("贴标下降");
Setting_Init.Runtime_Step = Runtime_StepE.LabelPaste; Setting_Init.Runtime_Step = Runtime_StepE.LabelPaste;
//LabelingMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000)); //LabelingMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
break; break;
case MoveStep.Labeling52: case MoveStep.Labeling52:
LabelingMoveInfo.NextMoveStep(MoveStep.Labeling53); LabelingMoveInfo.NextMoveStep(MoveStep.Labeling52_2);
IOMove(IO_Type.Label_Vacuum, IO_VALUE.LOW); IOMove(IO_Type.Label_Vacuum, IO_VALUE.LOW);
RotateEquip.TurnDegree(30);
break;
case MoveStep.Labeling52_2:
if (RotateEquip.TurnWork.IsCompleted)
{
LabelingMoveInfo.NextMoveStep(MoveStep.Labeling53);
RotateEquip.TurnDouble(); RotateEquip.TurnDouble();
}
break; break;
case MoveStep.Labeling53: case MoveStep.Labeling53:
if (RotateEquip.TurnWork.IsCompleted) if (RotateEquip.TurnWork.IsCompleted)
{ {
LabelingMoveInfo.NextMoveStep(MoveStep.Labeling54); LabelingMoveInfo.NextMoveStep(MoveStep.Labeling54);
RotateEquip.TurnDegree(-45);
//RotateEquip.TurnDouble();
} }
break; break;
case MoveStep.Labeling54: case MoveStep.Labeling54:
LabelingMoveInfo.NextMoveStep(MoveStep.Labeling55); if (RotateEquip.TurnWork.IsCompleted)
{
LabelingMoveInfo.NextMoveStep(MoveStep.Labeling56);
CylinderMove(null, IO_Type.Labeling_Down, IO_Type.Labeling_Up, IO_VALUE.HIGH); CylinderMove(null, IO_Type.Labeling_Down, IO_Type.Labeling_Up, IO_VALUE.HIGH);
//LabelingMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000)); //RotateEquip.TurnDegree(90);
RotateEquip.TurnDouble();
}
break; break;
case MoveStep.Labeling55: case MoveStep.Labeling55:
if (RotateEquip.TurnWork.IsCompleted)
{
LabelingMoveInfo.NextMoveStep(MoveStep.Labeling56); LabelingMoveInfo.NextMoveStep(MoveStep.Labeling56);
RotateEquip.TurnDegree(90); //RotateEquip.TurnDegree(90);
RotateEquip.TurnDouble();
//RotateEquip.TurnDouble();
}
break; break;
case MoveStep.Labeling56: case MoveStep.Labeling56:
if (RotateEquip.TurnWork.IsCompleted) if (RotateEquip.TurnWork.IsCompleted)
...@@ -240,7 +331,7 @@ namespace DeviceLibrary ...@@ -240,7 +331,7 @@ 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);
IOMove(IO_Type.Label_PasteBlow, IO_VALUE.LOW);
if (LabelingMoveInfo.MoveParam.IsNg) if (LabelingMoveInfo.MoveParam.IsNg)
Setting_Init.Runtime_Posid = "NG"; Setting_Init.Runtime_Posid = "NG";
} }
...@@ -397,7 +488,7 @@ namespace DeviceLibrary ...@@ -397,7 +488,7 @@ namespace DeviceLibrary
reelParam.SN = cs[5].Substring(1); reelParam.SN = cs[5].Substring(1);
reelParam.WareCode = rightcode; reelParam.WareCode = rightcode;
reelParam.ReeID = reelParam.SN; reelParam.ReeID = reelParam.SN;
reelParam.RFID = reelParam.SN.Substring(1); reelParam.RFID = "S"+reelParam.SN;
return true; return true;
} }
......
using CodeLibrary; using CodeLibrary;
using Newtonsoft.Json;
using OnlineStore; using OnlineStore;
using OnlineStore.Common; using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary; using OnlineStore.LoadCSVLibrary;
...@@ -6,6 +7,7 @@ using System; ...@@ -6,6 +7,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.Linq; using System.Linq;
using System.Security.Cryptography;
using System.Text; using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Threading; using System.Threading;
...@@ -19,6 +21,7 @@ namespace DeviceLibrary ...@@ -19,6 +21,7 @@ namespace DeviceLibrary
List<string> DemoTestList; List<string> DemoTestList;
int DemoTestIndex = 0; int DemoTestIndex = 0;
int DemoTestCount = 0; int DemoTestCount = 0;
bool issame = false;
void TFIDSelfTestProcess() void TFIDSelfTestProcess()
{ {
if (CheckWait(StoreMoveInfo)) if (CheckWait(StoreMoveInfo))
...@@ -27,84 +30,152 @@ namespace DeviceLibrary ...@@ -27,84 +30,152 @@ namespace DeviceLibrary
switch (StoreMoveInfo.MoveStep) switch (StoreMoveInfo.MoveStep)
{ {
case MoveStep.Wait: case MoveStep.Wait:
if (selfAuditMode&&!ServerCM.selfAudit)
{
StoreMoveInfo.log("自检模式结束");
selfAuditMode = false;
return;
}
StoreMoveInfo.NextMoveStep(MoveStep.StoreIn01);
StoreMoveInfo.log("自检模式开始");
break; break;
case MoveStep.StoreIn01: case MoveStep.StoreIn01:
if (IOValue(IO_Type.Out_Drawer).Equals(IO_VALUE.HIGH) && IOValue(IO_Type.Entry_Drawer).Equals(IO_VALUE.HIGH))
{
var slist = CameraPointTest.GetThingStoreName(TestStorePointPort.入口);
if (slist.Count == 0)
{
IOMove(IO_Type.Out_Drawer_Lock, IO_VALUE.HIGH);
IOMove(IO_Type.Entry_Drawer_Lock, IO_VALUE.HIGH);
StoreMoveInfo.NextMoveStep(MoveStep.StoreIn02); StoreMoveInfo.NextMoveStep(MoveStep.StoreIn02);
Y_Axis.AbsMove(StoreMoveInfo, Config.Y_Axis_P1, Config.Y_Axis_P1_speed); Y_Axis.AbsMove(StoreMoveInfo, 0, Config.Y_Axis_P1_speed);
X_Axis.AbsMove(StoreMoveInfo, Config.X_Axis_P1, Config.X_Axis_P1_speed); X_Axis.AbsMove(StoreMoveInfo, 0, Config.X_Axis_P1_speed);
}
else {
IOValue(IO_Type.Entry_Drawer_Lock).Equals(IO_VALUE.LOW);
Msg.add(crc.GetString("Res0174.f33f9554","开始自检时请清空入库抽屉"), MsgLevel.alarm);
}
}
else {
Msg.add(crc.GetString("Res0168.e90e8acf","开始自检时请关好抽屉"), MsgLevel.alarm);
}
break; break;
case MoveStep.StoreIn02: case MoveStep.StoreIn02:
StoreMoveInfo.NextMoveStep(MoveStep.StoreOut10); if (!ServerCM.selfAudit) {
if (IOManager.IOValue(IO_Type.Tside_Right).Equals(IO_VALUE.HIGH)) StoreMoveInfo.NextMoveStep(MoveStep.Wait);
DemoTestList = CameraPointTest.GetThingStoreName(TestStorePointPort.上层右侧);
else
DemoTestList = CameraPointTest.GetThingStoreName(TestStorePointPort.上层左侧);
if (DemoTestList.Count == 0)
return; return;
DemoTestIndex = 0; }
var job = ServerCM.SelfAudit_getNetPos();
break; if (job == null) {
case MoveStep.StoreOut10: Msg.add(crc.GetString("Res0169.ee0b269b","开始自检,但服务器没有返回正确库位信息."), MsgLevel.alarm);
if (IOValue(IO_Type.Out_Drawer).Equals(IO_VALUE.HIGH) && IOValue(IO_Type.Out_Drawer_Lock).Equals(IO_VALUE.HIGH)) }
else
{ {
StoreMoveInfo.NextMoveStep(MoveStep.StoreOut11); StoreMoveInfo.NextMoveStep(MoveStep.StoreIn03);
StoreMoveInfo.MoveParam.WareCode = job.WareNum;
StoreMoveInfo.MoveParam.PosID = job.PosId;
TestStorePointPort tspp = CameraPointTest.GetTestStorePointPort(job.PosId);
if (tspp == TestStorePointPort.上层左侧 || tspp == TestStorePointPort.下层右侧)
{
RobotManage.mainMachine.TPMove.ToLow(StoreMoveInfo);
StoreMoveInfo.log($"{job.WareNum},上层库位移至左侧");
} }
else if (IOValue(IO_Type.Out_Drawer).Equals(IO_VALUE.LOW) && IOValue(IO_Type.Out_Drawer_Lock).Equals(IO_VALUE.HIGH)) else if (tspp == TestStorePointPort.下层左侧)
{ {
IOMove(IO_Type.Out_Drawer_Lock, IO_VALUE.LOW); RobotManage.mainMachine.TPMove.ToHigh(StoreMoveInfo);
StoreMoveInfo.log($"{job.WareNum},上层库位移至右侧");
} }
else if (IOValue(IO_Type.Out_Drawer).Equals(IO_VALUE.LOW))
}
break;
case MoveStep.StoreIn03:
StoreMoveInfo.NextMoveStep(MoveStep.StoreOut10);
{ {
Msg.add(crc.GetString("Res0137","出库任务正在执行,请关好抽屉"), MsgLevel.warning); var tspp = CameraPointTest.GetTestStorePointPort(StoreMoveInfo.MoveParam.PosID);
var slist = CameraPointTest.GetThingStoreName(tspp);
var hasthing = slist.Contains(StoreMoveInfo.MoveParam.PosID);
if (!hasthing)
{
StoreMoveInfo.NextMoveStep(MoveStep.StoreIn02);
ServerCM.SelfAudit_posSelfAuditEnd(StoreMoveInfo.MoveParam.PosID, "", "");
StoreMoveInfo.log($"自检:{StoreMoveInfo.MoveParam.PosID},没有物料");
return;
} }
else {
IOMove(IO_Type.Out_Drawer_Lock, IO_VALUE.HIGH);
} }
break; break;
case MoveStep.StoreOut11: case MoveStep.StoreOut10:
StoreMoveInfo.NextMoveStep(MoveStep.StoreOut12); StoreMoveInfo.NextMoveStep(MoveStep.StoreOut11);
var from = CSVPositionReader<ACStorePosition>.GetPositon(DemoTestList[DemoTestIndex]); var from = CSVPositionReader<ACStorePosition>.GetPositon(StoreMoveInfo.MoveParam.PosID);
var to = CSVPositionReader<ACStorePosition>.GetPositon(RFIDP); var to = CSVPositionReader<ACStorePosition>.GetPositon(RFIDP);
StoreMoveInfo.MoveParam.ReelOnFixture = false; StoreMoveInfo.MoveParam.ReelOnFixture = false;
boxTransport.Start(new BoxStorePosition(Config, from, StoreMoveInfo.MoveParam), new BoxStorePosition(Config, to, StoreMoveInfo.MoveParam), StoreMoveType.OutStore, true); boxTransport.Start(new BoxStorePosition(Config, from, StoreMoveInfo.MoveParam), new BoxStorePosition(Config, to, StoreMoveInfo.MoveParam), StoreMoveType.OutStore, true);
boxTransport.isSelfAudit= true;
StoreMoveInfo.log($"开始转运出库"); StoreMoveInfo.log($"开始转运出库");
break; break;
case MoveStep.StoreOut11:
case MoveStep.StoreOut12: case MoveStep.StoreOut12:
if (boxTransport.IsComplateOrFree) if (boxTransport.IsComplateOrFree)
{ {
bool issame = false; if (!boxTransport.CheckHasMatetial)
{
StoreMoveInfo.NextMoveStep(MoveStep.StoreIn02);
ServerCM.SelfAudit_posSelfAuditEnd(StoreMoveInfo.MoveParam.PosID, "", "");
StoreMoveInfo.log($"自检:{StoreMoveInfo.MoveParam.PosID},没有物料");
return;
}
ServerCM.SelfAudit_posOutEnd(StoreMoveInfo.MoveParam.PosID);
issame = false;
string ds=""; string ds="";
for (int i = 0; i < 15; i++) for (int i = 0; i < 15; i++)
{ {
if (RobotManage.RFID.ReadEPC(12, out byte[] data)) if (RobotManage.RFID.ReadEPC(16, out byte[] data))
{ {
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 (!string.IsNullOrEmpty(ds))
{ {
StoreMoveInfo.MoveParam.RFID = ds; StoreMoveInfo.MoveParam.RFID = ds;
StoreMoveInfo.log("读取到 RFID:" + ds + " , "+ RobotManage.RFID.HexBuff(data)); StoreMoveInfo.log("读取到 RFID:" + ds + " , " + RobotManage.RFID.HexBuff(data));
if (StoreMoveInfo.MoveParam.WareCode.IndexOf(ds) > -1)
{
issame = true; issame = true;
break; break;
} }
} }
} }
Thread.Sleep(200);
} }
if (!issame) {
if (!issame) if (RobotManage.RFID2.ReadEPC(16, out data))
{
if (data[0] != 0xFF)
{
ds = Encoding.ASCII.GetString(data).Trim();
if (!string.IsNullOrEmpty(ds))
{
StoreMoveInfo.MoveParam.RFID = ds;
StoreMoveInfo.log("读取到 RFID2:" + ds + " , " + RobotManage.RFID.HexBuff(data));
if (StoreMoveInfo.MoveParam.WareCode.IndexOf(ds) > -1)
{ {
//StoreMoveInfo.log("读取到 RFID:" + ds); issame = true;
//Msg.add("读取到的RFID与物料信息不符:" + ds, MsgLevel.alarm); break;
//RobotManage.UserPause("读取到的RFID与物料信息不符"); }
}
}
}
}
Thread.Sleep(200);
} }
StoreMoveInfo.NextMoveStep(MoveStep.StoreOut13); StoreMoveInfo.NextMoveStep(MoveStep.StoreOut13);
from = CSVPositionReader<ACStorePosition>.GetPositon(RFIDP); from = CSVPositionReader<ACStorePosition>.GetPositon(RFIDP);
to = CSVPositionReader<ACStorePosition>.GetPositon(DemoTestList[DemoTestIndex]); to = CSVPositionReader<ACStorePosition>.GetPositon(StoreMoveInfo.MoveParam.PosID);
StoreMoveInfo.MoveParam.ReelOnFixture = true; StoreMoveInfo.MoveParam.ReelOnFixture = true;
boxTransport.Start(new BoxStorePosition(Config, from, StoreMoveInfo.MoveParam), new BoxStorePosition(Config, to, StoreMoveInfo.MoveParam), StoreMoveType.OutStore, true); boxTransport.Start(new BoxStorePosition(Config, from, StoreMoveInfo.MoveParam), new BoxStorePosition(Config, to, StoreMoveInfo.MoveParam), StoreMoveType.OutStore, true);
StoreMoveInfo.log($"开始转运出库"); StoreMoveInfo.log($"开始转运出库");
...@@ -113,11 +184,26 @@ namespace DeviceLibrary ...@@ -113,11 +184,26 @@ namespace DeviceLibrary
case MoveStep.StoreOut13: case MoveStep.StoreOut13:
if (boxTransport.IsComplateOrFree) if (boxTransport.IsComplateOrFree)
{ {
StoreMoveInfo.NextMoveStep(MoveStep.StoreOut11); StoreMoveInfo.NextMoveStep(MoveStep.StoreIn01);
DemoTestIndex++; if (!issame)
if (DemoTestIndex >= DemoTestList.Count) {
DemoTestIndex = 0; var crfid = StoreMoveInfo.MoveParam.RFID;
DemoTestCount++; if (string.IsNullOrEmpty(crfid))
{
crfid = "Rfid read fail";
StoreMoveInfo.MoveParam.NgMsg = "Rfid read fail";
}else
StoreMoveInfo.MoveParam.NgMsg = crc.GetString("Res0175.61bd5a58","RFID不符");
NGInfoList.Add(StoreMoveInfo.MoveParam.clone());
ServerCM.SelfAudit_posSelfAuditEnd(StoreMoveInfo.MoveParam.PosID, StoreMoveInfo.MoveParam.WareCode, crfid);
StoreMoveInfo.log($"自检:{StoreMoveInfo.MoveParam.PosID},{StoreMoveInfo.MoveParam.WareCode}!={StoreMoveInfo.MoveParam.RFID}物料数据不符");
}
else
{
ServerCM.SelfAudit_posSelfAuditEnd(StoreMoveInfo.MoveParam.PosID, StoreMoveInfo.MoveParam.WareCode, StoreMoveInfo.MoveParam.WareCode);
StoreMoveInfo.log($"自检:{StoreMoveInfo.MoveParam.PosID},{StoreMoveInfo.MoveParam.WareCode}=={StoreMoveInfo.MoveParam.RFID}物料数据符合");
}
} }
break; break;
default: default:
......
...@@ -16,20 +16,27 @@ namespace DeviceLibrary ...@@ -16,20 +16,27 @@ namespace DeviceLibrary
{ {
partial class MainMachine partial class MainMachine
{ {
public const string LabelP = "LabelP"; public const string LabelP = "LabelP";
public const string RFIDP = "RFIDP"; public const string RFIDP = "RFIDP";
StoreJobList OutStoreJobList = new StoreJobList(crc.GetString("Res0108", "批量")); StoreJobList OutStoreJobList = new StoreJobList(crc.GetString("Res0108", "批量"));
public bool HasJob { get => OutStoreJobList.Count > 0; } public bool HasJob { get => OutStoreJobList.Count > 0; }
public void AddOutStoreTask(string warecode, string posId) public void AddOutStoreTask(string warecode, string posId,bool ngReel, string ngMsg)
{ {
JobInfo jobInfo = new JobInfo(warecode, posId); JobInfo jobInfo = new JobInfo(warecode, posId);
jobInfo.isNG = ngReel;
jobInfo.NgMsg = ngMsg;
OutStoreJobList.Enqueue(jobInfo); OutStoreJobList.Enqueue(jobInfo);
LogUtil.info($"添加出库任务队列: {posId},当前任务数量: {OutStoreJobList.Count}"); LogUtil.info($"添加出库任务队列: {posId},当前任务数量: {OutStoreJobList.Count}");
} }
public bool IsInStoreReady { get => true; } public bool IsInStoreReady { get => true; }
List<string> nglist = new List<string>(); List<string> nglist = new List<string>();
/// <summary>
/// 是否新入抽屉
/// </summary>
public bool newDrawer=true;
void StoreDemoProcess() void StoreDemoProcess()
{ {
...@@ -41,7 +48,7 @@ namespace DeviceLibrary ...@@ -41,7 +48,7 @@ namespace DeviceLibrary
case MoveStep.Wait: case MoveStep.Wait:
StoreMoveInfo.MoveParam.ReelOnFixture = false; StoreMoveInfo.MoveParam.ReelOnFixture = false;
if (IOValue(IO_Type.Taking_Clamp).Equals(IO_VALUE.LOW)) { if (IOValue(IO_Type.Taking_Clamp).Equals(IO_VALUE.LOW)) {
if (Setting_Init.Runtime_Step == Runtime_StepE.LabelProcess) if (false && Setting_Init.Runtime_Step == Runtime_StepE.LabelProcess)
{ {
StoreMoveInfo.log("检测到上次正在贴标:" + Setting_Init.Runtime_Step + "," + Setting_Init.Runtime_Posid + "," + Setting_Init.Runtime_FromPosid); StoreMoveInfo.log("检测到上次正在贴标:" + Setting_Init.Runtime_Step + "," + Setting_Init.Runtime_Posid + "," + Setting_Init.Runtime_FromPosid);
if (!string.IsNullOrEmpty(Setting_Init.Runtime_FromPosid)) if (!string.IsNullOrEmpty(Setting_Init.Runtime_FromPosid))
...@@ -57,12 +64,14 @@ namespace DeviceLibrary ...@@ -57,12 +64,14 @@ namespace DeviceLibrary
return; return;
} }
else if (Setting_Init.Runtime_Step == Runtime_StepE.LabelPasteFinish) else if (Setting_Init.Runtime_Step >= Runtime_StepE.LabelProcess && Setting_Init.Runtime_Step <= Runtime_StepE.LabelPasteFinish)
{ {
StoreMoveInfo.log("检测到上次已完成贴标:" + Setting_Init.Runtime_Step + "," + Setting_Init.Runtime_Posid + "," + Setting_Init.Runtime_RFID); StoreMoveInfo.log("检测到上次已完成贴标:" + Setting_Init.Runtime_Step + "," + Setting_Init.Runtime_Posid + "," + Setting_Init.Runtime_RFID);
StoreMoveInfo.NewMove(MoveStep.StoreIn03); StoreMoveInfo.NewMove(MoveStep.StoreIn03);
if (Setting_Init.Runtime_Posid.Val == "NG") if (Setting_Init.Runtime_Posid.Val == "NG")
LabelingMoveInfo.MoveParam.IsNg = true; LabelingMoveInfo.MoveParam.IsNg = true;
LabelingMoveInfo.MoveParam.PosID = Setting_Init.Runtime_Posid;
LabelingMoveInfo.MoveParam.RFID = Setting_Init.Runtime_RFID;
StoreMoveInfo.MoveParam.PosID = Setting_Init.Runtime_Posid; StoreMoveInfo.MoveParam.PosID = Setting_Init.Runtime_Posid;
StoreMoveInfo.MoveParam.RFID = Setting_Init.Runtime_RFID; StoreMoveInfo.MoveParam.RFID = Setting_Init.Runtime_RFID;
return; return;
...@@ -93,6 +102,10 @@ namespace DeviceLibrary ...@@ -93,6 +102,10 @@ namespace DeviceLibrary
//StoreMoveInfo.log($"检测到入库抽屉已锁定"); //StoreMoveInfo.log($"检测到入库抽屉已锁定");
} }
Setting_Init.Runtime_Step = Runtime_StepE.None; Setting_Init.Runtime_Step = Runtime_StepE.None;
if (ServerCM.selfAudit) {
selfAuditMode = true;
}
return; return;
} }
if (Setting_Init.Runtime_Step!= Runtime_StepE.None) if (Setting_Init.Runtime_Step!= Runtime_StepE.None)
...@@ -178,7 +191,7 @@ namespace DeviceLibrary ...@@ -178,7 +191,7 @@ namespace DeviceLibrary
if (StoreMoveInfo.MoveParam.IsNg) if (StoreMoveInfo.MoveParam.IsNg)
{ {
StoreMoveInfo.NextMoveStep(MoveStep.StoreIn06); StoreMoveInfo.NextMoveStep(MoveStep.StoreIn08);
StoreMoveInfo.log($"收到完成贴标NG"); StoreMoveInfo.log($"收到完成贴标NG");
} }
else else
...@@ -217,16 +230,22 @@ namespace DeviceLibrary ...@@ -217,16 +230,22 @@ namespace DeviceLibrary
case MoveStep.StoreIn05: case MoveStep.StoreIn05:
if (boxTransport.IsComplateOrFree) if (boxTransport.IsComplateOrFree)
{ {
if (StoreMoveInfo.MoveParam.RFID.Length > 12) if (StoreMoveInfo.MoveParam.RFID.Length > 16)
StoreMoveInfo.MoveParam.RFID = StoreMoveInfo.MoveParam.RFID.Substring(0, 12); StoreMoveInfo.MoveParam.RFID = StoreMoveInfo.MoveParam.RFID.Substring(0, 16);
bool writeok = false; bool writeok = false;
var r=RobotManage.RFID.ReOpen();
var r1=RobotManage.RFID2.ReOpen();
StoreMoveInfo.log("连接rfid:" + r+ "rfid2:" + r1);
for (int i = 0; i < 15; i++) for (int i = 0; i < 15; i++)
{ {
if (string.IsNullOrEmpty(StoreMoveInfo.MoveParam.RFID)) if (string.IsNullOrEmpty(StoreMoveInfo.MoveParam.RFID))
break; break;
RobotManage.RFID.WriteEPC(Encoding.ASCII.GetBytes(StoreMoveInfo.MoveParam.RFID)); var epc = StoreMoveInfo.MoveParam.RFID.PadRight(16);
RobotManage.RFID.WriteByte(550, new byte[] { 0x40, 0x00 });
Thread.Sleep(300);
RobotManage.RFID.WriteEPC(Encoding.ASCII.GetBytes(epc));
Thread.Sleep(500); Thread.Sleep(500);
if (RobotManage.RFID.ReadEPC(12, out byte[] data)) if (RobotManage.RFID.ReadEPC(16, out byte[] data))
{ {
if (data[0] != 0xFF) if (data[0] != 0xFF)
{ {
...@@ -243,9 +262,33 @@ namespace DeviceLibrary ...@@ -243,9 +262,33 @@ namespace DeviceLibrary
} }
} }
} }
if (!writeok) {
RobotManage.RFID2.WriteByte(550, new byte[] { 0x40, 0x00 });
Thread.Sleep(300);
RobotManage.RFID2.WriteEPC(Encoding.ASCII.GetBytes(epc));
Thread.Sleep(500);
if (RobotManage.RFID2.ReadEPC(16, out data))
{
if (data[0] != 0xFF)
{
var ds = Encoding.ASCII.GetString(data).Trim();
if (ds == StoreMoveInfo.MoveParam.RFID)
{
StoreMoveInfo.log("RFID2 写入成功:" + ds);
writeok = true;
break;
}
else
{
StoreMoveInfo.log("失败的 RFID2:" + ds);
}
}
}
}
if (!writeok) if (!writeok)
{ {
var of = i * 1000 * (i % 2 == 0 ? 1 : -1); var of = i * 2000 * (i % 2 == 0 ? 1 : -1);
var zp = Z_Axis.GetAclPosition() + of; var zp = Z_Axis.GetAclPosition() + of;
var yp = Y_Axis.GetAclPosition() + of; var yp = Y_Axis.GetAclPosition() + of;
var zt = Z_Axis.AbsMoveASYNC(zp, Config.Z_Axis_P1_speed); var zt = Z_Axis.AbsMoveASYNC(zp, Config.Z_Axis_P1_speed);
...@@ -255,14 +298,13 @@ namespace DeviceLibrary ...@@ -255,14 +298,13 @@ namespace DeviceLibrary
//Thread.Sleep(100); //Thread.Sleep(100);
} }
if (!writeok) { if (!writeok) {
StoreMoveInfo.NextMoveStep(MoveStep.StoreIn06); StoreMoveInfo.NextMoveStep(MoveStep.StoreIn08);
StoreMoveInfo.MoveParam.ReelOnFixture = true; StoreMoveInfo.MoveParam.ReelOnFixture = true;
StoreMoveInfo.MoveParam.IsNg = true; StoreMoveInfo.MoveParam.IsNg = true;
StoreMoveInfo.MoveParam.NgMsg = crc.GetString("Res0139", "RFID 写入失败"); StoreMoveInfo.MoveParam.NgMsg = crc.GetString("Res0139", "RFID 写入失败");
StoreMoveInfo.log($"RFID 写入失败 NG"); StoreMoveInfo.log($"RFID 写入失败 NG");
ServerCM.cancelPutInTask("", StoreMoveInfo.MoveParam.WareCode); ServerCM.cancelPutInTask("", StoreMoveInfo.MoveParam.WareCode);
//Msg.add(crc.GetString("Res0139","RFID 写入失败"),MsgLevel.alarm); Z_Axis.AbsMove(StoreMoveInfo, Config.Z_Axis_P1, Config.Z_Axis_P1_speed);
//RobotManage.UserPause(crc.GetString("Res0139","RFID 写入失败"));
return; return;
} }
...@@ -303,7 +345,7 @@ namespace DeviceLibrary ...@@ -303,7 +345,7 @@ namespace DeviceLibrary
// StoreMoveInfo.log($"检测到空库位:{outposid}, 其他空库位:{string.Join(",", olist)}"); // StoreMoveInfo.log($"检测到空库位:{outposid}, 其他空库位:{string.Join(",", olist)}");
//} //}
//nglist.Add(outposid); //nglist.Add(outposid);
ServerCM.cancelPutInTask("", StoreMoveInfo.MoveParam.PosID); ServerCM.cancelPutInTask("", StoreMoveInfo.MoveParam.WareCode);
nglist.Add(Setting_Init.Runtime_FromPosid); nglist.Add(Setting_Init.Runtime_FromPosid);
StoreMoveInfo.MoveParam.PosID = Setting_Init.Runtime_FromPosid; StoreMoveInfo.MoveParam.PosID = Setting_Init.Runtime_FromPosid;
StoreMoveInfo.NextMoveStep(MoveStep.StoreIn09); StoreMoveInfo.NextMoveStep(MoveStep.StoreIn09);
...@@ -322,8 +364,11 @@ namespace DeviceLibrary ...@@ -322,8 +364,11 @@ namespace DeviceLibrary
case MoveStep.StoreIn09: case MoveStep.StoreIn09:
if (boxTransport.IsComplateOrFree) if (boxTransport.IsComplateOrFree)
{ {
if(!StoreMoveInfo.MoveParam.IsNg) if (!StoreMoveInfo.MoveParam.IsNg)
ServerCM.SendStoreState(StoreMoveInfo.MoveParam.PosID, StoreStatus.InStoreEnd); {
if (!ServerCM.SendStoreState(StoreMoveInfo.MoveParam.PosID, StoreStatus.InStoreEnd))
{ }
}
if (OutStoreJobList.Count==0) if (OutStoreJobList.Count==0)
StoreMoveInfo.NewMove(MoveStep.StoreIn01); StoreMoveInfo.NewMove(MoveStep.StoreIn01);
else else
...@@ -344,7 +389,7 @@ namespace DeviceLibrary ...@@ -344,7 +389,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(crc.GetString("Res0137","出库任务正在执行,请关好抽屉"), MsgLevel.warning); Msg.add(crc.GetString("Res0137","出库任务正在执行,请关好抽屉"), MsgLevel.alarm);
} }
else { else {
IOMove(IO_Type.Out_Drawer_Lock, IO_VALUE.HIGH); IOMove(IO_Type.Out_Drawer_Lock, IO_VALUE.HIGH);
...@@ -357,9 +402,12 @@ namespace DeviceLibrary ...@@ -357,9 +402,12 @@ namespace DeviceLibrary
Setting_Init.Runtime_WareCode = StoreMoveInfo.MoveParam.WareCode; Setting_Init.Runtime_WareCode = StoreMoveInfo.MoveParam.WareCode;
{ {
var outposid=""; var outposid="";
if (!ServerCM.selfAuditException)
{
var olist = CameraPointTest.GetThingStoreName(TestStorePointPort.出口); var olist = CameraPointTest.GetThingStoreName(TestStorePointPort.出口);
StoreMoveInfo.log($"检测到出库口有料库位:{string.Join(",", olist)}"); StoreMoveInfo.log($"检测到出库口有料库位:{string.Join(",", olist)}");
olist = RobotManage.AllPositionMapNumList.ToList().Where(p => { return p.StartsWith("U") && !olist.Contains(p); }).ToList(); olist = RobotManage.AllPositionMapNumList.ToList().Where(p => { return p.StartsWith("U") && !olist.Contains(p); }).ToList();
olist.Reverse();
if (olist.Count == 0) if (olist.Count == 0)
{ {
OutStoreJobList.ClearLastPosid(); OutStoreJobList.ClearLastPosid();
...@@ -372,10 +420,43 @@ namespace DeviceLibrary ...@@ -372,10 +420,43 @@ namespace DeviceLibrary
outposid = olist[0]; outposid = olist[0];
StoreMoveInfo.log($"检测到出库位有料:{outposid}, 其他有料出库位:{string.Join(",", olist)}"); StoreMoveInfo.log($"检测到出库位有料:{outposid}, 其他有料出库位:{string.Join(",", olist)}");
} }
StoreMoveInfo.MoveParam.IsNg = false;
}
else {
var olist = CameraPointTest.GetThingStoreName(TestStorePointPort.入口);
StoreMoveInfo.log($"检测到入库口有料库位:{string.Join(",", olist)}");
olist = RobotManage.AllPositionMapNumList.ToList().Where(p => { return p.StartsWith("L") && !p.StartsWith("La") && !olist.Contains(p); }).ToList();
StoreMoveInfo.log($"检测到入库口无料库位:{string.Join(",", olist)}");
if (olist.Count == 0)
{
OutStoreJobList.ClearLastPosid();
StoreMoveInfo.NextMoveStep(MoveStep.Wait);
StoreMoveInfo.log($"没有检测到NG出库未有空位");
return;
}
else
{
outposid = olist[0];
StoreMoveInfo.log($"检测到NG出库可用:{outposid}, 其他NG可用出库位:{string.Join(",", olist)}");
}
StoreMoveInfo.MoveParam.IsNg = true;
StoreMoveInfo.MoveParam.dateTime = DateTime.Now;
var n = StoreMoveInfo.MoveParam.clone();
n.PosID = outposid;
NGInfoList.Add(n);
Setting_Init.Runtime_NGINFOLIST = JsonConvert.SerializeObject(NGInfoList);
}
StoreMoveInfo.NextMoveStep(MoveStep.StoreOut11); StoreMoveInfo.NextMoveStep(MoveStep.StoreOut11);
from = CSVPositionReader<ACStorePosition>.GetPositon(inposid); from = CSVPositionReader<ACStorePosition>.GetPositon(inposid);
if (StoreMoveInfo.MoveParam.IsNg)
{
StoreMoveInfo.NextMoveStep(MoveStep.StoreOut12);
to = CSVPositionReader<ACStorePosition>.GetPositon(outposid);//NG出库直接去入口库位
}
else
{
to = CSVPositionReader<ACStorePosition>.GetPositon(RFIDP); to = CSVPositionReader<ACStorePosition>.GetPositon(RFIDP);
}
StoreMoveInfo.MoveParam.OutPosID = outposid; StoreMoveInfo.MoveParam.OutPosID = outposid;
//StoreMoveInfo.MoveParam.ReelOnFixture = false; //StoreMoveInfo.MoveParam.ReelOnFixture = false;
boxTransport.Start(new BoxStorePosition(Config, from, StoreMoveInfo.MoveParam), new BoxStorePosition(Config, to, StoreMoveInfo.MoveParam), StoreMoveType.OutStore, true); boxTransport.Start(new BoxStorePosition(Config, from, StoreMoveInfo.MoveParam), new BoxStorePosition(Config, to, StoreMoveInfo.MoveParam), StoreMoveType.OutStore, true);
...@@ -391,7 +472,7 @@ namespace DeviceLibrary ...@@ -391,7 +472,7 @@ namespace DeviceLibrary
string ds=""; string ds="";
for (int i = 0; i < 15; i++) for (int i = 0; i < 15; i++)
{ {
if (RobotManage.RFID.ReadEPC(12, out byte[] data)) if (RobotManage.RFID.ReadEPC(16, out byte[] data))
{ {
if (data[0] != 0xFF) if (data[0] != 0xFF)
{ {
...@@ -403,7 +484,22 @@ namespace DeviceLibrary ...@@ -403,7 +484,22 @@ namespace DeviceLibrary
issame = true; issame = true;
break; break;
} }
}
}
if (!issame) {
if (RobotManage.RFID2.ReadEPC(16, out data))
{
if (data[0] != 0xFF)
{
ds = Encoding.ASCII.GetString(data).Trim();
if (StoreMoveInfo.MoveParam.WareCode.IndexOf(ds) > -1)
{
StoreMoveInfo.MoveParam.RFID = ds;
StoreMoveInfo.log("读取到 RFID2:" + ds + " , " + RobotManage.RFID2.HexBuff(data));
issame = true;
break;
}
}
} }
} }
Thread.Sleep(200); Thread.Sleep(200);
...@@ -412,7 +508,7 @@ namespace DeviceLibrary ...@@ -412,7 +508,7 @@ namespace DeviceLibrary
if (!issame) if (!issame)
{ {
StoreMoveInfo.log("读取到 RFID:" + ds); StoreMoveInfo.log("读取到 RFID:" + ds);
Msg.add(crc.GetString("Res0140","读取到的RFID与物料信息不符:") + ds, MsgLevel.alarm); Msg.add("rfid.nomatch", crc.GetString("Res0140","读取到的RFID与物料信息不符:") + ds, MsgLevel.alarm);
RobotManage.UserPause(crc.GetString("Res0141","读取到的RFID与物料信息不符")); RobotManage.UserPause(crc.GetString("Res0141","读取到的RFID与物料信息不符"));
} }
...@@ -427,23 +523,41 @@ namespace DeviceLibrary ...@@ -427,23 +523,41 @@ namespace DeviceLibrary
case MoveStep.StoreOut12: case MoveStep.StoreOut12:
if (boxTransport.IsComplateOrFree) if (boxTransport.IsComplateOrFree)
{ {
ServerCM.SendStoreState(StoreMoveInfo.MoveParam.PosID, StoreStatus.OutStoreBoxEnd);
ServerCM.SendStoreState(StoreMoveInfo.MoveParam.PosID, StoreStatus.OutStoreEnd); ServerCM.SendStoreState(StoreMoveInfo.MoveParam.PosID, StoreStatus.OutStoreEnd);
StoreMoveInfo.log("出库完成"); StoreMoveInfo.log("出库完成");
StoreMoveInfo.NextMoveStep(MoveStep.Wait); StoreMoveInfo.NextMoveStep(MoveStep.Wait);
OutStoreJobList.ClearLastPosid(); OutStoreJobList.ClearLastPosid();
if (!StoreMoveInfo.MoveParam.IsNg)
{
var olist = CameraPointTest.GetThingStoreName(TestStorePointPort.出口); var olist = CameraPointTest.GetThingStoreName(TestStorePointPort.出口);
StoreMoveInfo.log($"检测到出库口有料库位:{string.Join(",", olist)}"); StoreMoveInfo.log($"检测到出库口有料库位:{string.Join(",", olist)}");
olist = RobotManage.AllPositionMapNumList.ToList().Where(p => { return p.StartsWith("U") && !olist.Contains(p); }).ToList(); olist = RobotManage.AllPositionMapNumList.ToList().Where(p => { return p.StartsWith("U") && !olist.Contains(p); }).ToList();
if (olist.Count == 0) { if (olist.Count == 0)
{
StoreMoveInfo.NextMoveStep(MoveStep.StoreOut13); StoreMoveInfo.NextMoveStep(MoveStep.StoreOut13);
StoreMoveInfo.log($"出库库位已用完"); StoreMoveInfo.log($"出库库位已用完");
} }
if (OutStoreJobList.Count==0) }
else {
var olist = CameraPointTest.GetThingStoreName(TestStorePointPort.入口);
StoreMoveInfo.log($"检测到NG出库口有料库位:{string.Join(",", olist)}");
olist = RobotManage.AllPositionMapNumList.ToList().Where(p => { return p.StartsWith("L") && !p.StartsWith("Lab") && !olist.Contains(p); }).ToList();
StoreMoveInfo.log($"检测到NG出库口无料库位:{string.Join(",", olist)}");
//if (olist.Count == 0)
{
StoreMoveInfo.NextMoveStep(MoveStep.Wait);
StoreMoveInfo.log($"NG出库库位已完成");
return;
}
}
if (OutStoreJobList.Count == 0)
{ {
StoreMoveInfo.NextMoveStep(MoveStep.StoreOut13); StoreMoveInfo.NextMoveStep(MoveStep.StoreOut13);
StoreMoveInfo.log($"没有出库任务了"); StoreMoveInfo.log($"没有出库任务了");
} }
} }
break; break;
case MoveStep.StoreOut13: case MoveStep.StoreOut13:
...@@ -480,7 +594,11 @@ namespace DeviceLibrary ...@@ -480,7 +594,11 @@ namespace DeviceLibrary
case MoveStep.StoreOut17: case MoveStep.StoreOut17:
if (IOValue(IO_Type.Out_Drawer).Equals(IO_VALUE.HIGH)) if (IOValue(IO_Type.Out_Drawer).Equals(IO_VALUE.HIGH))
{ {
StoreMoveInfo.log("抽屉已经上锁 newDrawer:"+ newDrawer);
if (!newDrawer)
StoreMoveInfo.NewMove(MoveStep.StoreIn01); StoreMoveInfo.NewMove(MoveStep.StoreIn01);
else
StoreMoveInfo.NewMove(MoveStep.Wait);
} }
else else
{ {
......
...@@ -131,6 +131,7 @@ namespace DeviceLibrary ...@@ -131,6 +131,7 @@ namespace DeviceLibrary
Labeling50, Labeling50,
Labeling51, Labeling51,
Labeling52, Labeling52,
Labeling52_2,
Labeling53, Labeling53,
Labeling54, Labeling54,
Labeling55, Labeling55,
......
...@@ -79,6 +79,7 @@ namespace DeviceLibrary ...@@ -79,6 +79,7 @@ namespace DeviceLibrary
//public static HIKCamera CameraD=new HIKCamera(); //public static HIKCamera CameraD=new HIKCamera();
public static DauxiKS107Controller dauxiKS107 = new DauxiKS107Controller(); public static DauxiKS107Controller dauxiKS107 = new DauxiKS107Controller();
public static PuYueRFID_FR540SP_C2S RFID = new PuYueRFID_FR540SP_C2S(); public static PuYueRFID_FR540SP_C2S RFID = new PuYueRFID_FR540SP_C2S();
public static PuYueRFID_FR540SP_C2S RFID2 = new PuYueRFID_FR540SP_C2S();
public static PrinterHelper printerHelper = new PrinterHelper(); public static PrinterHelper printerHelper = new PrinterHelper();
public static void Init() { public static void Init() {
string msg = ""; string msg = "";
...@@ -147,6 +148,14 @@ namespace DeviceLibrary ...@@ -147,6 +148,14 @@ namespace DeviceLibrary
else else
{ {
CameraA.Open(); CameraA.Open();
for (int i = 0; i < 4;i++) {
if (CameraA.GetImage(i) == null)
{
msg += string.Format(crc.GetString("Res0176.7352b919","第{0}个相机打开失败"), i) + "\r\n";
IsLoadOk = false;
}
}
} }
mainMachine = new MainMachine(RobotManage.Config); mainMachine = new MainMachine(RobotManage.Config);
if (!dauxiKS107.OpenPort(Setting_Init.Device_DauxiKS107_Port, out _)) { if (!dauxiKS107.OpenPort(Setting_Init.Device_DauxiKS107_Port, out _)) {
...@@ -172,7 +181,17 @@ namespace DeviceLibrary ...@@ -172,7 +181,17 @@ namespace DeviceLibrary
} }
else else
LogUtil.info("RFID连接成功,IP:"+ Setting_Init.Device_RFID_IP); LogUtil.info("RFID连接成功,IP:"+ Setting_Init.Device_RFID_IP);
//RFID.Init();
RFID2.IP = Setting_Init.Device_RFID_IP2;
RFID2.Open(Setting_Init.Device_RFID_IP2);
if (!RFID2.IsConn)
{
IsLoadOk = false;
msg += crc.GetString("Res0142","RFID2连接失败,IP:") + $"{Setting_Init.Device_RFID_IP2}\n";
}
else
LogUtil.info("RFID2连接成功,IP:"+ Setting_Init.Device_RFID_IP2);
//RFID.AntennaPower = 4; //RFID.AntennaPower = 4;
IOManager.IOMove(IO_Type.Camera_Led, IO_VALUE.HIGH); IOManager.IOMove(IO_Type.Camera_Led, IO_VALUE.HIGH);
......
...@@ -287,6 +287,11 @@ namespace DeviceLibrary ...@@ -287,6 +287,11 @@ namespace DeviceLibrary
{ {
return; return;
} }
if (!currentAxis.IsSafe(0, out string msg))
{
MessageBox.Show(msg);
return;
}
if (btnAddMove.BackColor.Equals(Color.White)) if (btnAddMove.BackColor.Equals(Color.White))
{ {
int speed = Convert.ToInt32(comjSpeed.Text); int speed = Convert.ToInt32(comjSpeed.Text);
...@@ -316,6 +321,11 @@ namespace DeviceLibrary ...@@ -316,6 +321,11 @@ namespace DeviceLibrary
{ {
return; return;
} }
if (!currentAxis.IsSafe(0, out string msg))
{
MessageBox.Show(msg);
return;
}
if (btnDelMove.BackColor.Equals(Color.White)) if (btnDelMove.BackColor.Equals(Color.White))
{ {
int speed = Convert.ToInt32(comjSpeed.Text); int speed = Convert.ToInt32(comjSpeed.Text);
......
...@@ -83,3 +83,5 @@ DO,0,锡膏旋转定位夹紧气缸夹紧,Tin_Dock_Rotate_Clamp,26,HC,Y26,,,,,,,,,, ...@@ -83,3 +83,5 @@ DO,0,锡膏旋转定位夹紧气缸夹紧,Tin_Dock_Rotate_Clamp,26,HC,Y26,,,,,,,,,,
DO,0,锡膏翻转机构前进,Tin_Dock_Right,27,HC,Y27,,,,,,,,,, DO,0,锡膏翻转机构前进,Tin_Dock_Right,27,HC,Y27,,,,,,,,,,
DO,0,锡膏翻转机构后退,Tin_Dock_Left,28,HC,Y28,,,,,,,,,, DO,0,锡膏翻转机构后退,Tin_Dock_Left,28,HC,Y28,,,,,,,,,,
DO,0,标签吸盘取料,Label_Vacuum,29,HC,Y29,,,,,,,,,, DO,0,标签吸盘取料,Label_Vacuum,29,HC,Y29,,,,,,,,,,
DO,0,标签出标吹气,Label_TakeBlow,30,HC,Y30,,,,,,,,,,
DO,0,标签贴标吹气,Label_PasteBlow,31,HC,Y31,,,,,,,,,,
\ No newline at end of file \ No newline at end of file
...@@ -213,6 +213,15 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -213,6 +213,15 @@ namespace OnlineStore.LoadCSVLibrary
public static string Label_Vacuum = "Label_Vacuum"; public static string Label_Vacuum = "Label_Vacuum";
/// <summary>
/// DO,0,标签出标吹气,Label_TakeBlow,30,HC,Y30,,,,,,,,,,
/// </summary>
public static string Label_TakeBlow = "Label_TakeBlow";
/// <summary>
/// DO,0,标签贴标吹气,Label_PasteBlow,31,HC,Y31,,,,,,,,,,
/// </summary>
public static string Label_PasteBlow = "Label_PasteBlow";
} }
public enum IO_VALUE public enum IO_VALUE
{ {
......
...@@ -430,10 +430,11 @@ namespace TheMachine ...@@ -430,10 +430,11 @@ namespace TheMachine
} }
else if (msg.errInfo == ErrInfo.LabelInPaste) else if (msg.errInfo == ErrInfo.LabelInPaste)
{ {
RobotManage.mainMachine.IOMove(IO_Type.PrinterDoor_Lock, IO_VALUE.LOW);
if (FrmAlarm.ShowAlarmDialog(crc.GetString("Res0143","贴标区内可能有物料未完成贴标,请手动取出")) == 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;
RobotManage.UserPause(false); RobotManage.UserPause(false);
} }
else { else {
......
...@@ -79,6 +79,7 @@ namespace TheMachine ...@@ -79,6 +79,7 @@ namespace TheMachine
this.Name = "FrmAlarm"; this.Name = "FrmAlarm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "FrmAlarm"; this.Text = "FrmAlarm";
this.Load += new System.EventHandler(this.FrmAlarm_Load);
this.ResumeLayout(false); this.ResumeLayout(false);
} }
......
using System; using OnlineStore;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Data; using System.Data;
...@@ -34,5 +35,10 @@ namespace TheMachine ...@@ -34,5 +35,10 @@ namespace TheMachine
DialogResult = DialogResult.OK; DialogResult = DialogResult.OK;
Close(); Close();
} }
private void FrmAlarm_Load(object sender, EventArgs e)
{
crc.LanguageProcess(this);
}
} }
} }
...@@ -118,7 +118,6 @@ namespace TheMachine ...@@ -118,7 +118,6 @@ namespace TheMachine
this.button10.TabIndex = 6; this.button10.TabIndex = 6;
this.button10.Text = "写入RFID EPC"; this.button10.Text = "写入RFID EPC";
this.button10.UseVisualStyleBackColor = false; this.button10.UseVisualStyleBackColor = false;
this.button10.Visible = false;
this.button10.Click += new System.EventHandler(this.button10_Click); this.button10.Click += new System.EventHandler(this.button10_Click);
// //
// button9 // button9
......
...@@ -88,12 +88,23 @@ namespace TheMachine ...@@ -88,12 +88,23 @@ namespace TheMachine
private void button9_Click(object sender, EventArgs e) private void button9_Click(object sender, EventArgs e)
{ {
var r= RobotManage.RFID.ReOpen();
RobotManage.RFID2.ReOpen();
LogUtil.info("RFID.ReOpen:" + r);
for (int i = 0; i < 6;i++) { for (int i = 0; i < 6;i++) {
Thread.Sleep(200); Thread.Sleep(200);
if (RobotManage.RFID.ReadEPC(12,out byte[] data)) { if (RobotManage.RFID.ReadEPC(16,out byte[] data)) {
if (data[0] != 0xFF) if (data[0] != 0xFF)
{ {
MessageBox.Show(RobotManage.RFID.HexBuff(data) + "\r\n" + Encoding.ASCII.GetString(data).Trim()); MessageBox.Show("RFID:"+Encoding.ASCII.GetString(data).Trim());
return;
}
}
if (RobotManage.RFID2.ReadEPC(16, out data))
{
if (data[0] != 0xFF)
{
MessageBox.Show("RFID2:" + RobotManage.RFID2.HexBuff(data) + "\r\n" + Encoding.ASCII.GetString(data).Trim());
return; return;
} }
} }
...@@ -103,16 +114,82 @@ namespace TheMachine ...@@ -103,16 +114,82 @@ namespace TheMachine
private void button10_Click(object sender, EventArgs e) private void button10_Click(object sender, EventArgs e)
{ {
var epc = InputBox("Write EPC, maximum 16 words.", "Please enter EPC data, maximum 16 words.", "");
var r = RobotManage.RFID.ReOpen();
RobotManage.RFID2.ReOpen();
LogUtil.info("RFID.ReOpen:" + r+",epc="+ epc);
epc = epc.PadRight(16);
RobotManage.RFID.WriteByte(550, new byte[] { 0x40, 0x00 });
Thread.Sleep(300); Thread.Sleep(300);
var epc = "20418002Z-203";
epc = "20418002Z-20";
epc = epc.PadRight(12);
var result = RobotManage.RFID.WriteEPC(Encoding.ASCII.GetBytes(epc)); var result = RobotManage.RFID.WriteEPC(Encoding.ASCII.GetBytes(epc));
result = RobotManage.RFID2.WriteEPC(Encoding.ASCII.GetBytes(epc));
if (result) if (result)
{ {
MessageBox.Show(crc.GetString("Res0144","写入成功")); MessageBox.Show(crc.GetString("Res0144","写入成功"));
return; return;
} }
} }
private string InputBox(string Caption, string Hint, string Default)
{
Form InputForm = new Form();
InputForm.MinimizeBox = false;
InputForm.MaximizeBox = false;
InputForm.StartPosition = FormStartPosition.CenterScreen;
InputForm.Width = 360;
InputForm.Height = 150;
//InputForm.Font.Name = "宋体";
//InputForm.Font.Size = 10;
InputForm.Text = Caption;
Label lbl = new Label();
lbl.Text = Hint;
lbl.Left = 10;
lbl.Top = 20;
lbl.Parent = InputForm;
lbl.AutoSize = true;
TextBox tb = new TextBox();
tb.Left = 30;
tb.Top = 45;
tb.Width = 300;
tb.Parent = InputForm;
tb.Text = Default;
tb.SelectAll();
Button btnok = new Button();
btnok.Left = 30;
btnok.Top = 80;
btnok.Parent = InputForm;
btnok.Text = "Ok";
InputForm.AcceptButton = btnok;//回车响应
btnok.DialogResult = DialogResult.OK;
Button btncancal = new Button();
btncancal.Left = 120;
btncancal.Top = 80;
btncancal.Parent = InputForm;
btncancal.Text = "Cancel";
btncancal.DialogResult = DialogResult.Cancel;
try
{
if (InputForm.ShowDialog() == DialogResult.OK)
{
return tb.Text;
}
else
{
return "";
}
}
finally
{
InputForm.Dispose();
}
}
} }
} }
\ No newline at end of file \ No newline at end of file
using ConfigHelper; using ConfigHelper;
using DeviceLibrary; using DeviceLibrary;
using log4net.Config; using log4net.Config;
using OnlineStore;
using OnlineStore.Common; using OnlineStore.Common;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
...@@ -25,12 +26,13 @@ namespace TheMachine ...@@ -25,12 +26,13 @@ namespace TheMachine
static void Main() static void Main()
{ {
CameraPointTest.Init(); CameraPointTest.Init();
CameraPointTest.TestHasLabelOnDock(true);
//CameraPointTest.ScanRectangle(); //CameraPointTest.ScanRectangle();
//var bmpfile = @"D:\rick\vs\SO20031_TinStorage\TheMachine\bin\Debug\test.bmp"; //var bmpfile = @"D:\rick\vs\SO20031_TinStorage\TheMachine\bin\Debug\test.bmp";
//var bmp = new Bitmap(bmpfile); //var bmp = new Bitmap(bmpfile);
//var r = CameraPointTest.TestStorePoint(bmp, TestStorePointPort.入口); //var r = CameraPointTest.TestStorePoint(bmp, TestStorePointPort.入口);
_ = new Mutex(true, Application.ProductName, out bool ret); _ = new Mutex(true, Application.ProductName, out bool ret);
if (!ret) if (!ret)
{ {
......
...@@ -133,6 +133,9 @@ namespace TheMachine ...@@ -133,6 +133,9 @@ namespace TheMachine
haslistStoreName = CameraPointTest.GetThingStoreName(TestStorePointPort.下层右侧); haslistStoreName = CameraPointTest.GetThingStoreName(TestStorePointPort.下层右侧);
LogUtil.info("下层右侧:" + string.Join(",", haslistStoreName)); LogUtil.info("下层右侧:" + string.Join(",", haslistStoreName));
} }
var haslabel = CameraPointTest.TestHasLabelOnDock(true);
LogUtil.info("标签台:" + haslabel);
}); });
RobotManage.mainMachine.ScanCode(); RobotManage.mainMachine.ScanCode();
} }
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!