Browse Source

热装、堆垛装车2车位逻辑调整

qiangxuan 2 days ago
parent
commit
447fb552e9

+ 39 - 36
zgzt-sys-java/jeecg-module-conn/src/main/java/org/jeecg/modules/billetActual/service/impl/BilletHotsendBaseServiceImpl.java

@@ -280,6 +280,36 @@ public class BilletHotsendBaseServiceImpl extends ServiceImpl<BilletHotsendBaseM
 			return;
 		}
 
+		String shiftGroup = shiftGroupHandle(ccmNo);
+		String shift = shiftHandle(ccmNo);
+		log.info("C端自动化热装缓存中的班组、班别:{}", shiftGroup + ":" + shift);
+		if (oConvertUtils.isEmpty(shiftGroup) || oConvertUtils.isEmpty(shift)){
+			log.info("{}{}", "班组班别获取为空,C端自动化热装<保存>失败!", JSON.toJSON(jsonObject));
+			return;
+		}
+		BilletLiftingBill billetLiftingBill = new BilletLiftingBill();
+		// 独立保存行车吊运单
+		billetLiftingBill.setId(String.valueOf(IdWorker.getId()));
+		billetLiftingBill.setCcmNo(ccmNo);
+		billetLiftingBill.setBilletsNo(billetNos);
+		billetLiftingBill.setShiftGroup(shiftGroup);
+		billetLiftingBill.setShift(shift);
+		billetLiftingBill.setVehicleNumber(jsonObject.getString("vehicleNumber"));
+		billetLiftingBill.setLocation(location);
+		billetLiftingBill.setAddress(address);
+		billetLiftingBill.setLiftingType("1");
+		billetLiftingBill.setBelongType("1");
+		billetLiftingBill.setDestination(destination);
+		billetLiftingBill.setLayer(layer);
+		billetLiftingBill.setPositionNum(Integer.valueOf(positionNum));
+		billetLiftingBill.setPlateOrStack(plateOrStack);
+		if (oConvertUtils.isNotEmpty(liftingTime)){
+			billetLiftingBill.setLiftingTime(DateUtils.str2Date(liftingTime, DateUtils.datetimeFormat.get()));
+		}
+		billetLiftingBill.setRemark("热装吊运单");
+		billetLiftingBill.setBilletWeight(0.00);
+		saveBilletLiftingBillsHotCharge(billetLiftingBill);
+		log.info("C端自动化热装保存吊运单成功: {}", billetLiftingBill.getBilletsNo());
 		// 首先查询钢坯装运单
 		LambdaQueryWrapper<StorageBill> queryWrapper2 = new LambdaQueryWrapper<>();
 		queryWrapper2.eq(StorageBill::getPositionNum, Integer.valueOf(positionNum))
@@ -314,22 +344,20 @@ public class BilletHotsendBaseServiceImpl extends ServiceImpl<BilletHotsendBaseM
 				.filter(num -> num.length() >= 9)
 				.map(num -> String.valueOf(num.charAt(8)))
 				.orElse("");
