生产线实时状态 数据统计 6.5

master
zhc077 1 year ago
parent 208988e984
commit 29baf08241
  1. 7
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/largeScreen/controller/ProductionLargeScreenController.java
  2. 2
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/largeScreen/service/ProductionLargeService.java
  3. 107
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/largeScreen/service/impl/ProductionLargeServiceImpl.java
  4. 12
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/largeScreen/vo/ProductRecordVo.java
  5. 8
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/message/entity/ZySpeechMessage.java
  6. 2
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/controller/ZyProductPlanController.java

@ -33,4 +33,11 @@ public class ProductionLargeScreenController {
return Result.OK(data);
}
@ApiOperation(value = "获取生产设备大屏数据", notes = "获取生产设备大屏数据")
@GetMapping("/shengchanxian_data")
public Result<?> shengchanxian_data() {
Map<String, Object> data = productionLargeService.shengchanxian_data();
return Result.OK(data);
}
}

@ -5,4 +5,6 @@ import java.util.Map;
public interface ProductionLargeService {
Map<String, Object> getData();
Map<String, Object> shengchanxian_data();
}

@ -64,7 +64,71 @@ public class ProductionLargeServiceImpl implements ProductionLargeService {
resultMap.put("diaogua_data", diaoguaData);*/
//2,生产线实时状态
// //2,生产线实时状态
// List<Station> stationGroup = iStationService.list(new LambdaQueryWrapper<Station>().groupBy(Station::getDepartId));
// Map<String, Object> shengchanxianMap = new LinkedHashMap<>();
// if (!ObjectUtils.isEmpty(stationGroup)) {
// stationGroup.stream().forEach(station -> {
// Map<String, Object> departMap = new LinkedHashMap<>();
// //每个车间的工位
// List<Station> stationList = iStationService.list(new LambdaQueryWrapper<Station>()
// .eq(Station::getDepartId, station.getDepartId())
// .orderByAsc(Station::getStationNum)
// );
// /**
// * 取每个工位的,生产记录状态0(生产中)的最新一条数据
// */
// List<ProductRecordVo> productRecordVos = new LinkedList<>();
// Optional.ofNullable(stationList).orElse(new LinkedList<>()).forEach(obj -> {
// ProductRecord productRecord = iProductRecordService.getOne(new LambdaQueryWrapper<ProductRecord>()
// .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<ZyProductPlan>().eq(ZyProductPlan::getProductCode, productRecord.getOrderCode()));
// Optional.ofNullable(productPlan).orElseThrow(() -> new JeecgBootException("工单编号:" + productRecord.getOrderCode() + "不存在!"));
// List<ZyPlanProcess> zyPlanProcessList = iZyPlanProcessService.list(new LambdaQueryWrapper<ZyPlanProcess>()
// .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<SysDepart>().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<String, Object> shengchanxian_data() {
Map<String, Object> resultMap = new HashMap<>();
List<Station> stationGroup = iStationService.list(new LambdaQueryWrapper<Station>().groupBy(Station::getDepartId));
Map<String, Object> shengchanxianMap = new LinkedHashMap<>();
if (!ObjectUtils.isEmpty(stationGroup)) {
@ -80,27 +144,31 @@ public class ProductionLargeServiceImpl implements ProductionLargeService {
*/
List<ProductRecordVo> productRecordVos = new LinkedList<>();
Optional.ofNullable(stationList).orElse(new LinkedList<>()).forEach(obj -> {
ProductRecord productRecord = iProductRecordService.getOne(new LambdaQueryWrapper<ProductRecord>()
.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<ZyProductPlan>().eq(ZyProductPlan::getProductCode, productRecord.getOrderCode()));
Optional.ofNullable(productPlan).orElseThrow(() -> new JeecgBootException("工单编号:" + productRecord.getOrderCode() + "不存在!"));
List<ZyPlanProcess> zyPlanProcessList = iZyPlanProcessService.list(new LambdaQueryWrapper<ZyPlanProcess>()
.eq(ZyPlanProcess::getPlanId, productPlan.getId())
// ProductRecord productRecord = iProductRecordService.getOne(new LambdaQueryWrapper<ProductRecord>()
// .eq(ProductRecord::getStationId, obj.getId())
// .eq(ProductRecord::getStatus, "0")
// .orderByDesc(ProductRecord::getCreateTime)
// .last("limit 1")
// );
//查询生产计划工序表,对应设备状态 为生产中的数据
ZyPlanProcess zyPlanProcess = iZyPlanProcessService.getOne(new LambdaQueryWrapper<ZyPlanProcess>()
.eq(ZyPlanProcess::getStationId, obj.getId())
);
if (!ObjectUtils.isEmpty(zyPlanProcessList)) {
ZyPlanProcess zyPlanProcess = zyPlanProcessList.get(0);
// .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();
vo.setProductCode(productRecord.getOrderCode());
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();
@ -108,15 +176,8 @@ public class ProductionLargeServiceImpl implements ProductionLargeService {
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<SysDepart>().eq(SysDepart::getId, station.getDepartId()));
// productRecordVos.stream().map(o -> o.getStationNum()).collect(Collectors.toList());
departMap.put(depart.getDepartName(), productRecordVos);
shengchanxianMap.putAll(departMap);
});

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

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

@ -101,6 +101,8 @@ public class ZyProductPlanController extends JeecgController<ZyProductPlan, IZyP
String productCode = zyProductPlan.getProductCode();
String code = productCode.substring(productCode.length() - 6);
String mess = "工单尾号" + code + ",生产计划已完成制定,请跟进后续生产作业.";
//生产类型的消息,保存工单id,播报工单id
zySpeechMessage.setMessageType(ZySpeechMessage.SHENGCHAN);
zySpeechMessage.setMessage(mess);
zySpeechMessage.setWorkorderId(productCode);
iZySpeechMessageService.save(zySpeechMessage);

Loading…
Cancel
Save