add:大屏、看板、弹窗接口
This commit is contained in:
@@ -4,14 +4,16 @@ import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.wms.cockpit.service.CockpitService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
@@ -31,7 +33,49 @@ public class CockPitController {
|
||||
@PostMapping("/press")
|
||||
@Log("压制看板")
|
||||
@ApiOperation("压制看板")
|
||||
public ResponseEntity<Object> PressedMonitor(){
|
||||
return new ResponseEntity<>(cockpitService.PressedMonitor(), HttpStatus.OK);
|
||||
public ResponseEntity<Object> pressedMonitor(){
|
||||
return new ResponseEntity<>(cockpitService.pressedMonitor(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/sorting")
|
||||
@Log("分拣看板")
|
||||
@ApiOperation("分拣看板")
|
||||
public ResponseEntity<Object> sortingMonitor(){
|
||||
return new ResponseEntity<>(cockpitService.sortingMonitor(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/screenTableData")
|
||||
@Log("大屏")
|
||||
@ApiOperation("大屏")
|
||||
public ResponseEntity<Object> screenLeftData(){
|
||||
return new ResponseEntity<>(cockpitService.screenTableData(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/deviceCondition")
|
||||
@Log("设备运行情况")
|
||||
@ApiOperation("设备运行情况")
|
||||
public ResponseEntity<Object> deviceCondition(){
|
||||
return new ResponseEntity<>(cockpitService.deviceCondition(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
// @GetMapping("/mixingDetail")
|
||||
// @Log("混碾料仓弹出框")
|
||||
// @ApiOperation("混碾料仓弹出框")
|
||||
// public ResponseEntity<Object> selectMixingDetail(@RequestParam Map whereJson){
|
||||
// return new ResponseEntity<>(cockpitService.selectMixingDetail(whereJson), HttpStatus.OK);
|
||||
// }
|
||||
|
||||
@GetMapping("/inOutKilnDetail")
|
||||
@Log("出、入窑输送线")
|
||||
@ApiOperation("出、入窑输送线")
|
||||
public ResponseEntity<Object> selectInOutKilnDetail(){
|
||||
return new ResponseEntity<>(cockpitService.selectInOutKilnDetail(), HttpStatus.OK);
|
||||
}
|
||||
@GetMapping("/kilnDetail")
|
||||
@Log("窑弹出框")
|
||||
@ApiOperation("窑弹出框")
|
||||
public ResponseEntity<Object> selectKilnDetail(){
|
||||
return new ResponseEntity<>(cockpitService.selectKilnDetail(), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
package org.nl.wms.cockpit.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.wms.cockpit.service.dao.*;
|
||||
import org.nl.wms.das.device.record.service.dao.DasDeviceErrorRecord;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
@@ -12,5 +19,27 @@ public interface CockpitService {
|
||||
* 压制看板
|
||||
* @return
|
||||
*/
|
||||
ConcurrentHashMap<String,Object> PressedMonitor();
|
||||
ConcurrentHashMap<String,Object> pressedMonitor();
|
||||
|
||||
/**
|
||||
* 分拣看板
|
||||
* @return
|
||||
*/
|
||||
ConcurrentHashMap<String,Object> sortingMonitor();
|
||||
|
||||
ConcurrentHashMap<String,Object> screenTableData();
|
||||
|
||||
// List<DeviceErrorVo> getDeviceErrorList();
|
||||
//
|
||||
// IPage<DasDeviceErrorRecord> getDeviceErrorInfoList(PageQuery page);
|
||||
//
|
||||
// DeviceRunStatVo selectDeviceRunStatNum();
|
||||
Object deviceCondition();
|
||||
//
|
||||
// MixingDetailVo selectMixingDetail(Map whereJson);
|
||||
|
||||
List<InOutKilnVo> selectInOutKilnDetail();
|
||||
|
||||
KilnVo selectKilnDetail();
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package org.nl.wms.cockpit.service.dao;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
*/
|
||||
@Data
|
||||
public class DeviceConditionVo {
|
||||
private String deviceName;
|
||||
private Integer failure;
|
||||
private Integer shutdown;
|
||||
private Integer standby;
|
||||
private Integer running;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package org.nl.wms.cockpit.service.dao;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
* @description 30天故障
|
||||
*/
|
||||
@Data
|
||||
public class DeviceErrorVo {
|
||||
private String deviceName;
|
||||
private String errorNum;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package org.nl.wms.cockpit.service.dao;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
* @description 设备运行统计
|
||||
*/
|
||||
@Data
|
||||
public class DeviceRunStatVo {
|
||||
//总数
|
||||
private int total;
|
||||
//正常运行
|
||||
private int runNum;
|
||||
//暂未生产
|
||||
private int unProducedNum;
|
||||
//空闲设备
|
||||
private int freeNum;
|
||||
//故障设备
|
||||
private int errorNum;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package org.nl.wms.cockpit.service.dao;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
*/
|
||||
@Data
|
||||
public class HistoryVo {
|
||||
private String produceDate;
|
||||
private String suppressedNum;
|
||||
private String finishedNum;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package org.nl.wms.cockpit.service.dao;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
*/
|
||||
@Data
|
||||
public class InOutKilnVo {
|
||||
private String stat; //1运行中
|
||||
private String pointName;//点位名称
|
||||
private String workTime;//工作时间
|
||||
private String palletNum;//当前托盘数
|
||||
private String materialNum;//当前物料数量
|
||||
private String deliveredPalletNum;//当日已输送托盘数
|
||||
private String deliveredMaterialNum;//当日已输送数量
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package org.nl.wms.cockpit.service.dao;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
*/
|
||||
@Data
|
||||
public class KilnMaterialInfo {
|
||||
private String materialCode;
|
||||
private String customer;
|
||||
private String producedNum;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package org.nl.wms.cockpit.service.dao;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
*/
|
||||
@Data
|
||||
public class KilnVo {
|
||||
private String pointName;
|
||||
private String workTime;
|
||||
private String palletNum;
|
||||
private String materialNum;
|
||||
private String produceNum;
|
||||
private List<KilnMaterialInfo> materialInfos;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package org.nl.wms.cockpit.service.dao;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
*/
|
||||
@Data
|
||||
public class MixingDetailVo {
|
||||
private String point;
|
||||
private String materialName;
|
||||
private String materialCode;
|
||||
private String weight;
|
||||
private String updateTime;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package org.nl.wms.cockpit.service.dao;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
*/
|
||||
@Data
|
||||
public class MixingVo {
|
||||
private String workorderCode;
|
||||
private String pointName;
|
||||
private String customer;
|
||||
private String material;
|
||||
private String materialSpec;
|
||||
private String planQty;
|
||||
private String realQty;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package org.nl.wms.cockpit.service.dao;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
*/
|
||||
@Data
|
||||
public class PressOrderVo {
|
||||
private String planQty;
|
||||
private String realQty;
|
||||
private String rate;
|
||||
private String orderNumber;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package org.nl.wms.cockpit.service.dao;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
*/
|
||||
@Data
|
||||
public class PressProductVo {
|
||||
private String materialName;
|
||||
private String requiredNum;
|
||||
private String suppressedNum;
|
||||
private String finishedNum;
|
||||
}
|
||||
@@ -10,16 +10,16 @@ import lombok.Data;
|
||||
@Data
|
||||
public class ProductTaskVo {
|
||||
private String device;
|
||||
private String workorder_code;
|
||||
private String workorderCode;
|
||||
private String team;
|
||||
private String material_name;
|
||||
private String planproducestart_date;
|
||||
private String plan_qty;
|
||||
private String real_qty;
|
||||
private String unqualified_qty;
|
||||
private String qualified_rate;
|
||||
private String workorder_status;
|
||||
private String materialName;
|
||||
private String planproducestartDate;
|
||||
private String planQty;
|
||||
private String realQty;
|
||||
private String unqualifiedQty;
|
||||
private String qualifiedRate;
|
||||
private String workorderStatus;
|
||||
private String operator;
|
||||
private String realproducestart_date;
|
||||
private String realproduceend_date;
|
||||
private String realproducestartDate;
|
||||
private String realproduceendDate;
|
||||
}
|
||||
|
||||
@@ -9,8 +9,8 @@ import lombok.Data;
|
||||
*/
|
||||
@Data
|
||||
public class ShiftProductionVo {
|
||||
private String column_name;
|
||||
private String qualified_qty;
|
||||
private String unqualified_qty;
|
||||
private String total_difference;
|
||||
private String columnName;
|
||||
private String qualifiedQty;
|
||||
private String unqualifiedQty;
|
||||
private String lastQty;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package org.nl.wms.cockpit.service.dao;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
*/
|
||||
@Data
|
||||
public class SortingLineVo {
|
||||
private String workorderCode;
|
||||
private String pointName;
|
||||
private String customer;
|
||||
private String material;
|
||||
private String materialSpec;
|
||||
private String planQty;
|
||||
private String realQty;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package org.nl.wms.cockpit.service.dao;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
*/
|
||||
@Data
|
||||
public class StackVo {
|
||||
private String vehicleCode;
|
||||
private String materialQty;
|
||||
private String materialWeight;
|
||||
private String materialName;
|
||||
@JsonFormat(pattern ="MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date createTime;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package org.nl.wms.cockpit.service.dao;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
*/
|
||||
@Data
|
||||
public class WorkOrderVo {
|
||||
private String workorderCode;
|
||||
private String materialName;
|
||||
private String materialSpec;
|
||||
private String planQty;
|
||||
private String planWeight;
|
||||
private String produceOrder;
|
||||
private String customer;
|
||||
private String vehicleType;
|
||||
//todo 是否有半托
|
||||
@JsonFormat(pattern ="MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date createTime;
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package org.nl.wms.cockpit.service.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum DeviceEnum {
|
||||
HL(0, "HL", "混料"),
|
||||
YZ(1, "YZ", "压制"),
|
||||
GZ(2, "SZ", "干燥"),
|
||||
BZ(3, "FJ", "包装");
|
||||
private final int index;
|
||||
private final String code;
|
||||
private final String device_name;
|
||||
|
||||
public static DeviceEnum getDeviceEnumByIndex(int index) {
|
||||
DeviceEnum[] enums = DeviceEnum.values();
|
||||
for (DeviceEnum deviceEnum : enums) {
|
||||
if (deviceEnum.getIndex() == index) {
|
||||
return deviceEnum;
|
||||
}
|
||||
}
|
||||
return null; // 如果没有找到对应的枚举常量,可以根据需要返回null或者抛出异常
|
||||
}
|
||||
|
||||
public static DeviceEnum getDeviceEnumByCode(String code) {
|
||||
DeviceEnum[] enums = DeviceEnum.values();
|
||||
for (DeviceEnum deviceEnum : enums) {
|
||||
if (deviceEnum.getCode().equals(code)) {
|
||||
return deviceEnum;
|
||||
}
|
||||
}
|
||||
return null; // 如果没有找到对应的枚举常量,可以根据需要返回null或者抛出异常
|
||||
}
|
||||
}
|
||||
@@ -1,18 +1,23 @@
|
||||
package org.nl.wms.cockpit.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.config.thread.ThreadPoolExecutorUtil;
|
||||
import org.nl.wms.cockpit.service.CockpitService;
|
||||
import org.nl.wms.cockpit.service.dao.PersonnelMonthlyProductionVo;
|
||||
import org.nl.wms.cockpit.service.dao.PressProductHeaderVo;
|
||||
import org.nl.wms.cockpit.service.dao.ProductTaskVo;
|
||||
import org.nl.wms.cockpit.service.dao.ShiftProductionVo;
|
||||
import org.nl.wms.cockpit.service.dao.*;
|
||||
import org.nl.wms.cockpit.service.enums.DeviceEnum;
|
||||
import org.nl.wms.cockpit.service.mapper.CockPitMapper;
|
||||
import org.nl.wms.util.CommonUtils;
|
||||
import org.nl.wms.das.device.record.service.IDasDeviceErrorRecordService;
|
||||
import org.nl.wms.das.device.record.service.dao.DasDeviceErrorRecord;
|
||||
import org.nl.wms.ext.acs.service.WmsToAcsService;
|
||||
import org.nl.wms.ext.acs.service.dto.to.wms.AcsResponse;
|
||||
import org.nl.wms.sch.point.service.ISchBasePointService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
@@ -27,15 +32,23 @@ import java.util.concurrent.ThreadPoolExecutor;
|
||||
public class CockpitServiceImpl implements CockpitService {
|
||||
@Autowired
|
||||
private CockPitMapper cockPitMapper;
|
||||
|
||||
@Autowired
|
||||
private WmsToAcsService wmsToAcsService;
|
||||
|
||||
@Autowired
|
||||
private IDasDeviceErrorRecordService dasDeviceErrorRecordService;
|
||||
|
||||
@Autowired
|
||||
private ISchBasePointService schBasePointService;
|
||||
|
||||
@Override
|
||||
public ConcurrentHashMap<String, Object> PressedMonitor() {
|
||||
public ConcurrentHashMap<String, Object> pressedMonitor() {
|
||||
ThreadPoolExecutor pool = ThreadPoolExecutorUtil.getPoll();
|
||||
ConcurrentHashMap<String, Object> map = new ConcurrentHashMap<>();
|
||||
// 1、当前班次、计划生产、已生产、不合格产品数
|
||||
String dayShift = CommonUtils.getDayShift(); // 白班、晚班
|
||||
map.put("DayShift", dayShift);
|
||||
CompletableFuture<List<PressProductHeaderVo>> listCompletableFuture = CompletableFuture.supplyAsync(
|
||||
() -> cockPitMapper.getPressProductHeaderList(dayShift), pool);
|
||||
() -> cockPitMapper.getPressProductHeaderList(), pool);
|
||||
listCompletableFuture.thenAccept(result -> {
|
||||
map.put("DayShiftList", result);
|
||||
}).exceptionally((e) -> {
|
||||
@@ -45,7 +58,7 @@ public class CockpitServiceImpl implements CockpitService {
|
||||
});
|
||||
// 2、当班生产
|
||||
CompletableFuture<List<ShiftProductionVo>> listShiftProductionFuture = CompletableFuture.supplyAsync(
|
||||
() -> cockPitMapper.getShiftProductionList(dayShift), pool);
|
||||
() -> cockPitMapper.getShiftProductionList(), pool);
|
||||
listShiftProductionFuture.thenAccept(result -> {
|
||||
map.put("ShiftProductionList", result);
|
||||
}).exceptionally((e) -> {
|
||||
@@ -53,14 +66,14 @@ public class CockpitServiceImpl implements CockpitService {
|
||||
map.put("ShiftProductionList", null);
|
||||
return null;
|
||||
});
|
||||
// 3、人员月生产
|
||||
CompletableFuture<List<PersonnelMonthlyProductionVo>> listPersonnelMonthlyProductionFuture = CompletableFuture.supplyAsync(
|
||||
() -> cockPitMapper.getPersonnelMonthlyProductionList(dayShift), pool);
|
||||
listPersonnelMonthlyProductionFuture.thenAccept(result -> {
|
||||
map.put("PersonnelMonthlyProduction", result);
|
||||
// 2、当日订单
|
||||
CompletableFuture<List<PressOrderVo>> pressOrderFuture = CompletableFuture.supplyAsync(
|
||||
() -> cockPitMapper.getPressOrderVoList(), pool);
|
||||
pressOrderFuture.thenAccept(result -> {
|
||||
map.put("PressOrderList", result);
|
||||
}).exceptionally((e) -> {
|
||||
log.error("人员月生产: {}", e.getMessage(), e);
|
||||
map.put("PersonnelMonthlyProduction", null);
|
||||
log.error("当日订单: {}", e.getMessage(), e);
|
||||
map.put("PressOrderList", null);
|
||||
return null;
|
||||
});
|
||||
// 4、生产任务
|
||||
@@ -77,7 +90,7 @@ public class CockpitServiceImpl implements CockpitService {
|
||||
CompletableFuture<Void> allQuery = CompletableFuture.allOf(
|
||||
listCompletableFuture,
|
||||
listShiftProductionFuture,
|
||||
listPersonnelMonthlyProductionFuture,
|
||||
pressOrderFuture,
|
||||
listProductionTaskFuture);
|
||||
CompletableFuture<ConcurrentHashMap<String, Object>> future
|
||||
= allQuery.thenApply((result) -> map).exceptionally((e) -> {
|
||||
@@ -87,4 +100,274 @@ public class CockpitServiceImpl implements CockpitService {
|
||||
future.join();
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConcurrentHashMap<String, Object> sortingMonitor() {
|
||||
ThreadPoolExecutor pool = ThreadPoolExecutorUtil.getPoll();
|
||||
ConcurrentHashMap<String, Object> resultMap = new ConcurrentHashMap<>();
|
||||
//查询分拣线信息
|
||||
CompletableFuture<List<SortingLineVo>> sortingLineCompletableFuture = CompletableFuture.supplyAsync(
|
||||
() -> cockPitMapper.getSortingLine(), pool);
|
||||
sortingLineCompletableFuture.thenAccept(res -> {
|
||||
resultMap.put("sortingLine", res);
|
||||
}).exceptionally((e) -> {
|
||||
log.error("获取分拣线信息: {}", e.getMessage(), e);
|
||||
resultMap.put("sortingLine", null);
|
||||
return null;
|
||||
});
|
||||
//查询当日拆码垛信息 todo
|
||||
CompletableFuture<List<StackVo>> unstackingCompletableFuture = CompletableFuture.supplyAsync(
|
||||
() -> cockPitMapper.getUnstackingList(), pool);
|
||||
unstackingCompletableFuture.thenAccept(res -> {
|
||||
resultMap.put("unstackingList", res);
|
||||
}).exceptionally((e) -> {
|
||||
log.error("获取当日已拆垛信息: {}", e.getMessage(), e);
|
||||
resultMap.put("unstackingList", null);
|
||||
return null;
|
||||
});
|
||||
//查询剩余工单列表
|
||||
CompletableFuture<List<WorkOrderVo>> lastWorkOrderCompletableFuture = CompletableFuture.supplyAsync(
|
||||
() -> cockPitMapper.getLastWorkOrderList(), pool);
|
||||
lastWorkOrderCompletableFuture.thenAccept(res -> {
|
||||
resultMap.put("lastWorkOrderList", res);
|
||||
}).exceptionally((e) -> {
|
||||
log.error("查询剩余工单列表: {}", e.getMessage(), e);
|
||||
resultMap.put("lastWorkOrderList", null);
|
||||
return null;
|
||||
});
|
||||
CompletableFuture<Void> allQuery = CompletableFuture.allOf(
|
||||
sortingLineCompletableFuture,
|
||||
unstackingCompletableFuture,
|
||||
lastWorkOrderCompletableFuture);
|
||||
CompletableFuture<ConcurrentHashMap<String, Object>> future
|
||||
= allQuery.thenApply((result) -> resultMap).exceptionally((e) -> {
|
||||
log.error(e.getMessage(), e);
|
||||
return null;
|
||||
});
|
||||
future.join();
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConcurrentHashMap<String, Object> screenTableData() {
|
||||
ThreadPoolExecutor pool = ThreadPoolExecutorUtil.getPoll();
|
||||
ConcurrentHashMap<String, Object> resultMap = new ConcurrentHashMap<>();
|
||||
//当日混料
|
||||
CompletableFuture<List<MixingVo>> mixingCompletableFuture = CompletableFuture.supplyAsync(
|
||||
() -> cockPitMapper.getMixingList(), pool);
|
||||
mixingCompletableFuture.thenAccept(result -> {
|
||||
resultMap.put("mixingList", result);
|
||||
}).exceptionally((e) -> {
|
||||
log.error("获取当日混料信息: {}", e.getMessage(), e);
|
||||
resultMap.put("mixingList", null);
|
||||
return null;
|
||||
});
|
||||
|
||||
//当日成品
|
||||
CompletableFuture<List<PressProductVo>> productCompletableFuture = CompletableFuture.supplyAsync(
|
||||
() -> cockPitMapper.getPressWorkerOrder(), pool);
|
||||
productCompletableFuture.thenAccept(result -> {
|
||||
resultMap.put("productList", result);
|
||||
}).exceptionally((e) -> {
|
||||
log.error("获取当日成品信息: {}", e.getMessage(), e);
|
||||
resultMap.put("productList", null);
|
||||
return null;
|
||||
});
|
||||
|
||||
//历史分析
|
||||
CompletableFuture<List<HistoryVo>> historyCompletableFuture = CompletableFuture.supplyAsync(
|
||||
() -> cockPitMapper.getHistoryList(), pool);
|
||||
historyCompletableFuture.thenAccept(result -> {
|
||||
resultMap.put("historyList", result);
|
||||
}).exceptionally((e) -> {
|
||||
log.error("获取历史分析信息: {}", e.getMessage(), e);
|
||||
resultMap.put("historyList", null);
|
||||
return null;
|
||||
});
|
||||
|
||||
//设备运行统计
|
||||
CompletableFuture<DeviceRunStatVo> deviceRunStatCompletableFuture = CompletableFuture.supplyAsync(
|
||||
() -> {
|
||||
List<String> devices = cockPitMapper.selectAllDevice();
|
||||
if (devices.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
JSONArray param = new JSONArray(Collections.singletonList(devices));
|
||||
AcsResponse devicesStatus = wmsToAcsService.getDeviceStatus(param);
|
||||
JSONArray data = ObjectUtil.isNotEmpty(devicesStatus) ? devicesStatus.getData() : param;
|
||||
// 初始化数据 数组下标:0关机 1待机 2生产中 3故障
|
||||
DeviceRunStatVo res = new DeviceRunStatVo();
|
||||
int total = data.size();
|
||||
int errorNum = 0;
|
||||
int freeNum = 0;
|
||||
int runNum = 0;
|
||||
int unProducedNum = 0;
|
||||
// 遍历判断
|
||||
for (int i = 0; i < data.size(); i++) {
|
||||
JSONObject device = data.getJSONObject(i);
|
||||
int status = ObjectUtil.isNotEmpty(device.getInteger("status"))
|
||||
? device.getInteger("status")
|
||||
: 0;
|
||||
if (status == 0) {
|
||||
unProducedNum++;
|
||||
}
|
||||
if (status == 1) {
|
||||
freeNum++;
|
||||
continue;
|
||||
}
|
||||
if (status == 2) {
|
||||
runNum++;
|
||||
continue;
|
||||
}
|
||||
if (status == 3) {
|
||||
errorNum++;
|
||||
}
|
||||
}
|
||||
res.setTotal(total);
|
||||
res.setErrorNum(errorNum);
|
||||
res.setFreeNum(freeNum);
|
||||
res.setRunNum(runNum);
|
||||
res.setUnProducedNum(unProducedNum);
|
||||
return res;
|
||||
}, pool);
|
||||
deviceRunStatCompletableFuture.thenAccept(result -> {
|
||||
resultMap.put("deviceRunStatList", result);
|
||||
}).exceptionally((e) -> {
|
||||
log.error("设备运行统计: {}", e.getMessage(), e);
|
||||
resultMap.put("deviceRunStatList", null);
|
||||
return null;
|
||||
});
|
||||
|
||||
//30天故障top10
|
||||
CompletableFuture<List<DeviceErrorVo>> errorCompletableFuture = CompletableFuture.supplyAsync(
|
||||
() -> dasDeviceErrorRecordService.queryErrorVo(), pool);
|
||||
errorCompletableFuture.thenAccept(result -> {
|
||||
resultMap.put("deviceErrorList", result);
|
||||
}).exceptionally((e) -> {
|
||||
log.error("30天故障top10: {}", e.getMessage(), e);
|
||||
resultMap.put("deviceErrorList", null);
|
||||
return null;
|
||||
});
|
||||
|
||||
//设备报警信息
|
||||
CompletableFuture<List<DasDeviceErrorRecord>> errorRecordCompletableFuture = CompletableFuture.supplyAsync(
|
||||
() -> dasDeviceErrorRecordService.queryRecord(), pool);
|
||||
errorRecordCompletableFuture.thenAccept(result -> {
|
||||
resultMap.put("deviceErrorRecordList", result);
|
||||
}).exceptionally((e) -> {
|
||||
log.error("设备报警信息: {}", e.getMessage(), e);
|
||||
resultMap.put("deviceErrorRecordList", null);
|
||||
return null;
|
||||
});
|
||||
|
||||
CompletableFuture<Void> allQuery = CompletableFuture.allOf(
|
||||
mixingCompletableFuture,
|
||||
productCompletableFuture,
|
||||
historyCompletableFuture,
|
||||
deviceRunStatCompletableFuture,
|
||||
errorCompletableFuture,
|
||||
errorRecordCompletableFuture);
|
||||
CompletableFuture<ConcurrentHashMap<String, Object>> future
|
||||
= allQuery.thenApply((result) -> resultMap).exceptionally((e) -> {
|
||||
log.error(e.getMessage(), e);
|
||||
return null;
|
||||
});
|
||||
future.join();
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object deviceCondition() {
|
||||
List<DeviceConditionVo> res = new ArrayList<>();
|
||||
// 获取所有设备
|
||||
List<String> allDevice = cockPitMapper.selectAllDevice();
|
||||
if (allDevice.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
JSONArray param = new JSONArray(Collections.singletonList(allDevice));
|
||||
AcsResponse devicesStatus = wmsToAcsService.getDeviceStatus(param);
|
||||
JSONArray data = ObjectUtil.isNotEmpty(devicesStatus) ? devicesStatus.getData() : param;
|
||||
// JSONObject devicesStatus = null;
|
||||
// 初始化数据 数组下标:0关机 1待机 2生产中 3故障
|
||||
JSONObject total = new JSONObject();
|
||||
DeviceEnum[] values = DeviceEnum.values();
|
||||
for (DeviceEnum deviceEnum : values) {
|
||||
total.put(deviceEnum.getCode(), new int[4]);
|
||||
}
|
||||
// 遍历判断
|
||||
for (int i = 0; i < data.size(); i++) {
|
||||
JSONObject device = data.getJSONObject(i);
|
||||
Integer devicesStatus1 = ObjectUtil.isNotEmpty(device.getInteger("status"))
|
||||
? device.getInteger("status")
|
||||
: 0;
|
||||
String regionCode = device.getString("region_code");
|
||||
DeviceEnum deviceEnumByCode = DeviceEnum.getDeviceEnumByCode(regionCode); // 获取属于哪种设备
|
||||
int[] ints = (int[]) total.get(deviceEnumByCode.getCode());
|
||||
ints[devicesStatus1] = ints[devicesStatus1] + 1;
|
||||
total.put(deviceEnumByCode.getCode(), ints);
|
||||
}
|
||||
// 返回输出值
|
||||
for (DeviceEnum value : values) { // 4个
|
||||
int[] ints = (int[]) total.get(value.getCode());
|
||||
DeviceConditionVo dto = new DeviceConditionVo();
|
||||
dto.setDeviceName(value.getDevice_name()); // 列名
|
||||
dto.setShutdown(ints[0]);
|
||||
dto.setStandby(ints[1]);
|
||||
dto.setRunning(ints[2]);
|
||||
dto.setFailure(ints[3]);
|
||||
res.add(dto);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public MixingDetailVo selectMixingDetail(Map whereJson) {
|
||||
//// Object deviceCode = ObjectUtil.isNotEmpty(whereJson.get("deviceCode"));
|
||||
//// if (ObjectUtil.isEmpty(deviceCode)){
|
||||
//// return null;
|
||||
//// }
|
||||
// //todo 假数据
|
||||
// MixingDetailVo res = new MixingDetailVo();
|
||||
// res.setPoint("8");
|
||||
// res.setMaterialCode("W001");
|
||||
// res.setMaterialName("物料1");
|
||||
// res.setWeight("800");
|
||||
// res.setUpdateTime("2020-11-28 09:09:09");
|
||||
// return res;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public List<InOutKilnVo> selectInOutKilnDetail() {
|
||||
//todo 确定每托盘数量
|
||||
List<InOutKilnVo> res = new ArrayList<>();
|
||||
InOutKilnVo in = cockPitMapper.selectInKilnInfo();
|
||||
in.setStat("1");
|
||||
in.setPointName("入窑输送线");
|
||||
in.setWorkTime("3.5");
|
||||
in.setMaterialNum("25000");
|
||||
InOutKilnVo out = cockPitMapper.selectOutKilnInfo();
|
||||
if (null == out){
|
||||
out = new InOutKilnVo();
|
||||
}
|
||||
out.setStat("1");
|
||||
out.setPointName("出窑输送线");
|
||||
out.setWorkTime("3.5");
|
||||
out.setMaterialNum("25000");
|
||||
out.setDeliveredMaterialNum("25000");
|
||||
res.add(in);
|
||||
res.add(out);
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public KilnVo selectKilnDetail() {
|
||||
KilnVo kilnVo = cockPitMapper.selectKilnInfo();
|
||||
kilnVo.setPointName("窑1");
|
||||
kilnVo.setWorkTime("3.5");
|
||||
kilnVo.setMaterialNum("5000");
|
||||
kilnVo.setProduceNum("25000");
|
||||
List<KilnMaterialInfo> kilnMaterialInfo = cockPitMapper.selectKilnMaterialInfo();
|
||||
kilnVo.setMaterialInfos(kilnMaterialInfo);
|
||||
return kilnVo;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
package org.nl.wms.cockpit.service.mapper;
|
||||
|
||||
import org.nl.wms.cockpit.service.dao.PersonnelMonthlyProductionVo;
|
||||
import org.nl.wms.cockpit.service.dao.PressProductHeaderVo;
|
||||
import org.nl.wms.cockpit.service.dao.ProductTaskVo;
|
||||
import org.nl.wms.cockpit.service.dao.ShiftProductionVo;
|
||||
import org.nl.wms.cockpit.service.dao.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -13,11 +10,33 @@ import java.util.List;
|
||||
* @Date: 2023/9/25
|
||||
*/
|
||||
public interface CockPitMapper {
|
||||
List<PressProductHeaderVo> getPressProductHeaderList(String dayShift);
|
||||
List<PressProductHeaderVo> getPressProductHeaderList();
|
||||
|
||||
List<ShiftProductionVo> getShiftProductionList(String dayShift);
|
||||
|
||||
List<PersonnelMonthlyProductionVo> getPersonnelMonthlyProductionList(String dayShift);
|
||||
List<ShiftProductionVo> getShiftProductionList();
|
||||
|
||||
List<PressOrderVo> getPressOrderVoList();
|
||||
List<ProductTaskVo> getProductionTaskList();
|
||||
|
||||
List<SortingLineVo> getSortingLine();
|
||||
|
||||
List<StackVo> getUnstackingList();
|
||||
|
||||
List<WorkOrderVo> getLastWorkOrderList();
|
||||
|
||||
List<MixingVo> getMixingList();
|
||||
|
||||
List<PressProductVo> getPressWorkerOrder();
|
||||
|
||||
List<HistoryVo> getHistoryList();
|
||||
|
||||
List<String> selectAllDevice();
|
||||
|
||||
InOutKilnVo selectInKilnInfo();
|
||||
|
||||
InOutKilnVo selectOutKilnInfo();
|
||||
|
||||
KilnVo selectKilnInfo();
|
||||
List<KilnMaterialInfo> selectKilnMaterialInfo();
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -2,65 +2,220 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.nl.wms.cockpit.service.mapper.CockPitMapper">
|
||||
<select id="getPressProductHeaderList" resultType="org.nl.wms.cockpit.service.dao.PressProductHeaderVo">
|
||||
SELECT
|
||||
SUM(w.plan_qty) AS plan_qty,
|
||||
SUM(w.real_qty) AS real_qty,
|
||||
SUM(w.qualified_qty) AS qualified_qty,
|
||||
SUM(w.unqualified_qty) AS unqualified_qty
|
||||
FROM
|
||||
pdm_bd_workorder w
|
||||
SELECT SUM(w.plan_qty) AS plan_qty,
|
||||
SUM(w.real_qty) AS real_qty,
|
||||
SUM(w.qualified_qty) AS qualified_qty,
|
||||
SUM(w.unqualified_qty) AS unqualified_qty
|
||||
FROM pdm_bd_workorder w
|
||||
WHERE
|
||||
DATE( w.produce_date ) = CURDATE() AND w.team = #{dayShift};
|
||||
DATE ( w.produce_date ) = CURDATE()
|
||||
</select>
|
||||
<select id="getShiftProductionList" resultType="org.nl.wms.cockpit.service.dao.ShiftProductionVo">
|
||||
SELECT
|
||||
w.point_name AS column_name,
|
||||
SUM(w.qualified_qty) AS qualified_qty,
|
||||
SUM(w.unqualified_qty) AS unqualified_qty,
|
||||
SUM(w.plan_qty - w.qualified_qty - w.unqualified_qty) AS total_difference
|
||||
FROM
|
||||
`pdm_bd_workorder` w
|
||||
SELECT w.point_name AS columnName,
|
||||
SUM(w.qualified_qty) AS qualifiedQty,
|
||||
SUM(w.unqualified_qty) AS unqualifiedQty,
|
||||
SUM(w.plan_qty - w.qualified_qty - w.unqualified_qty) AS lastQty
|
||||
FROM `pdm_bd_workorder` w
|
||||
WHERE
|
||||
DATE( w.produce_date ) = CURDATE()
|
||||
AND w.team = #{dayShift}
|
||||
DATE ( w.produce_date ) = CURDATE()
|
||||
GROUP BY w.point_name
|
||||
order by w.point_name
|
||||
</select>
|
||||
<select id="getPersonnelMonthlyProductionList"
|
||||
resultType="org.nl.wms.cockpit.service.dao.PersonnelMonthlyProductionVo">
|
||||
SELECT
|
||||
w.operator,
|
||||
SUM(w.real_qty) AS real_qty
|
||||
FROM
|
||||
`pdm_bd_workorder` w
|
||||
WHERE DATE_FORMAT(w.produce_date, '%Y-%m') = DATE_FORMAT(CURDATE(), '%Y-%m') AND w.team = '白班'
|
||||
GROUP BY w.operator
|
||||
|
||||
<select id="getPressOrderVoList" resultType="org.nl.wms.cockpit.service.dao.PressOrderVo">
|
||||
SELECT SUM(w.plan_qty) AS planQty,
|
||||
SUM(w.real_qty) AS realQty,
|
||||
FORMAT(
|
||||
IF
|
||||
(SUM(w.plan_qty) != 0, SUM(w.real_qty) / SUM(w.plan_qty), 0),
|
||||
2
|
||||
) AS rate,
|
||||
m.order_number as orderNumber
|
||||
FROM pdm_bd_workorder w
|
||||
LEFT JOIN md_base_material m ON m.material_id = w.material_id
|
||||
WHERE
|
||||
DATE ( w.produce_date ) = CURDATE()
|
||||
GROUP BY
|
||||
m.order_number
|
||||
</select>
|
||||
<select id="getProductionTaskList" resultType="org.nl.wms.cockpit.service.dao.ProductTaskVo">
|
||||
SELECT
|
||||
w.point_name AS device,
|
||||
w.workorder_code,
|
||||
w.team,
|
||||
m.material_name,
|
||||
w.planproducestart_date,
|
||||
w.plan_qty,
|
||||
w.real_qty,
|
||||
w.unqualified_qty,
|
||||
FORMAT((w.qualified_qty / w.plan_qty) * 100, 1) AS qualified_rate,
|
||||
CASE w.workorder_status
|
||||
WHEN '1' THEN '未生产'
|
||||
WHEN '2' THEN '已下发'
|
||||
WHEN '3' THEN '生产中'
|
||||
WHEN '4' THEN '暂停'
|
||||
WHEN '5' THEN '完成'
|
||||
ELSE ''
|
||||
END AS workorder_status,
|
||||
w.operator,
|
||||
IF(LENGTH(w.realproducestart_date)>0,w.realproducestart_date,'-') AS realproducestart_date,
|
||||
IF(LENGTH(w.realproduceend_date)>0,w.realproduceend_date,'-') AS realproduceend_date
|
||||
FROM
|
||||
`pdm_bd_workorder` w
|
||||
LEFT JOIN md_base_material m ON m.material_id = w.material_id
|
||||
SELECT w.point_name AS device,
|
||||
w.workorder_code as workorderCode,
|
||||
w.team,
|
||||
m.material_name as materialName,
|
||||
w.planproducestart_date as planproducestartDate,
|
||||
w.plan_qty as planQty,
|
||||
w.real_qty as realQty,
|
||||
w.unqualified_qty as unqualifiedQty,
|
||||
FORMAT((w.qualified_qty / w.plan_qty) * 100, 1) AS qualifiedRate,
|
||||
CASE w.workorder_status
|
||||
WHEN '1' THEN '未生产'
|
||||
WHEN '2' THEN '已下发'
|
||||
WHEN '3' THEN '生产中'
|
||||
WHEN '4' THEN '暂停'
|
||||
WHEN '5' THEN '完成'
|
||||
ELSE ''
|
||||
END AS workorderStatus,
|
||||
w.operator,
|
||||
IF(LENGTH(w.realproducestart_date) > 0, w.realproducestart_date, '-') AS realproducestartDate,
|
||||
IF(LENGTH(w.realproduceend_date) > 0, w.realproduceend_date, '-') AS realproduceendDate
|
||||
FROM `pdm_bd_workorder` w
|
||||
LEFT JOIN md_base_material m ON m.material_id = w.material_id
|
||||
WHERE w.region_code = 'YZ'
|
||||
ORDER BY w.team DESC, w.workorder_status
|
||||
</select>
|
||||
|
||||
<select id="getSortingLine" resultType="org.nl.wms.cockpit.service.dao.SortingLineVo">
|
||||
SELECT w.workorder_code as workorderCode,
|
||||
w.point_name as pointName,
|
||||
w.plan_qty as planQty,
|
||||
w.real_qty as realQty,
|
||||
w.customer,
|
||||
m.material_name as materialName,
|
||||
m.material_spec as materialSpec
|
||||
FROM pdm_bd_workorder w
|
||||
LEFT JOIN md_base_material m ON m.material_id = w.material_id
|
||||
WHERE w.region_code = 'FJ'
|
||||
and w.workorder_status = '3'
|
||||
order by w.create_time
|
||||
</select>
|
||||
|
||||
<select id="getUnstackingList" resultType="org.nl.wms.cockpit.service.dao.StackVo">
|
||||
SELECT
|
||||
t.create_time AS createTime,
|
||||
t.vehicle_code AS vehicleCode,
|
||||
m.material_name AS materialName,
|
||||
g.material_qty AS materialQty,
|
||||
g.material_weight AS materialWeight
|
||||
FROM
|
||||
`sch_base_task` t
|
||||
LEFT JOIN sch_base_vehiclematerialgroup g ON t.group_id = g.group_id
|
||||
LEFT JOIN md_base_material m ON g.material_id = m.material_id
|
||||
WHERE
|
||||
t.config_code ='FJQLTask'
|
||||
AND t.task_status = '5'
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
<select id="getLastWorkOrderList" resultType="org.nl.wms.cockpit.service.dao.WorkOrderVo">
|
||||
SELECT w.workorder_code as workorderCode,
|
||||
m.material_name as materialName,
|
||||
m.material_spec as materialSpec,
|
||||
w.plan_qty as planQty,
|
||||
w.plan_weight as planWeight,
|
||||
w.produce_order as produceOrder,
|
||||
w.customer,
|
||||
w.vehicle_type as vehicleType,
|
||||
w.create_time as createTime
|
||||
FROM pdm_bd_workorder w
|
||||
LEFT JOIN md_base_material m ON m.material_id = w.material_id
|
||||
WHERE w.region_code = 'FJ'
|
||||
AND w.workorder_status <![CDATA[ <> ]]> '5'
|
||||
ORDER BY w.create_time
|
||||
</select>
|
||||
|
||||
<select id="getMixingList" resultType="org.nl.wms.cockpit.service.dao.MixingVo">
|
||||
SELECT m.material_name AS materialName,
|
||||
SUM(w.plan_qty) AS planQty,
|
||||
SUM(w.real_qty) AS realQty
|
||||
FROM pdm_bd_workorder w
|
||||
LEFT JOIN md_base_material m ON m.material_id = w.material_id
|
||||
WHERE w.region_code = 'HN'
|
||||
and DATE ( w.produce_date ) = CURDATE()
|
||||
GROUP BY m.material_name
|
||||
order by m.material_name
|
||||
</select>
|
||||
|
||||
<select id="getPressWorkerOrder" resultType="org.nl.wms.cockpit.service.dao.PressProductVo">
|
||||
SELECT m.material_name as materialName,
|
||||
SUM(w.plan_qty) as requiredNum,
|
||||
SUM(CASE WHEN w.workorder_status = '5' THEN w.plan_qty ELSE 0 END) AS finishedNum,
|
||||
SUM(CASE
|
||||
WHEN w.workorder_status = '3' or w.workorder_status = '4'
|
||||
THEN w.plan_qty
|
||||
ELSE 0 END) AS suppressedNum
|
||||
FROM pdm_bd_workorder w
|
||||
LEFT JOIN md_base_material m ON w.material_id = m.material_id
|
||||
WHERE w.region_code = 'YZ'
|
||||
AND w.workorder_status IN ('2', '3', '4', '5')
|
||||
AND w.produce_date = DATE_FORMAT(CURRENT_DATE (), '%Y%m%d')
|
||||
group by m.material_name
|
||||
order by m.material_name
|
||||
</select>
|
||||
|
||||
<select id="getHistoryList" resultType="org.nl.wms.cockpit.service.dao.HistoryVo">
|
||||
SELECT DATE_FORMAT(produce_date, '%m-%d') as produceDate,
|
||||
SUM(CASE WHEN workorder_status = '5' THEN plan_qty ELSE 0 END) AS finishedNum,
|
||||
SUM(CASE
|
||||
WHEN workorder_status = '3' or workorder_status = '4'
|
||||
THEN plan_qty
|
||||
ELSE 0 END) AS suppressedNum
|
||||
FROM pdm_bd_workorder
|
||||
WHERE region_code = 'YZ'
|
||||
AND workorder_status IN ('2', '3', '4', '5')
|
||||
AND produce_date >= CURDATE() - INTERVAL 7 DAY
|
||||
group by produceDate
|
||||
order by produce_date desc
|
||||
</select>
|
||||
|
||||
<select id="selectAllDevice" resultType="java.lang.String">
|
||||
SELECT point_code
|
||||
FROM sch_base_point
|
||||
WHERE is_used = '1'
|
||||
</select>
|
||||
|
||||
<select id="selectInKilnInfo" resultType="org.nl.wms.cockpit.service.dao.InOutKilnVo">
|
||||
SELECT COUNT(1) as palletNum,
|
||||
sum(sbv.material_qty) as deliveredMaterialNum,
|
||||
(select count(1)
|
||||
from sch_base_task
|
||||
WHERE config_code = 'YZMLTask'
|
||||
and task_status = '5'
|
||||
and DATE ( create_time ) = CURDATE()) as deliveredPalletNum
|
||||
FROM sch_base_vehiclematerialgroup sbv
|
||||
left join sch_base_point p
|
||||
on p.vehicle_code = sbv.vehicle_code
|
||||
WHERE sbv.group_bind_material_status = '2'
|
||||
and p.point_status = '1'
|
||||
and p.is_used = '1'
|
||||
and p.region_code = 'RYHCX'
|
||||
and DATE ( sbv.create_time ) = CURDATE()
|
||||
</select>
|
||||
|
||||
<select id="selectOutKilnInfo" resultType="org.nl.wms.cockpit.service.dao.InOutKilnVo">
|
||||
select count(1) as deliveredPalletNum,
|
||||
count(1) - (select count(1)
|
||||
from sch_base_task
|
||||
where config_code = 'CYHCXMLTask'
|
||||
and task_status = '5'
|
||||
and DATE ( create_time ) = CURDATE()) as palletNum
|
||||
from sch_base_vehiclematerialgroup
|
||||
where out_kiln_time is not null
|
||||
and DATE ( create_time ) = CURDATE()
|
||||
</select>
|
||||
|
||||
<select id="selectKilnInfo" resultType="org.nl.wms.cockpit.service.dao.KilnVo">
|
||||
select COUNT(IF(out_kiln_time IS NULL, 1, NULL)) as palletNum,
|
||||
count(IF(out_kiln_time IS NOT NULL, 1, NULL)) as produceNum
|
||||
from sch_base_vehiclematerialgroup
|
||||
where into_kiln_time IS NOT NULL
|
||||
and DATE ( create_time ) = CURDATE()
|
||||
</select>
|
||||
|
||||
<select id="selectKilnMaterialInfo" resultType="org.nl.wms.cockpit.service.dao.KilnMaterialInfo">
|
||||
SELECT
|
||||
sum(vg.material_qty) as producedNum,
|
||||
m.material_code as producedNum,
|
||||
c.cust_name as customer
|
||||
FROM
|
||||
`sch_base_vehiclematerialgroup` vg
|
||||
LEFT JOIN md_base_material m ON m.material_id = vg.material_id
|
||||
LEFT JOIN md_cs_customerbase c ON vg.customer = c.cust_id
|
||||
WHERE
|
||||
vg.into_kiln_time IS NOT NULL
|
||||
AND vg.out_kiln_time IS NULL
|
||||
and DATE ( vg.create_time ) = CURDATE()
|
||||
GROUP BY
|
||||
m.material_code, c.cust_name
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package org.nl.wms.das.device.record.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.wms.cockpit.service.dao.DeviceErrorVo;
|
||||
import org.nl.wms.das.device.check.service.dao.DasDeviceCheckRecord;
|
||||
import org.nl.wms.das.device.record.service.dao.DasDeviceErrorRecord;
|
||||
import org.nl.wms.pda.service.dao.vo.PdaResponseVo;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @description 服务接口
|
||||
* @author lyd
|
||||
* @date 2023-08-01
|
||||
**/
|
||||
public interface IDasDeviceErrorRecordService extends IService<DasDeviceErrorRecord> {
|
||||
|
||||
IPage<DasDeviceErrorRecord> queryAll( PageQuery pageable);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
* @param entity /
|
||||
*/
|
||||
int create(DasDeviceErrorRecord entity);
|
||||
|
||||
List<DeviceErrorVo> queryErrorVo();
|
||||
|
||||
List<DasDeviceErrorRecord> queryRecord();
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package org.nl.wms.das.device.record.service.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("das_device_error_record")
|
||||
public class DasDeviceErrorRecord implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "record_id", type = IdType.NONE)
|
||||
@ApiModelProperty(value = "记录标识")
|
||||
private String record_id;
|
||||
|
||||
@ApiModelProperty(value = "设备号")
|
||||
private String device_code;
|
||||
|
||||
@ApiModelProperty(value = "记录时间")
|
||||
private String record_time;
|
||||
|
||||
@ApiModelProperty(value = "故障")
|
||||
private String error;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package org.nl.wms.das.device.record.service.dao.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.nl.wms.cockpit.service.dao.DeviceErrorVo;
|
||||
import org.nl.wms.das.device.record.service.dao.DasDeviceErrorRecord;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
*/
|
||||
public interface DasDeviceErrorRecordMapper extends BaseMapper<DasDeviceErrorRecord> {
|
||||
|
||||
List<DeviceErrorVo> queryErrorVo();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.nl.wms.das.device.record.service.dao.mapper.DasDeviceErrorRecordMapper">
|
||||
|
||||
<select id="queryErrorVo" resultType="org.nl.wms.cockpit.service.dao.DeviceErrorVo">
|
||||
select p.point_name as deviceName,
|
||||
count(*) as errorNum
|
||||
from das_device_check_record r
|
||||
left join sch_base_point p on r.device_code = p.point_code
|
||||
where STR_TO_DATE(r.record_time, '%Y-%m-%d') > NOW() - INTERVAL 30 DAY
|
||||
group by deviceName
|
||||
order by errorNum desc
|
||||
limit 10
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,61 @@
|
||||
package org.nl.wms.das.device.record.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.wms.cockpit.service.dao.DeviceErrorVo;
|
||||
import org.nl.wms.das.device.check.service.dao.DasDeviceCheckRecord;
|
||||
import org.nl.wms.das.device.check.service.dao.mapper.DasDeviceCheckRecordMapper;
|
||||
import org.nl.wms.das.device.record.service.IDasDeviceErrorRecordService;
|
||||
import org.nl.wms.das.device.record.service.dao.DasDeviceErrorRecord;
|
||||
import org.nl.wms.das.device.record.service.dao.mapper.DasDeviceErrorRecordMapper;
|
||||
import org.nl.wms.pda.service.dao.vo.PdaResponseVo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class IDasDeviceErrorRecordServiceImpl extends ServiceImpl<DasDeviceErrorRecordMapper, DasDeviceErrorRecord> implements IDasDeviceErrorRecordService {
|
||||
@Autowired
|
||||
private DasDeviceErrorRecordMapper dasDeviceCheckRecordMapper;
|
||||
|
||||
@Override
|
||||
public IPage<DasDeviceErrorRecord> queryAll(PageQuery page) {
|
||||
LambdaQueryWrapper<DasDeviceErrorRecord> lam = new LambdaQueryWrapper<>();
|
||||
lam.orderByDesc(DasDeviceErrorRecord::getRecord_time);
|
||||
IPage<DasDeviceErrorRecord> pages = new Page<>(page.getPage() + 1, page.getSize());
|
||||
dasDeviceCheckRecordMapper.selectPage(pages, lam);
|
||||
return pages;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int create(DasDeviceErrorRecord entity) {
|
||||
entity.setRecord_id(IdUtil.getSnowflake(1, 1).nextIdStr());
|
||||
entity.setRecord_time(DateUtil.now());
|
||||
return dasDeviceCheckRecordMapper.insert(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeviceErrorVo> queryErrorVo() {
|
||||
return dasDeviceCheckRecordMapper.queryErrorVo();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DasDeviceErrorRecord> queryRecord() {
|
||||
LambdaQueryWrapper<DasDeviceErrorRecord> lam = new LambdaQueryWrapper<>();
|
||||
lam.orderByDesc(DasDeviceErrorRecord::getRecord_time);
|
||||
lam.last("LIMIT 100");
|
||||
return dasDeviceCheckRecordMapper.selectList(lam);
|
||||
}
|
||||
}
|
||||
@@ -26,10 +26,10 @@ import java.util.Set;
|
||||
|
||||
|
||||
/**
|
||||
* @description 服务实现
|
||||
* @author lyd
|
||||
* @date 2023-05-05
|
||||
**/
|
||||
* @author lyd
|
||||
* @description 服务实现
|
||||
* @date 2023-05-05
|
||||
**/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class MdBaseMaterialServiceImpl extends ServiceImpl<MdBaseMaterialMapper, MdBaseMaterial> implements IMdBaseMaterialService {
|
||||
@@ -40,7 +40,7 @@ public class MdBaseMaterialServiceImpl extends ServiceImpl<MdBaseMaterialMapper,
|
||||
private MesRequestMapper mesRequestMapper;
|
||||
|
||||
@Override
|
||||
public IPage<MdBaseMaterial> queryAll(Map whereJson, PageQuery page){
|
||||
public IPage<MdBaseMaterial> queryAll(Map whereJson, PageQuery page) {
|
||||
String blurry = ObjectUtil.isNotEmpty(whereJson.get("blurry")) ? whereJson.get("blurry").toString() : null;
|
||||
Boolean is_used = ObjectUtil.isNotEmpty(whereJson.get("is_used"))
|
||||
? Boolean.valueOf(whereJson.get("is_used").toString()) : null;
|
||||
|
||||
@@ -34,5 +34,12 @@ public class AcsToWmsController {
|
||||
public ResponseEntity<Object> apply(@RequestBody JSONObject param) {
|
||||
return new ResponseEntity<>(acsToWmsService.acsApply(param), HttpStatus.OK);
|
||||
}
|
||||
@PostMapping("/errorDeviceRecord")
|
||||
@ApiOperation("设备异常记录")
|
||||
@Log("设备异常记录")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> errorDeviceRecord(@RequestBody JSONObject param) {
|
||||
return new ResponseEntity<>(acsToWmsService.errorDeviceRecord(param), HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -59,4 +59,6 @@ public interface AcsToWmsService {
|
||||
|
||||
/** 分拣 申请取走满料盅托盘 任务不下发*/
|
||||
BaseResponse woodenPalletBinding(JSONObject param);
|
||||
|
||||
JSONObject errorDeviceRecord(JSONObject param);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package org.nl.wms.ext.acs.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.wms.ext.acs.service.dto.ResultForAcs;
|
||||
import org.nl.wms.ext.acs.service.dto.to.acs.DeviceInfoDto;
|
||||
import org.nl.wms.ext.acs.service.dto.to.acs.PutActionRequest;
|
||||
@@ -43,4 +45,9 @@ public interface WmsToAcsService {
|
||||
* @return
|
||||
*/
|
||||
AcsResponse getDeviceStatusByCode(List<DeviceInfoDto> list);
|
||||
|
||||
/**
|
||||
* 获取设备运行状态-大屏
|
||||
*/
|
||||
AcsResponse getDeviceStatus(JSONArray param);
|
||||
}
|
||||
|
||||
@@ -13,6 +13,8 @@ import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.system.service.notice.ISysNoticeService;
|
||||
import org.nl.wms.das.device.record.service.IDasDeviceErrorRecordService;
|
||||
import org.nl.wms.das.device.record.service.dao.DasDeviceErrorRecord;
|
||||
import org.nl.wms.das.inspection.service.IDasQualityInspectionService;
|
||||
import org.nl.wms.database.brick.service.IMdBaseBrickInfoService;
|
||||
import org.nl.wms.database.material.service.IMdBaseMaterialService;
|
||||
@@ -128,6 +130,9 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
@Autowired
|
||||
private YZMapper yzMapper;
|
||||
|
||||
@Autowired
|
||||
private IDasDeviceErrorRecordService dasDeviceErrorRecordService;
|
||||
|
||||
// 初始化反射方法
|
||||
@PostConstruct
|
||||
public void initCacheMethod() {
|
||||
@@ -1038,4 +1043,16 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
vehiclematerialgroupService.saveOrUpdate(groupEntity);
|
||||
return BaseResponse.responseOk(requestNo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject errorDeviceRecord(JSONObject param) {
|
||||
DasDeviceErrorRecord dasDeviceErrorRecord = new DasDeviceErrorRecord();
|
||||
dasDeviceErrorRecord.setDevice_code( param.getString("device_code"));
|
||||
dasDeviceErrorRecord.setError(param.getString("error"));
|
||||
dasDeviceErrorRecordService.create(dasDeviceErrorRecord);
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("status", org.springframework.http.HttpStatus.OK.value());
|
||||
result.put("message", "故障上报完成!");
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package org.nl.wms.ext.acs.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.wms.ext.acs.service.WmsToAcsService;
|
||||
import org.nl.wms.ext.acs.service.dto.ResultForAcs;
|
||||
@@ -16,6 +18,7 @@ import org.nl.wms.sch.task_manage.task.AcsUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -64,4 +67,10 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
interactRecordService.saveRecord("获取设备信息", list, resultForAcs, GeneralDefinition.LMS_ACS);
|
||||
return resultForAcs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AcsResponse getDeviceStatus(JSONArray whereJson) {
|
||||
String api = "api/wms/getDeviceStatus";
|
||||
return AcsUtil.notifyAcs2(api, whereJson);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user