feat: 临时将一期A2指定车辆改为两条任务

This commit is contained in:
2024-12-03 16:51:34 +08:00
parent b5b50b1087
commit 9a1f035ad2
4 changed files with 154 additions and 15 deletions

View File

@@ -9,6 +9,11 @@ import org.nl.b_lms.bst.ivt.shafttubeivt.service.dao.BstIvtShafttubeivt;
import org.nl.b_lms.bst.ivt.stockingivt.service.dao.BstIvtStockingivt;
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.modules.wql.util.SpringContextHolder;
import org.nl.system.service.param.ISysParamService;
import org.nl.system.service.param.dao.Param;
import org.nl.system.service.param.impl.SysParamServiceImpl;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
@@ -147,4 +152,18 @@ public class TaskUtils {
// 格式化日期时间
return now.format(formatter);
}
/**
* 获取参数值
* @param code
* @return
*/
public static String getParam(String code) {
ISysParamService paramService = SpringContextHolder.getBean(SysParamServiceImpl.class);
Param byCode = paramService.findByCode(code);
if (ObjectUtil.isEmpty(byCode)) {
throw new BadRequestException("请配置【" + code + "】参数");
}
return byCode.getValue();
}
}

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.common.utils.TaskUtils;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.wql.WQL;
import org.nl.modules.wql.core.bean.WQLObject;
@@ -257,12 +258,17 @@ public class RawFoilServiceImpl implements RawFoilService {
}
JSONObject jsonIvt = WQL.getWO("PDA_RAWFOIL_01").addParamMap(map).process().uniqueResult(0);
// 3.如果没找到则继续找下一节点
String bigType = whereJson.getString("big_type");
if (ObjectUtil.isEmpty(jsonIvt)) {
/*String point_location = jsonSb.getString("point_location");
if (StrUtil.equals(point_location, "0")) map.put("point_location", "1");
if (StrUtil.equals(point_location, "1")) map.put("point_location", "0");
JSONObject jsonIvt_tow = WQL.getWO("PDA_RAWFOIL_01").addParamMap(map).process().uniqueResult(0);*/
throw new BadRequestException("未查询到有空轴且母卷位置为空的点位!");
if (!(jsonSb.getString("product_area").startsWith("A1")
&& ObjectUtil.isNotEmpty(bigType)
&& "1".equals(bigType))) {
throw new BadRequestException("未查询到有空轴且母卷位置为空的点位!");
}
} else {
start_pint_code = jsonIvt.getString("empty_point_code");
point_code4 = jsonIvt.getString("full_point_code");
@@ -270,22 +276,32 @@ public class RawFoilServiceImpl implements RawFoilService {
// 起点和终点确定 生成任务
JSONObject param = new JSONObject();
String bigType = whereJson.getString("big_type");
// 只有一期才需要指定车号
if (jsonSb.getString("product_area").startsWith("A")
// 只有一期A2才需要指定车号
if (jsonSb.getString("product_area").startsWith("A2")
&& ObjectUtil.isNotEmpty(bigType)
&& "1".equals(bigType)) {
param.put("car_no", "8");
param.put("car_no", TaskUtils.getParam("A2_USE_CAR"));
// 不能创建四点任务,需要创建两条。
map.put("flag", "101");
JSONObject emptyPoint = WQL.getWO("PDA_RAWFOIL_01").addParamMap(map).process().uniqueResult(0);
if (ObjectUtil.isEmpty(emptyPoint)) {
throw new BadRequestException("未查询到母卷位置为空且空轴位也是空的点位!");
}
// 找全空的放满轴,任务完成后找有空轴的取
param.put("point_code1", jsonSb.getString("point_code") + "_M");
param.put("point_code2", emptyPoint.getString("full_point_code"));
param.put("task_type", "010105");
param.put("material_code", jsonRaw.getString("container_name"));
param.put("product_area", jsonSb.getString("product_area"));
} else {
param.put("point_code1", start_pint_code);
param.put("point_code2", jsonSb.getString("point_code") + "_K");
param.put("point_code3", jsonSb.getString("point_code") + "_M");
param.put("point_code4", point_code4);
param.put("task_type", "010101");
param.put("material_code", jsonRaw.getString("container_name"));
param.put("product_area", jsonSb.getString("product_area"));
}
param.put("point_code1", start_pint_code);
param.put("point_code2", jsonSb.getString("point_code") + "_K");
param.put("point_code3", jsonSb.getString("point_code") + "_M");
param.put("point_code4", point_code4);
param.put("task_type", "010101");
param.put("material_code", jsonRaw.getString("container_name"));
param.put("product_area", jsonSb.getString("product_area"));
CallEmpReelTask callEmpReelTask = new CallEmpReelTask();
callEmpReelTask.createTask(param);
}
@@ -413,7 +429,7 @@ public class RawFoilServiceImpl implements RawFoilService {
param.put("point_code4", point_code4);
param.put("task_type", "010101");
if (ObjectUtil.isNotEmpty(bigType) && "1".equals(bigType)) {
param.put("car_no", "8");
param.put("car_no", TaskUtils.getParam("A2_USE_CAR"));
}
param.put("material_code", whereJson.getString("container_name"));
param.put("product_area", jsonSb.getString("product_area"));

View File

@@ -88,6 +88,90 @@
ENDSELECT
ENDQUERY
ENDIF
IF 输入.flag = "101"
QUERY
SELECT
ivt.*
FROM
ST_IVT_CoolPointIvt ivt
WHERE
ivt.empty_point_status = '01'
AND
ivt.full_point_status = '01'
AND
ivt.is_used = '1'
OPTION 输入.point_type <> ""
ivt.point_type = 输入.point_type
ENDOPTION
OPTION 输入.point_type = ""
ivt.point_type = '1'
ENDOPTION
AND NOT EXISTS (
SELECT
*
FROM
sch_base_task
WHERE
( point_code1 = ivt.empty_point_code OR point_code2 = ivt.empty_point_code )
AND task_status < '07'
AND is_delete = '0'
)
OPTION 输入.product_area <> ""
ivt.product_area = 输入.product_area
ENDOPTION
OPTION 输入.point_location <> ""
ivt.point_location = 输入.point_location
ENDOPTION
order by ivt.point_code ASC
ENDSELECT
ENDQUERY
ENDIF
IF 输入.flag = "102"
QUERY
SELECT
ivt.*
FROM
ST_IVT_CoolPointIvt ivt
WHERE
ivt.empty_point_status = '02'
AND
ivt.is_used = '1'
OPTION 输入.point_type <> ""
ivt.point_type = 输入.point_type
ENDOPTION
OPTION 输入.point_type = ""
ivt.point_type = '1'
ENDOPTION
AND NOT EXISTS (
SELECT
*
FROM
sch_base_task
WHERE
( point_code1 = ivt.empty_point_code OR point_code2 = ivt.empty_point_code )
AND task_status < '07'
AND is_delete = '0'
)
OPTION 输入.product_area <> ""
ivt.product_area = 输入.product_area
ENDOPTION
OPTION 输入.point_location <> ""
ivt.point_location = 输入.point_location
ENDOPTION
order by ivt.point_code ASC
ENDSELECT
ENDQUERY
ENDIF
IF 输入.flag = "2"
QUERY

View File

@@ -9,6 +9,7 @@ import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.common.utils.SecurityUtils;
import org.nl.common.utils.TaskUtils;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.wql.WQL;
import org.nl.modules.wql.core.bean.WQLObject;
@@ -156,6 +157,24 @@ public class CallEmpReelTask extends AbstractAcsTask {
map.put("finish_type", "01");
map.put("update_time", DateUtil.now());
WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder").update(map, "container_name = '" + jsonTask.getString("material_code") + "'");
// hint: 判断是不是010105
if ("010105".equals(jsonTask.getString("task_type"))) {
// 生成放空任务
JSONObject map2 = new JSONObject();
map2.put("flag", "102");
map2.put("product_area", jsonTask.getString("product_area"));
map2.put("point_location", jsonTask.getString("point_location"));
map2.put("point_type", "1");
JSONObject jsonIvt = WQL.getWO("PDA_RAWFOIL_01").addParamMap(map2).process().uniqueResult(0);
JSONObject nextTaskParam = new JSONObject();
nextTaskParam.put("car_no", TaskUtils.getParam("A2_USE_CAR"));
nextTaskParam.put("point_code1", jsonIvt.getString("empty_point_code"));
nextTaskParam.put("point_code2", point_code1.replace("M", "K"));
nextTaskParam.put("task_type", "010105");
nextTaskParam.put("material_code", jsonTask.getString("container_name"));
nextTaskParam.put("product_area", jsonTask.getString("product_area"));
this.createTask(nextTaskParam);
}
} else {
// 取空
JSONObject jsonCoolIvt = ivtTab.query("empty_point_code = '" + point_code1 + "'").uniqueResult(0);
@@ -163,6 +182,7 @@ public class CallEmpReelTask extends AbstractAcsTask {
jsonCoolIvt.put("empty_vehicle_code", "");
ivtTab.update(jsonCoolIvt);
}
} else {
// 取满放空
// 校验起点是否存在