InOutParam.cs
3.5 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
using log4net;
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
namespace OnlineStore.DeviceLibrary
{
/// <summary>
/// 出入仓参数(出入库操作时传入的参数类)
/// </summary>
public class InOutParam
{
public static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public InOutParam()
{
ACStoreP = null;
this.PosInfo = new InOutPosInfo("", "");
MoveP = null;
}
public InOutParam(InOutPosInfo inoutInfo , LineMoveP linePosition = null)
{
ACStoreP = null; ;
MoveP = linePosition;
this.PosInfo = inoutInfo;
}
private ACSquareSPosition ACStoreP = null;
public ACSquareSPosition GetACPosition()
{
try
{
if (ACStoreP == null)
{
string posId = PosInfo != null ? PosInfo.PosId : "";
ACStoreP = CSVPositionReader<ACSquareSPosition>.GetPositon(posId);
}
}
catch (Exception ex)
{
LogUtil.error(log, "出入库获取库位信息GetKTKPosition出错:" + ex.ToString());
}
return ACStoreP;
}
public InOutPosInfo PosInfo { get; set; }
public LineMoveP MoveP { get; set; }
public void UpdateShelfType(int shelfType, Box_Config Config)
{
if (MoveP != null)
{
if (shelfType.Equals(1))
{
MoveP.InOut_P2 = Config.InOutAxis_P2_Position;
}
else
{
MoveP.InOut_P2 = Config.InOutAxis_P3_Position;
}
}
if (PosInfo != null)
{
PosInfo.ShelfType = shelfType;
}
LogUtil.info("UpdateShelfType = " + shelfType);
}
}
/// <summary>
/// 夹具编码信息(保存夹具检测到的IO数值,和对应的料仓位置)
/// </summary>
public class InOutPosInfo
{
public InOutPosInfo(string barcode, string posId, string platew = "", string plateh = "", int shelftype=0)
{
this.barcode = barcode;
this.PosId = posId;
this.PlateW = platew;
this.PlateH = plateh;
this.ShelfType = shelftype;
}
/// <summary>
/// 物品二维码
/// </summary>
public string barcode { get; set; }
/// <summary>
/// 库位号编码
/// </summary>
public string PosId { get; set; }
/// <summary>
/// 料盘宽
/// </summary>
public string PlateW { get; set; }
/// <summary>
/// 料盘高
/// </summary>
public string PlateH { get; set; }
/// <summary>
/// 使用左侧托架=1,还是右侧托架=2
/// </summary>
public int ShelfType = 0;
public string ToStr()
{
string inType = "";
if (ShelfType.Equals(1))
{
inType = "左侧";
}
else if (ShelfType.Equals(2))
{
inType = "右侧";
}
return " [" + PosId + "] [" + inType + "] [" + barcode + "][" + PlateW + "X" + PlateH + "]";
}
}
}