ErpSettlementVO.java 2.7 KB
package com.skua.modules.erp.vo;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableField;
import com.skua.modules.erp.entity.ErpSettlement;
import com.skua.modules.erp.entity.ErpSettlementItem;
import com.skua.tool.util.JSUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;

/**
 * 药剂结算单详情
 */
@Data
@ApiModel(value="erp_settlement数据传输对象", description="药剂结算单详情")
public class ErpSettlementVO  extends ErpSettlement {
	@ApiModelProperty(value = "项目名称")
	private String projectName;

	@ApiModelProperty(value = "供应商名称")
	private String supplierName;

	@ApiModelProperty(value = "部门名称")
	private String departName;

	/*@ApiModelProperty(value = "数量")
	private String materialNum;

	@ApiModelProperty(value = "结算金额")
	private String totalPrice;

	@ApiModelProperty(value = "结算金额-不含税")
	private String totalPriceTax;*/

	@ApiModelProperty(value = "结算清单")
	private List<ErpSettlementItemVO> itemList ;

	@ApiModelProperty(value = "物料结算记录")
	private List<SparepartSettlementVO> sparepartSettlementList ;

	/***
	 * 计算总数、总价、价税合计
	 */
	public void calculatePrice(){
		String materialNumExpression = "0";
		String totalPriceExpression = "0";
		String totalPriceTaxExpression ="0";
		if(itemList != null && !itemList.isEmpty()){
			for(ErpSettlementItemVO settlementItemVO : itemList){
				materialNumExpression = materialNumExpression + "+" +settlementItemVO.getMaterialNum();
				totalPriceExpression = totalPriceExpression + "+" +settlementItemVO.getTotalPrice();
				totalPriceTaxExpression = totalPriceTaxExpression + "+" +settlementItemVO.getTotalPriceTax();
				//totalPriceExpression = totalPriceExpression + "+ (" +settlementItemVO.getUnitPrice() +" * "+settlementItemVO.getMaterialNum()+")";
				//totalPriceTaxExpression = totalPriceTaxExpression + "+ (" +settlementItemVO.getUnitPrice() +" * "+settlementItemVO.getMaterialNum()+" / (1+ "+settlementItemVO.getTaxAmount()+" * 0.01))";
			}
			this.setMaterialNum( JSUtils.executeExpression(materialNumExpression,"0.00"));
			this.setTotalPrice( JSUtils.executeExpression(totalPriceExpression,"0.00"));
			this.setTotalPriceTax( JSUtils.executeExpression(totalPriceTaxExpression,"0.00"));
		}
	}
}