|
|
@@ -195,7 +195,7 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
releaseProductByBatch.setTag(null);
|
|
|
}
|
|
|
}
|
|
|
- validateRepeatInExcel(releaseProductByBatchs, releaseProductByBatch);
|
|
|
+ validateRepeatInExcel(releaseProductByBatchs, releaseProductByBatch, isImport);
|
|
|
}
|
|
|
// 简单验证数据,防止空行保存的情况
|
|
|
if (blankNum != 3) {
|
|
|
@@ -223,15 +223,31 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
return modelMap;
|
|
|
}
|
|
|
|
|
|
- private void validateRepeatInExcel(List<ReleaseProductByBatch> batchList, ReleaseProductByBatch aBatch) {
|
|
|
+ /**
|
|
|
+ * 验证Excel中数据是否重复
|
|
|
+ *
|
|
|
+ * @param batchList
|
|
|
+ * @param aBatch
|
|
|
+ * @param isImport
|
|
|
+ */
|
|
|
+ private void validateRepeatInExcel(List<ReleaseProductByBatch> batchList, ReleaseProductByBatch aBatch, Boolean isImport) {
|
|
|
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;
|
|
|
+ if (StringUtils.isEmpty(each.getErrmsg()) && each.equals(aBatch)) {
|
|
|
+ if (!isImport) {
|
|
|
+ aBatch.setErrmsg(ErrorInfoConstant.REPEAT_IN_EXCEL.getInfo());
|
|
|
+ aBatch.setReleaseCode(ReleaseStatus.had_exists.value());
|
|
|
+ aBatch.setReleaseStatus(ReleaseStatus.had_exists.getPhrase());
|
|
|
+ break;
|
|
|
+ } else {
|
|
|
+ if (GoodsUtil.compareWithQtyPrice(each.getPrices(), aBatch.getPrices(), each.getCurrency())) {
|
|
|
+ aBatch.setErrmsg(ErrorInfoConstant.REPEAT_IN_EXCEL.getInfo());
|
|
|
+ aBatch.setReleaseCode(ReleaseStatus.had_exists.value());
|
|
|
+ aBatch.setReleaseStatus(ReleaseStatus.had_exists.getPhrase());
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -258,13 +274,13 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
List<Product> productList = productDao.findByEnUUAndPcmpcodeAndPbrandenAndB2cEnabled(enuu, each.getB2cCode(), each.getB2cBranden(), IntegerConstant.YES_SHORT);
|
|
|
if (!CollectionUtils.isEmpty(productList)) {
|
|
|
List<Goods> goodsList = goodsDao.findRepeatGoodsInProductId(productList.get(0).getId(), each.getProductDate(), each.getPackaging(), each.getMinPackage(), each.getMinBuyQty(), each.getSelfMaxDelivery(), each.getSelfMinDelivery(), each.getUnit());
|
|
|
- if (!isImport) {
|
|
|
- each.setErrmsg(ErrorInfoConstant.REPEAT_INFO.getInfo());
|
|
|
- each.setReleaseCode(ReleaseStatus.had_exists.value());
|
|
|
- each.setReleaseStatus(ReleaseStatus.had_exists.getPhrase());
|
|
|
- continue;
|
|
|
- }
|
|
|
if (!CollectionUtils.isEmpty(goodsList)) {
|
|
|
+ if (!isImport) {
|
|
|
+ each.setErrmsg(ErrorInfoConstant.REPEAT_INFO.getInfo());
|
|
|
+ each.setReleaseCode(ReleaseStatus.had_exists.value());
|
|
|
+ each.setReleaseStatus(ReleaseStatus.had_exists.getPhrase());
|
|
|
+ continue;
|
|
|
+ }
|
|
|
for (Goods goods1 : goodsList) {
|
|
|
if (GoodsUtil.compareWithQtyPrice(each.getPrices(), goods1.getPrices(), each.getCurrency())) {
|
|
|
each.setErrmsg(ErrorInfoConstant.REPEAT_INFO.getInfo());
|