MainMachine_PutReel.cs
6.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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
using CodeLibrary;
using OnlineStore;
using OnlineStore.Common;
using OnlineStore.DeviceLibrary;
using OnlineStore.LoadCSVLibrary;
namespace DeviceLibrary
{
partial class MainMachine
{
private bool canStartMove()
{
if (!boxTransport.IgnoreX09 && IOValue(IO_Type.TrayCheck_Fixture).Equals(IO_VALUE.HIGH))
{
if (!boxTransport.IgnoreX09 && IOMonitor.IODebound(IO_Type.TrayCheck_Fixture, Config, IO_VALUE.HIGH, 5000))
{
Msg.add(crc.GetString("Res0152", "收到出库任务,但料叉上有料,无法启动,请检查"), MsgLevel.alarm, ErrInfo.X09_BoxNotDetect);
return false;
}
else
{
Msg.add(crc.GetString("Res0152", "收到出库任务,但料叉上有料,无法启动,请检查"), MsgLevel.warning);
return false;
}
}
return true;
}
void StoreProcess()
{
if (CheckWait(StoreMoveInfo))
return;
//常规上料扫码流程
switch (StoreMoveInfo.MoveStep)
{
case MoveStep.Wait:
foreach (InReelBean inReel in inReelBeans)
{
if (inReel.ReelReady())
{
TrayInfo tray = inReel.CurrTray;
//取料
if (tray.ngReel)
{
//NG门关上再放料
if (IOManager.IOValue(IO_Type.Left_NGDoor_Close_Check).Equals(IO_VALUE.HIGH) && IOManager.IOValue(IO_Type.Right_NGDoor_Close_Check).Equals(IO_VALUE.HIGH))
{
string ngPos = getNextNgPos();
if (ngPos == "")
{
//暂无NG空位
}
else
{
//送料到NG
StoreMoveInfo.NewMove(MoveStep.PutReel01_Ready);
StoreMoveInfo.MoveParam = new ReelParam(tray.barcode, tray.plateW, tray.plageH, inReel.PosName, ngPos, tray.ngReel, tray.ngMsg);
StoreMoveInfo.log("准备放料:" + StoreMoveInfo.MoveParam.ToStr());
break;
}
}
}
else
{
//获取料架
string pos = GetShelfPosId(tray);
}
}
}
break;
// //放料,准备放料
// PutReel01_Ready,
////放料:开始移库
//PutReel02_StartM,
////放料:等待取料完成
//PutReel03_GetReelEnd,
////放料:等待放料完成
//PutReel04_PutReelEnd,
////放料:放料全部结束
//PutReel05_End,
case MoveStep.PutReel01_Ready:
ACStorePosition startP = CSVPositionReader<ACStorePosition>.GetPositon(StoreMoveInfo.MoveParam.StartPos);
ACStorePosition targetP = CSVPositionReader<ACStorePosition>.GetPositon(StoreMoveInfo.MoveParam.TargetPos);
bool result = boxTransport.Start(new BoxStorePosition(Config, startP, StoreMoveInfo.MoveParam), new BoxStorePosition(Config, targetP, StoreMoveInfo.MoveParam), StoreMoveType.PutReel, true);
if (result)
{
StoreMoveInfo.NewMove(MoveStep.PutReel02_StartM);
StoreMoveInfo.log("开始放料:" + StoreMoveInfo.MoveParam.ToStr());
}
break;
case MoveStep.PutReel02_StartM:
if (boxTransport.IsTakedReel)
{
StoreMoveInfo.NewMove(MoveStep.PutReel03_GetReelEnd);
StoreMoveInfo.log("取料完成:" + StoreMoveInfo.MoveParam.ToStr());
}
break;
case MoveStep.PutReel03_GetReelEnd:
if (boxTransport.IsPutOnOut|| boxTransport.IsComplateOrFree)
{
StoreMoveInfo.NewMove(MoveStep.PutReel04_PutReelEnd);
StoreMoveInfo.log("放料完成:" + StoreMoveInfo.MoveParam.ToStr());
//TODO 通知服务器
}
break;
case MoveStep.PutReel04_PutReelEnd:
if (boxTransport.IsComplateOrFree)
{
StoreMoveInfo.NewMove(MoveStep.PutReel05_End);
StoreMoveInfo.log("放料结束:" + StoreMoveInfo.MoveParam.ToStr());
}
break;
case MoveStep.PutReel05_End:
StoreMoveInfo.EndMove();
break;
default:
StoreMoveInfo.log($"未找到对应步骤:{StoreMoveInfo.MoveStep}");
break;
}
}
string StoreState()
{
string state = crc.GetString("Res0162", "空闲中");
if (StoreMoveInfo.MoveStep == MoveStep.PutReel01_Ready)
{
state = crc.GetString("Res0072","准备放料") + ":[]->[" + StoreMoveInfo.MoveParam.TargetPos+"]";
}
else if (StoreMoveInfo.MoveStep >= MoveStep.PutReel03_GetReelEnd)
{
state = crc.GetString("Res0163", "取料中") + ":" + StoreMoveInfo.MoveParam.TargetPos;
}
else if (StoreMoveInfo.MoveStep >= MoveStep.PutReel05_End)
{
state = crc.GetString("Res0164", "放料中") + ":" + StoreMoveInfo.MoveParam.TargetPos;
}
return state;
}
}
}