Explorar o código

热装、垛位装车调整

qiangxuan hai 1 mes
pai
achega
30c91ebfec

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

@@ -285,6 +285,42 @@ 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)){
+			if (liftingTime.contains("T")){
+				billetLiftingBill.setLiftingTime(DateUtils.str2Date(liftingTime, DateUtils.datetime_T_format.get()));
+			}else {
+				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))
@@ -307,22 +343,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();
@@ -332,34 +366,7 @@ 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)){
-			if (liftingTime.contains("T")){
-				billetLiftingBill.setLiftingTime(DateUtils.str2Date(liftingTime, DateUtils.datetime_T_format.get()));
-			}else {
-				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 获取所有的坯号集合

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

@@ -77,6 +77,7 @@ import org.springframework.transaction.interceptor.TransactionAspectSupport;
 import java.util.*;
 import java.util.concurrent.CompletableFuture;
 import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
 import java.util.concurrent.atomic.AtomicLong;
 import java.util.stream.Collectors;
 
@@ -304,7 +305,7 @@ 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) ){
+        if (oConvertUtils.isEmpty(ccmNo) || oConvertUtils.isEmpty(positionNum) || oConvertUtils.isEmpty(layer) || oConvertUtils.isEmpty(address) || oConvertUtils.isEmpty(billetHotsendTypeConfigId)){
             log.info("{}{}", "参数为空,C端自动化新增堆垛失败!", jsonObject.toJSONString());
             return;
         }
@@ -380,14 +381,47 @@ 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("{}{}", "自动化堆垛装车,装运单信息:", JSON.toJSON(isStorageBill));
@@ -409,13 +443,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())){
@@ -428,7 +463,7 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
             queryWrapper3.eq(BilletHotsendTypeConfig::getCastMachine, ccmNo)
                     .eq(BilletHotsendTypeConfig::getTypeName, isStorageBill.getDestination());
             BilletHotsendTypeConfig billetHotsendTypeConfigInfo = billetHotsendTypeConfigService.getOne(queryWrapper3);
-            log.info("{}{}", "C端自动化堆垛外运查询到钢坯配置目的地信息:", JSON.toJSON(billetHotsendTypeConfigInfo));
+            log.info("{}{}", "C端自动化堆垛装车查询到钢坯配置目的地信息:", JSON.toJSON(billetHotsendTypeConfigInfo));
 
             loadingParams.setDestination(billetHotsendTypeConfigInfo.getTypeName());
             loadingParams.setDestinationId(billetHotsendTypeConfigInfo.getId());