Commit c442141f 刘韬

对特殊PN做3次点料处理

1 个父辈 289bedb8
......@@ -93,7 +93,12 @@ namespace DeviceLibrary
XRay_09_SentToLabelStop,
XRay_10_CloseOutDoor,
XRay_11_GetCoutResult,
XRay_Extra_01,
XRay_Extra_02,
XRay_Extra_03,
XRay_Extra_04,
XRay_End,
Filter_01_WaitReel,
Filter_02_WaitReel,
Filter_10_NGReel_PushOut,
......
......@@ -112,6 +112,16 @@ namespace DeviceLibrary
Line1 = new LineRunMonitor("line1", labelMachine.Config.DOList[IO_Label_Type.Line1_Run].GetIOAddr());
Line2 = new LineRunMonitor("line2", labelMachine.Config.DOList[IO_Label_Type.Line2_Run].GetIOAddr());
LogUtil.info($"XRay StartDate:{UseData.GetStartDateTime},TotalSecond:{UseData.GetTotalUseSeconds},TotalTimes:{UseData.GetTimes}");
var wiston_spnlist = ConfigHelper.Config.Get<string[]>("wiston_spnlist");
if (wiston_spnlist == null)
wiston_spnlist = new string[] { "" };
xrayMachine.pnlst = new HashSet<string>(wiston_spnlist);
xrayMachine.relmove = ConfigHelper.Config.Get<int>("wiston_relmove", 50);
xrayMachine.ptrycount = ConfigHelper.Config.Get<int>("wiston_strycount", 3);
LogUtil.info("加载到特殊pn序列" + string.Join(",", ConfigHelper.Config.Get<string[]>("wiston_spnlist")));
LogUtil.info("加载到相对移动偏移" + xrayMachine.relmove+",重试次数"+ xrayMachine.ptrycount);
LoadFinishEvent?.Invoke(IsDebug?IsDebug:IsLoadOk, msgs);
}
catch (Exception ex) {
......
......@@ -414,9 +414,19 @@ namespace DeviceLibrary
{
case MoveStep.Shelf_Out_Wait:
if (IOValue(IO_T1_Type.T1_Lift_Tray_Check).Equals(IO_VALUE.LOW))
return;
{
ConfigIO io = Config.getWaitIO(IO_T1_Type.T1_Lift_Tray_Check);
WarnMsg = $"{crc.GetString("wait", "等待")}(" + io.DisplayStr + "=LOW" + $")";
Msg.add(WarnMsg, MsgLevel.warning);
return;
}
if (IOValue(IO_T1_Type.T1_Out_Check).Equals(IO_VALUE.HIGH))
{
ConfigIO io = Config.getWaitIO(IO_T1_Type.T1_Out_Check);
WarnMsg = $"{crc.GetString("wait", "等待")}(" + io.DisplayStr + "=HIGH" + $")";
Msg.add(WarnMsg, MsgLevel.warning);
return;
}
ShelfOutMoveInfo.NextMoveStep(MoveStep.Shelf_30_Out_BatchDown);
ShelfOutMoveInfo.log("出口工位有料,出口等待位无料,开始送出");
......
......@@ -17,6 +17,9 @@ namespace DeviceLibrary
using crc = OnlineStore.CodeResourceControl;
partial class XRayMachine
{
public HashSet<string> pnlst;
public int ptrycount;
public int relmove;
const string xraydir = @"\Image\Xray";
Task GetResultTask = null;
void WorkProcess()
......@@ -57,6 +60,14 @@ namespace DeviceLibrary
RobotManage.XRay.Start();
MoveInfo.log($"打开X光");
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
var pps = MoveInfo.ReelParam.PN.Split('-');
var pn = pps[0];
if (pnlst.Contains(pn)) {
MoveInfo.NextMoveStep(MoveStep.XRay_Extra_01);
MoveInfo.log($"判断为需要多次拍照的料盘,PN:{pn}");
countlist.Clear();
}
break;
case MoveStep.XRay_05_GetImage:
if (GrabImage())
......@@ -137,8 +148,54 @@ namespace DeviceLibrary
MoveInfo.StopwatchLog();
MoveInfo.EndMove();
break;
case MoveStep.XRay_Extra_01:
MoveInfo.NextMoveStep(MoveStep.XRay_Extra_02);
if (GrabImage())
{
MoveInfo.log($"获取图像,开始点料 IsRayOpen:{RobotManage.XRay.IsRayOpen}");
var c = GetCountResult(true);
countlist.Add(c);
MoveInfo.log($"获取点料数量:{c}, 第:{countlist.Count}次");
}
else {
MoveInfo.StopwatchLog(false, "获取图像失败");
countlist.Add(-1);
}
Line_In_Axis.RelMove(MoveInfo, relmove, Config.Line_In_Relative_speed);
MoveInfo.StopwatchLog(false, "轻微移动皮带,重试X光点料");
break;
case MoveStep.XRay_Extra_02:
if (countlist.Count <= ptrycount)
{
MoveInfo.NextMoveStep(MoveStep.XRay_Extra_01);
MoveInfo.log($"开始第{countlist.Count}次");
}
else
{
MoveInfo.NextMoveStep(MoveStep.XRay_Extra_03);
var maxcount = countlist.Max();
MoveInfo.log($"获取到最大数量{maxcount}, 分别数量:{string.Join(",", countlist)}");
MoveInfo.ReelParam.QTY = maxcount;
var cl = ServerConn.inputCounterDataByXRayMachine(MoveInfo.ReelParam.WareCode, maxcount);
if (cl == null)
{
MoveInfo.ReelParam.IsNg = true;
MoveInfo.ReelParam.NgMsg = "点料数量上传失败";
MoveInfo.ReelParam.logresult();
}
}
break;
case MoveStep.XRay_Extra_03:
MoveInfo.NextMoveStep(MoveStep.XRay_08_OpenOutDoor);
MoveInfo.log($"关闭X光");
RobotManage.XRay.Stop();
IOMove(IO_XRay_Type.Xray_Lock, IO_VALUE.LOW);
MoveInfo.StopwatchLog(false, "准备送出");
break;
}
}
List<int> countlist = new List<int>();
public string xrayImagePath;
[HandleProcessCorruptedStateExceptions]
public bool GrabImage()
......@@ -212,7 +269,7 @@ namespace DeviceLibrary
}
}
[HandleProcessCorruptedStateExceptions]
public void GetCountResult()
public int GetCountResult(bool dontlog = false)
{
//返回的数量是string类型,count = "4000,3000,3500,2000"
int count = 0;
......@@ -274,7 +331,7 @@ namespace DeviceLibrary
MoveInfo.ReelParam.IsNg = true;
MoveInfo.ReelParam.NgMsg = "点料失败";
MoveInfo.ReelParam.logresult();
return;
return count;
}
if (countStr != null)
......@@ -298,7 +355,7 @@ namespace DeviceLibrary
if (File.Exists(resfile))
File.Delete(resfile);
Directory.Move(Path.Combine(root, resfilename), resfile);
if (!RobotManage.offlinemode)
if (!RobotManage.offlinemode && !dontlog)
{
var cl = ServerConn.inputCounterDataByXRayMachine(MoveInfo.ReelParam.WareCode, count);
if (cl == null)
......@@ -319,6 +376,7 @@ namespace DeviceLibrary
{
MoveInfo.log("GetCountResult 出错: " + ex.ToString());
}
return count;
}
}
......
......@@ -56,6 +56,7 @@ namespace DeviceLibrary
IOMonitor.RegisterIO(IO_XRay_Type.Exit_Open, Config, IO_VALUE.LOW, delegate () { XRayDoorOpen(); });
IOMonitor.RegisterIO(IO_XRay_Type.Entry_Open, Config, IO_VALUE.LOW, delegate () { XRayDoorOpen(); });
AlarmBuzzer.SetOnOffAction(() => { IOMove(IO_XRay_Type.Alarm_Buzzer, IO_VALUE.HIGH); }, () => { IOMove(IO_XRay_Type.Alarm_Buzzer, IO_VALUE.LOW); });
LogUtil.info(DeviceName + " init end");
}
catch (Exception e){
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!