Commit 75f52895 LN

轨道调宽最宽不能超过原点

1 个父辈 abf7198d
......@@ -185,15 +185,28 @@ namespace TSA_V.DeviceLibrary
}
return result;
}
public static int GetWidthPosition(int targetWidth)
{
// LaodMap();
// LaodMap();
if (WPositionMap.ContainsKey(targetWidth))
{
return WPositionMap[targetWidth];
}
int targetP = (targetWidth - Line_HomeWidth) * Line_ChangeValue;
//轨道位置不能超过原点
if (Line_ChangeValue > 0 && targetP > 0)
{
LogUtil.info($"调宽{targetWidth} 计算目标位置{targetP} 转换系数{Line_ChangeValue},不能超过原点,位置改为=0");
return 0;
}
else if (Line_ChangeValue < 0 && targetP < 0)
{
LogUtil.info($"调宽{targetWidth} 计算目标位置{targetP} 转换系数{Line_ChangeValue},不能超过原点,位置改为=0");
return 0;
}
return targetP;
}
public static Dictionary<int , int> WPositionMap = null;
......
......@@ -39,6 +39,7 @@
this.numTarget = new System.Windows.Forms.NumericUpDown();
this.label5 = new System.Windows.Forms.Label();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.btnHomeM = new System.Windows.Forms.Button();
this.numChangeValue = new System.Windows.Forms.NumericUpDown();
this.numHomeWidth = new System.Windows.Forms.NumericUpDown();
this.numSlv = new System.Windows.Forms.NumericUpDown();
......@@ -52,7 +53,6 @@
this.btnDSave = new System.Windows.Forms.Button();
this.txtWP = new System.Windows.Forms.TextBox();
this.lbWidthMap = new System.Windows.Forms.ListBox();
this.btnHomeM = new System.Windows.Forms.Button();
this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.numTarget)).BeginInit();
this.groupBox2.SuspendLayout();
......@@ -160,7 +160,8 @@
0,
0,
0});
this.numTarget.ValueChanged += new System.EventHandler(this.numTarget_ValueChanged);
this.numTarget.ValueChanged += new System.EventHandler(this.numTarget_ValueChanged);
this.numTarget.Leave += new System.EventHandler(this.numTarget_Leave);
//
// label5
//
......@@ -189,6 +190,18 @@
this.groupBox2.TabStop = false;
this.groupBox2.Text = "轨道配置";
//
// btnHomeM
//
this.btnHomeM.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnHomeM.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnHomeM.Location = new System.Drawing.Point(32, 172);
this.btnHomeM.Name = "btnHomeM";
this.btnHomeM.Size = new System.Drawing.Size(128, 40);
this.btnHomeM.TabIndex = 296;
this.btnHomeM.Text = "原点返回";
this.btnHomeM.UseVisualStyleBackColor = true;
this.btnHomeM.Click += new System.EventHandler(this.btnHomeM_Click);
//
// numChangeValue
//
this.numChangeValue.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
......@@ -364,18 +377,6 @@
this.lbWidthMap.TabIndex = 319;
this.lbWidthMap.SelectedIndexChanged += new System.EventHandler(this.listDetitalP2_SelectedIndexChanged);
//
// btnHomeM
//
this.btnHomeM.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnHomeM.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnHomeM.Location = new System.Drawing.Point(32, 172);
this.btnHomeM.Name = "btnHomeM";
this.btnHomeM.Size = new System.Drawing.Size(128, 40);
this.btnHomeM.TabIndex = 296;
this.btnHomeM.Text = "原点返回";
this.btnHomeM.UseVisualStyleBackColor = true;
this.btnHomeM.Click += new System.EventHandler(this.btnHomeM_Click);
//
// FrmChangeWidth
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
......
......@@ -165,5 +165,14 @@ namespace TSA_V
LogUtil.info(Name+ "点击 原点返回");
PUSICANControl.HomeMove(LWidthManager.Line_NodeAddr, true);
}
private void numTarget_Leave(object sender, EventArgs e)
{
int value = (int)numTarget.Value;
int p = LWidthManager.GetWidthPosition(value);
txtTargetPosition.Text = p.ToString();
}
}
}
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!