コード例 #1
0
        void deleteNewModelONErr()
        {
            try
            {
                string queryCMD     = "ItemName='" + this.myModelName + "' And PID=" + this.PID;
                int    myExistCount = PNInfo.currPrmtrCountExisted(PNInfo.TopoToatlDS.Tables["TopoTestModel"], queryCMD);

                if (myExistCount > 0)
                {
                    PNInfo.DeleteItemForDT(PNInfo.TopoToatlDS.Tables["TopoTestModel"], queryCMD);
                    PNInfo.mylastIDTestModel = PNInfo.mylastIDTestModel - myExistCount;
                }
                PNInfo.myTestModelAddOKFlag = true;
                PNInfo.myTestPrmtrAddOKFlag = true; //140605_2
                blnAddNewModel  = false;            //140527_00
                btnAdd.Enabled  = true;
                currlst.Enabled = true;
                RefreshModelInfo();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
                RefreshModelInfo();
            }
        }
コード例 #2
0
        private void EquipmentForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            blnUnloadFormflag = true;
            if (this.blnAddNewEquip || AddErr) //140603_1712 Add 判定AddErr-->是否在添加过程中出现错误!
            {
                DialogResult myResult = MessageBox.Show(
                    "尚未完成资料维护!提前退出将可能无法保证资料完整,系统将自动删除当前维护项目资料!",
                    "注意:",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Warning,
                    MessageBoxDefaultButton.Button1);
                try
                {
                    //先删除TopoEquipmentParameter资料!
                    string queryCMD     = "PID=" + this.myPrmtrPID;
                    int    myExistCount = PNInfo.currPrmtrCountExisted(PNInfo.TopoToatlDS.Tables["TopoEquipmentParameter"], queryCMD);

                    if (myResult == DialogResult.OK)
                    {
                        if (myExistCount > 0)
                        {
                            PNInfo.DeleteItemForDT(PNInfo.TopoToatlDS.Tables["TopoEquipmentParameter"], queryCMD);
                            PNInfo.mylastIDTestEquipPrmtr = PNInfo.mylastIDTestEquipPrmtr - myExistCount;
                        }

                        //再删除TopoEquipment资料!
                        queryCMD     = "ItemName='" + this.myEquipName + "' And PID=" + this.PID;
                        myExistCount = PNInfo.currPrmtrCountExisted(PNInfo.TopoToatlDS.Tables["TopoEquipment"], queryCMD);

                        if (myExistCount > 0)
                        {
                            PNInfo.DeleteItemForDT(PNInfo.TopoToatlDS.Tables["TopoEquipment"], queryCMD);
                            PNInfo.mylastIDTestEquip = PNInfo.mylastIDTestEquip - myExistCount;
                        }
                        blnAddNewEquip = false;
                        PNInfo.myTestEquipPrmtrAddOKFlag = true; //140529_1
                        PNInfo.myTestEquipAddOKFlag      = true; //140529_1
                        mylastIndex = -1;                        //140603_2
                        RefreshEquipInfo();
                        this.Dispose();
                    }
                    //else //140604_1
                    //{
                    //    return;
                    //}
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                    RefreshEquipInfo();
                    //return;
                }
            }
            else
            {                                            //140612_3
                PNInfo.myTestEquipPrmtrAddOKFlag = true; //140529_1
                PNInfo.myTestEquipAddOKFlag      = true; //140529_1
            }
        }
コード例 #3
0
        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());
            }
        }
