LabelParam.cs
4.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
using CodeLibrary;
using OnlineStore;
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
using System.Threading.Tasks;
namespace DeviceLibrary
{
[Serializable]
class BoxStorePosition {
/// <summary>
/// 旋转轴取料点
/// </summary>
public int Middle_P2;
/// <summary>
/// 升降轴取料高点
/// </summary>
public int UpDown_PH;
/// <summary>
/// 升降轴取料低点
/// </summary>
public int UpDown_PL;
/// <summary>
/// 进出轴取料点
/// </summary>
public int InOut_P2;
/// <summary>
/// 压紧轴高点
/// </summary>
public int Comp_PH;
/// <summary>
/// 压紧轴压紧点
/// </summary>
public int Comp_PL;
public string posid;
public ReelParam Reel;
public BoxStorePosition(Store_ConfigBase Config, ACStorePosition aCStorePosition, ReelParam reel) {
Middle_P2 = aCStorePosition.XAxis_Position_P2;
InOut_P2 = aCStorePosition.InOutAxis_Position_P3;
UpDown_PH = aCStorePosition.UpDownAxis_IHPosition_P3;
UpDown_PL = aCStorePosition.UpDownAxis_ILPosition_P4;
int BagHigh = aCStorePosition.BagHigh;
if (FixtureConfig.GetFixtureHeight(aCStorePosition.BagWidth, aCStorePosition.BagHigh, out int actualheight))
BagHigh = actualheight;
Comp_PH = Config.Comp_P2 - Config.Comp_PoToMM * (BagHigh - 70 + Config.Comp_PH_MM);
int ReelHeight = reel.PlateH;
if (FixtureConfig.GetFixtureHeight(reel.PlateW, reel.PlateH, out int actualheight1))
ReelHeight = actualheight1;
Comp_PL = Config.Comp_P2 - Config.Comp_PoToMM * (ReelHeight - 70);
Comp_PH = Comp_PH < 0 ? 0 : Comp_PH;
Comp_PL = Comp_PL < 0 ? 0 : Comp_PL;
posid = aCStorePosition.PositionNum;
Reel = reel.clone();
LogUtil.info($"BSP:{posid},Comp_PH:{Comp_PH}={Config.Comp_P2}-({BagHigh}-{8}+{Config.Comp_PH_MM})*{Config.Comp_PoToMM},Comp_PL:{Comp_PL}={ReelHeight},{JsonHelper.SerializeObject(this)}");
}
public const string ngdoor = "单料口";
public BoxStorePosition(Store_ConfigBase Config, StoreSide storeSide, ReelParam reel)
{
int Height = reel.PlateH;
if (FixtureConfig.GetFixtureHeight(reel.PlateW, reel.PlateH, out int actualheight))
Height = actualheight;
Comp_PH = Config.Comp_P2 - Config.Comp_PoToMM * (Height - 70 + Config.Comp_PH_MM);
Comp_PL = Config.Comp_P2 - Config.Comp_PoToMM * (Height - 70);
Comp_PH = Comp_PH < 0 ? 0 : Comp_PH;
Comp_PL = Comp_PL < 0 ? 0 : Comp_PL;
if (storeSide == StoreSide.NGDoor)
{
Middle_P2 = Config.Middle_P2;
InOut_P2 = Config.InOut_P2;
UpDown_PH = Config.UpDown_P2;
UpDown_PL = Config.UpDown_P3;
posid = ngdoor;
}
Reel = reel.clone();
LogUtil.info($"BSP:{posid},Comp_PL:{Comp_PL}={reel.PlateH}={Height},{JsonHelper.SerializeObject(this)}");
}
public static BoxStorePosition GetFixPos(Store_ConfigBase Config, ReelParam reel) {
var fixpos = "fix#" + reel.PlateW.ToString();
var ac = CSVPositionReader<ACStorePosition>.GetPositon(fixpos);
if (ac == null)
return null;
var p = new BoxStorePosition(Config, ac, reel);
return p;
}
public BoxStorePosition clone()
{
BoxStorePosition dstobject;
using (MemoryStream mStream = new MemoryStream())
{
BinaryFormatter bf = new BinaryFormatter();
bf.Serialize(mStream, this);
mStream.Seek(0, SeekOrigin.Begin);//指定当前流的位置为流的开头。
dstobject = (BoxStorePosition)bf.Deserialize(mStream);
mStream.Close();
}
return dstobject;
}
}
public enum StoreSide
{
NGDoor
}
}