|
|
|
@ -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,34 +144,32 @@ 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()) |
|
|
|
|
.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<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()) |
|
|
|
|
// .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<SysDepart>().eq(SysDepart::getId, station.getDepartId())); |
|
|
|
|
// productRecordVos.stream().map(o -> o.getStationNum()).collect(Collectors.toList());
|
|
|
|
|
departMap.put(depart.getDepartName(), productRecordVos); |
|
|
|
|
shengchanxianMap.putAll(departMap); |
|
|
|
|
}); |
|
|
|
|