initial commit
This commit is contained in:
87
Handler/Project/RunCode/StateMachine/_SPS_AutoOutConveyor.cs
Normal file
87
Handler/Project/RunCode/StateMachine/_SPS_AutoOutConveyor.cs
Normal file
@@ -0,0 +1,87 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using AR;
|
||||
|
||||
namespace Project
|
||||
{
|
||||
public partial class FMain
|
||||
{
|
||||
//컨베이어 배출신호를 자동 해제한다.(지정시간-초)
|
||||
DateTime AutoConvOutTimeL = new DateTime(1982, 11, 23);
|
||||
DateTime AutoConvOutTimeR = new DateTime(1982, 11, 23);
|
||||
void AutoOutConveyor()
|
||||
{
|
||||
//동작중에만 사용한다
|
||||
if (PUB.sm.Step != eSMStep.RUN) return;
|
||||
|
||||
//컨베이어 사용시에만.
|
||||
if (VAR.BOOL[eVarBool.Use_Conveyor] == false) return;
|
||||
|
||||
//모델정보 필수
|
||||
if (PUB.Result.vModel == null || PUB.Result.isSetvModel == false) return;
|
||||
|
||||
//자동 해제 시간확인 (0=비활성)
|
||||
var AutoReleaseSecond = PUB.Result.vModel.AutoOutConveyor;
|
||||
if (AutoReleaseSecond < 1) return;
|
||||
|
||||
//현재 모델의 사용여부 확인 (UI상단에서 버튼으로 클릭가능하다)
|
||||
if (PUB.Result.AutoReelOut == false) return;
|
||||
|
||||
//외부신호 대기중일때만 사용
|
||||
if (PUB.iLockCVL.get((int)eILockCV.EXTBUSY) && DIO.GetIOInput(eDIName.L_CONV4))
|
||||
{
|
||||
if (VAR.BOOL[eVarBool.FG_AUTOOUTCONVL] == false)
|
||||
{
|
||||
if (AutoConvOutTimeL.Year == 1982) AutoConvOutTimeL = DateTime.Now;
|
||||
var ts = DateTime.Now - AutoConvOutTimeL;
|
||||
if (ts.TotalSeconds > AutoReleaseSecond)
|
||||
{
|
||||
PUB.log.AddI($"Auto Conveyor(L) Output - On");
|
||||
VAR.BOOL[eVarBool.FG_AUTOOUTCONVL] = true;
|
||||
AutoConvOutTimeL = DateTime.Now;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (VAR.BOOL[eVarBool.FG_AUTOOUTCONVL] == true)
|
||||
{
|
||||
var ts = DateTime.Now - AutoConvOutTimeL;
|
||||
if (ts.TotalSeconds > SETTING.Data.Timeout_AutoOutConvSignal)
|
||||
{
|
||||
PUB.log.Add($"Auto Conveyor(L) Output - Off");
|
||||
VAR.BOOL[eVarBool.FG_AUTOOUTCONVL] = false;
|
||||
AutoConvOutTimeL = new DateTime(1982, 11, 23);
|
||||
}
|
||||
}
|
||||
|
||||
//외부신호 대기중일때만 사용
|
||||
if (PUB.iLockCVR.get((int)eILockCV.EXTBUSY) && DIO.GetIOInput(eDIName.R_CONV4))
|
||||
{
|
||||
if (VAR.BOOL[eVarBool.FG_AUTOOUTCONVR] == false)
|
||||
{
|
||||
if (AutoConvOutTimeR.Year == 1982) AutoConvOutTimeR = DateTime.Now;
|
||||
var ts = DateTime.Now - AutoConvOutTimeR;
|
||||
if (ts.TotalSeconds > AutoReleaseSecond)
|
||||
{
|
||||
PUB.log.AddI($"Auto Conveyor(R) Output - On");
|
||||
VAR.BOOL[eVarBool.FG_AUTOOUTCONVR] = true;
|
||||
AutoConvOutTimeR = DateTime.Now;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (VAR.BOOL[eVarBool.FG_AUTOOUTCONVR] == true)
|
||||
{
|
||||
var ts = DateTime.Now - AutoConvOutTimeR;
|
||||
if (ts.TotalSeconds > SETTING.Data.Timeout_AutoOutConvSignal)
|
||||
{
|
||||
PUB.log.Add($"Auto Conveyor(R) Output - Off");
|
||||
VAR.BOOL[eVarBool.FG_AUTOOUTCONVR] = false;
|
||||
AutoConvOutTimeR = new DateTime(1982, 11, 23);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user