更新叠盘
This commit is contained in:
@@ -19,7 +19,10 @@ import org.nl.acs.auto.initial.ApplicationAutoInitial;
|
||||
import org.nl.acs.device.service.DeviceService;
|
||||
import org.nl.acs.device.service.impl.DeviceServiceImpl;
|
||||
import org.nl.acs.device_driver.basedriver.cargo_lift_conveyor.CargoLiftConveyorDeviceDriver;
|
||||
import org.nl.acs.device_driver.basedriver.empty_vehicle_stacking_position.EmptyVehicleStackingPositionDeviceDriver;
|
||||
import org.nl.acs.device_driver.basedriver.hailiang_smart_plc_test.HailiangSmartplcTestDeviceDriver;
|
||||
import org.nl.acs.device_driver.basedriver.haokai_auto_conveyor.HaoKaiAutoConveyorDeviceDriver;
|
||||
import org.nl.acs.device_driver.basedriver.paint_conveyor.PaintConveyorDeviceDriver;
|
||||
import org.nl.acs.device_driver.basedriver.standard_conveyor_control_with_scanner.StandardCoveyorControlWithScannerDeviceDriver;
|
||||
import org.nl.acs.device_driver.basedriver.standard_inspect_site.StandardInspectSiteDeviceDriver;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
@@ -302,6 +305,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
||||
CargoLiftConveyorDeviceDriver cargoLiftConveyorDeviceDriver;
|
||||
HaoKaiAutoConveyorDeviceDriver haoKaiAutoConveyorDeviceDriver;
|
||||
StandardCoveyorControlWithScannerDeviceDriver standardCoveyorControlWithScannerDeviceDriver;
|
||||
EmptyVehicleStackingPositionDeviceDriver emptyVehicleStackingPositionDeviceDriver;
|
||||
//输送线相关需要给任务字段进行赋值,通过任务来判断输送线当前执行到哪一步
|
||||
if (startdevice.getDeviceDriver() instanceof CargoLiftConveyorDeviceDriver) {
|
||||
cargoLiftConveyorDeviceDriver = (CargoLiftConveyorDeviceDriver) startdevice.getDeviceDriver();
|
||||
@@ -376,6 +380,33 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
||||
if (ObjectUtil.isEmpty(route)) {
|
||||
throw new BadRequestException("未查询到相关路由!");
|
||||
}
|
||||
if (startdevice.getDeviceDriver() instanceof EmptyVehicleStackingPositionDeviceDriver) {
|
||||
emptyVehicleStackingPositionDeviceDriver = (EmptyVehicleStackingPositionDeviceDriver) startdevice.getDeviceDriver();
|
||||
//已经生成指令得取空托盘数量
|
||||
Integer emptyNum = taskService.queryStartNum(dto.getStart_device_code());
|
||||
//当前任务取得空托盘数量
|
||||
Integer now_need_emptypallet_num = Integer.parseInt(taskService.findByCode(dto.getTask_code()).getEmptypallet_num());
|
||||
//当前叠盘架有空托盘数量
|
||||
int now_number = emptyVehicleStackingPositionDeviceDriver.getNumber();
|
||||
int i = now_number - now_need_emptypallet_num - emptyNum + 1;
|
||||
dto.setStart_device_code(start_device_code + "." + i);
|
||||
dto.setStart_parent_code(start_device_code + "." + i);
|
||||
dto.setStart_point_code(start_device_code + "." + i);
|
||||
}
|
||||
if (nextdevice.getDeviceDriver() instanceof EmptyVehicleStackingPositionDeviceDriver) {
|
||||
emptyVehicleStackingPositionDeviceDriver = (EmptyVehicleStackingPositionDeviceDriver) startdevice.getDeviceDriver();
|
||||
//已经生成指令得放空托盘数量
|
||||
Integer emptyNum = taskService.queryEndNum(dto.getStart_device_code());
|
||||
//当前任务放空托盘数量
|
||||
Integer now_need_emptypallet_num = Integer.parseInt(taskService.findByCode(dto.getTask_code()).getEmptypallet_num());
|
||||
//当前叠盘架有空托盘数量
|
||||
int now_number = emptyVehicleStackingPositionDeviceDriver.getNumber();
|
||||
int i = now_number + emptyNum + 1;
|
||||
dto.setNext_device_code(next_device_code + "." + i);
|
||||
dto.setNext_parent_code(next_device_code + "." + i);
|
||||
dto.setNext_point_code(next_device_code + "." + i);
|
||||
}
|
||||
|
||||
if (StrUtil.equals(route.getType(), "1")) {
|
||||
ZheDaAgvService zheDaAgvService = SpringContextHolder.getBean(ZheDaAgvService.class);
|
||||
HttpResponse result = zheDaAgvService.sendAgvInstToAgv(dto);
|
||||
@@ -900,11 +931,28 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
||||
if (entity == null) {
|
||||
throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
}
|
||||
String start_device_code = entity.getStart_device_code();
|
||||
String next_device_code = entity.getNext_device_code();
|
||||
if (StrUtil.contains(start_device_code, ".")) {
|
||||
String[] point = start_device_code.split("\\.");
|
||||
start_device_code = point[0];
|
||||
entity.setStart_device_code(start_device_code);
|
||||
} else {
|
||||
start_device_code = start_device_code;
|
||||
}
|
||||
if (StrUtil.contains(next_device_code, ".")) {
|
||||
String[] point = next_device_code.split("\\.");
|
||||
next_device_code = point[0];
|
||||
entity.setNext_device_code(next_device_code);
|
||||
} else {
|
||||
next_device_code = next_device_code;
|
||||
}
|
||||
TaskDto task = taskService.findByCodeFromCache(entity.getTask_code());
|
||||
if (StrUtil.isEmpty(entity.getRoute_plan_code())) {
|
||||
entity.setRoute_plan_code(task.getRoute_plan_code());
|
||||
}
|
||||
|
||||
|
||||
List<RouteLineDto> shortPathsList = routeLineService.getShortPathLines(entity.getStart_device_code(), entity.getNext_device_code(), entity.getRoute_plan_code());
|
||||
if (ObjectUtils.isEmpty(shortPathsList)) {
|
||||
throw new Exception(entity.getStart_device_code() + "->" + entity.getNext_device_code() + "路由不通");
|
||||
|
||||
@@ -260,4 +260,21 @@ public interface TaskService {
|
||||
*/
|
||||
Integer querySameDestinationTask(String code);
|
||||
|
||||
/**
|
||||
* 查询叠盘位起点未执行完任务得数量叠盘数量
|
||||
*
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
Integer queryStartNum(String code);
|
||||
|
||||
/**
|
||||
* 查询叠盘位起点未执行完任务得数量叠盘数量
|
||||
*
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
Integer queryEndNum(String code);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1201,7 +1201,6 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
num++;
|
||||
}
|
||||
}
|
||||
|
||||
return num;
|
||||
}
|
||||
|
||||
@@ -1215,4 +1214,30 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer queryStartNum(String code) {
|
||||
int num = 0;
|
||||
Iterator<TaskDto> iterator = tasks.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
TaskDto task = iterator.next();
|
||||
if (task.getStart_device_code().equals(code) && task.getTask_status().equals("1")) {
|
||||
num = num + Integer.parseInt(task.getEmptypallet_num());
|
||||
}
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer queryEndNum(String code) {
|
||||
int num = 0;
|
||||
Iterator<TaskDto> iterator = tasks.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
TaskDto task = iterator.next();
|
||||
if (task.getNext_device_code().equals(code) && task.getTask_status().equals("1")) {
|
||||
num = num + Integer.parseInt(task.getEmptypallet_num());
|
||||
}
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user