master:销售/出库 扫码BUG修复;

pull/1121/head
liujiang 2025-10-23 22:28:38 +08:00
parent efee2cace9
commit 3b5a018554
4 changed files with 64 additions and 15 deletions

View File

@ -20,5 +20,7 @@ public class StoreSaleSnDTO {
private Boolean refund;
@ApiModelProperty(value = "条码")
private String sn;
@ApiModelProperty(value = "条码前缀")
private String snPrefix;
}

View File

@ -14,9 +14,19 @@ import com.ruoyi.xkt.dto.storeProdColorSize.StoreSaleSnResDTO;
public interface StoreSaleDetailMapper extends BaseMapper<StoreSaleDetail> {
/**
*
* @param barcodeDTO
* @return
* ID
*
* @param barcodeDTO
* @return StoreSaleSnResDTO
*/
StoreSaleSnResDTO selectBySn(StoreSaleSnDTO barcodeDTO);
StoreSaleSnResDTO selectRefundByBuJuSnSale(StoreSaleSnDTO barcodeDTO);
/**
* ID
*
* @param barcodeDTO
* @return StoreSaleSnResDTO
*/
StoreSaleSnResDTO selectRefundByOtherSnSale(StoreSaleSnDTO barcodeDTO);
}

View File

@ -90,14 +90,19 @@ public class StoreProductColorSizeServiceImpl implements IStoreProductColorSizeS
}
// 销售出库[退货]
if (snDTO.getRefund()) {
// 先查storeSaleDetail中的sns条码是否存在[可能同一个条码,被一个客户多次销售、退货,则取最近的一条]
StoreSaleSnResDTO barcodeResDTO = this.saleDetailMapper.selectBySn(snDTO);
if (ObjectUtils.isNotEmpty(barcodeResDTO)) {
return barcodeResDTO.setSuccess(Boolean.TRUE).setSn(snDTO.getSn());
} else {
// 若是没查询到数据,则走正常条码查询流程
return this.getSnInfo(snDTO, stockSys);
}
// 先查storeSaleDetail中的sns条码是否存在[可能同一个条码,被一个客户多次销售、退货,则取最近销售的那条]
final boolean isBuJu = snDTO.getSn().startsWith(snDTO.getStoreId().toString());
// 获取条码前缀
final String snPrefix = isBuJu ? snDTO.getSn().substring(0, STOCK_PREFIX_LENGTH_MAP.get(StockSysType.BU_JU.getValue()))
// 从系统设置中获取,根据系统迁移时的配置
: snDTO.getSn().substring(0, STOCK_PREFIX_LENGTH_MAP.get(stockSys));
// 设置查询的条码前缀
snDTO.setSnPrefix(snPrefix);
StoreSaleSnResDTO barcodeResDTO = isBuJu ? this.saleDetailMapper.selectRefundByBuJuSnSale(snDTO)
: this.saleDetailMapper.selectRefundByOtherSnSale(snDTO);
return ObjectUtils.isNotEmpty(barcodeResDTO) ? barcodeResDTO.setSuccess(Boolean.TRUE).setSn(snDTO.getSn())
// 若是没查询到数据,则走正常条码查询流程
: this.getSnInfo(snDTO, stockSys);
// 销售出库[销售] 正常条码查询流程
} else {
return this.getSnInfo(snDTO, stockSys);

View File

@ -4,7 +4,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.xkt.mapper.StoreSaleDetailMapper">
<select id="selectBySn" resultType="com.ruoyi.xkt.dto.storeProdColorSize.StoreSaleSnResDTO">
<select id="selectRefundByBuJuSnSale" resultType="com.ruoyi.xkt.dto.storeProdColorSize.StoreSaleSnResDTO">
SELECT
ssd.store_prod_id,
ssd.store_prod_color_id,
@ -13,13 +13,45 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
ssd.prod_art_num,
ssd.price,
ssd.discounted_price,
ssd.quantity,
ssd.amount,
spcs.standard,
-(ssd.quantity) AS quantity,
-(ssd.amount) AS amount,
DATE_FORMAT(ssd.create_time, '(%m.%e出)') AS soldTime
FROM
store_sale_detail ssd
JOIN store_product_color_size spcs ON spcs.del_flag = 0 AND spcs.store_prod_id = ssd.store_prod_id
AND spcs.size = ssd.size AND spcs.sn_prefix = #{snPrefix}
WHERE
ssd.del_flag = 0
AND ssd.sale_type = 1
AND ssd.sn = #{sn}
AND ssd.store_id = #{storeId}
AND ssd.store_cus_id = #{storeCusId}
ORDER BY
ssd.update_time DESC
LIMIT 1
</select>
<select id="selectRefundByOtherSnSale" resultType="com.ruoyi.xkt.dto.storeProdColorSize.StoreSaleSnResDTO">
SELECT
ssd.store_prod_id,
ssd.store_prod_color_id,
ssd.color_name,
ssd.size,
ssd.prod_art_num,
ssd.price,
ssd.discounted_price,
spcs.standard,
-(ssd.quantity) AS quantity,
-(ssd.amount) AS amount,
DATE_FORMAT(ssd.create_time, '(%m.%e出)') AS soldTime
FROM
store_sale_detail ssd
JOIN store_product_color_size spcs ON spcs.del_flag = 0 AND spcs.store_prod_id = ssd.store_prod_id
AND spcs.size = ssd.size AND spcs.other_sn_prefix = #{snPrefix}
WHERE
ssd.del_flag = 0
AND ssd.sale_type = 1
AND ssd.sn = #{sn}
AND ssd.store_id = #{storeId}
AND ssd.store_cus_id = #{storeCusId}