-		
-		log.info("C端自动化热装铸机号:{}", ccmNo);
-		String shiftGroup = shiftGroupHandle(ccmNo);
-		String shift = shiftHandle(ccmNo);
-		// 更具装运单确认铸机号
-		if (oConvertUtils.isNotEmpty(isStorageBill) && oConvertUtils.isEmpty(isStorageBill.getCcmNo())) {
+
+		log.info("C端自动化热装,钢坯中截取的铸机号:{}", ccmNo);
+		// 更新装运单铸机号、班别、班组
+		if ("0".equals(isStorageBill.getCcmNo())) {
 			// 更新铸机号,到装运单
 			isStorageBill.setCcmNo(ccmNo);
 			isStorageBill.setShiftGroup(shiftGroup);
 			isStorageBill.setShift(shift);
 			storageBillService.updateById(isStorageBill);
-		}
-		log.info("C端自动化缓存中的班组、班别:{}", shiftGroup + ":" + shift);
-		if (oConvertUtils.isEmpty(shiftGroup) || oConvertUtils.isEmpty(shift)){
-			log.info("{}{}", "班组班别获取为空,C端自动化热装<保存>失败!", JSON.toJSON(isStorageBill));
-			return;
+		}else {
+			if (!isStorageBill.getCcmNo().equals(ccmNo)){
+				log.info("{}{}", ",铸机号与钢坯不一致,C端自动化热装<保存>失败!", JSON.toJSON(isStorageBill));
+				return;
+			}
 		}
 
 		BilletHotsend billetHotsends = new BilletHotsend();
@@ -339,30 +367,6 @@ public class BilletHotsendBaseServiceImpl extends ServiceImpl<BilletHotsendBaseM
 		billetHotsends.setIsUpd(false);
 		billetHotsendDetailsVo.setBilletHotsend(billetHotsends);
 
-		BilletLiftingBill billetLiftingBill = new BilletLiftingBill();
-		// 独立保存行车吊运单
-		billetLiftingBill.setId(String.valueOf(IdWorker.getId()));
-		billetLiftingBill.setCcmNo(ccmNo);
-		billetLiftingBill.setBilletsNo(billetNos);
-		billetLiftingBill.setShiftGroup(shiftGroup);
-		billetLiftingBill.setShift(shift);
-		billetLiftingBill.setVehicleNumber(jsonObject.getString("vehicleNumber"));
-		billetLiftingBill.setLocation(location);
-		billetLiftingBill.setAddress(address);
-		billetLiftingBill.setLiftingType("1");
-		billetLiftingBill.setBelongType("1");
-		billetLiftingBill.setDestination(destination);
-		billetLiftingBill.setLayer(layer);
-		billetLiftingBill.setPositionNum(Integer.valueOf(positionNum));
-		billetLiftingBill.setPlateOrStack(plateOrStack);
-		if (oConvertUtils.isNotEmpty(liftingTime)){
-			billetLiftingBill.setLiftingTime(DateUtils.str2Date(liftingTime, DateUtils.datetimeFormat.get()));
-		}
-		billetLiftingBill.setRemark("热装吊运单");
-		billetLiftingBill.setBilletWeight(0.00);
-		log.info("C端自动化热装——吊运单信息: {}", JSON.toJSON(billetLiftingBill));
-		saveBilletLiftingBillsHotCharge(billetLiftingBill);
-		log.info("C端自动化热装保存吊运单成功: {}", billetLiftingBill.getBilletsNo());
 		// 根据坯号查询 对应的钢坯基础信息
 		String[] billetNosparts = billetNos.split(",");
 		//4 获取所有的坯号集合
@@ -445,7 +449,6 @@ public class BilletHotsendBaseServiceImpl extends ServiceImpl<BilletHotsendBaseM
 			billetHotsendDetailsVo.setBelongTypeName(billetHotsendTypeConfig.getTypeName());
 			billetHotsendDetailsVo.setBilletHotsendTypeConfigId(billetHotsendTypeConfig.getId());
 		}
-		log.info("555自动化热装数据组装: {}", billetHotsendDetailsVo.getBilletHotsendTypeConfigId());
 		List<RollClubCommon> rollClubCommonLists= new ArrayList<>();
 		AtomicInteger startNum = new AtomicInteger(0);
 		String finalCcmNo = ccmNo;

+ 47 - 13
zgzt-sys-java/jeecg-module-conn/src/main/java/org/jeecg/modules/stackingAndLoadingVehicles/service/impl/StackingAndLoadingVehiclesServiceImpl.java

@@ -319,8 +319,8 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
         String positionNum = jsonObject.getString("positionNum");// 车位号
         String layer = jsonObject.getString("layer");
         String address = jsonObject.getString("address");
