qiangxuan 6 miesięcy temu
rodzic
commit
0642174264
11 zmienionych plików z 430 dodań i 133 usunięć
  1. 28 0
      zgztBus/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/DateUtils.java
  2. 5 0
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/actualControl/heatsActuals/entity/HeatsActuals.java
  3. 116 73
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/billetHotsend/service/impl/BilletHotsendBaseServiceImpl.java
  4. 37 0
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/billetHotsendAbandons/entity/BilletHotsendAbandons.java
  5. 4 4
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/billetHotsendChangeShift/entity/BilletHotsendChangeShift.java
  6. 7 0
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/stackingAndLoadingVehicles/controller/StackingAndLoadingVehiclesController.java
  7. 2 0
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/stackingAndLoadingVehicles/service/IStackingAndLoadingVehiclesService.java
  8. 184 5
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/stackingAndLoadingVehicles/service/impl/StackingAndLoadingVehiclesServiceImpl.java
  9. 20 18
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/storageBill/controller/StorageBillController.java
  10. 4 5
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/storageBill/entity/BilletHotsendDetails.java
  11. 23 28
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/storageBill/service/impl/StorageBillServiceImpl.java

+ 28 - 0
zgztBus/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/DateUtils.java

@@ -760,4 +760,32 @@ public class DateUtils extends PropertyEditorSupport {
         return calendar1.get(Calendar.YEAR) == calendar2.get(Calendar.YEAR);
     }
 
+    /**
+     * 获取当天的开始时间,即00:00:00
+     *
+     * @return 当天的开始时间
+     */
+    public static Date getStartOfDay() {
+        Calendar startCalendar = Calendar.getInstance();
+        startCalendar.setTime(new Date());
+        startCalendar.set(Calendar.HOUR_OF_DAY, 0);
+        startCalendar.set(Calendar.MINUTE, 0);
+        startCalendar.set(Calendar.SECOND, 0);
+        return startCalendar.getTime();
+    }
+
+    /**
+     * 获取当天的结束时间,即23:59:59
+     *
+     * @return 当天的结束时间
+     */
+    public static Date getEndOfDay() {
+        Calendar endCalendar = Calendar.getInstance();
+        endCalendar.setTime(new Date());
+        endCalendar.set(Calendar.HOUR_OF_DAY, 23);
+        endCalendar.set(Calendar.MINUTE, 59);
+        endCalendar.set(Calendar.SECOND, 59);
+        return endCalendar.getTime();
+    }
+
 }

+ 5 - 0
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/actualControl/heatsActuals/entity/HeatsActuals.java

@@ -130,6 +130,11 @@ public class HeatsActuals implements Serializable {
     @Dict(dicCode = "lg_bb")
     private String shift;
 
+    /**出批量*/
+    @Excel(name = "出批量", width = 15)
+    @ApiModelProperty(value = "出批量",required = true)
+    private Double blankOutput;
+
     /**list*/
     private Map<Integer, Long> basicInfoLengthList;
 

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

@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.toolkit.IdWorker;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.util.DateUtils;
 import org.jeecg.common.util.oConvertUtils;
 import org.jeecg.modules.actualControl.billetActual.billetActual.entity.BilletBasicInfo;
 import org.jeecg.modules.actualControl.billetActual.billetActual.service.IBilletBasicInfoService;
@@ -18,6 +19,8 @@ import org.jeecg.modules.billet.billetHotsend.entity.RulerDefaultConfig;
 import org.jeecg.modules.billet.billetHotsend.mapper.BilletHotsendBaseMapper;
 import org.jeecg.modules.billet.billetHotsend.service.IBilletHotsendBaseService;
 import org.jeecg.modules.billet.billetHotsend.service.IRulerDefaultConfigService;
+import org.jeecg.modules.billet.billetHotsendChangeShift.entity.BilletHotsendChangeShift;
+import org.jeecg.modules.billet.billetHotsendChangeShift.service.IBilletHotsendChangeShiftService;
 import org.jeecg.modules.billet.billetHotsendConfig.entity.BilletHotsendTypeConfig;
 import org.jeecg.modules.billet.billetHotsendConfig.service.IBilletHotsendTypeConfigService;
 import org.jeecg.modules.billet.operateLog.service.IOperateLogService;
@@ -105,6 +108,8 @@ public class BilletHotsendBaseServiceImpl extends ServiceImpl<BilletHotsendBaseM
 	private IBilletHotsendTypeConfigService billetHotsendTypeConfigService;
 	@Autowired
 	private IHeatsActualsService heatsActualsService;
+	@Autowired
+	private IBilletHotsendChangeShiftService billetHotsendChangeShiftService;
 	@Override
 	public void updateDesc(BilletHotsend billetHotsend) {
 		RulerDefaultConfig last = rulerDefaultConfigService.getLast(billetHotsend.getCcmNo());
@@ -320,29 +325,29 @@ public class BilletHotsendBaseServiceImpl extends ServiceImpl<BilletHotsendBaseM
 		BilletHotsend billetHotsend = new BilletHotsend();
 		// 新保存 钢坯热送基础信息
 		BeanUtils.copyProperties(billetHotsendDetailsVo.getBilletHotsend(), billetHotsend);
-//		billetHotsend.setAmountTotal(rollClubCommonList.size()); //总支数
-		LambdaQueryWrapper<HeatsActuals> queryWrapperHA = new LambdaQueryWrapper<>();
-		queryWrapperHA.eq(HeatsActuals::getCasterCode, billetHotsend.getCcmNo()).eq(HeatsActuals::getHeatsCode, billetHotsend.getHeatNo());
-		HeatsActuals heatsActuals = heatsActualsService.getOne(queryWrapperHA);
-		LambdaQueryWrapper<BilletHotsend> queryWrapper = new LambdaQueryWrapper<>();
+
+		String cacheShint = billetHotsendDetailsVo.getBilletHotsend().getShift();
+		String cacheShintGroup = billetHotsendDetailsVo.getBilletHotsend().getShiftGroup();
+
+		HeatsActuals heatsActuals = heatsActualsService.getOne(new LambdaQueryWrapper<HeatsActuals>()
+				.eq(HeatsActuals::getCasterCode, billetHotsend.getCcmNo())
+				.eq(HeatsActuals::getHeatsCode, billetHotsend.getHeatNo()));
 		if (heatsActuals != null){
-			queryWrapper.eq(BilletHotsend::getCcmNo, billetHotsend.getCcmNo())
-					.eq(BilletHotsend::getHeatNo, billetHotsend.getHeatNo())
-					.eq(BilletHotsend::getShift, heatsActuals.getShift())
-					.eq(BilletHotsend::getShiftGroup, heatsActuals.getShiftGroup());
-			billetHotsend.setShift(heatsActuals.getShift());
-			billetHotsend.setShiftGroup(heatsActuals.getShiftGroup());
-		}else {
-			queryWrapper.eq(BilletHotsend::getCcmNo, billetHotsend.getCcmNo())
-					.eq(BilletHotsend::getHeatNo, billetHotsend.getHeatNo())
-					.eq(BilletHotsend::getShift, billetHotsend.getShift())
-					.eq(BilletHotsend::getShiftGroup, billetHotsend.getShiftGroup());
+			cacheShint = heatsActuals.getShift();
+			cacheShintGroup = heatsActuals.getShiftGroup();
 		}
+		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 check = baseMapper.selectOne(queryWrapper);
 		if (oConvertUtils.isNotEmpty(check) && oConvertUtils.listIsEmpty(rollClubCommonList)){
 			result.put("fail", "该炉次信息已存在!");
 			return result;
 		}
+		billetHotsend.setShiftGroup(cacheShintGroup);
+		billetHotsend.setShift(cacheShint);
 		if (oConvertUtils.isEmpty(check) && oConvertUtils.listIsEmpty(rollClubCommonList)){
 			billetHotsend.setRollclubtwoNum(0);
 			billetHotsend.setRollcluboneNum(0);
@@ -443,6 +448,8 @@ public class BilletHotsendBaseServiceImpl extends ServiceImpl<BilletHotsendBaseM
 				rollClubOneDetailsList.add(rollClubOneDetails);
 			});
 			rollClubOneDetailsService.saveBatch(rollClubOneDetailsList);
+			// 更新交班表中的热送总支数
+			updateShiftInfoByType(billetHotsend.getCcmNo(), billetHotsend.getShift(), billetHotsend.getShiftGroup(), rollClubOneDetailsList.size(), "roll_club_one", "hotSend");
 		}
 
 		if ("roll_club_two".equals(billetHotsendDetailsVo.getBelongTable())){
@@ -486,6 +493,8 @@ public class BilletHotsendBaseServiceImpl extends ServiceImpl<BilletHotsendBaseM
 				rollClubTwoDetailsList.add(rollClubTwoDetails);
 			});
 			rollClubTwoDetailsService.saveBatch(rollClubTwoDetailsList);
