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 wStockExtListVOList; @ApiModelProperty(value = "备料入库业务信息 入库记录数据") @TableField(exist = false) private List 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; } }