|
@ -39,6 +39,7 @@ import org.springframework.transaction.annotation.Transactional; |
|
|
import java.math.BigDecimal; |
|
|
import java.math.BigDecimal; |
|
|
import java.util.Arrays; |
|
|
import java.util.Arrays; |
|
|
import java.util.List; |
|
|
import java.util.List; |
|
|
|
|
|
import java.util.concurrent.atomic.AtomicInteger; |
|
|
import java.util.stream.Collectors; |
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
@ -51,6 +52,8 @@ import java.util.stream.Collectors; |
|
|
@TaskType("YZMLTask") |
|
|
@TaskType("YZMLTask") |
|
|
public class YZSLTask extends AbstractTask { |
|
|
public class YZSLTask extends AbstractTask { |
|
|
private static String TASK_CONFIG_CODE = "YZMLTask"; |
|
|
private static String TASK_CONFIG_CODE = "YZMLTask"; |
|
|
|
|
|
private static AtomicInteger countUp = new AtomicInteger(0); // 上层数量
|
|
|
|
|
|
private static AtomicInteger countLower = new AtomicInteger(0); // 下层数量
|
|
|
@Autowired |
|
|
@Autowired |
|
|
private ISchBasePointService pointService; |
|
|
private ISchBasePointService pointService; |
|
|
@Autowired |
|
|
@Autowired |
|
@ -96,6 +99,19 @@ public class YZSLTask extends AbstractTask { |
|
|
NoticeTypeEnum.WARN.getCode()); |
|
|
NoticeTypeEnum.WARN.getCode()); |
|
|
continue; |
|
|
continue; |
|
|
} |
|
|
} |
|
|
|
|
|
int up = countUp.get(); |
|
|
|
|
|
int lower = countLower.get(); |
|
|
|
|
|
if (lower == 0 || lower != 5) { |
|
|
|
|
|
countLower.incrementAndGet(); |
|
|
|
|
|
} else { |
|
|
|
|
|
countUp.incrementAndGet(); |
|
|
|
|
|
} |
|
|
|
|
|
if (up == 4) { |
|
|
|
|
|
countLower = new AtomicInteger(0); |
|
|
|
|
|
} |
|
|
|
|
|
if (lower == 4 && up == 4) { |
|
|
|
|
|
countUp = new AtomicInteger(0); |
|
|
|
|
|
} |
|
|
// 设置终点并修改创建成功状态
|
|
|
// 设置终点并修改创建成功状态
|
|
|
task.setPoint_code2(point.getPoint_code()); |
|
|
task.setPoint_code2(point.getPoint_code()); |
|
|
task.setTask_status(TaskStatus.CREATED.getCode()); |
|
|
task.setTask_status(TaskStatus.CREATED.getCode()); |
|
@ -147,12 +163,14 @@ public class YZSLTask extends AbstractTask { |
|
|
regionCode = nextRegionStr.get(0); |
|
|
regionCode = nextRegionStr.get(0); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
// 双层缓存货架的一上一下的区分
|
|
|
// 双层缓存货架的一上一下的区分 -> todo: 上五下五区分
|
|
|
// 计算缓存上和缓存下的空位数量决定是使用desc还是asc
|
|
|
// 计算缓存上和缓存下的空位数量决定是使用desc还是asc
|
|
|
int countUp = yzMapper.countConveyorLine(nextRegionStr.get(0), GeneralDefinition.UPPER_CONVEYOR_LINE, |
|
|
int up = countUp.get(); |
|
|
PointStatusEnum.EMPTY_POINT.getCode()); |
|
|
int lower = countLower.get(); |
|
|
int countLower = yzMapper.countConveyorLine(nextRegionStr.get(0), GeneralDefinition.LOWER_CONVEYOR_LINE, |
|
|
boolean isASC = false; |
|
|
PointStatusEnum.EMPTY_POINT.getCode()); |
|
|
if (lower == 0 || lower != 5) { |
|
|
|
|
|
isASC = true; |
|
|
|
|
|
} |
|
|
LambdaQueryWrapper<SchBasePoint> lam = new QueryWrapper<SchBasePoint>().lambda(); |
|
|
LambdaQueryWrapper<SchBasePoint> lam = new QueryWrapper<SchBasePoint>().lambda(); |
|
|
lam.eq(SchBasePoint::getRegion_code, regionCode) |
|
|
lam.eq(SchBasePoint::getRegion_code, regionCode) |
|
|
.eq(SchBasePoint::getPoint_status, PointStatusEnum.EMPTY_POINT.getCode()) |
|
|
.eq(SchBasePoint::getPoint_status, PointStatusEnum.EMPTY_POINT.getCode()) |
|
@ -161,7 +179,7 @@ public class YZSLTask extends AbstractTask { |
|
|
.or() |
|
|
.or() |
|
|
.eq(SchBasePoint::getIng_task_code, "")) |
|
|
.eq(SchBasePoint::getIng_task_code, "")) |
|
|
.eq(SchBasePoint::getIs_used, true) |
|
|
.eq(SchBasePoint::getIs_used, true) |
|
|
.orderBy(true, countUp <= countLower, SchBasePoint::getPoint_code); |
|
|
.orderBy(true, isASC, SchBasePoint::getPoint_code); |
|
|
List<SchBasePoint> schBasePoints = pointService.list(lam); |
|
|
List<SchBasePoint> schBasePoints = pointService.list(lam); |
|
|
return ObjectUtil.isNotEmpty(schBasePoints) ? schBasePoints.get(0) : null; |
|
|
return ObjectUtil.isNotEmpty(schBasePoints) ? schBasePoints.get(0) : null; |
|
|
} |
|
|
} |
|
|