You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

165 lines
5.6 KiB
Java

package com.ipsplm.service.simulation.impl;
9 months ago
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.ipsplm.dao.simulation.SimulationAnalysisMapper;
9 months ago
import com.ipsplm.entity.simulation.*;
import com.ipsplm.entity.simulation.vo.BufferVO;
9 months ago
import com.ipsplm.entity.simulation.vo.OeeVO;
import com.ipsplm.entity.simulation.vo.PlantEquipmentUtilizationVO;
import com.ipsplm.service.simulation.ISimulationAnalysisService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
9 months ago
import java.util.ArrayList;
9 months ago
import java.util.List;
9 months ago
import java.util.Map;
9 months ago
/**
* @Description 仿
* @Author lulicheng
* @Date 2024-07-31 1020
* @Version 1.0
*/
@Service
public class SimulationAnalysisServiceImpl implements ISimulationAnalysisService {
@Autowired
private SimulationAnalysisMapper simulationAnalysisMapper;
/**
*
*
* @param flag
* @return
*/
@Override
9 months ago
public List<OeeVO> getPlantEquipmentUtilization(Long flag) {
List<PlantEquipmentUtilizationVO> plantEquipmentUtilization = simulationAnalysisMapper.getPlantEquipmentUtilization(flag);
List<OeeVO> oeeVOList = beanToKeyValue(plantEquipmentUtilization);
return oeeVOList;
9 months ago
}
/**
*
*
* @param tableCode
* @return
*/
@Override
public List<String> getProcessList(String tableCode) {
return simulationAnalysisMapper.getProcessList(tableCode);
}
/**
*
9 months ago
*
* @param process
* @return
*/
@Override
public Object getBufferNum(String process) {
List<BufferVO> bufferNameList = simulationAnalysisMapper.getBufferName(process);
String tableCode = bufferNameList.get(0).getTableCode();
switch (tableCode) {
case "buffernum_bxg": {
List<BufferNumBxg> bufferNumBxgList = simulationAnalysisMapper.getBufferNumBxg(bufferNameList);
return bufferNumBxgList;
}
case "buffernum_dj": {
List<BufferNumDj> bufferNumDjList = simulationAnalysisMapper.getBufferNumDj(bufferNameList);
return bufferNumDjList;
}
case "buffernum_xe": {
List<BufferNumXe> bufferNumXeList = simulationAnalysisMapper.getBufferNumXe(bufferNameList);
return bufferNumXeList;
}
case "buffernum_xy": {
List<BufferNumXy> bufferNumXyList = simulationAnalysisMapper.getBufferNumXy(bufferNameList);
return bufferNumXyList;
}
case "buffernum_ze": {
List<BufferNumZe> bufferNumZeList = simulationAnalysisMapper.getBufferNumZe(bufferNameList);
return bufferNumZeList;
}
case "buffernum_zy": {
List<BufferNumZy> bufferNumZyList = simulationAnalysisMapper.getBufferNumZy(bufferNameList);
return bufferNumZyList;
}
default:
break;
}
return null;
}
9 months ago
/**
* OEE
*
* @param tableCode
* @return
*/
@Override
public Object getOee(String tableCode) {
switch (tableCode) {
case "oee_bxg": {
List<OeeBxg> oeeBxgList = simulationAnalysisMapper.getOeeBxg();
List<OeeVO> oeeVOList = beanToKeyValue(oeeBxgList);
return oeeVOList;
}
case "oee_dj": {
List<OeeDj> oeeDjList = simulationAnalysisMapper.getOeeDj();
List<OeeVO> oeeVOList = beanToKeyValue(oeeDjList);
return oeeVOList;
}
case "oee_xe": {
List<OeeXe> oeeXeList = simulationAnalysisMapper.getOeeXe();
List<OeeVO> oeeVOList = beanToKeyValue(oeeXeList);
return oeeVOList;
}
case "oee_xy": {
List<OeeXy> oeeXyList = simulationAnalysisMapper.getOeeXy();
List<OeeVO> oeeVOList = beanToKeyValue(oeeXyList);
return oeeVOList;
}
case "oee_ze": {
List<OeeZe> oeeZeList = simulationAnalysisMapper.getOeeZe();
List<OeeVO> oeeVOList = beanToKeyValue(oeeZeList);
return oeeVOList;
}
case "oee_zy": {
List<OeeZy> oeeZyList = simulationAnalysisMapper.getOeeZy();
List<OeeVO> oeeVOList = beanToKeyValue(oeeZyList);
return oeeVOList;
}
default:
break;
}
return null;
}
/**
* OeeVO
* @param oeeList
* @return
*/
public List<OeeVO> beanToKeyValue(List oeeList) {
List<OeeVO> oeeVOList = new ArrayList<>();
for (Object object : oeeList) {
JSONObject jsonObject = (JSONObject) JSON.toJSON(object);
Object status = jsonObject.get("status");
for (Map.Entry<String, Object> entry : jsonObject.entrySet()) {
OeeVO oeeVO = new OeeVO();
Object value = entry.getValue();
String key = entry.getKey();
if ("flag".equals(key) || "id".equals(key) || "status".equals(key)) {
continue;
}
oeeVO.setName(key);
oeeVO.setValue(value);
oeeVO.setStatus(status);
oeeVOList.add(oeeVO);
}
}
return oeeVOList;
}
}