diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/largeScreen/controller/ProductionLargeScreenController.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/largeScreen/controller/ProductionLargeScreenController.java index 8e452b39..1cd28b6b 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/largeScreen/controller/ProductionLargeScreenController.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/largeScreen/controller/ProductionLargeScreenController.java @@ -33,4 +33,11 @@ public class ProductionLargeScreenController { return Result.OK(data); } + @ApiOperation(value = "获取生产设备大屏数据", notes = "获取生产设备大屏数据") + @GetMapping("/shengchanxian_data") + public Result shengchanxian_data() { + Map data = productionLargeService.shengchanxian_data(); + return Result.OK(data); + } + } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/largeScreen/service/ProductionLargeService.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/largeScreen/service/ProductionLargeService.java index cacff101..cc38e88c 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/largeScreen/service/ProductionLargeService.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/largeScreen/service/ProductionLargeService.java @@ -5,4 +5,6 @@ import java.util.Map; public interface ProductionLargeService { Map getData(); + + Map shengchanxian_data(); } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/largeScreen/service/impl/ProductionLargeServiceImpl.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/largeScreen/service/impl/ProductionLargeServiceImpl.java index 3bd4988c..6e814ac7 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/largeScreen/service/impl/ProductionLargeServiceImpl.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/largeScreen/service/impl/ProductionLargeServiceImpl.java @@ -64,7 +64,71 @@ public class ProductionLargeServiceImpl implements ProductionLargeService { resultMap.put("diaogua_data", diaoguaData);*/ - //2,生产线实时状态 +// //2,生产线实时状态 +// List stationGroup = iStationService.list(new LambdaQueryWrapper().groupBy(Station::getDepartId)); +// Map shengchanxianMap = new LinkedHashMap<>(); +// if (!ObjectUtils.isEmpty(stationGroup)) { +// stationGroup.stream().forEach(station -> { +// Map departMap = new LinkedHashMap<>(); +// //每个车间的工位 +// List stationList = iStationService.list(new LambdaQueryWrapper() +// .eq(Station::getDepartId, station.getDepartId()) +// .orderByAsc(Station::getStationNum) +// ); +// /** +// * 取每个工位的,生产记录状态0(生产中)的最新一条数据 +// */ +// List productRecordVos = new LinkedList<>(); +// Optional.ofNullable(stationList).orElse(new LinkedList<>()).forEach(obj -> { +// ProductRecord productRecord = iProductRecordService.getOne(new LambdaQueryWrapper() +// .eq(ProductRecord::getStationId, obj.getId()) +// .eq(ProductRecord::getStatus, "0") +// .orderByDesc(ProductRecord::getCreateTime) +// .last("limit 1") +// ); +// if (!ObjectUtils.isEmpty(productRecord)) { +// ZyProductPlan productPlan = iZyProductPlanService.getOne(new LambdaQueryWrapper().eq(ZyProductPlan::getProductCode, productRecord.getOrderCode())); +// Optional.ofNullable(productPlan).orElseThrow(() -> new JeecgBootException("工单编号:" + productRecord.getOrderCode() + "不存在!")); +// List zyPlanProcessList = iZyPlanProcessService.list(new LambdaQueryWrapper() +// .eq(ZyPlanProcess::getPlanId, productPlan.getId()) +// .eq(ZyPlanProcess::getStationId, obj.getId()) +// ); +// if (!ObjectUtils.isEmpty(zyPlanProcessList)) { +// ZyPlanProcess zyPlanProcess = zyPlanProcessList.get(0); +// ProductRecordVo vo = new ProductRecordVo(); +// vo.setProductCode(productRecord.getOrderCode()); +// vo.setProcessName(zyPlanProcess.getProcessName()); +// vo.setStationName(zyPlanProcess.getStationName()); +// vo.setMachineNames(zyPlanProcess.getMachineNames()); +// vo.setStationNum(zyPlanProcess.getStationNum()); +// productRecordVos.add(vo); +// } else { +// ProductRecordVo vo = new ProductRecordVo(); +// vo.setStationName(obj.getStationName()); +// vo.setStationNum(obj.getStationNum()); +// productRecordVos.add(vo); +// } +// } else { +// ProductRecordVo vo = new ProductRecordVo(); +// vo.setStationName(obj.getStationName()); +// vo.setStationNum(obj.getStationNum()); +// productRecordVos.add(vo); +// } +// }); +// SysDepart depart = iSysDepartService.getOne(new LambdaQueryWrapper().eq(SysDepart::getId, station.getDepartId())); +//// productRecordVos.stream().map(o -> o.getStationNum()).collect(Collectors.toList()); +// departMap.put(depart.getDepartName(), productRecordVos); +// shengchanxianMap.putAll(departMap); +// }); +// } +// resultMap.put("shengchanxian_data", shengchanxianMap); + return resultMap; + } + + @Override + public Map shengchanxian_data() { + Map resultMap = new HashMap<>(); + List stationGroup = iStationService.list(new LambdaQueryWrapper().groupBy(Station::getDepartId)); Map shengchanxianMap = new LinkedHashMap<>(); if (!ObjectUtils.isEmpty(stationGroup)) { @@ -80,34 +144,32 @@ public class ProductionLargeServiceImpl implements ProductionLargeService { */ List productRecordVos = new LinkedList<>(); Optional.ofNullable(stationList).orElse(new LinkedList<>()).forEach(obj -> { - ProductRecord productRecord = iProductRecordService.getOne(new LambdaQueryWrapper() - .eq(ProductRecord::getStationId, obj.getId()) - .eq(ProductRecord::getStatus, "0") - .orderByDesc(ProductRecord::getCreateTime) - .last("limit 1") - ); - if (!ObjectUtils.isEmpty(productRecord)) { - ZyProductPlan productPlan = iZyProductPlanService.getOne(new LambdaQueryWrapper().eq(ZyProductPlan::getProductCode, productRecord.getOrderCode())); - Optional.ofNullable(productPlan).orElseThrow(() -> new JeecgBootException("工单编号:" + productRecord.getOrderCode() + "不存在!")); - List zyPlanProcessList = iZyPlanProcessService.list(new LambdaQueryWrapper() - .eq(ZyPlanProcess::getPlanId, productPlan.getId()) - .eq(ZyPlanProcess::getStationId, obj.getId()) - ); - if (!ObjectUtils.isEmpty(zyPlanProcessList)) { - ZyPlanProcess zyPlanProcess = zyPlanProcessList.get(0); - ProductRecordVo vo = new ProductRecordVo(); - vo.setProductCode(productRecord.getOrderCode()); - vo.setProcessName(zyPlanProcess.getProcessName()); - vo.setStationName(zyPlanProcess.getStationName()); - vo.setMachineNames(zyPlanProcess.getMachineNames()); - vo.setStationNum(zyPlanProcess.getStationNum()); - productRecordVos.add(vo); - } else { - ProductRecordVo vo = new ProductRecordVo(); - vo.setStationName(obj.getStationName()); - vo.setStationNum(obj.getStationNum()); - productRecordVos.add(vo); +// ProductRecord productRecord = iProductRecordService.getOne(new LambdaQueryWrapper() +// .eq(ProductRecord::getStationId, obj.getId()) +// .eq(ProductRecord::getStatus, "0") +// .orderByDesc(ProductRecord::getCreateTime) +// .last("limit 1") +// ); + //查询生产计划工序表,对应设备状态 为生产中的数据 + ZyPlanProcess zyPlanProcess = iZyPlanProcessService.getOne(new LambdaQueryWrapper() + .eq(ZyPlanProcess::getStationId, obj.getId()) +// .eq(ZyPlanProcess::getStatus,"1")) + .orderByDesc(ZyPlanProcess::getUpdateTime) + .last("limit 1")); + if (!ObjectUtils.isEmpty(zyPlanProcess)) { + ZyProductPlan productPlan = iZyProductPlanService.getById(zyPlanProcess.getPlanId()); +// Optional.ofNullable(productPlan).orElseThrow(() -> new JeecgBootException("生产计划:" + zyPlanProcess.getPlanId() + "不存在!")); + ProductRecordVo vo = new ProductRecordVo(); + if (!ObjectUtils.isEmpty(productPlan)) { + vo.setWorkOrder(productPlan.getProductNo()); } + vo.setProcessName(zyPlanProcess.getProcessName()); + vo.setStationName(zyPlanProcess.getStationName()); + vo.setMachineNames(zyPlanProcess.getMachineNames()); + vo.setStationNum(zyPlanProcess.getStationNum()); + vo.setProcessStatus(zyPlanProcess.getStatus()); + vo.setPlanProcessInfo(zyPlanProcess); + productRecordVos.add(vo); } else { ProductRecordVo vo = new ProductRecordVo(); vo.setStationName(obj.getStationName()); @@ -116,7 +178,6 @@ public class ProductionLargeServiceImpl implements ProductionLargeService { } }); SysDepart depart = iSysDepartService.getOne(new LambdaQueryWrapper().eq(SysDepart::getId, station.getDepartId())); -// productRecordVos.stream().map(o -> o.getStationNum()).collect(Collectors.toList()); departMap.put(depart.getDepartName(), productRecordVos); shengchanxianMap.putAll(departMap); }); diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/largeScreen/vo/ProductRecordVo.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/largeScreen/vo/ProductRecordVo.java index f2a57098..9be807c2 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/largeScreen/vo/ProductRecordVo.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/largeScreen/vo/ProductRecordVo.java @@ -1,12 +1,15 @@ package org.jeecg.modules.largeScreen.vo; +import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import org.jeecg.modules.productplan.entity.ZyPlanProcess; import org.jeecgframework.poi.excel.annotation.Excel; import java.io.Serializable; @Data +@ApiModel(value="生产大屏-生产线实时状态", description="生产大屏-生产线实时状态") public class ProductRecordVo implements Serializable { private static final long serialVersionUID = 007555; @@ -21,6 +24,7 @@ public class ProductRecordVo implements Serializable { // @ApiModelProperty(value = "设备id列表") // @Dict(dictTable = "zy_device", dicText = "name", dicCode = "id") // private String machineIds; + private String machineNames; @@ -44,7 +48,13 @@ public class ProductRecordVo implements Serializable { @Excel(name = "工单编号", width = 15) @ApiModelProperty(value = "工单编号") - private String productCode; + private String workOrder; private Integer stationNum; + + @ApiModelProperty(value = "工位工序状态") + private Integer processStatus; + + @ApiModelProperty(value = "工序信息") + private ZyPlanProcess planProcessInfo; } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/message/entity/ZySpeechMessage.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/message/entity/ZySpeechMessage.java index 1ac07612..8423d214 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/message/entity/ZySpeechMessage.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/message/entity/ZySpeechMessage.java @@ -30,6 +30,9 @@ import java.util.Date; public class ZySpeechMessage implements Serializable { private static final long serialVersionUID = 1L; + public static final int XIAOSHOU = 1; + public static final int SHENGCHAN = 2; + /** * 主键 */ @@ -89,4 +92,9 @@ public class ZySpeechMessage implements Serializable { @Excel(name = "消息", width = 15) @ApiModelProperty(value = "消息") private String message; + + @Excel(name = "消息类型", width = 15) + @ApiModelProperty(value = "消息类型") +// 1:销售类(订单) 2:生产(生产计划/工单)', + private Integer messageType; } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/controller/ZyProductPlanController.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/controller/ZyProductPlanController.java index 2bbd6b06..94b3e99e 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/controller/ZyProductPlanController.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/controller/ZyProductPlanController.java @@ -101,6 +101,8 @@ public class ZyProductPlanController extends JeecgController