Переглянути джерело

2号车位热装逻辑调整

qiangxuan 1 місяць тому
батько
коміт
fbaf80f999

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

@@ -237,7 +237,20 @@ public class BilletHotsendBaseServiceImpl extends ServiceImpl<BilletHotsendBaseM
 		saveBilletRodLineCommom(billetHotsendDetailsVo);
 		log.info("C端自动化操作结果,{}新增成功:{}", operationMsg, billetNos);
 	}
-
+	public static void main(String[] args) {
+		String billetNos = "255061616805,255061615705,255061615606,255061575804";
+
+		String ninthCharStr = Optional.ofNullable(billetNos)
+				.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(""); // 默认返回空字符串或其他默认值
+
+		System.out.println("第一个坯号的第9位字符是:" + ninthCharStr);
+	}
 	/**
 	 * 5、6号机  轧钢外运
 	 * 去上若  车牌为陕E开头
@@ -253,7 +266,6 @@ public class BilletHotsendBaseServiceImpl extends ServiceImpl<BilletHotsendBaseM
 
 		String ccmNo = jsonObject.getString("ccmNo");
 		String billetNos = jsonObject.getString("billetNos");
-//		String billetHotsendTypeConfigId = jsonObject.getString("billetHotsendTypeConfigId");
 		String licensePlate = jsonObject.getString("licensePlate");
 		String destination = jsonObject.getString("destination");
 		String positionNum = jsonObject.getString("positionNum");
@@ -280,6 +292,18 @@ public class BilletHotsendBaseServiceImpl extends ServiceImpl<BilletHotsendBaseM
 		// 更具装运单确认铸机号
 		if (oConvertUtils.isNotEmpty(isStorageBill) && oConvertUtils.isNotEmpty(isStorageBill.getCcmNo())) {
 			ccmNo = isStorageBill.getCcmNo();
+		}else {
+			ccmNo = Optional.ofNullable(billetNos)
+					.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("");
+			// 更新铸机号,到装运单
+			isStorageBill.setCcmNo(ccmNo);
+			storageBillService.updateById(isStorageBill);
 		}
 
 		String shiftGroup = shiftGroupHandle(ccmNo);
@@ -346,11 +370,6 @@ public class BilletHotsendBaseServiceImpl extends ServiceImpl<BilletHotsendBaseM
 		}
 		if (oConvertUtils.listIsEmpty(billetBasicInfoLists)){
 			log.info("{}{}", "钢坯基础信息不存在,C端自动化热装<保存>失败!", jsonObject);
-			//4 获取所有的坯号集合
-			LambdaQueryWrapper<BilletBasicInfo> queryWrapperTest = new LambdaQueryWrapper<>();
-			queryWrapper1.in(BilletBasicInfo::getBilletNo, Arrays.asList(billetNosparts));
-			List<BilletBasicInfo> billetBasicInfoListsTest = billetBasicInfoService.list(queryWrapper1);
-			log.info("{}{}", ">>>>>>>C端自动化热装钢坯实绩信息:", JSON.toJSON(billetBasicInfoListsTest));
 			BilletAutoException billetAutoException = createBilletAutoException(ccmNo, billetNos, shiftGroupHandle(ccmNo), shiftHandle(ccmNo), null);
 			billetAutoException.setMassage("钢坯基础信息不存在,自动化热装<保存>失败!");
 			billetAutoExceptionService.save(billetAutoException);
@@ -367,9 +386,10 @@ public class BilletHotsendBaseServiceImpl extends ServiceImpl<BilletHotsendBaseM
 			billetLiftingBillUpdate.setAssemblyNumber(getAssemblyNumber(billetBasicInfoLists));
 			billetLiftingBillService.updateById(billetLiftingBillUpdate);
 		}
-		// 验证空的装运单
-		if (oConvertUtils.isEmpty(isStorageBill)) {
-			// 循环三次处理
+		// 查询更新后的装运单信息
+		StorageBill storageBill = storageBillService.getById(isStorageBill.getId());
+		if (oConvertUtils.isEmpty(storageBill)) {
+			//  验证空的装运单 循环三次处理
 			for (int i = 0; i < 6; i++) {
 				// 延迟10秒
 				try {
@@ -377,14 +397,14 @@ public class BilletHotsendBaseServiceImpl extends ServiceImpl<BilletHotsendBaseM
 				} catch (InterruptedException e) {
 					e.printStackTrace();
 				}
-				isStorageBill = storageBillService.getOne(queryWrapper2);
-				if (!oConvertUtils.isEmpty(isStorageBill)){
+				storageBill = storageBillService.getById(isStorageBill.getId());
+				if (!oConvertUtils.isEmpty(storageBill)){
 					break;
 				}
 			}
 		}
 		// 钢坯装运单
-		if (oConvertUtils.isEmpty(isStorageBill)) {
+		if (oConvertUtils.isEmpty(storageBill)) {
 			log.info("未查询钢坯装运单信息,车位号为:{},C端自动化热装<保存>失败!", positionNum);
 			BilletAutoException billetAutoException = new BilletAutoException();
 			billetAutoException.setId(String.valueOf(IdWorker.getId()));
@@ -398,9 +418,9 @@ public class BilletHotsendBaseServiceImpl extends ServiceImpl<BilletHotsendBaseM
 			billetAutoExceptionService.save(billetAutoException);
 			return;
 		}
-		billetHotsendDetailsVo.setStorageBill(isStorageBill);
+		billetHotsendDetailsVo.setStorageBill(storageBill);
 		// 轧钢外运保存时,先判断装运单中的目的地ID是否为1024,如果为1024、明细暂存临时表billet_auto_tmp
-		if ("1024".equals(isStorageBill.getTypeConfigId())){
+		if ("1024".equals(storageBill.getTypeConfigId())){
 			log.info("{}{}", "C端自动化热装未知目的地,坯号集:", JSON.toJSON(billetNosparts));
 			billetHotsendDetailsVo.setBelongTable("billet_auto_tmp");
 			billetHotsendDetailsVo.setBilletHotsendTypeConfigId("1024");