opt: 空指针修复

This commit is contained in:
2025-10-10 17:08:45 +08:00
parent 2aa091125c
commit 32eb2c5b1f
8 changed files with 41 additions and 5 deletions

View File

@@ -184,6 +184,9 @@ public class ProductOutTwoServiceImpl implements ProductOutTwoService {
@Override
public List<JSONObject> woodenBoxPoint(JSONObject whereJson) {
if (ObjectUtil.isEmpty(whereJson.getString("container_name"))) {
throw new BadRequestException("卷号不能为空!");
}
JSONObject jsonPlan = WQLObject.getWQLObject("pdm_bi_slittingproductionplan")
.query("container_name = '" + whereJson.getString("container_name") + "' and is_delete = '0'")
.uniqueResult(0);

View File

@@ -774,6 +774,7 @@ public class AutoCallAirShaftTask extends Prun {
List<BstIvtStockingivt> list = stockingivtService.getEmptyPointNotTask(location, "0");
if (list.size() == 0) {
stepErrorInfo.add("备货区找不到空位置搬运, 请检查备货区点位情况!");
redisUtils.set("ERROR" + empty.getPoint_code(), stepErrorInfo);
throw new RuntimeException("备货区找不到空位置搬运, 请检查备货区点位情况!");
}
BstIvtStockingivt endPoint = list.get(0);

View File

@@ -52,7 +52,7 @@ public class AutoExceptionTrussTask {
// 获取能够拉走的点位
List<String> needMoves = slitterMapper.getMoveTzdjwExceptionPoint();
for (String needMove : needMoves) {
List<String> exceptionPointCodes = bcutpointivtService.getCanUseMinPointByShelf("4", "0");
List<String> exceptionPointCodes = bcutpointivtService.getCanUseMinPointByShelf("5", "0");
if (exceptionPointCodes.size() == 0) {
log.info("没有可用的异常处理位...");
return;

View File

@@ -292,7 +292,7 @@
WHERE bic.point_type = '1'
AND bic.is_used = '1'
AND bic.point_location = '0'
AND bic.point_status = '4'
AND bic.point_status = '5'
AND IFNULL(bic.qzz_no1, '') <![CDATA[ <> ]]> ''
AND 0 = (SELECT COUNT(*)
FROM sch_base_task t
@@ -314,7 +314,7 @@
WHERE bic.point_type = '1'
AND bic.is_used = '1'
AND bic.point_location = '0'
AND bic.point_status = '4'
AND bic.point_status = '5'
AND IFNULL(bic.qzz_no2, '') <![CDATA[ <> ]]> ''
AND 0 = (SELECT COUNT(*)
FROM sch_base_task t

View File

@@ -1474,6 +1474,10 @@ public class SlitterServiceImpl implements SlitterService {
// param : container_name, point_code
String containerName = param.getString("container_name");
String pointCode1 = param.getString("point_code");
BstIvtCutpointivt pointCode = bcutpointivtService.getPintByTrussCode(pointCode1, false);
if (ObjectUtil.isEmpty(pointCode)) {
throw new BadRequestException("点位" + pointCode1 + "不存在,请确认点位编码是否正确!");
}
if (ObjectUtil.isEmpty(containerName)) {
throw new BadRequestException("子卷号不能为空!");
}
@@ -1487,7 +1491,6 @@ public class SlitterServiceImpl implements SlitterService {
if (taskList.size() > 0) {
throw new BadRequestException("操作失败,点位[" + pointCode1 + "]存在未完成的任务!");
}
BstIvtCutpointivt pointCode = bcutpointivtService.getPintByTrussCode(pointCode1, false);
PdmBiSlittingproductionplan demoPlan = plans.get(0);
String resourceName = demoPlan.getResource_name();
// 创建新的气胀轴编码

View File

@@ -134,7 +134,11 @@ public class SlitterTaskUtil {
}
public static void main(String[] args) {
System.out.println(getComposePaperTubeInformation("玻璃纤维及其制品|FRP管|6英寸|15|1100", "1"));
// System.out.println(getComposePaperTubeInformation("玻璃纤维及其制品|FRP管|6英寸|15|1100", "1"));
System.out.println(isNumeric(",3000"));
System.out.println(isNumeric("3000"));
System.out.println(isNumeric("3000.32"));
System.out.println(isNumeric("-3000.32"));
}
/**
@@ -642,4 +646,16 @@ public class SlitterTaskUtil {
}
return errorList;
}
/**
* 判断字符串是否为数字(整数、小数、负数)
*/
public static boolean isNumeric(String str) {
if (str == null || str.isEmpty() || str.trim().isEmpty()) {
return false;
}
String s = str.trim();
return s.matches("-?\\d+(\\.\\d+)?");
}
}

View File

@@ -102,6 +102,9 @@ public class InBoxManageServiceImpl implements InBoxManageService {
@Override
@Transactional(rollbackFor = Exception.class)
public void inBox(JSONObject whereJson) {
if (ObjectUtil.isEmpty(whereJson.getString("vehicle_code"))) {
throw new BadRequestException("托盘号不能为空!");
}
/*
* 1.找木箱区的一个仓位
* 2.插入木箱对象载具表
@@ -381,6 +384,9 @@ public class InBoxManageServiceImpl implements InBoxManageService {
new QueryWrapper<BstIvtBoxinfo>().lambda()
.eq(BstIvtBoxinfo::getBox_no, whereJson.getString("box_no"))
);
if (ObjectUtil.isEmpty(boxDao)) {
throw new BadRequestException("找不到木箱号[" + whereJson.getString("box_no") + "]的信息!");
}
// 下发桁架任务
JSONObject taskParam = new JSONObject();
taskParam.put("task_type", "010713");

View File

@@ -9,6 +9,7 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.b_lms.sch.tasks.slitter.util.SlitterTaskUtil;
import org.nl.common.utils.SecurityUtils;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.common.utils.RedisUtils;
@@ -78,6 +79,12 @@ public class BakingServiceImpl implements BakingService {
String temperature = whereJson.getString("temperature"); // 温度
String hours = whereJson.getString("hours"); // 时间
String point_code1 = whereJson.getString("point_code"); // 点位
if (SlitterTaskUtil.isNumeric(hours)) {
throw new BadRequestException("请输入合法的时间!");
}
if (SlitterTaskUtil.isNumeric(temperature)) {
throw new BadRequestException("请输入合法的温度!");
}
//查询该点位是否存在未完成的任务
JSONObject hasTask = WQLObject.getWQLObject("SCH_BASE_Task").query("point_code1 = '" + point_code1 + "' AND task_status < '07' AND is_delete = '0'").uniqueResult(0);
if (hasTask != null) {