init(): 跟踪逻辑代码初始化

This commit is contained in:
Allenxy
2025-08-19 14:56:23 +08:00
parent 43eeef8089
commit e314b0fa45
116 changed files with 7207 additions and 695 deletions

View File

@@ -0,0 +1,64 @@
package com.fizz.business.config;
import cn.hutool.json.JSONObject;
import com.fizz.business.dto.CoilHeadDTO;
import com.fizz.business.dto.CoilPositionDTO;
import com.fizz.business.dto.MatmapDTO;
import com.fizz.business.dto.SegmentDTO;
import com.ruoyi.framework.config.RedisConfig;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;
import java.util.List;
/**
* 描述: RedisTemplate配置及序列化
*
* @author daiyue
* @date 2021/3/25
*/
@Configuration
public class RedisTemplateConfig {
@Bean
public RedisTemplate<String, List<String>> redisTemplateOfList(RedisConnectionFactory redisConnectionFactory) {
RedisTemplate<String, List<String>> redisTemplate = new RedisTemplate<>();
return RedisConfig.fetchRedisTemplate(redisTemplate, redisConnectionFactory);
}
@Bean
public RedisTemplate<String, SegmentDTO> redisTemplateOfSegment(RedisConnectionFactory redisConnectionFactory) {
RedisTemplate<String, SegmentDTO> redisTemplate = new RedisTemplate<>();
return RedisConfig.fetchRedisTemplate(redisTemplate, redisConnectionFactory);
}
@Bean
public RedisTemplate<String, MatmapDTO> redisTemplateOfMatmap(RedisConnectionFactory redisConnectionFactory) {
RedisTemplate<String, MatmapDTO> redisTemplate = new RedisTemplate<>();
return RedisConfig.fetchRedisTemplate(redisTemplate, redisConnectionFactory);
}
@Bean
public RedisTemplate<String, CoilHeadDTO> redisTemplateOfHead(RedisConnectionFactory redisConnectionFactory) {
RedisTemplate<String, CoilHeadDTO> redisTemplate = new RedisTemplate<>();
return RedisConfig.fetchRedisTemplate(redisTemplate, redisConnectionFactory);
}
@Bean
public RedisTemplate<String, CoilPositionDTO> redisTemplateOfCoilPos(RedisConnectionFactory redisConnectionFactory) {
RedisTemplate<String, CoilPositionDTO> redisTemplate = new RedisTemplate<>();
return RedisConfig.fetchRedisTemplate(redisTemplate, redisConnectionFactory);
}
@Bean
public RedisTemplate<String, JSONObject> redisTemplateOfMap(RedisConnectionFactory redisConnectionFactory) {
RedisTemplate<String, JSONObject> redisTemplate = new RedisTemplate<>();
return RedisConfig.fetchRedisTemplate(redisTemplate, redisConnectionFactory);
}
}

View File

