refcatoring 관련 프로그램 추가

This commit is contained in:
최이근 2026-02-21 15:47:11 +09:00
parent c6e9783950
commit 4e99433782
5 changed files with 1285 additions and 13 deletions

View File

@ -108,6 +108,7 @@
<Compile Include="Sequences\Monitoring\AlarmMonitoring.cs" /> <Compile Include="Sequences\Monitoring\AlarmMonitoring.cs" />
<Compile Include="Sequences\ProcessManager.cs" /> <Compile Include="Sequences\ProcessManager.cs" />
<Compile Include="Sequences\SeqAutoRunCCWH52A.cs" /> <Compile Include="Sequences\SeqAutoRunCCWH52A.cs" />
<Compile Include="Sequences\SeqAutoRunRMOTF.cs" />
<Compile Include="Sequences\SequenceContextEx.cs" /> <Compile Include="Sequences\SequenceContextEx.cs" />
<Compile Include="Views\Main\UCMainAutoRun.xaml.cs"> <Compile Include="Views\Main\UCMainAutoRun.xaml.cs">
<DependentUpon>UCMainAutoRun.xaml</DependentUpon> <DependentUpon>UCMainAutoRun.xaml</DependentUpon>

View File

@ -7,14 +7,30 @@ using ILSOS_CCW_H52A.Device;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Reactive.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows;
using WeldingCommon;
using static ILSOS_CCW_H52A.Device.PLCControllerCCWH52A; using static ILSOS_CCW_H52A.Device.PLCControllerCCWH52A;
namespace ILSOS_CCW_H52A.Sequences namespace ILSOS_CCW_H52A.Sequences
{ {
public class ProcessManager public class ProcessManager
{ {
private static ProcessManager _Instance;
public static ProcessManager Instance {
get {
if (_Instance is null) {
_Instance = new ProcessManager();
}
return _Instance;
}
}
private IAuroraEnvironment _env;
private PLCControllerCCWH52A _plc;
private ScannerCCWH52A _scanner;
private bool usedAnalyzerLog = false; private bool usedAnalyzerLog = false;
private readonly Logger _log = new Logger("ProcessManager"); private readonly Logger _log = new Logger("ProcessManager");
@ -24,26 +40,20 @@ namespace ILSOS_CCW_H52A.Sequences
public double DegreePerJig { get => RotaryMaxAngle / RotaryJigCount; } public double DegreePerJig { get => RotaryMaxAngle / RotaryJigCount; }
public double HalfDegreePerJig { get => DegreePerJig / 2; } public double HalfDegreePerJig { get => DegreePerJig / 2; }
public void Init(IAuroraEnvironment env)
private readonly IAuroraEnvironment _env;
private readonly PLCControllerCCWH52A _plc;
private readonly Scanner _scanner;
public ProcessManager()
{ {
_env = env;
_plc = _env.DeviceManager[DeviceIds.PLCDevice] as PLCControllerCCWH52A; _plc = _env.DeviceManager[DeviceIds.PLCDevice] as PLCControllerCCWH52A;
_scanner = _env.DeviceManager[DeviceIds.Scanner] as Scanner; _scanner = _env.DeviceManager[DeviceIds.Scanner] as ScannerCCWH52A;
} }
public IEnumerable<bool> CheckRotaryState() public IEnumerable<bool> CheckRotaryState()
{ {
List<bool> rotaryStates = new List<bool>(); List<bool> rotaryStates = new List<bool>();
for (int i = 0; i < RotaryJigCount; i++) { for (int i = 0; i < RotaryJigCount; i++) {
var rotaryProcessState = _plc.ReadBit(eBitInput.PLC_USE_WELD_JIG_1 + i).data; var rotaryProcessState = _plc.ReadBit(eBitInput.PLC_USE_WELD_JIG_1 + i).data;
rotaryStates.Add(rotaryProcessState); rotaryStates.Add(rotaryProcessState);
//if (rotaryProcessState == false)
if (rotaryProcessState == false) // _plc.ToggleBit(eBitInput.PLC_USE_WELD_JIG_1 + i, eBitOutput.PC_WELD_COMPLETE_1 + i);
_plc.ToggleBit(eBitInput.PLC_USE_WELD_JIG_1 + i, eBitOutput.PC_WELD_COMPLETE_1 + i);
} }
if (usedAnalyzerLog) { if (usedAnalyzerLog) {
@ -57,8 +67,6 @@ namespace ILSOS_CCW_H52A.Sequences
public bool GetRotaryCanExist(int jigNo) public bool GetRotaryCanExist(int jigNo)
{ {
//var RotaryStates = CheckRotaryState();
if (jigNo == 0) if (jigNo == 0)
jigNo = 1; jigNo = 1;

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,45 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WeldingCommon.Utils
{
public class ChangeChecker
{
private static Dictionary<string, bool> mapping = new Dictionary<string, bool>();
public static bool IsChangedBool(string Resource, bool value, bool defaultVal = false)
{
if (mapping.ContainsKey(Resource) == false) {
mapping[Resource] = defaultVal;
return false;
}
if (mapping[Resource] == value) {
return false;
}
mapping[Resource] = value;
return true;
}
public static bool IsChangedBoolMonitoring(string Resource, bool value, bool MonitoringValue, bool defaultVal = false)
{
if (mapping.ContainsKey(Resource) == false) {
mapping[Resource] = defaultVal;
return false;
}
if (mapping[Resource] == value) {
return false;
}
mapping[Resource] = value;
if(mapping[Resource] == MonitoringValue)
return true;
return false;
}
}
}

View File

@ -248,6 +248,7 @@
<Compile Include="Settings\SystemParameter.cs" /> <Compile Include="Settings\SystemParameter.cs" />
<Compile Include="Settings\SystemParameterManager.cs" /> <Compile Include="Settings\SystemParameterManager.cs" />
<Compile Include="Status.cs" /> <Compile Include="Status.cs" />
<Compile Include="Utils\ChangeChecker.cs" />
<Compile Include="Utils\CSV_Manager.cs" /> <Compile Include="Utils\CSV_Manager.cs" />
<Compile Include="Utils\ExcelManagementUnit.cs" /> <Compile Include="Utils\ExcelManagementUnit.cs" />
<Compile Include="Utils\ImageUtil.cs" /> <Compile Include="Utils\ImageUtil.cs" />