add:代码优化
This commit is contained in:
@@ -649,13 +649,24 @@ public class PdaTaskServiceImpl implements PdaTaskService {
|
||||
arr.add(dataItem);
|
||||
});
|
||||
} else {
|
||||
List<String> list = Arrays.asList("R6", "R7");
|
||||
List<String> list = Arrays.asList("R6-1","R6-2","R6-3","R6-4","R6-5","R6-6","R7");
|
||||
list.forEach(region_code -> {
|
||||
ResponseVo.DataItem dataItem = new ResponseVo.DataItem();
|
||||
dataItem.setValue(region_code);
|
||||
if (region_code.equals("R6")) {
|
||||
dataItem.setText("区域6");
|
||||
} else {
|
||||
if (region_code.equals("R6-1")) {
|
||||
dataItem.setText("区域6第一排");
|
||||
} else if (region_code.equals("R6-2")){
|
||||
dataItem.setText("区域6第二排");
|
||||
}else if (region_code.equals("R6-3")){
|
||||
dataItem.setText("区域6第三排");
|
||||
}else if (region_code.equals("R6-4")){
|
||||
dataItem.setText("区域6第四排");
|
||||
}else if (region_code.equals("R6-5")){
|
||||
dataItem.setText("区域6第五排");
|
||||
}else if (region_code.equals("R6-6")){
|
||||
dataItem.setText("区域6第六排");
|
||||
}
|
||||
else {
|
||||
dataItem.setText("区域7");
|
||||
}
|
||||
arr.add(dataItem);
|
||||
@@ -708,6 +719,9 @@ public class PdaTaskServiceImpl implements PdaTaskService {
|
||||
if (!point.getRegion_code().equals(RegionTypeEnum.REGION_TYPE.code("区域1")) && !point.getRegion_code().equals(RegionTypeEnum.REGION_TYPE.code("区域2"))) {
|
||||
throw new BadRequestException("该点位【" + point.getPoint_code() + "】不是区域1或者区域2的下料位,请检查输入点位是否有误!");
|
||||
}
|
||||
if (!point.getPoint_type().equals("2")){
|
||||
throw new BadRequestException("该点位【" + point.getPoint_code() + "】不是下料位,请检查输入点位是否有误!");
|
||||
}
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("point3", point.getPoint_code());
|
||||
param.put("device_code", pointMapper.selectOne(new LambdaQueryWrapper<SchBasePoint>().eq(SchBasePoint::getPoint_code, point.getParent_point_code())).getPoint_code());//等待点
|
||||
@@ -721,6 +735,9 @@ public class PdaTaskServiceImpl implements PdaTaskService {
|
||||
if (!point.getRegion_code().equals(RegionTypeEnum.REGION_TYPE.code("区域3"))) {
|
||||
throw new BadRequestException("该点位【" + point.getPoint_code() + "】不是区域3的下料位,请检查输入点位是否有误!");
|
||||
}
|
||||
if (!point.getPoint_type().equals("2")){
|
||||
throw new BadRequestException("该点位【" + point.getPoint_code() + "】不是下料位,请检查输入点位是否有误!");
|
||||
}
|
||||
String region_code = whereJson.getRegion_code();
|
||||
if (ObjectUtil.isEmpty(region_code)) {
|
||||
throw new BadRequestException("区域不能为空!");
|
||||
@@ -739,6 +756,9 @@ public class PdaTaskServiceImpl implements PdaTaskService {
|
||||
if (!point.getRegion_code().equals(RegionTypeEnum.REGION_TYPE.code("区域4")) && !point.getRegion_code().equals(RegionTypeEnum.REGION_TYPE.code("区域5"))) {
|
||||
throw new BadRequestException("该点位【" + point.getPoint_code() + "】不是区域4或区域5的下料位,请检查输入点位是否有误!");
|
||||
}
|
||||
if (!point.getPoint_type().equals("2")){
|
||||
throw new BadRequestException("该点位【" + point.getPoint_code() + "】不是下料位,请检查输入点位是否有误!");
|
||||
}
|
||||
String region_code = whereJson.getRegion_code();
|
||||
if (ObjectUtil.isEmpty(region_code)) {
|
||||
throw new BadRequestException("区域不能为空!");
|
||||
@@ -785,7 +805,7 @@ public class PdaTaskServiceImpl implements PdaTaskService {
|
||||
|
||||
@Override
|
||||
public JSONObject selectRegions() {
|
||||
List<String> regions = Arrays.asList("R6", "R7");
|
||||
List<String> regions = Arrays.asList("R3","R6", "R7");
|
||||
List<SchBaseRegion> list = regionMapper.selectList(new LambdaQueryWrapper<SchBaseRegion>().in(SchBaseRegion::getRegion_code, regions));
|
||||
List<JSONObject> ja = new ArrayList<>();
|
||||
list.forEach(region -> {
|
||||
@@ -836,6 +856,10 @@ public class PdaTaskServiceImpl implements PdaTaskService {
|
||||
if (ObjectUtil.isEmpty(point)) {
|
||||
throw new BadRequestException("点位不存在!");
|
||||
}
|
||||
boolean flag = isSingleTask(point.getPoint_code());
|
||||
if (flag) {
|
||||
throw new BadRequestException("该点位【" + point.getPoint_code() + "】有未完成的任务!");
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(point.getStoragevehicle_code())) {
|
||||
GroupPlate groupPlate = groupplateMapper.selectOne(new LambdaQueryWrapper<GroupPlate>().eq(GroupPlate::getStoragevehicle_code, point.getStoragevehicle_code()));
|
||||
if (ObjectUtil.isNotEmpty(groupPlate)) {
|
||||
@@ -879,10 +903,21 @@ public class PdaTaskServiceImpl implements PdaTaskService {
|
||||
if (ObjectUtil.isEmpty(schBasePoint)) {
|
||||
throw new BadRequestException("点位【" + schBasePoint.getPoint_code() + "】不存在!");
|
||||
}
|
||||
if (!"1".equals(schBasePoint.getPoint_type())) {
|
||||
throw new BadRequestException("点位【" + schBasePoint.getPoint_code() + "】不能使用清空排的功能!");
|
||||
}
|
||||
List<String> regionList = Arrays.asList("R6", "R7","R4","R5");
|
||||
if (!regionList.contains(schBasePoint.getRegion_code())){
|
||||
throw new BadRequestException("点位【" + schBasePoint.getPoint_code() + "】不能使用清空排的功能!");
|
||||
}
|
||||
Integer col = whereJson.getInteger("col");
|
||||
if (ObjectUtil.isEmpty(col)) {
|
||||
throw new BadRequestException("排不能为空!");
|
||||
}
|
||||
boolean flag = isSingleTask(schBasePoint.getPoint_code());
|
||||
if (flag) {
|
||||
throw new BadRequestException("该点位【" + schBasePoint.getPoint_code() + "】有未完成的任务!");
|
||||
}
|
||||
List<SchBasePoint> pointListlist = pointMapper.selectList(new LambdaQueryWrapper<SchBasePoint>().eq(SchBasePoint::getRegion_code, schBasePoint.getRegion_code())
|
||||
.eq(SchBasePoint::getPoint_type, "1")
|
||||
.eq(SchBasePoint::getRow_num, col));
|
||||
|
||||
@@ -60,6 +60,20 @@ public interface ISchBasePointService extends IService<SchBasePoint> {
|
||||
*/
|
||||
List<SchBasePoint> getPointList(SchBasePoint region);
|
||||
|
||||
/**
|
||||
* 获取点位
|
||||
* @param waitPoint
|
||||
* @return
|
||||
*/
|
||||
List<SchBasePoint> getPointList(String waitPoint);
|
||||
|
||||
/**
|
||||
* 获取点位
|
||||
* @param waitPoint
|
||||
* @return
|
||||
*/
|
||||
List<SchBasePoint> getPoints(String waitPoint, String point);
|
||||
|
||||
/**
|
||||
* 解锁/上锁
|
||||
* @param points
|
||||
|
||||
@@ -249,6 +249,7 @@
|
||||
WHERE
|
||||
p2.point_status = '2'
|
||||
AND p2.point_location = p.point_location
|
||||
AND p2.row_num = p.row_num
|
||||
AND p2.in_order_seq > p.in_order_seq
|
||||
AND p2.point_type = '1'
|
||||
AND p2.region_code = 'R3'
|
||||
|
||||
@@ -86,7 +86,7 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
|
||||
String point_code = entity.getPoint_code();
|
||||
SchBasePoint pointObj = pointMapper.selectById(point_code);
|
||||
if (ObjectUtil.isNotEmpty(pointObj) && !pointObj.getPoint_code().equals(entity.getPoint_code())) {
|
||||
throw new BadRequestException(LangProcess.msg("error_ParamExist",entity.getPoint_code()));
|
||||
throw new BadRequestException(LangProcess.msg("error_ParamExist", entity.getPoint_code()));
|
||||
}
|
||||
|
||||
// 默认父类点位为自身
|
||||
@@ -170,6 +170,22 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
|
||||
.eq(SchBasePoint::getIs_has_workder, true));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SchBasePoint> getPointList(String point) {
|
||||
if (ObjectUtil.isEmpty(point)) return this.list();
|
||||
return pointMapper.selectList(new LambdaQueryWrapper<SchBasePoint>()
|
||||
.eq(SchBasePoint::getExt_point_code, point)
|
||||
.eq(SchBasePoint::getPoint_status, PointStatusEnum.EMPTY_VEHICLE.getCode()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SchBasePoint> getPoints(String point, String point1) {
|
||||
if (ObjectUtil.isEmpty(point)) return this.list();
|
||||
return pointMapper.selectList(new LambdaQueryWrapper<SchBasePoint>()
|
||||
.eq(SchBasePoint::getExt_point_code, point)
|
||||
.ne(SchBasePoint::getPoint_code, point1));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeLock(JSONObject points) {
|
||||
JSONArray data = points.getJSONArray("data");
|
||||
@@ -214,8 +230,8 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
|
||||
// .eq(SchBasePoint::getMaterial_code, material_code)
|
||||
// .orderByAsc(SchBasePoint::getIn_order_seq);
|
||||
// List<SchBasePoint> list = pointMapper.selectList(queryWrapper);
|
||||
List<SchBasePoint> list = pointMapper.getSamePoints(regionCode,material_code);
|
||||
if (CollUtil.isNotEmpty(list)){
|
||||
List<SchBasePoint> list = pointMapper.getSamePoints(regionCode, material_code);
|
||||
if (CollUtil.isNotEmpty(list)) {
|
||||
return list;
|
||||
}
|
||||
return null;
|
||||
@@ -224,7 +240,7 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
|
||||
@Override
|
||||
public List<SchBasePoint> getPointByMaxCol(String regionCode, int col) {
|
||||
List<SchBasePoint> list = pointMapper.getPointByMaxCol(regionCode, col);
|
||||
if (CollUtil.isNotEmpty(list)){
|
||||
if (CollUtil.isNotEmpty(list)) {
|
||||
return list;
|
||||
}
|
||||
return null;
|
||||
@@ -232,8 +248,8 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
|
||||
|
||||
@Override
|
||||
public List<SchBasePoint> getEmptyPoints(String regionCode) {
|
||||
List<SchBasePoint> list = pointMapper.getEmptyPoints(regionCode,null);
|
||||
if (CollUtil.isNotEmpty(list)){
|
||||
List<SchBasePoint> list = pointMapper.getEmptyPoints(regionCode, null);
|
||||
if (CollUtil.isNotEmpty(list)) {
|
||||
return list;
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -104,6 +104,14 @@ AbstractTask {
|
||||
taskDto.setStart_device_code2(task.getPoint_code3());
|
||||
taskDto.setNext_device_code2(task.getPoint_code4());
|
||||
taskDto.setVehicle_code(task.getVehicle_code());
|
||||
// 从配置表获取优先级并设置
|
||||
SchBaseTaskconfig taskConfig = taskConfigService.getOne(new LambdaQueryWrapper<SchBaseTaskconfig>()
|
||||
.eq(SchBaseTaskconfig::getConfig_code, task.getConfig_code()));
|
||||
if (ObjectUtil.isNotEmpty(taskConfig)) {
|
||||
if (ObjectUtil.isEmpty(taskDto.getPriority())) {
|
||||
taskDto.setPriority(taskConfig.getPriority());
|
||||
}
|
||||
}
|
||||
taskDto.setAgv_action_type(task.getVehicle_code2());
|
||||
this.setTask(task.getConfig_code(), taskDto);
|
||||
// 如果各类方法对返回参数有不同,可以通过调用子类实现的deliveryBeforeProcessing方法来完成赋值,也可以是统一封装到参数值中。
|
||||
|
||||
@@ -13,7 +13,7 @@ import java.util.Map;
|
||||
public enum PointTypeEnum {
|
||||
|
||||
//点位类型
|
||||
POINT_STATUS(MapOf.of("普通点位/上料点", "1", "下料点/等待点", "2"));
|
||||
POINT_STATUS(MapOf.of("上料点", "1", "下料点", "2", "等待点", "3"));
|
||||
|
||||
private Map<String, String> code;
|
||||
|
||||
|
||||
@@ -108,15 +108,14 @@ public class SCXLTask extends AbstractTask {
|
||||
SchBasePoint schBasePoint = null;
|
||||
for (int i = 0; i < points.size(); i++) {
|
||||
SchBasePoint point = points.get(i);
|
||||
|
||||
//判断该点位的所在的排是否达到任务最大数
|
||||
if (!checkMaxTaskNum(point)) {
|
||||
if (!this.checkMaxTaskNum(point)) {
|
||||
continue;
|
||||
}
|
||||
schBasePoint = point;
|
||||
break;
|
||||
}
|
||||
if (schBasePoint == null){
|
||||
if (schBasePoint == null) {
|
||||
throw new BadRequestException("区域3接收区域没有空闲的点位!");
|
||||
}
|
||||
// 设置终点并修改创建成功状态
|
||||
@@ -125,7 +124,7 @@ public class SCXLTask extends AbstractTask {
|
||||
String requestParam = task.getRequest_param();
|
||||
JSONObject jsonObject = JSONObject.parseObject(requestParam);
|
||||
String point3 = jsonObject.getString("point3");
|
||||
if (StrUtil.isNotEmpty(point3)){
|
||||
if (StrUtil.isNotEmpty(point3)) {
|
||||
task.setPoint_code3(point3);
|
||||
}
|
||||
task.setVehicle_code2(PackageInfoIvtEnum.AGV_ACTION_TYPE.code("取放货二次分配"));
|
||||
@@ -154,24 +153,33 @@ public class SCXLTask extends AbstractTask {
|
||||
|
||||
public boolean checkMaxTaskNum(SchBasePoint point) {
|
||||
String ext_point_code = point.getExt_point_code();
|
||||
if (StrUtil.isEmpty(ext_point_code)){
|
||||
throw new BadRequestException("该点位【"+point.getPoint_code()+"】没有设置等待点位!");
|
||||
}
|
||||
List<SchBaseTask> zjpsTask = taskService.findUnFinishTasksByTaskConfigAndPointCode("ZJPSTask", ext_point_code);
|
||||
String point_location = point.getPoint_location();
|
||||
if (StrUtil.isEmpty(point_location)){
|
||||
throw new BadRequestException("该点位【"+point.getPoint_code()+"】没有设置点位位置!");
|
||||
if (StrUtil.isEmpty(ext_point_code)) {
|
||||
throw new BadRequestException("该点位【" + point.getPoint_code() + "】没有设置等待点位!");
|
||||
}
|
||||
List<SchBasePoint> points = pointService.getPoints(ext_point_code, point.getPoint_code());
|
||||
List<SchBasePoint> collect = points.stream().filter(point1 -> point1.getCol_num() > point.getCol_num() && PointStatusEnum.EMPTY_POINT.getCode().equals(point1.getPoint_status())&& StrUtil.isEmpty(point1.getIng_task_code())).collect(Collectors.toList());
|
||||
List<SchBasePoint> pointList = pointService.getPointList(ext_point_code);
|
||||
List<SchBaseTask> zjpsTask = taskService.findUnFinishTasksByTaskConfigAndPointCode("SCXLTask", ext_point_code);
|
||||
int rowNum = point.getRow_num();
|
||||
Param zjpsTaskNum = null;
|
||||
if (point_location.equals("1")) {
|
||||
if (rowNum == 1) {
|
||||
zjpsTaskNum = paramService.findByCode("SCXLTask_num1");
|
||||
} else if (point_location.equals("2")) {
|
||||
} else if (rowNum == 2) {
|
||||
zjpsTaskNum = paramService.findByCode("SCXLTask_num2");
|
||||
} else if (rowNum == 3) {
|
||||
zjpsTaskNum = paramService.findByCode("SCXLTask_num3");
|
||||
}
|
||||
if (zjpsTaskNum == null) {
|
||||
throw new BadRequestException("请先设置参数【SCXLTask_num】!");
|
||||
if (rowNum == 1) {
|
||||
throw new BadRequestException("请先设置参数【SCXLTask_num1】!");
|
||||
} else if (rowNum == 2) {
|
||||
throw new BadRequestException("请先设置参数【SCXLTask_num2】!");
|
||||
} else if (rowNum == 3) {
|
||||
throw new BadRequestException("请先设置参数【SCXLTask_num3】!");
|
||||
}
|
||||
}
|
||||
if (zjpsTask.size() >= Integer.parseInt(zjpsTaskNum.getValue())) {
|
||||
int count = zjpsTask.size() + pointList.size() + collect.size();
|
||||
if (count >= Integer.parseInt(zjpsTaskNum.getValue())) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -23,8 +23,8 @@
|
||||
SELECT COUNT(1) FROM sch_base_point p2
|
||||
WHERE
|
||||
p2.point_status = '2'
|
||||
AND p2.point_location = p1.point_location
|
||||
AND p2.in_order_seq > p1.in_order_seq
|
||||
AND p2.row_num = p1.row_num
|
||||
AND p2.col_num <![CDATA[<]]> p1.col_num
|
||||
AND p2.point_type = '1'
|
||||
AND p2.region_code = 'R3'
|
||||
)
|
||||
|
||||
@@ -85,7 +85,7 @@ public class ZJPSTask extends AbstractTask {
|
||||
String requestParam = task.getRequest_param();
|
||||
JSONObject jsonObject = JSONObject.parseObject(requestParam);
|
||||
String regionCode = jsonObject.getString("region_code");
|
||||
findNextPoint(nextRegionStr,regionCode, task);
|
||||
findNextPoint(nextRegionStr, regionCode, task);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,20 +103,19 @@ public class ZJPSTask extends AbstractTask {
|
||||
String requestParam = task.getRequest_param();
|
||||
JSONObject jsonObject = JSONObject.parseObject(requestParam);
|
||||
String regionCode = jsonObject.getString("region_code");
|
||||
findNextPoint(nextRegionStr,regionCode, task);
|
||||
findNextPoint(nextRegionStr, regionCode, task);
|
||||
}
|
||||
|
||||
public void findNextPoint(List<String> nextRegionStr,String regionCode,SchBaseTask task) {
|
||||
public void findNextPoint(List<String> nextRegionStr, String regionCode, SchBaseTask task) {
|
||||
if ("R4".equals(regionCode)) {
|
||||
RedissonUtils.lock(c -> {
|
||||
List<SchBasePoint> points = zjpsMapper.findNextPoint(nextRegionStr,regionCode);
|
||||
List<SchBasePoint> points = zjpsMapper.findNextPoint(nextRegionStr, regionCode);
|
||||
if (CollectionUtils.isEmpty(points)) {
|
||||
throw new BadRequestException("区域4没有空闲的上料点位!");
|
||||
}
|
||||
SchBasePoint schBasePoint = null;
|
||||
for (int i = 0; i < points.size(); i++) {
|
||||
SchBasePoint point = points.get(i);
|
||||
|
||||
//判断该点位的所在的排是否达到任务最大数
|
||||
if (!checkMaxTaskNum(point)) {
|
||||
continue;
|
||||
@@ -133,7 +132,7 @@ public class ZJPSTask extends AbstractTask {
|
||||
String requestParam = task.getRequest_param();
|
||||
JSONObject jsonObject = JSONObject.parseObject(requestParam);
|
||||
String point3 = jsonObject.getString("point3");
|
||||
if (StrUtil.isNotEmpty(point3)){
|
||||
if (StrUtil.isNotEmpty(point3)) {
|
||||
task.setPoint_code3(point3);
|
||||
}
|
||||
task.setVehicle_code2(PackageInfoIvtEnum.AGV_ACTION_TYPE.code("取放货二次分配"));
|
||||
@@ -146,16 +145,15 @@ public class ZJPSTask extends AbstractTask {
|
||||
pointService.updateById(schBasePoint);
|
||||
return true;
|
||||
}, "ZJPSToR4Task", null);
|
||||
}else {
|
||||
} else {
|
||||
RedissonUtils.lock(c -> {
|
||||
List<SchBasePoint> points = zjpsMapper.findNextPoint(nextRegionStr,regionCode);
|
||||
List<SchBasePoint> points = zjpsMapper.findNextPoint(nextRegionStr, regionCode);
|
||||
if (CollectionUtils.isEmpty(points)) {
|
||||
throw new BadRequestException("区域5没有空闲的上料点位!");
|
||||
}
|
||||
SchBasePoint schBasePoint = null;
|
||||
for (int i = 0; i < points.size(); i++) {
|
||||
SchBasePoint point = points.get(i);
|
||||
|
||||
//判断该点位的所在的排是否达到任务最大数
|
||||
if (!checkMaxTaskNum(point)) {
|
||||
continue;
|
||||
@@ -172,7 +170,7 @@ public class ZJPSTask extends AbstractTask {
|
||||
String requestParam = task.getRequest_param();
|
||||
JSONObject jsonObject = JSONObject.parseObject(requestParam);
|
||||
String point3 = jsonObject.getString("point3");
|
||||
if (StrUtil.isNotEmpty(point3)){
|
||||
if (StrUtil.isNotEmpty(point3)) {
|
||||
task.setPoint_code3(point3);
|
||||
}
|
||||
task.setVehicle_code2(PackageInfoIvtEnum.AGV_ACTION_TYPE.code("取放货二次分配"));
|
||||
@@ -190,25 +188,48 @@ public class ZJPSTask extends AbstractTask {
|
||||
|
||||
public boolean checkMaxTaskNum(SchBasePoint point) {
|
||||
String ext_point_code = point.getExt_point_code();
|
||||
if (StrUtil.isEmpty(ext_point_code)){
|
||||
throw new BadRequestException("该点位【"+point.getPoint_code()+"】没有设置等待点位!");
|
||||
if (StrUtil.isEmpty(ext_point_code)) {
|
||||
throw new BadRequestException("该点位【" + point.getPoint_code() + "】没有设置等待点位!");
|
||||
}
|
||||
List<SchBasePoint> points = pointService.getPoints(ext_point_code, point.getPoint_code());
|
||||
List<SchBasePoint> collect = points.stream().filter(point1 -> point1.getCol_num() > point.getCol_num() && PointStatusEnum.EMPTY_POINT.getCode().equals(point1.getPoint_status())&& StrUtil.isEmpty(point1.getIng_task_code())).collect(Collectors.toList());
|
||||
List<SchBasePoint> pointList = pointService.getPointList(ext_point_code);
|
||||
List<SchBaseTask> zjpsTask = taskService.findUnFinishTasksByTaskConfigAndPointCode("ZJPSTask", ext_point_code);
|
||||
String region_code = point.getRegion_code();
|
||||
int rowNum = point.getRow_num();
|
||||
Param zjpsTaskNum = new Param();
|
||||
if (region_code.equals("R4")) {
|
||||
zjpsTaskNum = paramService.findByCode("ZJXLToR4Task_num");
|
||||
}else if (region_code.equals("R5")) {
|
||||
zjpsTaskNum = paramService.findByCode("ZJXLToR5Task_num");
|
||||
}
|
||||
List<SchBaseTask> zjpsTask = taskService.findUnFinishTasksByTaskConfigAndPointCode("ZJPSTask", ext_point_code);
|
||||
if (zjpsTaskNum == null) {
|
||||
if (region_code.equals("R4")) {
|
||||
throw new BadRequestException("请先设置参数【ZJXLToR4Task_num】!");
|
||||
}else if (region_code.equals("R5")) {
|
||||
throw new BadRequestException("请先设置参数【ZJXLToR5Task_num】!");
|
||||
if (rowNum == 1) {
|
||||
zjpsTaskNum = paramService.findByCode("ZJXLToR4Task_num1");
|
||||
} else if (rowNum == 2) {
|
||||
zjpsTaskNum = paramService.findByCode("ZJXLToR4Task_num2");
|
||||
}
|
||||
} else if (region_code.equals("R5")) {
|
||||
if (rowNum == 3) {
|
||||
zjpsTaskNum = paramService.findByCode("ZJXLToR5Task_num1");
|
||||
} else if (rowNum == 4) {
|
||||
zjpsTaskNum = paramService.findByCode("ZJXLToR5Task_num2");
|
||||
}
|
||||
}
|
||||
if (zjpsTask.size() >= Integer.parseInt(zjpsTaskNum.getValue())) {
|
||||
|
||||
if (zjpsTaskNum == null) {
|
||||
if (region_code.equals("R4")) {
|
||||
if (rowNum == 1) {
|
||||
throw new BadRequestException("请先设置参数【ZJXLToR4Task_num1】!");
|
||||
} else if (rowNum == 2) {
|
||||
throw new BadRequestException("请先设置参数【ZJXLToR4Task_num2】!");
|
||||
}
|
||||
} else if (region_code.equals("R5")) {
|
||||
if (rowNum == 1) {
|
||||
throw new BadRequestException("请先设置参数【ZJXLToR5Task_num1】!");
|
||||
} else if (rowNum == 2) {
|
||||
throw new BadRequestException("请先设置参数【ZJXLToR5Task_num2】!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int count = zjpsTask.size() + pointList.size() + collect.size();
|
||||
if (count >= Integer.parseInt(zjpsTaskNum.getValue())) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -302,7 +323,7 @@ public class ZJPSTask extends AbstractTask {
|
||||
if (ObjectUtil.isEmpty(taskObj)) {
|
||||
throw new BadRequestException("该任务不存在");
|
||||
}
|
||||
if (!taskObj.getTask_status().equals(TaskStatus.PICK_UP_COMPLETED.getCode())){
|
||||
if (!taskObj.getTask_status().equals(TaskStatus.PICK_UP_COMPLETED.getCode())) {
|
||||
throw new BadRequestException("agv还未取货完成,不允许点完成!");
|
||||
}
|
||||
this.finishTask(taskObj, TaskFinishedTypeEnum.MANUAL_PC);
|
||||
@@ -314,7 +335,7 @@ public class ZJPSTask extends AbstractTask {
|
||||
if (ObjectUtil.isEmpty(taskObj)) {
|
||||
throw new BadRequestException("该任务不存在");
|
||||
}
|
||||
if (taskObj.getTask_status().equals(TaskStatus.PICK_UP_COMPLETED.getCode())){
|
||||
if (taskObj.getTask_status().equals(TaskStatus.PICK_UP_COMPLETED.getCode())) {
|
||||
throw new BadRequestException("agv已经取货完成,不允许点取消!");
|
||||
}
|
||||
this.cancelTask(taskObj, TaskFinishedTypeEnum.MANUAL_PC);
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
WHERE
|
||||
p2.point_status = '2'
|
||||
AND p2.row_num = p1.row_num
|
||||
AND p2.in_order_seq > p1.in_order_seq
|
||||
AND p2.col_num <![CDATA[<]]> p1.col_num
|
||||
AND p2.point_type = '1'
|
||||
AND p2.region_code = #{regionCode}
|
||||
)
|
||||
|
||||
@@ -108,9 +108,12 @@ public class ZJXLTask extends AbstractTask {
|
||||
|
||||
public void findNextPoint(List<String> nextRegionStr,String regionCode,SchBaseTask task) {
|
||||
// 查找R6 R7区域的空闲点位
|
||||
if ("R6".equals(regionCode)) {
|
||||
if (regionCode.contains("R6")) {
|
||||
RedissonUtils.lock(c -> {
|
||||
List<SchBasePoint> points = zjxlMapper.findNextPoint(nextRegionStr,regionCode);
|
||||
String[] split = regionCode.split("-");
|
||||
String region = split[0];
|
||||
String rowNum = split[1];
|
||||
List<SchBasePoint> points = zjxlMapper.findR6Point(rowNum,region);
|
||||
if (CollectionUtils.isEmpty(points)) {
|
||||
throw new BadRequestException("区域6没有空闲的点位!");
|
||||
}
|
||||
@@ -118,9 +121,8 @@ public class ZJXLTask extends AbstractTask {
|
||||
SchBasePoint schBasePoint = null;
|
||||
for (int i = 0; i < points.size(); i++) {
|
||||
SchBasePoint point = points.get(i);
|
||||
|
||||
//判断该点位的所在的排是否达到任务最大数
|
||||
if (!checkMaxTaskNum(point)) {
|
||||
if (!this.checkMaxTaskNum(point)) {
|
||||
continue;
|
||||
}
|
||||
schBasePoint = point;
|
||||
@@ -158,9 +160,8 @@ public class ZJXLTask extends AbstractTask {
|
||||
SchBasePoint schBasePoint = null;
|
||||
for (int i = 0; i < points.size(); i++) {
|
||||
SchBasePoint point = points.get(i);
|
||||
|
||||
//判断该点位的所在的排是否达到任务最大数
|
||||
if (!checkMaxTaskNum(point)) {
|
||||
if (!this.checkMaxTaskNum(point)) {
|
||||
continue;
|
||||
}
|
||||
schBasePoint = point;
|
||||
@@ -196,22 +197,51 @@ public class ZJXLTask extends AbstractTask {
|
||||
if (StrUtil.isEmpty(ext_point_code)){
|
||||
throw new BadRequestException("该点位【"+point.getPoint_code()+"】没有设置等待点位!");
|
||||
}
|
||||
List<SchBasePoint> points = pointService.getPoints(ext_point_code, point.getPoint_code());
|
||||
List<SchBasePoint> collect = points.stream().filter(point1 -> point1.getCol_num() > point.getCol_num() && PointStatusEnum.EMPTY_POINT.getCode().equals(point1.getPoint_status())&& StrUtil.isEmpty(point1.getIng_task_code())).collect(Collectors.toList());
|
||||
List<SchBasePoint> pointList = pointService.getPointList(ext_point_code);
|
||||
List<SchBaseTask> zjpsTask = taskService.findUnFinishTasksByTaskConfigAndPointCode("ZJXLTask", ext_point_code);
|
||||
String region_code = point.getRegion_code();
|
||||
int rowNum = point.getRow_num();
|
||||
Param zjpsTaskNum = new Param();
|
||||
if (region_code.equals("R6")) {
|
||||
zjpsTaskNum = paramService.findByCode("ZJXLToR6Task_num");
|
||||
if (rowNum==1) {
|
||||
zjpsTaskNum = paramService.findByCode("ZJXLToR6Task_num1");
|
||||
} else if (rowNum==2) {
|
||||
zjpsTaskNum = paramService.findByCode("ZJXLToR6Task_num2");
|
||||
}else if (rowNum==3) {
|
||||
zjpsTaskNum = paramService.findByCode("ZJXLToR6Task_num3");
|
||||
}else if (rowNum==4) {
|
||||
zjpsTaskNum = paramService.findByCode("ZJXLToR6Task_num4");
|
||||
}else if (rowNum==5) {
|
||||
zjpsTaskNum = paramService.findByCode("ZJXLToR6Task_num5");
|
||||
}else if (rowNum==6) {
|
||||
zjpsTaskNum = paramService.findByCode("ZJXLToR6Task_num6");
|
||||
}
|
||||
}else if (region_code.equals("R7")) {
|
||||
zjpsTaskNum = paramService.findByCode("ZJXLToR7Task_num");
|
||||
}
|
||||
List<SchBaseTask> zjpsTask = taskService.findUnFinishTasksByTaskConfigAndPointCode("ZJXLTask", ext_point_code);
|
||||
if (zjpsTaskNum == null) {
|
||||
if (region_code.equals("R6")) {
|
||||
throw new BadRequestException("请先设置参数【ZJXLToR6Task_num】!");
|
||||
if (rowNum==1){
|
||||
throw new BadRequestException("请先设置参数【ZJXLToR6Task_num1】!");
|
||||
}else if (rowNum==2){
|
||||
throw new BadRequestException("请先设置参数【ZJXLToR6Task_num2】!");
|
||||
}else if (rowNum==3){
|
||||
throw new BadRequestException("请先设置参数【ZJXLToR6Task_num3】!");
|
||||
}else if (rowNum==4){
|
||||
throw new BadRequestException("请先设置参数【ZJXLToR6Task_num4】!");
|
||||
}else if (rowNum==5){
|
||||
throw new BadRequestException("请先设置参数【ZJXLToR6Task_num5】!");
|
||||
}else if (rowNum==6){
|
||||
throw new BadRequestException("请先设置参数【ZJXLToR6Task_num6】!");
|
||||
}
|
||||
}else if (region_code.equals("R7")) {
|
||||
throw new BadRequestException("请先设置参数【ZJXLToR7Task_num】!");
|
||||
}
|
||||
}
|
||||
if (zjpsTask.size() >= Integer.parseInt(zjpsTaskNum.getValue())) {
|
||||
int count = zjpsTask.size() + pointList.size() + collect.size();
|
||||
if (count >= Integer.parseInt(zjpsTaskNum.getValue())) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -7,4 +7,6 @@ import java.util.List;
|
||||
|
||||
public interface ZJXLMapper {
|
||||
List<SchBasePoint> findNextPoint(@Param("nextRegionStr") List<String> nextRegionStr, @Param("regionCode") String regionCode);
|
||||
|
||||
List<SchBasePoint> findR6Point(@Param("rowNum") String rowNum, @Param("regionCode") String regionCode);
|
||||
}
|
||||
|
||||
@@ -31,4 +31,35 @@
|
||||
)
|
||||
ORDER BY p1.in_order_seq
|
||||
</select>
|
||||
<select id="findR6Point" resultType="org.nl.wms.sch.point.service.dao.SchBasePoint">
|
||||
SELECT * FROM sch_base_point p1
|
||||
WHERE
|
||||
p1.point_status = '1'
|
||||
AND p1.point_type = '1'
|
||||
AND p1.is_used= '1'
|
||||
AND p1.region_code = #{regionCode}
|
||||
AND p1.row_num = #{rowNum}
|
||||
AND 0 = (
|
||||
SELECT COUNT(*)
|
||||
FROM sch_base_task
|
||||
WHERE (point_code1 = p1.point_code
|
||||
OR point_code2 = p1.point_code
|
||||
OR point_code3 = p1.point_code
|
||||
OR point_code4 = p1.point_code
|
||||
)
|
||||
AND task_status <![CDATA[<]]> '5'
|
||||
AND is_delete = '0'
|
||||
)
|
||||
AND 0 = (
|
||||
SELECT COUNT(1) FROM sch_base_point p2
|
||||
WHERE
|
||||
p2.point_status = '2'
|
||||
AND p2.row_num = p1.row_num
|
||||
AND p2.in_order_seq > p1.in_order_seq
|
||||
AND p2.point_type = '1'
|
||||
AND p2.region_code = #{regionCode}
|
||||
AND p2.row_num = #{rowNum}
|
||||
)
|
||||
ORDER BY p1.in_order_seq
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user