+			// 更新交班表中的热送总支数
+			updateShiftInfoByType(billetHotsend.getCcmNo(), billetHotsend.getShift(), billetHotsend.getShiftGroup(), rollClubTwoDetailsList.size(), "roll_club_two", "hotCharge");
 		}
 
 		if ("roll_club_three".equals(billetHotsendDetailsVo.getBelongTable())){
@@ -531,6 +540,7 @@ public class BilletHotsendBaseServiceImpl extends ServiceImpl<BilletHotsendBaseM
 				rollClubThreeDetailsList.add(rollClubThreeDetails);
 			});
 			rollClubThreeDetailsService.saveBatch(rollClubThreeDetailsList);
+			updateShiftInfoByType(billetHotsend.getCcmNo(), billetHotsend.getShift(), billetHotsend.getShiftGroup(), rollClubThreeDetailsList.size(), "roll_club_three", "hotCharge");
 		}
 
 		/**
@@ -574,6 +584,8 @@ public class BilletHotsendBaseServiceImpl extends ServiceImpl<BilletHotsendBaseM
 				rollHeightDetailsList.add(rollHeightDetails);
 			});
 			rollHeightDetailsService.saveBatch(rollHeightDetailsList);
+			// 更新交班表中的热送总支数
+			updateShiftInfoByType(billetHotsend.getCcmNo(), billetHotsend.getShift(), billetHotsend.getShiftGroup(), rollHeightDetailsList.size(), "roll_height", "hotSend");
 		}
 
 		/**
@@ -620,6 +632,7 @@ public class BilletHotsendBaseServiceImpl extends ServiceImpl<BilletHotsendBaseM
 				rollOutShippDetailsList.add(rollOutShippDetails);
 			});
 			rollOutShippDetailsService.saveBatch(rollOutShippDetailsList);
+			updateShiftInfoByType(billetHotsend.getCcmNo(), billetHotsend.getShift(), billetHotsend.getShiftGroup(), rollOutShippDetailsList.size(), "roll_out_shipp", "hotCharge");
 		}
 		//查询并批量更新钢坯基础信息 belongTable
 		LambdaQueryWrapper<BilletBasicInfo> queryWrapperls = new LambdaQueryWrapper<BilletBasicInfo>()
@@ -662,48 +675,6 @@ public class BilletHotsendBaseServiceImpl extends ServiceImpl<BilletHotsendBaseM
 		return result;
 	}
 
-	@Override
-	public Integer queryEndNumByCcmNo(String ccmNo, String heatNo, String belongTable) {
-		if ("roll_club_one".equals(belongTable)){
-			LambdaQueryWrapper<RollClubOneDetails> queryWrapper = new LambdaQueryWrapper<>();
-			queryWrapper.eq(RollClubOneDetails::getCcmNo, ccmNo).eq(RollClubOneDetails::getHeatNo, heatNo);
-			List<RollClubOneDetails> rollClubOneDetailsList = rollClubOneDetailsService.list(queryWrapper);
-			if (oConvertUtils.listIsEmpty(rollClubOneDetailsList)){
-				return 0;
-			}
-			RollClubOneDetails rollClubOneDetails = rollClubOneDetailsList.stream().max(Comparator.comparing(RollClubOneDetails::getEndNum)).orElse(null);
-			return rollClubOneDetails.getEndNum();
-		}else if ("roll_club_two".equals(belongTable)){
-			LambdaQueryWrapper<RollClubTwoDetails> queryWrapper = new LambdaQueryWrapper<>();
-			queryWrapper.eq(RollClubTwoDetails::getCcmNo, ccmNo).eq(RollClubTwoDetails::getHeatNo, heatNo);
-			List<RollClubTwoDetails> rollClubTwoDetailsList = rollClubTwoDetailsService.list(queryWrapper);
-			if (oConvertUtils.listIsEmpty(rollClubTwoDetailsList)){
-				return 0;
-			}
-			RollClubTwoDetails rollClubTwoDetails = rollClubTwoDetailsList.stream().max(Comparator.comparing(RollClubTwoDetails::getEndNum)).orElse(null);
-			return rollClubTwoDetails.getEndNum();
-		}else if ("roll_club_three".equals(belongTable)){
-			LambdaQueryWrapper<RollClubThreeDetails> queryWrapper = new LambdaQueryWrapper<>();
-			queryWrapper.eq(RollClubThreeDetails::getCcmNo, ccmNo).eq(RollClubThreeDetails::getHeatNo, heatNo);
-			List<RollClubThreeDetails> rollClubThreeDetailsList = rollClubThreeDetailsService.list(queryWrapper);
-			if (oConvertUtils.listIsEmpty(rollClubThreeDetailsList)){
-				return 0;
-			}
-			RollClubThreeDetails rollClubThreeDetails = rollClubThreeDetailsList.stream().max(Comparator.comparing(RollClubThreeDetails::getEndNum)).orElse(null);
-			return rollClubThreeDetails.getEndNum();
-		}else if ("roll_height".equals(belongTable)){
-			LambdaQueryWrapper<RollHeightDetails> queryWrapper = new LambdaQueryWrapper<>();
-			queryWrapper.eq(RollHeightDetails::getCcmNo, ccmNo).eq(RollHeightDetails::getHeatNo, heatNo);
-			List<RollHeightDetails> rollHeightDetailsList = rollHeightDetailsService.list(queryWrapper);
-			if (oConvertUtils.listIsEmpty(rollHeightDetailsList)){
-				return 0;
-			}
-			RollHeightDetails rollHeightDetails = rollHeightDetailsList.stream().max(Comparator.comparing(RollHeightDetails::getEndNum)).orElse(null);
-			return rollHeightDetails.getEndNum();
-		}
-		return null;
-	}
-
 	@Override
 	@Transactional
 	public void saveBilletHotsendDetailsCar(BilletHotsendDetailsVo billetHotsendDetailsVo) {
@@ -716,27 +687,28 @@ public class BilletHotsendBaseServiceImpl extends ServiceImpl<BilletHotsendBaseM
 		BeanUtils.copyProperties(billetHotsendDetailsVo.getBilletHotsend(), billetHotsend);
 		billetHotsend.setCreateDate(new Date());
 //		billetHotsend.setAmountTotal(rollClubCommonList.size()); //总支数
-		LambdaQueryWrapper<HeatsActuals> queryWrapperHA = new LambdaQueryWrapper();
-		queryWrapperHA.eq(HeatsActuals::getCasterCode, billetHotsend.getCcmNo()).eq(HeatsActuals::getHeatsCode, billetHotsend.getHeatNo());
-		HeatsActuals heatsActuals = heatsActualsService.getOne(queryWrapperHA);
-		LambdaQueryWrapper<BilletHotsend> queryWrapper = new LambdaQueryWrapper<>();
+
+		String cacheShint = billetHotsendDetailsVo.getBilletHotsend().getShift();
+		String cacheShintGroup = billetHotsendDetailsVo.getBilletHotsend().getShiftGroup();
+
+		HeatsActuals heatsActuals = heatsActualsService.getOne(new LambdaQueryWrapper<HeatsActuals>()
+				.eq(HeatsActuals::getCasterCode, billetHotsend.getCcmNo())
+				.eq(HeatsActuals::getHeatsCode, billetHotsend.getHeatNo()));
 		if (heatsActuals != null){
-			queryWrapper.eq(BilletHotsend::getCcmNo, billetHotsend.getCcmNo())
-					.eq(BilletHotsend::getHeatNo, billetHotsend.getHeatNo())
-					.eq(BilletHotsend::getShift, heatsActuals.getShift())
-					.eq(BilletHotsend::getShiftGroup, heatsActuals.getShiftGroup());
-			billetHotsend.setShift(heatsActuals.getShift());
-			billetHotsend.setShiftGroup(heatsActuals.getShiftGroup());
-		}else {
-			queryWrapper.eq(BilletHotsend::getCcmNo, billetHotsend.getCcmNo())
-					.eq(BilletHotsend::getHeatNo, billetHotsend.getHeatNo())
-					.eq(BilletHotsend::getShift, billetHotsend.getShift())
-					.eq(BilletHotsend::getShiftGroup, billetHotsend.getShiftGroup());
+			cacheShint = heatsActuals.getShift();
+			cacheShintGroup = heatsActuals.getShiftGroup();
 		}
+		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 check = baseMapper.selectOne(queryWrapper);
 		if (oConvertUtils.isNotEmpty(check) && oConvertUtils.listIsEmpty(rollClubCommonList)){
 			return;
 		}
+		billetHotsend.setShiftGroup(cacheShintGroup);
+		billetHotsend.setShift(cacheShint);
 		if (oConvertUtils.isEmpty(check) && oConvertUtils.listIsEmpty(rollClubCommonList)){
 			billetHotsend.setRollclubtwoNum(0);
 			billetHotsend.setRollcluboneNum(0);
@@ -1099,6 +1071,77 @@ public class BilletHotsendBaseServiceImpl extends ServiceImpl<BilletHotsendBaseM
 		storageCarLog.setAmount(Integer.valueOf((int) count));// 支数
 		storageCarLog.setDataTime(new Date());
 		storageCarLogService.save(storageCarLog);
+	}
+
+
+	@Override
+	public Integer queryEndNumByCcmNo(String ccmNo, String heatNo, String belongTable) {
+		if ("roll_club_one".equals(belongTable)){
+			LambdaQueryWrapper<RollClubOneDetails> queryWrapper = new LambdaQueryWrapper<>();
+			queryWrapper.eq(RollClubOneDetails::getCcmNo, ccmNo).eq(RollClubOneDetails::getHeatNo, heatNo).isNotNull(RollClubOneDetails::getEndNum);
+			List<RollClubOneDetails> rollClubOneDetailsList = rollClubOneDetailsService.list(queryWrapper);
+			if (oConvertUtils.listIsEmpty(rollClubOneDetailsList)){
+				return 0;
+			}
+			RollClubOneDetails rollClubOneDetails = rollClubOneDetailsList.stream().max(Comparator.comparing(RollClubOneDetails::getEndNum)).orElse(null);
+			return rollClubOneDetails.getEndNum();
+		}else if ("roll_club_two".equals(belongTable)){
+			LambdaQueryWrapper<RollClubTwoDetails> queryWrapper = new LambdaQueryWrapper<>();
+			queryWrapper.eq(RollClubTwoDetails::getCcmNo, ccmNo).eq(RollClubTwoDetails::getHeatNo, heatNo).isNotNull(RollClubTwoDetails::getEndNum);
+			List<RollClubTwoDetails> rollClubTwoDetailsList = rollClubTwoDetailsService.list(queryWrapper);
+			if (oConvertUtils.listIsEmpty(rollClubTwoDetailsList)){
+				return 0;
+			}
+			RollClubTwoDetails rollClubTwoDetails = rollClubTwoDetailsList.stream().max(Comparator.comparing(RollClubTwoDetails::getEndNum)).orElse(null);
+			return rollClubTwoDetails.getEndNum();
+		}else if ("roll_club_three".equals(belongTable)){
+			LambdaQueryWrapper<RollClubThreeDetails> queryWrapper = new LambdaQueryWrapper<>();
+			queryWrapper.eq(RollClubThreeDetails::getCcmNo, ccmNo).eq(RollClubThreeDetails::getHeatNo, heatNo).isNotNull(RollClubThreeDetails::getEndNum);
+			List<RollClubThreeDetails> rollClubThreeDetailsList = rollClubThreeDetailsService.list(queryWrapper);
+			if (oConvertUtils.listIsEmpty(rollClubThreeDetailsList)){
+				return 0;
+			}
+			RollClubThreeDetails rollClubThreeDetails = rollClubThreeDetailsList.stream().max(Comparator.comparing(RollClubThreeDetails::getEndNum)).orElse(null);
+			return rollClubThreeDetails.getEndNum();
+		}else if ("roll_height".equals(belongTable)){
+			LambdaQueryWrapper<RollHeightDetails> queryWrapper = new LambdaQueryWrapper<>();
+			queryWrapper.eq(RollHeightDetails::getCcmNo, ccmNo).eq(RollHeightDetails::getHeatNo, heatNo).isNotNull(RollHeightDetails::getEndNum);
+			List<RollHeightDetails> rollHeightDetailsList = rollHeightDetailsService.list(queryWrapper);
+			if (oConvertUtils.listIsEmpty(rollHeightDetailsList)){
+				return 0;
+			}
+			RollHeightDetails rollHeightDetails = rollHeightDetailsList.stream().max(Comparator.comparing(RollHeightDetails::getEndNum)).orElse(null);
+			return rollHeightDetails.getEndNum();
+		}
+		return null;
+	}
+
 
+	/**
+	 * 根据铸机号、班次、班别查询当天交班记录,并根据提供的日志列表更新相应的热送总支数
+	 *
+	 * @param ccmNo 铸机号
+	 * @param cacheShint 班次信息
+	 * @param cacheShintGroup 班别信息
+	 * @param sum 热送总支数
+	 */
+	public void updateShiftInfoByType(String ccmNo, String cacheShint, String cacheShintGroup, Integer sum, String type, String updateType) {
+		LambdaQueryWrapper<BilletHotsendChangeShift> queryWrapperCS = new LambdaQueryWrapper<>();
+		queryWrapperCS.eq(BilletHotsendChangeShift::getCcmNo, ccmNo)
+				.eq(BilletHotsendChangeShift::getShift, cacheShint)
+				.eq(BilletHotsendChangeShift::getShiftGroup, cacheShintGroup)
+				.between(BilletHotsendChangeShift::getCreateTime, DateUtils.getStartOfDay(), DateUtils.getEndOfDay());
+		BilletHotsendChangeShift billetHotsendChangeShift = billetHotsendChangeShiftService.getOne(queryWrapperCS);
+		if (oConvertUtils.isNotEmpty(billetHotsendChangeShift)) {
+			String operationName = type.equals("hotSend")? "热送" : "热装";
+			log.info("{}{}", ">>>>>棒线统计当前班次" + operationName + "总支数:", sum + "班组:" + cacheShintGroup + "班次:" + cacheShint);
+			billetHotsendChangeShift.setUpdateTime(new Date());
+			if ("hotSend".equals(updateType)){
+				billetHotsendChangeShift.setHotsendAmount(sum);
+			}else{
+				billetHotsendChangeShift.setHotfeignAmount(sum);
+			}
+			billetHotsendChangeShiftService.updateById(billetHotsendChangeShift);
+		}
 	}
 }

