From 52287925ae0004d67d99929daf6755ceab0f732d Mon Sep 17 00:00:00 2001
From: zhoushihao <zsh19950802@163.com>
Date: 星期二, 17 十二月 2024 09:49:54 +0800
Subject: [PATCH] 1、大理片笼格子详情查询按钮,默认deviceid为1,
---
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/tools/service/impl/BigStorageBaseServiceImpl.java | 179 +++++++++++++++++++++++++++++------------------------------
1 files changed, 89 insertions(+), 90 deletions(-)
diff --git a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/tools/service/impl/BigStorageBaseServiceImpl.java b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/tools/service/impl/BigStorageBaseServiceImpl.java
index 4b275c5..b948c1e 100644
--- a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/tools/service/impl/BigStorageBaseServiceImpl.java
+++ b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/tools/service/impl/BigStorageBaseServiceImpl.java
@@ -5,10 +5,9 @@
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.yulichang.wrapper.MPJLambdaWrapper;
import com.mes.bigstorage.entity.BigStorageCage;
import com.mes.bigstorage.entity.BigStorageCageDetails;
-import com.mes.bigstorage.entity.BigStorageDTO;
+import com.mes.bigstorage.entity.dto.BigStorageDTO;
import com.mes.bigstorage.service.BigStorageCageDetailsService;
import com.mes.bigstorage.service.BigStorageCageService;
import com.mes.bigstoragetask.entity.BigStorageCageFeedTask;
@@ -21,7 +20,6 @@
import com.mes.tools.service.BigStorageBaseService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
-import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@@ -449,88 +447,88 @@
@Override
public BigStorageDTO queryTargetSlotByTempering(GlassInfo glassInfo) {
- BigStorageDTO bigStorageDTO = null;
- MPJLambdaWrapper<BigStorageCage> wrapper = new MPJLambdaWrapper<>(BigStorageCage.class)
- .selectAll(BigStorageCage.class)
- .leftJoin(BigStorageCageDetails.class, BigStorageCageDetails::getSlot, BigStorageCage::getSlot)
- .eq(BigStorageCage::getEnableState, Const.SLOT_ON)
- .in(BigStorageCageDetails::getState, Const.GLASS_STATE_IN_ALL_ZERO)
- .eq(BigStorageCageDetails::getEngineerId, glassInfo.getEngineerId())
- .eq(BigStorageCageDetails::getTemperingLayoutId, glassInfo.getTemperingLayoutId())
- .gt(BigStorageCage::getRemainWidth, Math.max(glassInfo.getWidth(), glassInfo.getHeight()))
- .last("limit 1");
- if (glassInfo.getTemperingLayoutId() == 0) {
- wrapper.eq(BigStorageCageDetails::getFlowCardId, glassInfo.getFlowCardId())
- .eq(BigStorageCageDetails::getLayer, glassInfo.getLayer());
-// wrapper.eq(BigStorageCageDetails::getWidth, glassInfo.getWidth()).eq(BigStorageCageDetails::getHeight, glassInfo.getHeight());
- } else {
- wrapper.eq(BigStorageCageDetails::getTemperingFeedSequence, glassInfo.getTemperingFeedSequence() + 1);
- }
- BigStorageCage bigStorageCage = bigStorageCageService.selectJoinOne(BigStorageCage.class, wrapper);
- if (null != bigStorageCage) {
- log.info("鏃犻挗鍖栫増鍥緄d鎴栨牴鎹綋鍓嶇幓鐠冪墖搴�+1鎵惧埌鐩爣鏍煎瓙锛歿},鐜荤拑id锛歿}", bigStorageCage.getSlot(), glassInfo.getGlassId());
- bigStorageDTO = new BigStorageDTO();
- bigStorageDTO.setWidth(bigStorageCage.getRemainWidth());
- bigStorageDTO.setSlot(bigStorageCage.getSlot());
- bigStorageDTO.setDeviceId(bigStorageCage.getDeviceId());
- return bigStorageDTO;
- }
- bigStorageCage = bigStorageCageService.getOne(new LambdaQueryWrapper<BigStorageCage>()
- .eq(BigStorageCage::getEnableState, Const.SLOT_ON)
- .eq(BigStorageCage::getRemainWidth, slotWidth)
-// .notInSql(BigStorageCage::getSlot, "select distinct slot from big_storage_cage_details where state = 0")
- .inSql(BigStorageCage::getDeviceId,
- "select distinct device_id from big_storage_cage_details where engineer_id = '" + glassInfo.getEngineerId() + "' and tempering_layout_id = " + glassInfo.getTemperingLayoutId())
- .last("limit 1"));
- if (null != bigStorageCage) {
- log.info("鏍规嵁鐗堝浘id鎵惧埌绗煎瓙鍐呯殑鐩爣鏍煎瓙锛歿},鐜荤拑id锛歿}", bigStorageCage.getSlot(), glassInfo.getGlassId());
- bigStorageDTO = new BigStorageDTO();
- bigStorageDTO.setWidth(bigStorageCage.getRemainWidth());
- bigStorageDTO.setSlot(bigStorageCage.getSlot());
- bigStorageDTO.setDeviceId(bigStorageCage.getDeviceId());
- return bigStorageDTO;
- }
-
- //鑾峰彇鐜荤拑鐨勫帤搴︼細閲嶆柊閫夌瀛愰渶瑕佹寜鐓х瀛愬彲鏀剧幓鐠冨帤搴﹁繘琛岄�夋嫨 鍥犱负瀛愭煡璇㈡帓搴忓涓籹ql鏃犲奖鍝嶏紝鎵�浠ュ厛鎵ц瀛愭煡璇㈣幏鍙栭『搴忥紝鐒跺悗涓�娆″幓鏌ヨ
- List<Integer> deviceUsedList = bigStorageCageService.queryFreeDeviceByUsed(glassInfo.getThickness());
- List<Integer> deviceUseds = bigStorageCageService.queryFreeDeviceByUsed(glassInfo.getThickness());
- List<BigStorageCageDetails> engineerCount1 = baseMapper.selectList(
- new LambdaQueryWrapper<BigStorageCageDetails>()
- .notIn(BigStorageCageDetails::getState, Const.GLASS_STATE_OUT, Const.GLASS_STATE_DAMAGE, Const.GLASS_STATE_TAKE)
- .select(BigStorageCageDetails::getEngineerId)
- .groupBy(BigStorageCageDetails::getEngineerId)
- .between(BigStorageCageDetails::getDeviceId, 1, 5)
- );
- List<BigStorageCageDetails> engineerCount2 = baseMapper.selectList(
- new LambdaQueryWrapper<BigStorageCageDetails>()
- .notIn(BigStorageCageDetails::getState, Const.GLASS_STATE_OUT, Const.GLASS_STATE_DAMAGE, Const.GLASS_STATE_TAKE)
- .select(BigStorageCageDetails::getEngineerId)
- .groupBy(BigStorageCageDetails::getEngineerId)
- .between(BigStorageCageDetails::getDeviceId, 6, 8)
- );
- if (engineerCount1.size() > engineerCount2.size()) {
- deviceUsedList.removeIf(device -> device < 6);
- } else {
- deviceUsedList.removeIf(device -> device > 5);
- }
- if (CollectionUtils.isEmpty(deviceUsedList)) {
- deviceUsedList = deviceUseds;
- }
- for (Integer item : deviceUsedList) {
- bigStorageCage = bigStorageCageService.getOne(new LambdaQueryWrapper<BigStorageCage>()
- .eq(BigStorageCage::getRemainWidth, slotWidth)
- .eq(BigStorageCage::getEnableState, Const.SLOT_ON)
- .eq(BigStorageCage::getDeviceId, item)
- .last("limit 1"));
- if (null != bigStorageCage) {
- log.info("鎸夌収瀛樼鐜荤拑鏍煎瓙鏁板崰鐢ㄦ渶灏戞柟寮忚幏鍙栦俊鎭牸瀛愪负锛歿},鐜荤拑id锛歿}", bigStorageCage.getSlot(), glassInfo.getGlassId());
- bigStorageDTO = new BigStorageDTO();
- bigStorageDTO.setWidth(bigStorageCage.getRemainWidth());
- bigStorageDTO.setSlot(bigStorageCage.getSlot());
- bigStorageDTO.setDeviceId(bigStorageCage.getDeviceId());
- return bigStorageDTO;
- }
- }
+// BigStorageDTO bigStorageDTO = null;
+// MPJLambdaWrapper<BigStorageCage> wrapper = new MPJLambdaWrapper<>(BigStorageCage.class)
+// .selectAll(BigStorageCage.class)
+// .leftJoin(BigStorageCageDetails.class, BigStorageCageDetails::getSlot, BigStorageCage::getSlot)
+// .eq(BigStorageCage::getEnableState, Const.SLOT_ON)
+// .in(BigStorageCageDetails::getState, Const.GLASS_STATE_IN_ALL_ZERO)
+// .eq(BigStorageCageDetails::getEngineerId, glassInfo.getEngineerId())
+// .eq(BigStorageCageDetails::getTemperingLayoutId, glassInfo.getTemperingLayoutId())
+// .gt(BigStorageCage::getRemainWidth, Math.max(glassInfo.getWidth(), glassInfo.getHeight()))
+// .last("limit 1");
+// if (glassInfo.getTemperingLayoutId() == 0) {
+// wrapper.eq(BigStorageCageDetails::getFlowCardId, glassInfo.getFlowCardId())
+// .eq(BigStorageCageDetails::getLayer, glassInfo.getLayer());
+//// wrapper.eq(BigStorageCageDetails::getWidth, glassInfo.getWidth()).eq(BigStorageCageDetails::getHeight, glassInfo.getHeight());
+// } else {
+// wrapper.eq(BigStorageCageDetails::getTemperingFeedSequence, glassInfo.getTemperingFeedSequence() + 1);
+// }
+// BigStorageCage bigStorageCage = bigStorageCageService.selectJoinOne(BigStorageCage.class, wrapper);
+// if (null != bigStorageCage) {
+// log.info("鏃犻挗鍖栫増鍥緄d鎴栨牴鎹綋鍓嶇幓鐠冪墖搴�+1鎵惧埌鐩爣鏍煎瓙锛歿},鐜荤拑id锛歿}", bigStorageCage.getSlot(), glassInfo.getGlassId());
+// bigStorageDTO = new BigStorageDTO();
+// bigStorageDTO.setWidth(bigStorageCage.getRemainWidth());
+// bigStorageDTO.setSlot(bigStorageCage.getSlot());
+// bigStorageDTO.setDeviceId(bigStorageCage.getDeviceId());
+// return bigStorageDTO;
+// }
+// bigStorageCage = bigStorageCageService.getOne(new LambdaQueryWrapper<BigStorageCage>()
+// .eq(BigStorageCage::getEnableState, Const.SLOT_ON)
+// .eq(BigStorageCage::getRemainWidth, slotWidth)
+//// .notInSql(BigStorageCage::getSlot, "select distinct slot from big_storage_cage_details where state = 0")
+// .inSql(BigStorageCage::getDeviceId,
+// "select distinct device_id from big_storage_cage_details where engineer_id = '" + glassInfo.getEngineerId() + "' and tempering_layout_id = " + glassInfo.getTemperingLayoutId())
+// .last("limit 1"));
+// if (null != bigStorageCage) {
+// log.info("鏍规嵁鐗堝浘id鎵惧埌绗煎瓙鍐呯殑鐩爣鏍煎瓙锛歿},鐜荤拑id锛歿}", bigStorageCage.getSlot(), glassInfo.getGlassId());
+// bigStorageDTO = new BigStorageDTO();
+// bigStorageDTO.setWidth(bigStorageCage.getRemainWidth());
+// bigStorageDTO.setSlot(bigStorageCage.getSlot());
+// bigStorageDTO.setDeviceId(bigStorageCage.getDeviceId());
+// return bigStorageDTO;
+// }
+//
+// //鑾峰彇鐜荤拑鐨勫帤搴︼細閲嶆柊閫夌瀛愰渶瑕佹寜鐓х瀛愬彲鏀剧幓鐠冨帤搴﹁繘琛岄�夋嫨 鍥犱负瀛愭煡璇㈡帓搴忓涓籹ql鏃犲奖鍝嶏紝鎵�浠ュ厛鎵ц瀛愭煡璇㈣幏鍙栭『搴忥紝鐒跺悗涓�娆″幓鏌ヨ
+// List<Integer> deviceUsedList = bigStorageCageService.queryFreeDeviceByUsed(glassInfo.getThickness());
+// List<Integer> deviceUseds = bigStorageCageService.queryFreeDeviceByUsed(glassInfo.getThickness());
+// List<BigStorageCageDetails> engineerCount1 = baseMapper.selectList(
+// new LambdaQueryWrapper<BigStorageCageDetails>()
+// .notIn(BigStorageCageDetails::getState, Const.GLASS_STATE_OUT, Const.GLASS_STATE_DAMAGE, Const.GLASS_STATE_TAKE)
+// .select(BigStorageCageDetails::getEngineerId)
+// .groupBy(BigStorageCageDetails::getEngineerId)
+// .between(BigStorageCageDetails::getDeviceId, 1, 5)
+// );
+// List<BigStorageCageDetails> engineerCount2 = baseMapper.selectList(
+// new LambdaQueryWrapper<BigStorageCageDetails>()
+// .notIn(BigStorageCageDetails::getState, Const.GLASS_STATE_OUT, Const.GLASS_STATE_DAMAGE, Const.GLASS_STATE_TAKE)
+// .select(BigStorageCageDetails::getEngineerId)
+// .groupBy(BigStorageCageDetails::getEngineerId)
+// .between(BigStorageCageDetails::getDeviceId, 6, 8)
+// );
+// if (engineerCount1.size() > engineerCount2.size()) {
+// deviceUsedList.removeIf(device -> device < 6);
+// } else {
+// deviceUsedList.removeIf(device -> device > 5);
+// }
+// if (CollectionUtils.isEmpty(deviceUsedList)) {
+// deviceUsedList = deviceUseds;
+// }
+// for (Integer item : deviceUsedList) {
+// bigStorageCage = bigStorageCageService.getOne(new LambdaQueryWrapper<BigStorageCage>()
+// .eq(BigStorageCage::getRemainWidth, slotWidth)
+// .eq(BigStorageCage::getEnableState, Const.SLOT_ON)
+// .eq(BigStorageCage::getDeviceId, item)
+// .last("limit 1"));
+// if (null != bigStorageCage) {
+// log.info("鎸夌収瀛樼鐜荤拑鏍煎瓙鏁板崰鐢ㄦ渶灏戞柟寮忚幏鍙栦俊鎭牸瀛愪负锛歿},鐜荤拑id锛歿}", bigStorageCage.getSlot(), glassInfo.getGlassId());
+// bigStorageDTO = new BigStorageDTO();
+// bigStorageDTO.setWidth(bigStorageCage.getRemainWidth());
+// bigStorageDTO.setSlot(bigStorageCage.getSlot());
+// bigStorageDTO.setDeviceId(bigStorageCage.getDeviceId());
+// return bigStorageDTO;
+// }
+// }
//鑾峰彇鐜荤拑鐨勫帤搴︼細閲嶆柊閫夌瀛愰渶瑕佹寜鐓х瀛愬彲鏀剧幓鐠冨帤搴﹁繘琛岄�夋嫨
// List<Integer> deviceNotUsedList = bigStorageCageService.queryFreeDeviceByNotUsed(glassInfo.getThickness());
@@ -549,12 +547,13 @@
// return bigStorageDTO;
// }
// }
- Assert.isTrue(null != bigStorageCage, "娌℃湁绌轰綑鐨勭瀛愬瓨鏀剧幓鐠�");
- return bigStorageDTO;
+// Assert.isTrue(null != bigStorageCage, "娌℃湁绌轰綑鐨勭瀛愬瓨鏀剧幓鐠�");
+// return bigStorageDTO;
+ return null;
}
- @Scheduled(fixedDelay = 300)
+ // @Scheduled(fixedDelay = 300)
public void querySizeByEngineerTask() {
log.info("鏌ヨ缁撴灉锛歿}", querySizeByEngineer("P24072402", 1, 10, 8));
log.info("鏌ヨ缁撴灉锛歿}", querySizeByEngineer("P24072402", 1, 5, 8));
@@ -624,7 +623,7 @@
bigStorageCage = bigStorageCageService.getOne(new LambdaQueryWrapper<BigStorageCage>()
.eq(BigStorageCage::getEnableState, Const.SLOT_ON)
- .eq(BigStorageCage::getRemainWidth, slotWidth)
+ .eq(BigStorageCage::getRemainWidth, slotWidth).orderByAsc(BigStorageCage::getSlot)
.inSql(BigStorageCage::getDeviceId,
"select distinct device_id from big_storage_cage_details where engineer_id = '" + engineerId + "' and tempering_layout_id = " + temperingLayoutId)
.last("limit 1"));
@@ -642,7 +641,7 @@
List<Integer> deviceUsedList = bigStorageCageService.queryFreeDeviceByUsed(thickness);
for (Integer item : deviceUsedList) {
bigStorageCage = bigStorageCageService.getOne(new LambdaQueryWrapper<BigStorageCage>()
- .eq(BigStorageCage::getRemainWidth, slotWidth)
+ .eq(BigStorageCage::getRemainWidth, slotWidth).orderByAsc(BigStorageCage::getSlot)
.eq(BigStorageCage::getEnableState, Const.SLOT_ON)
.eq(BigStorageCage::getDeviceId, item)
.last("limit 1"));
--
Gitblit v1.8.0