소스 검색

Merge branch 'master' of 123.57.213.14:guoqiang.duan/zgzt-bus-java

guoqiang 6 달 전
부모
커밋
213bac0d16

+ 75 - 73
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/stackingAndLoadingVehicles/service/impl/StackingAndLoadingVehiclesServiceImpl.java

@@ -1,6 +1,5 @@
 package org.jeecg.modules.billet.stackingAndLoadingVehicles.service.impl;
 
-import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.toolkit.IdWorker;
@@ -18,6 +17,12 @@ import org.jeecg.modules.billet.billetHotsend.service.IRulerDefaultConfigService
 import org.jeecg.modules.billet.billetHotsendConfig.entity.BilletHotsendTypeConfig;
 import org.jeecg.modules.billet.billetHotsendConfig.service.IBilletHotsendTypeConfigService;
 import org.jeecg.modules.billet.operateLog.service.IOperateLogService;
+import org.jeecg.modules.billet.rollClubThree.entity.RollClubThreeDetails;
+import org.jeecg.modules.billet.rollClubThree.service.IRollClubThreeDetailsService;
+import org.jeecg.modules.billet.rollClubTwo.entity.RollClubTwoDetails;
+import org.jeecg.modules.billet.rollClubTwo.service.IRollClubTwoDetailsService;
+import org.jeecg.modules.billet.rollOutShipp.entity.RollOutShippDetails;
+import org.jeecg.modules.billet.rollOutShipp.service.IRollOutShippDetailsService;
 import org.jeecg.modules.billet.stackingAndLoadingVehicles.entity.StackingAndLoadingVehicles;
 import org.jeecg.modules.billet.stackingAndLoadingVehicles.entity.StackingDownLog;
 import org.jeecg.modules.billet.stackingAndLoadingVehicles.entity.StackingUpLog;
@@ -77,7 +82,12 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
     private StackingAndLoadingVehiclesMapper stackingAndLoadingVehiclesMapper;
     @Autowired
     private IHeatsActualsService heatsActualsService;
