opt:优化子卷装箱校验逻辑
This commit is contained in:
@@ -1,5 +1,11 @@
|
||||
package org.nl.wms.util;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.nl.b_lms.pdm.bi.slittingproductionplan.service.dao.PdmBiSlittingproductionplan;
|
||||
import org.nl.b_lms.sch.task.dao.SchBaseTask;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.wms.sch.manage.TaskStatusEnum;
|
||||
|
||||
public class TaskUtil {
|
||||
|
||||
/**
|
||||
@@ -12,4 +18,38 @@ public class TaskUtil {
|
||||
return "normal";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 任务类参数校验
|
||||
*/
|
||||
public static boolean checkParams(SchBaseTask schBaseTask, String taskType) {
|
||||
if (schBaseTask == null) {
|
||||
throw new BadRequestException("任务类型为:" + taskType + "完成接口任务号为空!");
|
||||
}
|
||||
if (schBaseTask.getTask_status().equals(TaskStatusEnum.FINISHED.getCode())) {
|
||||
return true;
|
||||
}
|
||||
if (StringUtils.isBlank(schBaseTask.getVehicle_code())) {
|
||||
throw new BadRequestException("任务类型为:" + taskType + "子卷号不能为空!");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据分切计划获取子卷长度
|
||||
*/
|
||||
public static int getMaxNum(PdmBiSlittingproductionplan productionPlan, String paperDescription) {
|
||||
String containerLength = productionPlan != null ? productionPlan.getPaper_tube_or_FRP().equals("1") ? productionPlan.getPaper_tube_description() : productionPlan.getFRP_description() : paperDescription;
|
||||
int maxNum = 0;
|
||||
for (String part : containerLength.split("\\|")) {
|
||||
String numStr = part.replaceAll("\\D+", "");
|
||||
if (!numStr.isEmpty()) {
|
||||
int num = Integer.parseInt(numStr);
|
||||
if (num > maxNum) {
|
||||
maxNum = num;
|
||||
}
|
||||
}
|
||||
}
|
||||
return maxNum;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user