From 65572b6ebb85cd80921ca76e7760b00735c43bd4 Mon Sep 17 00:00:00 2001 From: baoge <751575283@qq.com> Date: Thu, 2 Mar 2023 11:33:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E5=A4=A7=E5=B1=8F=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E7=94=9F=E4=BA=A7=E7=BB=9F=E8=AE=A1=EF=BC=8C=20?= =?UTF-8?q?=E8=AE=BE=E5=A4=87=E6=83=85=E5=86=B5=EF=BC=8C=20=E4=BB=93?= =?UTF-8?q?=E5=82=A8=E6=83=85=E5=86=B5=EF=BC=8C=20=E8=BD=A6=E9=97=B4?= =?UTF-8?q?=E6=83=85=E5=86=B5=E7=9B=B8=E5=85=B3=E9=80=BB=E8=BE=91=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/utils/enums/IsOrNotEnum.java | 57 ++++++ .../common/utils/enums/PointStatusEnum.java | 58 ++++++ .../wms/cockpit/rest/CockpitController.java | 25 ++- .../wms/cockpit/service/CockpitService.java | 23 ++- .../cockpit/service/dto/DeviceDetailDto.java | 122 ++++++++++++ .../service/dto/DeviceStatisticsDto.java | 60 ++++++ .../cockpit/service/dto/DeviceStatusDto.java | 73 +++++++ .../service/dto/ProductionInfoDto.java | 48 +++++ .../service/dto/ProductionStatisticsDto.java | 41 ++-- .../cockpit/service/dto/SchBasePointDto.java | 167 ++-------------- .../wms/cockpit/service/dto/WorkorderDto.java | 93 ++------- .../service/impl/CockpitServiceImpl.java | 179 ++++++++++++++---- .../org/nl/wms/cockpit/wql/COCKPIT_DEVICE.wql | 32 +++- .../nl/wms/cockpit/wql/COCKPIT_PRODUCTION.wql | 22 ++- .../nl/wms/cockpit/wql/COCKPIT_WORKSHOP.wql | 7 - 15 files changed, 688 insertions(+), 319 deletions(-) create mode 100644 lms/nladmin-system/src/main/java/org/nl/modules/common/utils/enums/IsOrNotEnum.java create mode 100644 lms/nladmin-system/src/main/java/org/nl/modules/common/utils/enums/PointStatusEnum.java create mode 100644 lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/dto/DeviceDetailDto.java create mode 100644 lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/dto/DeviceStatisticsDto.java create mode 100644 lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/dto/DeviceStatusDto.java create mode 100644 lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/dto/ProductionInfoDto.java diff --git a/lms/nladmin-system/src/main/java/org/nl/modules/common/utils/enums/IsOrNotEnum.java b/lms/nladmin-system/src/main/java/org/nl/modules/common/utils/enums/IsOrNotEnum.java new file mode 100644 index 0000000..8651ad0 --- /dev/null +++ b/lms/nladmin-system/src/main/java/org/nl/modules/common/utils/enums/IsOrNotEnum.java @@ -0,0 +1,57 @@ +package org.nl.modules.common.utils.enums; + +import lombok.Getter; + +/** + * @author gbx + * 是否枚举 + * @since 2023-03-01 + */ +@Getter +public enum IsOrNotEnum{ + /** + * true + */ + YES("否", "0"), + /** + * false + */ + NO("是", "1"); + private String name; + private String index; + + IsOrNotEnum(String name, String index) { + this.name = name; + this.index = index; + } + + public static String getName(String index) { + for(IsOrNotEnum c : IsOrNotEnum.values()) { + if(c.getIndex().equals(index)) { + return c.name; + } + } + return null; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getIndex() { + return index; + } + + public void setIndex(String index) { + this.index = index; + } + + @Override + public String toString() { + return this.index + "_" + this.name; + } +} diff --git a/lms/nladmin-system/src/main/java/org/nl/modules/common/utils/enums/PointStatusEnum.java b/lms/nladmin-system/src/main/java/org/nl/modules/common/utils/enums/PointStatusEnum.java new file mode 100644 index 0000000..04dae52 --- /dev/null +++ b/lms/nladmin-system/src/main/java/org/nl/modules/common/utils/enums/PointStatusEnum.java @@ -0,0 +1,58 @@ +package org.nl.modules.common.utils.enums; + +/** + * @author gbx + * 设备状态枚举 + * @since 2023-03-01 + */ +public enum PointStatusEnum{ + /** + * 运行 + */ + RUN("运行", "1"), + /** + * 暂停 + */ + STOP("暂停", "2"), + /** + * 故障 + */ + FAULT("故障", "3"); + private String name; + private String index; + + PointStatusEnum(String name, String index) { + this.name = name; + this.index = index; + } + + public static String getName(String index) { + for(PointStatusEnum c : PointStatusEnum.values()) { + if(c.getIndex().equals(index)) { + return c.name; + } + } + return null; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getIndex() { + return index; + } + + public void setIndex(String index) { + this.index = index; + } + + @Override + public String toString() { + return this.index + "_" + this.name; + } +} 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 0abb4ae..9ea7c5f 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,17 +1,19 @@ package org.nl.wms.cockpit.rest; +import org.nl.modules.common.exception.BadRequestException; import org.nl.wms.cockpit.service.CockpitService; -import org.nl.wms.cockpit.service.dto.WorkorderDto; -import org.springframework.data.domain.Pageable; +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.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; -import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import io.swagger.annotations.*; import lombok.extern.slf4j.Slf4j; +import java.util.List; + /** * 大屏数据 * @@ -52,12 +54,25 @@ public class CockpitController{ @GetMapping("/deviceMonitor") @Log("设备监控") @ApiOperation("设备监控") - public ResponseEntity deviceMonitor() { + public ResponseEntity> deviceMonitor() { return new ResponseEntity<>(cockpitService.deviceMonitor(), HttpStatus.OK); } /** - * 车间情况 + * 根据点位id获取设备信息 + */ + @GetMapping("/findDeviceById/{id}") + @Log("根据点位id获取设备信息") + @ApiOperation("根据点位id获取设备信息") + public ResponseEntity findDeviceById(@PathVariable String id) { + if(null == id) { + throw new BadRequestException("更新定时任务失败"); + } + return new ResponseEntity<>(cockpitService.findDeviceById(id), HttpStatus.OK); + } + + /** + * 車间情况 */ @GetMapping("/workshopCondition") @Log("车间情况") 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 78fd99a..828183d 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,10 +1,10 @@ package org.nl.wms.cockpit.service; -import org.nl.wms.cockpit.service.dto.WorkorderDto; -import org.springframework.data.domain.Pageable; +import org.nl.wms.cockpit.service.dto.DeviceDetailDto; +import org.nl.wms.cockpit.service.dto.DeviceStatusDto; -import java.util.Map; import java.util.List; +import java.util.Map; import java.util.concurrent.ConcurrentHashMap; /** @@ -16,21 +16,32 @@ import java.util.concurrent.ConcurrentHashMap; public interface CockpitService{ /** * 生产统计 + * @return 返回统计结果集 */ ConcurrentHashMap productionStatistics(); /** * 仓储监控 + * @return 返回统计结果集 */ ConcurrentHashMap storageMonitor(); /** * 设备监控 + * @return 返回统计结果集 + */ + List deviceMonitor(); + + /** + * 根据point_id获取设备信息 + * @param id 点位id + * @return 返回统计结果集 */ - ConcurrentHashMap deviceMonitor(); + DeviceDetailDto findDeviceById(String id); /** - * 车间情况 + * 車间情况 + * @return 返回统计结果集 */ - ConcurrentHashMap workshopCondition(); + Map workshopCondition(); } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/dto/DeviceDetailDto.java b/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/dto/DeviceDetailDto.java new file mode 100644 index 0000000..a9f1720 --- /dev/null +++ b/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/dto/DeviceDetailDto.java @@ -0,0 +1,122 @@ +package org.nl.wms.cockpit.service.dto; + +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; + +/** + * @author gbx + * 设备状态 + * @date 2023-03-01 + **/ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class DeviceDetailDto extends DeviceStatusDto{ + /** + * 混碾机,压力机,窑外层弹出框已生产数量 + */ + @ApiModelProperty(value = "/**已生产数量*/") + private String real_qty; + /** + * 载具 + */ + @ApiModelProperty(value = "/**载具*/") + private String vehicle_code; + /** + * 入库时间 + */ + @ApiModelProperty(value = "/**入库时间*/") + private String instorage_time; + /** + * 搬运托盘数 + */ + @ApiModelProperty(value = "/**搬运托盘数*/") + private String pallet_qty; + /** + * 搬入准备车道 + */ + @ApiModelProperty(value = "/**搬入准备车道*/") + private String ready_lane; + /** + * 窑1窑车数 + */ + @ApiModelProperty(value = "/**窑1窑车数*/") + private String first_kiln_qty; + /** + * 窑2窑车数 + */ + @ApiModelProperty(value = "/**窑2窑车数*/") + private String second_kiln_qty; + /** + * 搬入1号窑 + */ + @ApiModelProperty(value = "/**搬入1号窑*/") + private String move_first_kiln; + /** + * 搬入2号窑 + */ + @ApiModelProperty(value = "/**搬入2号窑*/") + private String move_second_kiln; + /** + * 当前窑车数 + */ + @ApiModelProperty(value = "/**当前窑车数*/") + private String present_kiln_qty; + /** + * 容量 + */ + @ApiModelProperty(value = "/**容量*/") + private String volume; + /** + * 故障信息 + */ + @ApiModelProperty(value = "/**故障信息*/") + private String faulty_info; + /** + * 完成托盘数 + */ + @ApiModelProperty(value = "/**完成托盘数*/") + private String finish_pallet_qty; + /** + * 机械手完成托盘数 + */ + @ApiModelProperty(value = "/**机械手完成托盘数*/") + private String mechanical_pallet_qty; + /** + * 机械手完成数量 + */ + @ApiModelProperty(value = "/**机械手完成数量*/") + private String mechanical_arm_qty; + /** + * 包装机完成数量 + */ + @ApiModelProperty(value = "/**包装机完成数量*/") + private String pack_qty; + /** + * 完成跺数 + */ + @ApiModelProperty(value = "/**完成跺数*/") + private String finish_pile_qty; + /** + * 混碾机,破碎机本日生产信息 + */ + List mixingList; + /** + * 压力机,机械手本日生产信息 + */ + List crushingList; + /** + * 窑本日生产信息 + */ + List mKilnList; +} diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/dto/DeviceStatisticsDto.java b/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/dto/DeviceStatisticsDto.java new file mode 100644 index 0000000..dd298d4 --- /dev/null +++ b/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/dto/DeviceStatisticsDto.java @@ -0,0 +1,60 @@ +package org.nl.wms.cockpit.service.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + + +/** + * @author gbx + * 设备统计 + * @since 2023-03-01 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class DeviceStatisticsDto{ + /** + * 1混料2压制3干燥4包装(成品) + */ + @ApiModelProperty(value = "/**1混料2压制3干燥4包装(成品)*/") + private String workorder_procedure; + /** + * 设备编码 + */ + @ApiModelProperty(value = "/**设备编码*/") + private String deviceCode; + /** + * 设备名称 + */ + @ApiModelProperty(value = "/**设备名称*/") + private String deviceName; + /** + * 1运行2故障3暂停 + */ + @ApiModelProperty(value = "/**1运行2故障3暂停*/") + private String pointStatus; + /** + * 故障时间 + */ + @ApiModelProperty(value = "/**故障时间*/") + private String faultyTime; + /** + * 总设备数 + */ + @ApiModelProperty(value = "/**总设备数*/") + private Integer deviceQty; + /** + * 故障设备数 + */ + @ApiModelProperty(value = "/**故障设备数*/") + private Integer faultyDevice; + /** + * 故障次数 + */ + @ApiModelProperty(value = "/**故障次数*/") + private Integer faultyFrequency; +} diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/dto/DeviceStatusDto.java b/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/dto/DeviceStatusDto.java new file mode 100644 index 0000000..51e657d --- /dev/null +++ b/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/dto/DeviceStatusDto.java @@ -0,0 +1,73 @@ +package org.nl.wms.cockpit.service.dto; + +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.math.BigDecimal; + +/** + * @author gbx + * 设备状态 + * @date 2023-02-28 + **/ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class DeviceStatusDto implements Serializable{ + /** + * 点位标识 + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long point_id; + /** + * 点位编码 + */ + private String point_code; + /** + * 设备名称 + */ + private String point_name; + /** + * 设备状态:1未生产2已下发3生产中4暂停5完成 + */ + private String point_status; + /** + * 当前生产物料ID + */ + private Long material_id; + /** + * 当前生产名称 + */ + private String material_name; + /** + * 重量(如混料 24.00*0.89,0.89为重量) + */ + private BigDecimal ivt_weight; + /** + * 已工作时间 + */ + private String work_time; + /** + * 已生产数量 + */ + private BigDecimal ivt_qty; + /** + * 载具数量(当前窑车数) + */ + private Integer vehicle_qty; + /** + * 容量 + */ + private BigDecimal vehicle_max_qty; + + /** + * 设备图片 + */ + private String device_url; + + +} diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/dto/ProductionInfoDto.java b/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/dto/ProductionInfoDto.java new file mode 100644 index 0000000..ac50fb8 --- /dev/null +++ b/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/dto/ProductionInfoDto.java @@ -0,0 +1,48 @@ +package org.nl.wms.cockpit.service.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @author gbx + * 成品完成情况 + * @since 2023/2/27 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class ProductionInfoDto{ + + /** + * 本日生产内容 + */ + @ApiModelProperty(value = "/**本日生产内容*/") + private String productionDetails; + + /** + * 生产厂家 + */ + @ApiModelProperty(value = "/**生产厂家*/") + private String manufacturer; + + /** + * 已生产数量 + */ + @ApiModelProperty(value = "/**已生产数量*/") + private String productionQty; + + + /** + * 生产单位 + */ + @ApiModelProperty(value = "/**生产单位*/") + private String weightUnitName; + + + + +} diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/dto/ProductionStatisticsDto.java b/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/dto/ProductionStatisticsDto.java index ef17366..857547b 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/dto/ProductionStatisticsDto.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/dto/ProductionStatisticsDto.java @@ -6,32 +6,45 @@ import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; + import java.math.BigDecimal; /** * @author gbx - * @description + * 成品完成情况 * @since 2023/2/27 */ @Data @Builder @NoArgsConstructor @AllArgsConstructor -public class ProductionStatisticsDto -{ - - - - @ApiModelProperty(value = "/**工序*/") - /** 工序 */ - private BigDecimal workorderProcedure; - +public class ProductionStatisticsDto{ + /** + * 1混料2压制3干燥4包装(成品) + */ + @ApiModelProperty(value = "/**1混料2压制3干燥4包装(成品)*/") + private String workorder_procedure; + /** + * 计划生产数量 + */ @ApiModelProperty(value = "/**计划数量*/") - /** 计划数量 */ - private BigDecimal planQty; + private BigDecimal plan_qty; + public void setPlanQty(BigDecimal plan_qty) { + if(null == plan_qty) { + this.plan_qty = BigDecimal.valueOf(0); + } + } + /** + * 已完成数量 + */ @ApiModelProperty(value = "/**实际数量*/") - /** 实际数量 */ - private BigDecimal realQty; + private BigDecimal real_qty; + + public void setRealQty(BigDecimal real_qty) { + if(null == real_qty) { + this.real_qty = BigDecimal.valueOf(0); + } + } } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/dto/SchBasePointDto.java b/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/dto/SchBasePointDto.java index 5987fdf..5a10fed 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/dto/SchBasePointDto.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/dto/SchBasePointDto.java @@ -10,7 +10,7 @@ import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; /** * @author gbx - * @description + * 仓储状态 * @since 2023/2/27 */ @Data @@ -25,175 +25,40 @@ public class SchBasePointDto implements Serializable{ */ private String point_code; /** - * 物料号 - */ - private String material_code; - /** - * 生产物料 - */ - private String material_name; - /** - * 点位名称 + * 货位 */ private String point_name; /** - * 所属区域 - */ - private Long region_id; - /** - * 区域编码 - */ - private String region_code; - /** - * 区域名称 - */ - private String region_name; - /** - * 点位类型 - */ - private String point_type; - /** - * 点位状态 + * 货位状态 */ private String point_status; /** - * 锁定类型 - */ - private String lock_type; - /** - * 设备编码 - */ - private String device_code; - /** - * MES设备编码 - */ - private String mes_device_code; - /** - * 允许的载具类型 + * 物料标识 */ - private String can_vehicle_type; + private Long material_id; /** - * 载具类型 + * 物料名称 */ - private String vehicle_type; + private String material_name; + /** - * 载具编码 + * 托盘号 */ private String vehicle_code; - /** - * 载具数量 - */ - private BigDecimal vehicle_qty; - /** - * 块 - */ - private BigDecimal block_num; - /** - * 排 - */ - private BigDecimal row_num; - /** - * 列 - */ - private BigDecimal col_num; - /** - * 层 - */ - private BigDecimal layer_num; - /** - * 点位组编码 - */ - private String point_group_code; - /** - * 是否建工单 - */ - private String is_have_workder; - /** - * 备注 - */ - private String remark; - /** - * 来源标识 - */ - private Long source_id; - /** - * 是否启用 - */ - private String is_used; - /** - * 是否删除 - */ - private String is_delete; - /** - * 创建人 - */ - private Long create_id; - /** - * 创建人 - */ - private String create_name; - /** - * 创建时间 - */ - private String create_time; - /** - * 修改人 - */ - private Long update_optid; - /** - * 修改人 - */ - private String update_optname; - /** - * 修改时间 - */ - private String update_time; - /** - * 载具允许最大数量 - */ - private BigDecimal vehicle_max_qty; - /** - * 入库顺序 - */ - private BigDecimal in_order_seq; - /** - * 出库顺序 - */ - private BigDecimal out_order_seq; - /** - * 入空载具顺序 - */ - private BigDecimal in_empty_seq; - /** - * 出空载具顺序 - */ - private BigDecimal out_empty_seq; - /** - * 在执行的任务标识 - */ - private Long task_id; - /** - * 物料标识 - */ - private Long material_id; - /** - * 批次 - */ - private String pcsn; /** * 库存数 */ private BigDecimal ivt_qty; /** - * 计量单位标识 + * 重量 */ - private Long qty_unit_id; + private BigDecimal ivt_weight; /** * 入库时间 */ private String instorage_time; /** - * 静置时间(分钟) + * 已静置时间 */ private BigDecimal standing_time; /** @@ -201,7 +66,11 @@ public class SchBasePointDto implements Serializable{ */ private String standing_status; /** - * 是否关联库存表 + * 阈值 + */ + private String warn_time; + /** + * 是否满托 */ - private String is_ref_ivt; + private String is_full; } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/dto/WorkorderDto.java b/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/dto/WorkorderDto.java index f440da9..750615c 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/dto/WorkorderDto.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/dto/WorkorderDto.java @@ -10,13 +10,13 @@ import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; /** * @author gbx - * @description + * 生产统计 * @date 2023-02-27 **/ @Data public class WorkorderDto implements Serializable{ /** - *工单标识 + * 工单标识 */ @JsonSerialize(using = ToStringSerializer.class) private Long workorder_id; @@ -37,95 +37,30 @@ public class WorkorderDto implements Serializable{ */ private String material_name; /** - * 生产日期 + * 客户 */ - private String produce_date; + private String cust_name; /** - * 计划数量 + * 计划量(计划生产量) */ private BigDecimal plan_qty; /** - * 实际数量 + * 生产量(已完成数量) */ private BigDecimal real_qty; + + /** - * 物料标识 - */ - private Long material_id; - /** - * 载具类型 - */ - private String vehicle_type; - /** - * 计划生产开始时间 - */ - private String planproducestart_date; - /** - * 计划生产结束时间 - */ - private String planproduceend_date; - /** - * 实际生产开始时间 - */ - private String realproducestart_date; - /** - * 实际生产结束时间 - */ - private String realproduceend_date; - /** - * 设备标识 - */ - private Long device_id; - /** - * 所属工序:1-压制2-干燥3-成品 - */ - private String workorder_procedure; - /** - * 工单状态 + * 生产状态1未生产2已下发3生产中4停止5完成 */ private String order_status; + /** - * 是否搬运 - */ - private String is_needmove; - /** - * 回传MES状态 - */ - private String passback_status; - /** - * 外部标识 - */ - private String ext_id; - /** - * 是否删除 - */ - private String is_delete; - /** - * 创建人 - */ - private Long create_id; - /** - * 创建人 - */ - private String create_name; - /** - * 创建时间 - */ - private String create_time; - /** - * 修改人 - */ - private Long update_optid; - /** - * 修改人 - */ - private String update_optname; - /** - * 工单编号 + * 班次类型 */ - private String workorder_code; + private String shift_type; /** - * 修改时间 + * 开始时间 */ - private String update_time; + private String realproducestart_date; } 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 8d0275f..49f77ab 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 @@ -3,37 +3,24 @@ 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 com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; import lombok.RequiredArgsConstructor; -import lombok.var; import org.apache.commons.lang3.StringUtils; -import org.checkerframework.checker.units.qual.A; import org.nl.config.thread.ThreadPoolExecutorUtil; -import org.nl.modules.common.exception.BadRequestException; +import org.nl.modules.common.utils.enums.IsOrNotEnum; +import org.nl.modules.common.utils.enums.PointStatusEnum; import org.nl.modules.wql.WQL; import org.nl.wms.cockpit.service.CockpitService; -import org.nl.wms.cockpit.service.dto.ProductionStatisticsDto; -import org.nl.wms.cockpit.service.dto.SchBasePointDto; -import org.nl.wms.cockpit.service.dto.WorkorderDto; +import org.nl.wms.cockpit.service.dto.*; import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.data.domain.Pageable; -import java.math.BigDecimal; import java.util.*; import java.util.concurrent.*; import cn.hutool.core.date.DateUtil; -import cn.hutool.core.util.IdUtil; import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; -import org.nl.modules.common.utils.SecurityUtils; -import org.nl.modules.wql.core.bean.ResultBean; -import org.nl.modules.wql.core.bean.WQLObject; -import org.nl.modules.wql.util.WqlUtil; import lombok.extern.slf4j.Slf4j; import cn.hutool.core.util.ObjectUtil; -import org.springframework.util.CollectionUtils; /** * 大屏服务实现 @@ -54,37 +41,50 @@ public class CockpitServiceImpl implements CockpitService{ @Override public ConcurrentHashMap productionStatistics() { ThreadPoolExecutor pool = ThreadPoolExecutorUtil.getPoll(); - ConcurrentHashMap map = new ConcurrentHashMap<>(); - // 1、获取生产任务列表 + ConcurrentHashMap map = new ConcurrentHashMap<>(3); + // 1、获取生产任务列表、 CompletableFuture> productionTask = CompletableFuture.supplyAsync(() -> { List res = new CopyOnWriteArrayList<>(); JSONArray result = WQL.getWO("COCKPIT_PRODUCTION").addParam("flag", "1").process().getResultJSONArray(0); if(ObjectUtil.isNotEmpty(result)) { res = result.toJavaList(WorkorderDto.class); + res.forEach(r -> { + r.setCust_name("新余钢铁"); + if(StringUtils.isNotEmpty(r.getLabel())) { + r.setLabel(r.getLabel().substring(0, 2)); + r.setShift_type(r.getLabel().substring(0, 2) + "白班"); + } + }); } return res; }, pool); - productionTask.thenAccept((result) -> { - map.put("productionTask", result); - }).exceptionally((e) -> { + productionTask.thenAccept((result) -> map.put("productionTask", result)).exceptionally((e) -> { log.error("获取生产任务列表: {}", e.getMessage(), e); map.put("productionTask", ""); return null; }); // 2、获取原料计划完成情况 CompletableFuture materialTask = CompletableFuture.supplyAsync(() -> WQL.getWO("COCKPIT_PRODUCTION").addParam("flag", "2").process().getResultJSONArray(0), pool); - materialTask.thenAccept((result) -> { - map.put("materialTask", result); - }).exceptionally((e) -> { + materialTask.thenAccept((result) -> map.put("materialTask", result)).exceptionally((e) -> { log.error("获取原料计划完成情况: {}", e.getMessage(), e); map.put("materialTask", ""); return null; }); // 3、获取成品计划完成情况,今日压制量,干燥量,成品量 - CompletableFuture finishedTask = CompletableFuture.supplyAsync(() -> WQL.getWO("COCKPIT_PRODUCTION").addParam("flag", "3").process().getResultJSONArray(0), pool); - finishedTask.thenAccept((result) -> { - map.put("finishedTask", result); - }).exceptionally((e) -> { + CompletableFuture> finishedTask = CompletableFuture.supplyAsync(() -> { + List res = new CopyOnWriteArrayList<>(); + JSONArray result = WQL.getWO("COCKPIT_PRODUCTION").addParam("flag", "3").process().getResultJSONArray(0); + if(ObjectUtil.isNotEmpty(result)) { + res = result.toJavaList(ProductionStatisticsDto.class); + res.forEach(r -> { + if(StringUtils.isNotEmpty(r.getWorkorder_procedure())) { + r.setWorkorder_procedure(Objects.equals(r.getWorkorder_procedure(), "2") ? "今日压制量" : Objects.equals(r.getWorkorder_procedure(), "3") ? "今日干燥量" : "今日成品量"); + } + }); + } + return res; + }, pool); + finishedTask.thenAccept((result) -> map.put("finishedTask", result)).exceptionally((e) -> { log.error("获取成品计划完成情况: {}", e.getMessage(), e); map.put("finishedTask", ""); return null; @@ -107,7 +107,7 @@ public class CockpitServiceImpl implements CockpitService{ @Override public ConcurrentHashMap storageMonitor() { ThreadPoolExecutor pool = ThreadPoolExecutorUtil.getPoll(); - ConcurrentHashMap map = new ConcurrentHashMap<>(); + ConcurrentHashMap map = new ConcurrentHashMap<>(2); // 1、获取原料仓储信息 CompletableFuture> materialStorage = CompletableFuture.supplyAsync(() -> { List res = new CopyOnWriteArrayList<>(); @@ -115,11 +115,12 @@ public class CockpitServiceImpl implements CockpitService{ if(ObjectUtil.isNotEmpty(result)) { res = result.toJavaList(SchBasePointDto.class); res.forEach(schBasePointDto -> { + //Todo 空盅和强制完成状态相关逻辑待完善 //根据入库时间和静置时间判断状态静置状态 if(StringUtils.isNotBlank(schBasePointDto.getInstorage_time()) && null != schBasePointDto.getStanding_time()) { DateTime nowTime = DateUtil.parse(DateUtil.now(), DatePattern.NORM_DATETIME_FORMAT); - DateTime instorageTime = DateUtil.parse(schBasePointDto.getInstorage_time(), DatePattern.NORM_DATETIME_FORMAT); - long minute = DateUtil.between(nowTime, instorageTime, DateUnit.MINUTE); + DateTime inStorageTime = DateUtil.parse(schBasePointDto.getInstorage_time(), DatePattern.NORM_DATETIME_FORMAT); + long minute = DateUtil.between(nowTime, inStorageTime, DateUnit.MINUTE); if(minute < schBasePointDto.getStanding_time().longValue()) { schBasePointDto.setStanding_status("静置中"); } @@ -127,13 +128,15 @@ public class CockpitServiceImpl implements CockpitService{ schBasePointDto.setStanding_status("静置完成"); } } + //是否满托 + if(StringUtils.isNotEmpty(schBasePointDto.getIs_full())) { + schBasePointDto.setIs_full(IsOrNotEnum.getName(schBasePointDto.getIs_full())); + } }); } return res; }, pool); - materialStorage.thenAccept((result) -> { - map.put("materialTask", result); - }).exceptionally((e) -> { + materialStorage.thenAccept((result) -> map.put("materialTask", result)).exceptionally((e) -> { log.error("获取原料仓储信息: {}", e.getMessage(), e); map.put("materialTask", ""); return null; @@ -147,9 +150,7 @@ public class CockpitServiceImpl implements CockpitService{ } return res; }, pool); - finishedStorage.thenAccept((result) -> { - map.put("productionTask", result); - }).exceptionally((e) -> { + finishedStorage.thenAccept((result) -> map.put("productionTask", result)).exceptionally((e) -> { log.error("获取成品仓储信息: {}", e.getMessage(), e); map.put("productionTask", ""); return null; @@ -167,15 +168,111 @@ public class CockpitServiceImpl implements CockpitService{ * 设备监控大屏信息 * * @author gbx - * @since 2023/2/27 + * @since 2023/2/28 */ @Override - public ConcurrentHashMap deviceMonitor() { + public List deviceMonitor() { + List res; + JSONArray result = WQL.getWO("COCKPIT_DEVICE").addParam("flag", "1").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(PointStatusEnum.getName(r.getPoint_status())); + } + }); + return res; + } return null; } + /** + * 根据point_id获取设备信息 + * + * @author gbx + * @since 2023/3/1 + */ @Override - public ConcurrentHashMap workshopCondition() { + public DeviceDetailDto findDeviceById(String id) { + JSONObject rows = WQL.getWO("COCKPIT_DEVICE").addParam("flag", "2").addParam("point_id", id).process().uniqueResult(0); + if(ObjectUtil.isNotEmpty(rows)) { + DeviceDetailDto deviceDetailDto = rows.toJavaObject(DeviceDetailDto.class); + //Todo 点击设备弹窗临时演示数据,后面需要根据业务逻辑查询 + deviceDetailDto.setReal_qty("1500 KG"); + deviceDetailDto.setVehicle_code("L007"); + deviceDetailDto.setPoint_status("运行中"); + deviceDetailDto.setPallet_qty("120 托"); + deviceDetailDto.setMove_first_kiln("30 托"); + deviceDetailDto.setWork_time("3.5 小时"); + deviceDetailDto.setMove_second_kiln("30 托"); + deviceDetailDto.setDevice_url("ylj"); + deviceDetailDto.setSecond_kiln_qty("0 车"); + deviceDetailDto.setPresent_kiln_qty("15 车"); + deviceDetailDto.setVolume("20 车"); + deviceDetailDto.setReady_lane("60 托"); + deviceDetailDto.setFirst_kiln_qty("20 车"); + deviceDetailDto.setMove_second_kiln("20 托"); + deviceDetailDto.setMechanical_arm_qty("12000 块"); + deviceDetailDto.setPack_qty("1200"); + deviceDetailDto.setFinish_pallet_qty("120 个"); + deviceDetailDto.setMechanical_pallet_qty("120 托"); + deviceDetailDto.setFinish_pile_qty("12 垛"); + List setMixingList = new ArrayList<>(); + List setCrushingList = new ArrayList<>(); + setMixingList.add(ProductionInfoDto.builder().productionDetails("混料23.60*0.68").productionQty("1500").weightUnitName("KG").build()); + setMixingList.add(ProductionInfoDto.builder().productionDetails("混料24.00*0.89").productionQty("800").weightUnitName("KG").build()); + //混碾机,破碎机本日生产信息 + deviceDetailDto.setMixingList(setMixingList); + setCrushingList.add(ProductionInfoDto.builder().productionDetails("压制M29*0.90*5.5-6.5M").productionQty("10000").manufacturer("新余").build()); + setCrushingList.add(ProductionInfoDto.builder().productionDetails("压制Y22.00*0.80*2.5-3M").productionQty("15000").manufacturer("重钢").build()); + //压力机,机械手本日生产信息 + deviceDetailDto.setCrushingList(setCrushingList); + //窑本日生产信息 + deviceDetailDto.setMKilnList(setCrushingList); + return deviceDetailDto; + } return null; } + + /** + * 車间情况大屏信息 + * + * @author gbx + * @since 2023/3/1 + */ + @Override + public Map workshopCondition() { + //Todo 车间设备情况临时演示数据,后面需要根据业务逻辑查询 + Map hashMap = new HashMap<>(3); + //运行情况 + List runningStatusList = new ArrayList<>(); + runningStatusList.add(DeviceStatisticsDto.builder().workorder_procedure("混料").deviceQty(16).faultyDevice(2).build()); + runningStatusList.add(DeviceStatisticsDto.builder().workorder_procedure("压制").deviceQty(14).faultyDevice(1).build()); + runningStatusList.add(DeviceStatisticsDto.builder().workorder_procedure("干燥").deviceQty(6).faultyDevice(0).build()); + runningStatusList.add(DeviceStatisticsDto.builder().workorder_procedure("包装").deviceQty(9).faultyDevice(3).build()); + //近一个月故障次数 + List faultyStatusList = new ArrayList<>(); + 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个故障设备 + List faultyInfoList = new ArrayList<>(); + faultyInfoList.add(DeviceStatisticsDto.builder().faultyTime("2023-02-15 11:09:08").deviceCode("YZJ07SL01").deviceName("压制机7").pointStatus("3").build()); + faultyInfoList.add(DeviceStatisticsDto.builder().faultyTime("2023-02-15 10:24:12").deviceCode("HLJ45W15").deviceName("混料机15").pointStatus("3").build()); + faultyInfoList.add(DeviceStatisticsDto.builder().faultyTime("2023-02-15 10:01:33").deviceCode("YZJ02XL01").deviceName("压制机2").pointStatus("3").build()); + faultyInfoList.add(DeviceStatisticsDto.builder().faultyTime("2023-02-14 15:21:31").deviceCode("HLJ02W03").deviceName("混料机3").pointStatus("3").build()); + faultyInfoList.add(DeviceStatisticsDto.builder().faultyTime("2023-02-14 11:27:24").deviceCode("YZJ0903").deviceName("压制机9").pointStatus("3").build()); + hashMap.put("runningStatus", runningStatusList); + hashMap.put("faultyStatus", faultyStatusList); + hashMap.put("faultyInfo", faultyInfoList); + return hashMap; + } } 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 c0489ce..b3f2be4 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 @@ -14,7 +14,7 @@ ## 表字段对应输入参数 ################################################# 输入.flag TYPEAS s_string - 输入.date TYPEAS s_string + 输入.point_id TYPEAS s_string [临时表] @@ -39,17 +39,29 @@ # 3、业务主过程 # ########################################## - IF 输入.flag = "1" + IF 输入.flag = "1" PAGEQUERY - - 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 + 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 diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/wql/COCKPIT_PRODUCTION.wql b/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/wql/COCKPIT_PRODUCTION.wql index 9bb268c..1b29670 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/wql/COCKPIT_PRODUCTION.wql +++ b/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/wql/COCKPIT_PRODUCTION.wql @@ -39,10 +39,16 @@ # 3、业务主过程 # ########################################## + ########################################## + # 4、注释内容 # + #暂不统计当天而是统计全部,否则数据返回:AND TO_DAYS(workorder.realproduceend_date) = TO_DAYS(NOW())# + ########################################## + IF 输入.flag = "1" PAGEQUERY SELECT dict.label, + dicts.label order_status, material.material_code, material.material_name, device.device_name, @@ -53,9 +59,10 @@ LEFT JOIN pdm_bi_device device ON workorder.device_id = device.device_id LEFT JOIN sys_dict_detail dict ON dict.`VALUE` = workorder.workorder_procedure AND dict.dict_id = 112 + LEFT JOIN sys_dict_detail dicts ON dicts.`VALUE` = workorder.order_status + AND dicts.dict_id = 90 WHERE workorder.is_delete = '0' - AND TO_DAYS(workorder.realproduceend_date) = TO_DAYS(NOW()) ORDER BY workorder.create_time DESC ENDSELECT @@ -65,13 +72,12 @@ IF 输入.flag = "2" PAGEQUERY SELECT - SUM( plan_qty ) planQty, - SUM( real_qty ) realQty + SUM( plan_qty ) plan_qty, + SUM( real_qty ) real_qty FROM PDM_BD_WORKORDER workorder WHERE workorder.is_delete = '0' - AND TO_DAYS(workorder.realproduceend_date) = TO_DAYS(NOW()) ENDSELECT ENDPAGEQUERY ENDIF @@ -79,17 +85,17 @@ IF 输入.flag = "3" PAGEQUERY SELECT - workorder.workorder_procedure, - SUM( plan_qty ) planQty, - SUM( real_qty ) realQty + workorder.workorder_procedure, + SUM( plan_qty ) plan_qty, + SUM( real_qty ) real_qty FROM PDM_BD_WORKORDER workorder WHERE workorder.is_delete = '0' - AND TO_DAYS(workorder.realproduceend_date) = TO_DAYS(NOW()) GROUP BY workorder.workorder_procedure ENDSELECT ENDPAGEQUERY ENDIF + diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/wql/COCKPIT_WORKSHOP.wql b/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/wql/COCKPIT_WORKSHOP.wql index eaf1a25..def5e35 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/wql/COCKPIT_WORKSHOP.wql +++ b/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/wql/COCKPIT_WORKSHOP.wql @@ -46,11 +46,4 @@ ENDPAGEQUERY ENDIF - IF 输入.flag = "2" - PAGEQUERY - - ENDSELECT - ENDPAGEQUERY - ENDIF -