-        if (oConvertUtils.isEmpty(ccmNo) || oConvertUtils.isEmpty(positionNum) || oConvertUtils.isEmpty(layer) || oConvertUtils.isEmpty(address) ){
-            log.info("{}{}", "参数为空,C端自动化新增堆垛失败!", jsonObject.toJSONString());
+        if (oConvertUtils.isEmpty(ccmNo) || oConvertUtils.isEmpty(positionNum) || oConvertUtils.isEmpty(layer) || oConvertUtils.isEmpty(address) || oConvertUtils.isEmpty(billetHotsendTypeConfigId)){
+            log.info("{}{}", "参数为空,C端自动化垛位装车失败!", jsonObject.toJSONString());
             return;
         }
 
@@ -391,17 +391,50 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
 
         // 2025 3.3,C端自动化推送保存、B端手动发车临时方案,
         LambdaQueryWrapper<StorageBill> queryWrapper2 = new LambdaQueryWrapper<>();
-        queryWrapper2.eq(StorageBill::getCcmNo, ccmNo)
-                .eq(StorageBill::getPositionNum, Integer.valueOf(positionNum))
+        queryWrapper2.eq(StorageBill::getPositionNum, Integer.valueOf(positionNum))
                 .isNull(StorageBill::getOutTime);
+        // 2号车位不验证铸机号
+        if (!positionNum.equals("2")) {
+            queryWrapper2.eq(StorageBill::getCcmNo, ccmNo);
+        }
         StorageBill isStorageBill = storageBillService.getOne(queryWrapper2);
         if (oConvertUtils.isEmpty(isStorageBill)) {
-            log.info("未查询到钢坯装运单信息,车位号为:{},C端自动化垛位装车保存失败!", positionNum);
+            log.info("钢坯装运单不存在,车位号为:{},C端自动化垛位装车保存失败!", positionNum);
             return;
         }
+        // 截取钢坯的第九位字符,为最终铸机号
+        ccmNo = Optional.ofNullable(allBilletNos)
+                .filter(s -> !s.isEmpty())
+                .map(s -> s.split(","))
+                .filter(arr -> arr.length > 0)
+                .map(arr -> arr[0])
+                .filter(num -> num.length() >= 9)
+                .map(num -> String.valueOf(num.charAt(8)))
+                .orElse("");
+        log.info("C端自动化垛位装车,钢坯中截取的铸机号:{}", ccmNo);
+        String shiftGroup = shiftGroupHandle(ccmNo);
+        String shift = shiftHandle(ccmNo);
+        log.info("C端自动化垛位装车缓存中的班组、班别:{}", shiftGroup + ":" + shift);
+        if (oConvertUtils.isEmpty(shiftGroup) || oConvertUtils.isEmpty(shift)){
+            log.info("{}{}", "班组班别获取为空,C端自动化垛位装车<保存>失败!", JSON.toJSON(isStorageBill));
+            return;
+        }
+        // 更新装运单铸机号、班别、班组
+        if ("0".equals(isStorageBill.getCcmNo())) {
+            // 更新铸机号,到装运单
+            isStorageBill.setCcmNo(ccmNo);
+            isStorageBill.setShiftGroup(shiftGroup);
+            isStorageBill.setShift(shift);
+            storageBillService.updateById(isStorageBill);
+        }else {
+            if (!isStorageBill.getCcmNo().equals(ccmNo)){
+                log.info("{}{}", ",铸机号与钢坯不一致,C端自动化垛位装车<保存>失败!", JSON.toJSON(isStorageBill));
+                return;
+            }
+        }
         loadingParams.setStorageBill(isStorageBill);
 
-        log.info("{}{}", "自动化堆垛装车保存StorageBill数据:", JSON.toJSON(isStorageBill));
+        log.info("{}{}", "自动化堆垛装车,装运单信息:", JSON.toJSON(isStorageBill));
 
         StorageBill storageBill = loadingParams.getStorageBill();
 
@@ -420,13 +453,14 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
         }
 
         // 棒线公共属性信息
-        List<RollClubCommon> rollClubCommonList= new ArrayList<>();
-        billetBasicInfoList.forEach(x ->{
-            RollClubCommon rollClubCommon = new RollClubCommon();
-            BeanUtils.copyProperties(x, rollClubCommon);
-            rollClubCommon.setCcmNo(x.getCcmNo().toString());
-            rollClubCommonList.add(rollClubCommon);
-        });
+        String finalCcmNo = ccmNo;
+        List<RollClubCommon> rollClubCommonList = billetBasicInfoList.stream()
+                .map(info -> {
+                    RollClubCommon rollClubCommon = new RollClubCommon();
+                    BeanUtils.copyProperties(info, rollClubCommon);
+                    rollClubCommon.setCcmNo(finalCcmNo);
+                    return rollClubCommon;
+                }).collect(Collectors.toList());
 
         // 轧钢外运保存时,先判断装运单中的目的地ID是否为1024,如果为1024、明细暂存临时表billet_auto_tmp
         if ("1024".equals(isStorageBill.getTypeConfigId())){