master:销售/出库,后端返回数据调整;

pull/1121/head
liujiang 2025-09-19 14:25:44 +08:00
parent 40fa651202
commit 31f82dd209
3 changed files with 11 additions and 6 deletions

View File

@ -44,7 +44,5 @@ public class StoreSaleSnResVO {
private BigDecimal amount;
@ApiModelProperty(value = "[退货扫码时才有]销售数量")
private BigDecimal quantity;
@ApiModelProperty(value = "[退货扫码时才有]其它优惠")
private BigDecimal otherDiscount;
}

View File

@ -43,7 +43,5 @@ public class StoreSaleSnResDTO {
private BigDecimal amount;
@ApiModelProperty(value = "[退货扫码时才有]销售数量")
private BigDecimal quantity;
@ApiModelProperty(value = "[退货扫码时才有]其它优惠")
private BigDecimal otherDiscount;
}

View File

@ -21,6 +21,7 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.*;
import java.util.function.Function;
import java.util.regex.Pattern;
@ -511,8 +512,16 @@ public class StoreProductColorSizeServiceImpl implements IStoreProductColorSizeS
// 查询数据库 获取条码对应的商品信息
barcodeResDTO = prodColorSizeMapper.selectOtherSn(prefixPart, snDTO.getStoreId(), snDTO.getStoreCusId());
}
return ObjectUtils.isEmpty(barcodeResDTO) ? new StoreSaleSnResDTO().setSuccess(Boolean.FALSE).setSn(snDTO.getSn())
: barcodeResDTO.setSuccess(Boolean.TRUE).setSn(snDTO.getSn());
if (ObjectUtils.isEmpty(barcodeResDTO)) {
return new StoreSaleSnResDTO().setSuccess(Boolean.FALSE).setSn(snDTO.getSn());
}
// 设置档口客户优惠金额
final BigDecimal discountedPrice = barcodeResDTO.getPrice()
.subtract(ObjectUtils.defaultIfNull(barcodeResDTO.getDiscount(), BigDecimal.ZERO));
// 销售则数量为1 退货则数量为-1
final BigDecimal quantity = snDTO.getRefund() ? BigDecimal.ONE.negate() : BigDecimal.ONE;
return barcodeResDTO.setSuccess(Boolean.TRUE).setSn(snDTO.getSn()).setDiscountedPrice(discountedPrice)
.setQuantity(quantity).setAmount(discountedPrice.multiply(barcodeResDTO.getQuantity()));
}