From 47ab1c46b5141f572381a2a27613f728e3bf96c5 Mon Sep 17 00:00:00 2001
From: zhoushihao <zsh19950802@163.com>
Date: 星期一, 20 五月 2024 14:18:16 +0800
Subject: [PATCH] 1、卧式理片笼对接过程中bug修复 2、上片机协议修改 3、临时解决json文件打包后读取不到文件问题 4、上片新增接口修改上片机联动请求
---
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/service/impl/DownStorageCageServiceImpl.java | 139 ++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 132 insertions(+), 7 deletions(-)
diff --git a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/service/impl/DownStorageCageServiceImpl.java b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/service/impl/DownStorageCageServiceImpl.java
index fe93e4a..e580072 100644
--- a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/service/impl/DownStorageCageServiceImpl.java
+++ b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/service/impl/DownStorageCageServiceImpl.java
@@ -1,9 +1,25 @@
package com.mes.downstorage.service.impl;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.github.yulichang.toolkit.JoinWrappers;
+import com.github.yulichang.wrapper.MPJLambdaWrapper;
+
+import com.mes.device.PlcParameterObject;
+import com.mes.downglassinfo.entity.DownGlassTask;
+import com.mes.downglassinfo.service.DownGlassTaskService;
import com.mes.downstorage.entity.DownStorageCage;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.mes.downstorage.entity.DownStorageCageDetails;
+import com.mes.downstorage.mapper.DownStorageCageDetailsMapper;
import com.mes.downstorage.mapper.DownStorageCageMapper;
+import com.mes.downstorage.service.DownStorageCageDetailsService;
import com.mes.downstorage.service.DownStorageCageService;
+import com.mes.glassinfo.entity.GlassInfo;
+import com.mes.glassinfo.service.GlassInfoService;
+import com.mes.pp.entity.OptimizeDetail;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -18,17 +34,126 @@
* @author zhoush
* @since 2024-03-27
*/
+@Slf4j
@Service
public class DownStorageCageServiceImpl extends ServiceImpl<DownStorageCageMapper, DownStorageCage> implements DownStorageCageService {
- @Autowired
+ @Autowired(required = false)
private DownStorageCageMapper downStorageCageMapper;
+ @Autowired
+ private GlassInfoService glassInfoService;
+
+ @Autowired
+ private DownGlassTaskService downGlassTaskService;
+ @Autowired
+ private DownStorageCageDetailsService downStorageCageDetailsService;
+ @Autowired
+ private DownStorageCageDetailsMapper downStorageCageDetailsMapper;
+
@Override
- public List<Map> gettask() {
- downStorageCageMapper.selectList(null);
-// downStorageCageMapper.selectJoin();
- return null;
+ public DownGlassTask createDownGlassTask(GlassInfo glassInfo, String startCell, String endCell, String taskType) {
+ DownGlassTask downGlassTask = new DownGlassTask();
+
+ BeanUtils.copyProperties(glassInfo, downGlassTask);
+
+ downGlassTask.setStartCell(startCell);
+ downGlassTask.setTaskType(taskType);
+ downGlassTask.setEndCell(endCell);
+ return downGlassTask;
}
- ;
+ @Override
+ public DownGlassTask createDownGlassTask(DownStorageCageDetails glassInfo, String startCell, String endCell, String taskType) {
+ DownGlassTask downGlassTask = new DownGlassTask();
+
+ BeanUtils.copyProperties(glassInfo, downGlassTask);
+ downGlassTask.setStartCell(startCell);
+ downGlassTask.setTaskType(taskType);
+ downGlassTask.setEndCell(endCell);
+ return downGlassTask;
+ }
+
+
+
+
+ //鎵惧埌绌烘牸瀛�
+ @Override
+ public List<DownStorageCageDetails> selectCacheEmpty() {
+ return baseMapper.selectJoinList(DownStorageCageDetails.class,
+ JoinWrappers.lambda(DownStorageCage.class)
+ .selectAll(DownStorageCage.class)
+ .select(DownStorageCageDetails::getWidth, DownStorageCageDetails::getHeight, DownStorageCageDetails::getGlassId)
+ .leftJoin(DownStorageCageDetails.class, on -> on
+ .eq(DownStorageCageDetails::getDeviceId, DownStorageCage::getDeviceId)
+ .eq(DownStorageCageDetails::getSlot, DownStorageCage::getSlot))
+ .isNull(DownStorageCageDetails::getSlot)
+ );
+ }
+
+
+
+
+
+
+ @Override
+ public List<Map<String, Object>> selectDownStorageCages() {
+ return baseMapper.selectJoinMaps(JoinWrappers.lambda(DownStorageCage.class)
+ .selectAll(DownStorageCage.class)
+ .selectAs(DownStorageCageDetails::getId, "esdId")
+ .select(DownStorageCageDetails::getGlassId, DownStorageCageDetails::getWidth, DownStorageCageDetails::getHeight, DownStorageCageDetails::getId)
+ .leftJoin(DownStorageCageDetails.class, on -> on
+ .eq(DownStorageCageDetails::getDeviceId, DownStorageCage::getDeviceId)
+ .eq(DownStorageCageDetails::getSlot, DownStorageCage::getSlot))
+ );
+
+ }
+
+ /**
+ * 淇敼鐞嗙墖绗间俊鎭� 鍔熻兘锛氬绗煎唴鏍呮牸鐜荤拑 銆愬惎鐢�/绂佺敤銆�
+ *
+ * @param downStorageCage
+ * @return
+ */
+ @Override
+ public boolean updateDownStorageCage(DownStorageCage downStorageCage) {
+ DownStorageCage downItem = baseMapper.selectById(downStorageCage.getId());
+ downItem.setEnableState(downStorageCage.getEnableState());
+ baseMapper.updateById(downItem);
+ return true;
+ }
+
+ /**
+ * 淇敼鐞嗙墖绗间俊鎭� 鍔熻兘锛氬绗煎唴鏍呮牸鐜荤拑 銆愭坊鍔�/鍒犻櫎/鏇存崲銆�
+ *
+ * @param downStorageCageId
+ * @param downStorageCageDetails
+ * @return
+ */
+ @Override
+ public boolean updateDownStorageCageDetails(int downStorageCageId, DownStorageCageDetails downStorageCageDetails) {
+ DownStorageCage downItem = baseMapper.selectById(downStorageCageId);
+ log.info("姝e父" + downItem);
+ if (downStorageCageDetails != null) {
+ DownStorageCageDetails edgDItem = downStorageCageDetailsMapper.selectById(downStorageCageDetails.getId());
+ //娣诲姞
+ if (edgDItem != null) {
+ //鍙紶鏍煎瓙 锛氱Щ闄ょ幓鐠�
+ DownStorageCageDetails newresult = downStorageCageDetailsMapper.selectById(downStorageCageDetails.getId());
+ newresult.setSlot(downItem.getSlot());
+ downStorageCageDetailsMapper.updateById(newresult);
+ }
+ }
+
+ if (downItem != null) {
+ //绉婚櫎
+ DownStorageCageDetails result = downStorageCageDetailsMapper.selectOne(new MPJLambdaWrapper<DownStorageCageDetails>().eq(DownStorageCageDetails::getSlot, downStorageCageId));
+ if (result != null) {
+ result.setSlot(0);
+ downStorageCageDetailsMapper.updateById(result);
+ }
+
+ }
+ return true;
+ }
+
}
--
Gitblit v1.8.0