rev:复烤、内包间查询优化
This commit is contained in:
@@ -19,6 +19,7 @@ import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.nl.system.service.param.impl.SysParamServiceImpl;
|
||||
import org.nl.wms.basedata.st.service.impl.UserAreaServiceImpl;
|
||||
import org.nl.wms.ext.acs.service.impl.WmsToAcsServiceImpl;
|
||||
import org.nl.wms.ext.mes.service.impl.LmsToMesServiceImpl;
|
||||
import org.nl.wms.pda.mps.eum.RegionTypeEnum;
|
||||
import org.nl.wms.pda.mps.service.BakingService;
|
||||
import org.nl.wms.sch.tasks.CutConveyorTask;
|
||||
@@ -29,6 +30,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
@@ -383,10 +386,33 @@ public class BakingServiceImpl implements BakingService {
|
||||
if (ObjectUtil.isEmpty(point_code2)) {
|
||||
throw new BadRequestException("没有无货且没有任务的点位类型为出箱的烘箱对接位!");
|
||||
}
|
||||
|
||||
// 2.找冷却区空货位
|
||||
JSONObject map2 = new JSONObject();
|
||||
map2.put("flag", "2");
|
||||
map2.put("product_area", jsonHotIvt.getString("product_area"));
|
||||
map2.put("point_location", jsonHotIvt.getString("point_location"));
|
||||
|
||||
JSONObject jsonCooIvt = WQL.getWO("PDA_OVENINANDOUT_01").addParamMap(map2).process().uniqueResult(0);
|
||||
// 如果为空
|
||||
if (ObjectUtil.isEmpty(jsonCooIvt)) {
|
||||
if (StrUtil.equals(jsonHotIvt.getString("point_location"), "0")) {
|
||||
map2.put("point_location", "1");
|
||||
}
|
||||
if (StrUtil.equals(jsonHotIvt.getString("point_location"), "1")) {
|
||||
map2.put("point_location", "0");
|
||||
}
|
||||
jsonCooIvt = WQL.getWO("PDA_OVENINANDOUT_01").addParamMap(map2).process().uniqueResult(0);
|
||||
}
|
||||
if (ObjectUtil.isEmpty(jsonCooIvt)) {
|
||||
throw new BadRequestException("冷却区空位不足");
|
||||
}
|
||||
|
||||
// 3.创建任务
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("point_code1", point_code1);
|
||||
param.put("point_code2", point_code2);
|
||||
param.put("point_code3", jsonCooIvt.getString("full_point_code"));
|
||||
param.put("material_code", jsonHotIvt.getString("container_name"));
|
||||
param.put("product_area", jsonHotIvt.getString("product_area"));
|
||||
OutHotTask outHotTask = new OutHotTask();
|
||||
@@ -430,13 +456,13 @@ public class BakingServiceImpl implements BakingService {
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public JSONObject inCoolIvt(JSONObject whereJson) {
|
||||
WQLObject pointTab = WQLObject.getWQLObject("SCH_BASE_Point"); // 点位点
|
||||
WQLObject pointTab = WQLObject.getWQLObject("st_ivt_coolpointivt"); // 点位点
|
||||
WQLObject coolTab = WQLObject.getWQLObject("ST_IVT_CoolRegionIO"); // 冷却区出入表
|
||||
WQLObject rawTab = WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder"); // 生箔工单表
|
||||
WQLObject materTab = WQLObject.getWQLObject("md_me_materialbase"); // 物料表
|
||||
|
||||
|
||||
String point_code1 = whereJson.getString("point_code"); // 暂存位:起点
|
||||
String point_code1 = whereJson.getString("point_code"); // 冷却区点位:起点
|
||||
String container_name = whereJson.getString("container_name"); // 母卷号
|
||||
|
||||
//获取人员对应的区域
|
||||
@@ -467,15 +493,16 @@ public class BakingServiceImpl implements BakingService {
|
||||
throw new BadRequestException("该母卷在MES上未进行决策入半成品库,不允许进行入冷却操作!");
|
||||
}
|
||||
|
||||
// 1.获取此暂存位的生产区域和上下位置
|
||||
JSONObject jsonPoint = pointTab.query("point_code = '" + point_code1 + "'").uniqueResult(0);
|
||||
JSONObject jsonPoint = pointTab.query("full_point_code = '" + point_code1 + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonPoint)) {
|
||||
throw new BadRequestException("请扫描点位类型为出箱的烘箱对接位!");
|
||||
throw new BadRequestException("请扫描冷却区满轴点位编码!");
|
||||
}
|
||||
|
||||
if (!in_area_id.contains(jsonPoint.getString("product_area"))) {
|
||||
throw new BadRequestException("当前登录人员暂无【" + jsonPoint.getString("product_area") + "】操作权限");
|
||||
}
|
||||
|
||||
/* // 1.获取此暂存位的生产区域和上下位置
|
||||
// 2.找冷却区空货位
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("flag", "2");
|
||||
@@ -507,9 +534,9 @@ public class BakingServiceImpl implements BakingService {
|
||||
|
||||
InCoolIvtTask inCoolIvtTask = new InCoolIvtTask();
|
||||
String task_id = inCoolIvtTask.createTask(param);
|
||||
|
||||
*/
|
||||
// 生成冷却区出入表
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
/*String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
|
||||
JSONObject jsonRaw = rawTab.query("container_name = '" + container_name + "' and is_delete = '0'").uniqueResult(0);
|
||||
@@ -540,7 +567,44 @@ public class BakingServiceImpl implements BakingService {
|
||||
jsonCool.put("confirm_optid", currentUserId);
|
||||
jsonCool.put("confirm_optname", currentUsername);
|
||||
jsonCool.put("confirm_time", DateUtil.now());
|
||||
coolTab.insert(jsonCool);
|
||||
coolTab.insert(jsonCool);*/
|
||||
|
||||
WQLObject ivtTab = WQLObject.getWQLObject("ST_IVT_CoolPointIvt"); // 冷却区库存表
|
||||
JSONObject jsonIvt = ivtTab.query("full_point_code ='" + point_code1 + "'").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();
|
||||
String passWord = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("MES_PASSWORD").getValue();
|
||||
param.put("iContainerName", container_name);
|
||||
param.put("iArrivalTime", DateUtil.now());
|
||||
param.put("iWarehouse", 2);
|
||||
param.put("UserName", userName);
|
||||
param.put("PassWord", passWord);
|
||||
|
||||
//判断该接口是否需要回传
|
||||
JSONObject back_jo = WQLObject.getWQLObject("MD_PB_InterfaceBack").query("interface_name = 'momRollSemiFGInboundComplete'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(back_jo) && "1".equals(back_jo.getString("is_back"))) {
|
||||
String product_area = back_jo.getString("product_area");
|
||||
if (StrUtil.isNotEmpty(product_area) && product_area.contains(jsonPoint.getString("product_area"))) {
|
||||
new LmsToMesServiceImpl().momRollSemiFGInboundComplete(param);
|
||||
}
|
||||
}
|
||||
|
||||
//将该母卷的入冷却标识改为0
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put("is_instor", "0");
|
||||
WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder").update(map, "container_name = '" + container_name + "'");
|
||||
log.info("母卷:" + container_name + "对应的入冷却任务完成,请求入半成品库标识改为0");
|
||||
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("message", "操作成功!");
|
||||
|
||||
@@ -361,40 +361,90 @@ public class FeedingServiceImpl implements FeedingService {
|
||||
if (StrUtil.isEmpty(point_code)) {
|
||||
throw new BadRequestException("输入的点位不能为空!");
|
||||
}
|
||||
String type = form.getString("type");
|
||||
|
||||
//查询对应的分切点位是否存在
|
||||
JSONObject cut_jo = WQLObject.getWQLObject("st_ivt_cutpointivt").query("empty_point_code = '" + point_code + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(cut_jo)) {
|
||||
throw new BadRequestException("请输入或者扫码分切区域的空轴点位!");
|
||||
}
|
||||
if (StrUtil.equals("01", cut_jo.getString("empty_point_status"))) {
|
||||
throw new BadRequestException("该点位库存状态不存在空轴!");
|
||||
//空轴送回
|
||||
if (type.equals("1")) {
|
||||
//查询对应的分切点位是否存在
|
||||
JSONObject cut_jo = WQLObject.getWQLObject("st_ivt_cutpointivt").query("empty_point_code = '" + point_code + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(cut_jo)) {
|
||||
throw new BadRequestException("请输入或者扫码分切区域的空轴点位!");
|
||||
}
|
||||
if (StrUtil.equals("01", cut_jo.getString("empty_point_status"))) {
|
||||
throw new BadRequestException("该点位库存状态不存在空轴!");
|
||||
}
|
||||
|
||||
// 2.找冷却区空货位
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("flag", "2");
|
||||
map.put("product_area", cut_jo.getString("product_area"));
|
||||
map.put("point_location", "0");
|
||||
|
||||
JSONObject jsonCooIvt = WQL.getWO("PDA_OVENINANDOUT_01").addParamMap(map).process().uniqueResult(0);
|
||||
// 如果为空
|
||||
if (ObjectUtil.isEmpty(jsonCooIvt)) {
|
||||
map.put("point_location", "1");
|
||||
jsonCooIvt = WQL.getWO("PDA_OVENINANDOUT_01").addParamMap(map).process().uniqueResult(0);
|
||||
}
|
||||
if (ObjectUtil.isEmpty(jsonCooIvt)) {
|
||||
throw new BadRequestException("冷却区空位不足");
|
||||
}
|
||||
|
||||
// 3.创建任务
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("point_code1", point_code);
|
||||
param.put("point_code2", jsonCooIvt.getString("empty_point_code"));
|
||||
param.put("product_area", cut_jo.getString("product_area"));
|
||||
param.put("task_type", "010303");
|
||||
AbstractAcsTask task = new CoolCutTask();
|
||||
task.createTask(param);
|
||||
}
|
||||
|
||||
// 2.找冷却区空货位
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("flag", "2");
|
||||
map.put("product_area", cut_jo.getString("product_area"));
|
||||
map.put("point_location", "0");
|
||||
//满轴送回
|
||||
if (type.equals("2")) {
|
||||
//查询对应的分切点位是否存在
|
||||
JSONObject cut_jo = WQLObject.getWQLObject("st_ivt_cutpointivt").query("full_point_code = '" + point_code + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(cut_jo)) {
|
||||
throw new BadRequestException("请输入或者扫码分切区域的满轴点位!");
|
||||
}
|
||||
if (StrUtil.equals("01", cut_jo.getString("full_point_status"))) {
|
||||
throw new BadRequestException("该点位库存状态不存在满轴!");
|
||||
}
|
||||
|
||||
JSONObject jsonCooIvt = WQL.getWO("PDA_OVENINANDOUT_01").addParamMap(map).process().uniqueResult(0);
|
||||
// 如果为空
|
||||
if (ObjectUtil.isEmpty(jsonCooIvt)) {
|
||||
map.put("point_location", "1");
|
||||
jsonCooIvt = WQL.getWO("PDA_OVENINANDOUT_01").addParamMap(map).process().uniqueResult(0);
|
||||
}
|
||||
if (ObjectUtil.isEmpty(jsonCooIvt)) {
|
||||
throw new BadRequestException("冷却区空位不足");
|
||||
String container_name = cut_jo.getString("container_name");
|
||||
if (StrUtil.isEmpty(container_name)) {
|
||||
throw new BadRequestException("该点位上不存在母卷,或LMS系统上未维护母卷号!");
|
||||
}
|
||||
JSONObject raw_jo = WQLObject.getWQLObject("pdm_bi_rawfoilworkorder").query("container_name = '" + container_name + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(raw_jo)) {
|
||||
throw new BadRequestException("未查询到【" + container_name + "】对应的母卷号!");
|
||||
}
|
||||
JSONObject device_jo = WQLObject.getWQLObject("st_ivt_sbpointivt").query("ext_code = '" + raw_jo.getString("resource_name") + "'").uniqueResult(0);
|
||||
String point_location = device_jo.getString("point_location");
|
||||
|
||||
// 2.找冷却区空货位
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("flag", "2");
|
||||
map.put("product_area", cut_jo.getString("product_area"));
|
||||
map.put("point_location", point_location);
|
||||
|
||||
JSONObject jsonCooIvt = WQL.getWO("PDA_OVENINANDOUT_01").addParamMap(map).process().uniqueResult(0);
|
||||
// 如果为空
|
||||
if (ObjectUtil.isEmpty(jsonCooIvt)) {
|
||||
throw new BadRequestException("冷却区空位不足");
|
||||
}
|
||||
|
||||
// 3.创建任务
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("point_code1", point_code);
|
||||
param.put("point_code2", jsonCooIvt.getString("full_point_code"));
|
||||
param.put("product_area", cut_jo.getString("product_area"));
|
||||
param.put("vehicle_code", container_name);
|
||||
param.put("task_type", "010304");
|
||||
AbstractAcsTask task = new CoolCutTask();
|
||||
task.createTask(param);
|
||||
}
|
||||
|
||||
// 3.创建任务
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("point_code1", point_code);
|
||||
param.put("point_code2", jsonCooIvt.getString("empty_point_code"));
|
||||
param.put("product_area", cut_jo.getString("product_area"));
|
||||
param.put("task_type", "010303");
|
||||
AbstractAcsTask task = new CoolCutTask();
|
||||
task.createTask(param);
|
||||
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("message", "操作成功!");
|
||||
|
||||
@@ -45,9 +45,11 @@
|
||||
IF 输入.flag = "1"
|
||||
PAGEQUERY
|
||||
SELECT
|
||||
ivt.*
|
||||
ivt.*,
|
||||
dict.label
|
||||
FROM
|
||||
st_ivt_shaftivt ivt
|
||||
LEFT JOIN sys_dict dict ON dict.value = ivt.point_type AND dict.`code` = 'PACKAGE_POINT_TYPE'
|
||||
WHERE
|
||||
ivt.product_area in 输入.in_area_id
|
||||
OPTION 输入.point_code <> ""
|
||||
|
||||
@@ -244,6 +244,31 @@ public class CoolCutTask extends AbstractAcsTask {
|
||||
WQLObject.getWQLObject("st_ivt_coolpointivt").update(jsonCoolIvt2);
|
||||
}
|
||||
|
||||
if ("010304".equals(jsonTask.getString("task_type"))) {
|
||||
//更新分切区空轴库存
|
||||
|
||||
JSONObject cut_jo2 = WQLObject.getWQLObject("ST_IVT_CutPointIvt").query("full_point_code = '" + point_code1 + "'").uniqueResult(0);
|
||||
String container_name = cut_jo2.getString("container_name");
|
||||
cut_jo2.put("full_point_status", "01");
|
||||
cut_jo2.put("full_vehicle_code", "");
|
||||
cut_jo2.put("container_name", "");
|
||||
cut_jo2.put("update_optid", currentUserId);
|
||||
cut_jo2.put("update_optname", currentUsername);
|
||||
cut_jo2.put("update_time", DateUtil.now());
|
||||
WQLObject.getWQLObject("ST_IVT_CutPointIvt").update(cut_jo2);
|
||||
|
||||
//更新冷却区空轴库存
|
||||
JSONObject jsonCoolIvt2 = WQLObject.getWQLObject("st_ivt_coolpointivt").query("full_point_code = '" + point_code2 + "'").uniqueResult(0);
|
||||
jsonCoolIvt2.put("full_point_status", "02");
|
||||
jsonCoolIvt2.put("container_name", container_name);
|
||||
jsonCoolIvt2.put("cool_ivt_status", "02");
|
||||
jsonCoolIvt2.put("instorage_time", "");
|
||||
jsonCoolIvt2.put("update_optid", currentUserId);
|
||||
jsonCoolIvt2.put("update_optname", currentUsername);
|
||||
jsonCoolIvt2.put("update_time", DateUtil.now());
|
||||
WQLObject.getWQLObject("st_ivt_coolpointivt").update(jsonCoolIvt2);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -49,13 +49,18 @@ public class OutHotTask extends AbstractAcsTask {
|
||||
.task_code(json.getString("task_code"))
|
||||
.task_type(json.getString("acs_task_type"))
|
||||
.start_device_code(json.getString("point_code1"))
|
||||
.next_device_code(json.getString("point_code2"))
|
||||
.vehicle_code(json.getString("vehicle_code"))
|
||||
.agv_system_type(agv_system_type)
|
||||
.priority(json.getString("priority"))
|
||||
.product_area(product_area)
|
||||
.remark(json.getString("remark"))
|
||||
.build();
|
||||
if (StrUtil.isNotEmpty(json.getString("point_code3"))) {
|
||||
dto.setNext_device_code(json.getString("point_code3"));
|
||||
dto.setPut_device_code(json.getString("point_code2"));
|
||||
} else {
|
||||
dto.setNext_device_code(json.getString("point_code2"));
|
||||
}
|
||||
resultList.add(dto);
|
||||
}
|
||||
return resultList;
|
||||
@@ -105,11 +110,11 @@ public class OutHotTask extends AbstractAcsTask {
|
||||
// 更新主表: 什么时候更新主表
|
||||
JSONObject jsonHotMst = hotMstTab.query("task_id = '" + task_id + "'").uniqueResult(0);
|
||||
|
||||
// 更新暂存区点位状态
|
||||
/*// 更新暂存区点位状态
|
||||
JSONObject jsonPoint2 = pointTab.query("point_code = '" + jsonTask.getString("point_code2") + "'").uniqueResult(0);
|
||||
jsonPoint2.put("point_status", "2");
|
||||
jsonPoint2.put("material_code", jsonHotIvt.getString("container_name"));
|
||||
pointTab.update(jsonPoint2);
|
||||
pointTab.update(jsonPoint2);*/
|
||||
|
||||
// 更新烘箱区库存状态
|
||||
jsonHotIvt.put("point_status", "01");
|
||||
@@ -121,6 +126,24 @@ public class OutHotTask extends AbstractAcsTask {
|
||||
jsonHotIvt.put("update_optname", currentUsername);
|
||||
jsonHotIvt.put("update_time", DateUtil.now());
|
||||
|
||||
// 更新冷却库存状态
|
||||
// 校验终点是否存在
|
||||
WQLObject ivtTab = WQLObject.getWQLObject("ST_IVT_CoolPointIvt"); // 冷却区库存表
|
||||
JSONObject jsonIvt = ivtTab.query("full_point_code ='" + jsonTask.getString("point_code3") + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonIvt)) {
|
||||
throw new BadRequestException("终点未找到可用点位:" + jsonTask.getString("point_code3"));
|
||||
}
|
||||
|
||||
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", "03");
|
||||
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);
|
||||
|
||||
log.info("出烘箱wql执行update语句!");
|
||||
hotIvtTab.update(jsonHotIvt);
|
||||
JSONObject update_ivt = hotIvtTab.query("point_code = '" + jsonTask.getString("point_code1") + "'").uniqueResult(0);
|
||||
@@ -191,6 +214,7 @@ public class OutHotTask extends AbstractAcsTask {
|
||||
json.put("task_status", TaskStatusEnum.START_AND_POINT.getCode());
|
||||
json.put("point_code1", form.getString("point_code1"));
|
||||
json.put("point_code2", form.getString("point_code2"));
|
||||
json.put("point_code3", form.getString("point_code3"));
|
||||
json.put("product_area", form.getString("product_area"));
|
||||
json.put("material_code", form.getString("material_code"));
|
||||
json.put("sort_seq", "1");
|
||||
@@ -205,7 +229,7 @@ public class OutHotTask extends AbstractAcsTask {
|
||||
} else {
|
||||
json.put("priority", priority_jo.getString("value"));
|
||||
}
|
||||
json.put("acs_task_type", "6");
|
||||
json.put("acs_task_type", "8");
|
||||
tab.insert(json);
|
||||
immediateNotifyAcs(json.getString("task_id"));
|
||||
return json.getString("task_id");
|
||||
|
||||
Reference in New Issue
Block a user