diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/WmsToAcsService.java b/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/WmsToAcsService.java index 5fc098b00..cb2bd4908 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/WmsToAcsService.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/WmsToAcsService.java @@ -51,7 +51,7 @@ public interface WmsToAcsService { Map orderStatusUpdate(JSONArray arr); /** - * 获取点位状态 + * 获取设备状态 * @return */ JSONObject getPointStatus(JSONArray whereJson); diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/ext/mes/service/impl/MesToLmsServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/ext/mes/service/impl/MesToLmsServiceImpl.java index cc7ecfe1d..b4105e67b 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/ext/mes/service/impl/MesToLmsServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/ext/mes/service/impl/MesToLmsServiceImpl.java @@ -545,7 +545,7 @@ public class MesToLmsServiceImpl implements MesToLmsService { jsonCool.put("io_type", "1"); jsonCool.put("material_id", mater_jo.getString("material_id")); jsonCool.put("pcsn", parent_container_name); - jsonCool.put("bill_status", "10"); + jsonCool.put("bill_status", "50"); jsonCool.put("task_id", task_id); jsonCool.put("qty_unit_id", "1"); jsonCool.put("start_point_code", cool_ivt.getString("full_point_code")); diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/impl/BakingServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/impl/BakingServiceImpl.java index d5b3632ab..558d906c2 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/impl/BakingServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/impl/BakingServiceImpl.java @@ -2,6 +2,7 @@ package org.nl.wms.pda.mps.service.impl; 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; @@ -10,9 +11,11 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.nl.modules.common.exception.BadRequestException; import org.nl.modules.common.utils.SecurityUtils; +import org.nl.modules.system.service.impl.ParamServiceImpl; import org.nl.modules.system.util.CodeUtil; 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.BakingService; import org.nl.wms.sch.tasks.CutConveyorTask; @@ -57,6 +60,7 @@ public class BakingServiceImpl implements BakingService { WQLObject rawTab = WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder"); // 生箔工单表 WQLObject materTab = WQLObject.getWQLObject("md_me_materialbase"); // 物料表 + String temperature_lose = SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("temperature_lose").getValue(); if (StrUtil.equals(option, "1")) { // 入箱 @@ -82,15 +86,18 @@ public class BakingServiceImpl implements BakingService { JSONObject jsonMap = new JSONObject(); jsonMap.put("flag", "1"); jsonMap.put("product_area", jsonPointZc.getString("product_area")); - jsonMap.put("temperature", temperature); + //获取温度幅度 + jsonMap.put("min_temperature", NumberUtil.sub(temperature, temperature_lose)); + jsonMap.put("max_temperature", NumberUtil.add(temperature, temperature_lose)); jsonMap.put("point_location", jsonPointZc.getString("point_location")); JSONObject jsonHotIvt = WQL.getWO("PDA_BAKING_01").addParamMap(jsonMap).process().uniqueResult(0); - if (ObjectUtil.isEmpty(jsonHotIvt)) throw new BadRequestException("烘烤区没有对应空位"); + if (ObjectUtil.isEmpty(jsonHotIvt)) throw new BadRequestException("烘烤区没有合适温度的空位!"); // 2.创建暂存位 --> 烘烤区任务 JSONObject param = new JSONObject(); param.put("type", "2"); // 1- 冷却区入烘箱 2- 暂存位入烘箱 param.put("point_code1", point_code1); param.put("point_code2", jsonHotIvt.getString("point_code")); + param.put("material_code", container_name); InHotTask inHotTask = new InHotTask(); String task_id = inHotTask.createTask(param); @@ -178,10 +185,11 @@ public class BakingServiceImpl implements BakingService { JSONObject jsonMap = new JSONObject(); jsonMap.put("flag", "1"); jsonMap.put("product_area", product_area); - jsonMap.put("temperature", temperature); + jsonMap.put("min_temperature", NumberUtil.sub(temperature, temperature_lose)); + jsonMap.put("max_temperature", NumberUtil.add(temperature, temperature_lose)); jsonMap.put("point_location", map.getString("point_location")); JSONObject jsonHotIvt = WQL.getWO("PDA_BAKING_01").addParamMap(jsonMap).process().uniqueResult(0); - if (ObjectUtil.isEmpty(jsonHotIvt)) throw new BadRequestException("烘烤区没有对应空位"); + if (ObjectUtil.isEmpty(jsonHotIvt)) throw new BadRequestException("烘烤区没有合适温度的空位"); // 3.创建冷却区 --> 烘烤区任务 JSONObject param = new JSONObject(); @@ -189,6 +197,7 @@ public class BakingServiceImpl implements BakingService { param.put("point_code1", point_code1); param.put("point_code2", point_code2); param.put("point_code3", jsonHotIvt.getString("point_code")); + param.put("material_code", container_name); // 创建冷却区 --> 暂存位的任务 InHotTask inHotTask = new InHotTask(); @@ -224,7 +233,8 @@ public class BakingServiceImpl implements BakingService { jsonCool.put("io_type", "1"); jsonCool.put("material_id", jsonMater.getString("material_id")); jsonCool.put("pcsn", container_name); - jsonCool.put("bill_status", "10"); + jsonCool.put("bill_status", "50"); + jsonCool.put("qty", jsonRaw.get("productin_qty")); jsonCool.put("task_id", task_id); jsonCool.put("qty_unit_id", jsonMater.getString("base_unit_id")); jsonCool.put("start_point_code", point_code1); @@ -249,11 +259,11 @@ public class BakingServiceImpl implements BakingService { if (ObjectUtil.isEmpty(jsonHotIvt)) throw new BadRequestException("对应烘箱点位不存在"); //查询该点位是否存在未完成的任务 - boolean have_task =new CutConveyorTask().isSingleTask(point_code1); - if (have_task){ + boolean have_task = new CutConveyorTask().isSingleTask(point_code1); + if (have_task) { throw new BadRequestException("该点位存在未完成的任务!"); } - if (StrUtil.isEmpty(jsonHotIvt.getString("container_name"))){ + if (StrUtil.isEmpty(jsonHotIvt.getString("container_name"))) { throw new BadRequestException("该点位不存在母卷!"); } // 1.查询暂存位有没有空位 @@ -400,6 +410,7 @@ public class BakingServiceImpl implements BakingService { jsonCool.put("material_id", jsonMater.getString("material_id")); jsonCool.put("pcsn", container_name); jsonCool.put("bill_status", "10"); + jsonCool.put("qty", jsonRaw.get("productin_qty")); jsonCool.put("qty_unit_id", jsonMater.get("base_unit_id")); jsonCool.put("task_id", task_id); jsonCool.put("start_point_code", point_code1); diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/impl/HandleBakingServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/impl/HandleBakingServiceImpl.java index 72e1e62f8..8b272c6b8 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/impl/HandleBakingServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/impl/HandleBakingServiceImpl.java @@ -9,6 +9,7 @@ import com.alibaba.fastjson.JSONObject; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.nl.modules.common.exception.BadRequestException; +import org.nl.modules.common.utils.SecurityUtils; import org.nl.modules.system.service.impl.ParamServiceImpl; import org.nl.modules.system.util.CodeUtil; import org.nl.modules.wql.WQL; @@ -64,24 +65,23 @@ public class HandleBakingServiceImpl implements HandleBakingService { String next_point_code = whereJson.getString("next_point_code"); // 终点 JSONObject cool_ivt = WQLObject.getWQLObject("st_ivt_coolpointivt").query("full_point_code = '" + point_code1 + "'").uniqueResult(0); + if(ObjectUtil.isEmpty(cool_ivt)){ + throw new BadRequestException("请扫描正确的冷却区满轴点位!"); + } String on_container_name = cool_ivt.getString("container_name"); if (!on_container_name.equals(container_name)) { - throw new BadRequestException("点位上子卷不符!"); + throw new BadRequestException("点位上母卷不符!"); } - Long currentUserId = 2L; - String currentUsername = "默认用户"; + Long currentUserId = SecurityUtils.getCurrentUserId(); + String nickName = SecurityUtils.getCurrentNickName(); JSONObject jsonRaw = rawTab.query("container_name = '" + container_name + "' and is_delete = '0'").uniqueResult(0); JSONObject jsonMater = materTab.query("material_code = '" + jsonRaw.getString("product_name") + "'").uniqueResult(0); if (ObjectUtil.isEmpty(jsonMater)) throw new BadRequestException("物料不存在"); if (StrUtil.equals(option, "1")) { - - if (ObjectUtil.isEmpty(container_name)) throw new BadRequestException("母卷号不能为空"); - if (ObjectUtil.isEmpty(temperature)) throw new BadRequestException("温度不能为空"); - if (ObjectUtil.isEmpty(hours)) throw new BadRequestException("时间不能为空"); if (ObjectUtil.isEmpty(point_code1)) throw new BadRequestException("起点不能为空!"); if (ObjectUtil.isEmpty(next_point_code)) throw new BadRequestException("终点不能为空"); @@ -95,17 +95,18 @@ public class HandleBakingServiceImpl implements HandleBakingService { jsonCool.put("pcsn", container_name); jsonCool.put("bill_status", "50"); jsonCool.put("qty_unit_id", jsonMater.getString("base_unit_id")); + jsonCool.put("qty", jsonRaw.get("productin_qty")); jsonCool.put("start_point_code", point_code1); jsonCool.put("end_point_code", next_point_code); jsonCool.put("create_mode", "03"); jsonCool.put("create_id", currentUserId); - jsonCool.put("create_name", currentUsername); + jsonCool.put("create_name", nickName); jsonCool.put("create_time", DateUtil.now()); jsonCool.put("update_optid", currentUserId); - jsonCool.put("update_optname", currentUsername); + jsonCool.put("update_optname", nickName); jsonCool.put("update_time", DateUtil.now()); jsonCool.put("confirm_optid", currentUserId); - jsonCool.put("confirm_optname", currentUsername); + jsonCool.put("confirm_optname", nickName); jsonCool.put("confirm_time", DateUtil.now()); coolTab.insert(jsonCool); @@ -118,13 +119,12 @@ public class HandleBakingServiceImpl implements HandleBakingService { jsonCoolIvt.put("ivt_qty", "0"); jsonCoolIvt.put("instorage_time", ""); jsonCoolIvt.put("update_optid", currentUserId); - jsonCoolIvt.put("update_optname", currentUsername); + jsonCoolIvt.put("update_optname", nickName); jsonCoolIvt.put("update_time", DateUtil.now()); coolIvtTab.update(jsonCoolIvt); //生成烘箱出入库表 - JSONObject hotParam = new JSONObject(); hotParam.put("container_name", container_name); hotParam.put("io_type", "0"); @@ -140,6 +140,9 @@ public class HandleBakingServiceImpl implements HandleBakingService { // 更新烘箱区库存状态 JSONObject jsonHotIvt = hosIvtTab.query("point_code = '" + next_point_code + "'").uniqueResult(0); + if (ObjectUtil.isEmpty(jsonHotIvt)){ + throw new BadRequestException("请扫描正确的烘箱点位!"); + } if (StrUtil.isNotEmpty(jsonHotIvt.getString("container_name"))) { throw new BadRequestException("目的点上存在母卷!"); } @@ -149,7 +152,7 @@ public class HandleBakingServiceImpl implements HandleBakingService { jsonHotIvt.put("ivt_qty", jsonRaw.getString("productin_qty")); jsonHotIvt.put("instorage_time", DateUtil.now()); jsonHotIvt.put("update_optid", currentUserId); - jsonHotIvt.put("update_optname", currentUsername); + jsonHotIvt.put("update_optname", nickName); jsonHotIvt.put("update_time", DateUtil.now()); hosIvtTab.update(jsonHotIvt); @@ -196,7 +199,7 @@ public class HandleBakingServiceImpl implements HandleBakingService { jsonHotIvt.put("ivt_qty", 0); jsonHotIvt.put("instorage_time", ""); jsonHotIvt.put("update_optid", currentUserId); - jsonHotIvt.put("update_optname", currentUsername); + jsonHotIvt.put("update_optname", nickName); jsonHotIvt.put("update_time", DateUtil.now()); hosIvtTab.update(jsonHotIvt); @@ -208,18 +211,19 @@ public class HandleBakingServiceImpl implements HandleBakingService { jsonCool.put("material_id", jsonMater.getString("material_id")); jsonCool.put("pcsn", container_name); jsonCool.put("bill_status", "10"); + jsonCool.put("qty", jsonRaw.get("productin_qty")); jsonCool.put("qty_unit_id", jsonMater.get("base_unit_id")); jsonCool.put("start_point_code", point_code1); jsonCool.put("end_point_code", next_point_code); jsonCool.put("create_mode", "03"); jsonCool.put("create_id", currentUserId); - jsonCool.put("create_name", currentUsername); + jsonCool.put("create_name", nickName); jsonCool.put("create_time", DateUtil.now()); jsonCool.put("update_optid", currentUserId); - jsonCool.put("update_optname", currentUsername); + jsonCool.put("update_optname", nickName); jsonCool.put("update_time", DateUtil.now()); jsonCool.put("confirm_optid", currentUserId); - jsonCool.put("confirm_optname", currentUsername); + jsonCool.put("confirm_optname", nickName); jsonCool.put("confirm_time", DateUtil.now()); coolTab.insert(jsonCool); @@ -306,6 +310,10 @@ public class HandleBakingServiceImpl implements HandleBakingService { /* * 创建烘箱区出入主表 */ + + Long currentUserId = SecurityUtils.getCurrentUserId(); + String nickName = SecurityUtils.getCurrentNickName(); + WQLObject hotMstTab = WQLObject.getWQLObject("ST_IVT_HotRegionIOMst"); // 烘箱区出入主表 JSONObject jsonHotMst = new JSONObject(); @@ -325,11 +333,11 @@ public class HandleBakingServiceImpl implements HandleBakingService { jsonHotMst.put("task_type", param.getString("task_type")); jsonHotMst.put("temperature", param.getString("temperature")); jsonHotMst.put("oven_time", param.getString("oven_time")); - jsonHotMst.put("create_id", 2); - jsonHotMst.put("create_name", "mes用户"); + jsonHotMst.put("create_id", currentUserId); + jsonHotMst.put("create_name", nickName); jsonHotMst.put("create_time", DateUtil.now()); - jsonHotMst.put("confirm_optid", 2); - jsonHotMst.put("confirm_optname", "mes用户"); + jsonHotMst.put("confirm_optid", currentUserId); + jsonHotMst.put("confirm_optname", nickName); jsonHotMst.put("confirm_time", DateUtil.now()); hotMstTab.insert(jsonHotMst); diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/impl/RawFoilServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/impl/RawFoilServiceImpl.java index 883d68dff..f6d010fd7 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/impl/RawFoilServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/impl/RawFoilServiceImpl.java @@ -255,7 +255,7 @@ public class RawFoilServiceImpl implements RawFoilService { //查询该生箔工单是否存在未完成的任务 String container_name = raw_jo.getString("container_name"); - JSONObject task_jo = WQLObject.getWQLObject("").query("material_code = '"+container_name+"' AND task_status < '07' AND is_delete = '0'").uniqueResult(0); + JSONObject task_jo = WQLObject.getWQLObject("sch_base_task").query("material_code = '"+container_name+"' AND task_status < '07' AND is_delete = '0'").uniqueResult(0); if (ObjectUtil.isNotEmpty(task_jo)){ throw new BadRequestException("该生箔工单存在未完成的任务,请先完成任务!"); } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/wql/PDA_BAKING_01.wql b/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/wql/PDA_BAKING_01.wql index 74b59b123..cc5f796db 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/wql/PDA_BAKING_01.wql +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/wql/PDA_BAKING_01.wql @@ -16,7 +16,8 @@ 输入.flag TYPEAS s_string 输入.product_area TYPEAS s_string 输入.point_location TYPEAS s_string - 输入.temperature TYPEAS s_string + 输入.min_temperature TYPEAS s_string + 输入.max_temperature TYPEAS s_string [临时表] @@ -70,8 +71,12 @@ ivt.point_location = 输入.point_location ENDOPTION - OPTION 输入.temperature <> "" - ivt.temperature = 输入.temperature + OPTION 输入.max_temperature <> "" + ivt.temperature <= 输入.max_temperature + ENDOPTION + + OPTION 输入.min_temperature <> "" + ivt.temperature >= 输入.min_temperature ENDOPTION order by ivt.point_code ASC diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pdm/service/impl/RawfoilworkorderServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/service/impl/RawfoilworkorderServiceImpl.java index c40069095..8aec20bc6 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pdm/service/impl/RawfoilworkorderServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/service/impl/RawfoilworkorderServiceImpl.java @@ -188,6 +188,14 @@ public class RawfoilworkorderServiceImpl implements RawfoilworkorderService { Long currentUserId = SecurityUtils.getCurrentUserId(); String currentUsername = SecurityUtils.getCurrentUsername(); + //查询该生箔工单是否存在未完成的任务 + String container_name = whereJson.getString("container_name"); + + JSONObject task_jo = WQLObject.getWQLObject("sch_base_task").query("material_code = '"+container_name+"' AND task_status < '07' AND is_delete = '0'").uniqueResult(0); + if (ObjectUtil.isNotEmpty(task_jo)){ + throw new BadRequestException("该生箔工单存在未完成的任务,请先完成任务!"); + } + WQLObject tab = WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder"); JSONObject json = tab.query("workorder_id = '" + workorder_id + "'").uniqueResult(0); diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoQueryDeviceStatus.java b/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoQueryDeviceStatus.java new file mode 100644 index 000000000..2384e0085 --- /dev/null +++ b/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoQueryDeviceStatus.java @@ -0,0 +1,29 @@ +package org.nl.wms.sch.manage; + + +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.nl.modules.wql.core.bean.WQLObject; +import org.nl.wms.ext.acs.service.WmsToAcsService; +import org.springframework.stereotype.Component; + +@Slf4j +@Component +@RequiredArgsConstructor +public class AutoQueryDeviceStatus{ + private final WmsToAcsService wmsToAcsService; + public void run() { + //通过ACS接口获取温度 + JSONObject jo = wmsToAcsService.getPointStatus(null); + JSONArray device_rows = jo.getJSONArray("device_rows"); + for (int i = 0; i < device_rows.size(); i++) { + JSONObject row = device_rows.getJSONObject(i); + String device_code = row.getString("device_code"); + JSONObject point_jo = WQLObject.getWQLObject("st_ivt_hotpointivt").query("point_code = '"+device_code+"'").uniqueResult(0); + point_jo.put("temperature",row.getString("temperature")); + WQLObject.getWQLObject("st_ivt_hotpointivt").update(point_jo); + } + } +} diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/InHotTask.java b/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/InHotTask.java index eb7527c9b..ee7827af5 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/InHotTask.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/InHotTask.java @@ -232,6 +232,7 @@ public class InHotTask extends AbstractAcsTask { json.put("sort_seq", "1"); json.put("handle_class", THIS_CLASS); json.put("create_id", currentUserId); + json.put("material_code",form.getString("material_code")); json.put("create_name", currentUsername); json.put("create_time", DateUtil.now()); json.put("priority", "1"); diff --git a/lms/nladmin-ui/src/views/wms/pdm/ivt/coolpointivt/coolregionio.vue b/lms/nladmin-ui/src/views/wms/pdm/ivt/coolpointivt/coolregionio.vue index 5922c66be..3d7477f97 100644 --- a/lms/nladmin-ui/src/views/wms/pdm/ivt/coolpointivt/coolregionio.vue +++ b/lms/nladmin-ui/src/views/wms/pdm/ivt/coolpointivt/coolregionio.vue @@ -147,7 +147,6 @@ {{ dict.label.io_type[scope.row.io_type] }} -