jiangping
2023-08-17 6365ab0a976afdd247742c9b3dca15deb3a7a7a1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
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;
    }
 
}