diff --git a/Machines/ILSOS_ACW_H52A/Sequences/SeqAutoRunACWH52A.cs b/Machines/ILSOS_ACW_H52A/Sequences/SeqAutoRunACWH52A.cs index ff40d09..eb18d22 100644 --- a/Machines/ILSOS_ACW_H52A/Sequences/SeqAutoRunACWH52A.cs +++ b/Machines/ILSOS_ACW_H52A/Sequences/SeqAutoRunACWH52A.cs @@ -205,8 +205,8 @@ namespace ILSOS_ACW_H52A.Sequences > sb[SEQ_SET_PARAMS_UPLOAD_WELDING_LIST_SEQ] > sb[SEQ_DO_ID_UPLOAD_WELDING_LIST_SEQ] > sb[SEQ_GET_RESULT_UPLOAD_WELDING_LIST_SEQ] > sb[SEQ_EXECUTE_WELDING] > sb[SEQ_REQUEST_UNLOAD_CELL] > sb[SEQ_CHECK_CAN_WELDED] > sb[SEQ_SET_PARAMS_REPORT_CELL_RESULT_SEQ] > sb[SEQ_DO_ID_REPORT_CELL_RESULT_SEQ] > sb[SEQ_GET_RESULT_REPORT_CELL_RESULT_SEQ] - > sb[SEQ_CHECK_CYCLE_STOP] - > sb[SEQ_SAVE_RESULT_DATA] > sb[SEQ_WRITE_COMPLETION_PLC_BIT] > sb[SEQ_JOIN_ENCODER_MONITOR] > sb[SEQ_COMPLETE]); + > sb[SEQ_SAVE_RESULT_DATA] > sb[SEQ_CHECK_CYCLE_STOP] + > sb[SEQ_WRITE_COMPLETION_PLC_BIT] > sb[SEQ_JOIN_ENCODER_MONITOR] > sb[SEQ_COMPLETE]); sb.Flows(sb[SEQ_READY_SCANNER_LIST] > sb[SEQ_EXECUTE_WELDING]); @@ -570,6 +570,8 @@ namespace ILSOS_ACW_H52A.Sequences return SEQ_INIT_CONDITION_ERROR; } + Status.EquipmentMode = eEquipmentMode.AUTO; + var startTime = DateTime.Now; context.PutValue(ContextKey.KEY_SEQUENCE_START_TIME, startTime); Thread.Sleep(1); // 부하 방지 @@ -838,33 +840,40 @@ namespace ILSOS_ACW_H52A.Sequences SetInputScannerList(_WeldingScannerListNo, DateTime.Now, _WeldingCount, _WeldingStartAngle, _WeldingJigNo, _RotaryJigCount, canExist, LotId, CellId); _RecipeNo = _RecipeManager.ActivatedRecipe().Id; - var item = _SelectedDrawObjectList[0]; - - if (item is Line) - { - Line lineItem = (Line)item; - ScannerParam laserParam = WeldingRecipeManager.GetScannerParam(lineItem.ScannerParamNo); - - // EDC 보내는 용도 - Status.GetProcessingWeldingData().LaserPowerCore = laserParam.LaserPower1.ToString(); - Status.GetProcessingWeldingData().MarkSpeed = laserParam.MarkSpeed.ToString(); - Status.GetProcessingWeldingData().FocalLength = (_PLC.ReadDWord((int)eWordInput.PLC_WELDING_FOCAL_LENGTH).data / 1000f).ToString(); - Status.GetProcessingWeldingData().WeldingJigNo = _WeldingJigNo.ToString(); - } - + SetWeldingData(); } else { return SEQ_EXECUTE_WELDING; } - - //var item = _SelectedDrawObjectList[0]; - - - // 여기서 어디로 가는지 설정 필요함 return SEQ_SET_PARAMS_UPLOAD_WELDING_LIST_SEQ; #endregion + } + private ScannerParam GetSelectedDrawObjectData(IDrawObject DrawObj) + { + if (DrawObj is Line lineItem) + return WeldingRecipeManager.GetScannerParam(lineItem.ScannerParamNo); + else if (DrawObj is Arc arcItem) + return WeldingRecipeManager.GetScannerParam(arcItem.ScannerParamNo); + else if (DrawObj is Group groupItem) + return WeldingRecipeManager.GetScannerParam(groupItem.ScannerParamNo); + + return null; + } + private void SetWeldingData() + { + ScannerParam laserParam = null; + laserParam = GetSelectedDrawObjectData(_SelectedDrawObjectList[0]); + + if (laserParam != null) + { + // EDC 보내는 용도 + Status.GetProcessingWeldingData().LaserPowerCore = laserParam.LaserPower1.ToString(); + Status.GetProcessingWeldingData().MarkSpeed = laserParam.MarkSpeed.ToString(); + Status.GetProcessingWeldingData().FocalLength = (_PLC.ReadDWord((int)eWordInput.PLC_WELDING_FOCAL_LENGTH).data / 1000f).ToString(); + Status.GetProcessingWeldingData().WeldingJigNo = _WeldingJigNo.ToString(); + } } public void WaitForEncoderNextRotarySection(int weldingCount, int rotaryJigCount, double rotaryAngleOffset, double encoderResetOffset, out double sectionStartAngle) @@ -1181,10 +1190,13 @@ namespace ILSOS_ACW_H52A.Sequences private SequenceActionResult SaveResultData(SequenceContext context, string id, SequenceActionResult param) { - string directoryPath = "D:\\ILSOSConfig\\APD_History"; - string fileName = Status.GetProcessingWeldingData().APD.First().Date.ToString("HHmmss") + "_" + Status.GetProcessingWeldingData().APD.First().CellID; - string fullPath = Path.Combine(directoryPath, Status.GetProcessingWeldingData().APD.First().Date.ToString("yyyy-MM-dd"), fileName); - Status.GetProcessingWeldingData().APD.CreateFiles(fullPath); + if (Status.GetProcessingWeldingData().APD.Count > 0) + { + string directoryPath = "D:\\ILSOSConfig\\APD_History"; + string fileName = Status.GetProcessingWeldingData().APD.First().Date.ToString("HHmmss") + "_" + Status.GetProcessingWeldingData().APD.First().CellID; + string fullPath = Path.Combine(directoryPath, Status.GetProcessingWeldingData().APD.First().Date.ToString("yyyy-MM-dd"), fileName); + Status.GetProcessingWeldingData().APD.CreateFiles(fullPath); + } context.PutValue(ContextKey.KEY_SEQUENCE_RESULT, true); return SequenceAction.Ok(); @@ -1309,6 +1321,8 @@ namespace ILSOS_ACW_H52A.Sequences private void OnSeqActionStop() { + Status.EquipmentMode = eEquipmentMode.MANUAL; + //PLC All BIT OFF for (int i = 0; i < _RotaryJigCount; i++) { diff --git a/Machines/ILSOS_CCW_H52A/Sequences/SeqAutoRunCCWH52A.cs b/Machines/ILSOS_CCW_H52A/Sequences/SeqAutoRunCCWH52A.cs index deb5483..d9db7da 100644 --- a/Machines/ILSOS_CCW_H52A/Sequences/SeqAutoRunCCWH52A.cs +++ b/Machines/ILSOS_CCW_H52A/Sequences/SeqAutoRunCCWH52A.cs @@ -207,8 +207,8 @@ namespace ILSOS_CCW_H52A.Sequences > sb[SEQ_SET_PARAMS_UPLOAD_WELDING_LIST_SEQ] > sb[SEQ_DO_ID_UPLOAD_WELDING_LIST_SEQ] > sb[SEQ_GET_RESULT_UPLOAD_WELDING_LIST_SEQ] > sb[SEQ_EXECUTE_WELDING] > sb[SEQ_REQUEST_UNLOAD_CELL] > sb[SEQ_CHECK_CAN_WELDED] > sb[SEQ_SET_PARAMS_REPORT_CELL_RESULT_SEQ] > sb[SEQ_DO_ID_REPORT_CELL_RESULT_SEQ] > sb[SEQ_GET_RESULT_REPORT_CELL_RESULT_SEQ] - > sb[SEQ_CHECK_CYCLE_STOP] - > sb[SEQ_SAVE_RESULT_DATA] > sb[SEQ_WRITE_COMPLETION_PLC_BIT] > sb[SEQ_JOIN_ENCODER_MONITOR] > sb[SEQ_COMPLETE]); + > sb[SEQ_SAVE_RESULT_DATA] > sb[SEQ_CHECK_CYCLE_STOP] + > sb[SEQ_WRITE_COMPLETION_PLC_BIT] > sb[SEQ_JOIN_ENCODER_MONITOR] > sb[SEQ_COMPLETE]); sb.Flows(sb[SEQ_READY_SCANNER_LIST] > sb[SEQ_EXECUTE_WELDING]); @@ -838,33 +838,40 @@ namespace ILSOS_CCW_H52A.Sequences SetInputScannerList(_WeldingScannerListNo, DateTime.Now, _WeldingCount, _WeldingStartAngle, _WeldingJigNo, _RotaryJigCount, canExist, LotId, CellId); _RecipeNo = _RecipeManager.ActivatedRecipe().Id; - var item = _SelectedDrawObjectList[0]; - - if (item is Line) - { - Line lineItem = (Line)item; - ScannerParam laserParam = WeldingRecipeManager.GetScannerParam(lineItem.ScannerParamNo); - - // EDC 보내는 용도 - Status.GetProcessingWeldingData().LaserPowerCore = laserParam.LaserPower1.ToString(); - Status.GetProcessingWeldingData().MarkSpeed = laserParam.MarkSpeed.ToString(); - Status.GetProcessingWeldingData().FocalLength = (_PLC.ReadDWord((int)eWordInput.PLC_WELDING_FOCAL_LENGTH).data / 1000f).ToString(); - Status.GetProcessingWeldingData().WeldingJigNo = _WeldingJigNo.ToString(); - } - + SetWeldingData(); } else { return SEQ_EXECUTE_WELDING; } - - //var item = _SelectedDrawObjectList[0]; - - - // 여기서 어디로 가는지 설정 필요함 return SEQ_SET_PARAMS_UPLOAD_WELDING_LIST_SEQ; #endregion + } + private ScannerParam GetSelectedDrawObjectData(IDrawObject DrawObj) + { + if (DrawObj is Line lineItem) + return WeldingRecipeManager.GetScannerParam(lineItem.ScannerParamNo); + else if (DrawObj is Arc arcItem) + return WeldingRecipeManager.GetScannerParam(arcItem.ScannerParamNo); + else if (DrawObj is Group groupItem) + return WeldingRecipeManager.GetScannerParam(groupItem.ScannerParamNo); + + return null; + } + private void SetWeldingData() + { + ScannerParam laserParam = null; + laserParam = GetSelectedDrawObjectData(_SelectedDrawObjectList[0]); + + if (laserParam != null) + { + // EDC 보내는 용도 + Status.GetProcessingWeldingData().LaserPowerCore = laserParam.LaserPower1.ToString(); + Status.GetProcessingWeldingData().MarkSpeed = laserParam.MarkSpeed.ToString(); + Status.GetProcessingWeldingData().FocalLength = (_PLC.ReadDWord((int)eWordInput.PLC_WELDING_FOCAL_LENGTH).data / 1000f).ToString(); + Status.GetProcessingWeldingData().WeldingJigNo = _WeldingJigNo.ToString(); + } } public void WaitForEncoderNextRotarySection(int weldingCount, int rotaryJigCount, double rotaryAngleOffset, double encoderResetOffset, out double sectionStartAngle) @@ -1181,6 +1188,14 @@ namespace ILSOS_CCW_H52A.Sequences } private SequenceActionResult SaveResultData(SequenceContext context, string id, SequenceActionResult param) { + if (Status.GetProcessingWeldingData().APD.Count > 0) + { + string directoryPath = "D:\\ILSOSConfig\\APD_History"; + string fileName = Status.GetProcessingWeldingData().APD.First().Date.ToString("HHmmss") + "_" + Status.GetProcessingWeldingData().APD.First().CellID; + string fullPath = Path.Combine(directoryPath, Status.GetProcessingWeldingData().APD.First().Date.ToString("yyyy-MM-dd"), fileName); + Status.GetProcessingWeldingData().APD.CreateFiles(fullPath); + } + context.PutValue(ContextKey.KEY_SEQUENCE_RESULT, true); return SequenceAction.Ok(); } diff --git a/WeldingComponents/WeldingCommon/Data/ActualProcessData.cs b/WeldingComponents/WeldingCommon/Data/ActualProcessData.cs index 2b3c89f..151cfef 100644 --- a/WeldingComponents/WeldingCommon/Data/ActualProcessData.cs +++ b/WeldingComponents/WeldingCommon/Data/ActualProcessData.cs @@ -28,6 +28,7 @@ namespace WeldingCommon.Data table.Columns.Add("Time", typeof(string)); table.Columns.Add(nameof(ActualProcessUnit.LotID), typeof(string)); table.Columns.Add(nameof(ActualProcessUnit.CellID), typeof(string)); + table.Columns.Add(nameof(ActualProcessUnit.WeldType), typeof(string)); table.Columns.Add(nameof(ActualProcessUnit.EncoderCheck), typeof(bool)); table.Columns.Add(nameof(ActualProcessUnit.StartPointX), typeof(double)); table.Columns.Add(nameof(ActualProcessUnit.StartPointY), typeof(double)); @@ -60,7 +61,7 @@ namespace WeldingCommon.Data protected override void InsertItem(int index, ActualProcessUnit item) { base.InsertItem(index, item); - table.Rows.Add(item.Date.ToString("yyyy-MM-dd"), item.Date.ToString("HH:mm:ss.fff"), item.LotID, item.CellID, item.EncoderCheck, + table.Rows.Add(item.Date.ToString("yyyy-MM-dd"), item.Date.ToString("HH:mm:ss.fff"), item.LotID, item.CellID, item.WeldType, item.EncoderCheck, item.StartPointX, item.StartPointY, item.EndPointX, item.EndPointY, item.WeldCondition, item.LaserOnDelay, item.LaserOffDelay, item.JumpDelay, item.MarkDelay, item.PolygonDelay, item.Power, item.JumpSpeed, item.MarkSpeed, item.JumpX, @@ -80,6 +81,8 @@ namespace WeldingCommon.Data private DateTime _Date; public string LotID { get => Status.GetProcessingWeldingData().LotId; } public string CellID { get => Status.GetProcessingWeldingData().CellId; } + public string WeldType { get => _WeldType; set => SetProperty(ref _WeldType, value); } + private string _WeldType; public bool EncoderCheck { get => _EncoderCheck; set => SetProperty(ref _EncoderCheck, value); } private bool _EncoderCheck; public double StartPointX { get => _StartPointX; set => SetProperty(ref _StartPointX, value); } diff --git a/WeldingComponents/WeldingCommon/Sequences/Main/SeqUploadWeldingList.cs b/WeldingComponents/WeldingCommon/Sequences/Main/SeqUploadWeldingList.cs index 71909c2..fca9fe2 100644 --- a/WeldingComponents/WeldingCommon/Sequences/Main/SeqUploadWeldingList.cs +++ b/WeldingComponents/WeldingCommon/Sequences/Main/SeqUploadWeldingList.cs @@ -409,6 +409,7 @@ namespace WeldingCommon.Sequences { //CSV Laser Log 추가 laserLog.Date = DateTime.Now; + laserLog.WeldType = "Line"; laserLog.WeldCondition = param.No + 1; laserLog.LaserOnDelay = param.LaserOnDelay; laserLog.LaserOffDelay = param.LaserOffDelay; @@ -1408,12 +1409,26 @@ namespace WeldingCommon.Sequences { // 1.스캐너 가공조건 설정 ScannerParam param = ScannerCanvasUserCtrl.ScannerParams[obj.ScannerParamNo]; + var laserLog = new ActualProcessUnit(); float percentLaser1 = 0; float percentLaser2 = 0; SetScannerProcessCondition(param, out percentLaser1, out percentLaser2); Log.I(string.Format($"[Arc Weld] Weld Condition(No:{param.No + 1}) Setting(LaserOnDelay:{param.LaserOnDelay},LaserOffDelay:{param.LaserOffDelay},JumpDelay:{param.JumpDelay},MarkDelay:{param.MarkDelay},PolygonDelay:{param.PolygonDelay},Power:{param.LaserPower1},JumpSpeed:{param.JumpSpeed},MarkSpeed:{param.MarkSpeed})")); + //CSV Laser Log 추가 + laserLog.Date = DateTime.Now; + laserLog.WeldType = "Arc"; + laserLog.WeldCondition = param.No + 1; + laserLog.LaserOnDelay = param.LaserOnDelay; + laserLog.LaserOffDelay = param.LaserOffDelay; + laserLog.JumpDelay = param.JumpDelay; + laserLog.MarkDelay = param.MarkDelay; + laserLog.PolygonDelay = param.PolygonDelay; + laserLog.Power = param.LaserPower1; + laserLog.JumpSpeed = param.JumpSpeed; + laserLog.MarkSpeed = param.MarkSpeed; + // 2. 스캐너 가공 작업 // 2.1. Wobbel 관련 설정 // Snowman 사용 모드가 아닐 경우 Wobbel 모드 실행 @@ -1637,6 +1652,14 @@ namespace WeldingCommon.Sequences { _LastX = obj.PF2.X + xOffset; _LastY = obj.PF2.Y + yOffset; + + //CSV Laser Log 추가 + laserLog.StartPointX = obj.PF1.X; + laserLog.StartPointY = obj.PF1.Y; + laserLog.EndPointX = obj.PF2.X; + laserLog.EndPointY = obj.PF2.Y; + Status.GetProcessingWeldingData().APD.Add(laserLog); + if (obj.MadebyRCC) { Log.I(string.Format($"[RCC SubPath Arc Weld] Arc center ({obj.CenterPointF.X + xOffset},{obj.CenterPointF.Y + yOffset}), Sweep angle : ({obj.SweepAngle})")); } else { @@ -1653,11 +1676,25 @@ namespace WeldingCommon.Sequences { // 1.스캐너 가공조건 설정 ScannerParam param = ScannerCanvasUserCtrl.ScannerParams[obj.ScannerParamNo]; + var laserLog = new ActualProcessUnit(); float percentLaser1 = 0; float percentLaser2 = 0; SetScannerProcessCondition(param, out percentLaser1, out percentLaser2); Log.I(string.Format($"[Arc3P Weld] Weld Condition(No:{param.No + 1}) Setting(LaserOnDelay:{param.LaserOnDelay},LaserOffDelay:{param.LaserOffDelay},JumpDelay:{param.JumpDelay},MarkDelay:{param.MarkDelay},PolygonDelay:{param.PolygonDelay},Power:{param.LaserPower1},JumpSpeed:{param.JumpSpeed},MarkSpeed:{param.MarkSpeed})")); + + //CSV Laser Log 추가 + laserLog.Date = DateTime.Now; + laserLog.WeldType = "Arc3"; + laserLog.WeldCondition = param.No + 1; + laserLog.LaserOnDelay = param.LaserOnDelay; + laserLog.LaserOffDelay = param.LaserOffDelay; + laserLog.JumpDelay = param.JumpDelay; + laserLog.MarkDelay = param.MarkDelay; + laserLog.PolygonDelay = param.PolygonDelay; + laserLog.Power = param.LaserPower1; + laserLog.JumpSpeed = param.JumpSpeed; + laserLog.MarkSpeed = param.MarkSpeed; // 2. 스캐너 가공 작업 // 2.1. Wobbel 관련 설정 @@ -1883,6 +1920,14 @@ namespace WeldingCommon.Sequences { _LastX = obj.PF2.X + xOffset; _LastY = obj.PF2.Y + yOffset; + + //CSV Laser Log 추가 + laserLog.StartPointX = obj.PF1.X; + laserLog.StartPointY = obj.PF1.Y; + laserLog.EndPointX = obj.PF2.X; + laserLog.EndPointY = obj.PF2.Y; + Status.GetProcessingWeldingData().APD.Add(laserLog); + if (obj.MadebyRCC) { Log.I(string.Format($"[RCC SubPath Arc3P Weld] Arc center ({obj.CenterPointF.X + xOffset},{obj.CenterPointF.Y + yOffset}), Sweep angle : ({obj.SweepAngle})")); } else {