廖井涛
2024-03-04 eae17d27ec56a6b7887f5597335e38ca40273ef4
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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
package Optimize;
 
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
 
public class OptimizationInput {
 
       public Param Param;
       public Polygon_Info[] Polygons;
       public Stock_Info[] Stocks;
       public String GongCheng;       
       
       
       public OptimizationInput(){
           
       }
       
       public JSONObject toJson() throws JSONException{
           JSONObject obj=new JSONObject();
           obj.put("GongCheng",this.GongCheng);
           obj.put("Param",this.Param.toJson());
           JSONArray arr=new JSONArray();
           for(int i=0;i<this.Polygons.length;i++){
               arr.put(this.Polygons[i].toJson());
           }
           obj.put("Polygons", arr);
            arr=new JSONArray();
           for(int i=0;i<this.Stocks.length;i++){
               arr.put(this.Stocks[i].toJson());
           }
           obj.put("Stocks", arr);
           return obj;
       }
       
       public OptimizationInput(JSONObject obj) throws JSONException{
           this.Param=new Param(obj.getJSONObject("Param"));
           JSONArray arr=obj.getJSONArray("Polygons");
           this.Polygons=new Polygon_Info[arr.length()];
           for(int i=0;i<arr.length();i++){
              this.Polygons[i]=new Polygon_Info(arr.getJSONObject(i));
           }
           arr=obj.getJSONArray("Stocks");
           this.Stocks=new Stock_Info[arr.length()];
           for(int i=0;i<arr.length();i++){
               this.Stocks[i]=new Stock_Info( arr.getJSONObject(i));
           }
           this.GongCheng=obj.getString("GongCheng");
       }
       
       
       public static class Param{
           public boolean AutoMatch=false;
           public boolean RotateAble=false;
           public int MaxRack=0;
           public double BaiBian=12;
           public double ZhengGongCha=0;
           public double FuGongCha=0;
           public int YuanDianWeiZhi=0;
           public int XiuBianMode=0;
           public int TongDaoShu=1;
           public int YouHuaCiShu=9;
           public int MobianMinSize=0;
           public Param(JSONObject obj) throws JSONException{
               this.AutoMatch=obj.getBoolean("AutoMatch");
               this.RotateAble=obj.getBoolean("RotateAble");
               this.MaxRack=obj.getInt("MaxRack");
               this.BaiBian=obj.getDouble("BaiBian");
               this.ZhengGongCha=obj.getDouble("ZhengGongCha");
               this.FuGongCha=obj.getDouble("FuGongCha");
               this.YuanDianWeiZhi=obj.getInt("YuanDianWeiZhi");
               this.XiuBianMode=obj.getInt("XiuBianMode");
               this.TongDaoShu=obj.getInt("TongDaoShu");
               this.YouHuaCiShu=obj.getInt("YouHuaCiShu");
               this.MobianMinSize=obj.getInt("MobianMinSize");
           }
           
           public Param(){
               
           }
           
           public JSONObject toJson() throws JSONException{
               JSONObject ret=new JSONObject();
               ret.put("AutoMatch", this.AutoMatch);
               ret.put("RotateAble", this.RotateAble);
               ret.put("MaxRack", this.MaxRack);
               ret.put("BaiBian", this.BaiBian);
               ret.put("ZhengGongCha", this.ZhengGongCha);
               ret.put("FuGongCha", this.FuGongCha);
               ret.put("YuanDianWeiZhi", this.YuanDianWeiZhi);
               ret.put("XiuBianMode", this.XiuBianMode);
               ret.put("TongDaoShu", this.TongDaoShu);
               ret.put("YouHuaCiShu", this.YouHuaCiShu);
               ret.put("MobianMinSize", this.MobianMinSize);
               return ret;
           }
       }
       
       public static  class Polygon_Info{
           public double width;
           public double height;
           public double thickness;
           public double LM1;
           public double LM2;
           public double DM1;
           public double DM2;
           public String JiaHao;
           public String CustomName;
           public String orderid;      //¼ÜºÅ+/+²ã
           public String xuhao;        //ÐòºÅ
           public int count;
           public String gongcheng;
           public int rownumber;
           public String liuchengka;
           
           public Polygon_Info(){
               
           }
           
           public Polygon_Info(JSONObject obj) throws JSONException{
               this.width=obj.getDouble("width");
               this.height=obj.getDouble("height");
               this.thickness=obj.getDouble("thickness");
               this.LM1=obj.getDouble("LM1");
               this.LM2=obj.getDouble("LM2");
               this.DM1=obj.getDouble("DM1");
               this.DM2=obj.getDouble("DM2");
               this.JiaHao=obj.getString("JiaHao");
               this.CustomName=obj.getString("CustomName");
               this.orderid=obj.getString("orderid");
               this.xuhao=obj.getString("xuhao");
               this.count=obj.getInt("count");
               this.gongcheng=obj.getString("gongcheng");
               this.rownumber=obj.getInt("rownumber");
               this.liuchengka=obj.getString("liuchengka");
           }
           
           
           public JSONObject toJson() throws JSONException{
               JSONObject ret=new JSONObject();
               ret.put("width", this.width);
               ret.put("height", this.height);
               ret.put("thickness", this.thickness);
               ret.put("LM1", this.LM1);
               ret.put("LM2", this.LM2);
               ret.put("DM1", this.DM1);
               ret.put("DM2", this.DM2);
               ret.put("JiaHao", this.JiaHao);
               ret.put("CustomName", this.CustomName);
               ret.put("orderid", this.orderid);
               ret.put("xuhao", this.xuhao);
               ret.put("count", this.count);
               ret.put("gongcheng", this.gongcheng);
               ret.put("rownumber", this.rownumber);
               ret.put("liuchengka", this.liuchengka);
            
               return ret;
           }
           
           
       }
       
       public static  class Stock_Info{
           public double up;
           public double down;
           public double left;
           public double right;
           public double width;
           public double height;
           public int count;
           public String libposition;
           public String Color;
           public double thickness;
           public String supplyer;
           public String wuliao_number;
           public Stock_Info(JSONObject obj) throws JSONException{
               
               this.up=obj.getDouble("up");
               this.down=obj.getDouble("down");
               this.left=obj.getDouble("left");
               this.right=obj.getDouble("right");
               this.width=obj.getDouble("width");
               this.height=obj.getDouble("height");
               this.count=obj.getInt("count");
               this.libposition=obj.getString("libposition");
               this.Color=obj.getString("Color");
               this.thickness=obj.getDouble("thickness");
               this.supplyer=obj.getString("supplyer");
               this.wuliao_number=obj.getString("wuliao_number");              
           }
           
           public Stock_Info(){
               
           }
           
           public JSONObject toJson() throws JSONException{
               JSONObject ret=new JSONObject();
               ret.put("up", this.up);
               ret.put("down", this.down);
               ret.put("left", this.left);
               ret.put("right", this.right);
               ret.put("width", this.width);
               ret.put("height", this.height);
               ret.put("count", this.count);
               ret.put("libposition", this.libposition);
               ret.put("count", this.count);
               ret.put("thickness", this.thickness);
               ret.put("supplyer", this.supplyer);
               ret.put("wuliao_number", this.wuliao_number);
           
               return ret;
           }
       }
}