+ 37 - 0
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/billetHotsendAbandons/entity/BilletHotsendAbandons.java

@@ -9,6 +9,7 @@ import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
+import org.jeecg.common.aspect.annotation.Dict;
 import org.jeecgframework.poi.excel.annotation.Excel;
 import org.springframework.format.annotation.DateTimeFormat;
 
@@ -64,6 +65,42 @@ public class BilletHotsendAbandons implements Serializable {
 	@Excel(name = "坯号", width = 15)
     @ApiModelProperty(value = "坯号")
     private String billetNo;
+    /**班组*/
+    @Excel(name = "班组", width = 15)
+    @ApiModelProperty(value = "班组")
+    @Dict(dicCode = "lg_bz")
+    private String shiftGroup;
+    /**班别*/
+    @Excel(name = "班别", width = 15)
+    @Dict(dicCode = "lg_bb")
+    @ApiModelProperty(value = "班别")
+    private String shift;
+    /**堆垛层号(1-20)*/
+    @Excel(name = "堆垛层号(1-20)", width = 15)
+    @ApiModelProperty(value = "堆垛层号(1-20)")
+    private String stackStorey;
+    /**堆垛编号(1-9)*/
+    @Excel(name = "堆垛编号(1-9)", width = 15)
+    @ApiModelProperty(value = "堆垛编号(1-9)")
+    private String stackNum;
+    /**垛位*/
+    @Excel(name = "垛位", width = 15)
+    @ApiModelProperty(value = "垛位")
+    private String stackAddr;
+    /**钢种*/
+    @Excel(name = "钢种", width = 15)
+    @ApiModelProperty(value = "钢种")
+    private String steel;
+    /**规格*/
+    @Excel(name = "规格", width = 15)
+    @ApiModelProperty(value = "规格")
+    @Dict(dicCode = "billet_spec")
+    private String spec;
+    /**定尺1*/
+    @Excel(name = "定尺", width = 15)
+    @ApiModelProperty(value = "定尺")
+    @Dict(dicCode = "lg_dcgg")
+    private String size;
 	/**备注*/
 	@Excel(name = "备注", width = 15)
     @ApiModelProperty(value = "备注")

+ 4 - 4
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/billetHotsendChangeShift/entity/BilletHotsendChangeShift.java

@@ -54,7 +54,7 @@ public class BilletHotsendChangeShift implements Serializable {
     private String sysOrgCode;
     /**铸机*/
     @Excel(name = "铸机号", width = 15)
-    @ApiModelProperty(value = "castMachine")
+    @ApiModelProperty(value = "铸机号")
     private String ccmNo;
 	/**当前浇铸炉号*/
 	@Excel(name = "当前浇铸炉号", width = 15)
@@ -101,9 +101,9 @@ public class BilletHotsendChangeShift implements Serializable {
     @ApiModelProperty(value = "车牌号")
     private String carNumber;
 	/**出车号*/
-	@Excel(name = "出车号", width = 15)
-    @ApiModelProperty(value = "出车号")
-    private String outCarNum;
+	@Excel(name = "车次", width = 15)
+    @ApiModelProperty(value = "车次")
+    private Integer outCarNum;
 	/**备注*/
 	@Excel(name = "备注", width = 15)
     @ApiModelProperty(value = "备注")

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

@@ -355,4 +355,11 @@ public class StackingAndLoadingVehiclesController extends JeecgController<Stacki
 		 stackingAndLoadingVehiclesService.startHeight(savVo);
 		 return Result.OK("操作成功");
 	 }
+
+	 @ApiOperation(value="钢坯叛废", notes="钢坯叛废")
+	 @PostMapping(value = "/judgeDiscard")
+	 public Result<?> judgeDiscardHandle(@RequestBody LoadingParams loadingParams){
+		 String result = stackingAndLoadingVehiclesService.judgeDiscardHandle(loadingParams);
+		 return Result.OK(result);
+	 }
 }

+ 2 - 0
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/stackingAndLoadingVehicles/service/IStackingAndLoadingVehiclesService.java

@@ -43,4 +43,6 @@ public interface IStackingAndLoadingVehiclesService extends IService<StackingAnd
     void stackDepartHandle(LoadingParams loadingParams);
 
     void addStackInfo(LoadingParams loadingParams);
+
+    String judgeDiscardHandle(LoadingParams loadingParams);
 }

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

