Browse Source

二次分配fix

master
psh 8 months ago
parent
commit
04fb7c004f
  1. 50
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/KGHJRKTask.java
  2. 19
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/MJXLTask.java

50
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/KGHJRKTask.java

@ -130,43 +130,63 @@ public class KGHJRKTask extends AbstractTask {
//从前往后判断,直到发现点位有货,取前一个
SchBasePoint schBasePoint = null;
if (!"ZJBKGHJDJW".equals(regionCode)) {
boolean flag = false;
for (int i = schBasePointList.size() - 1; i >= 0; i--) {
SchBasePoint temp = schBasePointList.get(i);
if (temp.getVehicle_qty() >= 1 &&
temp.getPoint_code().endsWith("01")
&& ObjectUtil.isEmpty(temp.getIng_task_code())) {
//三拖一起放,如果不是01结尾直接跳过
if (!temp.getPoint_code().endsWith("01")) {
continue;
}
//如果当列已放满,跳过到下一列最后一个点位0501开始判断
if (flag && !temp.getPoint_code().endsWith("0501")) {
continue;
} else if(flag && temp.getPoint_code().endsWith("0501")) {
flag = false;
}
if (temp.getVehicle_qty() == 1 ||
ObjectUtil.isNotEmpty(temp.getIng_task_code())) {
if (schBasePoint != null) {
log.info("空固化架放货找到当前点位有货:{},取上一个空位:{}", temp.getPoint_code(), schBasePoint.getPoint_code());
return schBasePoint;
} else {
log.info("当前区域:" + regionCode + "所有点位均已放满,暂时跳过");
}
break;
log.info("当前区域:" + regionCode2 + "初始点位" + temp.getPoint_code() + "有货,暂时跳过本列");
flag = true;
}
//放货三拖一起放,只能到01位置
if(temp.getPoint_code().endsWith("01")) {
} else if (temp.getPoint_code().endsWith("01")) {
schBasePoint = temp;
}
}
if (ObjectUtil.isEmpty(schBasePoint)) {
schBasePointList = pointMapper.findPointByRegion(regionCode2, "1");
flag = false;
for (int i = schBasePointList.size() - 1; i >= 0; i--) {
SchBasePoint temp = schBasePointList.get(i);
//三拖一起放,如果不是01结尾直接跳过
if (!temp.getPoint_code().endsWith("01")) {
continue;
}
if (temp.getVehicle_qty() == 1 &&
ObjectUtil.isEmpty(temp.getIng_task_code())) {
//如果当列已放满,跳过到下一列最后一个点位1001开始判断
if (flag && !temp.getPoint_code().endsWith("1001")) {
continue;
}else if(flag && temp.getPoint_code().endsWith("1001")) {
flag = false;
}
if (temp.getVehicle_qty() == 1 ||
ObjectUtil.isNotEmpty(temp.getIng_task_code())) {
if (schBasePoint != null) {
log.info("空固化架放货找到当前点位有货:{},取上一个空位:{}", temp.getPoint_code(), schBasePoint.getPoint_code());
return schBasePoint;
} else {
log.info("当前区域:" + regionCode2 + "所有点位均已放满,暂时跳过");
}
break;
log.info("当前区域:" + regionCode2 + "初始点位" + temp.getPoint_code() + "有货,暂时跳过本列");
flag = true;
}
//放货三拖一起放,只能到01位置
} else if (temp.getPoint_code().endsWith("01")) {
schBasePoint = temp;
}
}
}
} else {
for (int i = schBasePointList.size() - 1; i >= 0; i--) {
SchBasePoint temp = schBasePointList.get(i);
@ -251,9 +271,13 @@ public class KGHJRKTask extends AbstractTask {
}
@Override
protected void feedbackTaskState(JSONObject param, SchBaseTask schBaseTask, BaseResponse result) {
protected synchronized void feedbackTaskState(JSONObject param, SchBaseTask schBaseTask, BaseResponse result) {
//重新计算固化室放货点位
JSONObject extGroupData = JSONObject.parseObject(schBaseTask.getExt_group_data());
if (!schBaseTask.getPoint_code2().endsWith("DDD")) {
log.info("当前任务" + schBaseTask.getTask_code() + "二次已分配点位" + schBaseTask.getPoint_code2() + ",无需重算");
return;
}
SchBasePoint startPoint = pointService.getOne(new LambdaQueryWrapper<SchBasePoint>()
.eq(SchBasePoint::getPoint_code, schBaseTask.getPoint_code1()));
SchBasePoint point = findNextPoint(startPoint, schBaseTask.getVehicle_type());

19
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/MJXLTask.java

@ -66,7 +66,7 @@ public class MJXLTask extends AbstractTask {
@Override
// @Transactional(rollbackFor = Exception.class)
protected void create() throws BadRequestException {
protected synchronized void create() throws BadRequestException {
// 获取任务
List<SchBaseTask> tasks = taskService.findTasksByTaskStatus(TASK_CONFIG_CODE, TaskStatus.APPLY);
// 配置信息
@ -79,7 +79,7 @@ public class MJXLTask extends AbstractTask {
String extGroupData = task.getExt_group_data();
JSONObject jsonObject = JSONObject.parseObject(extGroupData);
String materialType = jsonObject.getString("material_type");
SchBasePoint point = findNextPoint(startPoint, jsonObject);
SchBasePoint point = findNextPoint(startPoint, jsonObject,task);
if (ObjectUtil.isEmpty(point)) {
task.setRemark("未找到所需点位!");
taskService.update(task);
@ -99,8 +99,8 @@ public class MJXLTask extends AbstractTask {
//发起任务时先把点位占用,防止发起重复任务
// point.setIng_task_code(task.getTask_code());
point.setVehicle_type(materialType);
pointService.update(point);
// point.setVehicle_type(materialType);
// pointService.update(point);
//下发
this.renotifyAcs(task);
@ -118,7 +118,7 @@ public class MJXLTask extends AbstractTask {
* @param extGroupData
* @return
*/
private SchBasePoint findNextPoint(SchBasePoint startPoint, JSONObject extGroupData) {
private SchBasePoint findNextPoint(SchBasePoint startPoint, JSONObject extGroupData,SchBaseTask task) {
String regionCode = null;
String materialType = extGroupData.getString("material_type");
if ("TBX1".equals(startPoint.getRegion_code())) {
@ -136,6 +136,10 @@ public class MJXLTask extends AbstractTask {
!schBasePoint.getPoint_code().endsWith("06")) {
continue;
}
if(task.getTask_code().equals(schBasePoint.getIng_task_code())){
log.info("点位"+schBasePoint.getPoint_code()+"已被当前任务锁定直接反馈");
return schBasePoint;
}
if ((ObjectUtil.isEmpty(schBasePoint.getVehicle_type()) ||
materialType.equals(schBasePoint.getVehicle_type()))
&& "2".equals(schBasePoint.getPoint_status())
@ -292,18 +296,19 @@ public class MJXLTask extends AbstractTask {
}
@Override
protected void feedbackTaskState(JSONObject param, SchBaseTask schBaseTask, BaseResponse result) {
protected synchronized void feedbackTaskState(JSONObject param, SchBaseTask schBaseTask, BaseResponse result) {
//重新计算固化室放货点位
JSONObject extGroupData = JSONObject.parseObject(schBaseTask.getExt_group_data());
SchBasePoint startPoint = pointService.getOne(new LambdaQueryWrapper<SchBasePoint>()
.eq(SchBasePoint::getPoint_code, schBaseTask.getPoint_code1()));
SchBasePoint point = findNextPoint(startPoint, extGroupData);
SchBasePoint point = findNextPoint(startPoint, extGroupData,schBaseTask);
schBaseTask.setPoint_code2(point.getPoint_code()+"0"+(point.getVehicle_qty()+1));
if(ObjectUtil.isNotEmpty(point.getIng_task_code())&&!schBaseTask.getTask_code().equals(point.getIng_task_code())){
throw new BadRequestException("当前固化室点位有任务,暂不反馈!");
}
//重算点位时把点位占用
point.setIng_task_code(schBaseTask.getTask_code());
point.setVehicle_type(extGroupData.getString("material_type"));
pointService.update(point);
}
}

Loading…
Cancel
Save