Commit 5ddaf0ae LN

增加入料照明

增加条码解析
增加接口代码
IO模块更新。
1 个父辈 ae2be12f
...@@ -508,8 +508,10 @@ namespace OnlineStore.AutoCountClient ...@@ -508,8 +508,10 @@ namespace OnlineStore.AutoCountClient
private void btnScan_Click(object sender, EventArgs e) private void btnScan_Click(object sender, EventArgs e)
{ {
List<string> LastCodeList = CodeManager.CameraScan(equipBean.Config.LeftCamera, equipBean.Name); equipBean.IOMove(IO_Type.Camera_Led, IO_VALUE.HIGH);
string msg = CodeManager.ProcessCode(LastCodeList); List<string> LastCodeList = CodeManager.CameraScan(equipBean.Name,equipBean.Config.LeftCamera );
string msg = CodeManager.GetValidCode(LastCodeList);
equipBean.IOMove(IO_Type.Camera_Led, IO_VALUE.LOW);
LogUtil.info(equipBean.Name + "[" + equipBean.Config.LeftCamera + "]扫码测试结果:\r\n" + msg); LogUtil.info(equipBean.Name + "[" + equipBean.Config.LeftCamera + "]扫码测试结果:\r\n" + msg);
MessageBox.Show(equipBean.Name + "[" + equipBean.Config.LeftCamera + "]扫码测试结果:" + msg); MessageBox.Show(equipBean.Name + "[" + equipBean.Config.LeftCamera + "]扫码测试结果:" + msg);
} }
...@@ -641,8 +643,10 @@ namespace OnlineStore.AutoCountClient ...@@ -641,8 +643,10 @@ namespace OnlineStore.AutoCountClient
private void btnRScan_Click(object sender, EventArgs e) private void btnRScan_Click(object sender, EventArgs e)
{ {
List<string> LastCodeList = CodeManager.CameraScan(equipBean.Config.RightCamera, equipBean.Name); equipBean.IOMove(IO_Type.Camera_Led, IO_VALUE.HIGH);
string msg = CodeManager.ProcessCode(LastCodeList); List<string> LastCodeList = CodeManager.CameraScan(equipBean.Name,equipBean.Config.RightCamera );
string msg = CodeManager.GetValidCode(LastCodeList);
equipBean.IOMove(IO_Type.Camera_Led, IO_VALUE.LOW);
LogUtil.info(equipBean.Name + "[" + equipBean.Config.RightCamera + "]扫码测试结果:\r\n" + msg); LogUtil.info(equipBean.Name + "[" + equipBean.Config.RightCamera + "]扫码测试结果:\r\n" + msg);
MessageBox.Show(equipBean.Name + "[" + equipBean.Config.RightCamera + "]扫码测试结果:" + msg); MessageBox.Show(equipBean.Name + "[" + equipBean.Config.RightCamera + "]扫码测试结果:" + msg);
} }
......
...@@ -12,3 +12,10 @@ ...@@ -12,3 +12,10 @@
4.入料模块复位时,需要先下降顶升气缸,防止伺服报警。 4.入料模块复位时,需要先下降顶升气缸,防止伺服报警。
去掉X56 去掉X56
20200526
增加入料照明
增加条码解析
增加接口代码
IO模块更新。
\ No newline at end of file \ No newline at end of file
...@@ -72,18 +72,13 @@ namespace OnlineStore.Common ...@@ -72,18 +72,13 @@ namespace OnlineStore.Common
} }
return true; return true;
} }
//public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); public static string Post(string url, string paramData, int timeOut = 10000)
public static string Post(string url, string paramData, int timeOut = 2000)
{ {
return Post(url, paramData, Encoding.UTF8, timeOut); return Post(url, paramData, Encoding.UTF8, timeOut);
} }
private static int isLog = ConfigAppSettings.GetIntValue(Setting_Init.Server_Log_Open); private static int isLog = ConfigAppSettings.GetIntValue(Setting_Init.Server_Log_Open);
public static string Post(string url, string paramData, Encoding encoding, int timeOut = 2000) public static string Post(string url, string paramData, Encoding encoding, int timeOut = 10000)
{ {
//if (PingURLIP(url, 100).Equals(false))
//{
// return "";
//}
if (isLog == 1) if (isLog == 1)
{ {
LogUtil.info("给服务器发送数据【" + paramData + "】 "); LogUtil.info("给服务器发送数据【" + paramData + "】 ");
......
...@@ -151,7 +151,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -151,7 +151,7 @@ namespace OnlineStore.DeviceLibrary
if (Robot.IOValue(IO_LineIn_Check).Equals(Robot.IOValue(IO_LineEnd_Check))) if (Robot.IOValue(IO_LineIn_Check).Equals(Robot.IOValue(IO_LineEnd_Check)))
{ {
LineStop(); LineStop();
MoveInfo.NextMoveStep( StepEnum.IBR03_BatchHome); MoveInfo.NextMoveStep(StepEnum.IBR03_BatchHome);
WorkLog("复位:批量轴开始回原点"); WorkLog("复位:批量轴开始回原点");
BatchAxis.HomeMove(MoveInfo); BatchAxis.HomeMove(MoveInfo);
} }
...@@ -378,8 +378,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -378,8 +378,8 @@ namespace OnlineStore.DeviceLibrary
} }
else if (wait.WaitType.Equals(WaitEnum.W002_IOValue)) else if (wait.WaitType.Equals(WaitEnum.W002_IOValue))
{ {
NotOkMsg = " [" + IOManager.GetDI(wait.IoType, Robot.DeviceID).DisplayStr + "=" + wait.IoValue + "]"; NotOkMsg = " [" + IOManager.GetIO(wait.IoType, Robot.DeviceID).DisplayStr + "=" + wait.IoValue + "]";
wait.IsEnd = Robot. IOValue(wait.IoType).Equals(wait.IoValue); wait.IsEnd = Robot.IOValue(wait.IoType).Equals(wait.IoValue);
if (!wait.IsEnd) if (!wait.IsEnd)
{ {
...@@ -423,7 +423,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -423,7 +423,8 @@ namespace OnlineStore.DeviceLibrary
else if (wait.WaitType.Equals(WaitEnum.W003_Time)) else if (wait.WaitType.Equals(WaitEnum.W003_Time))
{ {
wait.IsEnd = (span.TotalMilliseconds >= wait.TimeMSeconds); wait.IsEnd = (span.TotalMilliseconds >= wait.TimeMSeconds);
}else if (wait.WaitType.Equals(WaitEnum.W101_BatchAxisMove)) }
else if (wait.WaitType.Equals(WaitEnum.W101_BatchAxisMove))
{ {
//等待信号亮或者走到绝对位置才停止 //等待信号亮或者走到绝对位置才停止
if (Robot.IOValue(BatchAxis.TargetIoType).Equals(BatchAxis.TargetIoValue)) if (Robot.IOValue(BatchAxis.TargetIoType).Equals(BatchAxis.TargetIoValue))
...@@ -444,7 +445,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -444,7 +445,8 @@ namespace OnlineStore.DeviceLibrary
wait.IsEnd = true; wait.IsEnd = true;
} }
} }
}else if (wait.WaitType.Equals(WaitEnum.W102_FeedScanCode)) }
else if (wait.WaitType.Equals(WaitEnum.W102_FeedScanCode))
{ {
if (LastCodeList.Count > 0) if (LastCodeList.Count > 0)
{ {
...@@ -501,5 +503,11 @@ namespace OnlineStore.DeviceLibrary ...@@ -501,5 +503,11 @@ namespace OnlineStore.DeviceLibrary
} }
public string GetMoveStr()
{
string code = MoveInfo.MoveParam != null ? MoveInfo.MoveParam.WareCode : "";
return MoveInfo.MoveType + " " + MoveInfo.MoveStep + " " + code + "\n";
}
} }
} }
...@@ -178,7 +178,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -178,7 +178,8 @@ namespace OnlineStore.DeviceLibrary
else if (MoveInfo.IsStep(StepEnum.IB09_ScanCode)) else if (MoveInfo.IsStep(StepEnum.IB09_ScanCode))
{ {
MoveInfo.NextMoveStep(StepEnum.IB10_ScanOK); MoveInfo.NextMoveStep(StepEnum.IB10_ScanOK);
WorkLog("料串入料 :扫码结束,等待取料机构来取料"); MoveInfo.MoveParam.WareCode = CodeManager.GetValidCode(LastCodeList);
WorkLog("料串入料 :扫码结束【"+ MoveInfo.MoveParam.WareCode + "】,等待取料机构来取料");
} }
else if (MoveInfo.IsStep(StepEnum.IB11_TrayLeave)) else if (MoveInfo.IsStep(StepEnum.IB11_TrayLeave))
{ {
...@@ -235,11 +236,11 @@ namespace OnlineStore.DeviceLibrary ...@@ -235,11 +236,11 @@ namespace OnlineStore.DeviceLibrary
LogUtil.error(Name + "当前状态:" + MoveInfo.MoveType + ",GetTrayOK暂不处理"); LogUtil.error(Name + "当前状态:" + MoveInfo.MoveType + ",GetTrayOK暂不处理");
} }
} }
internal string GetCurrCode() //internal string LCodeStr = "";
{ //internal string GetCurrCode()
string code = CodeManager.ProcessCode(LastCodeList); //{
return code; // return LCodeStr = CodeManager.GetValidCode(LastCodeList);
} //}
private void FI_21_BatchAxisDown() private void FI_21_BatchAxisDown()
{ {
...@@ -274,12 +275,13 @@ namespace OnlineStore.DeviceLibrary ...@@ -274,12 +275,13 @@ namespace OnlineStore.DeviceLibrary
{ {
Task<List<string>> scanTask = Task.Factory.StartNew(delegate Task<List<string>> scanTask = Task.Factory.StartNew(delegate
{ {
Robot.IOMove(IO_Type.Camera_Led, IO_VALUE.HIGH);
NextCodeList = CodeManager.CameraScan(CameraName, Name); NextCodeList = CodeManager.CameraScan(Name, CameraName );
if (NextCodeList.Count <= 0) if (NextCodeList.Count <= 0)
{ {
NextCodeList = CodeManager.CameraScan(CameraName, Name); NextCodeList = CodeManager.CameraScan(Name, CameraName);
} }
Robot.IOMove(IO_Type.Camera_Led, IO_VALUE.LOW);
return NextCodeList; return NextCodeList;
}); });
} }
...@@ -299,12 +301,13 @@ namespace OnlineStore.DeviceLibrary ...@@ -299,12 +301,13 @@ namespace OnlineStore.DeviceLibrary
if (NextCodeList.Count > 0) if (NextCodeList.Count > 0)
{ {
WorkLog("料盘移栽 :开始扫码:使用预扫码");
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(300)); MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(300));
LastCodeList = new List<string>(NextCodeList); LastCodeList = new List<string>(NextCodeList);
NextCodeList = new List<string>(); NextCodeList = new List<string>();
MoveInfo.MoveParam.WareCode = CodeManager.GetValidCode(LastCodeList);
MoveInfo.NextMoveStep(StepEnum.IB10_ScanOK); MoveInfo.NextMoveStep(StepEnum.IB10_ScanOK);
WorkLog("料盘移栽 :上料横移取料端"); WorkLog("料盘移栽 :使用预扫码【" + MoveInfo.MoveParam.WareCode + "】,等待取料机构来取料");
//WorkLog("料盘移栽 :上料横移取料端");
// CylinderMove(MoveInfo, IO_Type.SL_MoveCylinder_Give, IO_Type.SL_MoveCylinder_Take); // CylinderMove(MoveInfo, IO_Type.SL_MoveCylinder_Give, IO_Type.SL_MoveCylinder_Take);
} }
else if (isScan) else if (isScan)
...@@ -317,12 +320,14 @@ namespace OnlineStore.DeviceLibrary ...@@ -317,12 +320,14 @@ namespace OnlineStore.DeviceLibrary
{ {
Task<List<string>> scanTask = Task.Factory.StartNew(delegate Task<List<string>> scanTask = Task.Factory.StartNew(delegate
{ {
Robot.IOMove(IO_Type.Camera_Led, IO_VALUE.HIGH);
LastCodeList = CodeManager.CameraScan(CameraName, Name); LastCodeList = CodeManager.CameraScan(Name, CameraName);
if (LastCodeList.Count <= 0) if (LastCodeList.Count <= 0)
{ {
LastCodeList = CodeManager.CameraScan(CameraName, Name); LastCodeList = CodeManager.CameraScan(Name, CameraName);
} }
Robot.IOMove(IO_Type.Camera_Led, IO_VALUE.LOW);
return LastCodeList; return LastCodeList;
}); });
} }
...@@ -447,7 +452,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -447,7 +452,7 @@ namespace OnlineStore.DeviceLibrary
} }
} }
if (LastHeight <= 8) { LastHeight = 8; } if (LastHeight <= 8) { LastHeight = 8; }
string code = CodeManager.ProcessCode(LastCodeList); string code = CodeManager.GetValidCode(LastCodeList);
string msg = Name + " 计算盘高:上升前 [" + StartMovePosition + "]实时[ " + EndMovePosition + "]差值[" + (EndMovePosition - StartMovePosition) + "]系数[" + AxisChangeValue + "] 计算后" + buchongStr + "[" + height + "]" + ",归类为【" + LastHeight + "mm】条码【" + code + "】"; string msg = Name + " 计算盘高:上升前 [" + StartMovePosition + "]实时[ " + EndMovePosition + "]差值[" + (EndMovePosition - StartMovePosition) + "]系数[" + AxisChangeValue + "] 计算后" + buchongStr + "[" + height + "]" + ",归类为【" + LastHeight + "mm】条码【" + code + "】";
LogUtil.info(msg); LogUtil.info(msg);
return LastHeight; return LastHeight;
......
...@@ -241,11 +241,13 @@ namespace OnlineStore.DeviceLibrary ...@@ -241,11 +241,13 @@ namespace OnlineStore.DeviceLibrary
//若左侧或右侧在等待扫码结束的状态,需要开始去取料 //若左侧或右侧在等待扫码结束的状态,需要开始去取料
if (LeftBatchMove.MoveInfo.MoveType.Equals(RobotMoveType.Working) && LeftBatchMove.MoveInfo.IsStep(StepEnum.IB10_ScanOK)) if (LeftBatchMove.MoveInfo.MoveType.Equals(RobotMoveType.Working) && LeftBatchMove.MoveInfo.IsStep(StepEnum.IB10_ScanOK))
{ {
StartWorking(new WorkParam(1, 0, LeftBatchMove.GetCurrCode())); string code = LeftBatchMove.MoveInfo.MoveParam.WareCode;
StartWorking(new WorkParam(1, 0, code));
} }
else if (RightBatchMove.MoveInfo.MoveType.Equals(RobotMoveType.Working) && RightBatchMove.MoveInfo.IsStep(StepEnum.IB10_ScanOK)) else if (RightBatchMove.MoveInfo.MoveType.Equals(RobotMoveType.Working) && RightBatchMove.MoveInfo.IsStep(StepEnum.IB10_ScanOK))
{ {
StartWorking(new WorkParam(2, 0, RightBatchMove.GetCurrCode())); string code = RightBatchMove.MoveInfo.MoveParam.WareCode;
StartWorking(new WorkParam(2, 0, code));
} }
} }
if (SecMoveInfo.MoveType.Equals(RobotMoveType.None) && NoErrorAlarm()) if (SecMoveInfo.MoveType.Equals(RobotMoveType.None) && NoErrorAlarm())
...@@ -373,8 +375,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -373,8 +375,8 @@ namespace OnlineStore.DeviceLibrary
{ {
msg+= "\n"; msg+= "\n";
} }
msg += "左侧上料 :" + LeftBatchMove.MoveInfo.MoveType + " "+LeftBatchMove.MoveInfo.MoveStep + "\n"; msg += "左侧上料 :" + LeftBatchMove.GetMoveStr()+"\n";
msg += "右侧上料:" + RightBatchMove.MoveInfo.MoveType + " " + RightBatchMove.MoveInfo.MoveStep + "\n"; msg += "右侧上料:" + RightBatchMove.GetMoveStr() + "\n";
return msg; return msg;
} }
} }
......
...@@ -189,6 +189,31 @@ namespace OnlineStore.DeviceLibrary ...@@ -189,6 +189,31 @@ namespace OnlineStore.DeviceLibrary
else if (MoveInfo.IsStep(StepEnum.IW10_SaveSize)) else if (MoveInfo.IsStep(StepEnum.IW10_SaveSize))
{ {
MoveInfo.NextMoveStep(StepEnum.IW11_GetTargetPosition); MoveInfo.NextMoveStep(StepEnum.IW11_GetTargetPosition);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
if (SServerManager.CanConnect())
{
Task task = Task.Factory.StartNew(delegate {
bool outNeed = false;
string msg = SServerManager.Get_VMICheckRLC(Name, MoveInfo.MoveParam.WareCode, out outNeed);
if (!msg.Equals(""))
{
WorkLog(" 【"+ MoveInfo.MoveParam.WareCode + "】获取是否测值失败:" + msg);
MoveInfo.MoveParam.IsNgReel = true;
MoveInfo.MoveParam.NgMsg = msg;
}else if (outNeed)
{
MoveInfo.MoveParam.TargetPosType = 2;
WorkLog(" 【" + MoveInfo.MoveParam.WareCode + "】需要测值" );
}else
{
MoveInfo.MoveParam.TargetPosType = 1;
WorkLog(" 【" + MoveInfo.MoveParam.WareCode + "】无需测值,开始点料");
}
});
}
else
{
if (MoveInfo.MoveParam.TargetPosType.Equals(0)) if (MoveInfo.MoveParam.TargetPosType.Equals(0))
{ {
if (DefautTargetP > 0) if (DefautTargetP > 0)
...@@ -198,18 +223,33 @@ namespace OnlineStore.DeviceLibrary ...@@ -198,18 +223,33 @@ namespace OnlineStore.DeviceLibrary
} }
WorkLog(" 根据条码获取目标位置:" + MoveInfo.MoveParam.ToStr()); WorkLog(" 根据条码获取目标位置:" + MoveInfo.MoveParam.ToStr());
} }
}
#endregion #endregion
else if (MoveInfo.IsStep(StepEnum.IW11_GetTargetPosition)) else if (MoveInfo.IsStep(StepEnum.IW11_GetTargetPosition))
{ {
if (MoveInfo.MoveParam.TargetPosType.Equals(0)) if (MoveInfo.MoveParam.TargetPosType.Equals(0))
{ {
if (SServerManager.CanConnect())
{
if (MoveInfo.IsTimeOut(120))
{
WarnMsg = Name + "等待" + MoveInfo.MoveParam.WareCode + "验证是否测值 超时[" + MoveInfo.TimeOutSeconds + "]秒";
LogUtil.error(Name + WarnMsg);
Alarm(AlarmType.IoSingleTimeOut);
}
return;
}
else
{
//随机目标地址 //随机目标地址
Random r = new Random(); Random r = new Random();
int targetP = r.Next(1, 100) % 3 + 1; int targetP = r.Next(1, 100) % 3 + 1;
MoveInfo.MoveParam.TargetPosType = targetP; MoveInfo.MoveParam.TargetPosType = targetP;
WorkLog(" 随机放料目标:" + targetP); WorkLog(" 随机放料目标:" + targetP);
} }
}
if (MoveInfo.MoveParam.TargetPosType.Equals(1)) if (MoveInfo.MoveParam.TargetPosType.Equals(1))
{ {
MoveInfo.NextMoveStep(StepEnum.IW21_MiddleToP3); MoveInfo.NextMoveStep(StepEnum.IW21_MiddleToP3);
...@@ -240,7 +280,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -240,7 +280,7 @@ namespace OnlineStore.DeviceLibrary
{ {
MoveInfo.NextMoveStep(StepEnum.IW24_WaitCanPut); MoveInfo.NextMoveStep(StepEnum.IW24_WaitCanPut);
WorkLog(" 放料到XRay:等待XRay可放料"); WorkLog(" 放料到XRay:等待XRay可放料");
MoveInfo.TimeOutSeconds = 120;
//TODO //TODO
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000)); MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.X_InLine_Check, IO_VALUE.LOW)); MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.X_InLine_Check, IO_VALUE.LOW));
...@@ -249,7 +289,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -249,7 +289,7 @@ namespace OnlineStore.DeviceLibrary
else if (MoveInfo.IsStep(StepEnum.IW24_WaitCanPut)) else if (MoveInfo.IsStep(StepEnum.IW24_WaitCanPut))
{ {
MoveInfo.NextMoveStep(StepEnum.IW41_Clamping_Relax); MoveInfo.NextMoveStep(StepEnum.IW41_Clamping_Relax);
RobotManager.robot.XrayBean.In_ReelInfo = new ReelInfo(MoveInfo.MoveParam.WareCode, MoveInfo.MoveParam.PlateW, MoveInfo.MoveParam.PlateH); RobotManager.robot.XrayBean.In_ReelInfo = MoveInfo.MoveParam.GetReelInfo();
WorkLog(" 放料到XRay:夹料气缸放松,更新XRay入口料盘信息:" + RobotManager.robot.XrayBean.In_ReelInfo.ToStr()); WorkLog(" 放料到XRay:夹料气缸放松,更新XRay入口料盘信息:" + RobotManager.robot.XrayBean.In_ReelInfo.ToStr());
CylinderMove(MoveInfo, IO_Type.Clamping_Work, IO_Type.Clamping_Relax); CylinderMove(MoveInfo, IO_Type.Clamping_Work, IO_Type.Clamping_Relax);
} }
......
...@@ -306,10 +306,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -306,10 +306,10 @@ namespace OnlineStore.DeviceLibrary
else if (ShelfMoveInfo.IsStep(StepEnum.OBR02_CylinderBack)) else if (ShelfMoveInfo.IsStep(StepEnum.OBR02_CylinderBack))
{ {
ShelfMoveInfo.NextMoveStep(StepEnum.OBR03_LineRun); ; ShelfMoveInfo.NextMoveStep(StepEnum.OBR03_LineRun); ;
ShelfWorkLog(" :链条先转动3秒钟,横移电机停止"); ShelfWorkLog(" :链条先转动8秒钟,横移电机停止");
IOMove(IO_Type.O_WLine_Run, IO_VALUE.HIGH); IOMove(IO_Type.O_WLine_Run, IO_VALUE.HIGH);
IOMove(IO_Type.O_ELine_Run, IO_VALUE.HIGH); IOMove(IO_Type.O_ELine_Run, IO_VALUE.HIGH);
ShelfMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(3000)); ShelfMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(8000));
IOMove(IO_Type.O_SWLine_Run, IO_VALUE.LOW); IOMove(IO_Type.O_SWLine_Run, IO_VALUE.LOW);
} }
else if (ShelfMoveInfo.IsStep(StepEnum.OBR03_LineRun)) else if (ShelfMoveInfo.IsStep(StepEnum.OBR03_LineRun))
...@@ -510,12 +510,14 @@ namespace OnlineStore.DeviceLibrary ...@@ -510,12 +510,14 @@ namespace OnlineStore.DeviceLibrary
msg += "贴标状态:" + SecMoveInfo.MoveType + " " + SecMoveInfo.MoveStep + "\n"; msg += "贴标状态:" + SecMoveInfo.MoveType + " " + SecMoveInfo.MoveStep + "\n";
msg += "料串状态:" + ShelfMoveInfo.MoveType + " " + ShelfMoveInfo.MoveStep + "\n"; msg += "料串状态:" + ShelfMoveInfo.MoveType + " " + ShelfMoveInfo.MoveStep + "\n";
//msg += "料盘信息:" + MoveInfo.MoveParam.ToStr() + " \r\n";
// msg += "标签信息:" + Out_ReelInfo.ToStr() + " \r\n"; // msg += "标签信息:" + Out_ReelInfo.ToStr() + " \r\n";
msg += "当前料串:" + WorkShelfId + ",累积出料 "+OutReelCount+" 盘共 "+OutReelHeight+" mm \r\n"; msg += "当前料串:" + WorkShelfId + ",累积出料 "+OutReelCount+" 盘共 "+OutReelHeight+" mm \r\n";
msg += "打印机["+RobotManager.PrintName+"]:" + RobotManager.LastPrintStatus + "\n"; msg += "打印机["+RobotManager.PrintName+"]:" + RobotManager.LastPrintStatus + "\n";
if (MoveInfo.MoveType.Equals(RobotMoveType.Working))
{
msg += "当前料盘:" + MoveInfo.MoveParam.OutStr() + " \r\n";
}
return msg; return msg;
} }
......
...@@ -370,7 +370,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -370,7 +370,7 @@ namespace OnlineStore.DeviceLibrary
else if (SecMoveInfo.IsStep(StepEnum.OL04_PrintOk)) else if (SecMoveInfo.IsStep(StepEnum.OL04_PrintOk))
{ {
bool isPrintOk = RobotManager.LastPrintStatus.Equals(Asa.PrintLabel.PrinterStatus.Idle); bool isPrintOk = RobotManager.LastPrintStatus.Equals(Asa.PrintLabel.PrinterStatus.Idle);
bool isTimeOut = SecMoveInfo.IsTimeOut(120); bool isTimeOut = SecMoveInfo.IsTimeOut(30);
if (isPrintOk || isTimeOut) if (isPrintOk || isTimeOut)
{ {
SecMoveInfo.NextMoveStep(StepEnum.OL05_TakeBack); SecMoveInfo.NextMoveStep(StepEnum.OL05_TakeBack);
......
...@@ -157,16 +157,21 @@ namespace OnlineStore.DeviceLibrary ...@@ -157,16 +157,21 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.NextMoveStep(StepEnum.XW12_EndCount); MoveInfo.NextMoveStep(StepEnum.XW12_EndCount);
if (Work_ReelInfo.WareCount <= 0) if (Work_ReelInfo.WareCount <= 0)
{ {
MoveInfo.MoveParam.WareCount = 99999;
Work_ReelInfo.WareCount = 99999; Work_ReelInfo.WareCount = 99999;
} }
WorkLog("料盘处理:点料结束,关闭X关机互锁信号"); WorkLog("料盘处理:点料结束,关闭X关机互锁信号");
IOMove(IO_Type.X_Lock_On, IO_VALUE.LOW); IOMove(IO_Type.X_Lock_On, IO_VALUE.LOW);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000)); MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
Task.Factory.StartNew(delegate {
SServerManager.Return_Material(Name, MoveInfo.MoveParam.WareCode, Work_ReelInfo.WareCount);
});
} }
#endregion #endregion
else if (MoveInfo.IsStep(StepEnum.XW12_EndCount)) else if (MoveInfo.IsStep(StepEnum.XW12_EndCount))
{ {
MoveInfo.NextMoveStep(StepEnum.XW21_WaitOutNoReel); MoveInfo.NextMoveStep(StepEnum.XW21_WaitOutNoReel);
MoveInfo.TimeOutSeconds = 120;
WorkLog("料盘处理:等待出口无料盘"); WorkLog("料盘处理:等待出口无料盘");
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Out_TrayCheck, IO_VALUE.LOW)); MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Out_TrayCheck, IO_VALUE.LOW));
} }
...@@ -196,7 +201,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -196,7 +201,7 @@ namespace OnlineStore.DeviceLibrary
{ {
MoveInfo.NextMoveStep(StepEnum.XW25_WaitTime); MoveInfo.NextMoveStep(StepEnum.XW25_WaitTime);
WorkLog("料盘处理:清空 Work_ReelInfo,更新 再转动3秒"); WorkLog("料盘处理:清空 Work_ReelInfo,更新 再转动3秒");
Out_ReelInfo = new ReelInfo(Work_ReelInfo.WareCode, Work_ReelInfo.PlateW, Work_ReelInfo.PlateH, Work_ReelInfo.WareCount); Out_ReelInfo = Work_ReelInfo.GetReelInfo();
Work_ReelInfo = new ReelInfo(); Work_ReelInfo = new ReelInfo();
IOMove(IO_Type.X_MLine_Run, IO_VALUE.HIGH); IOMove(IO_Type.X_MLine_Run, IO_VALUE.HIGH);
IOMove(IO_Type.X_OLine_Run, IO_VALUE.HIGH); IOMove(IO_Type.X_OLine_Run, IO_VALUE.HIGH);
......
...@@ -51,7 +51,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -51,7 +51,7 @@ namespace OnlineStore.DeviceLibrary
} }
private static void LoadCamera(bool isReLoad) private static void LoadCamera(bool isReLoad)
{ {
if (isReLoad|| Camera._cam==null) if (isReLoad || Camera._cam == null)
{ {
try try
{ {
...@@ -95,19 +95,14 @@ namespace OnlineStore.DeviceLibrary ...@@ -95,19 +95,14 @@ namespace OnlineStore.DeviceLibrary
{ {
Camera._cam.CloseAll(); Camera._cam.CloseAll();
} }
public static List<string> CameraScan(string camera, string deviceName, bool findRightCodeBreak = false)
{
List<string> cameraList = new List<string>();
cameraList.Add(camera);
return CameraScan(cameraList, deviceName, findRightCodeBreak);
}
private static int ScanCount = 0; private static int ScanCount = 0;
private static int codeCount = ConfigAppSettings.GetIntValue(Setting_Init.CodeCount); private static int codeCount = ConfigAppSettings.GetIntValue(Setting_Init.CodeCount);
[HandleProcessCorruptedStateExceptions] [HandleProcessCorruptedStateExceptions]
public static List<string> CameraScan(List<string> cameraList, string deviceName, bool findRightCodeBreak = false) public static List<string> CameraScan( string deviceName ,params string[] cameraList)
{ {
List<string> codeList = new List<string>(); List<string> codeList = new List<string>();
if (cameraList == null || cameraList.Count <= 0) if (cameraList == null || cameraList.Length <= 0)
{ {
return codeList; return codeList;
} }
...@@ -123,10 +118,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -123,10 +118,10 @@ namespace OnlineStore.DeviceLibrary
DateTime startTime = DateTime.Now; DateTime startTime = DateTime.Now;
if (deviceName != "") if (deviceName != "")
{ {
LogUtil.info(deviceName + " 【" + cameraName + "】开始取图片"); LogUtil.debug (deviceName + " 【" + cameraName + "】开始取图片");
} }
HalconDotNet.HObject ho_Image = null; HalconDotNet.HObject ho_Image = null;
bool findRightCode = false;
try try
{ {
ho_Image = Camera._cam.CaptureOnImage(cameraName); ho_Image = Camera._cam.CaptureOnImage(cameraName);
...@@ -158,17 +153,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -158,17 +153,9 @@ namespace OnlineStore.DeviceLibrary
{ {
codeList.Add(str); codeList.Add(str);
r = r + "##" + str; r = r + "##" + str;
if (!findRightCode)
{
findRightCode = IsRightCode(str);
}
} }
} }
if (findRightCodeBreak&&findRightCode)
{
break;
}
} }
if (String.IsNullOrEmpty(r)) if (String.IsNullOrEmpty(r))
{ {
...@@ -176,7 +163,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -176,7 +163,7 @@ namespace OnlineStore.DeviceLibrary
} }
if (deviceName != "" || r != "") if (deviceName != "" || r != "")
{ {
LogUtil.info(deviceName + " 【" + cameraName + "】扫码完成【" + FormUtil.GetSpanStr(DateTime.Now - startTime) + "】[" + findRightCode + "]" + ScanCount + " :" + r); LogUtil.info(deviceName + " 【" + cameraName + "】扫码完成【" + FormUtil.GetSpanStr(DateTime.Now - startTime) + "】" + ScanCount + " :" + r);
} }
} }
catch (AccessViolationException e) catch (AccessViolationException e)
...@@ -232,28 +219,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -232,28 +219,7 @@ namespace OnlineStore.DeviceLibrary
} }
} }
private static bool IsRightCode(string code)
{
//分号分割后长度=4,L,E,B,R
try
{
string[] strarray = code.Split(';');
if (strarray.Length == 4)
{
if (strarray[0].StartsWith("L") &&
strarray[1].StartsWith("E") &&
strarray[2].StartsWith("B") &&
strarray[3].StartsWith("R"))
{
return true;
}
}
}
catch (Exception ex)
{
}
return false;
}
public static string GetCodeParamFilePath(string codePath) public static string GetCodeParamFilePath(string codePath)
{ {
string appPath = Application.StartupPath; string appPath = Application.StartupPath;
...@@ -299,9 +265,32 @@ namespace OnlineStore.DeviceLibrary ...@@ -299,9 +265,32 @@ namespace OnlineStore.DeviceLibrary
message = asciiEncoding.GetString(newBytes.ToArray()); message = asciiEncoding.GetString(newBytes.ToArray());
return message; return message;
} }
public static string ProcessCode(List<string> codeList) private static bool IsRightCode(string code)
{
//分号分割后长度=4,L,E,B,R
try
{
string[] strarray = code.Split(';');
if (strarray.Length == 4)
{
if (strarray[0].StartsWith("L") &&
strarray[1].StartsWith("E") &&
strarray[2].StartsWith("B") &&
strarray[3].StartsWith("R"))
{
return true;
}
}
}
catch (Exception ex)
{
}
return false;
}
public static string GetValidCode(List<string> codeList)
{ {
string code = ""; string code = "";
List<string> targetCode = new List<string>();
foreach (string cc in codeList) foreach (string cc in codeList)
{ {
if (string.IsNullOrEmpty(cc)) if (string.IsNullOrEmpty(cc))
...@@ -310,7 +299,49 @@ namespace OnlineStore.DeviceLibrary ...@@ -310,7 +299,49 @@ namespace OnlineStore.DeviceLibrary
} }
code += cc + "##"; code += cc + "##";
} }
return ReplaceCode(code); code = ReplaceCode(code);
if (String.IsNullOrEmpty(code))
{
return "";
}
foreach (string cc in codeList)
{
if (string.IsNullOrEmpty(cc))
{
continue;
}
string rCode = ReplaceCode(cc);
//L0000000000360K003732; E20200311 0365; B6D.49925.551014212020031105000; R014212020031103159##B29
string[] codearray = code.Split(';');
if (codearray.Length >= 4)
{
if (codearray[2].StartsWith("B") && codearray[2].Length >= 13 && codearray[3].StartsWith("R"))
{
string tc = codearray[2].Substring(1, 12) + ";" + codearray[3];
if (!targetCode.Contains(tc))
{
targetCode.Add(tc);
}
}
}
}
if (targetCode.Count == 1)
{
LogUtil.info("解析条码【" + code + "】结果【" + targetCode[0] + "】");
return targetCode[0];
}
else if (targetCode.Count <= 0)
{
LogUtil.info("解析条码【" + code + "】失败:未找到有效条码");
}
else
{
LogUtil.info("解析条码【" + code + "】失败:有多个(" + targetCode.Count + ")有效条码");
}
return "";
} }
} }
} }
...@@ -27,9 +27,6 @@ namespace OnlineStore.DeviceLibrary ...@@ -27,9 +27,6 @@ namespace OnlineStore.DeviceLibrary
this.IsTest = test; this.IsTest = test;
} }
/// <summary>
/// 物品二维码信息
/// </summary>
public string WareCode = ""; public string WareCode = "";
/// <summary> /// <summary>
...@@ -37,13 +34,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -37,13 +34,8 @@ namespace OnlineStore.DeviceLibrary
/// </summary> /// </summary>
public int TrayStatus = -1; public int TrayStatus = -1;
/// <summary>
/// 料盘高度
/// </summary>
public int PlateH = 0; public int PlateH = 0;
/// <summary>
/// 料盘宽度
/// </summary>
public int PlateW = 0; public int PlateW = 0;
/// <summary> /// <summary>
...@@ -61,10 +53,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -61,10 +53,8 @@ namespace OnlineStore.DeviceLibrary
/// </summary> /// </summary>
public int TargetPosType = 0; public int TargetPosType = 0;
/// <summary>
/// 取料时判断是否是NG料
/// </summary>
public bool IsNgReel = false; public bool IsNgReel = false;
public string NgMsg = "";
/// <summary> /// <summary>
/// 是否是测试步骤 /// 是否是测试步骤
/// </summary> /// </summary>
...@@ -89,7 +79,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -89,7 +79,7 @@ namespace OnlineStore.DeviceLibrary
} }
public string OutStr() public string OutStr()
{ {
return "[" + WareCode + "]:[" + PlateW + "]X[" + PlateH + "][" + WareCount + "]"; return "[" + WareCode + "] [ " + PlateW + "X" + PlateH + " ] [" + WareCount + "]" + (IsNgReel ? "[NG料:" + NgMsg + "]" : "") + "";
} }
public int Get_Inout_P2(InputEquip_Config config) public int Get_Inout_P2(InputEquip_Config config)
{ {
...@@ -146,6 +136,13 @@ namespace OnlineStore.DeviceLibrary ...@@ -146,6 +136,13 @@ namespace OnlineStore.DeviceLibrary
this.PlateW = reel.PlateW; this.PlateW = reel.PlateW;
this.WareCode = reel.WareCode; this.WareCode = reel.WareCode;
this.WareCount = reel.WareCount; this.WareCount = reel.WareCount;
this.IsNgReel = reel.IsNgReel;
this.NgMsg = reel.NgMsg;
}
public ReelInfo GetReelInfo()
{
ReelInfo reel = new ReelInfo(WareCode, PlateW, PlateH, WareCount, IsNgReel, NgMsg);
return reel;
} }
} }
...@@ -153,12 +150,14 @@ namespace OnlineStore.DeviceLibrary ...@@ -153,12 +150,14 @@ namespace OnlineStore.DeviceLibrary
public class ReelInfo public class ReelInfo
{ {
public ReelInfo(string code = "", int plateW = 7, int plateH = 8,int count=0) public ReelInfo(string code = "", int plateW = 7, int plateH = 8,int count=0,bool IsNg=false,string msg="")
{ {
this.WareCode = code; this.WareCode = code;
this.PlateH = plateH; this.PlateH = plateH;
this.PlateW = plateW; this.PlateW = plateW;
this.WareCount = count; this.WareCount = count;
this.IsNgReel = IsNg;
this.NgMsg = msg;
} }
/// <summary> /// <summary>
/// 物品二维码信息 /// 物品二维码信息
...@@ -178,10 +177,19 @@ namespace OnlineStore.DeviceLibrary ...@@ -178,10 +177,19 @@ namespace OnlineStore.DeviceLibrary
public int WareCount = 0; public int WareCount = 0;
public bool IsNgReel = false;
public string NgMsg = "";
public string ToStr() public string ToStr()
{ {
return "[" + WareCode + "] [ " + PlateW + "X" + PlateH + " ] ["+WareCount+"]"; return "[" + WareCode + "] [ " + PlateW + "X" + PlateH + " ] ["+WareCount+"]"+(IsNgReel?"[NG料:"+NgMsg+"]":"")+"";
} }
public ReelInfo GetReelInfo()
{
ReelInfo reel = new ReelInfo(WareCode, PlateW, PlateH, WareCount, IsNgReel, NgMsg);
return reel;
}
} }
} }
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!