ERP:初始化销售退货逻辑 100%

This commit is contained in:
YunaiV 2024-02-12 06:52:20 +08:00
parent 926286fe08
commit 798b72778e
3 changed files with 10 additions and 2 deletions

View File

@ -74,4 +74,7 @@ public class ErpSaleOrderPageReqVO extends PageParam {
@Schema(description = "是否可出库", example = "true") @Schema(description = "是否可出库", example = "true")
private Boolean outEnable; private Boolean outEnable;
@Schema(description = "是否可退货", example = "true")
private Boolean returnEnable;
} }

View File

@ -42,7 +42,7 @@ public class ErpSaleReturnRespVO {
@Schema(description = "退货时间", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "退货时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("退货时间") @ExcelProperty("退货时间")
private LocalDateTime outTime; private LocalDateTime returnTime;
@Schema(description = "销售订单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "17386") @Schema(description = "销售订单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "17386")
private Long orderId; private Long orderId;

View File

@ -46,11 +46,16 @@ public interface ErpSaleOrderMapper extends BaseMapperX<ErpSaleOrderDO> {
} else if (Objects.equals(reqVO.getReturnStatus(), ErpSaleOrderPageReqVO.RETURN_STATUS_ALL)) { } else if (Objects.equals(reqVO.getReturnStatus(), ErpSaleOrderPageReqVO.RETURN_STATUS_ALL)) {
query.apply("t.return_count = t.total_count"); query.apply("t.return_count = t.total_count");
} }
// 出库 // 销售出库
if (Boolean.TRUE.equals(reqVO.getOutEnable())) { if (Boolean.TRUE.equals(reqVO.getOutEnable())) {
query.eq(ErpSaleOrderDO::getStatus, ErpAuditStatus.APPROVE.getStatus()) query.eq(ErpSaleOrderDO::getStatus, ErpAuditStatus.APPROVE.getStatus())
.apply("t.out_count < t.total_count"); .apply("t.out_count < t.total_count");
} }
// 可销售退货
if (Boolean.TRUE.equals(reqVO.getReturnEnable())) {
query.eq(ErpSaleOrderDO::getStatus, ErpAuditStatus.APPROVE.getStatus())
.apply("t.return_count < t.out_count");
}
if (reqVO.getProductId() != null) { if (reqVO.getProductId() != null) {
query.leftJoin(ErpSaleOrderItemDO.class, ErpSaleOrderItemDO::getOrderId, ErpSaleOrderDO::getId) query.leftJoin(ErpSaleOrderItemDO.class, ErpSaleOrderItemDO::getOrderId, ErpSaleOrderDO::getId)
.eq(reqVO.getProductId() != null, ErpSaleOrderItemDO::getProductId, reqVO.getProductId()) .eq(reqVO.getProductId() != null, ErpSaleOrderItemDO::getProductId, reqVO.getProductId())