package com.zfire.mall.manager.bean.engin.deposit;

import com.zfire.mall.manager.plus.entity.*;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.math.BigDecimal;

@EqualsAndHashCode(callSuper = true)
@Data
public class DepositManageRecordBean extends DepositManageRecord {

    private EnginOrderItem orderItem;

    public void handleEnginOrderItem(EnginOrder enginOrder, EnginOrderItem orderItem, Integer depositQty, BigDecimal subDepositAmount) {
        this.setRefEnginRecordNo(enginOrder.getRefEnginRecordNo())
                .setOrderNo(enginOrder.getEnginOrderNo())
                .setOrderDate(enginOrder.getOrderDate())
                .setOrderType(enginOrder.getEnginOrderType())
                .setSaleTypeId(orderItem.getSaleTypeId())
                .setSaleTypeCode(orderItem.getSaleTypeCode())
                .setSaleTypeName(orderItem.getSaleTypeName())
                .setMaterialId(orderItem.getMaterialId())
                .setMaterialNumber(orderItem.getMaterialNumber())
                .setMaterialOldNumber(orderItem.getMaterialOldNumber())
                .setMaterialName(orderItem.getMaterialName())
                .setSpecification(orderItem.getSpecification())
                .setUnit(orderItem.getUnit())
                .setPrice(orderItem.getPrice())
                .setQty(depositQty)
                .setDepositRate(orderItem.getDepositRate())
                .setSingleDepositAmount(orderItem.getSingleDepositAmount())
                .setDepositAmount(subDepositAmount)
                .setCustomerWalletId(orderItem.getCustomerWalletId())
                .setCustomerWalletName(orderItem.getCustomerWalletName())
                .setRemark(orderItem.getRemark())
                .setRealMaterialId(orderItem.getRealMaterialId())
                .setRealMaterialName(orderItem.getRealMaterialName())
                .setRealMaterialNumber(orderItem.getRealMaterialNumber())
                .setRealMaterialOldNumber(orderItem.getRealMaterialOldNumber())
                .setRealSpecification(orderItem.getRealSpecification());
    }

    public void handleEnginOrderItem(DisplaceOrder enginOrder, DisplaceOrderItem orderItem, Integer depositQty, BigDecimal subDepositAmount) {
        this.setRefEnginRecordNo(enginOrder.getEnginRecordNo())
                .setOrderNo(enginOrder.getOrderNo())
                .setOrderDate(enginOrder.getOrderDate())
                .setOrderType(enginOrder.getOrderType())
                .setSaleTypeId(orderItem.getSaleTypeId())
                .setSaleTypeCode(orderItem.getSaleTypeCode())
                .setSaleTypeName(orderItem.getSaleTypeName())
                .setMaterialId(orderItem.getMaterialId())
                .setMaterialNumber(orderItem.getMaterialNumber())
                .setMaterialOldNumber(orderItem.getMaterialOldNumber())
                .setMaterialName(orderItem.getMaterialName())
                .setSpecification(orderItem.getSpecification())
                .setUnit(orderItem.getUnit())
                .setPrice(orderItem.getPrice())
                .setQty(depositQty)
                .setDepositRate(orderItem.getDepositRate())
                .setSingleDepositAmount(orderItem.getSingleDepositAmount())
                .setDepositAmount(subDepositAmount)
                .setCustomerWalletId(orderItem.getCustomerWalletId())
                .setCustomerWalletName(orderItem.getCustomerWalletName())
                .setRemark(orderItem.getRemark());
    }
}
