Browse Source

add AGV暂停恢复接口

master
张江玮 1 year ago
parent
commit
00329df59b
  1. 7
      acs/hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/rest/WmsToAcsController.java
  2. 2
      acs/hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/WmsToAcsService.java
  3. 51
      acs/hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java

7
acs/hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/rest/WmsToAcsController.java

@ -77,4 +77,11 @@ public class WmsToAcsController {
return new ResponseEntity<>(wmstoacsService.queryDevice(whereJson), HttpStatus.OK);
}
@PostMapping("/deviceOption")
@Log("查询设备状态")
@ApiOperation("查询设备状态")
public ResponseEntity<Object> deviceOption(@RequestBody String whereJson) throws Exception {
return new ResponseEntity<>(wmstoacsService.deviceOption(whereJson), HttpStatus.OK);
}
}

2
acs/hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/WmsToAcsService.java

@ -62,4 +62,6 @@ public interface WmsToAcsService {
* @return Map<String, Object>
*/
Map<String, Object> queryDevice(String jsonObject) throws Exception;
JSONObject deviceOption(String whereJson) throws Exception;
}

51
acs/hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java

@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.agv.server.MagicAgvService;
import org.nl.acs.config.AcsConfig;
import org.nl.acs.config.server.AcsConfigService;
import org.nl.acs.device.service.DeviceService;
@ -24,6 +25,7 @@ import org.nl.acs.route.service.RouteLineService;
import org.nl.acs.route.service.dto.RouteLineDto;
import org.nl.acs.task.service.TaskService;
import org.nl.acs.task.service.dto.TaskDto;
import org.nl.exception.BadRequestException;
import org.nl.exception.WDKException;
import org.nl.utils.SpringContextHolder;
import org.nl.wql.core.bean.WQLObject;
@ -45,6 +47,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
private final DeviceAppService DeviceAppService;
private final RouteLineService RouteLineService;
private final ProduceshiftorderService produceshiftorderService;
private final MagicAgvService magicAgvService;
private String log_file_type = "log_file_type";
private String log_type = "WMS下发ACS";
@ -478,4 +481,52 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
}
}
@Override
public JSONObject deviceOption(String whereJson) throws Exception {
JSONObject param = JSONObject.parseObject(whereJson);
String option = param.getString("option");
JSONObject result = new JSONObject();
if (StrUtil.isBlank(option)) {
result.put("status", HttpStatus.BAD_REQUEST.value());
result.put("message", "操作类型不能为空!");
return result;
}
String deviceCode = param.getString("device_code");
if (StrUtil.isBlank(deviceCode)) {
switch (option) {
case "1":
// 急停
magicAgvService.pause();
break;
case "2":
// 恢复
magicAgvService.resume();
break;
default:
result.put("status", HttpStatus.BAD_REQUEST.value());
result.put("message", "未知操作类型!");
return result;
}
} else {
switch (option) {
case "1":
// 急停
magicAgvService.pause(deviceCode);
break;
case "2":
// 恢复
magicAgvService.resume(deviceCode);
break;
default:
result.put("status", HttpStatus.BAD_REQUEST.value());
result.put("message", "未知操作类型!");
return result;
}
}
result.put("status", HttpStatus.OK.value());
result.put("message", "操作成功!");
return result;
}
}

Loading…
Cancel
Save