add - 发泡运行状态

master
wenjy 3 years ago
parent 53c14d8ee2
commit 193ec95b34

@ -5,6 +5,7 @@ import com.productionboard.entity.MesProduction.MesHourProdutionStatistics;
import com.productionboard.entity.MesProduction.MesMaterialProductionStatistics; import com.productionboard.entity.MesProduction.MesMaterialProductionStatistics;
import com.productionboard.entity.MesProduction.MesMaterialStoreStatistics; import com.productionboard.entity.MesProduction.MesMaterialStoreStatistics;
import com.productionboard.entity.MesProduction.MesTeamStatistics; import com.productionboard.entity.MesProduction.MesTeamStatistics;
import com.productionboard.service.IFoamBoxDeviceInfoService;
import com.productionboard.service.IMesProductionDataService; import com.productionboard.service.IMesProductionDataService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
@ -29,6 +30,9 @@ public class FoamBoxController {
@Autowired @Autowired
private IMesProductionDataService iMesProductionDataService; private IMesProductionDataService iMesProductionDataService;
@Autowired
private IFoamBoxDeviceInfoService ifamBoxDeviceInfoService;
private String prefix = "foamBox/index"; private String prefix = "foamBox/index";
/** /**
@ -71,6 +75,14 @@ public class FoamBoxController {
return JSONArray.toJSONString(new MesTeamStatistics()); return JSONArray.toJSONString(new MesTeamStatistics());
} }
@GetMapping("/getRunStatusJson")
@ResponseBody
public String getRunStatusJson(String ids){
String runStatus = ifamBoxDeviceInfoService.getRunStatus(ids);
return runStatus;
}
/** /**
* MES * MES
* @author WenJY * @author WenJY

@ -0,0 +1,31 @@
package com.productionboard.entity.FoamBoxDevice;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
/**
* @author WenJY
* @date 20220610 14:12
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("SCADA_FPX_DEVICEINFO_1")
public class FoamBoxLineRunStatus implements Serializable {
@TableField("DEVICEID")
private String deviceId;
@TableField("DEVICESTATUS")
private String deviceStatus;
@TableField("COLLECTTIME")
private Date collectTime;
}

@ -0,0 +1,33 @@
package com.productionboard.entity.FoamBoxDevice;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
/**
* @author WenJY
* @date 20220610 14:16
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("SCADA_FPJ_DEVICEINFO_1")
public class FoamBoxMachineRunStatus implements Serializable {
@TableField("DEVICEID")
private String deviceId;
@TableField("DEVICESTATUS1")
private String deviceStatus1;
@TableField("DEVICESTATUS2")
private String deviceStatus2;
@TableField("COLLECTTIME")
private Date collectTime;
}

@ -0,0 +1,13 @@
package com.productionboard.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.productionboard.entity.FoamBoxDevice.FoamBoxLineRunStatus;
import org.apache.ibatis.annotations.Mapper;
/**
* @author WenJY
* @date 20220610 14:15
*/
@Mapper
public interface FoamBoxLineRunStatusMapper extends BaseMapper<FoamBoxLineRunStatus> {
}

@ -0,0 +1,14 @@
package com.productionboard.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.productionboard.entity.FoamBoxDevice.FoamBoxLineRunStatus;
import com.productionboard.entity.FoamBoxDevice.FoamBoxMachineRunStatus;
import org.apache.ibatis.annotations.Mapper;
/**
* @author WenJY
* @date 20220610 14:15
*/
@Mapper
public interface FoamBoxMachineRunStatusMapper extends BaseMapper<FoamBoxMachineRunStatus> {
}

@ -0,0 +1,19 @@
package com.productionboard.service;
import java.util.List;
/**
* @author WenJY
* @date 20220610 14:17
*/
public interface IFoamBoxDeviceInfoService {
/**
* 线
* @author WenJY
* @date 2022-06-10 14:18
* @param ids 0-线1-线
* @return java.lang.String
*/
String getRunStatus(String ids);
}

@ -0,0 +1,79 @@
package com.productionboard.service.impl;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.productionboard.entity.FoamBoxDevice.FoamBoxLineRunStatus;
import com.productionboard.entity.FoamBoxDevice.FoamBoxMachineRunStatus;
import com.productionboard.mapper.FoamBoxLineRunStatusMapper;
import com.productionboard.mapper.FoamBoxMachineRunStatusMapper;
import com.productionboard.service.IFoamBoxDeviceInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author WenJY
* @date 20220610 14:21
*/
@Service
public class FoamBoxDeviceInfoServiceImpl implements IFoamBoxDeviceInfoService {
@Autowired private FoamBoxLineRunStatusMapper foamBoxLineRunStatusMapper;
@Autowired private FoamBoxMachineRunStatusMapper foamBoxMachineRunStatusMapper;
/**
* 线
* @author WenJY
* @date 2022-06-10 14:34
* @param ids
* @return java.lang.String
*/
@Override
public String getRunStatus(String ids) {
String[] result = new String[6];
List<FoamBoxLineRunStatus> foamBoxLineRunStatuses = foamBoxLineRunStatusMapper.selectList(null);
QueryWrapper<FoamBoxMachineRunStatus> wrapper = new QueryWrapper<>();
switch (ids) {
case "0":
wrapper.eq("DEVICEID", "HF202009858");
break;
case "1":
wrapper.eq("DEVICEID", "HF202009857");
break;
}
List<FoamBoxMachineRunStatus> foamBoxMachineRunStatuses = foamBoxMachineRunStatusMapper.selectList(wrapper);
try{
if(foamBoxLineRunStatuses.size() > 0){
for (int i = 0; i < foamBoxLineRunStatuses.size();i++){
result[i] = foamBoxLineRunStatuses.get(i).getDeviceStatus();
}
}else{
for (int i = 0; i < 4;i++){
result[i] = "1";
}
}
if(foamBoxMachineRunStatuses.size() > 0 && foamBoxMachineRunStatuses.get(0) != null){
result[4] = foamBoxMachineRunStatuses.get(0).getDeviceStatus1();
result[5] = foamBoxMachineRunStatuses.get(0).getDeviceStatus2();
}else{
result[4] = "1";
result[5] = "1";
}
}catch (Exception e){
for (int i = 0; i < 5;i++){
result[i] = "1";
}
}
return JSONArray.toJSONString(result);
}
}
Loading…
Cancel
Save