ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • Example of handling code when receiving PortStatusChange
    IT Story/C# & WPF 2022. 7. 3. 17:32
    반응형
    private void s_PortStatusChange(string sACTVal)
            {
                try
                {
                    switch (sACTVal)
                    {
                        case "LR":       //LR
                            this.m_Info.Port(1).StatusBak = this.m_Info.Port(1).Status;
                            this.m_Info.Port(1).Initial(this.m_Info.Port(1).CSTColCount, this.m_Info.Port(1).CSTRowCount);          //EQP에서 Load Request 받았을 때
                            this.m_Info.Port(1).Status = Structure.classStructure.PortStatus.LDRQ;
                            this.m_Info.Set_SendSF(Structure.classStructure.SFName.S6F11RelatedPortEvent, 31, 1, "");
                            break;
    
                        case "LC":       //LC
                            this.m_Info.Port(1).StatusBak = this.m_Info.Port(1).Status;
                            // Port의 이전 상태가 Load Request 가 아니면 백업한 Data를 복원할지 물어본다.
                            if (this.m_Info.Port(1).StatusBak != Structure.classStructure.PortStatus.LDRQ)
                            {
                                DialogResult drResult = DialogResult.None;
                                drResult = MessageBox.Show("Port State가 Load Request 상태를 거치지 않고 Load Complete가 되었습니다.\n\rPort Data를 복원 하시겠습니까??", "PORT DATA RECOVERY", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                                if (drResult == DialogResult.Yes)
                                    this.subPortDataLoading(1);
                            }
    
                            this.m_Info.Port(1).Status = Structure.classStructure.PortStatus.LDCM;
                            this.m_Info.Port(1).ProcessStartTime = DateTime.Now.ToString("yyyyMMddHHmmss");
                            this.m_Info.Set_SendSF(Structure.classStructure.SFName.S6F11RelatedPortEvent, 32, 1, this.m_Info.Port(1).CSTID);
                            this.m_Info.Set_SendSF(Structure.classStructure.SFName.S6F11RelatedJobProcessEvent, 1, 1);
                            break;
    
                        case "UR":       //UR
                            this.m_Info.Port(1).StatusBak = this.m_Info.Port(1).Status;
                            this.m_Info.Port(1).Status = Structure.classStructure.PortStatus.UDRQ;
                            this.m_Info.Port(1).ProcessEndTime = DateTime.Now.ToString("yyyyMMddHHmmss");
                            this.m_Info.Set_SendSF(Structure.classStructure.SFName.S6F11RelatedPortEvent, 33, 1, this.m_Info.Port(1).CSTID);
    
                            if (this.m_Info.EQP("Main").PLCDummy == true)
                            {
                                this.m_Info.Port(1).CSTID = "CST" + DateTime.Now.ToString("yyyyMMddHHmmss");
    
                                for (int nloop = 1; nloop <= 105; nloop++)
                                {
                                    this.m_Info.Port(1).Slot(nloop).GlsExist = true;
                                    this.m_Info.Port(1).Slot(nloop).LOTACTION = "OK";
                                    this.m_Info.Port(1).Slot(nloop).STEPID = "PASS";
                                    this.m_Info.Port(1).Slot(nloop).E_PANELID = "6TBC" + nloop.ToString().PadLeft(3, '0') + "TES";
                                    this.m_Info.Port(1).Slot(nloop).H_PANELID = "6TBC" + nloop.ToString().PadLeft(3, '0') + ".TES";
                                }
    
                            }
    
                            if (this.m_Info.Port(1).CSTID != string.Empty)
                            {
                                //Printer에게 Label 출력 명령을 내린다. : doubt2000 김정훈 
                                EnuCommon.PrinterErrCode enuReturn = this.m_Label.MakeLabelData(this.m_Info.Port(1).CSTID);
                                if (enuReturn != EnuCommon.PrinterErrCode.NoError)
                                    this.m_Info.Set_Log(EnuCommon.LogType.CIM, "Printer Make Label Data Error : " + enuReturn.ToString());
    
                                enuReturn = this.m_Label.SendLabeData(this.m_Info.Port(1).CSTID);
                                if (enuReturn != EnuCommon.PrinterErrCode.NoError)
                                    this.m_Info.Set_Log(EnuCommon.LogType.CIM, "Printer Send Label Data Error : " + enuReturn.ToString());
    
                                //"PROCESS START TIME", "PROCESS END TIME", "FILE NAME", "CSTID", "NG COUNT", "NG SLOT"
                                string sCSTLog = this.m_Info.Port(1).ProcessStartTime + "?" + this.m_Info.Port(1).ProcessEndTime + "?" + this.m_Info.Port(1).CSTID + ".txt?" + this.m_Info.Port(1).CSTID + "?" + this.m_Info.Port(1).GLSNGCnt + "?" + this.m_Info.Port(1).GLSNGSlot;
                                this.m_Info.Set_Log(EnuCommon.LogType.CST, sCSTLog);
                            }
                            else
                                this.m_Info.Set_Log(EnuCommon.LogType.CIM, "Un-Load Request 시 CSTID 없음!");
                            break;
    
                        case "UC":       //UC
                            this.m_Info.Port(1).StatusBak = this.m_Info.Port(1).Status;
                            this.m_Info.Port(1).Status = Structure.classStructure.PortStatus.UDCM;
                            this.m_Info.Set_SendSF(Structure.classStructure.SFName.S6F11RelatedJobProcessEvent, 7, 1);
                            this.m_Info.Set_SendSF(Structure.classStructure.SFName.S6F11RelatedPortEvent, 34, 1, this.m_Info.Port(1).CSTID);
                            break;
    
                        default:
                            break;
                    }
                }
                catch (Exception ex)
                {
                    this.m_Info.Set_Log(Common.EnuCommon.LogType.CIM, ex.ToString());
                }
            }
    반응형

    댓글

Designed by Tistory.