package com.vincent.rsf.server.manager.entity; 
 | 
  
 | 
import java.text.SimpleDateFormat; 
 | 
import java.util.*; 
 | 
  
 | 
import com.alibaba.fastjson.JSONArray; 
 | 
import com.alibaba.fastjson.JSONObject; 
 | 
import com.baomidou.mybatisplus.annotation.*; 
 | 
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 
 | 
import com.vincent.rsf.server.manager.enums.StationTypeEnum; 
 | 
import com.vincent.rsf.server.manager.service.WarehouseAreasService; 
 | 
import com.vincent.rsf.server.system.entity.DictData; 
 | 
import com.vincent.rsf.server.system.service.DictDataService; 
 | 
import com.vincent.rsf.server.system.service.DictTypeService; 
 | 
import org.springframework.format.annotation.DateTimeFormat; 
 | 
import java.text.SimpleDateFormat; 
 | 
import java.util.Date; 
 | 
  
 | 
import io.swagger.annotations.ApiModel; 
 | 
import io.swagger.annotations.ApiModelProperty; 
 | 
import lombok.Data; 
 | 
import com.vincent.rsf.framework.common.Cools; 
 | 
import com.vincent.rsf.framework.common.SpringUtils; 
 | 
import com.vincent.rsf.server.system.service.UserService; 
 | 
import com.vincent.rsf.server.system.entity.User; 
 | 
import java.io.Serializable; 
 | 
import java.util.Date; 
 | 
import java.util.stream.Collectors; 
 | 
  
 | 
@Data 
 | 
@TableName("man_bas_station") 
 | 
public class BasStation implements Serializable { 
 | 
  
 | 
    private static final long serialVersionUID = 1L; 
 | 
  
 | 
    /** 
 | 
     * id 
 | 
     */ 
 | 
    @ApiModelProperty(value= "id") 
 | 
    @TableId(value = "id", type = IdType.AUTO) 
 | 
    private Long id; 
 | 
  
 | 
    /** 
 | 
     * 站点名称 
 | 
     */ 
 | 
    @ApiModelProperty(value= "站点名称") 
 | 
    private String stationName; 
 | 
  
 | 
    @ApiModelProperty("站点类型: {0:光电, 1:无光电}") 
 | 
    private Integer type; 
 | 
  
 | 
    /** 
 | 
     * 可入 
 | 
     */ 
 | 
    @ApiModelProperty(value= "可入") 
 | 
    private Integer inAble = 0; 
 | 
  
 | 
    /** 
 | 
     * 可出 
 | 
     */ 
 | 
    @ApiModelProperty(value= "可出") 
 | 
    private Integer outAble = 0; 
 | 
  
 | 
    /** 
 | 
     * 状态 
 | 
     */ 
 | 
    @ApiModelProperty(value= "状态") 
 | 
    private String useStatus; 
 | 
  
 | 
    /** 
 | 
     * 所属库区id 
 | 
     */ 
 | 
    @ApiModelProperty(value= "所属库区id") 
 | 
    private Long area; 
 | 
  
 | 
    /** 
 | 
     * 是否可跨区 
 | 
     */ 
 | 
    @ApiModelProperty(value= "是否可跨区") 
 | 
    private Integer isCrossZone = 0; 
 | 
  
 | 
    /** 
 | 
     * 可跨区区域id 
 | 
     */ 
 | 
    @ApiModelProperty(value= "可跨区区域id") 
 | 
    private String crossZoneArea; 
 | 
  
 | 
    /** 
 | 
     * 是否wcs站点 
 | 
     */ 
 | 
    @ApiModelProperty(value= "是否wcs站点") 
 | 
    private Integer isWcs = 0; 
 | 
  
 | 
    /** 
 | 
     * wcs站点信息 
 | 
     */ 
 | 
    @ApiModelProperty(value= "wcs站点信息") 
 | 
    private String wcsData; 
 | 
  
 | 
    /** 
 | 
     * 容器类型 
 | 
     */ 
 | 
    @ApiModelProperty(value= "容器类型") 
 | 
    private String containerType; 
 | 
  
 | 
    /** 
 | 
     * 条码 
 | 
     */ 
 | 
    @ApiModelProperty(value= "条码") 
 | 
    @TableField(updateStrategy = FieldStrategy.IGNORED) 
 | 
    private String barcode; 
 | 
  
 | 
    /** 
 | 
     * 是否自动调拨 
 | 
     */ 
 | 
    @ApiModelProperty(value= "是否自动调拨") 
 | 
    private Integer autoTransfer; 
 | 
  
 | 
    /** 
 | 
     * 备注 
 | 
     */ 
 | 
    @ApiModelProperty(value= "备注") 
 | 
    private String memo; 
 | 
  
