Commit b35a9306 zshaohui

1.增加忽略流水线检查配置

2.流水线 增加errorCode 黑灯工厂
1 个父辈 3c64092e
...@@ -185,4 +185,9 @@ public class Constants { ...@@ -185,4 +185,9 @@ public class Constants {
* 迈征配置分钟 * 迈征配置分钟
*/ */
public static final String CACHE_maiZhengMinute = "maiZhengMinute"; public static final String CACHE_maiZhengMinute = "maiZhengMinute";
/**
* 是否忽略流水线检查
*/
public static final String CACHE_ignoreLineCheck = "ignoreLineCheck";
} }
package com.neotel.smfcore.core.device.handler.impl; package com.neotel.smfcore.core.device.handler.impl;
import com.neotel.smfcore.common.utils.Constants;
import com.neotel.smfcore.core.device.bean.StatusBean; import com.neotel.smfcore.core.device.bean.StatusBean;
import com.neotel.smfcore.core.device.enums.OP; import com.neotel.smfcore.core.device.enums.OP;
import com.neotel.smfcore.core.storage.enums.DeviceType; import com.neotel.smfcore.core.storage.enums.DeviceType;
...@@ -39,6 +40,12 @@ public class SisoBoxHandler extends BaseDeviceHandler { ...@@ -39,6 +40,12 @@ public class SisoBoxHandler extends BaseDeviceHandler {
statusBean =taskService.checkOut(storage, statusBean); statusBean =taskService.checkOut(storage, statusBean);
} }
Boolean ignoreLineCheck = dataCache.getCache(Constants.CACHE_ignoreLineCheck);
if (ignoreLineCheck == null){
ignoreLineCheck = false;
}
statusBean.addData("ignoreLineCheck",ignoreLineCheck.toString());
return statusBean; return statusBean;
} }
@Override @Override
......
...@@ -27,6 +27,12 @@ public class EquipMsg { ...@@ -27,6 +27,12 @@ public class EquipMsg {
* 消息内容 * 消息内容
*/ */
private String msg; private String msg;
/**
* 错误码
*/
private String errorCode;
/** /**
* 参数 * 参数
*/ */
......
package com.neotel.smfcore.core.equipment.bean;
import lombok.Data;
@Data
public class EquipStatus {
private String module;
private int status;
}
...@@ -39,6 +39,8 @@ public class EquipStatusBean implements Serializable { ...@@ -39,6 +39,8 @@ public class EquipStatusBean implements Serializable {
private List<EquipMsg> msgList = new ArrayList<>(); private List<EquipMsg> msgList = new ArrayList<>();
private List<EquipStatus> statusList = new ArrayList<>();
/** /**
* 发上来的数据 * 发上来的数据
*/ */
......
...@@ -79,6 +79,11 @@ public class SettingsController { ...@@ -79,6 +79,11 @@ public class SettingsController {
Integer preGenerateTaskTimes = dataCache.getCache(Constants.CACHE_preGenerateTask_Times); Integer preGenerateTaskTimes = dataCache.getCache(Constants.CACHE_preGenerateTask_Times);
List<LineConfig> lineConfigList = dataCache.getCache(Constants.CACHE_lineConfigList); List<LineConfig> lineConfigList = dataCache.getCache(Constants.CACHE_lineConfigList);
Integer maiZhengMinute = dataCache.getCache(Constants.CACHE_maiZhengMinute); Integer maiZhengMinute = dataCache.getCache(Constants.CACHE_maiZhengMinute);
Boolean ignoreLineCheck = dataCache.getCache(Constants.CACHE_ignoreLineCheck);
if (ignoreLineCheck == null){
ignoreLineCheck = false;
dataCache.updateCache(Constants.CACHE_ignoreLineCheck,ignoreLineCheck);
}
SysSettingsDto dto = new SysSettingsDto(); SysSettingsDto dto = new SysSettingsDto();
dto.setStartJob(startJob); dto.setStartJob(startJob);
...@@ -90,6 +95,7 @@ public class SettingsController { ...@@ -90,6 +95,7 @@ public class SettingsController {
dto.setPreGenerateTaskTimes(preGenerateTaskTimes); dto.setPreGenerateTaskTimes(preGenerateTaskTimes);
dto.setLineConfigList(lineConfigList); dto.setLineConfigList(lineConfigList);
dto.setMaiZhengMinute(maiZhengMinute); dto.setMaiZhengMinute(maiZhengMinute);
dto.setIgnoreLineCheck(ignoreLineCheck);
return dto; return dto;
} }
...@@ -114,6 +120,9 @@ public class SettingsController { ...@@ -114,6 +120,9 @@ public class SettingsController {
if (sysSettingsDto.getMaiZhengMinute() != null) { if (sysSettingsDto.getMaiZhengMinute() != null) {
dataCache.updateCache(Constants.CACHE_maiZhengMinute, sysSettingsDto.getMaiZhengMinute()); dataCache.updateCache(Constants.CACHE_maiZhengMinute, sysSettingsDto.getMaiZhengMinute());
} }
dataCache.updateCache(Constants.CACHE_ignoreLineCheck,sysSettingsDto.isIgnoreLineCheck());
log.info("更改系统设置:stopout=" + sysSettingsDto.isStopOut() + ",stopjob=" + sysSettingsDto.isStartJob() log.info("更改系统设置:stopout=" + sysSettingsDto.isStopOut() + ",stopjob=" + sysSettingsDto.isStartJob()
+ ",backUpMonth=" + sysSettingsDto.getBackUpMonth() + ",backUpMonth=" + sysSettingsDto.getBackUpMonth()
+ ",preGenerateTask=" + sysSettingsDto.getPreGenerateTask() + ",preGenerateTask=" + sysSettingsDto.getPreGenerateTask()
...@@ -122,6 +131,7 @@ public class SettingsController { ...@@ -122,6 +131,7 @@ public class SettingsController {
+",preGenerateTaskTimes=" +sysSettingsDto.getPreGenerateTaskTimes() +",preGenerateTaskTimes=" +sysSettingsDto.getPreGenerateTaskTimes()
+",lineConfigList="+sysSettingsDto.getLineConfigList() +",lineConfigList="+sysSettingsDto.getLineConfigList()
+",maiZhengMinute="+sysSettingsDto.getMaiZhengMinute() +",maiZhengMinute="+sysSettingsDto.getMaiZhengMinute()
+",ignoreLineCheck="+sysSettingsDto.isIgnoreLineCheck()
); );
return ResultBean.newOkResult("保存成功"); return ResultBean.newOkResult("保存成功");
} }
......
...@@ -40,6 +40,9 @@ public class SysSettingsDto implements Serializable { ...@@ -40,6 +40,9 @@ public class SysSettingsDto implements Serializable {
@ApiModelProperty("迈征配置时间") @ApiModelProperty("迈征配置时间")
private Integer maiZhengMinute; private Integer maiZhengMinute;
@ApiModelProperty("是否忽略流水线检查")
private boolean ignoreLineCheck = false;
} }
...@@ -16,4 +16,8 @@ public class KafkaConfig { ...@@ -16,4 +16,8 @@ public class KafkaConfig {
* MachineParameter * MachineParameter
*/ */
public static final String MACHINEPARAMETER_TOPIC = "MachineParameter"; public static final String MACHINEPARAMETER_TOPIC = "MachineParameter";
public static final String LINE_CID = "line";
} }
...@@ -10,9 +10,13 @@ import com.neotel.smfcore.core.device.enums.BOX_STATUS; ...@@ -10,9 +10,13 @@ import com.neotel.smfcore.core.device.enums.BOX_STATUS;
import com.neotel.smfcore.core.device.enums.OP; import com.neotel.smfcore.core.device.enums.OP;
import com.neotel.smfcore.core.device.enums.OP_STATUS; import com.neotel.smfcore.core.device.enums.OP_STATUS;
import com.neotel.smfcore.core.device.util.DataCache; import com.neotel.smfcore.core.device.util.DataCache;
import com.neotel.smfcore.core.equipment.bean.EquipMsg;
import com.neotel.smfcore.core.equipment.bean.EquipStatus;
import com.neotel.smfcore.core.equipment.bean.EquipStatusBean;
import com.neotel.smfcore.core.storage.service.po.Storage; import com.neotel.smfcore.core.storage.service.po.Storage;
import com.neotel.smfcore.core.system.service.manager.IDataLogManager; import com.neotel.smfcore.core.system.service.manager.IDataLogManager;
import com.neotel.smfcore.core.system.util.DevicesStatusUtil; import com.neotel.smfcore.core.system.util.DevicesStatusUtil;
import com.neotel.smfcore.core.system.util.EquipStatusUtil;
import com.neotel.smfcore.custom.lizhen.innerBox.bean.StorageExport; import com.neotel.smfcore.custom.lizhen.innerBox.bean.StorageExport;
import com.neotel.smfcore.custom.lizhen.innerBox.util.StorageExportUtil; import com.neotel.smfcore.custom.lizhen.innerBox.util.StorageExportUtil;
import com.neotel.smfcore.custom.lizhen.kafka.bean.Heartbeat; import com.neotel.smfcore.custom.lizhen.kafka.bean.Heartbeat;
...@@ -202,36 +206,65 @@ public class KafkaService { ...@@ -202,36 +206,65 @@ public class KafkaService {
@Scheduled(fixedRate = 1000 * 60 * 1) @Scheduled(fixedRate = 1000 * 60 * 1)
public void setStorageExportStatus() { public void setStorageExportStatus() {
log.info("发送出料口信息开始"); log.info("发送出料口信息开始");
for (Map.Entry<String, StorageExport> exportEntry : StorageExportUtil.exportMap.entrySet()) {
if (exportEntry.getKey().contains(StorageExportUtil.OUT_STATION)) { EquipStatusBean statusBean = EquipStatusUtil.getStatusBean(KafkaConfig.LINE_CID);
continue; List<EquipStatus> statusList = statusBean.getStatusList();
List<EquipMsg> msgList = statusBean.getMsgList();
if (statusList != null && !statusList.isEmpty()) {
for (EquipStatus equipStatus : statusList) {
int status = equipStatus.getStatus(); //状态
String module = equipStatus.getModule(); //出口
String currentStatus = "1"; //正常
if (2 == status || 3 == status) {
currentStatus = "3"; //故障
}
if (0 == status) {
currentStatus = "5";
} }
//默认是等待中2,禁用是故障3,有任务是运行1
String currentStatus = "2";
StorageExport export = exportEntry.getValue(); List<EquipMsg> equipMsgList = new ArrayList<>();
if (export.isDisable()) { if (msgList != null && !msgList.isEmpty()) {
currentStatus = "3"; for (EquipMsg equipMsg : msgList) {
} else { if (module.equals(equipMsg.getModule())) {
if (StringUtils.isNotBlank(export.getHSerial())) { equipMsgList.add(equipMsg);
currentStatus = "1"; }
} }
} }
MachineStatus status = new MachineStatus(); if (equipMsgList != null && !equipMsgList.isEmpty()) {
for (EquipMsg equipMsg : equipMsgList) {
MachineStatus machineStatus = new MachineStatus();
String dateStr = DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss.SSS"); String dateStr = DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss.SSS");
status.setOccurrenceTime(dateStr); machineStatus.setOccurrenceTime(dateStr);
status.setMachineID(StorageExportConfig.getMachineId(exportEntry.getKey())); machineStatus.setMachineID(StorageExportConfig.getMachineId(module));
status.setTopicType(KafkaConfig.MACHINESTATUS_TOPIC); machineStatus.setTopicType(KafkaConfig.MACHINESTATUS_TOPIC);
status.setCurrentStatus(currentStatus); machineStatus.setCurrentStatus(currentStatus);
status.setErrorCode(""); machineStatus.setErrorCode(equipMsg.getErrorCode());
status.setErrorMsg(""); machineStatus.setErrorMsg(equipMsg.getMsg());
status.setClientIP(""); machineStatus.setClientIP("");
String statusStr = JSON.toJSONString(status); String statusStr = JSON.toJSONString(machineStatus);
log.info("出料口主题为:" + KafkaConfig.MACHINESTATUS_TOPIC + "内容为:" + statusStr); log.info("出料口主题为:" + KafkaConfig.MACHINESTATUS_TOPIC + "内容为:" + statusStr);
ListenableFuture future = kafkaTemplate.send(KafkaConfig.MACHINESTATUS_TOPIC, statusStr); ListenableFuture future = kafkaTemplate.send(KafkaConfig.MACHINESTATUS_TOPIC, statusStr);
log.info("出料口返回结果为:" + JSON.toJSONString(future)); log.info("出料口返回结果为:" + JSON.toJSONString(future));
} }
} else {
MachineStatus machineStatus = new MachineStatus();
String dateStr = DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss.SSS");
machineStatus.setOccurrenceTime(dateStr);
machineStatus.setMachineID(StorageExportConfig.getMachineId(module));
machineStatus.setTopicType(KafkaConfig.MACHINESTATUS_TOPIC);
machineStatus.setCurrentStatus(currentStatus);
machineStatus.setErrorCode("");
machineStatus.setErrorMsg("");
machineStatus.setClientIP("");
String statusStr = JSON.toJSONString(machineStatus);
log.info("出料口主题为:" + KafkaConfig.MACHINESTATUS_TOPIC + "内容为:" + statusStr);
ListenableFuture future = kafkaTemplate.send(KafkaConfig.MACHINESTATUS_TOPIC, statusStr);
log.info("出料口返回结果为:" + JSON.toJSONString(future));
}
}
}
log.info("发送出料口信息结束"); log.info("发送出料口信息结束");
} }
...@@ -242,27 +275,24 @@ public class KafkaService { ...@@ -242,27 +275,24 @@ public class KafkaService {
@Scheduled(fixedRate = 1000 * 60 * 5) @Scheduled(fixedRate = 1000 * 60 * 5)
public void setStorageHeartbeat() { public void setStorageHeartbeat() {
log.info("发送出料口心跳开始"); log.info("发送出料口心跳开始");
for (Map.Entry<String, StorageExport> exportEntry : StorageExportUtil.exportMap.entrySet()) { EquipStatusBean statusBean = EquipStatusUtil.getStatusBean(KafkaConfig.LINE_CID);
if (exportEntry.getKey().contains(StorageExportUtil.OUT_STATION)) { List<EquipStatus> statusList = statusBean.getStatusList();
continue; if (statusList != null && !statusList.isEmpty()) {
} for (EquipStatus equipStatus : statusList) {
//默认是等待中2,禁用是故障3,有任务是运行1 int status = equipStatus.getStatus(); //状态
String currentStatus = "2"; String module = equipStatus.getModule(); //出口
String currentStatus = "1"; //正常
StorageExport export = exportEntry.getValue(); if (2 == status || 3 == status) {
if (export.isDisable()) { currentStatus = "3"; //故障
currentStatus = "3"; }
} else { if (0 == status) {
if (StringUtils.isNotBlank(export.getHSerial())) { currentStatus = "5"; //离线
currentStatus = "1"; }
} if ("1".equals(currentStatus)) {
}
if (!"3".equals(currentStatus)) {
Heartbeat heartbeat = new Heartbeat(); Heartbeat heartbeat = new Heartbeat();
String dateStr = DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss.SSS"); String dateStr = DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss.SSS");
heartbeat.setOccurrenceTime(dateStr); heartbeat.setOccurrenceTime(dateStr);
heartbeat.setMachineID(StorageExportConfig.getMachineId(exportEntry.getKey())); heartbeat.setMachineID(StorageExportConfig.getMachineId(module));
heartbeat.setTopicType(KafkaConfig.HEARTBEAT_TOPIC); heartbeat.setTopicType(KafkaConfig.HEARTBEAT_TOPIC);
String statusStr = JSON.toJSONString(heartbeat); String statusStr = JSON.toJSONString(heartbeat);
log.info("出料口主题为:" + KafkaConfig.HEARTBEAT_TOPIC + "内容为:" + statusStr); log.info("出料口主题为:" + KafkaConfig.HEARTBEAT_TOPIC + "内容为:" + statusStr);
...@@ -270,6 +300,7 @@ public class KafkaService { ...@@ -270,6 +300,7 @@ public class KafkaService {
log.info("出料口返回结果为:" + JSON.toJSONString(future)); log.info("出料口返回结果为:" + JSON.toJSONString(future));
} }
} }
}
log.info("发送出料口心跳结束"); log.info("发送出料口心跳结束");
} }
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!