更新接口

This commit is contained in:
USER-20220102CG\noblelift
2022-08-26 14:41:15 +08:00
parent a538efbef1
commit a1dc5cef0b
5 changed files with 49 additions and 39 deletions

View File

@@ -482,10 +482,10 @@ public class LnshPalletizingManipulatorSiteDeviceDriver extends AbstractOpcDevic
json.put("device_code",this.device_code);
json.put("material_code",material);
json.put("qty",encoder_qty);
json.put("unqualified_qty",unqualified_qty);
json.put("batch",batch);
json.put("producetask_code",order_No);
json.put("is_full","1");
HttpResponse result = acsToWmsService.applyTaskManipulatorToWms(json);
if (ObjectUtil.isNotEmpty(result)) {
JSONObject jsonObject = JSONObject.parseObject(result.body());
@@ -516,6 +516,7 @@ public class LnshPalletizingManipulatorSiteDeviceDriver extends AbstractOpcDevic
json.put("material_code",material);
json.put("vehicle_code",barcode);
json.put("qty",encoder_qty);
json.put("unqualified_qty",unqualified_qty);
json.put("is_full","1");
HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json);
if (ObjectUtil.isNotEmpty(result)) {

View File

@@ -919,18 +919,14 @@ public class LnshSplitManipulatorDeviceDriver extends AbstractOpcDeviceDriver im
String demoArray[] = demosub.split(",");
List<String> demoList = Arrays.asList(demoArray);
json.put("device_code",demoList.get(getStation-1).replace("\"",""));
json.put("vehicle_code",barcode);
JSONObject jo = acsToWmsService.getVehicle(json);
HttpResponse result = acsToWmsService.queryCribbingInfo(json);
if (jo.getInteger("status") == 200) {
JSONObject content = jo.getJSONObject("content");
String qty = content.getString("qty");
String material_code = content.getString("material_code");
String material_name = content.getString("material_name");
this.writing(this.mode);
this.writing("to_material",material_code);
this.setRequireSucess(true);
if (ObjectUtil.isNotEmpty(result)) {
JSONObject jsonObject = JSONObject.parseObject(result.body());
if (result.getStatus() == 200 && StrUtil.equals(jsonObject.getString("status"),"200")) {
this.writing(this.mode);
this.setRequireSucess(true);
}
}
return true;
}

View File

@@ -35,6 +35,13 @@ public interface AcsToWmsService {
*/
JSONObject getVehicle(JSONObject json);
/**
* 机械手获取托盘信息
* @param json
* @return
*/
HttpResponse queryCribbingInfo(JSONObject json);
/**
* 获取入窑托盘信息
*/

View File

@@ -226,6 +226,35 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
}
@Override
public HttpResponse queryCribbingInfo(JSONObject json) {
try {
MDC.put(log_file_type, log_type);
String wmsurl = acsConfigService.findConfigFromCache().get(AcsConfig.WMSURL);
AddressDto addressDto = addressService.findByCode("queryCribbingInfo");
String methods_url = addressDto.getMethods_url();
String url = wmsurl + methods_url;
log.info("queryCribbingInfo----请求参数{}", json.toString());
HttpResponse result = null;
try {
result = HttpRequest.post(url)
.header("Authorization", token)
.body(String.valueOf(json))
.execute();
System.out.println(result);
} catch (Exception e) {
System.out.println(e.getMessage());
}
log.info("queryCribbingInfo----返回参数{}", result.body());
return result;
} finally {
MDC.remove(log_file_type);
}
}
@Override
public JSONObject getVehicle(JSONObject json) {
try {

View File

@@ -36,39 +36,16 @@ public class ToAgvDevice {
for (AgvDto agvDto : agv_map.values()) {
row.put("device_code", agvDto.getName());
row.put("energyLevel", agvDto.getEnergyLevel());
if (agvDto.getState().equals("UNKNOWN")) {
row.put("status_name", "有任务");
row.put("flag", "1");
}
if (agvDto.getState().equals("UNAVAILABLE")) {
row.put("status_name", "网络异常");
row.put("flag", "1");
}
if (agvDto.getState().equals("ERROR")) {
row.put("status_name", "机器错误");
row.put("flag", "1");
}
if (agvDto.getState().equals("IDLE")) {
row.put("status_name", "空闲");
row.put("flag", "0");
}
if (agvDto.getState().equals("EXECUTING")) {
row.put("status_name", "运行中");
row.put("flag", "0");
}
if (agvDto.getState().equals("CHARGING")) {
row.put("status_name", "充电中");
row.put("flag", "0");
}
row.put("status", agvDto.getState());
row.put("transportOrder", agvDto.getTransportOrder());
row.put("positionX", agvDto.getPositionX());
row.put("positionY", agvDto.getPositionY());
row.put("positionAngle", agvDto.getPositionAngle());
agv_rows.add(row);
}
json.put("agv_rows", agv_rows);
SocketMsg deviceInfo = new SocketMsg(json, MsgType.INFO);
WebSocketServer.sendInfo(deviceInfo, "toAgvDevice_data");
// json.put("agv_rows", agv_rows);
// SocketMsg deviceInfo = new SocketMsg(json, MsgType.INFO);
// WebSocketServer.sendInfo(deviceInfo, "toAgvDevice_data");
acsToWmsService.feedbackAgv(agv_rows);
}