Files
ATV_STDLabelAttach/Handler/Project_form2/Setting/CSetting.cs
2025-07-17 16:11:46 +09:00

549 lines
22 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
namespace Project
{
public class CSetting : arUtil.Setting
{
#region "log"
[Category("System Log - Main")]
public Boolean Log_CameraConn { get; set; }
[Category("System Log - Main"), DisplayName("Digital Input"),
Description("입/출력 장치의 상태 변화를 기록 합니다.")]
public Boolean Log_DI { get; set; }
[Category("System Log - Main"), DisplayName("Digital Output"),
Description("입/출력 장치의 상태 변화를 기록 합니다.")]
public Boolean Log_DO { get; set; }
[Category("System Log - Main"), DisplayName("Network Alive Check(Ping)"),
Description("디버그 메세지 사용")]
public Boolean Log_Debug { get; set; }
[Category("System Log - Main"), DisplayName("S/M Step Change"),
Description("상태머신의 변화 상태를 기록 합니다.")]
public Boolean Log_StepChange { get; set; }
[Category("System Log - Main"), DisplayName("Motion State Change"),
Description("모션 상태 변화를 기록 합니다.")]
public Boolean Log_motState { get; set; }
[Category("System Log - Main")]
public Boolean Log_flag { get; set; }
[Category("System Log - Main")]
public Boolean Log_ILock { get; set; }
[Category("System Log - Function"), DisplayName("Inter Lock")]
public Boolean Enable_Log_ILock { get; set; }
[Category("System Log - Function"), DisplayName("Flag")]
public Boolean Enable_Log_Flag { get; set; }
[Category("System Log - Function"), DisplayName("Motor Stop Message")]
public Boolean Enable_Log_MotStopReason { get; set; }
#endregion
#region "Communication"
[Category("Communication"), DisplayName("키엔스바코드IP"), Description("키엔스 바코드 프로그램의 접속 IP Address")]
public string IP_Barcode { get; set; }
#endregion
#region "Time Out"
[Category("Timeout Setting"), DisplayName()]
public int Timeout_AutoConfirm { get; set; }
[Category("Timeout Setting"), DisplayName("작업 완료 대기시간(단위:초)")]
public int Timeout_JOBEnd { get; set; }
[Category("Timeout Setting"), DisplayName("최대비젼분석시간(로더)")]
public int Timeout_VisionProcessL { get; set; }
[Category("Timeout Setting"), DisplayName("최대비젼분석시간(언로더)")]
public int Timeout_VisionProcessU { get; set; }
[Category("Timeout Setting"), DisplayName("장비 초기화 대기시간(단위:초)")]
public int Timeout_HomeSearch { get; set; }
[Category("Timeout Setting"), DisplayName("개별 동작의 대기시간(단위:초)")]
public double Timeout_StepMaxTime { get; set; }
[Category("Timeout Setting"), DisplayName("모션의 최대 동작시간(단위:초)")]
public int Timeout_MotionCommand { get; set; }
[Category("Timeout Setting"), DisplayName("DIO의 최대 동작시간(단위:초)")]
public int Timeout_DIOCommand { get; set; }
#endregion
#region "Advanced Parameter"
[Category("Advanced Parameter"), DisplayName("Remote Contoller Port"), Description("디버그 포트 정보(시리얼통신), 입력 예) COM1:9600")]
public string Serial_Remocon { get; set; }
[Category("Advanced Parameter"), Browsable(false)]
public Boolean Disable_PrinterL { get; set; }
[Category("Advanced Parameter"), Browsable(false)]
public Boolean Disable_PrinterR { get; set; }
[Category("Advanced Parameter"), Browsable(false)]
public Boolean Disable_PLVac { get; set; }
[Category("Advanced Parameter"), Browsable(false)]
public Boolean Disable_PRVac { get; set; }
[Category("Advanced Parameter"), Browsable(false)]
public Boolean Disable_PKVac { get; set; }
[Category("Advanced Parameter"), Browsable(false)]
public Boolean Disable_Port0 { get; set; }
[Category("Advanced Parameter")]
public Boolean Disable_Port1 { get; set; }
[Category("Advanced Parameter"), Browsable(false)]
public Boolean Disable_Port2 { get; set; }
[Category("Advanced Parameter")]
public Boolean Disable_SIDReferenceCheck { get; set; }
[Category("Advanced Parameter")]
public Boolean Enable_ButtonStart { get; set; }
[Category("Advanced Parameter")]
public Boolean Disable_RequestJobSeqNo { get; set; }
[Category("Advanced Parameter")]
public Boolean DisableSensor_AIRCheck { get; set; }
[Category("Advanced Parameter"), Browsable(false)]
public Boolean Disable_TowerLamp { get; set; }
[Category("Advanced Parameter"), Browsable(false)]
public Boolean Disable_RoomLight { get; set; }
[Category("Advanced Parameter")]
public bool Disable_vacum { get; set; }
[Category("Advanced Parameter"), DisplayName("*.속도제한")]
public Boolean Enable_SpeedLimit { get; set; }
[Category("Advanced Parameter"), DisplayName("*.최대속도")]
public int LimitSpeed { get; set; }
[Category("Advanced Parameter"), Browsable(false)]
public Boolean Disable_SidQtyCheck { get; set; }
[Category("Advanced Parameter")]
public Boolean Disable_Axis0 { get; set; }
[Category("Advanced Parameter")]
public Boolean Disable_Axis1 { get; set; }
[Category("Advanced Parameter")]
public Boolean Disable_Axis2 { get; set; }
[Category("Advanced Parameter")]
public Boolean Disable_Axis3 { get; set; }
[Category("Advanced Parameter")]
public Boolean Disable_Axis4 { get; set; }
[Category("Advanced Parameter")]
public Boolean Disable_Axis5 { get; set; }
[Category("Advanced Parameter")]
public Boolean Disable_Axis6 { get; set; }
[Category("Advanced Parameter")]
public Boolean EnableDebugMode { get; set; }
#endregion
#region "function"
[Browsable(false)]
public Boolean Disable_safty_F0 { get; set; }
[Browsable(false)]
public Boolean Disable_safty_F1 { get; set; }
[Browsable(false)]
public Boolean Disable_safty_F2 { get; set; }
[Browsable(false)]
public Boolean Disable_safty_R0 { get; set; }
[Browsable(false)]
public Boolean Disable_safty_R1 { get; set; }
[Browsable(false)]
public Boolean Disable_safty_R2 { get; set; }
[Browsable(false)]
public Boolean Disable_Buzzer { get; set; }
[Browsable(false)]
public Boolean Enable_RQAuto { get; set; }
[Browsable(false)]
public Boolean Enable_Magnet0 { get; set; }
[Browsable(false)]
public Boolean Enable_Magnet1 { get; set; }
[Browsable(false)]
public Boolean Enable_Magnet2 { get; set; }
[Browsable(false)]
public Boolean Disable_Left { get; set; }
[Browsable(false)]
public Boolean Disable_Right { get; set; }
public string GetPathData()
{
if (Path_Data.isEmpty()) return System.IO.Path.Combine(Util.CurrentPath, "SaveData");
else return Path_Data;
}
[Category("Function"), DisplayName("라벨QR코드검증"), Description("부착된 라벨의 QR코드를 인쇄데이터와 검증 합니다")]
public Boolean Enable_Unloader_QRValidation { get; set; }
[Category("Function"), DisplayName("촬영이미지저장")]
public Boolean Save_Image { get; set; }
[Category("Function"), DisplayName("피커자동이동(전면도어)")]
public Boolean PickerAutoMoveForDoor { get; set; }
[Category("Function"), DisplayName("Data Save Path")]
public string Path_Data { get; set; }
[Category("Function"), Browsable(false), DisplayName("실내등 자동 제어"),
Description("도어 상태에 따라서 내부 조명을 자동 ON/OFF 합니다")]
public Boolean Enable_AutoLight { get; set; }
//[Category("Function"), DisplayName("AIR OFF Timer(ms)"),
//Description("공압 OFF시 유지 시간(ms), 지정 시간 동안 스위치를 ON 시켜야 공압이 OFF 됩니다.")]
//public int AirOFFTimer { get; set; }
[Category("Function"), DisplayName("부저 동작시간(ms)"),
Description("부저 발생시 지정된 시간(ms) 동안 부저가 울립니다")]
public int buzz_run_ms { get; set; }
#endregion
#region "Vision"
[Category("Vision"), DisplayName("13' 이미지 중앙 위치"), Description("키엔스 이미지의 회전축 좌표")]
public System.Drawing.Point CenterPosition13 { get; set; }
[Category("Vision"), DisplayName("7' 이미지 중앙 위치"), Description("키엔트 이미지의 회전축 좌표")]
public System.Drawing.Point CenterPosition7 { get; set; }
[Category("Vision"), DisplayName("Vision Refresh Time"), Description("좌/우 비젼의 갱신 시간(ms)")]
public int Vis_Liveview_Interval { get; set; }
[Category("Vision"), DisplayName("카메라사용안함(좌)")]
public Boolean DisableCamera0 { get; set; }
[Category("Vision"), DisplayName("카메라사용안함(우)")]
public Boolean DisableCamera2 { get; set; }
public float RosRectScale { get; set; }
[Category("Vision")]
public float AngleOffsetL { get; set; }
[Category("Vision")]
public float AngleOffsetR { get; set; }
public Boolean DisableCamera(int idx)
{
if (idx == 0) return DisableCamera0;
else if (idx == 1) return false;
else return DisableCamera2;
}
#endregion
#region "Vision Processing"
//[Category("Vision Processing")]
//public int processCount { get; set; }
[Category("Vision Processing")]
public string erodevaluestr { get; set; }
[Category("Vision Processing")]
public uint blob_area_min { get; set; }
[Category("Vision Processing")]
public uint blob_area_max { get; set; }
[Category("Vision Processing")]
public float blob_sigmaxy { get; set; }
[Category("Vision Processing")]
public float blob_sigmayy { get; set; }
[Category("Vision Processing")]
public float blob_sigmaxx { get; set; }
//[Category("Vision Processing")]
//public Boolean SaveErrorImage { get; set; }
[Category("Vision Processing")]
public string GainOffsetListStr { get; set; }
#endregion
#region "Count Reset Setting"
[Category("Count Reset Setting"), Browsable(false), DisplayName("A/M Clear Enable"),
Description("오전 초기화 여부\n작업수량을 초기화 하려면 True 로 설정하세요")]
public Boolean datetime_Check_1 { get; set; }
[Category("Count Reset Setting"), Browsable(false), DisplayName("P/M Clear Enable"),
Description("오후 초기화 여부\n작업수량을 초기화 하려면 True 로 설정하세요")]
public Boolean datetime_Check_2 { get; set; }
[Category("Count Reset Setting"), Browsable(false), DisplayName("A/M Clear Time(HH:mm)"),
Description("오전 초기화 시간(시:분)\n예) 09:00")]
public string datetime_Reset_1 { get; set; }
[Category("Count Reset Setting"), Browsable(false), DisplayName("P/M Clear Time(HH:mm)"),
Description("오후 초기화 시간(시:분)\n예) 19:00")]
public string datetime_Reset_2 { get; set; }
#endregion
#region "Sensitive"
[Category("Sensitive"), DisplayName("언/로더포트 감지(fall)")]
public ushort PortDetectFall { get; set; }
[Category("Sensitive"), DisplayName("언/로더포트 감지(rise)")]
public ushort PortDetectRise { get; set; }
[Category("Sensitive"), DisplayName("도어 감지센서(rise)")]
public ushort SaftyDetectRise { get; set; }
[Category("Sensitive"), DisplayName("도어 감지센서(rise)")]
public ushort SaftyDetectFall { get; set; }
[Category("Sensitive"), DisplayName("AIR 버튼(rise/fall)")]
public ushort AirChange { get; set; }
#endregion
#region "Operation Delay"
[Category("Operation Delay(sec)"), DisplayName("라벨 붙인 후 대기 시간"), Description("라벨 부착 후 PURGE 대기 시간")]
public float PrintVacOffPurgesec { get; set; }
[Category("Operation Delay(sec)"), DisplayName("카트감지대기시간(좌)"), Description("지정된 시간 이후에 카트가 HOLD 됩니다- ms")]
public ushort WaitTime_Magnet0 { get; set; }
[Category("Operation Delay(sec)"), DisplayName("카트감지대기시간(중앙)"), Description("지정된 시간 이후에 카트가 HOLD 됩니다- ms")]
public ushort WaitTime_Magnet1 { get; set; }
[Category("Operation Delay(sec)"), DisplayName("카트감지대기시간(우)"), Description("지정된 시간 이후에 카트가 HOLD 됩니다 - ms")]
public ushort WaitTime_Magnet2 { get; set; }
[Category("Operation Delay(sec)"), DisplayName("프린트후대기시간(좌s)"), Description("프린터 라벨 출력 후 대기 시간(좌)- ms")]
public int PrintLWaitMS { get; set; }
[Category("Operation Delay(sec)"), DisplayName("프린트후대기시간(우)"), Description("프린터 라벨 출력 후 대기 시간(우)- ms")]
public int PrintRWaitMS { get; set; }
[Category("Operation Delay(sec)"), DisplayName("포트 하강 시간(Unloader)"), Description("포트 정렬시 지정된 시간동안 하강 합니다")]
public float PortAlignDownTimeU { get; set; }
[Category("Operation Delay(sec)"), DisplayName("포트 하강 시간(Loader)"), Description("포트 정렬시 지정된 시간동안 하강 합니다")]
public float PortAlignDownTimeL { get; set; }
[Category("Operation Delay(sec)"), DisplayName("Loder포트 하강 시간(Finish)"), Description("작업 완료 후 지정된 시간(ms) 만큼 하강 합니다")]
public ushort Port1FisnishDownTime { get; set; }
#endregion
[Category("General Setting"), DisplayName("장비 자산 번호")]
public string Asset { get; set; }
[Category("General Setting"), DisplayName("무시바코드"), Description("입려된 값으로 시작하는 바코드를 무시합니다. 여러개 입력하려면 콤마(,) 로 구분 하세요")]
public string IgnoreBarcode { get; set; }
[Category("General Setting")]
public string ReelIdDeviceID { get; set; }
[Category("General Setting")]
public string ReelIdDeviceLoc { get; set; }
public Boolean MoveYForPaperVaccume { get; set; }
public float MoveYForPaperVaccumeValue { get; set; }
public uint MoveYForPaperVaccumeVel { get; set; }
public uint MoveYForPaperVaccumeAcc { get; set; }
public Boolean OnlineMode { get; set; }
public string HostIPL { get; set; }
public string HostIPR { get; set; }
public int HostPortL { get; set; }
public int HostPortR { get; set; }
public string CameraLFile { get; set; }
public string CameraRFile { get; set; }
public Boolean STDLabelFormat7 { get; set; }
#region "Printer"
[Category("Printer"), DisplayName("프린트이름(좌)"), Description("프린트 장치 이름")]
public string PrintLeftName { get; set; }
[Category("Printer"), DisplayName("프린트이름(우)"), Description("프린트 장치 이름")]
public string PrintRightName { get; set; }
[Category("Printer"), DisplayName("바코드 외곽 박스 그리기")]
public Boolean DrawOutbox { get; set; }
#endregion
[Category("Joystick")]
public int Jostick_vid { get; set; }
[Category("Joystick")]
public int Jostick_pid { get; set; }
#region "general"
[Category("General Setting"), Browsable(false),
Description("데이터 자동 소거 기간(일) 비활성=0")]
public int AutoDeleteDay { get; set; }
[Category("General Setting"), Browsable(false),
Description("데이터 자동 소거 조건(남은용량 %)")]
public int AutoDeleteThreshold { get; set; }
[Category("General Setting"), Browsable(false)]
public string Password_Setup { get; set; }
[Category("General Setting"), Browsable(false)]
public string Language { get; set; }
[Category("General Setting"), DisplayName("Full Screen Window State"),
Description("화면을 전체화면으로 사용 합니다.")]
public Boolean FullScreen { get; set; }
#region "표시안함"
[Category("Sensor Detect"), Browsable(false)]
public Boolean Detect_CartL { get; set; }
[Category("Sensor Detect"), Browsable(false)]
public Boolean Detect_CartC { get; set; }
[Category("Sensor Detect"), Browsable(false)]
public Boolean Detect_CartR { get; set; }
[Category("Sensor Detect"), Browsable(false)]
public Boolean Detect_PrintL { get; set; }
[Category("Sensor Detect"), Browsable(false)]
public Boolean Detect_PrintR { get; set; }
[Category("Sensor Detect"), Browsable(false)]
public Boolean Detect_CenterSafty { get; set; }
#endregion
#endregion
public override void AfterLoad()
{
if (HostIPL.isEmpty() && HostPortL < 1)
{
HostIPL = "127.0.0.1";
HostPortL = 7979;
}
if (HostIPR.isEmpty() && HostPortR < 1)
{
HostIPR = "127.0.0.1";
HostPortR = 7980;
}
if (ReelIdDeviceLoc.isEmpty()) ReelIdDeviceLoc = "4";
if (ReelIdDeviceID.isEmpty()) ReelIdDeviceID = "A";
if (IgnoreBarcode.isEmpty()) IgnoreBarcode = "{{{";
if (Timeout_AutoConfirm == 0) Timeout_AutoConfirm = 5;
if (PrintVacOffPurgesec <= 0.0) PrintVacOffPurgesec = 1.1f;
if (MoveYForPaperVaccumeVel == 0) MoveYForPaperVaccumeVel = 10;
if (MoveYForPaperVaccumeAcc == 0) MoveYForPaperVaccumeAcc = 1000;
if (blob_area_max == 0 && blob_area_min == 0)
{
//processCount = 6;
erodevaluestr = "3,1";
blob_area_min = 5000;
blob_area_max = 50000;
blob_sigmaxy = 500f;
blob_sigmaxx = 5000f;
blob_sigmayy = 500f;
}
if (RosRectScale == 0f)
RosRectScale = 1.5f;
//포트얼라인시간 210401
if (PortAlignDownTimeU == 0f &&
PortAlignDownTimeL == 0f)
{
PortAlignDownTimeL = 1.5f;
PortAlignDownTimeU = 1.0f;
}
//if (Port1FisnishDownTime == 0)
// Port1FisnishDownTime = 5000;
if (GainOffsetListStr.isEmpty())
{
GainOffsetListStr = "1,0;1.3,0;1,50;1,-50;3,50;0.5,-20;2.5,150;2,0";
}
if (Jostick_vid == 0) Jostick_vid = 121;
if (Jostick_pid == 0) Jostick_pid = 17;
if (PrintLWaitMS == 0) PrintLWaitMS = 1500;
if (PrintRWaitMS == 0) PrintRWaitMS = 1500;
if (WaitTime_Magnet0 == 0) WaitTime_Magnet0 = 3000;
if (WaitTime_Magnet1 == 0) WaitTime_Magnet1 = 3000;
if (WaitTime_Magnet2 == 0) WaitTime_Magnet2 = 3000;
if (PrintLeftName.isEmpty()) PrintLeftName = "PrinterL";
if (PrintRightName.isEmpty()) PrintRightName = "PrinterR";
if (Vis_Liveview_Interval < 0) Vis_Liveview_Interval = 100;
if (SaftyDetectRise == 0) SaftyDetectRise = 20;
if (SaftyDetectFall == 0) SaftyDetectFall = 1000; //안전센서는 느리게 해제 한다
if (Timeout_JOBEnd == 0) Timeout_JOBEnd = 10;
if (Timeout_VisionProcessL == 0) Timeout_VisionProcessL = 3000;
if (Timeout_VisionProcessU == 0) Timeout_VisionProcessU = 10000;
if (PortDetectFall == 0) PortDetectFall = 50;
if (PortDetectRise == 0) PortDetectRise = 10;
if (AirChange == 0) AirChange = 3000;
if (IP_Barcode.isEmpty()) IP_Barcode = "192.168.100.100";
//데이터베이스
if (IP_Barcode.isEmpty() == true) IP_Barcode = "net.pipe://127.0.0.1/barcode";
if (Timeout_MotionCommand == 0) Timeout_MotionCommand = 10;
if (Timeout_DIOCommand == 0) Timeout_DIOCommand = 10;
if (AutoDeleteThreshold == 0) AutoDeleteThreshold = 20;
if (Timeout_HomeSearch == 0) Timeout_HomeSearch = 50;
//if (AirOFFTimer == 0) AirOFFTimer = 3000; //181226
if (Asset == "") Asset = "DEV_SPLIT";
if (Language.isEmpty()) Language = "Kor";
if (Password_Setup.isEmpty()) Password_Setup = "0000";
if (Path_Data == "")
Path_Data = System.IO.Path.Combine(Util.CurrentPath, "SaveData");
try
{
if (System.IO.Directory.Exists(Path_Data) == false)
System.IO.Directory.CreateDirectory(Path_Data);
}
catch
{
}
//if (Password_User.isEmpty()) Password_User = "9999";
}
public override void AfterSave()
{
//throw new NotImplementedException();
}
public void CopyTo(CSetting dest)
{
//이곳의 모든 쓰기가능한 속성값을 대상에 써준다.
Type thClass = this.GetType();
foreach (var method in thClass.GetMethods())
{
var parameters = method.GetParameters();
if (!method.Name.StartsWith("get_")) continue;
string keyname = method.Name.Substring(4);
string methodName = method.Name;
object odata = GetType().GetMethod(methodName).Invoke(this, null);
var wMethod = dest.GetType().GetMethod(Convert.ToString("set_") + keyname);
if (wMethod != null) wMethod.Invoke(dest, new object[] { odata });
}
}
}
}