#
Junjie
2024-03-27 4a7f884100b5583b1fe1fbe3d9e5f2c5ace7b624
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/entity/Motion.java
@@ -3,6 +3,10 @@
import java.text.SimpleDateFormat;
import java.util.Date;
import com.zy.asrs.wcs.core.BuildSupport;
import com.zy.asrs.wcs.core.entity.DeviceCtg;
import com.zy.asrs.wcs.core.model.enums.MotionStsType;
import com.zy.asrs.wcs.core.service.DeviceCtgService;
import com.zy.asrs.wcs.rcs.service.DeviceTypeService;
import com.zy.asrs.wcs.rcs.service.MotionCtgService;
import com.zy.asrs.wcs.rcs.service.MotionStsService;
@@ -101,7 +105,7 @@
     * 设备类型
     */
    @ApiModelProperty(value= "设备类型")
    private Long deviceType;
    private Long deviceCtg;
    /**
     * 设备
@@ -238,7 +242,7 @@
    public Motion() {}
    public Motion(String uuid,Integer wrkNo,String serialNo,String title,Integer priority,Integer sync,Long motionCtg,Long motionSts,Long deviceType,String device,String origin,Integer oriDrt,String target,Integer tarDrt,String dockNo,Date ioTime,Date startTime,Date endTime,Date errTime,Long errCode,String errDesc,String temp,Integer status,Long createBy,Date createTime,Long updateBy,Date updateTime,String memo,Integer deleted,Long hostId) {
    public Motion(String uuid,Integer wrkNo,String serialNo,String title,Integer priority,Integer sync,Long motionCtg,Long motionSts,Long deviceCtg,String device,String origin,Integer oriDrt,String target,Integer tarDrt,String dockNo,Date ioTime,Date startTime,Date endTime,Date errTime,Long errCode,String errDesc,String temp,Integer status,Long createBy,Date createTime,Long updateBy,Date updateTime,String memo,Integer deleted,Long hostId) {
        this.uuid = uuid;
        this.wrkNo = wrkNo;
        this.serialNo = serialNo;
@@ -247,7 +251,7 @@
        this.sync = sync;
        this.motionCtg = motionCtg;
        this.motionSts = motionSts;
        this.deviceType = deviceType;
        this.deviceCtg = deviceCtg;
        this.device = device;
        this.origin = origin;
        this.oriDrt = oriDrt;
@@ -269,6 +273,25 @@
        this.memo = memo;
        this.deleted = deleted;
        this.hostId = hostId;
    }
    public static Motion build(BuildSupport<Motion> support) {
        Motion motion = new Motion();
        Date date = new Date();
        support.execute(motion);
        if (null == motion.getSync()) {
            motion.setSync(1);
        }
        if (null == motion.getMotionSts()) {
            motion.setMotionSts(MotionStsType.INIT.val());
        }
        motion.setStatus(1);
        motion.setCreateTime(date);
        motion.setUpdateTime(date);
        return motion;
    }
//    Motion motion = new Motion(
@@ -335,10 +358,10 @@
    }
    public String getDeviceType$(){
        DeviceTypeService service = SpringUtils.getBean(DeviceTypeService.class);
        DeviceType deviceType = service.getById(this.deviceType);
        if (!Cools.isEmpty(deviceType)){
            return String.valueOf(deviceType.getName());
        DeviceCtgService service = SpringUtils.getBean(DeviceCtgService.class);
        DeviceCtg deviceCtg = service.getById(this.deviceCtg);
        if (!Cools.isEmpty(deviceCtg)){
            return String.valueOf(deviceCtg.getName());
        }
        return null;
    }
@@ -436,5 +459,27 @@
        return null;
    }
    public String getMotionCtgEl(){
        MotionCtgService service = SpringUtils.getBean(MotionCtgService.class);
        MotionCtg entity = service.getById(this.motionCtg);
        if (!Cools.isEmpty(entity)){
            return String.valueOf(entity.getFlag());
        }
        return null;
    }
    public String generateFlag() {
        return this.getUuid() + "【" + this.getPriority() + " - " + this.getMotionCtg$() + "】";
    }
    public String getDeviceCtgEl(){
        DeviceCtgService service = SpringUtils.getBean(DeviceCtgService.class);
        DeviceCtg entity = service.getById(this.deviceCtg);
        if (!Cools.isEmpty(entity)){
            return String.valueOf(entity.getFlag());
        }
        return null;
    }
}