@@ -1,10 +1,12 @@
 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;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.util.DateUtils;
 import org.jeecg.common.util.oConvertUtils;
 import org.jeecg.modules.actualControl.billetActual.billetActual.entity.BilletBasicInfo;
 import org.jeecg.modules.actualControl.billetActual.billetActual.service.IBilletBasicInfoService;
@@ -14,6 +16,10 @@ 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.billetHotsendAbandons.entity.BilletHotsendAbandons;
+import org.jeecg.modules.billet.billetHotsendAbandons.service.IBilletHotsendAbandonsService;
+import org.jeecg.modules.billet.billetHotsendChangeShift.entity.BilletHotsendChangeShift;
+import org.jeecg.modules.billet.billetHotsendChangeShift.service.IBilletHotsendChangeShiftService;
 import org.jeecg.modules.billet.billetHotsendConfig.entity.BilletHotsendTypeConfig;
 import org.jeecg.modules.billet.billetHotsendConfig.service.IBilletHotsendTypeConfigService;
 import org.jeecg.modules.billet.operateLog.service.IOperateLogService;
@@ -88,6 +94,10 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
     private IRollClubThreeDetailsService rollClubThreeDetailsService;
     @Autowired
     private IRollClubTwoDetailsService rollClubTwoDetailsService;
