コード例 #1
0
ファイル: Frm_Main.cs プロジェクト: xhyangxianjun/wangliang
 private void Frm_Main_Disposed()
 {
     Close_TCP();
     FunctionSub.Close_Serial1();
     FunctionSub.Close_Serial2();
     FunctionSub.Close_Serial3();
 }
コード例 #2
0
        private void Btn_ParSave_Click(object sender, EventArgs e)
        {
            if (CheeckPar() == false)
            {
                Par_Normal("Read");
                FileLog.OperateLog("保存参数按钮,失败");
                return;
            }

            Par_Normal("Write");
            FileLog.OperateLog("保存参数按钮,成功");
            TableLayoutPanel1.Enabled = false;
            TableLayoutPanel3.Enabled = false;
            TableLayoutPanel4.Enabled = false;
            Par_Normal("Read");
            FunctionSub.Init_Serial1(); //重新加载串口
            FunctionSub.Init_Serial2(); //重新加载串口
            FunctionSub.Init_Serial3(); //重新加载串口

            if (Interaction.MsgBox("参数保存OK!", Constants.vbOKOnly, "提示") == Constants.vbOK)
            {
                return;
            }
        }
コード例 #3
0
ファイル: Line1Run.cs プロジェクト: xhyangxianjun/wangliang
        public void Frm_L1Adddata()
        {
            int    tempRow    = 0;
            string Error_Str  = "";
            string Error_Str1 = "";

            try
            {
                //查找条码
                //if (BarCodeData != "")
                //    {
                //    Frm_L1Adddata_tempBarcode = BarCodeData.Trim();
                //    BarCodeData = "";
                //    }
                //else
                //    {
                //    Frm_L1Adddata_tempBarcode = DateTime.Now.ToString("HH:mm:ss");
                //    }
                tempRow = FunctionSub.FindRowfromSN(Frm_L1Adddata_tempBarcode);

                if (tempRow == 100)                        //新的条码
                {
                    PVar.DataCount = PVar.DataCount % 100; //加到100则为0
                    while (true)
                    {
                        if (PVar.BarcodeArrayList[PVar.DataCount] != "")
                        {
                            if (PVar.BarcodeArrayList[PVar.DataCount] == BVar.ProData[2, 1] || PVar.BarcodeArrayList[PVar.DataCount] == BVar.ProData[3, 1])
                            {
                                PVar.DataCount++; //数据计数,便于datagrid数据显示
                                PVar.DataCount = PVar.DataCount % 100;
                            }
                            else
                            {
                                break;
                            }
                            Application.DoEvents();
                        }
                        else
                        {
                            break;
                        }
                    }
                    BVar.FileRorW.WriteINI("Data100Count", "Count", System.Convert.ToString(PVar.DataCount), PVar.ListDataIniPath);
                    tempRow         = PVar.DataCount;
                    tempTestData[0] = DateTime.Now.ToString("yyyy-MM-dd");
                    tempTestData[1] = DateTime.Now.ToString("HH:mm:ss");
                    tempTestData[2] = DateTime.Now.ToString(Frm_L1Adddata_tempBarcode);
                    PVar.BarcodeArrayList[tempRow] = Frm_L1Adddata_tempBarcode; //将条码存到数组缓存区
                    //---------------------
                    //记录:日期,时间,条码
                    //---------------------
                    for (int i = 0; i <= 2; i++)
                    {
                        BVar.FileRorW.WriteINI(tempRow.ToString(), PVar.DataGrid_CheckDataHeadName[i], tempTestData[i], PVar.ListDataIniPath); //写入本地
                        FunctionSub.Grid_TestData_Show(Frm_Engineering.fEngineering.DataGrid_CheckData, tempRow, i, tempTestData[i]);          //显示在工程界面上
                    }

                    try
                    {
                        Frm_Engineering.fEngineering.DataGrid_CheckData.CurrentCell            = Frm_Engineering.fEngineering.DataGrid_CheckData.Rows[tempRow].Cells[0];
                        Frm_Engineering.fEngineering.DataGrid_CheckData.Rows[tempRow].Selected = true;
                    }
                    catch (Exception)
                    {
                    }
                    PVar.DataCount++; //数据计数,便于datagrid数据显示
                }
                else
                {
                    tempTestData[0] = DateTime.Now.ToString("yyyy-MM-dd");
                    tempTestData[1] = DateTime.Now.ToString("HH:mm:ss");
                    tempTestData[2] = DateTime.Now.ToString(Frm_L1Adddata_tempBarcode);
                    PVar.BarcodeArrayList[tempRow] = Frm_L1Adddata_tempBarcode; //将条码存到数组缓存区
                    //---------------------
                    //记录:日期,时间,条码
                    //---------------------
                    for (int i = 0; i <= 2; i++)
                    {
                        BVar.FileRorW.WriteINI(tempRow.ToString(), PVar.DataGrid_CheckDataHeadName[i], tempTestData[i], PVar.ListDataIniPath); //写入本地
                        FunctionSub.Grid_TestData_Show(Frm_Engineering.fEngineering.DataGrid_CheckData, tempRow, i, tempTestData[i]);          //显示在工程界面上
                    }

                    try
                    {
                        Frm_Engineering.fEngineering.DataGrid_CheckData.CurrentCell            = Frm_Engineering.fEngineering.DataGrid_CheckData.Rows[tempRow].Cells[0];
                        Frm_Engineering.fEngineering.DataGrid_CheckData.Rows[tempRow].Selected = true;
                    }
                    catch (Exception)
                    {
                    }
                }
            }
            catch (Exception exc)
            {
                Frm_Engineering.fEngineering.MacStop();
                MessageBox.Show(exc.Message);
                Error_Str  = PVar.BZ_LogPath + DateTime.Now.ToString("yyyyMMdd") + "\\" + DateTime.Now.ToString("yyyyMMdd") + "_代码异常记录" + ".txt";
                Error_Str1 = "\r\n" + "※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※" + "\r\n" +
                             "[" + DateTime.Now.ToString("HH:mm:ss") + "]" + "\r\n" + exc.ToString();
                FileRw.WriteDattxt(Error_Str, Error_Str1);
            }
        }
