|
|
@@ -123,13 +123,17 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
* @author hejq
|
|
|
*/
|
|
|
@Override
|
|
|
- public ModelMap releaseByWorkbook(Workbook workbook, Boolean selfSale, String currency, Integer isPerson) {
|
|
|
+ public ModelMap releaseByWorkbook(Workbook workbook, Boolean selfSale, String currency, Integer isPerson, Integer repeatImport) {
|
|
|
// 是否上传个人物料
|
|
|
boolean isAPerson = false;
|
|
|
+ boolean isImport = false;
|
|
|
if (null != isPerson && isPerson.intValue() == IntegerConstant.YES_SHORT.intValue()) {
|
|
|
isAPerson = true;
|
|
|
selfSale = false;
|
|
|
}
|
|
|
+ if (null != repeatImport && IntegerConstant.YES_SHORT.equals(repeatImport)) {
|
|
|
+ isImport = true;
|
|
|
+ }
|
|
|
ModelMap modelMap = new ModelMap();
|
|
|
// 获取第一个工作表
|
|
|
Sheet sheet = workbook.getSheetAt(0);
|
|
|
@@ -202,7 +206,7 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
}
|
|
|
}
|
|
|
if (!isAPerson) {
|
|
|
- resetRepeatData(releaseProductByBatchs);
|
|
|
+ resetRepeatData(releaseProductByBatchs, isImport);
|
|
|
}
|
|
|
commonDao.save(releaseProductByBatchs, ReleaseProductByBatch.class);
|
|
|
Long userUU = SystemSession.getUser().getUserUU();
|
|
|
@@ -234,14 +238,18 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
|
|
|
/**
|
|
|
* 判断是否重复,重复则重设状态
|
|
|
- * @param data
|
|
|
+ * @param data
|
|
|
+ * @param isImport
|
|
|
*/
|
|
|
- private void resetRepeatData(List<ReleaseProductByBatch> data) {
|
|
|
+ private void resetRepeatData(List<ReleaseProductByBatch> data, Boolean isImport) {
|
|
|
Long enuu = SystemSession.getUser().getEnterprise() != null ? SystemSession.getUser().getEnterprise().getUu() : null;
|
|
|
if (enuu == null) {
|
|
|
throw new IllegalOperatorException("企业enuu丢失");
|
|
|
}
|
|
|
for (ReleaseProductByBatch each : data) {
|
|
|
+ if (StringUtils.hasText(each.getErrmsg())) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
List<Product> standardList = productDao.findMatchStandard(enuu, each.getBrandNameEn(), each.getCode(), IntegerConstant.YES_SHORT);
|
|
|
if (!CollectionUtils.isEmpty(standardList)) {
|
|
|
each.setB2cBranden(standardList.get(0).getPbranden());
|
|
|
@@ -250,6 +258,12 @@ 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)) {
|
|
|
for (Goods goods1 : goodsList) {
|
|
|
if (GoodsUtil.compareWithQtyPrice(each.getPrices(), goods1.getPrices(), each.getCurrency())) {
|