From 1195e51e67436cf2b9513678b5e9d3f27a043de4 Mon Sep 17 00:00:00 2001
From: ZengTao <2773468879@qq.com>
Date: 星期一, 22 十二月 2025 08:29:40 +0800
Subject: [PATCH] 1、中空选中除膜改为多选 2、流程卡报工情况查询添加工程号条件,添加线路,备注显示
---
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageNewTask.java | 91 ++++++++++++++++++++++++++++++++++++---------
1 files changed, 72 insertions(+), 19 deletions(-)
diff --git a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageNewTask.java b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageNewTask.java
index 5cbe4f6..a07ea97 100644
--- a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageNewTask.java
+++ b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageNewTask.java
@@ -3,9 +3,10 @@
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.lang.Assert;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.github.xingshuangs.iot.protocol.s7.serializer.S7Serializer;
+import com.github.xingshuangs.iot.protocol.s7.service.S7PLC;
import com.github.yulichang.toolkit.JoinWrappers;
import com.kangaroohy.milo.model.ReadWriteEntity;
import com.kangaroohy.milo.service.MiloService;
@@ -87,6 +88,9 @@
@Autowired
@Qualifier("s7SerializerDLPTwo")
private S7Serializer s7SerializerDLPTwo;
+ @Autowired
+ @Qualifier("s7plcWZL")
+ private S7PLC s7plcWZL;
@Resource
SysConfigService sysConfigService;
@@ -104,6 +108,8 @@
private static final String ALARM_TYPE = "閽㈠寲澶х悊鐗�";
private static final String ALARM_CODE_SIZE = "sizeSame";
private static final String ALARM_CODE_ID = "idSame";
+ private static final String ALARM_CODE_SLOT = "slotLess";
+ private static final String ALARM_CODE_OVER = "overSize";
@Resource
private RedisUtil redisUtil;
@@ -231,6 +237,13 @@
.ge(BigStorageCage::getMaxThickness, entry.getKey()));
if (count < entry.getValue()) {
log.info("绗煎唴鏍煎瓙鍓╀綑鏁伴噺涓嶈冻锛岀粨鏉熸湰娆¤繘鐗�");
+ ProductAlarmInfo alarmInfo = new ProductAlarmInfo();
+ alarmInfo.setState(Const.LOAD_RAW_GLASS_NEW);
+ alarmInfo.setAlarmModule(ALARM_MODULE);
+ alarmInfo.setAlarmType(ALARM_TYPE);
+ alarmInfo.setAlarmCode(ALARM_CODE_SLOT);
+ alarmInfo.setAlarmMessage(count + "");
+ productAlarmInfoService.save(alarmInfo);
//鍚憄lc鍙戦�佹姤璀�:绗煎唴鏍煎瓙鍓╀綑鏁伴噺涓嶈冻
// miloService.writeToOpcWord(generateReadWriteEntity("DLP1A.DLP1A.alarmSignal", 16));
s7DataDLPOne = new S7DataDLPOne();
@@ -247,6 +260,13 @@
.in(BigStorageCageDetails::getState, Const.GLASS_STATE_IN_ALL));
if (count > 0) {
log.info("鐩撮�氱墖鍙板瓨鍦ㄧ幓鐠冿紝缁撴潫鏈杩涚墖");
+// ProductAlarmInfo alarmInfo = new ProductAlarmInfo();
+// alarmInfo.setState(Const.LOAD_RAW_GLASS_NEW);
+// alarmInfo.setAlarmModule(ALARM_MODULE);
+// alarmInfo.setAlarmType(ALARM_TYPE);
+// alarmInfo.setAlarmCode(ALARM_CODE_OVER);
+// alarmInfo.setAlarmMessage("");
+// productAlarmInfoService.save(alarmInfo);
//鍚憄lc鍙戦�佹姤璀�:鐩撮�氱墖鍙板瓨鍦ㄧ幓鐠冿紝鏃犳硶缁х画鐩撮��
// miloService.writeToOpcWord(generateReadWriteEntity("DLP1A.DLP1A.alarmSignal", 64));
s7DataDLPOne = new S7DataDLPOne();
@@ -398,6 +418,8 @@
LambdaQueryWrapper<BigStorageCage> queryWrapper = new LambdaQueryWrapper<BigStorageCage>()
.eq(BigStorageCage::getRemainWidth, slotWidth)
.eq(BigStorageCage::getEnableState, Const.SLOT_ON)
+ .le(BigStorageCage::getMinThickness, info.getThickness())
+ .ge(BigStorageCage::getMaxThickness, info.getThickness())
.orderByAsc(BigStorageCage::getDeviceId).orderByAsc(BigStorageCage::getSlot)
.last("limit 1");
@@ -447,6 +469,16 @@
Integer temperingOutTargetPosition = sysConfigService.queryConfigValue(ConstSysConfig.VERTICAL_TEMPERING_OUT_TARGET_POSITION);
if (redisUtil.getCacheObject("temperingSwitch")) {
+ try {
+ int outRequest = s7plcWZL.readUInt16("DB51.8");
+ if (outRequest == 0) {
+ log.info("褰撳墠鏈敹鍒板崸杞珛鍏佽鍑虹墖璇锋眰锛岀粨鏉熷嚭鐗囦换鍔�");
+ return;
+ }
+ } catch (Exception e) {
+ log.error("璇诲彇鍗ц浆绔嬩俊鍙峰紓甯�", e);
+ return;
+ }
//鏄惁鍏佽閽㈠寲
//鏄惁鏈夋鍦ㄩ挗鍖栫殑鐜荤拑:閽㈠寲灏忕墖琛ㄥ叧鑱斿巻鍙蹭换鍔¤〃锛岀瓫閫夋湭鍑虹鐨勭幓鐠冧俊鎭�
// 鑾峰彇褰撳墠閽㈠寲浠诲姟鏈畬鎴愬嚭鐗囩殑鐜荤拑淇℃伅
@@ -462,13 +494,30 @@
String temperingEngineerId = redisUtil.getCacheObject("temperingEngineerId");
if (StringUtils.isNotBlank(temperingEngineerId)) {
- TemperingGlassInfo temperingGlassInfo = temperingGlassInfoService.getOne(new QueryWrapper<TemperingGlassInfo>()
- .select("Top 1 *")
- .eq("engineer_id", temperingEngineerId)
- .orderByDesc("tempering_layout_id"));
+ List<TemperingGlassInfo> temperingGlassInfoList = temperingGlassInfoService.list(
+ new LambdaQueryWrapper<TemperingGlassInfo>()
+ .eq(TemperingGlassInfo::getEngineerId, temperingEngineerId)
+ .orderByAsc(TemperingGlassInfo::getId)
+ );
int temperingLayoutId = 1;
- if (temperingGlassInfo != null) {
- temperingLayoutId = temperingGlassInfo.getTemperingLayoutId() + 1;
+ if (CollectionUtils.isEmpty(temperingGlassInfoList)) {
+ temperingLayoutId = 1;
+ } else {
+ List<Integer> tempIds = temperingGlassInfoList.stream()
+ .map(TemperingGlassInfo::getTemperingLayoutId)
+ .distinct()
+ .sorted()
+ .collect(Collectors.toList());
+
+ int expected = 1;
+ for (int current : tempIds) {
+ if (current > expected) {
+ break; // 鎵惧埌绗竴涓己澶卞�硷紝璺冲嚭寰幆
+ } else if (current == expected) {
+ expected++; // 杩炵画鍒欓�掑鏈熸湜鐨勫��
+ }
+ }
+ temperingLayoutId = expected; // 缂哄け鍒欎负expected锛岃繛缁垯涓簃ax+1
}
List<GlassInfo> glassInfos = glassInfoService.list(new LambdaQueryWrapper<GlassInfo>().eq(GlassInfo::getEngineerId, temperingEngineerId).eq(GlassInfo::getTemperingLayoutId, temperingLayoutId));
if (CollectionUtil.isEmpty(glassInfos)) {
@@ -479,7 +528,7 @@
List<TemperingLayoutDTO> temperingLayoutDTOS = bigStorageCageDetailsService.temperingIsAllByTemperingLayoutId(temperingEngineerId, temperingLayoutId);
if (CollectionUtil.isNotEmpty(temperingLayoutDTOS)) {
List<TemperingGlassInfo> temperingGlassInfos = glassInfoService.selectJoinList(TemperingGlassInfo.class, JoinWrappers.lambda(GlassInfo.class)
- .select("-1 as state,t.filmsid as films_id,t.glass_id,t.flow_card_id,t.glass_type,t.width,t.height" +
+ .select("-1 as state,t.filmsid as films_id,t.glass_id,t.flow_card_id,t.layer,t.glass_type,t.width,t.height" +
",t.thickness,t.ishorizontal,t.tempering_layout_id,t.tempering_feed_sequence,t.x_coordinate,t.y_coordinate," +
"t.angle,t1.slot,t.engineer_id")
.innerJoin(BigStorageCageDetails.class, BigStorageCageDetails::getGlassId, GlassInfo::getGlassId)
@@ -559,6 +608,7 @@
.eq(BigStorageCage::getEnableState, Const.SLOT_ON));
//瀹氫箟10涓牸瀛愪负闃堝��
if (count <= 10) {
+ log.info("绗煎瓙瓒呰繃闃堝�硷紝鎵ц4鍙风瀛愯皟搴﹂�昏緫");
//鑾峰彇搴忓彿涓�1鐨勬牸瀛� 灏嗘牸瀛愬唴鐨勬墍鏈夌幓鐠冮�佸埌瀵瑰簲鐨勭瀛�
BigStorageCage bigStorageCage = bigStorageCageService.getOne(new LambdaQueryWrapper<BigStorageCage>()
.eq(BigStorageCage::getRemainWidth, slotWidth)
@@ -566,15 +616,18 @@
.in(BigStorageCage::getDeviceId, Arrays.asList(5, 6))
.orderByAsc(BigStorageCage::getDeviceId).orderByAsc(BigStorageCage::getSlot)
.last("limit 1"));
-
- list = bigStorageCageDetailsService.queryNeedDispatch();
- computeOutGlassInfoByVirtualSlot(list, "big_storage_cage_out_one_task",
- bigStorageCage.getSlot(), Const.GLASS_STATE_SCHEDULE_ING, Const.BIG_STORAGE_BEFORE_DISPATCH);
- List<Integer> slotList = new ArrayList<>();
- slotList.add(bigStorageCage.getSlot());
- slotList.add(list.get(0).getSlot());
- updateSlotRemainBySlots(slotList);
- return;
+ if (null != bigStorageCage) {
+ list = bigStorageCageDetailsService.queryNeedDispatch();
+ if (CollectionUtil.isNotEmpty(list)) {
+ computeOutGlassInfoByVirtualSlot(list, "big_storage_cage_out_one_task",
+ bigStorageCage.getSlot(), Const.GLASS_STATE_SCHEDULE_ING, Const.BIG_STORAGE_BEFORE_DISPATCH);
+ List<Integer> slotList = new ArrayList<>();
+ slotList.add(bigStorageCage.getSlot());
+ slotList.add(list.get(0).getSlot());
+ updateSlotRemainBySlots(slotList);
+ return;
+ }
+ }
}
//鐢熸垚璋冨害浠诲姟鎸夌収缁勫彿缁勫簭鐢�1寮�濮嬩緷娆″線5鍙风瀛愰�佸皬鐗�
BigStorageSlotDTO slotDTO = bigStorageCageDetailsService.queryNeedDispatchSlotBySequence();
@@ -873,7 +926,7 @@
damage.setWorkingProcedure("澶х悊鐗囩");
damage.setRemark("杩涚鍓嶅崸杞珛");
damage.setStatus(1);
- damage.setType(item.getTaskState());
+ damage.setType(Const.GLASS_STATE_DAMAGE);
damageService.insertDamage(damage);
slotList.add(item.getTargetSlot());
}
@@ -898,7 +951,7 @@
damage.setWorkingProcedure("閽㈠寲鍓�");
damage.setRemark("杩涚鍚庡崸杞珛");
damage.setStatus(1);
- damage.setType(item.getTaskState());
+ damage.setType(Const.GLASS_STATE_DAMAGE);
damageService.insertDamage(damage);
slotList.add(item.getTargetSlot());
slotList.add(item.getStartSlot());
--
Gitblit v1.8.0