+    @Autowired
+    private IBilletHotsendChangeShiftService billetHotsendChangeShiftService;
+    @Autowired
+    private IBilletHotsendAbandonsService billetHotsendAbandonsService;
     @Override
     public List<List<StackingAndLoadingVehicles>> getListBySatck(String typeConfigId) {
         LambdaQueryWrapper<StackingAndLoadingVehicles> wrapper = new LambdaQueryWrapper<>();
@@ -509,6 +519,9 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
         String finalCacheShintGroup1 = cacheShintGroup;
         // 3 保存 下垛日志    stacking_up_log
         List<StackingDownLog> stackingDownLogList = new ArrayList<>();
+        List<RollClubTwoDetails> addRollClubTwoDetailsList = new ArrayList<>();
+        List<RollClubThreeDetails> addRollClubThreeDetailsList = new ArrayList<>();
+        List<RollOutShippDetails> addRollOutShippDetailsList = new ArrayList<>();
         stackingAndLoadingVehiclesList.forEach(x ->{
             StackingDownLog stackingDownLog = new StackingDownLog();
             BeanUtils.copyProperties(x, stackingDownLog);
@@ -522,9 +535,47 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
             stackingDownLog.setShiftGroup(finalCacheShintGroup1);
 //            stackingUpLog.setFromStackingId(stackingAndLoadingVehicles.getId());
             stackingDownLogList.add(stackingDownLog);
+            if ("roll_club_two".equals(loadingParams.getDestinationTable())){
+                RollClubTwoDetails rollClubTwoDetails = new RollClubTwoDetails();
+                rollClubTwoDetails.setBilletNo(x.getBilletNos());
+                rollClubTwoDetails.setStorageBillId(loadingParams.getStorageBill().getId());
+                rollClubTwoDetails.setStackStorey(x.getLayer());
+                rollClubTwoDetails.setStackNum(x.getAddress());
+                rollClubTwoDetails.setLicensePlate(loadingParams.getStorageBill().getLicensePlate());
+                rollClubTwoDetails.setCreateTime(new Date());
+                BeanUtils.copyProperties(x, rollClubTwoDetails);
+                addRollClubTwoDetailsList.add(rollClubTwoDetails);
+            }else if ("roll_club_three".equals(loadingParams.getDestinationTable())){
+                RollClubThreeDetails rollClubThreeDetails = new RollClubThreeDetails();
+                BeanUtils.copyProperties(x, rollClubThreeDetails);
+                rollClubThreeDetails.setBilletNo(x.getBilletNos());
+                rollClubThreeDetails.setStorageBillId(loadingParams.getStorageBill().getId());
+                rollClubThreeDetails.setStackStorey(x.getLayer());
+                rollClubThreeDetails.setStackNum(x.getAddress());
+                rollClubThreeDetails.setLicensePlate(loadingParams.getStorageBill().getLicensePlate());
+                rollClubThreeDetails.setCreateTime(new Date());
+                addRollClubThreeDetailsList.add(rollClubThreeDetails);
+            }else if ("roll_out_shipp".equals(loadingParams.getDestinationTable())){
+                RollOutShippDetails rollOutShippDetails = new RollOutShippDetails();
+                BeanUtils.copyProperties(x, rollOutShippDetails);
+                rollOutShippDetails.setBilletNo(x.getBilletNos());
+                rollOutShippDetails.setStorageBillId(loadingParams.getStorageBill().getId());
+                rollOutShippDetails.setStackStorey(x.getLayer());
+                rollOutShippDetails.setStackNum(x.getAddress());
+                rollOutShippDetails.setLicensePlate(loadingParams.getStorageBill().getLicensePlate());
+                rollOutShippDetails.setCreateTime(new Date());
+                addRollOutShippDetailsList.add(rollOutShippDetails);
+            }
         });
         stackingDownLogService.saveBatch(stackingDownLogList);
-
+        // 根据所去的目的地 保存到对应的明细表
+        if ("roll_club_two".equals(loadingParams.getDestinationTable())){
+            rollClubTwoDetailsService.saveBatch(addRollClubTwoDetailsList);
+        }else if ("roll_club_three".equals(loadingParams.getDestinationTable())){
+            rollClubThreeDetailsService.saveBatch(addRollClubThreeDetailsList);
+        }else if ("roll_out_shipp".equals(loadingParams.getDestinationTable())){
+            rollOutShippDetailsService.saveBatch(addRollOutShippDetailsList);
+        }
         // 获取所有的坯号集合
         List<String> billetNosList = stackingAndLoadingVehiclesList.stream().map(StackingAndLoadingVehicles::getBilletNos)
                 .flatMap(billetNos -> {
@@ -595,11 +646,14 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
             idExistBh.setStackNum(idExistBh.getStackNum() - 4);
             billetHotsendBaseService.updateById(idExistBh);
         });
-
+        StorageBill storageBill = loadingParams.getStorageBill();
         // 4 保存 下垛日志    stacking_down_log
         String finalCacheShint1 = cacheShint;
         String finalCacheShintGroup1 = cacheShintGroup;
         List<StackingDownLog> stackingDownLogList = new ArrayList<>();
+        List<RollClubTwoDetails> addRollClubTwoDetailsList = new ArrayList<>();
+        List<RollClubThreeDetails> addRollClubThreeDetailsList = new ArrayList<>();
+        List<RollOutShippDetails> addRollOutShippDetailsList = new ArrayList<>();
         stackingAndLoadingVehiclesList.forEach(x ->{
             StackingDownLog stackingDownLog = new StackingDownLog();
             BeanUtils.copyProperties(x, stackingDownLog);
@@ -610,10 +664,49 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
             stackingDownLog.setStackNum(x.getAddress());
             stackingDownLog.setShift(finalCacheShint1);
             stackingDownLog.setShiftGroup(finalCacheShintGroup1);
+            stackingDownLog.setCreateTime(new Date());
             stackingDownLogList.add(stackingDownLog);
+            if ("roll_club_two".equals(loadingParams.getDestinationTable())){
+                RollClubTwoDetails rollClubTwoDetails = new RollClubTwoDetails();
+                rollClubTwoDetails.setBilletNo(x.getBilletNos());
+                rollClubTwoDetails.setStorageBillId(storageBill.getId());
+                rollClubTwoDetails.setStackStorey(x.getLayer());
+                rollClubTwoDetails.setStackNum(x.getAddress());
+                rollClubTwoDetails.setLicensePlate(storageBill.getLicensePlate());
+                rollClubTwoDetails.setCreateTime(new Date());
+                BeanUtils.copyProperties(x, rollClubTwoDetails);
+                addRollClubTwoDetailsList.add(rollClubTwoDetails);
+            }else if ("roll_club_three".equals(loadingParams.getDestinationTable())){
+                RollClubThreeDetails rollClubThreeDetails = new RollClubThreeDetails();
+                BeanUtils.copyProperties(x, rollClubThreeDetails);
+                rollClubThreeDetails.setBilletNo(x.getBilletNos());
+                rollClubThreeDetails.setStorageBillId(storageBill.getId());
+                rollClubThreeDetails.setStackStorey(x.getLayer());
+                rollClubThreeDetails.setStackNum(x.getAddress());
+                rollClubThreeDetails.setLicensePlate(storageBill.getLicensePlate());
+                rollClubThreeDetails.setCreateTime(new Date());
+                addRollClubThreeDetailsList.add(rollClubThreeDetails);
+            }else if ("roll_out_shipp".equals(loadingParams.getDestinationTable())){
+                RollOutShippDetails rollOutShippDetails = new RollOutShippDetails();
+                BeanUtils.copyProperties(x, rollOutShippDetails);
+                rollOutShippDetails.setBilletNo(x.getBilletNos());
+                rollOutShippDetails.setStorageBillId(storageBill.getId());
+                rollOutShippDetails.setStackStorey(x.getLayer());
+                rollOutShippDetails.setStackNum(x.getAddress());
+                rollOutShippDetails.setLicensePlate(storageBill.getLicensePlate());
+                rollOutShippDetails.setCreateTime(new Date());
+                addRollOutShippDetailsList.add(rollOutShippDetails);
+            }
         });
         stackingDownLogService.saveBatch(stackingDownLogList);
-
+        // 根据所去的目的地 保存装运明细到对应的明细表
+        if ("roll_club_two".equals(loadingParams.getDestinationTable())){
+            rollClubTwoDetailsService.saveBatch(addRollClubTwoDetailsList);
+        }else if ("roll_club_three".equals(loadingParams.getDestinationTable())){
+            rollClubThreeDetailsService.saveBatch(addRollClubThreeDetailsList);
+        }else if ("roll_out_shipp".equals(loadingParams.getDestinationTable())){
+            rollOutShippDetailsService.saveBatch(addRollOutShippDetailsList);
+        }
         // 获取所有的坯号集合
         List<String> billetNosList = stackingAndLoadingVehiclesList.stream().map(StackingAndLoadingVehicles::getBilletNos)
                 .flatMap(billetNos -> {
@@ -634,7 +727,6 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
         });
         billetBasicInfoService.saveOrUpdateBatch(billetBasicInfoList);
         // 6 更新装运单 storage_bill 新增储运信息
-        StorageBill storageBill = loadingParams.getStorageBill();
         storageBill.setTypeConfigId(loadingParams.getBilletHotsendTypeConfigId()); // 钢坯配置类型ID
         storageBill.setDestination(loadingParams.getDestination());// 目的地
         storageBill.setAmountTotal(storageBill.getAmountTotal() + stackingAndLoadingVehiclesList.size() * 4);
@@ -775,7 +867,8 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
             stackingUpLogList.add(stackingUpLog);
         });
         stackingUpLogService.saveBatch(stackingUpLogList);
