qiangxuan пре 8 месеци
родитељ
комит
5ede0091bd

+ 20 - 8
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/billetHotsend/service/impl/BilletHotsendBaseServiceImpl.java

@@ -305,13 +305,30 @@ public class BilletHotsendBaseServiceImpl extends ServiceImpl<BilletHotsendBaseM
 
 	@Override
 	public void saveBilletHotsendDetails(BilletHotsendDetailsVo billetHotsendDetailsVo) {
+		// 根据billetHotsendTypeConfigId 查询基础垛位信息
+		BilletHotsendTypeConfig billetHotsendTypeConfig = billetHotsendTypeConfigService.getById(billetHotsendDetailsVo.getBilletHotsendTypeConfigId());
+		if (oConvertUtils.isEmpty(billetHotsendTypeConfig)){
+			log.info("{}{}", "棒线保存或发车,查询基础钢坯类型配置信息为空!", JSON.toJSONString(billetHotsendDetailsVo));
+			return;
+		}
+		List<RollClubCommon> rollClubCommonList = billetHotsendDetailsVo.getRollClubCommonList();
 		BilletHotsend billetHotsend = new BilletHotsend();
 		StorageBill storageBill = billetHotsendDetailsVo.getStorageBill();
 		// 新保存 钢坯热送基础信息
 		BeanUtils.copyProperties(billetHotsendDetailsVo.getBilletHotsend(), billetHotsend);
 		billetHotsend.setCreateDate(new Date());
-		List<RollClubCommon> rollClubCommonList = billetHotsendDetailsVo.getRollClubCommonList();
-		billetHotsend.setAmountTotal(rollClubCommonList.size());
+		if ("roll_club_one".equals(billetHotsendDetailsVo.getBelongTable()) && "0".equals(billetHotsendTypeConfig.getBelongTable())){
+			billetHotsend.setRollcluboneNum(rollClubCommonList.size());
+		}else if ("roll_club_two".equals(billetHotsendDetailsVo.getBelongTable()) && "0".equals(billetHotsendTypeConfig.getBelongTable())){
+			billetHotsend.setRollclubtwoNum(rollClubCommonList.size());
+		}else if ("roll_club_three".equals(billetHotsendDetailsVo.getBelongTable()) && "0".equals(billetHotsendTypeConfig.getBelongTable())){
+			billetHotsend.setRollclubthreeNum(rollClubCommonList.size());
+		}else if ("roll_height".equals(billetHotsendDetailsVo.getBelongTable()) && "0".equals(billetHotsendTypeConfig.getBelongTable())){
+			billetHotsend.setRollheightNum(rollClubCommonList.size());
+		}else if ("roll_out_shipp".equals(billetHotsendDetailsVo.getBelongTable()) && "0".equals(billetHotsendTypeConfig.getBelongTable())){
+			billetHotsend.setRolloutshippNum(rollClubCommonList.size());
+		}
+//		billetHotsend.setAmountTotal(rollClubCommonList.size()); //总支数
 		if (billetHotsend.getIsUpd()){
 			baseMapper.insert(billetHotsend);
 		}else {
@@ -319,10 +336,6 @@ public class BilletHotsendBaseServiceImpl extends ServiceImpl<BilletHotsendBaseM
 			updateWrapper.eq(BilletHotsend::getCcmNo, billetHotsend.getCcmNo()).eq(BilletHotsend::getHeatNo, billetHotsend.getHeatNo());
 			baseMapper.update(billetHotsend,  updateWrapper);
 		}
-		if (oConvertUtils.isEmpty(billetHotsendDetailsVo.getBelongTable())){
-			log.info("{}{}", ">>>>>>>>>钢坯热送基础信息-添加或发车失败,belongTable参数为空:", JSON.toJSON(billetHotsendDetailsVo));
-			return;
-		}
 		List<String> billetNos = new ArrayList<>();
 		// 保存 钢坯热送单炉支数传递单明细
 		if ("roll_club_one".equals(billetHotsendDetailsVo.getBelongTable())){
@@ -449,6 +462,7 @@ public class BilletHotsendBaseServiceImpl extends ServiceImpl<BilletHotsendBaseM
 			}else if ("roll_out_shipp".equals(billetHotsendDetailsVo.getBelongTable())){
 				x.setBelongTable("roll_out_shipp");
 			}
+			x.setBhtcId(billetHotsendDetailsVo.getBilletHotsendTypeConfigId());
 			x.setUpdateTime(new Date());
 		});
 		billetBasicInfoService.saveOrUpdateBatch(billetBasicInfoList);
