qiangxuan преди 1 месец
родител
ревизия
5e32af4701

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

@@ -493,18 +493,21 @@ public class StorageBillController extends JeecgController<StorageBill, IStorage
 				old.setAmountTotal(originalAmountTotal);
 				JSONObject jsonObject = storageBillService.billetAutoTmpDataSyn(old);
 				log.info("钢坯装运单编辑,未知目的地数据同步结果:{}", jsonObject);
-				if (jsonObject.getBoolean("success")){
+				if (jsonObject.containsKey("success")){
 					return Result.OK("装运单编辑成功!");
 				} else {
-					return Result.error("装运单编辑失败!");
+					String errorMessage = jsonObject.getString("fail");
+					log.error("钢坯装运单编辑失败: {}", errorMessage);
+					// 手动标记事务回滚
+					TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+					return Result.error(errorMessage);
 				}
 			} catch (Exception e) {
-				// 更新 typeConfigId 和 destination
-				old.setTypeConfigId(storageBill.getTypeConfigId());
-				old.setDestination(storageBill.getDestination());
-				storageBillService.updateById(old);
-				log.info("装运单同步发生异常,已更新目的地:", e);
-				return Result.OK("装运单同步异常,编辑成功!");
+				// 记录详细的异常信息
+				log.error("钢坯装运单编辑,未知目的地数据同步发生异常", e);
+				// 手动标记事务回滚
+				TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+				return Result.error("钢坯装运单编辑,未知目的地数据同步发生异常:" + e.getMessage());
 			}
 		} else {
 			log.info("{}{}", "B端编辑钢坯装运单", old.getLicensePlate() + "===" + storageBill.getLicensePlate());
@@ -522,7 +525,7 @@ public class StorageBillController extends JeecgController<StorageBill, IStorage
 			log.info("{}{}", "B端编辑钢坯装运单对象", JSON.toJSON(storageBill));
 			storageBillService.updateById(storageBill);
 		}
-		operateLogService.add(old,storageBill,StorageBill.class);
+		operateLogService.add(old, storageBill, StorageBill.class);
 		return Result.OK("装运单编辑成功!");
 	}
 	
@@ -1750,18 +1753,24 @@ public class StorageBillController extends JeecgController<StorageBill, IStorage
 				bill.setTypeConfigId(storageBill.getTypeConfigId());
 				JSONObject jsonObject = storageBillService.billetAutoTmpDataSynConfirm(bill);
 				log.info("{}{}", "看板确认目的地数据同步结果:", jsonObject);
-				if (jsonObject.getBoolean("success")) {
-					return Result.OK("看板确认目的地成功!");
+				if (jsonObject.containsKey("success")){
+					return Result.OK("确认目的地成功!");
 				} else {
-					return Result.error("看板确认目的地失败!");
+					String errorMessage = jsonObject.getString("fail");
+					log.error("确认目的地编辑失败: {}", errorMessage);
+					// 手动标记事务回滚
+					TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+					return Result.error(errorMessage);
 				}
 			} catch (Exception e) {
 				// 更新typeConfigId和destination
-				bill.setTypeConfigId(storageBill.getTypeConfigId());
-				bill.setDestination(storageBill.getDestination());
-				storageBillService.getBaseMapper().updateById(bill);
+//				bill.setTypeConfigId(storageBill.getTypeConfigId());
+//				bill.setDestination(storageBill.getDestination());
+//				storageBillService.getBaseMapper().updateById(bill);
 				log.error("B端监控看板确认目的地,同步发生异常", e.getMessage());
-				return Result.OK("看板确认目的地成功!");
+				// 手动标记事务回滚
+				TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+				return Result.error("看板确认目的地发生异常:" + e.getMessage());
 			}
 		}else {
 			log.info("{}{}", "看板确认目的地参数有误:", JSON.toJSON(storageBill));

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

@@ -2758,7 +2758,7 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
                     .eq(BilletAutoTmp::getStorageBillId, storageBill.getId()));
             if (oConvertUtils.listIsEmpty(billetAutoTmpList)){
                 baseMapper.updateById(storageBill);
-                result.put("fail", "编辑装运单未知目的地明细不存在,更新目的地成功!");
+                result.put("success", "装运单临时表明细不存在,编辑目的地成功!");
                 return result;
             }
 
