|
|
@@ -391,7 +391,19 @@ public class ReplenishmentOrderServiceImpl extends ServiceImpl<ReplenishmentOrde
|
|
|
"商品「" + item.getProductName() + "」ERP商品编码未找到");
|
|
|
}
|
|
|
|
|
|
- BigDecimal price = item.getUnitPrice() != null ? item.getUnitPrice() : BigDecimal.ZERO;
|
|
|
+ // 单价优先级: 补货明细 > 商品零售价(Product.retailPrice) > 商品售价(Product.price)
|
|
|
+ BigDecimal price = item.getUnitPrice();
|
|
|
+ if (price == null || price.compareTo(BigDecimal.ZERO) <= 0) {
|
|
|
+ if (product != null && product.getRetailPrice() != null && product.getRetailPrice() > 0) {
|
|
|
+ price = BigDecimal.valueOf(product.getRetailPrice());
|
|
|
+ } else if (product != null && product.getPrice() != null && product.getPrice() > 0) {
|
|
|
+ price = BigDecimal.valueOf(product.getPrice());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (price == null || price.compareTo(BigDecimal.ZERO) <= 0) {
|
|
|
+ throw new BusinessException(400,
|
|
|
+ "商品「" + item.getProductName() + "」无有效单价,请先在补货明细中填写单价或确保商品有零售价");
|
|
|
+ }
|
|
|
BigDecimal quantity = BigDecimal.valueOf(item.getPlannedQuantity() != null ? item.getPlannedQuantity() : 0);
|
|
|
|
|
|
OrderGoods goods = OrderGoods.builder()
|