コード例 #4
0
ファイル: Frm_Login.cs プロジェクト: xhyangxianjun/wangliang
 private void Btn_Cancel_Click(object sender, EventArgs e)
 {
     Frm_Engineering.fEngineering.TabControl1.SelectedIndex = 0;
     FunctionSub.Close_NumberKey_Process();
     this.Close();
 }
コード例 #5
0
ファイル: Frm_Login.cs プロジェクト: xhyangxianjun/wangliang
 private void MainPassword_DoubleClick(object sender, EventArgs e)
 {
     FunctionSub.Start_NumberKey_Process();
 }
コード例 #6
0
ファイル: Frm_Main.cs プロジェクト: xhyangxianjun/wangliang
        public void UserLogin()
        {
            int i = 0;

            FileRw.ReadDatFilePassWord(PVar.BZ_ParameterPath + "PassWord.dat", PVar.Login);
            for (i = 0; i <= MainUserName.Items.Count - 1; i++)
            {
                if (PVar.IsOpenFrmLogin)
                {
                    if (Frm_Login.fLogin.MainUserName.Text == "Administrator" && Frm_Login.fLogin.MainPassword.Text == "zhanzw314177011")
                    {
                        Frm_Engineering.fEngineering.机械参数.Parent = Frm_Engineering.fEngineering.TabControl4;
                        PVar.LoginFrmEngineeringEnable           = true;
                        PVar.LoginFrmParEnable     = true;
                        PVar.LoginFrmParCCDEnable  = true;
                        PVar.LoginMachineParEnable = true;
                        PVar.LoginOutputEnable     = true;
                        PVar.LoginManualEnable     = true;
                        return;
                    }
                    Frm_Engineering.fEngineering.机械参数.Parent = null;
                    if (PVar.sOpenTargetForm == "Frm_Engineering" && MainUserName.Text == PVar.Login.NewUser[i] && PVar.Login.NewUserAuthority[i] == 3)
                    {
                        Interaction.MsgBox("该用户无权限,请重新选择用户!", Constants.vbOKOnly, "提示");
                        return;
                    }
                    if ((Frm_Login.fLogin.MainUserName.Text == PVar.Login.NewUser[i] && Frm_Login.fLogin.MainPassword.Text == PVar.Login.NewPassword[i] && Convert.ToString(Frm_Login.fLogin.MainUserName.Items[i]) != "") && (PVar.Login.NewUserAuthority[i] == 1 || PVar.Login.NewUserAuthority[i] == 2 || PVar.Login.NewUserAuthority[i] == 3))
                    {
                        if (PVar.Login.NewGroup[0] == "Post Safe" && PVar.Login.NewUserAuthority[i] == 1)
                        {
                            Temp = true;
                            break;
                        }
                        if (PVar.Login.NewGroup[1] == "Engineering" && PVar.Login.NewUserAuthority[i] == 2)
                        {
                            Temp = true;
                            break;
                        }
                        if (PVar.Login.NewGroup[2] == "FE2" && PVar.Login.NewUserAuthority[i] == 3)
                        {
                            Temp = true;
                            break;
                        }
                    }
                    else
                    {
                        Temp = false;
                    }
                }
                else
                {
                    if (PVar.sOpenTargetForm == "Frm_Engineering" && MainUserName.Text == PVar.Login.NewUser[i] && PVar.Login.NewUserAuthority[i] == 3)
                    {
                        Interaction.MsgBox("该用户无权限,请重新选择用户!", Constants.vbOKOnly, "提示");
                        return;
                    }
                    if ((MainUserName.Text == PVar.Login.NewUser[i] && MainPassword.Text == PVar.Login.NewPassword[i] && Convert.ToString(MainUserName.Items[i]) != "") && (PVar.Login.NewUserAuthority[i] == 0 || PVar.Login.NewUserAuthority[i] == 1 || PVar.Login.NewUserAuthority[i] == 2 || PVar.Login.NewUserAuthority[i] == 3))
                    {
                        if (PVar.Login.NewGroup[0] == "Post Safe" && PVar.Login.NewUserAuthority[i] == 1)
                        {
                            Temp = true;
                            break;
                        }
                        if (PVar.Login.NewGroup[1] == "Engineering" && PVar.Login.NewUserAuthority[i] == 2)
                        {
                            Temp = true;
                            break;
                        }
                        if (PVar.Login.NewGroup[2] == "FE2" && PVar.Login.NewUserAuthority[i] == 3)
                        {
                            Temp = true;
                            break;
                        }
                        else
                        {
                            Temp = true;
                            break;
                        }
                    }
                    else
                    {
                        Temp = false;
                    }
                }
            }
            if (Temp == true)
            {
                if (PVar.Login.NewUserAuthority[i] == 1) //Post Safe
                {
                    PVar.LoginFrmEngineeringEnable = true;
                    PVar.LoginFrmParEnable         = true;
                    PVar.LoginFrmParCCDEnable      = true;
                    PVar.LoginMachineParEnable     = true;
                    PVar.LoginOutputEnable         = true;
                    PVar.LoginManualEnable         = true;
                }
                if (PVar.Login.NewUserAuthority[i] == 2) //Engineering
                {
                    PVar.LoginFrmEngineeringEnable = true;
                    PVar.LoginFrmParEnable         = true;
                    PVar.LoginFrmParCCDEnable      = true;
                    PVar.LoginOutputEnable         = true;
                    PVar.LoginMachineParEnable     = true;
                    PVar.LoginManualEnable         = true;
                }
                if (PVar.Login.NewUserAuthority[i] == 3) //FE2
                {
                    PVar.LoginFrmEngineeringEnable = false;
                    PVar.LoginFrmParEnable         = false;
                    PVar.LoginOutputEnable         = true;
                }
                FunctionSub.Close_NumberKey_Process();
                //Temp = False
            }
            else
            {
                PVar.LoginFrmEngineeringEnable = false;
                PVar.LoginFrmParEnable         = false;
                PVar.LoginFrmParCCDEnable      = false;
                PVar.LoginOutputEnable         = false;
                PVar.LoginManualEnable         = false;
                PVar.LoginMachineParEnable     = false;
                if (Interaction.MsgBox("密码输入错误,请重新输入!", Constants.vbOKOnly, "提示") == Constants.vbOK)
                {
                    if (PVar.IsOpenFrmLogin)
                    {
                        Frm_Login.fLogin.MainPassword.Text = "";
                        Frm_Login.fLogin.MainPassword.Focus();
                    }
                    else
                    {
                        this.MainPassword.Text = "";
                        this.MainPassword.Focus();
                    }
                    return;
                }
            }
        }
