1. 导入excel修改规则,不符合条件的数据行直接返回错误。

This commit is contained in:
梁州 2025-04-16 08:47:37 +08:00
parent e9af1f12fe
commit 93731b685e

View File

@ -90,7 +90,7 @@ public class ImportExcelEasyPoi extends BaseImportExcelEasyPoi implements IImpor
|| dbsRawData.getPlanProduction() == null || dbsRawData.getPlanProduction() == null
|| StringUtils.isEmpty(dbsRawData.getFamily()) || StringUtils.isEmpty(dbsRawData.getFamily())
|| StringUtils.isEmpty(dbsRawData.getTestNo())) { || StringUtils.isEmpty(dbsRawData.getTestNo())) {
continue; return BaseWmsApiResponse.error("存在信息不全的数据行。");
} }
if (dbsRawData.getFamily().contains("NGH")) { if (dbsRawData.getFamily().contains("NGH")) {
// 去除J列的NGH // 去除J列的NGH
@ -131,7 +131,8 @@ public class ImportExcelEasyPoi extends BaseImportExcelEasyPoi implements IImpor
tAppDbsService.saveBatch(newDbsMapToSave.values()); tAppDbsService.saveBatch(newDbsMapToSave.values());
// 保存导入file记录 // 保存导入file记录
saveFileVo(fileVo); saveFileVo(fileVo);
return BaseWmsApiResponse.success("导入计划成功。"); return BaseWmsApiResponse.success("导入计划成功。\n非NGH" + dbsList.size() + "条,成功:" + newDbsMapToSave.size()
+ "条。");
} catch (Exception e) { } catch (Exception e) {
// 回滚事务 // 回滚事务
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
@ -168,10 +169,10 @@ public class ImportExcelEasyPoi extends BaseImportExcelEasyPoi implements IImpor
|| StringUtils.isEmpty(productRawData.getGoodsId()) || StringUtils.isEmpty(productRawData.getGoodsId())
|| productRawData.getQuantityOfPairs() == null || productRawData.getQuantityOfPairs() == null
|| StringUtils.isEmpty(productRawData.getBoxNo())) { || StringUtils.isEmpty(productRawData.getBoxNo())) {
continue; return BaseWmsApiResponse.error("存在信息不全的数据行。");
} }
if (StringUtils.isNotEmpty(thisProductId) && !thisProductId.equals(productRawData.getProductId())) { if (StringUtils.isNotEmpty(thisProductId) && !thisProductId.equals(productRawData.getProductId())) {
continue; return BaseWmsApiResponse.error("存在多个成品号。");
} else { } else {
thisProductId = productRawData.getProductId(); thisProductId = productRawData.getProductId();
} }
@ -247,10 +248,10 @@ public class ImportExcelEasyPoi extends BaseImportExcelEasyPoi implements IImpor
|| StringUtils.isEmpty(productRawData.getGoodsId()) || StringUtils.isEmpty(productRawData.getGoodsId())
|| productRawData.getQuantityOfPairs() == null || productRawData.getQuantityOfPairs() == null
|| StringUtils.isEmpty(productRawData.getBoxNo())) { || StringUtils.isEmpty(productRawData.getBoxNo())) {
continue; return BaseWmsApiResponse.error("存在信息不全的数据行。");
} }
if (StringUtils.isNotEmpty(thisProductId) && !thisProductId.equals(productRawData.getSingleProductId())) { if (StringUtils.isNotEmpty(thisProductId) && !thisProductId.equals(productRawData.getSingleProductId())) {
continue; return BaseWmsApiResponse.error("存在多个服务件成品号。");
} else { } else {
thisProductId = productRawData.getSingleProductId(); thisProductId = productRawData.getSingleProductId();
} }