Commit 658eff58 刘韬

修改pn算法匹配规则

1 个父辈 787c70a3
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
this.btnEnd = new System.Windows.Forms.Button(); this.btnEnd = new System.Windows.Forms.Button();
this.timer1 = new System.Windows.Forms.Timer(this.components); this.timer1 = new System.Windows.Forms.Timer(this.components);
this.groupBox4 = new System.Windows.Forms.GroupBox(); this.groupBox4 = new System.Windows.Forms.GroupBox();
this.label_coutresult = new System.Windows.Forms.Label();
this.buttonE = new System.Windows.Forms.Button(); this.buttonE = new System.Windows.Forms.Button();
this.buttonD = new System.Windows.Forms.Button(); this.buttonD = new System.Windows.Forms.Button();
this.buttonC = new System.Windows.Forms.Button(); this.buttonC = new System.Windows.Forms.Button();
...@@ -54,7 +55,6 @@ ...@@ -54,7 +55,6 @@
this.lblFeng = new System.Windows.Forms.Label(); this.lblFeng = new System.Windows.Forms.Label();
this.lblDes = new System.Windows.Forms.Label(); this.lblDes = new System.Windows.Forms.Label();
this.lblProName = new System.Windows.Forms.Label(); this.lblProName = new System.Windows.Forms.Label();
this.label_coutresult = new System.Windows.Forms.Label();
this.groupBox1.SuspendLayout(); this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.numWSize)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numWSize)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numTh)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numTh)).BeginInit();
...@@ -244,6 +244,15 @@ ...@@ -244,6 +244,15 @@
this.groupBox4.TabStop = false; this.groupBox4.TabStop = false;
this.groupBox4.Text = "请选择参数"; this.groupBox4.Text = "请选择参数";
// //
// label_coutresult
//
this.label_coutresult.AutoSize = true;
this.label_coutresult.Location = new System.Drawing.Point(57, 380);
this.label_coutresult.Name = "label_coutresult";
this.label_coutresult.Size = new System.Drawing.Size(79, 20);
this.label_coutresult.TabIndex = 304;
this.label_coutresult.Text = "点料结果:";
//
// buttonE // buttonE
// //
this.buttonE.BackColor = System.Drawing.Color.White; this.buttonE.BackColor = System.Drawing.Color.White;
...@@ -255,6 +264,7 @@ ...@@ -255,6 +264,7 @@
this.buttonE.TabIndex = 303; this.buttonE.TabIndex = 303;
this.buttonE.Text = "算法E"; this.buttonE.Text = "算法E";
this.buttonE.UseVisualStyleBackColor = false; this.buttonE.UseVisualStyleBackColor = false;
this.buttonE.Visible = false;
this.buttonE.Click += new System.EventHandler(this.buttonE_Click); this.buttonE.Click += new System.EventHandler(this.buttonE_Click);
// //
// buttonD // buttonD
...@@ -268,6 +278,7 @@ ...@@ -268,6 +278,7 @@
this.buttonD.TabIndex = 302; this.buttonD.TabIndex = 302;
this.buttonD.Text = "算法D"; this.buttonD.Text = "算法D";
this.buttonD.UseVisualStyleBackColor = false; this.buttonD.UseVisualStyleBackColor = false;
this.buttonD.Visible = false;
this.buttonD.Click += new System.EventHandler(this.buttonD_Click); this.buttonD.Click += new System.EventHandler(this.buttonD_Click);
// //
// buttonC // buttonC
...@@ -320,6 +331,7 @@ ...@@ -320,6 +331,7 @@
this.buttonA.TabIndex = 299; this.buttonA.TabIndex = 299;
this.buttonA.Text = "算法A"; this.buttonA.Text = "算法A";
this.buttonA.UseVisualStyleBackColor = false; this.buttonA.UseVisualStyleBackColor = false;
this.buttonA.Visible = false;
this.buttonA.Click += new System.EventHandler(this.buttonA_Click); this.buttonA.Click += new System.EventHandler(this.buttonA_Click);
// //
// groupBox2 // groupBox2
...@@ -374,15 +386,6 @@ ...@@ -374,15 +386,6 @@
this.lblProName.Text = "产品:"; this.lblProName.Text = "产品:";
this.lblProName.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.lblProName.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
// //
// label_coutresult
//
this.label_coutresult.AutoSize = true;
this.label_coutresult.Location = new System.Drawing.Point(57, 380);
this.label_coutresult.Name = "label_coutresult";
this.label_coutresult.Size = new System.Drawing.Size(79, 20);
this.label_coutresult.TabIndex = 304;
this.label_coutresult.Text = "点料结果:";
//
// FrmLearning // FrmLearning
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F); this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
......
...@@ -667,8 +667,11 @@ namespace OnlineStore.DeviceLibrary ...@@ -667,8 +667,11 @@ namespace OnlineStore.DeviceLibrary
{ {
printTask = null; printTask = null;
} }
if (!LabelXAxis.IsInPosition(Config.LabelX_P2))
LabelXAxis.AbsMove(SecMoveInfo, Config.LabelX_P2, Config.LabelX_P2Speed); LabelXAxis.AbsMove(SecMoveInfo, Config.LabelX_P2, Config.LabelX_P2Speed);
if (!LabelYAxis.IsInPosition(Config.LabelY_P2))
LabelYAxis.AbsMove(SecMoveInfo, Config.LabelY_P2, Config.LabelY_P2Speed); LabelYAxis.AbsMove(SecMoveInfo, Config.LabelY_P2, Config.LabelY_P2Speed);
if (!LabelRAxis.IsInPosition(Config.LabelR_P2))
LabelRAxis.AbsMove(SecMoveInfo, Config.LabelR_P2, Config.LabelR_P2Speed); LabelRAxis.AbsMove(SecMoveInfo, Config.LabelR_P2, Config.LabelR_P2Speed);
} }
else if (SecMoveInfo.IsStep(StepEnum.OL03_PrintLabel)) else if (SecMoveInfo.IsStep(StepEnum.OL03_PrintLabel))
...@@ -851,7 +854,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -851,7 +854,7 @@ namespace OnlineStore.DeviceLibrary
{ {
SecMoveInfo.NextMoveStep(StepEnum.OL14_PasteForward); SecMoveInfo.NextMoveStep(StepEnum.OL14_PasteForward);
SecWorkLog("贴标: 七寸盘:贴标气缸后退"); SecWorkLog("贴标: 七寸盘:贴标气缸后退");
CylinderMove(SecMoveInfo, IO_Type.LablePaste_Forward, IO_Type.PasteCode_Back); //CylinderMove(SecMoveInfo, IO_Type.LablePaste_Forward, IO_Type.PasteCode_Back);
} }
else else
{ {
...@@ -883,12 +886,17 @@ namespace OnlineStore.DeviceLibrary ...@@ -883,12 +886,17 @@ namespace OnlineStore.DeviceLibrary
{ {
SecMoveInfo.NextMoveStep(StepEnum.OL18_LableBack); SecMoveInfo.NextMoveStep(StepEnum.OL18_LableBack);
SecWorkLog("贴标: 贴标气缸后退,X轴R轴返回待机点P2,Y轴返回待机点P1, "); SecWorkLog("贴标: 贴标气缸后退,X轴R轴返回待机点P2,Y轴返回待机点P1, ");
LabelZAxis.AbsMove(SecMoveInfo, Config.LabelZ_P1, Config.LabelZ_P1Speed); LabelZAxis.AbsMove(SecMoveInfo, Config.LabelZ_P1, Config.LabelZ_P1Speed);
if (!SecMoveInfo.MoveParam.PlateW.Equals(7))
CylinderMove(SecMoveInfo, IO_Type.LablePaste_Forward, IO_Type.PasteCode_Back); CylinderMove(SecMoveInfo, IO_Type.LablePaste_Forward, IO_Type.PasteCode_Back);
LabelXAxis.AbsMove(SecMoveInfo, Config.LabelX_P2, Config.LabelX_P2Speed); LabelXAxis.AbsMove(SecMoveInfo, Config.LabelX_P2, Config.LabelX_P2Speed);
LabelYAxis.AbsMove(SecMoveInfo, Config.LabelY_P1, Config.LabelY_P1Speed); LabelYAxis.AbsMove(SecMoveInfo, Config.LabelY_P1, Config.LabelY_P1Speed);
LabelRAxis.AbsMove(SecMoveInfo, Config.LabelR_P2, Config.LabelR_P2Speed); LabelRAxis.AbsMove(SecMoveInfo, Config.LabelR_P2, Config.LabelR_P2Speed);
}
else if (SecMoveInfo.IsStep(StepEnum.OL18_LableBack))
{
bool canLabel = ShelfMoveInfo.MoveType.Equals(RobotMoveType.ShelfPro) && ShelfMoveInfo.IsStep(StepEnum.OS_25_WaitLabel); bool canLabel = ShelfMoveInfo.MoveType.Equals(RobotMoveType.ShelfPro) && ShelfMoveInfo.IsStep(StepEnum.OS_25_WaitLabel);
if (canLabel) if (canLabel)
{ {
...@@ -896,9 +904,6 @@ namespace OnlineStore.DeviceLibrary ...@@ -896,9 +904,6 @@ namespace OnlineStore.DeviceLibrary
//SecTickLog("贴标完成1"); //SecTickLog("贴标完成1");
ShelfWorkLog("贴标完成"); ShelfWorkLog("贴标完成");
} }
}
else if (SecMoveInfo.IsStep(StepEnum.OL18_LableBack))
{
// SecMoveInfo.NextMoveStep(StepEnum.OL19_XYRBackToP2); // SecMoveInfo.NextMoveStep(StepEnum.OL19_XYRBackToP2);
// SecWorkLog("贴标: X轴R轴返回待机点P2,Y轴返回待机点P1, "); // SecWorkLog("贴标: X轴R轴返回待机点P2,Y轴返回待机点P1, ");
// LabelXAxis.AbsMove(SecMoveInfo, Config.LabelX_P2, Config.LabelX_P2Speed); // LabelXAxis.AbsMove(SecMoveInfo, Config.LabelX_P2, Config.LabelX_P2Speed);
......
...@@ -77,6 +77,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -77,6 +77,8 @@ namespace OnlineStore.DeviceLibrary
return; return;
} }
*/ */
ParamManager.Init();
OldPNList.init();
Task.Factory.StartNew(delegate Task.Factory.StartNew(delegate
{ {
LogUtil.info(Name + "开始连接IO模块 "); LogUtil.info(Name + "开始连接IO模块 ");
......
...@@ -54,6 +54,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -54,6 +54,7 @@ namespace OnlineStore.DeviceLibrary
IoCheckTimer.Elapsed += IoCheckTimerProcess; IoCheckTimer.Elapsed += IoCheckTimerProcess;
MoveInfo = new RobotMoveInfo(Name); MoveInfo = new RobotMoveInfo(Name);
SecMoveInfo = new RobotMoveInfo(Name.Trim() + "-SMove"); SecMoveInfo = new RobotMoveInfo(Name.Trim() + "-SMove");
XrayImage.setProcessLevel(4);
Task.Factory.StartNew(delegate Task.Factory.StartNew(delegate
{ {
XRayLoad(); XRayLoad();
...@@ -96,8 +97,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -96,8 +97,7 @@ namespace OnlineStore.DeviceLibrary
{ {
Directory.CreateDirectory(path2_out); Directory.CreateDirectory(path2_out);
} }
ParamManager.Init();
OldPNList.init();
ResultMinCount = ConfigAppSettings.GetIntValue(Setting_Init.ResultMinCount); ResultMinCount = ConfigAppSettings.GetIntValue(Setting_Init.ResultMinCount);
if (ResultMinCount == -1) if (ResultMinCount == -1)
{ {
......
...@@ -805,12 +805,14 @@ namespace OnlineStore.DeviceLibrary ...@@ -805,12 +805,14 @@ namespace OnlineStore.DeviceLibrary
int windowsize = param.WindowSize; ; int windowsize = param.WindowSize; ;
if (param.Sign == CountParam.SignType.AUTO) if (param.Sign == CountParam.SignType.AUTO)
{ {
result = XrayImage.GetLocalCount(fileP, 50, out countStr, out dst); LogUtil.info("GetCountResult " + type + " 调用 GetLocalCount 【" + fileP + "】【" + 100 + "】");
LogUtil.info("GetCountResult " + type + " 调用 GetLocalCount 【" + fileP + "】【" + threshold + "】【" + windowsize + "】,返回【" + result + "】,结果【" + string.Join(",", countStr) + "】"); result = XrayImage.GetLocalCount(fileP, 100, out countStr, out dst);
LogUtil.info("GetCountResult " + type + " 调用 GetLocalCount 【" + fileP + "】【" + 100 + "】,返回【" + result + "】,结果【" + string.Join(",", countStr) + "】");
} }
else { else {
result = XrayImage.GetLocalCountIrregular(fileP, 50, type.ToString(), out countStr, out dst); LogUtil.info("GetLocalCountIrregular " + type + " 【" + fileP + "】【" + 100 + "】");
LogUtil.info("GetCountResult " + type + " 调用 GetLocalCountIrregular 【" + fileP + "】【" + threshold + "】【" + windowsize + "】,返回【" + result + "】,结果【" + string.Join(",", countStr) + "】"); result = XrayImage.GetLocalCountIrregular(fileP, 100, type.ToString(), out countStr, out dst);
LogUtil.info("GetLocalCountIrregular " + type + " 【" + fileP + "】【" + 100 + "】,返回【" + result + "】,结果【" + string.Join(",", countStr) + "】");
} }
if (dst != null) if (dst != null)
{ {
......
...@@ -70,6 +70,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -70,6 +70,9 @@ namespace OnlineStore.DeviceLibrary
//bool result = false; //bool result = false;
//CountParam lastParam = new CountParam("", ThresholdValue, 3); //CountParam lastParam = new CountParam("", ThresholdValue, 3);
string pn = GetCodeStrPN(codeStr); string pn = GetCodeStrPN(codeStr);
var pns = pn.Split('.');
if (pns.Length == 3)
pn = pns[0] +"."+ pns[2];
if (countParamMap.ContainsKey(pn)) if (countParamMap.ContainsKey(pn))
{ {
CountParam lastParam = countParamMap[pn]; CountParam lastParam = countParamMap[pn];
...@@ -256,6 +259,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -256,6 +259,9 @@ namespace OnlineStore.DeviceLibrary
{ {
public CountParam(string pn, int th = 0, int size = 0, SignType sign=SignType.AUTO, int value = 0) public CountParam(string pn, int th = 0, int size = 0, SignType sign=SignType.AUTO, int value = 0)
{ {
var pns = pn.Split('.');
if (pns.Length == 3)
pn = pns[0] + "." + pns[2];
this.PN = pn; this.PN = pn;
this.Threshold = th; this.Threshold = th;
this.WindowSize = size; this.WindowSize = size;
...@@ -287,6 +293,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -287,6 +293,9 @@ namespace OnlineStore.DeviceLibrary
if (array.Length >= 5) if (array.Length >= 5)
{ {
string pn = array[0].Trim(); string pn = array[0].Trim();
var pns = pn.Split('.');
if (pns.Length == 3)
pn = pns[0] + "." + pns[2];
SignType sign = SignType.AUTO; SignType sign = SignType.AUTO;
Enum.TryParse<SignType>(array[1].Trim(), out sign); Enum.TryParse<SignType>(array[1].Trim(), out sign);
......
...@@ -21,7 +21,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -21,7 +21,7 @@ namespace OnlineStore.DeviceLibrary
var data = File.ReadAllLines(datafile); var data = File.ReadAllLines(datafile);
pnlist = new HashSet<string>(data); pnlist = new HashSet<string>(data);
LogUtil.info($"OldPNList加载数据{pnlist.Count}条"); LogUtil.info($"OldPNList加载数据{pnlist.Count}条");
pnlist.Union(ParamManager.GetPNlist()); pnlist.UnionWith(ParamManager.GetPNlist());
LogUtil.info($"OldPNList加载学习数据{pnlist.Count}条"); LogUtil.info($"OldPNList加载学习数据{pnlist.Count}条");
} }
...@@ -30,7 +30,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -30,7 +30,7 @@ namespace OnlineStore.DeviceLibrary
} }
public static void AddOne(string pn) public static void AddOne(string pn)
{ {
if(!pnlist.Contains(pn)) //if(!pnlist.Contains(pn))
pnlist.Add(pn); pnlist.Add(pn);
} }
} }
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!