|
@ -430,7 +430,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial { |
|
|
@Override |
|
|
@Override |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
public void create(TaskDto dto) throws Exception { |
|
|
public void create(TaskDto dto) throws Exception { |
|
|
dto = foramte(dto); |
|
|
// dto = foramte(dto);
|
|
|
if (!StrUtil.isEmpty(dto.getVehicle_code())) { |
|
|
if (!StrUtil.isEmpty(dto.getVehicle_code())) { |
|
|
TaskDto vehicle_dto = this.findByContainer(dto.getVehicle_code()); |
|
|
TaskDto vehicle_dto = this.findByContainer(dto.getVehicle_code()); |
|
|
if (vehicle_dto != null) { |
|
|
if (vehicle_dto != null) { |
|
@ -470,72 +470,72 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial { |
|
|
// 判断起点终点设备类型
|
|
|
// 判断起点终点设备类型
|
|
|
String startDeviceType = deviceAppService.findDeviceTypeByCode(dto.getStart_device_code()); |
|
|
String startDeviceType = deviceAppService.findDeviceTypeByCode(dto.getStart_device_code()); |
|
|
String nextDeviceType = deviceAppService.findDeviceTypeByCode(dto.getNext_device_code()); |
|
|
String nextDeviceType = deviceAppService.findDeviceTypeByCode(dto.getNext_device_code()); |
|
|
if (routelineserver |
|
|
// if (routelineserver
|
|
|
.getShortPathLines(dto.getStart_device_code(), dto.getNext_device_code(), plan_code) |
|
|
// .getShortPathLines(dto.getStart_device_code(), dto.getNext_device_code(), plan_code)
|
|
|
.size() |
|
|
// .size()
|
|
|
== 0) { |
|
|
// == 0) {
|
|
|
throw new Exception(dto.getStart_point_code() + "->" + dto.getNext_point_code() + "路由不通!"); |
|
|
// throw new Exception(dto.getStart_point_code() + "->" + dto.getNext_point_code() + "路由不通!");
|
|
|
} |
|
|
// }
|
|
|
String createTaskCheck = paramService.findByCode(AcsConfig.CREATETASKCHECK).getValue(); |
|
|
String createTaskCheck = paramService.findByCode(AcsConfig.CREATETASKCHECK).getValue(); |
|
|
DeviceService deviceService = SpringContextHolder.getBean(DeviceServiceImpl.class); |
|
|
DeviceService deviceService = SpringContextHolder.getBean(DeviceServiceImpl.class); |
|
|
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class); |
|
|
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class); |
|
|
Device nextdevice = appService.findDeviceByCode(next_device_code); |
|
|
Device nextdevice = appService.findDeviceByCode(next_device_code); |
|
|
Device startdevice = appService.findDeviceByCode(start_device_code); |
|
|
Device startdevice = appService.findDeviceByCode(start_device_code); |
|
|
dto.setMaterial(startdevice.getMaterial_type()); |
|
|
// dto.setMaterial(startdevice.getMaterial_type());
|
|
|
if (StrUtil.equals(createTaskCheck, "1")) { |
|
|
// if (StrUtil.equals(createTaskCheck, "1")) {
|
|
|
// 判断起点为输送设备
|
|
|
// // 判断起点为输送设备
|
|
|
if (StrUtil.equals(DeviceType.conveyor.toString(), startDeviceType)) { |
|
|
// if (StrUtil.equals(DeviceType.conveyor.toString(), startDeviceType)) {
|
|
|
} |
|
|
// }
|
|
|
|
|
|
//
|
|
|
if (StrUtil.equals(DeviceType.conveyor.toString(), nextDeviceType)) { |
|
|
// if (StrUtil.equals(DeviceType.conveyor.toString(), nextDeviceType)) {
|
|
|
} |
|
|
// }
|
|
|
} else { |
|
|
// } else {
|
|
|
// 判断起点为输送设备
|
|
|
// // 判断起点为输送设备
|
|
|
if (StrUtil.equals(DeviceType.conveyor.toString(), startDeviceType)) { |
|
|
// if (StrUtil.equals(DeviceType.conveyor.toString(), startDeviceType)) {
|
|
|
} |
|
|
// }
|
|
|
|
|
|
//
|
|
|
if (StrUtil.equals(DeviceType.conveyor.toString(), nextDeviceType)) { |
|
|
// if (StrUtil.equals(DeviceType.conveyor.toString(), nextDeviceType)) {
|
|
|
// if (nextdevice.getDeviceDriver() instanceof
|
|
|
// // if (nextdevice.getDeviceDriver() instanceof
|
|
|
// StandardOrdinarySiteDeviceDriver) {
|
|
|
// // StandardOrdinarySiteDeviceDriver) {
|
|
|
// standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver)
|
|
|
// // standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver)
|
|
|
// nextdevice.getDeviceDriver();
|
|
|
// // nextdevice.getDeviceDriver();
|
|
|
// if (nextdevice.getHas_goods() != 0) {
|
|
|
// // if (nextdevice.getHas_goods() != 0) {
|
|
|
// throw new Exception("任务终点需满足无货!");
|
|
|
// // throw new Exception("任务终点需满足无货!");
|
|
|
|
|
|
// // }
|
|
|
|
|
|
// // }
|
|
|
|
|
|
//
|
|
|
|
|
|
// JSONObject jo = new JSONObject();
|
|
|
|
|
|
// JSONObject jo2 = new JSONObject();
|
|
|
|
|
|
// if (!StrUtil.isEmpty(dto.getMaterial())) {
|
|
|
|
|
|
// if (!StrUtil.equals(dto.getMaterial(), "1")) {
|
|
|
|
|
|
// jo.put("hasGoodStatus", "2");
|
|
|
|
|
|
// jo.put("material_type", dto.getMaterial());
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
// jo.put("hasGoodStatus", "1");
|
|
|
|
|
|
// jo.put("material_type", "1");
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
// jo.put("hasGoodStatus", "1");
|
|
|
|
|
|
// jo.put("material_type", "1");
|
|
|
|
|
|
// }
|
|
|
|
|
|
// jo.put("device_code", dto.getStart_device_code());
|
|
|
|
|
|
// jo.put("quantity", dto.getQuantity());
|
|
|
|
|
|
// jo.put("remark", dto.getRemark());
|
|
|
|
|
|
// jo.put("batch", startdevice.getBatch());
|
|
|
|
|
|
// jo.put("islock", "true");
|
|
|
|
|
|
// deviceService.changeDeviceStatus(jo);
|
|
|
|
|
|
// Device deviceByCode = deviceAppService.findDeviceByCode(dto.getNext_device_code());
|
|
|
|
|
|
// jo2.put("device_code", dto.getNext_device_code());
|
|
|
|
|
|
// jo2.put("hasGoodStatus", deviceByCode.getHas_goods());
|
|
|
|
|
|
// jo2.put("quantity", deviceByCode.getQuantity());
|
|
|
|
|
|
// jo2.put("remark", deviceByCode.getRemark());
|
|
|
|
|
|
// jo2.put("material_type", deviceByCode.getMaterial_type());
|
|
|
|
|
|
// jo2.put("batch", deviceByCode.getBatch());
|
|
|
|
|
|
// jo2.put("islock", "true");
|
|
|
|
|
|
// deviceService.changeDeviceStatus(jo2);
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
|
|
|
|
|
|
JSONObject jo = new JSONObject(); |
|
|
|
|
|
JSONObject jo2 = new JSONObject(); |
|
|
|
|
|
if (!StrUtil.isEmpty(dto.getMaterial())) { |
|
|
|
|
|
if (!StrUtil.equals(dto.getMaterial(), "1")) { |
|
|
|
|
|
jo.put("hasGoodStatus", "2"); |
|
|
|
|
|
jo.put("material_type", dto.getMaterial()); |
|
|
|
|
|
} else { |
|
|
|
|
|
jo.put("hasGoodStatus", "1"); |
|
|
|
|
|
jo.put("material_type", "1"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
jo.put("hasGoodStatus", "1"); |
|
|
|
|
|
jo.put("material_type", "1"); |
|
|
|
|
|
} |
|
|
|
|
|
jo.put("device_code", dto.getStart_device_code()); |
|
|
|
|
|
jo.put("quantity", dto.getQuantity()); |
|
|
|
|
|
jo.put("remark", dto.getRemark()); |
|
|
|
|
|
jo.put("batch", startdevice.getBatch()); |
|
|
|
|
|
jo.put("islock", "true"); |
|
|
|
|
|
deviceService.changeDeviceStatus(jo); |
|
|
|
|
|
Device deviceByCode = deviceAppService.findDeviceByCode(dto.getNext_device_code()); |
|
|
|
|
|
jo2.put("device_code", dto.getNext_device_code()); |
|
|
|
|
|
jo2.put("hasGoodStatus", deviceByCode.getHas_goods()); |
|
|
|
|
|
jo2.put("quantity", deviceByCode.getQuantity()); |
|
|
|
|
|
jo2.put("remark", deviceByCode.getRemark()); |
|
|
|
|
|
jo2.put("material_type", deviceByCode.getMaterial_type()); |
|
|
|
|
|
jo2.put("batch", deviceByCode.getBatch()); |
|
|
|
|
|
jo2.put("islock", "true"); |
|
|
|
|
|
deviceService.changeDeviceStatus(jo2); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
WQLObject wo = WQLObject.getWQLObject("acs_task"); |
|
|
WQLObject wo = WQLObject.getWQLObject("acs_task"); |
|
|
JSONObject json = (JSONObject) JSONObject.toJSON(dto); |
|
|
JSONObject json = (JSONObject) JSONObject.toJSON(dto); |
|
|
|
|
|
|
|
|