示例#1
0
 private void Button1_Click(object sender, EventArgs e)
 {
     string[] ERRData = new string[3];
     try
     {
         if (RadioButton1.Checked == true)
         {
             ERRData    = Strings.Split(Com_ErrorCode1.Text, ",");
             ERRData[0] = ERRData[0].Replace("\u0022", ""); //把字符串双引号替换掉
             ERRData[1] = ERRData[1].Replace("\u0022", "");
             Mod_ErrorCode.WriteErrorCode(ERRData[0], int.Parse(ERRData[1]));
             FileLog.OperateLog("ErrorCode测试");
         }
         else if (RadioButton2.Checked == true)
         {
             ERRData    = Strings.Split(Com_ErrorCode2.Text, ",");
             ERRData[0] = ERRData[0].Replace("\u0022", "");
             ERRData[1] = ERRData[1].Replace("\u0022", "");
             Mod_ErrorCode.WriteErrorCode(ERRData[0], int.Parse(ERRData[1]));
             FileLog.OperateLog("ErrorCode测试");
         }
         else
         {
             Interaction.MsgBox("-->请选择测试项", (int)MsgBoxStyle.Information + MsgBoxStyle.OkCancel, "提示");
         }
     }
     catch (Exception)
     {
         Interaction.MsgBox("-->请选择测试项", (int)MsgBoxStyle.Information + MsgBoxStyle.OkCancel, "提示");
     }
 }
示例#2
0
 private void Button2_Click(object sender, EventArgs e)
 {
     Mod_ErrorCode.WriteErrorCode(Com_ErrorCode2.Text, 1);
 }