@@ -1,25 +1,65 @@
package com.fizz.business.constants;
import com.fizz.business.constants.enums.DeviceEnum;
import static com.fizz.business.constants.enums.DeviceEnum.DISC;
public class CommonConstants {
public static final double RO = 7.86; //硅钢密度
public static final int OPERATE_FROM_WEB = 1;
public static final String SYSTEM_MODULE = "CPG";
public static class RocketMQ {
public static final String CONSUMER_GROUP_RECEIVE_ALARM_ZR1 = "C-ZG-ZR1-ALARM";
public static final String CONSUMER_GROUP_RECEIVE_ALARM_ZR2 = "C-ZG-ZR2-ALARM";
public static final String TOPIC_RECEIVE_ALARM_FROM_PLAT_ZR1 = "ZG-ZR1-ALARM";
public static final String TOPIC_RECEIVE_ALARM_FROM_PLAT_ZR2 = "ZG-ZR2-ALARM";
}
public static final String CONSUMER_GROUP_COIL_POINT_DATA_ZR1 = "C-ZG-ZR1-COIL-POINT-DATA";
public static final String CONSUMER_GROUP_COIL_POINT_DATA_ZR2 = "C-ZG-ZR2-COIL-POINT-DATA";
public static class CoilMeasure {
public static final String TOPIC_RECEIVE_COIL_POINT_DATA_ZR1 = "ZG-ZR1-COIL-POINT-DATA";
public static final String TOPIC_RECEIVE_COIL_POINT_DATA_ZR2 = "ZG-ZR2-COIL-POINT-DATA";
// ======是否展示track_measure的websocket======
public static final String SHOW_APP_WEB = "0"; // APP\WEB都展示
public static final String SHOW_APP = "1"; // APP展示
public static final String SHOW_WEB = "2"; // WEB展示
public static final String SHOW_NONE = "3"; // APP\WEB都不展示
public static final String TOPIC_COIL_OUTPUT = "JH_PRODUCTION_PLAN_OUT";
// 硅钢密度
public static final double RO = 7.86;
public static final String TOPIC_COIL_DEFECT = "ZG-COIL-DEFECT";
// 新焊缝判定值
public static final String NEW_COIL_WD_OFFSET = "NEW_COIL_WD_OFFSET";
// 新带头判定值
public static final String NEW_HEAD_SL_MIN = "NEW_HEAD_SL_MIN";
// 新带头判定值
public static final String NEW_HEAD_SL_MAX = "NEW_HEAD_SL_MAX";
//机组运行判定最小速度
public static final String MIN_PRO_SPEED_LIMIT = "MIN_PRO_SPEED_LIMIT";
//卷取机上钢卷号生成最小重量[KG]
public static final String MIN_TR_COIL_WEIGHT = "MIN_TR_COIL_WEIGHT";
//最小剪切长度
public static final String MIN_EXIT_CUT_LENGTH = "MIN_EXIT_CUT_LENGTH";
//并卷带头最小距离,机组总长(600)+余量(500)
public static final String MIN_MERGE_POS_LENGTH = "MIN_MERGE_POS_LENGTH";
//带钢段 2米为一段
public static final String SEG_STRIP_LEN = "SEG_STRIP_LEN";
//卷取机前一个设备idx
public static final DeviceEnum BEFORE_TR_IDX = DISC;
// 工艺规程点位代码
public static final String SETUP_POINT_CODE = "SETUP_POINT_CODE";
// 工艺规程下限代码
public static final String SETUP_LOWER_CODE = "SETUP_LOWER_CODE";
// 工艺规程上限代码
public static final String SETUP_UPPER_CODE = "SETUP_UPPER_CODE";
public static final String MAX_UNIT_SPEED = "MAX_UNIT_SPEED";
}
public class RabbitMQ {
@@ -29,4 +69,42 @@ public class CommonConstants {
public static final String SEND_MODEL = "plateform.modpt.queue";
}
public static class Redis {
public static final String CACHE = SYSTEM_MODULE + ":cache:";
//******************COMMON_CACHE******************
public static final String COMMON_CACHE = CACHE + "common:";
public static final String VIRTUAL_PLAN_KEY = COMMON_CACHE + "virtual-plan"; // 虚拟计划
public static final String ALARM_KEY_PREFIX = COMMON_CACHE + "alarm:"; // 点位报警前缀
//******************COIL_CACHE******************
public static final String COIL_CACHE = CACHE + "coil:";
public static final String COIL_POSITION_KEY = COIL_CACHE + "position"; // 带钢当前位置
public static final String COIL_STRIP_LOCATION_KEY = COIL_CACHE + "strip-location"; // 带钢上一次焊缝位
public static final String COIL_POR_IDX_KEY = COIL_CACHE + "por-idx"; // 带钢上一次所在开卷机
public static final String COIL_SEG_NUM_KEY = COIL_CACHE + "seg-num"; // 带钢segment数量
public static final String COIL_SEG_LIST_KEY = COIL_CACHE + "seg-list"; // segment list
public static final String COIL_HEAD_CUT_LEN_KEY = COIL_CACHE + "head-cut-len:"; // 带钢头部废料剪切长度
public static final String COIL_MATMAP_LIST_KEY = COIL_CACHE + "matmap-list"; // matmap list
public static final String COIL_HEAD_LIST_KEY = COIL_CACHE + "head-list"; // head list
public static final String COIL_PREV_HEAD_KEY = COIL_CACHE + "prev-head"; // prev head
public static final String COIL_MERGE_HEAD_KEY = COIL_CACHE + "merge-head"; // merge head
public static final String COIL_MERGE_END_POS_KEY = COIL_CACHE + "merge-end-pos"; // 并卷结束位置
public static final String EXIT_CUT_LAST_END_POS_KEY = COIL_CACHE + "exit-cut-last-end-pos"; // 出口剪切结束位置
public static final String HEAD_DEFECT_START_POS = COIL_CACHE + "head-defect-start-pos"; // 头部缺陷起始位置
public static final String TAIL_DEFECT_START_POS = COIL_CACHE + "tail-defect-start-pos"; // 尾部缺陷起始位置
public static final String COIL_SETUP_KEY = COIL_CACHE + "setup:"; // 带钢工艺规程数据
//******************COUNTER_CACHE******************
public static final String COUNTER_CACHE = CACHE + "counter:";
public static final String COUNTER_EXIT_CUT_KEY = COUNTER_CACHE + "exit-cut"; // 出口剪切计数
public static final String COUNTER_HEAD_CUT_KEY = COUNTER_CACHE + "head-cut"; // 头部剪切计数
public static final String COUNTER_POR_ONLINE_KEY = COUNTER_CACHE + "por-online"; // 钢卷上线计数
public static final String COUNTER_POR_PAY_OVER_KEY = COUNTER_CACHE + "por-pay-over"; // 开卷机甩尾计数
public static final String COUNTER_TR_UNLOAD_KEY = COUNTER_CACHE + "tr-unload"; // 卷取机卸卷计数
}
}

View File

@@ -0,0 +1,46 @@
package com.fizz.business.constants.enums;
import com.baomidou.mybatisplus.annotation.IEnum;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.HashMap;
import java.util.Map;
/**
* 报警状态枚举
*
* @author chenhao
* @date 2023/04/24
*/
@Getter
@AllArgsConstructor
public enum AlarmStatusEnum implements IEnum<String> {
INIT("初始化"),
UNCONFIRMED("报警待确认"),
CONFIRM( "报警已确认")
;
private final String desc;
private static final Map<String, AlarmStatusEnum> MAP = new HashMap<>(16);
static {
for (AlarmStatusEnum e : AlarmStatusEnum.values()) {
MAP.put(e.getValue(), e);
}
}
@JsonCreator(mode = JsonCreator.Mode.DELEGATING)
public static AlarmStatusEnum getByValue(String value) {
return MAP.get(value);
}
@JsonValue
@Override
public String getValue() {
return this.name();
}
}

View File

@@ -0,0 +1,45 @@
package com.fizz.business.constants.enums;
import com.baomidou.mybatisplus.annotation.IEnum;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.HashMap;
import java.util.Map;
/**
* 并卷状态枚举
*
* @author chenhao
* @date 2023/04/24
*/
@Getter
@AllArgsConstructor
public enum CoilMergeStatusEnum implements IEnum<String> {
UNPROCESSED("未处理"),
PROCESSED("已处理"),
;
private final String desc;
private static final Map<String, CoilMergeStatusEnum> MAP = new HashMap<>(16);
static {
for (CoilMergeStatusEnum e : CoilMergeStatusEnum.values()) {
MAP.put(e.getValue(), e);
}
}
@JsonCreator(mode = JsonCreator.Mode.DELEGATING)
public static CoilMergeStatusEnum getByValue(String value) {
return MAP.get(value);
}
@JsonValue
@Override
public String getValue() {
return this.name();
}
}

View File

@@ -0,0 +1,61 @@
package com.fizz.business.constants.enums;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.HashMap;
import java.util.Map;
@Getter
@AllArgsConstructor
public enum DeviceEnum {
POR1(0, "1#开卷机"),
POR2(1, "2#开卷机"),
WELDER(2, "焊机"),
BR1(3, "1#张力辊"),
CEL(4, "入口活套"),
BR2(5, "2#张力辊"),
ALKALI(6, "碱洗"),
DRYING(7, "热烘干"),
BR4(8, "4#张力辊"),
RTF(9, "加热炉"),
SF1(10, "均热炉1"),
EHF(11, "EHF"),
SF2(12, "均热炉2"),
CTF(13, "CTF"),
SF3(14, "均热炉3"),
RJC(15, "控冷段"),
AJC(16, "快冷段"),
BR5(17, "5#张力辊"),
BR6(18, "6#张力辊"),
CXL(19, "出口活套"),
BR7(20, "7#张力辊"),
BR8(21, "8#张力辊"),
COAT(22, "涂机"),
DISC(23, "圆盘剪"),
TR1(24, "1#卷取机"),
TR2(25, "2#卷取机");
private final Integer idx;
private final String desc;
private static final Map<String, DeviceEnum> MAP = new HashMap<>();
static {
for (DeviceEnum e : DeviceEnum.values()) {
MAP.put(e.getValue(), e);
}
}
@JsonCreator(mode = JsonCreator.Mode.DELEGATING)
public static DeviceEnum getByValue(String value) {
return MAP.get(value);
}
@JsonValue
public String getValue() {
return this.name();
}
}

View File

@@ -0,0 +1,30 @@
package com.fizz.business.constants.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* 异常错误码枚举
*/
@Getter
public enum ExceptionCodeEnum {
// 系统级错误
SYSTEM_ERROR("SYS_500", "系统错误"),
SERVICE_UNAVAILABLE("SYS_503", "服务不可用"),
// 业务级错误
DATA_NOT_FOUND("BIZ_404", "数据不存在"),
DATA_VALIDATION_FAILED("BIZ_400", "数据验证失败"),
UNAUTHORIZED_ACCESS("BIZ_401", "未授权访问"),
// 默认错误
ERROR("ERR_500", "未知错误");
private final String code;
private final String message;
ExceptionCodeEnum(String code, String message) {
this.code = code;
this.message = message;
}
}

View File

@@ -0,0 +1,15 @@
package com.fizz.business.constants.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
*
* @author chenhao
* @date 2023/04/24
*/
@Getter
@AllArgsConstructor
public enum ExitCutTypeEnum {
WELDER_CUT, SPLIT_CUT
}

View File

@@ -0,0 +1,45 @@
package com.fizz.business.constants.enums;
import com.baomidou.mybatisplus.annotation.IEnum;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.HashMap;
import java.util.Map;
/**
* 回退类型枚举
*
* @author chenhao
* @date 2023/04/24
*/
@Getter
@AllArgsConstructor
public enum HalfReturnTypeEnum implements IEnum<String> {
HEAD_COIL("头部卷"),
TAIL_COIL("尾部卷")
;
private final String desc;
private static final Map<String, HalfReturnTypeEnum> MAP = new HashMap<>(5);
static {
for (HalfReturnTypeEnum e : HalfReturnTypeEnum.values()) {
MAP.put(e.getValue(), e);
}
}
@JsonCreator(mode = JsonCreator.Mode.DELEGATING)
public static HalfReturnTypeEnum getByValue(String value) {
return MAP.get(value);
}
@JsonValue
@Override
public String getValue() {
return this.name();
}
}

View File

@@ -0,0 +1,15 @@
package com.fizz.business.constants.enums;
import com.fizz.business.form.OperateMatForm;
/**
* 钢卷操作
*
* @author chenhao
* @date 2023/8/29
*/
public interface IOperateMat<T extends OperateMatForm> {
void operate(T form);
}

View File

@@ -0,0 +1,131 @@
package com.fizz.business.constants.enums;
import cn.hutool.core.lang.Assert;
import com.baomidou.mybatisplus.annotation.IEnum;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import com.fizz.business.form.ChangePlanStatusForm;
import com.fizz.business.form.L1OperateMatForm;
import com.fizz.business.service.client.PdiPlanClient;
import com.fizz.business.service.client.RedisCacheManager;
import com.fizz.business.service.impl.BeanFactory;
import com.fizz.business.utils.MatmapUtil;
import com.fizz.business.utils.WebSocketUtil;
import com.fizz.business.vo.PdiPlanVO;
import com.google.common.collect.Lists;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
/**
* 钢卷操作
*
* @author chenhao
* @date 2023/04/24
*/
@Getter
@AllArgsConstructor
public enum L1OperateMatEnum implements IEnum<String>, IOperateMat<L1OperateMatForm> {
ONLINE("上线") {
@Override
public void operate(L1OperateMatForm form) {
ONLINE.syncPlanStatus(form.getPlanId());
MatmapUtil.setMatmap(form.getPorIdx(), form.getEntryMatId(), form.getPlanId(), form.getPlanNo());
// 钢卷上线时, 缓存工艺规程
// BeanFactory.getBean(RedisCacheManager.class).setCoilSetup(form.getPlanId());
WebSocketUtil.sendSignalMsg(form);
WebSocketUtil.sendMatmapMsg();
}
},
UNLOAD("卸卷") {
@Override
public void operate(L1OperateMatForm form) {
// 卷取机卸卷,清除matmap
MatmapUtil.clearMatmap(form.getTrIdx());
// 移除mergeHead
BeanFactory.getBean(RedisCacheManager.class).removeMergeHead();
WebSocketUtil.sendSignalMsg(form);
WebSocketUtil.sendMatmapMsg();
}
},
PRODUCING("生产中") {
@Override
public void operate(L1OperateMatForm form) {
PRODUCING.syncPlanStatus(form.getPlanId());
// 钢卷上线时, 缓存工艺规程
// BeanFactory.getBean(RedisCacheManager.class).setCoilSetup(form.getPlanId());
WebSocketUtil.sendSignalMsg(form);
}
},
PRODUCT("生产完成") {
@Override
public void operate(L1OperateMatForm form) {
PRODUCT.syncPlanStatus(form.getPlanId());
// 删除工艺规程
BeanFactory.getBean(RedisCacheManager.class).delCoilSetup(form.getEntryMatId());
WebSocketUtil.sendSignalMsg(form);
}
},
PAY_OVER("甩尾") {
@Override
public void operate(L1OperateMatForm form) {
ArrayList<String> status = Lists.newArrayList(PlanStatusEnum.PRODUCING.name(), PlanStatusEnum.PRODUCT.name());
PdiPlanClient planClient = BeanFactory.getBean(PdiPlanClient.class);
PdiPlanVO plan = planClient.detail(form.getPlanId());
Assert.notNull(plan, "计划[{}]不存在", plan.getId());
if (!planClient.isVirtualPlan(plan.getId())) {
Assert.isTrue(status.contains(plan.getStatus()), "当前状态[{}]不支持甩尾", plan.getStatus());
}
MatmapUtil.clearMatmap(form.getPorIdx());
WebSocketUtil.sendSignalMsg(form);
WebSocketUtil.sendMatmapMsg();
}
},
;
private final String desc;
private static final Map<String, L1OperateMatEnum> MAP = new HashMap<>(16);
static {
for (L1OperateMatEnum e : L1OperateMatEnum.values()) {
MAP.put(e.getValue(), e);
}
}
@JsonCreator(mode = JsonCreator.Mode.DELEGATING)
public static L1OperateMatEnum getByValue(String value) {
return MAP.get(value);
}
@JsonValue
@Override
public String getValue() {
return this.name();
}
/**
* 同步计划状态
*
* @param planId 计划id
*/
private void syncPlanStatus(Long planId) {
PdiPlanClient planClient = BeanFactory.getBean(PdiPlanClient.class);
if (planClient.isVirtualPlan(planId)) {
RedisCacheManager redisCacheManager = BeanFactory.getBean(RedisCacheManager.class);
PdiPlanVO virtualPlan = redisCacheManager.getVirtualPlan(planId);
virtualPlan.setStatus(this.name());
redisCacheManager.putVirtualPlan(virtualPlan);
return;
}
planClient.changeStatus(ChangePlanStatusForm.builder()
.operation(this.name())
.id(planId)
.build());
}
}

View File

@@ -0,0 +1,11 @@
package com.fizz.business.constants.enums;
/**
* 参数配置code
*
* @author chenhao
* @date 2023/05/18
*/
public enum LimitItemCode {
track_ca1_alarm, track_ca_defect, track_ca1_measure, track_ca1_point
}

View File

@@ -0,0 +1,39 @@
package com.fizz.business.constants.enums;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.HashMap;
import java.util.Map;
/**
* websocket type
*
* @author chenhao
* @date 2023/04/24
*/
@Getter
@AllArgsConstructor
public enum MqOperateEnum {
ADD, UPDATE, DELETE;
private static final Map<String, MqOperateEnum> MAP = new HashMap<>(8);
static {
for (MqOperateEnum e : MqOperateEnum.values()) {
MAP.put(e.getValue(), e);
}
}
@JsonCreator(mode = JsonCreator.Mode.DELEGATING)
public static MqOperateEnum getByValue(String value) {
return MAP.get(value);
}
@JsonValue
public String getValue() {
return this.name();
}
}

View File

@@ -1,32 +1,59 @@
package com.fizz.business.constants.enums;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.baomidou.mybatisplus.annotation.IEnum;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.HashMap;
import java.util.Map;
/**
* 计划状态枚举
*
* @author chenhao
* @date 2023/04/24
*/
@Getter
@AllArgsConstructor
public enum PlanStatusEnum {
UNKNOWN("UNKNOWN","未知状态"),
NEW("NEW","新计划"),
READY("READY","准备好"),
ONLINE("ONLINE","上线"),
PRODUCING("PRODUCING","生产中"),
PRODUCT("PRODUCT","生产完成");
public enum PlanStatusEnum implements IEnum<String> {
INVALID("0","无效"),
UNCONFIRMED("1","待确认"),
NEW( "2","新计划"),
READY("3","准备好"),
ONLINE("4","上线"),
PRODUCING("5","生产中"),
PRODUCT("6","生产完成"),
BLOCK("7","封闭"),
REFUSE("8","拒绝"),
DELETED("9","已删除"),
;
private final String status;
private final String name;
private final String desc;
// 根据状态码获取对应的枚举
public static PlanStatusEnum fromStatus(String status) {
for (PlanStatusEnum planStatus : PlanStatusEnum.values()) {
if (planStatus.getStatus().equals(status)) {
return planStatus;
}
private static final Map<String, PlanStatusEnum> STATUS_MAP = new HashMap<>(16);
static {
for (PlanStatusEnum e : PlanStatusEnum.values()) {
STATUS_MAP.put(e.getValue(), e);
}
return UNKNOWN;
}
// 添加这个方法来解决 fromStatus 调用问题
public static PlanStatusEnum fromStatus(String status) {
return STATUS_MAP.get(status);
}
@JsonCreator(mode = JsonCreator.Mode.DELEGATING)
public static PlanStatusEnum getByValue(String value) {
return STATUS_MAP.get(value);
}
@JsonValue
@Override
public String getValue() {
return this.name();
}
}

View File

@@ -0,0 +1,46 @@
package com.fizz.business.constants.enums;
import com.baomidou.mybatisplus.annotation.IEnum;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.HashMap;
import java.util.Map;
/**
* 计划类型枚举
*
* @author chenhao
* @date 2023/04/24
*/
@Getter
@AllArgsConstructor
public enum PlanTypeEnum implements IEnum<String> {
PLAN_MAT("计划卷"),
TEMP_MAT("临时卷"),
BLOCK_MAT("封闭卷")
;
private final String desc;
private static final Map<String, PlanTypeEnum> MAP = new HashMap<>(5);
static {
for (PlanTypeEnum e : PlanTypeEnum.values()) {
MAP.put(e.getValue(), e);
}
}
@JsonCreator(mode = JsonCreator.Mode.DELEGATING)
public static PlanTypeEnum getByValue(String value) {
return MAP.get(value);
}
@JsonValue
@Override
public String getValue() {
return this.name();
}
}

View File

@@ -1,91 +0,0 @@
package com.fizz.business.constants.enums;
import com.baomidou.mybatisplus.annotation.IEnum;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import com.fizz.business.form.ChangePlanStatusForm;
import com.fizz.business.form.WebOperateMatForm;
import com.fizz.business.service.client.PdiPlanClient;
import com.fizz.business.service.impl.BeanFactory;
import com.fizz.business.utils.WebSocketUtil;
import com.fizz.business.vo.CrmPdiPlanVO;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import java.util.HashMap;
import java.util.Map;
@Getter
@Slf4j
@AllArgsConstructor
public enum WebMatOperateEnum implements IEnum<String> {
ONLINE("上线") {
@Override
public void operate(WebOperateMatForm form) {
ONLINE.syncPlanStatus(form.getId(), form.getEntryMatId());
}
},
READY("回退") {
@Override
public void operate(WebOperateMatForm form) {
READY.syncPlanStatus(form.getId(), form.getEntryMatId());
}
},
PRODUCT("生产完成") {
@Override
public void operate(WebOperateMatForm form) {
super.operate(form);
}
},
;
private final String desc;
private static final Map<String, WebMatOperateEnum> MAP = new HashMap<>(16);
static {
for (WebMatOperateEnum e : WebMatOperateEnum.values()) {
MAP.put(e.getValue(), e);
}
}
@JsonCreator(mode = JsonCreator.Mode.DELEGATING)
public static WebMatOperateEnum getByValue(String value) {
return MAP.get(value);
}
@JsonValue
@Override
public String getValue() {
return this.name();
}
public void operate(WebOperateMatForm form) {
PdiPlanClient planClient = BeanFactory.getBean(PdiPlanClient.class);
planClient.changeStatus(ChangePlanStatusForm.builder()
.operation(this.name())
.id(form.getId())
.coilId(form.getEntryMatId())
.build());
}
/**
* 同步计划状态
*
* @param planId 计划id
*/
private void syncPlanStatus(Long planId, String coilid) {
PdiPlanClient planClient = BeanFactory.getBean(PdiPlanClient.class);
planClient.changeStatus(ChangePlanStatusForm.builder()
.operation(this.name())
.id(planId)
.coilId(coilid)
.build());
}
}

View File

@@ -0,0 +1,336 @@
package com.fizz.business.constants.enums;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.annotation.IEnum;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import com.fizz.business.domain.HalfReturn;
import com.fizz.business.domain.Segment;
import com.fizz.business.dto.CoilHeadDTO;
import com.fizz.business.dto.ExitCoilInfoDTO;
import com.fizz.business.dto.MatmapDTO;
import com.fizz.business.form.ChangePlanStatusForm;
import com.fizz.business.form.WebOperateMatForm;
import com.fizz.business.mapper.HalfReturnMapper;
import com.fizz.business.mapper.SegmentMapper;
import com.fizz.business.service.PdoExCoilService;
import com.fizz.business.service.TrackService;
import com.fizz.business.service.client.PdiPlanClient;
import com.fizz.business.service.client.RedisCacheManager;
import com.fizz.business.service.impl.BeanFactory;
import com.fizz.business.utils.ErrorDataException;
import com.fizz.business.utils.MatmapUtil;
import com.fizz.business.utils.WebSocketUtil;
import com.fizz.business.vo.PdiPlanVO;
import com.google.common.collect.Lists;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import java.time.LocalDateTime;
import java.util.*;
/**
* 钢卷操作
*
* @author chenhao
* @date 2023/04/24
*/
@Getter
@Slf4j
@AllArgsConstructor
public enum WebOperateMatEnum implements IEnum<String>, IOperateMat<WebOperateMatForm> {
ONLINE("上线") {
@Override
public void operate(WebOperateMatForm form) {
Assert.notNull(form.getPorIdx(), "开卷机编号不能为空");
// 页面手动上卷时,如果开卷机有卷
// 需要判断正常卷不允许上卷虚拟卷则需要手动更新matmapsegment
PdiPlanClient planClient = BeanFactory.getBean(PdiPlanClient.class);
MatmapDTO porCoil = MatmapUtil.getMatmap(form.getPorIdx());
if (MatmapUtil.already(porCoil)) {
boolean virtualPlan = planClient.isVirtualPlan(porCoil.getPlanId());
if (!virtualPlan) {
throw new ErrorDataException(ExceptionCodeEnum.ERROR, "当前开卷机已有正在运行的钢卷,不支持上卷");
}
ONLINE.syncPlanStatus(form.getPlanId());
ONLINE.replaceVirtualPlan(form, porCoil);
WebSocketUtil.sendSignalMsg(form, true);
// 如果开卷机和焊机的钢卷相同,则将计划状态变更为生产中
MatmapDTO welderCoil = MatmapUtil.getMatmap(DeviceEnum.WELDER.getIdx());
if (MatmapUtil.already(welderCoil) && Objects.equals(form.getEntryMatId(), welderCoil.getMatId())) {
form.setOperation(PRODUCING);
BeanFactory.getBean(TrackService.class).webOperateMat(form);
}
} else {
ONLINE.syncPlanStatus(form.getPlanId());
MatmapUtil.setMatmap(form.getPorIdx(), form.getEntryMatId(), form.getPlanId(), form.getPlanNo());
WebSocketUtil.sendSignalMsg(form);
}
// 钢卷上线时, 缓存工艺规程
// BeanFactory.getBean(RedisCacheManager.class).setCoilSetup(form.getPlanId());
WebSocketUtil.sendMatmapMsg();
}
},
UNLOAD("卸卷") {
@Override
public void operate(WebOperateMatForm form) {
// 开卷机卸卷,变更计划状态为READY,清除matmap
if (Objects.nonNull(form.getPorIdx())) {
UNLOAD.syncPlanStatus(form.getPlanId());
MatmapUtil.clearMatmap(form.getPorIdx());
// 删除工艺规程
BeanFactory.getBean(RedisCacheManager.class).delCoilSetup(form.getEntryMatId());
WebSocketUtil.sendSignalMsg(form);
WebSocketUtil.sendMatmapMsg();
}
// 卷取机卸卷,清除matmap
else if (Objects.nonNull(form.getTrIdx())) {
MatmapUtil.clearMatmap(form.getTrIdx());
// 移除mergeHead
BeanFactory.getBean(RedisCacheManager.class).removeMergeHead();
WebSocketUtil.sendSignalMsg(form);
WebSocketUtil.sendMatmapMsg();
} else {
throw new ErrorDataException(ExceptionCodeEnum.DATA_NOT_FOUND, "卸卷开卷机或卷取机编号不能为空");
}
}
},
ALL_RETURN("整卷回退") {
@Override
public void operate(WebOperateMatForm form) {
ALL_RETURN.doReturn(form);
}
},
HALF_RETURN("半卷回退") {
@Override
public void operate(WebOperateMatForm form) {
HALF_RETURN.doReturn(form);
}
},
PRODUCING("生产中") {
@Override
public void operate(WebOperateMatForm form) {
PRODUCING.syncPlanStatus(form.getPlanId());
WebSocketUtil.sendSignalMsg(form);
}
},
PRODUCT("生产完成") {
@Override
public void operate(WebOperateMatForm form) {
PRODUCT.syncPlanStatus(form.getPlanId());
if (Objects.isNull(form.getCoilLength()) || form.getCoilLength() <= 0) {
form.setCoilLength(9999d);
}
PdoExCoilService pdoExCoilService = BeanFactory.getBean(PdoExCoilService.class);
MatmapDTO matmapDTO = new MatmapDTO();
matmapDTO.setMatId(form.getEntryMatId());
matmapDTO.setPlanId(form.getPlanId());
ExitCoilInfoDTO exitCoil = pdoExCoilService.genExitCoilInfo(matmapDTO, ExitCutTypeEnum.WELDER_CUT);
pdoExCoilService.saveExCoil(exitCoil);
// 2023.9.26 手动完成的计划产出不上报给L3由操作工手动登记产出
// SendMqUtil.sendCoilOutputMsg(pdoExCoilDTO);
// 删除工艺规程
BeanFactory.getBean(RedisCacheManager.class).delCoilSetup(form.getEntryMatId());
WebSocketUtil.sendSignalMsg(form);
}
},
BLOCK("卸卷并封闭") {
@Override
public void operate(WebOperateMatForm form) {
BLOCK.syncPlanStatus(form.getPlanId());
MatmapUtil.clearMatmap(form.getPorIdx());
// 删除工艺规程
BeanFactory.getBean(RedisCacheManager.class).delCoilSetup(form.getEntryMatId());
WebSocketUtil.sendSignalMsg(form);
WebSocketUtil.sendMatmapMsg();
}
},
PAY_OVER("甩尾") {
@Override
public void operate(WebOperateMatForm form) {
ArrayList<String> status = Lists.newArrayList(PlanStatusEnum.ONLINE.name());
PdiPlanClient planClient = BeanFactory.getBean(PdiPlanClient.class);
PdiPlanVO plan = planClient.detail(form.getPlanId());
if (Objects.nonNull(plan) && !planClient.isVirtualPlan(plan.getId())) {
Assert.isTrue(!status.contains(plan.getStatus()), "当前状态[{}]不支持甩尾", plan.getStatus());
}
MatmapUtil.clearMatmap(form.getPorIdx());
WebSocketUtil.sendSignalMsg(form);
WebSocketUtil.sendMatmapMsg();
}
},
;
private final String desc;
private static final Map<String, WebOperateMatEnum> MAP = new HashMap<>(16);
static {
for (WebOperateMatEnum e : WebOperateMatEnum.values()) {
MAP.put(e.getValue(), e);
}
}
@JsonCreator(mode = JsonCreator.Mode.DELEGATING)
public static WebOperateMatEnum getByValue(String value) {
return MAP.get(value);
}
@JsonValue
@Override
public String getValue() {
return this.name();
}
/**
* 同步计划状态
*
* @param planId 计划id
*/
private void syncPlanStatus(Long planId) {
PdiPlanClient planClient = BeanFactory.getBean(PdiPlanClient.class);
if (planClient.isVirtualPlan(planId)) {
RedisCacheManager redisCacheManager = BeanFactory.getBean(RedisCacheManager.class);
PdiPlanVO virtualPlan = redisCacheManager.getVirtualPlan(planId);
virtualPlan.setStatus(this.name());
redisCacheManager.putVirtualPlan(virtualPlan);
return;
}
planClient.changeStatus(ChangePlanStatusForm.builder()
.operation(this.name())
.id(planId)
.build());
}
/**
* 通过计划的halfReturnType字段判断当前卷是回退的头部卷还是尾部卷
* 1. 头部卷: entryMatId=A01
* 2. 尾部卷: entryMatId=A01-2, returnMatId=A01。由于计划号+钢卷号唯一所以回退的尾部卷生成新计划时将entryMatId设置为A01-2真实的原料卷号保存在returnMatId中
* 半卷回退上报产出
* 1. 头部卷产出时原料卷号A01, 产出卷号: A01-1, 分卷标识: true, 尾卷标识: false
* 2. 尾部卷产出时原料卷号A01产出卷号: A01-2, 分卷标识: false, 尾卷标识: true
*
* @param form
*/
private void doReturn(WebOperateMatForm form) {
if (!Lists.newArrayList(HALF_RETURN, ALL_RETURN).contains(form.getOperation()))
return;
PdiPlanClient planClient = BeanFactory.getBean(PdiPlanClient.class);
PdiPlanVO plan = planClient.detail(form.getPlanId());
String entryMatId = form.getEntryMatId();
String returnMatId = form.getReturnMatId();
if (StrUtil.isBlank(returnMatId)) {
returnMatId = BeanFactory.getBean(TrackService.class).getHalfReturnMatId(form.getPlanId(), entryMatId).getReturnMatId();
}
if (Objects.equals(form.getOperation(), HALF_RETURN)) {
HalfReturnMapper returnMapper = BeanFactory.getBean(HalfReturnMapper.class);
// 第一次回退,需要将头部卷与尾部卷都记录到回退表中
if (!Objects.equals(plan.getReturnType(), HALF_RETURN.name())) {
String headCoilId = form.getEntryMatId() + "-1";
int lastIndex = returnMatId.lastIndexOf("-");
if (lastIndex != -1 && lastIndex < returnMatId.length() - 1) {
String numberStr = returnMatId.substring(lastIndex + 1);
int number = Integer.parseInt(numberStr) - 1;
headCoilId = returnMatId.substring(0, lastIndex + 1) + number;
}
// 记录回退头部卷信息
HalfReturn headCoil = new HalfReturn();
headCoil.setEntryMatId(entryMatId);
headCoil.setExitMatId(headCoilId);
headCoil.setPlanNo(plan.getPlanNo());
headCoil.setExitMatWeight(plan.getEntryWeight() - form.getReturnWeight());
headCoil.setReturnMatWeight(0d);
headCoil.setReturnType(HALF_RETURN.name());
headCoil.setReturnRemark(form.getReturnRemark());
headCoil.setReturnMatTime(LocalDateTime.now());
returnMapper.insert(headCoil);
} else {
entryMatId = plan.getReturnMatId();
}
// 记录回退尾卷信息
HalfReturn tailCoil = new HalfReturn();
tailCoil.setEntryMatId(entryMatId);
tailCoil.setExitMatId(returnMatId);
tailCoil.setPlanNo(plan.getPlanNo());
tailCoil.setExitMatWeight(0d);
tailCoil.setReturnMatWeight(form.getReturnWeight());
tailCoil.setReturnType(HALF_RETURN.name());
tailCoil.setReturnRemark(form.getReturnRemark());
tailCoil.setReturnMatTime(LocalDateTime.now());
returnMapper.insert(tailCoil);
} else {
// 整卷回退删除已有产出
BeanFactory.getBean(PdoExCoilService.class).deleteExistPdo(form.getPlanId());
}
planClient.changeStatus(ChangePlanStatusForm.builder()
.operation(this.name())
.id(form.getPlanId())
.returnMatId(returnMatId)
.returnWeight(form.getReturnWeight())
.build());
// 更新matmapmatId置空
MatmapUtil.clearMatmap(form.getPorIdx());
WebSocketUtil.sendSignalMsg(form);
WebSocketUtil.sendMatmapMsg();
}
private void replaceVirtualPlan(WebOperateMatForm form, MatmapDTO porCoil) {
// 更新matmap
List<MatmapDTO> matmapList = MatmapUtil.getMatmapList();
matmapList.forEach(matmap -> {
if (Objects.equals(matmap.getMatId(), porCoil.getMatId())) {
MatmapUtil.setMatmap(matmap.getPosIdx(), form.getEntryMatId(), form.getPlanId(), form.getPlanNo());
}
});
RedisCacheManager redisCacheManager = BeanFactory.getBean(RedisCacheManager.class);
// 更新headList
List<CoilHeadDTO> headList = redisCacheManager.getHeadList();
headList.forEach(head -> {
if (Objects.equals(head.getMatId(), porCoil.getMatId())) {
head.setMatId(form.getEntryMatId());
head.setPlanNo(form.getPlanNo());
head.setPlanId(form.getPlanId());
head.setPorIdx(form.getPorIdx());
}
});
redisCacheManager.setHeadList(headList);
// 更新prevHead
CoilHeadDTO prevHead = redisCacheManager.getPrevHead();
if (Objects.nonNull(prevHead) && Objects.equals(prevHead.getMatId(), porCoil.getMatId())) {
prevHead.setMatId(form.getEntryMatId());
prevHead.setPlanNo(form.getPlanNo());
prevHead.setPlanId(form.getPlanId());
prevHead.setPorIdx(form.getPorIdx());
redisCacheManager.setPrevHead(prevHead);
}
// 更新mergeHead
CoilHeadDTO mergeHead = redisCacheManager.getMergeHead();
if (Objects.nonNull(mergeHead) && Objects.equals(mergeHead.getMatId(), porCoil.getMatId())) {
mergeHead.setMatId(form.getEntryMatId());
mergeHead.setPlanNo(form.getPlanNo());
mergeHead.setPlanId(form.getPlanId());
prevHead.setPorIdx(form.getPorIdx());
redisCacheManager.setMergeHead(mergeHead);
}
// 更新segment
SegmentMapper segmentMapper = BeanFactory.getBean(SegmentMapper.class);
LambdaUpdateWrapper<Segment> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(Segment::getEntryMatId, porCoil.getMatId());
updateWrapper.eq(Segment::getPlanId, porCoil.getPlanId());
updateWrapper.set(Segment::getEntryMatId, form.getEntryMatId());
updateWrapper.set(Segment::getPlanId, form.getPlanId());
segmentMapper.update(new Segment(), updateWrapper);
}
}

View File

@@ -23,41 +23,6 @@ public class CrmPdiPlanController {
@Resource
private CrmPdiPlanService crmPdiPlanService;
@GetMapping("/get/{coilid}")
@Operation(summary ="通过钢卷号或者状态查询计划")
public R<CrmPdiPlanVO> getByCoilId(@PathVariable String coilid) {
return R.ok(crmPdiPlanService.getByCoilIdAndOperId(coilid));
}
@GetMapping("/getOnlineCoil")
@Operation(summary ="通过钢卷号或者状态查询计划")
public R<CrmPdiPlan> getByCoilId() {
return R.ok(crmPdiPlanService.getOnlineCoil());
}
@GetMapping("/getCoilInfoAndSetupList")
@Operation(summary ="通过钢卷号获取钢卷信息和设定值列表")
public R<PdiPlanSetupInfoVO> getCoilInfoAndSetupList(@RequestParam String coilid) {
return R.ok(crmPdiPlanService.getCoilInfoAndSetupList(coilid));
}
@PostMapping("/save/coilInfo")
@Operation(summary ="保存钢卷信息")
public R<String> editCoilInfo(@RequestBody CrmPdiPlanForm coilid) {
return R.ok(crmPdiPlanService.editCoilInfo(coilid));
}
@PostMapping("/calc")
@Operation(summary ="计算设定值")
public R<String> editCoilInfo(@RequestBody CalcPdiPlanForm coilid) {
return R.ok(crmPdiPlanService.calcSetup(coilid));
}
@PostMapping("/add")
@Operation(summary ="新增计划")
public R<Boolean> add(@RequestBody CrmPdiPlan crmPdiPlan) {

View File

@@ -1,17 +1,21 @@
package com.fizz.business.controller;
import com.fizz.business.constants.enums.DeviceEnum;
import com.fizz.business.dto.CoilPositionDTO;
import com.fizz.business.form.AdjustPosForm;
import com.fizz.business.form.WebOperateMatForm;
import com.fizz.business.mq.RabbitMQ.RabbitQueueListener;
import com.fizz.business.service.TrackService;
import com.fizz.business.vo.CoilMeasureVO;
import com.fizz.business.vo.HalfReturnInfoVO;
import com.fizz.business.vo.ReturnInfoVO;
import com.ruoyi.common.core.domain.R;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;
/**
* @author baomidou
@@ -21,28 +25,44 @@ import java.util.List;
@RequestMapping("/track")
@Tag(name = "过程跟踪")
public class TrackController {
@Resource
@Autowired
TrackService trackService;
@PostMapping("/manual/operate/mat")
@Operation(summary = "页面手动操作钢卷 上线,回退")
@PutMapping("/manual/operate/mat")
@Operation(description = "页面手动操作钢卷")
public R<String> manualOperateMat(@RequestBody @Valid WebOperateMatForm form) {
trackService.operateMatWeb(form);
trackService.webOperateMat(form);
return R.ok();
}
@PostMapping("/manual/tr/unload")
@Operation(summary = "页面卷取机手动卸卷登记产出")
public R<String> manualtrUnload(@RequestBody @Valid WebOperateMatForm form) {
trackService.trUnload(form);
@PutMapping("/position")
@Operation(description = "页面手动调整钢卷位置")
public R<String> adjustPosition(@RequestBody @Valid AdjustPosForm form) {
trackService.adjustPosition(form);
return R.ok();
}
@GetMapping("/measure/list")
@Operation(summary = "获取测量数据list")
public R<List<String>> measureList() {
return R.ok(RabbitQueueListener.measureList);
@GetMapping("/return/info")
@Operation(description = "获取回退数据")
public R<ReturnInfoVO> getReturnInfo(@RequestParam("posIdx") int posIdx) {
return R.ok(trackService.getReturnInfo(posIdx));
}
@GetMapping("/half/return/mat/id")
@Operation(description = "获取半卷回退卷号")
public R<HalfReturnInfoVO> getHalfReturnMatId(@RequestParam("planId") Long planId,
@RequestParam("entryMatId") String entryMatId) {
return R.ok(trackService.getHalfReturnMatId(planId, entryMatId));
}
@GetMapping("/coil/position")
@Operation(description = "获取跟踪带钢位置")
public R<CoilPositionDTO> getCoilPosition() {
return R.ok(trackService.getCoilPosition());
}
}

View File

@@ -0,0 +1,55 @@
package com.fizz.business.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* <p>
* 机组定义表
* </p>
*
* @author baomidou
* @since 2023-05-17
*/
@Getter
@Setter
@TableName("cpg_device_define")
@Schema(title = "CpgDeviceDefine对象", description = "机组定义表")
public class DeviceDefine implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Long id;
@Schema(description = "位置编号")
private Integer posIdx;
@Schema(description = "区域代码")
private String positionArea;
@Schema(description = "位置代码英文")
private String positionNameEn;
@Schema(description = "位置代码中文")
private String positionNameCn;
@Schema(description = "设备开始位置")
private Double positionLengthStart;
@Schema(description = "设备结束位置")
private Double positionLengthEnd;
@Schema(description = "创建时间")
private LocalDateTime createTime;
@Schema(description = "修改时间")
private LocalDateTime updateTime;
}

View File

@@ -0,0 +1,80 @@
package com.fizz.business.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* <p>
* 半卷整卷回退表
* </p>
*
* @author baomidou
* @since 2023-05-17
*/
@Getter
@Setter
@TableName("track_ca1_half_return")
@Schema(title = "TrackCa1HalfReturn对象", description = "半卷整卷回退表")
public class HalfReturn implements Serializable {
private static final long serialVersionUID = 1L;
@Schema(description = "主键id")
@TableId(value = "id", type = IdType.AUTO)
private Long id;
@Schema(description = "来料卷号")
private String entryMatId;
@Schema(description = "工艺规程")
private String setupVersion;
@Schema(description = "钢种")
private String steelGrade;
@Schema(description = "计划号")
private String planNo;
@Schema(description = "钢卷产品代码")
private String prodCode;
@Schema(description = "成品钢卷号")
private String exitMatId;
@Schema(description = "成品卷重")
private Double exitMatWeight;
@Schema(description = "回退卷重")
private Double returnMatWeight;
@Schema(description = "回退时间")
private LocalDateTime returnMatTime;
@Schema(description = "回退类型:ALL_RETURN-整卷回退, HALF_RETURN-半卷回退")
private String returnType;
@Schema(description = "回退备注")
private String returnRemark;
@Schema(description = "0-未删除 时间戳:已删除")
private Long delFlag;
@Schema(description = "操作人")
private String operator;
@Schema(description = "操作人id")
private String operatorId;
@Schema(description = "创建时间")
private LocalDateTime createTime;
@Schema(description = "修改时间")
private LocalDateTime updateTime;
}

View File

@@ -0,0 +1,130 @@
package com.fizz.business.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* <p>
* cs机组产出实绩表
* </p>
*
* @author baomidou
* @since 2023-05-17
*/
@Getter
@Setter
@TableName("cpg_pdo_excoil")
@Schema(title = "cpgPdoExcoil对象", description = "镀锌机组产出实绩表")
public class PdoExcoil implements Serializable {
private static final long serialVersionUID = 1L;
@Schema(description = "主键id")
@TableId(value = "id", type = IdType.AUTO)
private Long id;
@Schema(description = "成品卷")
private String exitMatId;
@Schema(description = "来料卷")
private String entryMatId;
@Schema(description = "分切数")
private Integer subId;
@Schema(description = "开始位置")
private Double startPosition;
@Schema(description = "结束位置")
private Double endPosition;
@Schema(description = "计划id")
private Long planId;
@Schema(description = "计划号")
private String planNo;
@Schema(description = "产品类型")
private String prodCode;
@Schema(description = "班号")
private String groupNo;
@Schema(description = "组号")
private String shiftNo;
@Schema(description = "状态")
private String status;
@Schema(description = "钢种")
private String steelGrade;
@Schema(description = "来料厚度")
private Double entryThick;
@Schema(description = "来料宽带")
private Double entryWidth;
@Schema(description = "来料长度")
private Double entryLength;
@Schema(description = "来料重量")
private Double entryWeight;
@Schema(description = "实际来料重量CP/ZR/CA需要修改")
private Double actualEntryWeight;
@Schema(description = "上表面镀锌")
private Double weightTop;
@Schema(description = "下表面镀锌")
private Double weightBottom;
@Schema(description = "成品长度")
private Double exitLength;
@Schema(description = "成品带涂料重量")
private Double exitNetWeight;
@Schema(description = "理论重量")
private Double theoryWeight;
@Schema(description = "实际重量")
private Double actualWeight;
@Schema(description = "成品外径")
private Double exitOuterDiameter;
@Schema(description = "成品厚度")
private Double exitThickness;
@Schema(description = "成品宽度")
private Double exitWidth;
private String customer;
@Schema(description = "上线时间")
private LocalDateTime onlineTime;
@Schema(description = "开始时间")
private LocalDateTime startTime;
@Schema(description = "结束时间")
private LocalDateTime endTime;
@Schema(description = "0-未删除 时间戳:已删除")
private Long delFlag;
@Schema(description = "创建时间")
private LocalDateTime createTime;
@Schema(description = "修改时间")
private LocalDateTime updateTime;
}

View File

@@ -0,0 +1,559 @@
package com.fizz.business.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* <p>
* 剪切带钢段平均值
* </p>
*
* @author baomidou
* @since 2023-05-17
*/
@Getter
@Setter
@TableName("cpg_pdo_stripvalue")
@Schema(title = "cpgPdoStripvalue对象", description = "剪切带钢段平均值")
public class PdoStripvalue implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Long id;
private String exitMatId;
private Integer val1num;
private Integer val2num;
private Integer val3num;
private Integer val4num;
private Integer val5num;
private Integer val6num;
private Integer val7num;
private Integer val8num;
private Integer val9num;
private Integer val10num;
private Double val1max;
private Double val1min;
private Double val1avg;
private Integer val1cnt;
private Integer val1std;
private Double val2max;
private Double val2min;
private Double val2avg;
private Integer val2cnt;
private Integer val2std;
private Double val3max;
private Double val3min;
private Double val3avg;
private Integer val3cnt;
private Integer val3std;
private Double val4max;
private Double val4min;
private Double val4avg;
private Integer val4cnt;
private Integer val4std;
private Double val5max;
private Double val5min;
private Double val5avg;
private Integer val5cnt;
private Integer val5std;
private Double val6max;
private Double val6min;
private Double val6avg;
private Integer val6cnt;
private Integer val6std;
private Double val7max;
private Double val7min;
private Double val7avg;
private Integer val7cnt;
private Integer val7std;
private Double val8max;
private Double val8min;
private Double val8avg;
private Integer val8cnt;
private Integer val8std;
private Double val9max;
private Double val9min;
private Double val9avg;
private Integer val9cnt;
private Integer val9std;
private Double val10max;
private Double val10min;
private Double val10avg;
private Integer val10cnt;
private Integer val10std;
private Double val11max;
private Double val11min;
private Double val11avg;
private Integer val11cnt;
private Integer val11std;
private Double val12max;
private Double val12min;
private Double val12avg;
private Integer val12cnt;
private Integer val12std;
private Double val13max;
private Double val13min;
private Double val13avg;
private Integer val13cnt;
private Integer val13std;
private Double val14max;
private Double val14min;
private Double val14avg;
private Integer val14cnt;
private Integer val14std;
private Double val15max;
private Double val15min;
private Double val15avg;
private Integer val15cnt;
private Integer val15std;
private Double val16max;
private Double val16min;
private Double val16avg;
private Integer val16cnt;
private Integer val16std;
private Double val17max;
private Double val17min;
private Double val17avg;
private Integer val17cnt;
private Integer val17std;
private Double val18max;
private Double val18min;
private Double val18avg;
private Integer val18cnt;
private Integer val18std;
private Double val19max;
private Double val19min;
private Double val19avg;
private Integer val19cnt;
private Integer val19std;
private Double val20max;
private Double val20min;
private Double val20avg;
private Integer val20cnt;
private Integer val20std;
private Double val21max;
private Double val21min;
private Double val21avg;
private Integer val21cnt;
private Integer val21std;
private Double val22max;
private Double val22min;
private Double val22avg;
private Integer val22cnt;
private Integer val22std;
private Double val23max;
private Double val23min;
private Double val23avg;
private Integer val23cnt;
private Integer val23std;
private Double val24max;
private Double val24min;
private Double val24avg;
private Integer val24cnt;
private Integer val24std;
private Double val25max;
private Double val25min;
private Double val25avg;
private Integer val25cnt;
private Integer val25std;
private Double val26max;
private Double val26min;
private Double val26avg;
private Integer val26cnt;
private Integer val26std;
private Double val27max;
private Double val27min;
private Double val27avg;
private Integer val27cnt;
private Integer val27std;
private Double val28max;
private Double val28min;
private Double val28avg;
private Integer val28cnt;
private Integer val28std;
private Double val29max;
private Double val29min;
private Double val29avg;
private Integer val29cnt;
private Integer val29std;
private Double val30max;
private Double val30min;
private Double val30avg;
private Integer val30cnt;
private Integer val30std;
private Double val31max;
private Double val31min;
private Double val31avg;
private Integer val31cnt;
private Integer val31std;
private Double val32max;
private Double val32min;
private Double val32avg;
private Integer val32cnt;
private Integer val32std;
private Double val33max;
private Double val33min;
private Double val33avg;
private Integer val33cnt;
private Integer val33std;
private Double val34max;
private Double val34min;
private Double val34avg;
private Integer val34cnt;
private Integer val34std;
private Double val35max;
private Double val35min;
private Double val35avg;
private Integer val35cnt;
private Integer val35std;
private Double val36max;
private Double val36min;
private Double val36avg;
private Integer val36cnt;
private Integer val36std;
private Double val37max;
private Double val37min;
private Double val37avg;
private Integer val37cnt;
private Integer val37std;
private Double val38max;
private Double val38min;
private Double val38avg;
private Integer val38cnt;
private Integer val38std;
private Double val39max;
private Double val39min;
private Double val39avg;
private Integer val39cnt;
private Integer val39std;
private Double val40max;
private Double val40min;
private Double val40avg;
private Integer val40cnt;
private Integer val40std;
private Double val41max;
private Double val41min;
private Double val41avg;
private Integer val41cnt;
private Integer val41std;
private Double val42max;
private Double val42min;
private Double val42avg;
private Integer val42cnt;
private Integer val42std;
private Double val43max;
private Double val43min;
private Double val43avg;
private Integer val43cnt;
private Integer val43std;
private Double val44max;
private Double val44min;
private Double val44avg;
private Integer val44cnt;
private Integer val44std;
private Double val45max;
private Double val45min;
private Double val45avg;
private Integer val45cnt;
private Integer val45std;
private Double val46max;
private Double val46min;
private Double val46avg;
private Integer val46cnt;
private Integer val46std;
private Double val47max;
private Double val47min;
private Double val47avg;
private Integer val47cnt;
private Integer val47std;
private Double val48max;
private Double val48min;
private Double val48avg;
private Integer val48cnt;
private Integer val48std;
private Double val49max;
private Double val49min;
private Double val49avg;
private Integer val49cnt;
private Integer val49std;
private Double val50max;
private Double val50min;
private Double val50avg;
private Integer val50cnt;
private Integer val50std;
@Schema(description = "创建时间")
private LocalDateTime createTime;
@Schema(description = "修改时间")
private LocalDateTime updateTime;
}

View File

@@ -1,37 +1,41 @@
package com.fizz.business.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
@Data
public class ProMatmap {
public class ProMatmap implements Serializable {
@TableField("areaid")
private Integer areaid;
private static final long serialVersionUID = 1L;
@TableField("groupid")
private Integer groupid;
@TableId(value = "pos_idx", type = IdType.NONE)
private Integer posIdx;
@TableField("pos")
private Integer pos;
private String matId;
@TableField("full_place_name")
private String fullPlaceName;
@Schema(description = "设备英文名")
private String positionNameEn;
@TableField("matid")
private String matid;
@Schema(description = "设备中文名")
private String positionNameCn;
@TableField("display_name")
private String displayName;
@Schema(description = "计划id")
private Long planId;
@TableId("l1mapidx")
private Integer l1mapidx;
@Schema(description = "计划号")
private String planNo;
@TableField("updtime")
private LocalDateTime updtime;
@Schema(description = "创建时间")
private LocalDateTime createTime;
@Schema(description = "修改时间")
private LocalDateTime updateTime;
}

View File

@@ -0,0 +1,477 @@
package com.fizz.business.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* <p>
* 各机张力,电流等架跟踪表
* </p>
*
* @author baomidou
* @since 2023-05-17
*/
@Getter
@Setter
@TableName("cpg_segment")
@Schema(title = "CpgSegment对象", description = "各机张力,电流等架跟踪表")
public class Segment implements Serializable {
private static final long serialVersionUID = 1L;
@Schema(description = "主键")
@TableId(value = "id", type = IdType.AUTO)
private Long id;
@Schema(description = "卷号")
private String entryMatId;
@Schema(description = "分段id")
private Integer segNo;
@Schema(description = "计划id")
private Long planId;
@Schema(description = "计划号")
private String planNo;
@Schema(description = "开始位置")
private Double startPosition;
@Schema(description = "结束位置")
private Double endPosition;
@Schema(description = "长度")
private Double segLength;
private Integer val1num;
private Integer val2num;
private Integer val3num;
private Integer val4num;
private Integer val5num;
private Integer val6num;
private Integer val7num;
private Integer val8num;
private Integer val9num;
private Integer val10num;
private Double val1max;
private Double val1min;
private Double val1avg;
private Integer val1cnt;
private Double val2max;
private Double val2min;
private Double val2avg;
private Integer val2cnt;
private Double val3max;
private Double val3min;
private Double val3avg;
private Integer val3cnt;
private Double val4max;
private Double val4min;
private Double val4avg;
private Integer val4cnt;
private Double val5max;
private Double val5min;
private Double val5avg;
private Integer val5cnt;
private Double val6max;
private Double val6min;
private Double val6avg;
private Integer val6cnt;
private Double val7max;
private Double val7min;
private Double val7avg;
private Integer val7cnt;
private Double val8max;
private Double val8min;
private Double val8avg;
private Integer val8cnt;
private Double val9max;
private Double val9min;
private Double val9avg;
private Integer val9cnt;
private Double val10max;
private Double val10min;
private Double val10avg;
private Integer val10cnt;
private Double val11max;
private Double val11min;
private Double val11avg;
private Integer val11cnt;
private Double val12max;
private Double val12min;
private Double val12avg;
private Integer val12cnt;
private Double val13max;
private Double val13min;
private Double val13avg;
private Integer val13cnt;
private Double val14max;
private Double val14min;
private Double val14avg;
private Integer val14cnt;
private Double val15max;
private Double val15min;
private Double val15avg;
private Integer val15cnt;
private Double val16max;
private Double val16min;
private Double val16avg;
private Integer val16cnt;
private Double val17max;
private Double val17min;
private Double val17avg;
private Integer val17cnt;
private Double val18max;
private Double val18min;
private Double val18avg;
private Integer val18cnt;
private Double val19max;
private Double val19min;
private Double val19avg;
private Integer val19cnt;
private Double val20max;
private Double val20min;
private Double val20avg;
private Integer val20cnt;
private Double val21max;
private Double val21min;
private Double val21avg;
private Integer val21cnt;
private Double val22max;
private Double val22min;
private Double val22avg;
private Integer val22cnt;
private Double val23max;
private Double val23min;
private Double val23avg;
private Integer val23cnt;
private Double val24max;
private Double val24min;
private Double val24avg;
private Integer val24cnt;
private Double val25max;
private Double val25min;
private Double val25avg;
private Integer val25cnt;
private Double val26max;
private Double val26min;
private Double val26avg;
private Integer val26cnt;
private Double val27max;
private Double val27min;
private Double val27avg;
private Integer val27cnt;
private Double val28max;
private Double val28min;
private Double val28avg;
private Integer val28cnt;
private Double val29max;
private Double val29min;
private Double val29avg;
private Integer val29cnt;
private Double val30max;
private Double val30min;
private Double val30avg;
private Integer val30cnt;
private Double val31max;
private Double val31min;
private Double val31avg;
private Integer val31cnt;
private Double val32max;
private Double val32min;
private Double val32avg;
private Integer val32cnt;
private Double val33max;
private Double val33min;
private Double val33avg;
private Integer val33cnt;
private Double val34max;
private Double val34min;
private Double val34avg;
private Integer val34cnt;
private Double val35max;
private Double val35min;
private Double val35avg;
private Integer val35cnt;
private Double val36max;
private Double val36min;
private Double val36avg;
private Integer val36cnt;
private Double val37max;
private Double val37min;
private Double val37avg;
private Integer val37cnt;
private Double val38max;
private Double val38min;
private Double val38avg;
private Integer val38cnt;
private Double val39max;
private Double val39min;
private Double val39avg;
private Integer val39cnt;
private Double val40max;
private Double val40min;
private Double val40avg;
private Integer val40cnt;
private Double val41max;
private Double val41min;
private Double val41avg;
private Integer val41cnt;
private Double val42max;
private Double val42min;
private Double val42avg;
private Integer val42cnt;
private Double val43max;
private Double val43min;
private Double val43avg;
private Integer val43cnt;
private Double val44max;
private Double val44min;
private Double val44avg;
private Integer val44cnt;
private Double val45max;
private Double val45min;
private Double val45avg;
private Integer val45cnt;
private Double val46max;
private Double val46min;
private Double val46avg;
private Integer val46cnt;
private Double val47max;
private Double val47min;
private Double val47avg;
private Integer val47cnt;
private Double val48max;
private Double val48min;
private Double val48avg;
private Integer val48cnt;
private Double val49max;
private Double val49min;
private Double val49avg;
private Integer val49cnt;
private Double val50max;
private Double val50min;
private Double val50avg;
private Integer val50cnt;
private LocalDateTime createTime;
private LocalDateTime updateTime;
}

View File

@@ -0,0 +1,357 @@
package com.fizz.business.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* <p>
* 各机张力,电流等架跟踪表
* </p>
*
* @author baomidou
* @since 2023-10-26
*/
@Getter
@Setter
@TableName("cpg_segment_total")
@Schema(title = "CpgSegmentTotal对象", description = "各机张力,电流等架跟踪表")
public class SegmentTotal implements Serializable {
private static final long serialVersionUID = 1L;
@Schema(description = "主键")
@TableId(value = "id", type = IdType.AUTO)
private Long id;
@Schema(description = "卷号")
private String entryMatId;
@Schema(description = "分段id")
private Integer segNo;
@Schema(description = "计划id")
private Long planId;
@Schema(description = "计划号")
private String planNo;
@Schema(description = "开始位置")
private Double startPosition;
@Schema(description = "结束位置")
private Double endPosition;
@Schema(description = "长度")
private Double segLength;
private Double tval1avg;
private Double tval2avg;
private Double tval3avg;
private Double tval4avg;
private Double tval5avg;
private Double tval6avg;
private Double tval7avg;
private Double tval8avg;
private Double tval9avg;
private Double tval10avg;
private Double tval11avg;
private Double tval12avg;
private Double tval13avg;
private Double tval14avg;
private Double tval15avg;
private Double tval16avg;
private Double tval17avg;
private Double tval18avg;
private Double tval19avg;
private Double tval20avg;
private Double tval21avg;
private Double tval22avg;
private Double tval23avg;
private Double tval24avg;
private Double tval25avg;
private Double tval26avg;
private Double tval27avg;
private Double tval28avg;
private Double tval29avg;
private Double tval30avg;
private Double tval31avg;
private Double tval32avg;
private Double tval33avg;
private Double tval34avg;
private Double tval35avg;
private Double tval36avg;
private Double tval37avg;
private Double tval38avg;
private Double tval39avg;
private Double tval40avg;
private Double tval41avg;
private Double tval42avg;
private Double tval43avg;
private Double tval44avg;
private Double tval45avg;
private Double tval46avg;
private Double tval47avg;
private Double tval48avg;
private Double tval49avg;
private Double tval50avg;
private Double tval51avg;
private Double tval52avg;
private Double tval53avg;
private Double tval54avg;
private Double tval55avg;
private Double tval56avg;
private Double tval57avg;
private Double tval58avg;
private Double tval59avg;
private Double tval60avg;
private Double tval61avg;
private Double tval62avg;
private Double tval63avg;
private Double tval64avg;
private Double tval65avg;
private Double tval66avg;
private Double tval67avg;
private Double tval68avg;
private Double tval69avg;
private Double tval70avg;
private Double tval71avg;
private Double tval72avg;
private Double tval73avg;
private Double tval74avg;
private Double tval75avg;
private Double tval76avg;
private Double tval77avg;
private Double tval78avg;
private Double tval79avg;
private Double tval80avg;
private Double tval81avg;
private Double tval82avg;
private Double tval83avg;
private Double tval84avg;
private Double tval85avg;
private Double tval86avg;
private Double tval87avg;
private Double tval88avg;
private Double tval89avg;
private Double tval90avg;
private Double tval91avg;
private Double tval92avg;
private Double tval93avg;
private Double tval94avg;
private Double tval95avg;
private Double tval96avg;
private Double tval97avg;
private Double tval98avg;
private Double tval99avg;
private Double tval100avg;
private Double tval101avg;
private Double tval102avg;
private Double tval103avg;
private Double tval104avg;
private Double tval105avg;
private Double tval106avg;
private Double tval107avg;
private Double tval108avg;
private Double tval109avg;
private Double tval110avg;
private Double tval111avg;
private Double tval112avg;
private Double tval113avg;
private Double tval114avg;
private Double tval115avg;
private Double tval116avg;
private Double tval117avg;
private Double tval118avg;
private Double tval119avg;
private Double tval120avg;
private Double tval121avg;
private Double tval122avg;
private Double tval123avg;
private Double tval124avg;
private Double tval125avg;
private Double tval126avg;
private Double tval127avg;
private Double tval128avg;
private Double tval129avg;
private Double tval130avg;
private Double tval131avg;
private Double tval132avg;
private Double tval133avg;
private Double tval134avg;
private Double tval135avg;
private Double tval136avg;
private Double tval137avg;
private Double tval138avg;
private Double tval139avg;
private Double tval140avg;
private Double tval141avg;
private Double tval142avg;
private Double tval143avg;
private Double tval144avg;
private Double tval145avg;
private Double tval146avg;
private Double tval147avg;
private Double tval148avg;
private Double tval149avg;
private Double tval150avg;
private LocalDateTime createTime;
private LocalDateTime updateTime;
}

View File

@@ -0,0 +1,19 @@
package com.fizz.business.dto;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
@Getter
@Setter
public class CoilHeadDTO implements Serializable {
private boolean first;
private String matId;
private String planNo;
private Long planId;
private double pos;
private int posIdx;
private int porIdx;
}

View File

@@ -0,0 +1,32 @@
package com.fizz.business.dto;
import cn.hutool.core.lang.Pair;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import java.io.Serializable;
import java.util.List;
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class CoilMeasureVO implements Serializable {
@Schema(description = "参数名")
private String valueName;
@Schema(description = "设定值")
private String definedValue;
@Schema(description = "最大值")
private String maxValue;
@Schema(description = "最小值")
private String minValue;
private List<Pair<String, String>> data;
}

View File

@@ -0,0 +1,22 @@
package com.fizz.business.dto;
import lombok.Builder;
import lombok.Getter;
import lombok.Setter;
/**
* @author chenhao
* @date 2023/7/26
*/
@Getter
@Setter
@Builder
public class CoilMergeEvent {
private String mainMatId;
private String mainPlanNo;
private Long mainPlanId;
private String matId;
private String planNo;
private Long planId;
private double coilLength;
}

View File

@@ -0,0 +1,39 @@
package com.fizz.business.dto;
import lombok.*;
import java.io.Serializable;
import java.util.List;
@Getter
@Setter
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class CoilPositionDTO implements Serializable {
private List<CoilStripLocation> coilStripLocationList;
private double entryLoopLen;
private double exitLoopLen;
private double entryLoopPer; // 入口活套套量百分比
private double exitLoopLPer; // 出口活套套量百分比
private Integer porId;
private Integer trId;
private Double entrySpeed; // 入口段速度
private Double technologySpeed; // 工艺段速度
private Double exitSpeed; // 出口段速度
private List<MatmapDTO> matMapList;
@Getter
@Setter
@Builder
@NoArgsConstructor
@AllArgsConstructor
public static class CoilStripLocation {
private String matId;
private String planNo;
private Long planId;
private double stripLocation;
private Integer porId;
}
}

View File

@@ -0,0 +1,18 @@
package com.fizz.business.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
@Data
public class EventVO implements Serializable {
@Schema(description = "时间")
private String time;
@Schema(description = "事件描述")
private String eventDesc;
@Schema(description = "错误信息")
private String errorMsg;
}

View File

@@ -0,0 +1,23 @@
package com.fizz.business.dto;
import lombok.Builder;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
@Getter
@Setter
@Builder
public class ExitCoilInfoDTO implements Serializable {
private Long planId;
private double startPos;
private double endPos;
private double exitCutLength;
private String entryMatId;
private String exitMatId;
private boolean separateFlag;
private boolean lastFlag;
private int subNum;
}

View File

@@ -0,0 +1,17 @@
package com.fizz.business.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
public class GroupVO {
@Schema(description = "时间")
private String time;
@Schema(description = "班组")
private String groupNo;
@Schema(description = "当班电单耗")
private String electricityUnit;
@Schema(description = "当班产量")
private String yield;
}

View File

@@ -0,0 +1,26 @@
package com.fizz.business.dto;
import lombok.*;
import java.io.Serializable;
@Getter
@Setter
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class L1CoilExitCutDTO implements Serializable {
// 出口剪切位置(卷取机编号)
private Integer exitCutPosition;
// 出口剪切计数
private Integer exitCutCounter;
// 出口剪切类型
private Integer exitCutType;
// 卷取直径
private double coilDiameter;
// 剪切时,在线卷取实际长度
private double exitCutLength;
}

View File

@@ -0,0 +1,22 @@
package com.fizz.business.dto;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
@Getter
@Setter
public class L1CoilHeadCutDTO implements Serializable {
// 剪切位置(开卷机编号)
private Integer headCutPosition;
// 剪切信号
private Integer headCutCounter;
// 剪切类型
private Integer headCutType;
// 剪切总长
private double headCutLength;
}

View File

@@ -0,0 +1,239 @@
package com.fizz.business.dto;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
@Getter
@Setter
public class L1CoilLineMeasureDTO implements Serializable {
// 工作开卷机
private Integer workPor;
// 工作卷取机
private Integer workTr;
// 最近一次过焊缝长度
private double stripLocation;
// 入口活套百分比
private double entryLoopPercent;
// 入口活套长度
private double entryLoopLength;
// 出口活套百分比
private double exitLoopPercent;
// 出口活套长度
private double exitLoopLength;
// 卷取长度
private double coilLength;
// 入口段速度
private double inSpeed;
// 工艺段速度
private double unitSpeed;
// 出口段速度
private double outSpeed;
// 带钢在线卷重[KG]
private double onlineWt;
private double val1;
private double val2;
private double val3;
private double val4;
private double val5;
private double val6;
private double val7;
private double val8;
private double val9;
private double val10;
private double val11;
private double val12;
private double val13;
private double val14;
private double val15;
private double val16;
private double val17;
private double val18;
private double val19;
private double val20;
private double val21;
private double val22;
private double val23;
private double val24;
private double val25;
private double val26;
private double val27;
private double val28;
private double val29;
private double val30;
private double val31;
private double val32;
private double val33;
private double val34;
private double val35;
private double val36;
private double val37;
private double val38;
private double val39;
private double val40;
private double val41;
private double val42;
private double val43;
private double val44;
private double val45;
private double val46;
private double val47;
private double val48;
private double val49;
private double val50;
private double tval1;
private double tval2;
private double tval3;
private double tval4;
private double tval5;
private double tval6;
private double tval7;
private double tval8;
private double tval9;
private double tval10;
private double tval11;
private double tval12;
private double tval13;
private double tval14;
private double tval15;
private double tval16;
private double tval17;
private double tval18;
private double tval19;
private double tval20;
private double tval21;
private double tval22;
private double tval23;
private double tval24;
private double tval25;
private double tval26;
private double tval27;
private double tval28;
private double tval29;
private double tval30;
private double tval31;
private double tval32;
private double tval33;
private double tval34;
private double tval35;
private double tval36;
private double tval37;
private double tval38;
private double tval39;
private double tval40;
private double tval41;
private double tval42;
private double tval43;
private double tval44;
private double tval45;
private double tval46;
private double tval47;
private double tval48;
private double tval49;
private double tval50;
private double tval51;
private double tval52;
private double tval53;
private double tval54;
private double tval55;
private double tval56;
private double tval57;
private double tval58;
private double tval59;
private double tval60;
private double tval61;
private double tval62;
private double tval63;
private double tval64;
private double tval65;
private double tval66;
private double tval67;
private double tval68;
private double tval69;
private double tval70;
private double tval71;
private double tval72;
private double tval73;
private double tval74;
private double tval75;
private double tval76;
private double tval77;
private double tval78;
private double tval79;
private double tval80;
private double tval81;
private double tval82;
private double tval83;
private double tval84;
private double tval85;
private double tval86;
private double tval87;
private double tval88;
private double tval89;
private double tval90;
private double tval91;
private double tval92;
private double tval93;
private double tval94;
private double tval95;
private double tval96;
private double tval97;
private double tval98;
private double tval99;
private double tval100;
private double tval101;
private double tval102;
private double tval103;
private double tval104;
private double tval105;
private double tval106;
private double tval107;
private double tval108;
private double tval109;
private double tval110;
private double tval111;
private double tval112;
private double tval113;
private double tval114;
private double tval115;
private double tval116;
private double tval117;
private double tval118;
private double tval119;
private double tval120;
private double tval121;
private double tval122;
private double tval123;
private double tval124;
private double tval125;
private double tval126;
private double tval127;
private double tval128;
private double tval129;
private double tval130;
private double tval131;
private double tval132;
private double tval133;
private double tval134;
private double tval135;
private double tval136;
private double tval137;
private double tval138;
private double tval139;
private double tval140;
private double tval141;
private double tval142;
private double tval143;
private double tval144;
private double tval145;
private double tval146;
private double tval147;
private double tval148;
private double tval149;
private double tval150;
}

View File

@@ -0,0 +1,26 @@
package com.fizz.business.dto;
import lombok.*;
@Getter
@Setter
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class L1CoilOperateDTO {
// 开卷机上卷位置
private Integer porOnlinePosition;
// 开卷机甩尾位置
private Integer porPayOverPosition;
// 卷取机卸卷位置
private Integer trUnloadPosition;
// 开卷机上卷计数器
private Integer porOnlineCounter;
// 开卷机甩尾计数器
private Integer porPayOverCounter;
// 卷取机卸卷计数器
private Integer trUnloadCounter;
}

View File

@@ -0,0 +1,266 @@
package com.fizz.business.dto;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
@Getter
@Setter
public class L1CoilPointDataDTO implements Serializable {
//============================出口剪切============================
// 出口剪切位置(卷取机编号)
private Integer exitCutPosition;
// 出口剪切计数
private Integer exitCutCounter;
// 出口剪切类型
private Integer exitCutType;
// 卷取直径
private double coilDiameter;
// 剪切时,在线卷取实际长度
private double exitCutLength;
//============================上卷、甩尾、卸卷============================
// 开卷机上卷位置
private Integer porOnlinePosition;
// 开卷机甩尾位置
private Integer porPayOverPosition;
// 卷取机卸卷位置
private Integer trUnloadPosition;
// 开卷机上卷计数器
private Integer porOnlineCounter;
// 开卷机甩尾计数器
private Integer porPayOverCounter;
// 卷取机卸卷计数器
private Integer trUnloadCounter;
//============================焊缝跟踪============================
// 工作开卷机
private Integer workPor;
// 工作卷取机
private Integer workTr;
// 最近一次过焊缝长度
private double stripLocation;
// 入口活套百分比
private double entryLoopPercent;
// 入口活套长度
private double entryLoopLength;
// 出口活套百分比
private double exitLoopPercent;
// 出口活套长度
private double exitLoopLength;
// 卷取长度
private double coilLength;
// 入口段速度
private double inSpeed;
// 工艺段速度
private double unitSpeed;
// 出口段速度
private double outSpeed;
// 带钢在线卷重[KG]
private double onlineWt;
private double val1;
private double val2;
private double val3;
private double val4;
private double val5;
private double val6;
private double val7;
private double val8;
private double val9;
private double val10;
private double val11;
private double val12;
private double val13;
private double val14;
private double val15;
private double val16;
private double val17;
private double val18;
private double val19;
private double val20;
private double val21;
private double val22;
private double val23;
private double val24;
private double val25;
private double val26;
private double val27;
private double val28;
private double val29;
private double val30;
private double val31;
private double val32;
private double val33;
private double val34;
private double val35;
private double val36;
private double val37;
private double val38;
private double val39;
private double val40;
private double val41;
private double val42;
private double val43;
private double val44;
private double val45;
private double val46;
private double val47;
private double val48;
private double val49;
private double val50;
private double tval1;
private double tval2;
private double tval3;
private double tval4;
private double tval5;
private double tval6;
private double tval7;
private double tval8;
private double tval9;
private double tval10;
private double tval11;
private double tval12;
private double tval13;
private double tval14;
private double tval15;
private double tval16;
private double tval17;
private double tval18;
private double tval19;
private double tval20;
private double tval21;
private double tval22;
private double tval23;
private double tval24;
private double tval25;
private double tval26;
private double tval27;
private double tval28;
private double tval29;
private double tval30;
private double tval31;
private double tval32;
private double tval33;
private double tval34;
private double tval35;
private double tval36;
private double tval37;
private double tval38;
private double tval39;
private double tval40;
private double tval41;
private double tval42;
private double tval43;
private double tval44;
private double tval45;
private double tval46;
private double tval47;
private double tval48;
private double tval49;
private double tval50;
private double tval51;
private double tval52;
private double tval53;
private double tval54;
private double tval55;
private double tval56;
private double tval57;
private double tval58;
private double tval59;
private double tval60;
private double tval61;
private double tval62;
private double tval63;
private double tval64;
private double tval65;
private double tval66;
private double tval67;
private double tval68;
private double tval69;
private double tval70;
private double tval71;
private double tval72;
private double tval73;
private double tval74;
private double tval75;
private double tval76;
private double tval77;
private double tval78;
private double tval79;
private double tval80;
private double tval81;
private double tval82;
private double tval83;
private double tval84;
private double tval85;
private double tval86;
private double tval87;
private double tval88;
private double tval89;
private double tval90;
private double tval91;
private double tval92;
private double tval93;
private double tval94;
private double tval95;
private double tval96;
private double tval97;
private double tval98;
private double tval99;
private double tval100;
private double tval101;
private double tval102;
private double tval103;
private double tval104;
private double tval105;
private double tval106;
private double tval107;
private double tval108;
private double tval109;
private double tval110;
private double tval111;
private double tval112;
private double tval113;
private double tval114;
private double tval115;
private double tval116;
private double tval117;
private double tval118;
private double tval119;
private double tval120;
private double tval121;
private double tval122;
private double tval123;
private double tval124;
private double tval125;
private double tval126;
private double tval127;
private double tval128;
private double tval129;
private double tval130;
private double tval131;
private double tval132;
private double tval133;
private double tval134;
private double tval135;
private double tval136;
private double tval137;
private double tval138;
private double tval139;
private double tval140;
private double tval141;
private double tval142;
private double tval143;
private double tval144;
private double tval145;
private double tval146;
private double tval147;
private double tval148;
private double tval149;
private double tval150;
}

View File

@@ -0,0 +1,27 @@
package com.fizz.business.dto;
import lombok.*;
import java.io.Serializable;
import java.time.LocalDateTime;
@Getter
@Setter
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class L3CoilDefectDTO implements Serializable {
private Long defectId;
private String defectCode;
private String defectName;
private String defectDesc;
private String planNo;
private String matNo;
private String matSubNo;
private String workUnitCode;
private String workProcessCode;
private String operate;
private LocalDateTime doTime;
private String doUser;
}

View File

@@ -0,0 +1,17 @@
package com.fizz.business.dto;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import java.io.Serializable;
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class LimitData implements Serializable {
private Double upper;
private Double lower;
}

View File

@@ -0,0 +1,17 @@
package com.fizz.business.dto;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
@Getter
@Setter
public class MatmapDTO implements Serializable {
private String matId;
private String planNo;
private Long planId;
private String positionNameCn;
private String positionNameEn;
private int posIdx;
}

View File

@@ -0,0 +1,60 @@
package com.fizz.business.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
/**
* 子计划数据
*
* @author chenhao
* @date 2023/7/26
*/
@Getter
@Setter
public class PdiPlanSubDTO implements Serializable {
@Schema(description = "成品卷")
private String exitMatId;
@Schema(description = "来料卷")
private String entryMatId;
@Schema(description = "原料卷号")
private String originMatId;
@Schema(description = "开始位置")
private Double startPosition;
@Schema(description = "结束位置")
private Double endPosition;
@Schema(description = "产品类型")
private String prodCode;
@Schema(description = "钢种")
private String steelGrade;
@Schema(description = "来料厚度")
private Double entryThick;
@Schema(description = "来料宽度")
private Double entryWidth;
@Schema(description = "来料长度")
private Double entryLength;
@Schema(description = "来料重量")
private Double entryWeight;
@Schema(description = "成品长度")
private Double exitLength;
@Schema(description = "理论重量")
private Double theoryWeight;
@Schema(description = "实际重量")
private Double actualWeight;
}

View File

@@ -0,0 +1,51 @@
package com.fizz.business.dto;
import com.fizz.business.domain.PdoExcoil;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
import java.util.List;
/**
* 产出数据
*
* @author chenhao
* @date 2023/7/26
*/
@Getter
@Setter
public class PdoExCoilDTO extends PdoExcoil implements Serializable {
@Schema(description = "机组号")
private String unitCode;
@Schema(description = "工序号")
private String processCode;
@Schema(description = "是否尾卷")
private boolean lastFlag;
@Schema(description = "是否分卷")
private boolean separateFlag;
@Schema(description = "是否并卷")
private boolean mergeFlag;
@Schema(description = "并卷数")
private int mergeNum;
@Schema(description = "计划来源L3-L3计划MANUAL-人工")
private String planOrigin;
@Schema(description = "并卷数据")
private List<PdoExCoilSubDTO> subCoilList;
@Schema(description = "子计划数据")
private List<PdiPlanSubDTO> subPlanList;
@Schema(description = "是否实验卷")
private String isExperiment;
@Schema(description = "实验种类")
private String experimentType;
@Schema(description = "工艺规程id")
private Long setupId;
@Schema(description = "工艺规程名称")
private String setupName;
}

View File

@@ -0,0 +1,74 @@
package com.fizz.business.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* 并卷数据
*
* @author chenhao
* @date 2023/7/26
*/
@Getter
@Setter
public class PdoExCoilSubDTO implements Serializable {
@Schema(description = "成品卷")
private String exitMatId;
@Schema(description = "来料卷")
private String entryMatId;
@Schema(description = "开始位置")
private Double startPosition;
@Schema(description = "结束位置")
private Double endPosition;
@Schema(description = "计划id")
private Long planId;
@Schema(description = "计划号")
private String planNo;
@Schema(description = "产品类型")
private String prodCode;
@Schema(description = "钢种")
private String steelGrade;
@Schema(description = "来料厚度")
private Double entryThick;
@Schema(description = "来料宽带")
private Double entryWidth;
@Schema(description = "来料长度")
private Double entryLength;
@Schema(description = "来料重量")
private Double entryWeight;
@Schema(description = "成品长度")
private Double exitLength;
@Schema(description = "理论重量")
private Double theoryWeight;
@Schema(description = "实际重量")
private Double actualWeight;
@Schema(description = "上线时间")
private LocalDateTime onlineTime;
@Schema(description = "开始时间")
private LocalDateTime startTime;
@Schema(description = "结束时间")
private LocalDateTime endTime;
}

View File

@@ -0,0 +1,30 @@
package com.fizz.business.dto;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
/**
* 点位参数配置
*
* @author chenhao
* @date 2023/05/18
*/
@Getter
@Setter
public class PointConfigDTO implements Serializable {
private String point;
private String param;
private String desc;
@JSONField(name = "device_name")
private String deviceName;
@JSONField(name = "show_type")
private String showType;
}

View File

@@ -0,0 +1,19 @@
package com.fizz.business.dto;
import lombok.Data;
import java.util.Map;
@Data
public class PointEvent {
private Map<String, Object> data;
private Long gatewayTime;
private String pushId;
private Long sourceMsgTime;
private String deviceId;
}

View File

@@ -0,0 +1,20 @@
package com.fizz.business.dto;
import lombok.Data;
import java.io.Serializable;
/**
* 请求信息
* @author chenhao
* @date 2023/04/19
*/
@Data
public class RequestInfo implements Serializable {
private String ip;
private String url;
private String httpMethod;
private String classMethod;
private Object requestParams;
}

View File

@@ -0,0 +1,17 @@
package com.fizz.business.dto;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
@Getter
@Setter
public class SegValue implements Serializable {
private double max;
private double min;
private double avg;
private double std;
private int cnt;
private double sum;
}

View File

@@ -0,0 +1,26 @@
package com.fizz.business.dto;
import lombok.Data;
import java.util.Map;
@Data
public class SegmentDTO {
private boolean first;
private Long planId;
private String planNo;
private String coilID;
private String enCoilID;
private String exCoilID;
//MATID_Type matId;
private int segNo;
private double segLen;
private double startPos;//位于带钢的起始位置
private double endPos;
private double headPos;//位于全线的位置
private double tailPos;
private int headPosNum;
private int tailPosNum;
private Map<String, SegValue> segValMap;
}

View File

@@ -0,0 +1,33 @@
package com.fizz.business.dto;
import lombok.*;
import java.io.Serializable;
import java.util.List;
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class WsCoilMeasureDTO implements Serializable {
private String partName;
private String matId;
private String devName;
private String devDesc;
private List<ValueDTO> data;
@Getter
@Setter
@Builder
@NoArgsConstructor
@AllArgsConstructor
public static class ValueDTO {
private String point;
private String valueName;
private String value;
// 0-APP\WEB都显示1-WEB显示2-APP显示
private String showType;
private boolean needAlarm;
}
}

View File

@@ -0,0 +1,23 @@
package com.fizz.business.dto;
import com.fizz.business.form.OperateMatForm;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
/**
* @author chenhao
* @date 2023/8/29
*/
@Getter
@Setter
public class WsSignalMsgDTO extends OperateMatForm {
@Schema(description = "ONLINE-钢卷上线UNLOAD-手动卸卷ALL_RETURN-整卷回退HALF_RETURN-半卷回退BLOCK-卸卷并封闭THROW_TAIL-甩尾")
private String operation;
@Schema(description = "1-页面手动操作")
private int autoFlag;
@Schema(description = "虚拟卷标识")
private boolean virtualPlanFlag;
}

View File

@@ -0,0 +1,42 @@
package com.fizz.business.form;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.List;
@Getter
@Setter
public class AddDefectForm implements Serializable {
@NotNull(message = "计划id不能为空")
@Schema(description = "计划id")
private Long planId;
@NotBlank(message = "计划号不能为空")
@Schema(description = "计划号")
private String planNo;
@NotBlank(message = "钢卷号不能为空")
@Schema(description = "钢卷号")
private String entryMatId;
@Valid
@Schema(description = "缺陷列表")
private List<DefectInfo> defectList;
@Getter
@Setter
public static class DefectInfo {
@NotBlank(message = "缺陷代码不能为空")
@Schema(description = "缺陷代码")
private String defectCode;
@NotBlank(message = "缺陷名称不能为空")
@Schema(description = "缺陷名称")
private String defectName;
@Schema(description = "缺陷描述")
private String defectDesc;
}
}

View File

@@ -0,0 +1,26 @@
package com.fizz.business.form;
import com.fizz.business.constants.enums.DeviceEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* 位置调整form
*
* @author chenhao
* @date 2023/04/27
*/
@Getter
@Setter
public class AdjustPosForm implements Serializable {
@NotNull(message = "目标位置不存在")
@Schema(description = "目标位置")
private DeviceEnum targetPos;
@NotNull(message = "当前位置不存在")
@Schema(description = "当前位置")
private DeviceEnum currentPos;
}

View File

@@ -3,42 +3,114 @@ package com.fizz.business.form;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
@Data
public class CalcPdiPlanForm {
@Schema(description = "多火轧制次数")
private Integer operid;
private Long id; // 主键ID
@Schema(description = "轧制模式 1轧制力 2延伸率")
private Integer operMode;
@Schema(description = "钢种")
private String grade;
@Schema(description = "卷ID")
private String coilid;
@Schema(description = "热轧卷ID")
private String hotCoilid;
@Schema(description = "道次数")
private Integer passno;
@Schema(description = "入口宽度")
private Double entryWidth;
@Schema(description = "退火厚度")
private Double annealThick;
@Schema(description = "入口厚度")
private Double entryThick;
@Schema(description = "出口厚度")
private Double exitThick;
@Schema(description = "设定值列表")
List<ModSetupResultCalcForm> lists;
private Integer seqid; // 主键ID
private String coilid; // 钢卷号
private Integer picklingCount; // 酸洗次数
private Integer dummyCoilFlag; // 虚卷标识
private Integer seqno; // 顺序号
private Integer status; // 状态
private String planid; // 计划ID
private String planType; // 计划类型
private BigDecimal yieldPoint; // 屈服点
private BigDecimal entryWeight; // 入口重量(t)
private BigDecimal entryThick; // 入口厚度(mm)
private BigDecimal entryWidth; // 入口宽度(mm)
private BigDecimal entryLength; // 入口长度(mm)
private BigDecimal entryOuterDiameter; // 入口外径(mm)
private BigDecimal entryInnerDiameter; // 入口内径(mm)
private BigDecimal exitInnerDiameter; // 出口内径(mm)
private String steelGrade; // 钢种
private String exitCoilid; // 出口卷号
private Integer tlvFlag; // 张力平整标识
private String orderNo; // 订单号
private String custommerCode; // 客户代码
private BigDecimal orderThick; // 订单厚度(mm)
private BigDecimal orderWidth; // 订单宽度(mm)
private BigDecimal orderLenLow; // 订单长度下限(mm)
private BigDecimal orderLenUp; // 订单长度上限(mm)
private BigDecimal orderWt; // 订单重量(t)
private BigDecimal orderWtLow; // 订单重量下限(t)
private BigDecimal orderWtUp; // 订单重量上限(t)
private BigDecimal orderMetCoatTop; // 订单镀层上
private BigDecimal orderMetCoatBot; // 订单镀层下
private String finalUse; // 最终用途
private String hotCoilCode; // 热卷代码
private BigDecimal exitLengthTar; // 出口目标长度(mm)
private BigDecimal exitLengthTolMax; // 出口长度公差最大值(mm)
private BigDecimal exitLengthTolMin; // 出口长度公差最小值(mm)
private BigDecimal exitThickTar; // 出口目标厚度(mm)
private BigDecimal exitThickTolMax; // 出口厚度公差最大值(mm)
private BigDecimal exitThickTolMin; // 出口厚度公差最小值(mm)
private BigDecimal exitWidthTar; // 出口目标宽度(mm)
private BigDecimal exitWidthTolMax; // 出口宽度公差最大值(mm)
private BigDecimal exitWidthTolMin; // 出口宽度公差最小值(mm)
private String nextWholeBacklogCode; // 下道全流程积压代码
private String prevWholeBacklogCode; // 上道全流程积压代码
private String exitWtMode; // 出口重量模式
private Integer splitNum; // 分卷数量
private BigDecimal exitWeight1; // 出口重量1
private BigDecimal exitWeight2; // 出口重量2
private BigDecimal exitWeight3; // 出口重量3
private BigDecimal exitWeight4; // 出口重量4
private BigDecimal exitWeight5; // 出口重量5
private BigDecimal exitWeight6; // 出口重量6
private String headSampleMode; // 头部取样模式
private String headSamplePosition; // 头部取样位置
private BigDecimal headSampleLength; // 头部取样长度(mm)
private String headSamplePlace; // 头部取样地点
private Integer headSampleNum; // 头部取样数量
private String tailSampleMode; // 尾部取样模式
private String tailSamplePosition; // 尾部取样位置
private BigDecimal tailSampleLength; // 尾部取样长度(mm)
private String tailSamplePlace; // 尾部取样地点
private Integer tailSampleNum; // 尾部取样数量
private LocalDateTime timestamp; // 时间戳
private LocalDateTime onlineDate; // 上线时间
private LocalDateTime startDate; // 开始时间
private LocalDateTime endDate; // 结束时间
private LocalDateTime furInDate; // 进炉时间
private LocalDateTime furOutDate; // 出炉时间
private LocalDateTime createTime; // 创建时间
private LocalDateTime updateTime; // 更新时间
private String surfaceVice; // 副面
private String weldCode; // 焊缝代码
private Integer spmFlag; // SPM标识
private BigDecimal spmElongation; // SPM延伸率(%)
private BigDecimal spmRollforce; // SPM轧制力
private String spmProcessType; // SPM工艺类型
private String spmControlMode; // SPM控制模式
private BigDecimal spmBendingForce; // SPM弯曲力
private BigDecimal spmCrimpingRollMesh; // SPM咬入辊目
private BigDecimal spmBillyRollMesh; // SPM精轧辊目
private Integer trimFlag; // 切边标识
private String tlvMode; // 张力平整模式
private BigDecimal tlvElongation; // 张力平整延伸率(%)
private Integer chromating; // 钝化标识
private String coatingCode; // 镀层代码
private Integer oilingFlag; // 涂油标识
private String oilingType; // 涂油类型
private BigDecimal oilingTop; // 涂油上
private BigDecimal oilingBottom; // 涂油下
private String heatCycle; // 热循环
private String coatingSelection; // 镀层选择
private String coatingType; // 镀层类型
private String chemTreatMode; // 化学处理模式
private BigDecimal aimWeightTop; // 目标重量上
private BigDecimal aimWeightBottom; // 目标重量下
private BigDecimal maxTolWeightTop; // 最大公差重量上
private BigDecimal maxTolWeightBottom; // 最大公差重量下
private BigDecimal headendGaugeLength; // 头端测厚长度(mm)
private BigDecimal tailendGaugeLength; // 尾端测厚长度(mm)
private String origin; // 产地
private String originCoilid; // 原卷号
}

View File

@@ -1,5 +1,6 @@
package com.fizz.business.form;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
@@ -20,16 +21,13 @@ import java.io.Serializable;
public class ChangePlanStatusForm implements Serializable {
@NotNull(message = "状态变更类型不能为空")
@Schema(description="ONLINE-钢卷上线UNLOAD-手动卸卷,PRODUCT-生产完成")
@Schema(description = "ONLINE-钢卷上线UNLOAD-手动卸卷,ALL_RETURN-整卷回退PRODUCING-生产中HALF_RETURN-半卷回退PRODUCT-生产完成BLOCK-卸卷并封闭")
private String operation;
@NotNull(message = "计划id不能为空")
@Schema(description="主键id")
@Schema(description = "计划id集合")
private Long id;
@NotNull(message = "钢卷号不能为空")
@Schema(description="钢卷号")
private String coilId;
@Schema(description = "半卷回退新卷号")
private String returnMatId;
@Schema(description = "回退重量")
private Double returnWeight;
}

View File

@@ -0,0 +1,24 @@
package com.fizz.business.form;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
@Getter
@Setter
public class ConfirmAlarmForm implements Serializable {
@NotNull(message = "报警id不能为空")
@Schema(description = "报警id")
private Long id;
@NotNull(message = "状态不能为空")
@Schema(description = "状态")
private String status;
@Schema(description = "备注")
private String alarmRemark;
}

View File

@@ -4,121 +4,115 @@ import com.fizz.business.vo.ModSetupResultVO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
@Data
public class CrmPdiPlanForm {
@Schema(description = "序列号")
private Integer seqid;
private Long id; // 主键ID
@Schema(description = "多火轧制次数")
private Integer operid;
@Schema(description = "轧制模式 1轧制力 2延伸率")
private Integer operMode;
@Schema(description = "卷ID")
private String coilid;
@Schema(description = "热轧卷ID")
private String hotCoilid;
@Schema(description = "道次数")
private Integer passno;
@Schema(description = "退火厚度")
private Double annealThick;
@Schema(description = "入口厚度")
private Double entryThick;
@Schema(description = "入口宽度")
private Double entryWidth;
@Schema(description = "入口重量")
private Double entryWeight;
@Schema(description = "入口长度")
private Double entryLength;
@Schema(description = "入口内径")
private Integer entryInnerDiameter;
@Schema(description = "入口外径")
private Integer entryOuterDiameter;
@Schema(description = "出口卷号")
private String exitCoilid;
@Schema(description = "下工序代码 1冷硬卷 2退火卷 3其他 ")
private String nextUnit;
@Schema(description = "分割数量")
private Integer splitNum;
@Schema(description = "切割模式")
private Integer cutMode;
@Schema(description = "出口重量1")
private Double exitValue1;
@Schema(description = "出口重量2")
private Double exitValue2;
@Schema(description = "出口重量3")
private Double exitValue3;
@Schema(description = "出口重量4")
private Double exitValue4;
@Schema(description = "出口重量5")
private Double exitValue5;
@Schema(description = "出口重量6")
private Double exitValue6;
@Schema(description = "出口重量")
private Double exitWeight;
@Schema(description = "出口长度")
private Double exitLength;
@Schema(description = "出口厚度")
private Double exitThick;
@Schema(description = "出口宽度")
private Double exitWidth;
@Schema(description = "钢种")
private String grade;
@Schema(description = "屈服强度")
private Integer yieldStrength;
@Schema(description = "抗拉强度")
private Integer tensileStrength;
@Schema(description = "状态 NEW READY ONLINE PRODUCING PRODUCT")
private String status;
@Schema(description = "计划号")
private String planNo;
@Schema(description = "压下率")
private Double reductionRate;
@Schema(description = "热卷温度")
private Double hotCoilTemp;
@Schema(description = "厚度正偏差")
private Double entryThickMaxtol;
@Schema(description = "厚度正偏差")
private Double entryThickMintol;
@Schema(description = "设定值列表")
List<ModSetupResultVO> lists;
private Integer seqid; // 主键ID
private String coilid; // 钢卷号
private Integer picklingCount; // 酸洗次数
private Integer dummyCoilFlag; // 虚卷标识
private Integer seqno; // 顺序号
private Integer status; // 状态
private String planid; // 计划ID
private String planType; // 计划类型
private BigDecimal yieldPoint; // 屈服点
private BigDecimal entryWeight; // 入口重量(t)
private BigDecimal entryThick; // 入口厚度(mm)
private BigDecimal entryWidth; // 入口宽度(mm)
private BigDecimal entryLength; // 入口长度(mm)
private BigDecimal entryOuterDiameter; // 入口外径(mm)
private BigDecimal entryInnerDiameter; // 入口内径(mm)
private BigDecimal exitInnerDiameter; // 出口内径(mm)
private String steelGrade; // 钢种
private String exitCoilid; // 出口卷号
private Integer tlvFlag; // 张力平整标识
private String orderNo; // 订单号
private String custommerCode; // 客户代码
private BigDecimal orderThick; // 订单厚度(mm)
private BigDecimal orderWidth; // 订单宽度(mm)
private BigDecimal orderLenLow; // 订单长度下限(mm)
private BigDecimal orderLenUp; // 订单长度上限(mm)
private BigDecimal orderWt; // 订单重量(t)
private BigDecimal orderWtLow; // 订单重量下限(t)
private BigDecimal orderWtUp; // 订单重量上限(t)
private BigDecimal orderMetCoatTop; // 订单镀层上
private BigDecimal orderMetCoatBot; // 订单镀层下
private String finalUse; // 最终用途
private String hotCoilCode; // 热卷代码
private BigDecimal exitLengthTar; // 出口目标长度(mm)
private BigDecimal exitLengthTolMax; // 出口长度公差最大值(mm)
private BigDecimal exitLengthTolMin; // 出口长度公差最小值(mm)
private BigDecimal exitThickTar; // 出口目标厚度(mm)
private BigDecimal exitThickTolMax; // 出口厚度公差最大值(mm)
private BigDecimal exitThickTolMin; // 出口厚度公差最小值(mm)
private BigDecimal exitWidthTar; // 出口目标宽度(mm)
private BigDecimal exitWidthTolMax; // 出口宽度公差最大值(mm)
private BigDecimal exitWidthTolMin; // 出口宽度公差最小值(mm)
private String nextWholeBacklogCode; // 下道全流程积压代码
private String prevWholeBacklogCode; // 上道全流程积压代码
private String exitWtMode; // 出口重量模式
private Integer splitNum; // 分卷数量
private BigDecimal exitWeight1; // 出口重量1
private BigDecimal exitWeight2; // 出口重量2
private BigDecimal exitWeight3; // 出口重量3
private BigDecimal exitWeight4; // 出口重量4
private BigDecimal exitWeight5; // 出口重量5
private BigDecimal exitWeight6; // 出口重量6
private String headSampleMode; // 头部取样模式
private String headSamplePosition; // 头部取样位置
private BigDecimal headSampleLength; // 头部取样长度(mm)
private String headSamplePlace; // 头部取样地点
private Integer headSampleNum; // 头部取样数量
private String tailSampleMode; // 尾部取样模式
private String tailSamplePosition; // 尾部取样位置
private BigDecimal tailSampleLength; // 尾部取样长度(mm)
private String tailSamplePlace; // 尾部取样地点
private Integer tailSampleNum; // 尾部取样数量
private LocalDateTime timestamp; // 时间戳
private LocalDateTime onlineDate; // 上线时间
private LocalDateTime startDate; // 开始时间
private LocalDateTime endDate; // 结束时间
private LocalDateTime furInDate; // 进炉时间
private LocalDateTime furOutDate; // 出炉时间
private LocalDateTime createTime; // 创建时间
private LocalDateTime updateTime; // 更新时间
private String surfaceVice; // 副面
private String weldCode; // 焊缝代码
private Integer spmFlag; // SPM标识
private BigDecimal spmElongation; // SPM延伸率(%)
private BigDecimal spmRollforce; // SPM轧制力
private String spmProcessType; // SPM工艺类型
private String spmControlMode; // SPM控制模式
private BigDecimal spmBendingForce; // SPM弯曲力
private BigDecimal spmCrimpingRollMesh; // SPM咬入辊目
private BigDecimal spmBillyRollMesh; // SPM精轧辊目
private Integer trimFlag; // 切边标识
private String tlvMode; // 张力平整模式
private BigDecimal tlvElongation; // 张力平整延伸率(%)
private Integer chromating; // 钝化标识
private String coatingCode; // 镀层代码
private Integer oilingFlag; // 涂油标识
private String oilingType; // 涂油类型
private BigDecimal oilingTop; // 涂油上
private BigDecimal oilingBottom; // 涂油下
private String heatCycle; // 热循环
private String coatingSelection; // 镀层选择
private String coatingType; // 镀层类型
private String chemTreatMode; // 化学处理模式
private BigDecimal aimWeightTop; // 目标重量上
private BigDecimal aimWeightBottom; // 目标重量下
private BigDecimal maxTolWeightTop; // 最大公差重量上
private BigDecimal maxTolWeightBottom; // 最大公差重量下
private BigDecimal headendGaugeLength; // 头端测厚长度(mm)
private BigDecimal tailendGaugeLength; // 尾端测厚长度(mm)
private String origin; // 产地
private String originCoilid; // 原卷号
}

View File

@@ -0,0 +1,32 @@
package com.fizz.business.form;
import com.fizz.business.constants.enums.L1OperateMatEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* 状态变更form
*
* @author chenhao
* @date 2023/04/27
*/
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class L1OperateMatForm extends OperateMatForm implements Serializable {
@NotNull(message = "操作不存在")
@Schema(description = "ONLINE-钢卷上线UNLOAD-手动卸卷ALL_RETURN-整卷回退HALF_RETURN-半卷回退BLOCK-卸卷并封闭THROW_TAIL-甩尾")
private L1OperateMatEnum operation;
@Builder
public L1OperateMatForm(Integer porIdx, Integer trIdx, Long planId, String entryMatId, String planNo, L1OperateMatEnum operation) {
super(porIdx, trIdx, planId, entryMatId, planNo);
this.operation = operation;
}
}

View File

@@ -0,0 +1,42 @@
package com.fizz.business.form;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* 状态变更form
*
* @author chenhao
* @date 2023/04/27
*/
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class OperateMatForm implements Serializable {
@Schema(description = "开卷机编号")
private Integer porIdx;
@Schema(description = "卷取机编号")
private Integer trIdx;
@NotNull(message = "计划id不能为空")
@Schema(description = "计划id")
private Long planId;
@NotBlank(message = "钢卷号不能为空")
@Schema(description = "钢卷号")
private String entryMatId;
@Schema(description = "计划号")
private String planNo;
}

View File

@@ -0,0 +1,12 @@
package com.fizz.business.form;
import lombok.Data;
@Data
public class PageForm {
private long size = 10L;
private long current = 1L;
}

View File

@@ -0,0 +1,38 @@
package com.fizz.business.form;
import com.fizz.business.constants.enums.AlarmStatusEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.time.LocalDate;
import java.util.List;
/**
* @author chenhao
* @date 2023/04/26
*/
@Getter
@Setter
public class QueryAlarmForm extends PageForm implements Serializable {
@Schema(description = "钢卷号")
private String matId;
@Schema(description = "状态INIT-初始化UNCONFIRMED-报警未确认CONFIRM-报警已确认")
private List<AlarmStatusEnum> statuses;
@Schema(description = "报警类型 1:持续5min的报警 2立即报警")
private String alarmType;
@Schema(description = "开始日期,yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate startDate;
@Schema(description = "结束日期,yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate endDate;
}

View File

@@ -0,0 +1,30 @@
package com.fizz.business.form;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.time.LocalDate;
/**
* @author chenhao
* @date 2023/04/26
*/
@Getter
@Setter
public class QueryEventForm extends PageForm implements Serializable {
@Schema(description = "开始日期,yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate startDate;
@Schema(description = "结束日期,yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate endDate;
@Schema(description = "入口卷号")
private String entryMatId;
}

View File

@@ -0,0 +1,34 @@
package com.fizz.business.form;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Builder;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.time.LocalDate;
/**
* @author chenhao
* @date 2023/04/26
*/
@Getter
@Setter
@Builder
public class QueryTargetForm implements Serializable {
@Schema(description = "开始日期,yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate start;
@Schema(description = "结束日期,yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate end;
private String unitCode;
private String groupNo;
private String shiftNo;
private String type;
}

View File

@@ -0,0 +1,23 @@
package com.fizz.business.form;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
@Getter
@Setter
public class UpdateDefectForm implements Serializable {
@Schema(description = "缺陷起点")
private Double defectStartPos;
@Schema(description = "持续长度")
private Double defectLength;
@Schema(description = "缺陷code")
private String defectCode;
@Schema(description = "缺陷名称")
private String defectName;
@Schema(description = "缺陷描述")
private String defectDesc;
}

View File

@@ -1,10 +1,10 @@
package com.fizz.business.form;
import com.fizz.business.constants.enums.WebMatOperateEnum;
import com.fizz.business.constants.enums.WebOperateMatEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
@@ -16,27 +16,31 @@ import java.io.Serializable;
*/
@Getter
@Setter
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class WebOperateMatForm implements Serializable {
public class WebOperateMatForm extends OperateMatForm implements Serializable {
@NotNull(message = "操作不存在")
@Schema(description = "ONLINE-钢卷上线,NEW-回退PRODUCT-生成完成")
private WebMatOperateEnum operation;
@Schema(description = "ONLINE-钢卷上线,UNLOAD-手动卸卷ALL_RETURN-整卷回退HALF_RETURN-半卷回退BLOCK-卸卷并封闭THROW_TAIL-甩尾")
private WebOperateMatEnum operation;
@NotNull(message = "主键id不能为空")
@Schema(description = "主键id")
private Long id;
@Schema(description = "回退卷号")
private String returnMatId;
@NotBlank(message = "钢卷号不能为空")
@Schema(description = "钢卷号")
private String entryMatId;
@Schema(description = "回退重量")
private Double returnWeight;
@Schema(description = "计划号")
private String planNo;
@Schema(description = "回退备注")
private String returnRemark;
@Schema(description = "重量")
private Double weight;
@Schema(description = "产出钢卷长度")
private Double coilLength;
@Builder
public WebOperateMatForm(Integer porIdx, Integer trIdx, Long planId, String entryMatId, String planNo, WebOperateMatEnum operation, Double returnWeight, String returnRemark) {
super(porIdx, trIdx, planId, entryMatId, planNo);
this.operation = operation;
this.returnWeight = returnWeight;
this.returnRemark = returnRemark;
}
}

View File

@@ -0,0 +1,16 @@
package com.fizz.business.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fizz.business.domain.DeviceDefine;
/**
* <p>
* 机组定义表 Mapper 接口
* </p>
*
* @author baomidou
* @since 2023-05-17
*/
public interface DeviceDefineMapper extends BaseMapper<DeviceDefine> {
}

View File

@@ -0,0 +1,16 @@
package com.fizz.business.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fizz.business.domain.HalfReturn;
/**
* <p>
* 半卷整卷回退表 Mapper 接口
* </p>
*
* @author baomidou
* @since 2023-05-17
*/
public interface HalfReturnMapper extends BaseMapper<HalfReturn> {
}

View File

@@ -0,0 +1,18 @@
package com.fizz.business.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fizz.business.domain.PdoExcoil;
import org.apache.ibatis.annotations.Mapper;
/**
* <p>
* cs机组产出实绩表 Mapper 接口
* </p>
*
* @author baomidou
* @since 2023-05-17
*/
@Mapper
public interface PdoExcoilMapper extends BaseMapper<PdoExcoil> {
}

View File

@@ -0,0 +1,18 @@
package com.fizz.business.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fizz.business.domain.PdoStripvalue;
import org.apache.ibatis.annotations.Mapper;
/**
* <p>
* 剪切带钢段平均值 Mapper 接口
* </p>
*
* @author baomidou
* @since 2023-05-17
*/
@Mapper
public interface PdoStripvalueMapper extends BaseMapper<PdoStripvalue> {
}

View File

@@ -3,10 +3,18 @@ package com.fizz.business.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fizz.business.domain.ProMatmap;
import com.fizz.business.dto.MatmapDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface ProMatmapMapper extends BaseMapper<ProMatmap> {
int updateMatidByDisplayName(String matid);
void flushMatmap(@Param("list") List<MatmapDTO> list);
}

View File

@@ -0,0 +1,23 @@
package com.fizz.business.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fizz.business.domain.PdoStripvalue;
import com.fizz.business.domain.Segment;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* <p>
* 各机张力,电流等架跟踪表 Mapper 接口
* </p>
*
* @author baomidou
* @since 2023-05-17
*/
@Mapper
public interface SegmentMapper extends BaseMapper<Segment> {
PdoStripvalue getStripValue(@Param("entryMatId") String entryMatId, @Param("startPos") double startPos, @Param("endPos") double endPos);
Segment getLatestRecord();
}

View File

@@ -0,0 +1,18 @@
package com.fizz.business.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fizz.business.domain.SegmentTotal;
import org.apache.ibatis.annotations.Mapper;
/**
* <p>
* 各机张力,电流等架跟踪表 Mapper 接口
* </p>
*
* @author baomidou
* @since 2023-10-26
*/
@Mapper
public interface SegmentTotalMapper extends BaseMapper<SegmentTotal> {
SegmentTotal getLatestRecord();
}

View File

@@ -1,17 +1,12 @@
package com.fizz.business.scheduled;
import cn.hutool.json.JSONUtil;
import com.kangaroohy.milo.model.ReadWriteEntity;
import com.kangaroohy.milo.service.MiloService;
import jdk.nashorn.internal.runtime.Debug;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Map;
@Slf4j
//@Component
@@ -20,7 +15,7 @@ public class LineMeasureSchedule extends BaseSchedule{
@Resource
MiloService miloService;
@Scheduled(fixedDelay = 200)
// @Scheduled(fixedDelay = 200)
public void L1L2LineMeasure() {
try {
ReadWriteEntity node = miloService.readFromOpcUa("ns=2;s=通道 2.LockStautsRead.lockStauts1");

View File

@@ -14,7 +14,6 @@ import java.util.List;
public interface CrmPdiPlanService extends IService<CrmPdiPlan> {
public CrmPdiPlanVO getByCoilIdAndOperId(String coilid);
public PdiPlanSetupInfoVO getCoilInfoAndSetupList(String coilid);
public boolean addCrmPdiPlan(CrmPdiPlan crmPdiPlan);
@@ -24,11 +23,5 @@ public interface CrmPdiPlanService extends IService<CrmPdiPlan> {
public List<CrmPdiPlanVO> listAll(PlanQueryForm form);
void updateCrmPdiPlanById(ChangePlanStatusForm form);
String editCoilInfo(CrmPdiPlanForm coilid);
String calcSetup(CalcPdiPlanForm coilid);
CrmPdiPlan getOnlineCoil();
}

View File

@@ -0,0 +1,20 @@
package com.fizz.business.service;
import com.fizz.business.constants.enums.ExitCutTypeEnum;
import com.fizz.business.dto.PdoExCoilDTO;
import com.fizz.business.dto.ExitCoilInfoDTO;
import com.fizz.business.dto.MatmapDTO;
/**
* @author chenhao
* @date 2023/05/30
*/
public interface PdoExCoilService {
PdoExCoilDTO saveExCoil(ExitCoilInfoDTO exitCoil);
ExitCoilInfoDTO genExitCoilInfo(MatmapDTO trMatmap, ExitCutTypeEnum cutType);
void deleteExistPdo(Long planId);
}

View File

@@ -0,0 +1,13 @@
package com.fizz.business.service;
import com.fizz.business.dto.ExitCoilInfoDTO;
/**
* @author chenhao
* @date 2023/05/30
*/
public interface PdoStripValueService {
void treatStripValues(ExitCoilInfoDTO pdoExCoil);
}

View File

@@ -6,5 +6,7 @@ import com.fizz.business.domain.ProMatmap;
public interface ProMatmapService extends IService<ProMatmap> {
void updateMatid(String matid);
void flushMatmap();
// 你可以添加自定义的业务方法
}

View File

@@ -1,15 +1,33 @@
package com.fizz.business.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.fizz.business.constants.enums.DeviceEnum;
import com.fizz.business.dto.CoilPositionDTO;
import com.fizz.business.form.AdjustPosForm;
import com.fizz.business.form.L1OperateMatForm;
import com.fizz.business.form.QueryEventForm;
import com.fizz.business.form.WebOperateMatForm;
import com.fizz.business.vo.CoilMeasureVO;
import com.fizz.business.vo.ReturnInfoVO;
import com.fizz.business.vo.HalfReturnInfoVO;
/**
* @author chenhao
* @date 2023/05/17
*/
public interface TrackService {
void webOperateMat(WebOperateMatForm form);
void operateMatWeb(WebOperateMatForm form);
void l1OperateMat(L1OperateMatForm form);
ReturnInfoVO getReturnInfo(int posIdx);
HalfReturnInfoVO getHalfReturnMatId(Long planId, String entryMatId);
CoilPositionDTO getCoilPosition();
void adjustPosition(AdjustPosForm form);
void trUnload(WebOperateMatForm form);
}

View File

@@ -0,0 +1,57 @@
package com.fizz.business.service.client;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.lang.Pair;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.fizz.business.constants.enums.LimitItemCode;
import com.fizz.business.domain.DeviceDefine;
import com.fizz.business.dto.PointConfigDTO;
import com.fizz.business.mapper.DeviceDefineMapper;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.DependsOn;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 本地缓存管理
*
* @author chenhao
* @date 2023/05/15
*/
@Component
public class LocalCacheManager {
private static DeviceDefineMapper deviceDefineMapper;
@Autowired
public void setDeviceDefineMapper(DeviceDefineMapper deviceDefineMapper) {
LocalCacheManager.deviceDefineMapper = deviceDefineMapper;
}
public static LinkedHashMap<String, DeviceDefine> DEVICE_DEFINE_MAP = Maps.newLinkedHashMap();
@PostConstruct
public static void init() {
DEVICE_DEFINE_MAP = getDeviceDefine();
}
public static LinkedHashMap<String, DeviceDefine> getDeviceDefine() {
List<DeviceDefine> list = deviceDefineMapper.selectList(new LambdaQueryWrapper<DeviceDefine>().orderByAsc(DeviceDefine::getPosIdx));
return list.stream().collect(Collectors.toMap(DeviceDefine::getPositionNameEn, it -> it, (k1, k2) -> k1, LinkedHashMap::new));
}
}

View File

@@ -1,13 +1,27 @@
package com.fizz.business.service.client;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fasterxml.jackson.databind.JavaType;
import com.fizz.business.constants.enums.PlanStatusEnum;
import com.fizz.business.constants.enums.PlanTypeEnum;
import com.fizz.business.form.ChangePlanStatusForm;
import com.fizz.business.service.CrmPdiPlanService;
import com.fizz.business.vo.CrmPdiPlanVO;
import com.fizz.business.vo.PdiPlanVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.cache.RedisCacheManager;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
/**
* 计划执行接口
@@ -19,26 +33,47 @@ import java.util.List;
@Component
public class PdiPlanClient {
@Resource
CrmPdiPlanService crmPdiPlanService;
@Autowired
RedisCacheManager redisCacheManager;
@Value("${plan-execute.url:}")
private String url;
@Value("${plan-execute.timeout:30000}")
private int timeout;
private final String queryTrackPlanList = "/plan/track/plan-mat/list";
private final String queryTrackPlanFirst = "/plan/track/plan-mat/first";
private final String queryList = "/plan/list";
private final String changeStatus = "/plan/track/status/change";
public List<PdiPlanVO> queryList(PlanTypeEnum type, PlanStatusEnum status) {
public List<CrmPdiPlanVO> queryTrackPlanList() {
return null;
}
public CrmPdiPlanVO queryTrackPlanFirst() {
public List<PdiPlanVO> queryTrackPlanList() {
return null;
}
public CrmPdiPlanVO detail(Long planId) {
public PdiPlanVO queryTrackPlanFirst() {
return null;
}
public PdiPlanVO detail(Long planId) {
return null;
}
public void changeStatus(ChangePlanStatusForm form) {
crmPdiPlanService.updateCrmPdiPlanById(form);
if (isVirtualPlan(form.getId())) {
return;
}
}
public boolean isVirtualPlan(long planId) {
// 2020-01-01 00:00:00-->1577808000000
return planId > 1577808000000L;
}
}

View File

@@ -0,0 +1,361 @@
package com.fizz.business.service.client;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSON;
import com.fizz.business.dto.*;
import com.fizz.business.service.impl.BeanFactory;
import com.fizz.business.utils.CoilMeasUtil;
import com.fizz.business.utils.MatmapUtil;
import com.fizz.business.utils.RedisUtil;
import com.fizz.business.vo.PdiPlanVO;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
import java.util.*;
import java.util.stream.Collectors;
import static com.fizz.business.constants.CommonConstants.Redis.*;
/**
* redis缓存管理
*
* @author chenhao
* @date 2023/05/15
*/
@Slf4j
@Component
public class RedisCacheManager {
@Autowired
RedisTemplate<String, SegmentDTO> segmentRedisTemplate;
@Autowired
RedisTemplate<String, MatmapDTO> matmapRedisTemplate;
@Autowired
RedisTemplate<String, CoilHeadDTO> headRedisTemplate;
@Autowired
RedisTemplate<String, CoilPositionDTO> coilPosRedisTemplate;
@Autowired
RedisTemplate<String, JSONObject> jsonObjectRedisTemplate;
public double getStripLocation() {
return Optional.ofNullable((Double) RedisUtil.getValue(COIL_STRIP_LOCATION_KEY)).orElse(0d);
}
public void setStripLocation(double value) {
RedisUtil.setValue(COIL_STRIP_LOCATION_KEY, value);
}
public Integer getPrevPorIdx() {
return Optional.ofNullable((Integer) RedisUtil.getValue(COIL_POR_IDX_KEY)).orElse(0);
}
public void setPrevPorIdx(Integer value) {
RedisUtil.setValue(COIL_POR_IDX_KEY, value);
}
public CoilPositionDTO getCoilPosition() {
return Optional.ofNullable(coilPosRedisTemplate.opsForValue().get(COIL_POSITION_KEY)).orElse(new CoilPositionDTO());
}
public void setCoilPosition(CoilPositionDTO coilPos) {
coilPosRedisTemplate.opsForValue().set(COIL_POSITION_KEY, coilPos);
}
public int getSegNum() {
return Optional.ofNullable((Integer) RedisUtil.getValue(COIL_SEG_NUM_KEY)).orElse(1);
}
public void setSegNum(int value) {
RedisUtil.setValue(COIL_SEG_NUM_KEY, value);
}
public void incSegNum() {
RedisUtil.increment(COIL_SEG_NUM_KEY);
}
public void resetSegNum() {
RedisUtil.setValue(COIL_SEG_NUM_KEY, 1);
}
public double getHeadCutLength(int porIdx) {
return Optional.ofNullable((Double) RedisUtil.getValue(COIL_HEAD_CUT_LEN_KEY + porIdx)).orElse(0d);
}
public void setHeadCutLength(int porIdx, double value) {
RedisUtil.setValue(COIL_HEAD_CUT_LEN_KEY + porIdx, value);
}
public List<SegmentDTO> getSegmentList() {
return segmentRedisTemplate.opsForList().range(COIL_SEG_LIST_KEY, 0, -1);
}
public void setSegmentList(List<SegmentDTO> segmentList) {
segmentRedisTemplate.delete(COIL_SEG_LIST_KEY);
if (CollUtil.isNotEmpty(segmentList)) {
segmentRedisTemplate.opsForList().rightPushAll(COIL_SEG_LIST_KEY, segmentList);
}
}
public void addSegment(SegmentDTO segment) {
List<SegmentDTO> segmentList = this.getSegmentList();
if (segmentList.isEmpty()) {
segmentRedisTemplate.opsForList().rightPush(COIL_SEG_LIST_KEY, segment);
log.info("create new segment, coilId=[{}], segNo={}, startPos={}, endPos={}, segLen={}",
segment.getCoilID(), segment.getSegNo(), segment.getStartPos(), segment.getEndPos(), segment.getSegLen());
} else {
Map<String, String> exists = segmentList.stream().collect(Collectors.toMap(s -> s.getCoilID() + "-" + s.getSegNo() + "-" + s.getPlanId(), s -> s.getCoilID() + s.getSegNo() + s.getPlanId(), (k1, k2) -> k1));
String key = segment.getCoilID() + "-" + segment.getSegNo() + "-" + segment.getPlanId();
if (!exists.containsKey(key)) {
segmentRedisTemplate.opsForList().rightPush(COIL_SEG_LIST_KEY, segment);
log.info("create new segment, coilId=[{}], segNo={}, startPos={}, endPos={}, segLen={}",
segment.getCoilID(), segment.getSegNo(), segment.getStartPos(), segment.getEndPos(), segment.getSegLen());
}
}
}
public SegmentDTO getSegment(long index) {
return segmentRedisTemplate.opsForList().index(COIL_SEG_LIST_KEY, index);
}
public long getSegmentListSize() {
return Optional.ofNullable(segmentRedisTemplate.opsForList().size(COIL_SEG_LIST_KEY)).orElse(0L);
}
public void setMatmapList(List<MatmapDTO> matmaps) {
matmapRedisTemplate.delete(COIL_MATMAP_LIST_KEY);
if (CollUtil.isNotEmpty(matmaps)) {
matmapRedisTemplate.opsForList().rightPushAll(COIL_MATMAP_LIST_KEY, matmaps);
}
}
public List<MatmapDTO> getMatmapList() {
return matmapRedisTemplate.opsForList().range(COIL_MATMAP_LIST_KEY, 0, -1);
}
public void setMatmap(int index, MatmapDTO matmap) {
matmapRedisTemplate.opsForList().set(COIL_MATMAP_LIST_KEY, index, matmap);
}
public MatmapDTO getMatmap(int index) {
return matmapRedisTemplate.opsForList().index(COIL_MATMAP_LIST_KEY, index);
}
public List<CoilHeadDTO> getHeadList() {
return Optional.ofNullable(headRedisTemplate.opsForList().range(COIL_HEAD_LIST_KEY, 0, -1)).orElse(Collections.emptyList());
}
public void setHeadList(List<CoilHeadDTO> headList) {
headRedisTemplate.delete(COIL_HEAD_LIST_KEY);
if (CollUtil.isNotEmpty(headList)) {
headRedisTemplate.opsForList().rightPushAll(COIL_HEAD_LIST_KEY, headList);
}
}
public void addHead(CoilHeadDTO head) {
List<CoilHeadDTO> headList = getHeadList();
if (CollUtil.isNotEmpty(headList)) {
Map<String, CoilHeadDTO> exists = headList.stream().collect(Collectors.toMap(CoilHeadDTO::getMatId, h -> h, (k1, k2) -> k1));
if (!exists.containsKey(head.getMatId())) {
headRedisTemplate.opsForList().rightPush(COIL_HEAD_LIST_KEY, head);
log.info("add coil head: {}", JSON.toJSONString(head));
}
} else {
headRedisTemplate.opsForList().rightPush(COIL_HEAD_LIST_KEY, head);
log.info("add coil head: {}", JSON.toJSONString(head));
}
}
public void updateMergeHead(CoilHeadDTO head) {
headRedisTemplate.opsForValue().set(COIL_MERGE_HEAD_KEY, head);
}
public void removeHead(String matId) {
List<CoilHeadDTO> headList = getHeadList();
if (CollUtil.isEmpty(headList)) {
return;
}
// 倒序处理
ListIterator<CoilHeadDTO> iterator = headList.listIterator(headList.size());
while (iterator.hasPrevious()) {
CoilHeadDTO exists = iterator.previous();
if (Objects.equals(matId, exists.getMatId())) {
iterator.remove();
}
}
setHeadList(headList);
}
public void setMergeHead(CoilHeadDTO head) {
headRedisTemplate.opsForValue().set(COIL_MERGE_HEAD_KEY, head);
log.info("add merge head: {}", JSON.toJSONString(head));
}
public CoilHeadDTO getMergeHead() {
return headRedisTemplate.opsForValue().get(COIL_MERGE_HEAD_KEY);
}
public void removeMergeHead() {
CoilHeadDTO head = this.getMergeHead();
if (Objects.nonNull(head)) {
headRedisTemplate.delete(COIL_MERGE_HEAD_KEY);
log.info("remove merge head: {}", JSON.toJSONString(head));
}
}
public void setPrevAndMergeHead(CoilHeadDTO head, Integer workTr) {
this.setPrevHead(head);
// 卷取机上有卷时才设置mergeHead
Integer trIdx = CoilMeasUtil.getTrIdx(workTr);
if (Objects.nonNull(trIdx) && MatmapUtil.already(MatmapUtil.getMatmap(trIdx))) {
this.setMergeHead(head);
}
}
public void setPrevHead(CoilHeadDTO head) {
headRedisTemplate.opsForValue().set(COIL_PREV_HEAD_KEY, head);
log.info("add prev head: {}", JSON.toJSONString(head));
}
public CoilHeadDTO getPrevHead() {
return headRedisTemplate.opsForValue().get(COIL_PREV_HEAD_KEY);
}
private void removePrevHead() {
headRedisTemplate.delete(COIL_PREV_HEAD_KEY);
}
public double getMergeEndPos() {
return Optional.ofNullable((Double) RedisUtil.getValue(COIL_MERGE_END_POS_KEY)).orElse(0d);
}
public void setMergeEndPos(double value) {
RedisUtil.setValue(COIL_MERGE_END_POS_KEY, value);
}
public double getLastEndPos() {
return Optional.ofNullable((Double) RedisUtil.getValue(EXIT_CUT_LAST_END_POS_KEY)).orElse(0d);
}
public void setLastEndPos(double value) {
RedisUtil.setValue(EXIT_CUT_LAST_END_POS_KEY, value);
}
public double getDefectStartPos(int posIdx) {
Double value;
if (CoilMeasUtil.getPorIdxList().contains(posIdx)) {
value = RedisUtil.getValue(HEAD_DEFECT_START_POS);
} else {
value = RedisUtil.getValue(TAIL_DEFECT_START_POS);
}
return Optional.ofNullable(value).orElse(0d);
}
public void setHeadDefectStartPos(Double value) {
RedisUtil.setValue(HEAD_DEFECT_START_POS, value);
}
public void setTailDefectStartPos(Double value) {
RedisUtil.setValue(TAIL_DEFECT_START_POS, value);
}
public void delCoilSetup(String matId) {
RedisUtil.delete(Lists.newArrayList(COIL_SETUP_KEY + matId));
}
private boolean isValidSignal(Integer counter, String redisKey) {
if (counter == null) return false;
Integer cnt = RedisUtil.getValue(redisKey);
// 第一次信号不处理
if (Objects.isNull(cnt)) {
// 更新缓存计数器
RedisUtil.setValue(redisKey, counter);
return false;
}
if (!Objects.equals(cnt, counter)) {
// 更新缓存计数器
RedisUtil.setValue(redisKey, counter);
return true;
}
return false;
}
public boolean isExitCut(Integer exitCutCounter) {
return isValidSignal(exitCutCounter, COUNTER_EXIT_CUT_KEY);
}
public boolean isHeadCut(Integer headCutCounter) {
return isValidSignal(headCutCounter, COUNTER_HEAD_CUT_KEY);
}
public boolean isPorOnline(Integer porOnlineCounter) {
return isValidSignal(porOnlineCounter, COUNTER_POR_ONLINE_KEY);
}
public boolean isPorPayOver(Integer porPayOverCounter) {
return isValidSignal(porPayOverCounter, COUNTER_POR_PAY_OVER_KEY);
}
public boolean isTrUnload(Integer trUnloadCounter) {
return isValidSignal(trUnloadCounter, COUNTER_TR_UNLOAD_KEY);
}
public void setPointAlarm(String point, String type, double value) {
String key = ALARM_KEY_PREFIX + point + "-" + type;
RedisUtil.setValue(key, value, 5 * 1000);
}
public boolean hasPointAlarm(String point, String type) {
String key = ALARM_KEY_PREFIX + point + "-" + type;
return RedisUtil.getValue(key) != null;
}
/**
* 获取虚拟计划
*
* @param planId 计划ID
* @return 虚拟计划
*/
public PdiPlanVO getVirtualPlan(Long planId) {
Object value = jsonObjectRedisTemplate.opsForHash().get(VIRTUAL_PLAN_KEY, planId.toString());
return BeanUtil.toBean(value, PdiPlanVO.class);
}
public void deleteExpireVirtualPlan() {
Set<Object> keys = jsonObjectRedisTemplate.opsForHash().keys(VIRTUAL_PLAN_KEY);
if (CollUtil.isEmpty(keys)) return;
long curr = DateUtil.yesterday().getTime();
String[] expireKeys = keys.stream().map(Object::toString).filter(string -> Long.parseLong(string) < curr).toArray(String[]::new);
if (expireKeys.length > 0) {
jsonObjectRedisTemplate.opsForHash().delete(VIRTUAL_PLAN_KEY, expireKeys);
}
}
/**
* 缓存新增虚拟计划
*
* @param plan 虚拟计划
*/
public void putVirtualPlan(PdiPlanVO plan) {
JSONObject value = JSONUtil.parseObj(plan);
String planId = plan.getId().toString();
jsonObjectRedisTemplate.opsForHash().put(VIRTUAL_PLAN_KEY, planId, value);
}
}

View File

@@ -1,10 +1,13 @@
package com.fizz.business.service.hanle;
import com.fizz.business.anno.OpcMessageHandlerType;
import com.fizz.business.constants.enums.OpcMessageType;
import com.fizz.business.domain.msg.EntryMovementMessage;
import com.fizz.business.service.OpcMessageHandler;
import org.springframework.stereotype.Component;
@Component
@OpcMessageHandlerType(OpcMessageType.ENTRY_MOVEMENT)
public class EntryMovementHandler implements OpcMessageHandler<EntryMovementMessage> {
@Override

View File

@@ -1,10 +1,13 @@
package com.fizz.business.service.hanle;
import com.fizz.business.anno.OpcMessageHandlerType;
import com.fizz.business.constants.enums.OpcMessageType;
import com.fizz.business.domain.msg.ExitCutMessage;
import com.fizz.business.service.OpcMessageHandler;
import org.springframework.stereotype.Component;
@Component
@OpcMessageHandlerType(OpcMessageType.EXIT_CUT)
public class ExitCutHandler implements OpcMessageHandler<ExitCutMessage> {
@Override

View File

@@ -1,10 +1,13 @@
package com.fizz.business.service.hanle;
import com.fizz.business.anno.OpcMessageHandlerType;
import com.fizz.business.constants.enums.OpcMessageType;
import com.fizz.business.domain.msg.ExitMeasureMessage;
import com.fizz.business.service.OpcMessageHandler;
import org.springframework.stereotype.Component;
@Component
@OpcMessageHandlerType(OpcMessageType.EXIT_MEASURE)
public class ExitMeasureHandler implements OpcMessageHandler<ExitMeasureMessage> {
@Override

View File

@@ -1,10 +1,13 @@
package com.fizz.business.service.hanle;
import com.fizz.business.anno.OpcMessageHandlerType;
import com.fizz.business.constants.enums.OpcMessageType;
import com.fizz.business.domain.msg.ExitMovementMessage;
import com.fizz.business.service.OpcMessageHandler;
import org.springframework.stereotype.Component;
@Component
@OpcMessageHandlerType(OpcMessageType.EXIT_MOVEMENT)
public class ExitMovementHandler implements OpcMessageHandler<ExitMovementMessage> {
@Override

View File

@@ -70,18 +70,6 @@ public class CrmPdiPlanServiceImpl extends ServiceImpl<CrmPdiPlanMapper, CrmPdiP
return this.baseMapper.selectOne(queryWrapper);
}
@Override
public PdiPlanSetupInfoVO getCoilInfoAndSetupList(String coilid) {
CrmPdiPlanVO byCoilIdAndOperId = this.getByCoilIdAndOperId(coilid);
PdiPlanSetupInfoVO setupInfoVO = BeanUtil.copyProperties(byCoilIdAndOperId, PdiPlanSetupInfoVO.class);
List<ModSetupResultVO> setup = modSetupResultService.getSetupByCoilid(coilid);
setupInfoVO.setLists(setup);
return setupInfoVO;
}
/**
* 添加新记录
*
@@ -126,113 +114,5 @@ public class CrmPdiPlanServiceImpl extends ServiceImpl<CrmPdiPlanMapper, CrmPdiP
return BeanUtil.copyToList(this.list(queryWrapper), CrmPdiPlanVO.class);
}
@Override
public void updateCrmPdiPlanById(ChangePlanStatusForm form) {
CrmPdiPlan crmPdiPlan = this.getById(form.getId());
if (StringUtils.compare(form.getOperation(), "READY") == 0 && StringUtils.compare(crmPdiPlan.getStatus(), "ONLINE") == 0 ) {
crmPdiPlan.setStatus("READY");
log.info("退回钢卷,matId: {}", form.getCoilId());
this.updateById(crmPdiPlan);
proMatmapService.updateMatid("");
}
if (StringUtils.compare(form.getOperation(), "ONLINE") == 0 && StringUtils.compare(crmPdiPlan.getStatus(), "PRODUCT") != 0) {
crmPdiPlan.setStatus(form.getOperation());
LocalDateTime now = LocalDateTime.now();
crmPdiPlan.setOnlineTime(now);
crmPdiPlan.setStartDate(now);
this.updateById(crmPdiPlan);
log.info("上线时通知通讯程序下发设定到L1,matId: {}", form.getCoilId());
modSetupResultService.retrySetup(form.getCoilId());
ModCoilMap bean = BeanUtil.toBean(crmPdiPlan, ModCoilMap.class);
modCoilMapService.saveModCoilInfo(bean);
proMatmapService.updateMatid(form.getCoilId());
}
}
@Override
public String editCoilInfo(CrmPdiPlanForm coilid) {
LambdaQueryWrapper<CrmPdiPlan> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(CrmPdiPlan::getCoilid, coilid.getCoilid());
CrmPdiPlan one = this.baseMapper.selectOne(queryWrapper);
if (one == null) {
CrmPdiPlan bean = BeanUtil.toBean(coilid, CrmPdiPlan.class);
bean.setStatus("NEW");
bean.setSeqid(bean.getSeqid() + 1);
this.baseMapper.insert(bean);
} else {
BeanUtil.copyProperties(coilid, one);
one.setStatus("NEW");
this.baseMapper.updateById(one);
}
CalcPdiPlanForm calcPdiPlanForm = new CalcPdiPlanForm();
List<ModSetupResultCalcForm> calcForms = BeanUtil.copyToList(coilid.getLists(), ModSetupResultCalcForm.class);
calcPdiPlanForm.setGrade(coilid.getGrade());
calcPdiPlanForm.setOperid(coilid.getOperid());
calcPdiPlanForm.setCoilid(coilid.getCoilid());
calcPdiPlanForm.setHotCoilid(coilid.getHotCoilid());
calcPdiPlanForm.setAnnealThick(coilid.getAnnealThick());
calcPdiPlanForm.setEntryWidth(coilid.getEntryWidth());
calcPdiPlanForm.setExitThick(coilid.getExitThick());
calcPdiPlanForm.setPassno(coilid.getPassno());
calcPdiPlanForm.setEntryThick(coilid.getEntryThick());
calcPdiPlanForm.setOperMode(coilid.getOperMode());
calcPdiPlanForm.setLists(calcForms);
return modSetupResultService.calcSetup(calcPdiPlanForm);
}
@Override
public String calcSetup(CalcPdiPlanForm coilid) {
return modSetupResultService.calcSetup(coilid);
}
@Override
public CrmPdiPlan getOnlineCoil() {
LambdaQueryWrapper<ProMatmap> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(ProMatmap::getL1mapidx,0);
ProMatmap one = proMatmapService.getOne(queryWrapper);
if (one == null){
return new CrmPdiPlan();
}
CrmPdiPlan byCoilId = getByCoilId(one.getMatid());
return byCoilId;
}
}

View File

@@ -0,0 +1,186 @@
package com.fizz.business.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.fizz.business.constants.enums.ExitCutTypeEnum;
import com.fizz.business.domain.PdoExcoil;
import com.fizz.business.dto.ExitCoilInfoDTO;
import com.fizz.business.dto.MatmapDTO;
import com.fizz.business.dto.PdoExCoilDTO;
import com.fizz.business.mapper.PdoExcoilMapper;
import com.fizz.business.service.PdoExCoilService;
import com.fizz.business.service.PdoStripValueService;
import com.fizz.business.service.client.PdiPlanClient;
import com.fizz.business.utils.CalcUtil;
import com.fizz.business.vo.PdiPlanVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime;
import java.util.Objects;
import static com.fizz.business.constants.enums.ExitCutTypeEnum.SPLIT_CUT;
import static com.fizz.business.constants.enums.ExitCutTypeEnum.WELDER_CUT;
import static com.fizz.business.constants.enums.HalfReturnTypeEnum.HEAD_COIL;
import static com.fizz.business.constants.enums.HalfReturnTypeEnum.TAIL_COIL;
/**
* @author chenhao
* @date 2023/05/30
*/
@Slf4j
@Service
public class PdoExCoilServiceImpl implements PdoExCoilService {
@Autowired
private PdoExcoilMapper pdoExcoilMapper;
@Autowired
private PdiPlanClient pdiPlanClient;
@Autowired
private PdoStripValueService pdoStripValueService;
@Override
@Transactional
public PdoExCoilDTO saveExCoil(ExitCoilInfoDTO exitCoil) {
PdoExCoilDTO pdoExCoilDTO = new PdoExCoilDTO();
PdiPlanVO plan = pdiPlanClient.detail(exitCoil.getPlanId());
double aimWeightTop = 1;
double aimWeightBottom = 1;
pdoExCoilDTO.setPlanOrigin(plan.getOrigin());
pdoExCoilDTO.setUnitCode(plan.getL3UnitCode());
pdoExCoilDTO.setProcessCode(plan.getProcessCode());
pdoExCoilDTO.setExitMatId(exitCoil.getExitMatId());
pdoExCoilDTO.setEntryMatId(exitCoil.getEntryMatId());
pdoExCoilDTO.setSubId(exitCoil.getSubNum());
pdoExCoilDTO.setStartPosition(exitCoil.getStartPos());
pdoExCoilDTO.setEndPosition(exitCoil.getEndPos());
pdoExCoilDTO.setPlanId(plan.getId());
pdoExCoilDTO.setPlanNo(plan.getPlanNo());
pdoExCoilDTO.setProdCode(plan.getProdCode());
pdoExCoilDTO.setSteelGrade(plan.getSteelGrade());
pdoExCoilDTO.setEntryThick(plan.getEntryThickness());
pdoExCoilDTO.setEntryWidth(plan.getEntryWidth());
pdoExCoilDTO.setEntryLength(plan.getEntryLength());
pdoExCoilDTO.setEntryWeight(plan.getEntryWeight());
pdoExCoilDTO.setActualEntryWeight(plan.getActualEntryWeight());
pdoExCoilDTO.setWeightTop(aimWeightTop);
pdoExCoilDTO.setWeightBottom(aimWeightBottom);
pdoExCoilDTO.setExitLength(exitCoil.getExitCutLength());
double exitWeight = CalcUtil.calcCoilWeight(exitCoil.getExitCutLength(), plan.getTargetThickness(), plan.getTargetWidth());
pdoExCoilDTO.setExitNetWeight(exitWeight);
pdoExCoilDTO.setActualWeight(exitWeight);
pdoExCoilDTO.setTheoryWeight(exitWeight);
double exitOuterDiameter = CalcUtil.calcOuterDiameter(exitWeight, plan.getTargetWidth(), plan.getEntryInnerDiameter());
pdoExCoilDTO.setExitOuterDiameter(exitOuterDiameter);
pdoExCoilDTO.setExitThickness(plan.getTargetThickness());
pdoExCoilDTO.setExitWidth(plan.getTargetWidth());
pdoExCoilDTO.setLastFlag(exitCoil.isLastFlag());
pdoExCoilDTO.setSeparateFlag(exitCoil.isSeparateFlag());
// 计划有子卷需要记录通知L3
if (CollUtil.isNotEmpty(plan.getSubPlanList())) {
pdoExCoilDTO.setSubPlanList(plan.getSubPlanList());
}
pdoExCoilDTO.setOnlineTime(plan.getOnlineTime());
pdoExCoilDTO.setStartTime(plan.getProducingTime());
LocalDateTime now = LocalDateTime.now();
pdoExCoilDTO.setEndTime(now);
// 获取班组信息
pdoExCoilDTO.setGroupNo("1");
pdoExCoilDTO.setShiftNo("A");
pdoExCoilDTO.setStatus("UNWEIGHT");
log.info("save pdo exit coil:{}", JSONUtil.toJsonStr(pdoExCoilDTO));
// 虚拟卷不记录产出
if (pdiPlanClient.isVirtualPlan(exitCoil.getPlanId())) {
return pdoExCoilDTO;
}
// 产出实际入库
pdoExcoilMapper.insert(pdoExCoilDTO);
// 打包segment
pdoStripValueService.treatStripValues(exitCoil);
return pdoExCoilDTO;
}
/**
* 通过计划的halfReturnType字段判断当前卷是回退的头部卷还是尾部卷
* 1. 头部卷: entryMatId=A01
* 2. 尾部卷: entryMatId=A01-2, returnMatId=A01。由于计划号+钢卷号唯一所以回退的尾部卷生成新计划时将entryMatId设置为A01-2真实的原料卷号保存在returnMatId中
* 半卷回退上报产出
* 1. 头部卷产出时原料卷号A01, 产出卷号: A01-1, 分卷标识: true, 尾卷标识: false
* 2. 尾部卷产出时原料卷号A01产出卷号: A01-2
* @param trMatmap
* @param cutType
* @return ExitCoilInfoDTO
*/
@Override
public ExitCoilInfoDTO genExitCoilInfo(MatmapDTO trMatmap, ExitCutTypeEnum cutType) {
String trCoilId = trMatmap.getMatId();
//准备的成品子卷号
//考虑依据数据库记录分卷,避免因为平台重启导致分卷丢失或错误
Long subNum = pdoExcoilMapper.selectCount(new LambdaQueryWrapper<PdoExcoil>()
.eq(PdoExcoil::getEntryMatId, trCoilId)
.eq(PdoExcoil::getPlanNo, trMatmap.getPlanNo())
.ne(PdoExcoil::getSubId, 0));
PdiPlanVO plan = pdiPlanClient.detail(trMatmap.getPlanId());
boolean halfReturnHeadCoil = Objects.equals(plan.getHalfReturnType(), HEAD_COIL.name());
boolean halfReturnTailCoil = Objects.equals(plan.getHalfReturnType(), TAIL_COIL.name());
String entryMatId = trCoilId;
String exitMatId = entryMatId;
boolean separateFlag = false;
boolean lastFlag = Objects.equals(cutType, WELDER_CUT);
// 头部卷产出时原料卷号A01, 产出卷号: A01-1, 分卷标识: true, 尾卷标识: false
if (halfReturnHeadCoil) {
entryMatId = plan.getReturnMatId();
// 如果是第一次回退,头部卷产出卷号需要手动拼接“-1”
// 多次回退时,头部卷产出卷号和入口卷号一致
if (Objects.equals(plan.getEntryMatId(), plan.getReturnMatId())) {
exitMatId = entryMatId + "-1";
}
separateFlag = true;
lastFlag = false;
}
// 尾部卷产出时原料卷号A01保存在计划的returnMatId产出卷号: A01-2
if (halfReturnTailCoil) {
entryMatId = plan.getReturnMatId();
exitMatId = plan.getEntryMatId();
separateFlag = true;
}
// 分卷处理
if (subNum != 0 || Objects.equals(cutType, SPLIT_CUT)) {
subNum = subNum + 1;
separateFlag = true;
exitMatId = exitMatId + "-" + subNum;
}
ExitCoilInfoDTO exitCoil = ExitCoilInfoDTO.builder()
.planId(plan.getId())
.entryMatId(entryMatId)
.exitMatId(exitMatId)
.separateFlag(separateFlag)
.lastFlag(lastFlag)
.subNum(Integer.parseInt(subNum.toString()))
.build();
log.info("I: generate exit cut coil info:{}", JSON.toJSONString(exitCoil));
return exitCoil;
}
@Override
public void deleteExistPdo(Long planId) {
pdoExcoilMapper.delete(new LambdaQueryWrapper<PdoExcoil>().eq(PdoExcoil::getPlanId, planId));
}
}

View File

@@ -0,0 +1,42 @@
package com.fizz.business.service.impl;
import com.alibaba.fastjson.JSON;
import com.fizz.business.domain.PdoStripvalue;
import com.fizz.business.dto.ExitCoilInfoDTO;
import com.fizz.business.mapper.PdoStripvalueMapper;
import com.fizz.business.mapper.SegmentMapper;
import com.fizz.business.service.PdoStripValueService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Objects;
/**
* @author chenhao
* @date 2023/05/30
*/
@Slf4j
@Service
public class PdoStripValueServiceImpl implements PdoStripValueService {
@Autowired
PdoStripvalueMapper pdoStripvalueMapper;
@Autowired
SegmentMapper segmentMapper;
/**
* 打包segment
* @param pdoExCoil
*/
@Override
public void treatStripValues(ExitCoilInfoDTO pdoExCoil) {
PdoStripvalue stripvalue = segmentMapper.getStripValue(pdoExCoil.getEntryMatId(), pdoExCoil.getStartPos(), pdoExCoil.getEndPos());
if (Objects.isNull(stripvalue)) {
log.warn("W: strip value is null, {}", JSON.toJSONString(pdoExCoil));
return;
}
stripvalue.setExitMatId(pdoExCoil.getExitMatId());
pdoStripvalueMapper.insert(stripvalue);
}
}

View File

@@ -1,12 +1,16 @@
package com.fizz.business.service.impl;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fizz.business.domain.ProMatmap;
import com.fizz.business.dto.MatmapDTO;
import com.fizz.business.mapper.ProMatmapMapper;
import com.fizz.business.service.ProMatmapService;
import com.fizz.business.utils.MatmapUtil;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
@Service
public class ProMatmapServiceImpl extends ServiceImpl<ProMatmapMapper, ProMatmap> implements ProMatmapService {
@@ -20,4 +24,16 @@ public class ProMatmapServiceImpl extends ServiceImpl<ProMatmapMapper, ProMatmap
proMatmapMapper.updateMatidByDisplayName(matid);
}
/**
* 刷新matmap表
*/
@Override
public void flushMatmap() {
List<MatmapDTO> list = MatmapUtil.getMatmapList();
if (CollUtil.isEmpty(list)) return;
proMatmapMapper.flushMatmap(list);
}
}

View File

@@ -1,23 +1,41 @@
package com.fizz.business.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.NumberUtil;
import com.alibaba.fastjson.JSON;
import com.fizz.business.domain.CrmPdiPlan;
import com.fizz.business.domain.CrmPdoExcoil;
import com.fizz.business.domain.ProMatmap;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.fizz.business.constants.enums.DeviceEnum;
import com.fizz.business.constants.enums.PlanStatusEnum;
import com.fizz.business.constants.enums.WebOperateMatEnum;
import com.fizz.business.domain.DeviceDefine;
import com.fizz.business.domain.HalfReturn;
import com.fizz.business.dto.CoilHeadDTO;
import com.fizz.business.dto.CoilPositionDTO;
import com.fizz.business.dto.MatmapDTO;
import com.fizz.business.form.AdjustPosForm;
import com.fizz.business.form.L1OperateMatForm;
import com.fizz.business.form.WebOperateMatForm;
import com.fizz.business.mapper.CrmPdiPlanMapper;
import com.fizz.business.service.CrmPdoExcoilService;
import com.fizz.business.service.ProMatmapService;
import com.fizz.business.mapper.HalfReturnMapper;
import com.fizz.business.mapper.SegmentMapper;
import com.fizz.business.service.TrackService;
import com.fizz.business.service.client.LocalCacheManager;
import com.fizz.business.service.client.PdiPlanClient;
import com.fizz.business.service.client.RedisCacheManager;
import com.fizz.business.utils.CalcUtil;
import com.fizz.business.vo.Plan2PdoVO;
import com.ruoyi.common.utils.StringUtils;
import com.fizz.business.utils.CoilMeasUtil;
import com.fizz.business.utils.MatmapUtil;
import com.fizz.business.utils.WebSocketUtil;
import com.fizz.business.vo.HalfReturnInfoVO;
import com.fizz.business.vo.PdiPlanVO;
import com.fizz.business.vo.ReturnInfoVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Objects;
import static com.fizz.business.constants.enums.WebOperateMatEnum.*;
/**
@@ -28,63 +46,221 @@ import java.time.LocalDateTime;
@Service
public class TrackServiceImpl implements TrackService {
@Resource
CrmPdiPlanMapper crmPdiPlanMapper;
@Resource
ProMatmapService proMatmapService;
@Resource
CrmPdoExcoilService crmPdoExcoilService;
@Autowired
RedisCacheManager redisCacheManager;
@Autowired
SegmentMapper segmentMapper;
@Autowired
PdiPlanClient pdiPlanClient;
@Override
public void operateMatWeb(WebOperateMatForm form) {
public void webOperateMat(WebOperateMatForm form) {
log.info("unitCode:{}, hand operate mat by Web: {}", form.getPlanNo(), JSON.toJSONString(form));
log.info("web operate mat: {}", JSON.toJSONString(form));
form.getOperation().operate(form);
}
@Override
public void trUnload(WebOperateMatForm form) {
if (StringUtils.compare(form.getOperation().getValue(),"PRODUCT") != 0) {
public void l1OperateMat(L1OperateMatForm form) {
log.info("l1 operate mat: {}", JSON.toJSONString(form));
form.getOperation().operate(form);
}
@Override
public ReturnInfoVO getReturnInfo(int posIdx) {
MatmapDTO matmap = MatmapUtil.getMatmap(posIdx);
if (MatmapUtil.notReady(matmap)) {
}
PdiPlanVO planVO = pdiPlanClient.detail(matmap.getPlanId());
String returnType = null;
double returnWt = 0;
if (Objects.equals(planVO.getStatus(), PlanStatusEnum.PRODUCING.name())) {
double coiledLength = redisCacheManager.getStripLocation();
double calcCoilWeight = CalcUtil.calcCoilWeight(coiledLength, planVO.getEntryThickness(), planVO.getEntryWidth());
returnWt = planVO.getEntryWeight() - calcCoilWeight;
returnType = HALF_RETURN.name();
} else if (Objects.equals(planVO.getStatus(), PlanStatusEnum.ONLINE.name())) {
returnWt = planVO.getEntryWeight();
returnType = ALL_RETURN.name();
} else {
log.error("invalid plan status[{}], planId={}", planVO.getStatus(), planVO.getId());
}
return ReturnInfoVO.builder()
.returnWeight(NumberUtil.round(returnWt, 3).doubleValue())
.returnType(returnType)
.entryMatId(planVO.getEntryMatId())
.planId(planVO.getId())
.planNo(planVO.getPlanNo())
.build();
}
/**
* 获取半卷回退的钢卷号
*
* @param entryMatId
* @return
*/
@Override
public HalfReturnInfoVO getHalfReturnMatId(Long planId, String entryMatId) {
PdiPlanVO plan = pdiPlanClient.detail(planId);
String returnMatId = entryMatId;
HalfReturnMapper returnMapper = BeanFactory.getBean(HalfReturnMapper.class);
// 多次回退
if (Objects.equals(plan.getReturnType(), HALF_RETURN.name())) {
entryMatId = plan.getReturnMatId();
LambdaQueryWrapper<HalfReturn> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(HalfReturn::getEntryMatId, entryMatId);
queryWrapper.eq(HalfReturn::getPlanNo, plan.getPlanNo());
queryWrapper.eq(HalfReturn::getReturnType, HALF_RETURN.name());
queryWrapper.orderByDesc(HalfReturn::getId);
queryWrapper.last("limit 1");
HalfReturn halfReturn = returnMapper.selectOne(queryWrapper);
if (Objects.nonNull(halfReturn)) {
String exitMatId = halfReturn.getExitMatId();
int lastIndex = exitMatId.lastIndexOf("-");
if (lastIndex != -1 && lastIndex < exitMatId.length() - 1) {
String numberStr = exitMatId.substring(lastIndex + 1);
int number = Integer.parseInt(numberStr) + 1;
returnMatId = exitMatId.substring(0, lastIndex + 1) + number;
}
}
}
// 第一次回退,需要将头部卷与尾部卷都记录到回退表中
else {
returnMatId = entryMatId + "-2";
}
return HalfReturnInfoVO.builder().returnMatId(returnMatId).build();
}
/**
* 调整钢卷位置
* 更新matmap
* 更新焊缝位置
*
* @param form
*/
@Override
public void adjustPosition(AdjustPosForm form) {
DeviceDefine targetDevice = LocalCacheManager.DEVICE_DEFINE_MAP.get(form.getTargetPos().name());
Assert.notNull(targetDevice, "目标位置设备不存在");
DeviceDefine currentDevice = LocalCacheManager.DEVICE_DEFINE_MAP.get(form.getCurrentPos().name());
Assert.notNull(currentDevice, "当前位置设备不存在");
// 更新matmap
refreshMatmap(targetDevice, currentDevice, form);
WebSocketUtil.sendMatmapMsg();
}
private boolean pass(Integer startPos, Integer endPos, Integer currPos) {
// 跳过2#开卷机
if (Objects.equals(startPos, DeviceEnum.POR1.getIdx())
&& Objects.equals(currPos, DeviceEnum.POR2.getIdx())) {
return true;
}
// 不修改开卷机的卷号
if (CoilMeasUtil.getPorIdxList().contains(endPos)) {
return true;
}
// 多个卷取机需要跳过1#卷取机
if (Objects.equals(endPos, DeviceEnum.TR2.getIdx())
&& Objects.equals(currPos, DeviceEnum.TR1.getIdx())) {
return true;
}
return false;
}
private void refreshMatmap(DeviceDefine targetDevice, DeviceDefine currDevice, AdjustPosForm form) {
Integer targetPosIdx = targetDevice.getPosIdx();
Integer currPosIdx = currDevice.getPosIdx();
MatmapDTO target = MatmapUtil.getMatmap(targetPosIdx);
MatmapDTO curr = MatmapUtil.getMatmap(currPosIdx);
if (Objects.equals(curr.getMatId(), target.getMatId())) {
return;
}
this.operateMatWeb(form);
CrmPdiPlan pdiPlan = crmPdiPlanMapper.selectById(form.getId());
pdiPlan.setEndDate(LocalDateTime.now());
if (targetPosIdx < currPosIdx) {
// 目标位置小于当前位置,回退
// 设置目标位置->当前位置的matmap
for (int idx = targetPosIdx; idx <= currPosIdx; idx++) {
if (pass(targetPosIdx, currPosIdx, idx)) continue;
MatmapUtil.setMatmap(idx, curr.getMatId(), curr.getPlanId(), curr.getPlanNo());
}
pdiPlan.setStatus("PRODUCT");
crmPdiPlanMapper.updateById(pdiPlan);
// 从卷取机回退需要移除prevHead并创建currHead
// if (CoilMeasUtil.getTrIdxList().contains(currPosIdx)) {
// CoilHeadDTO head = new CoilHeadDTO();
// head.setMatId(form.getMatId());
// head.setPlanNo(form.getPlanNo());
// head.setPlanId(form.getPlanId());
// head.setPosIdx(targetPosIdx);
// redisCacheManager.removePrevAndMergeHead();
// // 设置当前带头长度为焊缝距离
// head.setPos(redisCacheManager.getStripLocation());
// redisCacheManager.addHead(head);
// log.info("add curr head: {}", JSON.toJSONString(head));
// }
} else if (targetPosIdx > currPosIdx) {
// 目标位置大于当前位置,前进
// 设置当前位置->目标位置的matmap
for (int idx = currPosIdx; idx <= targetPosIdx; idx++) {
if (pass(currPosIdx, targetPosIdx, idx)) continue;
MatmapUtil.setMatmap(idx, curr.getMatId(), curr.getPlanId(), curr.getPlanNo());
}
Plan2PdoVO bean = BeanUtil.toBean(pdiPlan, Plan2PdoVO.class);
CrmPdoExcoil excoil = BeanUtil.toBean(bean, CrmPdoExcoil.class);
CrmPdoExcoil operId = crmPdoExcoilService.getByExcoilIdAndOperId(excoil.getExitCoilid(), excoil.getOperid());
if (operId == null){
double calcCoilWeight = CalcUtil.calcCoilWeight(excoil.getExitLength(), excoil.getEntryThick(), excoil.getEntryWidth());
excoil.setEncoilid(bean.getCoilid());
excoil.setExitCoilid(bean.getCoilid());
excoil.setCalcExitWeight(calcCoilWeight);
excoil.setMeasExitWeight(calcCoilWeight);
excoil.setHeadpos(0d);
excoil.setTailpos(excoil.getExitLength());
excoil.setSubid(1);
excoil.setOuterDiameter(Double.valueOf(bean.getEntryOuterDiameter()));
excoil.setStatus("PRODUCT");
excoil.setOnlineDate(pdiPlan.getOnlineTime());
excoil.setStartDate(pdiPlan.getStartDate());
excoil.setEndDate(pdiPlan.getEndDate());
crmPdoExcoilService.addCrmPdoExcoil(excoil);
proMatmapService.updateMatid("");
// 从开卷机前进
// 移动到卷取机-->创建prevHead
// 移动到中间-->创建currHead
// 计划状态变更为PRODUCING
if (CoilMeasUtil.getPorIdxList().contains(currPosIdx)) {
CoilHeadDTO head = new CoilHeadDTO();
head.setMatId(curr.getMatId());
head.setPlanNo(curr.getPlanNo());
head.setPlanId(curr.getPlanId());
head.setPosIdx(targetPosIdx);
head.setPorIdx(currPosIdx);
// 移动到卷取机需要创建prevHead
if (CoilMeasUtil.getTrIdxList().contains(targetPosIdx)) {
head.setPos(888);
redisCacheManager.setPrevHead(head);
}
// 移动到中间时需要创建currHead
else {
// 设置当前带头长度为焊缝距离
head.setPos(redisCacheManager.getStripLocation());
redisCacheManager.removeHead(target.getMatId());
redisCacheManager.addHead(head);
}
// 判断当前计划状态如果是ONLINE需要变更为PRODUCING
PdiPlanVO plan = pdiPlanClient.detail(curr.getPlanId());
if (Objects.equals(plan.getStatus(), ONLINE.name())) {
webOperateMat(WebOperateMatForm.builder()
.operation(WebOperateMatEnum.PRODUCING)
.entryMatId(curr.getMatId())
.planId(curr.getPlanId())
.planNo(curr.getPlanNo())
.build());
}
}
}
}
@Override
public CoilPositionDTO getCoilPosition() {
CoilPositionDTO position = redisCacheManager.getCoilPosition();
List<MatmapDTO> matmapList = redisCacheManager.getMatmapList();
position.setMatMapList(matmapList);
return position;
}

View File

@@ -1,8 +1,9 @@
package com.fizz.business.utils;
import cn.hutool.core.util.NumberUtil;
import com.fizz.business.constants.CommonConstants;
import static com.fizz.business.constants.CommonConstants.RO;
/**
* @author chenhao
@@ -19,7 +20,7 @@ public class CalcUtil {
* @return 长度[m]
*/
public static double calcCoilLength(double weight, double thick, double width) {
double v = weight / (thick * width * CommonConstants.RO) * 1000 * 1000;
double v = weight / (thick * width * RO) * 1000 * 1000;
return NumberUtil.round(v, 0).doubleValue();
}
@@ -32,7 +33,7 @@ public class CalcUtil {
* @return 重量[T]
*/
public static double calcCoilWeight(double length, double thick, double width) {
double v = thick * width * length * CommonConstants.RO / (1000 * 1000);
double v = thick * width * length * RO / (1000 * 1000);
return NumberUtil.round(v, 3).doubleValue();
}
@@ -46,8 +47,21 @@ public class CalcUtil {
*/
public static double calcOuterDiameter(double weight, double width, double innerDiameter) {
double innerRadius = (innerDiameter / 1000) / 2;
double v = 2 * Math.sqrt(((weight * 1000) / (width * CommonConstants.RO) + Math.PI * Math.pow(innerRadius, 2)) / Math.PI) * 1000;
double v = 2 * Math.sqrt(((weight * 1000) / (width * RO) + Math.PI * Math.pow(innerRadius, 2)) / Math.PI) * 1000;
return NumberUtil.round(v, 0).doubleValue();
}
public static void main(String[] args) {
// 6882.0m
double length = CalcUtil.calcCoilLength(15, 0.27, 1027);
System.out.println(length);
// 15.0T
double weight = CalcUtil.calcCoilWeight(6882, 0.27, 1027);
System.out.println(weight);
// 1620.0mm
double diameter1 = CalcUtil.calcOuterDiameter(15, 1027, 508);
System.out.println(diameter1);
}
}

View File

@@ -0,0 +1,239 @@
package com.fizz.business.utils;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import com.alibaba.fastjson.JSON;
import com.fizz.business.constants.enums.DeviceEnum;
import com.fizz.business.domain.DeviceDefine;
import com.fizz.business.dto.*;
import com.fizz.business.service.client.RedisCacheManager;
import com.fizz.business.service.impl.BeanFactory;
import com.google.common.collect.Lists;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import java.util.*;
import java.util.stream.Collectors;
import static com.fizz.business.constants.CommonConstants.CoilMeasure.BEFORE_TR_IDX;
import static com.fizz.business.service.client.LocalCacheManager.DEVICE_DEFINE_MAP;
/**
* @author chenhao
* @date 2023/05/25
*/
@Slf4j
@Component
public class CoilMeasUtil {
public static Integer getPorIdx(Integer porCode) {
if (Objects.isNull(porCode)) {
return null;
}
Integer porIdx = null;
if (porCode == 1) {
porIdx = DeviceEnum.POR1.getIdx();
} else if (porCode == 2) {
porIdx = DeviceEnum.POR2.getIdx();
} else {
log.warn("W: invalid working POR, porCode={}", porCode);
}
return porIdx;
}
public static Integer getAnotherPorIdx(Integer porCode) {
if (Objects.isNull(porCode)) {
return null;
}
Integer porIdx = null;
if (porCode == 1) {
porIdx = DeviceEnum.POR2.getIdx();
} else if (porCode == 2) {
porIdx = DeviceEnum.POR1.getIdx();
} else {
log.warn("W: invalid working POR, porCode={}", porCode);
}
return porIdx;
}
public static Integer getTrIdx(Integer trCode) {
if (Objects.isNull(trCode)) {
return null;
}
Integer trIdx = null;
if (trCode == 1) {
trIdx = DeviceEnum.TR1.getIdx();
} else if (trCode == 2) {
trIdx = DeviceEnum.TR2.getIdx();
} else {
log.warn("W: invalid working TR, trCode={}", trCode);
}
return trIdx;
}
public static List<Integer> getPorIdxList() {
return Lists.newArrayList(DeviceEnum.POR1.getIdx(), DeviceEnum.POR2.getIdx());
}
public static List<Integer> getTrIdxList() {
return Lists.newArrayList(DeviceEnum.TR1.getIdx(), DeviceEnum.TR2.getIdx());
}
/**
* 获取卷取机前一个设备idx
*
* @return
*/
public static int getBeforeTrIdx() {
return BEFORE_TR_IDX.getIdx();
}
public static double initStripLocation(double stripLocation) {
if (stripLocation < 0) {
stripLocation = 0;
} else if (stripLocation > 25000) {
stripLocation = 25000;
}
return stripLocation;
}
public static DeviceDefine matchDevice(double posLen, double entryLoopLen, double exitLoopLen) {
DeviceDefine mCEL = DEVICE_DEFINE_MAP.get(DeviceEnum.CEL.name()); // 入口活套
DeviceDefine mCXL = DEVICE_DEFINE_MAP.get(DeviceEnum.CXL.name()); // 出口活套
for (DeviceDefine device : DEVICE_DEFINE_MAP.values()) {
Double start = device.getPositionLengthStart();
Double end = device.getPositionLengthEnd();
// 入口活套之后的设备需要加上entryLoopLen
if (device.getPosIdx() >= mCEL.getPosIdx()) {
// start = NumberUtil.add(start, entryLoopLen);
end = NumberUtil.add(end, entryLoopLen);
}
// 出口活套之后的设备还需要加上exitLoopLen
if (device.getPosIdx() >= mCXL.getPosIdx()) {
// start = NumberUtil.add(start, exitLoopLen);
end = NumberUtil.add(end, exitLoopLen);
}
if (posLen >= start && posLen < end) {
return device;
}
}
return null;
}
public static CoilPositionDTO buildCoilPos(L1CoilLineMeasureDTO measureDTO, List<CoilHeadDTO> headList) {
List<CoilPositionDTO.CoilStripLocation> coilStripLocationList = Lists.newArrayList();
Integer workPor = measureDTO.getWorkPor();
Integer workTr = measureDTO.getWorkTr();
CoilHeadDTO prevHead = BeanFactory.getBean(RedisCacheManager.class).getPrevHead();
if (Objects.nonNull(prevHead)) {
coilStripLocationList.add(
CoilPositionDTO.CoilStripLocation.builder()
.matId(prevHead.getMatId())
.planId(prevHead.getPlanId())
.planNo(prevHead.getPlanNo())
.porId(prevHead.getPorIdx())
.stripLocation(99999).build());
}
headList.forEach(head -> coilStripLocationList.add(
CoilPositionDTO.CoilStripLocation.builder()
.matId(head.getMatId())
.planId(head.getPlanId())
.planNo(head.getPlanNo())
.porId(head.getPorIdx())
.stripLocation(head.getPos()).build()));
// 两个开卷机时,需要设置另一个未运行的开卷机上的钢卷数据
Integer anotherPorIdx = getAnotherPorIdx(workPor);
if (Objects.nonNull(anotherPorIdx)) {
MatmapDTO matmap = MatmapUtil.getMatmap(anotherPorIdx);
coilStripLocationList.add(
CoilPositionDTO.CoilStripLocation.builder()
.matId(matmap.getMatId())
.planId(matmap.getPlanId())
.planNo(matmap.getPlanNo())
.porId(anotherPorIdx)
.stripLocation(0).build());
}
// 当前开卷机与焊机的卷号不同时,需要设置当前开卷机上的钢卷数据(这种情况只出现在只有一个开卷机运行的时候)
Integer porIdx = CoilMeasUtil.getPorIdx(workPor);
MatmapDTO welderCoil = MatmapUtil.getMatmap(DeviceEnum.WELDER.getIdx());
if (Objects.nonNull(porIdx) && MatmapUtil.already(welderCoil)) {
MatmapDTO porCoil = MatmapUtil.getMatmap(porIdx);
if (!Objects.equals(welderCoil.getMatId(), porCoil.getMatId())) {
coilStripLocationList.add(
CoilPositionDTO.CoilStripLocation.builder()
.matId(porCoil.getMatId())
.planId(porCoil.getPlanId())
.planNo(porCoil.getPlanNo())
.porId(porIdx)
.stripLocation(0).build());
}
}
return CoilPositionDTO.builder()
.coilStripLocationList(coilStripLocationList)
.entryLoopLen(measureDTO.getEntryLoopLength())
.exitLoopLen(measureDTO.getExitLoopLength())
.entryLoopPer(measureDTO.getEntryLoopPercent())
.exitLoopLPer(measureDTO.getExitLoopPercent())
.entrySpeed(measureDTO.getInSpeed())
.technologySpeed(measureDTO.getUnitSpeed())
.exitSpeed(measureDTO.getOutSpeed())
.porId(CoilMeasUtil.getPorIdx(workPor))
.trId(CoilMeasUtil.getTrIdx(workTr))
.build();
}
public static double getPorSpeed(L1CoilLineMeasureDTO measureDTO) {
return measureDTO.getUnitSpeed();
}
// public static List<String> getParamKey(String deviceName) {
// List<PointConfigDTO> list = DEVICE_PARAM_MAP.get(deviceName);
// if (CollUtil.isEmpty(list)) {
// return Collections.emptyList();
// }
// return list.stream().map(PointConfigDTO::getParam).collect(Collectors.toList());
// }
//
// public static String getParamKey(String deviceName, String paramDesc) {
// List<PointConfigDTO> list = DEVICE_PARAM_MAP.get(deviceName);
// if (CollUtil.isEmpty(list)) {
// return null;
// }
// List<String> keys = list.stream()
// .filter(p -> paramDesc.equals(p.getDesc()))
// .map(PointConfigDTO::getParam)
// .collect(Collectors.toList());
// if (CollUtil.isEmpty(keys)) {
// return null;
// }
// return keys.get(0);
// }
// public static List<String> getParamDesc(String deviceName) {
// List<PointConfigDTO> list = DEVICE_PARAM_MAP.get(deviceName);
// if (CollUtil.isEmpty(list)) {
// return Collections.emptyList();
// }
// return list.stream().map(PointConfigDTO::getDesc).collect(Collectors.toList());
// }
//
// public static LinkedHashMap<String, String> getParamMap(String deviceName) {
// List<PointConfigDTO> list = DEVICE_PARAM_MAP.get(deviceName);
// if (CollUtil.isEmpty(list)) {
// return Maps.newLinkedHashMap();
// }
//
// return list.stream().collect(Collectors.toMap(PointConfigDTO::getParam, PointConfigDTO::getDesc, (k1, k2) -> k1, LinkedHashMap::new));
// }
}

View File

@@ -0,0 +1,194 @@
package com.fizz.business.utils;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
* @author chenhao
* @date 2023/8/22
*/
public class DateSplitUtil {
public enum IntervalType {
DAY,
HOUR,
MINUTE,
SECOND,
;
}
/**
* 时间切割
* @param startTime 被切割的开始时间
* @param endTime 被切割的结束时间
* @param intervalType
* @param interval >0
* @return
*/
public static List<DateSplit> splitDate(LocalDateTime startTime, LocalDateTime endTime, IntervalType intervalType, int interval) {
if (interval < 0) {
return Collections.emptyList();
}
if (startTime.isAfter(endTime)) {
return Collections.emptyList();
}
if (intervalType == IntervalType.DAY) {
return splitByDay(startTime, endTime, interval);
}
if (intervalType == IntervalType.HOUR) {
return splitByHour(startTime, endTime, interval);
}
if (intervalType == IntervalType.MINUTE) {
return splitByMinute(startTime, endTime, interval);
}
if (intervalType == IntervalType.SECOND) {
return splitBySecond(startTime, endTime, interval);
}
return Collections.emptyList();
}
/**
* 按照小时切割时间区间
*/
public static List<DateSplit> splitByHour(LocalDateTime startTime, LocalDateTime endTime, int intervalHours) {
if (startTime.isAfter(endTime)) {
return Collections.emptyList();
}
List<DateSplit> dateSplits = new ArrayList<>(256);
DateSplit param = new DateSplit();
do {
LocalDateTime tempEndTime = startTime.plusHours(intervalHours);
if (tempEndTime.isAfter(endTime)) {
tempEndTime = endTime;
}
param.setStartTime(startTime);
param.setEndTime(tempEndTime);
dateSplits.add(new DateSplit(param.getStartTime(), param.getEndTime()));
startTime = tempEndTime;
} while (!startTime.isEqual(endTime));
return dateSplits;
}
/**
* 按照秒切割时间区间
*/
public static List<DateSplit> splitBySecond(LocalDateTime startTime, LocalDateTime endTime, int intervalSeconds) {
if (startTime.isAfter(endTime)) {
return Collections.emptyList();
}
List<DateSplit> dateSplits = new ArrayList<>(256);
DateSplit param = new DateSplit();
do {
LocalDateTime tempEndTime = startTime.plusSeconds(intervalSeconds);
if (tempEndTime.isAfter(endTime)) {
tempEndTime = endTime;
}
param.setStartTime(startTime);
param.setEndTime(tempEndTime);
dateSplits.add(new DateSplit(param.getStartTime(), param.getEndTime()));
startTime = tempEndTime;
} while (!startTime.isEqual(endTime));
return dateSplits;
}
/**
* 按照天切割时间区间
*/
public static List<DateSplit> splitByDay(LocalDateTime startTime, LocalDateTime endTime, int intervalDays) {
if (startTime.isAfter(endTime)) {
return Collections.emptyList();
}
List<DateSplit> dateSplits = new ArrayList<>(256);
DateSplit param = new DateSplit();
do {
LocalDateTime tempEndTime = startTime.plusDays(intervalDays);
if (tempEndTime.isAfter(endTime)) {
tempEndTime = endTime;
}
param.setStartTime(startTime);
param.setEndTime(tempEndTime);
dateSplits.add(new DateSplit(param.getStartTime(), param.getEndTime()));
startTime = tempEndTime;
} while (!startTime.isEqual(endTime));
return dateSplits;
}
/**
* 按照分钟切割时间区间
*
* @param startTime
* @param endTime
* @param intervalMinutes
* @return
*/
public static List<DateSplit> splitByMinute(LocalDateTime startTime, LocalDateTime endTime, int intervalMinutes) {
if (startTime.isAfter(endTime)) {
return Collections.emptyList();
}
List<DateSplit> dateSplits = new ArrayList<>(256);
DateSplit param = new DateSplit();
do {
LocalDateTime tempEndTime = startTime.plusMinutes(intervalMinutes);
if (tempEndTime.isAfter(endTime)) {
tempEndTime = endTime;
}
param.setStartTime(startTime);
param.setEndTime(tempEndTime);
dateSplits.add(new DateSplit(param.getStartTime(), param.getEndTime()));
startTime = tempEndTime;
} while (!startTime.isEqual(endTime));
return dateSplits;
}
public static long toMillSeconds(LocalDateTime dateTime) {
return dateTime.toInstant(ZoneOffset.of("+8")).toEpochMilli();
}
@Data
@AllArgsConstructor
@NoArgsConstructor
public static class DateSplit {
private LocalDateTime startTime;
private LocalDateTime endTime;
}
public static void main(String[] args) {
LocalDateTime a = LocalDateTime.of(2023, 6, 30, 12, 0);
LocalDateTime b = LocalDateTime.of(2023, 7, 1, 11, 44);
System.out.println(splitDate(a, b, IntervalType.DAY, 1));
System.out.println(splitDate(a, b, IntervalType.HOUR, 1));
System.out.println(splitDate(a, b, IntervalType.MINUTE, 15));
System.out.println(splitDate(a, b, IntervalType.SECOND, 90));
List<DateSplit> dateSplits = splitDate(a, b, IntervalType.MINUTE, 15);
dateSplits.forEach(d -> {
long start = toMillSeconds(d.getStartTime());
long end= toMillSeconds(d.getEndTime());
System.out.println(start + "-" + end);
});
System.out.println(LocalDateTime.now().plusHours(-24));
}
}

View File

@@ -0,0 +1,108 @@
package com.fizz.business.utils;
import com.fizz.business.constants.enums.ExceptionCodeEnum;
import org.springframework.stereotype.Component;
/**
* Global business exception class for error data handling
*/
@Component
public class ErrorDataException extends RuntimeException {
private final ExceptionCodeEnum codeEnum;
private Object errorData;
// ================ Basic Constructors ================
public ErrorDataException() {
super(ExceptionCodeEnum.ERROR.getMessage());
this.codeEnum = ExceptionCodeEnum.ERROR;
}
public ErrorDataException(String message) {
super(message);
this.codeEnum = ExceptionCodeEnum.ERROR;
}
public ErrorDataException(Throwable cause) {
super(ExceptionCodeEnum.ERROR.getMessage(), cause);
this.codeEnum = ExceptionCodeEnum.ERROR;
}
public ErrorDataException(String message, Throwable cause) {
super(message, cause);
this.codeEnum = ExceptionCodeEnum.ERROR;
}
// ================ Full Feature Constructors ================
public ErrorDataException(ExceptionCodeEnum codeEnum) {
super(codeEnum.getMessage());
this.codeEnum = codeEnum;
}
public ErrorDataException(ExceptionCodeEnum codeEnum, String extendMessage) {
super(combineMessage(codeEnum, extendMessage));
this.codeEnum = codeEnum;
}
public ErrorDataException(ExceptionCodeEnum codeEnum, Throwable cause) {
super(codeEnum.getMessage(), cause);
this.codeEnum = codeEnum;
}
public ErrorDataException(ExceptionCodeEnum codeEnum, String extendMessage, Throwable cause) {
super(combineMessage(codeEnum, extendMessage), cause);
this.codeEnum = codeEnum;
}
// ================ With Error Data Constructors ================
public ErrorDataException(ExceptionCodeEnum codeEnum, Object errorData) {
super(codeEnum.getMessage());
this.codeEnum = codeEnum;
this.errorData = errorData;
}
public ErrorDataException(ExceptionCodeEnum codeEnum, String extendMessage, Object errorData) {
super(combineMessage(codeEnum, extendMessage));
this.codeEnum = codeEnum;
this.errorData = errorData;
}
public ErrorDataException(ExceptionCodeEnum codeEnum, Throwable cause, Object errorData) {
super(codeEnum.getMessage(), cause);
this.codeEnum = codeEnum;
this.errorData = errorData;
}
public ErrorDataException(ExceptionCodeEnum codeEnum, String extendMessage, Throwable cause, Object errorData) {
super(combineMessage(codeEnum, extendMessage), cause);
this.codeEnum = codeEnum;
this.errorData = errorData;
}
// ================ Helper Methods ================
private static String combineMessage(ExceptionCodeEnum codeEnum, String extendMessage) {
return String.format("%s: %s", codeEnum.getMessage(), extendMessage);
}
// ================ Getters ================
public ExceptionCodeEnum getCodeEnum() {
return codeEnum;
}
public Object getErrorData() {
return errorData;
}
// ================ Override Methods ================
@Override
public String toString() {
return String.format("ErrorDataException{code=%s, message='%s', errorData=%s}",
codeEnum.getCode(), getMessage(), errorData);
}
}

View File

@@ -0,0 +1,131 @@
package com.fizz.business.utils;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.fizz.business.domain.ProMatmap;
import com.fizz.business.dto.MatmapDTO;
import com.fizz.business.mapper.ProMatmapMapper;
import com.fizz.business.service.client.RedisCacheManager;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
/**
* matmap数据操作封装
*
* @author chenhao
* @date 2023/05/25
*/
@Slf4j
@Component
public class MatmapUtil {
private static ProMatmapMapper romtbMatmapMapper;
private static RedisCacheManager redisCacheManager;
@Autowired
public void setRomtbMatmapMapper(ProMatmapMapper romtbMatmapMapper) {
MatmapUtil.romtbMatmapMapper = romtbMatmapMapper;
}
@Autowired
public void setRedisCacheManage(RedisCacheManager redisCacheManager) {
MatmapUtil.redisCacheManager = redisCacheManager;
}
@PostConstruct
public static void init() {
redisCacheManager.setMatmapList(getRomtbMatmap());
log.info("#################load matmap from db#################");
}
private static List<MatmapDTO> getRomtbMatmap() {
LambdaQueryWrapper<ProMatmap> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.orderByAsc(ProMatmap::getPosIdx);
List<ProMatmap> list = romtbMatmapMapper.selectList(queryWrapper);
return list.stream().map(m -> BeanUtil.toBean(m, MatmapDTO.class)).collect(Collectors.toList());
}
public static boolean notReady(MatmapDTO matmap) {
return Objects.isNull(matmap) || StrUtil.isBlank(matmap.getMatId());
}
public static boolean already(MatmapDTO matmap) {
return Objects.nonNull(matmap) && StrUtil.isNotBlank(matmap.getMatId());
}
public static void setMatId(int index, String matId) {
MatmapDTO matmap = getMatmap(index);
if (ObjectUtil.isNull(matmap)) {
return;
}
matmap.setPosIdx(index);
matmap.setMatId(matId);
redisCacheManager.setMatmap(index, matmap);
}
public static String getMatId(int index) {
MatmapDTO matmap = getMatmap(index);
if (MatmapUtil.notReady(matmap)) return null;
return matmap.getMatId();
}
public static void clearMatmap(int index) {
MatmapDTO matmap = getMatmap(index);
if (ObjectUtil.isNull(matmap)) {
return;
}
matmap.setMatId(null);
matmap.setPlanId(null);
matmap.setPlanNo(null);
redisCacheManager.setMatmap(index, matmap);
}
public static void setMatmap(int index, String matId, Long planId, String planNo) {
MatmapDTO matmap = getMatmap(index);
if (ObjectUtil.isNull(matmap)) {
return;
}
matmap.setPosIdx(index);
matmap.setMatId(matId);
matmap.setPlanId(planId);
matmap.setPlanNo(planNo);
redisCacheManager.setMatmap(index, matmap);
}
public static MatmapDTO getMatmap(int index) {
MatmapDTO matmap = redisCacheManager.getMatmap(index);
if (Objects.isNull(matmap)) {
init();
}
return redisCacheManager.getMatmap(index);
}
public static List<MatmapDTO> getMatmapList() {
List<MatmapDTO> matmapList = redisCacheManager.getMatmapList();
if (CollUtil.isEmpty(matmapList)) {
init();
}
return redisCacheManager.getMatmapList();
}
public static void clearMatmapByMatId(String matId) {
List<MatmapDTO> matmapList = getMatmapList();
for (MatmapDTO matmap : matmapList) {
if (Objects.nonNull(matmap) && Objects.equals(matmap.getMatId(), matId)) {
matmap.setMatId(null);
matmap.setPlanId(null);
matmap.setPlanNo(null);
}
}
redisCacheManager.setMatmapList(matmapList);
}
}

View File

@@ -0,0 +1,118 @@
package com.fizz.business.utils;
import org.springframework.stereotype.Component;
import java.math.BigDecimal;
import java.util.List;
import java.util.stream.Collectors;
@Component
public class NumberUtil {
public static double add(double number1, double number2) {
BigDecimal bignum1 = new BigDecimal(String.valueOf(number1));
BigDecimal bignum2 = new BigDecimal(String.valueOf(number2));
BigDecimal bignum3 = bignum1.add(bignum2);
double result = bignum3.doubleValue();
return result;
}
public static BigDecimal add(BigDecimal number1, BigDecimal number2) {
BigDecimal result = number1.add(number2);
return result;
}
public static double subtract(double number1, double number2) {
BigDecimal bignum1 = new BigDecimal(String.valueOf(number1));
BigDecimal bignum2 = new BigDecimal(String.valueOf(number2));
BigDecimal bignum3 = bignum1.subtract(bignum2);
double result = bignum3.doubleValue();
return result;
}
public static BigDecimal subtract(BigDecimal number1, BigDecimal number2) {
BigDecimal result = number1.subtract(number2);
return result;
}
public static double multiply(double number1, double number2) {
BigDecimal bignum1 = new BigDecimal(String.valueOf(number1));
BigDecimal bignum2 = new BigDecimal(String.valueOf(number2));
BigDecimal bignum3 = bignum1.multiply(bignum2);
double result = bignum3.doubleValue();
return result;
}
public static BigDecimal multiply(BigDecimal number1, BigDecimal number2) {
BigDecimal result = number1.multiply(number2);
return result;
}
public static double divide(double number1, double number2, int scale) {
BigDecimal bignum1 = new BigDecimal(String.valueOf(number1));
BigDecimal bignum2 = new BigDecimal(String.valueOf(number2));
if (number2 == 0.0) {
return 0.0;
} else {
double result = bignum1.divide(bignum2, scale, 4).doubleValue();
return result;
}
}
public static BigDecimal divide(BigDecimal number1, BigDecimal number2, int scale) {
if (number2.compareTo(BigDecimal.ZERO) == 0) {
return new BigDecimal("0");
} else {
BigDecimal result = number1.divide(number2, scale, 4);
return result;
}
}
public static double divideRate(double number1, double number2, int scale) {
BigDecimal bignum1 = new BigDecimal(String.valueOf(number1));
BigDecimal bignum2 = new BigDecimal(String.valueOf(number2));
if (number2 == 0.0) {
return 0.0;
} else {
double result = formatDouble(bignum1.divide(bignum2, scale, 4).doubleValue() * 100.0, 2);
return result;
}
}
public static BigDecimal divideRate(BigDecimal number1, BigDecimal number2, int scale) {
if (number2.compareTo(BigDecimal.ZERO) == 0) {
return new BigDecimal("0");
} else {
BigDecimal result = number1.divide(number2, scale, 4).multiply(new BigDecimal("100"));
return result;
}
}
public static double formatDouble(double number, int scale) {
BigDecimal bigDecimal = new BigDecimal(String.valueOf(number));
return bigDecimal.setScale(scale, 4).doubleValue();
}
public static BigDecimal formatBigDecimal(BigDecimal number, int scale) {
return number.setScale(scale, 4);
}
public static BigDecimal doubleTransferBigDecimal(double number) {
BigDecimal bigDecimal = new BigDecimal(String.valueOf(number));
return bigDecimal;
}
public static double BigDecimalTransferDouble(BigDecimal number) {
double result = number.doubleValue();
return result;
}
public static double divideForList(List<Double> list) {
Double resultAvg = (Double)list.stream().collect(Collectors.averagingDouble((item) -> {
return item;
}));
return resultAvg;
}
}

View File

@@ -0,0 +1,16 @@
package com.fizz.business.utils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fizz.business.form.PageForm;
/**
* @author chenhao
* @date 2023/04/28
*/
public class PageUtil {
public static <T> Page<T> getPageParam(PageForm pageParam){
return new Page<>(pageParam.getCurrent(),pageParam.getSize());
}
}

View File

@@ -0,0 +1,225 @@
package com.fizz.business.utils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;
@Component
public class RedisUtil {
private static RedisTemplate redis;
@Autowired
public void setRedisTemplate(RedisTemplate redisTemplate) {
redis = redisTemplate;
}
// ============================== Common ==============================
/**
* 删除多个key
*/
public static <K> Long delete(Collection<K> keys) {
return redis.delete(keys);
}
/**
* 根据pattern获取匹配的keys
*/
public static <K> Set<K> keys(K pattern) {
return redis.keys(pattern);
}
// ============================== String ==============================
/**
* 设置键值对
*/
public static <K, V> void setValue(K key, V value) {
redis.opsForValue().set(key, value);
}
/**
* 设置键值对并设置过期时间(毫秒)
*/
public static <K, V> void setValue(K key, V value, long time) {
redis.opsForValue().set(key, value, time, TimeUnit.MILLISECONDS);
}
/**
* 获取值
*/
public static <K, V> V getValue(K key) {
return (V) redis.opsForValue().get(key);
}
/**
* 值递增
*/
public static <K, V> Long increment(K key) {
return redis.opsForValue().increment(key);
}
/**
* 值递减
*/
public static <K, V> Long decrement(K key) {
return redis.opsForValue().decrement(key);
}
// ============================== List ==============================
/**
* 左推入单个元素
*/
public static <K, V> void leftPush(K key, V value) {
redis.opsForList().leftPush(key, value);
}
/**
* 左推入多个元素
*/
public static <K, V> void leftPush(K key, List<V> values) {
redis.opsForList().leftPushAll(key, values);
}
/**
* 右推入单个元素
*/
public static <K, V> void rightPush(K key, V value) {
redis.opsForList().rightPush(key, value);
}
/**
* 右推入多个元素
*/
public static <K, V> void rightPush(K key, List<V> values) {
redis.opsForList().rightPushAll(key, values);
}
/**
* 通过索引设置列表元素
*/
public static <K, V> void pushListByIndex(K key, V value, int index) {
redis.opsForList().set(key, (long) index, value);
}
/**
* 获取列表范围(0到-1表示全部)
*/
public static <K, V> List<V> range(K key) {
return redis.opsForList().range(key, 0L, -1L);
}
/**
* 移除列表元素
*/
public static <K, V> void remove(K key, long count, V value) {
redis.opsForList().remove(key, count, value);
}
/**
* 获取列表长度
*/
public static <K> Long listSize(K key) {
return redis.opsForList().size(key);
}
/**
* 通过索引获取列表元素
*/
public static <K, V> V getListByIndex(K key, Long index) {
return (V) redis.opsForList().index(key, index);
}
// ============================== Set ==============================
/**
* 向集合添加多个元素
*/
public static <K, V> void add(K key, List<V> values) {
redis.opsForSet().add(key, values.toArray());
}
/**
* 向集合添加一个或多个元素
*/
public static <K, V> void add(K key, V... values) {
redis.opsForSet().add(key, values);
}
/**
* 获取集合所有成员
*/
public static <K, V> Set<V> members(K key) {
return redis.opsForSet().members(key);
}
/**
* 移除集合中的多个元素
*/
public static <K, V> void remove(K key, List<V> values) {
redis.opsForSet().remove(key, values.toArray());
}
/**
* 移除集合中的一个或多个元素
*/
public static <K, V> void remove(K key, V... values) {
redis.opsForSet().remove(key, values);
}
/**
* 返回两个集合的差集
*/
public static <K, V> Set<V> difference(K key1, K key2) {
return redis.opsForSet().difference(key1, key2);
}
/**
* 随机获取集合中的一个元素
*/
public static <K, V> V randomMember(K key) {
return (V) redis.opsForSet().randomMember(key);
}
/**
* 随机弹出集合中的一个元素
*/
public static <K, V> V pop(K key) {
return (V) redis.opsForSet().pop(key);
}
// ============================== Hash ==============================
/**
* 设置整个Hash
*/
public static <K, V> void putAll(K key, Map<K, V> map) {
redis.opsForHash().putAll(key, map);
}
/**
* 设置Hash中的单个字段
*/
public static <K, V> void put(K key, K hashKey, V value) {
redis.opsForHash().put(key, hashKey, value);
}
/**
* 获取Hash中的字段值
*/
public static <K, V> V get(K key, K hashKey) {
return (V) redis.opsForHash().get(key, hashKey);
}
}

View File

@@ -0,0 +1,33 @@
package com.fizz.business.utils;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Builder;
import lombok.Getter;
import lombok.Setter;
/**
* 回退信息
*
* @author chenhao
* @date 2023/7/27
*/
@Getter
@Setter
@Builder
public class ReturnInfoVO {
@Schema(description = "钢卷号")
private String entryMatId;
@Schema(description = "计划ID")
private Long planId;
@Schema(description = "计划号")
private String planNo;
@Schema(description = "回退类型ALL_RETURN-整卷回退;HALF_RETURN-半卷回退")
private String returnType;
@Schema(description = "回退重量")
private double returnWeight;
}

View File

@@ -1,19 +1,28 @@
package com.fizz.business.utils;
import com.alibaba.druid.support.json.JSONUtils;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSON;
import com.fizz.business.constants.CommonConstants;
import com.fizz.business.constants.enums.WsTypeEnum;
import com.fizz.business.dto.CoilPositionDTO;
import com.fizz.business.dto.L1CoilLineMeasureDTO;
import com.fizz.business.dto.MatmapDTO;
import com.fizz.business.dto.WsSignalMsgDTO;
import com.fizz.business.form.L1OperateMatForm;
import com.fizz.business.form.WebOperateMatForm;
import com.fizz.business.service.client.TrackWsHandler;
import com.fizz.business.vo.CrmPdiPlanVO;
import com.google.common.collect.Maps;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.socket.TextMessage;
import org.springframework.web.socket.WebSocketSession;
import javax.annotation.Resource;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@Slf4j
@@ -28,7 +37,7 @@ public class WebSocketUtil {
}
public static void sendMessage(WsTypeEnum type, String text) {
Map<String, WebSocketSession> clients = trackWsHandler.getClients().getOrDefault(type.name(), new ConcurrentHashMap<>());
Map<String, WebSocketSession> clients = trackWsHandler.getClients().getOrDefault(type.name(), Maps.newConcurrentMap());
TextMessage message = new TextMessage(text);
clients.values().forEach(s -> {
try {
@@ -40,9 +49,39 @@ public class WebSocketUtil {
});
}
public static void sendMatmapMsg(CrmPdiPlanVO crmPdiPlanVO) {
sendMessage(WsTypeEnum.valueOf(WsTypeEnum.track_matmap.getValue()), JSONUtils.toJSONString(crmPdiPlanVO));
public static void sendSignalMsg(WebOperateMatForm form) {
sendSignalMsg(form, false);
}
public static void sendSignalMsg(WebOperateMatForm form, boolean virtualPlanFlag) {
WsSignalMsgDTO msg = new WsSignalMsgDTO();
BeanUtil.copyProperties(form, msg, "operation");
msg.setOperation(form.getOperation().name());
msg.setAutoFlag(CommonConstants.OPERATE_FROM_WEB);
msg.setVirtualPlanFlag(virtualPlanFlag);
sendMessage(WsTypeEnum.track_signal, JSON.toJSONString(msg));
}
public static void sendSignalMsg(L1OperateMatForm form) {
WsSignalMsgDTO msg = new WsSignalMsgDTO();
BeanUtil.copyProperties(form, msg, "operation");
msg.setOperation(form.getOperation().name());
sendMessage(WsTypeEnum.track_signal, JSON.toJSONString(msg));
}
public static void sendPositionMsg(CoilPositionDTO positionDTO) {
sendMessage(WsTypeEnum.track_position, JSONUtil.toJsonStr(positionDTO));
}
public static void sendMeasureMsg(L1CoilLineMeasureDTO measureDTO) {
sendMessage(WsTypeEnum.track_measure, JSONUtil.toJsonStr(measureDTO));
}
public static void sendMatmapMsg() {
List<MatmapDTO> list = MatmapUtil.getMatmapList();
if (CollUtil.isEmpty(list)) return;
sendMessage(WsTypeEnum.track_matmap, JSONUtil.toJsonStr(list));
}
}

View File

@@ -0,0 +1,33 @@
package com.fizz.business.vo;
import cn.hutool.core.lang.Pair;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import java.io.Serializable;
import java.util.List;
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class CoilMeasureVO implements Serializable {
@Schema(description = "参数名")
private String valueName;
@Schema(description = "设定值")
private String definedValue;
@Schema(description = "最大值")
private String maxValue;
@Schema(description = "最小值")
private String minValue;
private List<Pair<String, String>> data;
}

Some files were not shown because too many files have changed in this diff Show More