|
|
@@ -131,7 +131,6 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
selfSale = false;
|
|
|
}
|
|
|
ModelMap modelMap = new ModelMap();
|
|
|
- Set<ReleaseProductByBatch> releaseProductByBatchs = new HashSet<>();
|
|
|
// 获取第一个工作表
|
|
|
Sheet sheet = workbook.getSheetAt(0);
|
|
|
int colNum = sheet.getRow(0).getPhysicalNumberOfCells();
|
|
|
@@ -149,6 +148,7 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
throw new IllegalOperatorException
|
|
|
("您上传的信息超过2000条,请拆分成2000以再在上传");
|
|
|
}
|
|
|
+ List<ReleaseProductByBatch> releaseProductByBatchs = new ArrayList<>(rowNum);
|
|
|
String batch = createNumberService.getTimeNumber("product$goods", 8, rowNum);
|
|
|
StoreIn storeIn = getStoreInfo(selfSale);
|
|
|
Row headerRow = sheet.getRow(0);
|
|
|
@@ -191,6 +191,7 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
releaseProductByBatch.setTag(null);
|
|
|
}
|
|
|
}
|
|
|
+ validateRepeatInExcel(releaseProductByBatchs, releaseProductByBatch);
|
|
|
}
|
|
|
// 简单验证数据,防止空行保存的情况
|
|
|
if (blankNum != 3) {
|
|
|
@@ -200,12 +201,10 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- List<ReleaseProductByBatch> addList = new ArrayList<>(releaseProductByBatchs.size());
|
|
|
- addList.addAll(releaseProductByBatchs);
|
|
|
if (!isAPerson) {
|
|
|
- resetRepeatData(addList);
|
|
|
+ resetRepeatData(releaseProductByBatchs);
|
|
|
}
|
|
|
- commonDao.save(addList, ReleaseProductByBatch.class);
|
|
|
+ commonDao.save(releaseProductByBatchs, ReleaseProductByBatch.class);
|
|
|
Long userUU = SystemSession.getUser().getUserUU();
|
|
|
Long enUU = SystemSession.getUser().getEnterprise().getUu();
|
|
|
releaseProductByBatchDao.callValidProcedure(enUU, batch);
|
|
|
@@ -220,6 +219,19 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
return modelMap;
|
|
|
}
|
|
|
|
|
|
+ private void validateRepeatInExcel(List<ReleaseProductByBatch> batchList, ReleaseProductByBatch aBatch) {
|
|
|
+ if (CollectionUtils.isEmpty(batchList) || !StringUtils.isEmpty(aBatch.getErrmsg()))
|
|
|
+ return ;
|
|
|
+ for (ReleaseProductByBatch each : batchList) {
|
|
|
+ if (StringUtils.isEmpty(each) && each.equals(aBatch)) {
|
|
|
+ aBatch.setErrmsg(ErrorInfoConstant.REPEAT_IN_EXCEL.getInfo());
|
|
|
+ aBatch.setReleaseCode(ReleaseStatus.had_exists.value());
|
|
|
+ aBatch.setReleaseStatus(ReleaseStatus.had_exists.getPhrase());
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 判断是否重复,重复则重设状态
|
|
|
* @param data
|
|
|
@@ -257,7 +269,7 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
* @param aProduct 单个产品
|
|
|
* @param productSet 产品列表
|
|
|
*/
|
|
|
- private Boolean validateTagInfo(ReleaseProductByBatch aProduct, Set<ReleaseProductByBatch> productSet) {
|
|
|
+ private Boolean validateTagInfo(ReleaseProductByBatch aProduct, List<ReleaseProductByBatch> productSet) {
|
|
|
for (ReleaseProductByBatch each : productSet) {
|
|
|
if (aProduct.getBrandNameEn().equals(each.getBrandNameEn()) && aProduct.getCode().equals(each.getCode())
|
|
|
&& aProduct.getTag().equals(each.getTag())) {
|