NGBox.cs
2.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OnlineStore.DeviceLibrary
{
/// <summary>
/// NG箱子
/// </summary>
public class NGBox
{
static string MaxCntInNGBox = "MaxCntInNGBox";
static string CurCntInNGBox = "CurCntInNGBox";
InputEquip_Config Config;
public NGBox(InputEquip_Config config)
{
Config = config;
}
/// <summary>
/// 门禁信号
/// </summary>
/// <returns>true,门开</returns>
bool doorLimitSig()
{
return IOManager.DIValue(IO_Type.NGDoor_Limit, Config.Id).Equals(IO_VALUE.LOW);
}
/// <summary>
/// 最大容量
/// </summary>
int MaxCntInBox = Common.ConfigAppSettings.GetIntValue(MaxCntInNGBox, 15);
/// <summary>
/// 当前容量
/// </summary>
int CurCntInBox = Common.ConfigAppSettings.GetIntValue(CurCntInNGBox, 0);
/// <summary>
/// 是否可以放入
/// </summary>
/// <param name="msg"></param>
/// <returns></returns>
public bool CanPutIn(out string msg)
{
msg = "";
if (doorLimitSig())
{
msg = "无法放料,NG门已开";
return false;
}
if (CurCntInBox >= MaxCntInBox)
{
msg = $"无法放料,NG箱已到达最大数量{MaxCntInBox},请清理NG箱物料";
return false;
}
return true;
}
public bool State(out string msg)
{
msg = $"【NG箱:{CurCntInBox}/{MaxCntInBox}】";
return CurCntInBox < MaxCntInBox;
}
/// <summary>
/// 清除NG数量
/// </summary>
public void ClearCnt()
{
CurCntInBox = 0;
Common.ConfigAppSettings.SaveValue(CurCntInNGBox, CurCntInBox);
}
/// <summary>
/// 放入NG箱信息
/// </summary>
/// <param name="inOutParam"></param>
public void PutIn(InOutParam inOutParam = null)
{
CurCntInBox++;
Common.ConfigAppSettings.SaveValue(CurCntInNGBox, CurCntInBox);
}
}
}