-
+        // 根据铸机号、班次、班别 查询当天交班记录 存在就更新当前起跺总支数
+        updateShiftInfoByType(billetHotsend.getCcmNo(), cacheShint, cacheShintGroup, stackingUpLogList.size() * 4, "stackingUp");
         //4 获取所有的坯号集合
         List<String> billetNosList = stackingAndLoadingVehiclesList.stream().map(StackingAndLoadingVehicles::getBilletNos)
                 .flatMap(billetNoss -> {
@@ -797,6 +890,63 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
         billetBasicInfoService.saveOrUpdateBatch(billetBasicInfoList);
     }
 
+    @Override
+    @Transactional
+    public String judgeDiscardHandle(LoadingParams loadingParams) {
+        List<StackingAndLoadingVehicles> stackingAndLoadingVehiclesList = loadingParams.getStackingAndLoadingVehiclesList();
+        if (oConvertUtils.listIsEmpty(stackingAndLoadingVehiclesList)){
+            return "钢坯叛废记录不存在!";
+        }
+        List<BilletHotsendAbandons> billetHotsendAbandonsList = new ArrayList<>();
+        // 2 发车后,动态更新容器中的垛位信息 初始化
+        stackingAndLoadingVehiclesList.forEach(x ->{
+            // 拆分四个钢坯集,组成叛废记录
+            List<String> sizeList = Arrays.asList(x.getSize().split(","));
+            List<String> billetNosList = Arrays.asList(x.getBilletNos().split(","));
+            billetNosList.forEach(y -> {
+                // 每次循环创建一个全新的BilletHotsendAbandons对象
+                BilletHotsendAbandons billetHotsendAbandons = new BilletHotsendAbandons();
+                BeanUtils.copyProperties(x, billetHotsendAbandons);
+                billetHotsendAbandons.setId(String.valueOf(IdWorker.getId()));
+                billetHotsendAbandons.setBilletNo(y);
+                billetHotsendAbandons.setStackStorey(x.getLayer());
+                billetHotsendAbandons.setStackNum(x.getAddress());
+                billetHotsendAbandons.setCreateTime(new Date());
+                if (oConvertUtils.listIsNotEmpty(sizeList)) {
+                    billetHotsendAbandons.setSize(sizeList.get(0));// 一夹4组,定尺是一致的
+                }
+                billetHotsendAbandonsList.add(billetHotsendAbandons);
+            });
+            // 先根据垛位容器中的铸机号和炉号 查询钢坯热送基础信息
+            LambdaQueryWrapper<BilletHotsend> queryWrapperBH = new LambdaQueryWrapper<>();
+            queryWrapperBH.eq(BilletHotsend::getCcmNo, x.getCcmNo())
+                    .eq(BilletHotsend::getHeatNo, x.getHeatNo())
+                    .eq(BilletHotsend::getShift, x.getShift())
+                    .eq(BilletHotsend::getShiftGroup, x.getShiftGroup());
+            BilletHotsend idExistBh = billetHotsendBaseService.getOne(queryWrapperBH);
+            if (oConvertUtils.isNotEmpty(idExistBh)){
+                log.info("{}{}", ">>>>>更新钢坯热送基础信息叛废支数:", JSON.toJSON(idExistBh));
+                idExistBh.setWasteNum(oConvertUtils.isEmpty(idExistBh.getWasteNum()) ? 4 : idExistBh.getWasteNum() + 4);
+                idExistBh.setUpdateTime(new Date());
+                billetHotsendBaseService.updateById(idExistBh);
+            }
+        });
+        billetHotsendAbandonsService.saveBatch(billetHotsendAbandonsList);
+        // 根据交班表的当前判废总数
+        LambdaQueryWrapper<BilletHotsendChangeShift> queryWrapperCS = new LambdaQueryWrapper<>();
+        queryWrapperCS.eq(BilletHotsendChangeShift::getCcmNo, loadingParams.getBilletHotsend().getCcmNo())
+                .eq(BilletHotsendChangeShift::getShift, loadingParams.getBilletHotsend().getShift())
+                .eq(BilletHotsendChangeShift::getShiftGroup, loadingParams.getBilletHotsend().getShiftGroup());
+        BilletHotsendChangeShift billetHotsendChangeShift = billetHotsendChangeShiftService.getOne(queryWrapperCS);
+        if (oConvertUtils.isNotEmpty(billetHotsendChangeShift)){
+            billetHotsendChangeShift.setWasteAmount(oConvertUtils.isEmpty(billetHotsendChangeShift.getWasteAmount()) ? stackingAndLoadingVehiclesList.size() : billetHotsendChangeShift.getWasteAmount() + stackingAndLoadingVehiclesList.size() * 4);
+            billetHotsendChangeShift.setUpdateTime(new Date());
+            billetHotsendChangeShiftService.updateById(billetHotsendChangeShift);
+        }
+        log.info("{}{}", "保存钢坯叛废记录总数:", billetHotsendAbandonsList.size());
+        return "钢坯叛废成功!";
+    }
+
 
     /**
      * 初始化StackingAndLoadingVehicles对象
@@ -954,4 +1104,33 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
 //        }
     }
 
+
+    /**
+     * 根据铸机号、班次、班别查询当天交班记录,并根据提供的日志列表更新相应的总支数
+     *
+     * @param ccmNo 铸机号
+     * @param cacheShint 班次信息
+     * @param cacheShintGroup 班别信息
+     * @param sum 总支数
+     * @param type 操作类型,用于区分是热装还是起跺,比如 "hotSend" 表示热装,"stackUp" 表示起跺
+     */
+    public void updateShiftInfoByType(String ccmNo, String cacheShint, String cacheShintGroup, Integer sum, String type) {
+        LambdaQueryWrapper<BilletHotsendChangeShift> queryWrapperCS = new LambdaQueryWrapper<>();
+        queryWrapperCS.eq(BilletHotsendChangeShift::getCcmNo, ccmNo)
+                .eq(BilletHotsendChangeShift::getShift, cacheShint)
+                .eq(BilletHotsendChangeShift::getShiftGroup, cacheShintGroup)
+                .between(BilletHotsendChangeShift::getCreateTime, DateUtils.getStartOfDay(), DateUtils.getEndOfDay());
+        BilletHotsendChangeShift billetHotsendChangeShift = billetHotsendChangeShiftService.getOne(queryWrapperCS);
+        if (oConvertUtils.isNotEmpty(billetHotsendChangeShift)) {
+            String operationName = type.equals("hotSend")? "热装" : "起跺";
+            log.info("{}{}", ">>>>>堆垛统计当前班次" + operationName + "总支数:", sum + "班组:" + cacheShintGroup + "班次:" + cacheShint);
+            billetHotsendChangeShift.setUpdateTime(new Date());
+            if ("hotSend".equals(type)){
+                billetHotsendChangeShift.setHotfeignAmount(sum);
+            }else if ("stackingUp".equals(type)){
+                billetHotsendChangeShift.setStackAmount(sum);
+            }
+            billetHotsendChangeShiftService.updateById(billetHotsendChangeShift);
+        }
+    }
 }

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

