Browse Source

棒线目的地切换开发

qiangxuan 3 weeks ago
parent
commit
ba73d7872e

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

@@ -1805,6 +1805,36 @@ public class StorageBillController extends JeecgController<StorageBill, IStorage
 		return Result.OK("更新车牌号成功!");
 	}
 
+	@ApiOperation(value="钢坯装运单-棒线目的地切换", notes="钢坯装运单-棒线目的地切换")
+	@RequestMapping(value = "/destinationSwitch", method = {RequestMethod.PUT})
+	public Result<String> destinationSwitch(@RequestBody StorageBill storageBill) {
+		if(oConvertUtils.isEmpty(storageBill.getId())) {
+			return Result.error("参数异常!");
+		}
+		StorageBill sb = storageBillService.getById(storageBill.getId());
+		if (oConvertUtils.isEmpty(sb)){
+			return Result.OK("装运单信息为空,棒线目的地切换失败!");
+		}
+
+		if (oConvertUtils.isEmpty(sb.getCcmNo())){
+			return Result.OK("未确认铸机号,棒线目的地切换失败!");
+		}
+
+		if (oConvertUtils.isEmpty(storageBill.getAmountTotal())){
+			return Result.OK("未装运钢坯,棒线目的地切换失败!");
+		}
+
+		if (oConvertUtils.isEmpty(storageBill.getDestination()) || "1024".equals(storageBill.getTypeConfigId())){
+			return Result.OK("未选择目的地,棒线目的地切换失败!");
+		}
+
+		if (storageBill.getDestination().equals(sb.getDestination())){
+			return Result.OK("目的地一致,棒线切换失败!");
+		}
+		String result =	storageBillService.destinationSwitchHandle(sb, storageBill.getDestination(), storageBill.getTypeConfigId());
+		return Result.OK(result);
+	}
+
 	/**
 	 * 生成综合唯一编码
 	 * @param  date

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

@@ -100,4 +100,5 @@ public interface IStorageBillService extends IService<StorageBill> {
 
     void fillCarNumbersAndShiftInfo(List<StorageBill> bills);
 
+    String destinationSwitchHandle(StorageBill sb, String destination, String typeConfigId);
 }

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

@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.toolkit.IdWorker;
@@ -20,6 +21,7 @@ import org.jeecg.modules.actualControl.billetActual.billetActual.entity.BilletBa
 import org.jeecg.modules.actualControl.billetActual.billetActual.service.IBilletBasicInfoService;
 import org.jeecg.modules.actualControl.heatsActuals.entity.HeatsActuals;
 import org.jeecg.modules.actualControl.heatsActuals.service.IHeatsActualsService;
+import org.jeecg.modules.billet.billetAutoException.entity.BilletAutoException;
 import org.jeecg.modules.billet.billetAutoTmp.entity.BilletAutoTmp;
 import org.jeecg.modules.billet.billetAutoTmp.service.IBilletAutoTmpService;
 import org.jeecg.modules.billet.billetHotsend.entity.BilletHotsend;
@@ -390,6 +392,7 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
             updateBilletHotsendChangeShift(storageBill.getCcmNo(), shiftGroup, shift);
 
             storageBill.setAmountTotal(0);
+            storageBill.setPanelAmountTotal(0);
             storageBill.setShiftGroup(shiftGroup);
             storageBill.setShift(shift);
             String uniqueCode = generateUniqueCode(new Date(), storageBill.getCcmNo(), shift, shiftGroup);
@@ -6077,6 +6080,483 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
 
     }
 
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public String destinationSwitchHandle(StorageBill storageBill, String destination, String typeConfigId) {
+        String result = null;
+
+        // 根据当前目的地选择对应的切换逻辑
+        if ("棒二".equals(storageBill.getDestination())) {
+            result = switchFromRollClubTwo(storageBill, destination);
+        } else if ("棒三".equals(storageBill.getDestination())) {
+            result = switchFromRollClubThree(storageBill, destination);
+        } else if ("上若".equals(storageBill.getDestination())) {
+            result = switchFromRollOutShipp(storageBill, destination);
+        }
+
+        // 如果切换过程中出现错误,直接返回错误信息
+        if (result != null && result.contains("失败")) {
+            return result;
+        }
+
+        // 更新原始装运单 新目的地
+        storageBill.setDestination(destination);
+        storageBill.setTypeConfigId(typeConfigId);
+        storageBill.setUpdateTime(new Date());
+        baseMapper.updateById(storageBill);
+
+        return "切换棒线操作成功!";
+    }
+
+    /**
+     * 棒二切换到其他目的地的处理逻辑
+     */
+    private String switchFromRollClubTwo(StorageBill storageBill, String destination) {
+        // 根据铸机号、装运单ID查询棒二明细信息
+        LambdaQueryWrapper<RollClubTwoDetails> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(RollClubTwoDetails::getCcmNo, storageBill.getCcmNo())
+                .eq(RollClubTwoDetails::getStorageBillId, storageBill.getId());
+        List<RollClubTwoDetails> rollClubTwoDetailsList = rollClubTwoDetailsService.list(queryWrapper);
+        if (oConvertUtils.listIsEmpty(rollClubTwoDetailsList)) {
+            return "棒二装运明细为空,棒线切换失败!";
+        }
+
+        List<String> billetNos = rollClubTwoDetailsList.stream()
+                .map(RollClubTwoDetails::getBilletNo)
+                .filter(billetNo -> billetNo != null && !billetNo.isEmpty())
+                .flatMap(billetNo -> Arrays.stream(billetNo.split(",")))
+                .map(String::trim)
+                .filter(trimmedBilletNo -> !trimmedBilletNo.isEmpty())
+                .distinct()
+                .collect(Collectors.toList());
+
+        List<RollClubCommon> rollClubCommonList = createRollClubCommonList(rollClubTwoDetailsList);
+        Map<String, List<RollClubCommon>> rollClubCommonLists = groupByShiftAttributes(rollClubCommonList);
+
+        // 维护热送单炉信息
+        BilletHotsend billetHotsend = new BilletHotsend();
+        billetHotsend.setCcmNo(storageBill.getCcmNo());
+
+        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]);// 班别
+
+            LambdaQueryWrapper<BilletHotsend> queryWrapper2 = new LambdaQueryWrapper<>();
+            queryWrapper2.eq(BilletHotsend::getCcmNo, billetHotsend.getCcmNo())
+                    .eq(BilletHotsend::getHeatNo, billetHotsend.getHeatNo())
+                    .eq(BilletHotsend::getShift,  billetHotsend.getShift())
+                    .eq(BilletHotsend::getShiftGroup, billetHotsend.getShiftGroup());
+            BilletHotsend idExistBh = billetHotsendBaseMapper.selectOne(queryWrapper2);
+            if (oConvertUtils.isEmpty(idExistBh)) {
+                log.info("{}{}", "炉次传递单不存在,棒线目的地切换失败!", JSON.toJSON(billetHotsend));
+                // 手动回滚事务
+                TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                return "炉次传递单不存在,棒线切换失败!";
+            }
+
+            List<RollClubCommon> groupRollClubCommonList = entry.getValue();
+            updateBilletHotsendForRollClubTwo(idExistBh, destination, groupRollClubCommonList);
+            billetHotsendBaseMapper.updateById(idExistBh);
+        }
+
+        // 根据炉号、班组、班别查询热送单信息
+        LambdaQueryWrapper<RollClubTwo> queryWrapper1 = new LambdaQueryWrapper<>();
+        queryWrapper1.eq(RollClubTwo::getCcmNo, billetHotsend.getCcmNo())
+                .eq(RollClubTwo::getStorageBillId, storageBill.getId());
+        List<RollClubTwo> rollClubTwoList = rollClubTwoService.list(queryWrapper1);
+        if (oConvertUtils.listIsEmpty(rollClubTwoList)) {
+            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+            return "轧钢棒二信息不存在,棒线切换失败!";
+        }
+
+        // 根据目标类型保存相应的明细信息
+        if ("上若".equals(destination)) {
+            saveRollOutShippDetails(rollClubTwoList, rollClubTwoDetailsList);
+        } else if ("棒三".equals(destination)) {
+            saveRollClubThreeDetails(rollClubTwoList, rollClubTwoDetailsList);
+        }
+
+        // 删除原记录
+        rollClubTwoService.removeBatchByIds(rollClubTwoList);
+        rollClubTwoDetailsService.removeBatchByIds(rollClubTwoDetailsList);
+
+        // 更新钢坯基础信息
+        return updateBilletBasicInfo(billetHotsend.getCcmNo(), billetNos, destination);
+    }
+
+    /**
+     * 棒三切换到其他目的地的处理逻辑
+     */
+    private String switchFromRollClubThree(StorageBill storageBill, String destination) {
+        // 根据铸机号、装运单ID查询棒三明细信息
+        LambdaQueryWrapper<RollClubThreeDetails> queryWrapper33 = new LambdaQueryWrapper<>();
+        queryWrapper33.eq(RollClubThreeDetails::getCcmNo, storageBill.getCcmNo())
+                .eq(RollClubThreeDetails::getStorageBillId, storageBill.getId());
+        List<RollClubThreeDetails> rollClubThreeDetailsList = rollClubThreeDetailsService.list(queryWrapper33);
+        if (oConvertUtils.listIsEmpty(rollClubThreeDetailsList)) {
+            return "棒三装运明细为空,棒线切换失败!";
+        }
+
+        List<String> billetNos = rollClubThreeDetailsList.stream()
+                .map(RollClubThreeDetails::getBilletNo)
+                .filter(billetNo -> billetNo != null && !billetNo.isEmpty())
+                .flatMap(billetNo -> Arrays.stream(billetNo.split(",")))
+                .map(String::trim)
+                .filter(trimmedBilletNo -> !trimmedBilletNo.isEmpty())
+                .distinct()
+                .collect(Collectors.toList());
+
+        List<RollClubCommon> rollClubCommonList = createRollClubCommonList(rollClubThreeDetailsList);
+        Map<String, List<RollClubCommon>> rollClubCommonLists = groupByShiftAttributes(rollClubCommonList);
+
+        // 维护热送单炉信息
+        BilletHotsend billetHotsend = new BilletHotsend();
+        billetHotsend.setCcmNo(storageBill.getCcmNo());
+
+        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]);// 班别
+
+            LambdaQueryWrapper<BilletHotsend> queryWrapper2 = new LambdaQueryWrapper<>();
+            queryWrapper2.eq(BilletHotsend::getCcmNo, billetHotsend.getCcmNo())
+                    .eq(BilletHotsend::getHeatNo, billetHotsend.getHeatNo())
+                    .eq(BilletHotsend::getShift,  billetHotsend.getShift())
+                    .eq(BilletHotsend::getShiftGroup, billetHotsend.getShiftGroup());
+            BilletHotsend idExistBh = billetHotsendBaseMapper.selectOne(queryWrapper2);
+            if (oConvertUtils.isEmpty(idExistBh)) {
+                log.info("{}{}", "炉次传递单不存在,切换棒线失败!", JSON.toJSON(billetHotsend));
+                // 手动回滚事务
+                TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                return "炉次传递单不存在,棒线切换失败!";
+            }
+
+            List<RollClubCommon> groupRollClubCommonList = entry.getValue();
+            updateBilletHotsendForRollClubThree(idExistBh, destination, groupRollClubCommonList);
+            billetHotsendBaseMapper.updateById(idExistBh);
+        }
+
+        // 根据炉号、班组、班别查询热送单信息
+        LambdaQueryWrapper<RollClubThree> queryWrapper11 = new LambdaQueryWrapper<>();
+        queryWrapper11.eq(RollClubThree::getCcmNo, billetHotsend.getCcmNo())
+                .eq(RollClubThree::getStorageBillId, storageBill.getId());
+        List<RollClubThree> rollClubThreeList = rollClubThreeService.list(queryWrapper11);
+        if (oConvertUtils.listIsEmpty(rollClubThreeList)) {
+            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+            return "轧钢棒三信息不存在,棒线切换失败!";
+        }
+
+        // 根据目标类型保存相应的明细信息
+        if ("上若".equals(destination)) {
+            saveRollOutShippDetails(rollClubThreeList, rollClubThreeDetailsList);
+        } else if ("棒二".equals(destination)) {
+            saveRollClubTwoDetails(rollClubThreeList, rollClubThreeDetailsList, billetHotsend.getShift());
+        }
+
+        // 删除原记录
+        rollClubThreeService.removeBatchByIds(rollClubThreeList);
+        rollClubThreeDetailsService.removeBatchByIds(rollClubThreeDetailsList);
+
+        // 更新钢坯基础信息
+        return updateBilletBasicInfo(billetHotsend.getCcmNo(), billetNos, destination);
+    }
+
+    /**
+     * 上若切换到其他目的地的处理逻辑
+     */
+    private String switchFromRollOutShipp(StorageBill storageBill, String destination) {
+        LambdaQueryWrapper<RollOutShippDetails> queryWrapper34 = new LambdaQueryWrapper<>();
+        queryWrapper34.eq(RollOutShippDetails::getCcmNo, storageBill.getCcmNo())
+                .eq(RollOutShippDetails::getStorageBillId, storageBill.getId());
+        List<RollOutShippDetails> rollOutShippDetailsList = rollOutShippDetailsService.list(queryWrapper34);
+        if (oConvertUtils.listIsEmpty(rollOutShippDetailsList)) {
+            return "上若装运明细为空,棒线切换失败";
+        }
+
+        List<String> billetNos = rollOutShippDetailsList.stream()
+                .map(RollOutShippDetails::getBilletNo)
+                .filter(billetNo -> billetNo != null && !billetNo.isEmpty())
+                .flatMap(billetNo -> Arrays.stream(billetNo.split(",")))
+                .map(String::trim)
+                .filter(trimmedBilletNo -> !trimmedBilletNo.isEmpty())
+                .distinct()
+                .collect(Collectors.toList());
+
+        List<RollClubCommon> rollClubCommonList = createRollClubCommonList(rollOutShippDetailsList);
+        Map<String, List<RollClubCommon>> rollClubCommonLists = groupByShiftAttributes(rollClubCommonList);
+
+        // 维护热送单炉信息
+        BilletHotsend billetHotsend = new BilletHotsend();
+        billetHotsend.setCcmNo(storageBill.getCcmNo());
+
+        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]);// 班别
+
+            LambdaQueryWrapper<BilletHotsend> queryWrapper2 = new LambdaQueryWrapper<>();
+            queryWrapper2.eq(BilletHotsend::getCcmNo, billetHotsend.getCcmNo())
+                    .eq(BilletHotsend::getHeatNo, billetHotsend.getHeatNo())
+                    .eq(BilletHotsend::getShift,  billetHotsend.getShift())
+                    .eq(BilletHotsend::getShiftGroup, billetHotsend.getShiftGroup());
+            BilletHotsend idExistBh = billetHotsendBaseMapper.selectOne(queryWrapper2);
+            if (oConvertUtils.isEmpty(idExistBh)) {
+                log.info("{}{}", "炉次传递单不存在,棒线切换失败!", JSON.toJSON(billetHotsend));
+                // 手动回滚事务
+                TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                return "炉次传递单不存在,棒线切换失败";
+            }
+
+            List<RollClubCommon> groupRollClubCommonList = entry.getValue();
+            updateBilletHotsendForRollOutShipp(idExistBh, destination, groupRollClubCommonList);
+            billetHotsendBaseMapper.updateById(idExistBh);
+        }
+
+        // 根据炉号、班组、班别查询热送单信息
+        LambdaQueryWrapper<RollOutShipp> queryWrapper15 = new LambdaQueryWrapper<>();
+        queryWrapper15.eq(RollOutShipp::getCcmNo, billetHotsend.getCcmNo())
+                .eq(RollOutShipp::getStorageBillId, storageBill.getId());
+        List<RollOutShipp> rollOutShippList = rollOutShippService.list(queryWrapper15);
+        if (oConvertUtils.listIsEmpty(rollOutShippList)) {
+            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+            return "轧钢上若信息不存在,棒线切换失败!";
+        }
+
+        // 根据目标类型保存相应的明细信息
+        if ("棒二".equals(destination)) {
+            saveRollClubTwoDetails(rollOutShippList, rollOutShippDetailsList, null);
+        } else if ("棒三".equals(destination)) {
+            saveRollClubThreeDetails(rollOutShippList, rollOutShippDetailsList);
+        }
+
+        // 删除原记录
+        rollOutShippService.removeByIds(rollOutShippList);
+        rollOutShippDetailsService.removeBatchByIds(rollOutShippDetailsList);
+
+        // 更新钢坯基础信息
+        return updateBilletBasicInfo(billetHotsend.getCcmNo(), billetNos, destination);
+    }
+
+    /**
+     * 创建 RollClubCommon 列表
+     */
+    private List<RollClubCommon> createRollClubCommonList(List<? extends Object> sourceList) {
+        List<RollClubCommon> rollClubCommonList = new ArrayList<>();
+
+        sourceList.forEach(x -> {
+            RollClubCommon rollClubCommon = new RollClubCommon();
+            BeanUtils.copyProperties(x, rollClubCommon);
+
+            // 根据不同的源对象类型设置特定属性
+            if (x instanceof RollClubTwoDetails) {
+                RollClubTwoDetails details = (RollClubTwoDetails) x;
+                rollClubCommon.setGrade(details.getSteel());
+                rollClubCommon.setLength(Integer.valueOf(details.getSize()));
+                rollClubCommon.setStorageBillId(details.getStorageBillId());
+                rollClubCommon.setBilletWeight(details.getBlankOutput());
+            } else if (x instanceof RollClubThreeDetails) {
+                RollClubThreeDetails details = (RollClubThreeDetails) x;
+                rollClubCommon.setGrade(details.getSteel());
+                rollClubCommon.setLength(Integer.valueOf(details.getSize()));
+                rollClubCommon.setStorageBillId(details.getStorageBillId());
+                rollClubCommon.setBilletWeight(details.getBlankOutput());
+            } else if (x instanceof RollOutShippDetails) {
+                RollOutShippDetails details = (RollOutShippDetails) x;
+                rollClubCommon.setGrade(details.getSteel());
+                rollClubCommon.setLength(Integer.valueOf(details.getSize()));
+                rollClubCommon.setStorageBillId(details.getStorageBillId());
+                rollClubCommon.setBilletWeight(details.getBlankOutput());
+            }
+
+            rollClubCommonList.add(rollClubCommon);
+        });
+
+        return rollClubCommonList;
+    }
+
+    /**
+     * 更新热送单信息 - 棒二来源
+     */
+    private void updateBilletHotsendForRollClubTwo(BilletHotsend hotsend, String destination, List<RollClubCommon> commonList) {
+        int effectiveCount = commonList.stream()
+                .mapToInt(item -> item.getStackAddr() == null || item.getStackAddr().isEmpty() ? 1 : 4)
+                .sum();
+        if ("上若".equals(destination)) {
+            hotsend.setRollclubtwoNum(hotsend.getRollclubtwoNum() - effectiveCount);
+            hotsend.setRolloutshippNum(hotsend.getRolloutshippNum() + effectiveCount);
+        } else if ("棒三".equals(destination)) {
+            hotsend.setRollclubtwoNum(hotsend.getRollclubtwoNum() - effectiveCount);
+            hotsend.setRollclubthreeNum(hotsend.getRollclubthreeNum() + effectiveCount);
+        }
+    }
+
+    /**
+     * 更新热送单信息 - 棒三来源
+     */
+    private void updateBilletHotsendForRollClubThree(BilletHotsend hotsend, String destination, List<RollClubCommon> commonList) {
+
+        // 计算有效数量:stackAddr为空的项按1计算,不为空的项按4计算
+        int effectiveCount = commonList.stream()
+                .mapToInt(item -> item.getStackAddr() == null || item.getStackAddr().isEmpty() ? 1 : 4)
+                .sum();
+
+        if ("上若".equals(destination)) {
+            hotsend.setRollclubthreeNum(hotsend.getRollclubthreeNum() - effectiveCount);
+            hotsend.setRolloutshippNum(hotsend.getRolloutshippNum() + effectiveCount);
+        } else if ("棒二".equals(destination)) {
+            hotsend.setRollclubthreeNum(hotsend.getRollclubthreeNum() - effectiveCount);
+            hotsend.setRollclubtwoNum(hotsend.getRollclubtwoNum() + effectiveCount);
+        }
+    }
+
+    /**
+     * 更新热送单信息 - 上若来源
+     */
+    private void updateBilletHotsendForRollOutShipp(BilletHotsend hotsend, String destination, List<RollClubCommon> commonList) {
+
+        // 计算有效数量:stackAddr为空的项按1计算,不为空的项按4计算
+        int effectiveCount = commonList.stream()
+                .mapToInt(item -> item.getStackAddr() == null || item.getStackAddr().isEmpty() ? 1 : 4)
+                .sum();
+
+        if ("棒二".equals(destination)) {
+            hotsend.setRollclubtwoNum(hotsend.getRollclubtwoNum() + effectiveCount);
+            hotsend.setRolloutshippNum(hotsend.getRolloutshippNum() - effectiveCount);
+        } else if ("棒三".equals(destination)) {
+            hotsend.setRollclubthreeNum(hotsend.getRollclubthreeNum() + effectiveCount);
+            hotsend.setRolloutshippNum(hotsend.getRolloutshippNum() - effectiveCount);
+        }
+    }
+
+    /**
+     * 保存上若明细信息
+     */
+    private void saveRollOutShippDetails(List<? extends Object> parentList, List<? extends Object> detailsList) {
+        // 保存上若主表信息
+        List<RollOutShipp> rollOutShippList = new ArrayList<>();
+        parentList.forEach(x -> {
+            RollOutShipp rollOutShipp = new RollOutShipp();
+            BeanUtils.copyProperties(x, rollOutShipp);
+            rollOutShipp.setId(String.valueOf(IdWorker.getId()));
+            rollOutShipp.setUpdateTime(new Date());
+            rollOutShippList.add(rollOutShipp);
+        });
+        rollOutShippService.saveBatch(rollOutShippList);
+
+        // 保存上若明细表信息
+        List<RollOutShippDetails> rollOutShippDetailsList = new ArrayList<>();
+        detailsList.forEach(x -> {
+            RollOutShippDetails rollOutShippDetails = new RollOutShippDetails();
+            BeanUtils.copyProperties(x, rollOutShippDetails);
+            rollOutShippDetails.setId(String.valueOf(IdWorker.getId()));
+            rollOutShippDetails.setUpdateTime(new Date());
+            rollOutShippDetailsList.add(rollOutShippDetails);
+        });
+        rollOutShippDetailsService.saveBatch(rollOutShippDetailsList);
+    }
+
+    /**
+     * 保存棒二明细信息
+     */
+    private void saveRollClubTwoDetails(List<? extends Object> parentList, List<? extends Object> detailsList, String shift) {
+        // 保存棒二主表信息
+        List<RollClubTwo> rollClubTwoList = new ArrayList<>();
+        parentList.forEach(x -> {
+            RollClubTwo rollClubTwo = new RollClubTwo();
+            BeanUtils.copyProperties(x, rollClubTwo);
+            rollClubTwo.setId(String.valueOf(IdWorker.getId()));
+            rollClubTwo.setUpdateTime(new Date());
+            rollClubTwoList.add(rollClubTwo);
+        });
+        rollClubTwoService.saveBatch(rollClubTwoList);
+
+        // 保存棒二明细表信息
+        List<RollClubTwoDetails> rollClubTwoDetailsList = new ArrayList<>();
+        detailsList.forEach(x -> {
+            RollClubTwoDetails rollClubTwoDetails = new RollClubTwoDetails();
+            BeanUtils.copyProperties(x, rollClubTwoDetails);
+            rollClubTwoDetails.setId(String.valueOf(IdWorker.getId()));
+            if (shift != null) {
+                rollClubTwoDetails.setShift(shift);
+            }
+            rollClubTwoDetails.setUpdateTime(new Date());
+            rollClubTwoDetailsList.add(rollClubTwoDetails);
+        });
+        rollClubTwoDetailsService.saveBatch(rollClubTwoDetailsList);
+    }
+
+    /**
+     * 保存棒三明细信息
+     */
+    private void saveRollClubThreeDetails(List<? extends Object> parentList, List<? extends Object> detailsList) {
+        // 保存棒三主表信息
+        List<RollClubThree> rollClubThreeList = new ArrayList<>();
+        parentList.forEach(x -> {
+            RollClubThree rollClubThree = new RollClubThree();
+            BeanUtils.copyProperties(x, rollClubThree);
+            rollClubThree.setId(String.valueOf(IdWorker.getId()));
+            rollClubThree.setUpdateTime(new Date());
+            rollClubThreeList.add(rollClubThree);
+        });
+        rollClubThreeService.saveBatch(rollClubThreeList);
+
+        // 保存棒三明细表信息
+        List<RollClubThreeDetails> rollClubThreeDetailsList = new ArrayList<>();
+        detailsList.forEach(x -> {
+            RollClubThreeDetails rollClubThreeDetails = new RollClubThreeDetails();
+            BeanUtils.copyProperties(x, rollClubThreeDetails);
+            rollClubThreeDetails.setId(String.valueOf(IdWorker.getId()));
+            rollClubThreeDetails.setUpdateTime(new Date());
+            rollClubThreeDetailsList.add(rollClubThreeDetails);
+        });
+        rollClubThreeDetailsService.saveBatch(rollClubThreeDetailsList);
+    }
+
+    /**
+     * 更新钢坯基础信息
+     */
+    private String updateBilletBasicInfo(String ccmNo, List<String> billetNos, String destination) {
+        LambdaQueryWrapper<BilletBasicInfo> queryWrapperls = new LambdaQueryWrapper<BilletBasicInfo>()
+                .eq(BilletBasicInfo::getCcmNo, Integer.valueOf(ccmNo))
+                .in(BilletBasicInfo::getBilletNo, billetNos);
+        List<BilletBasicInfo> billetBasicInfoList = billetBasicInfoService.list(queryWrapperls);
+
+        if (oConvertUtils.listIsEmpty(billetBasicInfoList)) {
+            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+            return "钢坯基础信息不存在,棒线切换失败!";
+        }
+
+        billetBasicInfoList.forEach(x -> {
+            if ("上若".equals(destination) && "5".equals(x.getCcmNo().toString())) {
+                x.setBelongTable("roll_out_shipp");
+                x.setBhtcId("5");
+            } else if ("上若".equals(destination) && "6".equals(x.getCcmNo().toString())) {
+                x.setBelongTable("roll_out_shipp");
+                x.setBhtcId("16");
+            } else if ("棒三".equals(destination) && "5".equals(x.getCcmNo().toString())) {
+                x.setBelongTable("roll_club_three");
+                x.setBhtcId("3");
+            } else if ("棒三".equals(destination) && "6".equals(x.getCcmNo().toString())) {
+                x.setBelongTable("roll_club_three");
+                x.setBhtcId("14");
+            } else if ("棒二".equals(destination) && "5".equals(x.getCcmNo().toString())) {
+                x.setBelongTable("roll_club_two");
+                x.setBhtcId("2");
+            } else if ("棒二".equals(destination) && "6".equals(x.getCcmNo().toString())) {
+                x.setBelongTable("roll_club_two");
+                x.setBhtcId("13");
+            }
+            x.setUpdateTime(new Date());
+        });
+
+        // 更新钢坯实绩
+        billetBasicInfoService.updateBatchById(billetBasicInfoList);
+        return "棒线切换成功";
+    }
 
     private Date getMinDate(List<StorageBill> bills) {
         return bills.stream()