diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java b/acs/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java index c66b73b..412b703 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java @@ -21,6 +21,8 @@ import org.nl.acs.device.service.DeviceService; import org.nl.acs.device.service.StorageCellService; import org.nl.acs.device.service.dto.DeviceAssignedDto; import org.nl.acs.device.service.impl.DeviceServiceImpl; +import org.nl.acs.device_driver.basedriver.standard_inspect_site.StandardInspectSiteDeviceDriver; +import org.nl.acs.device_driver.basedriver.standard_ordinary_site.StandardOrdinarySiteDeviceDriver; import org.nl.acs.ext.wms.service.AcsToWmsService; import org.nl.acs.instruction.service.InstructionService; import org.nl.acs.instruction.service.dto.Instruction; @@ -381,6 +383,17 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial { throw new WDKException("已存在该载具号的任务!"); } } + WQLObject wo_runPoint = WQLObject.getWQLObject("acs_device_runpoint"); + JSONObject jsonObject = wo_runPoint.query("device_code = '" + dto.getStart_device_code() + "'").uniqueResult(0); + if (ObjectUtil.isNotEmpty(jsonObject)){ + Device device = deviceAppService.findDeviceByCode(dto.getStart_device_code()); + if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver){ + String hasgoods = jsonObject.getString("hasgoods"); + if (StrUtil.equals(hasgoods,"0")){ + throw new BadRequestException("设备:" + dto.getStart_device_code() + "库存为无货状态,请手动绑定货物!"); + } + } + } String currentUsername = SecurityUtils.getCurrentUsername(); String now = DateUtil.now(); String task_uuid = dto.getTask_id(); @@ -417,6 +430,14 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial { if (routelineserver.getShortPathLines(dto.getStart_device_code(), dto.getNext_device_code(), plan_code).size() == 0) { throw new Exception(dto.getStart_point_code() + "->" + dto.getNext_point_code() + "路由不通!"); } + Device nextDevice = deviceAppService.findDeviceByCode(next_device_code); + if (nextDevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver){ + StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) nextDevice.getDeviceDriver(); + if (standardInspectSiteDeviceDriver.getMode() != 2){ + throw new BadRequestException(next_device_code + "未联机,工作模式不为2,任务生成失败!"); + } + } + String createTaskCheck = paramService.findByCode(AcsConfig.CREATETASKCHECK).getValue(); DeviceService deviceService = SpringContextHolder.getBean(DeviceServiceImpl.class); DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);