增加接口数据返回值的状态及信息封装,完善大屏接口相关逻辑。
This commit is contained in:
@@ -0,0 +1,141 @@
|
||||
package org.nl.modules.common.api;
|
||||
|
||||
/**
|
||||
* 通用返回对象
|
||||
*
|
||||
* @author gbx
|
||||
* @date 2023-03-02
|
||||
*/
|
||||
public class CommonResult<T> {
|
||||
private long code;
|
||||
private String desc;
|
||||
private T result;
|
||||
|
||||
public CommonResult() {
|
||||
}
|
||||
|
||||
protected CommonResult(T result) {
|
||||
this.result = result;
|
||||
this.desc = ResultCode.SUCCESS.getDesc();
|
||||
this.code = ResultCode.SUCCESS.getCode();
|
||||
}
|
||||
|
||||
|
||||
protected CommonResult(long code, String desc, T result) {
|
||||
this.code = code;
|
||||
this.desc = desc;
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 成功返回结果
|
||||
|
||||
*/
|
||||
public static <T> CommonResult<T> success() {
|
||||
return new CommonResult<>(ResultCode.SUCCESS.getCode(), ResultCode.SUCCESS.getDesc(), null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 成功返回结果
|
||||
*
|
||||
* @param result 获取的数据
|
||||
*/
|
||||
public static <T> CommonResult<T> success(T result) {
|
||||
return new CommonResult<>(ResultCode.SUCCESS.getCode(), ResultCode.SUCCESS.getDesc(), result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 成功返回结果
|
||||
*
|
||||
* @param result 获取的数据
|
||||
* @param desc 提示信息
|
||||
*/
|
||||
public static <T> CommonResult<T> success(T result, String desc) {
|
||||
return new CommonResult<>(ResultCode.SUCCESS.getCode(), desc, result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 失败返回结果
|
||||
* @param errorCode 错误码
|
||||
*/
|
||||
public static <T> CommonResult<T> failed(IErrorCode errorCode) {
|
||||
return new CommonResult<>(errorCode.getCode(), errorCode.getDesc(), null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 失败返回结果
|
||||
* @param errorCode 错误码
|
||||
* @param desc 错误信息
|
||||
*/
|
||||
public static <T> CommonResult<T> failed(IErrorCode errorCode,String desc) {
|
||||
return new CommonResult<>(errorCode.getCode(), desc, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 失败返回结果
|
||||
* @param desc 提示信息
|
||||
*/
|
||||
public static <T> CommonResult<T> failed(String desc) {
|
||||
return new CommonResult<>(ResultCode.FAILED.getCode(), desc, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 失败返回结果
|
||||
*/
|
||||
public static <T> CommonResult<T> failed() {
|
||||
return failed(ResultCode.FAILED);
|
||||
}
|
||||
|
||||
/**
|
||||
* 参数验证失败返回结果
|
||||
*/
|
||||
public static <T> CommonResult<T> validateFailed() {
|
||||
return failed(ResultCode.VALIDATE_FAILED);
|
||||
}
|
||||
|
||||
/**
|
||||
* 参数验证失败返回结果
|
||||
* @param desc 提示信息
|
||||
*/
|
||||
public static <T> CommonResult<T> validateFailed(String desc) {
|
||||
return new CommonResult<>(ResultCode.MISS_PARAMETER.getCode(), desc, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 未登录返回结果
|
||||
*/
|
||||
public static <T> CommonResult<T> unauthorized(T result) {
|
||||
return new CommonResult<>(ResultCode.UNAUTHORIZED.getCode(), ResultCode.UNAUTHORIZED.getDesc(), result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 未授权返回结果
|
||||
*/
|
||||
public static <T> CommonResult<T> forbidden(T result) {
|
||||
return new CommonResult<>(ResultCode.FORBIDDEN.getCode(), ResultCode.FORBIDDEN.getDesc(), result);
|
||||
}
|
||||
|
||||
public long getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(long code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
public void setDesc(String desc) {
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public T getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setResult(T result) {
|
||||
this.result = result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package org.nl.modules.common.api;
|
||||
|
||||
/**
|
||||
* 封装API的错误码
|
||||
*
|
||||
* @author gbx
|
||||
* @date 2023-03-02
|
||||
*/
|
||||
public interface IErrorCode{
|
||||
/**
|
||||
* 返回状态码
|
||||
*/
|
||||
long getCode();
|
||||
|
||||
/**
|
||||
* 返回提示
|
||||
*/
|
||||
String getDesc();
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
package org.nl.modules.common.api;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.nl.modules.common.exception.BizCoreException;
|
||||
|
||||
/**
|
||||
* 回调
|
||||
*
|
||||
* @author gbx
|
||||
* @date 2023-03-02
|
||||
*/
|
||||
@Slf4j
|
||||
public class RestBusinessTemplate{
|
||||
public static <T> CommonResult<T> execute(Callback<T> callback) {
|
||||
CommonResult<T> result = new CommonResult<>();
|
||||
try {
|
||||
result.setCode(ResultCode.SUCCESS.getCode());
|
||||
result.setDesc(ResultCode.SUCCESS.getDesc());
|
||||
T object = callback.doExecute();
|
||||
if(object != null) {
|
||||
result.setResult(object);
|
||||
}
|
||||
}
|
||||
catch(BizCoreException e) {
|
||||
String errorMsg;
|
||||
if(StringUtils.isNotBlank(e.getErrorMsg())) {
|
||||
errorMsg = e.getErrorMsg();
|
||||
}
|
||||
else if(e.getCode() != null) {
|
||||
errorMsg = e.getCode().getDesc();
|
||||
}
|
||||
else{
|
||||
errorMsg = e.getMessage();
|
||||
}
|
||||
log.error(e.getErrorMsg());
|
||||
ResultCode code = e.getCode() == null ? ResultCode.FAILED : e.getCode();
|
||||
result.setCode(code.getCode());
|
||||
result.setDesc(errorMsg);
|
||||
}
|
||||
catch(Exception e) {
|
||||
log.error("execute error", e);
|
||||
result.setCode(ResultCode.FAILED.getCode());
|
||||
result.setDesc(ResultCode.FAILED.getDesc());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static CommonResult<Void> execute(VoidCallback callback) {
|
||||
CommonResult<Void> result = new CommonResult<>();
|
||||
try {
|
||||
callback.execute();
|
||||
result.setCode(ResultCode.SUCCESS.getCode());
|
||||
result.setDesc(ResultCode.SUCCESS.getDesc());
|
||||
}
|
||||
catch(BizCoreException e) {
|
||||
log.error("", e);
|
||||
ResultCode code = e.getCode() == null ? ResultCode.FAILED : e.getCode();
|
||||
result.setCode(code.getCode());
|
||||
result.setDesc(StringUtils.isBlank(e.getMessage()) ? code.getDesc() : e.getMessage());
|
||||
}
|
||||
catch(Exception e) {
|
||||
log.error("execute error", e);
|
||||
result.setCode(ResultCode.FAILED.getCode());
|
||||
result.setDesc(ResultCode.FAILED.getDesc());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行回调
|
||||
*
|
||||
* @param <T>
|
||||
*/
|
||||
public interface Callback<T>{
|
||||
T doExecute();
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行回调
|
||||
*/
|
||||
public interface VoidCallback{
|
||||
void execute();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package org.nl.modules.common.api;
|
||||
|
||||
/**
|
||||
* 枚举了一些常用API操作码
|
||||
*
|
||||
* @author gbx
|
||||
* @date 2023-03-02
|
||||
*/
|
||||
public enum ResultCode implements IErrorCode{
|
||||
SUCCESS(200, "操作成功"),
|
||||
FAILED(500, "操作失败"),
|
||||
MISS_PARAMETER(400, "参数缺失"),
|
||||
UNAUTHORIZED(401, "暂未登录或token已经过期"),
|
||||
INVALID_PARAMETER(402, "无效参数"),
|
||||
FORBIDDEN(403, "没有相关权限"),
|
||||
VALIDATE_FAILED(404, "参数检验失败"),
|
||||
INVALID_CAPTCHA(503, "验证码已失效或验证码错误"),
|
||||
/**
|
||||
* 员工相关异常 1000 ~ 1199
|
||||
*/
|
||||
STAFF_NOT_FOUND(1000, "员工不存在"),
|
||||
STAFF_EXISTED(1001, "员工已存在"),
|
||||
/**
|
||||
* 部门相关异常 1200 ~ 1399
|
||||
*/
|
||||
DEPT_EXIST(1200, "部门已存在"),
|
||||
PARENT_DEPT_STATUS_EXCEPTION(1201, "父部门状态异常"),
|
||||
DEPT_NOT_EXIST(1202, "部门不存在"),
|
||||
/**
|
||||
* 岗位相关异常 1400 ~ 1599
|
||||
*/
|
||||
POST_EXIST(1400, "岗位已存在"),
|
||||
POST_NOT_EXIST(1401, "岗位不存在"),
|
||||
/**
|
||||
* 菜单相关异常 1600 ~ 1799
|
||||
*/
|
||||
MENU_EXIST(1600, "菜单已存在"),
|
||||
MENU_NOT_EXIST(1601, "菜单不存在"),
|
||||
MENU_STATUS_EXCEPTION(1602, "菜单状态异常"),
|
||||
/**
|
||||
* 角色相关异常 1800 ~ 1999
|
||||
*/
|
||||
ROLE_EXIST(1800, "角色已存在"),
|
||||
ROLE_NOT_EXIST(1801, "角色不存在"),
|
||||
/**
|
||||
* 账户相关异常 2000 ~ 2099
|
||||
*/
|
||||
ACCOUNT_EXCEPTION(2000, "账户异常"),
|
||||
INVALID_RECHARGE_AMOUNT(2001, "无效金额"),
|
||||
BALANCE_NOT_ENOUGH(2002, "余额不足"),
|
||||
ACCOUNT_NOT_EXIST(2003, "账户不存在"),
|
||||
STORAGE_NOT_ENOUGH(2004, "库存不足"),
|
||||
IS_EXCHANGED(2005, "已有兑换"),
|
||||
/**
|
||||
* 短信相关 2100 ~ 2199
|
||||
*/
|
||||
ERR_MESSAGE(2100, "短信发送失败"),
|
||||
ERR_SEND_LIMIT(2101, "短信发送上限"),
|
||||
ERR_PHONE(2102, "短信号码不正确"),
|
||||
ERR_Content(2103, "短信内容不能为空");
|
||||
private final long code;
|
||||
private final String desc;
|
||||
|
||||
ResultCode(long code, String desc) {
|
||||
this.code = code;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
package org.nl.modules.common.exception;
|
||||
|
||||
import org.nl.modules.common.api.ResultCode;
|
||||
|
||||
/**
|
||||
* 业务异常
|
||||
*
|
||||
* @author gbx
|
||||
* @date 2022-03-21
|
||||
*/
|
||||
public class BizCoreException extends RuntimeException{
|
||||
private static final long serialVersionUID = -430613633714952314L;
|
||||
/**
|
||||
* 错误描述,生成错误响应时,如果该值不为空,则返回message,否则返回code对象的描述值
|
||||
*/
|
||||
private String errorMsg;
|
||||
private ResultCode code = ResultCode.FAILED;
|
||||
|
||||
/**
|
||||
* 构造方法
|
||||
*/
|
||||
public BizCoreException(String message) {
|
||||
super(message);
|
||||
this.errorMsg = message;
|
||||
}
|
||||
|
||||
/**
|
||||
* 构造方法
|
||||
*/
|
||||
public BizCoreException(String message, ResultCode code) {
|
||||
super(message);
|
||||
this.errorMsg = message;
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
/**
|
||||
* 构造方法
|
||||
*/
|
||||
public BizCoreException(ResultCode code) {
|
||||
super(code.getDesc());
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
/**
|
||||
* 构造方法
|
||||
*/
|
||||
public BizCoreException(String message, Throwable e) {
|
||||
super(message, e);
|
||||
this.errorMsg = message;
|
||||
}
|
||||
|
||||
/**
|
||||
* 构造方法
|
||||
*/
|
||||
public BizCoreException(String message, ResultCode code, Throwable e) {
|
||||
super(message, e);
|
||||
this.errorMsg = message;
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
/**
|
||||
* 构造方法
|
||||
*/
|
||||
public BizCoreException(Throwable e) {
|
||||
super(e);
|
||||
this.errorMsg = e.getMessage();
|
||||
}
|
||||
|
||||
/**
|
||||
* 构造方法
|
||||
*/
|
||||
public BizCoreException(ResultCode code, Throwable e) {
|
||||
super(e);
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public ResultCode getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(ResultCode code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getErrorMsg() {
|
||||
return this.errorMsg;
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,14 @@
|
||||
package org.nl.wms.cockpit.rest;
|
||||
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.common.api.CommonResult;
|
||||
import org.nl.modules.common.api.RestBusinessTemplate;
|
||||
import org.nl.modules.common.exception.BizCoreException;
|
||||
import org.nl.wms.cockpit.service.CockpitService;
|
||||
import org.nl.wms.cockpit.service.dto.DeviceDetailDto;
|
||||
import org.nl.wms.cockpit.service.dto.DeviceStatusDto;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.modules.logging.annotation.Log;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.nl.wms.cockpit.service.dto.SchBasePointDto;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import io.swagger.annotations.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -34,8 +35,8 @@ public class CockpitController{
|
||||
@GetMapping("/productionStatistics")
|
||||
@Log("生产统计")
|
||||
@ApiOperation("生产统计")
|
||||
public ResponseEntity<Object> productionStatistics() {
|
||||
return new ResponseEntity<>(cockpitService.productionStatistics(), HttpStatus.OK);
|
||||
public CommonResult<Object> productionStatistics() {
|
||||
return RestBusinessTemplate.execute(cockpitService::productionStatistics);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -44,8 +45,23 @@ public class CockpitController{
|
||||
@GetMapping("/storageMonitor")
|
||||
@Log("仓储监控")
|
||||
@ApiOperation("仓储监控")
|
||||
public ResponseEntity<Object> storageMonitor() {
|
||||
return new ResponseEntity<>(cockpitService.storageMonitor(), HttpStatus.OK);
|
||||
public CommonResult<Object> storageMonitor() {
|
||||
return RestBusinessTemplate.execute(cockpitService::storageMonitor);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据点位id获取仓储信息
|
||||
*/
|
||||
@GetMapping("/findStorageById/{id}")
|
||||
@Log("根据点位id获取仓储信息")
|
||||
@ApiOperation("根据点位id获取仓储信息")
|
||||
public CommonResult<SchBasePointDto> findStorageById(@PathVariable String id) {
|
||||
return RestBusinessTemplate.execute(() -> {
|
||||
if(null == id) {
|
||||
throw new BizCoreException("点位id不能为空");
|
||||
}
|
||||
return cockpitService.findStorageById(id);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -54,8 +70,8 @@ public class CockpitController{
|
||||
@GetMapping("/deviceMonitor")
|
||||
@Log("设备监控")
|
||||
@ApiOperation("设备监控")
|
||||
public ResponseEntity<List<DeviceStatusDto>> deviceMonitor() {
|
||||
return new ResponseEntity<>(cockpitService.deviceMonitor(), HttpStatus.OK);
|
||||
public CommonResult<List<DeviceStatusDto>> deviceMonitor() {
|
||||
return RestBusinessTemplate.execute(cockpitService::deviceMonitor);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -64,11 +80,13 @@ public class CockpitController{
|
||||
@GetMapping("/findDeviceById/{id}")
|
||||
@Log("根据点位id获取设备信息")
|
||||
@ApiOperation("根据点位id获取设备信息")
|
||||
public ResponseEntity<DeviceDetailDto> findDeviceById(@PathVariable String id) {
|
||||
if(null == id) {
|
||||
throw new BadRequestException("更新定时任务失败");
|
||||
}
|
||||
return new ResponseEntity<>(cockpitService.findDeviceById(id), HttpStatus.OK);
|
||||
public CommonResult<DeviceDetailDto> findDeviceById(@PathVariable String id) {
|
||||
return RestBusinessTemplate.execute(() -> {
|
||||
if(null == id) {
|
||||
throw new BizCoreException("点位id不能为空");
|
||||
}
|
||||
return cockpitService.findDeviceById(id);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -77,7 +95,7 @@ public class CockpitController{
|
||||
@GetMapping("/workshopCondition")
|
||||
@Log("车间情况")
|
||||
@ApiOperation("车间情况")
|
||||
public ResponseEntity<Object> workshopCondition() {
|
||||
return new ResponseEntity<>(cockpitService.workshopCondition(), HttpStatus.OK);
|
||||
public CommonResult<Object> workshopCondition() {
|
||||
return RestBusinessTemplate.execute(cockpitService::workshopCondition);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.nl.wms.cockpit.service;
|
||||
|
||||
import org.nl.wms.cockpit.service.dto.DeviceDetailDto;
|
||||
import org.nl.wms.cockpit.service.dto.DeviceStatusDto;
|
||||
import org.nl.wms.cockpit.service.dto.SchBasePointDto;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -16,32 +17,45 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
public interface CockpitService{
|
||||
/**
|
||||
* 生产统计
|
||||
* @return 返回统计结果集
|
||||
*
|
||||
* @return 返回结果集
|
||||
*/
|
||||
ConcurrentHashMap<String,Object> productionStatistics();
|
||||
|
||||
/**
|
||||
* 仓储监控
|
||||
* @return 返回统计结果集
|
||||
*
|
||||
* @return 返回结果集
|
||||
*/
|
||||
ConcurrentHashMap<String,Object> storageMonitor();
|
||||
|
||||
/**
|
||||
* 根据点位id获取仓储信息
|
||||
*
|
||||
* @param id 点位id
|
||||
* @return 返回结果集
|
||||
*/
|
||||
SchBasePointDto findStorageById(String id);
|
||||
|
||||
/**
|
||||
* 设备监控
|
||||
* @return 返回统计结果集
|
||||
*
|
||||
* @return 返回结果集
|
||||
*/
|
||||
List<DeviceStatusDto> deviceMonitor();
|
||||
|
||||
/**
|
||||
* 根据point_id获取设备信息
|
||||
*
|
||||
* @param id 点位id
|
||||
* @return 返回统计结果集
|
||||
* @return 返回结果集
|
||||
*/
|
||||
DeviceDetailDto findDeviceById(String id);
|
||||
|
||||
/**
|
||||
* 車间情况
|
||||
* @return 返回统计结果集
|
||||
*
|
||||
* @return 返回结果集
|
||||
*/
|
||||
Map<String,Object> workshopCondition();
|
||||
}
|
||||
|
||||
@@ -36,6 +36,13 @@ public class SchBasePointDto implements Serializable{
|
||||
* 物料标识
|
||||
*/
|
||||
private Long material_id;
|
||||
|
||||
/**
|
||||
* 物料编码
|
||||
*/
|
||||
private String material_code;
|
||||
|
||||
|
||||
/**
|
||||
* 物料名称
|
||||
*/
|
||||
|
||||
@@ -116,18 +116,8 @@ public class CockpitServiceImpl implements CockpitService{
|
||||
res = result.toJavaList(SchBasePointDto.class);
|
||||
res.forEach(schBasePointDto -> {
|
||||
//Todo 空盅和强制完成状态相关逻辑待完善
|
||||
//根据入库时间和静置时间判断状态静置状态
|
||||
if(StringUtils.isNotBlank(schBasePointDto.getInstorage_time()) && null != schBasePointDto.getStanding_time()) {
|
||||
DateTime nowTime = DateUtil.parse(DateUtil.now(), DatePattern.NORM_DATETIME_FORMAT);
|
||||
DateTime inStorageTime = DateUtil.parse(schBasePointDto.getInstorage_time(), DatePattern.NORM_DATETIME_FORMAT);
|
||||
long minute = DateUtil.between(nowTime, inStorageTime, DateUnit.MINUTE);
|
||||
if(minute < schBasePointDto.getStanding_time().longValue()) {
|
||||
schBasePointDto.setStanding_status("静置中");
|
||||
}
|
||||
else{
|
||||
schBasePointDto.setStanding_status("静置完成");
|
||||
}
|
||||
}
|
||||
//根据入库时间和静置时间判断静置状态
|
||||
getStandingStatus(schBasePointDto);
|
||||
//是否满托
|
||||
if(StringUtils.isNotEmpty(schBasePointDto.getIs_full())) {
|
||||
schBasePointDto.setIs_full(IsOrNotEnum.getName(schBasePointDto.getIs_full()));
|
||||
@@ -164,6 +154,23 @@ public class CockpitServiceImpl implements CockpitService{
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据点位id获取仓储信息
|
||||
*
|
||||
* @author gbx
|
||||
* @since 2023/3/1
|
||||
*/
|
||||
@Override
|
||||
public SchBasePointDto findStorageById(String id) {
|
||||
JSONObject rows = WQL.getWO("COCKPIT_STORAGE").addParam("flag", "3").addParam("point_id", id).process().uniqueResult(0);
|
||||
if(ObjectUtil.isNotEmpty(rows)) {
|
||||
SchBasePointDto res = rows.toJavaObject(SchBasePointDto.class);
|
||||
getStandingStatus(res);
|
||||
return res;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设备监控大屏信息
|
||||
*
|
||||
@@ -180,7 +187,7 @@ public class CockpitServiceImpl implements CockpitService{
|
||||
res.forEach(r -> {
|
||||
//Todo 设备运行时间和图标相关暂为固定值,逻辑待完善
|
||||
//设备运行时间
|
||||
r.setWork_time("3.5 小时");
|
||||
r.setWork_time("3.5");
|
||||
//设备监控图标
|
||||
r.setDevice_url("ylj");
|
||||
//设备运行状态
|
||||
@@ -205,25 +212,25 @@ public class CockpitServiceImpl implements CockpitService{
|
||||
if(ObjectUtil.isNotEmpty(rows)) {
|
||||
DeviceDetailDto deviceDetailDto = rows.toJavaObject(DeviceDetailDto.class);
|
||||
//Todo 点击设备弹窗临时演示数据,后面需要根据业务逻辑查询
|
||||
deviceDetailDto.setReal_qty("1500 KG");
|
||||
deviceDetailDto.setReal_qty("1500");
|
||||
deviceDetailDto.setVehicle_code("L007");
|
||||
deviceDetailDto.setPoint_status("运行中");
|
||||
deviceDetailDto.setPallet_qty("120 托");
|
||||
deviceDetailDto.setMove_first_kiln("30 托");
|
||||
deviceDetailDto.setWork_time("3.5 小时");
|
||||
deviceDetailDto.setMove_second_kiln("30 托");
|
||||
deviceDetailDto.setPallet_qty("120");
|
||||
deviceDetailDto.setMove_first_kiln("30");
|
||||
deviceDetailDto.setWork_time("3.5");
|
||||
deviceDetailDto.setMove_second_kiln("30");
|
||||
deviceDetailDto.setDevice_url("ylj");
|
||||
deviceDetailDto.setSecond_kiln_qty("0 车");
|
||||
deviceDetailDto.setPresent_kiln_qty("15 车");
|
||||
deviceDetailDto.setVolume("20 车");
|
||||
deviceDetailDto.setReady_lane("60 托");
|
||||
deviceDetailDto.setFirst_kiln_qty("20 车");
|
||||
deviceDetailDto.setMove_second_kiln("20 托");
|
||||
deviceDetailDto.setMechanical_arm_qty("12000 块");
|
||||
deviceDetailDto.setSecond_kiln_qty("0");
|
||||
deviceDetailDto.setPresent_kiln_qty("15");
|
||||
deviceDetailDto.setVolume("20");
|
||||
deviceDetailDto.setReady_lane("60");
|
||||
deviceDetailDto.setFirst_kiln_qty("20");
|
||||
deviceDetailDto.setMove_second_kiln("20");
|
||||
deviceDetailDto.setMechanical_arm_qty("12000");
|
||||
deviceDetailDto.setPack_qty("1200");
|
||||
deviceDetailDto.setFinish_pallet_qty("120 个");
|
||||
deviceDetailDto.setMechanical_pallet_qty("120 托");
|
||||
deviceDetailDto.setFinish_pile_qty("12 垛");
|
||||
deviceDetailDto.setFinish_pallet_qty("120");
|
||||
deviceDetailDto.setMechanical_pallet_qty("120");
|
||||
deviceDetailDto.setFinish_pile_qty("12");
|
||||
List<ProductionInfoDto> setMixingList = new ArrayList<>();
|
||||
List<ProductionInfoDto> setCrushingList = new ArrayList<>();
|
||||
setMixingList.add(ProductionInfoDto.builder().productionDetails("混料23.60*0.68").productionQty("1500").weightUnitName("KG").build());
|
||||
@@ -275,4 +282,21 @@ public class CockpitServiceImpl implements CockpitService{
|
||||
hashMap.put("faultyInfo", faultyInfoList);
|
||||
return hashMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断静置状态
|
||||
*/
|
||||
private void getStandingStatus(SchBasePointDto schBasePointDto) {
|
||||
if(StringUtils.isNotBlank(schBasePointDto.getInstorage_time()) && null != schBasePointDto.getStanding_time()) {
|
||||
DateTime nowTime = DateUtil.parse(DateUtil.now(), DatePattern.NORM_DATETIME_FORMAT);
|
||||
DateTime inStorageTime = DateUtil.parse(schBasePointDto.getInstorage_time(), DatePattern.NORM_DATETIME_FORMAT);
|
||||
long minute = DateUtil.between(nowTime, inStorageTime, DateUnit.MINUTE);
|
||||
if(minute < schBasePointDto.getStanding_time().longValue()) {
|
||||
schBasePointDto.setStanding_status("静置中");
|
||||
}
|
||||
else{
|
||||
schBasePointDto.setStanding_status("静置完成");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
## 表字段对应输入参数
|
||||
#################################################
|
||||
输入.flag TYPEAS s_string
|
||||
输入.point_id TYPEAS s_string
|
||||
|
||||
[临时表]
|
||||
--这边列出来的临时表就会在运行期动态创建
|
||||
@@ -71,4 +72,23 @@
|
||||
ENDPAGEQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "3"
|
||||
PAGEQUERY
|
||||
SELECT
|
||||
material.material_code,
|
||||
material.material_name,
|
||||
point.*
|
||||
FROM
|
||||
sch_base_point point
|
||||
LEFT JOIN md_me_materialbase material ON material.material_id = point.material_id
|
||||
WHERE 1=1
|
||||
OPTION 输入.point_id <> ""
|
||||
point.point_id = 输入.point_id
|
||||
ENDOPTION
|
||||
ORDER BY
|
||||
point.create_time DESC
|
||||
ENDSELECT
|
||||
ENDPAGEQUERY
|
||||
ENDIF
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user