rev:更新
This commit is contained in:
@@ -40,7 +40,7 @@ public class AppRun {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(AppRun.class, args);
|
||||
new HeartServer(new InetSocketAddress("192.168.8.218", 20889));
|
||||
new HeartServer(new InetSocketAddress("192.168.18.218", 20889));
|
||||
System.out.println("项目启动成功");
|
||||
}
|
||||
|
||||
|
||||
@@ -372,7 +372,9 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc
|
||||
return;
|
||||
}
|
||||
JSONObject param = new JSONObject();
|
||||
param.put(this.barcode, this.currentDeviceCode);
|
||||
param.put("vehicle_code", this.barcode);
|
||||
param.put("start_point", this.currentDeviceCode);
|
||||
param.put("height", this.height);
|
||||
CommonRequest<JSONObject> request =
|
||||
CommonRequest.<JSONObject>builder()
|
||||
.service("InStorage")
|
||||
@@ -855,9 +857,9 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc
|
||||
// this.writing(Arrays.asList(ItemProtocol.TO_COMMAND.getKey()), Arrays.asList(CommandEnum.COMMAND_1.getValue()));
|
||||
// this.requireSuccess = true;
|
||||
// } else {
|
||||
Integer address = Optional.ofNullable(next_device.getExtraValue().get("address")).map(Object::toString).map(Integer::parseInt).orElse(0);
|
||||
this.writing(Arrays.asList(ItemProtocol.TO_TASK.getKey(),ItemProtocol.TO_TARGET.getKey()), Arrays.asList(inst.getInstruction_code(),address));
|
||||
//this.writing(Arrays.asList(ItemProtocol.TO_TARGET.getKey()), Arrays.asList(address));
|
||||
Integer address = Optional.ofNullable(next_device.getExtraValue().get("address")).map(Object::toString).map(Integer::parseInt).orElse(0);
|
||||
this.writing(Arrays.asList(ItemProtocol.TO_TASK.getKey(), ItemProtocol.TO_TARGET.getKey()), Arrays.asList(inst.getInstruction_code(), address));
|
||||
//this.writing(Arrays.asList(ItemProtocol.TO_TARGET.getKey()), Arrays.asList(address));
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,8 @@ public class GateWayService {
|
||||
return wmsToAcsService.pinkStartStop(request.handleObject());
|
||||
} else if ("toCommand".equals(request.getType())) {
|
||||
return wmsToAcsService.toCommand(request.handleObject());
|
||||
} else if ("getWeight".equals(request.getType())){
|
||||
return wmsToAcsService.getWeight(request.handleObject());
|
||||
}
|
||||
resp.put("code", "400");
|
||||
resp.put("msg", "type有误");
|
||||
|
||||
@@ -39,4 +39,12 @@ public interface WmsToAcsService {
|
||||
* @return
|
||||
*/
|
||||
JSONObject toCommand(JSONObject req);
|
||||
|
||||
/**
|
||||
* 获取重量
|
||||
*
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
JSONObject getWeight(JSONObject req);
|
||||
}
|
||||
|
||||
@@ -358,4 +358,25 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
return resp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject getWeight(JSONObject req) {
|
||||
log.info("getWeight--------------:输入参数:" + JSON.toJSONString(req));
|
||||
Assert.notNull(req);
|
||||
String device_code = req.getString("device_code");
|
||||
Device device = deviceAppService.findDeviceByCode(device_code);
|
||||
JSONObject resp = new JSONObject();
|
||||
JSONObject data = new JSONObject();
|
||||
if (device != null && device.getDeviceDriver() instanceof AppearanceInspectionScannerConveyorDeviceDriver){
|
||||
AppearanceInspectionScannerConveyorDeviceDriver appearanceInspectionScannerConveyorDeviceDriver = (AppearanceInspectionScannerConveyorDeviceDriver) device.getDeviceDriver();
|
||||
data.put("weight",appearanceInspectionScannerConveyorDeviceDriver.getWeight());
|
||||
} else {
|
||||
throw new BadRequestException("设备不存在");
|
||||
}
|
||||
resp.put("code","200");
|
||||
resp.put("msg", "获取成功");
|
||||
resp.put("data",data);
|
||||
log.info("getWeight--------------:输出参数:" + JSON.toJSONString(resp));
|
||||
return resp;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ spring:
|
||||
active: true
|
||||
username: root
|
||||
password: 123456
|
||||
url: 192.168.8.218
|
||||
url: 192.168.18.218
|
||||
clientId: hs_mqtt_prod
|
||||
cleanSession: false
|
||||
topics:
|
||||
|
||||
Reference in New Issue
Block a user