private void oTimeOut_Finished(CTimeout timeoutObject) { try { if (this.IsDisposed) { return; } if (timeoutObject.Trigger is ITimeoutResource) { //CPLCControlProperies oPlc = timeoutObject.Trigger as CPLCControlProperies; //if (timeoutObject.Result == TimeoutResult.Success) //{ // _main.MelsectNetBitOnOff(oPlc.PLCControlName, oPlc.PLCAttribute, oPlc.PLCArea, false); //} //if (timeoutObject.Result == TimeoutResult.Failure) //{ // _main.MelsectNetBitOnOff(oPlc.PLCControlName, oPlc.PLCAttribute, oPlc.PLCArea, false); // SendButtonControl(false); //} } } catch (Exception ex) { CLogManager.Instance.Log(new CExceptionLogFormat(Catagory.Error, "ERROR", ex)); } }
public override int Execute() { if (_main.ReceivedGlassDatas.ContainsKey(_component.ControlName) == false) { return(-1); } CGlassDataProperties glassData = _main.ReceivedGlassDatas[_component.ControlName]; List <int> receiveJobData = CGlassDataProperties.ConvertPLCData(glassData); List <int> receiveJobDataSub = new List <int>(); receiveJobDataSub.Add(1); //upstream path no receiveJobDataSub.Add(1); //total glass count _main.MelsecNetMultiWordWrite(OW_JOB_DATA_FOR_UPSTREAM_BLOCK1, receiveJobData); _main.MelsecNetMultiWordWrite(OW_RECEIVED_JOB_DATA_SUB_BLOCK1, receiveJobDataSub); CTimeout timeout = CTimeoutManager.GetTimeout(_component.ControlName, 2000); timeout.Begin(OB_RECEIVED_JOB_REPORT_UPSTREAMPATH1, _main.CONTROLATTRIBUTES.GetProperty(IB_RECEIVED_JOB_REPORT_REPLY_UPSTREAM_PATH1.ScanControlName, IB_RECEIVED_JOB_REPORT_REPLY_UPSTREAM_PATH1.ScanAttribute) as ITimeoutResource); _main.MelsecNetBitOnOff(OB_RECEIVED_JOB_REPORT_UPSTREAMPATH1, true); //if (CTimeout.WaitSync(timeout, 10)) //{ //if (returnCode == CIM_MODE_ACCEPT) //{ // _main.MelsecNetBitOnOff(OB_CIM_MODE, cimMode == CIM_MODE_CIM_ON); // CSubject subject = CUIManager.Inst.GetData("ucCimStatus"); // subject.SetValue("CIMMode", cimMode); // subject.Notify(); //} //} //else //{ // //에러:응답이 없다.. //} //딜레이 추가 _main.MelsecNetBitOnOff(OB_RECEIVED_JOB_REPORT_UPSTREAMPATH1, false); if (glassData != null) { CSubject subject = CUIManager.Inst.GetData("GlassInfoDisplay"); Dictionary <string, string> data = CGlassDataProperties.GetGuiData(glassData); subject.SetValue("Data", data); subject.Notify(); } return(0); }
private int InnerExecute() { string tmpYear = SmartDevice.UTILS.PLCUtils.HexToDec(_main.MelsecNetWordRead(IW_SET_TIME_DATA_YEAR)); string tmpMonth = SmartDevice.UTILS.PLCUtils.HexToDec(_main.MelsecNetWordRead(IW_SET_TIME_DATA_MONTH)); string tmpDay = SmartDevice.UTILS.PLCUtils.HexToDec(_main.MelsecNetWordRead(IW_SET_TIME_DATA_DAY)); string tmpHour = SmartDevice.UTILS.PLCUtils.HexToDec(_main.MelsecNetWordRead(IW_SET_TIME_DATA_HOUR)); string tmpMin = SmartDevice.UTILS.PLCUtils.HexToDec(_main.MelsecNetWordRead(IW_SET_TIME_DATA_MINUTE)); string tmpSec = SmartDevice.UTILS.PLCUtils.HexToDec(_main.MelsecNetWordRead(IW_SET_TIME_DATA_SECOND)); int mYear = 0; int mMonth = 0; int mDay = 0; int mHour = 0; int mMin = 0; int mSec = 0; bool check = false; int.TryParse(tmpYear, out mYear); int.TryParse(tmpMonth, out mMonth); int.TryParse(tmpDay, out mDay); int.TryParse(tmpHour, out mHour); int.TryParse(tmpMin, out mMin); int.TryParse(tmpSec, out mSec); //check = _component.CIMMode != machineMode; //양전자 조건 검사 위치 //에러: //returnCode = check ? MACHINE_MODE_ACCEPT : MACHINE_MODE_ALREADY_THIS_MODE : MACHINE_MODE_MACHINE_HAVE_NO_THIS_MODE : MACHINE_MODE_OTHER_ERROR; CTimeout timeout = CTimeoutManager.GetTimeout(_component.ControlName, 2000); timeout.TargetOffValueCheck = true; timeout.Begin(OB_MACHINE_TIME_SET_REPLY, _main.CONTROLATTRIBUTES.GetProperty(IB_MACHINE_TIME_SET_COMMAND.ScanControlName, IB_MACHINE_TIME_SET_COMMAND.ScanAttribute) as ITimeoutResource); _main.MelsecNetBitOnOff(OB_MACHINE_TIME_SET_REPLY, true); //if (CTimeout.WaitSync(timeout, 10)) //{ CMain.SystemTimeSet(string.Format("{0:0000}{1:00}{2:00}{3:00}{4:00}{5:00}", mYear, mMonth, mDay, mHour, mMin, mSec)); CMain.Set(string.Format("{0:0000}{1:00}{2:00}{3:00}{4:00}{5:00}", mYear, mMonth, mDay, mHour, mMin, mSec)); //} //else //{ // //에러:응답이 없다.. //} _main.MelsecNetBitOnOff(OB_MACHINE_TIME_SET_REPLY, false); return(0); }
private int InnerExecute() { List <int> recipeList = new List <int>(); int ppid = 0; int unitId = 0; _main.MelsecNetWordWrite(OW_MACHINE_RECIPE_REQUEST_PPID, ppid); _main.MelsecNetWordWrite(OW_MACHINE_RECIPE_REQUEST_UNIT_ID, unitId); CTimeout timeout = CTimeoutManager.GetTimeout(_component.ControlName, 2000); timeout.TargetOffValueCheck = true; timeout.Begin(OB_MACHINE_RECIPE_REQUEST, _main.CONTROLATTRIBUTES.GetProperty(IB_MACHINE_RECIPE_REQUEST_CONFIRM.ScanControlName, IB_MACHINE_RECIPE_REQUEST_CONFIRM.ScanAttribute) as ITimeoutResource); _main.MelsecNetBitOnOff(OB_MACHINE_RECIPE_REQUEST, true); if (CTimeout.WaitSync(timeout, 10)) { string retrun = _main.MelsecNetWordRead(IW_MACHINE_RECIPE_CONFIRM_RETURN_CODE); string recipe = _main.MelsecNetWordRead(IW_MACHINE_RECIPE_CONFIRM_SEND_MACHINE_RECIPE); switch (int.Parse(retrun)) { case OK: break; case NG_NOT_DATA_FORMAT: break; case NG_NO_RECIPE: break; default: break; } } else { //에러:응답이 없다.. } _main.MelsecNetBitOnOff(OB_MACHINE_RECIPE_REQUEST, false); return(0); }
protected override int InnerExecute() { string temp = _main.MelsecNetWordRead(IW_CV_REPORT_ENABLE_MODE); string temp1 = _main.MelsecNetWordRead(IW_CV_REPORT_TIME); int cvEnable = 0; int cvTime = 0; int returnCode = 0; bool check = false; int.TryParse(temp, out cvEnable); int.TryParse(temp1, out cvTime); //check = _component.CIMMode != cvEnable; 임시 //양전자 조건 검사 위치 //에러: returnCode = check ? CV_TIME_CHANGE_OK : CV_TIME_CHANGE_NG; _main.MelsecNetWordWrite(OW_CV_COMMAND_RETURN_CODE, returnCode); CTimeout timeout = CTimeoutManager.GetTimeout(_component.ControlName, _main.SystemConfig.T2_TimeOut * 1000); timeout.TargetOffValueCheck = true; timeout.Begin(OB_CV_REPORT_TIME_CHANGE_COMMAND_REPLY, _main.CONTROLATTRIBUTES.GetProperty(IB_CV_REPORT_TIME_CHANGE_COMMAND.ScanControlName, IB_CV_REPORT_TIME_CHANGE_COMMAND.ScanAttribute) as ITimeoutResource); _main.MelsecNetBitOnOff(OB_CV_REPORT_TIME_CHANGE_COMMAND_REPLY, true); //if (CTimeout.WaitSync(timeout, 10)) //{ if (returnCode == CV_TIME_CHANGE_OK) { //_main.MelsecNetBitOnOff(OB_CIM_MODE, cimMode == CIM_MODE_CIM_ON); //CSubject subject = CUIManager.Inst.GetData("ucCimStatus"); //subject.SetValue("CIMMode", cimMode); //subject.Notify(); } //} //else //{ // //에러:응답이 없다.. //} _main.MelsecNetBitOnOff(OB_CV_REPORT_TIME_CHANGE_COMMAND_REPLY, false); return(0); }
protected override int InnerExecute() { string temp = _main.MelsecNetWordRead(IW_CIM_MODE); int cimMode = 0; int returnCode = 0; bool check = false; int.TryParse(temp, out cimMode); check = _component.CIMMode != cimMode; //양전자 조건 검사 위치 //에러: returnCode = check ? CIM_MODE_ACCEPT : CIM_MODE_ALREADY_IN_DESIRED_STATUS; _main.MelsecNetWordWrite(OW_CIM_MODE_CHANGE_RETURN_CODE, returnCode); CTimeout timeout = CTimeoutManager.GetTimeout(_component.ControlName, 2000); timeout.TargetOffValueCheck = true; timeout.Begin(OB_CIM_MODE_CHANGE_COMMAND_REPLY, _main.CONTROLATTRIBUTES.GetProperty(IB_CIM_MODE_CHANGE_COMMAND.ScanControlName, IB_CIM_MODE_CHANGE_COMMAND.ScanAttribute) as ITimeoutResource); _main.MelsecNetBitOnOff(OB_CIM_MODE_CHANGE_COMMAND_REPLY, true); if (CTimeout.WaitSync(timeout, 10)) { if (returnCode == CIM_MODE_ACCEPT) { _component.CIMMode = cimMode; _main.MelsecNetBitOnOff(OB_CIM_MODE, _component.CIMMode == CIM_MODE_CIM_ON); CSubject subject = CUIManager.Inst.GetData("ucCimStatus"); subject.SetValue("CIMMode", cimMode); subject.Notify(); } } else { //에러:응답이 없다.. } //Thread.Sleep(1000); _main.MelsecNetBitOnOff(OB_CIM_MODE_CHANGE_COMMAND_REPLY, false); return(0); }
private int InnerExecute() { string temp = _main.MelsecNetWordRead(IW_MACHINE_MODE_CHANGE_COMMAND); int machineMode = 0; int returnCode = 0; bool check = false; int.TryParse(temp, out machineMode); check = _component.CIMMode != machineMode; //양전자 조건 검사 위치 //에러: //returnCode = check ? MACHINE_MODE_ACCEPT : MACHINE_MODE_ALREADY_THIS_MODE : MACHINE_MODE_MACHINE_HAVE_NO_THIS_MODE : MACHINE_MODE_OTHER_ERROR; _main.MelsecNetWordWrite(OW_MACHINE_MODE_CHANGE_RETURN_CODE, returnCode); CTimeout timeout = CTimeoutManager.GetTimeout(_component.ControlName, 2000); timeout.TargetOffValueCheck = true; timeout.Begin(OB_MACHINE_MODE_CHANGE_COMMAND_REPLY, _main.CONTROLATTRIBUTES.GetProperty(IB_MACHINE_MODE_CHANGE_COMMAND.ScanControlName, IB_MACHINE_MODE_CHANGE_COMMAND.ScanAttribute) as ITimeoutResource); _main.MelsecNetBitOnOff(OB_MACHINE_MODE_CHANGE_COMMAND_REPLY, true); //if (CTimeout.WaitSync(timeout, 10)) //{ if (returnCode == MACHINE_MODE_ACCEPT) { //_main.MelsecNetBitOnOff(OB_CIM_MODE, cimMode == CIM_MODE_CIM_ON); //CSubject subject = CUIManager.Inst.GetData("ucCimStatus"); //subject.SetValue("CIMMode", cimMode); //subject.Notify(); } //} //else //{ // //에러:응답이 없다.. //} _main.MelsecNetBitOnOff(OB_MACHINE_MODE_CHANGE_COMMAND_REPLY, false); return(0); }
protected override int InnerExecute() { List <int> storedJobData = new List <int>(); int unitOrPort = UNIT; int unitNo = 0; int subUnitNo = 0; int portNo = 0; int slotNO = 0; _main.MelsecNetMultiWordWrite(OW_STORED_DATA_BLOCK, storedJobData); _main.MelsecNetWordWrite(OW_STORED_DATA_UNIT_OR_PORT, unitOrPort); _main.MelsecNetWordWrite(OW_STORED_DATA_UNIT_NO, unitNo); _main.MelsecNetWordWrite(OW_STORED_DATA_SUB_UNIT_NO, subUnitNo); _main.MelsecNetWordWrite(OW_STORED_DATA_PORT_NO, portNo); _main.MelsecNetWordWrite(OW_STORED_DATA_SLOT_NO, slotNO); CTimeout timeout = CTimeoutManager.GetTimeout(_component.ControlName, 2000); timeout.TargetOffValueCheck = true; timeout.Begin(OB_STORED_JOB_REPORT, _main.CONTROLATTRIBUTES.GetProperty(IB_STORED_JOB_REPORT_REPLY.ScanControlName, IB_STORED_JOB_REPORT_REPLY.ScanAttribute) as ITimeoutResource); _main.MelsecNetBitOnOff(OB_STORED_JOB_REPORT, true); if (CTimeout.WaitSync(timeout, 10)) { //if (returnCode == CIM_MODE_ACCEPT) //{ // _main.MelsecNetBitOnOff(OB_CIM_MODE, cimMode == CIM_MODE_CIM_ON); // CSubject subject = CUIManager.Inst.GetData("ucCimStatus"); // subject.SetValue("CIMMode", cimMode); // subject.Notify(); //} } else { //에러:응답이 없다.. } _main.MelsecNetBitOnOff(OB_STORED_JOB_REPORT, false); return(0); }
protected override int InnerExecute() { string tmpYear = SmartDevice.UTILS.PLCUtils.HexToDec(_main.MelsecNetWordRead(IW_SET_TIME_DATA_YEAR)); string tmpMonth = SmartDevice.UTILS.PLCUtils.HexToDec(_main.MelsecNetWordRead(IW_SET_TIME_DATA_MONTH)); string tmpDay = SmartDevice.UTILS.PLCUtils.HexToDec(_main.MelsecNetWordRead(IW_SET_TIME_DATA_DAY)); string tmpHour = SmartDevice.UTILS.PLCUtils.HexToDec(_main.MelsecNetWordRead(IW_SET_TIME_DATA_HOUR)); string tmpMin = SmartDevice.UTILS.PLCUtils.HexToDec(_main.MelsecNetWordRead(IW_SET_TIME_DATA_MINUTE)); string tmpSec = SmartDevice.UTILS.PLCUtils.HexToDec(_main.MelsecNetWordRead(IW_SET_TIME_DATA_SECOND)); ushort mYear = 0; ushort mMonth = 0; ushort mDay = 0; ushort mHour = 0; ushort mMin = 0; ushort mSec = 0; ushort.TryParse(tmpYear, out mYear); ushort.TryParse(tmpMonth, out mMonth); ushort.TryParse(tmpDay, out mDay); ushort.TryParse(tmpHour, out mHour); ushort.TryParse(tmpMin, out mMin); ushort.TryParse(tmpSec, out mSec); //check = _component.CIMMode != machineMode; //양전자 조건 검사 위치 //에러: //returnCode = check ? MACHINE_MODE_ACCEPT : MACHINE_MODE_ALREADY_THIS_MODE : MACHINE_MODE_MACHINE_HAVE_NO_THIS_MODE : MACHINE_MODE_OTHER_ERROR; CTimeout timeout = CTimeoutManager.GetTimeout(_component.ControlName, 2000); timeout.TargetOffValueCheck = true; timeout.Begin(OB_MACHINE_TIME_SET_REPLY, _main.CONTROLATTRIBUTES.GetProperty(IB_MACHINE_TIME_SET_COMMAND.ScanControlName, IB_MACHINE_TIME_SET_COMMAND.ScanAttribute) as ITimeoutResource); _main.MelsecNetBitOnOff(OB_MACHINE_TIME_SET_REPLY, true); _main.SetLocalTime(mYear, mMonth, mDay, mHour, mMin, mSec); _main.MelsecNetBitOnOff(OB_MACHINE_TIME_SET_REPLY, false); return(0); }
private int InnerExecute() { int returnCode = 0; CTimeout timeout = CTimeoutManager.GetTimeout(_component.ControlName, 2000); timeout.TargetOffValueCheck = true; timeout.Begin(OB_LOADING_STOP_RELEASE, _main.CONTROLATTRIBUTES.GetProperty(IB_LOADING_STOP_RELEASE_REPLY.ScanControlName, IB_LOADING_STOP_RELEASE_REPLY.ScanAttribute) as ITimeoutResource); _main.MelsecNetBitOnOff(OB_LOADING_STOP_RELEASE, true); if (CTimeout.WaitSync(timeout, 10)) { string temp = _main.MelsecNetWordRead(IW_LOADING_STOP_RELEASE_RETURN); int.TryParse(temp, out returnCode); if (returnCode == LOADING_STOP_RELEASE_OK) { } //if (returnCode == CIM_MODE_ACCEPT) //{ // _main.MelsecNetBitOnOff(OB_CIM_MODE, cimMode == CIM_MODE_CIM_ON); // CSubject subject = CUIManager.Inst.GetData("ucCimStatus"); // subject.SetValue("CIMMode", cimMode); // subject.Notify(); //} } else { //에러:응답이 없다.. } _main.MelsecNetBitOnOff(OB_LOADING_STOP_RELEASE, false); return(0); }
protected override int InnerExecute() { List <int> changedJobData = new List <int>(); if (_userRequest) { _userRequest = false; if (userNewGlassData != null) { changedJobData = CGlassDataProperties.ConvertPLCData(userNewGlassData); } } _main.MelsecNetMultiWordWrite(OW_GLASS_DATA_CHANGE_REPORT, changedJobData); CTimeout timeout = CTimeoutManager.GetTimeout(_component.ControlName, 2000);//시뮬레이션 테스트로 10000 설정함); timeout.Begin(OB_GLASS_DATA_CHANGE_REPORT, _main.CONTROLATTRIBUTES.GetProperty(IB_GLASS_DATA_CHANGE_REPORT_REPLY.ScanControlName, IB_GLASS_DATA_CHANGE_REPORT_REPLY.ScanAttribute) as ITimeoutResource); _main.MelsecNetBitOnOff(OB_GLASS_DATA_CHANGE_REPORT, true); if (CTimeout.WaitSync(timeout, 10)) { //if (returnCode == CIM_MODE_ACCEPT) //{ // _main.MelsecNetBitOnOff(OB_CIM_MODE, cimMode == CIM_MODE_CIM_ON); // CSubject subject = CUIManager.Inst.GetData("ucCimStatus"); // subject.SetValue("CIMMode", cimMode); // subject.Notify(); //} } else { //에러:응답이 없다.. } _main.MelsecNetBitOnOff(OB_GLASS_DATA_CHANGE_REPORT, false); return(0); }
protected override int InnerExecute() { List <int> glassCode = new List <int>(); glassCode.Add(0); glassCode.Add(0); int unitNo = 0; _main.MelsecNetMultiWordWrite(OW_GLS_PROCESS_END_GLASS_CODE, glassCode); _main.MelsecNetWordWrite(OW_GLS_PROCESS_END_UNIT_NO, unitNo); CTimeout timeout = CTimeoutManager.GetTimeout(_component.ControlName, 2000); timeout.TargetOffValueCheck = true; timeout.Begin(OB_GLASS_PROCESS_START_REPORT, _main.CONTROLATTRIBUTES.GetProperty(IB_GLASS_PROCESS_END_REPORT_REPLY.ScanControlName, IB_GLASS_PROCESS_END_REPORT_REPLY.ScanAttribute) as ITimeoutResource); _main.MelsecNetBitOnOff(OB_GLASS_PROCESS_START_REPORT, true); if (CTimeout.WaitSync(timeout, 10)) { //if (returnCode == CIM_MODE_ACCEPT) //{ // _main.MelsecNetBitOnOff(OB_CIM_MODE, cimMode == CIM_MODE_CIM_ON); // CSubject subject = CUIManager.Inst.GetData("ucCimStatus"); // subject.SetValue("CIMMode", cimMode); // subject.Notify(); //} } else { //에러:응답이 없다.. } _main.MelsecNetBitOnOff(OB_GLASS_PROCESS_START_REPORT, false); return(0); }
protected override int InnerExecute() { int mode = 0; if (_isManualMode) { mode = (int)ProgramDataList[0].Value; } else { mode = _component.EquipmentMode; } _main.MelsecNetWordWrite(OW_EQP_MODE, mode); //_main.MelsecNetBitOnOff(OB_EQP_MODE_CHANGE_REPORT, true); Log(string.Format("{0}\t{1}", _component.ControlName, string.Format("PGM DATA SEND - EQP MODE={0}", mode))); Log(string.Format("{0}\t{1}", _component.ControlName, "PGM DATA DISPLAY")); CSubject subject = CUIManager.Inst.GetData("ucCimStatus"); subject.SetValue("EqpMode", _component.EquipmentMode); subject.Notify(); //Thread.Sleep(1000); //_main.MelsecNetBitOnOff(OB_EQP_MODE_CHANGE_REPORT, false); CTimeout timeout = CTimeoutManager.GetTimeout(_controlName, T1); timeout.TargetOffValueCheck = true; timeout.Begin(OB_EQP_MODE_CHANGE_REPORT, _main.CONTROLATTRIBUTES.GetProperty(IB_EQP_MODE_CHANGE_REPORT.ControlName, IB_EQP_MODE_CHANGE_REPORT.AttributeName) as ITimeoutResource); _main.MelsecNetBitOnOff(OB_EQP_MODE_CHANGE_REPORT, true); Thread.Sleep(1000); IB_EQP_MODE_CHANGE_REPORT.Value = true.ToString(); string tempMsg = ""; bool error = false; if (CTimeout.WaitSync(timeout, 10)) { } else { error = true; _main.MelsecNetBitOnOff(OB_EQP_MODE_CHANGE_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); } #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> 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 status = 0; if (_isManualMode) { status = (int)ProgramDataList[0].Value; } else { status = _component.EqpStatus; } int bcStatus = status; //switch (status.ToString()) //{ // case "1": // bcStatus = 1; // break; // case "2": // bcStatus = 2; // break; // case "3": // bcStatus = 3; // break; // case "4": // bcStatus = 4; // break; // case "5": // bcStatus = 5; // break; // default: // break; //} _main.MelsecNetWordWrite(OW_EQP_STATUS, bcStatus); //_main.MelsecNetWordWrite(OW_EQP_SUB_MOUDLE_STATUS1, status); 사용하지 않음. //_main.MelsecNetBitOnOff(OB_EQP_STATUS_REPORT, true); Log(string.Format("{0}\t{1}", _component.ControlName, string.Format("PGM DATA SEND - EQP STATUS={0}", status))); Log(string.Format("{0}\t{1}", _component.ControlName, "PGM DATA DISPLAY")); CSubject subject = null;// CUIManager.Inst.GetData("ucCimStatus"); //subject.SetValue("EQPSTATUS", _component.MachineAutoMode); //subject.Notify(); //Thread.Sleep(1000); //_main.MelsecNetBitOnOff(OB_EQP_STATUS_REPORT, false); CTimeout timeout = CTimeoutManager.GetTimeout(_controlName, T1); timeout.TargetOffValueCheck = true; timeout.Begin(OB_EQP_STATUS_REPORT, _main.CONTROLATTRIBUTES.GetProperty(IB_EQP_STATUS_REPORT.ControlName, IB_EQP_STATUS_REPORT.AttributeName) as ITimeoutResource); _main.MelsecNetBitOnOff(OB_EQP_STATUS_REPORT, true); Thread.Sleep(1000); IB_EQP_STATUS_REPORT.Value = true.ToString(); string tempMsg = ""; bool error = false; if (CTimeout.WaitSync(timeout, 10)) { } else { error = true; _main.MelsecNetBitOnOff(OB_EQP_STATUS_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); } #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() { Thread.Sleep(500); string errorType = ""; ACommand command = null; bool noResponse = false; bool isTimeout = false; bool isOffline = false; string id = ""; string rcvYNFlag = "0"; string strJigId = ""; string strResultCode = ""; string strBoltCnt = ""; string strBMSID_A = ""; string strBMSID_B = ""; string strBMSID_Sum = ""; int count = 0; this.StatusChange(enumProgramStatus.PROCESSING); this.Log("STEP00"); List <string> apdData = new List <string>(); apdData = new List <string>(_BMS_Assy_WZControl.IW_APD.Split(' ')); strJigId = apdData[0].Trim('\0'); strResultCode = apdData[1].Trim('\0'); strBoltCnt = apdData[2].Trim('\0'); // 영역 확인 필요함 string tempA = ""; for (int i = 16; i < 32; i++) { tempA += SmartDevice.UTILS.PLCUtils.HexToAscii(SmartDevice.UTILS.PLCUtils.DecToHex(apdData[i])).Trim(); } strBMSID_A = tempA.Trim('\0'); string tempB = ""; for (int i = 32; i < 48; i++) { tempB += SmartDevice.UTILS.PLCUtils.HexToAscii(SmartDevice.UTILS.PLCUtils.DecToHex(apdData[i])).Trim(); } strBMSID_B = tempB.Trim('\0'); if (strBMSID_A != "") { if (strBMSID_B != "") { strBMSID_Sum = strBMSID_A + "@" + strBMSID_B; } else { strBMSID_Sum = strBMSID_A; } } else { if (strBMSID_B != "") { strBMSID_Sum = strBMSID_B; } } //CTimeout timeout = CTimeoutManager.GetTimeout(this.ControlName, T1); //timeout.TargetOffValueCheck = true; //timeout.Begin(_BMS_Assy_WZControl._OB_WORK_COMPLETE_APD_CONFIRM, _BMS_Assy_WZControl.__IB_WORK_COMPLETE_APD as ITimeoutResource); //_BMS_Assy_WZControl.OB_WORK_COMPLETE_APD_CONFIRM = true; //if (!CTimeout.WaitSync(timeout, 10)) //{ //} //_BMS_Assy_WZControl.OB_WORK_COMPLETE_APD_CONFIRM = false; this.Log("STEP01 JIGID:" + strJigId + " JUDGE:" + strResultCode + " BoltCnt:" + strBoltCnt + " BMSID_A:" + strBMSID_A + " BMSID_B:" + strBMSID_B); if (_main.Hsms1.CommunicationsState == Library.Manager.enumCommunicationsState.ENABLED_COMMUNICATING && _main.Hsms1.ControlState == Library.Manager.enumControlState.ONLINE_REMOTE) { //_main.Hsms1.BMSAssyAPDReport.RcvFlag = false; _main.Hsms1.BMSAssyAPDReportRCMD.RcvFlag = false; this.Log("STEP02"); //_main.Hsms1.GetVIDItem("103").Value = DateTime.Now.ToString("yyyyMMddHHmmss");//103 Clock //_main.Hsms1.GetVIDItem("110").Value = _BMS_Assy_WZControl.UnitNo;//110 Unit ID //_main.Hsms1.GetVIDItem("315").Value = strJigId;//315 JIGID //_main.Hsms1.GetVIDItem("350").Value = strBMSID_Sum;//350 BMSID //_main.Hsms1.GetVIDItem("375").Value = strResultCode;//375 Judge //_main.Hsms1.GetVIDItem("388").Value = strBoltCnt;//388 Bolt Count //_main.Hsms1.S6F11_SendMessage(Library.Manager.CHSMSEQPManager.enumCEID.ID1100_BMS_Ass_y_APD_Report); string clock = DateTime.Now.ToString("yyyyMMddHHmmss"); string unitID = _BMS_Assy_WZControl.UnitNo.ToString(); _main.Hsms1.S6F11_SendID1100(Library.Manager.CHSMSEQPManager.enumCEID.ID1100_BMS_Ass_y_APD_Report, clock, unitID, strJigId, strBMSID_Sum, strResultCode, strBoltCnt); bool waitCmd = CSystemConfig.GetOption("WAIT_HOST_CMD", bool.TrueString, new List <string>() { "True", "False" }).GetBoolValue1(); while (!_main.Hsms1.BMSAssyAPDReportRCMD.RcvFlag && (count++ < 4000 || waitCmd)) { Thread.Sleep(10); } noResponse = !_main.Hsms1.BMSAssyAPDReportRCMD.RcvFlag; isTimeout = noResponse; if (_main.Hsms1.BMSAssyAPDReportRCMD.RcvFlag) { _main.Hsms1.BMSAssyAPDReportRCMD.RcvFlag = false; rcvYNFlag = _main.Hsms1.BMSAssyAPDReportRCMD.GetPLCYNFlag(); } //bool waitCmd = CSystemConfig.GetOption("WAIT_HOST_CMD", bool.TrueString, new List<string>() { "True", "False" }).GetBoolValue1(); //while (!_main.Hsms1.BMSAssyAPDReport.RcvFlag && (count++ < 4000 || waitCmd)) //{ // Thread.Sleep(10); //} //noResponse = !_main.Hsms1.BMSAssyAPDReport.RcvFlag; //isTimeout = noResponse; } else { this.Log("STEP03"); isOffline = true; noResponse = true; } if (noResponse) { string reason = ""; if (isOffline) { id = "E0";//OFFLINE reason = "MES OFFLINE"; } else if (isTimeout) { id = "E1";//TIMEOUT reason = "MES TIMEOUT"; } else { id = "E9";//UNKNOWN reason = "MES UNKNOWN"; } this.Log("STEP04 NO RESPONSE PGM106_01 SET ID=" + id); //CUIManager.ShowMsgForm(msgId, "", message, enumButtonType.RETRY | enumButtonType.OK, new List<string>() { "REQUEST:LM_DATA_REQ", "" }); command = CUIManager.Inst.GetCommand("Form"); command.SetSubCommand("ShowMessageForm"); command.AddParameter("MSG_NO", "PGM00002"); command.AddParameter("ERR_MSG", "UNIT NO : " + _BMS_Assy_WZControl.UnitNo + " BMS_ASSY_APD_REPORT " + reason + " ERR <" + id + ">"); command.AddParameter("MSG", "UNIT NO : " + _BMS_Assy_WZControl.UnitNo + " BMS_ASSY_APD_REPORT " + reason + " ERR <" + id + ">"); command.AddParameter("TAG", string.Format("{0},{1},{2}", this.Name, T2, id)); command.AddParameter("BUTTON_TYPE", "OK"); command.AddParameter("RETURN_CMD", ""); command.Execute(); CBasicControl component = null; Dictionary <string, string> messageValues = new Dictionary <string, string>(); component = _main.GetComponent("WORK_CV04"); messageValues.Add("MESSAGE", reason); component.GetProgram("EQP_MESSAGE_DISPLAY").Execute(messageValues); } CTimeout timeout = CTimeoutManager.GetTimeout(this.ControlName, T1); timeout.TargetOffValueCheck = true; timeout.Begin(_BMS_Assy_WZControl._OB_WORK_COMPLETE_APD_CONFIRM, _BMS_Assy_WZControl.__IB_WORK_COMPLETE_APD as ITimeoutResource); bool plcTest = CSystemConfig.GetOption("PLC_TEST_FLAG", bool.FalseString, new List <string>() { "True", "False" }).GetBoolValue1(); if ((!isOffline && !isTimeout) || (plcTest && isOffline)) { _BMS_Assy_WZControl.OB_WORK_COMPLETE_APD_CONFIRM = true; if (!CTimeout.WaitSync(timeout, 10)) { } _BMS_Assy_WZControl.OB_WORK_COMPLETE_APD_CONFIRM = false; if (errorType == "") { return(0); } this.Log("STEP07"); #region 메시지 창 표시 //CUIManager.ShowMsgForm(msgId, "", message, enumButtonType.RETRY | enumButtonType.OK, new List<string>() { "REQUEST:LM_DATA_REQ", "" }); //command = CUIManager.Inst.GetCommand("Form"); //command.SetSubCommand("ShowMessageForm"); //command.AddParameter("MSG_NO", "PGM00001"); //command.AddParameter("TAG", string.Format("{0},{1},{2}", this.Name, T1, id)); //command.AddParameter("BUTTON_TYPE", "OK"); //command.AddParameter("RETURN_CMD", ",REQUEST:BMS_ASSY_APD_REPORT"); //command.Execute(); #endregion } else { } return(-1); }
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() { int VCRNo = 0; // 1 int VCRUsingMode = 0; // 1 int VCRStatus = 0; // 1 List <int> jobDataB = new List <int>(); CGlassDataPropertiesWHTM glassData1 = null; if (_isManualMode) { VCRNo = 1; VCRUsingMode = USING_MODE_DISABLE; VCRStatus = VCR_READ_OK; 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"; jobDataB = CGlassDataPropertiesWHTM.ConvertPLCDataB(glassData1); } else { } _main.MelsecNetWordWrite(OW_VCR_JOBDATA_REPORT_VCRNO, VCRNo); _main.MelsecNetWordWrite(OW_VCR_JOBDATA_REPORT_VCR_USING_MODE, VCRUsingMode); _main.MelsecNetWordWrite(OW_VCR_JOBDATA_REPORT_VCR_STATUS, VCRStatus); _main.MelsecNetMultiWordWrite(OW_VCR_JOBDATA_REPORT_VCR_JOBDATAB, jobDataB); Log(string.Format("{0}\t{1}", _component.ControlName, string.Format("PGM DATA SEND - VCR NO={0} USING MODE={0} STATUS={0}", VCRNo, VCRUsingMode, VCRStatus))); CTimeout timeout = CTimeoutManager.GetTimeout(_controlName, T1); timeout.TargetOffValueCheck = true; timeout.Begin(OB_VCR_JOBDATA_REPORT, _main.CONTROLATTRIBUTES.GetProperty(IB_VCR_JOBDATA_REPORT.ControlName, IB_VCR_JOBDATA_REPORT.AttributeName) as ITimeoutResource); _main.MelsecNetBitOnOff(OB_VCR_JOBDATA_REPORT, true); Thread.Sleep(1000); IB_VCR_JOBDATA_REPORT.Value = true.ToString(); string tempMsg = ""; bool error = false; if (CTimeout.WaitSync(timeout, 10)) { } else { error = true; _main.MelsecNetBitOnOff(OB_VCR_JOBDATA_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 (!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> 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); }
protected override int InnerExecute() { string ppid = ""; //10 string recipeId = ""; //10 if (IsManualExecute) { ppid = this.ProgramDataList[0].Value.ToString(); recipeId = this.ProgramDataList[1].Value.ToString(); ppid = "AAA"; recipeId = "BBB"; } else { string value = VI_CURRENT_RECIPE_CHANGE.Value; string[] temp = value.Split('|'); if (temp != null && temp.Length == 3) { //일단 동일하게 처리 ppid = _main.getPPID(temp[2]); recipeId = temp[2]; } } this.StatusChange(enumProgramStatus.PROCESSING); _main.MelsecNetMultiWordWriteByString(OW_CURRENT_PPID_RECIPEID_REPORT_PPID, ppid, 10, ' '); _main.MelsecNetMultiWordWriteByString(OW_CURRENT_PPID_RECIPEID_REPORT_RECIPEID, recipeId, 10, ' '); Log(string.Format("{0}\t{1}", _component.ControlName, string.Format("PGM DATA SEND - PPID={0} RECIPEID={1}", ppid, recipeId))); CTimeout timeout = CTimeoutManager.GetTimeout(_controlName, T1); timeout.TargetOffValueCheck = true; timeout.Begin(OB_CURRENT_PPID_RECIPEID_REPORT, _main.CONTROLATTRIBUTES.GetProperty(IB_CURRENT_PPID_RECIPEID_REPORT.ControlName, IB_CURRENT_PPID_RECIPEID_REPORT.AttributeName) as ITimeoutResource); _main.MelsecNetBitOnOff(OB_CURRENT_PPID_RECIPEID_REPORT, true); Thread.Sleep(1000); IB_CURRENT_PPID_RECIPEID_REPORT.Value = true.ToString(); string tempMsg = ""; bool error = false; if (CTimeout.WaitSync(timeout, 10)) { _main.MelsecNetBitOnOff(OB_CURRENT_PPID_RECIPEID_REPORT, false); } else { error = true; _main.MelsecNetBitOnOff(OB_CURRENT_PPID_RECIPEID_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 = CUIManager.Inst.GetData("ucEQP"); subject.SetValue("RECIPE", _component.CurrentRecipeNo); 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() { 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() { 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); }
private int InnerExecute() { //양전자 데이터 제공 int machineStatus = _component.EqpStatus; int resonCode = 0; int downAlarmCode = 0; int unitStatus = 0; //양전자값 //1:SETUP //2:STOP //3:PAUSE //4:IDLE //5:RUN switch (machineStatus) { case YES_SETUP: machineStatus = STATUS_PM; resonCode = REASON_PM; break; case YES_PAUSE: case YES_STOP: machineStatus = STATUS_DOWN; int.TryParse(_component.LastAlarmCode, out downAlarmCode); resonCode = REASON_F_RUN; break; case YES_IDLE: machineStatus = STATUS_IDLE; break; case YES_RUN: machineStatus = STATUS_RUN; break; default: return(-1); } _component.LastAlarmCode = ""; _component.LastAlarmText = ""; string temp = VI_ALARM_SET.Value; _main.MelsecNetWordWrite(OW_MACHINE_STATUS, machineStatus); _main.MelsecNetWordWrite(OW_MACHINE_REASON_CODE, resonCode); _main.MelsecNetWordWrite(OW_MACHINE_DOWN_ALARM_CODE, downAlarmCode); _main.MelsecNetWordWrite(OW_UNIT1_STATUS, machineStatus); CTimeout timeout = CTimeoutManager.GetTimeout(_component.ControlName, 10000); timeout.Begin(OB_MACHINE_STATUS_CHANGE_REPORT, _main.CONTROLATTRIBUTES.GetProperty(IB_MACHINE_STATUS_CHANGE_REPORT_REPLY.ScanControlName, IB_MACHINE_STATUS_CHANGE_REPORT_REPLY.ScanAttribute) as ITimeoutResource); _main.MelsecNetBitOnOff(OB_MACHINE_STATUS_CHANGE_REPORT, true); if (CTimeout.WaitSync(timeout, 10)) { //if (returnCode == CIM_MODE_ACCEPT) //{ // _main.MelsecNetBitOnOff(OB_CIM_MODE, cimMode == CIM_MODE_CIM_ON); // CSubject subject = CUIManager.Inst.GetData("ucCimStatus"); // subject.SetValue("CIMMode", cimMode); // subject.Notify(); //} } else { //에러:응답이 없다.. } _main.MelsecNetBitOnOff(OB_MACHINE_STATUS_CHANGE_REPORT, false); return(0); }
protected override int InnerExecute() { List <int> glassCode = new List <int>(); //glassCode.Add(101);//glass1 //glassCode.Add(21);//glass2 List <int> scrapCode = new List <int>(); // scrapCode.Add(8900);//glass1 scrapcode // scrapCode.Add(0);//glass2 scrapcode //string operIDTempe = ""; List <int> operID = new List <int>(); // operID.Add(1); // operID.Add(2); int unitID = 0; if (isCommand) { isCommand = false; string temp1 = _values["GLASSCODE1XXYYYY"]; string temp2 = _values["GLASSCODE1ZZZ"]; string temp3 = _values["SCRAPCODE1"]; string temp4 = _values["SCRAPCODE2"]; string temp5 = _values["UNITID"]; string temp6 = _values["OPERID"]; glassCode.Add(int.Parse(temp1)); glassCode.Add(int.Parse(temp2)); scrapCode.Add(int.Parse(SmartDevice.UTILS.PLCUtils.HexToDec(SmartDevice.UTILS.PLCUtils.StringToReverseHex(temp3)))); scrapCode.Add(int.Parse(SmartDevice.UTILS.PLCUtils.HexToDec(SmartDevice.UTILS.PLCUtils.StringToReverseHex(temp4)))); if (string.IsNullOrEmpty(temp5)) { temp5 = "0"; } unitID = int.Parse(temp5); char[] tempOperID = temp6.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 = ""; } } } else { glassCode.Add(0); //glass1 glassCode.Add(0); //glass2 scrapCode.Add(0); //glass1 scrapcode scrapCode.Add(0); //glass2 scrapcode } _main.MelsecNetMultiWordWrite(OW_SCRAP_DATA_GLASS_CODE, glassCode); _main.MelsecNetMultiWordWrite(OW_SCRAP_DATA_SCRAP_CODE, scrapCode); _main.MelsecNetWordWrite(OW_SCRAP_DATA_UNIT_ID, unitID); _main.MelsecNetMultiWordWrite(OW_SCRAP_DATA_OPERATORID, operID); CTimeout timeout = CTimeoutManager.GetTimeout(_component.ControlName, 2000); timeout.TargetOffValueCheck = true; //이건 확인바람. timeout.Begin(OB_SCRAP_JOB_REPORT, _main.CONTROLATTRIBUTES.GetProperty(IB_SCRAP_JOB_REPORT_REPLY.ScanControlName, IB_SCRAP_JOB_REPORT_REPLY.ScanAttribute) as ITimeoutResource); _main.MelsecNetBitOnOff(OB_SCRAP_JOB_REPORT, true); if (CTimeout.WaitSync(timeout, 10)) { //if (returnCode == CIM_MODE_ACCEPT) //{ // _main.MelsecNetBitOnOff(OB_CIM_MODE, cimMode == CIM_MODE_CIM_ON); // CSubject subject = CUIManager.Inst.GetData("ucCimStatus"); // subject.SetValue("CIMMode", cimMode); // subject.Notify(); //} } else { //에러:응답이 없다.. } _main.MelsecNetBitOnOff(OB_SCRAP_JOB_REPORT, false); return(0); }
protected override int InnerExecute() { string PPID = ""; string recipeId = ""; int PPCINFO = 0; if (IsManualExecute) { PPID = "ABCDEFG"; recipeId = "AAAA"; PPCINFO = PPCINFO_CREATED; } else { switch (int.Parse(_values["PPCINFO"])) { case PPCINFO_CREATED: //1: Created (a new mapping is created and registered) PPCINFO = PPCINFO_CREATED; break; case PPCINFO_MODIFIED: //2: Modified (PPID are modified) PPCINFO = PPCINFO_MODIFIED; break; case PPCINFO_DELETED: //3: Deleted (any mapping is deleted) PPCINFO = PPCINFO_DELETED; break; case PPCINFO_CHANGED: //4: Changed (Recipe Id is changed) PPCINFO = PPCINFO_CHANGED; break; default: // break; } } _main.MelsecNetMultiWordWriteByString(OW_PPID_RECIPE_MAP_REPORT_PPID, _values["PPID"], 10, ' '); _main.MelsecNetMultiWordWriteByString(OW_PPID_RECIPE_MAP_REPORT_RECIPE_ID, _values["RECIPEID"], 10, ' '); _main.MelsecNetWordWrite(OW_PPID_RECIPE_MAP_REPORT_PPCINFO, PPCINFO); Log(string.Format("{0}\t{1}", _component.ControlName, string.Format("PGM DATA SEND - PPID={0} RECIPEID={1} PPCINFO={2}", PPID, recipeId, PPCINFO))); Log(string.Format("{0}\t{1}", _component.ControlName, "PGM DATA DISPLAY")); //CSubject subject = CUIManager.Inst.GetData("ucCimStatus"); //subject.SetValue("EQPSTATUS", _component.MachineAutoMode); //subject.Notify(); //Thread.Sleep(1000); //_main.MelsecNetBitOnOff(OB_PPID_RECIPE_MAP_REPORT, false); CTimeout timeout = CTimeoutManager.GetTimeout(_controlName, T1); timeout.TargetOffValueCheck = true; timeout.Begin(OB_PPID_RECIPE_MAP_REPORT, _main.CONTROLATTRIBUTES.GetProperty(IB_PPID_RECIPE_MAP_REPORT.ControlName, IB_PPID_RECIPE_MAP_REPORT.AttributeName) as ITimeoutResource); _main.MelsecNetBitOnOff(OB_PPID_RECIPE_MAP_REPORT, true); string tempMsg = ""; bool error = false; if (CTimeout.WaitSync(timeout, 10)) { string reasonText = ""; switch (PPCINFO) { case PPCINFO_CREATED: //1: Created (a new mapping is created and registered) _main.PPIDCreate(_values["PPID"], _values["RECIPEID"], out reasonText); break; case PPCINFO_MODIFIED: //2: Modified (PPID are modified) _main.PPIDModify(_values["PPID"], _values["RECIPEID"], out reasonText); break; case PPCINFO_DELETED: //3: Deleted (any mapping is deleted) _main.PPIDDelete(_values["PPID"], _values["RECIPEID"], out reasonText); break; case PPCINFO_CHANGED: //4: Changed (Recipe Id is changed) _main.PPIDChange(_values["PPID"], _values["RECIPEID"], out reasonText); break; default: break; } List <string> RecipeData = new List <string>();; CSubject subject = null; RecipeData.Add(_values["PPID"]); RecipeData.Add(_values["RECIPEID"]); RecipeData.Add(_values["PPCINFO"]); _values["TIME"] = DateTime.Now.ToString(); RecipeData.Add(_values["TIME"]); _values["USER"] = _main.SystemConfig.UserAccount; RecipeData.Add(_values["USER"]); RecipeData.Add(_values["DESC"]); subject = CUIManager.Inst.GetData("UpdateRecipeData"); subject.SetValue("Recipe", RecipeData); subject.Notify(); } else { string reasonText = ""; switch (PPCINFO) { case PPCINFO_CREATED: //1: Created (a new mapping is created and registered) _main.PPIDCreate(_values["PPID"], _values["RECIPEID"], out reasonText); break; case PPCINFO_MODIFIED: //2: Modified (PPID are modified) _main.PPIDModify(_values["PPID"], _values["RECIPEID"], out reasonText); break; case PPCINFO_DELETED: //3: Deleted (any mapping is deleted) _main.PPIDDelete(_values["PPID"], _values["RECIPEID"], out reasonText); break; case PPCINFO_CHANGED: //4: Changed (Recipe Id is changed) _main.PPIDChange(_values["PPID"], _values["RECIPEID"], out reasonText); break; default: break; } List <string> RecipeData = new List <string>();; CSubject subject = null; RecipeData.Add(_values["PPID"]); RecipeData.Add(_values["RECIPEID"]); RecipeData.Add(_values["PPCINFO"]); _values["TIME"] = DateTime.Now.ToString(); RecipeData.Add(_values["TIME"]); _values["USER"] = _main.SystemConfig.UserAccount; RecipeData.Add(_values["USER"]); RecipeData.Add(_values["DESC"]); subject = CUIManager.Inst.GetData("UpdateRecipeData"); subject.SetValue("Recipe", RecipeData); subject.Notify(); //error = true; _main.MelsecNetBitOnOff(OB_PPID_RECIPE_MAP_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); } CSubject subject1 = 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"; subject1 = CUIManager.Inst.GetData("CIMMessage"); subject1.SetValue("List", new List <string>() { "MESSAGE_SET", msgId, receivedTime, message, panelNo }); subject1.Notify(); #endregion return(0); }
protected override int InnerExecute() { int alarmstatus = 0; int alarmIssuedUnitPathNo = 0; int alarmId = 0; int alarmCode = 0; int alarmLevel = 0; int alarmtextUsingFlag = 0; string alarmText = ""; List <ushort> alarmTime = new List <ushort>(); CAlarmWHTM alarmData = null; if (_isProgramDataUse) { //alarmData = _main.AlarmDatas.GetAlarm<CAlarmWHTM>(ProgramDataList[2].Value.ToString()); object value = ProgramDataList[2].Value; if (value == null) { value = "0"; } alarmData = _main.AlarmDatas.GetAlarm <CAlarmWHTM>(value.ToString()); if (alarmData == null) { alarmData = new CAlarmWHTM(); alarmData.AlarmStatus = int.Parse(ProgramDataList[0].Value.ToString()); alarmData.UnitID = ProgramDataList[1].Value.ToString(); alarmData.AlarmID = ProgramDataList[2].Value.ToString(); alarmData.AlarmCode = ProgramDataList[3].Value.ToString(); alarmData.AlarmLevel = (CAlarmWHTM.enumAlarmLevel)Enum.Parse(typeof(CAlarmWHTM.enumAlarmLevel), ProgramDataList[4].Value.ToString()); alarmData.AlarmTextUsingFlag = (int)ProgramDataList[5].Value; alarmData.AlarmText = (string)ProgramDataList[6].Value; } } else if (_isManualMode) { alarmData = new CAlarmWHTM(); alarmData.AlarmStatus = ALARM_RESET;//(int)ProgramDataList[0].Value; alarmData.UnitID = ProgramDataList[1].Value.ToString(); alarmData.AlarmID = ProgramDataList[2].Value.ToString(); alarmData.AlarmCode = ProgramDataList[3].Value.ToString(); alarmData.AlarmLevel = (CAlarmWHTM.enumAlarmLevel)Enum.Parse(typeof(CAlarmWHTM.enumAlarmLevel), ProgramDataList[4].Value.ToString()); alarmData.AlarmTextUsingFlag = (int)ProgramDataList[5].Value; alarmData.AlarmText = (string)ProgramDataList[6].Value; } else { alarmData = new CAlarmWHTM(); alarmData.UnitID = "1"; string value = VI_ALARM_SET.Value; string[] temp = value.Split('|'); int alarmCodeTemp = 0; if (temp != null && temp.Length > 2) { alarmCodeTemp = int.Parse(temp[1].Trim()); alarmText = temp[2]; } alarmData.AlarmID = alarmCodeTemp.ToString(); alarmData.AlarmCode = "2"; //"[00 ~ 06 Bit : Alarm Category] //Bit 00 Danger for human //Bit 01 Equipment error //Bit 02 Parameter overflow cause // process error //Bit 03 Parameter overflow cause // equipment can't work //Bit 04 Can not recover trouble //Bit 05 Equipment status warning //Bit 06 Process reached to predefined // status" alarmData.AlarmLevel = alarmCode > 1000 ? CAlarmWHTM.enumAlarmLevel.Serious : CAlarmWHTM.enumAlarmLevel.Light; alarmData.AlarmTextUsingFlag = ALARM_USING_EQ_REPORT_ALARM_TEXT; alarmData.AlarmText = alarmText; //string yearTemp = DateTime.Now.Year.ToString(); //ushort mYear = ushort.Parse(yearTemp.Substring(yearTemp.Length - 2, 2)); //ushort mMonth = (ushort)DateTime.Now.Month; //ushort mDay = (ushort)DateTime.Now.Day; //ushort mHour = (ushort)DateTime.Now.Hour; //ushort mMin = (ushort)DateTime.Now.Minute; //ushort mSec = (ushort)DateTime.Now.Second; //alarmTime.Add(mMonth); //alarmTime.Add(mYear); //alarmTime.Add(mHour); //alarmTime.Add(mDay); //alarmTime.Add(mSec); //alarmTime.Add(mMin); } if (alarmData != null) { alarmData.UnitID = "1"; alarmData.AlarmOffset = 30000;//30001~39999: #L3 alarmData.regtime = DateTime.Now; alarmData.AlarmStatus = ALARM_RESET; _main.MelsecNetMultiWordWrite(OW_ALARM_STATUS_BLOCK, alarmData.GetPLCData()); } else { Log(string.Format("{0}\t{1}", _component.ControlName, string.Format("PGM DATA SEND - ALARM NOT FOUND"))); } //_main.MelsecNetWordWrite(OW_ALARM_STATUS, alarmstatus); //_main.MelsecNetWordWrite(OW_ALARM_ISSUED_UNIT_PATH_NO, alarmIssuedUnitPathNo); //_main.MelsecNetWordWrite(OW_ALARM_ID, alarmId); //_main.MelsecNetWordWrite(OW_ALARM_CODE, alarmCode); //_main.MelsecNetWordWrite(OW_ALARM_LEVEL, alarmLevel); //_main.MelsecNetWordWrite(OW_ALARM_TEXT_USING_FLAG, alarmtextUsingFlag); //_main.MelsecNetMultiWordWriteByString(OW_ALARM_TEXT, alarmText, 130, ' '); //_main.MelsecNetMultiWordWrite(OW_ALARM_TIME, alarmTime); Log(string.Format("{0}\t{1}", _component.ControlName, string.Format("PGM DATA SEND - ALARM STATUS={0} ISSUEDUNITPATHNO={1} ID={2} CODE={3} LEVEL={4} TEXTUSINGFLAG={5} TEXT={6} TIME={7}", alarmstatus, alarmIssuedUnitPathNo, alarmId, alarmCode, alarmLevel, alarmtextUsingFlag, alarmText, alarmTime))); CTimeout timeout = CTimeoutManager.GetTimeout(_controlName, T1); timeout.TargetOffValueCheck = true; timeout.Begin(OB_ALARM_STATUS_REPORT, _main.CONTROLATTRIBUTES.GetProperty(IB_ALARM_STATUS_REPORT.ControlName, IB_ALARM_STATUS_REPORT.AttributeName) as ITimeoutResource); _main.MelsecNetBitOnOff(OB_ALARM_STATUS_REPORT, true); Thread.Sleep(1000); IB_ALARM_STATUS_REPORT.Value = true.ToString(); string tempMsg = ""; bool error = false; if (CTimeout.WaitSync(timeout, 10)) { } else { error = true; _main.MelsecNetBitOnOff(OB_ALARM_STATUS_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")); List <string> alarmDataTemp = new List <string>(); alarmDataTemp.Add(alarmData.regtime.ToString("yyyyMMdd HH:mm:ss.ff")); //code alarmDataTemp.Add(((uint.Parse(alarmData.AlarmID) + alarmData.AlarmOffset).ToString())); //AlarmID alarmDataTemp.Add(alarmData.AlarmCode.ToString()); //code alarmDataTemp.Add(alarmData.AlarmLevel.ToString()); alarmDataTemp.Add(_component.ControlName); alarmDataTemp.Add(alarmData.AlarmText); alarmDataTemp.Add("Y"); alarmDataTemp.Add("RESET"); CSubject subject = CUIManager.Inst.GetData("CurrentAlarm"); subject.SetValue("Alarm", alarmDataTemp); 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() { int requestOption = 0; string glassID = ""; string glassCode = ""; if (_values.ContainsKey("REQ_OPTION") == false || _values.ContainsKey("GLS_CODE") == false || _values.ContainsKey("GLS_ID") == false) { return(-1); } int.TryParse(_values["REQ_OPTION"], out requestOption); glassCode = _values["GLS_CODE"]; glassID = _values["GLS_ID"]; List <int> requestID = new List <int>(); List <int> requestCode = new List <int>(); char[] temp = glassID.ToCharArray(); string hex = ""; for (int i = 0; i < temp.Length; i = i + 2) { if (temp.Length > i + 1) { hex += SmartDevice.UTILS.PLCUtils.DecToHex(((int)temp[i + 1]).ToString()).Substring(2, 2); } if (temp.Length > i) { hex += SmartDevice.UTILS.PLCUtils.DecToHex(((int)temp[i]).ToString()).Substring(2, 2); requestID.Add(int.Parse(SmartDevice.UTILS.PLCUtils.HexToDec(hex))); } hex = ""; } string glassCode1 = ""; string glassCode2 = ""; if (string.IsNullOrEmpty(glassCode) || glassCode == "0") { requestCode.Add(0); requestCode.Add(0); } else if (glassCode.Length <= 3) { requestCode.Add(0); requestCode.Add(int.Parse(glassCode)); } else { glassCode1 = glassCode.Substring(0, glassCode.Length - 3); glassCode2 = glassCode.Substring(glassCode.Length - 3, 3); requestCode.Add(int.Parse(glassCode1)); requestCode.Add(int.Parse(glassCode2)); } _main.MelsecNetWordWrite(OW_GLS_DATA_REQ_OPTION, requestOption); _main.MelsecNetMultiWordWrite(OW_GLS_DATA_REQ_GLASS_ID, requestID); _main.MelsecNetMultiWordWrite(OW_GLS_DATA_REQ_GLASS_CODE, requestCode); CTimeout timeout = CTimeoutManager.GetTimeout(_component.ControlName, 2000); timeout.Begin(OB_GLASS_DATA_REQUEST, _main.CONTROLATTRIBUTES.GetProperty(IB_GLASS_DATA_REQUEST_CONFIRM.ScanControlName, IB_GLASS_DATA_REQUEST_CONFIRM.ScanAttribute) as ITimeoutResource); _main.MelsecNetBitOnOff(OB_GLASS_DATA_REQUEST, true); if (CTimeout.WaitSync(timeout, 10)) { ushort[] receviedGlassData = _main.MelsecNetMultiWordRead(IW_GLASS_DATA_SEND); string requestAck = _main.MelsecNetWordRead(IW_GLASS_DATA_REQUEST_ACK); CGlassDataProperties glassData = new CGlassDataProperties(receviedGlassData); CSubject subject = CUIManager.Inst.GetData("GlassInfoDisplay"); subject.SetValue("Data", CGlassDataProperties.GetGuiData(glassData)); subject.Notify(); } else { //에러:응답이 없다.. } _main.MelsecNetBitOnOff(OB_GLASS_DATA_REQUEST, false); return(0); }
protected override int InnerExecute() { string recipeId = "A10"; //10 string recipeVersionNo = ""; int CCODE = CCODE_CRE; // 1 string account = "ABCDEFGHIJK"; //5 //List<string> Param_Data = new List<string>(); List <int> Param_Data_List = new List <int>(); if (this.IsManualExecute) { recipeId = this.ProgramDataList[0].Value.ToString(); CCODE = int.Parse(ProgramDataList[1].Value.ToString()); account = this.ProgramDataList[2].Value.ToString(); Log(string.Format("{0}\t{1}", _component.ControlName, string.Format("PGM DATA SEND MANUAL"))); } else { string value = VI_RECIPE_CHANGE_REPORT.Value; string[] temp = value.Split('|'); int ParmCount = 0; if (temp != null && temp.Length == 3) { switch (temp[1].Trim())//C,M,D { case "1": CCODE = CCODE_CRE; break; case "2": CCODE = CCODE_MOD; break; case "3": CCODE = CCODE_DEL; break; } string[] data2 = temp[2].Split(','); recipeId = data2[0].Trim(); recipeVersionNo = data2[2].Trim(); ParmCount = int.Parse(data2[3]); List <CRecipeDataProperties> tempParameterList = _main.GetRecipeParameterData(); if (ParmCount != data2.Length - 4) { return(-1); } if (ParmCount != 0) { for (int i = 4; i < data2.Length; i++) { //Param_Data.Add(data2[i]); foreach (CRecipeDataProperties item in tempParameterList) { if (item.ParameterNo == (i - 3).ToString()) { item.ParameterValue = (data2[i]); break; } } } } if (ParmCount < tempParameterList.Count) { for (int i = ParmCount + 1; i <= tempParameterList.Count; i++) { //Param_Data.Add(data2[i]); foreach (CRecipeDataProperties item in tempParameterList) { if (item.ParameterNo == i.ToString()) { item.ParameterValue = ""; break; } } } } //else if(ParmCount ==0) //{ // for (int i = 0; i < 50; i++) // { // Param_Data.Add("0"); // } //} //if (Param_Data.Count < 50) //{ // while (Param_Data.Count < 50) // { // Param_Data.Add("0"); // } //} //OW_RECIPE_CHANGE_REPORT_ITEMS.Length Param_Data_List = CRecipeDataProperties.ConvertPLCDataList(tempParameterList); } else { throw new ArgumentException(); } account = _main.SystemConfig.UserAccount; } //List<string> dataList = new List<string>(); //dataList.Add("RECIPE_REQUEST"); //dataList.Add(recipeId); //_main.SendData(dataList); //while (true) //{ // if (_component.vi_recipe_request_reply) // { // _component.vi_recipe_request_reply = false; // break; // } // Thread.Sleep(50); //} _main.MelsecNetMultiWordWriteByString(OW_RECIPE_CHANGE_REPORT_RECIPE_ID, recipeId, 10, ' '); _main.MelsecNetWordWrite(OW_RECIPE_CHANGE_REPORT_RECIPE_CCODE, CCODE); _main.MelsecNetMultiWordWriteByString(OW_RECIPE_CHANGE_REPORT_USER_ACCOUNT, account, 5, ' '); CRecipeItems recipeItems = new CRecipeItems(); //string[] temp_Parm = VI_RECIPE_REQUEST_REPLY.Value.Split('|'); //if (temp_Parm != null && temp_Parm.Length == 3) //{ // string[] Parm_Value = temp_Parm[2].Split(','); // if (Parm_Value != null && Parm_Value.Length > 0) // { // //recipeItems.FL_GROUP_NUM = Parm_Value[0]; // //recipeItems.FR_GROUP_NUM = Parm_Value[1]; // //recipeItems.RL_GROUP_NUM = Parm_Value[2]; // //recipeItems.RR_GROUP_NUM = Parm_Value[3]; // //recipeItems.SUBSITE_NUM = Parm_Value[4]; // Param_Data = Parm_Value; // } //} //List<int> items = recipeItems.GetIntList(Param_Data); //134개 _main.MelsecNetMultiWordWrite(OW_RECIPE_CHANGE_REPORT_ITEMS, Param_Data_List); Log(string.Format("{0}\t{1}", _component.ControlName, string.Format("PGM DATA SEND - RECIPEID={0} CCODE={1} ACCOUNT={2}", recipeId, CCODE, account))); Log(string.Format("{0}\t{1}", _component.ControlName, "PGM DATA DISPLAY")); CTimeout timeout = CTimeoutManager.GetTimeout(_controlName, T1); timeout.TargetOffValueCheck = true; timeout.Begin(OB_RECIPE_CHANGE_REPORT, _main.CONTROLATTRIBUTES.GetProperty(IB_RECIPE_CHANGE_REPORT.ControlName, IB_RECIPE_CHANGE_REPORT.AttributeName) as ITimeoutResource); _main.MelsecNetBitOnOff(OB_RECIPE_CHANGE_REPORT, true); Thread.Sleep(1000); IB_RECIPE_CHANGE_REPORT.Value = true.ToString(); string tempMsg = ""; bool error = false; if (CTimeout.WaitSync(timeout, 10)) { return(0); } else { error = true; _main.MelsecNetBitOnOff(OB_RECIPE_CHANGE_REPORT, false); tempMsg = string.Format("RECIPE CHANGE TIMEOUT No response [timeout T1={0} sec]", T1 / 1000); Log(string.Format("{0}\t{1}", _component.ControlName, "PGM DATA " + tempMsg)); //tempMsg = string.Format("[{0}] Recipe Change Authorization Failure! No response [timeout T1={1} sec]", account.Trim(), T1 / 1000); } if (!error) { return(0); } Log(string.Format("{0}\t{1}", _component.ControlName, "PGM DATA DISPLAY")); #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"; CSubject 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() { //0~9, a~z,A~Z string account = ""; //5 string password = ""; //5 //if (IsManualExecute) //{ // account = this.ProgramDataList[0].Value.ToString(); // password = this.ProgramDataList[1].Value.ToString(); // Log(string.Format("{0}\t{1}", _component.ControlName, string.Format("PGM DATA SEND MANUAL"))); //} //else //{ // string value = VI_USER_LOGIN_RECIPE.Value; // string[] temp = value.Split('|'); // if (temp != null && temp.Length == 3) // { // account = temp[1]; // password = temp[2]; // } //} if (_main.SystemConfig.UserAccount == null) { return(-1); } account = _main.SystemConfig.UserAccount; password = _main.SystemConfig.UserPassword; //받아서 처리하는 부분 //양전자 RECIPE 가져오는 곳 this.StatusChange(enumProgramStatus.PROCESSING); _main.MelsecNetMultiWordWriteByString(OW_RECIPE_CHANGE_AUTHORIZATION_USER_ACCOUNT, account, 5, ' '); _main.MelsecNetMultiWordWriteByString(OW_RECIPE_CHANGE_AUTHORIZATION_PASSWORD, password, 5, ' '); Log(string.Format("{0}\t{1}", _component.ControlName, string.Format("PGM DATA SEND - ACCOUNT={0} PASSWORD="******""; bool error = false; if (CTimeout.WaitSync(timeout, 10)) { string acceptAccount = _main.MelsecNetMultiWordReadToString(IW_RECIPE_CHANGE_PERMISSION_USER_ACCOUNT); string permissionCode = _main.MelsecNetWordRead(IW_RECIPE_CHANGE_PERMISSION_PERMISSION_CODE); if (acceptAccount.Trim() == account.Trim()) { if (permissionCode == PERMISSION_ACCEPT.ToString()) { //_main.SendData(new List<string>() { "USER_LOGIN_RECIPE_REPLY", "O" }); AProgram program = _component.GetProgram("PPID_RECIPE_MAP_REPORT"); program.ExecuteManual(_values); } else { error = true; tempMsg = string.Format("[{0}] Recipe Change Authorization Reject by BC", account.Trim()); } } else { error = true; tempMsg = string.Format("[{0}] Recipe Change Authorization Failure! Account mismatch error. RECV={1}", account.Trim(), acceptAccount.Trim()); } } else { error = true; _main.MelsecNetBitOnOff(OB_RECIPE_CHANGE_AUTHORIZATION, false); tempMsg = string.Format("[{0}] Recipe Change Authorization Failure! No response [timeout T1={1} sec]", account.Trim(), T1 / 1000); Log(string.Format("{0}\t{1}", _component.ControlName, tempMsg)); } if (!error) { return(0); } //_main.SendData(new List<string>() { "USER_LOGIN_RECIPE_REPLY", "X" }); Log(string.Format("{0}\t{1}", _component.ControlName, "PGM DATA DISPLAY")); #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"; CSubject subject = CUIManager.Inst.GetData("CIMMessage"); subject.SetValue("List", new List <string>() { "MESSAGE_SET", msgId, receivedTime, message, panelNo }); subject.Notify(); #endregion return(0); }