示例#3
0
        public static void Bali_PDCA(string[] upLoadDataRec)
        {
            strBalli = upLoadDataRec;
            string tempLogStr = "";

            try
            {
                switch (UpLoadStep)
                {
                case 10:
                    tempLogStr = "-----------------------" + "\r\n" +
                                 "-->> Start Test: [" + DateTime.Now.ToString("HH:mm:ss") + "]";
                    UpLoad_PDCA_count = 0;
                    UpLoadStep        = 11;
                    break;

                case 11:
                    if (Frm_Engineering.fEngineering.Tcp_PDCA.IsStart == false)
                    {
                        Frm_Engineering.fEngineering.Tcp_PDCA.StartConnect();     //PDCA连接
                        tempLogStr = "与服务端建立握手协议连接...";
                        InitTime.InitialTime();
                        UpLoadStep = 12;
                    }
                    else
                    {
                        InitTime.InitialTime();
                        UpLoadStep = 20;
                    }
                    break;

                case 12:
                    if (Frm_Engineering.fEngineering.Tcp_PDCA.IsStart)
                    {
                        InitTime.InitialTime();
                        UpLoadStep = 20;
                    }
                    else
                    {
                        if (InitTime.TimeIsUp(3000))
                        {
                            tempLogStr = "与服务端握手协议连接超时!";
                            Mod_ErrorCode.WriteErrorCode("ERR-SSW01-50201", 0);
                            UpLoadStep = 250;
                        }
                    }
                    break;

                case 20:
                    CMDRtn = Command.TCP_PDCA_Send(strBalli[0] + ",@");
                    if (CMDRtn == 1)
                    {
                        tempLogStr = "发送信息到Mac Mini ====>[" + strBalli[0] + ",@\n]";
                        UpLoad_PDCA_count++;
                        InitTime.InitialTime();
                        UpLoadStep = 30;
                    }
                    else
                    {
                        InitTime.InitialTime();
                        UpLoadStep = 11;
                    }
                    break;

                case 30:
                    if (PVar.PDCA_Data[0] == "ok")
                    {
                        MLBSN      = VB.Strings.Mid(PVar.PDCA_Data[1], 2, PVar.PDCA_Data[1].Length - 2);
                        tempLogStr = "收到信息: <====[" + PVar.PDCA_StrData + "]";

                        InitTime.InitialTime();
                        UpLoadStep = 40;
                    }
                    else if (InitTime.TimeIsUp(10000))
                    {
                        tempLogStr = "接收ok@{MLBSN}@\n,10S超时 <==== [" + PVar.PDCA_StrData + "]";
                        UpLoadStep = 200;
                    }
                    break;

                case 40:
                    if (CheckResult)
                    {
                        AddList("等待CCD最终复检数据...");
                        tempLogStr = "等待CCD最终复检数据...";
                        InitTime.InitialTime();
                        UpLoadStep = 69;
                    }
                    break;

                case 70:
                    //*************************************************************************************
                    string testDatas = "";
                    testDatas = MLBSN + ":BZ" + "-" + PVar.MeshineSW + "-" + PVar.ParList.MacInfo[9] + "-S6.g0-NN.NN:";
                    for (int i = 2; i <= strBalli.Length - 1; i++)
                    {
                        testDatas = testDatas + strBalli[i] + ":";
                    }
                    testDatas = testDatas + System.Convert.ToString(strBalli.Last()) + ",@mm";
                    CMDRtn    = Command.TCP_PDCA_Send(testDatas);
                    if (CMDRtn == 1)
                    {
                        tempLogStr = "发送信息到Mac Mini ====>[" + testDatas + "\n]";
                        InitTime.InitialTime();
                        UpLoadStep = 80;
                    }
                    else
                    {
                        InitTime.InitialTime();
                        UpLoadStep = 200;
                    }
                    break;

                case 80:
                    if (Command.PDCA_Resule)
                    {
                        if (PVar.PDCA_Data[0] == "ok")
                        {
                            ResultofPDCA = VB.Strings.Mid(PVar.PDCA_Data[1], 2, PVar.PDCA_Data[1].Length - 2);
                            tempLogStr   = "收到信息: <====[" + PVar.PDCA_StrData + "]";
                            UpLoadStep   = 90;
                        }
                        else if (InitTime.TimeIsUp(500))
                        {
                            tempLogStr = "接收信息错误 <==== [" + PVar.PDCA_StrData + "]";
                            UpLoadStep = 200;
                        }
                    }
                    else if (InitTime.TimeIsUp(6000))
                    {
                        tempLogStr = "接收信息6s超时 <==== [" + PVar.PDCA_StrData + "]";
                        UpLoadStep = 200;
                    }
                    break;

                case 90:
                    Frm_Engineering.fEngineering.Tcp_PDCA.SendData(Encoding.UTF8.GetBytes("Check_status,@"));
                    tempLogStr = "发送信息到Mac Mini ====>[Check_status,@]";
                    InitTime.InitialTime();
                    UpLoadStep = 100;
                    break;

                case 100:

                    break;

                case 150:
                    if (System.Convert.ToInt32(API.GetTickCount()) - PVar.CMDSendTime > 5)
                    {
                        Frm_Engineering.fEngineering.Tcp_PDCA.SendData(Encoding.UTF8.GetBytes("Ack,@"));
                        tempLogStr = "发送信息到Mac Mini ====>[Ack,@]";
                        UpLoadStep = 250;
                    }
                    break;

                case 200:
                    if (UpLoad_PDCA_count > 2)
                    {
                        UpLoadStep = 250;
                    }
                    else
                    {
                        MLBSN      = "";
                        tempLogStr = "******上传数据到Mac Mini失败,开始第" + System.Convert.ToString(UpLoad_PDCA_count + 1) + "次上传:";
                        InitTime.InitialTime();
                        UpLoadStep = 210;
                    }
                    break;

                case 210:
                    if (UpLoad_PDCA_count > 3)
                    {
                        tempLogStr = "PDCA上传次数超过" + System.Convert.ToString(UpLoad_PDCA_count + 1) + ",PDCA上传结束";
                        UpLoadStep = 250;
                    }
                    else
                    {
                        if (InitTime.TimeIsUp(1000))
                        {
                            UpLoadStep = 11;
                        }
                    }
                    break;

                case 250:
                    UpLoad_PDCA_count = 0;
                    tempLogStr        = "";
                    PDCAIsWorking     = false;
                    UpLoadStep        = 0;
                    break;
                }

                if (!string.IsNullOrEmpty(tempLogStr))
                {
                    WritePDCALog(PVar.BZ_PDCALogPath + DateTime.Now.ToString("yyyyMM") + "\\", DateTime.Now.ToString("yyyyMMdd") + "-2" + ".log", UpLoadStep + "-->" + tempLogStr);
                    if (PVar.IsOpenFrmEngineering == true)
                    {
                        AddList(UpLoadStep + ":" + tempLogStr);
                    }

                    tempLogStr = "";
                }
            }
            catch (Exception)
            {
                UpLoadStep    = 0;
                PDCAIsWorking = false;
            }
        }