Browse Source

完善大屏接口生产统计,

设备情况,
仓储情况,
车间情况相关逻辑。
master
龚宝雄 2 years ago
parent
commit
65572b6ebb
  1. 57
      lms/nladmin-system/src/main/java/org/nl/modules/common/utils/enums/IsOrNotEnum.java
  2. 58
      lms/nladmin-system/src/main/java/org/nl/modules/common/utils/enums/PointStatusEnum.java
  3. 25
      lms/nladmin-system/src/main/java/org/nl/wms/cockpit/rest/CockpitController.java
  4. 23
      lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/CockpitService.java
  5. 122
      lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/dto/DeviceDetailDto.java
  6. 60
      lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/dto/DeviceStatisticsDto.java
  7. 73
      lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/dto/DeviceStatusDto.java
  8. 48
      lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/dto/ProductionInfoDto.java
  9. 41
      lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/dto/ProductionStatisticsDto.java
  10. 167
      lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/dto/SchBasePointDto.java
  11. 93
      lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/dto/WorkorderDto.java
  12. 179
      lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/impl/CockpitServiceImpl.java
  13. 32
      lms/nladmin-system/src/main/java/org/nl/wms/cockpit/wql/COCKPIT_DEVICE.wql
  14. 22
      lms/nladmin-system/src/main/java/org/nl/wms/cockpit/wql/COCKPIT_PRODUCTION.wql
  15. 7
      lms/nladmin-system/src/main/java/org/nl/wms/cockpit/wql/COCKPIT_WORKSHOP.wql

57
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;
}
}

58
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;
}
}

25
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<Object> deviceMonitor() {
public ResponseEntity<List<DeviceStatusDto>> deviceMonitor() {
return new ResponseEntity<>(cockpitService.deviceMonitor(), HttpStatus.OK);
}
/**
* 车间情况
* 根据点位id获取设备信息
*/
@GetMapping("/findDeviceById/{id}")
@Log("根据点位id获取设备信息")
@ApiOperation("根据点位id获取设备信息")
public ResponseEntity<DeviceDetailDto> findDeviceById(@PathVariable String id) {
if(null == id) {
throw new BadRequestException("更新定时任务失败");
}
return new ResponseEntity<>(cockpitService.findDeviceById(id), HttpStatus.OK);
}
/**
* 車间情况
*/
@GetMapping("/workshopCondition")
@Log("车间情况")

23
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<String,Object> productionStatistics();
/**
* 仓储监控
* @return 返回统计结果集
*/
ConcurrentHashMap<String,Object> storageMonitor();
/**
* 设备监控
* @return 返回统计结果集
*/
List<DeviceStatusDto> deviceMonitor();
/**
* 根据point_id获取设备信息
* @param id 点位id
* @return 返回统计结果集
*/
ConcurrentHashMap<String,Object> deviceMonitor();
DeviceDetailDto findDeviceById(String id);
/**
* 车间情况
* 車间情况
* @return 返回统计结果集
*/
ConcurrentHashMap<String,Object> workshopCondition();
Map<String,Object> workshopCondition();
}

122
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<ProductionInfoDto> mixingList;
/**
* 压力机机械手本日生产信息
*/
List<ProductionInfoDto> crushingList;
/**
* 窑本日生产信息
*/
List<ProductionInfoDto> mKilnList;
}

60
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;
}

73
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.890.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;
}

48
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;
}

41
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);
}
}
}

167
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;
}

93
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;
}

179
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<String,Object> productionStatistics() {
ThreadPoolExecutor pool = ThreadPoolExecutorUtil.getPoll();
ConcurrentHashMap<String,Object> map = new ConcurrentHashMap<>();
// 1、获取生产任务列表
ConcurrentHashMap<String,Object> map = new ConcurrentHashMap<>(3);
// 1、获取生产任务列表
CompletableFuture<List<WorkorderDto>> productionTask = CompletableFuture.supplyAsync(() -> {
List<WorkorderDto> 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<JSONArray> 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<JSONArray> finishedTask = CompletableFuture.supplyAsync(() -> WQL.getWO("COCKPIT_PRODUCTION").addParam("flag", "3").process().getResultJSONArray(0), pool);
finishedTask.thenAccept((result) -> {
map.put("finishedTask", result);
}).exceptionally((e) -> {
CompletableFuture<List<ProductionStatisticsDto>> finishedTask = CompletableFuture.supplyAsync(() -> {
List<ProductionStatisticsDto> 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<String,Object> storageMonitor() {
ThreadPoolExecutor pool = ThreadPoolExecutorUtil.getPoll();
ConcurrentHashMap<String,Object> map = new ConcurrentHashMap<>();
ConcurrentHashMap<String,Object> map = new ConcurrentHashMap<>(2);
// 1、获取原料仓储信息
CompletableFuture<List<SchBasePointDto>> materialStorage = CompletableFuture.supplyAsync(() -> {
List<SchBasePointDto> 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<String,Object> deviceMonitor() {
public List<DeviceStatusDto> deviceMonitor() {
List<DeviceStatusDto> 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<String,Object> 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<ProductionInfoDto> setMixingList = new ArrayList<>();
List<ProductionInfoDto> 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<String,Object> workshopCondition() {
//Todo 车间设备情况临时演示数据,后面需要根据业务逻辑查询
Map<String,Object> hashMap = new HashMap<>(3);
//运行情况
List<DeviceStatisticsDto> 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<DeviceStatisticsDto> 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<DeviceStatisticsDto> 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;
}
}

32
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

22
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

7
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

Loading…
Cancel
Save