|
|
@@ -142,6 +142,10 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
@Autowired
|
|
|
private CommodityInOutboundService commodityInOutboundService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private InOutboundDetailService inOutboundDetailService;
|
|
|
+
|
|
|
+
|
|
|
private final Logger logger = Logger.getLogger(getClass());
|
|
|
|
|
|
/**
|
|
|
@@ -257,8 +261,8 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
releaseProductByBatch.setReleaseCode(ReleaseStatus.lack_info.value());
|
|
|
releaseProductByBatch.setReleaseStatus(ReleaseStatus.lack_info.getPhrase());
|
|
|
}
|
|
|
- // 简单验证数据,防止空行保存的情况(品牌、类目、型号)
|
|
|
- if (blankNum != 3) {
|
|
|
+ // 简单验证数据,防止空行保存的情况(品牌、类目、型号、庫存信息)
|
|
|
+ if (blankNum != 4) {
|
|
|
total++;
|
|
|
releaseProductByBatchs.add(releaseProductByBatch);
|
|
|
}
|
|
|
@@ -297,7 +301,7 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
success = releaseProductByBatchDao.getCountPublisherUuAndBatchAndReleaseCode(userUU, batch, ReleaseStatus.success.value());
|
|
|
}
|
|
|
}
|
|
|
- if (!isAPerson) {
|
|
|
+ if (!isAPerson && !isPcb) {
|
|
|
String publish = publishByBatch(batch, isPcb, ignoreImport);
|
|
|
modelMap.put("publish", publish);
|
|
|
}
|
|
|
@@ -425,9 +429,6 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
Object skuObj = readWorkBookCell(row.getCell(ModifyConstant.SKU_CODE), Cell.CELL_TYPE_STRING,
|
|
|
r, ModifyConstant.SKU_CODE);
|
|
|
aBatch.setBatchCodeByExcel(skuObj);
|
|
|
- if (!validateBatchCode(aBatch.getBatchCode(), aBatch)) {
|
|
|
- aBatch.addErrmsg(ErrorInfoConstant.BATCH_ERROR.getInfo());
|
|
|
- }
|
|
|
|
|
|
Object sellObj = readWorkBookCell(row.getCell(ModifyConstant.SALE_METHOD), Cell.CELL_TYPE_STRING,
|
|
|
r, ModifyConstant.SALE_METHOD);
|
|
|
@@ -454,21 +455,21 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
aBatch.setReleaseStatus(ReleaseStatus.lack_info.getPhrase());
|
|
|
} else {
|
|
|
// 导入成功的需要判断自定义标签是否重复
|
|
|
- if (CollectionUtils.isNotEmpty(batchList) && aBatch.getTag() != null) {
|
|
|
- if (validateTagInfo(aBatch, batchList)) {
|
|
|
- aBatch.setTag(null);
|
|
|
- }
|
|
|
- }
|
|
|
+// if (CollectionUtils.isNotEmpty(batchList) && aBatch.getTag() != null) {
|
|
|
+// if (validateTagInfo(aBatch, batchList)) {
|
|
|
+// aBatch.setTag(null);
|
|
|
+// }
|
|
|
+// }
|
|
|
validateRepeatInExcel(batchList, aBatch, true);
|
|
|
}
|
|
|
batchList.add(aBatch);
|
|
|
total++;
|
|
|
}
|
|
|
+ int success = goodsFillDataToExcelAndUpdate(batchList);
|
|
|
Long userUU = SystemSession.getUser().getUserUU();
|
|
|
- Long enUU = SystemSession.getUser().getEnterprise().getUu();
|
|
|
- resetRepeatData(batchList, true, false);
|
|
|
- setDefaultTag(batchList);
|
|
|
- int success = modifyGoodsByBatch(batchList);
|
|
|
+// Long enUU = SystemSession.getUser().getEnterprise().getUu();
|
|
|
+// resetRepeatData(batchList, true, false);
|
|
|
+// setDefaultTag(batchList);
|
|
|
commonDao.save(batchList, ReleaseProductByBatch.class);
|
|
|
Integer filter = releaseProductByBatchDao.getCountOfImportFail(userUU, batch, failCode);
|
|
|
modelMap.put("total", total);
|
|
|
@@ -479,6 +480,77 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
return modelMap;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 根据批次号设置需要被修改的信息
|
|
|
+ * @param batchList
|
|
|
+ */
|
|
|
+ private Integer goodsFillDataToExcelAndUpdate(List<ReleaseProductByBatch> batchList) {
|
|
|
+ int result = 0;
|
|
|
+ if (CollectionUtils.isEmpty(batchList)) {
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ List<String> batchCodes = new ArrayList<>();
|
|
|
+ for (ReleaseProductByBatch aBatch : batchList) {
|
|
|
+ if (!StringUtilB2C.isEmpty(aBatch.getBatchCode())) {
|
|
|
+ batchCodes.add(aBatch.getBatchCode());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ List<Goods> goodses = new ArrayList<>();
|
|
|
+ if (CollectionUtils.isNotEmpty(batchCodes)) {
|
|
|
+ goodses = goodsService.findGoodsByBatchCodes(batchCodes);
|
|
|
+ }
|
|
|
+ Goods newGoods = null;
|
|
|
+ List<GoodsHistory> goodsHistoryList = new ArrayList<>();
|
|
|
+ for (ReleaseProductByBatch aBatch : batchList) {
|
|
|
+ newGoods = null;
|
|
|
+ for (Goods goods : goodses) {
|
|
|
+ if (goods.getBatchCode().equals(aBatch.getBatchCode())) {
|
|
|
+ aBatch.setB2cBranden(goods.getBrandNameEn());
|
|
|
+ aBatch.setBrandNameEn(goods.getBrandNameEn());
|
|
|
+ aBatch.setKindName(goods.getKindNameCn());
|
|
|
+ aBatch.setB2cCode(goods.getCode());
|
|
|
+ aBatch.setCode(goods.getCode());
|
|
|
+ aBatch.setCurrency(goods.getCurrencyName());
|
|
|
+ if (goods.getUuid() == null) {
|
|
|
+ aBatch.setReleaseCode(ReleaseStatus.failure.value());
|
|
|
+ aBatch.setReleaseStatus(ReleaseStatus.failure.getPhrase());
|
|
|
+ }
|
|
|
+ fillInGoods(goods, aBatch);
|
|
|
+ newGoods = goods;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (newGoods == null) {
|
|
|
+ newGoods = new Goods();
|
|
|
+ TradeDeliveryDelayTime delayTime = getDelayTime(aBatch);
|
|
|
+ newGoods.setGoodsByReleaseProductByBatch(aBatch, delayTime);
|
|
|
+ goodsHistoryList.add(goodsHistoryService.converTGoodsHist(newGoods, GoodsHistory.OperateType.Publish.getPhrase(), false));
|
|
|
+ }
|
|
|
+ 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(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;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 给自定义标签为空的batch设置默认自定义标签
|
|
|
* @param batchList
|
|
|
@@ -622,21 +694,21 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
rowNum, ModifyConstant.PRODUCT_SPEC);
|
|
|
aProduct.setSpec(StringUtilB2C.getStr(specValue));
|
|
|
|
|
|
- Cell productCell = row.getCell(ModifyConstant.PRODUCE_DATE);
|
|
|
- if (productCell != null && productCell.getCellType() == 0) {
|
|
|
- if (HSSFDateUtil.isCellDateFormatted(productCell)) {
|
|
|
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
- String productStr = sdf.format(productCell.getDateCellValue());
|
|
|
- aProduct.setProductDateByExcel(productStr);
|
|
|
- } else {
|
|
|
- aProduct.setProductDateByExcel(readWorkBookCell(row.getCell(ModifyConstant.PRODUCE_DATE), Cell.CELL_TYPE_STRING,
|
|
|
- rowNum, ModifyConstant.PRODUCE_DATE));
|
|
|
- }
|
|
|
- } else {
|
|
|
- Object produceValue = readWorkBookCell(row.getCell(ModifyConstant.PRODUCE_DATE), Cell.CELL_TYPE_STRING,
|
|
|
- rowNum, ModifyConstant.PRODUCE_DATE);
|
|
|
- aProduct.setProductDateByExcel(produceValue);
|
|
|
- }
|
|
|
+// Cell productCell = row.getCell(ModifyConstant.PRODUCE_DATE);
|
|
|
+// if (productCell != null && productCell.getCellType() == 0) {
|
|
|
+// if (HSSFDateUtil.isCellDateFormatted(productCell)) {
|
|
|
+// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+// String productStr = sdf.format(productCell.getDateCellValue());
|
|
|
+// aProduct.setProductDateByExcel(productStr);
|
|
|
+// } else {
|
|
|
+// aProduct.setProductDateByExcel(readWorkBookCell(row.getCell(ModifyConstant.PRODUCE_DATE), Cell.CELL_TYPE_STRING,
|
|
|
+// rowNum, ModifyConstant.PRODUCE_DATE));
|
|
|
+// }
|
|
|
+// } else {
|
|
|
+// Object produceValue = readWorkBookCell(row.getCell(ModifyConstant.PRODUCE_DATE), Cell.CELL_TYPE_STRING,
|
|
|
+// rowNum, ModifyConstant.PRODUCE_DATE);
|
|
|
+// aProduct.setProductDateByExcel(produceValue);
|
|
|
+// }
|
|
|
|
|
|
Object packageMethodValue = readWorkBookCell(row.getCell(ModifyConstant.PACKAGE_METHOD), Cell.CELL_TYPE_STRING,
|
|
|
rowNum, ModifyConstant.PACKAGE_METHOD);
|
|
|
@@ -677,52 +749,21 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
aProduct.setReserveByExcel(reserveValue);
|
|
|
}
|
|
|
|
|
|
- Object statusValue = readWorkBookCell(row.getCell(ModifyConstant.SALE_STATUS), Cell.CELL_TYPE_STRING,
|
|
|
- rowNum, ModifyConstant.SALE_STATUS);
|
|
|
+ Object statusValue = readWorkBookCell(row.getCell(ModifyConstant.COST_PRICE), Cell.CELL_TYPE_STRING,
|
|
|
+ rowNum, ModifyConstant.COST_PRICE);
|
|
|
if (!StringUtils.isEmpty(statusValue)) {
|
|
|
- aProduct.setStatusByExcel(statusValue);
|
|
|
+ aProduct.setCostPriceByExcel(statusValue);
|
|
|
}
|
|
|
|
|
|
- Object tagValue = readWorkBookCell(row.getCell(ModifyConstant.CUSTOM_LABEL), Cell.CELL_TYPE_STRING,
|
|
|
- rowNum, ModifyConstant.CUSTOM_LABEL);
|
|
|
- if (!StringUtils.isEmpty(tagValue)) {
|
|
|
- aProduct.setTagByExcel(tagValue.toString().trim());
|
|
|
- }
|
|
|
- // 自定义标签不为null,则检查是否重复
|
|
|
- if (aProduct.getCode() != null && aProduct.getBrandNameEn() != null && aProduct.getTag() != null) {
|
|
|
- resetTag(aProduct);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 验证批次号是否正确,并为该公司下的goods
|
|
|
- * @param batchCode
|
|
|
- * @param aBatch
|
|
|
- * @return
|
|
|
- */
|
|
|
- private boolean validateBatchCode(String batchCode, ReleaseProductByBatch aBatch) {
|
|
|
- if (StringUtils.isEmpty(batchCode)) {
|
|
|
- return false;
|
|
|
- }
|
|
|
- Goods goods = goodsDao.findByBatchCode(batchCode);
|
|
|
- if (goods == null) {
|
|
|
- return false;
|
|
|
- }
|
|
|
- aBatch.setB2cBranden(goods.getBrandNameEn());
|
|
|
- aBatch.setBrandNameEn(goods.getBrandNameEn());
|
|
|
- aBatch.setKindName(goods.getKindNameCn());
|
|
|
- aBatch.setB2cCode(goods.getCode());
|
|
|
- aBatch.setCode(goods.getCode());
|
|
|
- aBatch.setCurrency(goods.getCurrencyName());
|
|
|
- if (goods.getUuid() == null) {
|
|
|
- aBatch.setReleaseCode(ReleaseStatus.failure.value());
|
|
|
- aBatch.setReleaseStatus(ReleaseStatus.failure.getPhrase());
|
|
|
- }
|
|
|
- Long enuu = SystemSession.getUser().getEnterprise() != null ? SystemSession.getUser().getEnterprise().getUu() : null;
|
|
|
- if (goods.getEnUU() != null) {
|
|
|
- return goods.getEnUU().equals(enuu);
|
|
|
- }
|
|
|
- return goods.getEnUU() == null && enuu == null;
|
|
|
+// Object tagValue = readWorkBookCell(row.getCell(ModifyConstant.CUSTOM_LABEL), Cell.CELL_TYPE_STRING,
|
|
|
+// rowNum, ModifyConstant.CUSTOM_LABEL);
|
|
|
+// if (!StringUtils.isEmpty(tagValue)) {
|
|
|
+// aProduct.setTagByExcel(tagValue.toString().trim());
|
|
|
+// }
|
|
|
+// // 自定义标签不为null,则检查是否重复
|
|
|
+// if (aProduct.getCode() != null && aProduct.getBrandNameEn() != null && aProduct.getTag() != null) {
|
|
|
+// resetTag(aProduct);
|
|
|
+// }
|
|
|
}
|
|
|
|
|
|
private void validateModifyExcel(Row headerRow) {
|
|
|
@@ -746,19 +787,22 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
return ;
|
|
|
for (ReleaseProductByBatch each : batchList) {
|
|
|
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;
|
|
|
- }
|
|
|
- }
|
|
|
+ aBatch.setErrmsg(ErrorInfoConstant.REPEAT_IN_EXCEL.getInfo());
|
|
|
+ aBatch.setReleaseCode(ReleaseStatus.had_exists.value());
|
|
|
+ aBatch.setReleaseStatus(ReleaseStatus.had_exists.getPhrase());
|
|
|
+// 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;
|
|
|
+// }
|
|
|
+// }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -934,7 +978,7 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
aProduct.setUsdTaxRate(0d);
|
|
|
} else {
|
|
|
aProduct.setCurrency("RMB");
|
|
|
- aProduct.setRmbTaxRate(0.17d);
|
|
|
+ aProduct.setRmbTaxRate(0.16d);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -1174,6 +1218,9 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
Object reserveValue = readWorkBookCell(row.getCell(UploadConstant.RESERVE_NUMBER), Cell.CELL_TYPE_STRING,
|
|
|
rowNum, UploadConstant.RESERVE_NUMBER);
|
|
|
aProduct.setReserveByExcel(reserveValue);
|
|
|
+ if (StringUtils.isEmpty(reserveValue)) {
|
|
|
+ result += 1;
|
|
|
+ }
|
|
|
|
|
|
Object costPrice = readWorkBookCell(row.getCell(UploadConstant.COST_PRICE), Cell.CELL_TYPE_STRING,
|
|
|
rowNum, UploadConstant.COST_PRICE);
|
|
|
@@ -1305,19 +1352,19 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
}
|
|
|
aProduct.setFragmentPrice(StringUtilB2C.getStr(firstValue), 0);
|
|
|
if (StringUtils.isEmpty(firstValue)) {
|
|
|
- aProduct.addErrmsg(ErrorInfoConstant.PRICE_INFO.getInfo());
|
|
|
+ //aProduct.addErrmsg(ErrorInfoConstant.PRICE_INFO.getInfo());
|
|
|
} else {
|
|
|
if (RegexConstant.isNumber(firstValue.toString())) {
|
|
|
Double cellPrice = Double.valueOf(firstValue.toString());
|
|
|
if (validatePrice(cellPrice)) {
|
|
|
- GoodsQtyPrice qtyPrice = getOneQtyPrice(aProduct.getMinBuyQty(), DoubleConstant.maxMinPackageQty,
|
|
|
+ GoodsQtyPrice qtyPrice = getOneQtyPrice(aProduct.getMinBuyQty(), DoubleConstant.maxReserve,
|
|
|
cellPrice, aProduct.getRmbTaxRate(), aProduct.getCurrency());
|
|
|
qtyPriceList.add(qtyPrice);
|
|
|
} else {
|
|
|
aProduct.addErrmsg(ErrorInfoConstant.PRICE_INFO.getInfo());
|
|
|
}
|
|
|
} else {
|
|
|
- aProduct.addErrmsg(ErrorInfoConstant.PRICE_INFO.getInfo());
|
|
|
+ //aProduct.addErrmsg(ErrorInfoConstant.PRICE_INFO.getInfo());
|
|
|
}
|
|
|
|
|
|
}
|
|
|
@@ -1366,7 +1413,7 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
if (start == null || lastEnd == null) {
|
|
|
return false;
|
|
|
}
|
|
|
- return start.compareTo(lastEnd) > 0 && start.compareTo(DoubleConstant.maxMinPackageQty) <= 0;
|
|
|
+ return start.compareTo(lastEnd) > 0 && start.compareTo(DoubleConstant.maxReserve) <= 0;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -1395,7 +1442,7 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
Double price = Double.valueOf(priceValue.toString());
|
|
|
Double start = Double.valueOf(startValue.toString());
|
|
|
if (validatePrice(price) && validateStartNumber(start, aProduct.getMinBuyQty())) {
|
|
|
- GoodsQtyPrice qtyPrice = getOneQtyPrice(Double.valueOf(startValue.toString()), DoubleConstant.maxMinPackageQty,
|
|
|
+ GoodsQtyPrice qtyPrice = getOneQtyPrice(Double.valueOf(startValue.toString()), DoubleConstant.maxReserve,
|
|
|
price, aProduct.getRmbTaxRate(), aProduct.getCurrency());
|
|
|
qtyPriceList.add(qtyPrice);
|
|
|
qtyPriceList.get(0).setEnd(Double.valueOf(startValue.toString()) - 1);
|
|
|
@@ -1436,7 +1483,7 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
Double start = Double.valueOf(startValue.toString());
|
|
|
Double lastEnd = qtyPriceList.get(qtyPriceList.size() - 1).getStart();
|
|
|
if (validatePrice(price) && validateStartNumber(start, lastEnd)) {
|
|
|
- GoodsQtyPrice qtyPrice = getOneQtyPrice(start, DoubleConstant.maxMinPackageQty,
|
|
|
+ GoodsQtyPrice qtyPrice = getOneQtyPrice(start, DoubleConstant.maxReserve,
|
|
|
price, aProduct.getRmbTaxRate(), aProduct.getCurrency());
|
|
|
qtyPriceList.get(qtyPriceList.size() - 1).setEnd(start - 1);
|
|
|
qtyPriceList.add(qtyPrice);
|
|
|
@@ -1773,8 +1820,7 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
if (StringUtils.isEmpty(batch)) {
|
|
|
return "0";
|
|
|
}
|
|
|
- List<ReleaseProductByBatch> releaseProductByBatchList =
|
|
|
- releaseProductByBatchDao.findByRelbatchid(batch);
|
|
|
+ List<ReleaseProductByBatch> releaseProductByBatchList = releaseProductByBatchDao.findByRelbatchid(batch);
|
|
|
if (CollectionUtils.isEmpty(releaseProductByBatchList)) {
|
|
|
return String.valueOf(IntegerConstant.NO_SHORT);
|
|
|
}
|
|
|
@@ -1810,28 +1856,7 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
if (CollectionUtils.isNotEmpty(list)) {
|
|
|
List<Goods> goodses = new ArrayList<>();
|
|
|
Goods goods = null;
|
|
|
- TradeDeliveryDelayTime delayTime = null;
|
|
|
- ReleaseProductByBatch releaseProductByBatch1 = list.get(0);
|
|
|
- if (releaseProductByBatch1.getStoreid().equals(SysConf.getStoreid())) {
|
|
|
- // 增加交货延长期限
|
|
|
- List<TradeDeliveryDelayTime> tradeDeliveryDelayTime = tradeDeliveryDelayTimeService.getTradeDeliveryDelayTime();
|
|
|
- if (releaseProductByBatch1.getCurrency().equals(StringConstant.RMB)) {
|
|
|
- for (TradeDeliveryDelayTime deliveryDelayTime : tradeDeliveryDelayTime) {
|
|
|
- if (deliveryDelayTime.getType() == IntegerConstant.DOMESTIC_DELAY) {
|
|
|
- delayTime = deliveryDelayTime;
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- for (TradeDeliveryDelayTime deliveryDelayTime : tradeDeliveryDelayTime) {
|
|
|
- if (deliveryDelayTime.getType() == IntegerConstant.ABROAD_DELAY) {
|
|
|
- delayTime = deliveryDelayTime;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if (delayTime == null) {
|
|
|
- throw new IllegalOperatorException("平台未设置供应商延长时间,请联系管理员");
|
|
|
- }
|
|
|
- }
|
|
|
+ TradeDeliveryDelayTime delayTime = getDelayTime(list.get(0));
|
|
|
List<Goods> goodlist = null;
|
|
|
if (CollectionUtils.isNotEmpty(idSet)) {
|
|
|
List<Long> prids = new ArrayList<>();
|
|
|
@@ -1841,6 +1866,7 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
List<ReleaseProductByBatch> insertGoods = new ArrayList<>();
|
|
|
Set<Long> prids = new HashSet<>();
|
|
|
List<Goods> updateGoods = new ArrayList<>();
|
|
|
+ List<GoodsHistory> goodsHistoryList = new ArrayList<>();
|
|
|
for (ReleaseProductByBatch releaseProductByBatch : list) {
|
|
|
if (releaseProductByBatch.getReleaseCode().intValue() == ReleaseStatus.success.value() || releaseProductByBatch.getReleaseCode().intValue() == ReleaseStatus.failure.value()) {
|
|
|
Boolean isExist = false;
|
|
|
@@ -1852,6 +1878,7 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
isExist = true;
|
|
|
prids.add(releaseProductByBatch.getProductid());
|
|
|
goods1.updateGoodsByReleaseProductByBatch(releaseProductByBatch, delayTime, ignoreImport);
|
|
|
+ goodsHistoryList.add(goodsHistoryService.converTGoodsHist(goods1, GoodsHistory.OperateType.Update.getPhrase(), false));
|
|
|
updateGoods.add(goods1);
|
|
|
break;
|
|
|
}
|
|
|
@@ -1866,6 +1893,7 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
for (ReleaseProductByBatch releaseProductByBatch : insertGoods) {
|
|
|
goods = new Goods();
|
|
|
goods.setGoodsByReleaseProductByBatch(releaseProductByBatch, delayTime);
|
|
|
+ goodsHistoryList.add(goodsHistoryService.converTGoodsHist(goods, GoodsHistory.OperateType.Publish.getPhrase(), false));
|
|
|
goodses.add(goods);
|
|
|
}
|
|
|
}
|
|
|
@@ -1875,12 +1903,40 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
if (CollectionUtils.isNotEmpty(updateGoods)) {
|
|
|
goodsDao.save(updateGoods);
|
|
|
}
|
|
|
+ if (CollectionUtils.isNotEmpty(goodsHistoryList)) {
|
|
|
+ goodsHistoryService.save(goodsHistoryList);
|
|
|
+ }
|
|
|
return (goodses.size() + updateGoods.size());
|
|
|
} else {
|
|
|
return 0;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ public TradeDeliveryDelayTime getDelayTime(ReleaseProductByBatch releaseProductByBatch) {
|
|
|
+ TradeDeliveryDelayTime delayTime = null;
|
|
|
+ if (releaseProductByBatch.getStoreid().equals(SysConf.getStoreid())) {
|
|
|
+ // 增加交货延长期限
|
|
|
+ List<TradeDeliveryDelayTime> tradeDeliveryDelayTime = tradeDeliveryDelayTimeService.getTradeDeliveryDelayTime();
|
|
|
+ if (releaseProductByBatch.getCurrency().equals(StringConstant.RMB)) {
|
|
|
+ for (TradeDeliveryDelayTime deliveryDelayTime : tradeDeliveryDelayTime) {
|
|
|
+ if (deliveryDelayTime.getType() == IntegerConstant.DOMESTIC_DELAY) {
|
|
|
+ delayTime = deliveryDelayTime;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ for (TradeDeliveryDelayTime deliveryDelayTime : tradeDeliveryDelayTime) {
|
|
|
+ if (deliveryDelayTime.getType() == IntegerConstant.ABROAD_DELAY) {
|
|
|
+ delayTime = deliveryDelayTime;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (delayTime == null) {
|
|
|
+ throw new IllegalOperatorException("平台未设置供应商延长时间,请联系管理员");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return delayTime;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 批量保存pcb的信息
|
|
|
* @param idSet id
|
|
|
@@ -1964,6 +2020,7 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
proNums.add(prodNum);
|
|
|
productsfromRelease.add(releaseProductByBatch);
|
|
|
} else {
|
|
|
+ prodNum = releaseProductByBatch.getCode();
|
|
|
//对于已经存在于物料库的信息,如果规格信息已存在,则做更新
|
|
|
prIds.add(releaseProductByBatch.getProductid());
|
|
|
}
|
|
|
@@ -2009,9 +2066,9 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
commonDao.save(productPrivates, ProductPrivate.class);
|
|
|
}
|
|
|
//将本次临时表中的数据更新到物料表中
|
|
|
- if (CollectionUtils.isNotEmpty(updateProducts)) {
|
|
|
- Map<String, Set<InOutboundDetail>> inOutMap = new HashedMap();
|
|
|
- productService.updateProductsByReleaseProductByBatch(prIds, releaseProductByBatchList, ignoreImport, newInOutboundDetail, inOutMap);
|
|
|
+ productService.updateProductsByReleaseProductByBatch(prIds, releaseProductByBatchList, ignoreImport, newInOutboundDetail);
|
|
|
+ if (CollectionUtils.isNotEmpty(newInOutboundDetail)) {
|
|
|
+ Map<String, Set<InOutboundDetail>> inOutMap = inOutboundDetailService.initInOutboundDetailByQty(newInOutboundDetail);
|
|
|
Set<String> stringSet = inOutMap.keySet();
|
|
|
for (String type : stringSet) {
|
|
|
CommodityInOutbound commodityInOutbound = commodityInOutboundService.produceCommodityInOutbound(inOutMap.get(type), type);
|
|
|
@@ -2088,15 +2145,15 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
public void run() {
|
|
|
|
|
|
//创建历史库存
|
|
|
- List<Goods> goodses1 = goodsService.findByBatchId(batchid);
|
|
|
- List<GoodsHistory> list = new ArrayList<>();
|
|
|
- for (Goods goods : goodses1) {
|
|
|
- GoodsHistory goodsHistory = goodsHistoryService.converTGoodsHist(goods, GoodsHistory.OperateType.Publish.getPhrase(), false);
|
|
|
- list.add(goodsHistory);
|
|
|
- }
|
|
|
- if (CollectionUtils.isNotEmpty(list)) {
|
|
|
- goodsHistoryService.save(list);
|
|
|
- }
|
|
|
+// List<Goods> goodses1 = goodsService.findByBatchId(batchid);
|
|
|
+// List<GoodsHistory> list = new ArrayList<>();
|
|
|
+// for (Goods goods : goodses1) {
|
|
|
+// GoodsHistory goodsHistory = goodsHistoryService.converTGoodsHist(goods, GoodsHistory.OperateType.Publish.getPhrase(), false);
|
|
|
+// list.add(goodsHistory);
|
|
|
+// }
|
|
|
+// if (CollectionUtils.isNotEmpty(list)) {
|
|
|
+// goodsHistoryService.save(list);
|
|
|
+// }
|
|
|
//创建物料的私有信息
|
|
|
productPrivateService.newProductPrivateIfNotExist(productIds);
|
|
|
|