add:增加固化室错误代码解析。
This commit is contained in:
@@ -4,7 +4,6 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.Data;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.nl.acs.device.domain.Device;
|
||||
import org.nl.acs.device_driver.DeviceDriver;
|
||||
import org.nl.acs.device_driver.RouteableDeviceDriver;
|
||||
@@ -16,7 +15,11 @@ import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||
import org.nl.acs.monitor.DeviceStageMonitor;
|
||||
import org.nl.config.SpringContextHolder;
|
||||
import org.openscada.opc.lib.da.Server;
|
||||
import java.util.*;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.nl.common.utils.StringUtils.handleErrorCode;
|
||||
|
||||
/**
|
||||
@@ -185,8 +188,8 @@ public class GuhuashiSiteDeviceDriver extends AbstractOpcDeviceDriver implements
|
||||
//todo 错误码转换
|
||||
request.setType("3");
|
||||
request.setState(String.valueOf(VD7046));
|
||||
//String ghsErrorCode = "10001000000010000001000010001000";
|
||||
String ghsErrorMessages = handleErrorCode(String.valueOf(VD7046), AcsDefineEnum.GHS_ERROR_STATUS);
|
||||
String binaryCode = Integer.toBinaryString(VD7046);
|
||||
String ghsErrorMessages = handleErrorCode(binaryCode, "GHS");
|
||||
request.setState(ghsErrorMessages);
|
||||
//有故障
|
||||
request.setCurrent_status(AcsDefineEnum.IS_NOTANDYES.code("是"));
|
||||
|
||||
@@ -24,7 +24,6 @@ import nl.basjes.parse.useragent.UserAgentAnalyzer;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.nl.acs.enums.AcsDefineEnum;
|
||||
import org.nl.config.ElAdminProperties;
|
||||
import org.nl.config.SpringContextHolder;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.net.InetAddress;
|
||||
@@ -253,25 +252,42 @@ public class StringUtils {
|
||||
}
|
||||
}
|
||||
|
||||
public static String handleErrorCode(String errorCode, AcsDefineEnum deviceEnum) {
|
||||
public static String handleErrorCode(String errorCode, String deviceType) {
|
||||
AcsDefineEnum errorType;
|
||||
List<String> errorMessages = new ArrayList<>();
|
||||
// if (errorCode.length() != 32) {
|
||||
// throw new RuntimeException("错误代码必须是32位!");
|
||||
// }
|
||||
for (int i = 0; i < errorCode.length(); i++) {
|
||||
char bit = errorCode.charAt(i);
|
||||
if (bit == '1') {
|
||||
String errorNumber = String.valueOf(i + 1);
|
||||
String errorMessage = deviceEnum.getErrorMessage(errorNumber);
|
||||
if (org.apache.commons.lang3.StringUtils.isNotBlank(errorMessage)) {
|
||||
errorMessages.add(errorMessage);
|
||||
switch (deviceType) {
|
||||
//取货完成
|
||||
case "GHS":
|
||||
errorType = AcsDefineEnum.GHS_ERROR_STATUS;
|
||||
break;
|
||||
//放货完成
|
||||
case "TBX":
|
||||
errorType = AcsDefineEnum.IS_NOTANDYES;
|
||||
break;
|
||||
default:
|
||||
errorType = null;
|
||||
break;
|
||||
|
||||
}
|
||||
if (errorType != null) {
|
||||
for (int i = 0; i < errorCode.length(); i++) {
|
||||
// 从右往左,索引从0开始,所以需要加1
|
||||
if (errorCode.charAt(errorCode.length() - 1 - i) == '1') {
|
||||
// 获取对应的错误信息
|
||||
String errorMessage = errorType.getErrorMessage(String.valueOf(i + 1));
|
||||
if (!errorMessage.isEmpty()) {
|
||||
errorMessages.add(errorMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ObjectUtils.isNotEmpty(errorMessages)) {
|
||||
return String.join(", ", errorMessages);
|
||||
if (ObjectUtils.isNotEmpty(errorMessages)) {
|
||||
return String.join(", ", errorMessages);
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ import java.util.Map;
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/api/param")
|
||||
@SaIgnore
|
||||
class SysParamController {
|
||||
|
||||
@Autowired
|
||||
@@ -43,6 +44,16 @@ class SysParamController {
|
||||
return new ResponseEntity<>(TableDataInfo.build(paramService.queryPage(whereJson, page)), HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/getValueByCode1")
|
||||
@Log("查询系统参数")
|
||||
@ApiOperation("查询系统参数")
|
||||
//@SaCheckPermission("param:list")
|
||||
public ResponseEntity<Object> query(){
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@PostMapping
|
||||
@Log("新增系统参数")
|
||||
@ApiOperation("新增系统参数")
|
||||
|
||||
Reference in New Issue
Block a user