Example #1
0
 private void StatusFresh()
 {
     while (true)
     {
         try
         {
             if (Globals.MachineMode == MachineModeType.CPKGRR)
             {
                 Label_CPK.Visible = true;
                 Invoker.SetCtltxt(Label_CPK, "CPK:" + System.Convert.ToString(PVar.CPKDoneCounts) + "/32");
             }
             if (Globals.settingMachineInfo.什么机器 == WhichMachine.IPDM)
             {
                 Invoker.SetCtl_BckColor(this.CCD_Status, Globals.TCPIP_CCD1.IsOn ? Color.LimeGreen : Mycolor.Red);
                 Invoker.SetCtl_BckColor(this.Scanner_Status, Globals.TCPIP_Scanner.IsOn ? Color.LimeGreen : Mycolor.Red);
             }
             Invoker.SetCtl_BckColor(this.btn_SSHsts, Globals.SSHconnSt ? Color.LimeGreen : Color.Red);
             Invoker.SetCtl_BckColor(this.Btn_EMG, btn_EMG_Sta ? Mycolor.Red : Color.LimeGreen);
             //CT
             Invoker.SetCtltxt(this.Cycle, ((XTaskManager.Instance.FindTaskById((int)TasksId.Manchine).ElapsedMilliseconds) / 1000).ToString("f1") + "S");
             Invoker.SetCtltxt(this.Product_Num, DataManager.Instance.currentyield.CurrentTotal.ToString());
             FunctionSub.LightStatus(); //指示灯刷新
             //Alarm
             AlarmReport();             //
         }
         catch (Exception ex) { MessageBox.Show(ex.Message); }
         Application.DoEvents();
         Thread.Sleep(200);
     }
 }
Example #2
0
        //CCD九点标定
        public void AutoCalibration0()
        {
            switch (CalibStep[0])
            {
            case 10:
                break;


            case 700:
                Frm_Engineering.fEngineering.PanelCalibration.Enabled = true;
                FunctionSub.AddListCalib("相机自动标定成功!");
                BVar.FileRorW.WriteINI("CCD", "CCD九点标定-吸嘴1", "OK", PVar.BZ_CalibrationFileName);
                CalibStep[0] = 0;
                Frm_Engineering.fEngineering.Timer_Calibration.Enabled = false;
                break;

            case 8000:
                CalibStep[0] = 0;
                Frm_Engineering.fEngineering.PanelCalibration.Enabled = true;
                BVar.FileRorW.WriteINI("CCD", "CCD九点标定-吸嘴1", "NG", PVar.BZ_CalibrationFileName);
                FunctionSub.AddListCalib("相机自动标定失败,请检查!");
                ShowList("相机自动标定失败,请检查!");
                Frm_Engineering.fEngineering.Timer_Calibration.Enabled = false;
                break;
            }
        }
Example #3
0
 private void Frm_Main_Disposed()
 {
     Close_TCP();
     FunctionSub.Close_Serial1();
     FunctionSub.Close_Serial2();
     FunctionSub.Close_Serial3();
 }
