|
|
@@ -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);
|
|
|
}
|
|
|
@@ -497,6 +501,7 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
goodses = goodsService.findGoodsByBatchCodes(batchCodes);
|
|
|
}
|
|
|
Goods newGoods = null;
|
|
|
+ List<GoodsHistory> goodsHistoryList = new ArrayList<>();
|
|
|
for (ReleaseProductByBatch aBatch : batchList) {
|
|
|
newGoods = null;
|
|
|
for (Goods goods : goodses) {
|
|
|
@@ -517,7 +522,10 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
}
|
|
|
}
|
|
|
if (newGoods == null) {
|
|
|
- newGoods = aBatch.releaseProductByBatchConvertToGoods(aBatch);
|
|
|
+ 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()) {
|
|
|
@@ -1210,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);
|
|
|
@@ -1341,7 +1352,7 @@ 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());
|
|
|
@@ -1353,7 +1364,7 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
aProduct.addErrmsg(ErrorInfoConstant.PRICE_INFO.getInfo());
|
|
|
}
|
|
|
} else {
|
|
|
- aProduct.addErrmsg(ErrorInfoConstant.PRICE_INFO.getInfo());
|
|
|
+ //aProduct.addErrmsg(ErrorInfoConstant.PRICE_INFO.getInfo());
|
|
|
}
|
|
|
|
|
|
}
|
|
|
@@ -1431,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);
|
|
|
@@ -1472,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);
|
|
|
@@ -1809,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);
|
|
|
}
|
|
|
@@ -1846,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<>();
|
|
|
@@ -1877,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;
|
|
|
@@ -1888,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;
|
|
|
}
|
|
|
@@ -1902,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);
|
|
|
}
|
|
|
}
|
|
|
@@ -1911,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
|
|
|
@@ -2045,9 +2065,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);
|
|
|
@@ -2124,15 +2144,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);
|
|
|
|