|
@@ -94,8 +94,8 @@ namespace UAS_MES
|
|
|
IsAbleDbFind = true;
|
|
|
}
|
|
|
}
|
|
|
- catch (Exception) {
|
|
|
-
|
|
|
+ catch (Exception EB) {
|
|
|
+ LogManager.DoLog(EB.Message);
|
|
|
IsAbleDbFind = false; }
|
|
|
}
|
|
|
|
|
@@ -162,11 +162,11 @@ namespace UAS_MES
|
|
|
//给打开窗体的对应字段赋值
|
|
|
private void DbFindGridView_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
|
|
|
{
|
|
|
+ FormCollection fmCollection = Application.OpenForms;
|
|
|
+ ControlCollection controls = (ControlCollection)fmCollection[FormName].Controls;
|
|
|
try
|
|
|
{
|
|
|
//先判断DataTable里面是否有这个字段,然后从打开的窗口里面去获取到这个Form,从Form中的指定Panel获取到指定字段的控件
|
|
|
- FormCollection fmCollection = Application.OpenForms;
|
|
|
- ControlCollection controls = (ControlCollection)fmCollection[FormName].Controls;
|
|
|
for (int i = 0; i < dt.Columns.Count; i++)
|
|
|
{
|
|
|
fillControl(e, i, fmCollection[FormName]);
|
|
@@ -188,12 +188,78 @@ namespace UAS_MES
|
|
|
catch (Exception ea)
|
|
|
{
|
|
|
LogManager.DoLog(ea.Message);
|
|
|
+ MainControl = fillFormname(FormName, (ControlCollection)fmCollection[FormName].Controls, e);
|
|
|
+ if (MainControl is MaCodeSearchTextBox)
|
|
|
+ {
|
|
|
+ MaCodeSearchTextBox ctl = (MainControl as MaCodeSearchTextBox);
|
|
|
+ ctl.GetData();
|
|
|
+ }
|
|
|
+ if (MainControl is SearchTextBox)
|
|
|
+ {
|
|
|
+ SearchTextBox ctl = (MainControl as SearchTextBox);
|
|
|
+ ctl.GetData();
|
|
|
+ }
|
|
|
+ MainControl.Focus();
|
|
|
SuccessReturnData = false;
|
|
|
}
|
|
|
Dispose();
|
|
|
Close();
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ private Control fillFormname(string fromname, ControlCollection controls, DataGridViewCellEventArgs e)
|
|
|
+ {
|
|
|
+ Control ct = null;
|
|
|
+ if (e.RowIndex >= 0)
|
|
|
+ {
|
|
|
+ switch (fromname)
|
|
|
+ {
|
|
|
+ case "Make_TestCollection":
|
|
|
+ controls[MainField].Text = DbFindGridView.Rows[e.RowIndex].Cells["工单号"].Value.ToString();
|
|
|
+ ct = controls[MainField];
|
|
|
+ break;
|
|
|
+ case "Make_Repair":
|
|
|
+ if (MainField == "cr_code")
|
|
|
+ {
|
|
|
+ controls[MainField].Text = DbFindGridView.Rows[e.RowIndex].Cells["工艺编号"].Value.ToString();
|
|
|
+ }
|
|
|
+ else if (MainField == "cd_stepcode")
|
|
|
+ {
|
|
|
+ controls[MainField].Text = DbFindGridView.Rows[e.RowIndex].Cells["工序编号"].Value.ToString();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ controls[MainField].Text = DbFindGridView.Rows[e.RowIndex].Cells["零件名称"].Value.ToString();
|
|
|
+ }
|
|
|
+ ct = controls[MainField];
|
|
|
+ break;
|
|
|
+ case "OQC_PlanMaintain":
|
|
|
+ if (MainField == "ob_aqlcode")
|
|
|
+ {
|
|
|
+ Control.ControlCollection ctL = controls["panel1"].Controls;
|
|
|
+ ctL[MainField].Text = DbFindGridView.Rows[e.RowIndex].Cells["流水编号"].Value.ToString();
|
|
|
+ ct = ctL[MainField];
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ controls[MainField].Text = DbFindGridView.Rows[e.RowIndex].Cells["方案编号"].Value.ToString();
|
|
|
+ ct = controls[MainField];
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case "OQC_Inspection":
|
|
|
+ controls[MainField].Text = DbFindGridView.Rows[e.RowIndex].Cells["工单号"].Value.ToString();
|
|
|
+ ct = controls[MainField];
|
|
|
+ break;
|
|
|
+ case "Make_FeedingCollection":
|
|
|
+ controls[MainField].Text = DbFindGridView.Rows[e.RowIndex].Cells["工单号"].Value.ToString();
|
|
|
+ ct = controls[MainField];
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return ct;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
private void fillControl(DataGridViewCellEventArgs e, int i, Control ct)
|
|
|
{
|
|
|
for (int j = 0; j < SetValueField.Length; j++)
|