|
|
|
@ -2,17 +2,19 @@ package com.productionboard.service.impl;
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import com.productionboard.entity.TankShellDevice.TankShellDeviceDataInformation;
|
|
|
|
|
import com.productionboard.entity.TankShellDevice.TankShellEnergyConsumption;
|
|
|
|
|
import com.productionboard.entity.TankShellDevice.TankShellOeeStatistics;
|
|
|
|
|
import com.productionboard.mapper.TankShellDeviceDataInformationMapper;
|
|
|
|
|
import com.productionboard.mapper.TankShellEnergyConsumptionMapper;
|
|
|
|
|
import com.productionboard.mapper.TankShellOeeStatisticsMapper;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
import com.productionboard.entity.AluminumDevice.AluminumDeviceDataInformation;
|
|
|
|
|
import com.productionboard.entity.AluminumDevice.AluminumThisMonthEnergy;
|
|
|
|
|
import com.productionboard.entity.AluminumDevice.AluminumYesterdayEnergy;
|
|
|
|
|
import com.productionboard.entity.TankShellDevice.*;
|
|
|
|
|
import com.productionboard.mapper.*;
|
|
|
|
|
import com.productionboard.service.ITankShellDeviceInfoService;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
|
import java.util.Calendar;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -25,6 +27,9 @@ public class TankShellDeviceInfoServiceImpl implements ITankShellDeviceInfoServi
|
|
|
|
|
@Autowired
|
|
|
|
|
private TankShellDeviceDataInformationMapper tankShellDeviceDataInformationMapper;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private TankShellThisMonthEnergyMapper tankShellThisMonthEnergyMapper;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private TankShellEnergyConsumptionMapper tankShellEnergyConsumptionMapper;
|
|
|
|
|
|
|
|
|
@ -35,12 +40,53 @@ public class TankShellDeviceInfoServiceImpl implements ITankShellDeviceInfoServi
|
|
|
|
|
|
|
|
|
|
private SimpleDateFormat hourFormat = new SimpleDateFormat("HH");
|
|
|
|
|
|
|
|
|
|
private SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public String getDataInformationJson() {
|
|
|
|
|
List<TankShellDeviceDataInformation> tankShellDeviceDataInformations = tankShellDeviceDataInformationMapper.selectList(null);
|
|
|
|
|
return JSONArray.toJSONString(tankShellDeviceDataInformations);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public String getRunParameters() {
|
|
|
|
|
String[] result = new String[10];
|
|
|
|
|
try{
|
|
|
|
|
List<TankShellThisMonthEnergy> tankShellThisMonthEnergies = tankShellThisMonthEnergyMapper.selectList(null);
|
|
|
|
|
|
|
|
|
|
Calendar calendar = Calendar.getInstance();
|
|
|
|
|
calendar.setTime(new Date());
|
|
|
|
|
calendar.add(Calendar.DATE,-1);
|
|
|
|
|
String lastDate = simpleDateFormat.format(calendar.getTime()).substring(0,10)+" 00:00:00";;
|
|
|
|
|
//昨日产量、能耗
|
|
|
|
|
QueryWrapper<TankShellEnergyConsumption> wrapper = new QueryWrapper<TankShellEnergyConsumption>();
|
|
|
|
|
wrapper.eq("createTime",simpleDateFormat.parse(lastDate));
|
|
|
|
|
List<TankShellEnergyConsumption> tankShellYesterdayEnergies = tankShellEnergyConsumptionMapper.selectList(wrapper);
|
|
|
|
|
|
|
|
|
|
result[0] = tankShellYesterdayEnergies.size() > 0 ? tankShellYesterdayEnergies.get(0).getProduction():"0";
|
|
|
|
|
result[1] = tankShellYesterdayEnergies.size() > 0 ? tankShellYesterdayEnergies.get(0).getEnergy():"0";
|
|
|
|
|
result[2] = tankShellThisMonthEnergies.size() > 0 ? tankShellThisMonthEnergies.get(0).getProduction():"0";
|
|
|
|
|
result[3] = tankShellThisMonthEnergies.size() > 0 ? tankShellThisMonthEnergies.get(0).getEnergy():"0";
|
|
|
|
|
|
|
|
|
|
List<TankShellDeviceDataInformation> deviceDataInformations = tankShellDeviceDataInformationMapper.selectList(null);
|
|
|
|
|
if(deviceDataInformations.size() > 0){
|
|
|
|
|
TankShellDeviceDataInformation tankShellDeviceDataInformation = deviceDataInformations.get(0);
|
|
|
|
|
result[4] = tankShellDeviceDataInformation.getRunTime();
|
|
|
|
|
result[5] = tankShellDeviceDataInformation.getStopTime();
|
|
|
|
|
result[6] = tankShellDeviceDataInformation.getDeviceOee();
|
|
|
|
|
result[7] = "0";
|
|
|
|
|
result[8] = tankShellDeviceDataInformation.getRunTime();
|
|
|
|
|
result[9] = tankShellDeviceDataInformation.getDeviceTakt();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
System.out.println("箱壳设备看板getRunParameters方法异常:"+e.getMessage());
|
|
|
|
|
result[0] = "-";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return JSONArray.toJSONString(result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public String getEnergyConsumptionJson() {
|
|
|
|
|
List<TankShellEnergyConsumption> tankShellEnergyConsumptions = tankShellEnergyConsumptionMapper.selectList(null);
|
|
|
|
|