Example #4
0
 private void Btn_Login_Click(object sender, EventArgs e)
 {
     Temp = false;
     UserLogin();
     if (Temp == true)
     {
         switch (PVar.sOpenTargetForm)
         {
         case "Frm_Engineering":
             if (PVar.IsOpenFrmEngineering == false && PVar.LoginFrmEngineeringEnable)
             {
                 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;
 }
Example #5
0
        public void WriteLine(string path, string line)
        {
            FunctionSub.Close_Excel_Process();//加载参数前,判断有没有打开Excel,打开的话关掉
            CsvInfo csvInfo = new CsvInfo();

            PathHelper(path);                 //if the path is not exit? creat it by auto
            csvInfo.Path = path;
            csvInfo.Line = line;
            queue.Enqueue(csvInfo);
        }
Example #6
0
 private void FrmMain_Load(object sender, EventArgs e)
 {
     this.Location    = new Point(0, 0);
     this.MinimumSize = this.Size;
     #region 检查执行参数文件夹
     System.IO.DirectoryInfo SFile = new System.IO.DirectoryInfo(PVar.BZ_ParameterPath);
     CheckForIllegalCrossThreadCalls = false;
     if (!SFile.Exists)
     {
         if (Interaction.MsgBox("参数文件不存在,程序拒绝加载,请查看路径:" + "\r\n" + PVar.BZ_ParameterPath + "\r\n" + "执行函数Main_Load()", Constants.vbExclamation, "重要参数文件") == Constants.vbOK)
         {
             //ProjectData.EndApp();
         }
     }
     #endregion
     this.Text                   = Globals.settingMachineInfo.什么机器.ToString();
     PageLogin.loginTp           = loginType.Op;
     PageEngineering.PauseClick += On_Pause;
     //PageEngineering.On_EMG += On_ErrorBtn;
     PageProduction.On_Errorbtn += On_ErrorBtn;
     FunctionSub.Close_Excel_Process();//加载参数前,判断有没有打开Excel,打开的话关掉
     Globals.BindDevice();
     #region 加载Data
     DataManager.Instance.toosing      = DataManager.Instance.toosing.Load();//本机不存在抛料问题
     DataManager.Instance.yield        = DataManager.Instance.yield.Load();
     DataManager.Instance.uph          = DataManager.Instance.uph.Load();
     DataManager.Instance.currentyield = DataManager.Instance.currentyield.LoadCurrentYield();
     DataManager.Instance.alarmRecord  = DataManager.Instance.alarmRecord.Load();
     #endregion
     InitPages();
     InitTask();
     CsvServer.Instance.Start();
     if (Globals.settingMachineInfo.什么机器 == WhichMachine.MMS)
     {
         DAQ.Instance.Start();                                                     //for pci9222 analog
     }
     PVar.LampStatus = 50;
     Globals.InitDevice();
     if (Globals.settingFunc.打开SSH通信)
     {
         SSH_Thread.Instance.Start();
         SSH.Instance.Connect(Globals.settingPara.SSH远程IP地址, 22, Globals.settingPara.SSH用户名, out Globals.SSHconnSt);
     }
     this.Btn_Start.BackColor = Mycolor.Red;
     this.Btn_Pause.BackColor = Mycolor.None;
     this.Btn_Stop.BackColor  = Mycolor.None;
     this.Btn_Start.Enabled   = true;
     this.Btn_Stop.Enabled    = false;
     this.Btn_Pause.Enabled   = true;
     this.timer1.Enabled      = true;
 }
Example #7
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;
            }
        }
Example #8
0
 private void Btn_Cancel_Click(object sender, EventArgs e)
 {
     Frm_Engineering.fEngineering.TabControl1.SelectedIndex = 0;
     FunctionSub.Close_NumberKey_Process();
     this.Close();
 }
Example #9
0
 private void MainPassword_DoubleClick(object sender, EventArgs e)
 {
     FunctionSub.Start_NumberKey_Process();
 }
Example #10
0
        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);
            }
        }
Example #11
0
        public void UserLogin()
        {
            int i = 0;

            FileRw.ReadDatFilePassWord(PVar.BZ_ParameterPath + "PassWord.dat", PVar.Login);
            for (i = 0; i <= MainUserName.Items.Count - 1; i++)
            {
                #region IsOpenFrmLogin true
                if (PVar.IsOpenFrmLogin)
                {
                    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;
                            PVar.isShowAxisPara = false;
                            break;
                        }
                        if (PVar.Login.NewGroup[1] == "Engineering" && PVar.Login.NewUserAuthority[i] == 2)
                        {
                            Temp = true;
                            PVar.isShowAxisPara = true;
                            break;
                        }
                        if (PVar.Login.NewGroup[2] == "FE2" && PVar.Login.NewUserAuthority[i] == 3)
                        {
                            Temp = true;
                            PVar.isShowAxisPara = false;
                            break;
                        }
                    }
                    else
                    {
                        Temp = false;
                    }
                }
                #endregion
                #region isOpenFrmlogion 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;
                    }
                }
                #endregion
            }
            #region password OK
            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
            }
            #endregion
            #region password err
            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;
                }
            }
            #endregion
        }
Example #12
0
 //总入口
 private void Btn_Production_Click(object sender, EventArgs e)
 {
     BoTech.Button btn = sender as BoTech.Button;
     FunctionSub.Close_Key_Process();
     LoadFormAndSetBtBkColor(btn);
 }