コード例 #7
0
ファイル: Frm_Main.cs プロジェクト: xhyangxianjun/wangliang
        private void Btn_Login_Click(object sender, EventArgs e)
        {
            Frm_Engineering.fEngineering.机械参数.Parent = null;
            if (MainUserName.Text == "Administrator" && MainPassword.Text == "zhanzw314177011")
            {
                FunctionSub.Close_NumberKey_Process();
                Frm_Engineering.fEngineering.Show(this);
                PVar.IsOpenFrmEngineering      = true;
                this.BackColor                 = Color.White;
                Btn_Home.BZ_BackColor          = PVar.BZColor_UnselectedBtn;
                Btn_OpenDataFile.BZ_BackColor  = Color.White;
                Btn_OpenCCDFile.BZ_BackColor   = Color.White;
                PVar.LoginFrmEngineeringEnable = false;
                PVar.LoginFrmParEnable         = false;
                PVar.LoginFrmParCCDEnable      = false;
                PVar.LoginOutputEnable         = false;
                PVar.LoginManualEnable         = false;
                PVar.LoginMachineParEnable     = false;
                RestoreLoginDialog();
                return;
            }

            if (MainUserName.Text == "OP")
            {
                Frm_Engineering.fEngineering.TabPage3.Parent = null;
                Frm_Engineering.fEngineering.TabPage4.Parent = null;
                FunctionSub.Close_NumberKey_Process();
                Frm_Engineering.fEngineering.Show(this);
                PVar.IsOpenFrmEngineering      = true;
                this.BackColor                 = Color.White;
                Btn_Home.BZ_BackColor          = PVar.BZColor_UnselectedBtn;
                Btn_OpenDataFile.BZ_BackColor  = Color.White;
                Btn_OpenCCDFile.BZ_BackColor   = Color.White;
                PVar.LoginFrmEngineeringEnable = false;
                PVar.LoginFrmParEnable         = false;
                PVar.LoginFrmParCCDEnable      = false;
                PVar.LoginOutputEnable         = false;
                PVar.LoginManualEnable         = false;
                PVar.LoginMachineParEnable     = false;
                RestoreLoginDialog();
                return;
            }
            Temp = false;
            UserLogin();
            if (Temp == true)
            {
                switch (PVar.sOpenTargetForm)
                {
                case "Frm_Engineering":
                    if (PVar.IsOpenFrmEngineering == false && PVar.LoginFrmEngineeringEnable)
                    {
                        Frm_Engineering.fEngineering.TabPage3.Parent = Frm_Engineering.fEngineering.TabControl1;
                        Frm_Engineering.fEngineering.TabPage4.Parent = Frm_Engineering.fEngineering.TabControl1;
                        FunctionSub.Close_NumberKey_Process();
                        Frm_Engineering.fEngineering.Show(this);
                        PVar.IsOpenFrmEngineering      = true;
                        this.BackColor                 = Color.White;
                        Btn_Home.BZ_BackColor          = PVar.BZColor_UnselectedBtn;
                        Btn_OpenDataFile.BZ_BackColor  = Color.White;
                        Btn_OpenCCDFile.BZ_BackColor   = Color.White;
                        PVar.LoginFrmEngineeringEnable = false;
                        PVar.LoginFrmParEnable         = false;
                        PVar.LoginFrmParCCDEnable      = false;
                        PVar.LoginOutputEnable         = false;
                        PVar.LoginManualEnable         = false;
                        PVar.LoginMachineParEnable     = false;
                        RestoreLoginDialog();
                    }
                    break;
                }
            }
            Temp = false;
        }
コード例 #8
0
ファイル: Frm_Main.cs プロジェクト: xhyangxianjun/wangliang
 //总入口
 private void Btn_Production_Click(object sender, EventArgs e)
 {
     BoTech.Button btn = sender as BoTech.Button;
     FunctionSub.Close_Key_Process();
     LoadFormAndSetBtBkColor(btn);
 }