@@ -500,8 +514,6 @@ public class BilletHotsendBaseServiceImpl extends ServiceImpl<BilletHotsendBaseM
 					count = rollOutShippDetailsList.stream().count();
 				}
 			}
-			// 根据billetHotsendTypeConfigId 查询基础垛位信息
-			BilletHotsendTypeConfig billetHotsendTypeConfig = billetHotsendTypeConfigService.getById(billetHotsendDetailsVo.getBilletHotsendTypeConfigId());
 			storageCarLog.setDestination(billetHotsendTypeConfig.getTypeName());// 目的地
 			storageCarLog.setCarNm(storageCarLog.getCarNm());// 车号
 //			storageCarLog.setFixedWeight();// 定重

+ 22 - 4
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/stackingAndLoadingVehicles/controller/StackingAndLoadingVehiclesController.java

@@ -3,6 +3,7 @@ package org.jeecg.modules.billet.stackingAndLoadingVehicles.controller;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.IdWorker;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -12,8 +13,11 @@ import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.base.controller.JeecgController;
 import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.common.util.oConvertUtils;
+import org.jeecg.modules.billet.billetHotsend.entity.BilletHotsend;
 import org.jeecg.modules.billet.billetHotsend.entity.RulerDefaultConfig;
+import org.jeecg.modules.billet.billetHotsend.service.IBilletHotsendBaseService;
 import org.jeecg.modules.billet.billetHotsend.service.IRulerDefaultConfigService;
+import org.jeecg.modules.billet.operateLog.service.IOperateLogService;
 import org.jeecg.modules.billet.stackingAndLoadingVehicles.entity.StackingAndLoadingVehicles;
 import org.jeecg.modules.billet.stackingAndLoadingVehicles.entity.UpdateBatchParams;
 import org.jeecg.modules.billet.stackingAndLoadingVehicles.service.IStackingAndLoadingVehiclesService;
@@ -45,6 +49,10 @@ public class StackingAndLoadingVehiclesController extends JeecgController<Stacki
 	private IStackingAndLoadingVehiclesService stackingAndLoadingVehiclesService;
 	 @Autowired
 	 private IRulerDefaultConfigService rulerDefaultConfigService;
