Browse Source

add 窑内及冷却道托盘推送逻辑

暂未启用,先看电气能不能上报
master
张江玮 2 years ago
parent
commit
32acfcb2e3
  1. 24
      lms/nladmin-system/src/main/java/org/nl/wms/cockpit/constant/CockpitConstants.java
  2. 48
      lms/nladmin-system/src/main/java/org/nl/wms/sch/task/util/TaskUtils.java

24
lms/nladmin-system/src/main/java/org/nl/wms/cockpit/constant/CockpitConstants.java

@ -0,0 +1,24 @@
package org.nl.wms.cockpit.constant;
import java.util.concurrent.CopyOnWriteArrayList;
/**
* 大屏常量类
*
* @author zhangjiangwei
* @date 2023/07/03 16:58
*/
public class CockpitConstants {
// 入窑输送线及窑内数据
public static CopyOnWriteArrayList<String> kilnData = new CopyOnWriteArrayList<>(new String[44]);
// 入窑输送线及窑内数据 redis key
public static final String KILN_DATA_KEY = "KILN_DATA_KEY";
// 冷却道数据
public static CopyOnWriteArrayList<String> coolingData = new CopyOnWriteArrayList<>(new String[46]);
// 冷却道数据 redis key
public static final String COOLING_DATA_KEY = "COOLING_DATA_KEY";
}

48
lms/nladmin-system/src/main/java/org/nl/wms/sch/task/util/TaskUtils.java

@ -4,12 +4,17 @@ import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import org.nl.modules.common.exception.BadRequestException; import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.common.utils.RedisUtils;
import org.nl.modules.common.utils.SecurityUtils; import org.nl.modules.common.utils.SecurityUtils;
import org.nl.modules.system.util.CodeUtil; import org.nl.modules.system.util.CodeUtil;
import org.nl.modules.wql.WQL; import org.nl.modules.wql.WQL;
import org.nl.modules.wql.core.bean.WQLObject; import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.modules.wql.util.SpringContextHolder;
import org.nl.wms.cockpit.constant.CockpitConstants;
import org.nl.wms.common.PickType; import org.nl.wms.common.PickType;
import org.nl.wms.sch.manage.*; import org.nl.wms.sch.manage.*;
@ -239,7 +244,7 @@ public class TaskUtils {
/** /**
* 生成喷码内容祥见 SVN 项目文档信息 * 生成喷码内容祥见 SVN 项目文档信息
* *
* @param vd 组盘对象 * @param vd 组盘对象
* @param yjCode 压机编码 * @param yjCode 压机编码
* @return 喷码内容 * @return 喷码内容
*/ */
@ -279,4 +284,45 @@ public class TaskUtils {
return null; return null;
} }
} }
public static void inKiln(String vehicleCode) {
if (StrUtil.isBlank(CockpitConstants.kilnData.get(0))) {
CockpitConstants.kilnData.set(0, vehicleCode);
SpringContextHolder.getBean(RedisUtils.class).set(CockpitConstants.KILN_DATA_KEY, JSON.toJSONString(CockpitConstants.kilnData, SerializerFeature.WriteMapNullValue));
} else {
for (int i = CockpitConstants.kilnData.size() - 1; i > 0; i--) {
CockpitConstants.kilnData.set(i, CockpitConstants.kilnData.get(i - 1));
}
CockpitConstants.kilnData.set(0, vehicleCode);
SpringContextHolder.getBean(RedisUtils.class).set(CockpitConstants.KILN_DATA_KEY, JSON.toJSONString(CockpitConstants.kilnData, SerializerFeature.WriteMapNullValue));
}
}
public static void outKiln(String vehicleCode) {
if (vehicleCode.equals(CockpitConstants.kilnData.get(CockpitConstants.kilnData.size() - 1))) {
for (int i = CockpitConstants.kilnData.size() - 1; i > 0; i--) {
CockpitConstants.kilnData.set(i, CockpitConstants.kilnData.get(i - 1));
}
CockpitConstants.kilnData.set(0, null);
SpringContextHolder.getBean(RedisUtils.class).set(CockpitConstants.KILN_DATA_KEY, JSON.toJSONString(CockpitConstants.kilnData, SerializerFeature.WriteMapNullValue));
}
}
public static void inCooling(String vehicleCode) {
for (int i = CockpitConstants.coolingData.size() - 1; i > 0; i--) {
CockpitConstants.coolingData.set(i, CockpitConstants.coolingData.get(i - 1));
}
CockpitConstants.coolingData.set(0, vehicleCode);
SpringContextHolder.getBean(RedisUtils.class).set(CockpitConstants.COOLING_DATA_KEY, JSON.toJSONString(CockpitConstants.coolingData, SerializerFeature.WriteMapNullValue));
}
public static void outCooling(String vehicleCode) {
if (vehicleCode.equals(CockpitConstants.coolingData.get(CockpitConstants.coolingData.size() - 1))) {
for (int i = CockpitConstants.coolingData.size() - 1; i > 0; i--) {
CockpitConstants.coolingData.set(i, CockpitConstants.coolingData.get(i - 1));
}
CockpitConstants.coolingData.set(0, null);
SpringContextHolder.getBean(RedisUtils.class).set(CockpitConstants.COOLING_DATA_KEY, JSON.toJSONString(CockpitConstants.coolingData, SerializerFeature.WriteMapNullValue));
}
}
} }

Loading…
Cancel
Save