Ejemplo n.º 1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(txtEQPPPID.Text) == false && string.IsNullOrEmpty(txtChange_UP.Text) == false && string.IsNullOrEmpty(txtChange_LOW.Text) == false)
                {
                    PInfo.Unit(0).SubUnit(0).MappingEQPPPID(txtEQPPPID.Text).UP_EQPPPID  = txtCurrent_UP.Text;
                    PInfo.Unit(0).SubUnit(0).MappingEQPPPID(txtEQPPPID.Text).LOW_EQPPPID = txtCurrent_LOW.Text;
                    PInfo.Unit(0).SubUnit(0).MappingEQPPPID(txtEQPPPID.Text).DateTime    = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                    PInfo.Unit(0).SubUnit(0).MappingEQPPPID(txtEQPPPID.Text).PPIDCommand = clsInfo.PPIDCMD.Modify;
                    PInfo.SetPPIDCMD(txtEQPPPID.Text);

                    string dstrSQL = string.Format("update `tbEQPPPID` set UP_PPID='{0}', LOW_PPID='{1}' where EQPPPID='{2}';", txtChange_UP.Text, txtChange_LOW.Text, txtEQPPPID.Text);
                    clsDBAct.funExecuteQuery(dstrSQL);

                    DialogResult = System.Windows.Forms.DialogResult.Yes;
                    this.Hide();
                }
                else
                {
                    MessageBox.Show("Input Data Error!!");
                }
            }
            catch (Exception ex)
            {
                this.PInfo.subLog_Set(InfoAct.clsInfo.LogType.CIM, ex.ToString());
            }
        }
Ejemplo n.º 2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(txtEQPPPID.Text) == false && string.IsNullOrEmpty(txtEQPPPID_UP.Text) == false && string.IsNullOrEmpty(txtEQPPPID_LOW.Text) == false)
                {
                    if (PInfo.Unit(0).SubUnit(0).MappingEQPPPID(txtEQPPPID.Text) == null)
                    {
                        string strDateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                        PInfo.Unit(0).SubUnit(0).AddMappingEQPPPID(txtEQPPPID.Text);
                        PInfo.Unit(0).SubUnit(0).MappingEQPPPID(txtEQPPPID.Text);

                        PInfo.Unit(0).SubUnit(0).MappingEQPPPID(txtEQPPPID.Text).UP_EQPPPID  = txtEQPPPID_UP.Text;
                        PInfo.Unit(0).SubUnit(0).MappingEQPPPID(txtEQPPPID.Text).LOW_EQPPPID = txtEQPPPID_LOW.Text;
                        PInfo.Unit(0).SubUnit(0).MappingEQPPPID(txtEQPPPID.Text).DateTime    = strDateTime;
                        PInfo.Unit(0).SubUnit(0).MappingEQPPPID(txtEQPPPID.Text).PPIDCommand = clsInfo.PPIDCMD.Create;
                        PInfo.SetPPIDCMD(txtEQPPPID.Text);

                        //PInfo.subPLCCommand_Set(InfoAct.clsInfo.PLCCommand.OnePPIDRead, 1, txtEQPPPID_UP.Text, "");
                        //subWaitDuringReadFromPLC();

                        //PInfo.subPLCCommand_Set(InfoAct.clsInfo.PLCCommand.OnePPIDRead, 1, txtEQPPPID_LOW.Text, "");
                        //subWaitDuringReadFromPLC();

                        string dstrSQL = string.Format("INSERT INTO `tbEQPPPID` values ('{0}','{1}','{2}', '{3}');", txtEQPPPID.Text, txtEQPPPID_UP.Text, txtEQPPPID_LOW.Text, strDateTime);
                        clsDBAct.funExecuteQuery(dstrSQL);

                        PInfo.All.CreatePPIDName = txtEQPPPID.Text;
                        PInfo.All.CreatePPIDType = 1;

                        //PInfo.subSendSF_Set(InfoAct.clsInfo.SFName.S7F107PPIDCreatDeleteAndPPBodyChangedReport, "1", "1","", txtEQPPPID.Text);
                        DialogResult = System.Windows.Forms.DialogResult.Yes;
                        this.Hide();
                    }
                    else
                    {
                        //Error Message!!
                        MessageBox.Show("Error!! HostPPID Exist!!");
                    }
                }
                else
                {
                    MessageBox.Show("Input Data Error!!");
                }
            }
            catch (Exception ex)
            {
                this.PInfo.subLog_Set(InfoAct.clsInfo.LogType.CIM, ex.ToString());
            }
        }