|
|
@@ -164,16 +164,20 @@ public class DeliveryItemsServiceImpl extends ServiceImpl<DeliveryItemsMapper, D
|
|
|
}
|
|
|
StockGoods stockGoods=null;
|
|
|
StockGoodsVO stock = this.getStock(delivery.getTradeType(), deliveryItems.getCorpId(), delivery.getStorageId(), deliveryItems);
|
|
|
- if (stock != null && delivery.getDeliveryType() == DeliveryEnum.DELIVER.getType()){//发货
|
|
|
- //更新库存账
|
|
|
- stockGoods = this.deliverGoods(delivery.getTradeType(), stock.getId(), deliveryItems);
|
|
|
+ // todo 国内贸易暂定不更新库存
|
|
|
+ if (!delivery.getTradeType().equals(OrderTypeEnum.DOMESTIC.getType())){
|
|
|
+ if (stock != null && delivery.getDeliveryType() == DeliveryEnum.DELIVER.getType()){//发货
|
|
|
+ //更新库存账
|
|
|
+ stockGoods = this.deliverGoods(delivery.getTradeType(), stock.getId(), deliveryItems);
|
|
|
|
|
|
- }else if (stock != null && delivery.getDeliveryType() == DeliveryEnum.REPEAL.getType()){ //撤销发货
|
|
|
- stockGoods = this.revocationDeliverGoods(delivery.getTradeType(), stock.getId(), deliveryItems);
|
|
|
+ }else if (stock != null && delivery.getDeliveryType() == DeliveryEnum.REPEAL.getType()){ //撤销发货
|
|
|
+ stockGoods = this.revocationDeliverGoods(delivery.getTradeType(), stock.getId(), deliveryItems);
|
|
|
+
|
|
|
+ }else {
|
|
|
+ //新增库存账
|
|
|
+ throw new RuntimeException("库存为空");
|
|
|
+ }
|
|
|
|
|
|
- }else {
|
|
|
- //新增库存账
|
|
|
- throw new RuntimeException("库存为空");
|
|
|
}
|
|
|
// todo 更新订单明细中发货数量 采购和销售可能需要调不同接口
|
|
|
R actualQuantity = orderItemsClient.updateActualQuantity(deliveryItems.getSrcId(), deliveryItems.getActualQuantity(),delivery.getDeliveryType());
|
|
|
@@ -188,7 +192,13 @@ public class DeliveryItemsServiceImpl extends ServiceImpl<DeliveryItemsMapper, D
|
|
|
}
|
|
|
}
|
|
|
//更新发货明细库存字段
|
|
|
- deliveryItems.setInventoryNumber(stockGoods.getSurplusRouteQuantity());
|
|
|
+ if (stockGoods != null){
|
|
|
+ deliveryItems.setInventoryNumber(stockGoods.getSurplusRouteQuantity());
|
|
|
+ }else if (stock != null){
|
|
|
+ deliveryItems.setInventoryNumber(stock.getSurplusRouteQuantity());
|
|
|
+ }else {
|
|
|
+ deliveryItems.setInventoryNumber(BigDecimal.ZERO);
|
|
|
+ }
|
|
|
baseMapper.updateById(deliveryItems);
|
|
|
}
|
|
|
}
|
|
|
@@ -319,12 +329,9 @@ public class DeliveryItemsServiceImpl extends ServiceImpl<DeliveryItemsMapper, D
|
|
|
}
|
|
|
stockGoods.setUpdateTime(new Date());
|
|
|
stockGoods.setUpdateUser(SecureUtil.getUserId());
|
|
|
- // todo 国内贸易暂定不更新库存
|
|
|
- if (!tradeType.equals(OrderTypeEnum.DOMESTIC.getType())){
|
|
|
- R updateStock = stockGoodsClient.updateStock(stockGoods);
|
|
|
- if (!updateStock.isSuccess()){
|
|
|
- throw new RuntimeException("更新库存总账失败");
|
|
|
- }
|
|
|
+ R updateStock = stockGoodsClient.updateStock(stockGoods);
|
|
|
+ if (!updateStock.isSuccess()){
|
|
|
+ throw new RuntimeException("更新库存总账失败");
|
|
|
}
|
|
|
return stockGoods;
|
|
|
}
|