|
|
@@ -145,79 +145,82 @@ namespace UAS_MES.SystemSetting
|
|
|
|
|
|
private void LabelDataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e)
|
|
|
{
|
|
|
- if (LabelDataGridView.Columns[e.ColumnIndex].HeaderText == "预览")
|
|
|
+ if (e.ColumnIndex >= 0 && e.RowIndex >= 0)
|
|
|
{
|
|
|
- //获取路径和标签名称
|
|
|
- LabelPath = LabelDataGridView.Rows[e.RowIndex].Cells["pl_labelurl"].Value.ToString();
|
|
|
- LabelCode = LabelDataGridView.Rows[e.RowIndex].Cells["pl_labelcode"].Value.ToString();
|
|
|
- pl_id1 = LabelDataGridView.Rows[e.RowIndex].Cells["pl_id"].Value.ToString();
|
|
|
- La_id1 = LabelDataGridView.Rows[e.RowIndex].Cells["la_id"].Value.ToString();
|
|
|
- if (CodeSoft.Checked)
|
|
|
+ if (LabelDataGridView.Columns[e.ColumnIndex].HeaderText == "预览")
|
|
|
{
|
|
|
- string LabelName = LabelDataGridView.Rows[e.RowIndex].Cells["pl_labelname"].Value.ToString();
|
|
|
- doc = lbl.Documents.Open(BaseUtil.GetLabelUrl(LabelPath, LabelName));
|
|
|
- if (doc == null)
|
|
|
- {
|
|
|
- MessageBox.Show("指定位置文件不存在");
|
|
|
- return;
|
|
|
- }
|
|
|
- ParamNum = doc.Variables.FreeVariables.Count;
|
|
|
- //去除之前添加的控件
|
|
|
- for (int i = 0; i < (ParamName == null ? 0 : ParamName.Length); i++)
|
|
|
+ //获取路径和标签名称
|
|
|
+ LabelPath = LabelDataGridView.Rows[e.RowIndex].Cells["pl_labelurl"].Value.ToString();
|
|
|
+ LabelCode = LabelDataGridView.Rows[e.RowIndex].Cells["pl_labelcode"].Value.ToString();
|
|
|
+ pl_id1 = LabelDataGridView.Rows[e.RowIndex].Cells["pl_id"].Value.ToString();
|
|
|
+ La_id1 = LabelDataGridView.Rows[e.RowIndex].Cells["la_id"].Value.ToString();
|
|
|
+ if (CodeSoft.Checked)
|
|
|
{
|
|
|
- if (this.Controls["LabelParam"].Controls[ParamName[i] + "_label"] != null)
|
|
|
+ string LabelName = LabelDataGridView.Rows[e.RowIndex].Cells["pl_labelname"].Value.ToString();
|
|
|
+ doc = lbl.Documents.Open(BaseUtil.GetLabelUrl(LabelPath, LabelName));
|
|
|
+ if (doc == null)
|
|
|
{
|
|
|
- this.Controls["LabelParam"].Controls.Remove(this.Controls["LabelParam"].Controls[ParamName[i] + "_label"]);
|
|
|
- this.Controls["LabelParam"].Controls.Remove(this.Controls["LabelParam"].Controls[ParamName[i]]);
|
|
|
+ MessageBox.Show("指定位置文件不存在");
|
|
|
+ return;
|
|
|
}
|
|
|
+ ParamNum = doc.Variables.FreeVariables.Count;
|
|
|
+ //去除之前添加的控件
|
|
|
+ for (int i = 0; i < (ParamName == null ? 0 : ParamName.Length); i++)
|
|
|
+ {
|
|
|
+ if (this.Controls["LabelParam"].Controls[ParamName[i] + "_label"] != null)
|
|
|
+ {
|
|
|
+ this.Controls["LabelParam"].Controls.Remove(this.Controls["LabelParam"].Controls[ParamName[i] + "_label"]);
|
|
|
+ this.Controls["LabelParam"].Controls.Remove(this.Controls["LabelParam"].Controls[ParamName[i]]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ParamName = new string[ParamNum];
|
|
|
+ for (int i = 0; i < ParamNum; i++)
|
|
|
+ {
|
|
|
+ ParamName[i] = doc.Variables.FreeVariables.Item(i + 1).Name;
|
|
|
+ }
|
|
|
+ int y = 20;
|
|
|
+ for (int i = 0; i < ParamName.Length; i++)
|
|
|
+ {
|
|
|
+ //变量的名称Label
|
|
|
+ Label Param = new Label();
|
|
|
+ Param.Text = ParamName[i];
|
|
|
+ Param.Name = ParamName[i] + "_label";
|
|
|
+ Param.AutoSize = true;
|
|
|
+ Param.Anchor = AnchorStyles.Left;
|
|
|
+ Param.Anchor = AnchorStyles.Top;
|
|
|
+ Param.Location = new Point(30, y + 5);
|
|
|
+ this.Controls["LabelParam"].Controls.Add(Param);
|
|
|
+ //维护变量的打印测试参数
|
|
|
+ EnterTextBox TempParam = new EnterTextBox();
|
|
|
+ TempParam.Anchor = AnchorStyles.Left;
|
|
|
+ TempParam.Anchor = AnchorStyles.Top;
|
|
|
+ TempParam.Name = ParamName[i];
|
|
|
+ TempParam.Location = new Point(110, y);
|
|
|
+ y = y + 30;
|
|
|
+ TempParam.Size = new Size(170, 22);
|
|
|
+ this.Controls["LabelParam"].Controls.Add(TempParam);
|
|
|
+ y = y + 30;
|
|
|
+ }
|
|
|
+ doc.Close();
|
|
|
}
|
|
|
- ParamName = new string[ParamNum];
|
|
|
- for (int i = 0; i < ParamNum; i++)
|
|
|
- {
|
|
|
- ParamName[i] = doc.Variables.FreeVariables.Item(i + 1).Name;
|
|
|
- }
|
|
|
- int y = 20;
|
|
|
- for (int i = 0; i < ParamName.Length; i++)
|
|
|
- {
|
|
|
- //变量的名称Label
|
|
|
- Label Param = new Label();
|
|
|
- Param.Text = ParamName[i];
|
|
|
- Param.Name = ParamName[i] + "_label";
|
|
|
- Param.AutoSize = true;
|
|
|
- Param.Anchor = AnchorStyles.Left;
|
|
|
- Param.Anchor = AnchorStyles.Top;
|
|
|
- Param.Location = new Point(30, y + 5);
|
|
|
- this.Controls["LabelParam"].Controls.Add(Param);
|
|
|
- //维护变量的打印测试参数
|
|
|
- EnterTextBox TempParam = new EnterTextBox();
|
|
|
- TempParam.Anchor = AnchorStyles.Left;
|
|
|
- TempParam.Anchor = AnchorStyles.Top;
|
|
|
- TempParam.Name = ParamName[i];
|
|
|
- TempParam.Location = new Point(110, y);
|
|
|
- y = y + 30;
|
|
|
- TempParam.Size = new Size(170, 22);
|
|
|
- this.Controls["LabelParam"].Controls.Add(TempParam);
|
|
|
- y = y + 30;
|
|
|
- }
|
|
|
- doc.Close();
|
|
|
}
|
|
|
- }
|
|
|
- if (LabelDataGridView.Columns[e.ColumnIndex].HeaderText == "编辑")
|
|
|
- {
|
|
|
- if (e.RowIndex >= 0 && e.ColumnIndex >= 0)
|
|
|
+ if (LabelDataGridView.Columns[e.ColumnIndex].HeaderText == "编辑")
|
|
|
{
|
|
|
- LabelPath = LabelDataGridView.Rows[e.RowIndex].Cells["pl_labelurl"].Value.ToString();
|
|
|
- string LabelName = LabelDataGridView.Rows[e.RowIndex].Cells["pl_labelname"].Value.ToString();
|
|
|
- pr_code.Text = LabelDataGridView.Rows[e.RowIndex].Cells["pr_code1"].Value.ToString();
|
|
|
- la_code.Text = LabelDataGridView.Rows[e.RowIndex].Cells["pl_labelcode"].Value.ToString();
|
|
|
- la_name.Text = LabelDataGridView.Rows[e.RowIndex].Cells["pl_labelname"].Value.ToString();
|
|
|
- la_type.Text = LabelDataGridView.Rows[e.RowIndex].Cells["pl_labeltype"].Value.ToString();
|
|
|
- FolderPath.Text = ftpOperater.DownLoadTo;
|
|
|
- pl_id2 = LabelDataGridView.Rows[e.RowIndex].Cells["pl_id"].Value.ToString();
|
|
|
- pr_code_1 = LabelDataGridView.Rows[e.RowIndex].Cells["pr_code1"].Value.ToString();
|
|
|
- la_type_1 = LabelDataGridView.Rows[e.RowIndex].Cells["pl_labeltype"].Value.ToString();
|
|
|
- pl_default = LabelDataGridView.Rows[e.RowIndex].Cells["pl_isdefault"].Value.ToString();
|
|
|
- System.Diagnostics.Process.Start(BaseUtil.GetLabelUrl(LabelPath, LabelName));
|
|
|
+ if (e.RowIndex >= 0 && e.ColumnIndex >= 0)
|
|
|
+ {
|
|
|
+ LabelPath = LabelDataGridView.Rows[e.RowIndex].Cells["pl_labelurl"].Value.ToString();
|
|
|
+ string LabelName = LabelDataGridView.Rows[e.RowIndex].Cells["pl_labelname"].Value.ToString();
|
|
|
+ pr_code.Text = LabelDataGridView.Rows[e.RowIndex].Cells["pr_code1"].Value.ToString();
|
|
|
+ la_code.Text = LabelDataGridView.Rows[e.RowIndex].Cells["pl_labelcode"].Value.ToString();
|
|
|
+ la_name.Text = LabelDataGridView.Rows[e.RowIndex].Cells["pl_labelname"].Value.ToString();
|
|
|
+ la_type.Text = LabelDataGridView.Rows[e.RowIndex].Cells["pl_labeltype"].Value.ToString();
|
|
|
+ FolderPath.Text = ftpOperater.DownLoadTo;
|
|
|
+ pl_id2 = LabelDataGridView.Rows[e.RowIndex].Cells["pl_id"].Value.ToString();
|
|
|
+ pr_code_1 = LabelDataGridView.Rows[e.RowIndex].Cells["pr_code1"].Value.ToString();
|
|
|
+ la_type_1 = LabelDataGridView.Rows[e.RowIndex].Cells["pl_labeltype"].Value.ToString();
|
|
|
+ pl_default = LabelDataGridView.Rows[e.RowIndex].Cells["pl_isdefault"].Value.ToString();
|
|
|
+ System.Diagnostics.Process.Start(BaseUtil.GetLabelUrl(LabelPath, LabelName));
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|