InOutParam.cs
5.0 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
148
149
150
151
152
153
154
155
156
157
158
159
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()
{
this.WareCode = "";
MoveP = null;
}
/// <summary>
/// 新建一个对象
/// </summary>
/// <param name="wareNo">物品二维码</param>
/// <param name="position">仓位号</param>
public InOutParam(string wareNo, string posId,string ShelfPosID)
{
this.ShelfPosID = ShelfPosID;
WareCode = wareNo;
PosID = posId;
MoveP = null;
IsSolderPaste = false;
}
public InOutParam(string wareNo, string posId,string plateH,string plateW, string ShelfPosID="")
{
this.ShelfPosID = ShelfPosID;
WareCode = wareNo;
PosID = posId;
MoveP = null;
this.PlateW = plateW;
this.PlateH = plateH;
IsSolderPaste = false;
}
public InOutParam(string wareNo, string posId, LineMoveP linePosition )
{
WareCode = wareNo;
PosID = posId;
MoveP = linePosition;
IsSolderPaste = false;
}
/// <summary>
/// 物品二维码信息
/// </summary>
public string WareCode { get; set; }
/// <summary>
/// 位置坐标名(对应配置表的位置)
/// </summary>
public string PosID { get; set; }
/// <summary>
/// 料架对应的库位号
/// </summary>
public string ShelfPosID = "";
public LineMoveP MoveP { get; set; }
/// <summary>
/// 料盘高度
/// </summary>
public string PlateH { get; set; }
/// <summary>
/// 料盘宽度
/// </summary>
public string PlateW { get; set; }
/// <summary>
/// 是否是放入锡膏(在线料仓才需要此字段)
/// </summary>
public bool IsSolderPaste { get; set; }
/// <summary>
/// 出入库时需要进入新料架
/// </summary>
public bool NeedEnterShelf = true;
/// <summary>
/// 出入库结束后需要将料架送出
/// </summary>
public bool NeedOutShelf = true;
/// <summary>
/// 根据PosId获取对应的料仓ID,若PosId=="",返回-1
/// </summary>
/// <returns></returns>
public int GetStoreId()
{
if (!PosID.Equals(""))
{
string[] arr = PosID.Split('#');
if (arr.Length >= 2)
{
try
{
return int.Parse(arr[0]);
}
catch (Exception ex)
{
}
}
}
return -1;
}
public string ToStr()
{
return " ShelfPosID=["+ ShelfPosID + "],WareCode=【" + WareCode + "】,PosID=【" + PosID + "】,PlateW=【" + PlateW + "】,PlateH=【" + PlateH + "】";
}
internal void UpdateShelfPosId(string pId)
{
this.ShelfPosID = pId;
ShelfPosition sp = CSVPositionReader<ShelfPosition>.GetPositon(ShelfPosID);
if (sp == null)
{
LogUtil.error( "GetPositon[" + ShelfPosID + "]=null,没有库位不能执行出入库");
}
MoveP.InOut_P101 = sp.InoutAxis_P101;
MoveP.UpDown_LP101 = sp.UpDownAxis_LP101;
MoveP.UpDown_HP102 = sp.UpDownAxis_HP102;
MoveP.Middle_P101 = sp.MiddleAxis_P101;
}
internal void UpdatePosId(string message, string posId, string plateW, string plateH,int comPosition)
{
this.WareCode = message;
this.PosID = posId;
this.PlateH = plateH;
this.PlateW = plateW;
ACBoxPosition position = CSVPositionReader<ACBoxPosition>.GetPositon(posId);
if (position == null)
{
LogUtil.error( "GetPositon[" + posId + "] =null,没有库位不能执行出入库");
}
MoveP.InOut_P2 = position.InOutAxis_P2;
MoveP.ComPress_P2 = comPosition;
MoveP.ComPress_P3 = position.ComAxis_P3;
MoveP.InOut_P3 = position.InoutAxis_P3;
MoveP.Middle_P2 = position.MiddleAxis_P2;
MoveP.UpDown_P3 = position.UpdownAxis_IH_P3;
MoveP.UpDown_P4 = position.UpdownAxis_IL_P4;
MoveP.UpDown_P5 = position.UpdownAxis_OH_P5;
MoveP.UpDown_P6 = position.UpdownAxis_OL_P6;
}
}
}