feat: B2车间生箔下料

This commit is contained in:
2024-12-24 16:09:58 +08:00
parent 115ef819b5
commit 824ad68db9
6 changed files with 140 additions and 58 deletions

View File

@@ -535,7 +535,7 @@ public class BakingServiceImpl implements BakingService {
return result;
}
private JSONObject getJsonObject(String product_area, JSONObject point_code2_jo, String temperature) {
public JSONObject getJsonObject(String product_area, JSONObject point_code2_jo, String temperature) {
JSONObject jsonMap = new JSONObject();
jsonMap.put("flag", "1");
jsonMap.put("product_area", product_area);

View File

@@ -12,16 +12,20 @@ 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.common.utils.RedisUtils;
import org.nl.modules.wql.WQL;
import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.modules.wql.core.content.HttpContext;
import org.nl.modules.wql.util.SpringContextHolder;
import org.nl.wms.basedata.st.service.impl.UserAreaServiceImpl;
import org.nl.wms.ext.acs.service.AcsToWmsService;
import org.nl.wms.ext.acs.service.impl.WmsToAcsServiceImpl;
import org.nl.wms.pda.mps.eum.RegionTypeEnum;
import org.nl.wms.pda.mps.service.BakingService;
import org.nl.wms.pda.mps.service.RawFoilService;
import org.nl.wms.sch.service.PointService;
import org.nl.wms.sch.tasks.CallEmpReelTask;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -144,7 +148,7 @@ public class RawFoilServiceImpl implements RawFoilService {
@Override
@Transactional(rollbackFor = Exception.class)
public JSONObject needEmptyAxis(JSONObject whereJson) {
String message = "操作完成!";
WQLObject pdmBiRawfoilworkorderService = WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder"); // 生箔工单表
WQLObject stIvtSbpointivtService = WQLObject.getWQLObject("ST_IVT_SbPointIvt"); // 生箔点位库存表
@@ -294,20 +298,37 @@ public class RawFoilServiceImpl implements RawFoilService {
param.put("material_code", jsonRaw.getString("container_name"));
param.put("product_area", jsonSb.getString("product_area"));
} else if (jsonSb.getString("product_area").equals("B2") && "2".equals(orderType)) {
// 如果是B2直接送到对接位。
// 如果是B2直接送到对接位。(找到对应满足温度的烘箱、没有禁用的烘箱。)
BakingServiceImpl bean = SpringContextHolder.getBean(BakingServiceImpl.class);
// 温度
String temperature = whereJson.getString("temperature");
// 时间
String hours = whereJson.getString("hours");
JSONObject map2 = new JSONObject();
map2.put("flag", "3");
map2.put("flag", "301");
map2.put("reging_id", RegionTypeEnum.B2_HKZC.getId());
map2.put("point_location", jsonSb.getString("point_location"));
//只找入箱点位
map2.put("point_type", "4");
JSONObject point_code2_jo = WQL.getWO("PDA_OVENINANDOUT_01").addParamMap(map2).process().uniqueResult(0);
if (ObjectUtil.isNotEmpty(point_code2_jo)) {
param.put("point_code4", point_code2_jo.getString("point_code"));
param.put("task_type", "010106");
} else {
JSONArray point_code2_jos = WQL.getWO("PDA_OVENINANDOUT_01").addParamMap(map2).process().getResultJSONArray(0);
if (ObjectUtil.isNotEmpty(point_code2_jos)) {
// 遍历查找
for (int i = 0; i < point_code2_jos.size(); i++) {
JSONObject point_code2_jo = point_code2_jos.getJSONObject(i);
JSONObject productArea = bean.getJsonObject(jsonSb.getString("product_area"), point_code2_jo, temperature);
if (ObjectUtil.isNotEmpty(productArea)) {
param.put("point_code4", point_code2_jo.getString("point_code"));
param.put("task_type", "010106");
param.put("temperature", temperature);
param.put("hours", hours);
message = "送到烘箱对接位!";
break;
}
}
}
if (ObjectUtil.isEmpty(point_code2_jos) || ObjectUtil.isEmpty(param.getString("point_code4"))) {
param.put("point_code4", point_code4);
param.put("task_type", "010101");
message = "送到冷却区!";
}
param.put("point_code1", start_pint_code);
param.put("point_code2", jsonSb.getString("point_code") + "_K");
@@ -333,7 +354,7 @@ public class RawFoilServiceImpl implements RawFoilService {
pdmBiRawfoilworkorderService.update(jo_map, "workorder_id = '" + raw_jo.getString("workorder_id") + "'");
JSONObject jo = new JSONObject();
jo.put("message", "操作成功!");
jo.put("message", message);
return jo;
}

View File

@@ -58,7 +58,7 @@
FROM
sch_base_task
WHERE
( point_code3 = ivt.point_code OR point_code1 = ivt.point_code OR point_code2 = ivt.point_code )
( point_code3 = ivt.point_code OR point_code1 = ivt.point_code OR point_code2 = ivt.point_code OR point_code4 = ivt.point_code )
AND task_status < '07'
AND is_delete = '0'
)

View File

@@ -320,3 +320,24 @@
ENDSELECT
ENDQUERY
ENDIF
IF 输入.flag = "301"
QUERY
SELECT
p.*
FROM
`sch_base_point` p
WHERE p.is_used = '1'
OPTION 输入.reging_id <> ""
p.region_id = 输入.reging_id
ENDOPTION
OPTION 输入.point_type <> ""
p.point_type = 输入.point_type
ENDOPTION
AND p.point_type = '4'
AND 0 = (SELECT COUNT(*) FROM sch_base_task t WHERE t.task_status < '07'
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)
AND t.is_delete = '0')
ENDSELECT
ENDQUERY
ENDIF

View File

@@ -2,6 +2,7 @@ package org.nl.wms.sch.tasks;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONArray;
@@ -14,6 +15,8 @@ import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.wql.WQL;
import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.modules.wql.util.SpringContextHolder;
import org.nl.wms.pda.mps.eum.RegionTypeEnum;
import org.nl.wms.pda.mps.service.impl.BakingServiceImpl;
import org.nl.wms.sch.AcsTaskDto;
import org.nl.wms.sch.manage.AbstractAcsTask;
import org.nl.wms.sch.manage.TaskStatusEnum;
@@ -228,6 +231,11 @@ public class CallEmpReelTask extends AbstractAcsTask {
jsonIvt2.put("material_code", jsonTask.getString("material_code"));
point_tab.update(jsonIvt2);
} else if (jsonTask.getString("task_type").equals("010106")) {
BakingServiceImpl bean = SpringContextHolder.getBean(BakingServiceImpl.class);
WQLObject materTab = WQLObject.getWQLObject("md_me_materialbase"); // 物料表
JSONObject requestParam = jsonTask.getJSONObject("request_param");
String temperature = requestParam.getString("temperature");
String hours = requestParam.getString("hours");
// 校验终点是否存在
JSONObject jsonIvt2 = point_tab.query("point_code ='" + point_code4 + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonIvt2)) {
@@ -255,6 +263,37 @@ public class CallEmpReelTask extends AbstractAcsTask {
cache_param.put("cool_ivt_status", "01");
cache_param.put("empty_point_status", "01");
ivtTab.update(cache_param, "empty_point_code ='" + point_code1 + "'");
// 创建桁架任务,入烘箱。
JSONObject hotPoint = bean.getJsonObject(jsonIvt2.getString("product_area"), jsonIvt2, temperature);
String container_name = jsonTask.getString("material_code");
// 创建暂存位 --> 烘烤区任务
JSONObject param = new JSONObject();
param.put("type", "2");
param.put("point_code1", point_code4);
param.put("point_code2", hotPoint.getString("point_code"));
param.put("material_code", container_name);
param.put("product_area", hotPoint.getString("product_area"));
param.put("request_param", NumberUtil.mul(Double.parseDouble(hours), 60));
InHotTask inHotTask = new InHotTask();
String taskId = inHotTask.createTask(param);
// 3.插入主表
JSONObject jsonRawHot = rawTab.query("container_name = '" + container_name + "' and is_delete = '0'").uniqueResult(0);
JSONObject jsonMater = materTab.query("material_code = '" + jsonRawHot.getString("product_name") + "'").uniqueResult(0);
JSONObject hotParam = new JSONObject();
hotParam.put("container_name", container_name);
hotParam.put("workorder_id", jsonRawHot.getString("workorder_id"));
hotParam.put("material_id", jsonMater.getString("material_id"));
hotParam.put("qty", jsonRawHot.get("productin_qty"));
hotParam.put("io_type", "0");
hotParam.put("qty_unit_id", jsonMater.getString("base_unit_id"));
hotParam.put("task_id", taskId);
hotParam.put("start_point_code", point_code1);
hotParam.put("end_point_code", hotPoint.getString("point_code"));
hotParam.put("temperature", temperature);
hotParam.put("oven_time", hours);
bean.createHotIoMst(hotParam);
} else {
// 校验终点是否存在
JSONObject jsonIvt2 = ivtTab.query("full_point_code ='" + point_code4 + "'").uniqueResult(0);
@@ -369,6 +408,7 @@ public class CallEmpReelTask extends AbstractAcsTask {
json.put("product_area", form.getString("product_area"));
json.put("handle_class", THIS_CLASS);
json.put("sort_seq", "1");
json.put("request_param", JSONObject.toJSONString(form));
json.put("car_no", form.getString("car_no"));
json.put("create_id", currentUserId);
json.put("create_name", currentUsername);

View File

@@ -118,56 +118,56 @@ public class InHotTask extends AbstractAcsTask {
String hot_point_code = "";
// 判断此任务是否有三个点位
if (ObjectUtil.isEmpty(jsonTask.getString("point_code3"))) {
if (ObjectUtil.isEmpty(jsonTask.getString("point_code3"))) {
if (jsonTask.getString("task_type").equals("010204")) {
//更新冷却区库存
JSONObject cool_jo = coolIvtTab.query("point_code = '" + jsonTask.getString("point_code2") + "'").uniqueResult(0);
cool_jo.put("full_point_status", "02");
cool_jo.put("cool_ict_status", "01");
cool_jo.put("container_name", jsonTask.getString("material_code"));
coolIvtTab.update(cool_jo);
//更新对接位库存
JSONObject dj_jo = pointTab.query("point_code = '" + jsonTask.getString("point_code1") + "'").uniqueResult(0);
dj_jo.put("point_status", "1");
dj_jo.put("material_code", "");
pointTab.update(dj_jo);
return;
if (jsonTask.getString("task_type").equals("010204")) {
//更新冷却区库存
JSONObject cool_jo = coolIvtTab.query("point_code = '" + jsonTask.getString("point_code2") + "'").uniqueResult(0);
cool_jo.put("full_point_status", "02");
cool_jo.put("cool_ict_status", "01");
cool_jo.put("container_name", jsonTask.getString("material_code"));
coolIvtTab.update(cool_jo);
//更新对接位库存
JSONObject dj_jo = pointTab.query("point_code = '" + jsonTask.getString("point_code1") + "'").uniqueResult(0);
dj_jo.put("point_status", "1");
dj_jo.put("material_code", "");
pointTab.update(dj_jo);
return;
} else {
/*
* 暂存区入烘箱任务
*/
// 更新烘箱区库存状态
JSONObject jsonHotIvt = hotIvtTab.query("point_code = '" + jsonTask.getString("point_code2") + "'").uniqueResult(0);
jsonHotIvt.put("point_status", "02");
jsonHotIvt.put("container_name", jsonHotMst.getString("container_name"));
jsonHotIvt.put("workorder_id", jsonHotMst.getString("workorder_id"));
jsonHotIvt.put("ivt_qty", jsonHotMst.getString("qty"));
jsonHotIvt.put("instorage_time", DateUtil.now());
jsonHotIvt.put("update_optid", currentUserId);
jsonHotIvt.put("update_optname", currentUsername);
jsonHotIvt.put("update_time", DateUtil.now());
hotIvtTab.update(jsonHotIvt);
String product_area = jsonHotIvt.getString("product_area");
if (product_area.equals("B1")) {
JSONObject jsonPoint = coolIvtTab.query("point_code = '" + jsonTask.getString("point_code1") + "'").uniqueResult(0);
jsonPoint.put("container_name", "");
jsonPoint.put("full_point_status", "01");
coolIvtTab.update(jsonPoint);
} else {
/*
* 暂存区入烘箱任务
*/
// 更新烘箱区库存状态
JSONObject jsonHotIvt = hotIvtTab.query("point_code = '" + jsonTask.getString("point_code2") + "'").uniqueResult(0);
jsonHotIvt.put("point_status", "02");
jsonHotIvt.put("container_name", jsonHotMst.getString("container_name"));
jsonHotIvt.put("workorder_id", jsonHotMst.getString("workorder_id"));
jsonHotIvt.put("ivt_qty", jsonHotMst.getString("qty"));
jsonHotIvt.put("instorage_time", DateUtil.now());
jsonHotIvt.put("update_optid", currentUserId);
jsonHotIvt.put("update_optname", currentUsername);
jsonHotIvt.put("update_time", DateUtil.now());
hotIvtTab.update(jsonHotIvt);
String product_area = jsonHotIvt.getString("product_area");
if (product_area.equals("B1")) {
JSONObject jsonPoint = coolIvtTab.query("point_code = '" + jsonTask.getString("point_code1") + "'").uniqueResult(0);
jsonPoint.put("container_name", "");
jsonPoint.put("full_point_status", "01");
coolIvtTab.update(jsonPoint);
} else {
// 更新暂存区点位状态为空位
JSONObject jsonPoint = pointTab.query("point_code = '" + jsonTask.getString("point_code1") + "'").uniqueResult(0);
jsonPoint.put("point_status", "1");
jsonPoint.put("material_code", "");
pointTab.update(jsonPoint);
}
hot_point_code = jsonHotIvt.getString("ext_code");
// 更新暂存区点位状态为空位
JSONObject jsonPoint = pointTab.query("point_code = '" + jsonTask.getString("point_code1") + "'").uniqueResult(0);
jsonPoint.put("point_status", "1");
jsonPoint.put("material_code", "");
pointTab.update(jsonPoint);
}
} else {
hot_point_code = jsonHotIvt.getString("ext_code");
}
} else {
/*
* 冷却区入烘箱任务
*/