FixtureCodeInfo.cs
2.8 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
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace OnlineStore.DeviceLibrary
{
/// <summary>
/// 夹具编码信息(保存夹具检测到的IO数值,和对应的料仓位置)
/// </summary>
public class FixtureCodeInfo
{
public FixtureCodeInfo(int trayCode, string wareNum, string posId)
{
this.TrayCode = trayCode;
this.WareNum = wareNum;
this.PosId = posId;
SetSize();
}
public FixtureCodeInfo(int trayCode, string wareNum, string posId, int platew, int plateh)
{
this.TrayCode = trayCode;
this.WareNum = wareNum;
this.PosId = posId;
this.plateW = platew;
this.plateH = plateh;
}
public void SetSize()
{
AutoStorePosition position = CSVPositionReader<AutoStorePosition>.GetPositon(PosId);
if (!(position == null))
{
this.plateH = position.BagHeight;
this.plateW = position.BagWidth;
}
else
{
this.plateW = StoreManager.Config.Default_TrayWidth;
if (this.plateW.Equals(0)) { this.plateW = 13; }
this.plateH = StoreManager.Config.GetDefaultHeight();
}
}
/// <summary>
/// 夹具编码值(1-6)
/// </summary>
public int TrayCode { get; set; }
/// <summary>
/// 物品二维码
/// </summary>
public string WareNum { get; set; }
/// <summary>
/// 库位号编码
/// </summary>
public string PosId { get; set; }
/// <summary>
/// 料盘宽
/// </summary>
public int plateW { get; set; }
/// <summary>
/// 料盘高
/// </summary>
public int plateH { get; set; }
public string ToStr()
{
return "TrayCode【" + TrayCode + "】,WareNum=【" + WareNum + "】,PosId=【" + PosId + "】,plateW=【" + plateW + "】,plateH=【" + plateH + "】";
}
/// <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;
}
}
}