コード例 #4
0
        void exitForm()
        {
            try
            {
                if (this.blnAddNew)
                {
                    DialogResult myResult = MessageBox.Show("尚未完成 TestPlanName= " + this.cboItemName.Text
                                                            + "的资料维护!提前退出将可能无法保证资料完整,系统将自动删除当前维护项目资料!",
                                                            "注意:",
                                                            MessageBoxButtons.OK,
                                                            MessageBoxIcon.Warning,
                                                            MessageBoxDefaultButton.Button1);

                    if (myResult == DialogResult.OK)
                    {
                        string queryCMD     = "ItemName= '" + this.cboItemName.Text.ToString() + "' And PID=" + this.PID;
                        int    myExistCount = PNInfo.currPrmtrCountExisted(PNInfo.TopoToatlDS.Tables["TopoTestPlan"], queryCMD);
                        if (myExistCount > 0)
                        {
                            PNInfo.DeleteItemForDT(PNInfo.TopoToatlDS.Tables["TopoTestPlan"], queryCMD);
                            PNInfo.mylastIDTestPlan = PNInfo.mylastIDTestPlan - myExistCount;
                        }
                        blnAddNew = false;
                        PNInfo.myTestPlanAddOKFlag = true; //140529_1
                        this.Close();
                        Application.OpenForms["PNInfo"].Show();
                    }
                }
                else
                {
                    this.Close();
                    Application.OpenForms["PNInfo"].Show();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
コード例 #5
0
        private void TestParameterInfo_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (this.blnAddNew)
            {
                DialogResult myResult = MessageBox.Show(
                    "尚未完成资料维护!提前退出将可能无法保证资料完整,系统将自动删除当前维护项目资料!",
                    "注意:",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Warning,
                    MessageBoxDefaultButton.Button1);
                try
                {
                    string queryCMD     = "PID=" + this.myPrmtrPID;
                    int    myExistCount = PNInfo.currPrmtrCountExisted(PNInfo.TopoToatlDS.Tables["TopoTestParameter"], queryCMD);
                    if (myResult == DialogResult.OK)
                    {
                        if (myExistCount > 0)
                        {
                            PNInfo.DeleteItemForDT(PNInfo.TopoToatlDS.Tables["TopoTestParameter"], queryCMD);
                            PNInfo.mylastIDTestPrmtr = PNInfo.mylastIDTestPrmtr - myExistCount;
                        }
                        blnAddNew = false;

                        PNInfo.myTestPrmtrAddOKFlag = true;    //140529_1

                        this.Dispose();
                    }
                    else //140604_1
                    {
                        return;
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
            }
        }
コード例 #6
0
 private void CtrlInfo_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (this.blnAddNew)
     {
         DialogResult myResult = MessageBox.Show(
             "尚未完成资料维护!提前退出将可能无法保证资料完整,系统将自动删除当前维护项目资料!",
             "注意:",
             MessageBoxButtons.OK,
             MessageBoxIcon.Warning,
             MessageBoxDefaultButton.Button1);
         try
         {
             string queryCMD     = "ItemName='" + this.cboItemName.Text.ToString() + "' And PID=" + this.PID;
             int    myExistCount = PNInfo.currPrmtrCountExisted(PNInfo.TopoToatlDS.Tables["TopoTestControl"], queryCMD);
             if (myResult == DialogResult.OK)
             {
                 if (myExistCount > 0)
                 {
                     PNInfo.DeleteItemForDT(PNInfo.TopoToatlDS.Tables["TopoTestControl"], queryCMD);
                     PNInfo.mylastIDTestCtrl = PNInfo.mylastIDTestCtrl - myExistCount;
                 }
                 blnAddNew = false;
                 PNInfo.myTestCtrlAddOKFlag = true;
                 this.Dispose();
             }
             //else //140604_1
             //{
             //    return;
             //}
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.ToString());
         }
     }
 }
コード例 #7
0
        private void btnEditPrmtrOK_Click(object sender, EventArgs e)
        {
            try
            {
                showResultBackColor(2);

                //ADD/ Edit value for TopoEquipmentParameter Table
                bool editResult = EditPrmtrInfoForDT(PNInfo.TopoToatlDS.Tables["TopoEquipmentParameter"]);
                //修改颜色还原! txt隐藏!
                txtDGVItem.Visible = false;
                if (PNInfo.currPrmtrCountExisted(PNInfo.TopoToatlDS.Tables["TopoEquipmentParameter"], "PID=" + myPrmtrPID)
                    == PNInfo.currPrmtrCountExisted(PNInfo.GlobalTotalDS.Tables["GlobalAllEquipmentParamterList"], "PID=" + +myGlobalEquipID)
                    )
                {
                    if (editResult && AddErr == false)
                    {
                        PNInfo.ISNeedUpdateflag = true; //140603_2
                        showResultBackColor(0);
                        for (int i = 0; i < dgvEquipPrmtr.Rows.Count; i++)
                        {
                            for (int j = 0; j < dgvEquipPrmtr.Columns.Count; j++)
                            {
                                if (dgvEquipPrmtr.Rows[i].Cells[j].Style.BackColor != Color.White)
                                {
                                    dgvEquipPrmtr.Rows[i].Cells[j].Style.BackColor = Color.White;
                                }
                            }
                        }

                        if (!currlst.Enabled)
                        {
                            currlst.Enabled = true;
                            currlst.Focus();
                        }

                        PNInfo.myTestEquipAddOKFlag      = true;    //140529_1
                        PNInfo.myTestEquipPrmtrAddOKFlag = true;    //140529_1
                        PNInfo.myTestEquipISNewFlag      = false;   //140530_2
                        PNInfo.myTestEquipPrmtrISNewFlag = false;   //140530_2
                        btnAdd.Enabled      = true;
                        btnNextPage.Enabled = true;
                    }
                    else
                    {
                        //blnAddNewEquip = true;
                        currlst.Enabled = false;//140604_0
                        showResultBackColor(1);
                        btnNextPage.Enabled = false;
                        if (this.blnAddNewEquip)
                        {
                            btnAdd.Enabled = false;
                        }
                    }
                }
                else
                {
                    MessageBox.Show("未发现Topo表中有当前选择Equip的参数与Global的Equip参数一致,资料丢失!不允许保存!");
                    showResultBackColor(1);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
                showResultBackColor(1);
            }
        }
コード例 #8
0
        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());
            }
        }