@@ -12,8 +12,11 @@ import org.jeecg.common.api.vo.Result;
 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.DateUtils;
 import org.jeecg.common.util.oConvertUtils;
 import org.jeecg.modules.billet.billetHotsend.entity.BilletHotsendDetailsVo;
+import org.jeecg.modules.billet.billetHotsendChangeShift.entity.BilletHotsendChangeShift;
+import org.jeecg.modules.billet.billetHotsendChangeShift.service.IBilletHotsendChangeShiftService;
 import org.jeecg.modules.billet.operateLog.service.IOperateLogService;
 import org.jeecg.modules.billet.storageBill.entity.BilletHotsendDetails;
 import org.jeecg.modules.billet.storageBill.entity.StorageBill;
@@ -30,7 +33,6 @@ import org.springframework.web.servlet.ModelAndView;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.util.Arrays;
-import java.util.Calendar;
 import java.util.Date;
 import java.util.List;
 
@@ -60,6 +62,9 @@ public class StorageBillController extends JeecgController<StorageBill, IStorage
 	@Autowired
 	private IStorageCarLogService storageCarLogService;
 
+	@Autowired
+	private IBilletHotsendChangeShiftService billetHotsendChangeShiftService;
+
 	/**
 	 * 分页列表查询
 	 *
@@ -120,34 +125,31 @@ public class StorageBillController extends JeecgController<StorageBill, IStorage
 		 storageBill.setCarAllNum(oConvertUtils.listIsEmpty(storageBillService.list()) ? 0 : storageBillService.list().size() + 1);// 车次总序号
 		 storageBill.setArrivalTime(new Date());// 到达时间
 
-		 // 获取当天开始时间 00:00:00
-		 Calendar startCalendar = Calendar.getInstance();
-		 startCalendar.setTime(new Date());
-		 startCalendar.set(Calendar.HOUR_OF_DAY, 0);
-		 startCalendar.set(Calendar.MINUTE, 0);
-		 startCalendar.set(Calendar.SECOND, 0);
-		 Date startOfDay = startCalendar.getTime();
-		 // 获取当天结束时间 23:59:59
-		 Calendar endCalendar = Calendar.getInstance();
-		 endCalendar.setTime(new Date());
-		 endCalendar.set(Calendar.HOUR_OF_DAY, 23);
-		 endCalendar.set(Calendar.MINUTE, 59);
-		 endCalendar.set(Calendar.SECOND, 59);
-		 Date endOfDay = endCalendar.getTime();
-
 		 LambdaQueryWrapper<StorageBill> queryWrapper1 = new LambdaQueryWrapper<>();
 		 queryWrapper1.eq(StorageBill::getCcmNo, storageBill.getCcmNo())
 				 .eq(StorageBill::getLicensePlate, storageBill.getLicensePlate())
 				 .eq(StorageBill::getShiftGroup, text1)
-				 .eq(StorageBill::getShift, text2).between(StorageBill::getCreateTime, startOfDay, endOfDay);
+				 .eq(StorageBill::getShift, text2).between(StorageBill::getCreateTime, DateUtils.getStartOfDay(), DateUtils.getEndOfDay());
 
 		 LambdaQueryWrapper<StorageBill> queryWrapper2 = new LambdaQueryWrapper<>();
 		 queryWrapper2.eq(StorageBill::getCcmNo, storageBill.getCcmNo())
 				 .eq(StorageBill::getShiftGroup, text1)
-				 .eq(StorageBill::getShift, text2).between(StorageBill::getCreateTime, startOfDay, endOfDay);
+				 .eq(StorageBill::getShift, text2).between(StorageBill::getCreateTime, DateUtils.getStartOfDay(), DateUtils.getEndOfDay());
 		 List<StorageBill> storageBillList = storageBillService.list(queryWrapper1);
 		 storageBill.setCarNum(storageBillList.size() + 1);
 		 storageBill.setCarAllNum(storageBillService.list(queryWrapper2).size() + 1);
+
+		 // 通过铸机号、班组、班别去查询交班记录并初始化 车次
+		 LambdaQueryWrapper<BilletHotsendChangeShift> queryWrapper3 = new LambdaQueryWrapper<>();
+		 queryWrapper3.eq(BilletHotsendChangeShift::getCcmNo, storageBill.getCcmNo())
+				 .eq(BilletHotsendChangeShift::getShiftGroup, text1)
+				 .eq(BilletHotsendChangeShift::getShift, text2).between(BilletHotsendChangeShift::getCreateTime, DateUtils.getStartOfDay(), DateUtils.getEndOfDay());
+		 BilletHotsendChangeShift billetHotsendChangeShift = billetHotsendChangeShiftService.getOne(queryWrapper3);
+		 if (oConvertUtils.isNotEmpty(billetHotsendChangeShift)){
+			 billetHotsendChangeShift.setOutCarNum(billetHotsendChangeShift.getOutCarNum() + 1);
+			 billetHotsendChangeShift.setUpdateTime(new Date());
+			 billetHotsendChangeShiftService.updateById(billetHotsendChangeShift);
+		 }
 		 storageBill.setAmountTotal(0);
 		 storageBill.setShiftGroup(text1);
 		 storageBill.setShift(text2);

+ 4 - 5
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/storageBill/entity/BilletHotsendDetails.java

@@ -4,7 +4,6 @@ import lombok.Data;
 import org.jeecg.modules.billet.rollClubThree.entity.RollClubThreeDetails;
 import org.jeecg.modules.billet.rollClubTwo.entity.RollClubTwoDetails;
 import org.jeecg.modules.billet.rollOutShipp.entity.RollOutShippDetails;
-import org.jeecg.modules.billet.stackingAndLoadingVehicles.entity.StackingDownLog;
 
 import java.util.List;
 
@@ -16,9 +15,9 @@ public class BilletHotsendDetails {
     private List<RollClubThreeDetails> rollClubThreeDetailsList;
 
     private List<RollOutShippDetails> rollOutShippDetailsList;
-
-    private List<StackingDownLog> stackingDownLogList;
-
-    private List<StackingDownLogDetails> stackingDownLogDetailsList;
+//
+//    private List<StackingDownLog> stackingDownLogList;
+//
+//    private List<StackingDownLogDetails> stackingDownLogDetailsList;
 
 }

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

@@ -16,21 +16,16 @@ 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.StackingDownLog;
 import org.jeecg.modules.billet.stackingAndLoadingVehicles.service.IStackingDownLogService;
 import org.jeecg.modules.billet.storageBill.entity.BilletHotsendDetails;
 import org.jeecg.modules.billet.storageBill.entity.GetStatsResponse;
-import org.jeecg.modules.billet.storageBill.entity.StackingDownLogDetails;
 import org.jeecg.modules.billet.storageBill.entity.StorageBill;
 import org.jeecg.modules.billet.storageBill.mapper.StorageBillMapper;
 import org.jeecg.modules.billet.storageBill.service.IStorageBillService;
 import org.jeecg.modules.billet.storageCarLog.service.IStorageCarLogService;
-import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
-import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Date;
 import java.util.List;
 import java.util.stream.Collectors;
@@ -136,29 +131,29 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
         result.setRollClubThreeDetailsList(rollClubThreeDetailsList);
         List<RollOutShippDetails> rollOutShippDetailsList = rollOutShippDetailsService.list(new LambdaQueryWrapper<RollOutShippDetails>().eq(RollOutShippDetails::getStorageBillId, storageBill.getId()));
         result.setRollOutShippDetailsList(rollOutShippDetailsList);
-        List<StackingDownLogDetails> stackingDownLogDetailsList = new ArrayList<>();
-        List<StackingDownLog> stackingDownLogList = stackingDownLogService.list(new LambdaQueryWrapper<StackingDownLog>().eq(StackingDownLog::getStorageBillId, storageBill.getId()));
-        if (oConvertUtils.listIsEmpty(stackingDownLogList)){
-            result.setStackingDownLogList(stackingDownLogList);
-            result.setStackingDownLogDetailsList(stackingDownLogDetailsList);
-            return result;
-        }
-        StackingDownLog stackingDownLog = stackingDownLogList.stream().findFirst().orElse(null);
-        List<String> stringList = Arrays.stream(stackingDownLog.getBilletNo().split(","))
-                .collect(Collectors.toList());
-        LambdaQueryWrapper<BilletBasicInfo> queryWrapper = new LambdaQueryWrapper<>();
-        queryWrapper.eq(BilletBasicInfo::getBilletNo, stringList.get(0));
-        BilletBasicInfo billetBasicInfo = billetBasicInfoService.list(queryWrapper).stream().findFirst().orElse(null);
-        stackingDownLogList.forEach(x ->{
-            StackingDownLogDetails stackingDownLogDetails = new StackingDownLogDetails();
-            BeanUtils.copyProperties(x, stackingDownLogDetails);
-            stackingDownLogDetails.setGrade(billetBasicInfo.getGrade());
-            stackingDownLogDetails.setSpec(billetBasicInfo.getSpec());
-            stackingDownLogDetails.setLength(billetBasicInfo.getLength());
-            stackingDownLogDetailsList.add(stackingDownLogDetails);
-        });
-        result.setStackingDownLogList(stackingDownLogList);
-        result.setStackingDownLogDetailsList(stackingDownLogDetailsList);
+//        List<StackingDownLogDetails> stackingDownLogDetailsList = new ArrayList<>();
+//        List<StackingDownLog> stackingDownLogList = stackingDownLogService.list(new LambdaQueryWrapper<StackingDownLog>().eq(StackingDownLog::getStorageBillId, storageBill.getId()));
+//        if (oConvertUtils.listIsEmpty(stackingDownLogList)){
+//            result.setStackingDownLogList(stackingDownLogList);
+//            result.setStackingDownLogDetailsList(stackingDownLogDetailsList);
+//            return result;
+//        }
+//        StackingDownLog stackingDownLog = stackingDownLogList.stream().findFirst().orElse(null);
+//        List<String> stringList = Arrays.stream(stackingDownLog.getBilletNo().split(","))
+//                .collect(Collectors.toList());
+//        LambdaQueryWrapper<BilletBasicInfo> queryWrapper = new LambdaQueryWrapper<>();
+//        queryWrapper.eq(BilletBasicInfo::getBilletNo, stringList.get(0));
+//        BilletBasicInfo billetBasicInfo = billetBasicInfoService.list(queryWrapper).stream().findFirst().orElse(null);
+//        stackingDownLogList.forEach(x ->{
+//            StackingDownLogDetails stackingDownLogDetails = new StackingDownLogDetails();
+//            BeanUtils.copyProperties(x, stackingDownLogDetails);
+//            stackingDownLogDetails.setGrade(billetBasicInfo.getGrade());
+//            stackingDownLogDetails.setSpec(billetBasicInfo.getSpec());
+//            stackingDownLogDetails.setLength(billetBasicInfo.getLength());
+//            stackingDownLogDetailsList.add(stackingDownLogDetails);
+//        });
+//        result.setStackingDownLogList(stackingDownLogList);
+//        result.setStackingDownLogDetailsList(stackingDownLogDetailsList);
         return result;
     }