package doumeemes.dao.ext.bean;
|
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
import doumeemes.core.annotation.excel.ExcelColumn;
|
import doumeemes.dao.business.model.Bom;
|
import doumeemes.dao.business.model.BomDetail;
|
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModelProperty;
|
import lombok.Data;
|
|
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotEmpty;
|
import javax.validation.constraints.NotNull;
|
import java.util.ArrayList;
|
import java.util.Date;
|
import java.util.List;
|
|
@Data
|
@ApiModel("物料清单信息表 - 编辑or保存")
|
public class BomBean {
|
|
@ApiModelProperty(value = "主键", example = "1")
|
private Integer id;
|
|
@ApiModelProperty(value = "工厂主键(关联department表)")
|
private Integer departId;
|
|
@ApiModelProperty(value = "物料ID")
|
@NotNull( message = "物料ID不能为空")
|
private Integer materialId;
|
|
@ApiModelProperty(value = "单位编码")
|
@NotNull( message = "单位编码不能为空")
|
private Integer unitId;
|
|
@ApiModelProperty(value = "工艺路线编码")
|
@NotNull( message = "工艺路线编码不能为空")
|
private Integer routeId;
|
|
@ApiModelProperty(value = "工序编码")
|
@NotNull( message = "工序编码不能为空")
|
private Integer procedureId;
|
|
@ApiModelProperty(value = "图纸编号" )
|
private String papercode;
|
|
@ApiModelProperty(value = "模具编号" )
|
private String mjcode;
|
|
@ApiModelProperty(value = "喂料体系" )
|
private String wltx;
|
|
@ApiModelProperty(value = "收缩比" )
|
private String rate;
|
|
@ApiModelProperty(value = "投料方式 0推式 1拉式" )
|
private Integer type;
|
|
@ApiModelProperty(value = "Bom列表明细" )
|
@NotEmpty(message = "Bom列表明细不能为空")
|
private List<BomDetailBean> bomDetailBeanList;
|
|
public Bom toBom(Bom bom){
|
bom.setId(this.getId());
|
bom.setDepartId(this.getDepartId());
|
bom.setMaterialId(this.getMaterialId());
|
bom.setUnitId(this.getUnitId());
|
bom.setRouteId(this.getRouteId());
|
bom.setProcedureId(this.getProcedureId());
|
bom.setPapercode(this.getPapercode());
|
bom.setMjcode(this.getMjcode());
|
bom.setWltx(this.getWltx());
|
bom.setRate(this.getRate());
|
bom.setType(this.getType());
|
return bom;
|
}
|
|
public List<BomDetail> toBomDetail(){
|
List<BomDetail> bomDetails = new ArrayList<>();
|
for (BomDetailBean bomDetailBean:this.getBomDetailBeanList()) {
|
BomDetail bomDetail = new BomDetail();
|
bomDetail.setDeleted(0);
|
bomDetail.setCreateTime(new Date());
|
bomDetail.setMaterialId(bomDetailBean.getMaterialId());
|
bomDetail.setUnitId(bomDetailBean.getUnitId());
|
bomDetail.setNum(bomDetailBean.getNum());
|
bomDetails.add(bomDetail);
|
}
|
return bomDetails;
|
}
|
|
}
|