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