-
+    @Autowired
+    private IRollOutShippDetailsService rollOutShippDetailsService;
+    @Autowired
+    private IRollClubThreeDetailsService rollClubThreeDetailsService;
+    @Autowired
+    private IRollClubTwoDetailsService rollClubTwoDetailsService;
     @Override
     public List<List<StackingAndLoadingVehicles>> getListBySatck(String typeConfigId) {
         LambdaQueryWrapper<StackingAndLoadingVehicles> wrapper = new LambdaQueryWrapper<>();
@@ -472,36 +482,6 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
         if (oConvertUtils.listIsEmpty(stackingAndLoadingVehiclesList)){
             return;
         }
-        LambdaQueryWrapper<BilletHotsend> queryWrapper = new LambdaQueryWrapper<>();
-        queryWrapper.eq(BilletHotsend::getCcmNo, billetHotsend.getCcmNo())
-                .eq(BilletHotsend::getHeatNo, billetHotsend.getHeatNo())
-                .eq(BilletHotsend::getShift, cacheShint)
-                .eq(BilletHotsend::getShiftGroup, cacheShintGroup);
-        BilletHotsend idExistBh = billetHotsendBaseService.getOne(queryWrapper);
-        if (oConvertUtils.isNotEmpty(idExistBh)){
-            if (idExistBh.getStackNum() < stackingAndLoadingVehiclesList.size() * 4){
-                billetHotsend.setStackNum(stackingAndLoadingVehiclesList.size() * 4); // 堆垛总支数
-                log.info("{}{}", ">>>>>>>>>堆垛总支数计算出现异常:", JSON.toJSON(loadingParams));
-            }else {
-                billetHotsend.setStackNum(idExistBh.getStackNum() - stackingAndLoadingVehiclesList.size() * 4); // 堆垛总支数
-            }
-            // 钢坯热送基础信息存在,但是钢坯信息不存在 直接返回
-            LambdaUpdateWrapper<BilletHotsend> updateWrapper = new LambdaUpdateWrapper<>();
-            updateWrapper.eq(BilletHotsend::getCcmNo, billetHotsend.getCcmNo())
-                    .eq(BilletHotsend::getHeatNo, billetHotsend.getHeatNo())
-                    .eq(BilletHotsend::getShift, cacheShint)
-                    .eq(BilletHotsend::getShiftGroup, cacheShintGroup)
-                    .set(BilletHotsend::getStackNum, billetHotsend.getStackNum())
-                    .set(BilletHotsend::getShift, cacheShint)
-                    .set(BilletHotsend::getShiftGroup, cacheShintGroup);
-            billetHotsendBaseService.update(billetHotsend, updateWrapper);
-        } else {
-            // 钢坯热送基础信息不存在,但是钢坯信息不存在 保存钢坯热送基础信息
-            billetHotsend.setStackNum(stackingAndLoadingVehiclesList.size() * 4);
-            billetHotsend.setShiftGroup(cacheShintGroup);
-            billetHotsend.setShift(cacheShint);
-            billetHotsendBaseService.save(billetHotsend);
-        }
         // 根据铸机号、位置、层数、类型配置ID更新 初始化容器中的垛位信息
         stackingAndLoadingVehiclesList.forEach(x ->{
             LambdaUpdateWrapper<StackingAndLoadingVehicles> updateWrapper = new LambdaUpdateWrapper();
@@ -517,6 +497,13 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
             StackingAndLoadingVehicles stackingAndLoadingVehicles = new StackingAndLoadingVehicles();
             BeanUtils.copyProperties(x, stackingAndLoadingVehicles);
             stackingAndLoadingVehiclesMapper.update(stackingAndLoadingVehicles, updateWrapper);
+            // 先根据垛位容器中的铸机号和炉号 查询钢坯热送基础信息
+            LambdaQueryWrapper<BilletHotsend> queryWrapper1 = new LambdaQueryWrapper<>();
+            queryWrapper1.eq(BilletHotsend::getCcmNo, x.getCcmNo())
+                    .eq(BilletHotsend::getHeatNo, x.getHeatNo());
+            BilletHotsend idExistBh = billetHotsendBaseService.getOne(queryWrapper1);
+            idExistBh.setStackNum(idExistBh.getStackNum() - 4);
+            billetHotsendBaseService.updateById(idExistBh);
         });
         String finalCacheShint1 = cacheShint;
         String finalCacheShintGroup1 = cacheShintGroup;
@@ -585,36 +572,6 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
         if (oConvertUtils.listIsEmpty(stackingAndLoadingVehiclesList)){
             return;
         }
-        LambdaQueryWrapper<BilletHotsend> queryWrapper = new LambdaQueryWrapper<>();
-        queryWrapper.eq(BilletHotsend::getCcmNo, billetHotsend.getCcmNo())
-                .eq(BilletHotsend::getHeatNo, billetHotsend.getHeatNo())
-                .eq(BilletHotsend::getShift, cacheShint)
-                .eq(BilletHotsend::getShiftGroup, cacheShintGroup);
-        BilletHotsend idExistBh = billetHotsendBaseService.getOne(queryWrapper);
-        if (oConvertUtils.isNotEmpty(idExistBh)){
-            if (idExistBh.getStackNum() < stackingAndLoadingVehiclesList.size() * 4){
-                billetHotsend.setStackNum(stackingAndLoadingVehiclesList.size() * 4); // 堆垛总支数
-                log.info("{}{}", ">>>>>>>>>堆垛总支数计算出现异常:", JSON.toJSON(loadingParams));
-            }else {
-                billetHotsend.setStackNum(idExistBh.getStackNum() - stackingAndLoadingVehiclesList.size() * 4); // 堆垛总支数
-            }
-            // 钢坯热送基础信息存在,但是钢坯信息不存在 直接返回
-            LambdaUpdateWrapper<BilletHotsend> updateWrapper = new LambdaUpdateWrapper<>();
-            updateWrapper.eq(BilletHotsend::getCcmNo, billetHotsend.getCcmNo())
-                    .eq(BilletHotsend::getHeatNo, billetHotsend.getHeatNo())
-                    .eq(BilletHotsend::getShift, cacheShint)
-                    .eq(BilletHotsend::getShiftGroup, cacheShintGroup)
-                    .set(BilletHotsend::getStackNum, billetHotsend.getStackNum())
-                    .set(BilletHotsend::getShift, cacheShint)
-                    .set(BilletHotsend::getShiftGroup, cacheShintGroup);
-            billetHotsendBaseService.update(billetHotsend, updateWrapper);
-        } else {
-            // 钢坯热送基础信息不存在,但是钢坯信息不存在 保存钢坯热送基础信息
-            billetHotsend.setStackNum(stackingAndLoadingVehiclesList.size() * 4);
-            billetHotsend.setShiftGroup(cacheShintGroup);
-            billetHotsend.setShift(cacheShint);
-            billetHotsendBaseService.save(billetHotsend);
-        }
         // 2 发车后,动态更新容器中的垛位信息 初始化
         stackingAndLoadingVehiclesList.forEach(x ->{
             LambdaUpdateWrapper<StackingAndLoadingVehicles> updateWrapper = new LambdaUpdateWrapper();
@@ -630,6 +587,13 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
             StackingAndLoadingVehicles stackingAndLoadingVehicles = new StackingAndLoadingVehicles();
             BeanUtils.copyProperties(x, stackingAndLoadingVehicles);
             stackingAndLoadingVehiclesMapper.update(stackingAndLoadingVehicles, updateWrapper);
+            // 先根据垛位容器中的铸机号和炉号 查询钢坯热送基础信息
+            LambdaQueryWrapper<BilletHotsend> queryWrapper1 = new LambdaQueryWrapper<>();
+            queryWrapper1.eq(BilletHotsend::getCcmNo, x.getCcmNo())
+                    .eq(BilletHotsend::getHeatNo, x.getHeatNo());
+            BilletHotsend idExistBh = billetHotsendBaseService.getOne(queryWrapper1);
+            idExistBh.setStackNum(idExistBh.getStackNum() - 4);
+            billetHotsendBaseService.updateById(idExistBh);
         });
 
         // 4 保存 下垛日志    stacking_down_log
@@ -679,20 +643,58 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
         // 7 发车后,新增钢坯堆垛储运信息,生成储运单 storage_car_log
         StorageCarLog storageCarLog = new StorageCarLog();
         BeanUtils.copyProperties(storageBill, storageCarLog);
+        List<String> sizeList = new ArrayList<>();
+        List<String> heatNoList = new ArrayList<>();
+        long count = 0l;
+        //根据铸机号、钢坯转运单ID查询定尺信息
+        if ("roll_club_two".equals(loadingParams.getDestinationTable())){
+            LambdaQueryWrapper<RollClubTwoDetails> queryWrapperRC = new LambdaQueryWrapper();
+            queryWrapperRC.eq(RollClubTwoDetails::getCcmNo, storageBill.getCcmNo()).eq(RollClubTwoDetails::getStorageBillId, storageBill.getId());
+            List<RollClubTwoDetails> rollClubTwoDetailsList = rollClubTwoDetailsService.list(queryWrapperRC);
+            sizeList = rollClubTwoDetailsList.stream().map(RollClubTwoDetails::getSize).distinct()
+                    .collect(Collectors.toList());
+            heatNoList = rollClubTwoDetailsList.stream().map(RollClubTwoDetails::getHeatNo).distinct()
+                    .collect(Collectors.toList());
+            if (oConvertUtils.listIsNotEmpty(rollClubTwoDetailsList)){
+                count = rollClubTwoDetailsList.stream().count();
+            }
+        }
+        if ("roll_club_three".equals(loadingParams.getDestinationTable())){
+            LambdaQueryWrapper<RollClubThreeDetails> queryWrapperCT = new LambdaQueryWrapper();
+            queryWrapperCT.eq(RollClubThreeDetails::getCcmNo, storageBill.getCcmNo()).eq(RollClubThreeDetails::getStorageBillId, storageBill.getId());
+            List<RollClubThreeDetails> rollClubThreeDetailsList = rollClubThreeDetailsService.list(queryWrapperCT);
+            sizeList = rollClubThreeDetailsList.stream().map(RollClubThreeDetails::getSize).distinct()
+                    .collect(Collectors.toList());
+            heatNoList = rollClubThreeDetailsList.stream().map(RollClubThreeDetails::getHeatNo).distinct()
+                    .collect(Collectors.toList());
+            if (oConvertUtils.listIsNotEmpty(rollClubThreeDetailsList)){
+                count = rollClubThreeDetailsList.stream().count();
+            }
+        }
+        if ("roll_out_shipp".equals(loadingParams.getDestinationTable())){
+            LambdaQueryWrapper<RollOutShippDetails> queryWrapperROS = new LambdaQueryWrapper();
+            queryWrapperROS.eq(RollOutShippDetails::getCcmNo, storageBill.getCcmNo()).eq(RollOutShippDetails::getStorageBillId, storageBill.getId());
+            List<RollOutShippDetails> rollOutShippDetailsList = rollOutShippDetailsService.list(queryWrapperROS);
+            sizeList = rollOutShippDetailsList.stream().map(RollOutShippDetails::getSize).distinct()
+                    .collect(Collectors.toList());
+            heatNoList = rollOutShippDetailsList.stream().map(RollOutShippDetails::getHeatNo).distinct()
+                    .collect(Collectors.toList());
+            if (oConvertUtils.listIsNotEmpty(rollOutShippDetailsList)){
+                count = rollOutShippDetailsList.stream().count();
+            }
+        }
+        Integer bx =Integer.valueOf((int) count);
+        LambdaQueryWrapper<StackingDownLog> queryWrappersd = new LambdaQueryWrapper();
+        queryWrappersd.eq(StackingDownLog::getCcmNo, storageBill.getCcmNo()).eq(StackingDownLog::getStorageBillId, storageBill.getId());
+        List<StackingDownLog> stackingDownLogs = stackingDownLogService.list(queryWrappersd);
+        Integer dd = stackingDownLogs.size() * 4 + bx;
         storageCarLog.setDestination(loadingParams.getDestination());// 目的地
         storageCarLog.setCarNm(storageBill.getLicensePlate());// 车牌号
         storageCarLog.setTypeConfigId(billetHotsendTypeConfig.getId()); // 钢坯配置类型ID
-        storageCarLog.setHeatNo(billetHotsend.getHeatNo());
-//			  storageCarLog.setFixedWeight();// 定重
-//            storageCarLog.setSize();// 定尺
-        // 查询上垛记录,计算出总支数
-        LambdaQueryWrapper<StackingUpLog> queryWrapperSU = new LambdaQueryWrapper<>();
-        queryWrapperSU.eq(StackingUpLog::getCcmNo, billetHotsend.getCcmNo())
-                .eq(StackingUpLog::getHeatNo, billetHotsend.getHeatNo())
-                .eq(StackingUpLog::getShift, finalCacheShint1)
-                .eq(StackingUpLog::getShiftGroup, finalCacheShintGroup1);
-        List<StackingUpLog> stackingUpLogList = stackingUpLogService.list(queryWrapperSU);
-        storageCarLog.setAmount(stackingUpLogList.size());// 支数
+        storageCarLog.setHeatNo(String.join(",", heatNoList));
+        storageCarLog.setSize(String.join(",", sizeList));// 定尺
+        storageCarLog.setAmount(dd);// 支数
+        storageCarLog.setDataTime(new Date());
         storageCarLogService.save(storageCarLog);
     }
 

+ 4 - 0
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/stackingAndLoadingVehicles/vo/LoadingParams.java

@@ -50,4 +50,8 @@ public class LoadingParams {
     @Excel(name = "目的地ID", width = 15)
     @ApiModelProperty(value = "目的地ID")
     private String destinationId;
+
+    @Excel(name = "目的地表", width = 15)
+    @ApiModelProperty(value = "目的地表")
+    private String destinationTable;
 }

+ 1 - 0
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/storageBill/controller/StorageBillController.java

@@ -184,6 +184,7 @@ public class StorageBillController extends JeecgController<StorageBill, IStorage
 //		storageCarLog.setFixedWeight();// 定重
 //      storageCarLog.setSize(storageBill.getSize());// 定尺
 		// 查询上垛记录,计算出总支数
+		storageCarLog.setDataTime(new Date());
 		storageCarLog.setAmount(storageBill.getAmountTotal());// 支数
 		storageCarLogService.save(storageCarLog);
 		operateLogService.add(storageBill,null,StorageBill.class);