+	 @Autowired
+	 private IBilletHotsendBaseService billetHotsendBaseService;
+	 @Autowired
+	 private IOperateLogService operateLogService;
 	
 	/**
 	 * 分页列表查询
@@ -275,16 +283,26 @@ public class StackingAndLoadingVehiclesController extends JeecgController<Stacki
      @ApiOperation(value="垛位装车-发车", notes="垛位装车-发车")
      @PostMapping(value = "/loading")
      public Result<?> loading(@RequestBody LoadingParams loadingParams){
-    	if(loadingParams.getStackingAndLoadingVehiclesList() == null || loadingParams.getStackingAndLoadingVehiclesList().size() < 3){
+    	 if(loadingParams.getStackingAndLoadingVehiclesList() == null || loadingParams.getStackingAndLoadingVehiclesList().size() < 3){
     		return Result.OK("请至少装入3夹钢坯!");
-		}
+		 }
 		 Set<String> heats = new HashSet<>();
 		 for (StackingAndLoadingVehicles stackingAndLoadingVehicles : loadingParams.getStackingAndLoadingVehiclesList()) {
 			 heats.add(stackingAndLoadingVehicles.getHeatNo());
 		 }
 		 if(heats.size()>3)return Result.error("一次只能选择三种炉次的钢坯");
-    	stackingAndLoadingVehiclesService.loadingHandle(loadingParams);
-		return Result.OK("发车成功");
+		 BilletHotsend billetHotsend = loadingParams.getBilletHotsend();
+		 billetHotsend.setId(String.valueOf(IdWorker.getId()));
+		 loadingParams.setBilletHotsend(billetHotsend);
+		 LambdaQueryWrapper<BilletHotsend> queryWrapper = new LambdaQueryWrapper<>();
+		 queryWrapper.eq(BilletHotsend::getCcmNo, billetHotsend.getCcmNo()).eq(BilletHotsend::getHeatNo, billetHotsend.getHeatNo());
+		 BilletHotsend check = billetHotsendBaseService.getOne(queryWrapper);
+		 if (oConvertUtils.isNotEmpty(check) && billetHotsend.getIsUpd() ){
+			 return Result.OK("该铸机和炉号信息已存在,钢坯装运单操作失败!");
+		 }
+    	 stackingAndLoadingVehiclesService.loadingHandle(loadingParams);
+		 operateLogService.add(billetHotsend,null,BilletHotsend.class);
+		return Result.OK("操作成功");
      }
 
      @ApiOperation(value="堆垛-发车", notes="堆垛-发车")

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

@@ -1,8 +1,10 @@
 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.extension.service.impl.ServiceImpl;
+import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.util.oConvertUtils;
 import org.jeecg.modules.actualControl.billetActual.billetActual.entity.BilletBasicInfo;
 import org.jeecg.modules.actualControl.billetActual.billetActual.service.IBilletBasicInfoService;
@@ -59,6 +61,7 @@ import java.util.stream.Collectors;
  * @Version: V1.0
  */
 @Service
+@Slf4j
 public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingAndLoadingVehiclesMapper, StackingAndLoadingVehicles> implements IStackingAndLoadingVehiclesService {
 
     @Autowired
@@ -477,12 +480,34 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
 
     @Override
     public void loadingHandle(LoadingParams loadingParams) {
+        //  根据billetHotsendTypeConfigId 查询基础垛位信息
+        BilletHotsendTypeConfig billetHotsendTypeConfig = billetHotsendTypeConfigService.getById(loadingParams.getBilletHotsendTypeConfigId());
+        if (oConvertUtils.isEmpty(billetHotsendTypeConfig)){
+            log.info("{}{}", "垛位保存或发车,查询基础钢坯类型配置信息为空!", JSON.toJSONString(loadingParams));
+            return;
+        }
         List<StackingAndLoadingVehicles> stackingAndLoadingVehiclesListParam = loadingParams.getStackingAndLoadingVehiclesList();
         StorageBill storageBill = loadingParams.getStorageBill();
-        // 2 先移除 堆垛公共容器中的记录 stacking_and_loading_vehicles
+        // 1 保存或更新 钢坯热送基础信息 billet_hotsend
+        BilletHotsend billetHotsend = new BilletHotsend();
+        BeanUtils.copyProperties(loadingParams.getBilletHotsend(), billetHotsend);
+        billetHotsend.setCreateDate(new Date());
+        if ("stacking_and_loading_vehicles".equals(loadingParams.getBelongTable()) && "1".equals(billetHotsendTypeConfig.getBelongTable())){
+            billetHotsend.setStackNum(stackingAndLoadingVehiclesListParam.size() * 4); // 堆垛总支数
+        }
+//        billetHotsend.setAmountTotal(stackingAndLoadingVehiclesListParam.size());// 总支数
+        if (billetHotsend.getIsUpd()){
+            billetHotsendBaseService.save(billetHotsend);
+        }else {
+            LambdaUpdateWrapper<BilletHotsend> updateWrapper = new LambdaUpdateWrapper<>();
+            updateWrapper.eq(BilletHotsend::getCcmNo, billetHotsend.getCcmNo()).eq(BilletHotsend::getHeatNo, billetHotsend.getHeatNo());
+            billetHotsendBaseService.update(billetHotsend,  updateWrapper);
+        }
+        // 2 先查询堆垛公共容器中的信息,在批量移除 堆垛公共容器中的记录 stacking_and_loading_vehicles
         List<String> ids = stackingAndLoadingVehiclesListParam.stream().map(StackingAndLoadingVehicles::getId).collect(Collectors.toList());
         List<StackingAndLoadingVehicles> stackingAndLoadingVehiclesList = baseMapper.selectBatchIds(ids);
         if (oConvertUtils.listIsEmpty(stackingAndLoadingVehiclesList)){
+            log.info("{}{}", "垛位保存或发车,堆垛容器信息信息为空!", JSON.toJSONString(loadingParams));
             return;
         }
         baseMapper.deleteBatchIds(stackingAndLoadingVehiclesList.stream().map(StackingAndLoadingVehicles::getId).collect(Collectors.toList()));
@@ -500,20 +525,9 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
             stackingDownLogList.add(stackingDownLog);
         });
         stackingDownLogService.saveBatch(stackingDownLogList);
