|
|
@@ -461,7 +461,7 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
batchList.add(aBatch);
|
|
|
total++;
|
|
|
}
|
|
|
- int success = goodsFillDataToExcel(batchList);
|
|
|
+ int success = goodsFillDataToExcelAndUpdate(batchList);
|
|
|
Long userUU = SystemSession.getUser().getUserUU();
|
|
|
// Long enUU = SystemSession.getUser().getEnterprise().getUu();
|
|
|
// resetRepeatData(batchList, true, false);
|
|
|
@@ -480,7 +480,7 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
* 根据批次号设置需要被修改的信息
|
|
|
* @param batchList
|
|
|
*/
|
|
|
- private Integer goodsFillDataToExcel(List<ReleaseProductByBatch> batchList) {
|
|
|
+ private Integer goodsFillDataToExcelAndUpdate(List<ReleaseProductByBatch> batchList) {
|
|
|
int result = 0;
|
|
|
if (CollectionUtils.isEmpty(batchList)) {
|
|
|
return result;
|
|
|
@@ -496,8 +496,10 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
if (CollectionUtils.isNotEmpty(batchCodes)) {
|
|
|
goodses = goodsService.findGoodsByBatchCodes(batchCodes);
|
|
|
}
|
|
|
- for (Goods goods : goodses) {
|
|
|
- for (ReleaseProductByBatch aBatch : batchList) {
|
|
|
+ Goods newGoods = null;
|
|
|
+ for (ReleaseProductByBatch aBatch : batchList) {
|
|
|
+ newGoods = null;
|
|
|
+ for (Goods goods : goodses) {
|
|
|
if (goods.getBatchCode().equals(aBatch.getBatchCode())) {
|
|
|
aBatch.setB2cBranden(goods.getBrandNameEn());
|
|
|
aBatch.setBrandNameEn(goods.getBrandNameEn());
|
|
|
@@ -510,30 +512,34 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
aBatch.setReleaseStatus(ReleaseStatus.failure.getPhrase());
|
|
|
}
|
|
|
fillInGoods(goods, aBatch);
|
|
|
- ResultMap resultMap = goodsService.updateGoods(goods);
|
|
|
- if (resultMap.isSuccess()) {
|
|
|
- Goods goods1 = (Goods) resultMap.getData();
|
|
|
- if (Status.REMOVED.value() == aBatch.getStatus() && Status.REMOVED.value() != goods1.getStatus()) {
|
|
|
- ResultMap offMap = goodsService.offShelfGoodsByProvider(goods.getBatchCode(), null, false);
|
|
|
- if (offMap.isSuccess()) {
|
|
|
- result++;
|
|
|
- } else {
|
|
|
- aBatch.setErrmsg(offMap.getMessage());
|
|
|
- aBatch.setReleaseCode(ReleaseStatus.lack_info.value());
|
|
|
- aBatch.setReleaseStatus(ReleaseStatus.lack_info.getPhrase());
|
|
|
- }
|
|
|
- } else {
|
|
|
- result++;
|
|
|
- }
|
|
|
+ newGoods = goods;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (newGoods == null) {
|
|
|
+ newGoods = aBatch.releaseProductByBatchConvertToGoods(aBatch);
|
|
|
+ }
|
|
|
+ ResultMap resultMap = goodsService.updateGoods(newGoods);
|
|
|
+ if (resultMap.isSuccess()) {
|
|
|
+ Goods goods1 = (Goods) resultMap.getData();
|
|
|
+ if (Status.REMOVED.value() == aBatch.getStatus() && Status.REMOVED.value() != goods1.getStatus()) {
|
|
|
+ ResultMap offMap = goodsService.offShelfGoodsByProvider(newGoods.getBatchCode(), null, false);
|
|
|
+ if (offMap.isSuccess()) {
|
|
|
+ result++;
|
|
|
} else {
|
|
|
- aBatch.setErrmsg(resultMap.getMessage());
|
|
|
+ aBatch.setErrmsg(offMap.getMessage());
|
|
|
aBatch.setReleaseCode(ReleaseStatus.lack_info.value());
|
|
|
aBatch.setReleaseStatus(ReleaseStatus.lack_info.getPhrase());
|
|
|
}
|
|
|
+ } else {
|
|
|
+ result++;
|
|
|
}
|
|
|
+ } else {
|
|
|
+ aBatch.setErrmsg(resultMap.getMessage());
|
|
|
+ aBatch.setReleaseCode(ReleaseStatus.lack_info.value());
|
|
|
+ aBatch.setReleaseStatus(ReleaseStatus.lack_info.getPhrase());
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
@@ -589,7 +595,27 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
continue;
|
|
|
}
|
|
|
Goods goods = goodsDao.findByBatchCode(aBatch.getBatchCode());
|
|
|
-
|
|
|
+ fillInGoods(goods, aBatch);
|
|
|
+ ResultMap resultMap = goodsService.updateGoods(goods);
|
|
|
+ if (resultMap.isSuccess()) {
|
|
|
+ Goods goods1 = (Goods) resultMap.getData();
|
|
|
+ if (Status.REMOVED.value() == aBatch.getStatus() && Status.REMOVED.value() != goods1.getStatus()) {
|
|
|
+ ResultMap offMap = goodsService.offShelfGoodsByProvider(goods.getBatchCode(), null, false);
|
|
|
+ if (offMap.isSuccess()) {
|
|
|
+ result++;
|
|
|
+ } else {
|
|
|
+ aBatch.setErrmsg(offMap.getMessage());
|
|
|
+ aBatch.setReleaseCode(ReleaseStatus.lack_info.value());
|
|
|
+ aBatch.setReleaseStatus(ReleaseStatus.lack_info.getPhrase());
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ result++;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ aBatch.setErrmsg(resultMap.getMessage());
|
|
|
+ aBatch.setReleaseCode(ReleaseStatus.lack_info.value());
|
|
|
+ aBatch.setReleaseStatus(ReleaseStatus.lack_info.getPhrase());
|
|
|
+ }
|
|
|
}
|
|
|
return result;
|
|
|
}
|