From fcb8b8cc392b146aa11bbaab9e497f7f13f29d44 Mon Sep 17 00:00:00 2001
From: ZengTao <2773468879@qq.com>
Date: 星期一, 26 五月 2025 11:38:17 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10105/r/YiWuProject
---
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/service/impl/BigStorageCageDetailsServiceImpl.java | 150 +++++++++++++++++++++++++++++++++++++++++---------
1 files changed, 123 insertions(+), 27 deletions(-)
diff --git a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/service/impl/BigStorageCageDetailsServiceImpl.java b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/service/impl/BigStorageCageDetailsServiceImpl.java
index 3c478b9..b0aa717 100644
--- a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/service/impl/BigStorageCageDetailsServiceImpl.java
+++ b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/service/impl/BigStorageCageDetailsServiceImpl.java
@@ -6,31 +6,37 @@
import com.github.yulichang.base.MPJBaseServiceImpl;
import com.github.yulichang.toolkit.JoinWrappers;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
+import com.google.common.collect.Lists;
+import com.mes.base.entity.vo.BigStorageVO;
import com.mes.bigstorage.entity.BigStorageCage;
import com.mes.bigstorage.entity.BigStorageCageDetails;
import com.mes.bigstorage.entity.dto.*;
+import com.mes.bigstorage.entity.vo.BigStorageQueryVO;
import com.mes.bigstorage.mapper.BigStorageCageDetailsMapper;
import com.mes.bigstorage.service.BigStorageCageDetailsService;
import com.mes.bigstorage.service.BigStorageCageService;
+import com.mes.bigstoragecagetask.entity.BigStorageCageHistoryTask;
+import com.mes.bigstoragecagetask.service.BigStorageCageHistoryTaskService;
import com.mes.bigstoragetask.entity.BigStorageCageFeedTask;
import com.mes.bigstoragetask.entity.BigStorageCageOutTask;
import com.mes.bigstoragetask.entity.UpdateBigStorageCageDTO;
import com.mes.bigstoragetask.mapper.BigStorageCageFeedTaskMapper;
import com.mes.bigstoragetask.mapper.BigStorageCageOutTaskMapper;
import com.mes.common.config.Const;
+import com.mes.common.config.ConstSysConfig;
import com.mes.damage.entity.Damage;
import com.mes.damage.service.DamageService;
import com.mes.glassinfo.entity.GlassInfo;
import com.mes.glassinfo.mapper.GlassInfoMapper;
import com.mes.glassinfo.service.GlassInfoService;
-import com.mes.job.PlcStorageCageTask;
+import com.mes.sysconfig.entity.SysConfig;
+import com.mes.sysconfig.service.SysConfigService;
import com.mes.temperingglass.entity.TemperingGlassInfo;
import com.mes.temperingglass.mapper.TemperingGlassInfoMapper;
import com.mes.temperingglass.service.TemperingGlassInfoService;
import com.mes.utils.RedisUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
-import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@@ -68,26 +74,31 @@
@Resource
private TemperingGlassInfoService temperingGlassInfoService;
-
@Resource
- private PlcStorageCageTask plcStorageCageTask;
+ private SysConfigService sysConfigService;
+
+// @Resource
+// private PlcStorageCageTask plcStorageCageTask;
@Resource
private DamageService damageService;
@Resource
private RedisUtil redisUtil;
- @Value("${mes.minCount}")
- private int minCount;
-
- @Value("${mes.slotWidth}")
- private Integer slotWidth;
-
- @Value("${mes.glassGap}")
- private Integer glassGap;
-
- @Value("${mes.sequence.order}")
- private boolean sequenceOrder;
+ @Resource
+ BigStorageCageHistoryTaskService bigStorageCageHistoryTaskService;
+//
+// @Value("${mes.minCount}")
+// private int minCount;
+//
+// @Value("${mes.slotWidth}")
+// private Integer slotWidth;
+//
+// @Value("${mes.glassGap}")
+// private Integer glassGap;
+//
+// @Value("${mes.sequence.order}")
+// private boolean sequenceOrder;
@Override
@@ -163,7 +174,7 @@
for (BigStorageCageDetails bigStorageCageDetails : bigStorageCageDetailsList
) {
if (bigStorageCageDetails.getBigStorageCageFeedTask().getTaskState() == 0) {
- carWidth = carWidth - bigStorageCageDetails.getWidth() - glassGap;
+ carWidth = carWidth - bigStorageCageDetails.getWidth() - 250;
}
}
return carWidth;
@@ -229,7 +240,7 @@
if (glassInfo != null) {
BeanUtils.copyProperties(glassInfo, bigStorageCageDetails);
bigStorageCageDetails.setState(1);
- bigStorageCageDetails.setGap(glassGap);
+ bigStorageCageDetails.setGap(250);
bigStorageCageDetailsList = new ArrayList<>();
bigStorageCageDetailsList.add(bigStorageCageDetails);
}
@@ -267,6 +278,7 @@
@Override
public BigStorageDTO queryTargetSlotByTempering(GlassInfo glassInfo) {
BigStorageDTO bigStorageDTO = null;
+ int slotWidth = sysConfigService.queryConfigValue(ConstSysConfig.VERTICAL_SLOT_WIDTH);
MPJLambdaWrapper<BigStorageCage> wrapper = new MPJLambdaWrapper<>(BigStorageCage.class)
.selectAll(BigStorageCage.class)
.leftJoin(BigStorageCageDetails.class, BigStorageCageDetails::getSlot, BigStorageCage::getSlot)
@@ -378,7 +390,7 @@
@Override
public List<TemperingLayoutDTO> queryTemperingOccupySlot() {
- return baseMapper.queryTemperingOccupySlot(minCount);
+ return baseMapper.queryTemperingOccupySlot(10);
}
@Override
@@ -389,15 +401,17 @@
@Override
public boolean temperingGlass(String temperingLayoutId, String engineerId, String temperingFeedSequence) {
LambdaQueryWrapper<TemperingGlassInfo> temperingGlassInfoLambdaQueryWrapper = new LambdaQueryWrapper<>();
+ SysConfig sysConfig = sysConfigService.queryConfigById(ConstSysConfig.CACHE_SEQUENCE_ORDER_TRUE);
+ boolean sequenceOrder = Boolean.parseBoolean(sysConfig.getConfigValue());
temperingGlassInfoLambdaQueryWrapper
.eq(TemperingGlassInfo::getState, Const.TEMPERING_NEW);
List<TemperingGlassInfo> temperingGlassInfoList = temperingGlassInfoMapper.selectList(temperingGlassInfoLambdaQueryWrapper);
if (temperingGlassInfoList.size() == 0) {
List<TemperingGlassInfo> temperingGlassInfos = glassInfoService.selectJoinList(TemperingGlassInfo.class, JoinWrappers.lambda(GlassInfo.class)
- .selectAll(GlassInfo.class)
- .select("-1 as state")
- .selectAs(BigStorageCageDetails::getSlot, TemperingGlassInfo::getSlot)
+ .select("-1 as state,t.filmsid as films_id,t.glass_id,t.flow_card_id,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)
.eq(GlassInfo::getTemperingLayoutId, temperingLayoutId)
.eq(GlassInfo::getEngineerId, engineerId)
@@ -406,7 +420,7 @@
if (CollectionUtils.isNotEmpty(temperingGlassInfos)) {
if ("0".equals(temperingFeedSequence)) {
if (CollectionUtils.isNotEmpty(temperingGlassInfos)) {
- plcStorageCageTask.computeOutMoreGlassInfo(temperingGlassInfos, Boolean.FALSE, "");
+// plcStorageCageTask.computeOutMoreGlassInfo(temperingGlassInfos, Boolean.FALSE, "");
}
} else {
temperingGlassInfoService.saveBatch(temperingGlassInfos);
@@ -419,9 +433,8 @@
@Override
- public List<Map<String, Object>> selectTemperingGlass() {
- List<Map<String, Object>> temperingGlass = baseMapper.selectTemperingGlassCount();
- return temperingGlass;
+ public List<TemperingGlassCountDTO> selectTemperingGlass(int isTempering) {
+ return baseMapper.selectTemperingGlassCount(isTempering);
}
@Override
@@ -436,14 +449,83 @@
}
@Override
+ public List<GlassInfoLackDTO> queryLackGlassInfo(BigStorageQueryVO bigStorageQueryVO) {
+ return baseMapper.queryLackGlassInfo(bigStorageQueryVO);
+ }
+
+ @Override
+ public List<BigStorageCageDetails> queryRealGlassInfo(BigStorageQueryVO bigStorageQueryVO) {
+ return this.list(new LambdaQueryWrapper<BigStorageCageDetails>()
+ .eq(BigStorageCageDetails::getEngineerId, bigStorageQueryVO.getEngineerId())
+ .eq(BigStorageCageDetails::getTemperingLayoutId, bigStorageQueryVO.getTemperingLayoutId())
+ .in(BigStorageCageDetails::getState, Const.GLASS_STATE_IN_ALL).orderByAsc(BigStorageCageDetails::getTemperingFeedSequence));
+ }
+
+ @Override
+ public Map<Integer, List<BigStorageVO>> querybigStorageCageDetail() {
+ List<BigStorageVO> bigStorageCages = baseMapper.querybigStorageCageDetail();
+ return bigStorageCages.stream().collect(Collectors.groupingBy(item -> item.getDeviceId()));
+ }
+
+ @Override
+ public boolean cancelTemperingTask() {
+ //褰撳墠姝e湪鎵ц鐨勫嚭鐗囦换鍔�
+ List<BigStorageCageHistoryTask> historyTaskList = bigStorageCageHistoryTaskService.list(new LambdaQueryWrapper<BigStorageCageHistoryTask>()
+ .eq(BigStorageCageHistoryTask::getTaskState, Const.GLASS_STATE_NEW)
+ .eq(BigStorageCageHistoryTask::getTargetSlot, Const.TEMPERING_OUT_TARGET_POSITION));
+ //涓嶅瓨鍦ㄥ嚭鐗囦换鍔★紝鐩存帴鍒犻櫎閽㈠寲灏忕墖琛ㄦ湭鍑虹墖鐨勪换鍔�
+ if (CollectionUtils.isEmpty(historyTaskList)) {
+ temperingGlassInfoMapper.delete(new LambdaQueryWrapper<TemperingGlassInfo>().eq(TemperingGlassInfo::getState, Const.TEMPERING_NEW));
+ return Boolean.TRUE;
+ }
+ //瀛樺湪鍑虹墖浠诲姟锛屽垹闄ら挗鍖栧皬鐗囪〃
+ List<String> glassIdList = historyTaskList.stream().map(BigStorageCageHistoryTask::getGlassId).collect(Collectors.toList());
+ GlassInfo glassInfo = glassInfoService.getOne(new LambdaQueryWrapper<GlassInfo>().in(GlassInfo::getGlassId, glassIdList)
+ .orderByDesc(GlassInfo::getTemperingFeedSequence).last("limit 1"));
+ temperingGlassInfoMapper.delete(new LambdaQueryWrapper<TemperingGlassInfo>()
+ .eq(TemperingGlassInfo::getEngineerId, glassInfo.getEngineerId())
+ .eq(TemperingGlassInfo::getState, Const.TEMPERING_NEW)
+ .ge(TemperingGlassInfo::getTemperingLayoutId, glassInfo.getTemperingLayoutId())
+ .gt(TemperingGlassInfo::getTemperingFeedSequence, glassInfo.getTemperingFeedSequence())
+ );
+ return Boolean.TRUE;
+ }
+
+ @Override
public String temperingSwitch(Boolean flag) {
redisUtil.setCacheObject("temperingSwitch", flag);
return "success";
}
@Override
- public void appointEngineerId(String engineerId) {
- redisUtil.setCacheObject("temperingengineerId", engineerId);
+ public boolean appointTemperingEngineerId(String engineerId) {
+ LambdaQueryWrapper<TemperingGlassInfo> temperingGlassInfoLambdaQueryWrapper = new LambdaQueryWrapper<>();
+ temperingGlassInfoLambdaQueryWrapper
+ .eq(TemperingGlassInfo::getState, Const.TEMPERING_NEW);
+ List<TemperingGlassInfo> temperingGlassInfoList = temperingGlassInfoMapper.selectList(temperingGlassInfoLambdaQueryWrapper);
+
+ if (temperingGlassInfoList.size() == 0) {
+ 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" +
+ ",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)
+ .eq(GlassInfo::getEngineerId, engineerId)
+ .ne(GlassInfo::getTemperingLayoutId, 0)
+ .in(BigStorageCageDetails::getState, Const.GLASS_STATE_IN)
+ .orderByAsc(BigStorageCageDetails::getTemperingLayoutId)
+ .orderByAsc(BigStorageCageDetails::getTemperingFeedSequence)
+ );
+ if (CollectionUtils.isNotEmpty(temperingGlassInfos)) {
+ //閬垮厤澶ч噺鏁版嵁鎻掑叆瀵艰嚧sqlserver鏁版嵁搴撳紓甯革紝鍒嗘壒娆℃瘡璋冨瓨鍌ㄤ緷娆�
+ List<List<TemperingGlassInfo>> temperingGlassInfoLists = Lists.partition(temperingGlassInfos, 50);
+ for (List<TemperingGlassInfo> item : temperingGlassInfoLists) {
+ temperingGlassInfoService.saveBatch(item);
+ }
+ return true;
+ }
+ }
+ return false;
}
@Override
@@ -455,4 +537,18 @@
public List<BigStorageSequenceDTO> dispatchBigStorageGlassInfo(BigStorageRelationDTO bigStorageRelationDTO) {
return baseMapper.queryNeedDispatchSlot(bigStorageRelationDTO);
}
+
+ @Override
+ public String bigStorageGlassDamageByGlassId(String glassId) {
+ Damage damage = new Damage();
+ damage.setGlassId(glassId);
+ damage.setType(Const.GLASS_STATE_DAMAGE);
+ damageService.insertDamage(damage);
+ return "success";
+ }
+
+ @Override
+ public void updateDeviceIdBySlot(List<Integer> slotList) {
+ baseMapper.updateDeviceIdBySlot(slotList);
+ }
}
--
Gitblit v1.8.0