MainMachine _Store.cs
5.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
using CodeLibrary;
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DeviceLibrary
{
partial class MainMachine
{
public void AddOutStoreTask(string posId) {
JobInfo jobInfo = new JobInfo("", posId);
OutStoreJobList.Enqueue(jobInfo);
LogUtil.info($"添加出库任务队列: {posId},当前任务数量: {OutStoreJobList.Count}");
}
void StoreProcess()
{
if (CheckWait(StoreMoveInfo))
return;
//常规上料扫码流程
switch (StoreMoveInfo.MoveStep)
{
case MoveStep.Wait:
//判断入库线体有没有等待入库
if (InMoveInfo.MoveStep == MoveStep.InWaitBoxLeave)
{
StoreMoveInfo.NextMoveStep(MoveStep.StoreIn01);
StoreMoveInfo.MoveParam = InMoveInfo.MoveParam.clone();
StoreMoveInfo.log($"入库周转箱已准备好");
}
//判断有没有出库任务, 需要入库空闲, 出口空闲
else if (InMoveInfo.MoveStep==MoveStep.Wait && OutMoveInfo.MoveStep==MoveStep.Wait && IsOutLiftEmpty && boxTransport.IsComplateOrFree) {
if (OutStoreJobList.Dequeue(out JobInfo jobInfo))
{
StoreMoveInfo.NewMove(MoveStep.StoreOut10);
StoreMoveInfo.MoveParam.PosID = jobInfo.PosId;
StoreMoveInfo.log($"开始出库任务");
ServerCM.storeStatus = StoreStatus.OutStoreExecute;
}
}
break;
case MoveStep.StoreIn01:
StoreMoveInfo.NextMoveStep(MoveStep.StoreIn02);
var ac = CSVPositionReader<ACStorePosition>.GetPositon(StoreMoveInfo.MoveParam.PosID);
boxTransport.Start(new BoxStorePosition(Config,StoreSide.A), new BoxStorePosition(ac),StoreMoveType.InStore);
StoreMoveInfo.log($"开始转运周转箱");
ServerCM.SendStoreState(StoreMoveInfo.MoveParam.PosID, StoreStatus.InStoreExecute);
break;
case MoveStep.StoreIn02:
if (boxTransport.IsTakedBox)
{
StoreMoveInfo.NextMoveStep(MoveStep.StoreIn03);
InMoveInfo.NextMoveStep(MoveStep.InBoxLeaved);
StoreMoveInfo.log($"周转箱已取走");
}
else
{
Msg.add("入料线等待周转箱离开", MsgLevel.info);
}
//if (string.IsNullOrEmpty(boxTransport.ErrMsgTxt)) {
// Msg.add(boxTransport.ErrMsgTxt, MsgLevel.warning);
//}
break;
case MoveStep.StoreIn03:
if (boxTransport.IsComplateOrFree)
{
StoreMoveInfo.log($"周转箱已到达目的地");
ServerCM.SendStoreState(StoreMoveInfo.MoveParam.PosID, StoreStatus.InStoreEnd);
StoreMoveInfo.EndMove();
}
break;
case MoveStep.StoreOut10:
StoreMoveInfo.NextMoveStep(MoveStep.StoreOut11);
var outac = CSVPositionReader<ACStorePosition>.GetPositon(StoreMoveInfo.MoveParam.PosID);
boxTransport.Start(new BoxStorePosition(outac),new BoxStorePosition(Config, StoreSide.B),StoreMoveType.OutStore);
StoreMoveInfo.log($"开始转运周转箱");
ServerCM.SendStoreState(StoreMoveInfo.MoveParam.PosID, StoreStatus.OutStoreExecute);
break;
case MoveStep.StoreOut11:
if (boxTransport.IsTakedBox)
{
StoreMoveInfo.NextMoveStep(MoveStep.StoreOut12);
StoreMoveInfo.log($"周转箱已取走");
}
else
{
Msg.add("出料线等待周转箱到达", MsgLevel.info);
}
//if (string.IsNullOrEmpty(boxTransport.ErrMsgTxt))
//{
// Msg.add(boxTransport.ErrMsgTxt, MsgLevel.warning);
//}
break;
case MoveStep.StoreOut12:
if (boxTransport.IsComplateOrFree)
{
OutMoveInfo.NextMoveStep(MoveStep.OutBoxPutOn);
StoreMoveInfo.log($"周转箱已到达目的地");
ServerCM.SendStoreState(StoreMoveInfo.MoveParam.PosID, StoreStatus.OutStoreBoxEnd);
StoreMoveInfo.EndMove();
}
break;
default:
StoreMoveInfo.log($"未找到对应步骤:{StoreMoveInfo.MoveStep}");
break;
}
}
}
}