rev:修改设备UI查询,错误代码解析。
This commit is contained in:
@@ -115,26 +115,22 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
String old_device_code = null;
|
||||
String emptyNum = null;
|
||||
String device_code = null;
|
||||
|
||||
// if (phase == 0x67) {
|
||||
// //故障信息
|
||||
// if (arr[18] * 256 + arr[19] == 0) {
|
||||
//
|
||||
// }
|
||||
// FeedBackTaskStatusRequest request = new FeedBackTaskStatusRequest();
|
||||
// request.setDevice_code(this.device_code);
|
||||
// request.setType("3");
|
||||
// request.setState("故障");
|
||||
// acsToWmsService.notify(request);
|
||||
// data = NDCAgvService.sendAgvOneModeInst(phase, index, 0, 0, 0, 0, 0);
|
||||
// }
|
||||
// if (phase == 0x67) {
|
||||
// //故障信息
|
||||
// if (arr[18] * 256 + arr[19] == 0) {
|
||||
//
|
||||
// }
|
||||
// FeedBackTaskStatusRequest request = new FeedBackTaskStatusRequest();
|
||||
// request.setDevice_code(this.device_code);
|
||||
// request.setType("3");
|
||||
// request.setState("故障");
|
||||
// acsToWmsService.notify(request);
|
||||
// data = NDCAgvService.sendAgvOneModeInst(phase, index, 0, 0, 0, 0, 0);
|
||||
// }
|
||||
TaskDto task = new TaskDto();
|
||||
|
||||
if(ObjectUtil.isNotEmpty(inst)){
|
||||
task = taskService.findById(inst.getTask_id());
|
||||
}
|
||||
|
||||
|
||||
//分配 车id
|
||||
//(不需要WCS反馈)
|
||||
if (phase == 0x02) {
|
||||
|
||||
@@ -785,10 +785,10 @@ public class SiemensConveyorLabelingDeviceDriver extends AbstractOpcDeviceDriver
|
||||
}
|
||||
ApplyLabelingAndBindingRequest applyLabelingAndBindingRequest =
|
||||
new ApplyLabelingAndBindingRequest();
|
||||
// JSONObject device_json =
|
||||
// WQLObject.getWQLObject("acs_storage_cell")
|
||||
// .query("storage_code ='" + this.device_code + "'")
|
||||
// .uniqueResult(0);
|
||||
// JSONObject device_json =
|
||||
// WQLObject.getWQLObject("acs_storage_cell")
|
||||
// .query("storage_code ='" + this.device_code + "'")
|
||||
// .uniqueResult(0);
|
||||
StorageCell storageCell = new LambdaQueryChainWrapper<>(storageCellMapper).eq(StorageCell::getStorage_code,this.device_code).one();
|
||||
String start_point_code = null;
|
||||
if (!ObjectUtil.isEmpty(storageCell)) {
|
||||
|
||||
@@ -115,11 +115,11 @@ public class StandardAutodoorDeviceDriver extends AbstractOpcDeviceDriver implem
|
||||
}
|
||||
if (state != last_state) {
|
||||
//固化室状态变更后通知lms更新固化室状态
|
||||
FeedBackTaskStatusRequest request = new FeedBackTaskStatusRequest();
|
||||
request.setState(String.valueOf(state));
|
||||
request.setDevice_code(this.devicecode);
|
||||
request.setType("1");
|
||||
acsToWmsService.notify(request);
|
||||
// FeedBackTaskStatusRequest request = new FeedBackTaskStatusRequest();
|
||||
// request.setState(String.valueOf(state));
|
||||
// request.setDevice_code(this.devicecode);
|
||||
// request.setType("1");
|
||||
// acsToWmsService.notify(request);
|
||||
}
|
||||
last_action = action;
|
||||
last_mode = mode;
|
||||
|
||||
@@ -128,6 +128,8 @@ public class ItemProtocol {
|
||||
return "0";
|
||||
}
|
||||
|
||||
|
||||
//保湿间
|
||||
public static List<ItemDto> getReadableItemDtos() {
|
||||
ArrayList list = new ArrayList();
|
||||
list.add(new ItemDto(item_x0, "系统状态", "400001"));
|
||||
|
||||
@@ -1,43 +1,23 @@
|
||||
package org.nl.acs.device_driver.tianneng.guhuashi;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
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.service.DeviceService;
|
||||
import org.nl.acs.device_driver.DeviceDriver;
|
||||
import org.nl.acs.device_driver.RequestMethodEnum;
|
||||
import org.nl.acs.device_driver.RouteableDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
||||
import org.nl.acs.ext.wms.data.BaseRequest;
|
||||
import org.nl.acs.enums.AcsDefineEnum;
|
||||
import org.nl.acs.ext.wms.data.feedBackTaskStatus.FeedBackTaskStatusRequest;
|
||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||
import org.nl.acs.instruction.domain.Instruction;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.monitor.DeviceStageMonitor;
|
||||
import org.nl.acs.opc.WcsConfig;
|
||||
import org.nl.acs.route.service.RouteLineService;
|
||||
import org.nl.acs.route.service.dto.RouteLineDto;
|
||||
import org.nl.acs.task.domain.Task;
|
||||
import org.nl.acs.task.service.TaskService;
|
||||
import org.nl.acs.task.service.dto.TaskDto;
|
||||
import org.nl.acs.task.service.mapper.TaskMapper;
|
||||
import org.nl.acs.utils.ConvertUtil;
|
||||
import org.nl.acs.utils.ReadUtil;
|
||||
import org.nl.common.utils.CodeUtil;
|
||||
import org.nl.config.SpringContextHolder;
|
||||
import org.openscada.opc.lib.da.Server;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import static org.nl.common.utils.StringUtils.handleErrorCode;
|
||||
|
||||
/**
|
||||
* 检测站点驱动
|
||||
@@ -195,6 +175,8 @@ public class GuhuashiSiteDeviceDriver extends AbstractOpcDeviceDriver implements
|
||||
//todo 错误码转换
|
||||
request.setType("3");
|
||||
request.setState(String.valueOf(VD7046));
|
||||
//有故障
|
||||
request.setCurrent_status(AcsDefineEnum.IS_NOTANDYES.code("否"));
|
||||
acsToWmsService.notify(request);
|
||||
}else if(VD7046 != last_VD7046) {
|
||||
log.info("固化室{}反馈固化室发生异常,开始通知lms", devicecode);
|
||||
@@ -203,6 +185,11 @@ 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);
|
||||
request.setState(ghsErrorMessages);
|
||||
//有故障
|
||||
request.setCurrent_status(AcsDefineEnum.IS_NOTANDYES.code("是"));
|
||||
acsToWmsService.notify(request);
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ import org.nl.acs.device_driver.RequestMethodEnum;
|
||||
import org.nl.acs.device_driver.RouteableDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
||||
import org.nl.acs.enums.AcsDefineEnum;
|
||||
import org.nl.acs.ext.wms.data.BaseRequest;
|
||||
import org.nl.acs.ext.wms.data.feedBackTaskStatus.FeedBackTaskStatusRequest;
|
||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||
@@ -164,12 +165,24 @@ public class SiteDeviceDriver extends AbstractOpcDeviceDriver implements DeviceD
|
||||
acsToWmsService.notify(request);
|
||||
}
|
||||
}
|
||||
//todo 错误码转换
|
||||
if (error != last_error ) {
|
||||
|
||||
if (error != last_error && error == 0) {
|
||||
log.info("输送线{}反馈输送线恢复正常,开始通知lms", device_code);
|
||||
FeedBackTaskStatusRequest request = new FeedBackTaskStatusRequest();
|
||||
request.setDevice_code(this.device_code);
|
||||
request.setType("3");
|
||||
request.setState(String.valueOf(error));
|
||||
//无故障
|
||||
request.setCurrent_status(AcsDefineEnum.IS_NOTANDYES.code("否"));
|
||||
acsToWmsService.notify(request);
|
||||
}
|
||||
else if (error != last_error ) {
|
||||
FeedBackTaskStatusRequest request = new FeedBackTaskStatusRequest();
|
||||
request.setDevice_code(this.device_code);
|
||||
request.setType("3");
|
||||
//todo 错误码转换
|
||||
request.setState(String.valueOf(error));
|
||||
request.setCurrent_status(AcsDefineEnum.IS_NOTANDYES.code("是"));
|
||||
acsToWmsService.notify(request);
|
||||
}
|
||||
} catch (Exception var17) {
|
||||
|
||||
@@ -118,6 +118,7 @@ public class ItemProtocol {
|
||||
|
||||
}
|
||||
|
||||
//涂板线,未对接
|
||||
public static List<ItemDto> getReadableItemDtos() {
|
||||
ArrayList list = new ArrayList();
|
||||
list.add(new ItemDto(item_heartbeat, "心跳", "DB600.B0"));
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
package org.nl.acs.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* acs状态枚举
|
||||
*
|
||||
* @author gbx
|
||||
* @since 2024-01-31
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum AcsDefineEnum {
|
||||
|
||||
//固化室错误码
|
||||
GHS_ERROR_STATUS(MapOf.of("排湿风机变频故障", "1", "主变频器故障", "2", "低水位报警", "3", "低气压报警", "4", "温度异常报警", "5", "湿度异常报警", "6",
|
||||
"电动门运行故障", "7", "前门安全气缸限位故障", "8", "前门压紧气缸限位故障", "9", "后门安全气缸限位故障", "10", "后门压紧气缸限位故障", "11", "热风机运行失败",
|
||||
"12", "燃烧器故障", "13", "高压泵故障", "14", "循环风机过载", "15", "温度1比较值超限", "16", "温度2比较值超限", "17",
|
||||
"高压泵运行故障", "18", "热风进风口开未到位故障", "19", "热风出风口开未到位故障", "20", "湿度1比较值超限", "21", "湿度2比较值超限", "22")),
|
||||
|
||||
|
||||
//是否
|
||||
IS_NOTANDYES(MapOf.of("否", "0", "是", "1"));
|
||||
|
||||
|
||||
private Map<String, String> code;
|
||||
|
||||
public String code(String desc) {
|
||||
String code = this.getCode().get(desc);
|
||||
if (StringUtils.isNotEmpty(code)) {
|
||||
return code;
|
||||
}
|
||||
throw new RuntimeException(this.name() + "对应类型" + desc + "未定义");
|
||||
}
|
||||
|
||||
public Long longCode(String desc) {
|
||||
String code = this.getCode().get(desc);
|
||||
if (StringUtils.isNotEmpty(code)) {
|
||||
return Long.valueOf(code);
|
||||
}
|
||||
throw new RuntimeException(this.name() + "对应类型" + desc + "未定义");
|
||||
}
|
||||
|
||||
public String check(String code) {
|
||||
for (Map.Entry<String, String> entry : this.getCode().entrySet()) {
|
||||
if (entry.getValue().equals(code)) {
|
||||
return entry.getValue();
|
||||
}
|
||||
}
|
||||
throw new RuntimeException(this.name() + "对应类型" + code + "未定义");
|
||||
}
|
||||
|
||||
public String check1(String code) {
|
||||
for (Map.Entry<String, String> entry : this.getCode().entrySet()) {
|
||||
if (entry.getValue().equals(code)) {
|
||||
return entry.getKey();
|
||||
}
|
||||
}
|
||||
throw new RuntimeException(this.name() + "对应类型" + code + "未定义");
|
||||
}
|
||||
|
||||
public String getErrorMessage(String code) {
|
||||
for (Map.Entry<String, String> entry : this.code.entrySet()) {
|
||||
if (entry.getValue().equals(code)) {
|
||||
return entry.getKey();
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package org.nl.acs.enums;
|
||||
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
|
||||
/*
|
||||
* @author ZZQ
|
||||
* @Date 2022/11/29 2:55 下午
|
||||
*/
|
||||
public class MapOf implements Serializable {
|
||||
|
||||
public static <K> HashMap of(K... key) {
|
||||
HashMap map = new HashMap<>();
|
||||
for (int i = 0; i < (key.length & ~1); i = i + 2) {
|
||||
map.put(key[i], key[i + 1]);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
}
|
||||
@@ -36,6 +36,12 @@ public class FeedBackTaskStatusRequest extends BaseRequest {
|
||||
*/
|
||||
private String vehicle_code;
|
||||
|
||||
|
||||
/**
|
||||
* 当前状态
|
||||
*/
|
||||
private String current_status;
|
||||
|
||||
/**
|
||||
* 动作 1请求取货 2取货完成 3请求放货 4放货完成
|
||||
*/
|
||||
|
||||
@@ -326,7 +326,6 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
} else {
|
||||
type = "error";
|
||||
}
|
||||
|
||||
log.info("feedbackOrderStatus----返回参数{}", result);
|
||||
} catch (Exception e) {
|
||||
String msg = e.getMessage();
|
||||
@@ -334,7 +333,6 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
//System.out.println(msg);
|
||||
}
|
||||
return result;
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -238,6 +238,10 @@ public class InstructionMybatis extends CommonModel<InstructionMybatis> implemen
|
||||
@ApiModelProperty(value = "AGV系统类型")
|
||||
private String agv_system_type;
|
||||
|
||||
@ApiModelProperty(value = "lms任务id")
|
||||
private String ext_task_id;
|
||||
|
||||
|
||||
public void copyFrom(Instruction source){
|
||||
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.nl.acs.instruction.service.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
@@ -343,9 +344,12 @@ public class InstructionDto implements Serializable {
|
||||
*/
|
||||
private String next_parent_code;
|
||||
|
||||
/**
|
||||
* AGV系统类型
|
||||
*/
|
||||
|
||||
private String agv_system_type;
|
||||
|
||||
|
||||
/**
|
||||
* lms任务id
|
||||
*/
|
||||
private String ext_task_id;
|
||||
}
|
||||
|
||||
@@ -372,6 +372,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
if (StrUtil.isEmpty(dto.getRoute_plan_code())) {
|
||||
dto.setRoute_plan_code(task.getRoute_plan_code());
|
||||
}
|
||||
|
||||
if (StrUtil.isEmpty(dto.getPriority())) {
|
||||
dto.setPriority(task.getPriority());
|
||||
}
|
||||
@@ -411,7 +412,8 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
dto.setCompound_inst_data(task.getCompound_task_data());
|
||||
}
|
||||
}
|
||||
|
||||
//todo 增加lms任务id
|
||||
dto.setExt_task_id(task.getExt_task_id());
|
||||
dto.setCreate_by(ObjectUtil.isNotEmpty(currentUsername) ? currentUsername : "admin");
|
||||
dto.setUpdate_by(ObjectUtil.isNotEmpty(currentUsername) ? currentUsername : "admin");
|
||||
dto.setUpdate_time(now);
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package org.nl.acs.instruction.service.mapper;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.nl.acs.instruction.domain.InstructionMybatis;
|
||||
import org.nl.acs.common.base.CommonMapper;
|
||||
@@ -13,9 +15,5 @@ import org.springframework.stereotype.Repository;
|
||||
*/
|
||||
@Repository
|
||||
public interface InstructionMapper extends CommonMapper<InstructionMybatis> {
|
||||
List<Instruction> getByTaskId(@Param("task_id")String task_id);
|
||||
// List<Instruction> getallbyinstruction_statusAndis_delete();
|
||||
|
||||
|
||||
|
||||
List<Map<String, Object>> getTaskFromInstruction(@Param("deviceCodes") List<String> deviceCodes);
|
||||
}
|
||||
|
||||
@@ -21,6 +21,8 @@ import cn.hutool.json.JSONUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import nl.basjes.parse.useragent.UserAgent;
|
||||
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;
|
||||
|
||||
@@ -28,9 +30,7 @@ import javax.servlet.http.HttpServletRequest;
|
||||
import java.net.InetAddress;
|
||||
import java.net.NetworkInterface;
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.Enumeration;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
@@ -252,4 +252,26 @@ public class StringUtils {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public static String handleErrorCode(String errorCode, AcsDefineEnum deviceEnum) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ObjectUtils.isNotEmpty(errorMessages)) {
|
||||
return String.join(", ", errorMessages);
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -196,6 +196,8 @@ public class AutoCreateInst {
|
||||
instdto.setInstruction_status("0");
|
||||
instdto.setExecute_device_code(start_point_code);
|
||||
instdto.setVehicle_type(vehicleType);
|
||||
//todo lms任务id
|
||||
instdto.setExt_task_id(acsTask.getExt_task_id());
|
||||
try {
|
||||
instructionService.create(instdto);
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package org.nl.quartz.task;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.agv.server.ZheDaAgvService;
|
||||
import org.nl.acs.device.domain.Device;
|
||||
@@ -13,8 +13,7 @@ import org.nl.acs.device_driver.tianneng.baoshijian.BaoshijianSiteDeviceDriver;
|
||||
import org.nl.acs.device_driver.tianneng.guhuashi.GuhuashiSiteDeviceDriver;
|
||||
import org.nl.acs.device_driver.tianneng.site.SiteDeviceDriver;
|
||||
import org.nl.acs.device_driver.tianneng.site_status.SiteStatusDeviceDriver;
|
||||
import org.nl.acs.device_driver.tianneng.tubanxian.TubanxianSiteDeviceDriver;
|
||||
import org.nl.acs.instruction.domain.Instruction;
|
||||
import org.nl.acs.instruction.domain.InstructionMybatis;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.opc.DeviceAppService;
|
||||
import org.nl.common.utils.RedisUtils;
|
||||
@@ -23,6 +22,8 @@ import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 自动同步设备状态
|
||||
@@ -41,6 +42,8 @@ public class SyncDeviceStatus {
|
||||
@Resource
|
||||
private DeviceAppService deviceAppService;
|
||||
|
||||
@Resource
|
||||
private InstructionService instructionService;
|
||||
|
||||
public void run() throws Exception {
|
||||
rgv();
|
||||
@@ -53,6 +56,25 @@ public class SyncDeviceStatus {
|
||||
HttpResponse response = agvService.queryAgvDeviceStatus("1");
|
||||
//查询AGV指令列表
|
||||
JSONArray jsonArray = JSONArray.parseArray(response.body());
|
||||
List<String> task_codes = jsonArray.stream()
|
||||
.map(r -> ((JSONObject) r).getString("task_code"))
|
||||
.collect(Collectors.toList());
|
||||
List<InstructionMybatis> instructionList = instructionService.list(new LambdaQueryWrapper<InstructionMybatis>().in(InstructionMybatis::getInstruction_code, task_codes));
|
||||
if (ObjectUtil.isNotEmpty(instructionList)) {
|
||||
Map<String, String> taskCodeToTaskIdMap = instructionList.stream()
|
||||
.collect(Collectors.toMap(
|
||||
InstructionMybatis::getInstruction_code,
|
||||
InstructionMybatis::getTask_id
|
||||
));
|
||||
jsonArray.forEach(r -> {
|
||||
JSONObject Item = (JSONObject) r;
|
||||
Item.put("task_id", "");
|
||||
String taskId = taskCodeToTaskIdMap.get(Item.getString("task_code"));
|
||||
if (taskId != null) {
|
||||
Item.put("task_id", taskId);
|
||||
}
|
||||
});
|
||||
}
|
||||
redisUtils.set("RGV", jsonArray);
|
||||
} catch (Exception e) {
|
||||
log.error("自动线程查询浙大RGV设备状态失败{}{}", e, e.getMessage());
|
||||
@@ -65,25 +87,25 @@ public class SyncDeviceStatus {
|
||||
JSONArray baoshijian = new JSONArray();
|
||||
JSONArray guhuashi = new JSONArray();
|
||||
JSONArray site = new JSONArray();
|
||||
JSONArray AGV = new JSONArray();
|
||||
log.info("自动线程开始查询AGV设备状态");
|
||||
JSONArray agv = new JSONArray();
|
||||
log.info("自动线程开始查询agv设备状态");
|
||||
List<Device> deviceList = deviceAppService.findAllDevice();
|
||||
for (Device device : deviceList) {
|
||||
if (device.getDeviceDriver() instanceof BaoshijianSiteDeviceDriver) {
|
||||
BaoshijianSiteDeviceDriver baoshijianSiteDeviceDriver=(BaoshijianSiteDeviceDriver)device.getDeviceDriver();
|
||||
BaoshijianSiteDeviceDriver baoshijianSiteDeviceDriver = (BaoshijianSiteDeviceDriver) device.getDeviceDriver();
|
||||
JSONObject json2 = new JSONObject();
|
||||
json2.put("device_code", baoshijianSiteDeviceDriver.getDeviceCode());
|
||||
json2.put("mode",baoshijianSiteDeviceDriver.getX0());
|
||||
json2.put("mode", baoshijianSiteDeviceDriver.getX0());
|
||||
baoshijian.add(json2);
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("device_code", baoshijianSiteDeviceDriver.getDeviceCode()+"DJW01");
|
||||
json.put("move",baoshijianSiteDeviceDriver.getX1());
|
||||
json.put("mode",baoshijianSiteDeviceDriver.getX0());
|
||||
json.put("device_code", baoshijianSiteDeviceDriver.getDeviceCode() + "DJW01");
|
||||
json.put("move", baoshijianSiteDeviceDriver.getX1());
|
||||
json.put("mode", baoshijianSiteDeviceDriver.getX0());
|
||||
baoshijian.add(json);
|
||||
JSONObject json1 = new JSONObject();
|
||||
json1.put("device_code", baoshijianSiteDeviceDriver.getDeviceCode()+"DJW02");
|
||||
json1.put("move",baoshijianSiteDeviceDriver.getX2()==1?0:1);
|
||||
json.put("mode",baoshijianSiteDeviceDriver.getX0());
|
||||
json1.put("device_code", baoshijianSiteDeviceDriver.getDeviceCode() + "DJW02");
|
||||
json1.put("move", baoshijianSiteDeviceDriver.getX2() == 1 ? 0 : 1);
|
||||
json.put("mode", baoshijianSiteDeviceDriver.getX0());
|
||||
baoshijian.add(json1);
|
||||
} else if (device.getDeviceDriver() instanceof GuhuashiSiteDeviceDriver) {
|
||||
GuhuashiSiteDeviceDriver guhuashiSiteDeviceDriver=(GuhuashiSiteDeviceDriver)device.getDeviceDriver();
|
||||
@@ -97,16 +119,18 @@ public class SyncDeviceStatus {
|
||||
json.put("humidity_setting", guhuashiSiteDeviceDriver.getVW7014());
|
||||
//湿度显示
|
||||
json.put("humidity", guhuashiSiteDeviceDriver.getVW7016());
|
||||
//阶段累加时间
|
||||
//运行时间
|
||||
json.put("total_running_time", guhuashiSiteDeviceDriver.getVW7038());
|
||||
json.put("current_stage", guhuashiSiteDeviceDriver.getVW7042());
|
||||
//固化阶段
|
||||
json.put("executing_stage_num", guhuashiSiteDeviceDriver.getVW7044());
|
||||
//当前阶段需固化时间
|
||||
json.put("required_time", guhuashiSiteDeviceDriver.getVW7018());
|
||||
//固化工艺 0-固化;1-干燥;
|
||||
json.put("craft",guhuashiSiteDeviceDriver.getVW7036());
|
||||
json.put("device_statue", guhuashiSiteDeviceDriver.getVW7058());
|
||||
json.put("front_door", guhuashiSiteDeviceDriver.getVW70004()==0?1:0);
|
||||
json.put("back_door", guhuashiSiteDeviceDriver.getVW7010());
|
||||
json.put("error", guhuashiSiteDeviceDriver.getVD7046());
|
||||
//正在执行的阶段数 0-固化;1-干燥;
|
||||
json.put("current_stage",guhuashiSiteDeviceDriver.getVW7036());
|
||||
guhuashi.add(json);
|
||||
} else if (device.getDeviceDriver() instanceof SiteStatusDeviceDriver) {
|
||||
SiteStatusDeviceDriver siteStatusDeviceDriver=(SiteStatusDeviceDriver)device.getDeviceDriver();
|
||||
@@ -140,13 +164,37 @@ public class SyncDeviceStatus {
|
||||
json.put("positionX", agvNdcOneDeviceDriver.getX());
|
||||
json.put("positionY", agvNdcOneDeviceDriver.getY());
|
||||
json.put("positionAngle", agvNdcOneDeviceDriver.getAngle());
|
||||
AGV.add(json);
|
||||
agv.add(json);
|
||||
}
|
||||
}
|
||||
redisUtils.set("baoshijian", baoshijian);
|
||||
redisUtils.set("guhuashi", guhuashi);
|
||||
redisUtils.set("site", site);
|
||||
redisUtils.set("AGV", AGV);
|
||||
if (ObjectUtil.isNotEmpty(agv)) {
|
||||
List<String> deviceCodes = agv.stream()
|
||||
.map(r -> {
|
||||
String deviceCode = ((JSONObject) r).getString("device_code");
|
||||
return deviceCode.substring(deviceCode.length() - 1);
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
List<InstructionMybatis> instructionList = instructionService.list(new LambdaQueryWrapper<InstructionMybatis>().in(InstructionMybatis::getCarno, deviceCodes));
|
||||
if (ObjectUtil.isNotEmpty(instructionList)) {
|
||||
Map<String, String> taskCodeToTaskIdMap = instructionList.stream()
|
||||
.collect(Collectors.toMap(
|
||||
InstructionMybatis::getInstruction_code,
|
||||
InstructionMybatis::getTask_id
|
||||
));
|
||||
agv.forEach(r -> {
|
||||
JSONObject Item = (JSONObject) r;
|
||||
String taskId = taskCodeToTaskIdMap.get(Item.getString("task_code"));
|
||||
Item.put("task_id", "");
|
||||
if (taskId != null) {
|
||||
Item.put("task_id", taskId);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
redisUtils.set("agv", agv);
|
||||
log.trace("自动上报驱动状态,完毕耗时{}", System.currentTimeMillis() - startTime);
|
||||
} catch (Exception e) {
|
||||
log.error("自动线程开始查询AGV设备状态失败{}{}", e, e.getMessage());
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
package org.nl.common.enums;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.nl.common.utils.MapOf;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* acs状态枚举
|
||||
*
|
||||
* @author gbx
|
||||
* @since 2024-01-31
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum AcsDefineEnum {
|
||||
|
||||
//agv状态 1-关机2-运行中3-交通管制4-任务等待5-充电中6-故障中7-低电量
|
||||
AGV_STATUS(MapOf.of("关机", "1", "运行中", "2", "交通管制", "3", "任务等待", "4", "充电中", "5", "故障中", "6", "低电量", "7")),
|
||||
|
||||
//RGV状态 1-空闲 2-任务未派发 3-执行任务中 4-任务完成
|
||||
RGV_STATUS(MapOf.of("1","IDLE","2","SENT","3","WORK","4","COMPLETE")),
|
||||
|
||||
//载具类型
|
||||
VEHICLE_TYPE(MapOf.of("普涂", "1", "连涂", "2")),
|
||||
|
||||
//是否
|
||||
IS_USED(MapOf.of("启用", "1", "未启用", "0"));
|
||||
|
||||
|
||||
private Map<String, String> code;
|
||||
|
||||
public String code(String desc) {
|
||||
String code = this.getCode().get(desc);
|
||||
if (StringUtils.isNotEmpty(code)) {
|
||||
return code;
|
||||
}
|
||||
throw new RuntimeException(this.name() + "对应类型" + desc + "未定义");
|
||||
}
|
||||
|
||||
public Long longCode(String desc) {
|
||||
String code = this.getCode().get(desc);
|
||||
if (StringUtils.isNotEmpty(code)) {
|
||||
return Long.valueOf(code);
|
||||
}
|
||||
throw new RuntimeException(this.name() + "对应类型" + desc + "未定义");
|
||||
}
|
||||
|
||||
public String check(String code) {
|
||||
for (Map.Entry<String, String> entry : this.getCode().entrySet()) {
|
||||
if (entry.getValue().equals(code)) {
|
||||
return entry.getValue();
|
||||
}
|
||||
}
|
||||
throw new RuntimeException(this.name() + "对应类型" + code + "未定义");
|
||||
}
|
||||
|
||||
public String check1(String code) {
|
||||
for (Map.Entry<String, String> entry : this.getCode().entrySet()) {
|
||||
if (entry.getValue().equals(code)) {
|
||||
return entry.getKey();
|
||||
}
|
||||
}
|
||||
throw new RuntimeException(this.name() + "对应类型" + code + "未定义");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package org.nl.common.utils;
|
||||
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
|
||||
/*
|
||||
* @author ZZQ
|
||||
* @Date 2022/11/29 2:55 下午
|
||||
*/
|
||||
public class MapOf implements Serializable {
|
||||
|
||||
public static <K> HashMap of(K... key) {
|
||||
HashMap map = new HashMap<>();
|
||||
for (int i = 0; i < (key.length & ~1); i = i + 2) {
|
||||
map.put(key[i], key[i + 1]);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
}
|
||||
@@ -33,5 +33,6 @@ public class DasDeviceFault implements Serializable {
|
||||
|
||||
private String failure_info;
|
||||
|
||||
private String current_status;
|
||||
|
||||
}
|
||||
|
||||
@@ -6,12 +6,12 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.nl.common.enums.AcsDefineEnum;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.ColaBeanUtils;
|
||||
import org.nl.common.utils.RedisUtils;
|
||||
import org.nl.wms.cockpit.service.CockpitService;
|
||||
import org.nl.wms.cockpit.service.dao.CommonData;
|
||||
import org.nl.wms.cockpit.service.dao.ghs.DeviceFaultStatistics;
|
||||
import org.nl.wms.cockpit.service.dao.home.DayData;
|
||||
import org.nl.wms.cockpit.service.dao.home.HomeInfo;
|
||||
import org.nl.wms.cockpit.service.dao.home.TargetAchievement;
|
||||
@@ -35,11 +35,13 @@ import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.nl.common.utils.DateUtil.localDateTimeFormatyMdHms;
|
||||
@@ -297,7 +299,6 @@ public class CockpitServiceImpl implements CockpitService {
|
||||
JSONObject getGhsInfo = new JSONObject();
|
||||
//固化汇总
|
||||
JSONArray curing_summary = cockpitMapper.curingSummary();
|
||||
//todo 近30天固化数据
|
||||
List<Map<String, Object>> monthly_gh_qty = cockpitMapper.getGhsQty("30");
|
||||
List<Map<String, Object>> monthly_gh_qty_default = new ArrayList<>();
|
||||
getWeekWorkStatistics(monthly_gh_qty, monthly_gh_qty_default, "GH", 30);
|
||||
@@ -384,54 +385,56 @@ public class CockpitServiceImpl implements CockpitService {
|
||||
JSONObject getHandlingInfo = new JSONObject();
|
||||
//设备运行状态
|
||||
JSONObject device_status = new JSONObject();
|
||||
//todo 点位状态信息状态信息
|
||||
List<Map<String, Object>> agv_info = cockpitMapper.statusInfo();
|
||||
List<Map<String, Object>> rgv_info = cockpitMapper.statusInfo();
|
||||
List<Map<String, Object>> conveyor_info = cockpitMapper.statusInfo();
|
||||
if (ObjectUtil.isEmpty(agv_info) || ObjectUtil.isEmpty(rgv_info)) {
|
||||
Map<String, Object> item1 = new HashMap<>();
|
||||
item1.put("item_name", "1");
|
||||
item1.put("item_qty", "8");
|
||||
Map<String, Object> item2 = new HashMap<>();
|
||||
item2.put("item_name", "2");
|
||||
item2.put("item_qty", "2");
|
||||
Map<String, Object> item3 = new HashMap<>();
|
||||
item3.put("item_name", "1");
|
||||
item3.put("item_qty", "9");
|
||||
Map<String, Object> item4 = new HashMap<>();
|
||||
item4.put("item_name", "2");
|
||||
item4.put("item_qty", "1");
|
||||
if (ObjectUtil.isEmpty(agv_info)) {
|
||||
agv_info.add(item1);
|
||||
agv_info.add(item2);
|
||||
}
|
||||
if (ObjectUtil.isEmpty(rgv_info)) {
|
||||
rgv_info.add(item3);
|
||||
rgv_info.add(item4);
|
||||
}
|
||||
}
|
||||
if (ObjectUtil.isEmpty(conveyor_info)) {
|
||||
Map<String, Object> item1 = new HashMap<>();
|
||||
item1.put("item_name", "3");
|
||||
item1.put("item_qty", "6");
|
||||
Map<String, Object> item2 = new HashMap<>();
|
||||
item2.put("item_name", "4");
|
||||
item2.put("item_qty", "7");
|
||||
Map<String, Object> item3 = new HashMap<>();
|
||||
item3.put("item_name", "5");
|
||||
item3.put("item_qty", "8");
|
||||
conveyor_info.add(item1);
|
||||
conveyor_info.add(item2);
|
||||
conveyor_info.add(item3);
|
||||
}
|
||||
Function<String, Function<Integer, Map<String, Object>>> createItem = itemName -> itemQty -> {
|
||||
Map<String, Object> item = new HashMap<>();
|
||||
item.put("item_name", itemName);
|
||||
item.put("item_qty", itemQty);
|
||||
return item;
|
||||
};
|
||||
// AGV
|
||||
JSONArray agvInfos = (JSONArray) redisUtils.get("AGV1");
|
||||
int agvFaultNum = (int) agvInfos.stream()
|
||||
.map(object -> (JSONObject) object)
|
||||
.filter(jsonObject -> AcsDefineEnum.AGV_STATUS.code("故障中").equals(jsonObject.getString("device_status")))
|
||||
.count();
|
||||
int agvNormalNum = agvInfos.size() - agvFaultNum;
|
||||
List<Map<String, Object>> agv_info = Arrays.asList(
|
||||
createItem.apply("0").apply(agvNormalNum),
|
||||
createItem.apply("1").apply(agvFaultNum)
|
||||
);
|
||||
// RGV
|
||||
JSONArray rgvInfos = (JSONArray) redisUtils.get("RGV1");
|
||||
int rgvFaultNum = (int) rgvInfos.stream()
|
||||
.map(object -> (JSONObject) object)
|
||||
.filter(jsonObject -> StringUtils.isNotBlank(jsonObject.getString("Error")))
|
||||
.count();
|
||||
int rgvNormalNum = rgvInfos.size() - rgvFaultNum;
|
||||
List<Map<String, Object>> rgv_info = Arrays.asList(
|
||||
createItem.apply("0").apply(rgvNormalNum),
|
||||
createItem.apply("1").apply(rgvFaultNum)
|
||||
);
|
||||
// 输送线
|
||||
JSONArray conveyorInfos = (JSONArray) redisUtils.get("site1");
|
||||
int ptConveyorNum = (int) conveyorInfos.stream()
|
||||
.map(object -> (JSONObject) object)
|
||||
.filter(jsonObject -> AcsDefineEnum.VEHICLE_TYPE.code("普涂").equals(jsonObject.getString("pallet_type")))
|
||||
.count();
|
||||
int ltConveyorNum = (int) conveyorInfos.stream()
|
||||
.map(object -> (JSONObject) object)
|
||||
.filter(jsonObject -> AcsDefineEnum.VEHICLE_TYPE.code("连涂").equals(jsonObject.getString("pallet_type")))
|
||||
.count();
|
||||
int emptyConveyorNum = conveyorInfos.size() - ptConveyorNum - ltConveyorNum;
|
||||
List<Map<String, Object>> conveyor_info = Arrays.asList(
|
||||
createItem.apply("2").apply(ltConveyorNum),
|
||||
createItem.apply("3").apply(ptConveyorNum),
|
||||
createItem.apply("4").apply(emptyConveyorNum)
|
||||
);
|
||||
device_status.put("agv_info", agv_info);
|
||||
device_status.put("rgv_info", rgv_info);
|
||||
device_status.put("conveyor_info", conveyor_info);
|
||||
|
||||
|
||||
//实时故障告警
|
||||
List<Map<String, Object>> fault_alarm = cockpitMapper.faultAlarm();
|
||||
faultAlarmDefault(fault_alarm, "TS_RGV02");
|
||||
faultAlarmDefault(fault_alarm, "AGV08");
|
||||
//近30日故障统计
|
||||
JSONArray monthly_fault_statistics = cockpitMapper.monthlyFaultStatistics();
|
||||
if (ObjectUtil.isEmpty(monthly_fault_statistics)) {
|
||||
@@ -454,16 +457,18 @@ public class CockpitServiceImpl implements CockpitService {
|
||||
public JSONObject equipmentInfo(String deviceCode) {
|
||||
JSONObject res = new JSONObject();
|
||||
SchBasePoint point = pointService.getById(deviceCode);
|
||||
if (point == null) {
|
||||
throw new BadRequestException("该设备不存在");
|
||||
}
|
||||
String type = point != null ? point.getRegion_code() : RegionCodeConstant.VEHICLEINFO;
|
||||
List<SchBasePoint> points;
|
||||
switch (point.getRegion_code()) {
|
||||
switch (type) {
|
||||
case RegionCodeConstant.COATED_PLATE_LINE_AREA:
|
||||
// hint: 涂板线是作为一整台设备显示。point:设备点
|
||||
// 涂板线区域,涂板线是作为一整台设备显示,point:设备点
|
||||
JSONArray baoshijian = (JSONArray) redisUtils.get("baoshijian1");
|
||||
points = pointService.getSubSites(deviceCode);
|
||||
res.put("device_code", deviceCode);
|
||||
//todo 运行状态,信号缺失
|
||||
res.put("mode", 2);
|
||||
//todo 当前生产时间,信号缺失
|
||||
res.put("production_time", 0);
|
||||
res.put("device_name", point.getPoint_name());
|
||||
//当前物料
|
||||
JSONObject getDeviceWorker = cockpitMapper.getDeviceWorker(deviceCode);
|
||||
@@ -483,31 +488,52 @@ public class CockpitServiceImpl implements CockpitService {
|
||||
JSONObject one = new JSONObject();
|
||||
one.put("device_code", pointObj.getPoint_code());
|
||||
one.put("device_name", pointObj.getPoint_name());
|
||||
// one.put("mode", "2");
|
||||
for (Object object : baoshijian) {
|
||||
JSONObject jsonObject = (JSONObject) object;
|
||||
if (pointObj.getPoint_code().equals(jsonObject.getString("device_code"))) {
|
||||
one.put("move", jsonObject.getString("move") == null ? "0" : jsonObject.getString("move"));
|
||||
//todo 模式,信号缺失
|
||||
one.put("mode", jsonObject.getString("mode") == null ? "0" : jsonObject.getString("mode"));
|
||||
//todo 错误码(中文),信号缺失
|
||||
one.put("error", jsonObject.getString("error") == null ? "0" : jsonObject.getString("error"));
|
||||
}
|
||||
}
|
||||
array.add(one);
|
||||
}
|
||||
res.put("details", array);
|
||||
//日产量
|
||||
JSONArray production_day = new JSONArray();
|
||||
production_day=cockpitMapper.getProductionDay(deviceCode);
|
||||
res.put("production_day",production_day);
|
||||
JSONArray production_day;
|
||||
//todo 暂时注释当天条件,正式环境需要加上只查当天数据
|
||||
production_day = cockpitMapper.getProductionDay(deviceCode);
|
||||
//班产量
|
||||
JSONArray production_team=new JSONArray();
|
||||
production_team=cockpitMapper.getProductionTeam(deviceCode);
|
||||
res.put("production_team",production_team);
|
||||
JSONArray production_team;
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
LocalDateTime todayStart1 = now.toLocalDate().atTime(LocalTime.of(7, 0));
|
||||
LocalDateTime todayEnd1 = now.toLocalDate().atTime(LocalTime.of(18, 0));
|
||||
LocalDateTime todayStart2 = now.toLocalDate().atTime(LocalTime.of(18, 30));
|
||||
LocalDateTime todayEnd12 = now.toLocalDate().plusDays(1).atTime(LocalTime.of(6, 30));
|
||||
Integer dateType = 1;
|
||||
if (now.isAfter(todayStart1) && now.isBefore(todayEnd1)) {
|
||||
//白班
|
||||
dateType = 1;
|
||||
res.put("team", "白班");
|
||||
} else if (now.isAfter(todayStart2) || now.isBefore(todayEnd12)) {
|
||||
//晚班
|
||||
dateType = 2;
|
||||
res.put("team", "晚班");
|
||||
}
|
||||
//todo 暂时注释白晚班查询条件,正式环境需要加上只查班组数据
|
||||
production_team = cockpitMapper.getProductionTeam(deviceCode, dateType);
|
||||
res.put("production_day", production_day);
|
||||
res.put("production_team", production_team);
|
||||
//30日生产记录
|
||||
JSONArray production_history=new JSONArray();
|
||||
production_history=cockpitMapper.getProductionHistory(deviceCode);
|
||||
res.put("production_team",production_history);
|
||||
List<Map<String, Object>> tb_real_qty = cockpitMapper.getTxQty("30", "TBX");
|
||||
List<Map<String, Object>> tb_real_qty_default = new ArrayList<>();
|
||||
getWeekWorkStatistics(tb_real_qty, tb_real_qty_default, "TBX", 30);
|
||||
res.put("production_month ", tb_real_qty_default);
|
||||
break;
|
||||
case RegionCodeConstant.CURING_ZONE:
|
||||
// hint: 固化室,需要显示整个设备+内部位置明细
|
||||
//固化室,需要显示整个设备+内部位置明细
|
||||
points = pointService.getSubSites(deviceCode); // 小固化位置以及进出口(入口是不管的)
|
||||
JSONArray guhuashi = (JSONArray) redisUtils.get("guhuashi1");
|
||||
for (Object object : guhuashi) {
|
||||
@@ -517,12 +543,17 @@ public class CockpitServiceImpl implements CockpitService {
|
||||
res.put("device_statue", point.getPoint_status());
|
||||
JSONObject jsonObject = (JSONObject) object;
|
||||
if (deviceCode.equals(jsonObject.getString("device_code"))) {
|
||||
res.put("current_stage", jsonObject.getString("current_stage"));
|
||||
res.put("humidity_setting", jsonObject.getString("humidity_setting"));
|
||||
res.put("temperature", jsonObject.getString("temperature"));
|
||||
res.put("humidity", jsonObject.getString("humidity"));
|
||||
res.put("device_status", jsonObject.getString("device_statue"));
|
||||
res.put("total_running_time", jsonObject.getString("total_running_time"));
|
||||
res.put("temperature_setting", jsonObject.getString("temperature_setting"));
|
||||
//固化工艺
|
||||
res.put("craft", jsonObject.getString("craft") == null ? "0" : jsonObject.getString("craft"));
|
||||
//todo 需固化时间,阶段设定时,暂无数据默认5
|
||||
res.put("required_time", jsonObject.getString("required_time") == null ? "5" : jsonObject.getString("required_time"));
|
||||
//固化阶段
|
||||
res.put("executing_stage_num", jsonObject.getString("executing_stage_num"));
|
||||
res.put("humidity_setting", jsonObject.getString("humidity_setting"));
|
||||
res.put("humidity", jsonObject.getString("humidity"));
|
||||
res.put("temperature", jsonObject.getString("temperature"));
|
||||
}
|
||||
}
|
||||
JSONArray ghsArray = new JSONArray();
|
||||
@@ -539,22 +570,41 @@ public class CockpitServiceImpl implements CockpitService {
|
||||
one.put("material_type", ObjectUtil.isNotEmpty(pointObj.getVehicle_type()) ? pointObj.getVehicle_type() : "-");
|
||||
ghsArray.add(one);
|
||||
}
|
||||
//todo 需要检查当前固化逻辑是否正确
|
||||
List<String> deviceCodes = ghsArray.stream()
|
||||
.map(r -> ((JSONObject) r).getString("device_code"))
|
||||
.collect(Collectors.toList());
|
||||
List<Map<String, Object>> current_tasks = cockpitMapper.getCurrentTasks(deviceCodes);
|
||||
List<Map<String, Object>> gh_real_qty = cockpitMapper.getGhsQty("30");
|
||||
List<Map<String, Object>> gh_real_qty_default = new ArrayList<>();
|
||||
getWeekWorkStatistics(gh_real_qty, gh_real_qty_default, "GHS", 30);
|
||||
res.put("production_month ", gh_real_qty_default);
|
||||
res.put("current_tasks ", current_tasks);
|
||||
res.put("details", ghsArray);
|
||||
break;
|
||||
case RegionCodeConstant.EMPTY_TEMPORARY_STORAGE_AREA:
|
||||
// 空暂存区
|
||||
// 输送线
|
||||
points = pointService.getSubSites(deviceCode);
|
||||
res.put("device_code", deviceCode);
|
||||
res.put("device_name", point.getPoint_name());
|
||||
res.put("material_type", ObjectUtil.isNotEmpty(point.getVehicle_type()) ? point.getVehicle_type() : "-");
|
||||
res.put("end_time", "-");
|
||||
JSONArray ssxInfos = (JSONArray) redisUtils.get("site1");
|
||||
JSONArray ssxArray = new JSONArray();
|
||||
for (int i = 0; i < points.size(); i++) {
|
||||
SchBasePoint pointObj = points.get(i);
|
||||
JSONObject one = new JSONObject();
|
||||
one.put("move", "0");
|
||||
one.put("mode", "0");
|
||||
for (Object object : ssxInfos) {
|
||||
JSONObject jsonObject = (JSONObject) object;
|
||||
if (pointObj.getPoint_code().equals(jsonObject.getString("device_code"))) {
|
||||
one.put("move", jsonObject.getString("move") == null ? "0" : jsonObject.getString("move"));
|
||||
one.put("mode", jsonObject.getString("mode") == null ? "0" : jsonObject.getString("mode"));
|
||||
}
|
||||
}
|
||||
one.put("device_code", pointObj.getPoint_code());
|
||||
one.put("device_name", pointObj.getPoint_name());
|
||||
one.put("move", "0");
|
||||
ssxArray.add(one);
|
||||
}
|
||||
res.put("details", ssxArray);
|
||||
@@ -570,21 +620,113 @@ public class CockpitServiceImpl implements CockpitService {
|
||||
// 货位直接显示,获取组盘信息,组装数据反馈
|
||||
res.put("device_code", deviceCode);
|
||||
res.put("device_name", point.getPoint_name());
|
||||
// res.put("vehicle_code", ObjectUtil.isNotEmpty(point.getVehicle_code()) ? point.getVehicle_code() : "-");
|
||||
// res.put("vehicle_type", ObjectUtil.isNotEmpty(point.getVehicle_type()) ? point.getVehicle_type() : "-");
|
||||
res.put("move", "0");
|
||||
if (ObjectUtil.isNotEmpty(point.getVehicle_type()) && ObjectUtil.isNotEmpty(point.getVehicle_code())) {
|
||||
JSONObject groupInfo = cockpitMapper.getVehicleGroupInfo(point.getVehicle_code(), point.getVehicle_type());
|
||||
if (ObjectUtil.isNotEmpty(groupInfo)) {
|
||||
res.put("storage_info", groupInfo);
|
||||
res.put("move", "1");
|
||||
}
|
||||
}
|
||||
break;
|
||||
case RegionCodeConstant.VEHICLEINFO:
|
||||
JSONArray agvInfos = (JSONArray) redisUtils.get("AGV1");
|
||||
JSONArray rgvInfos = (JSONArray) redisUtils.get("RGV1");
|
||||
JSONObject vehicleInfo = agvInfos.stream()
|
||||
.map(object -> (JSONObject) object)
|
||||
.filter(jsonObject -> deviceCode.equals(jsonObject.getString("device_code")))
|
||||
.findFirst()
|
||||
.orElse(new JSONObject());
|
||||
if (ObjectUtil.isNotEmpty(vehicleInfo)) {
|
||||
vehicleInfo.put("type", "AGV");
|
||||
} else {
|
||||
vehicleInfo = rgvInfos.stream()
|
||||
.map(object -> (JSONObject) object)
|
||||
.filter(jsonObject -> deviceCode.equals(jsonObject.getString("vehicle")))
|
||||
.findFirst()
|
||||
.orElse(new JSONObject());
|
||||
if (ObjectUtil.isNotEmpty(vehicleInfo)) {
|
||||
vehicleInfo.put("type", "RGV");
|
||||
}
|
||||
}
|
||||
res = queryVehicleInfo(vehicleInfo);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
getFaultsForDevice(deviceCode, res);
|
||||
return res;
|
||||
}
|
||||
|
||||
private void getFaultsForDevice(String deviceCode, JSONObject res) {
|
||||
JSONObject faultInfo = getFaultsForDevice(deviceCode);
|
||||
//故障次数与故障率
|
||||
if (ObjectUtil.isNotEmpty(faultInfo)) {
|
||||
res.put("fault_total", faultInfo.get("fault_total"));
|
||||
res.put("fault_percentage", faultInfo.get("fault_percentage"));
|
||||
} else {
|
||||
res.put("fault_total", "0");
|
||||
res.put("fault_percentage", "0");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询车辆信息
|
||||
*/
|
||||
|
||||
public JSONObject queryVehicleInfo(JSONObject vehicleInfo) {
|
||||
if (StringUtils.isBlank(vehicleInfo.getString("type"))) {
|
||||
return null;
|
||||
}
|
||||
String deviceCode;
|
||||
//当前任务
|
||||
JSONObject current_tasks = cockpitMapper.getCurrentTask(vehicleInfo.getString("task_id"));
|
||||
String transportOrder = ObjectUtil.isNotEmpty(current_tasks) ? "正常" : "";
|
||||
vehicleInfo.put("transportOrder", transportOrder);
|
||||
String energyLevel = StringUtils.isNotBlank(vehicleInfo.getString("energyLevel")) ? String.valueOf((long) Double.parseDouble(vehicleInfo.getString("energyLevel"))) : "50";
|
||||
vehicleInfo.put("energyLevel", energyLevel);
|
||||
if ("AGV".equals(vehicleInfo.getString("type"))) {
|
||||
deviceCode = StringUtils.isNotBlank(vehicleInfo.getString("device_code")) ? vehicleInfo.getString("device_code") : "err_1";
|
||||
vehicleInfo.put("device_code", deviceCode);
|
||||
//编号
|
||||
String number = StringUtils.isNotBlank(vehicleInfo.getString("device_code")) ? vehicleInfo.getString("device_code").substring(vehicleInfo.getString("device_code").length() - 1) : "";
|
||||
vehicleInfo.put("number", number);
|
||||
String positionX = StringUtils.isNotBlank(vehicleInfo.getString("positionX")) ? vehicleInfo.getString("positionX") : "0";
|
||||
vehicleInfo.put("positionX", positionX);
|
||||
String positionY = StringUtils.isNotBlank(vehicleInfo.getString("positionY")) ? vehicleInfo.getString("positionY") : "0";
|
||||
vehicleInfo.put("positionY", positionY);
|
||||
String positionAngle = StringUtils.isNotBlank(vehicleInfo.getString("positionAngle")) ? vehicleInfo.getString("positionAngle") : "0";
|
||||
vehicleInfo.put("positionAngle", positionAngle);
|
||||
//运行状态
|
||||
String device_status = StringUtils.isNotBlank(vehicleInfo.getString("device_status")) ? AcsDefineEnum.AGV_STATUS.check(vehicleInfo.getString("device_status")) : "";
|
||||
vehicleInfo.put("device_status", device_status);
|
||||
//车辆状态
|
||||
String vehicle_status = device_status.equals(AcsDefineEnum.AGV_STATUS.check("6")) ? "故障" : "正常";
|
||||
vehicleInfo.put("vehicle_status", vehicle_status);
|
||||
} else {
|
||||
deviceCode = StringUtils.isNotBlank(vehicleInfo.getString("vehicle")) ? vehicleInfo.getString("vehicle") : "err_1";
|
||||
vehicleInfo.put("device_code", deviceCode);
|
||||
String open_time = StringUtils.isNotBlank(vehicleInfo.getString("open_time")) ? vehicleInfo.getString("open_time").replaceAll("(?<=\\d) +| +(?=\\d)", "") : "未开机";
|
||||
String end_time = StringUtils.isNotBlank(vehicleInfo.getString("end_time")) ? vehicleInfo.getString("end_time").replaceAll("(?<=\\d) +| +(?=\\d)", "") : "未开机";
|
||||
vehicleInfo.put("open_time", open_time);
|
||||
vehicleInfo.put("end_time", end_time);
|
||||
String production_time = StringUtils.isNotBlank(vehicleInfo.getString("production_time")) ? String.valueOf((long) Double.parseDouble(vehicleInfo.getString("production_time")) / 3600) : "";
|
||||
vehicleInfo.put("production_time", production_time);
|
||||
//运行状态
|
||||
String device_status = StringUtils.isNotBlank(vehicleInfo.getString("status")) ? AcsDefineEnum.RGV_STATUS.check1(vehicleInfo.getString("status")) : "";
|
||||
vehicleInfo.put("device_status", device_status);
|
||||
String vehicle_status = StringUtils.isNotBlank(vehicleInfo.getString("Error")) ? "故障" : "正常";
|
||||
vehicleInfo.put("vehicle_status", vehicle_status);
|
||||
String rfid = StringUtils.isNotBlank(vehicleInfo.getString("rfid")) ? vehicleInfo.getString("rfid") : "";
|
||||
vehicleInfo.put("rfid", rfid);
|
||||
String angle = StringUtils.isNotBlank(vehicleInfo.getString("angle")) ? vehicleInfo.getString("angle") : "";
|
||||
vehicleInfo.put("positionAngle", angle);
|
||||
}
|
||||
vehicleInfo.put("current_tasks", current_tasks);
|
||||
return vehicleInfo;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 接收acs推送的设备信息
|
||||
@@ -901,18 +1043,15 @@ public class CockpitServiceImpl implements CockpitService {
|
||||
/**
|
||||
* 查询设备的故障次数和故障率
|
||||
*/
|
||||
private DeviceFaultStatistics getFaultsForDevice(String deviceCode) {
|
||||
long totalFaults = cockpitMapper.getFaultsForDevice(deviceCode);
|
||||
long last30Days = 30; // 假设固定为30天
|
||||
double faultRate = (totalFaults / (double) last30Days) * 100.0;
|
||||
// 返回包含故障数和故障率的对象
|
||||
return new DeviceFaultStatistics(totalFaults, faultRate);
|
||||
private JSONObject getFaultsForDevice(String deviceCode) {
|
||||
return cockpitMapper.getFaultsForDevice(deviceCode);
|
||||
}
|
||||
private static void faultAlarmDefault( List<Map<String, Object>> fault_alarm,String device_name) {
|
||||
|
||||
private static void faultAlarmDefault(List<Map<String, Object>> fault_alarm, String device_name) {
|
||||
if (ObjectUtil.isEmpty(fault_alarm)) {
|
||||
Map<String, Object> item1 = new HashMap<>();
|
||||
item1.put("device_name", device_name);
|
||||
item1.put("fault_cause", "过载");
|
||||
item1.put("fault_cause", "通信失败");
|
||||
item1.put("alarm_time", localDateTimeFormatyMdHms(LocalDateTime.now()));
|
||||
fault_alarm.add(item1);
|
||||
}
|
||||
|
||||
@@ -43,18 +43,17 @@ public interface CockpitMapper {
|
||||
|
||||
List<TargetAchievement> getWorkOrders(@Param("regionCode") String regionCode, @Param("days") Integer days);
|
||||
|
||||
List<Map<String, Object>> getCurrentTasks(@Param("deviceCodes") List<String> deviceCodes);
|
||||
|
||||
JSONObject getCurrentTask(@Param("taskId") String taskId);
|
||||
|
||||
List<TargetAchievement> getGhActualProduction(@Param("days") Integer days);
|
||||
|
||||
|
||||
List<TaskInfo> gettodayGhTaskList();
|
||||
|
||||
@Select("SELECT COUNT(*) AS totalFaults, " +
|
||||
" (COUNT(*) / 30.0) * 100 AS faultRate " +
|
||||
"FROM das_device_fault " +
|
||||
"WHERE device_code = #{deviceCode} " +
|
||||
" AND failure_time >= NOW() - INTERVAL 30 DAY")
|
||||
Long getFaultsForDevice(@Param("deviceCode") String deviceCode);
|
||||
|
||||
JSONObject getFaultsForDevice(@Param("deviceCode") String deviceCode);
|
||||
|
||||
|
||||
List<DayData> getGhCuringSummary();
|
||||
@@ -118,10 +117,10 @@ public interface CockpitMapper {
|
||||
JSONArray getProductionDay(String devicecode);
|
||||
|
||||
//根据所传设备得到该设备班产量
|
||||
JSONArray getProductionTeam(String devicecode);
|
||||
JSONArray getProductionTeam(@Param("deviceCode") String devicecode,@Param("dateType") Integer dateType);
|
||||
|
||||
//根据所传设备得到该设备30天生产记录
|
||||
JSONArray getProductionHistory(String devicecode);
|
||||
List<Map<String, Object>> getProductionHistory(String devicecode);
|
||||
//今日生产连涂生产
|
||||
JSONObject ltProduction();
|
||||
//今日生产普涂生产
|
||||
|
||||
@@ -103,7 +103,63 @@
|
||||
AND vehicle_type = #{vehicleType}
|
||||
</if>
|
||||
</select>
|
||||
<select id="getCurrentTasks" resultType="java.util.HashMap">
|
||||
SELECT
|
||||
g.vehicle_type,
|
||||
g.pcsn,
|
||||
g.material_qty,
|
||||
m.material_name,
|
||||
m.material_spec
|
||||
FROM
|
||||
sch_base_vehiclematerialgroup g
|
||||
LEFT JOIN md_base_material m ON g.material_id = m.material_id
|
||||
WHERE
|
||||
g.vehicle_code IN (
|
||||
SELECT
|
||||
vehicle_code
|
||||
FROM
|
||||
sch_base_point
|
||||
WHERE point_code IN
|
||||
<foreach collection="deviceCodes" item="code" open="(" separator="," close=")">
|
||||
#{code}
|
||||
</foreach>
|
||||
)
|
||||
AND g.is_delete = '0'
|
||||
</select>
|
||||
|
||||
<select id="getCurrentTask" resultType="com.alibaba.fastjson.JSONObject">
|
||||
SELECT
|
||||
t.task_code,
|
||||
t.point_code1,
|
||||
t.point_code2,
|
||||
CASE
|
||||
WHEN t.next_wait_point IS NULL THEN
|
||||
"" ELSE ""
|
||||
END AS next_wait_point,
|
||||
t.vehicle_code,
|
||||
g.vehicle_type,
|
||||
m.material_name,
|
||||
g.pcsn,
|
||||
g.material_qty
|
||||
FROM
|
||||
sch_base_task t
|
||||
LEFT JOIN sch_base_vehiclematerialgroup g ON g.group_id = t.group_id
|
||||
LEFT JOIN md_base_material m ON m.material_id = g.material_id
|
||||
WHERE t.task_id = #{taskId}
|
||||
</select>
|
||||
|
||||
<select id="getFaultsForDevice" resultType="com.alibaba.fastjson.JSONObject">
|
||||
SELECT
|
||||
COUNT(*) AS fault_total, CASE
|
||||
WHEN COUNT(*) = 0 THEN 0
|
||||
ELSE ROUND((COUNT(*) / 30.0) * 100, 0)
|
||||
END AS fault_percentage
|
||||
FROM
|
||||
das_device_fault
|
||||
WHERE
|
||||
device_code = #{deviceCode}
|
||||
AND failure_time >= NOW() - INTERVAL 30 DAY;
|
||||
</select>
|
||||
|
||||
<select id="getGhCuringSummary" resultType="org.nl.wms.cockpit.service.dao.home.DayData">
|
||||
SELECT CASE
|
||||
@@ -354,44 +410,72 @@
|
||||
m.material_id= #{material_id}
|
||||
</select>
|
||||
<select id="getProductionDay" resultType="com.alibaba.fastjson.JSONObject">
|
||||
SELECT
|
||||
w.plan_qty,
|
||||
w.real_qty,
|
||||
(w.plan_qty)-(w.real_qty) AS remain_qty,
|
||||
(w.real_qty)/(w.plan_qty) AS percentage,
|
||||
m.material_name
|
||||
FROM `pdm_bd_workorder` w
|
||||
LEFT JOIN md_base_material m ON m.material_id = w.material_id
|
||||
WHERE
|
||||
DATE(w.create_time)=CURDATE()
|
||||
And w.point_code= #{devicecode}
|
||||
SELECT
|
||||
w.plan_qty,
|
||||
w.real_qty,
|
||||
(w.plan_qty - w.real_qty) AS remain_qty,
|
||||
CASE
|
||||
WHEN w.plan_qty = 0 AND w.real_qty = 0 THEN 0
|
||||
WHEN w.plan_qty = 0 THEN 100
|
||||
ELSE ROUND((w.real_qty * 1.0 / w.plan_qty) * 100, 0)
|
||||
END AS percentage,
|
||||
m.material_spec,
|
||||
m.material_name,
|
||||
g.pcsn
|
||||
FROM
|
||||
pdm_bd_workorder w
|
||||
LEFT JOIN md_base_material m ON m.material_id = w.material_id
|
||||
LEFT JOIN (
|
||||
SELECT p1.workorder_code, p1.pcsn
|
||||
FROM sch_base_vehiclematerialgroup p1
|
||||
INNER JOIN (
|
||||
SELECT workorder_code, MIN(group_id) AS min_group_id
|
||||
FROM sch_base_vehiclematerialgroup
|
||||
GROUP BY workorder_code
|
||||
) p2 ON p1.workorder_code = p2.workorder_code AND p1.group_id = p2.min_group_id
|
||||
) g ON g.workorder_code = w.workorder_code
|
||||
WHERE
|
||||
w.point_code = #{devicecode};
|
||||
# AND DATE(w.create_time) = CURDATE()
|
||||
</select>
|
||||
<select id="getProductionTeam" resultType="com.alibaba.fastjson.JSONObject">
|
||||
SELECT
|
||||
w.plan_qty,
|
||||
w.real_qty,
|
||||
(w.plan_qty)-(w.real_qty) AS remain_qty,
|
||||
(w.real_qty)/(w.plan_qty) AS percentage,
|
||||
m.material_name,
|
||||
w.team
|
||||
FROM `pdm_bd_workorder` w
|
||||
LEFT JOIN md_base_material m ON m.material_id = w.material_id
|
||||
WHERE
|
||||
DATE(w.create_time)=CURDATE()
|
||||
And w.point_code= #{devicecode}
|
||||
And w.workorder_status= 3
|
||||
</select>
|
||||
<select id="getProductionHistory" resultType="com.alibaba.fastjson.JSONObject">
|
||||
SELECT
|
||||
DATE_FORMAT(w.create_time,'%Y-%m-%d') AS date,
|
||||
SUM(w.real_qty) AS total_qty
|
||||
FROM
|
||||
`pdm_bd_workorder` w
|
||||
WHERE
|
||||
create_time >= CURDATE() - INTERVAL 30 DAY
|
||||
And w.point_code= #{devicecode}
|
||||
GROUP BY
|
||||
DATE_FORMAT(w.create_time, '%Y-%m-%d');
|
||||
SELECT
|
||||
w.plan_qty,
|
||||
w.real_qty,
|
||||
(w.plan_qty - w.real_qty) AS remain_qty,
|
||||
CASE
|
||||
WHEN w.plan_qty = 0 AND w.real_qty = 0 THEN 0
|
||||
WHEN w.plan_qty = 0 THEN 100
|
||||
ELSE ROUND((w.real_qty * 1.0 / w.plan_qty) * 100, 0)
|
||||
END AS percentage,
|
||||
m.material_spec,
|
||||
m.material_name,
|
||||
g.pcsn
|
||||
FROM
|
||||
pdm_bd_workorder w
|
||||
LEFT JOIN md_base_material m ON m.material_id = w.material_id
|
||||
LEFT JOIN (
|
||||
SELECT p1.workorder_code, p1.pcsn
|
||||
FROM sch_base_vehiclematerialgroup p1
|
||||
INNER JOIN (
|
||||
SELECT workorder_code, MIN(group_id) AS min_group_id
|
||||
FROM sch_base_vehiclematerialgroup
|
||||
GROUP BY workorder_code
|
||||
) p2 ON p1.workorder_code = p2.workorder_code AND p1.group_id = p2.min_group_id
|
||||
) g ON g.workorder_code = w.workorder_code
|
||||
WHERE
|
||||
w.point_code = #{deviceCode}
|
||||
<!-- AND <choose>-->
|
||||
<!-- <when test="dateType == 1">-->
|
||||
<!-- w.create_time BETWEEN CONCAT(DATE(NOW()), ' 07:00:00') AND CONCAT(DATE(NOW()), ' 18:00:00')-->
|
||||
<!-- </when>-->
|
||||
<!-- <when test="dateType == 2">-->
|
||||
<!-- w.create_time BETWEEN CONCAT(DATE(NOW()), ' 18:30:00') AND CONCAT(DATE_ADD(DATE(NOW()), INTERVAL 1 DAY), ' 06:30:00')-->
|
||||
<!-- </when>-->
|
||||
<!-- <otherwise>-->
|
||||
<!-- 1 = 1-->
|
||||
<!-- </otherwise>-->
|
||||
<!-- </choose>-->
|
||||
</select>
|
||||
<select id="ltProduction" resultType="com.alibaba.fastjson.JSONObject">
|
||||
SELECT
|
||||
@@ -405,6 +489,19 @@
|
||||
AND DATE(w.create_time) = CURDATE()
|
||||
AND point_code LIKE 'LT%';
|
||||
</select>
|
||||
|
||||
<select id="getProductionHistory" resultType="java.util.HashMap">
|
||||
SELECT
|
||||
SUM(w.plan_qty) AS plan_production,
|
||||
SUM(w.real_qty) AS actual_production,
|
||||
ROUND(SUM(w.real_qty) / SUM(w.plan_qty) * 100) AS percentage
|
||||
FROM
|
||||
`pdm_bd_workorder` w
|
||||
WHERE
|
||||
w.workorder_status = 3
|
||||
AND DATE(w.create_time) = CURDATE()
|
||||
AND point_code LIKE 'LT%';
|
||||
</select>
|
||||
<select id="ptProduction" resultType="com.alibaba.fastjson.JSONObject">
|
||||
SELECT
|
||||
SUM(w.plan_qty) AS plan_production,
|
||||
|
||||
@@ -190,6 +190,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
Integer type = param.getInteger("type");
|
||||
String device_code = param.getString("device_code");
|
||||
String state = param.getString("state");
|
||||
String current_status = param.getString("current_status");
|
||||
switch (type) {
|
||||
case 1:
|
||||
//反馈设备状态,将对应固化室修改为传入状态
|
||||
@@ -204,7 +205,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
try {
|
||||
SchBasePoint schBasePoint=pointService.getById(device_code);
|
||||
if(ObjectUtil.isNotEmpty(schBasePoint)) {
|
||||
if ("0".equals(state)) {
|
||||
if ("0".equals(current_status)) {
|
||||
schBasePoint.setIs_used(true);
|
||||
pointService.update(schBasePoint);
|
||||
} else {
|
||||
@@ -215,6 +216,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
dasDeviceFault.setData_id(IdUtil.getSnowflake(1, 1).nextIdStr());
|
||||
dasDeviceFault.setFailure_time(now);
|
||||
dasDeviceFault.setFailure_info(state);
|
||||
//当前状态
|
||||
dasDeviceFault.setCurrent_status(current_status);
|
||||
cockpitMapper.insertDeviceFault(dasDeviceFault);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,14 +6,30 @@ package org.nl.wms.sch.task_manage.enums;
|
||||
* @Date: 2023/11/22
|
||||
*/
|
||||
public class RegionCodeConstant {
|
||||
/** 固化区域 */
|
||||
public final static String COATED_PLATE_LINE_AREA = "TBX";
|
||||
/**
|
||||
* 固化区域
|
||||
*/
|
||||
public final static String CURING_ZONE = "GH";
|
||||
/** 空架暂存区域 */
|
||||
|
||||
/**
|
||||
* 车辆信息
|
||||
*/
|
||||
public final static String VEHICLEINFO = "VEHICLEINFO";
|
||||
|
||||
/**
|
||||
* 空架暂存区域
|
||||
*/
|
||||
public final static String EMPTY_TEMPORARY_STORAGE_AREA = "KJZC";
|
||||
/** 空架位区域 */
|
||||
|
||||
/**
|
||||
* 空架位区域
|
||||
*/
|
||||
public final static String EMPTY_POSITION_AREA = "KJW";
|
||||
/** 涂板线区域 */
|
||||
public final static String COATED_PLATE_LINE_AREA = "TBX";
|
||||
/** 暂存区域 */
|
||||
|
||||
/**
|
||||
* 暂存区域
|
||||
*/
|
||||
public final static String STAGING_AREA = "ZC";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user