diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java index 4e82f83..21624fd 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java @@ -18,6 +18,7 @@ import org.nl.wms.basedata.service.dto.VehicleDto; import org.nl.wms.ext.acs.service.AcsToWmsService; import org.nl.wms.log.LokiLog; import org.nl.wms.log.LokiLogType; +import org.nl.wms.sch.manage.RegionEnum; import org.nl.wms.sch.manage.TaskStatusEnum; import org.nl.wms.sch.manage.WorkOrderEnum; import org.nl.wms.sch.service.TaskService; @@ -188,6 +189,59 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { if (ObjectUtil.isEmpty(type)) throw new BadRequestException("类型不能为空"); if (ObjectUtil.isEmpty(point_code)) throw new BadRequestException("点位不能为空"); + // 类型映射 + String regionId = WQLObject + .getWQLObject("sch_base_point") + .query("point_code = '" + point_code + "'") + .uniqueResult(0) + .getString("region_id"); + switch (type) { + case "1": + // 设备送料入库 + if (StrUtil.equals(regionId, RegionEnum.HNQ.getId())) { + type = "1"; + } else if (StrUtil.equals(regionId, RegionEnum.YZQ.getId())) { + type = "5"; + } else if (StrUtil.equals(regionId, RegionEnum.YQ.getId())) { + type = "8"; + } else if (StrUtil.equals(regionId, RegionEnum.ZDCDX.getId())) { + type = "11"; + } + break; + case "2": + // 设备叫料出库 + if (StrUtil.equals(regionId, RegionEnum.YZQ.getId())) { + type = "3"; + } else if (StrUtil.equals(regionId, RegionEnum.YQ.getId())) { + type = "7"; + } else if (StrUtil.equals(regionId, RegionEnum.ZDCDX.getId())) { + type = "9"; + } + break; + case "3": + // 设备送空托盘 + if (StrUtil.equals(regionId, RegionEnum.YZQ.getId())) { + type = "4"; + } else if (StrUtil.equals(regionId, RegionEnum.ZDCDX.getId())) { + type = "10"; + } else if (StrUtil.equals(regionId, RegionEnum.KGTDPQ.getId())) { + type = "13"; + } + break; + case "4": + // 设备叫空托盘 + if (StrUtil.equals(regionId, RegionEnum.HNQ.getId())) { + type = "2"; + } else if (StrUtil.equals(regionId, RegionEnum.YZQ.getId())) { + type = "6"; + } else if (StrUtil.equals(regionId, RegionEnum.ZDCDX.getId())) { + type = "12"; + } + break; + default: + throw new BadRequestException("ACS任务类型错误"); + } + // 参数统一获取 JSONObject param = new JSONObject(); param.put("vehicle_code", vehicle_code); @@ -197,19 +251,19 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { /* * 根据type判断是什么业务类型: - * 1.混碾机送料入库-困料货架 - * 2.混碾机呼叫空托盘 - * 3.压制机上料位叫料出库 - * 4.压制机上料位送空盅 - * 5.压制机满料入库 - * 6.压制机呼叫空钢托盘 - * 7.烧制叫料出库 - * 8.烧制送料入库 - * 9.分拣叫料出库 - * 10.分拣送空钢托盘 - * 11.分拣送料入库 - * 12.分拣呼叫木托盘 - * 13.叠盘区送空钢托盘 + * 1.混碾机送料入库-困料货架 + * 2.混碾机呼叫空托盘 + * 3.压制机上料位叫料出库 + * 4.压制机上料位送空盅 + * 5.压制机满料入库 + * 6.压制机呼叫空钢托盘 + * 7.烧制叫料出库 + * 8.烧制送料入库 + * 9.分拣叫料出库 + * 10.分拣送空钢托盘 + * 11.分拣送料入库 + * 12.分拣呼叫木托盘 + * 13.叠盘区送空钢托盘 */ switch (type) { case "1": @@ -395,6 +449,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { jsonObject.put("type", "5"); } this.apply(jsonObject); + jsonObject.put("type", "1"); + this.apply((JSONObject) jsonObject); } /** @@ -464,7 +520,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { //将起点终点确定不下发的任务查出来,将木托盘点位解锁,起点改为扫描点,is_auto_issue 改为1, String device_code = (String) jsonObject.get("device_code"); WQLObject task_Table = WQLObject.getWQLObject("SCH_BASE_Task"); - JSONObject taskObj = task_Table.query("task_status='" + TaskStatusEnum.START_AND_POINT.getCode() +"' and is_auto_issue='0'", "create_time desc").uniqueResult(0); + JSONObject taskObj = task_Table.query("task_status='" + TaskStatusEnum.START_AND_POINT.getCode() + "' and is_auto_issue='0'", "create_time desc").uniqueResult(0); String start_point_code = taskObj.getString("point_code1"); WQLObject pointTable = WQLObject.getWQLObject("sch_base_point"); JSONObject startObj = pointTable.query("point_code ='" + start_point_code + "'").uniqueResult(0); diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pda/sendvehicle/service/impl/SendVehicleServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/pda/sendvehicle/service/impl/SendVehicleServiceImpl.java index 6a0f17a..737fe0f 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pda/sendvehicle/service/impl/SendVehicleServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pda/sendvehicle/service/impl/SendVehicleServiceImpl.java @@ -9,7 +9,7 @@ import org.nl.modules.wql.WQL; import org.nl.modules.wql.core.bean.WQLObject; import org.nl.wms.ext.acs.service.AcsToWmsService; import org.nl.wms.pda.sendvehicle.service.SendVehicleService; -import org.nl.wms.sch.tasks.RegionTypeEnum; +import org.nl.wms.sch.manage.RegionTypeEnum; import org.springframework.stereotype.Service; diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/RegionEnum.java b/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/RegionEnum.java new file mode 100644 index 0000000..1120e52 --- /dev/null +++ b/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/RegionEnum.java @@ -0,0 +1,33 @@ +package org.nl.wms.sch.manage; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * 区域枚举类 + * + * @author 张江玮 + * @date 2022/11/22 16:16 + */ +@AllArgsConstructor +@Getter +public enum RegionEnum { + + KLHJ("1590223405414748160", "KLHJ", "困料货架"), + RYZCQ("1590223672247980032", "RYZCQ", "入窑暂存区"), + CYZCQ("1590223771673956352", "CYZCQ", "出窑暂存区"), + BZZCQ("1590223846013800448", "BZZCQ", "包装暂存区"), + HNQ("1590223931246252032", "HNQ", "混碾区"), + YZQ("1590223991732310016", "YZQ", "压制区"), + YYJLZJ("1590224119046213632", "YYJLZJ", "液压机料盅架"), + YQ("1590224197186097152", "YQ", "窑区域"), + KGTCPQ("1590224331051503616", "KGTCPQ", "空钢托拆盘区"), + ZDCDX("1590224431970652160", "ZDCDX", "自动拆垛线"), + RGCPQ("1590224498601365504", "RGCPQ", "人工拆盘区域"), + BZQ("1590224549646045184", "BZQ", "包装区"), + KGTDPQ("1590224679409422336", "KGTDPQ", "空钢托叠盘区"); + + private String id; + private String code; + private String name; +} diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/RegionTypeEnum.java b/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/RegionTypeEnum.java similarity index 97% rename from lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/RegionTypeEnum.java rename to lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/RegionTypeEnum.java index 21ce4b5..eba8a67 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/RegionTypeEnum.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/RegionTypeEnum.java @@ -1,4 +1,4 @@ -package org.nl.wms.sch.tasks; +package org.nl.wms.sch.manage; /** * 任务状态枚举 diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/callEmpty/HnCallEmptyVehicleTask.java b/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/callEmpty/HnCallEmptyVehicleTask.java index 899f0c8..35e0bc8 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/callEmpty/HnCallEmptyVehicleTask.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/callEmpty/HnCallEmptyVehicleTask.java @@ -1,7 +1,6 @@ package org.nl.wms.sch.tasks.callEmpty; import cn.hutool.core.date.DateUtil; -import cn.hutool.core.util.NumberUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import com.alibaba.fastjson.JSON; @@ -21,7 +20,6 @@ import org.nl.wms.sch.manage.TaskStatusEnum; import org.nl.wms.sch.manage.UpdateTaskStatusEnum; import org.nl.wms.sch.tasks.AcsTaskDto; import org.nl.wms.sch.tasks.PointUpdateUtil; -import org.nl.wms.sch.tasks.RegionTypeEnum; import org.springframework.stereotype.Service; import java.util.ArrayList; diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/sendEmpty/HtSendEmpVehicleTask.java b/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/sendEmpty/HtSendEmpVehicleTask.java index 34162d3..06c6e02 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/sendEmpty/HtSendEmpVehicleTask.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/sendEmpty/HtSendEmpVehicleTask.java @@ -16,7 +16,7 @@ import org.nl.wms.sch.SchTaskDto; import org.nl.wms.sch.manage.AbstractAcsTask; import org.nl.wms.sch.manage.TaskStatusEnum; import org.nl.wms.sch.tasks.AcsTaskDto; -import org.nl.wms.sch.tasks.RegionTypeEnum; +import org.nl.wms.sch.manage.RegionTypeEnum; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/sendEmpty/YqxSendEmpVehicleTask.java b/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/sendEmpty/YqxSendEmpVehicleTask.java index e7cc37c..8ba40e4 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/sendEmpty/YqxSendEmpVehicleTask.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/sendEmpty/YqxSendEmpVehicleTask.java @@ -16,7 +16,7 @@ import org.nl.wms.sch.SchTaskDto; import org.nl.wms.sch.manage.AbstractAcsTask; import org.nl.wms.sch.manage.TaskStatusEnum; import org.nl.wms.sch.tasks.AcsTaskDto; -import org.nl.wms.sch.tasks.RegionTypeEnum; +import org.nl.wms.sch.manage.RegionTypeEnum; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional;