From bffdc995c09a5d875461d0fc6c52d379565a54a4 Mon Sep 17 00:00:00 2001 From: liyongde <1419499670@qq.com> Date: Fri, 14 Apr 2023 10:57:12 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=A4=A7=E5=B1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/common/utils/PointUpdateUtil.java | 123 ++++++++++++++++++ .../wms/cockpit/rest/CockpitController.java | 22 ++-- .../wms/cockpit/service/CockpitService.java | 5 +- .../cockpit/service/dto/DeviceInfoDto.java | 76 +++++++++++ .../service/impl/CockpitServiceImpl.java | 92 ++++++++----- .../org/nl/wms/cockpit/wql/COCKPIT_DEVICE.wql | 63 ++++++--- .../nl/wms/cockpit/wql/COCKPIT_STORAGE.wql | 94 ++++++------- .../org/nl/wms/sch/manage/DeviceEnum.java | 61 +++++++++ .../nl/wms/sch/manage/DeviceStatusEnum.java | 28 ++++ 9 files changed, 456 insertions(+), 108 deletions(-) create mode 100644 lms/nladmin-system/src/main/java/org/nl/modules/common/utils/PointUpdateUtil.java create mode 100644 lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/dto/DeviceInfoDto.java create mode 100644 lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/DeviceEnum.java create mode 100644 lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/DeviceStatusEnum.java diff --git a/lms/nladmin-system/src/main/java/org/nl/modules/common/utils/PointUpdateUtil.java b/lms/nladmin-system/src/main/java/org/nl/modules/common/utils/PointUpdateUtil.java new file mode 100644 index 0000000..eb8924f --- /dev/null +++ b/lms/nladmin-system/src/main/java/org/nl/modules/common/utils/PointUpdateUtil.java @@ -0,0 +1,123 @@ +package org.nl.modules.common.utils; + +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.ObjectUtil; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import lombok.extern.slf4j.Slf4j; +import org.nl.modules.wql.core.bean.WQLObject; +import org.nl.wms.ext.acs.service.impl.WmsToAcsServiceImpl; +import org.nl.wms.sch.manage.DeviceStatusEnum; +import org.nl.wms.sch.manage.PointEnum; + +/** + * @author: lyd + * @description: 点位更新工具类 + * @Date: 2022/11/23 + */ +@Slf4j +public class PointUpdateUtil { + /** + * 清理点位 + */ + public static void clearPoint(String point_code) { + WQLObject pointTab = WQLObject.getWQLObject("sch_base_point"); + JSONObject pointObj = pointTab.query("point_code = '" + point_code + "'").uniqueResult(0); + pointObj.put("point_status", PointEnum.POINT_STATUS_EMPTY_POSITION.getCode()); + pointObj.put("lock_type", PointEnum.LOCK_TYPE_FALSE.getCode()); + pointObj.put("vehicle_type", ""); + pointObj.put("vehicle_code", ""); + pointObj.put("vehicle_qty", "0"); + pointObj.put("material_id", ""); + pointObj.put("pcsn", ""); + pointObj.put("ivt_qty", "0"); + pointObj.put("qty_unit_id", ""); + pointObj.put("ivt_weight", "0"); + pointObj.put("weight_unit_id", ""); + pointObj.put("instorage_time", ""); + pointObj.put("is_full", "0"); + pointObj.put("standing_time", "0"); + pointObj.put("warn_time", "0"); + pointObj.put("group_id", ""); + pointTab.update(pointObj); + } + + /** + * 点位:空载具 + */ + public static void setVehicle(JSONObject jsonObject) { + WQLObject pointTab = WQLObject.getWQLObject("sch_base_point"); + JSONObject pointObj = pointTab.query("point_code = '" + jsonObject.getString("point_code") + "'").uniqueResult(0); + pointObj.put("lock_type", PointEnum.LOCK_TYPE_FALSE.getCode()); + pointObj.put("point_status", PointEnum.POINT_STATUS_EMPTY_VEHICLE.getCode()); + pointObj.put("vehicle_code", jsonObject.getString("vehicle_code")); + pointObj.put("vehicle_qty", "1"); + pointObj.put("instorage_time", DateUtil.now()); + pointObj.put("is_full", "1"); + pointObj.put("ivt_qty", "0"); + pointObj.put("pcsn", null); + pointObj.put("material_id", null); + pointObj.put("standing_time", "0"); + pointTab.update(pointObj); + } + + /** + * 访问acs获取点位数据更新点位信息: + * 分拣呼叫空托盘、空钢托盘叠盘架 + * @param pointCodes + * @deprecated 只更新点位状态和载具类型 + */ + public static void updatePoint(JSONArray pointCodes) { + WQLObject pointTable = WQLObject.getWQLObject("sch_base_point"); + WmsToAcsServiceImpl wmsToAcsService = new WmsToAcsServiceImpl(); + // 向ACS查询点位状态 + JSONObject pointStatus = wmsToAcsService.getPointStatus(pointCodes); + // 找到对应的载具类型再去下发 + JSONArray deviceDatas = pointStatus.getJSONArray("data"); + if (ObjectUtil.isNotEmpty(deviceDatas)) { + for (int j = 0; j < deviceDatas.size(); j++) { + JSONObject pointObj = deviceDatas.getJSONObject(j); + String point_code = pointObj.getString("device_code"); + String mode = pointObj.getString("mode"); // 工作状态:0脱机,其他正常 + String error = pointObj.getString("error"); // 0是正常 + String point_status = pointObj.getString("move"); // 点位状态:0无货,1有货(具体是空载具还是物料不知道) + //将托盘类型456.... + String vehicle_type = pointObj.getString("container_type"); + if (mode.equals("0") || !error.equals("0")) { + // 点位异常 + vehicle_type = ""; + point_status = "0"; + if (point_code.startsWith("BZX")) point_status = "1"; + } + JSONObject pointObj2 = pointTable.query("point_code = '" + point_code + "'").uniqueResult(0); + pointObj2.put("point_status", Integer.parseInt(point_status) + 1); // 1空位, 2空载具 + pointObj2.put("vehicle_type", vehicle_type); + pointTable.update(pointObj2); + } + } + } + + /** + * 查找设备状态: 单个 + * @return + */ + public static String getDeviceStatus(String deviceCode) { + WmsToAcsServiceImpl wmsToAcsService = new WmsToAcsServiceImpl(); + // 封装 + JSONArray devices = new JSONArray(); + JSONObject device = new JSONObject(); + device.put("device_code", deviceCode); + devices.add(device); + // 向ACS查询点位状态 + JSONObject deviceStatus = wmsToAcsService.getPointStatus(devices); + JSONArray statusJSONArray = deviceStatus.getJSONArray("data"); + if (ObjectUtil.isEmpty(statusJSONArray)) return DeviceStatusEnum.SHUTDOWN.getCode(); + JSONObject deviceJson = statusJSONArray.getJSONObject(0); + String point_code = deviceJson.getString("device_code"); + String mode = deviceJson.getString("mode"); // 工作状态:0脱机,其他正常 + String error = deviceJson.getString("error"); // 0是正常 + log.info("device_code: " + point_code + ", mode: " + mode + ", error: " + error); + if (!error.equals("0")) return DeviceStatusEnum.FAILURE.getCode(); + return mode.equals("0") ? DeviceStatusEnum.STANDBY.getCode() : DeviceStatusEnum.RUNNING.getCode(); + } +} diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/rest/CockpitController.java b/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/rest/CockpitController.java index 0dc2fb5..b0c5879 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/rest/CockpitController.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/rest/CockpitController.java @@ -1,26 +1,30 @@ package org.nl.wms.cockpit.rest; import cn.dev33.satoken.annotation.SaIgnore; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.nl.modules.common.api.CommonResult; import org.nl.modules.common.api.RestBusinessTemplate; import org.nl.modules.common.api.ResultCode; import org.nl.modules.common.exception.BizCoreException; +import org.nl.modules.logging.annotation.Log; import org.nl.wms.cockpit.service.CockpitService; import org.nl.wms.cockpit.service.dto.DeviceDetailDto; -import org.nl.wms.cockpit.service.dto.DeviceStatusDto; -import lombok.RequiredArgsConstructor; -import org.nl.modules.logging.annotation.Log; +import org.nl.wms.cockpit.service.dto.DeviceInfoDto; import org.nl.wms.cockpit.service.dto.SchBasePointDto; -import org.springframework.web.bind.annotation.*; -import io.swagger.annotations.*; -import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; import java.util.List; import java.util.Map; /** - * 大屏数据 + * 大屏数据1 * * @author gbx * @since 2023/2/27 @@ -30,7 +34,6 @@ import java.util.Map; @Api(tags = "大屏数据") @RequestMapping("/api/cockpit") @Slf4j -@SaIgnore public class CockpitController{ private final CockpitService cockpitService; @@ -72,10 +75,11 @@ public class CockpitController{ /** * 设备监控 */ + @SaIgnore @PostMapping("/deviceMonitor") @Log("设备监控") @ApiOperation("设备监控") - public CommonResult> deviceMonitor() { + public CommonResult> deviceMonitor() { return RestBusinessTemplate.execute(cockpitService::deviceMonitor); } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/CockpitService.java b/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/CockpitService.java index 24f4f02..54e544f 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/CockpitService.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/CockpitService.java @@ -1,6 +1,7 @@ package org.nl.wms.cockpit.service; import org.nl.wms.cockpit.service.dto.DeviceDetailDto; +import org.nl.wms.cockpit.service.dto.DeviceInfoDto; import org.nl.wms.cockpit.service.dto.DeviceStatusDto; import org.nl.wms.cockpit.service.dto.SchBasePointDto; @@ -9,7 +10,7 @@ import java.util.Map; import java.util.concurrent.ConcurrentHashMap; /** - * 大屏服务接口 + * 大屏服务接口1 * * @author gbx * @date 2023-02-27 @@ -42,7 +43,7 @@ public interface CockpitService{ * * @return 返回结果集 */ - List deviceMonitor(); + List deviceMonitor(); /** * 根据point_id获取设备信息 diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/dto/DeviceInfoDto.java b/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/dto/DeviceInfoDto.java new file mode 100644 index 0000000..680430a --- /dev/null +++ b/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/dto/DeviceInfoDto.java @@ -0,0 +1,76 @@ +package org.nl.wms.cockpit.service.dto; + +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.math.BigDecimal; + +/** + * @Author: lyd + * @Description: 设备信息数据 + * @Date: 2023/3/8 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class DeviceInfoDto implements Serializable { + /** + * 设备编码 + */ + private String device_code; + /** + * 设备名称 + */ + private String device_name; + /** + * 设备类型 + */ + private String device_model; + /** + * 设备状态枚举: 0关机(停机),1开机(运行),2故障 + */ + private String device_status; + /** + * 设备状态:RGV + */ + @Builder.Default + private String device_status_name = null; + /** + * 当前生产名称 + */ + private String material_name; + /** + * 已工作时间 + */ + @Builder.Default + private String work_time = "0"; + /** + * 已生产数量 + */ + private BigDecimal real_qty; + /** + * 生产时间 + */ + private String realproducestart_date; + /** + * 载具数量(当前窑车数) + */ + private Integer vehicle_qty; + /** + * 载具类型 + */ + private String vehicle_type; + /** + * 容量 + */ + private Integer vehicle_max_qty; + /** + * 图片名字 + */ + private String device_url; +} diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/impl/CockpitServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/impl/CockpitServiceImpl.java index 402f036..93b68da 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/impl/CockpitServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/impl/CockpitServiceImpl.java @@ -1,30 +1,36 @@ package org.nl.wms.cockpit.service.impl; -import cn.hutool.core.date.DatePattern; -import cn.hutool.core.date.DateTime; -import cn.hutool.core.date.DateUnit; +import cn.hutool.core.date.*; +import cn.hutool.core.util.ObjectUtil; +import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.nl.config.thread.ThreadPoolExecutorUtil; +import org.nl.modules.common.utils.PointUpdateUtil; import org.nl.modules.common.utils.enums.IsOrNotEnum; -import org.nl.modules.common.utils.enums.PointStatusEnum; import org.nl.modules.common.utils.enums.ProductionStatisticsEnum; import org.nl.modules.wql.WQL; import org.nl.wms.cockpit.service.CockpitService; import org.nl.wms.cockpit.service.dto.*; +import org.nl.wms.sch.manage.DeviceEnum; +import org.nl.wms.sch.manage.PointEnum; import org.springframework.stereotype.Service; -import java.util.*; -import java.util.concurrent.*; - -import cn.hutool.core.date.DateUtil; -import com.alibaba.fastjson.JSONArray; -import lombok.extern.slf4j.Slf4j; -import cn.hutool.core.util.ObjectUtil; +import java.time.Duration; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.CopyOnWriteArrayList; +import java.util.concurrent.ThreadPoolExecutor; /** - * 大屏服务实现 + * 大屏服务实现1 * * @author gbx * @date 2023-02-27 @@ -33,6 +39,7 @@ import cn.hutool.core.util.ObjectUtil; @RequiredArgsConstructor @Slf4j public class CockpitServiceImpl implements CockpitService{ + /** * 生产统计大屏 * @@ -114,6 +121,7 @@ public class CockpitServiceImpl implements CockpitService{ // 1、获取原料仓储信息 CompletableFuture> materialStorage = CompletableFuture.supplyAsync(() -> { List res = new CopyOnWriteArrayList<>(); + // 查找所有困料货架 JSONArray result = WQL.getWO("COCKPIT_STORAGE").addParam("flag", "1").process().getResultJSONArray(0); if(ObjectUtil.isNotEmpty(result)) { res = result.toJavaList(SchBasePointDto.class); @@ -143,7 +151,7 @@ public class CockpitServiceImpl implements CockpitService{ // 2、获取成品仓储信息 CompletableFuture> finishedStorage = CompletableFuture.supplyAsync(() -> { List res = new CopyOnWriteArrayList<>(); - JSONArray result = WQL.getWO("COCKPIT_STORAGE").addParam("flag", "1").process().getResultJSONArray(0); + JSONArray result = WQL.getWO("COCKPIT_STORAGE").addParam("flag", "2").process().getResultJSONArray(0); if(ObjectUtil.isNotEmpty(result)) { res = result.toJavaList(SchBasePointDto.class); } @@ -193,22 +201,44 @@ public class CockpitServiceImpl implements CockpitService{ * @since 2023/2/28 */ @Override - public List deviceMonitor() { - List res; - JSONArray result = WQL.getWO("COCKPIT_DEVICE").addParam("flag", "1").process().getResultJSONArray(0); + public List deviceMonitor() { + List res; + ConcurrentHashMap> map = new ConcurrentHashMap<>(); + JSONArray result = WQL.getWO("COCKPIT_DEVICE").addParam("flag", "3").process().getResultJSONArray(0); if(ObjectUtil.isNotEmpty(result)) { - res = result.toJavaList(DeviceStatusDto.class); - //已工作时间 - res.forEach(r -> { - //Todo 设备运行时间和图标相关暂为固定值,逻辑待完善 - //设备运行时间 - r.setWork_time("3.5"); - //设备监控图标 - r.setDevice_url("ylj"); - //设备运行状态 - if(StringUtils.isNotEmpty(r.getPoint_status())) { - r.setPoint_status_name(PointStatusEnum.getName(r.getPoint_status())); + res = result.toJavaList(DeviceInfoDto.class); + res.forEach(d -> { + if (ObjectUtil.isNotEmpty(d.getRealproducestart_date())) { + // 如果时间存在 + LocalDateTime dateTime = LocalDateTimeUtil.parse(d.getRealproducestart_date().replace(" ", "T")); + LocalDateTime now = LocalDateTime.now(); + Duration duration = Duration.between(dateTime, now); + d.setWork_time(duration.toHours() + ""); } + // 设备状态 + d.setDevice_status(PointUpdateUtil.getDeviceStatus(d.getDevice_code())); + DeviceEnum deviceEnum = DeviceEnum.get(d.getDevice_model(), d.getDevice_code()); + // 添加图片名字 + d.setDevice_url(deviceEnum.getPictureName()); + // todo: 区分窑与其他设备 + if (d.getDevice_model().equals(DeviceEnum.YAO.getModel())) { + d.setVehicle_qty(15); + d.setVehicle_max_qty(20); + } + // todo: RGV + if (d.getDevice_model().equals(DeviceEnum.RGV.getModel())) { + d.setDevice_status_name("空位无车,满位有车"); + } + // todo: 包装机、碟盘机 + // 分类链表 +// if (ObjectUtil.isEmpty(map.get(deviceEnum.getKeyName()))) { +// List de = new ArrayList<>(); +// de.add(d); +// map.put(deviceEnum.getKeyName(), de); +// } else { +// map.get(deviceEnum.getKeyName()).add(d); +// map.put(deviceEnum.getKeyName(), map.get(deviceEnum.getKeyName())); +// } }); return res; } @@ -281,9 +311,8 @@ public class CockpitServiceImpl implements CockpitService{ runningStatusList.add(DeviceStatisticsDto.builder().workorder_procedure("包装").deviceQty(9).faultyDevice(3).build()); //近一个月故障次数 List faultyStatusList = new ArrayList<>(); - faultyStatusList.add(DeviceStatisticsDto.builder().deviceName("压制机4").faultyFrequency(90).build()); - faultyStatusList.add(DeviceStatisticsDto.builder().deviceName("压制机9").faultyFrequency(85).build()); - faultyStatusList.add(DeviceStatisticsDto.builder().deviceName("压制机11").faultyFrequency(83).build()); + faultyStatusList.add(DeviceStatisticsDto.builder().deviceName("压制机4").faultyFrequency(91).build()); + faultyStatusList.add(DeviceStatisticsDto.builder().deviceName("压制机9").faultyFrequency(82).build()); faultyStatusList.add(DeviceStatisticsDto.builder().deviceName("混料机5").faultyFrequency(71).build()); faultyStatusList.add(DeviceStatisticsDto.builder().deviceName("压制机3").faultyFrequency(33).build()); //最近5个故障设备 @@ -333,6 +362,9 @@ public class CockpitServiceImpl implements CockpitService{ else{ schBasePointDto.setStanding_status("静置完成"); } + if (schBasePointDto.getPoint_status().equals(PointEnum.POINT_STATUS_EMPTY_POSITION.getCode())) { + schBasePointDto.setPoint_status("空盅"); + } } } } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/wql/COCKPIT_DEVICE.wql b/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/wql/COCKPIT_DEVICE.wql index b3f2be4..d4dd086 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/wql/COCKPIT_DEVICE.wql +++ b/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/wql/COCKPIT_DEVICE.wql @@ -40,28 +40,51 @@ ########################################## IF 输入.flag = "1" - PAGEQUERY + PAGEQUERY + SELECT point.*, material.material_name + FROM sch_base_point point + LEFT JOIN md_me_materialbase material ON material.material_id = point.material_id + WHERE + region_code IN ( 'ZDCDX', 'YZQ', 'YZQ', 'YQ', 'HNQ', 'BZQ' ) + AND point_code NOT IN ( 'RGCLW01', 'RGCLW02', 'RGCLW03', 'RGCLW04' ) + ORDER BY + region_id + ENDSELECT + ENDPAGEQUERY + ENDIF + + IF 输入.flag = "2" + PAGEQUERY SELECT point.*, material.material_name FROM sch_base_point point LEFT JOIN md_me_materialbase material ON material.material_id = point.material_id + WHERE 1=1 + OPTION 输入.point_id <> "" + point.point_id = 输入.point_id + ENDOPTION + ENDSELECT + ENDPAGEQUERY + ENDIF + + IF 输入.flag = "3" + PAGEQUERY + SELECT + d.device_code, + d.device_name, + d.device_model, + w.real_qty, + w.realproducestart_date, + IF(NULLIF(m.material_name, '') IS NULL, '-', m.material_name) as material_name + FROM + `pdm_bi_device` d + LEFT JOIN pdm_bd_workorder w ON ( d.device_code = w.device_code + OR d.extend_code = w.device_code ) AND w.order_status <> '5' + LEFT JOIN md_me_materialbase m ON w.material_id = m.material_id WHERE - region_code IN ( 'ZDCDX', 'YZQ', 'YZQ', 'YQ', 'HNQ', 'BZQ' ) - AND point_code NOT IN ( 'RGCLW01', 'RGCLW02', 'RGCLW03', 'RGCLW04' ) + d.is_used = '1' ORDER BY - region_id - ENDSELECT - ENDPAGEQUERY - ENDIF - - IF 输入.flag = "2" - PAGEQUERY - SELECT point.*, material.material_name - FROM sch_base_point point - LEFT JOIN md_me_materialbase material ON material.material_id = point.material_id - WHERE 1=1 - OPTION 输入.point_id <> "" - point.point_id = 输入.point_id - ENDOPTION - ENDSELECT - ENDPAGEQUERY - ENDIF + d.device_model, + d.device_code + ENDSELECT + ENDPAGEQUERY + ENDIF diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/wql/COCKPIT_STORAGE.wql b/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/wql/COCKPIT_STORAGE.wql index 7ce8b35..9dee616 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/wql/COCKPIT_STORAGE.wql +++ b/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/wql/COCKPIT_STORAGE.wql @@ -39,56 +39,56 @@ ########################################## IF 输入.flag = "1" - PAGEQUERY - SELECT - material.material_code, - material.material_name, - point.* - FROM - sch_base_point point - LEFT JOIN md_me_materialbase material ON material.material_id = point.material_id - WHERE - point.region_code = 'KLHJ' - ORDER BY - point.create_time DESC - ENDSELECT - ENDPAGEQUERY - ENDIF + PAGEQUERY + SELECT + material.material_code, + material.material_name, + point.* + FROM + sch_base_point point + LEFT JOIN md_me_materialbase material ON material.material_id = point.material_id + WHERE + point.region_code = 'KLHJ' + ORDER BY + point.point_code DESC + ENDSELECT + ENDPAGEQUERY + ENDIF IF 输入.flag = "2" - PAGEQUERY - SELECT - material.material_code, - material.material_name, - point.* - FROM - sch_base_point point - LEFT JOIN md_me_materialbase material ON material.material_id = point.material_id - WHERE - point.region_code = 'CYZCQ' - ORDER BY - point.create_time DESC - ENDSELECT - ENDPAGEQUERY - ENDIF + PAGEQUERY + SELECT + material.material_code, + material.material_name, + point.* + FROM + sch_base_point point + LEFT JOIN md_me_materialbase material ON material.material_id = point.material_id + WHERE + point.region_code = 'CYZCQ' + ORDER BY + point.create_time DESC + ENDSELECT + ENDPAGEQUERY + ENDIF IF 输入.flag = "3" - PAGEQUERY - SELECT - material.material_code, - material.material_name, - point.* - FROM - sch_base_point point - LEFT JOIN md_me_materialbase material ON material.material_id = point.material_id - WHERE 1=1 - OPTION 输入.point_id <> "" - point.point_id = 输入.point_id - ENDOPTION - ORDER BY - point.create_time DESC - ENDSELECT - ENDPAGEQUERY - ENDIF + PAGEQUERY + SELECT + material.material_code, + material.material_name, + point.* + FROM + sch_base_point point + LEFT JOIN md_me_materialbase material ON material.material_id = point.material_id + WHERE 1=1 + OPTION 输入.point_id <> "" + point.point_id = 输入.point_id + ENDOPTION + ORDER BY + point.create_time DESC + ENDSELECT + ENDPAGEQUERY + ENDIF diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/DeviceEnum.java b/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/DeviceEnum.java new file mode 100644 index 0000000..5845754 --- /dev/null +++ b/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/DeviceEnum.java @@ -0,0 +1,61 @@ +package org.nl.wms.sch.manage; + +import cn.hutool.core.util.StrUtil; + +/** + * @Author: lyd + * @Description: 设备枚举 + * @Date: 2023/3/9 + */ +public enum DeviceEnum { + HLJ("1", "混料机", "HLJ", "HLJ"), + HLJ_S("2", "高速混料机", "HLJ_S", "HLJ_S"), + YZJ("3", "压制机", "YZJ", "YZJ"), + YZJ_S("4", "高速压制机", "YZJ_S", "YZJ_S"), + FJJXS("5", "分拣机械手", "FJJXS", "FJJXS"), + CPX("6", "拆盘线", "CPX", "CPX"), + BZX("6", "包装线", "BZX", "BZX"), + YAO("7", "窑设备", "YAO", "YAO"), + DPJ("8", "叠盘架", "DPJ", "DPJ"), + CPJ("9", "拆盘架", "CPJ", "CPJ"), + MDJXS("10", "码垛机械手", "MDJXS", "MDJXS"), + RGV("11", "RGV", "RGV", "RGV"); + + private final String model; + private final String name; + private final String keyName; + private final String pictureName; + + DeviceEnum(String model, String name, String keyName, String pictureName) { + this.model = model; + this.name = name; + this.keyName = keyName; + this.pictureName = pictureName; + } + + public static DeviceEnum get(String model, String code) { + for (DeviceEnum deviceEnum : DeviceEnum.values()) { + if (code.equals(BZX.pictureName)) return BZX; + if (StrUtil.equals(deviceEnum.model, model)) { + return deviceEnum; + } + } + return null; + } + + public String getModel() { + return model; + } + + public String getName() { + return name; + } + + public String getKeyName() { + return keyName; + } + + public String getPictureName() { + return pictureName; + } +} diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/DeviceStatusEnum.java b/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/DeviceStatusEnum.java new file mode 100644 index 0000000..b924a0e --- /dev/null +++ b/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/DeviceStatusEnum.java @@ -0,0 +1,28 @@ +package org.nl.wms.sch.manage; + +/** + * @Author: lyd + * @Description: 设备状态枚举 + * @Date: 2023/3/10 + */ +public enum DeviceStatusEnum { + STANDBY("1", "待机"), + RUNNING("2", "运行"), + FAILURE("3", "故障"), + SHUTDOWN("4", "关机"); + private final String code; + private final String description; + + DeviceStatusEnum(String code, String description) { + this.code = code; + this.description = description; + } + + public String getCode() { + return code; + } + + public String getDescription() { + return description; + } +}