package com.vverp.entity; import com.fasterxml.jackson.annotation.JsonIgnore; import com.vverp.annotation.Module; import com.vverp.base.Setting; import javax.persistence.*; import java.math.BigDecimal; import java.util.ArrayList; import java.util.Date; import java.util.List; /** * @author dealsky * @date 2020/2/21 4:09 下午 */ @Entity @Table(name = "t_purchase_stock") @SequenceGenerator(name = "sequenceGenerator", sequenceName = "seq_purchase_stock") @Module(generate = false, name = "采购入库单") public class PurchaseStock extends OrderBase { /** * 订单项 */ private List purchaseStockItemList = new ArrayList<>(); /** * 采购订单id(按单入库) */ private Long purchaseOrderId; /** * 采购订单编号(按单入库) */ private String purchaseOrderSn; /** * 提货地 */ private String provenance; /** * 交货地 */ private String destination; /** * 物流状态 */ private Boolean logisticsState; /** * 仓库状态 */ private Boolean warehouseState; /** * 品质状态 */ private Boolean qualityState; /**项目名称*/ private String progressName; /**供货商联系人*/ private String supplierName; /**供货商联系方式*/ private String supplierPhone; /**供货商邮箱*/ private String supplierEmail; /**发货日期*/ private Date sendDate; /**预计到货日期*/ private Date preDate; /**运输车辆车牌号*/ private String carNo; /**司机姓名或电话*/ private String driverNamePhone; /** 到货日期:入库核对时设置,导出入库单使用 */ private Date arrivedDate; private Long progressId; public Long getProgressId() { return progressId; } public void setProgressId(Long progressId) { this.progressId = progressId; } public String getSupplierEmail() { return supplierEmail; } public void setSupplierEmail(String supplierEmail) { this.supplierEmail = supplierEmail; } public String getSupplierName() { return supplierName; } public void setSupplierName(String supplierName) { this.supplierName = supplierName; } public String getProgressName() { return progressName; } public void setProgressName(String progressName) { this.progressName = progressName; } public String getSupplierPhone() { return supplierPhone; } public void setSupplierPhone(String supplierPhone) { this.supplierPhone = supplierPhone; } public Date getSendDate() { return sendDate; } public void setSendDate(Date sendDate) { this.sendDate = sendDate; } public Date getPreDate() { return preDate; } public void setPreDate(Date preDate) { this.preDate = preDate; } public String getCarNo() { return carNo; } public void setCarNo(String carNo) { this.carNo = carNo; } public String getDriverNamePhone() { return driverNamePhone; } public void setDriverNamePhone(String driverNamePhone) { this.driverNamePhone = driverNamePhone; } @JsonIgnore @OneToMany(mappedBy = "purchaseStock", cascade = CascadeType.REMOVE) public List getPurchaseStockItemList() { return purchaseStockItemList; } public void setPurchaseStockItemList(List purchaseStockItemList) { this.purchaseStockItemList = purchaseStockItemList; } public Long getPurchaseOrderId() { return purchaseOrderId; } public void setPurchaseOrderId(Long purchaseOrderId) { this.purchaseOrderId = purchaseOrderId; } public String getPurchaseOrderSn() { return purchaseOrderSn; } public void setPurchaseOrderSn(String purchaseOrderSn) { this.purchaseOrderSn = purchaseOrderSn; } public String getProvenance() { return provenance; } public void setProvenance(String provenance) { this.provenance = provenance; } public String getDestination() { return destination; } public void setDestination(String destination) { this.destination = destination; } public Boolean getLogisticsState() { return logisticsState != null ? logisticsState : false; } public void setLogisticsState(Boolean logisticsState) { this.logisticsState = logisticsState; } public Boolean getWarehouseState() { return warehouseState != null ? warehouseState : false; } public void setWarehouseState(Boolean warehouseState) { this.warehouseState = warehouseState; } public Boolean getQualityState() { return qualityState != null ? qualityState : false; } public void setQualityState(Boolean qualityState) { this.qualityState = qualityState; } public Date getArrivedDate() { return arrivedDate; } public void setArrivedDate(Date arrivedDate) { this.arrivedDate = arrivedDate; } @Transient public BigDecimal getTotalCount() { BigDecimal totalCount = super.getTotalCount(); if (totalCount == null) { totalCount = BigDecimal.ZERO; for (PurchaseStockItem item : getPurchaseStockItemList()) { totalCount = totalCount.add(item.getCount()); } super.setTotalCount(totalCount); } return super.getTotalCount(); } }