rev: 压机送料上下分配规则
This commit is contained in:
@@ -134,7 +134,7 @@ public class WmsToMesServiceImpl implements WmsToMesService {
|
|||||||
mesProductDataDto.setCHECKERIN_TIM(DateUtil.now());
|
mesProductDataDto.setCHECKERIN_TIM(DateUtil.now());
|
||||||
mesProductDataDto.setPRODATE(workorder.getProduce_date());
|
mesProductDataDto.setPRODATE(workorder.getProduce_date());
|
||||||
mesProductDataDto.setCREATE_TM(DateUtil.now());
|
mesProductDataDto.setCREATE_TM(DateUtil.now());
|
||||||
mesProductDataDto.setOP_FLAG("0");
|
mesProductDataDto.setOP_FLAG(GeneralDefinition.NO);
|
||||||
log.info("返给MES的数据:{}", mesProductDataDto);
|
log.info("返给MES的数据:{}", mesProductDataDto);
|
||||||
// 插入mes数据库
|
// 插入mes数据库
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ import org.nl.wms.ext.mes.service.dto.MesMudConsumptionDto;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author: lyd
|
* @Author: lyd
|
||||||
* @Description:
|
* @Description:
|
||||||
@@ -19,8 +21,39 @@ public class TestDemo {
|
|||||||
private MesRequestMapper mesRequestMapper;
|
private MesRequestMapper mesRequestMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
private WmsToMesService wmsToMesService;
|
private WmsToMesService wmsToMesService;
|
||||||
|
private static AtomicInteger countUp = new AtomicInteger(0); // 上层数量
|
||||||
|
private static AtomicInteger countLower = new AtomicInteger(0); // 下层数量
|
||||||
@Test
|
@Test
|
||||||
public void test01() {
|
public void test01() {
|
||||||
wmsToMesService.reportProductData("1701105828406366210");
|
for (int i = 0; i < 13; i++) {
|
||||||
|
toAdd();
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void toAdd() {
|
||||||
|
int up = countUp.get();
|
||||||
|
int lower = countLower.get();
|
||||||
|
boolean isASC = false;
|
||||||
|
if (lower == 0 || lower != 5) {
|
||||||
|
isASC = true;
|
||||||
|
}
|
||||||
|
if (isASC) {
|
||||||
|
System.out.println("下面第" + lower + "次");
|
||||||
|
} else {
|
||||||
|
System.out.println("上面第" + up + "次");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user