protected override int InnerExecute() { int index = -1; int wipCount1 = 1; // 1 CGlassDataPropertiesWHTM glassData1 = null; List <int> jobDataA1 = null; index = int.Parse(_values["GLS_INDEX"]); if (index == -1) { return(-1); } if (_isManualMode) { glassData1 = new CGlassDataPropertiesWHTM(); glassData1.GlassIndex = 1; glassData1.CassetteIndex = 2; glassData1.CassetteIndex = 2; glassData1.ProductCode = 1; glassData1.GlassThickness = 1; glassData1.LotID = "GA"; glassData1.GlassID = "GB"; glassData1.PPID = "1"; glassData1.GlassType = 1; glassData1.JobJudge = "G"; glassData1.JobState = 5; glassData1.JobGrade = "G"; glassData1.TrackingData = 1000; glassData1.UnitPathNo = 1; glassData1.SlotNo = 0; glassData1.CycleTime = 10000; glassData1.TactTime = 10000; glassData1.ReasonCode = 1; glassData1.SamplingFlag = 1; glassData1.LotEndFlag = 1; glassData1.OperationId = "ABCDEFG"; glassData1.ProductId = "ABCDEFGAA"; glassData1.CassetteId = "ABCDEFGAA"; jobDataA1 = CGlassDataPropertiesWHTM.ConvertPLCData(glassData1); wipCount1 = 1; } else { AMaterialData materialData = _main.GetReceivedGlassDataByLoc(_component.ControlName, index); glassData1 = materialData as CGlassDataPropertiesWHTM; glassData1.UnitPathNo = 301; glassData1.SlotNo = 0; jobDataA1 = CGlassDataPropertiesWHTM.ConvertPLCData(glassData1); wipCount1 = 1; } _main.MelsecNetMultiWordWrite(OW_FORWARD_RECEIVED_JOB_REPORT_JOBDATAA1, jobDataA1); _main.MelsecNetWordWrite(OW_FORWARD_RECEIVED_JOB_REPORT_CURRENT_WIP_COUNT1, wipCount1); Log(string.Format("{0}\t{1}", _component.ControlName, string.Format("PGM DATA SEND - JOB DATA1={0} WIP COUNT1={1}", glassData1.ToString(), wipCount1))); Log(string.Format("{0}\t{1}", _component.ControlName, "PGM DATA DISPLAY")); CTimeout timeout = CTimeoutManager.GetTimeout(_controlName, T1); timeout.TargetOffValueCheck = true; timeout.Begin(OB_FORWARD_RECEIVED_JOB_REPORT, _main.CONTROLATTRIBUTES.GetProperty(IB_FORWARD_RECEIVED_JOB_REPORT.ControlName, IB_FORWARD_RECEIVED_JOB_REPORT.AttributeName) as ITimeoutResource); _main.MelsecNetBitOnOff(OB_FORWARD_RECEIVED_JOB_REPORT, true); Thread.Sleep(1000); IB_FORWARD_RECEIVED_JOB_REPORT.Value = true.ToString(); string tempMsg = ""; bool error = false; if (CTimeout.WaitSync(timeout, 10)) { } else { error = true; _main.MelsecNetBitOnOff(OB_FORWARD_RECEIVED_JOB_REPORT, false); tempMsg = string.Format("PGM DATA TIMEOUT No response [timeout T1={0} sec]", T1 / 1000); Log(string.Format("{0}\t{1}", _component.ControlName, tempMsg)); } Log(string.Format("{0}\t{1}", _component.ControlName, "PGM DATA DISPLAY")); CSubject subject = null; if (glassData1 != null) { if (index == 0) { subject = CUIManager.Inst.GetData("ucGlassData"); subject.SetValue("Data", CGlassDataPropertiesWHTM.GetGuiData(glassData1)); subject.Notify(); } else { subject = CUIManager.Inst.GetData("ucGlassData"); subject.SetValue("Data2", CGlassDataPropertiesWHTM.GetGuiData(glassData1)); subject.Notify(); } } if (!error) { return(0); } #region 메시지 창 표시 string receivedTime = DateTime.Now.ToString("yyyyMMdd HH:mm:ss"); string msgId = "0"; string message = string.Format("[{0}] {1}", this.Name, tempMsg); string panelNo = "1"; subject = CUIManager.Inst.GetData("CIMMessage"); subject.SetValue("List", new List <string>() { "MESSAGE_SET", msgId, receivedTime, message, panelNo }); subject.Notify(); #endregion return(0); }
protected override int InnerExecute() { //받아서 처리하는 부분 //양전자 RECIPE 가져오는 곳 List <int> jobDataB1 = new List <int>(); List <int> jobDataB2 = new List <int>(); CGlassDataPropertiesWHTM glassData1 = null; CGlassDataPropertiesWHTM glassData2 = null; userNewGlassData.UnitPathNo = 301; userNewGlassData.SlotNo = 0; List <int> changedJobData = new List <int>(); if (_userRequest) { _userRequest = false; if (userNewGlassData != null) { jobDataB1 = CGlassDataPropertiesWHTM.ConvertPLCDataB(userNewGlassData); //jobDataB1 = CGlassDataPropertiesWHTM.ConvertPLCDataB(new CGlassDataPropertiesWHTM()); } } else { AMaterialData materialData = _main.GetReceivedGlassDataByLoc(_component.ControlName, 0); glassData1 = materialData as CGlassDataPropertiesWHTM; jobDataB1 = CGlassDataPropertiesWHTM.ConvertPLCDataB(glassData1); AMaterialData materialData2 = _main.GetReceivedGlassDataByLoc(_component.ControlName, 1); glassData2 = materialData2 as CGlassDataPropertiesWHTM; jobDataB2 = CGlassDataPropertiesWHTM.ConvertPLCDataB(glassData2); } _main.MelsecNetMultiWordWrite(OW_JOB_JUDGE_CHANGE_JOBDATAB, jobDataB1); //_main.MelsecNetMultiWordWrite(OW_JOB_JUDGE_CHANGE_JOBDATAB, jobDataB2); //_main.MelsecNetBitOnOff(OB_JOB_JUDGE_CHANGE, true); Log(string.Format("{0}\t{1}", _component.ControlName, string.Format("PGM DATA SEND - RECIPEID={0}", ""))); //CSubject subject = CUIManager.Inst.GetData("ucCimStatus"); //subject.SetValue("EQPSTATUS", _component.MachineAutoMode); //subject.Notify(); //Thread.Sleep(1000); //_main.MelsecNetBitOnOff(OB_JOB_JUDGE_CHANGE, false); CTimeout timeout = CTimeoutManager.GetTimeout(_controlName, T1); timeout.TargetOffValueCheck = true; timeout.Begin(OB_JOB_JUDGE_CHANGE, _main.CONTROLATTRIBUTES.GetProperty(IB_JOB_JUDGE_CHANGE.ControlName, IB_JOB_JUDGE_CHANGE.AttributeName) as ITimeoutResource); _main.MelsecNetBitOnOff(OB_JOB_JUDGE_CHANGE, true); Thread.Sleep(1000); IB_JOB_JUDGE_CHANGE.Value = true.ToString(); string tempMsg = ""; bool error = false; if (CTimeout.WaitSync(timeout, 10)) { } else { error = true; _main.MelsecNetBitOnOff(OB_JOB_JUDGE_CHANGE, false); tempMsg = string.Format("PGM DATA TIMEOUT No response [timeout T1={0} sec]", T1 / 1000); Log(string.Format("{0}\t{1}", _component.ControlName, tempMsg)); } if (!error) { return(0); } Log(string.Format("{0}\t{1}", _component.ControlName, "PGM DATA DISPLAY")); #region 메시지 창 표시 CSubject subject = null; string receivedTime = DateTime.Now.ToString("yyyyMMdd HH:mm:ss"); string msgId = "0"; string message = string.Format("[{0}] {1}", this.Name, tempMsg); string panelNo = "1"; subject = CUIManager.Inst.GetData("CIMMessage"); subject.SetValue("List", new List <string>() { "MESSAGE_SET", msgId, receivedTime, message, panelNo }); subject.Notify(); #endregion return(0); }
protected override int InnerExecute() { //받아서 처리하는 부분 //양전자 RECIPE 가져오는 곳 List <int> jobDataC = new List <int>();//42 CGlassDataPropertiesWHTM glassData1 = null; AMaterialData materialData = null; TimeSpan elapsedSpan = new TimeSpan(); int index = -1; index = int.Parse(_values["GLS_INDEX"]); if (index == -1) { return(-1); } try { if (_isManualMode) { glassData1 = new CGlassDataPropertiesWHTM(); glassData1.GlassIndex = 1; glassData1.CassetteIndex = 2; glassData1.CassetteIndex = 2; glassData1.ProductCode = 1; glassData1.GlassThickness = 1; glassData1.LotID = "GA"; glassData1.GlassID = "GB"; glassData1.PPID = "1"; glassData1.GlassType = 1; glassData1.JobJudge = "G"; glassData1.JobState = 5; glassData1.JobGrade = "G"; glassData1.TrackingData = 1000; glassData1.UnitPathNo = 1; glassData1.SlotNo = 0; glassData1.CycleTime = 10000; glassData1.TactTime = 10000; glassData1.ReasonCode = 1; glassData1.SamplingFlag = 1; glassData1.LotEndFlag = 1; glassData1.OperationId = "ABCDEFG"; glassData1.ProductId = "ABCDEFGAA"; glassData1.CassetteId = "ABCDEFGAA"; glassData1.ProcessedTime = 10000; glassData1.ProcessedStartTime = "100000"; glassData1.ProcessedEndTime = "100000"; glassData1.CurrentWIPCount = 1; glassData1.JobState = 5; glassData1.TransportState = 1; jobDataC = CGlassDataPropertiesWHTM.ConvertPLCDataC(glassData1); } else { switch (_values["TRANS_STATE"]) { case "1": materialData = _main.GetReceivedGlassDataByLoc(_component.ControlName, index); glassData1 = materialData as CGlassDataPropertiesWHTM; glassData1.ProcessedStartTime = ""; glassData1.ProcessedEndTime = ""; break; case "2": materialData = _main.GetReceivedGlassDataByLoc(_component.ControlName, index); glassData1 = materialData as CGlassDataPropertiesWHTM; glassData1.ProcessedStartTime = _main.Get_Process_Start_Time(index).ToString(); glassData1.ProcessedEndTime = ""; break; case "3": materialData = _main.GetReceivedGlassDataByLoc(_component.ControlName, index); glassData1 = materialData as CGlassDataPropertiesWHTM; ////임시 //glassData1 = new CGlassDataPropertiesWHTM(); glassData1.ProcessedStartTime = _main.Get_Process_Start_Time(index).ToString(); glassData1.ProcessedEndTime = _main.Get_Process_End_Time(index).ToString(); elapsedSpan = new TimeSpan(_main.Get_Process_End_Time(index).Ticks - _main.Get_Process_Start_Time(index).Ticks); glassData1.ProcessedTime = (ushort)elapsedSpan.TotalSeconds < 0 ? (ushort)0 : (ushort)elapsedSpan.TotalSeconds; break; case "4": materialData = _main.GetSentOutGlassDataByLoc(_component.ControlName, index); glassData1 = materialData as CGlassDataPropertiesWHTM; glassData1.ProcessedStartTime = _main.Get_Process_Start_Time(index).ToString(); glassData1.ProcessedEndTime = _main.Get_Process_End_Time(index).ToString(); elapsedSpan = new TimeSpan(_main.Get_Process_End_Time(index).Ticks - _main.Get_Process_Start_Time(index).Ticks); glassData1.ProcessedTime = (ushort)elapsedSpan.TotalSeconds < 0 ? (ushort)0 : (ushort)elapsedSpan.TotalSeconds; break; default: break; } glassData1.UnitPathNo = 301; glassData1.SlotNo = 0; glassData1.TransportState = ushort.Parse(_values["TRANS_STATE"]); glassData1.JobStateInt = 5; glassData1.CurrentWIPCount = 1; jobDataC = CGlassDataPropertiesWHTM.ConvertPLCDataC(glassData1); } _main.MelsecNetMultiWordWrite(OW_TRACKING_JOB_UNIT1, jobDataC); //_main.MelsecNetBitOnOff(OB_REMOVED_JOB_REPORT, true); Log(string.Format("{0}\t{1}", _component.ControlName, string.Format("PGM DATA SEND - RECIPEID={0}", ""))); //CSubject subject = CUIManager.Inst.GetData("ucCimStatus"); //subject.SetValue("EQPSTATUS", _component.MachineAutoMode); //subject.Notify(); //Thread.Sleep(1000); //_main.MelsecNetBitOnOff(OB_REMOVED_JOB_REPORT, false); CTimeout timeout = CTimeoutManager.GetTimeout(_controlName, T1); timeout.TargetOffValueCheck = true; timeout.Begin(OB_TRACKING_JOB_REPORT_UNIT1, _main.CONTROLATTRIBUTES.GetProperty(IB_TRACKING_JOB_REPORT_UNIT1.ControlName, IB_TRACKING_JOB_REPORT_UNIT1.AttributeName) as ITimeoutResource); _main.MelsecNetBitOnOff(OB_TRACKING_JOB_REPORT_UNIT1, true); //Thread.Sleep(1000); //IB_TRACKING_JOB_REPORT_UNIT1.Value = true.ToString(); string tempMsg = ""; bool error = false; if (CTimeout.WaitSync(timeout, 10)) { return(0); } else { //error = true; _main.MelsecNetBitOnOff(OB_TRACKING_JOB_REPORT_UNIT1, false); //tempMsg = string.Format("PGM DATA TIMEOUT No response [timeout T1={0} sec]", T1 / 1000); //Log(string.Format("{0}\t{1}", _component.ControlName, tempMsg)); } Log(string.Format("{0}\t{1}", _component.ControlName, "PGM DATA DISPLAY")); CSubject subject = null; //if (glassData1 != null || glassData2 != null) //{ // subject = CUIManager.Inst.GetData("ucGlassData"); // subject.SetValue("GlassCount", 2); // subject.SetValue("Data", CGlassDataPropertiesWHTM.GetGuiData(glassData1)); // subject.SetValue("Data2", CGlassDataPropertiesWHTM.GetGuiData(glassData2)); // subject.Notify(); //} if (!error) { return(0); } #region 메시지 창 표시 string receivedTime = DateTime.Now.ToString("yyyyMMdd HH:mm:ss"); string msgId = "0"; string message = string.Format("[{0}] {1}", this.Name, tempMsg); string panelNo = "1"; subject = CUIManager.Inst.GetData("CIMMessage"); subject.SetValue("List", new List <string>() { "MESSAGE_SET", msgId, receivedTime, message, panelNo }); subject.Notify(); #endregion return(0); } catch (Exception e) { Log(string.Format("{0}\t{1}", _component.ControlName, e.ToString())); return(0); } }
protected override int InnerExecute() { int requestOption = 0; int glassType = 0; string id1 = ""; string id2 = ""; string lotId = ""; string value = ""; if (_isManualMode) { if (_values.ContainsKey("REQ_OPTION") == false || _values.ContainsKey("GLS_CODE") == false || _values.ContainsKey("GLS_ID") == false) { return(-1); } int.TryParse(_values["REQ_OPTION"], out glassType); lotId = _values["GLS_CODE"]; id1 = _values["GLS_ID"]; } else { value = VI_LOST_GLASS_DATA_REQUEST.Value; string[] temp1 = value.Split('|'); if (temp1.Length != 3) { return(-1); } requestOption = (temp1[1] == "P") ? 2 : 1; if (requestOption == 2) { string[] temp2 = temp1[2].Split(','); if (temp2.Length < 2) { return(-1); } int.TryParse(temp2[0], out glassType); lotId = temp2[1].Trim(); } else if (requestOption == 1) { string[] temp2 = temp1[2].Split(','); if (temp2.Length < 2) { return(-1); } int.TryParse(temp2[0], out glassType); if (glassType == 0)//0 WHOLE, 1 HALF { id1 = temp2[1].Trim(); } else { id1 = temp2[1].Trim(); id2 = temp2[2].Trim(); if (string.IsNullOrEmpty(id1)) { id1 = id2; } } } else { return(-1); } } //PROBE CIM _main.MelsecNetMultiWordWriteByString(OW_GLASS_DATA_REQUEST_LOTID, lotId, 10, ' '); _main.MelsecNetMultiWordWriteByString(OW_GLASS_DATA_REQUEST_GLASSID, id1, 10, ' '); _main.MelsecNetWordWrite(OW_GLASS_DATA_REQUEST_GLASS_TYPE, glassType); //_main.MelsecNetBitOnOff(OB_GLASS_DATA_REQUEST, true); Log(string.Format("{0}\t{1}", _component.ControlName, string.Format("PGM DATA SEND - LOTID={0} GLASSID={1} GLASSTYPE={2}", lotId, id1, glassType))); //CSubject subject = CUIManager.Inst.GetData("ucCimStatus"); //subject.SetValue("EQPSTATUS", _component.MachineAutoMode); //subject.Notify(); //Thread.Sleep(1000); //_main.MelsecNetBitOnOff(OB_GLASS_DATA_REQUEST, false); CTimeout timeout = CTimeoutManager.GetTimeout(_controlName, T1); timeout.TargetOffValueCheck = true; timeout.Begin(OB_GLASS_DATA_REQUEST, _main.CONTROLATTRIBUTES.GetProperty(IB_GLASS_DATA_REQUEST.ControlName, IB_GLASS_DATA_REQUEST.AttributeName) as ITimeoutResource); _main.MelsecNetBitOnOff(OB_GLASS_DATA_REQUEST, true); Thread.Sleep(1000); IB_GLASS_DATA_REQUEST.Value = true.ToString(); string tempMsg = ""; bool error = false; if (CTimeout.WaitSync(timeout, 10)) { string replyTemp = _main.MelsecNetWordRead(IW_GLASS_DATA_REQUEST_REPLY_REPLY_STATUS); int glassExist = int.Parse(replyTemp); Log(string.Format("{0}\t{1}", _component.ControlName, "PGM DATA RECV - GLASS EXIST={0}", replyTemp)); if (glassExist == REPLY_EXIST) { ushort[] data = _main.MelsecNetMultiWordRead(IW_GLASS_DATA_REQUEST_REPLY_JOB_DATAA); CGlassDataPropertiesWHTM jobDataA = new CGlassDataPropertiesWHTM(data); //CGlassDataPropertiesWHTM jobDataB = new CGlassDataPropertiesWHTM(data); Log(string.Format("{0}\t{1}", _component.ControlName, "PGM DATA RECV - GLASS DATA {0}", jobDataA.ToString())); CSubject subject = null; bool noGlass1 = false; bool noGlass2 = false; bool halfSize1 = false; bool halfSize2 = false; bool whole = false; List <bool> glassSizeType = new List <bool>(); subject = CUIManager.Inst.GetData("ucEQP"); if (!IsManualExecute) { string cstIndex1 = ""; string portNo1 = ""; string seqNo1 = ""; string glassIndex1 = ""; string position1 = ""; string slotNo1 = ""; string glassId1 = ""; string lotId1 = ""; string glassType1 = ""; string ppid1 = ""; string recipeId1 = ""; string prodId1 = ""; string stepid1 = ""; string cstid1 = ""; string cstIndex2 = ""; string portNo2 = ""; string seqNo2 = ""; string glassIndex2 = ""; string position2 = ""; string slotNo2 = ""; string glassId2 = ""; string lotId2 = ""; string glassType2 = ""; string ppid2 = ""; string recipeId2 = ""; string prodId2 = ""; string stepid2 = ""; string cstid2 = ""; if (jobDataA != null && jobDataA.CassetteIndex != 0) { if (jobDataA.GlassPosition.ToString() == "1" || jobDataA.GlassPosition.ToString() == "3") { cstIndex1 = jobDataA.CassetteIndex.ToString(); portNo1 = jobDataA.PortNo.ToString(); seqNo1 = jobDataA.SeqNo.ToString(); glassIndex1 = jobDataA.GlassIndex.ToString(); position1 = jobDataA.GlassPosition.ToString(); slotNo1 = jobDataA.SlotNo.ToString(); glassId1 = jobDataA.GlassID; lotId1 = jobDataA.LotID; glassType1 = jobDataA.GlassType.ToString(); ppid1 = jobDataA.PPID; recipeId1 = _main.getRecipeId(ppid1); prodId1 = jobDataA.ProductId.ToString(); stepid1 = jobDataA.OperationId.ToString(); cstid1 = jobDataA.CassetteId; jobDataA.ChangeLocation(_component.ControlName, "0"); _main.AddReceviedGlassData(_component.ControlName, jobDataA, 0, true); subject.SetValue("RECIPE", _component.CurrentRecipeNo); subject.SetValue("GlassCode1", jobDataA.GlassIndex.ToString()); subject.SetValue("GlassID1", jobDataA.GlassID); } else { cstIndex2 = jobDataA.CassetteIndex.ToString(); portNo2 = jobDataA.PortNo.ToString(); seqNo2 = jobDataA.SeqNo.ToString(); glassIndex2 = jobDataA.GlassIndex.ToString(); position2 = jobDataA.GlassPosition.ToString(); slotNo2 = jobDataA.SlotNo.ToString(); glassId2 = jobDataA.GlassID; lotId2 = jobDataA.LotID; glassType2 = jobDataA.GlassType.ToString(); ppid2 = jobDataA.PPID; recipeId2 = _main.getRecipeId(ppid2); prodId2 = jobDataA.ProductId.ToString(); stepid2 = jobDataA.OperationId.ToString(); cstid2 = jobDataA.CassetteId; jobDataA.ChangeLocation(_component.ControlName, "1"); _main.AddReceviedGlassData(_component.ControlName, jobDataA, 1, true); subject.SetValue("RECIPE", _component.CurrentRecipeNo); subject.SetValue("GlassCode2", jobDataA.GlassIndex.ToString()); subject.SetValue("GlassID2", jobDataA.GlassID); } } else { noGlass1 = true; } //if (jobDataB != null && jobDataB.CassetteIndex != 0) //{ // cstIndex2 = jobDataB.CassetteIndex.ToString(); // portNo2 = jobDataB.PortNo.ToString(); // seqNo2 = jobDataB.SeqNo.ToString(); // glassIndex2 = jobDataB.GlassIndex.ToString(); // position2 = jobDataB.GlassPosition.ToString(); // slotNo2 = jobDataB.SlotNo.ToString(); // glassId2 = jobDataB.GlassID; // lotId2 = jobDataB.LotID; // glassType2 = jobDataB.GlassType.ToString(); // ppid2 = jobDataB.PPID; // recipeId2 = _main.getRecipeId(ppid2); // prodId2 = jobDataB.ProductId.ToString(); // stepid2 = jobDataB.OperationId.ToString(); // jobDataB.ChangeLocation(_component.ControlName, "1"); // _main.AddReceviedGlassData(_component.ControlName, jobDataB, 1, true); // subject.SetValue("RECIPE", _component.CurrentRecipeNo); // subject.SetValue("GlassCode2", jobDataB.GlassIndex.ToString()); // subject.SetValue("GlassID2", jobDataB.GlassID); // if (position2 == "2") // { // halfSize2 = true; // } //} //else //{ // noGlass2 = true; //} //if (jobDataA == null && jobDataB != null) //{ // glassType1 = glassType2; //} if (jobDataA.GlassPosition == 3) { whole = true; halfSize1 = false; subject.SetValue("GlassExist_Whole", whole); subject.SetValue("GlassExist_A", halfSize1); subject.Notify(); } else if (jobDataA.GlassPosition == 1) { whole = false; halfSize1 = true; subject.SetValue("GlassExist_Whole", whole); subject.SetValue("GlassExist_A", halfSize1); subject.Notify(); } else if (jobDataA.GlassPosition == 2) { whole = false; halfSize2 = true; subject.SetValue("GlassExist_Whole", whole); subject.SetValue("GlassExist_B", halfSize2); subject.Notify(); } subject = CUIManager.Inst.GetData("frmGlassDataWHTM"); if (jobDataA != null && jobDataA.CassetteIndex != 0) { if (jobDataA.GlassPosition == 1) { subject.SetValue("Data", CGlassDataPropertiesWHTM.GetGuiData(jobDataA)); } else if (jobDataA.GlassPosition == 2) { subject.SetValue("Data2", CGlassDataPropertiesWHTM.GetGuiData(jobDataA)); } else { subject.SetValue("Data", CGlassDataPropertiesWHTM.GetGuiData(jobDataA)); subject.SetValue("Data2", CGlassDataPropertiesWHTM.GetClearData()); } } //if (jobDataB != null && jobDataB.CassetteIndex != 0) //{ // data2 = CGlassDataPropertiesWHTM.GetGuiData(jobDataB); // subject.SetValue("Data2", data2); //} subject.Notify(); //20161125 CGlassDataPropertiesWHTM glassData1 = null; CGlassDataPropertiesWHTM glassData2 = null; AMaterialData materialData1 = null; AMaterialData materialData2 = null; materialData1 = _main.GetReceivedGlassDataByLoc(_component.ControlName, 0); glassData1 = materialData1 as CGlassDataPropertiesWHTM; materialData2 = _main.GetReceivedGlassDataByLoc(_component.ControlName, 1); glassData2 = materialData2 as CGlassDataPropertiesWHTM; if (glassData1 == null) { glassData1 = new CGlassDataPropertiesWHTM(); } if (glassData2 == null) { glassData2 = new CGlassDataPropertiesWHTM(); } List <string> dataList = new List <string>(); string tempData2 = string.Format("{0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},{13},{14},{15},{16},{17},{18},{19}", glassData1.PortNo, glassData1.SeqNo, glassData1.GlassPosition, glassData1.SlotNo, glassData1.GlassID, glassData1.LotID, _main.getRecipeId(glassData1.PPID), glassData1.OperationId, glassData1.ProductId, glassData1.CassetteId, glassData2.PortNo, glassData2.SeqNo, glassData2.GlassPosition, glassData2.SlotNo, glassData2.GlassID, glassData2.LotID, _main.getRecipeId(glassData2.PPID), glassData2.OperationId, glassData2.ProductId, glassData2.CassetteId); dataList.Add("LOST_GLASS_DATA_REQUEST_ACK"); dataList.Add(glassData1.GlassID != "" || glassData2.GlassID != "" ? "O" : "X"); dataList.Add(tempData2); //List<string> dataList = new List<string>(); //string tempData2 = string.Format("{0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},{13},{14},{15},{16},{17},{18},{19}", portNo1, seqNo1, position1, slotNo1, glassId1, lotId1, recipeId1, stepid1, prodId1, cstid1, portNo2, seqNo2, position2, slotNo2, glassId2, lotId2, recipeId2, stepid2, prodId2, cstid2); //dataList.Add("LOST_GLASS_DATA_REQUEST_ACK"); //dataList.Add(jobDataA != null && jobDataA.CassetteIndex != 0 ? "O" : "X"); //dataList.Add(tempData2); _main.SendData(dataList); } } else { if (!IsManualExecute) { List <string> dataList = new List <string>(); string tempData2 = "".PadLeft(19, ','); //PORTNO,SEQNO,GLASSTYPE,SLOTNO,GLASS_ID,LOT_ID,PPID,RECIPEID,PORTNO,SEQNO,GLASSTYPE,SLOTNO,GLASS_ID,LOT_ID,PPID,RECIPEID dataList.Add("LOST_GLASS_DATA_REQUEST_ACK"); dataList.Add("X"); dataList.Add(tempData2); _main.SendData(dataList); } } _main.MelsecNetBitOnOff(OB_GLASS_DATA_REQUEST, false); } else { error = true; _main.MelsecNetBitOnOff(OB_GLASS_DATA_REQUEST, false); tempMsg = string.Format("PGM DATA TIMEOUT No response [timeout T1={0} sec]", T1 / 1000); Log(string.Format("{0}\t{1}", _component.ControlName, tempMsg)); } if (!error) { return(0); } Log(string.Format("{0}\t{1}", _component.ControlName, "PGM DATA DISPLAY")); #region 메시지 창 표시 CSubject msgSubject = null; string receivedTime = DateTime.Now.ToString("yyyyMMdd HH:mm:ss"); string msgId = "0"; string message = string.Format("[{0}] {1}", this.Name, tempMsg); string panelNo = "1"; msgSubject = CUIManager.Inst.GetData("CIMMessage"); msgSubject.SetValue("List", new List <string>() { "MESSAGE_SET", msgId, receivedTime, message, panelNo }); msgSubject.Notify(); #endregion return(0); }
protected override int InnerExecute() { try { string recipeId = ""; //10 int CCODE = 0; // 1 string account = ""; //5 string mYear = ""; string mMonth = ""; string mDay = ""; string mHour = ""; string mMin = ""; string mSec = ""; string mYear1 = ""; string mMonth1 = ""; string mDay1 = ""; string mHour1 = ""; string mMin1 = ""; string mSec1 = ""; int index = -1; index = int.Parse(_values["GLS_INDEX"]); if (index == -1) { return(-1); } string filePath = ""; filePath = _values["FILE_PATH"]; if (filePath == "") { return(-1); } //string mValue = VI_GLASS_DATA_VALUE_FILE_REPORT.Value; //string[] tempdata = mValue.Split('|'); ////string filePath = ""; //if (tempdata != null && tempdata.Length == 3) //{ // filePath = tempdata[1];// Glass Unloading시 측정 데이터 파일이 있는 Path 전송 ( 협의 후 수정 예정 ) //} //if (filePath != "") //{ //} //받아서 처리하는 부분 //양전자 RECIPE 가져오는 곳 List <int> jobDataB = new List <int>(); List <int> startTime = new List <int>(); List <int> processingTime = new List <int>(); List <int> endTime = new List <int>(); List <int> variableDataItems = new List <int>(); AMaterialData materialData = null; List <int> DV_List_Data1 = new List <int>(); List <int> DV_List_Data2 = new List <int>(); List <int> DV_List_Data3 = new List <int>(); List <int> DV_List_Data4 = new List <int>(); List <int> DV_List_Data5 = new List <int>(); List <int> DV_List_Data6 = new List <int>(); List <int> DV_List_Data7 = new List <int>(); List <int> DV_List_Data8 = new List <int>(); List <int> DV_List_Data9 = new List <int>(); List <int> DV_List_Data10 = new List <int>(); List <int> DV_List_Data11 = new List <int>(); List <int> DV_List_Data12 = new List <int>(); List <int> DV_List_Data13 = new List <int>(); List <int> DV_List_Data14 = new List <int>(); List <int> DV_List_Data15 = new List <int>(); List <int> DV_List_Data16 = new List <int>(); List <int> DV_List_Data17 = new List <int>(); List <int> DV_List_Data18 = new List <int>(); List <int> DV_List_Data19 = new List <int>(); List <int> DV_List_Data20 = new List <int>(); //20191202 List <int> DV_List_Data21 = new List <int>(); List <int> DV_List_Data22 = new List <int>(); List <int> DV_List_Data23 = new List <int>(); List <int> DV_List_Data24 = new List <int>(); List <int> DV_List_Data25 = new List <int>(); List <int> DV_List_Data26 = new List <int>(); List <int> DV_List_Data27 = new List <int>(); if (_isManualMode) { CGlassDataPropertiesWHTM jobData = new CGlassDataPropertiesWHTM(); jobData.CassetteIndex = 1; jobData.GlassIndex = 2; jobData.LotID = "A1"; jobData.GlassID = "G1"; jobData.UnitPathNo = 1; jobData.SlotNo = 0; jobData.JobJudge = "G";//GPR; jobData.JobGrade = "G"; jobDataB = CGlassDataPropertiesWHTM.ConvertPLCDataB(jobData); processingTime = _main.ConvertDecTo2WordList(2); startTime = _main.ConvertDecToBCD3WordList(16, 11, 7, 22, 14, 30); endTime = _main.ConvertDecToBCD3WordList(16, 11, 7, 22, 14, 30); variableDataItems = _main.GetDVValueToIntList(); recipeId = "ABCDEFG12345"; } else { CGlassDataPropertiesWHTM jobData = new CGlassDataPropertiesWHTM(); materialData = _main.GetSentOutGlassDataByLoc(_component.ControlName, index); jobData = materialData as CGlassDataPropertiesWHTM; jobData.UnitPathNo = 301; jobData.SlotNo = 0; jobDataB = CGlassDataPropertiesWHTM.ConvertPLCDataB(jobData); TimeSpan elapsedSpan = new TimeSpan(_main.Get_Process_End_Time(index).Ticks - _main.Get_Process_Start_Time(index).Ticks); processingTime.AddRange(ByteArrayToIntArray(PLCDataConverter.SystemFloatToPLC4Byte((float)elapsedSpan.TotalSeconds), 0, 2));// _main.ConvertDecTo2WordList((ushort)elapsedSpan.TotalSeconds); //processingTime =SmartDevice.UTILS.PLCUtils.(_main.MelsecNetWordRead(IW_PPID_RECIPE_ID_MAP_PPID_PPCINFO)).Trim(); if (_main.Get_Process_Start_Time(index) != null) { //DateTime yearTemp = DateTime.Parse(glassData.ProcessedStartTime);// DateTime.Now.Year.ToString(); string temp = _main.Get_Process_Start_Time(index).Year.ToString(); mYear = ushort.Parse(temp.Substring(temp.Length - 2, 2)).ToString("00"); mMonth = _main.Get_Process_Start_Time(index).Month.ToString("00"); mDay = _main.Get_Process_Start_Time(index).Day.ToString("00"); mHour = _main.Get_Process_Start_Time(index).Hour.ToString("00"); mMin = _main.Get_Process_Start_Time(index).Minute.ToString("00"); mSec = _main.Get_Process_Start_Time(index).Second.ToString("00"); } else { mYear = "00"; mMonth = "00"; mDay = "00"; mHour = "00"; mMin = "00"; mSec = "00"; } if (_main.Get_Process_End_Time(index) != null) { //DateTime yearTemp = DateTime.Parse(glassData.ProcessedStartTime);// DateTime.Now.Year.ToString(); string temp = _main.Get_Process_End_Time(index).Year.ToString(); mYear1 = ushort.Parse(temp.Substring(temp.Length - 2, 2)).ToString("00"); mMonth1 = _main.Get_Process_End_Time(index).Month.ToString("00"); mDay1 = _main.Get_Process_End_Time(index).Day.ToString("00"); mHour1 = _main.Get_Process_End_Time(index).Hour.ToString("00"); mMin1 = _main.Get_Process_End_Time(index).Minute.ToString("00"); mSec1 = _main.Get_Process_End_Time(index).Second.ToString("00"); } else { mYear1 = "00"; mMonth1 = "00"; mDay1 = "00"; mHour1 = "00"; mMin1 = "00"; mSec1 = "00"; } startTime.Add(ushort.Parse(mMonth.Substring(0, 1)) << 12 | ushort.Parse(mMonth.Substring(1, 1)) << 8 | ushort.Parse(mYear.Substring(0, 1)) << 4 | ushort.Parse(mYear.Substring(1, 1))); startTime.Add(ushort.Parse(mHour.Substring(0, 1)) << 12 | ushort.Parse(mHour.Substring(1, 1)) << 8 | ushort.Parse(mDay.Substring(0, 1)) << 4 | ushort.Parse(mDay.Substring(1, 1))); startTime.Add(ushort.Parse(mSec.Substring(0, 1)) << 12 | ushort.Parse(mSec.Substring(1, 1)) << 8 | ushort.Parse(mMin.Substring(0, 1)) << 4 | ushort.Parse(mMin.Substring(1, 1))); endTime.Add(ushort.Parse(mMonth1.Substring(0, 1)) << 12 | ushort.Parse(mMonth1.Substring(1, 1)) << 8 | ushort.Parse(mYear1.Substring(0, 1)) << 4 | ushort.Parse(mYear1.Substring(1, 1))); endTime.Add(ushort.Parse(mHour1.Substring(0, 1)) << 12 | ushort.Parse(mHour1.Substring(1, 1)) << 8 | ushort.Parse(mDay1.Substring(0, 1)) << 4 | ushort.Parse(mDay1.Substring(1, 1))); endTime.Add(ushort.Parse(mSec1.Substring(0, 1)) << 12 | ushort.Parse(mSec1.Substring(1, 1)) << 8 | ushort.Parse(mMin1.Substring(0, 1)) << 4 | ushort.Parse(mMin1.Substring(1, 1))); recipeId = _main.getRecipeId(jobData.PPID); variableDataItems = _main.GetDVValueToIntList(); //임시 데이터 string tempValue; //DateTime mTime = DateTime.Now; //Console.WriteLine(mTime.Second.ToString() + "." + mTime.Millisecond.ToString()); List <string> DvWords = new List <string>(); if (System.IO.File.Exists(@filePath)) { string[] lines = System.IO.File.ReadAllLines(@filePath); foreach (string line in lines) { if (line != "") { tempValue = line.Substring(40).Trim(); if (tempValue == "***") { tempValue = ""; } DvWords.Add(tempValue); } } } //if (DvWords.Count != 920) // return -1; List <string> DvData1 = new List <string>(); List <string> DvData2 = new List <string>(); List <string> DvData3 = new List <string>(); List <string> DvData4 = new List <string>(); List <string> DvData5 = new List <string>(); List <string> DvData6 = new List <string>(); List <string> DvData7 = new List <string>(); List <string> DvData8 = new List <string>(); List <string> DvData9 = new List <string>(); List <string> DvData10 = new List <string>(); List <string> DvData11 = new List <string>(); List <string> DvData12 = new List <string>(); List <string> DvData13 = new List <string>(); List <string> DvData14 = new List <string>(); List <string> DvData15 = new List <string>(); List <string> DvData16 = new List <string>(); List <string> DvData17 = new List <string>(); List <string> DvData18 = new List <string>(); List <string> DvData19 = new List <string>(); List <string> DvData20 = new List <string>(); //20191202 List <string> DvData21 = new List <string>(); List <string> DvData22 = new List <string>(); List <string> DvData23 = new List <string>(); List <string> DvData24 = new List <string>(); List <string> DvData25 = new List <string>(); List <string> DvData26 = new List <string>(); List <string> DvData27 = new List <string>(); //for (int i = 0; i < DvWords.Count; i++) //{ // if (i >= 0 && i < 236) // { // DvData1.Add(DvWords[i]); // } // else if (i >= 236 && i < 464) // { // DvData2.Add(DvWords[i]); // } // else if (i >= 464 && i < 730) // { // DvData3.Add(DvWords[i]); // } // else if (i >= 730 && i < 996) // { // DvData4.Add(DvWords[i]); // } // else if (i >= 996 && i < 1224) // { // DvData5.Add(DvWords[i]); // } // else if (i >= 1224 && i < 1490) // { // DvData6.Add(DvWords[i]); // } // else if (i >= 1490 && i < 1680) // { // DvData7.Add(DvWords[i]); // } // else if (i >= 1680 && i < 1946) // { // DvData8.Add(DvWords[i]); // } // else if (i >= 1946 && i < 2174) // { // DvData9.Add(DvWords[i]); // } // else if (i >= 2174 && i < 2402) // { // DvData10.Add(DvWords[i]); // } // else if (i >= 2402 && i <= 2592) // { // DvData11.Add(DvWords[i]); // } //} for (int i = 0; i < DvWords.Count; i++) //20191202 { if (i >= 0 && i < 238) { DvData1.Add(DvWords[i]); } else if (i >= 238 && i < 488) { DvData2.Add(DvWords[i]); } else if (i >= 488 && i < 738) { DvData3.Add(DvWords[i]); } else if (i >= 738 && i < 988) { DvData4.Add(DvWords[i]); } else if (i >= 998 && i < 1238) { DvData5.Add(DvWords[i]); } else if (i >= 1238 && i < 1488) { DvData6.Add(DvWords[i]); } else if (i >= 1488 && i < 1738) { DvData7.Add(DvWords[i]); } else if (i >= 1738 && i < 1988) { DvData8.Add(DvWords[i]); } else if (i >= 1988 && i < 2238) { DvData9.Add(DvWords[i]); } else if (i >= 2238 && i < 2488) { DvData10.Add(DvWords[i]); } else if (i >= 2488 && i < 2738) { DvData11.Add(DvWords[i]); } else if (i >= 2488 && i < 2988) { DvData12.Add(DvWords[i]); } else if (i >= 2488 && i < 3238) { DvData13.Add(DvWords[i]); } else if (i >= 2488 && i < 3488) { DvData14.Add(DvWords[i]); } else if (i >= 2488 && i < 3738) { DvData15.Add(DvWords[i]); } else if (i >= 2488 && i < 3988) { DvData16.Add(DvWords[i]); } else if (i >= 2488 && i < 4238) { DvData17.Add(DvWords[i]); } else if (i >= 2488 && i < 4488) { DvData18.Add(DvWords[i]); } else if (i >= 2488 && i < 4738) { DvData19.Add(DvWords[i]); } else if (i >= 2488 && i < 4988) { DvData20.Add(DvWords[i]); } else if (i >= 2488 && i < 5238) { DvData21.Add(DvWords[i]); } else if (i >= 2488 && i < 5488) { DvData22.Add(DvWords[i]); } else if (i >= 2488 && i < 5738) { DvData23.Add(DvWords[i]); } else if (i >= 2488 && i < 5988) { DvData24.Add(DvWords[i]); } else if (i >= 2488 && i < 6238) { DvData25.Add(DvWords[i]); } else if (i >= 2488 && i < 6488) { DvData26.Add(DvWords[i]); } else if (i >= 2488 && i < 6594) { DvData27.Add(DvWords[i]); } } DV_List_Data1 = CGlassDataProperties.ConvertPLC_DV_Data(DvData1, 10, true); DV_List_Data2 = CGlassDataProperties.ConvertPLC_DV_Data(DvData2, 10, false); DV_List_Data3 = CGlassDataProperties.ConvertPLC_DV_Data(DvData3, 10, false); DV_List_Data4 = CGlassDataProperties.ConvertPLC_DV_Data(DvData4, 10, false); DV_List_Data5 = CGlassDataProperties.ConvertPLC_DV_Data(DvData5, 10, false); DV_List_Data6 = CGlassDataProperties.ConvertPLC_DV_Data(DvData6, 10, false); DV_List_Data7 = CGlassDataProperties.ConvertPLC_DV_Data(DvData7, 10, false); DV_List_Data8 = CGlassDataProperties.ConvertPLC_DV_Data(DvData8, 10, false); DV_List_Data9 = CGlassDataProperties.ConvertPLC_DV_Data(DvData9, 10, false); DV_List_Data10 = CGlassDataProperties.ConvertPLC_DV_Data(DvData10, 10, false); DV_List_Data11 = CGlassDataProperties.ConvertPLC_DV_Data(DvData11, 10, false); DV_List_Data12 = CGlassDataProperties.ConvertPLC_DV_Data(DvData12, 10, false); DV_List_Data13 = CGlassDataProperties.ConvertPLC_DV_Data(DvData13, 10, false); DV_List_Data14 = CGlassDataProperties.ConvertPLC_DV_Data(DvData14, 10, false); DV_List_Data15 = CGlassDataProperties.ConvertPLC_DV_Data(DvData15, 10, false); DV_List_Data16 = CGlassDataProperties.ConvertPLC_DV_Data(DvData16, 10, false); DV_List_Data17 = CGlassDataProperties.ConvertPLC_DV_Data(DvData17, 10, false); DV_List_Data18 = CGlassDataProperties.ConvertPLC_DV_Data(DvData18, 10, false); DV_List_Data19 = CGlassDataProperties.ConvertPLC_DV_Data(DvData19, 10, false); DV_List_Data20 = CGlassDataProperties.ConvertPLC_DV_Data(DvData20, 10, false); //20191202 DV_List_Data21 = CGlassDataProperties.ConvertPLC_DV_Data(DvData21, 10, false); DV_List_Data22 = CGlassDataProperties.ConvertPLC_DV_Data(DvData22, 10, false); DV_List_Data23 = CGlassDataProperties.ConvertPLC_DV_Data(DvData23, 10, false); DV_List_Data24 = CGlassDataProperties.ConvertPLC_DV_Data(DvData24, 10, false); DV_List_Data25 = CGlassDataProperties.ConvertPLC_DV_Data(DvData25, 10, false); DV_List_Data26 = CGlassDataProperties.ConvertPLC_DV_Data(DvData26, 10, false); DV_List_Data27 = CGlassDataProperties.ConvertPLC_DV_Data(DvData27, 10, false); } //if (DV_List_Data6.Count < 1000) //{ // while (DV_List_Data6.Count == 1000) // { // DV_List_Data6.Add(0); // } //} _main.MelsecNetMultiWordWrite(OW_PROCESS_DATA_REPORT_JOBDATAB, jobDataB); _main.MelsecNetMultiWordWrite(OW_PROCESS_DATA_REPORT_LOCAL_PROCESSING_TIME, processingTime); //2word _main.MelsecNetMultiWordWrite(OW_PROCESS_DATA_REPORT_LOCAL_PROCESSING_START_TIME, startTime); //3word _main.MelsecNetMultiWordWrite(OW_PROCESS_DATA_REPORT_LOCAL_PROCESSING_END_TIME, endTime); //3word _main.MelsecNetMultiWordWriteByString(OW_PROCESS_DATA_REPORT_RECIPEID, recipeId, 10, ' '); //10word _main.MelsecNetMultiWordWrite(OW_DV_DATA_1, DV_List_Data1); _main.MelsecNetMultiWordWrite(OW_DV_DATA_2, DV_List_Data2); _main.MelsecNetMultiWordWrite(OW_DV_DATA_3, DV_List_Data3); _main.MelsecNetMultiWordWrite(OW_DV_DATA_4, DV_List_Data4); _main.MelsecNetMultiWordWrite(OW_DV_DATA_5, DV_List_Data5); _main.MelsecNetMultiWordWrite(OW_DV_DATA_6, DV_List_Data6); _main.MelsecNetMultiWordWrite(OW_DV_DATA_7, DV_List_Data7); _main.MelsecNetMultiWordWrite(OW_DV_DATA_8, DV_List_Data8); _main.MelsecNetMultiWordWrite(OW_DV_DATA_9, DV_List_Data9); _main.MelsecNetMultiWordWrite(OW_DV_DATA_10, DV_List_Data10); _main.MelsecNetMultiWordWrite(OW_DV_DATA_11, DV_List_Data11); _main.MelsecNetMultiWordWrite(OW_DV_DATA_12, DV_List_Data12); _main.MelsecNetMultiWordWrite(OW_DV_DATA_13, DV_List_Data13); _main.MelsecNetMultiWordWrite(OW_DV_DATA_14, DV_List_Data14); _main.MelsecNetMultiWordWrite(OW_DV_DATA_15, DV_List_Data15); _main.MelsecNetMultiWordWrite(OW_DV_DATA_16, DV_List_Data16); _main.MelsecNetMultiWordWrite(OW_DV_DATA_17, DV_List_Data17); _main.MelsecNetMultiWordWrite(OW_DV_DATA_18, DV_List_Data18); _main.MelsecNetMultiWordWrite(OW_DV_DATA_19, DV_List_Data19); _main.MelsecNetMultiWordWrite(OW_DV_DATA_20, DV_List_Data20); _main.MelsecNetMultiWordWrite(OW_DV_DATA_21, DV_List_Data21); _main.MelsecNetMultiWordWrite(OW_DV_DATA_22, DV_List_Data22); _main.MelsecNetMultiWordWrite(OW_DV_DATA_23, DV_List_Data23); _main.MelsecNetMultiWordWrite(OW_DV_DATA_24, DV_List_Data24); _main.MelsecNetMultiWordWrite(OW_DV_DATA_25, DV_List_Data25); _main.MelsecNetMultiWordWrite(OW_DV_DATA_26, DV_List_Data26); _main.MelsecNetMultiWordWrite(OW_DV_DATA_27, DV_List_Data27); //DateTime mTime1 = DateTime.Now; //Console.WriteLine(mTime1.Second.ToString() + "." + mTime1.Millisecond.ToString()); //main.MelsecNetBitOnOff(OB_PROCESS_DATA_REPORT, true); Log(string.Format("{0}\t{1}", _component.ControlName, string.Format("PGM DATA SEND - RECIPEID={0} CCODE={1} ACCOUNT={2}", recipeId, CCODE, account))); //CSubject subject = CUIManager.Inst.GetData("ucCimStatus"); //subject.SetValue("EQPSTATUS", _component.MachineAutoMode); //subject.Notify(); //Thread.Sleep(1000); //_main.MelsecNetBitOnOff(OB_PROCESS_DATA_REPORT, false); CTimeout timeout = CTimeoutManager.GetTimeout(_controlName, T1); timeout.TargetOffValueCheck = true; timeout.Begin(OB_PROCESS_DATA_REPORT, _main.CONTROLATTRIBUTES.GetProperty(IB_PROCESS_DATA_REPORT.ControlName, IB_PROCESS_DATA_REPORT.AttributeName) as ITimeoutResource); _main.MelsecNetBitOnOff(OB_PROCESS_DATA_REPORT, true); //Thread.Sleep(1000); //IB_PROCESS_DATA_REPORT.Value = true.ToString(); string tempMsg = ""; bool error = false; if (CTimeout.WaitSync(timeout, 10)) { } else { //error = true; _main.MelsecNetBitOnOff(OB_PROCESS_DATA_REPORT, false); //tempMsg = string.Format("PGM DATA TIMEOUT No response [timeout T1={0} sec]", T1 / 1000); //Log(string.Format("{0}\t{1}", _component.ControlName, tempMsg)); } if (!error) { return(0); } Log(string.Format("{0}\t{1}", _component.ControlName, "PGM DATA DISPLAY")); CSubject subject = null; #region 메시지 창 표시 string receivedTime = DateTime.Now.ToString("yyyyMMdd HH:mm:ss"); string msgId = "0"; string message = string.Format("[{0}] {1}", this.Name, tempMsg); string panelNo = "1"; subject = CUIManager.Inst.GetData("CIMMessage"); subject.SetValue("List", new List <string>() { "MESSAGE_SET", msgId, receivedTime, message, panelNo }); subject.Notify(); #endregion return(0); } catch (Exception ex) { Log(string.Format("{0}\t{1}", _component.ControlName, ex.ToString())); return(0); } }
protected override int InnerExecute() { //받아서 처리하는 부분 //양전자 RECIPE 가져오는 곳 List <int> jobDataA = new List <int>();//96 CGlassDataPropertiesWHTM glassData1 = null; CGlassDataPropertiesWHTM glassData2 = null; CGlassDataPropertiesWHTM glassData = null; int jobCount1 = 0; // 1 int wipCount1 = 1; // 1 string glassID = ""; string mscrapCode = ""; int mScrap_Index = 0; List <int> glassCode = new List <int>(); List <int> scrapCode = new List <int>(); List <int> operID = new List <int>(); if (_isManualMode) { glassData1 = new CGlassDataPropertiesWHTM(); glassData1.GlassIndex = 1; glassData1.CassetteIndex = 2; glassData1.CassetteIndex = 2; glassData1.ProductCode = 1; glassData1.GlassThickness = 1; glassData1.LotID = "GA"; glassData1.GlassID = "GB"; glassData1.PPID = "1"; glassData1.GlassType = 1; glassData1.JobJudge = "G"; glassData1.JobState = 5; glassData1.JobGrade = "G"; glassData1.TrackingData = 1000; glassData1.UnitPathNo = 1; glassData1.SlotNo = 1; glassData1.CycleTime = 10000; glassData1.TactTime = 10000; glassData1.ReasonCode = 1; glassData1.SamplingFlag = 1; glassData1.LotEndFlag = 1; glassData1.OperationId = "ABCDEFG"; glassData1.ProductId = "ABCDEFGAA"; glassData1.CassetteId = "ABCDEFGAA"; jobDataA = CGlassDataPropertiesWHTM.ConvertPLCData(glassData1); jobCount1 = 1; wipCount1 = 1; } else { //string value = VI_GLASS_SCRAP.Value; //string[] temp = value.Split('|'); //if (temp.Length != 3) // return -1; if (_values == null) { return(-1); } glassID = _values["GLASSID"]; mScrap_Index = int.Parse(_values["SCRAPINDEX"]); AMaterialData materialData = _main.GetReceivedGlassDataByLoc(_component.ControlName, mScrap_Index); //AMaterialData materialData2 = _main.GetReceivedGlassDataByLoc(_component.ControlName, 1); if (materialData == null) { //20161128 List <string> dataList = new List <string>(); dataList.Add("GLASS_SCRAP_ACK"); dataList.Add("X"); _main.SendData(dataList); return(-1); } //if (materialData2 == null) //{ // //20161128 // List<string> dataList = new List<string>(); // dataList.Add("GLASS_SCRAP_ACK"); // dataList.Add("X"); // _main.SendData(dataList); // return -1; //} glassData = materialData as CGlassDataPropertiesWHTM; string[] tempGlassID = glassData.GlassID.Split('\0'); if (glassID == tempGlassID[0].Trim()) { jobDataA = CGlassDataPropertiesWHTM.ConvertPLCData(glassData); if (_component.GlassStageExist) //20161129 { //glassCode.AddRange(ConvertDecTo2WordList(Convert.ToInt32(glassData.GlassCode))); ////scrapCode.Add(0); ////scrapCode.Add(0); //unitID = int.Parse(_component.UnitNo); //tempOperID = _main.SystemConfig.UserAccount.ToCharArray(); //string word = ""; //foreach (char item in tempOperID) //{ // word = item + word; // if (word.Length > 1) // { // operID.Add(int.Parse(SmartDevice.UTILS.PLCUtils.HexToDec(SmartDevice.UTILS.PLCUtils.StringToHex(word)))); // word = ""; // } //} ////tempCode = mscrapCode.ToCharArray(); ////foreach (char item in tempCode) ////{ //// word = item + word; //// if (word.Length > 1) //// { //// scrapCode.Add(int.Parse(SmartDevice.UTILS.PLCUtils.HexToDec(SmartDevice.UTILS.PLCUtils.StringToHex(word)))); //// word = ""; //// } ////} //tempCode = mscrapCode.ToCharArray(); //string hex = ""; //for (int i = 0; i < tempCode.Length; i = i + 2) //{ // if (tempCode.Length > i + 1) // { // hex += SmartDevice.UTILS.PLCUtils.DecToHex(((int)tempCode[i + 1]).ToString()).Substring(2, 2); // } // if (tempCode.Length > i) // { // hex += SmartDevice.UTILS.PLCUtils.DecToHex(((int)tempCode[i]).ToString()).Substring(2, 2); // scrapCode.Add(int.Parse(SmartDevice.UTILS.PLCUtils.HexToDec(hex))); // } // hex = ""; //} } } else { //20161128 List <string> dataList = new List <string>(); dataList.Add("GLASS_SCRAP_ACK"); dataList.Add("X"); _main.SendData(dataList); return(-1); } } _main.MelsecNetMultiWordWrite(OW_REMOVED_JOB_REPORT_JOBDATAA, jobDataA); //_main.MelsecNetBitOnOff(OB_REMOVED_JOB_REPORT, true); Log(string.Format("{0}\t{1}", _component.ControlName, string.Format("PGM DATA SEND - RECIPEID={0}", ""))); //CSubject subject = CUIManager.Inst.GetData("ucCimStatus"); //subject.SetValue("EQPSTATUS", _component.MachineAutoMode); //subject.Notify(); //Thread.Sleep(1000); //_main.MelsecNetBitOnOff(OB_REMOVED_JOB_REPORT, false); CTimeout timeout = CTimeoutManager.GetTimeout(_controlName, T1); timeout.TargetOffValueCheck = true; timeout.Begin(OB_REMOVED_JOB_REPORT, _main.CONTROLATTRIBUTES.GetProperty(IB_REMOVED_JOB_REPORT.ControlName, IB_REMOVED_JOB_REPORT.AttributeName) as ITimeoutResource); _main.MelsecNetBitOnOff(OB_REMOVED_JOB_REPORT, true); Thread.Sleep(1000); IB_REMOVED_JOB_REPORT.Value = true.ToString(); string tempMsg = ""; bool error = false; CSubject subject = null; if (CTimeout.WaitSync(timeout, 10)) { //<TODO> Test용 임시 _component.GlassStageExist = false; _component.GlassCode1 = 0; AMaterialData materialData = null;// _main.GetReceivedGlassDataByLoc(_component.ControlName, 0); _main.AddReceviedGlassData(_component.ControlName, materialData, mScrap_Index, false); if (mScrap_Index == 0) { subject = CUIManager.Inst.GetData("ucEQP"); if (glassData.GlassPosition == 1) { subject.SetValue("GlassExist_A", false); } else { subject.SetValue("GlassExist_Whole", false); } subject.SetValue("GlassCode1", ""); subject.SetValue("GlassID1", ""); subject.Notify(); } else { subject = CUIManager.Inst.GetData("ucEQP"); subject.SetValue("GlassExist_B", false); subject.SetValue("GlassCode2", ""); subject.SetValue("GlassID2", ""); subject.Notify(); } //20161128 List <string> dataList = new List <string>(); dataList.Add("GLASS_SCRAP_ACK"); dataList.Add("O"); _main.SendData(dataList); _main.MelsecNetBitOnOff(OB_REMOVED_JOB_REPORT, false); } else { //에러:응답이 없다.. List <string> dataList = new List <string>(); dataList.Add("GLASS_SCRAP_ACK"); dataList.Add("X"); _main.SendData(dataList); dataList = new List <string>(); dataList.Add("ALARM_SET_REQUEST"); dataList.Add("1"); dataList.Add("9001"); _main.SendData(dataList); error = true; _main.MelsecNetBitOnOff(OB_REMOVED_JOB_REPORT, false); tempMsg = string.Format("PGM DATA TIMEOUT No response [timeout T1={0} sec]", T1 / 1000); Log(string.Format("{0}\t{1}", _component.ControlName, tempMsg)); } Log(string.Format("{0}\t{1}", _component.ControlName, "PGM DATA DISPLAY")); if (glassData1 != null || glassData2 != null) { subject = CUIManager.Inst.GetData("ucGlassData"); subject.SetValue("GlassCount", 2); subject.SetValue("Data", CGlassDataPropertiesWHTM.GetGuiData(glassData1)); subject.SetValue("Data2", CGlassDataPropertiesWHTM.GetGuiData(glassData2)); subject.Notify(); } if (!error) { return(0); } #region 메시지 창 표시 string receivedTime = DateTime.Now.ToString("yyyyMMdd HH:mm:ss"); string msgId = "0"; string message = string.Format("[{0}] {1}", this.Name, tempMsg); string panelNo = "1"; subject = CUIManager.Inst.GetData("CIMMessage"); subject.SetValue("List", new List <string>() { "MESSAGE_SET", msgId, receivedTime, message, panelNo }); subject.Notify(); #endregion return(0); }