jiangping
2023-08-18 5dfbc4af25ab4f5e8d75f99c6e889b5004a49ef0
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
package doumeemes.dao.business.model;
 
import com.baomidou.mybatisplus.annotation.TableField;
import doumeemes.core.annotation.excel.ExcelColumn;
import doumeemes.core.model.LoginUserInfo;
import doumeemes.core.utils.Constants;
import doumeemes.dao.ext.vo.WStockExtListVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
 
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Objects;
 
/**
 * 仓库管理-出入库单明细表
 * @author 江蹄蹄
 * @date 2022/04/20 09:37
 */
@Data
@ApiModel("仓库管理-出入库单明细表")
@TableName("`w_outbound_detail`")
public class WOutboundDetail implements Serializable {
     @TableId(value = "id",type = IdType.AUTO)
    @ApiModelProperty(value = "主键", example = "1")
    @ExcelColumn(name="主键")
    private Integer id;
 
    @ApiModelProperty(value = "是否已删除 0未删除 1已删除", example = "1")
    @ExcelColumn(name="是否已删除 0未删除 1已删除")
    private Integer deleted;
 
    @ApiModelProperty(value = "创建人编码", example = "1")
    @ExcelColumn(name="创建人编码")
    private Integer createUser;
 
    @ApiModelProperty(value = "创建时间")
    @ExcelColumn(name="创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date createTime;
 
    @ApiModelProperty(value = "更新人编码", example = "1")
    @ExcelColumn(name="更新人编码")
    private Integer updateUser;
 
    @ApiModelProperty(value = "更新时间")
    @ExcelColumn(name="更新时间")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date updateTime;
 
    @ApiModelProperty(value = "备注")
    @ExcelColumn(name="备注")
    private String remark;
 
    @ApiModelProperty(value = "主组织编码(关联department表根组织)", example = "1")
    @ExcelColumn(name="主组织编码(关联department表根组织)")
    private Integer rootDepartId;
 
    @ApiModelProperty(value = "出入库单编码(关联w_outbound表)", example = "1")
    @ExcelColumn(name="出入库单编码(关联w_outbound表)")
    private Integer outboundId;
 
    @ApiModelProperty(value = "物料编码(关联material_distribute表)", example = "1")
    @ExcelColumn(name="物料编码(关联material_distribute表)")
    private Integer materialId;
 
    @ApiModelProperty(value = "单位编码(关联unit_distribute表)", example = "1")
    @ExcelColumn(name="单位编码(关联unit_distribute表)")
    private Integer unitId;
 
    @ApiModelProperty(value = "批次号")
    @ExcelColumn(name="批次号")
    private String batch;
 
    @ApiModelProperty(value = "数量", example = "1")
    @ExcelColumn(name="数量")
    private BigDecimal num;
 
    @ApiModelProperty(value = "处理完成日期")
    @ExcelColumn(name="处理完成日期")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date doneDate;
 
    @ApiModelProperty(value = "已处理数量", example = "1")
    @ExcelColumn(name="已处理数量")
    private BigDecimal doneNum;
 
    @ApiModelProperty(value = "仓库编码(关联warehouse表)", example = "1")
    @ExcelColumn(name="仓库编码(关联warehouse表)")
    private Integer warehouseId;
 
    @ApiModelProperty(value = "仓位编码(关联warehouse表)", example = "1")
    @ExcelColumn(name="仓位编码(关联warehouse表)")
    private Integer locationId;
 
    @ApiModelProperty(value = "处理状态 0待处理 1已处理", example = "1")
    @ExcelColumn(name="处理状态 0待处理 1已处理")
    private Integer status;
 
 
    @ApiModelProperty(value = "工序编码")
    private Integer  procedureId;
 
    @ApiModelProperty(value = "工序名称")
    @TableField(exist = false)
    private String procedureName;
 
    @ApiModelProperty(value = "产品质量属性 0合格 1不良 2报废")
    private Integer qualityType;
 
    @ApiModelProperty(value = "物料名称")
    @TableField(exist = false)
    private String materialName;
 
    @ApiModelProperty(value = "物料编编号")
    @TableField(exist = false)
    private String materialCode;
 
    @ApiModelProperty(value = "规格描述")
    @TableField(exist = false)
    private String unitName;
 
    @ApiModelProperty(value = "货位名称")
    @TableField(exist = false)
    private String locationName;
 
    @ApiModelProperty(value = "库存信息")
    @TableField(exist = false)
    private List<WStockExtListVO> wStockExtListVOList;
 
    @ApiModelProperty(value = "备料入库业务信息 入库记录数据")
    @TableField(exist = false)
    private List<WOutboundRecord> wOutboundRecordInList;
 
 
    public WOutboundRecord toRecord(Appliances appliances,LoginUserInfo loginUserInfo){
        WOutboundRecord record = new WOutboundRecord();
        record.setCreateTime(new Date());
        record.setCreateUser(loginUserInfo.getId());
        record.setRootDepartId(this.getRootDepartId());
        record.setOutboundId(this.getOutboundId());
        record.setDetailId(this.getId());
        record.setMaterialId(this.getMaterialId());
        record.setUnitId(this.getUnitId());
        record.setBatch(appliances.getBatch());
        record.setNum(appliances.getNum());
        record.setAppliancesId(appliances.getId());
        record.setDeleted(Constants.ZERO);
        record.setWarehouseId(this.getWarehouseId());
        record.setOutboundId(this.getOutboundId());
        record.setQualityType(appliances.getQualityType());
        record.setProcedureId(this.getProcedureId());
        if(!Objects.isNull(this.getLocationId())){
            record.setLocationId(this.getLocationId());
        }
        return record;
    }
 
 
    public WOutboundRecord toRecord(LoginUserInfo loginUserInfo){
        WOutboundRecord record = new WOutboundRecord();
        record.setCreateTime(new Date());
        record.setCreateUser(loginUserInfo.getId());
        record.setRootDepartId(this.getRootDepartId());
        record.setOutboundId(this.getOutboundId());
        record.setDetailId(this.getId());
        record.setMaterialId(this.getMaterialId());
        record.setUnitId(this.getUnitId());
        record.setBatch(this.getBatch());
        record.setNum(this.getDoneNum());
        record.setDeleted(Constants.ZERO);
        record.setWarehouseId(this.getWarehouseId());
        record.setOutboundId(this.getOutboundId());
        record.setQualityType(this.getQualityType());
        record.setProcedureId(this.getProcedureId());
        if(!Objects.isNull(this.getLocationId())){
            record.setLocationId(this.getLocationId());
        }
        return record;
    }
 
 
}