add - 发泡运行状态
parent
53c14d8ee2
commit
193ec95b34
@ -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 2022年06月10日 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 2022年06月10日 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 2022年06月10日 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 2022年06月10日 14:15
|
||||
*/
|
||||
@Mapper
|
||||
public interface FoamBoxMachineRunStatusMapper extends BaseMapper<FoamBoxMachineRunStatus> {
|
||||
}
|
@ -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 2022年06月10日 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);
|
||||
}
|
||||
}
|
Binary file not shown.
Loading…
Reference in New Issue