opt: B2烘烤质检优先送到中专架

This commit is contained in:
2025-01-07 09:02:02 +08:00
parent f184e184f5
commit 4be3280f46
3 changed files with 70 additions and 27 deletions

View File

@@ -10,6 +10,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.point.service.IschBasePointService;
import org.nl.common.utils.SecurityUtils;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.common.utils.RedisUtils;
@@ -619,32 +620,42 @@ public class BakingServiceImpl implements BakingService {
}
map.put("point_type", "1");
// B2出来要根据锂电或者标箔去不同地方状态5
String orderType = raw_jo.getString("order_type");
JSONObject lithiumPoint = null;
String endPointCode = null;
if (jsonPoint.getString("product_area").equals("B2")) {
String orderType = raw_jo.getString("order_type");
// order_type 1-标箔2-锂电
if ("2".equals(orderType)) {
map.put("point_type", "5");
// 如果是B2锂电就优先去表处中转区
lithiumPoint = WQL.getWO("PDA_OVENINANDOUT_01").addParam("flag", "5").process().uniqueResult(0);
if (ObjectUtil.isNotEmpty(lithiumPoint)) {
endPointCode = lithiumPoint.getString("point_code");
}
}
}
JSONObject jsonCooIvt = WQL.getWO("PDA_OVENINANDOUT_01").addParamMap(map).process().uniqueResult(0);
// 如果为空
if (ObjectUtil.isEmpty(jsonCooIvt) && !jsonPoint.getString("product_area").equals("B2")) {
if (StrUtil.equals(jsonPoint.getString("point_location"), "0")) {
map.put("point_location", "1");
if (ObjectUtil.isEmpty(lithiumPoint)) {
JSONObject jsonCooIvt = WQL.getWO("PDA_OVENINANDOUT_01").addParamMap(map).process().uniqueResult(0);
// 如果为空
if (ObjectUtil.isEmpty(jsonCooIvt) && !jsonPoint.getString("product_area").equals("B2")) {
if (StrUtil.equals(jsonPoint.getString("point_location"), "0")) {
map.put("point_location", "1");
}
if (StrUtil.equals(jsonPoint.getString("point_location"), "1")) {
map.put("point_location", "0");
}
jsonCooIvt = WQL.getWO("PDA_OVENINANDOUT_01").addParamMap(map).process().uniqueResult(0);
}
if (StrUtil.equals(jsonPoint.getString("point_location"), "1")) {
map.put("point_location", "0");
if (ObjectUtil.isEmpty(jsonCooIvt)) {
throw new BadRequestException("冷却区空位不足");
}
jsonCooIvt = WQL.getWO("PDA_OVENINANDOUT_01").addParamMap(map).process().uniqueResult(0);
}
if (ObjectUtil.isEmpty(jsonCooIvt)) {
throw new BadRequestException("冷却区空位不足");
endPointCode = jsonCooIvt.getString("full_point_code");
}
// 3.创建任务
JSONObject param = new JSONObject();
param.put("point_code1", point_code1);
param.put("point_code2", jsonCooIvt.getString("full_point_code"));
param.put("point_code2", endPointCode);
param.put("container_name", container_name);
param.put("product_area", jsonPoint.getString("product_area"));
@@ -673,7 +684,7 @@ public class BakingServiceImpl implements BakingService {
jsonCool.put("qty_unit_id", jsonMater.get("base_unit_id"));
jsonCool.put("task_id", task_id);
jsonCool.put("start_point_code", point_code1);
jsonCool.put("end_point_code", jsonCooIvt.getString("full_point_code"));
jsonCool.put("end_point_code", endPointCode);
jsonCool.put("create_mode", "03");
jsonCool.put("create_id", currentUserId);
jsonCool.put("create_name", currentUsername);

View File

@@ -341,3 +341,25 @@
ENDSELECT
ENDQUERY
ENDIF
IF 输入.flag = "5"
QUERY
SELECT
*
FROM
`sch_base_point` p
WHERE
p.region_code = 'B2-BCZZ'
AND p.point_type = '8'
AND p.point_status = '1'
AND 0 = (
SELECT
COUNT(*)
FROM
sch_base_task t
WHERE
t.task_status < '07'
AND t.is_delete = '0'
AND (t.point_code1 = p.point_code OR t.point_code2 = p.point_code OR t.point_code3 = p.point_code OR t.point_code4 = p.point_code))
ENDSELECT
ENDQUERY
ENDIF

View File

@@ -114,7 +114,29 @@ public class InCoolIvtTask extends AbstractAcsTask {
// 校验终点是否存在
JSONObject jsonIvt = ivtTab.query("full_point_code ='" + point_code2 + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonIvt)) {
throw new BadRequestException("终点未找到可用点位:" + point_code2);
// 判断是不是暂存位
JSONObject zzPoint = pointTab.query("point_code ='" + point_code2 + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(zzPoint)) {
throw new BadRequestException("终点未找到可用点位:" + point_code2);
}
zzPoint.put("material_code", jsonTask.getString("material_code"));
// 有料
zzPoint.put("point_status", "2");
zzPoint.put("update_optid", SecurityUtils.getCurrentUserId());
zzPoint.put("update_optname", SecurityUtils.getCurrentNickName());
zzPoint.put("update_time", DateUtil.now());
pointTab.update(zzPoint);
} else {
// 更新冷却库存状态
JSONObject raw_jo = WQLObject.getWQLObject("pdm_bi_rawfoilworkorder").query("container_name = '" + jsonTask.getString("material_code") + "'").uniqueResult(0);
jsonIvt.put("full_point_status", "02");
jsonIvt.put("cool_ivt_status", "04");
jsonIvt.put("instorage_time", DateUtil.now());
jsonIvt.put("container_name", raw_jo.getString("container_name"));
jsonIvt.put("workorder_id", raw_jo.getString("workorder_id"));
jsonIvt.put("ivt_qty", raw_jo.getString("qty"));
ivtTab.update(jsonIvt);
}
// 更新暂存位状态为空位
@@ -123,18 +145,6 @@ public class InCoolIvtTask extends AbstractAcsTask {
jsonPoint.put("material_code", "");
pointTab.update(jsonPoint);
// 更新冷却库存状态
JSONObject raw_jo = WQLObject.getWQLObject("pdm_bi_rawfoilworkorder").query("container_name = '" + jsonTask.getString("material_code") + "'").uniqueResult(0);
jsonIvt.put("full_point_status", "02");
jsonIvt.put("cool_ivt_status", "04");
jsonIvt.put("instorage_time", DateUtil.now());
jsonIvt.put("container_name", raw_jo.getString("container_name"));
jsonIvt.put("workorder_id", raw_jo.getString("workorder_id"));
jsonIvt.put("ivt_qty", raw_jo.getString("qty"));
ivtTab.update(jsonIvt);
// 将入冷却信息发送给mes
JSONObject param = new JSONObject();
String userName = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("MES_USERNAME").getValue();