mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-22 15:21:53 +08:00
✨ ERP:初始化 receipt 收款单的逻辑 100%
This commit is contained in:
parent
f93bad282f
commit
eefd787de6
@ -14,8 +14,8 @@ import java.math.BigDecimal;
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@TableName("erp_finance_payment_item")
|
||||
@KeySequence("erp_finance_payment_item_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@TableName("erp_finance_receipt_item")
|
||||
@KeySequence("erp_finance_receipt_item_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
|
@ -7,6 +7,7 @@ import cn.iocoder.yudao.framework.mybatis.core.query.MPJLambdaWrapperX;
|
||||
import cn.iocoder.yudao.module.erp.controller.admin.sale.vo.out.ErpSaleOutPageReqVO;
|
||||
import cn.iocoder.yudao.module.erp.dal.dataobject.sale.ErpSaleOutDO;
|
||||
import cn.iocoder.yudao.module.erp.dal.dataobject.sale.ErpSaleOutItemDO;
|
||||
import cn.iocoder.yudao.module.erp.enums.ErpAuditStatus;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@ -41,7 +42,8 @@ public interface ErpSaleOutMapper extends BaseMapperX<ErpSaleOutDO> {
|
||||
query.apply("t.receipt_price = t.total_price");
|
||||
}
|
||||
if (Boolean.TRUE.equals(reqVO.getReceiptEnable())) {
|
||||
query.apply("t.receipt_price < t.total_price");
|
||||
query.eq(ErpSaleOutDO::getStatus, ErpAuditStatus.APPROVE.getStatus())
|
||||
.apply("t.receipt_price < t.total_price");
|
||||
}
|
||||
if (reqVO.getWarehouseId() != null || reqVO.getProductId() != null) {
|
||||
query.leftJoin(ErpSaleOutItemDO.class, ErpSaleOutItemDO::getOutId, ErpSaleOutDO::getId)
|
||||
|
@ -5,8 +5,10 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.MPJLambdaWrapperX;
|
||||
import cn.iocoder.yudao.module.erp.controller.admin.sale.vo.returns.ErpSaleReturnPageReqVO;
|
||||
import cn.iocoder.yudao.module.erp.dal.dataobject.sale.ErpSaleOutDO;
|
||||
import cn.iocoder.yudao.module.erp.dal.dataobject.sale.ErpSaleReturnDO;
|
||||
import cn.iocoder.yudao.module.erp.dal.dataobject.sale.ErpSaleReturnItemDO;
|
||||
import cn.iocoder.yudao.module.erp.enums.ErpAuditStatus;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@ -41,7 +43,8 @@ public interface ErpSaleReturnMapper extends BaseMapperX<ErpSaleReturnDO> {
|
||||
query.apply("t.refund_price = t.total_price");
|
||||
}
|
||||
if (Boolean.TRUE.equals(reqVO.getRefundEnable())) {
|
||||
query.apply("t.refund_price < t.total_price");
|
||||
query.eq(ErpSaleOutDO::getStatus, ErpAuditStatus.APPROVE.getStatus())
|
||||
.apply("t.refund_price < t.total_price");
|
||||
}
|
||||
if (reqVO.getWarehouseId() != null || reqVO.getProductId() != null) {
|
||||
query.leftJoin(ErpSaleReturnItemDO.class, ErpSaleReturnItemDO::getReturnId, ErpSaleReturnDO::getId)
|
||||
|
@ -96,6 +96,9 @@ public class ErpFinancePaymentServiceImpl implements ErpFinancePaymentService {
|
||||
// 2.2 插入付款单项
|
||||
paymentItems.forEach(o -> o.setPaymentId(payment.getId()));
|
||||
financePaymentItemMapper.insertBatch(paymentItems);
|
||||
|
||||
// 3. 更新采购入库、退货的付款金额情况
|
||||
updatePurchasePrice(paymentItems);
|
||||
return payment.getId();
|
||||
}
|
||||
|
||||
@ -127,9 +130,6 @@ public class ErpFinancePaymentServiceImpl implements ErpFinancePaymentService {
|
||||
financePaymentMapper.updateById(updateObj);
|
||||
// 2.2 更新付款单项
|
||||
updateFinancePaymentItemList(updateReqVO.getId(), paymentItems);
|
||||
|
||||
// 3. 更新采购入库、退货的付款金额情况
|
||||
updatePurchasePrice(paymentItems);
|
||||
}
|
||||
|
||||
private void calculateTotalPrice(ErpFinancePaymentDO payment, List<ErpFinancePaymentItemDO> paymentItems) {
|
||||
|
@ -96,6 +96,9 @@ public class ErpFinanceReceiptServiceImpl implements ErpFinanceReceiptService {
|
||||
// 2.2 插入收款单项
|
||||
receiptItems.forEach(o -> o.setReceiptId(receipt.getId()));
|
||||
financeReceiptItemMapper.insertBatch(receiptItems);
|
||||
|
||||
// 3. 更新销售出库、退货的收款金额情况
|
||||
updateSalePrice(receiptItems);
|
||||
return receipt.getId();
|
||||
}
|
||||
|
||||
@ -127,9 +130,6 @@ public class ErpFinanceReceiptServiceImpl implements ErpFinanceReceiptService {
|
||||
financeReceiptMapper.updateById(updateObj);
|
||||
// 2.2 更新收款单项
|
||||
updateFinanceReceiptItemList(updateReqVO.getId(), receiptItems);
|
||||
|
||||
// 3. 更新销售出库、退货的收款金额情况
|
||||
updateSalePrice(receiptItems);
|
||||
}
|
||||
|
||||
private void calculateTotalPrice(ErpFinanceReceiptDO receipt, List<ErpFinanceReceiptItemDO> receiptItems) {
|
||||
|
@ -286,7 +286,7 @@ public class ErpSaleOutServiceImpl implements ErpSaleOutService {
|
||||
|
||||
@Override
|
||||
public ErpSaleOutDO validateSaleOut(Long id) {
|
||||
ErpSaleOutDO saleOut = validateSaleOut(id);
|
||||
ErpSaleOutDO saleOut = validateSaleOutExists(id);
|
||||
if (ObjectUtil.notEqual(saleOut.getStatus(), ErpAuditStatus.APPROVE.getStatus())) {
|
||||
throw exception(SALE_OUT_NOT_APPROVE);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user