private void btnEditPrmtr_Click(object sender, EventArgs e) { try { if (myPrmtrPID != -1) //140530_3 { PNInfo.myTestPrmtrISNewFlag = false; TestParameterInfo myTestParameterInfo = new TestParameterInfo(); if (myPrmtrPID == -1) { myTestParameterInfo.myPrmtrPID = Convert.ToInt64(this.dgvTestModel.CurrentRow.Cells["ID"].Value); } else { myTestParameterInfo.myPrmtrPID = myPrmtrPID; } myTestParameterInfo.ItemName = PNInfo.getDTColumnInfo(PNInfo.TopoToatlDS.Tables["TopoTestModel"], "ItemName", "ID=" + myPrmtrPID); myTestParameterInfo.ShowDialog(); } else { MessageBox.Show("请选择TestModel后再点击按钮!"); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void btnOK_Click(object sender, EventArgs e) { try { bool result = EditInfoForDT(PNInfo.TopoToatlDS.Tables["TopoTestModel"]); if (result) { PNInfo.ISNeedUpdateflag = true; //140603_2 PNInfo.myTestModelISNewFlag = false; //140530_2 btnNextPage.Enabled = true; PNInfo.myTestModelAddOKFlag = true; //140530_0 //if (blnAddNewModel) //140530_1 if (PNInfo.myTestModelAddOKFlag == true) { if (blnAddNewModel) //140703_2 若为新增Model则强制维护TestParameter >>> { TestParameterInfo myTestParameterInfo = new TestParameterInfo(); myTestParameterInfo.ItemName = currlst.SelectedItem.ToString(); myTestParameterInfo.myPrmtrPID = Convert.ToInt64(PNInfo.getDTColumnInfo(PNInfo.TopoToatlDS.Tables[3], "ID", "ItemName = '" + currlst.SelectedItem.ToString() + "' and PID=" + this.PID)); myPrmtrPID = myTestParameterInfo.myPrmtrPID; myModelName = myTestParameterInfo.ItemName; myTestParameterInfo.blnAddNew = true; //新增Model 对应的Prmtr的PID部分相互处理 //140529 OK myTestParameterInfo.ShowDialog(); if (PNInfo.currPrmtrCountExisted(PNInfo.TopoToatlDS.Tables["TopoTestParameter"], "PID=" + myPrmtrPID) == PNInfo.currPrmtrCountExisted(PNInfo.GlobalTotalDS.Tables["GlobalTestModelParamterList"], "PID=" + myGlobalModelID) ) { blnAddNewModel = false; //140527_00 btnAdd.Enabled = true; currlst.Enabled = true; PNInfo.myTestPrmtrISNewFlag = false; //140530_2 //this.Close(); //140530_4 //140703_2 } else { MessageBox.Show("未发现Topo表中有当前选择Model的参数与Global参数一致,资料丢失!不允许保存! \n 系统将自动删除未完成的TestModel", "注意!", MessageBoxButtons.OK, MessageBoxIcon.Warning); deleteNewModelONErr(); //140530_3 TBD? } } //140703_2 若为新增Model则强制维护TestParameter <<< } //this.Close(); //140530_3 //140703_2 } else { btnNextPage.Enabled = false; } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void btnOK_Click(object sender, EventArgs e) { try { if (this.cboItemName.Text.ToString().Trim().Length == 0 || this.cboChannel.Text.ToString().Trim().Length == 0 || this.cboTemp.Text.ToString().Trim().Length == 0 || this.cboVcc.Text.ToString().Trim().Length == 0 || this.cboPattent.Text.ToString().Trim().Length == 0 || this.cboDataRate.Text.ToString().Trim().Length == 0 || this.txtAuxAttribles.Text.ToString().Trim().Length == 0) //140606 Add { MessageBox.Show("部分资料资料为空白!请确认后再保存!!! "); return; } bool Result = EditInfoForDT(PNInfo.TopoToatlDS.Tables["TopoTestControl"]); if (Result) { runPrmtrMsgState((byte)MsgState.SaveOK); //140709_2 setAuxshow(false); //140811_0 PNInfo.ISNeedUpdateflag = true; //140603_2 cboItemName.BackColor = Color.White; cboItemName.Enabled = false; //140530_4 btnFinish.Enabled = true; PNInfo.myTestCtrlAddOKFlag = true; //140529_1 //if (blnAddNew) if (blnAddNew) //140706_1 //(PNInfo.myTestCtrlAddOKFlag == true) //140530_1 { if (TestCtrlName.Length > 0) { ModelInfo myModelInfo = new ModelInfo(); myModelInfo.blnAddNewModel = blnAddNew; //140430_1 TBD PNInfo.myTestModelAddOKFlag = false; myModelInfo.PID = Convert.ToInt64(PNInfo.getDTColumnInfo(PNInfo.TopoToatlDS.Tables["TopoTestControl"], "ID", "PID=" + PID + " and ItemName='" + TestCtrlName + "'")); myModelInfo.TestCtrlName = TestCtrlName; myModelInfo.ShowDialog(); //show NextForm... blnAddNew = false; //新增一条记录后将新增标志改为false; 140528 TBD 新增需要维护完全信息 this.Close(); //140530_4 } } } else { btnFinish.Enabled = false; } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void currlst_SelectedIndexChanged(object sender, EventArgs e) { try { if (currlst.SelectedIndex != -1) { DataTable myPrmtrDT = new DataTable(); myModelName = this.currlst.SelectedItem.ToString(); myGlobalModelID = Convert.ToInt32(PNInfo.getDTColumnInfo(PNInfo.GlobalTotalDS.Tables["GlobalAllTestModelList"], "ID", "ItemName= '" + myModelName + "'")); //140529_2 if (!blnAddNewModel) { btnOK.Enabled = true; btnNextPage.Enabled = true; getInfoFromDT(PNInfo.TopoToatlDS.Tables["TopoTestModel"], currlst.SelectedIndex); //未存放至Server 此处需进行查询本机未更新的DS myPrmtrPID = PNInfo.getNextTablePIDFromDT(PNInfo.TopoToatlDS.Tables["TopoTestModel"], "ItemName= '" + currlst.SelectedItem.ToString() + "' and PID=" + PID); DataRow[] myRows = PNInfo.TopoToatlDS.Tables["TopoTestParameter"].Select("PID=" + myPrmtrPID); //;("Select * from TopoTestParameter where PID=" + myPrmtrPID, "TopoTestParameter"); if (myRows.Length > 0) { TestPlanPID = Convert.ToInt32(PNInfo.getDTColumnInfo(PNInfo.TopoToatlDS.Tables["TopoTestControl"], "PID", "ID= " + PID)); getEquipLstInfo(TestPlanPID); } else { MessageBox.Show("未发现Topo表中有当前选择Model的参数,资料丢失!"); return; } } else { btnOK.Enabled = true; btnNextPage.Enabled = false; myPrmtrPID = PNInfo.mylastIDTestModel + 1; TestPlanPID = Convert.ToInt32(PNInfo.getDTColumnInfo(PNInfo.TopoToatlDS.Tables["TopoTestControl"], "PID", "ID= " + PID)); getEquipLstInfo(TestPlanPID); //ADD Description:...... } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void TestParameterInfo_Load(object sender, EventArgs e) { try { //initinal Current List currlst.Items.Clear(); this.btnFinish.Enabled = true; //140603_0 txtItemName.Text = ItemName; txtGlobalModelName.Text = ItemName; myGlobalPrmtrPID = Convert.ToInt64(PNInfo.getDTColumnInfo(PNInfo.GlobalTotalDS.Tables[3], "ID", "ItemName = '" + ItemName + "'")); DataRow[] CurrModelLst; CurrModelLst = PNInfo.GlobalTotalDS.Tables["GlobalTestModelParamterList"].Select("PID=" + myGlobalPrmtrPID); //myPrmtrPID 140528 MyPrmtrIndexOK = new bool[CurrModelLst.Length]; if (blnAddNew) { for (int i = 0; i < CurrModelLst.Length; i++) { MyPrmtrIndexOK[i] = false; PNInfo.myTestPrmtrAddOKFlag = false; } } else { //所有的testparameter必须从Global表中载入! //若Global中有删除部分parameter则需要将TopoTestParameter中的对应部分删除 140529 TBD //CurrModelLst = PNInfo.TopoToatlDS.Tables["TopoTestParameter"].Select("PID=" + myPrmtrPID); for (int i = 0; i < CurrModelLst.Length; i++) //需要判定是否Global有新增项目! { MyPrmtrIndexOK[i] = currPrmtrExisted(PNInfo.TopoToatlDS.Tables["TopoTestParameter"], CurrModelLst[i]["ItemName"].ToString()); } } foreach (DataRow dr in CurrModelLst) { currlst.Items.Add(dr["ItemName"]); } //myNewModelcount = CurrModelLst.Length; AddChkArry(CurrModelLst.Length); // 140530_1 ShowMyTip(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
void EditModel(bool isNewModel) { try { btnModelAdd.Enabled = false; btnModelEdit.Enabled = false; blnAddNewModel = isNewModel; ModelInfo myModelInfo = new ModelInfo(); myModelInfo.PID = this.myModelPID; myModelInfo.TestCtrlName = PNInfo.getDTColumnInfo(PNInfo.TopoToatlDS.Tables["TopoTestControl"], "ItemName", "ID=" + myModelPID); // PNInfo.TopoToatlDS.Tables["TopoTestControl"].Rows[ myModelInfo.ShowDialog(); //show NextForm... RefreshMyInfo(false); btnModelAdd.Enabled = true; btnModelEdit.Enabled = true; } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void dgvEquipPrmtr_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e) { try { if (dgvEquipPrmtr.CurrentRow != null && dgvEquipPrmtr.CurrentRow.Index != -1) //140714_0 { string descriptionString = PNInfo.getDTColumnInfo(PNInfo.GlobalTotalDS.Tables["GlobalAllEquipmentParamterList"] , "ItemDescription", "Item='" + dgvEquipPrmtr.CurrentRow.Cells["Item"].Value.ToString() + "' and PID='" + myGlobalEquipID + "'"); string prmtrType = PNInfo.getDTColumnInfo(PNInfo.GlobalTotalDS.Tables["GlobalAllEquipmentParamterList"] , "ItemType", "Item='" + dgvEquipPrmtr.CurrentRow.Cells["Item"].Value.ToString() + "' and PID='" + myGlobalEquipID + "'"); txtSaveResult.Text = "当前单元格资料: \r\n" + dgvEquipPrmtr.CurrentCell.Value.ToString(); //140709_2 this.lblPrmtrType.Text = "参数类型: "; this.lblMyType.Text = prmtrType; if (this.lblMyType.Text.Length == 0) { this.lblMyType.Text = "Not Found ParameterType"; } this.txtDescription.Text = descriptionString; if (this.txtDescription.Text.Length == 0) { this.txtDescription.Text = "Not Found ParameterDescription"; } if (dgvEquipPrmtr.CurrentCell.Value.ToString().Length > 15) //140714_1 { dgvEquipPrmtr.Rows[dgvEquipPrmtr.CurrentRow.Index].Height = 50; } //获取当前的DGV.X,Y;新增txtBox if (dgvEquipPrmtr.RowCount > 0 && ( dgvEquipPrmtr.Columns[dgvEquipPrmtr.CurrentCell.ColumnIndex].HeaderText == "ItemValue" || dgvEquipPrmtr.Columns[dgvEquipPrmtr.CurrentCell.ColumnIndex].HeaderText == "内容" )) { showTxtItem(); //dgvEquipPrmtr.CurrentCell.OwningRow.Cells[e.ColumnIndex - 1].Style.BackColor = Color.Yellow; txtDGVItem.Text = dgvEquipPrmtr.CurrentCell.Value.ToString(); mylastDGVRowIndex = e.RowIndex; mylastDGVColumnIndex = e.ColumnIndex; } else { txtDGVItem.Visible = false; } if (txtDGVItem.Visible && txtDGVItem.Enabled) //140530_1 { txtDGVItem.Focus(); txtDGVItem.BackColor = Color.YellowGreen; txtDGVItem.Refresh(); } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void currlst_SelectedIndexChanged(object sender, EventArgs e) { txtDGVItem.Visible = false; try { if (currlst.SelectedIndex != -1) { txtSaveResult.Text = ""; mylastIndex = currlst.SelectedIndex;//140530_1 myEquipName = this.currlst.SelectedItem.ToString(); int lastChar = myEquipName.IndexOf("_"); myQueryEquipName = myEquipName.Substring(0, lastChar); myGlobalEquipID = Convert.ToInt64(PNInfo.getDTColumnInfo(PNInfo.GlobalTotalDS.Tables["GlobalAllEquipmentList"], "ID", "ItemName='" + myQueryEquipName + "'")); DataTable myPrmtrDT = new DataTable(); if (!blnAddNewEquip) { //140529 TBD 若Global的EquipParameter参数有新增? 但是查询TopoTable无法新增资料? //140529 TBD 如何处理? 删除原Equip 后新增? btnEditPrmtrOK.Enabled = true; getInfoFromDT(PNInfo.TopoToatlDS.Tables["TopoEquipment"], currlst.SelectedIndex); PNInfo.showTablefilterStrInfo(PNInfo.TopoToatlDS.Tables["TopoEquipmentParameter"], dgvEquipPrmtr, "PID=" + myPrmtrPID); //140709_3 if (dgvEquipPrmtr.Columns["Item"].Width + dgvEquipPrmtr.Columns["ItemValue"].Width < dgvEquipPrmtr.Size.Width) { dgvEquipPrmtr.Columns["ItemValue"].Width = dgvEquipPrmtr.Size.Width - dgvEquipPrmtr.Columns["Item"].Width; } int myTopoEquipPrmtrCount = dgvEquipPrmtr.Rows.Count; int myGlobalEquipPrmtrCount = PNInfo.currPrmtrCountExisted(PNInfo.GlobalTotalDS.Tables["GlobalAllEquipmentParamterList"], "PID=" + +myGlobalEquipID); string[,] myValues = new string[myGlobalEquipPrmtrCount, 2]; for (int i = 0; i < myGlobalEquipPrmtrCount; i++) { if (i < myTopoEquipPrmtrCount) { myValues[i, 0] = dgvEquipPrmtr.Rows[i].Cells["Item"].Value.ToString(); myValues[i, 1] = dgvEquipPrmtr.Rows[i].Cells["ItemValue"].Value.ToString(); } else //140707_0 { myValues[i, 0] = ""; myValues[i, 1] = ""; } } if (myTopoEquipPrmtrCount != myGlobalEquipPrmtrCount) { MessageBox.Show("发现Topo表参数数目:" + myTopoEquipPrmtrCount + " Global参数数目:" + myGlobalEquipPrmtrCount + ";\n 参数数目不一致,即将新增" + (myGlobalEquipPrmtrCount - myTopoEquipPrmtrCount) + "条仪器参数!!!"); PNInfo.showTablefilterStrInfo(PNInfo.GlobalTotalDS.Tables["GlobalAllEquipmentParamterList"], dgvEquipPrmtr, "PID=" + myGlobalEquipID); //若Topo表中存在部分资料则需要覆盖掉此部分Global的默认参数! //140709_3 if (dgvEquipPrmtr.Columns["Item"].Width + dgvEquipPrmtr.Columns["ItemValue"].Width < dgvEquipPrmtr.Size.Width) { dgvEquipPrmtr.Columns["ItemValue"].Width = dgvEquipPrmtr.Size.Width - dgvEquipPrmtr.Columns["Item"].Width; } for (int i = 0; i < myGlobalEquipPrmtrCount; i++) { if (myValues[i, 0] == dgvEquipPrmtr.Rows[i].Cells["Item"].Value.ToString()) { dgvEquipPrmtr.Rows[i].Cells["ItemValue"].Value = myValues[i, 1]; } } } } else { btnEditPrmtrOK.Enabled = false; PNInfo.showTablefilterStrInfo(PNInfo.GlobalTotalDS.Tables["GlobalAllEquipmentParamterList"], dgvEquipPrmtr, "PID=" + myGlobalEquipID); myPrmtrPID = PNInfo.mylastIDTestEquip + 1; } PNInfo.hideMyIDPID(dgvEquipPrmtr); if (dgvEquipPrmtr.Columns.Contains("ItemDescription")) //140530_1 { PNInfo.hideMyColumn(dgvEquipPrmtr, "ItemDescription"); } if (dgvEquipPrmtr.Columns.Contains("ItemType")) //140530_1 { PNInfo.hideMyColumn(dgvEquipPrmtr, "ItemType"); } if (dgvEquipPrmtr.Columns.Contains("Item")) //140530_1 { dgvEquipPrmtr.Columns["Item"].HeaderText = "项目"; } if (dgvEquipPrmtr.Columns.Contains("ItemValue")) //140530_1 { dgvEquipPrmtr.Columns["ItemValue"].HeaderText = "内容"; } } else { mylastIndex = -1; } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
void getInfoFromDT(DataTable mydt, int currIndex) { try { string filterString = currlst.SelectedItem.ToString(); long GlobalPrmtrInfoPID; clearGlobalLst(); clearCurrLst(); string PIDString = PNInfo.getDTColumnInfo(PNInfo.GlobalTotalDS.Tables["GlobalAllTestModelList"], "ID", "ItemName='" + ItemName + "'"); if (PIDString.Trim().Length > 0) { GlobalPrmtrInfoPID = Convert.ToInt64(PIDString); gerGlobalDTInfo("ItemName='" + filterString + "' and PID=" + GlobalPrmtrInfoPID); //先载入Global信息! } else { } DataRow[] myROWS = mydt.Select("ItemName='" + filterString + "' and PID=" + myPrmtrPID); if (myROWS.Length == 1) { this.cboItemName.Items.Add(myROWS[0]["ItemName"].ToString()); this.cboItemType.Items.Add(myROWS[0]["ItemType"].ToString()); this.cboDirection.Items.Add(myROWS[0]["Direction"].ToString()); this.cboValue.Items.Add(myROWS[0]["ItemValue"].ToString()); this.cboLowLimit.Items.Add(myROWS[0]["DefaultLowLimit"].ToString()); this.cboUpperLimit.Items.Add(myROWS[0]["DefaultUpperLimit"].ToString()); this.cboSpecific.Items.Add(myROWS[0]["ItemSpecific"].ToString()); this.cboLogRecord.Items.Add(myROWS[0]["LogRecord"].ToString()); this.cboFailbreak.Items.Add(myROWS[0]["Failbreak"].ToString()); this.cboDataRecord.Items.Add(myROWS[0]["DataRecord"].ToString()); } else { if (blnAddNew) { //myNewID= PNInfo.mylastIDTestPrmtr + 1; } else { MessageBox.Show("未发现当前选择资料!请确认是否为新增的参数项目!!! 共有" + myROWS.Length + ("条记录; \n 条件--> ItemName='" + filterString + "' and PID=" + myPrmtrPID + "")); //clearCurrLst(); //return; } } if (this.cboItemName.Items.Count > 0) { this.cboItemName.SelectedIndex = this.cboItemName.Items.Count - 1; this.cboItemType.SelectedIndex = this.cboItemType.Items.Count - 1; this.cboDirection.SelectedIndex = this.cboDirection.Items.Count - 1; this.cboValue.SelectedIndex = this.cboValue.Items.Count - 1; this.cboLowLimit.SelectedIndex = this.cboLowLimit.Items.Count - 1; this.cboUpperLimit.SelectedIndex = this.cboUpperLimit.Items.Count - 1; this.cboSpecific.SelectedIndex = this.cboSpecific.Items.Count - 1; this.cboLogRecord.SelectedIndex = this.cboLogRecord.Items.Count - 1; this.cboFailbreak.SelectedIndex = this.cboFailbreak.Items.Count - 1; this.cboDataRecord.SelectedIndex = this.cboDataRecord.Items.Count - 1; } } catch (Exception ex) { MessageBox.Show(ex.ToString()); clearGlobalLst(); clearCurrLst(); return; } }