-        // 4 保存或更新 钢坯热送基础信息 billet_hotsend
-        BilletHotsend billetHotsend = new BilletHotsend();
-        BeanUtils.copyProperties(loadingParams.getBilletHotsend(), billetHotsend);
-        billetHotsend.setCreateDate(new Date());
-        billetHotsend.setAmountTotal(stackingAndLoadingVehiclesListParam.size());// 总支数
-        if (billetHotsend.getIsUpd()){
-            billetHotsendBaseService.save(billetHotsend);
-        }else {
-            LambdaUpdateWrapper<BilletHotsend> updateWrapper = new LambdaUpdateWrapper<>();
-            updateWrapper.eq(BilletHotsend::getCcmNo, billetHotsend.getCcmNo()).eq(BilletHotsend::getHeatNo, billetHotsend.getHeatNo());
-            billetHotsendBaseService.update(billetHotsend,  updateWrapper);
-        }
+
         List<String> billetNos = new ArrayList<>();
-        // 5 根据所属表 保存对应的棒线和对象信息,明细信息 roll_club_two、roll_club_two_details、roll_club_three、roll_club_three_details、roll_out_shipp、roll_out_shipp_details
+        // 4 根据所属表 保存对应的棒线和对象信息,明细信息 roll_club_two、roll_club_two_details、roll_club_three、roll_club_three_details、roll_out_shipp、roll_out_shipp_details
         if ("roll_club_two".equals(loadingParams.getBelongTable())){
             // 保存棒一信息
             RollClubTwo rollClubTwo = new RollClubTwo();
@@ -590,7 +604,7 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
             });
             rollOutShippDetailsService.saveBatch(rollOutShippDetailsList);
         }
-        //查询并批量更新钢坯基础信息 belongTable
+        //5 查询并批量更新钢坯基础信息 belongTable
         LambdaQueryWrapper<BilletBasicInfo> queryWrapper = new LambdaQueryWrapper<BilletBasicInfo>()
                 .eq(BilletBasicInfo::getCcmNo, Integer.valueOf(billetHotsend.getCcmNo()))
                 .eq(BilletBasicInfo::getHeatNo, billetHotsend.getHeatNo())
@@ -609,6 +623,7 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
                 x.setBelongTable("roll_out_shipp");
             }
             x.setUpdateTime(new Date());
+            x.setBhtcId(loadingParams.getBilletHotsendTypeConfigId());
         });
         billetBasicInfoService.saveOrUpdateBatch(billetBasicInfoList);
         /**
@@ -663,8 +678,6 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
                     count = rollOutShippDetailsList.stream().count();
                 }
             }
-            // 根据billetHotsendTypeConfigId 查询基础垛位信息
-            BilletHotsendTypeConfig billetHotsendTypeConfig = billetHotsendTypeConfigService.getById(loadingParams.getBilletHotsendTypeConfigId());
             storageCarLog.setDestination(billetHotsendTypeConfig.getTypeName());// 目的地
             storageCarLog.setCarNm(storageCarLog.getCarNm());// 车号
 //			storageCarLog.setFixedWeight();// 定重