 | 
    @ApiModelProperty(value= "是否删除 1: 是  0: 否  ") 
 | 
    @TableLogic 
 | 
    private Integer deleted; 
 | 
  
 | 
    /** 
 | 
     * 创建人 
 | 
     */ 
 | 
    @ApiModelProperty(value= "创建人") 
 | 
    private Long createBy; 
 | 
  
 | 
    /** 
 | 
     * 创建时间 
 | 
     */ 
 | 
    @ApiModelProperty(value= "创建时间") 
 | 
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") 
 | 
    private Date createTime; 
 | 
  
 | 
    /** 
 | 
     * 更新人 
 | 
     */ 
 | 
    @ApiModelProperty(value= "更新人") 
 | 
    private Long updateBy; 
 | 
  
 | 
    /** 
 | 
     * 更新时间 
 | 
     */ 
 | 
    @ApiModelProperty(value= "更新时间") 
 | 
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") 
 | 
    private Date updateTime; 
 | 
  
 | 
    @ApiModelProperty(value= "状态") 
 | 
    private Integer status; 
 | 
  
 | 
    /** 
 | 
     * 所属机构 
 | 
     */ 
 | 
    @ApiModelProperty(value= "租户") 
 | 
    private Long tenantId; 
 | 
  
 | 
    @TableField(exist = false) 
 | 
    private List<Long> areaIds; 
 | 
  
 | 
    @TableField(exist = false) 
 | 
    private List<Long> containerTypes; 
 | 
  
 | 
    public BasStation() {} 
 | 
  
 | 
    public String getType$() { 
 | 
        if (this.type == null) return null; 
 | 
        return StationTypeEnum.getStationDesc(this.type); 
 | 
    } 
 | 
  
 | 
    public List<Long> getContainerTypes$(){ 
 | 
        if (Cools.isEmpty(this.containerType)){ 
 | 
            return new ArrayList<>(); 
 | 
        } 
 | 
        DictDataService service = SpringUtils.getBean(DictDataService.class); 
 | 
  
 | 
        Object parse = JSONArray.parse(this.getContainerType()); 
 | 
        List<Long> longs1 = JSONObject.parseArray(parse.toString(), Long.class); 
 | 
        List<DictData> dictData = service.list(new LambdaQueryWrapper<DictData>() 
 | 
                .eq(DictData::getDictTypeCode, "sys_container_type") 
 | 
                .in(DictData::getValue, longs1) 
 | 
        ); 
 | 
        List<Long> longs = dictData.stream().map(DictData::getId).collect(Collectors.toList()); 
 | 
        return longs; 
 | 
    } 
 | 
  
 | 
    public String getCreateTime$(){ 
 | 
        if (Cools.isEmpty(this.createTime)){ 
 | 
            return ""; 
 | 
        } 
 | 
        return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.createTime); 
 | 
    } 
 | 
  
 | 
    public String getUpdateTime$(){ 
 | 
        if (Cools.isEmpty(this.updateTime)){ 
 | 
            return ""; 
 | 
        } 
 | 
        return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.updateTime); 
 | 
    } 
 | 
  
 | 
    public String getUseStatus$(){ 
 | 
        if (Cools.isEmpty(this.useStatus)){ 
 | 
            return ""; 
 | 
        } 
 | 
        DictDataService service = SpringUtils.getBean(DictDataService.class); 
 | 
        DictData dictData = service.getOne(new LambdaQueryWrapper<DictData>() 
 | 
                .eq(DictData::getDictTypeCode, "sys_sta_use_stas") 
 | 
                .eq(DictData::getValue, this.useStatus) 
 | 
        ); 
 | 
        if (!Cools.isEmpty(dictData)){ 
 | 
            return String.valueOf(dictData.getLabel()); 
 | 
        } 
 | 
        return ""; 
 | 
    } 
 | 
  
 | 
  
 | 
  
 | 
    public String getArea$(){ 
 | 
        if (null == this.area){ return null; } 
 | 
        WarehouseAreasService service = SpringUtils.getBean(WarehouseAreasService.class); 
 | 
        WarehouseAreas warehouseAreas = service.getById(this.area); 
 | 
        if (!Cools.isEmpty(warehouseAreas)){ 
 | 
            return String.valueOf(warehouseAreas.getName()); 
 | 
        } 
 | 
        return null; 
 | 
    } 
 | 
  
 | 
  
 | 
    public Boolean getStatusBool(){ 
 | 
        if (null == this.status){ return null; } 
 | 
        switch (this.status){ 
 | 
            case 1: 
 | 
                return true; 
 | 
            case 0: 
 | 
                return false; 
 | 
            default: 
 | 
                return null; 
 | 
        } 
 | 
    } 
 | 
} 
 |