add:新增更新任务点位状态接口
This commit is contained in:
@@ -54,6 +54,13 @@ public class WmsToAcsController {
|
|||||||
return new ResponseEntity<>(wmstoacsService.updateDeviceGoodsFromWms(whereJson), HttpStatus.OK);
|
return new ResponseEntity<>(wmstoacsService.updateDeviceGoodsFromWms(whereJson), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/updateTask")
|
||||||
|
@Log(value = "WMS更新任务点位状态")
|
||||||
|
@SaIgnore
|
||||||
|
public ResponseEntity<Object> updateTask(@RequestBody String whereJson){
|
||||||
|
return new ResponseEntity<>(wmstoacsService.updateTask(whereJson), HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
@PostMapping("/areaControl")
|
@PostMapping("/areaControl")
|
||||||
@Log(value = "区域控制")
|
@Log(value = "区域控制")
|
||||||
public ResponseEntity<Object> areaControl(@RequestBody JSONObject whereJson) {
|
public ResponseEntity<Object> areaControl(@RequestBody JSONObject whereJson) {
|
||||||
|
|||||||
@@ -25,6 +25,14 @@ public interface WmsToAcsService {
|
|||||||
*/
|
*/
|
||||||
CreateTaskResponse crateTask(List<CreateTaskRequest> reqs);
|
CreateTaskResponse crateTask(List<CreateTaskRequest> reqs);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新任务点位状态
|
||||||
|
*
|
||||||
|
* @param whereJson 条件
|
||||||
|
* @return Map<String, Object>
|
||||||
|
*/
|
||||||
|
Map<String, Object> updateTask(String whereJson);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 取消任务
|
* 取消任务
|
||||||
|
|||||||
@@ -15,7 +15,9 @@ import lombok.RequiredArgsConstructor;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.nl.acs.AcsConfig;
|
import org.nl.acs.AcsConfig;
|
||||||
import org.nl.acs.device.domain.Device;
|
import org.nl.acs.device.domain.Device;
|
||||||
|
import org.nl.acs.device_driver.agv.ndctwo.AgvNdcTwoDeviceDriver;
|
||||||
import org.nl.acs.device_driver.conveyor.siemens_conveyor.SiemensConveyorDeviceDriver;
|
import org.nl.acs.device_driver.conveyor.siemens_conveyor.SiemensConveyorDeviceDriver;
|
||||||
|
import org.nl.acs.device_driver.conveyor.standard_ordinary_site.StandardOrdinarySiteDeviceDriver;
|
||||||
import org.nl.acs.device_driver.one_manipulator.box_package_manipulator.BoxPackageManipulatorDeviceDriver;
|
import org.nl.acs.device_driver.one_manipulator.box_package_manipulator.BoxPackageManipulatorDeviceDriver;
|
||||||
import org.nl.acs.device_driver.conveyor.box_palletizing_manipulator.BoxPalletizingManipulatorDeviceDriver;
|
import org.nl.acs.device_driver.conveyor.box_palletizing_manipulator.BoxPalletizingManipulatorDeviceDriver;
|
||||||
import org.nl.acs.device_driver.paper_tube_device2.PaperTubeConveyor2DeviceDriver;
|
import org.nl.acs.device_driver.paper_tube_device2.PaperTubeConveyor2DeviceDriver;
|
||||||
@@ -34,6 +36,7 @@ import org.nl.acs.ext.wms.service.AcsToLiKuService;
|
|||||||
import org.nl.acs.ext.wms.service.WmsToAcsService;
|
import org.nl.acs.ext.wms.service.WmsToAcsService;
|
||||||
|
|
||||||
import org.nl.acs.instruction.domain.Instruction;
|
import org.nl.acs.instruction.domain.Instruction;
|
||||||
|
import org.nl.acs.instruction.service.InstructionService;
|
||||||
import org.nl.acs.opc.DeviceAppService;
|
import org.nl.acs.opc.DeviceAppService;
|
||||||
import org.nl.acs.storage_cell.domain.StorageCell;
|
import org.nl.acs.storage_cell.domain.StorageCell;
|
||||||
import org.nl.acs.storage_cell.service.mapper.StorageCellMapper;
|
import org.nl.acs.storage_cell.service.mapper.StorageCellMapper;
|
||||||
@@ -68,6 +71,9 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private LuceneExecuteLogService luceneExecuteLogService;
|
private LuceneExecuteLogService luceneExecuteLogService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private InstructionService instructionService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private AcsToLiKuService acsToLiKuService;
|
private AcsToLiKuService acsToLiKuService;
|
||||||
|
|
||||||
@@ -387,6 +393,80 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> updateTask(String whereJson) {
|
||||||
|
JSONArray datas = JSONArray.parseArray(whereJson);
|
||||||
|
log.info("updateTask--------------:输入参数" + datas.toString());
|
||||||
|
JSONArray errArr = new JSONArray();
|
||||||
|
if (datas.size() > 0) {
|
||||||
|
for (int i = 0; i < datas.size(); i++) {
|
||||||
|
JSONObject jsonObject = datas.getJSONObject(i);
|
||||||
|
String device_code = jsonObject.getString("device_code");
|
||||||
|
String task_code = jsonObject.getString("task_code");
|
||||||
|
//1-允许取放; 2-允许离开
|
||||||
|
String option = jsonObject.getString("option");
|
||||||
|
Instruction inst = instructionService.findByTaskcode(task_code);
|
||||||
|
if (ObjectUtil.isEmpty(inst)) {
|
||||||
|
JSONObject jo = new JSONObject();
|
||||||
|
jo.put("task_code", task_code);
|
||||||
|
jo.put("message", "未找到对应任务");
|
||||||
|
errArr.add(jo);
|
||||||
|
continue;
|
||||||
|
} else {
|
||||||
|
String carNo = inst.getCarno();
|
||||||
|
if (ObjectUtil.isEmpty(carNo)) {
|
||||||
|
JSONObject jo = new JSONObject();
|
||||||
|
jo.put("task_code", task_code);
|
||||||
|
jo.put("message", "未找到任务对应车号");
|
||||||
|
errArr.add(jo);
|
||||||
|
continue;
|
||||||
|
} else {
|
||||||
|
Device device = deviceAppService.findDeviceByCode(carNo);
|
||||||
|
AgvNdcTwoDeviceDriver agvNdcTwoDeviceDriver;
|
||||||
|
if (device.getDeviceDriver() instanceof AgvNdcTwoDeviceDriver) {
|
||||||
|
agvNdcTwoDeviceDriver = (AgvNdcTwoDeviceDriver) device.getDeviceDriver();
|
||||||
|
int phase = agvNdcTwoDeviceDriver.getPhase();
|
||||||
|
if (phase == 0x03 || phase == 0x05 || phase == 0x08) {
|
||||||
|
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
|
||||||
|
Device device_k = deviceAppService.findDeviceByCode(device_code + "_K");
|
||||||
|
Device device_m = deviceAppService.findDeviceByCode(device_code + "_M");
|
||||||
|
if (device_k.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
|
||||||
|
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device_k.getDeviceDriver();
|
||||||
|
standardOrdinarySiteDeviceDriver.setOption(Integer.parseInt(option));
|
||||||
|
standardOrdinarySiteDeviceDriver.setTask_code(task_code);
|
||||||
|
}
|
||||||
|
if (device_m.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
|
||||||
|
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device_m.getDeviceDriver();
|
||||||
|
standardOrdinarySiteDeviceDriver.setOption(Integer.parseInt(option));
|
||||||
|
standardOrdinarySiteDeviceDriver.setTask_code(task_code);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
JSONObject jo = new JSONObject();
|
||||||
|
jo.put("task_code", task_code);
|
||||||
|
jo.put("message", "AGV未就绪无法设置");
|
||||||
|
errArr.add(jo);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
JSONObject resultJson = new JSONObject();
|
||||||
|
if (ObjectUtil.isEmpty(errArr)) {
|
||||||
|
resultJson.put("status", HttpStatus.OK.value());
|
||||||
|
resultJson.put("message", "操作成功");
|
||||||
|
} else {
|
||||||
|
resultJson.put("status", HttpStatus.BAD_REQUEST.value());
|
||||||
|
resultJson.put("message", "操作失败");
|
||||||
|
if (ObjectUtil.isNotEmpty(errArr)) {
|
||||||
|
resultJson.put("errArr", errArr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return resultJson;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public org.nl.acs.ext.wms.data.one.CancelTaskResponse cancelFromWms(List<org.nl.acs.ext.wms.data.one.CancelTaskRequest> reqs) throws Exception {
|
public org.nl.acs.ext.wms.data.one.CancelTaskResponse cancelFromWms(List<org.nl.acs.ext.wms.data.one.CancelTaskRequest> reqs) throws Exception {
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
Reference in New Issue
Block a user