Browse Source

二次分配fix

master
psh 8 months ago
parent
commit
04fb7c004f
  1. 56
      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

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

@ -85,7 +85,7 @@ public class KGHJRKTask extends AbstractTask {
continue; continue;
} }
// 设置终点并修改创建成功状态 // 设置终点并修改创建成功状态
if("HCQ7".equals(point.getRegion_code())) { if ("HCQ7".equals(point.getRegion_code())) {
task.setTask_type("11"); task.setTask_type("11");
} else { } else {
task.setTask_type("12"); task.setTask_type("12");
@ -130,41 +130,61 @@ public class KGHJRKTask extends AbstractTask {
//从前往后判断,直到发现点位有货,取前一个 //从前往后判断,直到发现点位有货,取前一个
SchBasePoint schBasePoint = null; SchBasePoint schBasePoint = null;
if (!"ZJBKGHJDJW".equals(regionCode)) { if (!"ZJBKGHJDJW".equals(regionCode)) {
boolean flag = false;
for (int i = schBasePointList.size() - 1; i >= 0; i--) { for (int i = schBasePointList.size() - 1; i >= 0; i--) {
SchBasePoint temp = schBasePointList.get(i); SchBasePoint temp = schBasePointList.get(i);
if (temp.getVehicle_qty() >= 1 && //三拖一起放,如果不是01结尾直接跳过
temp.getPoint_code().endsWith("01") if (!temp.getPoint_code().endsWith("01")) {
&& ObjectUtil.isEmpty(temp.getIng_task_code())) { 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) { if (schBasePoint != null) {
log.info("空固化架放货找到当前点位有货:{},取上一个空位:{}", temp.getPoint_code(), schBasePoint.getPoint_code()); log.info("空固化架放货找到当前点位有货:{},取上一个空位:{}", temp.getPoint_code(), schBasePoint.getPoint_code());
return schBasePoint;
} else { } else {
log.info("当前区域:" + regionCode + "所有点位均已放满,暂时跳过"); log.info("当前区域:" + regionCode2 + "初始点位" + temp.getPoint_code() + "有货,暂时跳过本列");
flag = true;
} }
break; //放货三拖一起放,只能到01位置
} } else if (temp.getPoint_code().endsWith("01")) {
//放货三拖一起放,只能到01位置
if(temp.getPoint_code().endsWith("01")) {
schBasePoint = temp; schBasePoint = temp;
} }
} }
if (ObjectUtil.isEmpty(schBasePoint)) { if (ObjectUtil.isEmpty(schBasePoint)) {
schBasePointList = pointMapper.findPointByRegion(regionCode2, "1"); schBasePointList = pointMapper.findPointByRegion(regionCode2, "1");
flag = false;
for (int i = schBasePointList.size() - 1; i >= 0; i--) { for (int i = schBasePointList.size() - 1; i >= 0; i--) {
SchBasePoint temp = schBasePointList.get(i); SchBasePoint temp = schBasePointList.get(i);
//三拖一起放,如果不是01结尾直接跳过 //三拖一起放,如果不是01结尾直接跳过
if (!temp.getPoint_code().endsWith("01")) { if (!temp.getPoint_code().endsWith("01")) {
continue; continue;
} }
if (temp.getVehicle_qty() == 1 && //如果当列已放满,跳过到下一列最后一个点位1001开始判断
ObjectUtil.isEmpty(temp.getIng_task_code())) { 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) { if (schBasePoint != null) {
log.info("空固化架放货找到当前点位有货:{},取上一个空位:{}", temp.getPoint_code(), schBasePoint.getPoint_code()); log.info("空固化架放货找到当前点位有货:{},取上一个空位:{}", temp.getPoint_code(), schBasePoint.getPoint_code());
return schBasePoint;
} else { } else {
log.info("当前区域:" + regionCode2 + "所有点位均已放满,暂时跳过"); log.info("当前区域:" + regionCode2 + "初始点位" + temp.getPoint_code() + "有货,暂时跳过本列");
flag = true;
} }
break; //放货三拖一起放,只能到01位置
} else if (temp.getPoint_code().endsWith("01")) {
schBasePoint = temp;
} }
schBasePoint = temp;
} }
} }
} else { } else {
@ -251,9 +271,13 @@ public class KGHJRKTask extends AbstractTask {
} }
@Override @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()); 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>() SchBasePoint startPoint = pointService.getOne(new LambdaQueryWrapper<SchBasePoint>()
.eq(SchBasePoint::getPoint_code, schBaseTask.getPoint_code1())); .eq(SchBasePoint::getPoint_code, schBaseTask.getPoint_code1()));
SchBasePoint point = findNextPoint(startPoint, schBaseTask.getVehicle_type()); SchBasePoint point = findNextPoint(startPoint, schBaseTask.getVehicle_type());
@ -263,7 +287,7 @@ public class KGHJRKTask extends AbstractTask {
//空架缓存区不需要该逻辑,左右都是同一套点位体系 //空架缓存区不需要该逻辑,左右都是同一套点位体系
if (!"HCQ7".equals(point.getRegion_code())) { if (!"HCQ7".equals(point.getRegion_code())) {
schBaseTask.setPoint_code2(point.getPoint_code().replace("HCQ", "QHQ")); schBaseTask.setPoint_code2(point.getPoint_code().replace("HCQ", "QHQ"));
}else{ } else {
schBaseTask.setPoint_code2(point.getPoint_code()); schBaseTask.setPoint_code2(point.getPoint_code());
} }
if (ObjectUtil.isNotEmpty(point.getIng_task_code()) && !schBaseTask.getTask_code().equals(point.getIng_task_code())) { if (ObjectUtil.isNotEmpty(point.getIng_task_code()) && !schBaseTask.getTask_code().equals(point.getIng_task_code())) {

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

Loading…
Cancel
Save