|
|
@@ -39,7 +39,7 @@ public class TeDataServiceImpl implements TeDataService {
|
|
39
|
39
|
|
|
40
|
40
|
private static final Logger logger = LoggerFactory.getLogger(TeDataServiceImpl.class);
|
|
41
|
41
|
|
|
42
|
|
- static String base_url = "http://192.168.0.61:4017/";
|
|
|
42
|
+ //static String base_url = "http://192.168.0.61:4017/";
|
|
43
|
43
|
static boolean flag = true;
|
|
44
|
44
|
static double h1 = 6; //h1 圆锥的高
|
|
45
|
45
|
static double h2 = 3; //h2 水平地面到圆锥尖的高
|
|
|
@@ -81,6 +81,7 @@ public class TeDataServiceImpl implements TeDataService {
|
|
81
|
81
|
*/
|
|
82
|
82
|
@Override
|
|
83
|
83
|
public void scanTask(double diameter, double high) {
|
|
|
84
|
+ String base_url = "http://192.168.0.61:4017/";
|
|
84
|
85
|
logger.info("圆筒仓第一次打点的直径和高: {},{}",diameter,high);
|
|
85
|
86
|
STask task = new STask();
|
|
86
|
87
|
Date date = new Date();
|
|
|
@@ -100,7 +101,7 @@ public class TeDataServiceImpl implements TeDataService {
|
|
100
|
101
|
|
|
101
|
102
|
logger.info("scanTask sTaskMapper teDataMapper {},{}",task,teData);
|
|
102
|
103
|
|
|
103
|
|
- postHelper(teData);
|
|
|
104
|
+ postHelper(teData,base_url);
|
|
104
|
105
|
//equipmentTestingEnd
|
|
105
|
106
|
flag = true;
|
|
106
|
107
|
|
|
|
@@ -129,6 +130,8 @@ public class TeDataServiceImpl implements TeDataService {
|
|
129
|
130
|
teData.setEquipmentID(hardList.get(0).getDeviceCode());//设备id
|
|
130
|
131
|
teData.setTaskID(cfId+","+ task.getId());//拼接一个仓房id
|
|
131
|
132
|
teData.setStime(date);
|
|
|
133
|
+ //IP地址
|
|
|
134
|
+ String base_url = "http://"+hardList.get(0).getIpAdress()+":"+hardList.get(0).getPort()+"/";
|
|
132
|
135
|
|
|
133
|
136
|
// 第一次待打点
|
|
134
|
137
|
String rotationxy = CylinderAlg.getAveragePosition(diameter, h);
|
|
|
@@ -136,7 +139,7 @@ public class TeDataServiceImpl implements TeDataService {
|
|
136
|
139
|
logger.info("第一次打点的数据{}",teData);
|
|
137
|
140
|
|
|
138
|
141
|
//发送给硬件
|
|
139
|
|
- postHelper(teData);
|
|
|
142
|
+ postHelper(teData,base_url);
|
|
140
|
143
|
|
|
141
|
144
|
flag = true;
|
|
142
|
145
|
|
|
|
@@ -168,29 +171,43 @@ public class TeDataServiceImpl implements TeDataService {
|
|
168
|
171
|
|
|
169
|
172
|
String taskId = teData.getTaskID();
|
|
170
|
173
|
String houseId = taskId.split(",")[0];//仓房id
|
|
171
|
|
- OrgInfo orgInfoHouse = orgInfoMapper.selectById(Integer.parseInt(houseId));
|
|
172
|
|
- String high = orgInfoHouse.getHigh();//仓房的高
|
|
173
|
|
- String radius = orgInfoHouse.getRadius();//仓房的半径
|
|
174
|
|
- Double diameter = Double.parseDouble(radius)*2;//直径
|
|
175
|
|
- Double h = Double.parseDouble(high);
|
|
176
|
|
-
|
|
177
|
|
- //double zHeight = CylinderAlg.zHeight(teData.getRotationxy(), diameter, h);
|
|
178
|
174
|
|
|
179
|
|
- List<Double> zList = CylinderAlg.getValidZ(teData.getRotationxy(), diameter, h);
|
|
180
|
|
- double z = Collections.max(zList);//纵坐标的最大值
|
|
181
|
|
- //第二次打点的高
|
|
182
|
|
- double secondH = h - z;//仓房的高-点的纵坐标
|
|
183
|
|
- logger.info("z {} ,diameter {},secondH {}",z,diameter,secondH);
|
|
184
|
|
-
|
|
185
|
|
- //打点
|
|
186
|
|
- String rotationxy = CylinderAlg.getAveragePosition(diameter, secondH);
|
|
187
|
|
- teData.setRotationxy(rotationxy);
|
|
188
|
|
- teData.setStime(new Date());//第二次开始的时间
|
|
|
175
|
+ //查询设备的ip和端口
|
|
|
176
|
+ QueryWrapper<HardwareParameter> queryWrapper = new QueryWrapper<>();
|
|
|
177
|
+ queryWrapper.eq("house_id", Integer.parseInt(houseId));
|
|
|
178
|
+ List<HardwareParameter> hardList = hardwareParameterMapper.selectList(queryWrapper);
|
|
|
179
|
+
|
|
|
180
|
+ if(hardList.size()>0){
|
|
|
181
|
+
|
|
|
182
|
+ OrgInfo orgInfoHouse = orgInfoMapper.selectById(Integer.parseInt(houseId));
|
|
|
183
|
+ String high = orgInfoHouse.getHigh();//仓房的高
|
|
|
184
|
+ String radius = orgInfoHouse.getRadius();//仓房的半径
|
|
|
185
|
+ Double diameter = Double.parseDouble(radius)*2;//直径
|
|
|
186
|
+ Double h = Double.parseDouble(high);
|
|
|
187
|
+
|
|
|
188
|
+ //double zHeight = CylinderAlg.zHeight(teData.getRotationxy(), diameter, h);
|
|
|
189
|
+
|
|
|
190
|
+ List<Double> zList = CylinderAlg.getValidZ(teData.getRotationxy(), diameter, h);
|
|
|
191
|
+ double z = Collections.max(zList);//纵坐标的最大值
|
|
|
192
|
+ //第二次打点的高
|
|
|
193
|
+ double secondH = h - z;//仓房的高-点的纵坐标
|
|
|
194
|
+ logger.info("z {} ,diameter {},secondH {}",z,diameter,secondH);
|
|
|
195
|
+
|
|
|
196
|
+ //打点
|
|
|
197
|
+ String rotationxy = CylinderAlg.getAveragePosition(diameter, secondH);
|
|
|
198
|
+ teData.setRotationxy(rotationxy);
|
|
|
199
|
+ teData.setStime(new Date());//第二次开始的时间
|
|
|
200
|
+
|
|
|
201
|
+ //IP地址
|
|
|
202
|
+ String base_url = "http://"+hardList.get(0).getIpAdress()+":"+hardList.get(0).getPort()+"/";
|
|
|
203
|
+
|
|
|
204
|
+ //发送给硬件打点数据
|
|
|
205
|
+ postHelper(teData,base_url);
|
|
|
206
|
+
|
|
|
207
|
+ flag = false;
|
|
|
208
|
+ }
|
|
|
209
|
+
|
|
189
|
210
|
|
|
190
|
|
- //发送给硬件打点数据
|
|
191
|
|
- postHelper(teData);
|
|
192
|
|
-
|
|
193
|
|
- flag = false;
|
|
194
|
211
|
} else {
|
|
195
|
212
|
//打点两次完毕 计算体积
|
|
196
|
213
|
double v = this.calculateVolume(teData.getTaskID());
|
|
|
@@ -207,7 +224,7 @@ public class TeDataServiceImpl implements TeDataService {
|
|
207
|
224
|
return teDataMapper.insert(teData);
|
|
208
|
225
|
}
|
|
209
|
226
|
|
|
210
|
|
- public ReMsg postHelper(TeData teData) {
|
|
|
227
|
+ public ReMsg postHelper(TeData teData,String base_url) {
|
|
211
|
228
|
|
|
212
|
229
|
logger.info("in ...... postHelper teData{}",teData);
|
|
213
|
230
|
|
|
|
@@ -391,7 +408,7 @@ public class TeDataServiceImpl implements TeDataService {
|
|
391
|
408
|
JSONArray jsonArray=JSONArray.parseArray(xyz);
|
|
392
|
409
|
for(int i=0;i<jsonArray.size();i++){
|
|
393
|
410
|
double z = Double.parseDouble(jsonArray.get(i).toString().split(",")[2].split("]")[0])/1000;//单位转化为米
|
|
394
|
|
- System.out.println(z);
|
|
|
411
|
+ //System.out.println(z);
|
|
395
|
412
|
}
|
|
396
|
413
|
|
|
397
|
414
|
}
|