qiangxuan 2 ماه پیش
والد
کامیت
bbf479caf9

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

@@ -461,6 +461,7 @@ public class StorageBillController extends JeecgController<StorageBill, IStorage
 			BeanUtils.copyProperties(storageBill, old);
 			log.info("钢坯装运单编辑,前端同步总支数:{}", old.getAmountTotal());
 			old.setAmountTotal(originalAmountTotal);
+
 			log.info("钢坯装运单编辑,同步装运单原始总支数:{}", old.getAmountTotal());
 			JSONObject jsonObject = storageBillService.billetAutoTmpDataSyn(old);
 
@@ -1367,7 +1368,6 @@ public class StorageBillController extends JeecgController<StorageBill, IStorage
 			return Result.error("参数异常!");
 		}
 		StorageBill bill = storageBillService.getById(storageBill.getId());
-		int originalAmountTotal = bill.getAmountTotal();
 		// 原始装运单目的地ID是1024,才走数据同步
 		if("1024".equals(bill.getTypeConfigId()) && !"1024".equals(storageBill.getTypeConfigId())){
 			bill.setDestination(storageBill.getDestination());

+ 133 - 133
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/storageBill/service/impl/StorageBillServiceImpl.java

@@ -2768,60 +2768,60 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
 
             log.info("{}{}", "编辑装运单未知目的地数据同步临时表总条数:", rollClubCommonList.size());
 
-//            // 根据ID获取钢坯配置信息
-//            BilletHotsend billetHotsend = new BilletHotsend();
-//            billetHotsend.setCcmNo(storageBill.getCcmNo());
-//            BilletHotsendTypeConfig billetHotsendTypeConfig = billetHotsendTypeConfigService.getById(storageBill.getTypeConfigId());
-//
-//            BilletHotsendDetailsVo billetHotsendDetailsVo = new BilletHotsendDetailsVo();
-//            billetHotsendDetailsVo.setBelongTable(billetHotsendTypeConfig.getBelongTable());
-//            billetHotsendDetailsVo.setBelongTypeName(billetHotsendTypeConfig.getTypeName());
-//
-//            billetHotsendDetailsVo.setDestination(billetHotsendTypeConfig.getTypeName());
-//            billetHotsendDetailsVo.setDestinationId(billetHotsendTypeConfig.getId());
-//            billetHotsendDetailsVo.setBilletHotsendTypeConfigId(billetHotsendTypeConfig.getId());
-//
-//            billetHotsendDetailsVo.setStorageBill(storageBill);
-//            billetHotsendDetailsVo.setBilletHotsend(billetHotsend);
-//            billetHotsendDetailsVo.setRollClubCommonList(rollClubCommonList);
-//
-//            Map<String, List<RollClubCommon>> rollClubCommonLists = groupByShiftAttributes(rollClubCommonList);
-//            /**
-//             * 维护热送单炉信息 保存棒二或或棒三明细 更新钢坯基础信息
-//             * 在这里可以添加更多针对每个分组(键和对应列表)的业务逻辑操作,比如遍历列表中的元素等
-//             */
-//            for (Map.Entry<String, List<RollClubCommon>> entry : rollClubCommonLists.entrySet()) {
-//                String[] parts = entry.getKey().split(",");
-//                billetHotsend.setHeatNo(parts[0]);// 炉号
-//                billetHotsend.setShiftGroup(parts[1]);// 班组
-//                billetHotsend.setShift(parts[2]);// 班别
-//                List<RollClubCommon> groupRollClubCommonList = entry.getValue();
-//                JSONObject jsonObject = commonBilletHotsenAndDetailsHandle(billetHotsend, billetHotsendDetailsVo, billetHotsendTypeConfig, storageBill, groupRollClubCommonList, null);
-//                if (jsonObject.containsKey("fail")) {
-//                    TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
-//                    log.info("{}{}", "编辑装运单未知目的地数据同步操作失败,事务回滚!", jsonObject);
-//                    result.put("fail", "编辑装运单未知目的地数据同步操作失败!");
-//                    return result;
-//                }
-//            }
-//            List<String> billetNos = rollClubCommonList.stream().map(RollClubCommon::getBilletNo).collect(Collectors.toList());
-//            //查询并批量更新钢坯基础信息 belongTable
-//            LambdaQueryWrapper<BilletBasicInfo> queryWrapperls = new LambdaQueryWrapper<BilletBasicInfo>()
-//                    .eq(BilletBasicInfo::getCcmNo, Integer.valueOf(billetHotsend.getCcmNo()))
-//                    .in(BilletBasicInfo::getBilletNo, billetNos);
-//            List<BilletBasicInfo> billetBasicInfoList = billetBasicInfoService.list(queryWrapperls);
-//            billetBasicInfoList.forEach(x ->{
-//                if ("roll_club_two".equals(billetHotsendDetailsVo.getBelongTable())){
-//                    x.setBelongTable("roll_club_two");
-//                }else if ("roll_club_three".equals(billetHotsendDetailsVo.getBelongTable())){
-//                    x.setBelongTable("roll_club_three");
-//                }else if ("roll_out_shipp".equals(billetHotsendDetailsVo.getBelongTable())){
-//                    x.setBelongTable("roll_out_shipp");
-//                }
-//                x.setBhtcId(billetHotsendDetailsVo.getBilletHotsendTypeConfigId());
-//                x.setUpdateTime(new Date());
-//            });
-//            billetBasicInfoService.saveOrUpdateBatch(billetBasicInfoList);
+            // 根据ID获取钢坯配置信息
+            BilletHotsend billetHotsend = new BilletHotsend();
+            billetHotsend.setCcmNo(storageBill.getCcmNo());
+            BilletHotsendTypeConfig billetHotsendTypeConfig = billetHotsendTypeConfigService.getById(storageBill.getTypeConfigId());
+
+            BilletHotsendDetailsVo billetHotsendDetailsVo = new BilletHotsendDetailsVo();
+            billetHotsendDetailsVo.setBelongTable(billetHotsendTypeConfig.getBelongTable());
+            billetHotsendDetailsVo.setBelongTypeName(billetHotsendTypeConfig.getTypeName());
+
+            billetHotsendDetailsVo.setDestination(billetHotsendTypeConfig.getTypeName());
+            billetHotsendDetailsVo.setDestinationId(billetHotsendTypeConfig.getId());
+            billetHotsendDetailsVo.setBilletHotsendTypeConfigId(billetHotsendTypeConfig.getId());
+
+            billetHotsendDetailsVo.setStorageBill(storageBill);
+            billetHotsendDetailsVo.setBilletHotsend(billetHotsend);
+            billetHotsendDetailsVo.setRollClubCommonList(rollClubCommonList);
+
+            Map<String, List<RollClubCommon>> rollClubCommonLists = groupByShiftAttributes(rollClubCommonList);
+            /**
+             * 维护热送单炉信息 保存棒二或或棒三明细 更新钢坯基础信息
+             * 在这里可以添加更多针对每个分组(键和对应列表)的业务逻辑操作,比如遍历列表中的元素等
+             */
+            for (Map.Entry<String, List<RollClubCommon>> entry : rollClubCommonLists.entrySet()) {
+                String[] parts = entry.getKey().split(",");
+                billetHotsend.setHeatNo(parts[0]);// 炉号
+                billetHotsend.setShiftGroup(parts[1]);// 班组
+                billetHotsend.setShift(parts[2]);// 班别
+                List<RollClubCommon> groupRollClubCommonList = entry.getValue();
+                JSONObject jsonObject = commonBilletHotsenAndDetailsHandle(billetHotsend, billetHotsendDetailsVo, billetHotsendTypeConfig, storageBill, groupRollClubCommonList, null);
+                if (jsonObject.containsKey("fail")) {
+                    TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                    log.info("{}{}", "编辑装运单未知目的地数据同步操作失败,事务回滚!", jsonObject);
+                    result.put("fail", "编辑装运单未知目的地数据同步操作失败!");
+                    return result;
+                }
+            }
+            List<String> billetNos = rollClubCommonList.stream().map(RollClubCommon::getBilletNo).collect(Collectors.toList());
+            //查询并批量更新钢坯基础信息 belongTable
+            LambdaQueryWrapper<BilletBasicInfo> queryWrapperls = new LambdaQueryWrapper<BilletBasicInfo>()
+                    .eq(BilletBasicInfo::getCcmNo, Integer.valueOf(billetHotsend.getCcmNo()))
+                    .in(BilletBasicInfo::getBilletNo, billetNos);
+            List<BilletBasicInfo> billetBasicInfoList = billetBasicInfoService.list(queryWrapperls);
+            billetBasicInfoList.forEach(x ->{
+                if ("roll_club_two".equals(billetHotsendDetailsVo.getBelongTable())){
+                    x.setBelongTable("roll_club_two");
+                }else if ("roll_club_three".equals(billetHotsendDetailsVo.getBelongTable())){
+                    x.setBelongTable("roll_club_three");
+                }else if ("roll_out_shipp".equals(billetHotsendDetailsVo.getBelongTable())){
+                    x.setBelongTable("roll_out_shipp");
+                }
+                x.setBhtcId(billetHotsendDetailsVo.getBilletHotsendTypeConfigId());
+                x.setUpdateTime(new Date());
+            });
+            billetBasicInfoService.saveOrUpdateBatch(billetBasicInfoList);
 
             log.info("{}{}", "B端编辑装运单未知目的地数据同步时,装运单总支数:", storageBill.getAmountTotal());
             // 维护总支数
@@ -2839,23 +2839,23 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
             String sizeString = String.join(",", sizeList.stream().map(String::valueOf).collect(Collectors.toList()));
             storageBill.setSize(sizeString);// 定尺
 
-//            List<String> assemblyNumberList = billetBasicInfoList.stream().map(BilletBasicInfo::getAssemblyNumber).filter(assemblyNumber -> oConvertUtils.isNotEmpty(assemblyNumber)).collect(Collectors.toList());
-//            if(oConvertUtils.listIsNotEmpty(assemblyNumberList)) {
-//                String distinctAssemblyNumber = billetBasicInfoList.stream()
-//                        .map(BilletBasicInfo::getAssemblyNumber)
-//                        .filter(assemblyNumber -> oConvertUtils.isNotEmpty(assemblyNumber))
-//                        .distinct().collect(Collectors.joining(","));
-//                String finalAssemblyNumber = Optional.ofNullable(storageBill.getAssemblyNumber())
-//                        .filter(oConvertUtils::isNotEmpty)
-//                        .map(s -> s + "," + distinctAssemblyNumber)
-//                        .orElse(distinctAssemblyNumber);
-//                storageBill.setAssemblyNumber(finalAssemblyNumber);
-//            }
+            List<String> assemblyNumberList = billetBasicInfoList.stream().map(BilletBasicInfo::getAssemblyNumber).filter(assemblyNumber -> oConvertUtils.isNotEmpty(assemblyNumber)).collect(Collectors.toList());
+            if(oConvertUtils.listIsNotEmpty(assemblyNumberList)) {
+                String distinctAssemblyNumber = billetBasicInfoList.stream()
+                        .map(BilletBasicInfo::getAssemblyNumber)
+                        .filter(assemblyNumber -> oConvertUtils.isNotEmpty(assemblyNumber))
+                        .distinct().collect(Collectors.joining(","));
+                String finalAssemblyNumber = Optional.ofNullable(storageBill.getAssemblyNumber())
+                        .filter(oConvertUtils::isNotEmpty)
+                        .map(s -> s + "," + distinctAssemblyNumber)
+                        .orElse(distinctAssemblyNumber);
+                storageBill.setAssemblyNumber(finalAssemblyNumber);
+            }
             storageBill.setUpdateTime(new Date());
             baseMapper.updateById(storageBill);
 
             // 物理删除钢坯临时表记录
-//            billetAutoTmpService.removeBatchByIds(billetAutoTmpList.stream().map(BilletAutoTmp::getId).collect(Collectors.toList()));
+            billetAutoTmpService.removeBatchByIds(billetAutoTmpList.stream().map(BilletAutoTmp::getId).collect(Collectors.toList()));
             result.put("success", "B端编辑装运单未知目的地明细同步成功!");
             return result;
         }catch (Exception e){
@@ -2895,60 +2895,60 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
 
             log.info("{}{}", "看板确认目的地同步临时表总条数:", rollClubCommonList.size());
 
-//            // 根据ID获取钢坯配置信息
-//            BilletHotsend billetHotsend = new BilletHotsend();
-//            billetHotsend.setCcmNo(storageBill.getCcmNo());
-//            BilletHotsendTypeConfig billetHotsendTypeConfig = billetHotsendTypeConfigService.getById(storageBill.getTypeConfigId());
-//
-//            BilletHotsendDetailsVo billetHotsendDetailsVo = new BilletHotsendDetailsVo();
-//            billetHotsendDetailsVo.setBelongTable(billetHotsendTypeConfig.getBelongTable());
-//            billetHotsendDetailsVo.setBelongTypeName(billetHotsendTypeConfig.getTypeName());
-//
-//            billetHotsendDetailsVo.setDestination(billetHotsendTypeConfig.getTypeName());
-//            billetHotsendDetailsVo.setDestinationId(billetHotsendTypeConfig.getId());
-//            billetHotsendDetailsVo.setBilletHotsendTypeConfigId(billetHotsendTypeConfig.getId());
-//
-//            billetHotsendDetailsVo.setStorageBill(storageBill);
-//            billetHotsendDetailsVo.setBilletHotsend(billetHotsend);
-//            billetHotsendDetailsVo.setRollClubCommonList(rollClubCommonList);
-//
-//            Map<String, List<RollClubCommon>> rollClubCommonLists = groupByShiftAttributes(rollClubCommonList);
-//            /**
-//             * 维护热送单炉信息 保存棒二或或棒三明细 更新钢坯基础信息
-//             * 在这里可以添加更多针对每个分组(键和对应列表)的业务逻辑操作,比如遍历列表中的元素等
-//             */
-//            for (Map.Entry<String, List<RollClubCommon>> entry : rollClubCommonLists.entrySet()) {
-//                String[] parts = entry.getKey().split(",");
-//                billetHotsend.setHeatNo(parts[0]);// 炉号
-//                billetHotsend.setShiftGroup(parts[1]);// 班组
-//                billetHotsend.setShift(parts[2]);// 班别
-//                List<RollClubCommon> groupRollClubCommonList = entry.getValue();
-//                JSONObject jsonObject = commonBilletHotsenAndDetailsHandle(billetHotsend, billetHotsendDetailsVo, billetHotsendTypeConfig, storageBill, groupRollClubCommonList, null);
-//                if (jsonObject.containsKey("fail")) {
-//                    TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
-//                    log.info("{}{}", "B端钢坯装运单未知目的地数据同步操作失败,看板确认目的地事务回滚!", jsonObject);
-//                    result.put("fail", "B端钢坯装运单看板确认目的地同步操作失败!");
-//                    return result;
-//                }
-//            }
-//            List<String> billetNos = rollClubCommonList.stream().map(RollClubCommon::getBilletNo).collect(Collectors.toList());
-//            //查询并批量更新钢坯基础信息 belongTable
-//            LambdaQueryWrapper<BilletBasicInfo> queryWrapperls = new LambdaQueryWrapper<BilletBasicInfo>()
-//                    .eq(BilletBasicInfo::getCcmNo, Integer.valueOf(billetHotsend.getCcmNo()))
-//                    .in(BilletBasicInfo::getBilletNo, billetNos);
-//            List<BilletBasicInfo> billetBasicInfoList = billetBasicInfoService.list(queryWrapperls);
-//            billetBasicInfoList.forEach(x ->{
-//                if ("roll_club_two".equals(billetHotsendDetailsVo.getBelongTable())){
-//                    x.setBelongTable("roll_club_two");
-//                }else if ("roll_club_three".equals(billetHotsendDetailsVo.getBelongTable())){
-//                    x.setBelongTable("roll_club_three");
-//                }else if ("roll_out_shipp".equals(billetHotsendDetailsVo.getBelongTable())){
-//                    x.setBelongTable("roll_out_shipp");
-//                }
-//                x.setBhtcId(billetHotsendDetailsVo.getBilletHotsendTypeConfigId());
-//                x.setUpdateTime(new Date());
-//            });
-//            billetBasicInfoService.saveOrUpdateBatch(billetBasicInfoList);
+            // 根据ID获取钢坯配置信息
+            BilletHotsend billetHotsend = new BilletHotsend();
+            billetHotsend.setCcmNo(storageBill.getCcmNo());
+            BilletHotsendTypeConfig billetHotsendTypeConfig = billetHotsendTypeConfigService.getById(storageBill.getTypeConfigId());
+
+            BilletHotsendDetailsVo billetHotsendDetailsVo = new BilletHotsendDetailsVo();
+            billetHotsendDetailsVo.setBelongTable(billetHotsendTypeConfig.getBelongTable());
+            billetHotsendDetailsVo.setBelongTypeName(billetHotsendTypeConfig.getTypeName());
+
+            billetHotsendDetailsVo.setDestination(billetHotsendTypeConfig.getTypeName());
+            billetHotsendDetailsVo.setDestinationId(billetHotsendTypeConfig.getId());
+            billetHotsendDetailsVo.setBilletHotsendTypeConfigId(billetHotsendTypeConfig.getId());
+
+            billetHotsendDetailsVo.setStorageBill(storageBill);
+            billetHotsendDetailsVo.setBilletHotsend(billetHotsend);
+            billetHotsendDetailsVo.setRollClubCommonList(rollClubCommonList);
+
+            Map<String, List<RollClubCommon>> rollClubCommonLists = groupByShiftAttributes(rollClubCommonList);
+            /**
+             * 维护热送单炉信息 保存棒二或或棒三明细 更新钢坯基础信息
+             * 在这里可以添加更多针对每个分组(键和对应列表)的业务逻辑操作,比如遍历列表中的元素等
+             */
+            for (Map.Entry<String, List<RollClubCommon>> entry : rollClubCommonLists.entrySet()) {
+                String[] parts = entry.getKey().split(",");
+                billetHotsend.setHeatNo(parts[0]);// 炉号
+                billetHotsend.setShiftGroup(parts[1]);// 班组
+                billetHotsend.setShift(parts[2]);// 班别
+                List<RollClubCommon> groupRollClubCommonList = entry.getValue();
+                JSONObject jsonObject = commonBilletHotsenAndDetailsHandle(billetHotsend, billetHotsendDetailsVo, billetHotsendTypeConfig, storageBill, groupRollClubCommonList, null);
+                if (jsonObject.containsKey("fail")) {
+                    TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                    log.info("{}{}", "B端钢坯装运单未知目的地数据同步操作失败,看板确认目的地事务回滚!", jsonObject);
+                    result.put("fail", "B端钢坯装运单看板确认目的地同步操作失败!");
+                    return result;
+                }
+            }
+            List<String> billetNos = rollClubCommonList.stream().map(RollClubCommon::getBilletNo).collect(Collectors.toList());
+            //查询并批量更新钢坯基础信息 belongTable
+            LambdaQueryWrapper<BilletBasicInfo> queryWrapperls = new LambdaQueryWrapper<BilletBasicInfo>()
+                    .eq(BilletBasicInfo::getCcmNo, Integer.valueOf(billetHotsend.getCcmNo()))
+                    .in(BilletBasicInfo::getBilletNo, billetNos);
+            List<BilletBasicInfo> billetBasicInfoList = billetBasicInfoService.list(queryWrapperls);
+            billetBasicInfoList.forEach(x ->{
+                if ("roll_club_two".equals(billetHotsendDetailsVo.getBelongTable())){
+                    x.setBelongTable("roll_club_two");
+                }else if ("roll_club_three".equals(billetHotsendDetailsVo.getBelongTable())){
+                    x.setBelongTable("roll_club_three");
+                }else if ("roll_out_shipp".equals(billetHotsendDetailsVo.getBelongTable())){
+                    x.setBelongTable("roll_out_shipp");
+                }
+                x.setBhtcId(billetHotsendDetailsVo.getBilletHotsendTypeConfigId());
+                x.setUpdateTime(new Date());
+            });
+            billetBasicInfoService.saveOrUpdateBatch(billetBasicInfoList);
             log.info("{}{}", "B端看板确认目的地数据同步时,装运单总支数:", storageBill.getAmountTotal());
             // 维护总支数
             storageBill.setAmountTotal(storageBill.getAmountTotal() + rollClubCommonList.size());
@@ -2965,18 +2965,18 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
             String sizeString = String.join(",", sizeList.stream().map(String::valueOf).collect(Collectors.toList()));
             storageBill.setSize(sizeString);// 定尺
 
-//            List<String> assemblyNumberList = billetBasicInfoList.stream().map(BilletBasicInfo::getAssemblyNumber).filter(assemblyNumber -> oConvertUtils.isNotEmpty(assemblyNumber)).collect(Collectors.toList());
-//            if(oConvertUtils.listIsNotEmpty(assemblyNumberList)) {
-//                String distinctAssemblyNumber = billetBasicInfoList.stream()
-//                        .map(BilletBasicInfo::getAssemblyNumber)
-//                        .filter(assemblyNumber -> oConvertUtils.isNotEmpty(assemblyNumber))
-//                        .distinct().collect(Collectors.joining(","));
-//                String finalAssemblyNumber = Optional.ofNullable(storageBill.getAssemblyNumber())
-//                        .filter(oConvertUtils::isNotEmpty)
-//                        .map(s -> s + "," + distinctAssemblyNumber)
-//                        .orElse(distinctAssemblyNumber);
-//                storageBill.setAssemblyNumber(finalAssemblyNumber);
-//            }
+            List<String> assemblyNumberList = billetBasicInfoList.stream().map(BilletBasicInfo::getAssemblyNumber).filter(assemblyNumber -> oConvertUtils.isNotEmpty(assemblyNumber)).collect(Collectors.toList());
+            if(oConvertUtils.listIsNotEmpty(assemblyNumberList)) {
+                String distinctAssemblyNumber = billetBasicInfoList.stream()
+                        .map(BilletBasicInfo::getAssemblyNumber)
+                        .filter(assemblyNumber -> oConvertUtils.isNotEmpty(assemblyNumber))
+                        .distinct().collect(Collectors.joining(","));
+                String finalAssemblyNumber = Optional.ofNullable(storageBill.getAssemblyNumber())
+                        .filter(oConvertUtils::isNotEmpty)
+                        .map(s -> s + "," + distinctAssemblyNumber)
+                        .orElse(distinctAssemblyNumber);
+                storageBill.setAssemblyNumber(finalAssemblyNumber);
+            }
             storageBill.setUpdateTime(new Date());
             baseMapper.updateById(storageBill);