@@ -2827,7 +2827,7 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
                     JSONObject jsonObject = commonBilletHotsenAndDetailsHandle(billetHotsend, billetHotsendDetailsVo, billetHotsendTypeConfig, storageBill, groupRollClubCommonList, null);
                     if (jsonObject.containsKey("fail")) {
                         log.info("{}{}", "编辑装运单,未知目的地数据同步操作失败,事务回滚!", jsonObject);
-                        result.put("fail", "编辑装运单,未知目的地数据同步操作失败!");
+                        result.put("fail", "炉次传递单不存在,编辑失败!");
                         // 手动回滚事务
                         TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
                         return result;
@@ -2901,7 +2901,7 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
                     BilletHotsend idExistBh = billetHotsendBaseMapper.selectOne(queryWrapper);
                     if (oConvertUtils.isEmpty(idExistBh)){
                         log.info("{}{}", "编辑装运单,钢坯热送单为空,堆垛数据同步失败:", JSON.toJSON(billetHotsend));
-                        result.put("fail", "编辑装运单,钢坯热送单为空,堆垛数据同步操作失败!");
+                        result.put("fail", "炉次传递单不存在,编辑失败!");
                         // 手动回滚事务
                         TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
                         return result;
@@ -2935,7 +2935,7 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
                 billetBasicInfoStackList = billetBasicInfoService.list(queryWrapperls);
                 if (oConvertUtils.listIsEmpty(billetBasicInfoStackList)) {
                     log.info("编辑装运单,钢坯基础信息为空,堆垛数据同步失败!");
-                    result.put("fail", "编辑装运单,钢坯基础信息为空,堆垛数据同步失败!");
+                    result.put("fail", "钢坯实绩不存在,编辑失败!");
                     // 手动回滚事务
                     TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
                     return result;
@@ -3113,7 +3113,7 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
                     JSONObject jsonObject = commonBilletHotsenAndDetailsHandle(billetHotsend, billetHotsendDetailsVo, billetHotsendTypeConfig, storageBill, groupRollClubCommonList, null);
                     if (jsonObject.containsKey("fail")) {
                         log.info("{}{}", "监控看板确认目的地,未知目的地数据同步操作失败,事务回滚!", jsonObject);
-                        result.put("fail", "监控看板确认目的地,未知目的地数据同步操作失败!");
+                        result.put("fail", "炉次传递单不存在,编辑失败!");
                         TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
                         return result;
                     }
@@ -3187,7 +3187,7 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
                     BilletHotsend idExistBh = billetHotsendBaseMapper.selectOne(queryWrapper);
                     if (oConvertUtils.isEmpty(idExistBh)){
                         log.info("{}{}", "监控看板确认目的地,钢坯热送单为空,堆垛数据同步失败:", JSON.toJSON(billetHotsend));
-                        result.put("fail", "监控看板确认目的地,钢坯热送单为空,堆垛数据同步操作失败!");
+                        result.put("fail", "炉次传递单不存在,编辑失败!");
                         TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
                         return result;
                     }
@@ -3220,7 +3220,7 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
                 billetBasicInfoStackList = billetBasicInfoService.list(queryWrapperls);
                 if (oConvertUtils.listIsEmpty(billetBasicInfoStackList)) {
                     log.info("{}{}", "监控看板确认目的地,钢坯基础信息为空,堆垛数据同步失败:", billetNosList);
-                    result.put("fail", "监控看板确认目的地,钢坯基础信息为空,堆垛数据同步失败!");
+                    result.put("fail", "钢坯实绩不存在,编辑失败!");
                     TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
                     return result;
                 }