|  |  | 
 |  |  |         <module>zy-acs-gateway</module> | 
 |  |  |         <module>zy-acs-manager</module> | 
 |  |  |         <module>zy-acs-fake</module> | 
 |  |  | <!--        <module>zy-acs-wcs</module>--> | 
 |  |  |     </modules> | 
 |  |  |  | 
 |  |  |     <properties> | 
 
 |  |  | 
 |  |  | import com.zy.acs.framework.common.Cools; | 
 |  |  | import lombok.extern.slf4j.Slf4j; | 
 |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
 |  |  | import org.springframework.scheduling.annotation.Scheduled; | 
 |  |  | import org.springframework.stereotype.Component; | 
 |  |  |  | 
 |  |  | import javax.annotation.PostConstruct; | 
 |  |  | 
 |  |  |         /** | 
 |  |  |          * 1.AgvDataService.dataProcess [ agvDetail: vol, code, agvAngle, agvStatus ] | 
 |  |  |          * 2.MainService.upDataSubscribe | 
 |  |  |          * 3.AgvCmdService.executeRequest {@link com.zy.acs.manager.core.service.AgvCmdService#executeAgvActionCmd} | 
 |  |  |          * 3.AgvCmdService.executeRequest {@link com.zy.acs.wcs.core.service.AgvCmdService#executeAgvActionCmd} | 
 |  |  |          * 4.AgvServiceImpl.judgeOnline | 
 |  |  |          */ | 
 |  |  |         // Simulator | 
 
 |  |  | 
 |  |  |  */ | 
 |  |  | public abstract class AbstractBaseController { | 
 |  |  |  | 
 |  |  |     public <T> List exportSupport(List<T> list, List<String> fields){ | 
 |  |  |         if (Cools.isEmpty(list)){ | 
 |  |  |     public <T> List exportSupport(List<T> list, List<String> fields) { | 
 |  |  |         if (Cools.isEmpty(list)) { | 
 |  |  |             throw new CoolException(BaseRes.EMPTY); | 
 |  |  |         } | 
 |  |  |         try { | 
 |  |  |             List<List<Object>> result = new ArrayList<>(); | 
 |  |  |             Method[] methods = list.get(0).getClass().getMethods(); | 
 |  |  |             for (T t : list){ | 
 |  |  |             for (T t : list) { | 
 |  |  |                 List<Object> node = new ArrayList<>(); | 
 |  |  |                 for (String field : fields){ | 
 |  |  |                 for (String field : fields) { | 
 |  |  |                     for (Method method : methods) { | 
 |  |  |                         if (("get" + field).toLowerCase().equals(method.getName().toLowerCase())) { | 
 |  |  |                             Object val = method.invoke(t); | 
 |  |  | 
 |  |  |                 result.add(node); | 
 |  |  |             } | 
 |  |  |             return result; | 
 |  |  |         } catch (Exception e){ | 
 |  |  |         } catch (Exception e) { | 
 |  |  |             throw new RuntimeException(e); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public static Map<String, Object> excludeTrash(Map<String, Object> map){ | 
 |  |  |         if (Cools.isEmpty(map)){ | 
 |  |  |     public static Map<String, Object> excludeTrash(Map<String, Object> map) { | 
 |  |  |         if (Cools.isEmpty(map)) { | 
 |  |  |             return new HashMap<>(); | 
 |  |  |         } | 
 |  |  |         map.entrySet().removeIf(next -> next.getKey().equals("curr") | 
 |  |  |                 || next.getKey().equals("limit") | 
 |  |  |                 || next.getKey().equals("orderByField") | 
 |  |  |                 || next.getKey().equals("orderByType") | 
 |  |  |                 || next.getKey().equals("condition") | 
 |  |  |                 || Cools.isEmpty(next.getValue())); | 
 |  |  |         map.entrySet().removeIf(next -> next.getKey().equals("curr") || next.getKey().equals("limit") || next.getKey().equals("orderByField") || next.getKey().equals("orderByType") || next.getKey().equals("condition") || Cools.isEmpty(next.getValue())); | 
 |  |  |         return map; | 
 |  |  |     } | 
 |  |  |  | 
 
 |  |  | 
 |  |  | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 
 |  |  | import com.zy.acs.framework.common.Cools; | 
 |  |  | import com.zy.acs.framework.common.R; | 
 |  |  | import com.zy.acs.manager.common.utils.ExcelUtil; | 
 |  |  | import com.zy.acs.manager.common.annotation.OperationLog; | 
 |  |  | import com.zy.acs.manager.common.domain.BaseParam; | 
 |  |  | import com.zy.acs.manager.common.domain.KeyValVo; | 
 |  |  | import com.zy.acs.manager.common.domain.PageParam; | 
 |  |  | import com.zy.acs.wcs.common.utils.ExcelUtil; | 
 |  |  | import com.zy.acs.wcs.common.annotation.OperationLog; | 
 |  |  | import com.zy.acs.wcs.common.domain.BaseParam; | 
 |  |  | import com.zy.acs.wcs.common.domain.KeyValVo; | 
 |  |  | import com.zy.acs.wcs.common.domain.PageParam; | 
 |  |  | import @{COMPANYNAME}.entity.@{ENTITYNAME}; | 
 |  |  | import @{COMPANYNAME}.service.@{ENTITYNAME}Service; | 
 |  |  | import com.zy.acs.manager.system.controller.BaseController; | 
 |  |  | import com.zy.acs.wcs.system.controller.BaseController; | 
 |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
 |  |  | import org.springframework.security.access.prepost.PreAuthorize; | 
 |  |  | import org.springframework.web.bind.annotation.*; | 
 
 |  |  | 
 |  |  | import lombok.Data; | 
 |  |  | import com.zy.acs.framework.common.Cools; | 
 |  |  | import com.zy.acs.framework.common.SpringUtils; | 
 |  |  | import com.zy.acs.manager.system.service.UserService; | 
 |  |  | import com.zy.acs.manager.system.service.HostService; | 
 |  |  | import com.zy.acs.wcs.system.service.UserService; | 
 |  |  | import com.zy.acs.wcs.system.service.HostService; | 
 |  |  |  | 
 |  |  | import java.io.Serializable; | 
 |  |  | import java.util.Date; | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.manager.core.scheduler; | 
 |  |  |  | 
 |  |  | import com.zy.acs.common.utils.RedisSupport; | 
 |  |  | import com.zy.acs.framework.common.SnowflakeIdWorker; | 
 |  |  | import com.zy.acs.manager.core.service.MainLockWrapService; | 
 |  |  | import com.zy.acs.manager.core.service.MainService; | 
 |  |  | import com.zy.acs.manager.core.service.TrafficService; | 
 |  |  | import com.zy.acs.manager.manager.entity.TaskReport; | 
 |  |  | import com.zy.acs.manager.manager.service.*; | 
 |  |  | import com.zy.acs.manager.system.service.ConfigService; | 
 |  |  | import lombok.extern.slf4j.Slf4j; | 
 |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
 |  |  | import org.springframework.scheduling.annotation.Scheduled; | 
 |  |  | import org.springframework.stereotype.Component; | 
 |  |  | import org.springframework.transaction.annotation.Transactional; | 
 |  |  |  | 
 |  |  | import java.util.List; | 
 |  |  |  | 
 |  |  | @Slf4j | 
 |  |  | @Component | 
 |  |  | public class ReportThirdScheduler { | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private TaskReportService taskReportService; | 
 |  |  |  | 
 |  |  |  | 
 |  |  | //    @Scheduled(fixedDelay = 1000) | 
 |  |  |     public void execute() { | 
 |  |  | //        List<TaskReport> list = taskReportService.list(); | 
 |  |  | //        for (TaskReport taskReport : list) { | 
 |  |  | //            report(taskReport); | 
 |  |  | //        } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @Transactional | 
 |  |  |     public void report(TaskReport taskReport) { | 
 |  |  |         //TODO 原先应该调用接口,现在直接修改数据 | 
 |  |  |  | 
 |  |  |     } | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.manager.core.scheduler; | 
 |  |  |  | 
 |  |  | import com.zy.acs.common.constant.RedisConstant; | 
 |  |  | import com.zy.acs.common.enums.AgvStatusType; | 
 |  |  | import com.zy.acs.common.utils.RedisSupport; | 
 |  |  | import com.zy.acs.manager.manager.entity.*; | 
 |  |  | import com.zy.acs.manager.manager.enums.TaskStsType; | 
 |  |  | import com.zy.acs.manager.manager.service.*; | 
 |  |  | import lombok.extern.slf4j.Slf4j; | 
 |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
 |  |  | import org.springframework.scheduling.annotation.Scheduled; | 
 |  |  | import org.springframework.stereotype.Component; | 
 |  |  |  | 
 |  |  | import java.util.Date; | 
 |  |  | import java.util.List; | 
 |  |  |  | 
 |  |  | @Slf4j | 
 |  |  | @Component | 
 |  |  | public class StatisticsScheduler { | 
 |  |  |  | 
 |  |  |     private final RedisSupport redis = RedisSupport.defaultRedisSupport; | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private AgvService agvService; | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private AgvDetailService agvDetailService; | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private TaskService taskService; | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private AgvDurationService agvDurationService; | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private OfflineLogService offlineLogService; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 定时检查AGV是否掉线,并且保存记录 | 
 |  |  |      */ | 
 |  |  |     @Scheduled(cron = "0/5 * * * * ? ") | 
 |  |  |     public void execute() { | 
 |  |  |         List<Agv> list = agvService.list(); | 
 |  |  |         Object object = null; | 
 |  |  |         OfflineLog offlineLog; | 
 |  |  |         for (Agv agv : list) { | 
 |  |  |             if (agv.getStatus() == 1) { | 
 |  |  |                 object = redis.getObject(RedisConstant.AGV_ONLINE_FLAG, agv.getUuid()); | 
 |  |  |                 if (object == null) { | 
 |  |  |                     offlineLog = offlineLogService.getTopOfflineLog(agv.getId()); | 
 |  |  |                     if (offlineLog == null) { | 
 |  |  |                         offlineLog = new OfflineLog(); | 
 |  |  |                         offlineLog.setAgvId(agv.getId()); | 
 |  |  |                         offlineLog.setHappenTime(new Date()); | 
 |  |  |                         offlineLogService.save(offlineLog); | 
 |  |  |                     } | 
 |  |  |                 } else { | 
 |  |  |                     offlineLog = offlineLogService.getTopOfflineLog(agv.getId()); | 
 |  |  |                     if (offlineLog != null) { | 
 |  |  |                         offlineLog.setResetTime(new Date()); | 
 |  |  |                         offlineLog.setDuration(offlineLog.getResetTime().getTime() - offlineLog.getHappenTime().getTime()); | 
 |  |  |                         offlineLogService.updateById(offlineLog); | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @Scheduled(cron = "0/5 * * * * ? ") | 
 |  |  |     public void execute2() { | 
 |  |  |         List<AgvDuration> agvDurations = agvDurationService.listUnFinish(); | 
 |  |  |         for (AgvDuration agvDuration : agvDurations) { | 
 |  |  |             Task task = taskService.getById(agvDuration.getTaskNo()); | 
 |  |  |             if (task.getTaskSts() == TaskStsType.COMPLETE.val()) { | 
 |  |  |                 AgvDetail agvDetail = agvDetailService.selectByAgvId(agvDuration.getAgvId()); | 
 |  |  |                 if (agvDetail.getAgvStatus() != AgvStatusType.CHARGE) { | 
 |  |  |                     agvDuration.setResetTime(new Date()); | 
 |  |  |                     agvDuration.setDuration(agvDuration.getResetTime().getTime() - agvDuration.getHappenTime().getTime()); | 
 |  |  |                     agvDurationService.updateById(agvDuration); | 
 |  |  |                 } | 
 |  |  |             } else if (task.getTaskSts() == TaskStsType.CANCEL.val()) { | 
 |  |  |                 agvDurationService.removeById(agvDuration.getId()); | 
 |  |  |             } else { | 
 |  |  |  | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.manager.manager.entity; | 
 |  |  |  | 
 |  |  | import com.baomidou.mybatisplus.annotation.IdType; | 
 |  |  | import com.baomidou.mybatisplus.annotation.TableId; | 
 |  |  | import com.baomidou.mybatisplus.annotation.TableName; | 
 |  |  | import com.zy.acs.framework.common.Cools; | 
 |  |  | import com.zy.acs.framework.common.SpringUtils; | 
 |  |  | import com.zy.acs.manager.manager.service.AgvService; | 
 |  |  | import io.swagger.annotations.ApiModelProperty; | 
 |  |  | import lombok.Data; | 
 |  |  |  | 
 |  |  | import java.io.Serializable; | 
 |  |  | import java.util.Date; | 
 |  |  |  | 
 |  |  | @Data | 
 |  |  | @TableName("man_agv_duration") | 
 |  |  | public class AgvDuration implements Serializable { | 
 |  |  |  | 
 |  |  |     private static final long serialVersionUID = 1L; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * ID | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "ID") | 
 |  |  |     @TableId(value = "id", type = IdType.AUTO) | 
 |  |  |     private Long id; | 
 |  |  |     /** | 
 |  |  |      * 任务号 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "任务号") | 
 |  |  |     private Long taskNo; | 
 |  |  |     /** | 
 |  |  |      * 类型 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "类型,1充电") | 
 |  |  |     private Integer type; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 车辆 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "车辆") | 
 |  |  |     private Long agvId; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 发生时间 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "发生时间") | 
 |  |  |     private Date happenTime; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 恢复时间 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "恢复时间") | 
 |  |  |     private Date resetTime; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 持续时间 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "持续时间") | 
 |  |  |     private Long duration; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 状态 1: 正常  0: 冻结 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "状态 1: 正常  0: 冻结  ") | 
 |  |  |     private Integer status; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 是否删除 1: 是  0: 否 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "是否删除 1: 是  0: 否  ") | 
 |  |  |     private Integer deleted; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 租户 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "租户") | 
 |  |  |     private Long tenantId; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 添加人员 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "添加人员") | 
 |  |  |     private Long createBy; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 添加时间 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "添加时间") | 
 |  |  |     private Date createTime; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 修改人员 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "修改人员") | 
 |  |  |     private Long updateBy; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 修改时间 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "修改时间") | 
 |  |  |     private Date updateTime; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 备注 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "备注") | 
 |  |  |     private String memo; | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     public String getAgvId$() { | 
 |  |  |         AgvService service = SpringUtils.getBean(AgvService.class); | 
 |  |  |         Agv agv = service.getById(this.agvId); | 
 |  |  |         if (!Cools.isEmpty(agv)) { | 
 |  |  |             return String.valueOf(agv.getUuid()); | 
 |  |  |         } | 
 |  |  |         return null; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public String getStatus$() { | 
 |  |  |         if (null == this.status) { | 
 |  |  |             return null; | 
 |  |  |         } | 
 |  |  |         switch (this.status) { | 
 |  |  |             case 1: | 
 |  |  |                 return "正常"; | 
 |  |  |             case 0: | 
 |  |  |                 return "冻结"; | 
 |  |  |             default: | 
 |  |  |                 return String.valueOf(this.status); | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     public Boolean getStatusBool() { | 
 |  |  |         if (null == this.status) { | 
 |  |  |             return null; | 
 |  |  |         } | 
 |  |  |         switch (this.status) { | 
 |  |  |             case 1: | 
 |  |  |                 return true; | 
 |  |  |             case 0: | 
 |  |  |                 return false; | 
 |  |  |             default: | 
 |  |  |                 return null; | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.manager.manager.entity; | 
 |  |  |  | 
 |  |  | import com.baomidou.mybatisplus.annotation.IdType; | 
 |  |  | import com.baomidou.mybatisplus.annotation.TableId; | 
 |  |  | import com.baomidou.mybatisplus.annotation.TableName; | 
 |  |  | import com.zy.acs.framework.common.Cools; | 
 |  |  | import com.zy.acs.framework.common.SpringUtils; | 
 |  |  | import com.zy.acs.manager.manager.service.AgvService; | 
 |  |  | import io.swagger.annotations.ApiModelProperty; | 
 |  |  | import lombok.Data; | 
 |  |  |  | 
 |  |  | import java.io.Serializable; | 
 |  |  | import java.util.Date; | 
 |  |  |  | 
 |  |  | @Data | 
 |  |  | @TableName("man_offline_log") | 
 |  |  | public class OfflineLog implements Serializable { | 
 |  |  |  | 
 |  |  |     private static final long serialVersionUID = 1L; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * ID | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "ID") | 
 |  |  |     @TableId(value = "id", type = IdType.AUTO) | 
 |  |  |     private Long id; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 车辆 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "车辆") | 
 |  |  |     private Long agvId; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 发生时间 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "发生时间") | 
 |  |  |     private Date happenTime; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 恢复时间 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "恢复时间") | 
 |  |  |     private Date resetTime; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 持续时间 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "持续时间") | 
 |  |  |     private Long duration; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 状态 1: 正常  0: 冻结 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "状态 1: 正常  0: 冻结  ") | 
 |  |  |     private Integer status; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 是否删除 1: 是  0: 否 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "是否删除 1: 是  0: 否  ") | 
 |  |  |     private Integer deleted; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 租户 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "租户") | 
 |  |  |     private Long tenantId; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 添加人员 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "添加人员") | 
 |  |  |     private Long createBy; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 添加时间 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "添加时间") | 
 |  |  |     private Date createTime; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 修改人员 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "修改人员") | 
 |  |  |     private Long updateBy; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 修改时间 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "修改时间") | 
 |  |  |     private Date updateTime; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 备注 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "备注") | 
 |  |  |     private String memo; | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     public String getAgvId$() { | 
 |  |  |         AgvService service = SpringUtils.getBean(AgvService.class); | 
 |  |  |         Agv agv = service.getById(this.agvId); | 
 |  |  |         if (!Cools.isEmpty(agv)) { | 
 |  |  |             return String.valueOf(agv.getUuid()); | 
 |  |  |         } | 
 |  |  |         return null; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public String getStatus$() { | 
 |  |  |         if (null == this.status) { | 
 |  |  |             return null; | 
 |  |  |         } | 
 |  |  |         switch (this.status) { | 
 |  |  |             case 1: | 
 |  |  |                 return "正常"; | 
 |  |  |             case 0: | 
 |  |  |                 return "冻结"; | 
 |  |  |             default: | 
 |  |  |                 return String.valueOf(this.status); | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     public Boolean getStatusBool() { | 
 |  |  |         if (null == this.status) { | 
 |  |  |             return null; | 
 |  |  |         } | 
 |  |  |         switch (this.status) { | 
 |  |  |             case 1: | 
 |  |  |                 return true; | 
 |  |  |             case 0: | 
 |  |  |                 return false; | 
 |  |  |             default: | 
 |  |  |                 return null; | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.manager.manager.entity; | 
 |  |  |  | 
 |  |  | import com.baomidou.mybatisplus.annotation.IdType; | 
 |  |  | import com.baomidou.mybatisplus.annotation.TableId; | 
 |  |  | import com.baomidou.mybatisplus.annotation.TableName; | 
 |  |  | import io.swagger.annotations.ApiModelProperty; | 
 |  |  | import lombok.Data; | 
 |  |  |  | 
 |  |  | import java.io.Serializable; | 
 |  |  | import java.util.Date; | 
 |  |  |  | 
 |  |  | @Data | 
 |  |  | @TableName("man_task_report") | 
 |  |  | public class TaskReport 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 busNo; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 任务号 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "任务号") | 
 |  |  |     private String seqNum; | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 任务进度 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "任务进度") | 
 |  |  |     private Long taskSts; | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * AGV | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "AGV") | 
 |  |  |     private Long agvId; | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 起始站 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "起始站") | 
 |  |  |     private Long oriSta; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 起始库位 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "起始库位") | 
 |  |  |     private Long oriLoc; | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 目标站 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "目标站") | 
 |  |  |     private Long destSta; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 目标库位 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "目标库位") | 
 |  |  |     private Long destLoc; | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 托盘码 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "托盘码") | 
 |  |  |     private String zpallet; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 是否删除 1: 是  0: 否 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "是否删除 1: 是  0: 否  ") | 
 |  |  |     private Integer deleted; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 租户 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "租户") | 
 |  |  |     private Long tenantId; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 添加人员 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "添加人员") | 
 |  |  |     private Long createBy; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 添加时间 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "添加时间") | 
 |  |  |     private Date createTime; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 修改人员 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "修改人员") | 
 |  |  |     private Long updateBy; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 修改时间 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "修改时间") | 
 |  |  |     private Date updateTime; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 备注 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "备注") | 
 |  |  |     private String memo; | 
 |  |  |  | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.manager.manager.entity; | 
 |  |  |  | 
 |  |  | import com.baomidou.mybatisplus.annotation.IdType; | 
 |  |  | import com.baomidou.mybatisplus.annotation.TableId; | 
 |  |  | import com.baomidou.mybatisplus.annotation.TableName; | 
 |  |  | import io.swagger.annotations.ApiModelProperty; | 
 |  |  | import lombok.Data; | 
 |  |  |  | 
 |  |  | import java.io.Serializable; | 
 |  |  | import java.util.Date; | 
 |  |  |  | 
 |  |  | @Data | 
 |  |  | @TableName("man_task_report_log") | 
 |  |  | public class TaskReportLog 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 busNo; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 任务号 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "任务号") | 
 |  |  |     private String seqNum; | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 任务进度 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "任务进度") | 
 |  |  |     private Long taskSts; | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * AGV | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "AGV") | 
 |  |  |     private Long agvId; | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 起始站 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "起始站") | 
 |  |  |     private Long oriSta; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 起始库位 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "起始库位") | 
 |  |  |     private Long oriLoc; | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 目标站 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "目标站") | 
 |  |  |     private Long destSta; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 目标库位 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "目标库位") | 
 |  |  |     private Long destLoc; | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 托盘码 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "托盘码") | 
 |  |  |     private String zpallet; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 是否删除 1: 是  0: 否 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "是否删除 1: 是  0: 否  ") | 
 |  |  |     private Integer deleted; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 租户 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "租户") | 
 |  |  |     private Long tenantId; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 添加人员 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "添加人员") | 
 |  |  |     private Long createBy; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 添加时间 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "添加时间") | 
 |  |  |     private Date createTime; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 修改人员 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "修改人员") | 
 |  |  |     private Long updateBy; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 修改时间 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "修改时间") | 
 |  |  |     private Date updateTime; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 备注 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "备注") | 
 |  |  |     private String memo; | 
 |  |  |  | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.manager.manager.enums; | 
 |  |  |  | 
 |  |  | public enum AgvDurationType { | 
 |  |  |     CHARGE(1), | 
 |  |  |     OFFLINE(2), | 
 |  |  |     ; | 
 |  |  |  | 
 |  |  |     public int val; | 
 |  |  |  | 
 |  |  |     AgvDurationType(int val) { | 
 |  |  |         this.val = val; | 
 |  |  |     } | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.manager.manager.mapper; | 
 |  |  |  | 
 |  |  | import com.baomidou.mybatisplus.core.mapper.BaseMapper; | 
 |  |  | import com.zy.acs.manager.manager.entity.AgvDuration; | 
 |  |  | import com.zy.acs.manager.manager.entity.OfflineLog; | 
 |  |  | import com.zy.acs.manager.manager.entity.VehFaultRec; | 
 |  |  |  | 
 |  |  | import java.util.List; | 
 |  |  |  | 
 |  |  | public interface AgvDurationMapper extends BaseMapper<AgvDuration> { | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     List<AgvDuration> listUnFinish(); | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.manager.manager.mapper; | 
 |  |  |  | 
 |  |  | import com.baomidou.mybatisplus.core.mapper.BaseMapper; | 
 |  |  | import com.zy.acs.manager.manager.entity.OfflineLog; | 
 |  |  |  | 
 |  |  | public interface OfflineLogMapper extends BaseMapper<OfflineLog> { | 
 |  |  |  | 
 |  |  |     OfflineLog getTopOfflineLog(Long agvId); | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.manager.manager.mapper; | 
 |  |  |  | 
 |  |  | import com.baomidou.mybatisplus.core.mapper.BaseMapper; | 
 |  |  | import com.zy.acs.manager.manager.entity.TaskReportLog; | 
 |  |  |  | 
 |  |  | public interface TaskReportLogMapper extends BaseMapper<TaskReportLog> { | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.manager.manager.mapper; | 
 |  |  |  | 
 |  |  | import com.baomidou.mybatisplus.core.mapper.BaseMapper; | 
 |  |  | import com.zy.acs.manager.manager.entity.TaskReport; | 
 |  |  |  | 
 |  |  | public interface TaskReportMapper extends BaseMapper<TaskReport> { | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.manager.manager.service; | 
 |  |  |  | 
 |  |  | import com.baomidou.mybatisplus.extension.service.IService; | 
 |  |  | import com.zy.acs.manager.manager.entity.AgvDuration; | 
 |  |  | import com.zy.acs.manager.manager.entity.OfflineLog; | 
 |  |  |  | 
 |  |  | import java.util.List; | 
 |  |  |  | 
 |  |  | public interface AgvDurationService extends IService<AgvDuration> { | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     List<AgvDuration> listUnFinish(); | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.manager.manager.service; | 
 |  |  |  | 
 |  |  | import com.baomidou.mybatisplus.extension.service.IService; | 
 |  |  | import com.zy.acs.manager.manager.entity.OfflineLog; | 
 |  |  |  | 
 |  |  | public interface OfflineLogService extends IService<OfflineLog> { | 
 |  |  |  | 
 |  |  |     OfflineLog getTopOfflineLog(Long agvId); | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.manager.manager.service; | 
 |  |  |  | 
 |  |  | import com.baomidou.mybatisplus.extension.service.IService; | 
 |  |  | import com.zy.acs.manager.manager.entity.TaskReportLog; | 
 |  |  |  | 
 |  |  | public interface TaskReportLogService extends IService<TaskReportLog> { | 
 |  |  |  | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.manager.manager.service; | 
 |  |  |  | 
 |  |  | import com.baomidou.mybatisplus.extension.service.IService; | 
 |  |  | import com.zy.acs.manager.manager.entity.TaskReport; | 
 |  |  |  | 
 |  |  | public interface TaskReportService extends IService<TaskReport> { | 
 |  |  |  | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.manager.manager.service.impl; | 
 |  |  |  | 
 |  |  | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | 
 |  |  | import com.zy.acs.manager.manager.entity.AgvDuration; | 
 |  |  | import com.zy.acs.manager.manager.mapper.AgvDurationMapper; | 
 |  |  | import com.zy.acs.manager.manager.service.AgvDurationService; | 
 |  |  | import org.springframework.stereotype.Service; | 
 |  |  |  | 
 |  |  | import java.util.Collections; | 
 |  |  | import java.util.List; | 
 |  |  |  | 
 |  |  | @Service("agvDurationService") | 
 |  |  | public class AgvDurationServiceImpl extends ServiceImpl<AgvDurationMapper, AgvDuration> implements AgvDurationService { | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     @Override | 
 |  |  |     public List<AgvDuration> listUnFinish() { | 
 |  |  |  | 
 |  |  |         return baseMapper.listUnFinish(); | 
 |  |  |     } | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.manager.manager.service.impl; | 
 |  |  |  | 
 |  |  | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | 
 |  |  | import com.zy.acs.manager.manager.entity.OfflineLog; | 
 |  |  | import com.zy.acs.manager.manager.mapper.OfflineLogMapper; | 
 |  |  | import com.zy.acs.manager.manager.service.OfflineLogService; | 
 |  |  | import org.springframework.stereotype.Service; | 
 |  |  |  | 
 |  |  | @Service("offlineLogService") | 
 |  |  | public class OfflineLogServiceImpl extends ServiceImpl<OfflineLogMapper, OfflineLog> implements OfflineLogService { | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     @Override | 
 |  |  |     public OfflineLog getTopOfflineLog(Long agvId) { | 
 |  |  |         return baseMapper.getTopOfflineLog(agvId); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.manager.manager.service.impl; | 
 |  |  |  | 
 |  |  | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | 
 |  |  | import com.zy.acs.manager.manager.entity.TaskReportLog; | 
 |  |  | import com.zy.acs.manager.manager.mapper.TaskReportLogMapper; | 
 |  |  | import com.zy.acs.manager.manager.service.TaskReportLogService; | 
 |  |  | import lombok.extern.slf4j.Slf4j; | 
 |  |  | import org.springframework.stereotype.Service; | 
 |  |  |  | 
 |  |  | @Slf4j | 
 |  |  | @Service("taskReportLogService") | 
 |  |  | public class TaskReportLogServiceImpl extends ServiceImpl<TaskReportLogMapper, TaskReportLog> implements TaskReportLogService { | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.manager.manager.service.impl; | 
 |  |  |  | 
 |  |  | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | 
 |  |  | import com.zy.acs.manager.manager.entity.*; | 
 |  |  | import com.zy.acs.manager.manager.mapper.TaskReportMapper; | 
 |  |  | import com.zy.acs.manager.manager.service.*; | 
 |  |  | import lombok.extern.slf4j.Slf4j; | 
 |  |  | import org.springframework.stereotype.Service; | 
 |  |  |  | 
 |  |  | import java.util.*; | 
 |  |  |  | 
 |  |  | @Slf4j | 
 |  |  | @Service("taskReportService") | 
 |  |  | public class TaskReportServiceImpl extends ServiceImpl<TaskReportMapper, TaskReport> implements TaskReportService { | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | <?xml version="1.0" encoding="UTF-8"?> | 
 |  |  | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | 
 |  |  | <mapper namespace="com.zy.acs.manager.manager.mapper.AgvDurationMapper"> | 
 |  |  |  | 
 |  |  |     <!-- 关联查询sql --> | 
 |  |  |     <sql id="selectSql"> | 
 |  |  |         SELECT a.* | 
 |  |  |         FROM man_agv_duration a | 
 |  |  |         <where> | 
 |  |  |             AND a.deleted = 0 | 
 |  |  |             <if test="param.id != null"> | 
 |  |  |                 AND a.id = #{param.id} | 
 |  |  |             </if> | 
 |  |  |             <if test="param.status != null"> | 
 |  |  |                 AND a.status = #{param.status} | 
 |  |  |             </if> | 
 |  |  |             <if test="param.keywords != null"> | 
 |  |  |                 AND ( | 
 |  |  |                  a.memo LIKE CONCAT('%', #{param.keywords}, '%') | 
 |  |  |                 ) | 
 |  |  |             </if> | 
 |  |  |         </where> | 
 |  |  |     </sql> | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     <select id="listUnFinish" resultType="com.zy.acs.manager.manager.entity.AgvDuration"> | 
 |  |  |         SELECT * | 
 |  |  |         FROM man_agv_duration | 
 |  |  |         WHERE  reset_time is null | 
 |  |  |     </select> | 
 |  |  |  | 
 |  |  | </mapper> | 
 |  |  |  | 
 
| New file | 
 |  |  | 
 |  |  | <?xml version="1.0" encoding="UTF-8"?> | 
 |  |  | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | 
 |  |  | <mapper namespace="com.zy.acs.manager.manager.mapper.OfflineLogMapper"> | 
 |  |  |  | 
 |  |  |     <!-- 关联查询sql --> | 
 |  |  |     <sql id="selectSql"> | 
 |  |  |         SELECT a.* | 
 |  |  |         FROM man_offline_log a | 
 |  |  |         <where> | 
 |  |  |             AND a.deleted = 0 | 
 |  |  |             <if test="param.id != null"> | 
 |  |  |                 AND a.id = #{param.id} | 
 |  |  |             </if> | 
 |  |  |             <if test="param.status != null"> | 
 |  |  |                 AND a.status = #{param.status} | 
 |  |  |             </if> | 
 |  |  |             <if test="param.keywords != null"> | 
 |  |  |                 AND ( | 
 |  |  |                  a.memo LIKE CONCAT('%', #{param.keywords}, '%') | 
 |  |  |                 ) | 
 |  |  |             </if> | 
 |  |  |         </where> | 
 |  |  |     </sql> | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     <select id="getTopOfflineLog" resultType="com.zy.acs.manager.manager.entity.OfflineLog"> | 
 |  |  |         SELECT * | 
 |  |  |         FROM man_offline_log | 
 |  |  |         WHERE agv_id = #{agvId} | 
 |  |  |           and reset_time is null | 
 |  |  |         ORDER BY happen_time DESC LIMIT 1 | 
 |  |  |     </select> | 
 |  |  |  | 
 |  |  | </mapper> | 
 
| New file | 
 |  |  | 
 |  |  | <?xml version="1.0" encoding="UTF-8"?> | 
 |  |  | <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | 
 |  |  |          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | 
 |  |  |     <modelVersion>4.0.0</modelVersion> | 
 |  |  |  | 
 |  |  |     <artifactId>zy-acs-wcs</artifactId> | 
 |  |  |     <version>1.0.0</version> | 
 |  |  |     <packaging>war</packaging> | 
 |  |  |  | 
 |  |  |     <name>wcs</name> | 
 |  |  |  | 
 |  |  |     <parent> | 
 |  |  |         <groupId>com.zy</groupId> | 
 |  |  |         <artifactId>acs</artifactId> | 
 |  |  |         <version>1.0.0</version> | 
 |  |  |     </parent> | 
 |  |  |  | 
 |  |  |     <properties> | 
 |  |  |         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | 
 |  |  |         <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> | 
 |  |  |         <mysql-driver.version>5.1.47</mysql-driver.version> | 
 |  |  |     </properties> | 
 |  |  |  | 
 |  |  |     <dependencies> | 
 |  |  |         <dependency> | 
 |  |  |             <groupId>com.zy</groupId> | 
 |  |  |             <artifactId>acs-common</artifactId> | 
 |  |  |             <version>1.0.0</version> | 
 |  |  |         </dependency> | 
 |  |  |  | 
 |  |  |         <dependency> | 
 |  |  |             <groupId>org.springframework.cloud</groupId> | 
 |  |  |             <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId> | 
 |  |  |         </dependency> | 
 |  |  |  | 
 |  |  |         <dependency> | 
 |  |  |             <groupId>org.springframework.boot</groupId> | 
 |  |  |             <artifactId>spring-boot-starter-web</artifactId> | 
 |  |  |         </dependency> | 
 |  |  |  | 
 |  |  |         <dependency> | 
 |  |  |             <groupId>org.springframework.boot</groupId> | 
 |  |  |             <artifactId>spring-boot-starter-security</artifactId> | 
 |  |  |         </dependency> | 
 |  |  |  | 
 |  |  |         <dependency> | 
 |  |  |             <groupId>org.springframework.boot</groupId> | 
 |  |  |             <artifactId>spring-boot-starter-mail</artifactId> | 
 |  |  |         </dependency> | 
 |  |  |  | 
 |  |  |         <dependency> | 
 |  |  |             <groupId>org.springframework.boot</groupId> | 
 |  |  |             <artifactId>spring-boot-starter-websocket</artifactId> | 
 |  |  |         </dependency> | 
 |  |  |  | 
 |  |  |         <dependency> | 
 |  |  |             <groupId>com.ibeetl</groupId> | 
 |  |  |             <artifactId>beetl</artifactId> | 
 |  |  |             <version>3.6.1.RELEASE</version> | 
 |  |  |         </dependency> | 
 |  |  |  | 
 |  |  |         <dependency> | 
 |  |  |             <groupId>mysql</groupId> | 
 |  |  |             <artifactId>mysql-connector-java</artifactId> | 
 |  |  |             <version>${mysql-driver.version}</version> | 
 |  |  |         </dependency> | 
 |  |  |         <dependency> | 
 |  |  |             <groupId>com.microsoft.sqlserver</groupId> | 
 |  |  |             <artifactId>mssql-jdbc</artifactId> | 
 |  |  |             <version>8.2.2.jre8</version> | 
 |  |  |         </dependency> | 
 |  |  |  | 
 |  |  |         <!-- mybatis-plus --> | 
 |  |  |         <dependency> | 
 |  |  |             <groupId>com.baomidou</groupId> | 
 |  |  |             <artifactId>mybatis-plus-boot-starter</artifactId> | 
 |  |  |             <version>3.4.1</version> | 
 |  |  |         </dependency> | 
 |  |  |         <dependency> | 
 |  |  |             <groupId>com.baomidou</groupId> | 
 |  |  |             <artifactId>mybatis-plus-generator</artifactId> | 
 |  |  |             <version>3.4.1</version> | 
 |  |  |         </dependency> | 
 |  |  |  | 
 |  |  |         <dependency> | 
 |  |  |             <groupId>org.aspectj</groupId> | 
 |  |  |             <artifactId>aspectjrt</artifactId> | 
 |  |  |             <version>1.9.19</version>  <!-- 确保使用最新版本 --> | 
 |  |  |         </dependency> | 
 |  |  |         <dependency> | 
 |  |  |             <groupId>org.aspectj</groupId> | 
 |  |  |             <artifactId>aspectjweaver</artifactId> | 
 |  |  |             <version>1.9.19</version>  <!-- 用于织入切面 --> | 
 |  |  |         </dependency> | 
 |  |  |  | 
 |  |  |         <!-- swagger --> | 
 |  |  |         <dependency> | 
 |  |  |             <groupId>io.springfox</groupId> | 
 |  |  |             <artifactId>springfox-boot-starter</artifactId> | 
 |  |  |             <version>3.0.0</version> | 
 |  |  |         </dependency> | 
 |  |  |  | 
 |  |  |         <!-- jjwt --> | 
 |  |  |         <dependency> | 
 |  |  |             <groupId>io.jsonwebtoken</groupId> | 
 |  |  |             <artifactId>jjwt-impl</artifactId> | 
 |  |  |             <version>0.11.2</version> | 
 |  |  |         </dependency> | 
 |  |  |         <dependency> | 
 |  |  |             <groupId>io.jsonwebtoken</groupId> | 
 |  |  |             <artifactId>jjwt-jackson</artifactId> | 
 |  |  |             <version>0.11.2</version> | 
 |  |  |         </dependency> | 
 |  |  |  | 
 |  |  |         <!-- 图形验证码 --> | 
 |  |  |         <dependency> | 
 |  |  |             <groupId>com.github.whvcse</groupId> | 
 |  |  |             <artifactId>easy-captcha</artifactId> | 
 |  |  |             <version>1.6.2</version> | 
 |  |  |         </dependency> | 
 |  |  |  | 
 |  |  |         <!-- open office, 用于文档转pdf实现在线预览 --> | 
 |  |  |         <dependency> | 
 |  |  |             <groupId>com.github.livesense</groupId> | 
 |  |  |             <artifactId>jodconverter-core</artifactId> | 
 |  |  |             <version>1.0.5</version> | 
 |  |  |         </dependency> | 
 |  |  |  | 
 |  |  |         <!-- tika, 用于FileServer获取content-type --> | 
 |  |  |         <dependency> | 
 |  |  |             <groupId>org.apache.tika</groupId> | 
 |  |  |             <artifactId>tika-core</artifactId> | 
 |  |  |             <version>2.1.0</version> | 
 |  |  |         </dependency> | 
 |  |  |  | 
 |  |  |         <!-- druid --> | 
 |  |  |         <dependency> | 
 |  |  |             <groupId>com.alibaba</groupId> | 
 |  |  |             <artifactId>druid-spring-boot-starter</artifactId> | 
 |  |  |             <version>1.2.6</version> | 
 |  |  |         </dependency> | 
 |  |  |  | 
 |  |  |         <dependency> | 
 |  |  |             <groupId>com.alibaba</groupId> | 
 |  |  |             <artifactId>easyexcel</artifactId> | 
 |  |  |             <version>2.2.6</version> | 
 |  |  |         </dependency> | 
 |  |  |         <dependency> | 
 |  |  |             <groupId>org.springframework.boot</groupId> | 
 |  |  |             <artifactId>spring-boot-starter-actuator</artifactId> | 
 |  |  |         </dependency> | 
 |  |  |  | 
 |  |  |         <!-- nd4j --> | 
 |  |  | <!--        <dependency>--> | 
 |  |  | <!--            <groupId>org.nd4j</groupId>--> | 
 |  |  | <!--            <artifactId>nd4j-native-platform</artifactId>--> | 
 |  |  | <!--            <!– java 8 –>--> | 
 |  |  | <!--<!–            <version>1.0.0-M1.1</version>–>--> | 
 |  |  | <!--            <!– java 11 –>--> | 
 |  |  | <!--            <version>1.0.0-M2.1</version>--> | 
 |  |  | <!--        </dependency>--> | 
 |  |  |  | 
 |  |  |  | 
 |  |  |         <dependency> | 
 |  |  |             <groupId>com.github.dathlin</groupId> | 
 |  |  |             <artifactId>HslCommunication</artifactId> | 
 |  |  |             <version>2.0.0</version> | 
 |  |  |         </dependency> | 
 |  |  |         <!-- led sdk --> | 
 |  |  |         <dependency> | 
 |  |  |             <groupId>com.wcs.led</groupId> | 
 |  |  |             <artifactId>5m3</artifactId> | 
 |  |  |             <scope>system</scope> | 
 |  |  |             <version>0.5.0</version> | 
 |  |  |             <systemPath>${project.basedir}/src/main/resources/lib/bx05-0.5.0-SNAPSHOT.jar</systemPath> | 
 |  |  |         </dependency> | 
 |  |  |         <dependency> | 
 |  |  |             <groupId>com.wcs.led</groupId> | 
 |  |  |             <artifactId>5m3message</artifactId> | 
 |  |  |             <scope>system</scope> | 
 |  |  |             <version>0.5.0</version> | 
 |  |  |             <systemPath>${project.basedir}/src/main/resources/lib/bx05.message-0.5.0-SNAPSHOT.jar</systemPath> | 
 |  |  |         </dependency> | 
 |  |  |         <dependency> | 
 |  |  |             <groupId>com.wcs.led</groupId> | 
 |  |  |             <artifactId>5m3doc</artifactId> | 
 |  |  |             <scope>system</scope> | 
 |  |  |             <version>0.5.0</version> | 
 |  |  |             <systemPath>${project.basedir}/src/main/resources/lib/bx05-0.5.0-SNAPSHOT-javadoc.jar</systemPath> | 
 |  |  |         </dependency> | 
 |  |  |         <dependency> | 
 |  |  |             <groupId>com.wcs.led</groupId> | 
 |  |  |             <artifactId>rxtx</artifactId> | 
 |  |  |             <scope>system</scope> | 
 |  |  |             <version>2.1.7</version> | 
 |  |  |             <systemPath>${project.basedir}/src/main/resources/lib/rxtx-2.1.7.jar</systemPath> | 
 |  |  |         </dependency> | 
 |  |  |         <dependency> | 
 |  |  |             <groupId>com.wcs.led</groupId> | 
 |  |  |             <artifactId>simple-xml</artifactId> | 
 |  |  |             <scope>system</scope> | 
 |  |  |             <version>2.7.1</version> | 
 |  |  |             <systemPath>${project.basedir}/src/main/resources/lib/simple-xml-2.7.1.jar</systemPath> | 
 |  |  |         </dependency> | 
 |  |  |         <dependency> | 
 |  |  |             <groupId>com.wcs.led</groupId> | 
 |  |  |             <artifactId>stax</artifactId> | 
 |  |  |             <scope>system</scope> | 
 |  |  |             <version>1.2.0</version> | 
 |  |  |             <systemPath>${project.basedir}/src/main/resources/lib/stax-1.2.0.jar</systemPath> | 
 |  |  |         </dependency> | 
 |  |  |         <dependency> | 
 |  |  |             <groupId>com.wcs.led</groupId> | 
 |  |  |             <artifactId>stax-api</artifactId> | 
 |  |  |             <scope>system</scope> | 
 |  |  |             <version>1.0.1</version> | 
 |  |  |             <systemPath>${project.basedir}/src/main/resources/lib/stax-api-1.0.1.jar</systemPath> | 
 |  |  |         </dependency> | 
 |  |  |         <dependency> | 
 |  |  |             <groupId>com.wcs.led</groupId> | 
 |  |  |             <artifactId>uia-comm</artifactId> | 
 |  |  |             <scope>system</scope> | 
 |  |  |             <version>0.5.1</version> | 
 |  |  |             <systemPath>${project.basedir}/src/main/resources/lib/uia-comm-0.5.1.jar</systemPath> | 
 |  |  |         </dependency> | 
 |  |  |         <dependency> | 
 |  |  |             <groupId>com.wcs.led</groupId> | 
 |  |  |             <artifactId>uia-message</artifactId> | 
 |  |  |             <scope>system</scope> | 
 |  |  |             <version>0.6.0</version> | 
 |  |  |             <systemPath>${project.basedir}/src/main/resources/lib/uia-message-0.6.0.jar</systemPath> | 
 |  |  |         </dependency> | 
 |  |  |         <dependency> | 
 |  |  |             <groupId>com.wcs.led</groupId> | 
 |  |  |             <artifactId>uia-utils</artifactId> | 
 |  |  |             <scope>system</scope> | 
 |  |  |             <version>0.2.0</version> | 
 |  |  |             <systemPath>${project.basedir}/src/main/resources/lib/uia-utils-0.2.0.jar</systemPath> | 
 |  |  |         </dependency> | 
 |  |  |         <dependency> | 
 |  |  |             <groupId>com.wcs.led</groupId> | 
 |  |  |             <artifactId>xpp3</artifactId> | 
 |  |  |             <scope>system</scope> | 
 |  |  |             <version>1.1.3.3</version> | 
 |  |  |             <systemPath>${project.basedir}/src/main/resources/lib/xpp3-1.1.3.3.jar</systemPath> | 
 |  |  |         </dependency> | 
 |  |  |         <dependency> | 
 |  |  |             <groupId>org.yaml</groupId> | 
 |  |  |             <artifactId>snakeyaml</artifactId> | 
 |  |  |             <version>1.33</version> | 
 |  |  |         </dependency> | 
 |  |  |         <dependency> | 
 |  |  |             <groupId>commons-io</groupId> | 
 |  |  |             <artifactId>commons-io</artifactId> | 
 |  |  |             <version>2.11.0</version> | 
 |  |  |         </dependency> | 
 |  |  |         <dependency> | 
 |  |  |             <groupId>de.schlichtherle.truelicense</groupId> | 
 |  |  |             <artifactId>truelicense-core</artifactId> | 
 |  |  |             <version>1.33</version> | 
 |  |  |         </dependency> | 
 |  |  |  | 
 |  |  |         <!-- okHttp3 --> | 
 |  |  |         <dependency> | 
 |  |  |             <groupId>com.squareup.okhttp3</groupId> | 
 |  |  |             <artifactId>okhttp</artifactId> | 
 |  |  |             <version>3.10.0</version> | 
 |  |  |         </dependency> | 
 |  |  |     </dependencies> | 
 |  |  |  | 
 |  |  |     <build> | 
 |  |  |         <finalName>rcs-wcs</finalName> | 
 |  |  |         <plugins> | 
 |  |  |             <plugin> | 
 |  |  |                 <groupId>org.springframework.boot</groupId> | 
 |  |  |                 <artifactId>spring-boot-maven-plugin</artifactId> | 
 |  |  |             </plugin> | 
 |  |  |         </plugins> | 
 |  |  |     </build> | 
 |  |  |  | 
 |  |  | </project> | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs; | 
 |  |  |  | 
 |  |  | import com.zy.common.utils.RandomValidateCodeUtil; | 
 |  |  | import org.springframework.boot.SpringApplication; | 
 |  |  | import org.springframework.boot.autoconfigure.SpringBootApplication; | 
 |  |  | import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; | 
 |  |  | import org.springframework.scheduling.annotation.EnableAsync; | 
 |  |  | import org.springframework.scheduling.annotation.EnableScheduling; | 
 |  |  |  | 
 |  |  | @EnableAsync | 
 |  |  | @EnableScheduling | 
 |  |  | @SpringBootApplication | 
 |  |  | public class Boot extends SpringBootServletInitializer { | 
 |  |  |  | 
 |  |  |     public static void main(String[] args) { | 
 |  |  |         RandomValidateCodeUtil.init(); | 
 |  |  |         SpringApplication.run(Boot.class, args); | 
 |  |  | //        new Thread(()-> { | 
 |  |  | //            ServerBootstrap serverBootstrap = SpringUtils.getBean(ServerBootstrap.class); | 
 |  |  | //            serverBootstrap.init(); | 
 |  |  | //        }).start(); | 
 |  |  |  | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | //    @Override | 
 |  |  | //    protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) { | 
 |  |  | //        return builder.sources(Boot.class); | 
 |  |  | //    } | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.asrs.controller; | 
 |  |  |  | 
 |  |  | import com.alibaba.fastjson.JSONArray; | 
 |  |  | import com.alibaba.fastjson.JSONObject; | 
 |  |  | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
 |  |  | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 
 |  |  | import com.zy.acs.framework.annotations.ManagerAuth; | 
 |  |  | import com.zy.acs.framework.common.BaseRes; | 
 |  |  | import com.zy.acs.framework.common.Cools; | 
 |  |  | import com.zy.acs.framework.common.DateUtils; | 
 |  |  | import com.zy.acs.framework.common.R; | 
 |  |  | import com.zy.acs.wcs.asrs.entity.BasDevp; | 
 |  |  | import com.zy.acs.wcs.asrs.service.BasDevpService; | 
 |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
 |  |  | import org.springframework.web.bind.annotation.*; | 
 |  |  |  | 
 |  |  | import java.util.*; | 
 |  |  |  | 
 |  |  | @RestController | 
 |  |  | public class BasDevpController extends BaseController { | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private BasDevpService basDevpService; | 
 |  |  |  | 
 |  |  |     @RequestMapping(value = "/basDevp/{id}/auth") | 
 |  |  |     @ManagerAuth | 
 |  |  |     public R get(@PathVariable("id") Long id) { | 
 |  |  |         return R.ok(basDevpService.getById(String.valueOf(id))); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @RequestMapping(value = "/basDevp/list/auth") | 
 |  |  |     @ManagerAuth | 
 |  |  |     public R list(@RequestParam(defaultValue = "1") Integer curr, | 
 |  |  |                   @RequestParam(defaultValue = "10") Integer limit, | 
 |  |  |                   @RequestParam(required = false) String orderByField, | 
 |  |  |                   @RequestParam(required = false) String orderByType, | 
 |  |  |                   @RequestParam Map<String, Object> param) { | 
 |  |  |         excludeTrash(param); | 
 |  |  |         QueryWrapper<BasDevp> wrapper = new QueryWrapper<>(); | 
 |  |  |         convert(param, wrapper); | 
 |  |  |         if (!Cools.isEmpty(orderByField)) { | 
 |  |  |             wrapper.orderBy(false, "asc".equals(orderByType), humpToLine(orderByField)); | 
 |  |  |         } | 
 |  |  |         return R.ok(basDevpService.page(new Page<>(curr, limit), wrapper)); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     private <T> void convert(Map<String, Object> map, QueryWrapper<T> wrapper) { | 
 |  |  |         for (Map.Entry<String, Object> entry : map.entrySet()) { | 
 |  |  |             String val = String.valueOf(entry.getValue()); | 
 |  |  |             if (val.contains(RANGE_TIME_LINK)) { | 
 |  |  |                 String[] dates = val.split(RANGE_TIME_LINK); | 
 |  |  |                 wrapper.ge(entry.getKey(), DateUtils.convert(dates[0])); | 
 |  |  |                 wrapper.le(entry.getKey(), DateUtils.convert(dates[1])); | 
 |  |  |             } else { | 
 |  |  |                 wrapper.like(entry.getKey(), val); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @RequestMapping(value = "/basDevp/add/auth") | 
 |  |  |     @ManagerAuth(memo = "站点添加") | 
 |  |  |     public R add(BasDevp basDevp) { | 
 |  |  |         basDevp.setModiUser(getUserId()); | 
 |  |  |         basDevp.setModiTime(new Date()); | 
 |  |  |         basDevp.setAppeUser(getUserId()); | 
 |  |  |         basDevp.setAppeTime(new Date()); | 
 |  |  |         basDevpService.save(basDevp); | 
 |  |  |         return R.ok(); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @RequestMapping(value = "/basDevp/update/auth") | 
 |  |  |     @ManagerAuth(memo = "站点修改") | 
 |  |  |     public R update(BasDevp basDevp) { | 
 |  |  |         if (Cools.isEmpty(basDevp) || null == basDevp.getDevNo()) { | 
 |  |  |             return R.error(); | 
 |  |  |         } | 
 |  |  |         basDevp.setModiUser(getUserId()); | 
 |  |  |         basDevp.setModiTime(new Date()); | 
 |  |  |         basDevpService.updateById(basDevp); | 
 |  |  |         return R.ok("修改完成"); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @RequestMapping(value = "/basDevp/delete/auth") | 
 |  |  |     @ManagerAuth(memo = "站点删除") | 
 |  |  |     public R delete(@RequestParam String param) { | 
 |  |  |         List<BasDevp> list = JSONArray.parseArray(param, BasDevp.class); | 
 |  |  |         if (Cools.isEmpty(list)) { | 
 |  |  |             return R.error(); | 
 |  |  |         } | 
 |  |  |         for (BasDevp entity : list) { | 
 |  |  |             basDevpService.removeById(entity.getDevNo()); | 
 |  |  |         } | 
 |  |  |         return R.ok(); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @RequestMapping(value = "/basDevp/export/auth") | 
 |  |  |     @ManagerAuth(memo = "站点导出") | 
 |  |  |     public R export(@RequestBody JSONObject param) { | 
 |  |  |         List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); | 
 |  |  |         QueryWrapper<BasDevp> wrapper = new QueryWrapper<>(); | 
 |  |  |         Map<String, Object> map = excludeTrash(param.getJSONObject("basDevp")); | 
 |  |  |         convert(map, wrapper); | 
 |  |  |         List<BasDevp> list = basDevpService.list(wrapper); | 
 |  |  |         return R.ok(exportSupport(list, fields)); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @RequestMapping(value = "/basDevpQuery/auth") | 
 |  |  |     @ManagerAuth | 
 |  |  |     public R query(String condition) { | 
 |  |  |         QueryWrapper<BasDevp> wrapper = new QueryWrapper<>(); | 
 |  |  |         wrapper.like("dev_no", condition); | 
 |  |  |         Page<BasDevp> page = basDevpService.page(new Page<>(0, 10), wrapper); | 
 |  |  |         List<Map<String, Object>> result = new ArrayList<>(); | 
 |  |  |         for (BasDevp basDevp : page.getRecords()) { | 
 |  |  |             Map<String, Object> map = new HashMap<>(); | 
 |  |  |             map.put("id", basDevp.getDevNo()); | 
 |  |  |             map.put("value", basDevp.getDevNo()); | 
 |  |  |             result.add(map); | 
 |  |  |         } | 
 |  |  |         return R.ok(result); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @RequestMapping(value = "/basDevp/check/column/auth") | 
 |  |  |     @ManagerAuth | 
 |  |  |     public R query(@RequestBody JSONObject param) { | 
 |  |  |         QueryWrapper<BasDevp> wrapper = new QueryWrapper<BasDevp>().eq(humpToLine(String.valueOf(param.get("key"))), param.get("val")); | 
 |  |  |         if (null != basDevpService.getOne(wrapper)) { | 
 |  |  |             return R.parse(BaseRes.REPEAT).add(getComment(BasDevp.class, String.valueOf(param.get("key")))); | 
 |  |  |         } | 
 |  |  |         return R.ok(); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @RequestMapping(value = "/basDevp/weigh/auth") | 
 |  |  |     @ManagerAuth(memo = "站点称重查询") | 
 |  |  |     public Double weigh(Integer dev_no) { | 
 |  |  |         BasDevp basDevp = basDevpService.getById(dev_no); | 
 |  |  |         return basDevp.getGrossWt(); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.asrs.controller; | 
 |  |  |  | 
 |  |  | import com.zy.acs.framework.common.Cools; | 
 |  |  | import com.zy.acs.framework.controller.AbstractBaseController; | 
 |  |  | import io.swagger.annotations.ApiModelProperty; | 
 |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
 |  |  |  | 
 |  |  | import javax.servlet.http.HttpServletRequest; | 
 |  |  | import java.lang.reflect.Field; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * Created by vincent on 2019-09-09 | 
 |  |  |  */ | 
 |  |  | public class BaseController extends AbstractBaseController { | 
 |  |  |  | 
 |  |  |     protected static final String RANGE_TIME_LINK = " - "; | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     protected HttpServletRequest request; | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     protected Long getUserId() { | 
 |  |  |         return Long.parseLong(String.valueOf(request.getAttribute("userId"))); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     protected String getComment(Class<?> cls, String fieldName) { | 
 |  |  |         Field[] fields = Cools.getAllFields(cls); | 
 |  |  |         for (Field field : fields) { | 
 |  |  |             if (fieldName.equals(field.getName())) { | 
 |  |  |                 return field.getAnnotation(ApiModelProperty.class).value(); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         return ""; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.asrs.domain.dto; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * 曲线图表json键 | 
 |  |  |  * | 
 |  |  |  * @author admin | 
 |  |  |  */ | 
 |  |  | public class AxisBean { | 
 |  |  |     private String name; | 
 |  |  |     private Integer[] data; | 
 |  |  |  | 
 |  |  |     public String getName() { | 
 |  |  |         return name; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public void setName(String name) { | 
 |  |  |         this.name = name; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public Integer[] getData() { | 
 |  |  |         return data; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public void setData(Integer[] data) { | 
 |  |  |         this.data = data; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.asrs.domain.dto; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * 入出库统计曲线图 | 
 |  |  |  * | 
 |  |  |  * @author admin | 
 |  |  |  * @date 2018年12月12日 | 
 |  |  |  */ | 
 |  |  | public class WorkChartAxis { | 
 |  |  |     private String ymd; | 
 |  |  |     private int inqty; | 
 |  |  |     private int outqty; | 
 |  |  |  | 
 |  |  |     public String getYmd() { | 
 |  |  |         return ymd; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public void setYmd(String ymd) { | 
 |  |  |         this.ymd = ymd; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public int getInqty() { | 
 |  |  |         return inqty; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public void setInqty(int inqty) { | 
 |  |  |         this.inqty = inqty; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public int getOutqty() { | 
 |  |  |         return outqty; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public void setOutqty(int outqty) { | 
 |  |  |         this.outqty = outqty; | 
 |  |  |     } | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.asrs.domain.enums; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * 堆垛机状态枚举 | 
 |  |  |  */ | 
 |  |  | public enum CrnStatusType { | 
 |  |  |  | 
 |  |  |     // 入库 | 
 |  |  |     MACHINE_PAKIN("入库"), | 
 |  |  |     // 出库 | 
 |  |  |     MACHINE_PAKOUT("出库"), | 
 |  |  |     // 库到库 | 
 |  |  |     MACHINE_STOCK_MOVE("库到库"), | 
 |  |  |     // 站到站 | 
 |  |  |     MACHINE_SITE_MOVE("站到站"), | 
 |  |  |     // p to p | 
 |  |  |     MACHINE_P_MOVE("PToP"), | 
 |  |  |     // 异常 | 
 |  |  |     MACHINE_ERROR("异常"), | 
 |  |  |     // 自动 | 
 |  |  |     MACHINE_AUTO("自动"), | 
 |  |  |     // 非自动/手动 | 
 |  |  |     MACHINE_UN_AUTO("非自动"), | 
 |  |  |     ; | 
 |  |  |  | 
 |  |  |     private String desc; | 
 |  |  |  | 
 |  |  |     CrnStatusType(String desc) { | 
 |  |  |         this.desc = desc; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public static CrnStatusType process(Integer ioType) { | 
 |  |  |         if (ioType == 2) { | 
 |  |  |             return MACHINE_PAKOUT; | 
 |  |  |         } else if (ioType < 100 && ioType != 3 && ioType != 6 && ioType != 11) { | 
 |  |  |             return MACHINE_PAKIN; | 
 |  |  |         } else if (ioType == 3) { | 
 |  |  |             return MACHINE_SITE_MOVE; | 
 |  |  |         } else if (ioType == 11) { | 
 |  |  |             return MACHINE_STOCK_MOVE; | 
 |  |  |         } else { | 
 |  |  |             return MACHINE_ERROR; | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public String getDesc() { | 
 |  |  |         return desc; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public void setDesc(String desc) { | 
 |  |  |         this.desc = desc; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.asrs.domain.enums; | 
 |  |  |  | 
 |  |  |  | 
 |  |  | import com.zy.core.model.protocol.StaProtocol; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * 站点状态枚举 | 
 |  |  |  */ | 
 |  |  | public enum SiteStatusType { | 
 |  |  |  | 
 |  |  |     // 自动 | 
 |  |  |     SITE_AUTO, | 
 |  |  |     // 非自动 | 
 |  |  |     SITE_UNAUTO, | 
 |  |  |     // 自动+有物+ID | 
 |  |  |     SITE_AUTO_RUN_ID, | 
 |  |  |     // 自动+有物 | 
 |  |  |     SITE_AUTO_RUN, | 
 |  |  |     // 自动+ID | 
 |  |  |     SITE_AUTO_ID, | 
 |  |  |  | 
 |  |  |     ; | 
 |  |  |  | 
 |  |  |     public static SiteStatusType process(StaProtocol staProtocol) { | 
 |  |  |         if (staProtocol == null) { | 
 |  |  |             return null; | 
 |  |  |         } | 
 |  |  |         if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.getWorkNo() > 0) { | 
 |  |  |             return SITE_AUTO_RUN_ID; | 
 |  |  |         } | 
 |  |  |         if (staProtocol.isAutoing() && staProtocol.isLoading()) { | 
 |  |  |             return SITE_AUTO_RUN; | 
 |  |  |         } | 
 |  |  |         if (staProtocol.isAutoing() && staProtocol.getWorkNo() > 0) { | 
 |  |  |             return SITE_AUTO_ID; | 
 |  |  |         } | 
 |  |  |         if (staProtocol.isAutoing()) { | 
 |  |  |             return SITE_AUTO; | 
 |  |  |         } | 
 |  |  |         if (!staProtocol.isAutoing()) { | 
 |  |  |             return SITE_UNAUTO; | 
 |  |  |         } | 
 |  |  |         return null; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.asrs.domain.enums; | 
 |  |  |  | 
 |  |  | public enum TaskStatusType { | 
 |  |  |  | 
 |  |  |     RECEIVE(1, "接收"), | 
 |  |  |     DISTRIBUTE(2, "派发"), | 
 |  |  |     //COMPLETE(3, "命令完成"), | 
 |  |  |     CANCEL(4, "取消"), | 
 |  |  |     OVER(5, "完结"); | 
 |  |  |  | 
 |  |  |     public Integer id; | 
 |  |  |     public String desc; | 
 |  |  |  | 
 |  |  |     TaskStatusType(Integer id, String desc) { | 
 |  |  |         this.id = id; | 
 |  |  |         this.desc = desc; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public static String get(Integer id) { | 
 |  |  |         if (null == id) { | 
 |  |  |             return null; | 
 |  |  |         } | 
 |  |  |         for (TaskStatusType type : TaskStatusType.values()) { | 
 |  |  |             if (type.id.equals(id)) { | 
 |  |  |                 return type.desc; | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         return null; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.asrs.domain.enums; | 
 |  |  |  | 
 |  |  | import com.core.exception.CoolException; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * 工作号排序规则 | 
 |  |  |  */ | 
 |  |  | public enum WorkNoType { | 
 |  |  |  | 
 |  |  |     PAKIN(0), | 
 |  |  |     PICK(1), | 
 |  |  |     PAKOUT(2), | 
 |  |  |     OTHER(3), | 
 |  |  |     ; | 
 |  |  |  | 
 |  |  |     public Integer type; | 
 |  |  |  | 
 |  |  |     WorkNoType(Integer type) { | 
 |  |  |         this.type = type; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public static Integer getWorkNoType(Integer ioType) { | 
 |  |  |         switch (ioType) { | 
 |  |  |             case 1: | 
 |  |  |                 return PAKIN.type; | 
 |  |  |             case 10: | 
 |  |  |                 return PAKIN.type; | 
 |  |  |             case 11: | 
 |  |  |                 return PICK.type; | 
 |  |  |             case 53: | 
 |  |  |             case 54: | 
 |  |  |             case 57: | 
 |  |  |                 return PICK.type; | 
 |  |  |             case 101: | 
 |  |  |                 return PAKOUT.type; | 
 |  |  |             case 103: | 
 |  |  |             case 104: | 
 |  |  |             case 107: | 
 |  |  |                 return PICK.type; | 
 |  |  |             case 110: | 
 |  |  |                 return PAKOUT.type; | 
 |  |  |             default: | 
 |  |  |                 break; | 
 |  |  |         } | 
 |  |  |         throw new CoolException(ioType + "的任务类型无法生成工作号"); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.asrs.domain.param; | 
 |  |  |  | 
 |  |  | import lombok.Data; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * @author pang.jiabao | 
 |  |  |  * @description 通知输送线流动 | 
 |  |  |  * @createDate 2025/5/15 14:27 | 
 |  |  |  */ | 
 |  |  | @Data | 
 |  |  | public class ApplyInDevpDto { | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 源站点 | 
 |  |  |      */ | 
 |  |  |     private Integer sourceSite; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 目标站点 | 
 |  |  |      */ | 
 |  |  |     private Integer targetSite; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 0:1.6, 1:1.8, 2:2.4 | 
 |  |  |      */ | 
 |  |  |     private Integer flag; | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.asrs.domain.param; | 
 |  |  |  | 
 |  |  | import lombok.Data; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * 堆垛机演示操作入参 | 
 |  |  |  * Created by vincent on 2020-06-03 | 
 |  |  |  */ | 
 |  |  | @Data | 
 |  |  | public class CrnDemoParam { | 
 |  |  |  | 
 |  |  |     // 操作类型 1: 打开;  0: 关闭 | 
 |  |  |     private Integer crnId; | 
 |  |  |  | 
 |  |  |     // 密码口令 | 
 |  |  |     private String password; | 
 |  |  |  | 
 |  |  |     private Boolean opt; | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.asrs.domain.param; | 
 |  |  |  | 
 |  |  | import lombok.Data; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * Created by vincent on 2020-06-02 | 
 |  |  |  */ | 
 |  |  | @Data | 
 |  |  | public class CrnOperatorParam { | 
 |  |  |  | 
 |  |  |     // 堆垛机号 | 
 |  |  |     private Integer crnNo; | 
 |  |  |  | 
 |  |  |     // 源站 | 
 |  |  |     private Short sourceStaNo; | 
 |  |  |  | 
 |  |  |     // 源库位-排 | 
 |  |  |     private Short sourceRow; | 
 |  |  |  | 
 |  |  |     // 源库位-列 | 
 |  |  |     private Short sourceBay; | 
 |  |  |  | 
 |  |  |     // 源库位-层 | 
 |  |  |     private Short sourceLev; | 
 |  |  |  | 
 |  |  |     // 目标站 | 
 |  |  |     private Short staNo; | 
 |  |  |  | 
 |  |  |     // 目标库位-排 | 
 |  |  |     private Short row; | 
 |  |  |  | 
 |  |  |     // 目标库位-列 | 
 |  |  |     private Short bay; | 
 |  |  |  | 
 |  |  |     // 目标库位-层 | 
 |  |  |     private Short lev; | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.asrs.domain.param; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * 系统运行状态操作入参 | 
 |  |  |  * Created by vincent on 2020-06-03 | 
 |  |  |  */ | 
 |  |  | public class SystemSwitchParam { | 
 |  |  |  | 
 |  |  |     // 操作类型 1: 打开;  0: 关闭 | 
 |  |  |     private Integer operatorType; | 
 |  |  |  | 
 |  |  |     // 密码口令 | 
 |  |  |     private String password; | 
 |  |  |  | 
 |  |  |     public Integer getOperatorType() { | 
 |  |  |         return operatorType; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public void setOperatorType(Integer operatorType) { | 
 |  |  |         this.operatorType = operatorType; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public String getPassword() { | 
 |  |  |         return password; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public void setPassword(String password) { | 
 |  |  |         this.password = password; | 
 |  |  |     } | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.asrs.domain.vo; | 
 |  |  |  | 
 |  |  | import lombok.Data; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * 扫码器实时数据视图对象 | 
 |  |  |  * Created by vincent on 2020-06-03 | 
 |  |  |  */ | 
 |  |  | @Data | 
 |  |  | public class BarcodeDataVo { | 
 |  |  |  | 
 |  |  |     // 扫码器编号 | 
 |  |  |     private Integer barcodeId; | 
 |  |  |  | 
 |  |  |     // 扫码器内容 | 
 |  |  |     private String codeValue; | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.asrs.domain.vo; | 
 |  |  |  | 
 |  |  | import lombok.Data; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * Created by vincent on 2020-06-02 | 
 |  |  |  */ | 
 |  |  | @Data | 
 |  |  | public class CommandLogVo { | 
 |  |  |  | 
 |  |  |     // 堆垛机编号 | 
 |  |  |     private Integer crnNo; | 
 |  |  |  | 
 |  |  |     // 状态 | 
 |  |  |     private Integer status; | 
 |  |  |  | 
 |  |  |     // 命令报文 | 
 |  |  |     private String command; | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.asrs.domain.vo; | 
 |  |  |  | 
 |  |  | import lombok.Data; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * 堆垛机详情视图对象 | 
 |  |  |  * Created by vincent on 2020-06-03 | 
 |  |  |  */ | 
 |  |  | @Data | 
 |  |  | public class CrnDetailVo { | 
 |  |  |  | 
 |  |  |     // 堆垛机号 | 
 |  |  |     private Integer crnNo; | 
 |  |  |  | 
 |  |  |     // 工作号 | 
 |  |  |     private Short workNo; | 
 |  |  |  | 
 |  |  |     // 源站 | 
 |  |  |     private String sourceStaNo = ""; | 
 |  |  |  | 
 |  |  |     // 目标站 | 
 |  |  |     private String staNo = ""; | 
 |  |  |  | 
 |  |  |     // 工作状态 | 
 |  |  |     private String wrkSts = ""; | 
 |  |  |  | 
 |  |  |     // 出入类型 | 
 |  |  |     private String ioType = ""; | 
 |  |  |  | 
 |  |  |     // 源库位 | 
 |  |  |     private String sourceLocNo = ""; | 
 |  |  |  | 
 |  |  |     // 目标库位 | 
 |  |  |     private String locNo = ""; | 
 |  |  |  | 
 |  |  |     // 堆垛机状态 | 
 |  |  |     private String crnStatus = ""; | 
 |  |  |  | 
 |  |  |     // 异常 | 
 |  |  |     private String error = ""; | 
 |  |  |  | 
 |  |  |     // 可入 | 
 |  |  |     private String inEnable = ""; | 
 |  |  |  | 
 |  |  |     // 可出 | 
 |  |  |     private String outEnable = ""; | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.asrs.domain.vo; | 
 |  |  |  | 
 |  |  | import com.zy.asrs.domain.enums.CrnStatusType; | 
 |  |  | import lombok.Data; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * 堆垛机最新数据视图对象 | 
 |  |  |  * Created by vincent on 2020-06-01 | 
 |  |  |  */ | 
 |  |  | @Data | 
 |  |  | public class CrnLatestDataVo { | 
 |  |  |  | 
 |  |  |     // 堆垛机编号 | 
 |  |  |     private Integer crnId; | 
 |  |  |  | 
 |  |  |     // 偏移量 | 
 |  |  |     private Double offset; | 
 |  |  |  | 
 |  |  |     // 当前列 | 
 |  |  |     private Short bay; | 
 |  |  |  | 
 |  |  |     private CrnStatusType crnStatus; | 
 |  |  |  | 
 |  |  |     public String getCrnStatus() { | 
 |  |  |         return crnStatus.toString().toLowerCase().replaceAll("_", "-"); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.asrs.domain.vo; | 
 |  |  |  | 
 |  |  | import com.zy.asrs.utils.Utils; | 
 |  |  | import com.zy.core.enums.CrnStatusType; | 
 |  |  | import lombok.Data; | 
 |  |  |  | 
 |  |  | @Data | 
 |  |  | public class CrnListVo { | 
 |  |  |  | 
 |  |  |     // 堆垛机号 | 
 |  |  |     private Integer crnNo; | 
 |  |  |  | 
 |  |  |     // 模式 | 
 |  |  |     private String statusType = "-"; | 
 |  |  |  | 
 |  |  |     // 有物 | 
 |  |  |     private String loading = "-"; | 
 |  |  |  | 
 |  |  |     // 列 | 
 |  |  |     private Short bay; | 
 |  |  |  | 
 |  |  |     // 层 | 
 |  |  |     private Short lev; | 
 |  |  |  | 
 |  |  |     // 走行原点 | 
 |  |  |     private String xOrigin = "-"; | 
 |  |  |  | 
 |  |  |     // 升降原点 | 
 |  |  |     private String yOrigin = "-"; | 
 |  |  |  | 
 |  |  |     // 货叉位置 | 
 |  |  |     private String forkOffset = "-"; | 
 |  |  |  | 
 |  |  |     // 载货台位置 | 
 |  |  |     private String liftPos = "-"; | 
 |  |  |  | 
 |  |  |     // 走行定位 | 
 |  |  |     private String walkPos = "-"; | 
 |  |  |  | 
 |  |  |     // 急停 | 
 |  |  |     private String stop = "-"; | 
 |  |  |  | 
 |  |  |     // 列坐标 | 
 |  |  |     private String bayCoor = "-"; | 
 |  |  |  | 
 |  |  |     // 层坐标 | 
 |  |  |     private String levCoor = "-"; | 
 |  |  |  | 
 |  |  |     // 完成 | 
 |  |  |     private String complete = "-"; | 
 |  |  |  | 
 |  |  |     // 任务号 | 
 |  |  |     private Short workNo = 0; | 
 |  |  |  | 
 |  |  |     // 任务状态 | 
 |  |  |     private Integer wrkStatus; | 
 |  |  |  | 
 |  |  |     // 异常码 | 
 |  |  |     private String warnCode = "-"; | 
 |  |  |  | 
 |  |  |     // 垂直故障码 | 
 |  |  |     private String alarm = "-"; | 
 |  |  |  | 
 |  |  |     // 源站 | 
 |  |  |     private String sourceStaNo = "-"; | 
 |  |  |  | 
 |  |  |     // 目标站 | 
 |  |  |     private String staNo = "-"; | 
 |  |  |  | 
 |  |  |     // 源库位 | 
 |  |  |     private String sourceLocNo = "-"; | 
 |  |  |  | 
 |  |  |     // 目标库位 | 
 |  |  |     private String locNo = "-"; | 
 |  |  |  | 
 |  |  |     // 异常 | 
 |  |  |     private String error = ""; | 
 |  |  |  | 
 |  |  |     // 原点 | 
 |  |  |     private String origin = ""; | 
 |  |  |  | 
 |  |  |     // 命令 | 
 |  |  |     private String command = ""; | 
 |  |  |  | 
 |  |  |     // 走行速度(m/min) | 
 |  |  |     private Float xspeed = 0.0F; | 
 |  |  |  | 
 |  |  |     // 升降速度(m/min) | 
 |  |  |     private Float yspeed = 0.0F; | 
 |  |  |  | 
 |  |  |     // 叉牙速度(m/min) | 
 |  |  |     private Float zspeed = 0.0F; | 
 |  |  |  | 
 |  |  |     // 走行距离(Km) | 
 |  |  |     private Float xdistance = 0.0F; | 
 |  |  |  | 
 |  |  |     // 升降距离(Km) | 
 |  |  |     private Float ydistance = 0.0F; | 
 |  |  |  | 
 |  |  |     // 走行时长(H) | 
 |  |  |     private Float xduration = 0.0F; | 
 |  |  |  | 
 |  |  |     // 升降时长(H) | 
 |  |  |     private Float yduration = 0.0F; | 
 |  |  |  | 
 |  |  |     // 设备状态 | 
 |  |  |     private String deviceStatus = "-"; | 
 |  |  |  | 
 |  |  |     // 可入 | 
 |  |  |     private String inEnable; | 
 |  |  |  | 
 |  |  |     // 可出 | 
 |  |  |     private String outEnable; | 
 |  |  |  | 
 |  |  |     public void setXspeed(Float xspeed) { | 
 |  |  |         this.xspeed = Utils.scale(xspeed); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public void setYspeed(Float yspeed) { | 
 |  |  |         this.yspeed = Utils.scale(yspeed); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public void setZspeed(Float zspeed) { | 
 |  |  |         this.zspeed = Utils.scale(zspeed); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public void setXdistance(Float xdistance) { | 
 |  |  |         this.xdistance = Utils.scale(xdistance); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public void setYdistance(Float ydistance) { | 
 |  |  |         this.ydistance = Utils.scale(ydistance); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public void setXduration(Float xduration) { | 
 |  |  |         this.xduration = Utils.scale(xduration); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public void setYduration(Float yduration) { | 
 |  |  |         this.yduration = Utils.scale(yduration); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public String getWrkStatus$() { | 
 |  |  |         if (this.wrkStatus == null) { | 
 |  |  |             return "-"; | 
 |  |  |         } | 
 |  |  |         return CrnStatusType.get(this.wrkStatus.shortValue()).desc; | 
 |  |  |     } | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | //package com.zy.acs.wcs.asrs.domain.vo; | 
 |  |  | // | 
 |  |  | //import com.zy.asrs.utils.Utils; | 
 |  |  | //import lombok.Data; | 
 |  |  | // | 
 |  |  | ///** | 
 |  |  | // * Created by vincent on 2020-06-02 | 
 |  |  | // */ | 
 |  |  | //@Data | 
 |  |  | //public class CrnMsgTableVo { | 
 |  |  | // | 
 |  |  | //    // 堆垛机号 | 
 |  |  | //    private Integer crnNo; | 
 |  |  | // | 
 |  |  | //    // 工作号 | 
 |  |  | //    private Short workNo = 0; | 
 |  |  | // | 
 |  |  | //    // 状态 | 
 |  |  | //    private String status = "-"; | 
 |  |  | // | 
 |  |  | //    // 源站 | 
 |  |  | //    private String sourceStaNo = "-"; | 
 |  |  | // | 
 |  |  | //    // 目标站 | 
 |  |  | //    private String staNo = "-"; | 
 |  |  | // | 
 |  |  | //    // 源库位 | 
 |  |  | //    private String sourceLocNo = "-"; | 
 |  |  | // | 
 |  |  | //    // 目标库位 | 
 |  |  | //    private String locNo = "-"; | 
 |  |  | // | 
 |  |  | //    // 异常 | 
 |  |  | //    private String error = ""; | 
 |  |  | // | 
 |  |  | //    // 原点 | 
 |  |  | //    private String origin = ""; | 
 |  |  | // | 
 |  |  | //    // 命令 | 
 |  |  | //    private String command = ""; | 
 |  |  | // | 
 |  |  | //    // 走行速度(m/min) | 
 |  |  | //    private Float xspeed = 0.0F; | 
 |  |  | // | 
 |  |  | //    // 升降速度(m/min) | 
 |  |  | //    private Float yspeed = 0.0F; | 
 |  |  | // | 
 |  |  | //    // 叉牙速度(m/min) | 
 |  |  | //    private Float zspeed = 0.0F; | 
 |  |  | // | 
 |  |  | //    // 走行距离(Km) | 
 |  |  | //    private Float xdistance = 0.0F; | 
 |  |  | // | 
 |  |  | //    // 升降距离(Km) | 
 |  |  | //    private Float ydistance = 0.0F; | 
 |  |  | // | 
 |  |  | //    // 走行时长(H) | 
 |  |  | //    private Float xduration = 0.0F; | 
 |  |  | // | 
 |  |  | //    // 升降时长(H) | 
 |  |  | //    private Float yduration = 0.0F; | 
 |  |  | // | 
 |  |  | //    public void setXspeed(Float xspeed) { | 
 |  |  | //        this.xspeed = Utils.scale(xspeed); | 
 |  |  | //    } | 
 |  |  | // | 
 |  |  | //    public void setYspeed(Float yspeed) { | 
 |  |  | //        this.yspeed = Utils.scale(yspeed); | 
 |  |  | //    } | 
 |  |  | // | 
 |  |  | //    public void setZspeed(Float zspeed) { | 
 |  |  | //        this.zspeed = Utils.scale(zspeed); | 
 |  |  | //    } | 
 |  |  | // | 
 |  |  | //    public void setXdistance(Float xdistance) { | 
 |  |  | //        this.xdistance = Utils.scale(xdistance); | 
 |  |  | //    } | 
 |  |  | // | 
 |  |  | //    public void setYdistance(Float ydistance) { | 
 |  |  | //        this.ydistance = Utils.scale(ydistance); | 
 |  |  | //    } | 
 |  |  | // | 
 |  |  | //    public void setXduration(Float xduration) { | 
 |  |  | //        this.xduration = Utils.scale(xduration); | 
 |  |  | //    } | 
 |  |  | // | 
 |  |  | //    public void setYduration(Float yduration) { | 
 |  |  | //        this.yduration = Utils.scale(yduration); | 
 |  |  | //    } | 
 |  |  | //} | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.asrs.domain.vo; | 
 |  |  |  | 
 |  |  | import lombok.Data; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * Created by vincent on 2020-06-02 | 
 |  |  |  */ | 
 |  |  | @Data | 
 |  |  | public class CrnStateTableVo { | 
 |  |  |  | 
 |  |  |     // 堆垛机号 | 
 |  |  |     private Integer crnNo; | 
 |  |  |  | 
 |  |  |     // 模式 | 
 |  |  |     private String statusType = "-"; | 
 |  |  |  | 
 |  |  |     // 有物 | 
 |  |  |     private String loading = "-"; | 
 |  |  |  | 
 |  |  |     // 列 | 
 |  |  |     private Short bay; | 
 |  |  |  | 
 |  |  |     // 层 | 
 |  |  |     private Short lev; | 
 |  |  |  | 
 |  |  |     // 走行原点 | 
 |  |  |     private String xOrigin = "-"; | 
 |  |  |  | 
 |  |  |     // 升降原点 | 
 |  |  |     private String yOrigin = "-"; | 
 |  |  |  | 
 |  |  |     // 货叉位置 | 
 |  |  |     private String forkOffset = "-"; | 
 |  |  |  | 
 |  |  |     // 载货台位置 | 
 |  |  |     private String liftPos = "-"; | 
 |  |  |  | 
 |  |  |     // 走行定位 | 
 |  |  |     private String walkPos = "-"; | 
 |  |  |  | 
 |  |  |     // 急停 | 
 |  |  |     private String stop = "-"; | 
 |  |  |  | 
 |  |  |     // 列坐标 | 
 |  |  |     private String bayCoor = "-"; | 
 |  |  |  | 
 |  |  |     // 层坐标 | 
 |  |  |     private String levCoor = "-"; | 
 |  |  |  | 
 |  |  |     // 完成 | 
 |  |  |     private String complete = "-"; | 
 |  |  |  | 
 |  |  |     // 任务号 | 
 |  |  |     private Short workNo = 0; | 
 |  |  |  | 
 |  |  |     // 状态 | 
 |  |  |     private String status = "-"; | 
 |  |  |  | 
 |  |  |     // 异常码 | 
 |  |  |     private String warnCode = "-"; | 
 |  |  |  | 
 |  |  |     // 垂直故障码 | 
 |  |  |     private String alarm = "-"; | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.asrs.domain.vo; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * 库位占用百分比 | 
 |  |  |  * | 
 |  |  |  * @author admin | 
 |  |  |  * @date 2018年12月12日 | 
 |  |  |  */ | 
 |  |  | public class LocChartPie { | 
 |  |  |     private int fqty; | 
 |  |  |     private int oqty; | 
 |  |  |     private int uqty; | 
 |  |  |     private int xqty; | 
 |  |  |  | 
 |  |  |     public int getFqty() { | 
 |  |  |         return fqty; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public void setFqty(int fqty) { | 
 |  |  |         this.fqty = fqty; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public int getOqty() { | 
 |  |  |         return oqty; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public void setOqty(int oqty) { | 
 |  |  |         this.oqty = oqty; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public int getUqty() { | 
 |  |  |         return uqty; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public void setUqty(int uqty) { | 
 |  |  |         this.uqty = uqty; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public int getXqty() { | 
 |  |  |         return xqty; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public void setXqty(int xqty) { | 
 |  |  |         this.xqty = xqty; | 
 |  |  |     } | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.asrs.domain.vo; | 
 |  |  |  | 
 |  |  | import lombok.Data; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * Created by vincent on 2020-06-02 | 
 |  |  |  */ | 
 |  |  | @Data | 
 |  |  | public class PlcErrorTableVo { | 
 |  |  |  | 
 |  |  |     // 序号 | 
 |  |  |     private Integer no; | 
 |  |  |  | 
 |  |  |     // plc异常描述 | 
 |  |  |     private String plcDesc; | 
 |  |  |  | 
 |  |  |     // 异常 | 
 |  |  |     private String error; | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.asrs.domain.vo; | 
 |  |  |  | 
 |  |  | import lombok.Data; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * 磅秤实时数据视图对象 | 
 |  |  |  * Created by vincent on 2020-06-03 | 
 |  |  |  */ | 
 |  |  | @Data | 
 |  |  | public class ScaleDataVo { | 
 |  |  |  | 
 |  |  |     // 磅秤编号 | 
 |  |  |     private Integer scaleId; | 
 |  |  |  | 
 |  |  |     // 磅秤内容 | 
 |  |  |     private String value; | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.asrs.domain.vo; | 
 |  |  |  | 
 |  |  | import lombok.Data; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * 输送设备详情视图对象 | 
 |  |  |  * Created by vincent on 2020-06-03 | 
 |  |  |  */ | 
 |  |  | @Data | 
 |  |  | public class SiteDetailVo { | 
 |  |  |  | 
 |  |  |     // 站点编号 | 
 |  |  |     private Integer siteId; | 
 |  |  |  | 
 |  |  |     // 工作号 | 
 |  |  |     private Short workNo; | 
 |  |  |  | 
 |  |  |     // 工作状态 | 
 |  |  |     private String wrkSts = ""; | 
 |  |  |  | 
 |  |  |     // 自动 | 
 |  |  |     private String autoing; | 
 |  |  |  | 
 |  |  |     // 有物 | 
 |  |  |     private String loading; | 
 |  |  |  | 
 |  |  |     // 能入 | 
 |  |  |     private String canining; | 
 |  |  |  | 
 |  |  |     // 能出 | 
 |  |  |     private String canouting; | 
 |  |  |  | 
 |  |  |     // 出入类型 | 
 |  |  |     private String ioType = ""; | 
 |  |  |  | 
 |  |  |     // 源站 | 
 |  |  |     private String sourceStaNo = ""; | 
 |  |  |  | 
 |  |  |     // 目标站 | 
 |  |  |     private String staNo = ""; | 
 |  |  |  | 
 |  |  |     // 源库位 | 
 |  |  |     private String sourceLocNo = ""; | 
 |  |  |  | 
 |  |  |     // 目标库位 | 
 |  |  |     private String locNo = ""; | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.asrs.domain.vo; | 
 |  |  |  | 
 |  |  | import com.zy.asrs.domain.enums.SiteStatusType; | 
 |  |  | import lombok.Data; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * 站点最新数据视图对象 | 
 |  |  |  * Created by vincent on 2020-06-01 | 
 |  |  |  */ | 
 |  |  | @Data | 
 |  |  | public class SiteLatestDataVo { | 
 |  |  |  | 
 |  |  |     // 站点编号 | 
 |  |  |     private String siteId; | 
 |  |  |  | 
 |  |  |     // 工作号 | 
 |  |  |     private Short workNo; | 
 |  |  |  | 
 |  |  |     // 站点状态 | 
 |  |  |     private SiteStatusType siteStatus; | 
 |  |  |  | 
 |  |  |     // 隔壁站点(台车特性) | 
 |  |  |     private String nearbySta; | 
 |  |  |  | 
 |  |  |     public String getSiteStatus() { | 
 |  |  |         return siteStatus.toString().toLowerCase().replaceAll("_", "-"); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.asrs.domain.vo; | 
 |  |  |  | 
 |  |  | import lombok.Data; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * Created by vincent on 2020-06-02 | 
 |  |  |  */ | 
 |  |  | @Data | 
 |  |  | public class SiteTableVo { | 
 |  |  |  | 
 |  |  |     // 站号 | 
 |  |  |     private Integer devNo; | 
 |  |  |  | 
 |  |  |     // 工作号 | 
 |  |  |     private Short workNo = 0; | 
 |  |  |  | 
 |  |  |     // 自动 | 
 |  |  |     private String autoing = "-"; | 
 |  |  |  | 
 |  |  |     // 有物 | 
 |  |  |     private String loading = "-"; | 
 |  |  |  | 
 |  |  |     // 可入 | 
 |  |  |     private String inEnable = "-"; | 
 |  |  |  | 
 |  |  |     // 可出 | 
 |  |  |     private String outEnable = "-"; | 
 |  |  |  | 
 |  |  |     // 需求1 | 
 |  |  |     private String pakMk = "-"; | 
 |  |  |  | 
 |  |  |     // 空板信号 | 
 |  |  |     private String emptyMk = "-"; | 
 |  |  |  | 
 |  |  |     // 目标站 | 
 |  |  |     private Short staNo = 0; | 
 |  |  |  | 
 |  |  |     //高低库位 | 
 |  |  |     private String locType1 = "-"; | 
 |  |  |     private String car = "-"; | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.asrs.entity; | 
 |  |  |  | 
 |  |  | import com.baomidou.mybatisplus.annotation.IdType; | 
 |  |  | import com.baomidou.mybatisplus.annotation.TableField; | 
 |  |  | import com.baomidou.mybatisplus.annotation.TableId; | 
 |  |  | import com.baomidou.mybatisplus.annotation.TableName; | 
 |  |  | import com.zy.acs.framework.common.Cools; | 
 |  |  | import io.swagger.annotations.ApiModelProperty; | 
 |  |  | import lombok.Data; | 
 |  |  |  | 
 |  |  | import java.io.Serializable; | 
 |  |  | import java.text.SimpleDateFormat; | 
 |  |  | import java.util.Date; | 
 |  |  |  | 
 |  |  | @Data | 
 |  |  | @TableName("asr_bas_devp") | 
 |  |  | public class BasDevp implements Serializable { | 
 |  |  |  | 
 |  |  |     private static final long serialVersionUID = 1L; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 编号 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "编号") | 
 |  |  |     @TableId(value = "dev_no", type = IdType.INPUT) | 
 |  |  |     @TableField("dev_no") | 
 |  |  |     private Integer devNo; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 设备描述 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "设备描述") | 
 |  |  |     @TableField("dec_desc") | 
 |  |  |     private String decDesc; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 备注 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "备注") | 
 |  |  |     @TableField("dev_mk") | 
 |  |  |     private String devMk; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 可入 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "可入") | 
 |  |  |     @TableField("in_enable") | 
 |  |  |     private String inEnable; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 可出 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "可出") | 
 |  |  |     @TableField("out_enable") | 
 |  |  |     private String outEnable; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 自动 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "自动") | 
 |  |  |     private String autoing; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 有物 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "有物") | 
 |  |  |     private String loading; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 能入 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "能入") | 
 |  |  |     private String canining; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 能出 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "能出") | 
 |  |  |     private String canouting; | 
 |  |  |  | 
 |  |  |     @ApiModelProperty(value = "") | 
 |  |  |     private String fronting; | 
 |  |  |  | 
 |  |  |     @ApiModelProperty(value = "") | 
 |  |  |     private String rearing; | 
 |  |  |  | 
 |  |  |     @ApiModelProperty(value = "") | 
 |  |  |     private String uping; | 
 |  |  |  | 
 |  |  |     @ApiModelProperty(value = "") | 
 |  |  |     private String downing; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 需求1 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "需求1") | 
 |  |  |     private String inreq1; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 需求2 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "需求2") | 
 |  |  |     private String inreq2; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 工作号 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "工作号") | 
 |  |  |     @TableField("wrk_no") | 
 |  |  |     private Integer wrkNo; | 
 |  |  |  | 
 |  |  |     @ApiModelProperty(value = "") | 
 |  |  |     @TableField("wrk_no1") | 
 |  |  |     private Integer wrkNo1; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 容器类型 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "容器类型") | 
 |  |  |     @TableField("ctn_type") | 
 |  |  |     private Integer ctnType; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 条形码 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "条形码") | 
 |  |  |     private String barcode; | 
 |  |  |  | 
 |  |  |     @ApiModelProperty(value = "入库暂存数") | 
 |  |  |     @TableField("in_qty") | 
 |  |  |     private Integer inQty; | 
 |  |  |  | 
 |  |  |     @ApiModelProperty(value = "") | 
 |  |  |     private Integer row1; | 
 |  |  |  | 
 |  |  |     @ApiModelProperty(value = "") | 
 |  |  |     @TableField("io_time") | 
 |  |  |     private Date ioTime; | 
 |  |  |  | 
 |  |  |     @ApiModelProperty(value = "") | 
 |  |  |     private String area; | 
 |  |  |  | 
 |  |  |     @ApiModelProperty(value = "") | 
 |  |  |     @TableField("in_ok") | 
 |  |  |     private String inOk; | 
 |  |  |  | 
 |  |  |     @ApiModelProperty(value = "") | 
 |  |  |     @TableField("out_ok") | 
 |  |  |     private String outOk; | 
 |  |  |  | 
 |  |  |     @ApiModelProperty(value = "高低类型{0:未知,1:低库位,2:高库位}") | 
 |  |  |     @TableField("loc_type1") | 
 |  |  |     private Short locType1; | 
 |  |  |  | 
 |  |  |     @ApiModelProperty(value = "宽窄类型{0:未知,1:窄库位,2:宽库位}") | 
 |  |  |     @TableField("loc_type2") | 
 |  |  |     private Short locType2; | 
 |  |  |  | 
 |  |  |     @ApiModelProperty(value = "轻重类型{0:未知,1:轻库位,2:重库位}") | 
 |  |  |     @TableField("loc_type3") | 
 |  |  |     private Short locType3; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 修改人员 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "修改人员") | 
 |  |  |     @TableField("modi_user") | 
 |  |  |     private Long modiUser; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 修改时间 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "修改时间") | 
 |  |  |     @TableField("modi_time") | 
 |  |  |     private Date modiTime; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 创建者 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "创建者") | 
 |  |  |     @TableField("appe_user") | 
 |  |  |     private Long appeUser; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 添加时间 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "添加时间") | 
 |  |  |     @TableField("appe_time") | 
 |  |  |     private Date appeTime; | 
 |  |  |  | 
 |  |  |     @ApiModelProperty(value = "") | 
 |  |  |     @TableField("std_qty") | 
 |  |  |     private Double stdQty; | 
 |  |  |  | 
 |  |  |     @ApiModelProperty(value = "") | 
 |  |  |     @TableField("min_wt") | 
 |  |  |     private Double minWt; | 
 |  |  |  | 
 |  |  |     @ApiModelProperty(value = "") | 
 |  |  |     @TableField("max_wt") | 
 |  |  |     private Double maxWt; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 重量 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "重量") | 
 |  |  |     @TableField("gross_wt") | 
 |  |  |     private Double grossWt; | 
 |  |  |  | 
 |  |  |     @ApiModelProperty(value = "") | 
 |  |  |     @TableField("cart_pos") | 
 |  |  |     private Integer cartPos; | 
 |  |  |  | 
 |  |  |     @ApiModelProperty(value = "") | 
 |  |  |     @TableField("agv_start_pick") | 
 |  |  |     private Integer agvStartPick; | 
 |  |  |  | 
 |  |  |     @ApiModelProperty(value = "") | 
 |  |  |     @TableField("agv_target_pick") | 
 |  |  |     private Integer agvTargetPick; | 
 |  |  |  | 
 |  |  |     @ApiModelProperty(value = "") | 
 |  |  |     @TableField("agv_start_place") | 
 |  |  |     private Integer agvStartPlace; | 
 |  |  |  | 
 |  |  |     @ApiModelProperty(value = "") | 
 |  |  |     @TableField("agv_target_place") | 
 |  |  |     private Integer agvTargetPlace; | 
 |  |  |  | 
 |  |  |     @ApiModelProperty(value = "异常码") | 
 |  |  |     @TableField("sta_err") | 
 |  |  |     private Integer staErr; | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     public String getIoTime$() { | 
 |  |  |         if (Cools.isEmpty(this.ioTime)) { | 
 |  |  |             return ""; | 
 |  |  |         } | 
 |  |  |         return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.ioTime); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public String getLocType1$() { | 
 |  |  |         if (null == this.locType1) { | 
 |  |  |             return null; | 
 |  |  |         } | 
 |  |  |         switch (this.locType1) { | 
 |  |  |             case 0: | 
 |  |  |                 return "未知"; | 
 |  |  |             case 1: | 
 |  |  |                 return "低库位"; | 
 |  |  |             case 2: | 
 |  |  |                 return "高库位"; | 
 |  |  |             default: | 
 |  |  |                 return String.valueOf(this.locType1); | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public String getLocType2$() { | 
 |  |  |         if (null == this.locType2) { | 
 |  |  |             return null; | 
 |  |  |         } | 
 |  |  |         switch (this.locType2) { | 
 |  |  |             case 0: | 
 |  |  |                 return "未知"; | 
 |  |  |             case 1: | 
 |  |  |                 return "窄库位"; | 
 |  |  |             case 2: | 
 |  |  |                 return "宽库位"; | 
 |  |  |             default: | 
 |  |  |                 return String.valueOf(this.locType2); | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public String getLocType3$() { | 
 |  |  |         if (null == this.locType3) { | 
 |  |  |             return null; | 
 |  |  |         } | 
 |  |  |         switch (this.locType3) { | 
 |  |  |             case 0: | 
 |  |  |                 return "未知"; | 
 |  |  |             case 1: | 
 |  |  |                 return "轻库位"; | 
 |  |  |             case 2: | 
 |  |  |                 return "重库位"; | 
 |  |  |             default: | 
 |  |  |                 return String.valueOf(this.locType3); | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     public String getModiTime$() { | 
 |  |  |         if (Cools.isEmpty(this.modiTime)) { | 
 |  |  |             return ""; | 
 |  |  |         } | 
 |  |  |         return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.modiTime); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     public String getAppeTime$() { | 
 |  |  |         if (Cools.isEmpty(this.appeTime)) { | 
 |  |  |             return ""; | 
 |  |  |         } | 
 |  |  |         return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.appeTime); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.asrs.entity; | 
 |  |  |  | 
 |  |  | import com.baomidou.mybatisplus.annotation.IdType; | 
 |  |  | import com.baomidou.mybatisplus.annotation.TableId; | 
 |  |  | import com.baomidou.mybatisplus.annotation.TableName; | 
 |  |  | import com.zy.acs.framework.common.Cools; | 
 |  |  | import com.zy.acs.framework.common.SpringUtils; | 
 |  |  | import io.swagger.annotations.ApiModelProperty; | 
 |  |  | import lombok.Data; | 
 |  |  |  | 
 |  |  | import java.io.Serializable; | 
 |  |  | import java.util.Date; | 
 |  |  |  | 
 |  |  | @Data | 
 |  |  | @TableName("man_loc") | 
 |  |  | public class Loc 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 uuid; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 库区 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value= "库区") | 
 |  |  |     private Long zoneId; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 库位编号 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value= "库位编号") | 
 |  |  |     private String locNo; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 名称 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value= "名称") | 
 |  |  |     private String name; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 条码 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value= "条码") | 
 |  |  |     private Long code; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 比码方向阈 1:  大于  0    小于 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value= "比码方向阈 1:  大于  0    小于") | 
 |  |  |     private Integer compDirect; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 库位状态 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value= "库位状态") | 
 |  |  |     private Long locSts; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 偏移量 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value= "偏移量") | 
 |  |  |     private Double offset; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 排 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value= "排") | 
 |  |  |     private Integer row; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 列 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value= "列") | 
 |  |  |     private Integer bay; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 层 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value= "层") | 
 |  |  |     private Integer lev; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 库位码 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value= "库位码") | 
 |  |  |     private String barcode; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 托盘码 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value= "托盘码") | 
 |  |  |     private String zpallet; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 库位类型 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value= "库位类型") | 
 |  |  |     private Long locType; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 状态 1: 正常  0: 冻结   | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value= "状态 1: 正常  0: 冻结  ") | 
 |  |  |     private Integer status; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 是否删除 1: 是  0: 否   | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value= "是否删除 1: 是  0: 否  ") | 
 |  |  |     private Integer deleted; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 租户 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value= "租户") | 
 |  |  |     private Long tenantId; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 添加人员 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value= "添加人员") | 
 |  |  |     private Long createBy; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 添加时间 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value= "添加时间") | 
 |  |  |     private Date createTime; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 修改人员 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value= "修改人员") | 
 |  |  |     private Long updateBy; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 修改时间 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value= "修改时间") | 
 |  |  |     private Date updateTime; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 备注 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value= "备注") | 
 |  |  |     private String memo; | 
 |  |  |  | 
 |  |  |     public Loc() {} | 
 |  |  |  | 
 |  |  |     public Loc(String uuid, Long zoneId, String locNo, String name, Long code, Long locSts, Double offset, Integer row, Integer bay, Integer lev, String zpallet, Long locType, Integer status, Integer deleted, Long tenantId, Long createBy, Date createTime, Long updateBy, Date updateTime, String memo) { | 
 |  |  |         this.uuid = uuid; | 
 |  |  |         this.zoneId = zoneId; | 
 |  |  |         this.locNo = locNo; | 
 |  |  |         this.name = name; | 
 |  |  |         this.code = code; | 
 |  |  |         this.locSts = locSts; | 
 |  |  |         this.offset = offset; | 
 |  |  |         this.row = row; | 
 |  |  |         this.bay = bay; | 
 |  |  |         this.lev = lev; | 
 |  |  |         this.zpallet = zpallet; | 
 |  |  |         this.locType = locType; | 
 |  |  |         this.status = status; | 
 |  |  |         this.deleted = deleted; | 
 |  |  |         this.tenantId = tenantId; | 
 |  |  |         this.createBy = createBy; | 
 |  |  |         this.createTime = createTime; | 
 |  |  |         this.updateBy = updateBy; | 
 |  |  |         this.updateTime = updateTime; | 
 |  |  |         this.memo = memo; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | //    Loc loc = new Loc( | 
 |  |  | //            null,    // 编号 | 
 |  |  | //            null,    // 库区 | 
 |  |  | //            null,    // 库位编号 | 
 |  |  | //            null,    // 名称 | 
 |  |  | //            null,    // 条码 | 
 |  |  | //            null,    // 库位状态 | 
 |  |  | //            null,    // 偏移量 | 
 |  |  | //            null,    // 排 | 
 |  |  | //            null,    // 列 | 
 |  |  | //            null,    // 层 | 
 |  |  | //            null,    // 托盘码 | 
 |  |  | //            null,    // 库位类型 | 
 |  |  | //            null,    // 状态[非空] | 
 |  |  | //            null,    // 是否删除[非空] | 
 |  |  | //            null,    // 租户 | 
 |  |  | //            null,    // 添加人员 | 
 |  |  | //            null,    // 添加时间[非空] | 
 |  |  | //            null,    // 修改人员 | 
 |  |  | //            null,    // 修改时间 | 
 |  |  | //            null    // 备注 | 
 |  |  | //    ); | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.asrs.entity; | 
 |  |  |  | 
 |  |  | import com.baomidou.mybatisplus.annotation.IdType; | 
 |  |  | import com.baomidou.mybatisplus.annotation.TableField; | 
 |  |  | import com.baomidou.mybatisplus.annotation.TableId; | 
 |  |  | import com.baomidou.mybatisplus.annotation.TableName; | 
 |  |  | import io.swagger.annotations.ApiModelProperty; | 
 |  |  | import lombok.Data; | 
 |  |  |  | 
 |  |  | import java.io.Serializable; | 
 |  |  | import java.util.Date; | 
 |  |  |  | 
 |  |  | @Data | 
 |  |  | @TableName("asr_sta_desc") | 
 |  |  | public class StaDesc implements Serializable { | 
 |  |  |  | 
 |  |  |     private static final long serialVersionUID = 1L; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 路径ID | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "路径ID") | 
 |  |  |     @TableId(value = "type_id", type = IdType.AUTO) | 
 |  |  |     @TableField("type_id") | 
 |  |  |     private Long typeId; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 入出库类型 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "入出库类型") | 
 |  |  |     @TableId(value = "type_no", type = IdType.INPUT) | 
 |  |  |     @TableField("type_no") | 
 |  |  |     private Integer typeNo; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 作业类型 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "作业类型") | 
 |  |  |     @TableField("type_desc") | 
 |  |  |     private String typeDesc; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 作业站点 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "作业站点") | 
 |  |  |     @TableId(value = "stn_no", type = IdType.INPUT) | 
 |  |  |     @TableField("stn_no") | 
 |  |  |     private Integer stnNo; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 站点名称 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "站点名称") | 
 |  |  |     @TableField("stn_desc") | 
 |  |  |     private String stnDesc; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 地图号 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "地图号") | 
 |  |  |     @TableId(value = "zone_id", type = IdType.INPUT) | 
 |  |  |     @TableField("zone_id") | 
 |  |  |     private Integer zoneId; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 堆垛机站点 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "堆垛机站点") | 
 |  |  |     @TableField("crn_stn") | 
 |  |  |     private Integer crnStn; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 备注 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "备注") | 
 |  |  |     private String memo; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 修改人员 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "修改人员") | 
 |  |  |     @TableField("modi_user") | 
 |  |  |     private Long modiUser; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 修改时间 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "修改时间") | 
 |  |  |     @TableField("modi_time") | 
 |  |  |     private Date modiTime; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 创建者 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "创建者") | 
 |  |  |     @TableField("appe_user") | 
 |  |  |     private Long appeUser; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 添加时间 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "添加时间") | 
 |  |  |     @TableField("appe_time") | 
 |  |  |     private Date appeTime; | 
 |  |  |  | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.asrs.entity; | 
 |  |  |  | 
 |  |  | import com.baomidou.mybatisplus.annotation.IdType; | 
 |  |  | import com.baomidou.mybatisplus.annotation.TableId; | 
 |  |  | import com.baomidou.mybatisplus.annotation.TableName; | 
 |  |  | import io.swagger.annotations.ApiModelProperty; | 
 |  |  | import lombok.Data; | 
 |  |  |  | 
 |  |  | import java.io.Serializable; | 
 |  |  | import java.util.Date; | 
 |  |  |  | 
 |  |  | @Data | 
 |  |  | @TableName("man_task_report") | 
 |  |  | public class TaskReport 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 busNo; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 任务号 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "任务号") | 
 |  |  |     private String seqNum; | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 任务进度 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "任务进度") | 
 |  |  |     private Long taskSts; | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * AGV | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "AGV") | 
 |  |  |     private Long agvId; | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 起始站 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "起始站") | 
 |  |  |     private Long oriSta; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 起始库位 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "起始库位") | 
 |  |  |     private Long oriLoc; | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 目标站 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "目标站") | 
 |  |  |     private Long destSta; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 目标库位 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "目标库位") | 
 |  |  |     private Long destLoc; | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 托盘码 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "托盘码") | 
 |  |  |     private String zpallet; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 是否删除 1: 是  0: 否 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "是否删除 1: 是  0: 否  ") | 
 |  |  |     private Integer deleted; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 租户 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "租户") | 
 |  |  |     private Long tenantId; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 添加人员 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "添加人员") | 
 |  |  |     private Long createBy; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 添加时间 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "添加时间") | 
 |  |  |     private Date createTime; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 修改人员 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "修改人员") | 
 |  |  |     private Long updateBy; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 修改时间 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "修改时间") | 
 |  |  |     private Date updateTime; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 备注 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "备注") | 
 |  |  |     private String memo; | 
 |  |  |  | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.asrs.entity; | 
 |  |  |  | 
 |  |  | import com.baomidou.mybatisplus.annotation.IdType; | 
 |  |  | import com.baomidou.mybatisplus.annotation.TableId; | 
 |  |  | import com.baomidou.mybatisplus.annotation.TableName; | 
 |  |  | import io.swagger.annotations.ApiModelProperty; | 
 |  |  | import lombok.Data; | 
 |  |  |  | 
 |  |  | import java.io.Serializable; | 
 |  |  | import java.util.Date; | 
 |  |  |  | 
 |  |  | @Data | 
 |  |  | @TableName("man_task_report_log") | 
 |  |  | public class TaskReportLog 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 busNo; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 任务号 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "任务号") | 
 |  |  |     private String seqNum; | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 任务进度 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "任务进度") | 
 |  |  |     private Long taskSts; | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * AGV | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "AGV") | 
 |  |  |     private Long agvId; | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 起始站 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "起始站") | 
 |  |  |     private Long oriSta; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 起始库位 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "起始库位") | 
 |  |  |     private Long oriLoc; | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 目标站 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "目标站") | 
 |  |  |     private Long destSta; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 目标库位 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "目标库位") | 
 |  |  |     private Long destLoc; | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 托盘码 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "托盘码") | 
 |  |  |     private String zpallet; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 是否删除 1: 是  0: 否 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "是否删除 1: 是  0: 否  ") | 
 |  |  |     private Integer deleted; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 租户 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "租户") | 
 |  |  |     private Long tenantId; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 添加人员 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "添加人员") | 
 |  |  |     private Long createBy; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 添加时间 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "添加时间") | 
 |  |  |     private Date createTime; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 修改人员 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "修改人员") | 
 |  |  |     private Long updateBy; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 修改时间 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "修改时间") | 
 |  |  |     private Date updateTime; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 备注 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "备注") | 
 |  |  |     private String memo; | 
 |  |  |  | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.asrs.entity; | 
 |  |  |  | 
 |  |  | import com.baomidou.mybatisplus.annotation.TableField; | 
 |  |  | import com.baomidou.mybatisplus.annotation.TableName; | 
 |  |  | import com.zy.acs.framework.common.Cools; | 
 |  |  | import io.swagger.annotations.ApiModelProperty; | 
 |  |  | import lombok.Data; | 
 |  |  |  | 
 |  |  | import java.io.Serializable; | 
 |  |  | import java.text.SimpleDateFormat; | 
 |  |  | import java.util.Date; | 
 |  |  |  | 
 |  |  | @Data | 
 |  |  | @TableName("asr_wrk_detl") | 
 |  |  | public class WrkDetl implements Serializable { | 
 |  |  |  | 
 |  |  |     private static final long serialVersionUID = 1L; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 工作号 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "工作号") | 
 |  |  |     @TableField("wrk_no") | 
 |  |  |     private Integer wrkNo; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 工作时间 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "工作时间") | 
 |  |  |     @TableField("io_time") | 
 |  |  |     private Date ioTime; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 数量 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "数量") | 
 |  |  |     private Double anfme; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 托盘条码 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "托盘条码") | 
 |  |  |     private String zpallet; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 物料 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "商品编号") | 
 |  |  |     private String matnr; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 物料描述 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "商品名称") | 
 |  |  |     private String maktx; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 批号 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "批号") | 
 |  |  |     private String batch; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 单据编号 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "单据编号") | 
 |  |  |     @TableField("order_no") | 
 |  |  |     private String orderNo; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 规格 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "规格") | 
 |  |  |     private String specs; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 型号 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "型号") | 
 |  |  |     private String model; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 颜色 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "颜色") | 
 |  |  |     private String color; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 品牌 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "品牌") | 
 |  |  |     private String brand; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 单位 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "单位") | 
 |  |  |     private String unit; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 单价 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "单价") | 
 |  |  |     private Double price; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * sku | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "sku") | 
 |  |  |     private String sku; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 单位量 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "单位量") | 
 |  |  |     private Double units; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 条码 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "条码") | 
 |  |  |     private String barcode; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 产地 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "产地") | 
 |  |  |     private String origin; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 厂家 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "厂家") | 
 |  |  |     private String manu; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 生产日期 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "生产日期") | 
 |  |  |     @TableField("manu_date") | 
 |  |  |     private String manuDate; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 品项数 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "品项数") | 
 |  |  |     @TableField("item_num") | 
 |  |  |     private String itemNum; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 安全库存量 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "安全库存量") | 
 |  |  |     @TableField("safe_qty") | 
 |  |  |     private Double safeQty; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 重量 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "重量") | 
 |  |  |     private Double weight; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 长度 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "长度") | 
 |  |  |     @TableField("man_length") | 
 |  |  |     private Double manLength; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 体积 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "体积") | 
 |  |  |     private Double volume; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 三方编码 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "三方编码") | 
 |  |  |     @TableField("three_code") | 
 |  |  |     private String threeCode; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 供应商 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "供应商") | 
 |  |  |     private String supp; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 供应商编码 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "供应商编码") | 
 |  |  |     @TableField("supp_code") | 
 |  |  |     private String suppCode; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 是否批次 1: 是  0: 否 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "是否批次 1: 是  0: 否  ") | 
 |  |  |     @TableField("be_batch") | 
 |  |  |     private Integer beBatch; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 保质期 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "保质期") | 
 |  |  |     @TableField("dead_time") | 
 |  |  |     private String deadTime; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 预警天数 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "预警天数") | 
 |  |  |     @TableField("dead_warn") | 
 |  |  |     private Integer deadWarn; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 制购 1: 制造  2: 采购  3: 外协 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "制购 1: 制造  2: 采购  3: 外协  ") | 
 |  |  |     private Integer source; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 要求检验 1: 是  0: 否 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "要求检验 1: 是  0: 否  ") | 
 |  |  |     private Integer inspect; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 危险品 1: 是  0: 否 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "危险品 1: 是  0: 否  ") | 
 |  |  |     private Integer danger; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 修改人员 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "修改人员") | 
 |  |  |     @TableField("modi_user") | 
 |  |  |     private Long modiUser; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 修改时间 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "修改时间") | 
 |  |  |     @TableField("modi_time") | 
 |  |  |     private Date modiTime; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 创建者 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "创建者") | 
 |  |  |     @TableField("appe_user") | 
 |  |  |     private Long appeUser; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 添加时间 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "添加时间") | 
 |  |  |     @TableField("appe_time") | 
 |  |  |     private Date appeTime; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 备注 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "备注") | 
 |  |  |     private String memo; | 
 |  |  |  | 
 |  |  |     public String getIoTime$() { | 
 |  |  |         if (Cools.isEmpty(this.ioTime)) { | 
 |  |  |             return ""; | 
 |  |  |         } | 
 |  |  |         return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.ioTime); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public String getBeBatch$() { | 
 |  |  |         if (null == this.beBatch) { | 
 |  |  |             return null; | 
 |  |  |         } | 
 |  |  |         switch (this.beBatch) { | 
 |  |  |             case 1: | 
 |  |  |                 return "是"; | 
 |  |  |             case 0: | 
 |  |  |                 return "否"; | 
 |  |  |             default: | 
 |  |  |                 return String.valueOf(this.beBatch); | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public String getSource$() { | 
 |  |  |         if (null == this.source) { | 
 |  |  |             return null; | 
 |  |  |         } | 
 |  |  |         switch (this.source) { | 
 |  |  |             case 1: | 
 |  |  |                 return "制造"; | 
 |  |  |             case 2: | 
 |  |  |                 return "采购"; | 
 |  |  |             case 3: | 
 |  |  |                 return "外协"; | 
 |  |  |             default: | 
 |  |  |                 return String.valueOf(this.source); | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public String getInspect$() { | 
 |  |  |         if (null == this.inspect) { | 
 |  |  |             return null; | 
 |  |  |         } | 
 |  |  |         switch (this.inspect) { | 
 |  |  |             case 1: | 
 |  |  |                 return "是"; | 
 |  |  |             case 0: | 
 |  |  |                 return "否"; | 
 |  |  |             default: | 
 |  |  |                 return String.valueOf(this.inspect); | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public String getDanger$() { | 
 |  |  |         if (null == this.danger) { | 
 |  |  |             return null; | 
 |  |  |         } | 
 |  |  |         switch (this.danger) { | 
 |  |  |             case 1: | 
 |  |  |                 return "是"; | 
 |  |  |             case 0: | 
 |  |  |                 return "否"; | 
 |  |  |             default: | 
 |  |  |                 return String.valueOf(this.danger); | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     public String getModiTime$() { | 
 |  |  |         if (Cools.isEmpty(this.modiTime)) { | 
 |  |  |             return ""; | 
 |  |  |         } | 
 |  |  |         return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.modiTime); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     public String getAppeTime$() { | 
 |  |  |         if (Cools.isEmpty(this.appeTime)) { | 
 |  |  |             return ""; | 
 |  |  |         } | 
 |  |  |         return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.appeTime); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.asrs.entity; | 
 |  |  |  | 
 |  |  | import com.baomidou.mybatisplus.annotation.IdType; | 
 |  |  | import com.baomidou.mybatisplus.annotation.TableField; | 
 |  |  | import com.baomidou.mybatisplus.annotation.TableId; | 
 |  |  | import com.baomidou.mybatisplus.annotation.TableName; | 
 |  |  | import com.zy.acs.framework.common.Cools; | 
 |  |  | import io.swagger.annotations.ApiModelProperty; | 
 |  |  | import lombok.Data; | 
 |  |  |  | 
 |  |  | import java.io.Serializable; | 
 |  |  | import java.text.SimpleDateFormat; | 
 |  |  | import java.util.Date; | 
 |  |  |  | 
 |  |  | @Data | 
 |  |  | @TableName("asr_wrk_mast") | 
 |  |  | public class WrkMast implements Serializable { | 
 |  |  |  | 
 |  |  |     private static final long serialVersionUID = 1L; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 工作号 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "工作号") | 
 |  |  |     @TableId(value = "wrk_no", type = IdType.INPUT) | 
 |  |  |     @TableField("wrk_no") | 
 |  |  |     private Integer wrkNo; | 
 |  |  |  | 
 |  |  |     @ApiModelProperty(value = "") | 
 |  |  |     @TableField("inv_wh") | 
 |  |  |     private String invWh; | 
 |  |  |  | 
 |  |  |     @ApiModelProperty(value = "") | 
 |  |  |     private Date ymd; | 
 |  |  |  | 
 |  |  |     @ApiModelProperty(value = "") | 
 |  |  |     private String mk; | 
 |  |  |  | 
 |  |  |     @ApiModelProperty(value = "") | 
 |  |  |     @TableField("whs_type") | 
 |  |  |     private Integer whsType; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 工作状态 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "工作状态") | 
 |  |  |     @TableField("wrk_sts") | 
 |  |  |     private Long wrkSts; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 入出库类型 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "入出库类型") | 
 |  |  |     @TableField("io_type") | 
 |  |  |     private Integer ioType; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 堆垛机 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "堆垛机") | 
 |  |  |     @TableField("crn_no") | 
 |  |  |     private Integer crnNo; | 
 |  |  |  | 
 |  |  |     @ApiModelProperty(value = "") | 
 |  |  |     @TableField("sheet_no") | 
 |  |  |     private String sheetNo; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 优先级 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "优先级") | 
 |  |  |     @TableField("io_pri") | 
 |  |  |     private Double ioPri; | 
 |  |  |  | 
 |  |  |     @ApiModelProperty(value = "") | 
 |  |  |     @TableField("wrk_date") | 
 |  |  |     private Date wrkDate; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 目标库位 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "目标库位") | 
 |  |  |     @TableField("loc_no") | 
 |  |  |     private String locNo; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 目标站 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "目标站") | 
 |  |  |     @TableField("sta_no") | 
 |  |  |     private Integer staNo; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 源站 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "源站") | 
 |  |  |     @TableField("source_sta_no") | 
 |  |  |     private Integer sourceStaNo; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 源库位 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "源库位") | 
 |  |  |     @TableField("source_loc_no") | 
 |  |  |     private String sourceLocNo; | 
 |  |  |  | 
 |  |  |     @ApiModelProperty(value = "") | 
 |  |  |     @TableField("loc_sts") | 
 |  |  |     private String locSts; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 拣料 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "拣料") | 
 |  |  |     private String picking; | 
 |  |  |  | 
 |  |  |     @ApiModelProperty(value = "") | 
 |  |  |     @TableField("link_mis") | 
 |  |  |     private String linkMis; | 
 |  |  |  | 
 |  |  |     @ApiModelProperty(value = "") | 
 |  |  |     @TableField("online_yn") | 
 |  |  |     private String onlineYn; | 
 |  |  |  | 
 |  |  |     @ApiModelProperty(value = "") | 
 |  |  |     @TableField("upd_mk") | 
 |  |  |     private String updMk; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 退出 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "退出") | 
 |  |  |     @TableField("exit_mk") | 
 |  |  |     private String exitMk; | 
 |  |  |  | 
 |  |  |     @ApiModelProperty(value = "") | 
 |  |  |     @TableField("plt_type") | 
 |  |  |     private Integer pltType; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 空板 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "空板") | 
 |  |  |     @TableField("empty_mk") | 
 |  |  |     private String emptyMk; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 工作时间 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "工作时间") | 
 |  |  |     @TableField("io_time") | 
 |  |  |     private Date ioTime; | 
 |  |  |  | 
 |  |  |     @ApiModelProperty(value = "") | 
 |  |  |     @TableField("ctn_type") | 
 |  |  |     private Integer ctnType; | 
 |  |  |  | 
 |  |  |     @ApiModelProperty(value = "") | 
 |  |  |     private String packed; | 
 |  |  |  | 
 |  |  |     @ApiModelProperty(value = "") | 
 |  |  |     @TableField("ove_mk") | 
 |  |  |     private String oveMk; | 
 |  |  |  | 
 |  |  |     @ApiModelProperty(value = "") | 
 |  |  |     @TableField("mtn_type") | 
 |  |  |     private Double mtnType; | 
 |  |  |  | 
 |  |  |     @ApiModelProperty(value = "") | 
 |  |  |     @TableField("user_no") | 
 |  |  |     private String userNo; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 堆垛机启动时间 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "堆垛机启动时间") | 
 |  |  |     @TableField("crn_str_time") | 
 |  |  |     private Date crnStrTime; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 堆垛机停止时间 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "堆垛机停止时间") | 
 |  |  |     @TableField("crn_end_time") | 
 |  |  |     private Date crnEndTime; | 
 |  |  |  | 
 |  |  |     @ApiModelProperty(value = "") | 
 |  |  |     @TableField("plc_str_time") | 
 |  |  |     private Date plcStrTime; | 
 |  |  |  | 
 |  |  |     @ApiModelProperty(value = "") | 
 |  |  |     @TableField("crn_pos_time") | 
 |  |  |     private Date crnPosTime; | 
 |  |  |  | 
 |  |  |     @ApiModelProperty(value = "") | 
 |  |  |     @TableField("load_time") | 
 |  |  |     private Double loadTime; | 
 |  |  |  | 
 |  |  |     @ApiModelProperty(value = "") | 
 |  |  |     @TableField("exp_time") | 
 |  |  |     private Double expTime; | 
 |  |  |  | 
 |  |  |     @ApiModelProperty(value = "") | 
 |  |  |     @TableField("ref_wrkno") | 
 |  |  |     private Double refWrkno; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 拣料时间 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "拣料时间") | 
 |  |  |     @TableField("ref_iotime") | 
 |  |  |     private Date refIotime; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 修改人员 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "修改人员") | 
 |  |  |     @TableField("modi_user") | 
 |  |  |     private Long modiUser; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 修改时间 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "修改时间") | 
 |  |  |     @TableField("modi_time") | 
 |  |  |     private Date modiTime; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 创建者 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "创建者") | 
 |  |  |     @TableField("appe_user") | 
 |  |  |     private Long appeUser; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 添加时间 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "添加时间") | 
 |  |  |     @TableField("appe_time") | 
 |  |  |     private Date appeTime; | 
 |  |  |  | 
 |  |  |     @ApiModelProperty(value = "") | 
 |  |  |     @TableField("pause_mk") | 
 |  |  |     private String pauseMk; | 
 |  |  |  | 
 |  |  |     @ApiModelProperty(value = "") | 
 |  |  |     @TableField("error_time") | 
 |  |  |     private Date errorTime; | 
 |  |  |  | 
 |  |  |     @ApiModelProperty(value = "") | 
 |  |  |     @TableField("error_memo") | 
 |  |  |     private String errorMemo; | 
 |  |  |  | 
 |  |  |     @ApiModelProperty(value = "") | 
 |  |  |     @TableField("ctn_kind") | 
 |  |  |     private Integer ctnKind; | 
 |  |  |  | 
 |  |  |     @ApiModelProperty(value = "") | 
 |  |  |     @TableField("manu_type") | 
 |  |  |     private String manuType; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 备注 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "备注") | 
 |  |  |     private String memo; | 
 |  |  |  | 
 |  |  |     @ApiModelProperty(value = "") | 
 |  |  |     @TableField("sc_weight") | 
 |  |  |     private Double scWeight; | 
 |  |  |  | 
 |  |  |     @ApiModelProperty(value = "") | 
 |  |  |     @TableField("log_mk") | 
 |  |  |     private String logMk; | 
 |  |  |  | 
 |  |  |     @ApiModelProperty(value = "") | 
 |  |  |     @TableField("log_err_time") | 
 |  |  |     private Date logErrTime; | 
 |  |  |  | 
 |  |  |     @ApiModelProperty(value = "") | 
 |  |  |     @TableField("log_err_memo") | 
 |  |  |     private String logErrMemo; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 条码 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "条码") | 
 |  |  |     private String barcode; | 
 |  |  |  | 
 |  |  |     @ApiModelProperty(value = "") | 
 |  |  |     @TableField("Pdc_type") | 
 |  |  |     private String PdcType; | 
 |  |  |  | 
 |  |  |     @ApiModelProperty(value = "") | 
 |  |  |     @TableField("ctn_no") | 
 |  |  |     private String ctnNo; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 满板 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value = "满板") | 
 |  |  |     @TableField("full_plt") | 
 |  |  |     private String fullPlt; | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     public String getYmd$() { | 
 |  |  |         if (Cools.isEmpty(this.ymd)) { | 
 |  |  |             return ""; | 
 |  |  |         } | 
 |  |  |         return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.ymd); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public String getWrkDate$() { | 
 |  |  |         if (Cools.isEmpty(this.wrkDate)) { | 
 |  |  |             return ""; | 
 |  |  |         } | 
 |  |  |         return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.wrkDate); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     public String getIoTime$() { | 
 |  |  |         if (Cools.isEmpty(this.ioTime)) { | 
 |  |  |             return ""; | 
 |  |  |         } | 
 |  |  |         return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.ioTime); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public String getCrnStrTime$() { | 
 |  |  |         if (Cools.isEmpty(this.crnStrTime)) { | 
 |  |  |             return ""; | 
 |  |  |         } | 
 |  |  |         return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.crnStrTime); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public String getCrnEndTime$() { | 
 |  |  |         if (Cools.isEmpty(this.crnEndTime)) { | 
 |  |  |             return ""; | 
 |  |  |         } | 
 |  |  |         return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.crnEndTime); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public String getPlcStrTime$() { | 
 |  |  |         if (Cools.isEmpty(this.plcStrTime)) { | 
 |  |  |             return ""; | 
 |  |  |         } | 
 |  |  |         return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.plcStrTime); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public String getCrnPosTime$() { | 
 |  |  |         if (Cools.isEmpty(this.crnPosTime)) { | 
 |  |  |             return ""; | 
 |  |  |         } | 
 |  |  |         return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.crnPosTime); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public String getRefIotime$() { | 
 |  |  |         if (Cools.isEmpty(this.refIotime)) { | 
 |  |  |             return ""; | 
 |  |  |         } | 
 |  |  |         return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.refIotime); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     public String getModiTime$() { | 
 |  |  |         if (Cools.isEmpty(this.modiTime)) { | 
 |  |  |             return ""; | 
 |  |  |         } | 
 |  |  |         return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.modiTime); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public Date getAppeTime() { | 
 |  |  |         return appeTime; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public String getAppeTime$() { | 
 |  |  |         if (Cools.isEmpty(this.appeTime)) { | 
 |  |  |             return ""; | 
 |  |  |         } | 
 |  |  |         return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.appeTime); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public String getErrorTime$() { | 
 |  |  |         if (Cools.isEmpty(this.errorTime)) { | 
 |  |  |             return ""; | 
 |  |  |         } | 
 |  |  |         return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.errorTime); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public void setErrorMemo(String errorMemo) { | 
 |  |  |         if (errorMemo.length() > 255) { | 
 |  |  |             errorMemo = errorMemo.substring(0, 150); | 
 |  |  |         } | 
 |  |  |         this.errorMemo = errorMemo; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public String getLogErrTime$() { | 
 |  |  |         if (Cools.isEmpty(this.logErrTime)) { | 
 |  |  |             return ""; | 
 |  |  |         } | 
 |  |  |         return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.logErrTime); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.asrs.mapper; | 
 |  |  |  | 
 |  |  | import com.baomidou.mybatisplus.core.mapper.BaseMapper; | 
 |  |  | import com.zy.acs.wcs.asrs.entity.BasDevp; | 
 |  |  | import org.apache.ibatis.annotations.Mapper; | 
 |  |  | import org.apache.ibatis.annotations.Param; | 
 |  |  | import org.springframework.stereotype.Repository; | 
 |  |  |  | 
 |  |  | import java.util.List; | 
 |  |  |  | 
 |  |  | @Mapper | 
 |  |  | @Repository | 
 |  |  | public interface BasDevpMapper extends BaseMapper<BasDevp> { | 
 |  |  |  | 
 |  |  |     List<Integer> getAvailableInSite(@Param("typeNo") Integer typeNo); | 
 |  |  |  | 
 |  |  |     List<Integer> getAvailableOutSite(@Param("typeNo") Integer typeNo); | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.asrs.mapper; | 
 |  |  |  | 
 |  |  | import com.baomidou.mybatisplus.core.mapper.BaseMapper; | 
 |  |  | import com.zy.acs.wcs.asrs.entity.Loc; | 
 |  |  |  | 
 |  |  | import java.util.List; | 
 |  |  | import java.util.Map; | 
 |  |  |  | 
 |  |  | public interface LocMapper extends BaseMapper<Loc> { | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.asrs.mapper; | 
 |  |  |  | 
 |  |  | import com.baomidou.mybatisplus.core.mapper.BaseMapper; | 
 |  |  | import com.zy.acs.wcs.asrs.entity.StaDesc; | 
 |  |  | import org.apache.ibatis.annotations.Mapper; | 
 |  |  | import org.springframework.stereotype.Repository; | 
 |  |  |  | 
 |  |  | @Mapper | 
 |  |  | @Repository | 
 |  |  | public interface StaDescMapper extends BaseMapper<StaDesc> { | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.asrs.mapper; | 
 |  |  |  | 
 |  |  | import com.baomidou.mybatisplus.core.mapper.BaseMapper; | 
 |  |  | import com.zy.acs.wcs.asrs.entity.TaskReportLog; | 
 |  |  |  | 
 |  |  | public interface TaskReportLogMapper extends BaseMapper<TaskReportLog> { | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.asrs.mapper; | 
 |  |  |  | 
 |  |  | import com.baomidou.mybatisplus.core.mapper.BaseMapper; | 
 |  |  | import com.zy.acs.wcs.asrs.entity.TaskReport; | 
 |  |  |  | 
 |  |  | public interface TaskReportMapper extends BaseMapper<TaskReport> { | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.asrs.mapper; | 
 |  |  |  | 
 |  |  | import com.baomidou.mybatisplus.core.mapper.BaseMapper; | 
 |  |  | import com.zy.acs.wcs.asrs.entity.WrkDetl; | 
 |  |  | import org.apache.ibatis.annotations.Mapper; | 
 |  |  | import org.apache.ibatis.annotations.Param; | 
 |  |  | import org.springframework.stereotype.Repository; | 
 |  |  |  | 
 |  |  | import java.util.Date; | 
 |  |  | import java.util.List; | 
 |  |  |  | 
 |  |  | @Mapper | 
 |  |  | @Repository | 
 |  |  | public interface WrkDetlMapper extends BaseMapper<WrkDetl> { | 
 |  |  |  | 
 |  |  |     List<WrkDetl> findByWorkNo(Integer workNo); | 
 |  |  |  | 
 |  |  |     int updateIoTime(@Param("workNo") Integer workNo, @Param("ioTime") Date ioTime); | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.asrs.mapper; | 
 |  |  |  | 
 |  |  | import com.baomidou.mybatisplus.core.mapper.BaseMapper; | 
 |  |  | import com.zy.acs.wcs.asrs.entity.WrkMast; | 
 |  |  | import org.apache.ibatis.annotations.Insert; | 
 |  |  | import org.apache.ibatis.annotations.Mapper; | 
 |  |  | import org.apache.ibatis.annotations.Param; | 
 |  |  | import org.apache.ibatis.annotations.Update; | 
 |  |  | import org.springframework.stereotype.Repository; | 
 |  |  |  | 
 |  |  | import java.util.List; | 
 |  |  |  | 
 |  |  | @Mapper | 
 |  |  | @Repository | 
 |  |  | public interface WrkMastMapper extends BaseMapper<WrkMast> { | 
 |  |  |  | 
 |  |  |     WrkMast selectByLocNo(@Param("sourceLocNo") String sourceLocNo); | 
 |  |  |  | 
 |  |  |     WrkMast selectByLocNo1(@Param("sourceLocNo") String sourceLocNo); | 
 |  |  |  | 
 |  |  | //    @Select("select * from asr_wrk_mast where ((wrk_sts = 4 Or wrk_sts = 14 ) and io_type <> 103 and io_type <> 104 and io_type <> 107 ) or (wrk_sts = 2 and io_type=6) order by upd_mk,io_time,wrk_no") | 
 |  |  |     List<WrkMast> selectToBeCompleteData(); | 
 |  |  |  | 
 |  |  |     List<WrkMast> selectToBeHistoryData(); | 
 |  |  |  | 
 |  |  |     // wcs --------------------------------------------- | 
 |  |  |     // 入库第一步,扫码仪获取条码信息时查询 | 
 |  |  | //    @Select("select top 1 * from asr_wrk_mast where source_sta_no=#{sourceStaNo} and wrk_sts=2 and barcode=#{barcode} and (io_type=1 or io_type=10) order by io_pri desc,io_time,wrk_no ASC") | 
 |  |  |     WrkMast selectPakInStep1(@Param("sourceStaNo")Integer sourceStaNo, @Param("barcode")String barcode); | 
 |  |  |  | 
 |  |  |     WrkMast selectPakInStepBarcode(@Param("barcode")String barcode); | 
 |  |  |  | 
 |  |  |     WrkMast selectPakInStep11(@Param("sourceStaNo")Integer sourceStaNo); | 
 |  |  |  | 
 |  |  |     // 入库第二步,当托盘物料在堆垛机入库站时时查询 | 
 |  |  | //    @Select("select top 1 * from dbo.asr_wrk_mast where wrk_sts=2 and crn_no=#{crnNo} and wrk_no=#{workNo} and (io_type=1 or io_type=10 or io_type=53 or io_type=54 or io_type=57) order by io_pri desc,io_time,wrk_no ASC") | 
 |  |  |     WrkMast selectPakInStep2(@Param("crnNo")Integer crnNo, @Param("workNo")Integer workNo, @Param("staNo")Integer staNo); | 
 |  |  |  | 
 |  |  |     // 入库第三步,当堆垛机把货放入库位时 | 
 |  |  | //    @Select("select top 1 from dbo.asr_wrk_mast where wrk_no=#{workNo}") | 
 |  |  |     WrkMast selectPakInStep3(@Param("workNo")Integer workNo); | 
 |  |  |  | 
 |  |  |     // 拣料再入库时,站点有物且需求时查询 | 
 |  |  | //    @Select("select top 1 * from asr_wrk_mast where wrk_no=#{workNo} and wrk_sts=14 and (io_type=103 or io_type=107 or io_type=104)") | 
 |  |  |     WrkMast selectPickStep(@Param("barcode")String barcode); | 
 |  |  |  | 
 |  |  |     // 出库第一步,从库位到堆垛机出库站 | 
 |  |  | //    @Select("select top 1 * from dbo.asr_wrk_mast where crn_no=#{crnNo} and wrk_sts=11 and io_type>100 order by io_pri desc,io_time,wrk_no asc") | 
 |  |  |     WrkMast selectPakOutStep1(@Param("crnNo")Integer crnNO, @Param("sourceStaNo")Integer sourceStaNo); | 
 |  |  |  | 
 |  |  |     // 出库第二步,从堆垛机出库站到目标出库站,堆垛机出库站有物时执行 | 
 |  |  | //    @Select("select top 1 * from dbo.asr_wrk_mast where source_sta_no=#{sourceStaNo} and wrk_sts=12 and io_type>100 order by io_pri desc,io_time desc,wrk_no ASC") | 
 |  |  |     WrkMast selectPakOutStep2(@Param("sourceStaNo")Integer sourceStaNo); | 
 |  |  |  | 
 |  |  |     // 库位移转工作档,在进行一次入出库作业后紧跟库位移转 | 
 |  |  | //    @Select("select top 1 * from dbo.asr_wrk_mast where wrk_sts=11 and (io_type=11 or io_type=110) and crn_no=#{crnNo} order by io_time,wrk_no") | 
 |  |  |     WrkMast selectLocMove(@Param("crnNo")Integer crnNo); | 
 |  |  |     WrkMast selectLocMove111(@Param("crnNo")Integer crnNo); | 
 |  |  |  | 
 |  |  |     WrkMast selectLocMoving(@Param("crnNo")Integer crnNo); | 
 |  |  |  | 
 |  |  |     WrkMast selectWorking(@Param("crnNo")Integer crnNo); | 
 |  |  |  | 
 |  |  |     // work log ------------------------------------------------------- | 
 |  |  |     @Insert("insert into asr_wrk_mast_log select * from asr_wrk_mast where wrk_no=#{workNo}") | 
 |  |  |     int saveWrkMastLog(Integer workNo); | 
 |  |  |  | 
 |  |  |     @Insert("insert into asr_wrk_detl_log select * from asr_wrk_detl where wrk_no=#{workNo}") | 
 |  |  |     int saveWrkDetlLog(Integer workNo); | 
 |  |  |  | 
 |  |  |     // 通知档 ---------------------------------------------------------------------- | 
 |  |  |  | 
 |  |  |     // update 入库通知档 -- Y | 
 |  |  |     @Update("update cust_wait_pakin set io_status='Y' where zpallet = #{barcode}") | 
 |  |  |     int updateWaitPakInStep1(String barcode); | 
 |  |  |  | 
 |  |  |     // update 入库通知档  -- F | 
 |  |  |     @Update("update cust_wait_pakin set io_status='F' where zpallet = #{barcode}") | 
 |  |  |     int updateWaitPakInStep2(String barcode); | 
 |  |  |  | 
 |  |  | //    WrkMast selectWorkingPakin(); | 
 |  |  | // | 
 |  |  | //    WrkMast selectWorkingPakout(); | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 堆垛机是否存在出库任务 | 
 |  |  |      * @param crnNo | 
 |  |  |      * @return | 
 |  |  |      */ | 
 |  |  |     WrkMast selectCrnWorking(@Param("crnNo")Integer crnNo); | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 输送线是否存在入库任务 | 
 |  |  |      * @param crnNo | 
 |  |  |      * @return | 
 |  |  |      */ | 
 |  |  |     WrkMast selectDevWorking(@Param("crnNo")Integer crnNo); | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     List<WrkMast> selectPick(); | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 查找堆垛机号对应所有待出库工作档 | 
 |  |  |      * @param crnNO | 
 |  |  |      * @param sourceStaNo | 
 |  |  |      * @return | 
 |  |  |      */ | 
 |  |  |     List<WrkMast> selectPakOutStep11(@Param("crnNo")Integer crnNO, @Param("sourceStaNo")Integer sourceStaNo); | 
 |  |  |  | 
 |  |  |     WrkMast selectWorkingPakin(@Param("sourceStaNo")Integer sourceStaNo); | 
 |  |  |     WrkMast selectWorkingPakout(@Param("sourceStaNo")Integer sourceStaNo); | 
 |  |  |  | 
 |  |  |     WrkMast selectPakoutEmpty(@Param("staNo")Integer outSite); | 
 |  |  |  | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.asrs.service; | 
 |  |  |  | 
 |  |  | import com.baomidou.mybatisplus.extension.service.IService; | 
 |  |  | import com.zy.acs.wcs.asrs.entity.BasDevp; | 
 |  |  |  | 
 |  |  | import java.util.List; | 
 |  |  |  | 
 |  |  | public interface BasDevpService extends IService<BasDevp> { | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 入库站 | 
 |  |  |      * | 
 |  |  |      * @return | 
 |  |  |      */ | 
 |  |  |     List<Integer> getAvailableInSite(); | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 空板入库站 | 
 |  |  |      * | 
 |  |  |      * @return | 
 |  |  |      */ | 
 |  |  |     List<Integer> getAvailableEmptyInSite(); | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 出库站 | 
 |  |  |      * | 
 |  |  |      * @return | 
 |  |  |      */ | 
 |  |  |     List<Integer> getAvailableOutSite(Integer typeNo); | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 空板出库站 | 
 |  |  |      * | 
 |  |  |      * @return | 
 |  |  |      */ | 
 |  |  |     List<Integer> getAvailableEmptyOutSite(); | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 目标站点状态检测 | 
 |  |  |      * | 
 |  |  |      * @param devpNo | 
 |  |  |      */ | 
 |  |  |     BasDevp checkSiteStatus(Integer devpNo); | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 目标站点状态检测 | 
 |  |  |      * | 
 |  |  |      * @param devpNo | 
 |  |  |      * @param put    是否入库操作 true 是 ; false 不是 | 
 |  |  |      */ | 
 |  |  |     BasDevp checkSiteStatus(Integer devpNo, boolean put); | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.asrs.service; | 
 |  |  |  | 
 |  |  | import com.baomidou.mybatisplus.extension.service.IService; | 
 |  |  | import com.zy.acs.wcs.asrs.entity.Loc; | 
 |  |  |  | 
 |  |  | import java.util.List; | 
 |  |  | import java.util.Map; | 
 |  |  |  | 
 |  |  | public interface LocService extends IService<Loc> { | 
 |  |  |  | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.asrs.service; | 
 |  |  |  | 
 |  |  |  | 
 |  |  | import com.baomidou.mybatisplus.extension.service.IService; | 
 |  |  | import com.zy.acs.wcs.asrs.entity.StaDesc; | 
 |  |  |  | 
 |  |  | public interface StaDescService extends IService<StaDesc> { | 
 |  |  |  | 
 |  |  |     StaDesc queryCrnStn(Integer typeNo, Integer crnNo, Integer stnNo); | 
 |  |  |  | 
 |  |  |     StaDesc queryCrn(Integer typeNo, Integer stnNo, Integer crnNo); | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.asrs.service; | 
 |  |  |  | 
 |  |  | import com.baomidou.mybatisplus.extension.service.IService; | 
 |  |  | import com.zy.acs.wcs.asrs.entity.TaskReportLog; | 
 |  |  |  | 
 |  |  | public interface TaskReportLogService extends IService<TaskReportLog> { | 
 |  |  |  | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.asrs.service; | 
 |  |  |  | 
 |  |  | import com.baomidou.mybatisplus.extension.service.IService; | 
 |  |  | import com.zy.acs.wcs.asrs.entity.TaskReport; | 
 |  |  |  | 
 |  |  | public interface TaskReportService extends IService<TaskReport> { | 
 |  |  |  | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.asrs.service; | 
 |  |  |  | 
 |  |  |  | 
 |  |  | import com.baomidou.mybatisplus.extension.service.IService; | 
 |  |  | import com.zy.acs.wcs.asrs.entity.WrkDetl; | 
 |  |  |  | 
 |  |  | import java.util.Date; | 
 |  |  | import java.util.List; | 
 |  |  |  | 
 |  |  | public interface WrkDetlService extends IService<WrkDetl> { | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.asrs.service; | 
 |  |  |  | 
 |  |  |  | 
 |  |  | import com.baomidou.mybatisplus.extension.service.IService; | 
 |  |  | import com.zy.acs.wcs.asrs.entity.WrkMast; | 
 |  |  |  | 
 |  |  | import java.util.List; | 
 |  |  |  | 
 |  |  | public interface WrkMastService extends IService<WrkMast> { | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.asrs.service.impl; | 
 |  |  |  | 
 |  |  | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | 
 |  |  | import com.core.exception.CoolException; | 
 |  |  | import com.zy.acs.wcs.asrs.entity.BasDevp; | 
 |  |  | import com.zy.acs.wcs.asrs.mapper.BasDevpMapper; | 
 |  |  | import com.zy.acs.wcs.asrs.service.BasDevpService; | 
 |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
 |  |  | import org.springframework.stereotype.Service; | 
 |  |  |  | 
 |  |  | import java.util.List; | 
 |  |  |  | 
 |  |  | @Service("basDevpService") | 
 |  |  | public class BasDevpServiceImpl extends ServiceImpl<BasDevpMapper, BasDevp> implements BasDevpService { | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     @Override | 
 |  |  |     public List<Integer> getAvailableInSite() { | 
 |  |  |         return this.baseMapper.getAvailableInSite(1); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @Override | 
 |  |  |     public List<Integer> getAvailableEmptyInSite() { | 
 |  |  |         return this.baseMapper.getAvailableInSite(10); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @Override | 
 |  |  |     public List<Integer> getAvailableOutSite(Integer typeNo) { | 
 |  |  |         return this.baseMapper.getAvailableOutSite(typeNo); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @Override | 
 |  |  |     public List<Integer> getAvailableEmptyOutSite() { | 
 |  |  |         return this.baseMapper.getAvailableOutSite(110); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @Override | 
 |  |  |     public BasDevp checkSiteStatus(Integer devpNo) { | 
 |  |  |         return checkSiteStatus(devpNo, false); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @Override | 
 |  |  |     public BasDevp checkSiteStatus(Integer devpNo, boolean put) { | 
 |  |  |         BasDevp station = this.getById(devpNo); | 
 |  |  |         if (station == null) { | 
 |  |  |             throw new CoolException(devpNo + "站点不存在"); | 
 |  |  |         } | 
 |  |  |         if (put) { | 
 |  |  |             if (station.getAutoing() == null || !station.getAutoing().equals("Y")) { | 
 |  |  |                 throw new CoolException(devpNo + "站点不是自动状态"); | 
 |  |  |             } | 
 |  |  |             if (station.getLoading() == null || !station.getLoading().equals("Y")) { | 
 |  |  |                 throw new CoolException(devpNo + "站点无物"); | 
 |  |  |             } | 
 |  |  |             if (station.getWrkNo() != null && station.getWrkNo() > 0) { | 
 |  |  |                 throw new CoolException(devpNo + "站点已有工作号"); | 
 |  |  |             } | 
 |  |  |             if (wrkMastService.getWorkingMast(devpNo) > 0) { | 
 |  |  |                 throw new CoolException(devpNo + "站点不能同时生成两笔入库工作档"); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         return station; | 
 |  |  |     } | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.asrs.service.impl; | 
 |  |  |  | 
 |  |  | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 
 |  |  | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | 
 |  |  | import com.zy.acs.wcs.asrs.entity.Loc; | 
 |  |  | import com.zy.acs.wcs.asrs.mapper.LocMapper; | 
 |  |  | import com.zy.acs.wcs.asrs.service.LocService; | 
 |  |  | import lombok.extern.slf4j.Slf4j; | 
 |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
 |  |  | import org.springframework.stereotype.Service; | 
 |  |  |  | 
 |  |  | import java.util.Date; | 
 |  |  | import java.util.List; | 
 |  |  | import java.util.Map; | 
 |  |  | import java.util.Objects; | 
 |  |  |  | 
 |  |  | @Slf4j | 
 |  |  | @Service("locService") | 
 |  |  | public class LocServiceImpl extends ServiceImpl<LocMapper, Loc> implements LocService { | 
 |  |  |  | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.asrs.service.impl; | 
 |  |  |  | 
 |  |  | import com.alibaba.fastjson.JSON; | 
 |  |  | import com.alibaba.fastjson.JSONObject; | 
 |  |  | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 
 |  |  | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
 |  |  | import com.zy.acs.wcs.asrs.entity.Loc; | 
 |  |  | import com.zy.acs.wcs.asrs.entity.WrkMast; | 
 |  |  | import com.zy.acs.wcs.asrs.service.BasDevpService; | 
 |  |  | import com.zy.acs.wcs.asrs.service.LocService; | 
 |  |  | import com.zy.acs.wcs.asrs.service.StaDescService; | 
 |  |  | import com.zy.acs.wcs.asrs.service.WrkMastService; | 
 |  |  | import com.zy.acs.wcs.common.OpenBusSubmitParam; | 
 |  |  | import com.zy.acs.wcs.common.TaskDto; | 
 |  |  | import com.zy.acs.wcs.common.utils.HttpHandler; | 
 |  |  | import com.zy.acs.wcs.core.DevpThread; | 
 |  |  | import com.zy.acs.wcs.core.cache.MessageQueue; | 
 |  |  | import com.zy.acs.wcs.core.cache.SlaveConnection; | 
 |  |  | import com.zy.acs.wcs.core.enums.SlaveType; | 
 |  |  | import com.zy.acs.wcs.core.model.DevpSlave; | 
 |  |  | import com.zy.acs.wcs.core.model.Task; | 
 |  |  | import com.zy.acs.wcs.core.model.protocol.StaProtocol; | 
 |  |  | import com.zy.acs.wcs.core.properties.SlaveProperties; | 
 |  |  | import com.zy.acs.wcs.core.thread.BarcodeThread; | 
 |  |  | import com.zy.acs.wcs.core.thread.SiemensDevpThread; | 
 |  |  | import lombok.extern.slf4j.Slf4j; | 
 |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
 |  |  | import org.springframework.stereotype.Service; | 
 |  |  | import org.springframework.transaction.annotation.Transactional; | 
 |  |  | import org.springframework.transaction.interceptor.TransactionAspectSupport; | 
 |  |  |  | 
 |  |  | import java.io.IOException; | 
 |  |  | import java.util.ArrayList; | 
 |  |  | import java.util.Collections; | 
 |  |  | import java.util.Date; | 
 |  |  | import java.util.List; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * 立体仓库WCS系统主流程业务 | 
 |  |  |  * Created by vincent on 2020/8/6 | 
 |  |  |  */ | 
 |  |  | @Slf4j | 
 |  |  | @Service("mainService") | 
 |  |  | @Transactional | 
 |  |  | public class MainServiceImpl { | 
 |  |  |  | 
 |  |  |     public static final long COMMAND_TIMEOUT = 5 * 1000; | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private SlaveProperties slaveProperties; | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private WrkMastService wrkMastService; | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private BasDevpService basDevpService; | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private StaDescService staDescService; | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private LocService locService; | 
 |  |  |  | 
 |  |  |     public static final ArrayList<Integer> locRow = new ArrayList<Integer>() {{ | 
 |  |  |         add(49); | 
 |  |  |         add(50); | 
 |  |  |         add(51); | 
 |  |  |         add(52); | 
 |  |  |         add(53); | 
 |  |  |         add(54); | 
 |  |  |         add(55); | 
 |  |  |         add(56); | 
 |  |  |         add(57); | 
 |  |  |         add(58); | 
 |  |  |         add(59); | 
 |  |  |     }}; | 
 |  |  |  | 
 |  |  |     private short workNo = 1000; | 
 |  |  |  | 
 |  |  |     private short workNo2 = 3000; | 
 |  |  |  | 
 |  |  |     private Short getWorkNo() { | 
 |  |  |         if (workNo > 2000) { | 
 |  |  |             workNo = 1000; | 
 |  |  |         } else { | 
 |  |  |             workNo++; | 
 |  |  |         } | 
 |  |  |         return workNo; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     private Short getOutWorkNo() { | 
 |  |  |         if (workNo2 > 4000) { | 
 |  |  |             workNo2 = 3000; | 
 |  |  |         } else { | 
 |  |  |             workNo2++; | 
 |  |  |         } | 
 |  |  |         return workNo2; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     public synchronized void generateStoreWrkFile() { | 
 |  |  |         try { | 
 |  |  |             // 根据输送线plc遍历 | 
 |  |  |             for (DevpSlave devp : slaveProperties.getDevp()) { | 
 |  |  |                 // 遍历入库口 | 
 |  |  |                 for (DevpSlave.Sta inSta : devp.getInSta()) { | 
 |  |  |                     // 获取入库站信息 | 
 |  |  |                     DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId()); | 
 |  |  |                     StaProtocol staProtocol = devpThread.getStation().get(inSta.getStaNo()); | 
 |  |  |                     if (staProtocol == null) { | 
 |  |  |                         continue; | 
 |  |  |                     } else { | 
 |  |  |                         staProtocol = staProtocol.clone(); | 
 |  |  |                     } | 
 |  |  |                     Short workNo = staProtocol.getWorkNo(); | 
 |  |  |                     // 尺寸检测异常 | 
 |  |  |                     boolean back = false; | 
 |  |  |                     String errMsg = ""; | 
 |  |  |                     if (staProtocol.isFrontErr()) { | 
 |  |  |                         errMsg = "前超限"; | 
 |  |  |                         back = true; | 
 |  |  |                     } | 
 |  |  |                     if (!back && staProtocol.isBackErr()) { | 
 |  |  |                         errMsg = "后超限"; | 
 |  |  |                         back = true; | 
 |  |  |                     } | 
 |  |  |                     if (!back && staProtocol.isHighErr()) { | 
 |  |  |                         errMsg = "高超限"; | 
 |  |  |                         back = true; | 
 |  |  |                     } | 
 |  |  |                     if (!back && staProtocol.isLeftErr()) { | 
 |  |  |                         errMsg = "左超限"; | 
 |  |  |                         back = true; | 
 |  |  |                     } | 
 |  |  |                     if (!back && staProtocol.isRightErr()) { | 
 |  |  |                         errMsg = "右超限"; | 
 |  |  |                         back = true; | 
 |  |  |                     } | 
 |  |  |                     if (!back && staProtocol.isWeightErr()) { | 
 |  |  |                         errMsg = "超重"; | 
 |  |  |                         back = true; | 
 |  |  |                     } | 
 |  |  |                     if (!back && staProtocol.isBarcodeErr()) { | 
 |  |  |                         errMsg = "扫码失败"; | 
 |  |  |                         back = true; | 
 |  |  |                     } | 
 |  |  |                     // 判断是否满足入库条件 | 
 |  |  |                     if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.isInEnable() | 
 |  |  |                             && !staProtocol.isEmptyMk() && workNo >= 9000 && staProtocol.isPakMk()) { | 
 |  |  | //                        // 获取条码扫描仪信息 | 
 |  |  |                         BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, inSta.getBarcode()); | 
 |  |  |                         if (barcodeThread == null) { | 
 |  |  |                             continue; | 
 |  |  |                         } | 
 |  |  |                         String BoxNo = barcodeThread.getBarcode(); | 
 |  |  | //                        if (Cools.isEmpty(BoxNo)) { | 
 |  |  | //                            log.error("{}号条码扫描失败,值:{}", inSta.getBarcode(), BoxNo); | 
 |  |  | //                            continue; | 
 |  |  | //                        } | 
 |  |  |                         if (back) { | 
 |  |  |                             staProtocol.setStaNo(inSta.getBackSta().shortValue()); | 
 |  |  |                             devpThread.setPakMk(staProtocol.getSiteId(), false); | 
 |  |  |                             MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); | 
 |  |  |                             log.info("组托入库托盘退回命令推送输送线队列成功==>{},{},{}", BoxNo, errMsg); | 
 |  |  |                         } else { | 
 |  |  |                             // TODO | 
 |  |  |                             OpenBusSubmitParam data = getData(inSta.getStaNo()); | 
 |  |  |                             String response = new HttpHandler.Builder() | 
 |  |  |                                     .setUri("10.10.10.200:8088") | 
 |  |  |                                     .setPath("/api/open/bus/submit") | 
 |  |  |                                     .setJson(JSON.toJSONString(data)) | 
 |  |  |                                     .build() | 
 |  |  |                                     .doPost(); | 
 |  |  |                             JSONObject jsonObject = JSON.parseObject(response); | 
 |  |  |                             if (jsonObject.getInteger("code").equals(200)) { | 
 |  |  |                                 createInWrk(); | 
 |  |  |                                 staProtocol.setWorkNo(getWorkNo()); | 
 |  |  |                                 staProtocol.setStaNo((short) 102); | 
 |  |  |                                 MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); | 
 |  |  |                                 log.info("组托入库命令推送输送线队列成功:{}", staProtocol); | 
 |  |  |                             } | 
 |  |  |                         } | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |         } catch (Exception e) { | 
 |  |  |             log.error("generateStoreWrkFile e", e); | 
 |  |  |             TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     private Loc getLoc() { | 
 |  |  |         List<Loc> list = locService.list(new LambdaQueryWrapper<Loc>().eq(Loc::getLocSts, 15).in(Loc::getRow, locRow)); | 
 |  |  |         Collections.shuffle(list); | 
 |  |  |         return list.get(0); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     private OpenBusSubmitParam getData(Integer stnNo) { | 
 |  |  |         OpenBusSubmitParam param = new OpenBusSubmitParam(); | 
 |  |  |         param.setBatch(String.valueOf(System.currentTimeMillis())); | 
 |  |  |  | 
 |  |  |         TaskDto taskDto = new TaskDto(); | 
 |  |  |         taskDto.setOriSta(stnNo + ""); | 
 |  |  |         taskDto.setDestLoc(getLoc().getLocNo()); | 
 |  |  |         taskDto.setPriority(100); | 
 |  |  |         taskDto.setSeqNum(String.valueOf(System.currentTimeMillis()).substring(15, 19)); | 
 |  |  |         param.getTaskList().add(taskDto); | 
 |  |  |         return param; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     private WrkMast createInWrk() { | 
 |  |  |         Date date = new Date(); | 
 |  |  |         // 生成工作档 | 
 |  |  |         WrkMast wrkMast = new WrkMast(); | 
 |  |  |         wrkMast.setWrkNo(getWorkNo().intValue()); | 
 |  |  |         wrkMast.setIoTime(new Date()); | 
 |  |  |         wrkMast.setWrkSts(2L); // 工作状态:生成入库ID | 
 |  |  |         wrkMast.setIoType(10); // 入出库状态:1.入库 | 
 |  |  |         wrkMast.setIoPri(13D); // 优先级 | 
 |  |  |         wrkMast.setCrnNo(1); | 
 |  |  |         wrkMast.setSourceStaNo(101); | 
 |  |  |         wrkMast.setStaNo(103); | 
 |  |  |         wrkMast.setLocNo(getLoc().getLocNo()); | 
 |  |  |         wrkMast.setBarcode(""); // 托盘码 | 
 |  |  |         wrkMast.setFullPlt("Y"); // 满板:Y | 
 |  |  |         wrkMast.setPicking("N"); // 拣料 | 
 |  |  |         wrkMast.setExitMk("N"); // 退出 | 
 |  |  |         wrkMast.setEmptyMk("N"); // 空板 | 
 |  |  |         wrkMast.setLinkMis("Y"); | 
 |  |  |         // 操作人员数据 | 
 |  |  |         wrkMast.setAppeTime(date); | 
 |  |  |         wrkMast.setModiTime(date); | 
 |  |  |         boolean res = wrkMastService.save(wrkMast); | 
 |  |  |         return wrkMast; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     private WrkMast createOutWrk() { | 
 |  |  |         Date date = new Date(); | 
 |  |  |         // 生成工作档 | 
 |  |  |         WrkMast wrkMast = new WrkMast(); | 
 |  |  |         wrkMast.setWrkNo(getOutWorkNo().intValue()); | 
 |  |  |         wrkMast.setIoTime(new Date()); | 
 |  |  |         wrkMast.setWrkSts(2L); // 工作状态:生成入库ID | 
 |  |  |         wrkMast.setIoType(10); // 入出库状态:1.入库 | 
 |  |  |         wrkMast.setIoPri(13D); // 优先级 | 
 |  |  |         wrkMast.setCrnNo(1); | 
 |  |  |         wrkMast.setSourceStaNo(101); | 
 |  |  |         wrkMast.setStaNo(103); | 
 |  |  |         wrkMast.setLocNo(getLoc().getLocNo()); | 
 |  |  |         wrkMast.setBarcode(""); // 托盘码 | 
 |  |  |         wrkMast.setFullPlt("Y"); // 满板:Y | 
 |  |  |         wrkMast.setPicking("N"); // 拣料 | 
 |  |  |         wrkMast.setExitMk("N"); // 退出 | 
 |  |  |         wrkMast.setEmptyMk("N"); // 空板 | 
 |  |  |         wrkMast.setLinkMis("Y"); | 
 |  |  |         // 操作人员数据 | 
 |  |  |         wrkMast.setAppeTime(date); | 
 |  |  |         wrkMast.setModiTime(date); | 
 |  |  |         boolean res = wrkMastService.save(wrkMast); | 
 |  |  |         return wrkMast; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 出库 | 
 |  |  |      */ | 
 |  |  |     public synchronized void out() throws IOException { | 
 |  |  |         for (DevpSlave devpSlave : slaveProperties.getDevp()) { | 
 |  |  |             for (DevpSlave.Sta sta : devpSlave.getOutSta()) { | 
 |  |  |                 try { | 
 |  |  |                     // 获取堆垛机出库站信息 | 
 |  |  |                     DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, devpSlave.getId()); | 
 |  |  |                     StaProtocol staProtocol = devpThread.getStation().get(sta.getStaNo()); | 
 |  |  |                     if (staProtocol == null) { | 
 |  |  |                         continue; | 
 |  |  |                     } else { | 
 |  |  |                         staProtocol = staProtocol.clone(); | 
 |  |  |                     } | 
 |  |  |                     if (staProtocol.isAutoing() && staProtocol.isLoading() && (staProtocol.getWorkNo() == 0 || staProtocol.getStaNo() == 0)) { | 
 |  |  |                         WrkMast one = wrkMastService.getOne(new QueryWrapper<WrkMast>().eq("sta_no", sta.getStaNo()).eq("wrk_sts", 14)); | 
 |  |  |                         if (one != null) { | 
 |  |  |                             // 查询工作档 | 
 |  |  |                             staProtocol.setWorkNo(getOutWorkNo()); | 
 |  |  |                             staProtocol.setStaNo((short) 101); | 
 |  |  |                             MessageQueue.offer(SlaveType.Devp, devpSlave.getId(), new Task(2, staProtocol)); | 
 |  |  |                             one.setWrkSts(15L); | 
 |  |  |                             wrkMastService.updateById(one); | 
 |  |  |                         } | 
 |  |  |                     } | 
 |  |  |                 } catch (Exception e) { | 
 |  |  |                     log.error("出库到出库站异常:异常信息:" + e); | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 入出库模式切换函数 | 
 |  |  |      */ | 
 |  |  |     public synchronized void ioConvert() { | 
 |  |  |         try { | 
 |  |  |             // 根据输送线plc遍历 | 
 |  |  |             for (DevpSlave devp : slaveProperties.getDevp()) { | 
 |  |  |                 SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId()); | 
 |  |  | //                for (DevpSlave.Sta inSta : devp.getInSta()) { | 
 |  |  | //                    TaskWrk taskWrk = taskWrkService.selectByTargetPoint(inSta.getBackSta() + ""); | 
 |  |  | //                    switch (inSta.getBackSta()) { | 
 |  |  | //                        case 101: | 
 |  |  | //                            if (taskWrk != null) { | 
 |  |  | //                                if (devpThread.ioModeOf1F1 != IoModeType.PAKOUT_MODE) { | 
 |  |  | //                                    // 出库切换中 | 
 |  |  | //                                    devpThread.ioModeOf1F1 = IoModeType.PAKOUT_BOOTING; | 
 |  |  | //                                    TaskWrk pakin = taskWrkService.selectByStartPoint(inSta.getStaNo() + ""); | 
 |  |  | //                                    if (pakin == null && !devpThread.getStation().get(inSta.getStaNo()).isLoading() | 
 |  |  | //                                            && !devpThread.getStation().get(inSta.getBackSta()).isLoading() | 
 |  |  | //                                            && devpThread.getStation().get(inSta.getBackSta()).getWorkNo() == 0) { | 
 |  |  | //                                        // 出库模式 | 
 |  |  | //                                        devpThread.ioModeOf1F1 = IoModeType.PAKOUT_MODE; | 
 |  |  | //                                    } | 
 |  |  | //                                } | 
 |  |  | //                            } else { | 
 |  |  | //                                // 入库模式 | 
 |  |  | //                                devpThread.ioModeOf1F1 = IoModeType.PAKIN_MODE; | 
 |  |  | //                            } | 
 |  |  | //                            break; | 
 |  |  | //                        case 104: | 
 |  |  | //                            if (taskWrk != null) { | 
 |  |  | //                                if (devpThread.ioModeOf1F2 != IoModeType.PAKOUT_MODE) { | 
 |  |  | //                                    // 出库切换中 | 
 |  |  | //                                    devpThread.ioModeOf1F2 = IoModeType.PAKOUT_BOOTING; | 
 |  |  | //                                    TaskWrk pakin = taskWrkService.selectByStartPoint(inSta.getStaNo() + ""); | 
 |  |  | //                                    if (pakin == null && !devpThread.getStation().get(inSta.getStaNo()).isLoading() | 
 |  |  | //                                            && !devpThread.getStation().get(inSta.getBackSta()).isLoading() | 
 |  |  | //                                            && devpThread.getStation().get(inSta.getBackSta()).getWorkNo() == 0) { | 
 |  |  | //                                        // 出库模式 | 
 |  |  | //                                        devpThread.ioModeOf1F2 = IoModeType.PAKOUT_MODE; | 
 |  |  | //                                    } | 
 |  |  | //                                } | 
 |  |  | //                            } else { | 
 |  |  | //                                // 入库模式 | 
 |  |  | //                                devpThread.ioModeOf1F2 = IoModeType.PAKIN_MODE; | 
 |  |  | //                            } | 
 |  |  | //                            break; | 
 |  |  | //                        case 107: | 
 |  |  | //                            if (taskWrk != null) { | 
 |  |  | //                                if (devpThread.ioModeOf1F3 != IoModeType.PAKOUT_MODE) { | 
 |  |  | //                                    // 出库切换中 | 
 |  |  | //                                    devpThread.ioModeOf1F3 = IoModeType.PAKOUT_BOOTING; | 
 |  |  | //                                    TaskWrk pakin = taskWrkService.selectByStartPoint(inSta.getStaNo() + ""); | 
 |  |  | //                                    if (pakin == null && !devpThread.getStation().get(inSta.getStaNo()).isLoading() | 
 |  |  | //                                            && !devpThread.getStation().get(inSta.getBackSta()).isLoading() | 
 |  |  | //                                            && devpThread.getStation().get(inSta.getBackSta()).getWorkNo() == 0) { | 
 |  |  | //                                        // 出库模式 | 
 |  |  | //                                        devpThread.ioModeOf1F3 = IoModeType.PAKOUT_MODE; | 
 |  |  | //                                    } | 
 |  |  | //                                } | 
 |  |  | //                            } else { | 
 |  |  | //                                // 入库模式 | 
 |  |  | //                                devpThread.ioModeOf1F3 = IoModeType.PAKIN_MODE; | 
 |  |  | //                            } | 
 |  |  | //                            break; | 
 |  |  | //                        case 110: | 
 |  |  | //                            if (taskWrk != null) { | 
 |  |  | //                                if (devpThread.ioModeOf1F4 != IoModeType.PAKOUT_MODE) { | 
 |  |  | //                                    // 出库切换中 | 
 |  |  | //                                    devpThread.ioModeOf1F4 = IoModeType.PAKOUT_BOOTING; | 
 |  |  | //                                    TaskWrk pakin = taskWrkService.selectByStartPoint(inSta.getStaNo() + ""); | 
 |  |  | //                                    if (pakin == null && !devpThread.getStation().get(inSta.getStaNo()).isLoading() | 
 |  |  | //                                            && !devpThread.getStation().get(inSta.getBackSta()).isLoading() | 
 |  |  | //                                            && devpThread.getStation().get(inSta.getBackSta()).getWorkNo() == 0) { | 
 |  |  | //                                        // 出库模式 | 
 |  |  | //                                        devpThread.ioModeOf1F4 = IoModeType.PAKOUT_MODE; | 
 |  |  | //                                    } | 
 |  |  | //                                } | 
 |  |  | //                            } else { | 
 |  |  | //                                // 入库模式 | 
 |  |  | //                                devpThread.ioModeOf1F4 = IoModeType.PAKIN_MODE; | 
 |  |  | //                            } | 
 |  |  | //                            break; | 
 |  |  | //                        case 113: | 
 |  |  | //                            if (taskWrk != null) { | 
 |  |  | //                                if (devpThread.ioModeOf1F5 != IoModeType.PAKOUT_MODE) { | 
 |  |  | //                                    // 出库切换中 | 
 |  |  | //                                    devpThread.ioModeOf1F5 = IoModeType.PAKOUT_BOOTING; | 
 |  |  | //                                    TaskWrk pakin = taskWrkService.selectByStartPoint(inSta.getStaNo() + ""); | 
 |  |  | //                                    if (pakin == null && !devpThread.getStation().get(inSta.getStaNo()).isLoading() | 
 |  |  | //                                            && !devpThread.getStation().get(inSta.getBackSta()).isLoading() | 
 |  |  | //                                            && devpThread.getStation().get(inSta.getBackSta()).getWorkNo() == 0) { | 
 |  |  | //                                        // 出库模式 | 
 |  |  | //                                        devpThread.ioModeOf1F5 = IoModeType.PAKOUT_MODE; | 
 |  |  | //                                    } | 
 |  |  | //                                } | 
 |  |  | //                            } else { | 
 |  |  | //                                // 入库模式 | 
 |  |  | //                                devpThread.ioModeOf1F5 = IoModeType.PAKIN_MODE; | 
 |  |  | //                            } | 
 |  |  | //                            break; | 
 |  |  | //                        case 203: | 
 |  |  | //                            if (taskWrk != null) { | 
 |  |  | //                                if (devpThread.ioModeOf2F1 != IoModeType.PAKOUT_MODE) { | 
 |  |  | //                                    // 出库切换中 | 
 |  |  | //                                    devpThread.ioModeOf2F1 = IoModeType.PAKOUT_BOOTING; | 
 |  |  | //                                    TaskWrk pakin = taskWrkService.selectByStartPoint(inSta.getStaNo() + ""); | 
 |  |  | //                                    if (pakin == null && !devpThread.getStation().get(inSta.getStaNo()).isLoading() | 
 |  |  | //                                            && !devpThread.getStation().get(inSta.getBackSta()).isLoading() | 
 |  |  | //                                            && devpThread.getStation().get(inSta.getBackSta()).getWorkNo() == 0) { | 
 |  |  | //                                        // 出库模式 | 
 |  |  | //                                        devpThread.ioModeOf2F1 = IoModeType.PAKOUT_MODE; | 
 |  |  | //                                    } | 
 |  |  | //                                } | 
 |  |  | //                            } else { | 
 |  |  | //                                // 入库模式 | 
 |  |  | //                                devpThread.ioModeOf2F1 = IoModeType.PAKIN_MODE; | 
 |  |  | //                            } | 
 |  |  | //                            break; | 
 |  |  | // | 
 |  |  | //                        case 207: | 
 |  |  | //                            if (taskWrk != null) { | 
 |  |  | //                                if (devpThread.ioModeOf2F2 != IoModeType.PAKOUT_MODE) { | 
 |  |  | //                                    // 出库切换中 | 
 |  |  | //                                    devpThread.ioModeOf2F2 = IoModeType.PAKOUT_BOOTING; | 
 |  |  | //                                    TaskWrk pakin = taskWrkService.selectByStartPoint(inSta.getStaNo() + ""); | 
 |  |  | //                                    if (pakin == null && !devpThread.getStation().get(inSta.getStaNo()).isLoading() | 
 |  |  | //                                            && !devpThread.getStation().get(inSta.getBackSta()).isLoading() | 
 |  |  | //                                            && devpThread.getStation().get(inSta.getBackSta()).getWorkNo() == 0) { | 
 |  |  | //                                        // 出库模式 | 
 |  |  | //                                        devpThread.ioModeOf2F2 = IoModeType.PAKOUT_MODE; | 
 |  |  | //                                    } | 
 |  |  | //                                } | 
 |  |  | //                            } else { | 
 |  |  | //                                // 入库模式 | 
 |  |  | //                                devpThread.ioModeOf2F2 = IoModeType.PAKIN_MODE; | 
 |  |  | //                            } | 
 |  |  | //                            break; | 
 |  |  | // | 
 |  |  | //                        case 212: | 
 |  |  | //                            if (taskWrk != null) { | 
 |  |  | //                                if (devpThread.ioModeOf2F3 != IoModeType.PAKOUT_MODE) { | 
 |  |  | //                                    // 出库切换中 | 
 |  |  | //                                    devpThread.ioModeOf2F3 = IoModeType.PAKOUT_BOOTING; | 
 |  |  | //                                    TaskWrk pakin = taskWrkService.selectByStartPoint(inSta.getStaNo() + ""); | 
 |  |  | //                                    if (pakin == null && !devpThread.getStation().get(inSta.getStaNo()).isLoading() | 
 |  |  | //                                            && !devpThread.getStation().get(inSta.getBackSta()).isLoading() | 
 |  |  | //                                            && devpThread.getStation().get(inSta.getBackSta()).getWorkNo() == 0) { | 
 |  |  | //                                        // 出库模式 | 
 |  |  | //                                        devpThread.ioModeOf2F3 = IoModeType.PAKOUT_MODE; | 
 |  |  | //                                    } | 
 |  |  | //                                } | 
 |  |  | //                            } else { | 
 |  |  | //                                // 入库模式 | 
 |  |  | //                                devpThread.ioModeOf2F3 = IoModeType.PAKIN_MODE; | 
 |  |  | //                            } | 
 |  |  | //                            break; | 
 |  |  | //                    } | 
 |  |  | //                } | 
 |  |  |             } | 
 |  |  |         } catch (Exception e) { | 
 |  |  |             e.printStackTrace(); | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.asrs.service.impl; | 
 |  |  |  | 
 |  |  | import com.baomidou.mybatisplus.core.conditions.Wrapper; | 
 |  |  | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
 |  |  | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | 
 |  |  | import com.zy.acs.framework.exception.CoolException; | 
 |  |  | import com.zy.acs.wcs.asrs.entity.StaDesc; | 
 |  |  | import com.zy.acs.wcs.asrs.mapper.StaDescMapper; | 
 |  |  | import com.zy.acs.wcs.asrs.service.StaDescService; | 
 |  |  | import org.springframework.stereotype.Service; | 
 |  |  |  | 
 |  |  | @Service("staDescService") | 
 |  |  | public class StaDescServiceImpl extends ServiceImpl<StaDescMapper, StaDesc> implements StaDescService { | 
 |  |  |  | 
 |  |  |     @Override | 
 |  |  |     public StaDesc queryCrnStn(Integer typeNo, Integer crnNo, Integer stnNo) { | 
 |  |  |         Wrapper<StaDesc> wrapper = new QueryWrapper<StaDesc>() | 
 |  |  |                 .eq("type_no", typeNo) | 
 |  |  |                 .eq("stn_no", stnNo) | 
 |  |  |                 .eq("crn_no", crnNo); | 
 |  |  |         StaDesc staDesc = this.getOne(wrapper); | 
 |  |  |         if (staDesc == null) { | 
 |  |  |             throw new CoolException("出库路径不存在"); | 
 |  |  |         } | 
 |  |  |         return staDesc; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @Override | 
 |  |  |     public StaDesc queryCrn(Integer typeNo, Integer stnNo, Integer crnNo) { | 
 |  |  |         Wrapper<StaDesc> wrapper = new QueryWrapper<StaDesc>() | 
 |  |  |                 .eq("type_no", typeNo) | 
 |  |  |                 .eq("stn_no", stnNo) | 
 |  |  |                 .eq("crn_no", crnNo); | 
 |  |  |         StaDesc staDesc = this.getOne(wrapper); | 
 |  |  |         if (staDesc == null) { | 
 |  |  |             return null; | 
 |  |  |         } | 
 |  |  |         return staDesc; | 
 |  |  |     } | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.asrs.service.impl; | 
 |  |  |  | 
 |  |  | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | 
 |  |  | import com.zy.acs.wcs.asrs.entity.TaskReportLog; | 
 |  |  | import com.zy.acs.wcs.asrs.mapper.TaskReportLogMapper; | 
 |  |  | import com.zy.acs.wcs.asrs.service.TaskReportLogService; | 
 |  |  | import lombok.extern.slf4j.Slf4j; | 
 |  |  | import org.springframework.stereotype.Service; | 
 |  |  |  | 
 |  |  | @Slf4j | 
 |  |  | @Service("taskReportLogService") | 
 |  |  | public class TaskReportLogServiceImpl extends ServiceImpl<TaskReportLogMapper, TaskReportLog> implements TaskReportLogService { | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.asrs.service.impl; | 
 |  |  |  | 
 |  |  | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | 
 |  |  | import com.zy.acs.wcs.asrs.entity.TaskReport; | 
 |  |  | import com.zy.acs.wcs.asrs.mapper.TaskReportMapper; | 
 |  |  | import com.zy.acs.wcs.asrs.service.TaskReportService; | 
 |  |  | import lombok.extern.slf4j.Slf4j; | 
 |  |  | import org.springframework.stereotype.Service; | 
 |  |  |  | 
 |  |  | @Slf4j | 
 |  |  | @Service("taskReportService") | 
 |  |  | public class TaskReportServiceImpl extends ServiceImpl<TaskReportMapper, TaskReport> implements TaskReportService { | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.asrs.service.impl; | 
 |  |  |  | 
 |  |  | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | 
 |  |  | import com.zy.acs.wcs.asrs.entity.WrkDetl; | 
 |  |  | import com.zy.acs.wcs.asrs.mapper.WrkDetlMapper; | 
 |  |  | import com.zy.acs.wcs.asrs.service.WrkDetlService; | 
 |  |  | import org.springframework.stereotype.Service; | 
 |  |  |  | 
 |  |  |  | 
 |  |  | @Service("wrkDetlService") | 
 |  |  | public class WrkDetlServiceImpl extends ServiceImpl<WrkDetlMapper, WrkDetl> implements WrkDetlService { | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.asrs.service.impl; | 
 |  |  |  | 
 |  |  | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | 
 |  |  | import com.zy.acs.wcs.asrs.entity.WrkMast; | 
 |  |  | import com.zy.acs.wcs.asrs.mapper.WrkMastMapper; | 
 |  |  | import com.zy.acs.wcs.asrs.service.WrkMastService; | 
 |  |  | import org.springframework.stereotype.Service; | 
 |  |  |  | 
 |  |  | import java.util.List; | 
 |  |  |  | 
 |  |  | @Service("wrkMastService") | 
 |  |  | public class WrkMastServiceImpl extends ServiceImpl<WrkMastMapper, WrkMast> implements WrkMastService { | 
 |  |  |  | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.common; | 
 |  |  |  | 
 |  |  | import lombok.Data; | 
 |  |  |  | 
 |  |  | import java.util.ArrayList; | 
 |  |  | import java.util.List; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * Created by vincent on 2023/6/12 | 
 |  |  |  */ | 
 |  |  | @Data | 
 |  |  | public class OpenBusSubmitParam { | 
 |  |  |  | 
 |  |  |     private String batch; | 
 |  |  |  | 
 |  |  |     private List<TaskDto> taskList = new ArrayList<>(); | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.common; | 
 |  |  |  | 
 |  |  | import lombok.Data; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * Created by vincent on 2023/6/12 | 
 |  |  |  */ | 
 |  |  | @Data | 
 |  |  | public class TaskDto { | 
 |  |  |  | 
 |  |  |     private String seqNum; | 
 |  |  |  | 
 |  |  |     private String oriLoc; | 
 |  |  |  | 
 |  |  |     private String oriSta; | 
 |  |  |  | 
 |  |  |     private String destLoc; | 
 |  |  |  | 
 |  |  |     private String destSta; | 
 |  |  |  | 
 |  |  |     private Integer priority = 1; | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.common.utils; | 
 |  |  |  | 
 |  |  |  | 
 |  |  | import okhttp3.*; | 
 |  |  |  | 
 |  |  | import java.io.IOException; | 
 |  |  | import java.util.Map; | 
 |  |  | import java.util.Optional; | 
 |  |  | import java.util.concurrent.TimeUnit; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * Http协议客户端 | 
 |  |  |  * @author luxiaotao | 
 |  |  |  * @date 2018-9-27 | 
 |  |  |  */ | 
 |  |  | public class HttpHandler { | 
 |  |  |  | 
 |  |  |     private static final Integer DEFAULT_TIMEOUT_SECONDS = 5; | 
 |  |  |     private static final MediaType MEDIA_TYPE = MediaType.parse("application/json;charset=utf-8"); | 
 |  |  |  | 
 |  |  |     private String uri; | 
 |  |  |     private String path; | 
 |  |  |     private String json; | 
 |  |  |     private Map<String, Object> params; | 
 |  |  |     private Map<String, Object> headers; | 
 |  |  |     private boolean https; | 
 |  |  |     private Integer timeout; | 
 |  |  |     private TimeUnit timeUnit; | 
 |  |  |  | 
 |  |  |     public HttpHandler(Builder builder){ | 
 |  |  |         this.uri = builder.uri; | 
 |  |  |         this.path = builder.path; | 
 |  |  |         this.json = builder.json; | 
 |  |  |         this.params = builder.params; | 
 |  |  |         this.headers = builder.headers; | 
 |  |  |         this.https = builder.https; | 
 |  |  |         this.timeout = builder.timeout; | 
 |  |  |         this.timeUnit = builder.timeUnit; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * GET请求执行 | 
 |  |  |      * @return the HttpHandler response | 
 |  |  |      */ | 
 |  |  |     public String doGet() throws IOException { | 
 |  |  |         String url = paramsToUrl(uri, path, params, https); | 
 |  |  |         Request.Builder headerBuilder = new Request.Builder(); | 
 |  |  |         if (headers != null && headers.size()>0){ | 
 |  |  |             for (Map.Entry<String, Object> entry : headers.entrySet()){ | 
 |  |  |                 headerBuilder.addHeader(entry.getKey(), String.valueOf(entry.getValue())); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         Request request = headerBuilder.url(url).build(); | 
 |  |  |         Response response = getClient(timeout, timeUnit).newCall(request).execute(); | 
 |  |  |         return response.isSuccessful() ? response.body().string() : null; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * POST请求执行 | 
 |  |  |      * @return the HttpHandler response | 
 |  |  |      */ | 
 |  |  |     public String doPost() throws IOException { | 
 |  |  |         Request request; | 
 |  |  |         Request.Builder headerBuilder = new Request.Builder(); | 
 |  |  |         if (headers != null && headers.size()>0){ | 
 |  |  |             for (Map.Entry<String, Object> entry : headers.entrySet()){ | 
 |  |  |                 headerBuilder.addHeader(entry.getKey(), String.valueOf(entry.getValue())); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         if (json == null || "".equals(json)){ | 
 |  |  |             FormBody.Builder builder = new FormBody.Builder(); | 
 |  |  |             for (Map.Entry<String, Object> entry : params.entrySet()){ | 
 |  |  |                 builder.add(entry.getKey(), String.valueOf(entry.getValue())); | 
 |  |  |             } | 
 |  |  |             FormBody body = builder.build(); | 
 |  |  |             request = headerBuilder | 
 |  |  |                     .url((https?"https://":"http://")+uri+path) | 
 |  |  |                     .post(body) | 
 |  |  |                     .build(); | 
 |  |  |         } else { | 
 |  |  |             RequestBody body = RequestBody.create(MEDIA_TYPE, json); | 
 |  |  |             Request.Builder builder = headerBuilder.url((https?"https://":"http://")+uri+path); | 
 |  |  |             builder.header("Content-Type", "application/json;charset=UTF-8"); | 
 |  |  |             request = builder.post(body).build(); | 
 |  |  |  | 
 |  |  |         } | 
 |  |  |         Call call = getClient(timeout, timeUnit).newCall(request); | 
 |  |  |         Response response = call.execute(); | 
 |  |  |         return response.body().string(); | 
 |  |  |  | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * get请求参数拼接方法 | 
 |  |  |      * @return 请求行 | 
 |  |  |      */ | 
 |  |  |     private String paramsToUrl(String uri, String path, Map<String, Object> params, boolean isHttps) { | 
 |  |  |         StringBuilder res = new StringBuilder(); | 
 |  |  |         res.append(isHttps ? "https://" : "http://"); | 
 |  |  |         res.append(uri); | 
 |  |  |         if (path.length() > 0 && !(path.charAt(0) == '/')){ | 
 |  |  |             res.append("/"); | 
 |  |  |         } | 
 |  |  |         res.append(path); | 
 |  |  |         Optional.ofNullable(params).ifPresent( | 
 |  |  |                 args -> { | 
 |  |  |                     res.append("?"); | 
 |  |  |                     args.forEach((key, value) -> { | 
 |  |  |                         res.append(key); | 
 |  |  |                         res.append("="); | 
 |  |  |                         res.append(value); | 
 |  |  |                         res.append("&"); | 
 |  |  |                     }); | 
 |  |  |                 } | 
 |  |  |         ); | 
 |  |  |         String url = res.toString(); | 
 |  |  |         if ("&".equals(url.substring(url.length()-1, url.length()))){ | 
 |  |  |             url = url.substring(0, url.length()-1); | 
 |  |  |         } | 
 |  |  |         return url; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 获取 okHttpClient | 
 |  |  |      * @return the HttpHandler instance | 
 |  |  |      */ | 
 |  |  |     private OkHttpClient getClient(Integer timeout, TimeUnit timeUnit){ | 
 |  |  |         return new OkHttpClient | 
 |  |  |                 .Builder() | 
 |  |  |                 .connectTimeout(timeout, timeUnit) | 
 |  |  |                 .readTimeout(timeout, timeUnit) | 
 |  |  |                 .build(); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * Http协议报文建造者 | 
 |  |  |      */ | 
 |  |  |     public static class Builder { | 
 |  |  |  | 
 |  |  |         private String uri; | 
 |  |  |         private String path; | 
 |  |  |         private String json; | 
 |  |  |         private Map<String, Object> params; | 
 |  |  |         private Map<String, Object> headers; | 
 |  |  |         private boolean https; | 
 |  |  |         private Integer timeout; | 
 |  |  |         private TimeUnit timeUnit; | 
 |  |  |  | 
 |  |  |         { | 
 |  |  |             // 默认5s超时 | 
 |  |  |             timeout = DEFAULT_TIMEOUT_SECONDS; | 
 |  |  |             timeUnit = TimeUnit.SECONDS; | 
 |  |  |             path = ""; | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         /** | 
 |  |  |          * 建造器 | 
 |  |  |          * @return the HttpHandler instance | 
 |  |  |          */ | 
 |  |  |         public HttpHandler build(){ | 
 |  |  |             if (null == this.uri || "".equals(this.uri)){ | 
 |  |  |                 throw new RuntimeException("uri is null"); | 
 |  |  |             } | 
 |  |  |             if (this.uri.startsWith("http://")){ | 
 |  |  |                 this.uri = this.uri.substring(6,uri.length()); | 
 |  |  |             } else if (this.uri.startsWith("https://")){ | 
 |  |  |                 this.uri = this.uri.substring(7,uri.length()); | 
 |  |  |             } | 
 |  |  |             return new HttpHandler(this); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         public Builder setUri(String uri) { | 
 |  |  |             this.uri = uri; | 
 |  |  |             return this; | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         public Builder setPath(String path) { | 
 |  |  |             if (!path.startsWith("/")){ | 
 |  |  |                 path = "/" + path; | 
 |  |  |             } | 
 |  |  |             this.path = path; | 
 |  |  |             return this; | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         public Builder setTimeout(Integer timeout, TimeUnit timeUnit) { | 
 |  |  |             this.timeout = timeout; | 
 |  |  |             this.timeUnit = timeUnit; | 
 |  |  |             return this; | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         public Builder setParams(Map<String, Object> params) { | 
 |  |  |             this.params = params; | 
 |  |  |             return this; | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         public Builder setHeaders(Map<String, Object> headers) { | 
 |  |  |             this.headers = headers; | 
 |  |  |             return this; | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         public Builder setHttps(boolean https) { | 
 |  |  |             this.https = https; | 
 |  |  |             return this; | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         public Builder setJson(String json) { | 
 |  |  |             this.json = json; | 
 |  |  |             return this; | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.core; | 
 |  |  |  | 
 |  |  | import com.zy.acs.wcs.core.model.protocol.CrnProtocol; | 
 |  |  |  | 
 |  |  | public interface CrnThread extends ThreadHandler { | 
 |  |  |  | 
 |  |  |     CrnProtocol getCrnProtocol(); | 
 |  |  |  | 
 |  |  |     void setResetFlag(boolean flag); | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.core; | 
 |  |  |  | 
 |  |  | import com.zy.acs.wcs.core.model.protocol.StaProtocol; | 
 |  |  |  | 
 |  |  | import java.util.Map; | 
 |  |  |  | 
 |  |  | public interface DevpThread extends ThreadHandler { | 
 |  |  |  | 
 |  |  |     Map<Integer, StaProtocol> getStation(); | 
 |  |  |  | 
 |  |  |     void setPakMk(Integer siteId, boolean pakMk); | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.core; | 
 |  |  |  | 
 |  |  | import com.zy.acs.wcs.asrs.service.impl.MainServiceImpl; | 
 |  |  | import com.zy.acs.wcs.core.properties.SystemProperties; | 
 |  |  | import lombok.Data; | 
 |  |  | import lombok.extern.slf4j.Slf4j; | 
 |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
 |  |  | import org.springframework.stereotype.Component; | 
 |  |  |  | 
 |  |  | import javax.annotation.PreDestroy; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * WCS主流程 | 
 |  |  |  * Created by vincent on 2020/8/6 | 
 |  |  |  */ | 
 |  |  | @Data | 
 |  |  | @Slf4j | 
 |  |  | @Component | 
 |  |  | public class MainProcess { | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private MainServiceImpl mainService; | 
 |  |  |     // 所属线程 | 
 |  |  |     private Thread thread; | 
 |  |  |     // 频率 | 
 |  |  |     private int i = 0; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * =====>>  开始工作 | 
 |  |  |      */ | 
 |  |  |     public void start() { | 
 |  |  |         thread = new Thread(() -> { | 
 |  |  |             while (!Thread.currentThread().isInterrupted()) { | 
 |  |  |                 try { | 
 |  |  |                     // 间隔 | 
 |  |  |                     Thread.sleep(1000); | 
 |  |  |  | 
 |  |  |                     // 系统运行状态判断 | 
 |  |  |                     if (!SystemProperties.WCS_RUNNING_STATUS.get()) { | 
 |  |  |                         continue; | 
 |  |  |                     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |                     // 入库 | 
 |  |  |                     mainService.generateStoreWrkFile(); | 
 |  |  |                     // 出库 | 
 |  |  |                     mainService.out(); | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |                     // 其他  ===>> // 入出库模式切换函数 | 
 |  |  |                     i++; | 
 |  |  |                     if (i > 1) { | 
 |  |  |                         mainService.ioConvert(); | 
 |  |  |                         i = 0; | 
 |  |  |                     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |                 } catch (Exception e) { | 
 |  |  |                     e.printStackTrace(); | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |         }); | 
 |  |  |         thread.start(); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @PreDestroy | 
 |  |  |     public void shutDown() { | 
 |  |  |         if (thread != null) thread.interrupt(); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.core; | 
 |  |  |  | 
 |  |  | import com.zy.acs.common.utils.RedisSupport; | 
 |  |  | import com.zy.acs.wcs.asrs.entity.TaskReport; | 
 |  |  | import com.zy.acs.wcs.asrs.entity.WrkMast; | 
 |  |  | import com.zy.acs.wcs.asrs.service.TaskReportService; | 
 |  |  | import com.zy.acs.wcs.asrs.service.WrkMastService; | 
 |  |  | import lombok.extern.slf4j.Slf4j; | 
 |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
 |  |  | import org.springframework.stereotype.Component; | 
 |  |  | import org.springframework.transaction.annotation.Transactional; | 
 |  |  |  | 
 |  |  | import java.util.Date; | 
 |  |  | import java.util.List; | 
 |  |  |  | 
 |  |  | @Slf4j | 
 |  |  | @Component | 
 |  |  | public class ReportThirdScheduler { | 
 |  |  |  | 
 |  |  |     private final RedisSupport redis = RedisSupport.defaultRedisSupport; | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private TaskReportService taskReportService; | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private WrkMastService wrkMastService; | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     //    @Scheduled(fixedDelay = 1000) | 
 |  |  |     public void execute() { | 
 |  |  |         List<TaskReport> list = taskReportService.list(); | 
 |  |  |         for (TaskReport taskReport : list) { | 
 |  |  |             report(taskReport); | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @Transactional | 
 |  |  |     public void report(TaskReport taskReport) { | 
 |  |  |         //TODO 原先应该调用接口,现在直接修改数据 | 
 |  |  |         WrkMast wrkMast = wrkMastService.getById(taskReport.getSeqNum()); | 
 |  |  |         if (wrkMast != null) { | 
 |  |  |             wrkMast.setWrkSts(14L); | 
 |  |  |             wrkMast.setModiTime(new Date()); | 
 |  |  |             wrkMastService.updateById(wrkMast); | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.core; | 
 |  |  |  | 
 |  |  | import com.zy.acs.wcs.core.cache.MessageQueue; | 
 |  |  | import com.zy.acs.wcs.core.cache.SlaveConnection; | 
 |  |  | import com.zy.acs.wcs.core.enums.SlaveType; | 
 |  |  | import com.zy.acs.wcs.core.model.DevpSlave; | 
 |  |  | import com.zy.acs.wcs.core.properties.SlaveProperties; | 
 |  |  | import com.zy.acs.wcs.core.thread.SiemensDevpThread; | 
 |  |  | import lombok.extern.slf4j.Slf4j; | 
 |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
 |  |  | import org.springframework.scheduling.annotation.Async; | 
 |  |  | import org.springframework.stereotype.Component; | 
 |  |  |  | 
 |  |  | import javax.annotation.PostConstruct; | 
 |  |  | import javax.annotation.PreDestroy; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * Created by vincent on 2020/8/4 | 
 |  |  |  */ | 
 |  |  | @Slf4j | 
 |  |  | @Component | 
 |  |  | public class ServerBootstrap { | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private SlaveProperties slaveProperties; | 
 |  |  |     @Autowired | 
 |  |  |     private MainProcess mainProcess; | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * PostConstruct会在加载servlet的时候运行一次 | 
 |  |  |      * | 
 |  |  |      * @throws InterruptedException | 
 |  |  |      */ | 
 |  |  |     @PostConstruct | 
 |  |  |     @Async | 
 |  |  |     public void init() throws InterruptedException { | 
 |  |  |         log.info("核心控制层开始初始化..............................................."); | 
 |  |  |         Thread.sleep(2000); | 
 |  |  |         // 初始化消息队列 | 
 |  |  |         initMq(); | 
 |  |  |         // 初始化下位机线程 | 
 |  |  |         initThread(); | 
 |  |  |         // 开始主流程进程 | 
 |  |  |         mainProcess.start(); | 
 |  |  |  | 
 |  |  |         log.info("核心控制层已启动..............................................."); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     private void initMq() { | 
 |  |  |         // 初始化堆垛机mq | 
 |  |  | //        for (Slave crn : slaveProperties.getCrn()) { | 
 |  |  | //            MessageQueue.init(SlaveType.Crn, crn); | 
 |  |  | //        } | 
 |  |  |         // 初始化输送线mq | 
 |  |  |         for (Slave devp : slaveProperties.getDevp()) { | 
 |  |  |             MessageQueue.init(SlaveType.Devp, devp); | 
 |  |  |         } | 
 |  |  | //        // 初始化条码扫描仪mq | 
 |  |  | //        for (Slave barcode : slaveProperties.getBarcode()) { | 
 |  |  | //            MessageQueue.init(SlaveType.Barcode, barcode); | 
 |  |  | //        } | 
 |  |  | //        // 初始化Led灯mq | 
 |  |  | //        for (Slave led : slaveProperties.getLed()) { | 
 |  |  | //            MessageQueue.init(SlaveType.Led, led); | 
 |  |  | //        } | 
 |  |  | //        // 初始化磅称mq | 
 |  |  | //        for (Slave scale : slaveProperties.getScale()) { | 
 |  |  | //            MessageQueue.init(SlaveType.Scale, scale); | 
 |  |  | //        } | 
 |  |  | //        // 初始化台车mq | 
 |  |  | //        for (Slave car : slaveProperties.getCar()) { | 
 |  |  | //            MessageQueue.init(SlaveType.Car, car); | 
 |  |  | //        } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     private void initThread() { | 
 |  |  |         // 初始化堆垛机线程 | 
 |  |  | //        log.info("初始化堆垛机线程..................................................."); | 
 |  |  | //        for (CrnSlave crn : slaveProperties.getCrn()) { | 
 |  |  | //            CrnThread crnThread = new SiemensCrnThread(crn); | 
 |  |  | //            new Thread((Runnable) crnThread).start(); | 
 |  |  | //            SlaveConnection.put(SlaveType.Crn, crn.getId(), crnThread); | 
 |  |  | //        } | 
 |  |  |         // 初始化输送线线程 | 
 |  |  |         log.info("初始化输送线线程..................................................."); | 
 |  |  |         for (DevpSlave devp : slaveProperties.getDevp()) { | 
 |  |  |             DevpThread devpThread = new SiemensDevpThread(devp); | 
 |  |  |             new Thread((Runnable) devpThread).start(); | 
 |  |  |             SlaveConnection.put(SlaveType.Devp, devp.getId(), devpThread); | 
 |  |  |         } | 
 |  |  |         // 初始化条码扫描仪线程 | 
 |  |  | //        log.info("初始化条码扫描仪线程..................................................."); | 
 |  |  | //        for (Slave barcode : slaveProperties.getBarcode()) { | 
 |  |  | //            BarcodeThread barcodeThread = new BarcodeThread(barcode); | 
 |  |  | ////            new Thread(barcodeThread).start(); | 
 |  |  | //            SlaveConnection.put(SlaveType.Barcode, barcode.getId(), barcodeThread); | 
 |  |  | //        } | 
 |  |  | //        // 初始化LED线程 | 
 |  |  | //        log.info("初始化LED线程..................................................."); | 
 |  |  | //        for (LedSlave led : slaveProperties.getLed()) { | 
 |  |  | //            LedThread ledThread = new LedThread(led); | 
 |  |  | //            new Thread(ledThread).start(); | 
 |  |  | //            SlaveConnection.put(SlaveType.Led, led.getId(), ledThread); | 
 |  |  | //        } | 
 |  |  | //        // 初始化磅秤线程 | 
 |  |  | //        log.info("初始化磅秤线程..................................................."); | 
 |  |  | //        for (Slave scale : slaveProperties.getScale()) { | 
 |  |  | //            ScaleThread scaleThread = new ScaleThread(scale); | 
 |  |  | //            new Thread(scaleThread).start(); | 
 |  |  | //            SlaveConnection.put(SlaveType.Scale, scale.getId(), scaleThread); | 
 |  |  | //        } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     @PreDestroy | 
 |  |  |     public void destroy() { | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.core; | 
 |  |  |  | 
 |  |  | import lombok.Data; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * Created by vincent on 2020/8/4 | 
 |  |  |  */ | 
 |  |  | @Data | 
 |  |  | public class Slave { | 
 |  |  |  | 
 |  |  |     private Integer id; | 
 |  |  |  | 
 |  |  |     private String ip; | 
 |  |  |  | 
 |  |  |     private Integer port; | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.core; | 
 |  |  |  | 
 |  |  | public interface ThreadHandler { | 
 |  |  |  | 
 |  |  |     boolean connect(); | 
 |  |  |  | 
 |  |  |     void close(); | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.core.cache; | 
 |  |  |  | 
 |  |  | import com.zy.acs.wcs.core.Slave; | 
 |  |  | import com.zy.acs.wcs.core.enums.SlaveType; | 
 |  |  | import com.zy.acs.wcs.core.model.Task; | 
 |  |  |  | 
 |  |  | import java.util.Map; | 
 |  |  | import java.util.concurrent.ConcurrentHashMap; | 
 |  |  | import java.util.concurrent.ConcurrentLinkedQueue; | 
 |  |  | import java.util.concurrent.LinkedBlockingQueue; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * 消息队列 | 
 |  |  |  * Created by vincent on 2020/8/5 | 
 |  |  |  */ | 
 |  |  | public class MessageQueue { | 
 |  |  |  | 
 |  |  |     // 堆垛机mq交换机 | 
 |  |  |     private static final Map<Integer, LinkedBlockingQueue<Task>> CRN_EXCHANGE = new ConcurrentHashMap<>(); | 
 |  |  |     // 输送线mq交换机 | 
 |  |  |     private static final Map<Integer, ConcurrentLinkedQueue<Task>> DEVP_EXCHANGE = new ConcurrentHashMap<>(); | 
 |  |  |     // 条码扫描仪mq交换机 | 
 |  |  |     private static final Map<Integer, ConcurrentLinkedQueue<Task>> BARCODE_EXCHANGE = new ConcurrentHashMap<>(); | 
 |  |  |     // Led灯 mq交换机 | 
 |  |  |     private static final Map<Integer, LinkedBlockingQueue<Task>> LED_EXCHANGE = new ConcurrentHashMap<>(); | 
 |  |  |     // 磅称mq交换机 | 
 |  |  |     private static final Map<Integer, ConcurrentLinkedQueue<Task>> SCALE_EXCHANGE = new ConcurrentHashMap<>(); | 
 |  |  |     // 台车mq交换机 | 
 |  |  |     private static final Map<Integer, ConcurrentLinkedQueue<Task>> CAR_EXCHANGE = new ConcurrentHashMap<>(); | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * mq 交换机初始化 | 
 |  |  |      */ | 
 |  |  |     public static void init(SlaveType type, Slave slave) { | 
 |  |  |         switch (type) { | 
 |  |  |             case Crn: | 
 |  |  |                 CRN_EXCHANGE.put(slave.getId(), new LinkedBlockingQueue<>(1)); | 
 |  |  |                 break; | 
 |  |  |             case Devp: | 
 |  |  |                 DEVP_EXCHANGE.put(slave.getId(), new ConcurrentLinkedQueue<>()); | 
 |  |  |                 break; | 
 |  |  |             case Barcode: | 
 |  |  |                 BARCODE_EXCHANGE.put(slave.getId(), new ConcurrentLinkedQueue<>()); | 
 |  |  |                 break; | 
 |  |  |             case Led: | 
 |  |  |                 LED_EXCHANGE.put(slave.getId(), new LinkedBlockingQueue<>(1)); | 
 |  |  |                 break; | 
 |  |  |             case Scale: | 
 |  |  |                 SCALE_EXCHANGE.put(slave.getId(), new ConcurrentLinkedQueue<>()); | 
 |  |  |                 break; | 
 |  |  |             case Car: | 
 |  |  |                 CAR_EXCHANGE.put(slave.getId(), new ConcurrentLinkedQueue<>()); | 
 |  |  |                 break; | 
 |  |  |             default: | 
 |  |  |                 break; | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 添加元素 | 
 |  |  |      * 如果发现队列已满无法添加的话,会直接返回false。 | 
 |  |  |      */ | 
 |  |  |     public static boolean offer(SlaveType type, Integer id, Task task) { | 
 |  |  |         switch (type) { | 
 |  |  |             case Crn: | 
 |  |  |                 return CRN_EXCHANGE.get(id).offer(task); | 
 |  |  |             case Devp: | 
 |  |  |                 return DEVP_EXCHANGE.get(id).offer(task); | 
 |  |  |             case Barcode: | 
 |  |  |                 return BARCODE_EXCHANGE.get(id).offer(task); | 
 |  |  |             case Led: | 
 |  |  |                 return LED_EXCHANGE.get(id).offer(task); | 
 |  |  |             case Scale: | 
 |  |  |                 return SCALE_EXCHANGE.get(id).offer(task); | 
 |  |  |             case Car: | 
 |  |  |                 return CAR_EXCHANGE.get(id).offer(task); | 
 |  |  |             default: | 
 |  |  |                 return false; | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 移除元素 | 
 |  |  |      * 若队列为空,返回null。 | 
 |  |  |      */ | 
 |  |  |     public static Task poll(SlaveType type, Integer id) { | 
 |  |  |         switch (type) { | 
 |  |  |             case Crn: | 
 |  |  |                 return CRN_EXCHANGE.get(id).poll(); | 
 |  |  |             case Devp: | 
 |  |  |                 return DEVP_EXCHANGE.get(id).poll(); | 
 |  |  |             case Barcode: | 
 |  |  |                 return BARCODE_EXCHANGE.get(id).poll(); | 
 |  |  |             case Led: | 
 |  |  |                 return LED_EXCHANGE.get(id).poll(); | 
 |  |  |             case Scale: | 
 |  |  |                 return SCALE_EXCHANGE.get(id).poll(); | 
 |  |  |             case Car: | 
 |  |  |                 return CAR_EXCHANGE.get(id).poll(); | 
 |  |  |             default: | 
 |  |  |                 return null; | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 取出元素,并不删除. | 
 |  |  |      */ | 
 |  |  |     public static Task peek(SlaveType type, Integer id) { | 
 |  |  |         switch (type) { | 
 |  |  |             case Crn: | 
 |  |  |                 return CRN_EXCHANGE.get(id).peek(); | 
 |  |  |             case Devp: | 
 |  |  |                 return DEVP_EXCHANGE.get(id).peek(); | 
 |  |  |             case Barcode: | 
 |  |  |                 return BARCODE_EXCHANGE.get(id).peek(); | 
 |  |  |             case Led: | 
 |  |  |                 return LED_EXCHANGE.get(id).peek(); | 
 |  |  |             case Scale: | 
 |  |  |                 return SCALE_EXCHANGE.get(id).peek(); | 
 |  |  |             case Car: | 
 |  |  |                 return CAR_EXCHANGE.get(id).peek(); | 
 |  |  |             default: | 
 |  |  |                 return null; | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public static void clear(SlaveType type, Integer id) { | 
 |  |  |         switch (type) { | 
 |  |  |             case Crn: | 
 |  |  |  | 
 |  |  |                 CRN_EXCHANGE.get(id).clear(); | 
 |  |  |                 break; | 
 |  |  |             case Devp: | 
 |  |  |                 DEVP_EXCHANGE.get(id).clear(); | 
 |  |  |                 break; | 
 |  |  |             case Barcode: | 
 |  |  |                 BARCODE_EXCHANGE.get(id).clear(); | 
 |  |  |                 break; | 
 |  |  |             case Led: | 
 |  |  |                 LED_EXCHANGE.get(id).clear(); | 
 |  |  |                 break; | 
 |  |  |             case Scale: | 
 |  |  |                 SCALE_EXCHANGE.get(id).clear(); | 
 |  |  |                 break; | 
 |  |  |             case Car: | 
 |  |  |                 CAR_EXCHANGE.get(id).clear(); | 
 |  |  |                 break; | 
 |  |  |             default: | 
 |  |  |                 break; | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.core.cache; | 
 |  |  |  | 
 |  |  | import com.alibaba.fastjson.JSONObject; | 
 |  |  |  | 
 |  |  | import java.util.concurrent.ArrayBlockingQueue; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * Created by vincent on 2020/8/17 | 
 |  |  |  */ | 
 |  |  | public class OutputQueue { | 
 |  |  |  | 
 |  |  |     // 堆垛机输出日志 | 
 |  |  |     public static ArrayBlockingQueue<String> CRN = new ArrayBlockingQueue<>(32); | 
 |  |  |     // 输送线输出日志 | 
 |  |  |     public static ArrayBlockingQueue<String> DEVP = new ArrayBlockingQueue<>(32); | 
 |  |  |     // 条码器输出日志 | 
 |  |  |     public static ArrayBlockingQueue<JSONObject> BARCODE = new ArrayBlockingQueue<>(32); | 
 |  |  |     // 磅秤输出日志 | 
 |  |  |     public static ArrayBlockingQueue<JSONObject> SCALE = new ArrayBlockingQueue<>(32); | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.core.cache; | 
 |  |  |  | 
 |  |  | import com.zy.acs.wcs.core.ThreadHandler; | 
 |  |  | import com.zy.acs.wcs.core.enums.SlaveType; | 
 |  |  |  | 
 |  |  | import java.util.Map; | 
 |  |  | import java.util.concurrent.ConcurrentHashMap; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * 线程缓存容器 | 
 |  |  |  * Created by vincent on 2020/8/4 | 
 |  |  |  */ | 
 |  |  | public class SlaveConnection { | 
 |  |  |  | 
 |  |  |     private static final String _LINK = "_"; | 
 |  |  |  | 
 |  |  |     private static final Map<String, ThreadHandler> conContain = new ConcurrentHashMap<>(); | 
 |  |  |  | 
 |  |  |     public static void put(SlaveType type, Integer id, ThreadHandler threadHandler) { | 
 |  |  |         String key = toKey(type, id); | 
 |  |  |         remove(type, id); | 
 |  |  |         conContain.put(key, threadHandler); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public static ThreadHandler get(SlaveType type, Integer id) { | 
 |  |  |         return conContain.get(toKey(type, id)); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public static void remove(SlaveType type, Integer id) { | 
 |  |  |         ThreadHandler threadHandler = get(type, id); | 
 |  |  |         if (null == threadHandler) { | 
 |  |  |             return; | 
 |  |  |         } | 
 |  |  |         conContain.remove(toKey(type, id)); | 
 |  |  |         threadHandler.close(); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public static Integer remove(ThreadHandler threadHandler) { | 
 |  |  |         if (null == threadHandler) { | 
 |  |  |             return null; | 
 |  |  |         } | 
 |  |  |         String key = null; | 
 |  |  |         for (Map.Entry<String, ThreadHandler> entry : conContain.entrySet()) { | 
 |  |  |             if (entry.getValue() == threadHandler) { | 
 |  |  |                 key = entry.getKey(); | 
 |  |  |                 break; | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         if (null != key) { | 
 |  |  |             SlaveType type = SlaveType.findInstance(key); | 
 |  |  |             Integer id = Integer.parseInt(key.split(_LINK)[1]); | 
 |  |  |             remove(type, id); | 
 |  |  |             return id; | 
 |  |  |         } else { | 
 |  |  |             return null; | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     private static String toKey(SlaveType type, Integer id) { | 
 |  |  |         return type.toString() + _LINK + id; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.core.enums; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * 指令类型枚举 | 
 |  |  |  */ | 
 |  |  | public enum CommandStatusType { | 
 |  |  |  | 
 |  |  |     CREATE(1, "指令创建"),   //创建 | 
 |  |  |     EXECUTE(2, "指令执行中"),   //执行 | 
 |  |  |     COMPLETE(3, "指令完成"),  //完成 | 
 |  |  |     ; | 
 |  |  |  | 
 |  |  |     public Integer id; | 
 |  |  |     public String desc; | 
 |  |  |  | 
 |  |  |     CommandStatusType(Integer id, String desc) { | 
 |  |  |         this.id = id; | 
 |  |  |         this.desc = desc; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public static CommandStatusType get(Integer id) { | 
 |  |  |         if (null == id) { | 
 |  |  |             return null; | 
 |  |  |         } | 
 |  |  |         for (CommandStatusType type : CommandStatusType.values()) { | 
 |  |  |             if (type.id.equals(id)) { | 
 |  |  |                 return type; | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         return null; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public static CommandStatusType get(CommandStatusType type) { | 
 |  |  |         if (null == type) { | 
 |  |  |             return null; | 
 |  |  |         } | 
 |  |  |         for (CommandStatusType type1 : CommandStatusType.values()) { | 
 |  |  |             if (type1 == type) { | 
 |  |  |                 return type1; | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         return null; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.core.enums; | 
 |  |  |  | 
 |  |  | public enum CommandType { | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     AUTO(1, "自动命令"),   //自动命令 | 
 |  |  |     MANUAL(2, "手动命令"),   //手动命令 | 
 |  |  |     ; | 
 |  |  |  | 
 |  |  |     public Integer id; | 
 |  |  |     public String desc; | 
 |  |  |  | 
 |  |  |     CommandType(Integer id, String desc) { | 
 |  |  |         this.id = id; | 
 |  |  |         this.desc = desc; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public static CommandType get(Integer id) { | 
 |  |  |         if (null == id) { | 
 |  |  |             return null; | 
 |  |  |         } | 
 |  |  |         for (CommandType type : CommandType.values()) { | 
 |  |  |             if (type.id.equals(id)) { | 
 |  |  |                 return type; | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         return null; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public static CommandType get(CommandType type) { | 
 |  |  |         if (null == type) { | 
 |  |  |             return null; | 
 |  |  |         } | 
 |  |  |         for (CommandType type1 : CommandType.values()) { | 
 |  |  |             if (type1 == type) { | 
 |  |  |                 return type1; | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         return null; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.core.enums; | 
 |  |  |  | 
 |  |  | public enum CrnFingerPosType { | 
 |  |  |  | 
 |  |  |     DOWN(2, "下定位"),  // 下定位 | 
 |  |  |     UP(1, "上定位"),   // 上定位 | 
 |  |  |     NONE(0, "不在定位"),   // 不在定位 | 
 |  |  |     ; | 
 |  |  |  | 
 |  |  |     public Integer id; | 
 |  |  |     public String desc; | 
 |  |  |  | 
 |  |  |     CrnFingerPosType(Integer id, String desc) { | 
 |  |  |         this.id = id; | 
 |  |  |         this.desc = desc; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public static CrnFingerPosType get(Short id) { | 
 |  |  |         if (null == id) { | 
 |  |  |             return null; | 
 |  |  |         } | 
 |  |  |         for (CrnFingerPosType type : CrnFingerPosType.values()) { | 
 |  |  |             if (type.id.equals(id.intValue())) { | 
 |  |  |                 return type; | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         return null; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public static CrnFingerPosType get(CrnFingerPosType type) { | 
 |  |  |         if (null == type) { | 
 |  |  |             return null; | 
 |  |  |         } | 
 |  |  |         for (CrnFingerPosType crnLiftPosType : CrnFingerPosType.values()) { | 
 |  |  |             if (crnLiftPosType == type) { | 
 |  |  |                 return crnLiftPosType; | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         return null; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.core.enums; | 
 |  |  |  | 
 |  |  | public enum CrnForkPosType { | 
 |  |  |  | 
 |  |  |     NONE(-1, "不在定位"),   // 货叉原位 | 
 |  |  |     HOME(0, "货叉原位"),   // 货叉原位 | 
 |  |  |     LEFT(1, "货叉在左侧"),  // 货叉在左侧 | 
 |  |  |     RIGHT(2, "货叉在右侧"),   // 货叉在右侧 | 
 |  |  |     _LEFT(3, "货叉在左侧远"),   // 货叉在右侧远 | 
 |  |  |     _RIGHT(4, "货叉在右侧远"),   // 货叉在右侧远 | 
 |  |  |     ; | 
 |  |  |  | 
 |  |  |     public Integer id; | 
 |  |  |     public String desc; | 
 |  |  |  | 
 |  |  |     CrnForkPosType(Integer id, String desc) { | 
 |  |  |         this.id = id; | 
 |  |  |         this.desc = desc; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public static CrnForkPosType get(Short id) { | 
 |  |  |         if (null == id) { | 
 |  |  |             return null; | 
 |  |  |         } | 
 |  |  |         for (CrnForkPosType type : CrnForkPosType.values()) { | 
 |  |  |             if (type.id.equals(id.intValue())) { | 
 |  |  |                 return type; | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         return null; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public static CrnForkPosType get(CrnForkPosType type) { | 
 |  |  |         if (null == type) { | 
 |  |  |             return null; | 
 |  |  |         } | 
 |  |  |         for (CrnForkPosType crnForkPosType : CrnForkPosType.values()) { | 
 |  |  |             if (crnForkPosType == type) { | 
 |  |  |                 return crnForkPosType; | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         return null; | 
 |  |  |     } | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.core.enums; | 
 |  |  |  | 
 |  |  | public enum CrnLiftPosType { | 
 |  |  |  | 
 |  |  |     _DOWN(4, "双伸位低位"), | 
 |  |  |     _UP(3, "双伸位高位"), | 
 |  |  |     DOWN(2, "单伸位低位"),  // 下定位 | 
 |  |  |     UP(1, "单伸位高位"),   // 上定位 | 
 |  |  |     NONE(0, "不在定位"),   // 不在定位 | 
 |  |  |     ERROR(-1, "未知"),   // 不在定位 | 
 |  |  |     ; | 
 |  |  |  | 
 |  |  |     public Integer id; | 
 |  |  |     public String desc; | 
 |  |  |  | 
 |  |  |     CrnLiftPosType(Integer id, String desc) { | 
 |  |  |         this.id = id; | 
 |  |  |         this.desc = desc; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public static CrnLiftPosType get(Short id) { | 
 |  |  |         if (null == id) { | 
 |  |  |             return null; | 
 |  |  |         } | 
 |  |  |         for (CrnLiftPosType type : CrnLiftPosType.values()) { | 
 |  |  |             if (type.id.equals(id.intValue())) { | 
 |  |  |                 return type; | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         return null; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public static CrnLiftPosType get(CrnLiftPosType type) { | 
 |  |  |         if (null == type) { | 
 |  |  |             return null; | 
 |  |  |         } | 
 |  |  |         for (CrnLiftPosType crnLiftPosType : CrnLiftPosType.values()) { | 
 |  |  |             if (crnLiftPosType == type) { | 
 |  |  |                 return crnLiftPosType; | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         return null; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.core.enums; | 
 |  |  |  | 
 |  |  | public enum CrnModeType { | 
 |  |  |  | 
 |  |  |     NONE(0, "关机"), | 
 |  |  |     AUTO(3, "自动"), | 
 |  |  |     HALF_AUTO(2, "半自动"), | 
 |  |  |     HAND(1, "手动"), | 
 |  |  |     STOP(4, "维修"), | 
 |  |  |     ; | 
 |  |  |  | 
 |  |  |     public Integer id; | 
 |  |  |     public String desc; | 
 |  |  |  | 
 |  |  |     CrnModeType(Integer id, String desc) { | 
 |  |  |         this.id = id; | 
 |  |  |         this.desc = desc; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public static CrnModeType get(Short id) { | 
 |  |  |         if (null == id) { | 
 |  |  |             return null; | 
 |  |  |         } | 
 |  |  |         for (CrnModeType type : CrnModeType.values()) { | 
 |  |  |             if (type.id.equals(id.intValue())) { | 
 |  |  |                 return type; | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         return null; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public static CrnModeType get(CrnModeType type) { | 
 |  |  |         if (null == type) { | 
 |  |  |             return null; | 
 |  |  |         } | 
 |  |  |         for (CrnModeType crnModeType : CrnModeType.values()) { | 
 |  |  |             if (crnModeType == type) { | 
 |  |  |                 return crnModeType; | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         return null; | 
 |  |  |     } | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.core.enums; | 
 |  |  |  | 
 |  |  | public enum CrnStatusType { | 
 |  |  |  | 
 |  |  | //    NONE(-1, "离线"), | 
 |  |  | //    IDLE(0, "空闲"), | 
 |  |  | //    FETCH_MOVING(1, "取货行走"), | 
 |  |  | //    FETCH_WAITING(2, "取货等待"), | 
 |  |  | //    FETCHING(3, "取货中"), | 
 |  |  | //    PUT_MOVING(4, "放货走行"), | 
 |  |  | //    PUT_WAITING(5, "放货等待"), | 
 |  |  | //    PUTTING(6, "放货中"), | 
 |  |  | //    ORIGIN_GO(7, "回原点"), | 
 |  |  | //    ORIGIN_BACK(8, "回反原点"), | 
 |  |  | //    MOVING(9, "走行中"), | 
 |  |  | //    WAITING(10, "任务完成等待WCS确认"), | 
 |  |  | //    PAUSE(11, "任务暂停"), | 
 |  |  | //    SOS(99, "报警"), | 
 |  |  | //    ; | 
 |  |  |  | 
 |  |  |     IDLE(0, "空闲,无任务"), | 
 |  |  |     NONE_MOVING(1, "取货定位"), | 
 |  |  |     FETCHING(2, "取货等待"), | 
 |  |  |     MOVING(3, "取货中"), | 
 |  |  |     PUTTING(4, "放货走行"), | 
 |  |  |     HOMING(5, "放货等待"), | 
 |  |  |     ANTI_ORIGIN(6, "放货中"), | 
 |  |  |     PUT_COMPLETE(7, "回原点"), | 
 |  |  |     //    MOVE_THE_SHIPPING_LOCATION(8, "移动到放货位置"), | 
 |  |  | //    PUTTING(9, "放货中"), | 
 |  |  |     HANDLING_COMPLETED(10, "搬运完成等待WCS确认"), | 
 |  |  |     EMPTY_AVOIDANCE(11, "空载避让"), | 
 |  |  |     SOS(99, "报警"), | 
 |  |  |     OTHER(100, "其他"), | 
 |  |  |     ; | 
 |  |  |  | 
 |  |  |     public Integer id; | 
 |  |  |     public String desc; | 
 |  |  |  | 
 |  |  |     CrnStatusType(Integer id, String desc) { | 
 |  |  |         this.id = id; | 
 |  |  |         this.desc = desc; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public static CrnStatusType get(Short id) { | 
 |  |  |         if (null == id) { | 
 |  |  |             return null; | 
 |  |  |         } | 
 |  |  |         for (CrnStatusType type : CrnStatusType.values()) { | 
 |  |  |             if (type.id.equals(id.intValue())) { | 
 |  |  |                 return type; | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         return null; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public static CrnStatusType get(CrnStatusType type) { | 
 |  |  |         if (null == type) { | 
 |  |  |             return null; | 
 |  |  |         } | 
 |  |  |         for (CrnStatusType crnStatusType : CrnStatusType.values()) { | 
 |  |  |             if (crnStatusType == type) { | 
 |  |  |                 return crnStatusType; | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         return null; | 
 |  |  |     } | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.core.enums; | 
 |  |  |  | 
 |  |  | public enum CrnTaskModeType { | 
 |  |  |  | 
 |  |  |     NONE(0),    // 无 | 
 |  |  |     PAKIN(1),    // 入库 | 
 |  |  |     PAKOUT(2),    // 出库 | 
 |  |  |     LOC_MOVE(3),    // 库位移转 | 
 |  |  |     SITE_MOVE(4),    // 站位移转 | 
 |  |  |     GO_ORIGIN(5),    // 回原点 | 
 |  |  |     CLEAR(7),       // 清错 | 
 |  |  |     ; | 
 |  |  |  | 
 |  |  |     public Integer id; | 
 |  |  |  | 
 |  |  |     CrnTaskModeType(Integer id) { | 
 |  |  |         this.id = id; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public static CrnTaskModeType get(Short id) { | 
 |  |  |         if (null == id) { | 
 |  |  |             return null; | 
 |  |  |         } | 
 |  |  |         for (CrnTaskModeType type : CrnTaskModeType.values()) { | 
 |  |  |             if (type.id.equals(id.intValue())) { | 
 |  |  |                 return type; | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         return null; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public static CrnTaskModeType get(CrnTaskModeType type) { | 
 |  |  |         if (null == type) { | 
 |  |  |             return null; | 
 |  |  |         } | 
 |  |  |         for (CrnTaskModeType crnTaskModeType : CrnTaskModeType.values()) { | 
 |  |  |             if (crnTaskModeType == type) { | 
 |  |  |                 return crnTaskModeType; | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         return null; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.core.enums; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * 入出库模式枚举 | 
 |  |  |  */ | 
 |  |  | public enum IoModeType { | 
 |  |  |  | 
 |  |  |     NONE((short) 0, "未知"), | 
 |  |  |     PAKIN_BOOTING((short) 1, "入库启动中"), | 
 |  |  |     PAKIN_MODE((short) 2, "入库模式"), | 
 |  |  |     PAKOUT_BOOTING((short) 3, "出库启动中"), | 
 |  |  |     PAKOUT_MODE((short) 4, "出库模式"), | 
 |  |  |     ; | 
 |  |  |  | 
 |  |  |     public Short id; | 
 |  |  |     public String desc; | 
 |  |  |  | 
 |  |  |     IoModeType(Short id, String desc) { | 
 |  |  |         this.id = id; | 
 |  |  |         this.desc = desc; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public static IoModeType get(Short id) { | 
 |  |  |         for (IoModeType type : IoModeType.values()) { | 
 |  |  |             if (id.equals(type.id)) { | 
 |  |  |                 return type; | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         return IoModeType.NONE; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.core.enums; | 
 |  |  |  | 
 |  |  | public enum SlaveType { | 
 |  |  |  | 
 |  |  |     Crn, | 
 |  |  |     Devp, | 
 |  |  |     Barcode, | 
 |  |  |     Led, | 
 |  |  |     Scale, | 
 |  |  |     Car, | 
 |  |  |     ; | 
 |  |  |  | 
 |  |  |     public static SlaveType findInstance(String s) { | 
 |  |  |         for (SlaveType type : SlaveType.values()) { | 
 |  |  |             if (type.toString().equals(s)) { | 
 |  |  |                 return type; | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         return null; | 
 |  |  |     } | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.core.model; | 
 |  |  |  | 
 |  |  | import com.zy.acs.wcs.core.Slave; | 
 |  |  | import lombok.Data; | 
 |  |  | import lombok.EqualsAndHashCode; | 
 |  |  |  | 
 |  |  | import java.util.ArrayList; | 
 |  |  | import java.util.List; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * Created by vincent on 2020/8/10 | 
 |  |  |  */ | 
 |  |  | @EqualsAndHashCode(callSuper = true) | 
 |  |  | @Data | 
 |  |  | public class CrnSlave extends Slave { | 
 |  |  |  | 
 |  |  |     private Integer rack; | 
 |  |  |  | 
 |  |  |     private Integer slot; | 
 |  |  |  | 
 |  |  |     private Integer offset; | 
 |  |  |  | 
 |  |  |     private Boolean demo; | 
 |  |  |  | 
 |  |  |     // 堆垛机入库站点 | 
 |  |  |     private List<CrnStn> crnInStn = new ArrayList<>(); | 
 |  |  |  | 
 |  |  |     // 堆垛机出库站点 | 
 |  |  |     private List<CrnStn> crnOutStn = new ArrayList<>(); | 
 |  |  |  | 
 |  |  |     @Data | 
 |  |  |     public static class CrnStn { | 
 |  |  |  | 
 |  |  |         // 输送线plc编号 | 
 |  |  |         private Integer devpPlcId; | 
 |  |  |  | 
 |  |  |         // 堆垛机站点编号 | 
 |  |  |         private Integer staNo; | 
 |  |  |  | 
 |  |  |         // 排 | 
 |  |  |         private Integer row; | 
 |  |  |  | 
 |  |  |         // 列 | 
 |  |  |         private Integer bay; | 
 |  |  |  | 
 |  |  |         // 层 | 
 |  |  |         private Integer lev; | 
 |  |  |  | 
 |  |  |         //退回站点 | 
 |  |  |         private Integer backSta; | 
 |  |  |  | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.core.model; | 
 |  |  |  | 
 |  |  | import com.zy.acs.wcs.core.Slave; | 
 |  |  | import lombok.Data; | 
 |  |  | import lombok.EqualsAndHashCode; | 
 |  |  |  | 
 |  |  | import java.util.ArrayList; | 
 |  |  | import java.util.List; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * 输送线配置 | 
 |  |  |  * Created by vincent on 2020/8/6 | 
 |  |  |  */ | 
 |  |  | @EqualsAndHashCode(callSuper = true) | 
 |  |  | @Data | 
 |  |  | public class DevpSlave extends Slave { | 
 |  |  |  | 
 |  |  |     private Integer rack; | 
 |  |  |  | 
 |  |  |     private Integer slot; | 
 |  |  |  | 
 |  |  |     private List<Sta> inSta = new ArrayList<>(); | 
 |  |  |  | 
 |  |  |     private List<Sta> emptyInSta = new ArrayList<>(); | 
 |  |  |  | 
 |  |  |     private List<Sta> outSta = new ArrayList<>(); | 
 |  |  |  | 
 |  |  |     private List<Sta> pickSta = new ArrayList<>(); | 
 |  |  |  | 
 |  |  |     private List<Sta> deviceSta = new ArrayList<>(); | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     @Data | 
 |  |  |     public static class Sta { | 
 |  |  |  | 
 |  |  |         private Integer zoneId; | 
 |  |  |  | 
 |  |  |         private Integer staNo; | 
 |  |  |  | 
 |  |  |         private Integer barcode; | 
 |  |  |  | 
 |  |  |         private Integer scale; | 
 |  |  |  | 
 |  |  |         private Integer backSta; | 
 |  |  |  | 
 |  |  |         private Integer overSta; | 
 |  |  |  | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.core.model; | 
 |  |  |  | 
 |  |  | import com.zy.acs.wcs.core.Slave; | 
 |  |  | import lombok.Data; | 
 |  |  | import lombok.EqualsAndHashCode; | 
 |  |  |  | 
 |  |  | import java.util.ArrayList; | 
 |  |  | import java.util.List; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * LED配置 | 
 |  |  |  * Created by vincent on 2020/8/6 | 
 |  |  |  */ | 
 |  |  | @EqualsAndHashCode(callSuper = true) | 
 |  |  | @Data | 
 |  |  | public class LedSlave extends Slave { | 
 |  |  |  | 
 |  |  |     // 输送线plc编号 | 
 |  |  |     private Integer devpPlcId; | 
 |  |  |  | 
 |  |  |     // 叉车站点数组 | 
 |  |  |     private List<Integer> staArr = new ArrayList<>(); | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.core.model; | 
 |  |  |  | 
 |  |  | import lombok.Data; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * Created by vincent on 2020/8/5 | 
 |  |  |  */ | 
 |  |  | @Data | 
 |  |  | public class Task { | 
 |  |  |  | 
 |  |  |     private Integer step; | 
 |  |  |  | 
 |  |  |     private Object data; | 
 |  |  |  | 
 |  |  |     public Task() { | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public Task(Integer step, Object data) { | 
 |  |  |         this.step = step; | 
 |  |  |         this.data = data; | 
 |  |  |     } | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.core.model.command; | 
 |  |  |  | 
 |  |  | import lombok.Data; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * 指令数据包 | 
 |  |  |  */ | 
 |  |  | @Data | 
 |  |  | public class CommandPackage<T> { | 
 |  |  |  | 
 |  |  |     //工作号 | 
 |  |  |     private Integer wrkNo; | 
 |  |  |  | 
 |  |  |     //执行设备 | 
 |  |  |     private String device; | 
 |  |  |  | 
 |  |  |     //指令 | 
 |  |  |     private T command; | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.core.model.command; | 
 |  |  |  | 
 |  |  | import com.alibaba.fastjson.annotation.JSONField; | 
 |  |  | import com.zy.acs.wcs.core.enums.CrnTaskModeType; | 
 |  |  | import lombok.Data; | 
 |  |  |  | 
 |  |  | import java.util.Calendar; | 
 |  |  | import java.util.Date; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * 堆垛机命令报文 | 
 |  |  |  * Created by vincent on 2020/8/11 | 
 |  |  |  */ | 
 |  |  | @Data | 
 |  |  | public class CrnCommand { | 
 |  |  |  | 
 |  |  |     // 堆垛机号 | 
 |  |  |     private Integer crnNo = 0; | 
 |  |  |  | 
 |  |  |     // 任务完成确认位 | 
 |  |  |     private Short ackFinish = 0; | 
 |  |  |  | 
 |  |  |     // 任务号 | 
 |  |  |     private Short taskNo = 0; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 任务模式: | 
 |  |  |      * 0 = 无 | 
 |  |  |      * 1 = 入库   源和目标都发 | 
 |  |  |      * 2 = 出库   源和目标都发 | 
 |  |  |      * 3 = 库位移转 源和目标都发 | 
 |  |  |      * 4 = 站位移转 源和目标都发 | 
 |  |  |      * 5 = 回原点  不用发 | 
 |  |  |      * 6 = 去反原点 目标发 | 
 |  |  |      * 7 = 坐标移行 目标发 | 
 |  |  |      * 90 = 设置时间 | 
 |  |  |      * 99 = 取消当前任务 | 
 |  |  |      */ | 
 |  |  |     private Short taskMode = 0; | 
 |  |  |  | 
 |  |  |     @JSONField(serialize = false) | 
 |  |  |     private CrnTaskModeType taskModeType; | 
 |  |  |  | 
 |  |  |     // 源位置列号 | 
 |  |  |     private Short sourcePosX = 0; | 
 |  |  |  | 
 |  |  |     // 源位置层号 | 
 |  |  |     private Short sourcePosY = 0; | 
 |  |  |  | 
 |  |  |     // 源位置排号 | 
 |  |  |     private Short sourcePosZ = 0; | 
 |  |  |  | 
 |  |  |     // 源站 | 
 |  |  |     private Short sourceStaNo = 0; | 
 |  |  |  | 
 |  |  |     // 源巷道 | 
 |  |  |     private Short sourceLane = 0; | 
 |  |  |  | 
 |  |  |     // 目标位置排号 | 
 |  |  |     private Short destinationPosX = 0; | 
 |  |  |  | 
 |  |  |     // 目标位置列号 | 
 |  |  |     private Short destinationPosY = 0; | 
 |  |  |  | 
 |  |  |     // 目标位置层号 | 
 |  |  |     private Short destinationPosZ = 0; | 
 |  |  |  | 
 |  |  |     // 目标站 | 
 |  |  |     private Short destinationStaNo = 0; | 
 |  |  |  | 
 |  |  |     // 目标巷道 | 
 |  |  |     private Short destinationLane = 0; | 
 |  |  |  | 
 |  |  |     //联机模式 | 
 |  |  |     private Short auto = 0; | 
 |  |  |  | 
 |  |  |     //申请完成任务 | 
 |  |  |     private Short onlineWrk1 = 0; | 
 |  |  |     //申请取消任务 | 
 |  |  |     private Short onlineWrk2 = 0; | 
 |  |  |     //清除联机任务 | 
 |  |  |     private Short onlineWrk3 = 0; | 
 |  |  |     //恢复联机任务 | 
 |  |  |     private Short onlineWrk4 = 0; | 
 |  |  |     private Short reset = 0; | 
 |  |  |  | 
 |  |  |     // 任务确认 0:未确认 1:已确认 | 
 |  |  |     private Short command = 0; | 
 |  |  |  | 
 |  |  |     //指令ID | 
 |  |  |     private Integer commandId; | 
 |  |  |  | 
 |  |  |     public static void main(String[] args) { | 
 |  |  |         Date date = new Date(); | 
 |  |  |         Calendar cal = Calendar.getInstance(); | 
 |  |  |         cal.setTime(date); | 
 |  |  |  | 
 |  |  |         System.out.println(cal.get(Calendar.YEAR)); | 
 |  |  |         //默认从0-11 | 
 |  |  |         System.out.println(cal.get(Calendar.MONTH) + 1); | 
 |  |  |         System.out.println(cal.get(Calendar.DATE)); | 
 |  |  |         int hour = cal.get(Calendar.HOUR_OF_DAY); | 
 |  |  |         System.out.println("时"); | 
 |  |  |         System.out.println(hour); | 
 |  |  |         int minute = cal.get(Calendar.MINUTE); | 
 |  |  |         System.out.println("分"); | 
 |  |  |         System.out.println(minute); | 
 |  |  |         int second = cal.get(Calendar.SECOND); | 
 |  |  |         System.out.println("秒"); | 
 |  |  |         System.out.println(second); | 
 |  |  |         int mm = cal.get(Calendar.DAY_OF_WEEK) - 1; // 星期:0(日)~6(六) | 
 |  |  |         System.out.println("礼拜"); | 
 |  |  |         System.out.println(mm); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public void setTaskMode(Short taskMode) { | 
 |  |  |         this.taskMode = taskMode; | 
 |  |  |         this.taskModeType = CrnTaskModeType.get(taskModeType); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public void setTaskMode(CrnTaskModeType type) { | 
 |  |  |         this.taskModeType = type; | 
 |  |  |         this.taskMode = CrnTaskModeType.get(type).id.shortValue(); | 
 |  |  |     } | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | //package com.zy.acs.wcs.core.model.command; | 
 |  |  | // | 
 |  |  | //import com.zy.asrs.entity.CommandInfo; | 
 |  |  | //import com.zy.common.model.MatDto; | 
 |  |  | //import lombok.Data; | 
 |  |  | // | 
 |  |  | //import java.util.ArrayList; | 
 |  |  | //import java.util.List; | 
 |  |  | // | 
 |  |  | ///** | 
 |  |  | // * led命令报文 | 
 |  |  | // * Created by vincent on 2020/8/11 | 
 |  |  | // */ | 
 |  |  | //@Data | 
 |  |  | //public class LedCommand extends Object { | 
 |  |  | // | 
 |  |  | //    private String title; | 
 |  |  | // | 
 |  |  | //    private Integer workNo; | 
 |  |  | // | 
 |  |  | //    private Integer staNo; | 
 |  |  | // | 
 |  |  | //    private Integer sourceStaNo; | 
 |  |  | // | 
 |  |  | //    private String locNo; | 
 |  |  | // | 
 |  |  | //    private String sourceLocNo; | 
 |  |  | // | 
 |  |  | //    private List<MatDto> matDtos = new ArrayList<>(); | 
 |  |  | // | 
 |  |  | //    private boolean emptyMk = false; | 
 |  |  | // | 
 |  |  | //    private Integer ioType; | 
 |  |  | // | 
 |  |  | //    //指令信息 | 
 |  |  | //    private CommandInfo commandInfo; | 
 |  |  | //} | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.core.model.protocol; | 
 |  |  |  | 
 |  |  | import lombok.Data; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * Created by vincent on 2020/8/17 | 
 |  |  |  */ | 
 |  |  | @Data | 
 |  |  | public class CrnError1 { | 
 |  |  |  | 
 |  |  |     // 遥控器急停 | 
 |  |  |     public boolean remoteStop; | 
 |  |  |  | 
 |  |  |     // 主控盘急停 | 
 |  |  |     public boolean mainStop; | 
 |  |  |  | 
 |  |  |     // 操作盘急停 | 
 |  |  |     public boolean controlStop; | 
 |  |  |  | 
 |  |  |     // X行走变频器故障 | 
 |  |  |     public boolean xCoverErr; | 
 |  |  |  | 
 |  |  |     // Y升降变频器故障 | 
 |  |  |     public boolean yCoverErr; | 
 |  |  |  | 
 |  |  |     // Z货叉变频器故障 | 
 |  |  |     public boolean zCoverErr; | 
 |  |  |  | 
 |  |  |     // 激光故障 | 
 |  |  |     public boolean laserErr; | 
 |  |  |  | 
 |  |  |     // 条码阅读器故障 | 
 |  |  |     public boolean barcodeErr; | 
 |  |  |  | 
 |  |  |     // X前极限 | 
 |  |  |     public boolean xFrontLimitErr; | 
 |  |  |  | 
 |  |  |     // X后极限 | 
 |  |  |     public boolean xBackLimitErr; | 
 |  |  |  | 
 |  |  |     // Y上极限 | 
 |  |  |     public boolean yUpLimitErr; | 
 |  |  |  | 
 |  |  |     // Y下极限 | 
 |  |  |     public boolean yDownLimitErr; | 
 |  |  |  | 
 |  |  |     // Z左极限 | 
 |  |  |     public boolean zLeftLimitErr; | 
 |  |  |  | 
 |  |  |     // Z右极限 | 
 |  |  |     public boolean zRightLimitErr; | 
 |  |  |  | 
 |  |  |     // 左超宽1 | 
 |  |  |     public boolean leftOverWidthErr1; | 
 |  |  |  | 
 |  |  |     // 左超宽2 | 
 |  |  |     public boolean leftOverWidthErr2; | 
 |  |  |  | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.core.model.protocol; | 
 |  |  |  | 
 |  |  | import lombok.Data; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * Created by vincent on 2020/8/17 | 
 |  |  |  */ | 
 |  |  | @Data | 
 |  |  | public class CrnError2 { | 
 |  |  |  | 
 |  |  |     // 左超长1 | 
 |  |  |     public boolean leftOverLenErr1; | 
 |  |  |  | 
 |  |  |     // 左超长2 | 
 |  |  |     public boolean leftOverLenErr2; | 
 |  |  |  | 
 |  |  |     // 左超高 | 
 |  |  |     public boolean leftOverHighErr; | 
 |  |  |  | 
 |  |  |     // 右超宽1 | 
 |  |  |     public boolean rightOverWidthErr1; | 
 |  |  |  | 
 |  |  |     // 右超宽2 | 
 |  |  |     public boolean rightOverWidthErr2; | 
 |  |  |  | 
 |  |  |     // 右超长1 | 
 |  |  |     public boolean rightOverLenErr1; | 
 |  |  |  | 
 |  |  |     // 右超长2 | 
 |  |  |     public boolean rightOverLenErr2; | 
 |  |  |  | 
 |  |  |     // 右超高 | 
 |  |  |     public boolean rightOverHighErr; | 
 |  |  |  | 
 |  |  |     // 左松绳 | 
 |  |  |     public boolean leftLooseRopeErr; | 
 |  |  |  | 
 |  |  |     // 右松绳 | 
 |  |  |     public boolean rightLooseRopeErr; | 
 |  |  |  | 
 |  |  |     // 前安全门故障 | 
 |  |  |     public boolean frontDoorErr; | 
 |  |  |  | 
 |  |  |     // 后安全门故障 | 
 |  |  |     public boolean backDoorErr; | 
 |  |  |  | 
 |  |  |     // 启动错误 | 
 |  |  |     public boolean startupErr; | 
 |  |  |  | 
 |  |  |     // X向前定位超上限 | 
 |  |  |     public boolean xFrontLocaUpErr; | 
 |  |  |  | 
 |  |  |     // X向前定位超下限 | 
 |  |  |     public boolean xFrontLocaDownErr; | 
 |  |  |  | 
 |  |  |     // X向后定位超上限 | 
 |  |  |     public boolean xBackLocaUpErr; | 
 |  |  |  | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.core.model.protocol; | 
 |  |  |  | 
 |  |  | import lombok.Data; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * Created by vincent on 2020/8/17 | 
 |  |  |  */ | 
 |  |  | @Data | 
 |  |  | public class CrnError3 { | 
 |  |  |  | 
 |  |  |     // X向后定位超下限 | 
 |  |  |     public boolean xBackLocaDownErr; | 
 |  |  |  | 
 |  |  |     // Y向上定位超上限 | 
 |  |  |     public boolean yUpLocaUpErr; | 
 |  |  |  | 
 |  |  |     // Y向上定位超下限 | 
 |  |  |     public boolean yUpLocaDownErr; | 
 |  |  |  | 
 |  |  |     // Y向下定位超上限 | 
 |  |  |     public boolean yDownLocaUpErr; | 
 |  |  |  | 
 |  |  |     // Y向下定位超下限 | 
 |  |  |     public boolean yDownLocaDownErr; | 
 |  |  |  | 
 |  |  |     // Z向左定位超上限 | 
 |  |  |     public boolean zLeftLocaUpErr; | 
 |  |  |  | 
 |  |  |     // Z向左定位超下限 | 
 |  |  |     public boolean zLeftLocaDownErr; | 
 |  |  |  | 
 |  |  |     // Z向右定位超上限 | 
 |  |  |     public boolean zRightLocaUpErr; | 
 |  |  |  | 
 |  |  |     // Z向右定位超下限 | 
 |  |  |     public boolean zRightLocaDownErr; | 
 |  |  |  | 
 |  |  |     // 左取货时库位无货 | 
 |  |  |     public boolean leftTakeNoneErr; | 
 |  |  |  | 
 |  |  |     // 右取货时库位无货 | 
 |  |  |     public boolean rightTakeNoneErr; | 
 |  |  |  | 
 |  |  |     // 左取货后库位有货 | 
 |  |  |     public boolean leftTakeThenLoadErr; | 
 |  |  |  | 
 |  |  |     // 右取货后库位有货 | 
 |  |  |     public boolean rightTakeThenLoadErr; | 
 |  |  |  | 
 |  |  |     // 左放货时库位有货 | 
 |  |  |     public boolean leftPutAndLoadErr; | 
 |  |  |  | 
 |  |  |     // 右取货后库位有货 | 
 |  |  |     public boolean rightPutAndLoadErr; | 
 |  |  |  | 
 |  |  |     // 左放货后库位无货 | 
 |  |  |     public boolean leftPutThenNoneErr; | 
 |  |  |  | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.core.model.protocol; | 
 |  |  |  | 
 |  |  | import lombok.Data; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * Created by vincent on 2020/8/17 | 
 |  |  |  */ | 
 |  |  | @Data | 
 |  |  | public class CrnError4 { | 
 |  |  |  | 
 |  |  |     // 右放货后库位无货 | 
 |  |  |     public boolean rightPutThenNoneErr; | 
 |  |  |  | 
 |  |  |     // X松闸超时 | 
 |  |  |     public boolean xLooseBrakeTimeout; | 
 |  |  |  | 
 |  |  |     // Y松闸超时 | 
 |  |  |     public boolean yLooseBrakeTimeout; | 
 |  |  |  | 
 |  |  |     // Z松闸超时 | 
 |  |  |     public boolean zLooseBrakeTimeout; | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.core.model.protocol; | 
 |  |  |  | 
 |  |  | import lombok.Data; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * Created by vincent on 2020/8/17 | 
 |  |  |  */ | 
 |  |  | @Data | 
 |  |  | public class CrnError5 { | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.core.model.protocol; | 
 |  |  |  | 
 |  |  | import lombok.Data; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * Created by vincent on 2020/8/17 | 
 |  |  |  */ | 
 |  |  | @Data | 
 |  |  | public class CrnError6 { | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.core.model.protocol; | 
 |  |  |  | 
 |  |  | import com.zy.asrs.entity.BasCrnp; | 
 |  |  | import com.zy.acs.wcs.core.enums.*; | 
 |  |  | import lombok.Data; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * Created by vincent on 2020/8/7 | 
 |  |  |  */ | 
 |  |  | @Data | 
 |  |  | public class CrnProtocol { | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 1 = 手动模式 | 
 |  |  |      * 2 = 自动模式 | 
 |  |  |      * 3 = 电脑模式 | 
 |  |  |      */ | 
 |  |  |     public Short mode; | 
 |  |  |  | 
 |  |  |     public CrnModeType modeType; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 堆垛机任务完成 | 
 |  |  |      */ | 
 |  |  |     public Short taskFinish; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 校验结果 1表示检验成功 | 
 |  |  |      */ | 
 |  |  |     public Short valid; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 1 = 急停 | 
 |  |  |      */ | 
 |  |  |     public Short eStop; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 任务号 | 
 |  |  |      */ | 
 |  |  |     public Short taskNo = 0; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 堆垛机当前状态 | 
 |  |  |      * 0:空闲,无任务 | 
 |  |  |      * 1:取货定位中 | 
 |  |  |      * 2:取货中 | 
 |  |  |      * 3:取货完成,放货定位中 | 
 |  |  |      * 4:放货中 | 
 |  |  |      * 5:回原点中 | 
 |  |  |      * 6:反原点 | 
 |  |  |      * 7:库位移位 | 
 |  |  |      * 90:任务完成等待WCS确认 | 
 |  |  |      * 99:报警 | 
 |  |  |      */ | 
 |  |  |     public Short status; | 
 |  |  |  | 
 |  |  |     public Short alarm = 0; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 状态枚举 | 
 |  |  |      */ | 
 |  |  |     public CrnStatusType statusType; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 堆垛机当前列号 | 
 |  |  |      */ | 
 |  |  |     public Short bay; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 堆垛机当前层号 | 
 |  |  |      */ | 
 |  |  |     public Short level; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 堆垛机当前排 | 
 |  |  |      */ | 
 |  |  |     public Short row; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 堆垛机当前巷道号 | 
 |  |  |      */ | 
 |  |  |     public Short lane; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 堆垛机通讯状态 | 
 |  |  |      */ | 
 |  |  |     public Boolean connStatus; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 申请入库修正 | 
 |  |  |      */ | 
 |  |  |     public Boolean correction; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 托盘号错 | 
 |  |  |      */ | 
 |  |  |     public Boolean tuError; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 取货无箱 | 
 |  |  |      */ | 
 |  |  |     public Boolean noneError; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 双重入库 | 
 |  |  |      */ | 
 |  |  |     public Boolean stockError; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 作业数据无效 | 
 |  |  |      */ | 
 |  |  |     public Boolean jobInvalid; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 空闲状态 | 
 |  |  |      */ | 
 |  |  |     public Boolean idle; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 控制柜使能 | 
 |  |  |      */ | 
 |  |  |     public Boolean control; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 停准 | 
 |  |  |      */ | 
 |  |  |     public Boolean stopQuasi; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 运行 | 
 |  |  |      */ | 
 |  |  |     public Boolean running; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 故障 | 
 |  |  |      */ | 
 |  |  |     public Boolean fault; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 货叉中位 | 
 |  |  |      */ | 
 |  |  |     public Boolean forkHome; | 
 |  |  |     /** | 
 |  |  |      * 单伸位货叉左位 | 
 |  |  |      */ | 
 |  |  |     public Boolean forkSingleLeft; | 
 |  |  |     /** | 
 |  |  |      * 单伸位货叉右位 | 
 |  |  |      */ | 
 |  |  |     public Boolean forkSingleRight; | 
 |  |  |     /** | 
 |  |  |      * 双伸位货叉左位 | 
 |  |  |      */ | 
 |  |  |     public Boolean forkDoubleLeft; | 
 |  |  |     /** | 
 |  |  |      * 双伸位货叉右位 | 
 |  |  |      */ | 
 |  |  |     public Boolean forkDoubleRight; | 
 |  |  |     /** | 
 |  |  |      * 单伸位高位 | 
 |  |  |      */ | 
 |  |  |     public Boolean singleHigh; | 
 |  |  |     /** | 
 |  |  |      * 单伸位低位 | 
 |  |  |      */ | 
 |  |  |     public Boolean singleLow; | 
 |  |  |     /** | 
 |  |  |      * 双伸位高位 | 
 |  |  |      */ | 
 |  |  |     public Boolean doubleHigh; | 
 |  |  |     /** | 
 |  |  |      * 双伸位低位 | 
 |  |  |      */ | 
 |  |  |     public Boolean doubleLow; | 
 |  |  |     /** | 
 |  |  |      * 站台高位 | 
 |  |  |      */ | 
 |  |  |     public Boolean platformHigh; | 
 |  |  |     /** | 
 |  |  |      * 站台低位 | 
 |  |  |      */ | 
 |  |  |     public Boolean platformLow; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 当前货叉位置 | 
 |  |  |      * 0 = 货叉原位 | 
 |  |  |      * 1 = 货叉在左侧 | 
 |  |  |      * 2 = 货叉在右侧 | 
 |  |  |      */ | 
 |  |  |     public Short forkPos = -1; | 
 |  |  |  | 
 |  |  |     public CrnForkPosType forkPosType = CrnForkPosType.NONE; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 当前载货台位置 | 
 |  |  |      * 0 = 下定位 | 
 |  |  |      * 1 = 上定位 | 
 |  |  |      */ | 
 |  |  |     public Short liftPos = -1; | 
 |  |  |  | 
 |  |  |     public CrnLiftPosType liftPosType = CrnLiftPosType.ERROR; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 走行在定位 | 
 |  |  |      * 0 = 在定位 | 
 |  |  |      * 1 = 不在定位 | 
 |  |  |      */ | 
 |  |  |     public Short walkPos = 0; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 拨指位置 | 
 |  |  |      * 0 = 不在定位 | 
 |  |  |      * 1 = 上定位 | 
 |  |  |      * 2 = 下定位 | 
 |  |  |      */ | 
 |  |  |     public Short fingerPos; | 
 |  |  |  | 
 |  |  |     public CrnFingerPosType fingerPosType; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 载货台有物 | 
 |  |  |      */ | 
 |  |  |     public Short loaded; | 
 |  |  |     /** | 
 |  |  |      * 堆垛机累计走行距离km | 
 |  |  |      */ | 
 |  |  |     public Float xDistance = 0F; | 
 |  |  |     /** | 
 |  |  |      * 堆垛机累计升降距离km | 
 |  |  |      */ | 
 |  |  |     public Float yDistance = 0F; | 
 |  |  |     ; | 
 |  |  |     /** | 
 |  |  |      * 堆垛机累计走行时长h | 
 |  |  |      */ | 
 |  |  |     public Float xDuration = 0F; | 
 |  |  |     ; | 
 |  |  |     /**w | 
 |  |  |      * 堆垛机累计升降时长h | 
 |  |  |      */ | 
 |  |  |     public Float yDuration = 0F; | 
 |  |  |     ; | 
 |  |  |     /** | 
 |  |  |      * 堆垛机垂直故障代码(数值显示) | 
 |  |  |      */ | 
 |  |  |     private Integer alarm1 = 0; | 
 |  |  |     /** | 
 |  |  |      * 堆垛机水平故障代码(数值显示) | 
 |  |  |      */ | 
 |  |  |     private Integer alarm2 = 0; | 
 |  |  |     /** | 
 |  |  |      * 堆垛机货叉故障代码(数值显示) | 
 |  |  |      */ | 
 |  |  |     private Integer alarm3 = 0; | 
 |  |  |     /** | 
 |  |  |      * 堆垛机状态故障代码(数值显示) | 
 |  |  |      */ | 
 |  |  |     private Integer alarm4 = 0; | 
 |  |  |     /** | 
 |  |  |      * 异常1 | 
 |  |  |      */ | 
 |  |  |     private boolean[] error1; | 
 |  |  |     private CrnError1 crnError1; | 
 |  |  |     /** | 
 |  |  |      * 异常2 | 
 |  |  |      */ | 
 |  |  |     private boolean[] error2; | 
 |  |  |     private CrnError2 crnError2; | 
 |  |  |     /** | 
 |  |  |      * 异常3 | 
 |  |  |      */ | 
 |  |  |     private boolean[] error3; | 
 |  |  |     private CrnError3 crnError3; | 
 |  |  |     /** | 
 |  |  |      * 异常4 | 
 |  |  |      */ | 
 |  |  |     private boolean[] error4; | 
 |  |  |     private CrnError4 crnError4; | 
 |  |  |     /** | 
 |  |  |      * X行走线速度m/min | 
 |  |  |      */ | 
 |  |  |     private Float xSpeed = 0F; | 
 |  |  |     /** | 
 |  |  |      * Y行走线速度m/min | 
 |  |  |      */ | 
 |  |  |     private Float ySpeed = 0F; | 
 |  |  |     /** | 
 |  |  |      * Z行走线速度m/min | 
 |  |  |      */ | 
 |  |  |     private Float zSpeed = 0F; | 
 |  |  |     //指令ID | 
 |  |  |     private Integer commandId; | 
 |  |  |     /** | 
 |  |  |      * 最近一次入出库类型 | 
 |  |  |      *       I:入库 | 
 |  |  |      *       O:出库 | 
 |  |  |      */ | 
 |  |  |     private String lastIo = "I"; | 
 |  |  |  | 
 |  |  |     public void setMode(Short mode) { | 
 |  |  |         this.mode = mode; | 
 |  |  |         this.modeType = CrnModeType.get(mode); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public void setMode(CrnModeType type) { | 
 |  |  |         this.modeType = type; | 
 |  |  |         this.mode = CrnModeType.get(type).id.shortValue(); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public void setForkPos(Short forkPos) { | 
 |  |  |         this.forkPos = forkPos; | 
 |  |  |         this.forkPosType = CrnForkPosType.get(forkPos); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public void setForkPos(CrnForkPosType type) { | 
 |  |  |         this.forkPosType = type; | 
 |  |  |         this.forkPos = CrnForkPosType.get(type).id.shortValue(); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public void setLiftPos(Short liftPos) { | 
 |  |  |         this.liftPos = liftPos; | 
 |  |  |         this.liftPosType = CrnLiftPosType.get(liftPos); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public void setLiftPos(CrnLiftPosType type) { | 
 |  |  |         this.liftPosType = type; | 
 |  |  |         this.liftPos = CrnLiftPosType.get(type).id.shortValue(); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public void setStatus(Short status) { | 
 |  |  |         this.status = status; | 
 |  |  |         this.statusType = CrnStatusType.get(status); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public void setStatus(CrnStatusType type) { | 
 |  |  |         this.statusType = type; | 
 |  |  |         this.status = CrnStatusType.get(type).id.shortValue(); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public void setFingerPos(Short type) { | 
 |  |  |         this.fingerPos = type; | 
 |  |  |         this.fingerPosType = CrnFingerPosType.get(type); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public void setError1(boolean[] error1) { | 
 |  |  |         this.error1 = error1; | 
 |  |  |         this.crnError1 = new CrnError1(); | 
 |  |  |         this.crnError1.remoteStop = error1[0]; | 
 |  |  |         this.crnError1.mainStop = error1[1]; | 
 |  |  |         this.crnError1.controlStop = error1[2]; | 
 |  |  |         this.crnError1.xCoverErr = error1[3]; | 
 |  |  |         this.crnError1.yCoverErr = error1[4]; | 
 |  |  |         this.crnError1.zCoverErr = error1[5]; | 
 |  |  |         this.crnError1.laserErr = error1[6]; | 
 |  |  |         this.crnError1.barcodeErr = error1[7]; | 
 |  |  |         this.crnError1.xFrontLimitErr = error1[8]; | 
 |  |  |         this.crnError1.xBackLimitErr = error1[9]; | 
 |  |  |         this.crnError1.yUpLimitErr = error1[10]; | 
 |  |  |         this.crnError1.yDownLimitErr = error1[11]; | 
 |  |  |         this.crnError1.zLeftLimitErr = error1[12]; | 
 |  |  |         this.crnError1.zRightLimitErr = error1[13]; | 
 |  |  |         this.crnError1.leftOverWidthErr1 = error1[14]; | 
 |  |  |         this.crnError1.leftOverWidthErr2 = error1[15]; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public void setError2(boolean[] error2) { | 
 |  |  |         this.error2 = error2; | 
 |  |  |         this.crnError2 = new CrnError2(); | 
 |  |  |         this.crnError2.leftOverLenErr1 = error2[0]; | 
 |  |  |         this.crnError2.leftOverLenErr2 = error2[1]; | 
 |  |  |         this.crnError2.leftOverHighErr = error2[2]; | 
 |  |  |         this.crnError2.rightOverWidthErr1 = error2[3]; | 
 |  |  |         this.crnError2.rightOverWidthErr2 = error2[4]; | 
 |  |  |         this.crnError2.rightOverLenErr1 = error2[5]; | 
 |  |  |         this.crnError2.rightOverLenErr2 = error2[6]; | 
 |  |  |         this.crnError2.rightOverHighErr = error2[7]; | 
 |  |  |         this.crnError2.leftLooseRopeErr = error2[8]; | 
 |  |  |         this.crnError2.rightLooseRopeErr = error2[9]; | 
 |  |  |         this.crnError2.frontDoorErr = error2[10]; | 
 |  |  |         this.crnError2.backDoorErr = error2[11]; | 
 |  |  |         this.crnError2.startupErr = error2[12]; | 
 |  |  |         this.crnError2.xFrontLocaUpErr = error2[13]; | 
 |  |  |         this.crnError2.xFrontLocaDownErr = error2[14]; | 
 |  |  |         this.crnError2.xBackLocaUpErr = error2[15]; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public void setError3(boolean[] error3) { | 
 |  |  |         this.error3 = error3; | 
 |  |  |         this.crnError3 = new CrnError3(); | 
 |  |  |         this.crnError3.xBackLocaDownErr = error3[0]; | 
 |  |  |         this.crnError3.yUpLocaUpErr = error3[1]; | 
 |  |  |         this.crnError3.yUpLocaDownErr = error3[2]; | 
 |  |  |         this.crnError3.yDownLocaUpErr = error3[3]; | 
 |  |  |         this.crnError3.yDownLocaDownErr = error3[4]; | 
 |  |  |         this.crnError3.zLeftLocaUpErr = error3[5]; | 
 |  |  |         this.crnError3.zLeftLocaDownErr = error3[6]; | 
 |  |  |         this.crnError3.zRightLocaUpErr = error3[7]; | 
 |  |  |         this.crnError3.zRightLocaDownErr = error3[8]; | 
 |  |  |         this.crnError3.leftTakeNoneErr = error3[9]; | 
 |  |  |         this.crnError3.rightTakeNoneErr = error3[10]; | 
 |  |  |         this.crnError3.leftTakeThenLoadErr = error3[11]; | 
 |  |  |         this.crnError3.rightTakeThenLoadErr = error3[12]; | 
 |  |  |         this.crnError3.leftPutAndLoadErr = error3[13]; | 
 |  |  |         this.crnError3.rightPutAndLoadErr = error3[14]; | 
 |  |  |         this.crnError3.leftPutThenNoneErr = error3[15]; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public void setError4(boolean[] error4) { | 
 |  |  |         this.error4 = error4; | 
 |  |  |         this.crnError4 = new CrnError4(); | 
 |  |  |         this.crnError4.rightPutThenNoneErr = error4[0]; | 
 |  |  |         this.crnError4.xLooseBrakeTimeout = error4[1]; | 
 |  |  |         this.crnError4.yLooseBrakeTimeout = error4[2]; | 
 |  |  |         this.crnError4.zLooseBrakeTimeout = error4[3]; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public BasCrnp toSqlModel(BasCrnp basCrnp) { | 
 |  |  |         basCrnp.setCrnErr(alarm.longValue()); | 
 |  |  |         basCrnp.setWrkNo(taskNo.intValue()); | 
 |  |  |         return basCrnp; | 
 |  |  |     } | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.core.model.protocol; | 
 |  |  |  | 
 |  |  | import lombok.Data; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * Created by vincent on 2020/8/17 | 
 |  |  |  */ | 
 |  |  | @Data | 
 |  |  | public class CrnTemp1 { | 
 |  |  |  | 
 |  |  |     // 升降限位开关触发 | 
 |  |  |     public boolean liftLimitSwitchErr; | 
 |  |  |  | 
 |  |  |     // 行走制动序列异常 | 
 |  |  |     public boolean liftBrakeErr; | 
 |  |  |  | 
 |  |  |     // 行走测距器故障 | 
 |  |  |     public boolean liftDiastimeterFau; | 
 |  |  |  | 
 |  |  |     // 急停 | 
 |  |  |     public boolean stop; | 
 |  |  |  | 
 |  |  |     // 相序报警 | 
 |  |  |     public boolean warn; | 
 |  |  |  | 
 |  |  |     // 超高 | 
 |  |  |     public boolean overHighErr; | 
 |  |  |  | 
 |  |  |     // 左超宽 | 
 |  |  |     public boolean leftOverWidthErr; | 
 |  |  |  | 
 |  |  |     // 右超宽 | 
 |  |  |     public boolean rightOverWidthErr; | 
 |  |  |  | 
 |  |  |     // 左超长 | 
 |  |  |     public boolean leftOverLenErr; | 
 |  |  |  | 
 |  |  |     // 右超长 | 
 |  |  |     public boolean rightOverLenErr; | 
 |  |  |  | 
 |  |  |     // 有物入 | 
 |  |  |     public boolean pakinThenLoadedErr; | 
 |  |  |  | 
 |  |  |     // 无物出 | 
 |  |  |     public boolean pakOutThenNoneErr; | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.core.model.protocol; | 
 |  |  |  | 
 |  |  | import com.zy.asrs.entity.BasDevp; | 
 |  |  | import lombok.Data; | 
 |  |  |  | 
 |  |  | import java.util.ArrayList; | 
 |  |  | import java.util.List; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * 输送线plc单个站点详细信息 | 
 |  |  |  * Created by vincent on 2020/8/6 | 
 |  |  |  */ | 
 |  |  | @Data | 
 |  |  | public class StaProtocol implements Cloneable { | 
 |  |  |  | 
 |  |  |     // 站点编号 | 
 |  |  |     private Integer siteId; | 
 |  |  |  | 
 |  |  |     // ---------------------------------------------------------------- | 
 |  |  |     // 工作号 | 
 |  |  |     private Short workNo = 0; | 
 |  |  |  | 
 |  |  |     // ---------------------------------------------------------------- | 
 |  |  |     // 目标站 | 
 |  |  |     private Short staNo; | 
 |  |  |  | 
 |  |  |     // ---------------------------------------------------------------- | 
 |  |  |     // 自动 | 
 |  |  |     private boolean autoing; | 
 |  |  |  | 
 |  |  |     // 有物 | 
 |  |  |     private boolean loading; | 
 |  |  |  | 
 |  |  |     // 可入 | 
 |  |  |     private boolean inEnable; | 
 |  |  |  | 
 |  |  |     // 可出 | 
 |  |  |     private boolean outEnable; | 
 |  |  |  | 
 |  |  |     // 空板信号 | 
 |  |  |     private boolean emptyMk; | 
 |  |  |  | 
 |  |  |     // 满托盘 | 
 |  |  |     private boolean fullPlt; | 
 |  |  |  | 
 |  |  |     // 高 | 
 |  |  |     private boolean high = false; | 
 |  |  |  | 
 |  |  |     // 低 | 
 |  |  |     private boolean low; | 
 |  |  |  | 
 |  |  |     //agv | 
 |  |  |     private boolean car; | 
 |  |  |  | 
 |  |  |     // 锁定标记 | 
 |  |  |     private boolean pakMk = true; | 
 |  |  |  | 
 |  |  |     // 入库暂存数 | 
 |  |  |     private Short inQty; | 
 |  |  |  | 
 |  |  |     // 隔壁站点(台车位置) | 
 |  |  |     private String nearbySta; | 
 |  |  |  | 
 |  |  |     //指令ID | 
 |  |  |     private Integer commandId; | 
 |  |  |  | 
 |  |  |     // 物料号列表 | 
 |  |  |     private List<String> matIdList; | 
 |  |  |  | 
 |  |  |     // 高度 | 
 |  |  |     private String height; | 
 |  |  |  | 
 |  |  |     // 外形检测 ------------------------------------------------------------------------ | 
 |  |  |  | 
 |  |  |     // 前超限 | 
 |  |  |     private boolean frontErr = false; | 
 |  |  |  | 
 |  |  |     // 后超限 | 
 |  |  |     private boolean backErr = false; | 
 |  |  |  | 
 |  |  |     // 高超限 | 
 |  |  |     private boolean highErr = false; | 
 |  |  |  | 
 |  |  |     // 左超限 | 
 |  |  |     private boolean leftErr = false; | 
 |  |  |  | 
 |  |  |     // 右超限 | 
 |  |  |     private boolean rightErr = false; | 
 |  |  |  | 
 |  |  |     // 超重 | 
 |  |  |     private boolean weightErr = false; | 
 |  |  |  | 
 |  |  |     // 扫码失败 | 
 |  |  |     private boolean barcodeErr = false; | 
 |  |  |  | 
 |  |  |     //故障----------------------------------------------------------------------- | 
 |  |  |     private Boolean breakerErr = false; //断路器故障 | 
 |  |  |  | 
 |  |  |     private Boolean infraredErr = false; //光电异常 | 
 |  |  |  | 
 |  |  |     private Boolean outTimeErr = false; //运行超时 | 
 |  |  |  | 
 |  |  |     private Boolean seizeSeatErr = false; //占位超时 | 
 |  |  |  | 
 |  |  |     private Boolean wrkYgoodsN = false;//有任务无货故障 | 
 |  |  |  | 
 |  |  |     private Boolean inverterErr = false; //变频器故障 | 
 |  |  |  | 
 |  |  |     private Boolean contactErr = false; //电机接触器故障 | 
 |  |  |  | 
 |  |  |     private Boolean upcontactErr = false; //顶升电机接触器故障 | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     private Short agvStartPick; //允许取货 | 
 |  |  |     private Short agvStartPlace; //允许放货 | 
 |  |  |     private Short agvTypeSign; //允许放货 | 
 |  |  |  | 
 |  |  |     private Short agvTargetPick; //取货完成 | 
 |  |  |     private Short agvTargetPlace; //放货完成 | 
 |  |  |     private Short agvTypeSignEnd; //放货完成 | 
 |  |  |  | 
 |  |  |     private List<Integer> alarm; | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     public List<Integer> getAlarm() { | 
 |  |  |         List<Integer> alarm = new ArrayList<>(); | 
 |  |  |         if (breakerErr) { | 
 |  |  |             alarm.add(1); | 
 |  |  |         } | 
 |  |  |         if (infraredErr) { | 
 |  |  |             alarm.add(2); | 
 |  |  |         } | 
 |  |  |         if (outTimeErr) { | 
 |  |  |             alarm.add(3); | 
 |  |  |         } | 
 |  |  |         if (seizeSeatErr) { | 
 |  |  |             alarm.add(4); | 
 |  |  |         } | 
 |  |  |         if (wrkYgoodsN) { | 
 |  |  |             alarm.add(5); | 
 |  |  |         } | 
 |  |  |         if (inverterErr) { | 
 |  |  |             alarm.add(6); | 
 |  |  |         } | 
 |  |  |         if (contactErr) { | 
 |  |  |             alarm.add(7); | 
 |  |  |         } | 
 |  |  |         if (upcontactErr) { | 
 |  |  |             alarm.add(8); | 
 |  |  |         } | 
 |  |  |         return alarm; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     public BasDevp toSqlModel() { | 
 |  |  |         BasDevp basDevp = new BasDevp(); | 
 |  |  |         basDevp.setDevNo(siteId); | 
 |  |  |         basDevp.setWrkNo(workNo.intValue()); | 
 |  |  |         basDevp.setAutoing(autoing ? "Y" : "N"); | 
 |  |  |         basDevp.setLoading(loading ? "Y" : "N"); | 
 |  |  |         if (frontErr) { | 
 |  |  |             basDevp.setStaErr(11); | 
 |  |  |         } else if (backErr) { | 
 |  |  |             basDevp.setStaErr(12); | 
 |  |  |         } else if (highErr) { | 
 |  |  |             basDevp.setStaErr(13); | 
 |  |  |         } else if (leftErr) { | 
 |  |  |             basDevp.setStaErr(14); | 
 |  |  |         } else if (rightErr) { | 
 |  |  |             basDevp.setStaErr(15); | 
 |  |  |         } else if (weightErr) { | 
 |  |  |             basDevp.setStaErr(16); | 
 |  |  |         } else if (barcodeErr) { | 
 |  |  |             basDevp.setStaErr(17); | 
 |  |  |         } else if (breakerErr) { | 
 |  |  |             basDevp.setStaErr(18); | 
 |  |  |         } else if (infraredErr) { | 
 |  |  |             basDevp.setStaErr(19); | 
 |  |  |         } else if (outTimeErr) { | 
 |  |  |             basDevp.setStaErr(110); | 
 |  |  |         } else if (seizeSeatErr) { | 
 |  |  |             basDevp.setStaErr(111); | 
 |  |  |         } else if (wrkYgoodsN) { | 
 |  |  |             basDevp.setStaErr(112); | 
 |  |  |         } else if (inverterErr) { | 
 |  |  |             basDevp.setStaErr(113); | 
 |  |  |         } else if (contactErr) { | 
 |  |  |             basDevp.setStaErr(114); | 
 |  |  |         } else if (upcontactErr) { | 
 |  |  |             basDevp.setStaErr(115); | 
 |  |  |         } else { | 
 |  |  |             if (!loading) { | 
 |  |  |                 basDevp.setStaErr(0); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         basDevp.setInEnable(inEnable ? "Y" : "N"); | 
 |  |  |         basDevp.setOutEnable(outEnable ? "Y" : "N"); | 
 |  |  |         basDevp.setLocType1((short) 0);  // 高低类型{0:未知,1:低库位,2:高库位} | 
 |  |  |         basDevp.setLocType2((short) 0);  // 宽窄类型{0:未知,1:窄库位,2:宽库位} | 
 |  |  |         basDevp.setLocType3((short) 0);  // 轻重类型{0:未知,1:轻库位,2:重库位} | 
 |  |  |         basDevp.setLocType1(high != low && low ? (short) 1 : (short) 2); | 
 |  |  |         basDevp.setInQty(inQty != null ? (int) inQty : 0); | 
 |  |  | //        basDevp.setAgvStartPick(agvStartPick.intValue()); | 
 |  |  | //        basDevp.setAgvStartPlace(agvStartPlace.intValue()); | 
 |  |  |         return basDevp; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @Override | 
 |  |  |     public StaProtocol clone() { | 
 |  |  |         try { | 
 |  |  |             return (StaProtocol) super.clone(); | 
 |  |  |         } catch (CloneNotSupportedException e) { | 
 |  |  |             e.printStackTrace(); | 
 |  |  |         } | 
 |  |  |         return null; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.core.netty; | 
 |  |  |  | 
 |  |  | import io.netty.buffer.ByteBuf; | 
 |  |  | import io.netty.channel.ChannelHandlerContext; | 
 |  |  | import io.netty.channel.ChannelInboundHandlerAdapter; | 
 |  |  | import io.netty.util.ReferenceCountUtil; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * netty handler增强器 | 
 |  |  |  * 设计模式: 适配器模式 | 
 |  |  |  * Created by vincent on 2019-04-02 | 
 |  |  |  */ | 
 |  |  | public abstract class AbstractInboundHandler<T> extends ChannelInboundHandlerAdapter { | 
 |  |  |  | 
 |  |  |     @Override | 
 |  |  |     public void channelRead(ChannelHandlerContext ctx, Object obj) throws Exception { | 
 |  |  |         @SuppressWarnings("unchecked") | 
 |  |  |         T t = (T) obj; | 
 |  |  |         if (channelRead0(ctx, t)) { | 
 |  |  |             ctx.fireChannelRead(t); | 
 |  |  |         } else { | 
 |  |  |             // 管道中断,fireChannelRead未执行,需要手动释放堆外内存 | 
 |  |  |             if (obj instanceof ByteBuf) { | 
 |  |  |                 ReferenceCountUtil.release(obj); | 
 |  |  |             } | 
 |  |  | //            if (obj instanceof GBPackage){ | 
 |  |  | //                GBPackage pac = (GBPackage) obj; | 
 |  |  | //                ReferenceCountUtil.release(pac.getSourceBuff()); | 
 |  |  | //            } | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     protected abstract boolean channelRead0(ChannelHandlerContext ctx, T t) throws Exception; | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.core.netty; | 
 |  |  |  | 
 |  |  | import com.core.common.SnowflakeIdWorker; | 
 |  |  | import com.zy.acs.wcs.core.netty.cache.ChannelAttrKey; | 
 |  |  | import com.zy.acs.wcs.core.netty.handle.PackageServerHandler; | 
 |  |  | import com.zy.acs.wcs.core.netty.handle.ProtectorHandler; | 
 |  |  | import com.zy.acs.wcs.core.netty.handle.ProtocolDecoder; | 
 |  |  | import com.zy.acs.wcs.core.netty.handle.ProtocolEncoder; | 
 |  |  | import com.zy.acs.wcs.core.netty.properties.TcpProperties; | 
 |  |  | import io.netty.channel.Channel; | 
 |  |  | import io.netty.channel.ChannelHandler; | 
 |  |  | import io.netty.channel.ChannelInitializer; | 
 |  |  | import io.netty.handler.timeout.IdleStateHandler; | 
 |  |  | import io.netty.util.Attribute; | 
 |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
 |  |  | import org.springframework.stereotype.Component; | 
 |  |  |  | 
 |  |  | import java.util.HashMap; | 
 |  |  | import java.util.Map; | 
 |  |  |  | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * handler管道 | 
 |  |  |  * 控制所有netty handler流向 | 
 |  |  |  * 待完成: 动态管理handler | 
 |  |  |  * Created by vincent on 2019-04-02 | 
 |  |  |  */ | 
 |  |  | @Component | 
 |  |  | @ChannelHandler.Sharable | 
 |  |  | public class HandlerInitializer extends ChannelInitializer<Channel> { | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private SnowflakeIdWorker snowflakeIdWorker; | 
 |  |  |     @Autowired | 
 |  |  |     private TcpProperties tcpProperties; | 
 |  |  |     @Autowired | 
 |  |  |     private ProtocolEncoder protocolEncoder; | 
 |  |  |     @Autowired | 
 |  |  |     private PackageServerHandler packageServerHandler; | 
 |  |  |     @Autowired | 
 |  |  |     private ProtectorHandler protectorHandler; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * Set some channel handlers on channel pipeline | 
 |  |  |      */ | 
 |  |  |     @Override | 
 |  |  |     protected void initChannel(Channel channel) { | 
 |  |  |         channel.pipeline() | 
 |  |  |                 // 心跳 | 
 |  |  |                 .addLast(new IdleStateHandler(tcpProperties.getHeartSeconds(), 0, 0)) | 
 |  |  |                 // 编码器 | 
 |  |  |                 .addLast(protocolEncoder) | 
 |  |  |                 // 解码器 | 
 |  |  |                 .addLast(new ProtocolDecoder(snowflakeIdWorker)) | 
 |  |  |                 // 校验码处理器 | 
 |  |  | //                .addLast(validateHandler) | 
 |  |  |                 // 认证处理器 | 
 |  |  | //                .addLast(vehAuthHandler) | 
 |  |  |                 // 业务处理器 | 
 |  |  |                 .addLast(packageServerHandler) | 
 |  |  |                 // 通道保护器 | 
 |  |  |                 .addLast(protectorHandler); | 
 |  |  |  | 
 |  |  |         // Channel局部变量,相当于线程的ThreadLocal | 
 |  |  | //        initAttrTrack(channel); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      *  Init channel attr track | 
 |  |  |      */ | 
 |  |  |     private void initAttrTrack(Channel channel) { | 
 |  |  |         Attribute<Map<String, Object>> coolTrackAttr = channel.attr(ChannelAttrKey.DATA_MAP_ATTR); | 
 |  |  |         Map<String, Object> trackMap = new HashMap<>(); | 
 |  |  |         coolTrackAttr.setIfAbsent(trackMap); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.core.netty; | 
 |  |  |  | 
 |  |  |  | 
 |  |  | import com.zy.acs.wcs.core.netty.properties.TcpProperties; | 
 |  |  | import io.netty.bootstrap.ServerBootstrap; | 
 |  |  | import io.netty.buffer.PooledByteBufAllocator; | 
 |  |  | import io.netty.channel.Channel; | 
 |  |  | import io.netty.channel.ChannelOption; | 
 |  |  | import io.netty.channel.EventLoopGroup; | 
 |  |  | import io.netty.channel.nio.NioEventLoopGroup; | 
 |  |  | import io.netty.channel.socket.nio.NioServerSocketChannel; | 
 |  |  | import io.netty.util.ResourceLeakDetector; | 
 |  |  | import lombok.extern.slf4j.Slf4j; | 
 |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
 |  |  | import org.springframework.stereotype.Component; | 
 |  |  |  | 
 |  |  | import javax.annotation.PostConstruct; | 
 |  |  | import javax.annotation.PreDestroy; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * TCP/IP协议端口 | 
 |  |  |  * Netty Server 引导类 | 
 |  |  |  * @author Vincent | 
 |  |  |  */ | 
 |  |  | @Slf4j | 
 |  |  | @Component | 
 |  |  | public class OnlineServer { | 
 |  |  |  | 
 |  |  |     private final HandlerInitializer handlerInitializer; | 
 |  |  |     private final TcpProperties tcpProperties; | 
 |  |  |     private Channel channel; | 
 |  |  |     private ServerBootstrap bootstrap; | 
 |  |  |     private EventLoopGroup bossGroup; | 
 |  |  |     private EventLoopGroup workerGroup; | 
 |  |  |  | 
 |  |  |     { | 
 |  |  |         bootstrap = new ServerBootstrap(); | 
 |  |  |         bossGroup = new NioEventLoopGroup(1); | 
 |  |  |         workerGroup = new NioEventLoopGroup(); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     public OnlineServer(TcpProperties tcpProperties, HandlerInitializer handlerInitializer) { | 
 |  |  |         ; | 
 |  |  |         this.tcpProperties = tcpProperties; | 
 |  |  |         this.handlerInitializer = handlerInitializer; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      *  tcp server init | 
 |  |  |      */ | 
 |  |  |     @PostConstruct | 
 |  |  |     public void serverStart() throws Exception { | 
 |  |  |         // 开启大端模式 | 
 |  |  | //        CStruct.reverse = false; | 
 |  |  |  | 
 |  |  |         bootstrap.group(bossGroup, workerGroup) | 
 |  |  |                 .channel(NioServerSocketChannel.class) | 
 |  |  |                 .childHandler(handlerInitializer) | 
 |  |  |                 .option(ChannelOption.SO_BACKLOG, tcpProperties.getBacklog()) | 
 |  |  |                 .option(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT) | 
 |  |  |                 .childOption(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT) | 
 |  |  |                 .childOption(ChannelOption.SO_KEEPALIVE, tcpProperties.isKeepAlive()) | 
 |  |  |                 .childOption(ChannelOption.SO_SNDBUF, tcpProperties.getSndbuf()) | 
 |  |  |                 .childOption(ChannelOption.SO_RCVBUF, tcpProperties.getRcvbuf()); | 
 |  |  |  | 
 |  |  |         ResourceLeakDetector.setLevel(ResourceLeakDetector.Level.ADVANCED); | 
 |  |  |  | 
 |  |  |         log.info("TCP server started successfully, port:{}", tcpProperties.getPort()); | 
 |  |  |  | 
 |  |  |         channel = bootstrap.bind(tcpProperties.getPort()).sync().channel(); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * tcp server stop | 
 |  |  |      */ | 
 |  |  |     @PreDestroy | 
 |  |  |     public void destroy() { | 
 |  |  |         if (channel != null && channel.isActive()) { | 
 |  |  |             channel.close(); | 
 |  |  |         } | 
 |  |  |         if (bossGroup != null) { | 
 |  |  |             bossGroup.shutdownGracefully(); | 
 |  |  |         } | 
 |  |  |         if (workerGroup != null) { | 
 |  |  |             workerGroup.shutdownGracefully(); | 
 |  |  |         } | 
 |  |  |         log.info("TCP server stopped successfully, port: {}", tcpProperties.getPort()); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.core.netty.cache; | 
 |  |  |  | 
 |  |  |  | 
 |  |  | import io.netty.util.AttributeKey; | 
 |  |  |  | 
 |  |  | import java.util.Map; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * Channel局部变量缓存 ==>> 线程安全 | 
 |  |  |  * Created by vincent on 2019-04-02 | 
 |  |  |  */ | 
 |  |  | public final class ChannelAttrKey { | 
 |  |  |  | 
 |  |  |     private static String CHANNEL_ATTR_KEY_VC_TRACK = "channel.attr.vc.track"; | 
 |  |  |  | 
 |  |  |     public static AttributeKey<Map<String, Object>> DATA_MAP_ATTR = AttributeKey.newInstance(CHANNEL_ATTR_KEY_VC_TRACK); | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.core.netty.cache; | 
 |  |  |  | 
 |  |  | import io.netty.channel.Channel; | 
 |  |  | import lombok.extern.slf4j.Slf4j; | 
 |  |  | import org.springframework.web.bind.annotation.RestController; | 
 |  |  |  | 
 |  |  | import java.util.Map; | 
 |  |  | import java.util.concurrent.ConcurrentHashMap; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * Channel缓存 ==>> { | 
 |  |  |  *                   key: uuid | 
 |  |  |  *                   value: Channel | 
 |  |  |  *                 } | 
 |  |  |  * Created by vincent on 2019-04-02 | 
 |  |  |  */ | 
 |  |  | @Slf4j | 
 |  |  | @RestController | 
 |  |  | public class ChannelCache { | 
 |  |  |  | 
 |  |  |     private static Map<String, Channel> channelGroup = new ConcurrentHashMap<>(); | 
 |  |  |  | 
 |  |  |     public static void setChannel(String uuid, Channel channel) { | 
 |  |  |         // todo 缓存标记 ===>> 分布式系统 | 
 |  |  | //        String hostName = SystemProperties.HOST_NAME; | 
 |  |  |         if (getChannel(uuid) == channel) { | 
 |  |  |             return; | 
 |  |  |         } | 
 |  |  |         removeChannel(uuid); | 
 |  |  |         channelGroup.put(uuid, channel); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public static Channel getChannel(String uuid) { | 
 |  |  |         return channelGroup.get(uuid); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public static void removeChannel(String uuid) { | 
 |  |  |         Channel channel = getChannel(uuid); | 
 |  |  |         if (null == channel) { | 
 |  |  |             return; | 
 |  |  |         } | 
 |  |  |         channelGroup.remove(uuid); | 
 |  |  |         channel.close(); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public static String removeChannel(Channel channel) { | 
 |  |  |         String key = null; | 
 |  |  |         for (Map.Entry<String, Channel> entry : channelGroup.entrySet()) { | 
 |  |  |             if (entry.getValue() == channel) { | 
 |  |  |                 key = entry.getKey(); | 
 |  |  |                 break; | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         if (null != key) { | 
 |  |  |             channelGroup.remove(key); | 
 |  |  |             return key; | 
 |  |  |         } | 
 |  |  |         return null; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.core.netty.constant; | 
 |  |  |  | 
 |  |  | import java.nio.charset.Charset; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * 配置常量 | 
 |  |  |  * Created by vincent on 2019-04-03 | 
 |  |  |  */ | 
 |  |  | public class Constant { | 
 |  |  |  | 
 |  |  |     public static final String SYMBOL = "##"; | 
 |  |  |  | 
 |  |  |     public static final Charset CHARSET_GBK = Charset.forName("GBK"); | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.core.netty.domain; | 
 |  |  |  | 
 |  |  | import io.netty.buffer.ByteBuf; | 
 |  |  | import lombok.Data; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * 报文模型 | 
 |  |  |  * Created by vincent on 2019-04-03 | 
 |  |  |  */ | 
 |  |  | @Data | 
 |  |  | public class ChPackage { | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 唯一编码 | 
 |  |  |      */ | 
 |  |  |     private String uuid; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 源数据包缓冲区(引用) | 
 |  |  |      */ | 
 |  |  |     private ByteBuf sourceBuff; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 原始消息对应的16进制字符串 | 
 |  |  |      */ | 
 |  |  |     private String sourceHexStr; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 请求体 | 
 |  |  |      */ | 
 |  |  |     private ByteBuf content; | 
 |  |  |  | 
 |  |  |     private byte[] bytes; | 
 |  |  |  | 
 |  |  |     private String ascii; | 
 |  |  |  | 
 |  |  |     private String ip; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 消息的校正码 | 
 |  |  |      */ | 
 |  |  |     private byte validCode; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 是否为校验异常包 | 
 |  |  |      */ | 
 |  |  |     private boolean errorPac; | 
 |  |  |  | 
 |  |  |     public static ChPackage valueOfEmpty(String uuid, String ip) { | 
 |  |  |         ChPackage chPackage = new ChPackage(); | 
 |  |  |         chPackage.setUuid(uuid); | 
 |  |  |         chPackage.setIp(ip); | 
 |  |  |         return chPackage; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | //    public ByteBuf convert(ByteBuf byteBuf){ | 
 |  |  | //        byteBuf.writeBytes(this.getHeader().getStartSymbol().getBytes(Constant.CHARSET_GBK)) | 
 |  |  | //                .writeByte(this.getHeader().getCommandMark().getCode()) | 
 |  |  | //                .writeByte(this.getHeader().getAckMark().getCode()) | 
 |  |  | //                .writeBytes(this.getHeader().getUniqueNo().getBytes()) | 
 |  |  | //                .writeByte(this.getHeader().getEncryptType().getCode()) | 
 |  |  | //                .writeShort(this.getHeader().getContentLength()) | 
 |  |  | //                .writeBytes(this.getBody().getContent()) | 
 |  |  | //                .writeByte(this.getValidCode()); | 
 |  |  | //        // 计算并设置校验码 | 
 |  |  | //        this.setValidCode(ValidUtil.caculateValidByteFromBuff(byteBuf)); | 
 |  |  | //        byteBuf.resetReaderIndex(); | 
 |  |  | //        byteBuf.writerIndex(byteBuf.readableBytes() - 1).writeByte(this.getValidCode()); | 
 |  |  | //        return byteBuf; | 
 |  |  | //    } | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.core.netty.handle; | 
 |  |  |  | 
 |  |  | import com.zy.acs.wcs.core.netty.AbstractInboundHandler; | 
 |  |  | import com.zy.acs.wcs.core.netty.cache.ChannelCache; | 
 |  |  | import com.zy.acs.wcs.core.netty.domain.ChPackage; | 
 |  |  | import com.zy.acs.wcs.core.netty.properties.TcpProperties; | 
 |  |  | import com.zy.acs.wcs.core.properties.SlaveProperties; | 
 |  |  | import io.netty.channel.Channel; | 
 |  |  | import io.netty.channel.ChannelHandler; | 
 |  |  | import io.netty.channel.ChannelHandlerContext; | 
 |  |  | import lombok.extern.slf4j.Slf4j; | 
 |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
 |  |  | import org.springframework.stereotype.Component; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * 国标业务处理handler | 
 |  |  |  * Created by vincent on 2019-04-02 | 
 |  |  |  */ | 
 |  |  | @Slf4j | 
 |  |  | @Component | 
 |  |  | @ChannelHandler.Sharable | 
 |  |  | public class PackageServerHandler extends AbstractInboundHandler<ChPackage> { | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private SlaveProperties slaveProperties; | 
 |  |  |     @Autowired | 
 |  |  |     private TcpProperties tcpProperties; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 数据下行 | 
 |  |  |      */ | 
 |  |  |     public static void write(ChPackage chPackage) { | 
 |  |  |         String uuid = chPackage.getUuid(); | 
 |  |  |         Channel channel = ChannelCache.getChannel(uuid); | 
 |  |  |         if (null == channel) { | 
 |  |  |             log.warn("通道uuid={} 不在线", uuid); | 
 |  |  |             return; | 
 |  |  |         } | 
 |  |  |         channel.writeAndFlush(chPackage); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @Override | 
 |  |  |     protected boolean channelRead0(ChannelHandlerContext ctx, ChPackage pac) { | 
 |  |  | //        log.info("读码器【IP:{}】 上行数据 ===>> {}", pac.getIp(), pac.getAscii()); | 
 |  |  | //        //扫码上传数据格式必须2个#开头,如:##12345678 | 
 |  |  | //        String msg = pac.getAscii().replaceAll("#", ""); | 
 |  |  | //        if(!Cools.isEmpty(msg) && msg.length()>=tcpProperties.getBarcodeLen()){ | 
 |  |  | //            msg = msg.substring(0,tcpProperties.getBarcodeLen()); | 
 |  |  | // | 
 |  |  | //            for (Slave slave : slaveProperties.getBarcode()) { | 
 |  |  | //                if (slave.getIp().equals(pac.getIp())) { | 
 |  |  | //                    BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, slave.getId()); | 
 |  |  | //                    if (barcodeThread == null) { continue; } | 
 |  |  | //                    barcodeThread.setBarcode(msg); | 
 |  |  | //                    break; | 
 |  |  | //                } | 
 |  |  | //            } | 
 |  |  | //        } | 
 |  |  |  | 
 |  |  |         return true; | 
 |  |  |     } | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.core.netty.handle; | 
 |  |  |  | 
 |  |  | import com.core.common.Cools; | 
 |  |  | import com.zy.acs.wcs.core.netty.AbstractInboundHandler; | 
 |  |  | import com.zy.acs.wcs.core.netty.cache.ChannelCache; | 
 |  |  | import com.zy.acs.wcs.core.netty.domain.ChPackage; | 
 |  |  | import io.netty.channel.ChannelHandler; | 
 |  |  | import io.netty.channel.ChannelHandlerContext; | 
 |  |  | import io.netty.handler.timeout.IdleState; | 
 |  |  | import io.netty.handler.timeout.IdleStateEvent; | 
 |  |  | import lombok.extern.slf4j.Slf4j; | 
 |  |  | import org.springframework.stereotype.Component; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * 通道维护handler | 
 |  |  |  * Created by vincent on 2019-04-11 | 
 |  |  |  */ | 
 |  |  | @Slf4j | 
 |  |  | @Component("protectorHandler") | 
 |  |  | @ChannelHandler.Sharable | 
 |  |  | public class ProtectorHandler extends AbstractInboundHandler<ChPackage> { | 
 |  |  |  | 
 |  |  |     @Override | 
 |  |  |     protected boolean channelRead0(ChannelHandlerContext ctx, ChPackage pac) throws Exception { | 
 |  |  |         // jvm堆外内存需要手动释放 | 
 |  |  | //        ReferenceCountUtil.release(pac.getSourceBuff()); | 
 |  |  |         return true; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 空闲剔除 | 
 |  |  |      */ | 
 |  |  |     @Override | 
 |  |  |     public void userEventTriggered(ChannelHandlerContext ctx, Object evt) { | 
 |  |  |         if (evt instanceof IdleStateEvent) { | 
 |  |  |             IdleStateEvent e = (IdleStateEvent) evt; | 
 |  |  |             if (IdleState.READER_IDLE == e.state()) { | 
 |  |  |                 String uuid = ChannelCache.removeChannel(ctx.channel()); | 
 |  |  |                 ctx.close(); | 
 |  |  |                 if (!Cools.isEmpty(uuid)) { | 
 |  |  |                     log.info("uuid={} 空闲剔除", uuid); | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 断开连接 | 
 |  |  |      */ | 
 |  |  |     @Override | 
 |  |  |     public void channelInactive(ChannelHandlerContext ctx) { | 
 |  |  |         String uuid = ChannelCache.removeChannel(ctx.channel()); | 
 |  |  |         ctx.close(); | 
 |  |  |         if (!Cools.isEmpty(uuid)) { | 
 |  |  |             log.info("通道 uuid={} 失去连接", uuid); | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 管道异常 | 
 |  |  |      */ | 
 |  |  |     @Override | 
 |  |  |     public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) { | 
 |  |  |         cause.printStackTrace(); | 
 |  |  |         ChannelCache.removeChannel(ctx.channel()); | 
 |  |  |         ctx.close(); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.core.netty.handle; | 
 |  |  |  | 
 |  |  | import com.core.common.SnowflakeIdWorker; | 
 |  |  | import com.zy.acs.wcs.core.netty.constant.Constant; | 
 |  |  | import com.zy.acs.wcs.core.netty.domain.ChPackage; | 
 |  |  | import io.netty.buffer.ByteBuf; | 
 |  |  | import io.netty.buffer.ByteBufUtil; | 
 |  |  | import io.netty.channel.ChannelHandlerContext; | 
 |  |  | import io.netty.handler.codec.ByteToMessageDecoder; | 
 |  |  |  | 
 |  |  | import java.net.InetSocketAddress; | 
 |  |  | import java.nio.charset.StandardCharsets; | 
 |  |  | import java.util.List; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * Created by vincent on 2019-04-10 | 
 |  |  |  */ | 
 |  |  | public class ProtocolDecoder extends ByteToMessageDecoder { | 
 |  |  |  | 
 |  |  |     private final SnowflakeIdWorker snowflakeIdWorker; | 
 |  |  |  | 
 |  |  |     public ProtocolDecoder(SnowflakeIdWorker snowflakeIdWorker) { | 
 |  |  |         this.snowflakeIdWorker = snowflakeIdWorker; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     @Override | 
 |  |  |     protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> list) throws Exception { | 
 |  |  |         int startMark = indexOfStartMark(in); | 
 |  |  |         if (startMark == -1) { | 
 |  |  |             return; | 
 |  |  |         } | 
 |  |  |         // 去除无用前缀报文 | 
 |  |  |         if (startMark != 0) { | 
 |  |  |             in.readerIndex(startMark); | 
 |  |  |             in.discardReadBytes(); | 
 |  |  |         } | 
 |  |  |         // 生成和初始化消息包装类 | 
 |  |  |  | 
 |  |  |         String ip = ((InetSocketAddress) ctx.channel().remoteAddress()).getAddress().getHostAddress(); | 
 |  |  |         ChPackage pac = ChPackage.valueOfEmpty(String.valueOf(snowflakeIdWorker.nextId()), ip); | 
 |  |  |  | 
 |  |  |         pac.setSourceBuff(in); | 
 |  |  |  | 
 |  |  |         // 解析 | 
 |  |  |         list.add(analyzeProtocol(pac)); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public ChPackage analyzeProtocol(ChPackage pac) { | 
 |  |  |  | 
 |  |  |         ByteBuf byteBuf = pac.getSourceBuff(); | 
 |  |  |  | 
 |  |  |         // 备份缓冲区 | 
 |  |  |         ByteBuf body = byteBuf.duplicate(); | 
 |  |  |         if (null != body && body.readableBytes() >= 0) { | 
 |  |  |             pac.setContent(body); | 
 |  |  |         } else { | 
 |  |  |             return null; | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         // 字节数组 | 
 |  |  |         body.resetReaderIndex(); | 
 |  |  |         byte[] bytes = new byte[body.readableBytes()]; | 
 |  |  |         body.readBytes(bytes); | 
 |  |  |         body.resetReaderIndex(); | 
 |  |  |         pac.setBytes(bytes); | 
 |  |  |  | 
 |  |  |         // ascii | 
 |  |  |         if (bytes.length > 0) { | 
 |  |  |             pac.setAscii(new String(pac.getBytes(), StandardCharsets.US_ASCII)); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         // 备份字符串 | 
 |  |  |         if (null != pac.getSourceBuff() && null == pac.getSourceHexStr()) { | 
 |  |  |             pac.getSourceBuff().resetReaderIndex(); | 
 |  |  |             pac.setSourceHexStr(ByteBufUtil.hexDump(pac.getSourceBuff())); | 
 |  |  |             pac.getSourceBuff().resetReaderIndex(); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         byteBuf.skipBytes(byteBuf.readableBytes()); | 
 |  |  | //        pac.getSourceBuff().readByte(); | 
 |  |  |  | 
 |  |  |         return pac; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     // 获取标识位下标 | 
 |  |  |     private int indexOfStartMark(ByteBuf inputBuffer) { | 
 |  |  |         int length = inputBuffer.writerIndex(); | 
 |  |  |         // 报文长度至少大于2 | 
 |  |  |         if (length < 2) { | 
 |  |  |             return -1; | 
 |  |  |         } | 
 |  |  |         int readerIndex = inputBuffer.readerIndex(); | 
 |  |  |         for (int i = readerIndex; i < length - 1; i++) { | 
 |  |  |             byte b1 = inputBuffer.getByte(i); | 
 |  |  |             // "#" = b1 | 
 |  |  |             if (0x23 == b1) { | 
 |  |  |                 // "#" = b2 | 
 |  |  |                 if (i + 1 <= length && 0x23 == inputBuffer.getByte(i + 1)) { | 
 |  |  |                     return i; | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         return -1; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     private String byte2Str(ByteBuf buf, int len) { | 
 |  |  |         byte[] bytes = new byte[len]; | 
 |  |  |         buf.readBytes(bytes); | 
 |  |  |         return new String(bytes, Constant.CHARSET_GBK); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.core.netty.handle; | 
 |  |  |  | 
 |  |  | import com.zy.acs.wcs.core.netty.domain.ChPackage; | 
 |  |  | import com.zy.acs.wcs.core.netty.properties.TcpProperties; | 
 |  |  | import io.netty.buffer.ByteBuf; | 
 |  |  | import io.netty.channel.ChannelHandler; | 
 |  |  | import io.netty.channel.ChannelHandlerContext; | 
 |  |  | import io.netty.handler.codec.MessageToByteEncoder; | 
 |  |  | import lombok.extern.slf4j.Slf4j; | 
 |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
 |  |  | import org.springframework.stereotype.Component; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * 国标编码器 | 
 |  |  |  * 此解码器将会生成校验码 | 
 |  |  |  * 处理方式: 异或和 | 
 |  |  |  * Created by vincent on 2019-04-02 | 
 |  |  |  */ | 
 |  |  | @Slf4j | 
 |  |  | @Component | 
 |  |  | @ChannelHandler.Sharable | 
 |  |  | public class ProtocolEncoder extends MessageToByteEncoder<Object> { | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private TcpProperties tcpProperties; | 
 |  |  |  | 
 |  |  |     @Override | 
 |  |  |     protected void encode(ChannelHandlerContext ctx, Object obj, ByteBuf out) { | 
 |  |  |         boolean upgradeLog = true; | 
 |  |  |         if (obj instanceof ByteBuf) { | 
 |  |  |             out.writeBytes((ByteBuf) obj); | 
 |  |  |         } else if (obj instanceof byte[]) { | 
 |  |  |             out.writeBytes((byte[]) obj); | 
 |  |  |         } else if (obj instanceof ChPackage) { | 
 |  |  |  | 
 |  |  |         } | 
 |  |  | //        if (tcpProperties.isPrintPacLog() || upgradeLog){ | 
 |  |  | //            log.info("uuid={} 下行 >>> {}", getVin(out), ByteBufUtil.hexDump(out)); | 
 |  |  | //        } | 
 |  |  |  | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | //    private String getVin(ByteBuf byteBuf){ | 
 |  |  | //        byte[] bytes = new byte[PackagePart.UNIQUENO.getLen()]; | 
 |  |  | //        byteBuf.markReaderIndex(); | 
 |  |  | //        byteBuf.readerIndex(PackagePart.UNIQUENO.getStartIndex()); | 
 |  |  | //        byteBuf.readBytes(bytes); | 
 |  |  | //        byteBuf.resetReaderIndex(); | 
 |  |  | //        return RadixTools.bytesToStr(bytes); | 
 |  |  | //    } | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.core.netty.properties; | 
 |  |  |  | 
 |  |  | import lombok.Data; | 
 |  |  | import org.springframework.boot.context.properties.ConfigurationProperties; | 
 |  |  | import org.springframework.context.annotation.Configuration; | 
 |  |  |  | 
 |  |  | import java.net.InetAddress; | 
 |  |  | import java.net.UnknownHostException; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * vc系统配置 | 
 |  |  |  * Created by luxiaotao on 2018/10/15 | 
 |  |  |  */ | 
 |  |  | @Data | 
 |  |  | @Configuration | 
 |  |  | @ConfigurationProperties(prefix = "tcp") | 
 |  |  | public class TcpProperties { | 
 |  |  |  | 
 |  |  |     public static String HOST_NAME; | 
 |  |  |  | 
 |  |  |     static { | 
 |  |  |         try { | 
 |  |  |             HOST_NAME = InetAddress.getLocalHost().getHostName(); | 
 |  |  |         } catch (UnknownHostException e) { | 
 |  |  |             System.err.println("find hostname err"); | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     private int port; | 
 |  |  |  | 
 |  |  |     private int heartSeconds; | 
 |  |  |  | 
 |  |  |     private int backlog; | 
 |  |  |  | 
 |  |  |     private boolean keepAlive; | 
 |  |  |  | 
 |  |  |     private int sndbuf; | 
 |  |  |  | 
 |  |  |     private int rcvbuf; | 
 |  |  |  | 
 |  |  |     private boolean printPacLog; | 
 |  |  |  | 
 |  |  |     private int barcodeLen; | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.core.properties; | 
 |  |  |  | 
 |  |  | import com.zy.acs.wcs.core.Slave; | 
 |  |  | import com.zy.acs.wcs.core.model.CrnSlave; | 
 |  |  | import com.zy.acs.wcs.core.model.DevpSlave; | 
 |  |  | import com.zy.acs.wcs.core.model.LedSlave; | 
 |  |  | import lombok.Data; | 
 |  |  | import org.springframework.boot.context.properties.ConfigurationProperties; | 
 |  |  | import org.springframework.context.annotation.Configuration; | 
 |  |  |  | 
 |  |  | import java.util.ArrayList; | 
 |  |  | import java.util.List; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * Created by vincent on 2020/8/4 | 
 |  |  |  * | 
 |  |  |  */ | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * 该类整个就是一个通过配置文件来实体化对象类 | 
 |  |  |  */ | 
 |  |  | @Data | 
 |  |  | @Configuration | 
 |  |  | @ConfigurationProperties(prefix = "wcs-slave") | 
 |  |  | public class SlaveProperties { | 
 |  |  |  | 
 |  |  |     private boolean doubleDeep; | 
 |  |  |  | 
 |  |  |     private List<Integer> doubleLocs = new ArrayList<>(); | 
 |  |  |  | 
 |  |  |     private int groupCount; | 
 |  |  |  | 
 |  |  |     private List<CrnSlave> crn = new ArrayList<>(); | 
 |  |  |  | 
 |  |  |     private List<DevpSlave> devp = new ArrayList<>(); | 
 |  |  |  | 
 |  |  |     private List<Slave> barcode = new ArrayList<>(); | 
 |  |  |  | 
 |  |  |     private List<LedSlave> led = new ArrayList<>(); | 
 |  |  |  | 
 |  |  |     private List<Slave> scale = new ArrayList<>(); | 
 |  |  |  | 
 |  |  |     private List<Slave> car = new ArrayList<>(); | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.core.properties; | 
 |  |  |  | 
 |  |  | import java.util.concurrent.atomic.AtomicBoolean; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * Created by vincent on 2020-06-03 | 
 |  |  |  */ | 
 |  |  | public class SystemProperties { | 
 |  |  |  | 
 |  |  |     public static final String WCS_PASSWORD = "root"; | 
 |  |  |  | 
 |  |  |     // 系统运行状态 | 
 |  |  |     public static final AtomicBoolean WCS_RUNNING_STATUS = new AtomicBoolean(Boolean.TRUE); | 
 |  |  |  | 
 |  |  |     public static final String WMS_URL = "localhost"; | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.core.thread; | 
 |  |  |  | 
 |  |  | import com.alibaba.fastjson.JSONObject; | 
 |  |  | import com.zy.acs.framework.common.Cools; | 
 |  |  | import com.zy.acs.framework.common.DateUtils; | 
 |  |  | import com.zy.acs.wcs.core.Slave; | 
 |  |  | import com.zy.acs.wcs.core.ThreadHandler; | 
 |  |  | import com.zy.acs.wcs.core.cache.OutputQueue; | 
 |  |  | import lombok.Data; | 
 |  |  | import lombok.extern.slf4j.Slf4j; | 
 |  |  |  | 
 |  |  | import java.util.Date; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * 条码扫描仪线程 | 
 |  |  |  * Created by vincent on 2020/8/4 | 
 |  |  |  */ | 
 |  |  | @Data | 
 |  |  | @Slf4j | 
 |  |  | public class BarcodeThread implements Runnable, ThreadHandler { | 
 |  |  |  | 
 |  |  |     private Slave slave; | 
 |  |  |     private StringBuffer barcode = new StringBuffer(); | 
 |  |  |  | 
 |  |  |     private String lastBarcode = ""; | 
 |  |  |  | 
 |  |  |     public BarcodeThread(Slave slave) { | 
 |  |  |         this.slave = slave; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public String getBarcode() { | 
 |  |  |         return barcode.toString(); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public void setBarcode(String barcode) { | 
 |  |  |         this.barcode.delete(0, this.barcode.length()); | 
 |  |  |         this.barcode.append(barcode); | 
 |  |  |         if (!Cools.isEmpty(barcode) && !lastBarcode.equals(barcode)) { | 
 |  |  |             lastBarcode = barcode; | 
 |  |  |             log.info("{}号条码器,检索数据:{}", slave.getId(), this.barcode); | 
 |  |  |             JSONObject jsonObject = new JSONObject(); | 
 |  |  |             jsonObject.put("time", DateUtils.convert(new Date(), DateUtils.yyyyMMddHHmmss_F)); | 
 |  |  |             jsonObject.put("barcode", barcode); | 
 |  |  |             if (OutputQueue.BARCODE.size() >= 32) { | 
 |  |  |                 OutputQueue.BARCODE.poll(); | 
 |  |  |             } | 
 |  |  |             OutputQueue.BARCODE.offer(jsonObject); | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @Override | 
 |  |  |     public boolean connect() { | 
 |  |  |         return false; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @Override | 
 |  |  |     public void close() { | 
 |  |  |  | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @Override | 
 |  |  |     public void run() { | 
 |  |  |  | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | //package com.zy.acs.wcs.core.thread; | 
 |  |  | // | 
 |  |  | //import com.core.common.SpringUtils; | 
 |  |  | //import com.zy.asrs.entity.CommandInfo; | 
 |  |  | //import com.zy.asrs.service.CommandInfoService; | 
 |  |  | //import com.zy.asrs.service.DeviceErrorService; | 
 |  |  | //import com.zy.common.model.MatDto; | 
 |  |  | //import com.zy.acs.wcs.core.Slave; | 
 |  |  | //import com.zy.acs.wcs.core.ThreadHandler; | 
 |  |  | //import com.zy.acs.wcs.core.cache.MessageQueue; | 
 |  |  | //import com.zy.acs.wcs.core.enums.CommandStatusType; | 
 |  |  | //import com.zy.acs.wcs.core.enums.SlaveType; | 
 |  |  | //import com.zy.acs.wcs.core.model.Task; | 
 |  |  | //import com.zy.acs.wcs.core.model.command.LedCommand; | 
 |  |  | //import lombok.Data; | 
 |  |  | //import lombok.extern.slf4j.Slf4j; | 
 |  |  | //import onbon.bx05.Bx5GEnv; | 
 |  |  | //import onbon.bx05.Bx5GException; | 
 |  |  | //import onbon.bx05.Bx5GScreen; | 
 |  |  | //import onbon.bx05.Bx5GScreenClient; | 
 |  |  | //import onbon.bx05.area.TextCaptionBxArea; | 
 |  |  | //import onbon.bx05.area.page.TextBxPage; | 
 |  |  | //import onbon.bx05.file.ProgramBxFile; | 
 |  |  | //import onbon.bx05.message.led.ReturnControllerStatus; | 
 |  |  | //import onbon.bx05.utils.DisplayStyleFactory; | 
 |  |  | // | 
 |  |  | //import java.awt.*; | 
 |  |  | //import java.util.HashSet; | 
 |  |  | //import java.util.List; | 
 |  |  | //import java.util.Set; | 
 |  |  | // | 
 |  |  | ///** | 
 |  |  | // * Created by vincent on 2020/9/1 | 
 |  |  | // */ | 
 |  |  | //@Data | 
 |  |  | //@Slf4j | 
 |  |  | //public class LedThread implements Runnable, ThreadHandler { | 
 |  |  | // | 
 |  |  | //    ProgramBxFile pf; | 
 |  |  | //    TextCaptionBxArea area; | 
 |  |  | //    DisplayStyleFactory.DisplayStyle[] styles = DisplayStyleFactory.getStyles().toArray(new DisplayStyleFactory.DisplayStyle[0]); | 
 |  |  | //    private Slave slave; | 
 |  |  | //    private Bx5GScreenClient screen; | 
 |  |  | //    private Set<Integer> workNos = new HashSet<>(); | 
 |  |  | //    private boolean ledMk = false; | 
 |  |  | //    private boolean resetStatus = false;    // 复位状态 | 
 |  |  | // | 
 |  |  | //    public LedThread(Slave slave) { | 
 |  |  | //        this.slave = slave; | 
 |  |  | //        try { | 
 |  |  | //            Bx5GEnv.initial(3000); | 
 |  |  | //            screen = new Bx5GScreenClient("my"); | 
 |  |  | //        } catch (Exception e) { | 
 |  |  | //            e.printStackTrace(); | 
 |  |  | //            log.info("led连接构造器错误 ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort()); | 
 |  |  | //        } | 
 |  |  | //    } | 
 |  |  | // | 
 |  |  | //    public static void main(String[] args) throws Exception { | 
 |  |  | //        String strQty = "1234"; | 
 |  |  | //        int index = strQty.lastIndexOf("."); | 
 |  |  | //        if (index >= 0) { | 
 |  |  | //            strQty = strQty.substring(0, index); | 
 |  |  | //        } | 
 |  |  | //        System.out.println("2==>>" + strQty); | 
 |  |  | // | 
 |  |  | //        Bx5GEnv.initial(3000); | 
 |  |  | //        Bx5GScreenClient screen = new Bx5GScreenClient("my"); | 
 |  |  | //        DisplayStyleFactory.DisplayStyle[] styles = DisplayStyleFactory.getStyles().toArray(new DisplayStyleFactory.DisplayStyle[0]); | 
 |  |  | //        if (!screen.connect("192.168.10.101", 5005)) { | 
 |  |  | //            System.err.println("连接失败!!!!"); | 
 |  |  | //            return; | 
 |  |  | //        } | 
 |  |  | //        screen.turnOn(); | 
 |  |  | // | 
 |  |  | // | 
 |  |  | //        while (true) { | 
 |  |  | //            Thread.sleep(5000L); | 
 |  |  | // | 
 |  |  | //            ProgramBxFile pf = new ProgramBxFile(0, screen.getProfile()); | 
 |  |  | //            pf.setFrameShow(false); | 
 |  |  | //            // 分别输入X,Y,width,heigth | 
 |  |  | //            TextCaptionBxArea area = new TextCaptionBxArea(0, 0, 192, 96, screen.getProfile()); | 
 |  |  | // | 
 |  |  | //            // 创建一个数据页 | 
 |  |  | //            // 第一行数据 | 
 |  |  | //            TextBxPage page = new TextBxPage("出库任务(303)"); | 
 |  |  | //            page.newLine("源库位:0100204"); | 
 |  |  | //            page.newLine("目标站:1000"); | 
 |  |  | //            // 设置字体 | 
 |  |  | //            page.setFont(new Font("宋体", Font.PLAIN, 15)); | 
 |  |  | //            // 设置文本颜色 | 
 |  |  | //            page.setForeground(Color.red); | 
 |  |  | //            // 设置显示特技为快速打出 | 
 |  |  | //            page.setDisplayStyle(styles[6]); | 
 |  |  | //            area.clearPages(); | 
 |  |  | //            area.addPage(page); | 
 |  |  | //            pf.addArea(area); | 
 |  |  | // | 
 |  |  | //            // 更新节目 | 
 |  |  | //            // 更新节目 | 
 |  |  | //            if (pf.validate() != null) { | 
 |  |  | //                System.out.println("pf out of range"); | 
 |  |  | //                log.info("pf out of range"); | 
 |  |  | //            } else { | 
 |  |  | //                // 更新节目 | 
 |  |  | //                screen.writeProgram(pf); | 
 |  |  | //            } | 
 |  |  | //        } | 
 |  |  | // | 
 |  |  | //        // 继开与控制器之间的链接 | 
 |  |  | ////        screen.disconnect(); | 
 |  |  | //    } | 
 |  |  | // | 
 |  |  | //    public static void main1(String[] args) throws Exception { | 
 |  |  | //        Bx5GEnv.initial(3000); | 
 |  |  | //        // 创建screen对象,用于对控制器进行访问,客户端模式 | 
 |  |  | //        Bx5GScreenClient screen = new Bx5GScreenClient("my"); | 
 |  |  | //        // 创建screen对象,用于对控制器进行访问,串口模式 | 
 |  |  | //        //        Bx5GScreenRS screen = new Bx5GScreenRS("MyScreen"); | 
 |  |  | // | 
 |  |  | //        // 在对控制器交互之前,需要先与控制器建立连接 | 
 |  |  | //        boolean conn = screen.connect("192.168.10.61", 5005); | 
 |  |  | //        System.out.println(conn); | 
 |  |  | //        // 与控制器交互完成后,需断开与控制器之间的连接 | 
 |  |  | ////        screen.disconnect(); | 
 |  |  | // | 
 |  |  | //        // 以下为一些简单控制命令的使用方法 | 
 |  |  | //        // 开关机命令 | 
 |  |  | ////        screen.turnOff();// 关机 | 
 |  |  | //        screen.turnOn();// 开机 | 
 |  |  | ////        screen.syncTime();// 校时 | 
 |  |  | ////        screen.ping();// ping命令 | 
 |  |  | ////        // 查询控制器状态 | 
 |  |  | ////        screen.checkControllerStatus(); | 
 |  |  | ////        // 查询控制器当前固件版本 | 
 |  |  | ////        screen.checkFirmware(); | 
 |  |  | ////        // 查询控制器内存 | 
 |  |  | ////        screen.checkMemVolumes(); | 
 |  |  | ////        // 锁定屏幕当前画面 | 
 |  |  | ////        screen.lock(); | 
 |  |  | ////        // 解除锁定屏幕当前画面 | 
 |  |  | ////        screen.unlock(); | 
 |  |  | // | 
 |  |  | //        Bx5GScreen.Result<ReturnControllerStatus> result1 = | 
 |  |  | //                screen.checkControllerStatus(); | 
 |  |  | //        if (result1.isOK()) { | 
 |  |  | //            ReturnControllerStatus status = result1.reply; | 
 |  |  | //            System.out.println(status.getBrightness()); | 
 |  |  | //            System.out.println(status.getRtcDay()); | 
 |  |  | //            System.out.println(status.getScreenOnOff()); | 
 |  |  | //            // | 
 |  |  | //            // status 还有很对其他接口,可以根据实际需求再次调用以获取相应状态 | 
 |  |  | //        } | 
 |  |  | // | 
 |  |  | //// | 
 |  |  | //        // 以下是静态区部分 Demo | 
 |  |  | // | 
 |  |  | //        // 创建节目文件 | 
 |  |  | //        ProgramBxFile pf = new ProgramBxFile(0, screen.getProfile()); | 
 |  |  | //// 是否显示节目边框 | 
 |  |  | //        pf.setFrameShow(true); | 
 |  |  | //// 节目边框的移动速度 | 
 |  |  | //        pf.setFrameSpeed(20); | 
 |  |  | //// 使用第几个内置边框 | 
 |  |  | //        pf.loadFrameImage(13); | 
 |  |  | // | 
 |  |  | //        DisplayStyleFactory.DisplayStyle[] styles = DisplayStyleFactory.getStyles().toArray(new DisplayStyleFactory.DisplayStyle[0]); | 
 |  |  | //// 创建一个文本区 | 
 |  |  | //        // 分别输入X,Y,width,heigth | 
 |  |  | //        // 注意区域坐标和宽度高度,不要越界 | 
 |  |  | //        TextCaptionBxArea area = new TextCaptionBxArea(0, 0, 160, 64, screen.getProfile()); | 
 |  |  | // | 
 |  |  | //        // 创建一个数据页 | 
 |  |  | //        // 第一行数据 | 
 |  |  | //        TextBxPage page = new TextBxPage("入库"); | 
 |  |  | //        // 第二行数据 | 
 |  |  | //        page.newLine("物料:"); | 
 |  |  | //        page.newLine("接收器 RX18 XH 6V (数量:2)"); | 
 |  |  | //        page.newLine("中控 BM蓝牙 英文 6V (数量:1)"); | 
 |  |  | //        page.newLine("线束 S2588-1-XX 无实物(数量:5)"); | 
 |  |  | //        page.newLine("目标库位:0100204"); | 
 |  |  | //        // 设置字体 | 
 |  |  | //        page.setFont(new Font("宋体", Font.PLAIN, 12)); | 
 |  |  | //        // 设置显示特技为快速打出 | 
 |  |  | //        page.setDisplayStyle(styles[2]); | 
 |  |  | // | 
 |  |  | //        // 数据页可以是图片 | 
 |  |  | ////        ImageFileBxPage iPage = new ImageFileBxPage( "E;a/001.bmp" ); | 
 |  |  | //// | 
 |  |  | ////        // 数据页可以是txt文件 | 
 |  |  | ////        TextFileBxPage tPage  = new TextFileBxPage("E:a/001.txt"); | 
 |  |  | // | 
 |  |  | //        // 将前面的page添加到area中 area中可以添加多个page 其中page可以是字符串,可以是txt文件,可以是图片,不可以是表格,如果需要Led屏上显示表格,请先将表格绘制成图片 | 
 |  |  | //        area.addPage(page); | 
 |  |  | ////        area.addPage( iPage ); | 
 |  |  | ////        area.addPage( tPage ); | 
 |  |  | //        // 将area添加到节目中  节目中可以添加多个area | 
 |  |  | //        pf.addArea(area); | 
 |  |  | // | 
 |  |  | //        // 更新节目 | 
 |  |  | //        screen.writeProgram(pf); | 
 |  |  | // | 
 |  |  | // | 
 |  |  | //        // | 
 |  |  | //        // 以下是动态区部分 Demo | 
 |  |  | //        // 动态区的特点 | 
 |  |  | // | 
 |  |  | //        // DynamicBxAreaRule(id, runMode, immediatePlay, timeout) | 
 |  |  | //        // runMode 运行模式: | 
 |  |  | //        //   0:循环显示。 | 
 |  |  | //        //   1:显示完成后静止显示最后一页数据。 | 
 |  |  | //        //   2:循环显示,超过设定时间后数据仍未更新时不再显示。 | 
 |  |  | //        //   3:循环显示,超过设定时间后数据仍未更新时显示 Logo 信息。 | 
 |  |  | //        //   4:循环显示,显示完最后一页后就不再显示。 | 
 |  |  | //        // immediatePlay 是否立即播放: | 
 |  |  | //        //   0:与异步节目一起播放。 | 
 |  |  | //        //   1:异步节目停止播放,仅播放动态区域。 | 
 |  |  | //        //   2:当播放完节目编号最高的异步节目后播放该动态区域。 | 
 |  |  | // | 
 |  |  | //        // | 
 |  |  | //        // 定义一个动态区 | 
 |  |  | //        // 可以通过ID来更新不同的动态区内容, 此处 ID 为 0 | 
 |  |  | ////        DynamicBxAreaRule dynRule = new DynamicBxAreaRule(0, (byte) 0, (byte) 1, 0); | 
 |  |  | //        //dArea.addProgram("P000"); | 
 |  |  | //        //dArea.addProgram("P001"); | 
 |  |  | // | 
 |  |  | ////        int posX = 440; | 
 |  |  | ////        int posY = 4; | 
 |  |  | ////        TextCaptionBxArea dAreaContent = new TextCaptionBxArea(posX, posY, 64, 16, screen.getProfile()); | 
 |  |  | ////        TextBxPage page = new TextBxPage("动态第一次尝试"); | 
 |  |  | ////        page.setDisplayStyle(DisplayStyleFactory.getStyle(4)); | 
 |  |  | ////        dAreaContent.addPage(page); | 
 |  |  | //// | 
 |  |  | ////        // 发送动态区之前,如果需要删除之前的动态区,可以调用以下接口 | 
 |  |  | ////        // 通常如果动态区的位置或大小没有发生改变,不用删除 | 
 |  |  | ////        screen.deleteAllDynamic(); | 
 |  |  | //// | 
 |  |  | ////        // 更新动态区 | 
 |  |  | ////        screen.writeDynamic(dynRule, dAreaContent); | 
 |  |  | ////        Thread.sleep(15000); | 
 |  |  | //// | 
 |  |  | ////        // | 
 |  |  | ////        // 下面模拟再次更新动态区 | 
 |  |  | ////        page = new TextBxPage("再次尝试"); | 
 |  |  | ////        TextBxPage page2 = new TextBxPage("成功"); | 
 |  |  | //// | 
 |  |  | ////        dAreaContent.clearPages(); | 
 |  |  | ////        dAreaContent.addPage(page); | 
 |  |  | ////        dAreaContent.addPage(page2); | 
 |  |  | //// | 
 |  |  | ////        // 更新动态区 | 
 |  |  | ////        screen.writeDynamic(dynRule, dAreaContent); | 
 |  |  | // | 
 |  |  | //        // | 
 |  |  | //        // 继开与控制器之间的链接 | 
 |  |  | //        screen.disconnect(); | 
 |  |  | // | 
 |  |  | // | 
 |  |  | //    } | 
 |  |  | // | 
 |  |  | //    @Override | 
 |  |  | //    @SuppressWarnings({"InfiniteLoopStatement", "unchecked"}) | 
 |  |  | //    public void run() { | 
 |  |  | //        connect(); | 
 |  |  | //        close(); | 
 |  |  | //        while (true) { | 
 |  |  | //            try { | 
 |  |  | //                Task task = MessageQueue.poll(SlaveType.Led, slave.getId()); | 
 |  |  | //                if (task != null) { | 
 |  |  | //                    switch (task.getStep()) { | 
 |  |  | //                        // 写数据 | 
 |  |  | //                        case 1: | 
 |  |  | //                            write((List<LedCommand>) task.getData()); | 
 |  |  | //                            break; | 
 |  |  | //                        // 复位 | 
 |  |  | //                        case 2: | 
 |  |  | //                            reset(); | 
 |  |  | //                            break; | 
 |  |  | //                        default: | 
 |  |  | //                            break; | 
 |  |  | //                    } | 
 |  |  | //                } | 
 |  |  | // | 
 |  |  | //                Thread.sleep(400); | 
 |  |  | //            } catch (Exception e) { | 
 |  |  | //                e.printStackTrace(); | 
 |  |  | //            } | 
 |  |  | //        } | 
 |  |  | //    } | 
 |  |  | // | 
 |  |  | //    private void write(List<LedCommand> list) throws Bx5GException { | 
 |  |  | //        if (!connect()) { | 
 |  |  | //            return; | 
 |  |  | //        } | 
 |  |  | //        pf = new ProgramBxFile(0, screen.getProfile()); | 
 |  |  | //        pf.setFrameShow(false); | 
 |  |  | //        // 分别输入X,Y,width,height | 
 |  |  | //        area = new TextCaptionBxArea(0, 0, 96, 48, screen.getProfile()); | 
 |  |  | //        // 创建一个数据页 | 
 |  |  | //        TextBxPage page = new TextBxPage(); | 
 |  |  | //        for (LedCommand command : list) { | 
 |  |  | //            page.newLine(command.getTitle() + "(" + command.getWorkNo() + ")"); | 
 |  |  | //            page.newLine("库位:" + (command.getIoType() < 100 ? command.getLocNo() : command.getSourceLocNo())); | 
 |  |  | //            page.newLine("目标站:" + command.getStaNo()); | 
 |  |  | //            if (!command.isEmptyMk()) { | 
 |  |  | //                for (MatDto matDto : command.getMatDtos()) { | 
 |  |  | //                    //去掉小数点 | 
 |  |  | //                    String strQty = matDto.getCount().toString(); | 
 |  |  | //                    int idx = strQty.lastIndexOf("."); | 
 |  |  | //                    if (idx >= 0) { | 
 |  |  | //                        strQty.substring(0, idx); | 
 |  |  | //                    } | 
 |  |  | //                    page.newLine(matDto.getMaknx() + "[数量" + strQty + "]"); | 
 |  |  | ////                    page.newLine(matDto.getMaknx() + "【数量" + matDto.getCount() +"】"); | 
 |  |  | //                } | 
 |  |  | //            } | 
 |  |  | //            page.newLine("\n"); | 
 |  |  | // | 
 |  |  | //            //更新指令状态 | 
 |  |  | //            CommandInfoService commandInfoService = SpringUtils.getBean(CommandInfoService.class); | 
 |  |  | //            CommandInfo commandInfo = command.getCommandInfo(); | 
 |  |  | //            commandInfo.setCommandStatus(CommandStatusType.COMPLETE.id); | 
 |  |  | //            commandInfoService.updateById(commandInfo); | 
 |  |  | //        } | 
 |  |  | // | 
 |  |  | //        // 设置字体 | 
 |  |  | //        page.setFont(new Font("宋体", Font.PLAIN, 12)); | 
 |  |  | //        // 设置文本颜色 | 
 |  |  | //        page.setForeground(Color.red); | 
 |  |  | //        // 设置显示特技为快速打出 | 
 |  |  | //        page.setDisplayStyle(styles[6]); | 
 |  |  | //        area.clearPages(); | 
 |  |  | //        area.addPage(page); | 
 |  |  | //        pf.addArea(area); | 
 |  |  | //        if (pf.validate() != null) { | 
 |  |  | //            log.info("pf out of range"); | 
 |  |  | //        } else { | 
 |  |  | //            // 更新节目 | 
 |  |  | //            screen.writeProgram(pf); | 
 |  |  | ////            resetStatus = false; | 
 |  |  | //        } | 
 |  |  | //        close(); | 
 |  |  | //    } | 
 |  |  | // | 
 |  |  | //    private void reset() throws Bx5GException { | 
 |  |  | //        if (!connect()) { | 
 |  |  | //            return; | 
 |  |  | //        } | 
 |  |  | ////        if (resetStatus) { | 
 |  |  | ////            return; | 
 |  |  | ////        } | 
 |  |  | //        pf = new ProgramBxFile(0, screen.getProfile()); | 
 |  |  | //        pf.setFrameShow(false); | 
 |  |  | //        // 分别输入X,Y,width,height | 
 |  |  | //        area = new TextCaptionBxArea(0, 0, 96, 48, screen.getProfile()); | 
 |  |  | //        // 创建一个数据页 | 
 |  |  | //        TextBxPage page = new TextBxPage(); | 
 |  |  | // | 
 |  |  | ////        List<String> list = null; | 
 |  |  | ////        try { | 
 |  |  | ////            String ledDefaultMsg = Parameter.get().getLedDefaultMsg(); | 
 |  |  | ////            list = JSON.parseArray(ledDefaultMsg, String.class); | 
 |  |  | ////        } catch (Exception ignore) { | 
 |  |  | ////        } | 
 |  |  | ////        if (!Cools.isEmpty(list)) { | 
 |  |  | ////            for (String str : list) { | 
 |  |  | ////                page.newLine(str); | 
 |  |  | ////            } | 
 |  |  | ////        } else { | 
 |  |  | ////            page.newLine("自动化立体仓库"); | 
 |  |  | ////            page.newLine("西格迈股份有限公司"); | 
 |  |  | ////        } | 
 |  |  | //        page.newLine("力源智能仓储"); | 
 |  |  | // | 
 |  |  | //        // 设置字体 | 
 |  |  | //        page.setFont(new Font("宋体", Font.PLAIN, 13)); | 
 |  |  | //        // 设置文本颜色 | 
 |  |  | //        page.setForeground(Color.red); | 
 |  |  | //        // 设置显示特技为快速打出 | 
 |  |  | //        page.setDisplayStyle(styles[6]); | 
 |  |  | //        area.clearPages(); | 
 |  |  | //        area.addPage(page); | 
 |  |  | //        pf.addArea(area); | 
 |  |  | //        // 更新节目 | 
 |  |  | //        if (pf.validate() != null) { | 
 |  |  | //            log.info("pf out of range"); | 
 |  |  | //        } else { | 
 |  |  | //            // 更新节目 | 
 |  |  | //            screen.writeProgram(pf); | 
 |  |  | ////            resetStatus = true; | 
 |  |  | //        } | 
 |  |  | //        close(); | 
 |  |  | //    } | 
 |  |  | // | 
 |  |  | //    @Override | 
 |  |  | //    public boolean connect() { | 
 |  |  | //        boolean connRes = false; | 
 |  |  | //        try { | 
 |  |  | //            connRes = screen.connect(slave.getIp(), slave.getPort()); | 
 |  |  | //            screen.turnOn(); | 
 |  |  | //        } catch (Exception ignore) { | 
 |  |  | //        } | 
 |  |  | //        DeviceErrorService deviceErrorService = SpringUtils.getBean(DeviceErrorService.class); | 
 |  |  | //        if (connRes) { | 
 |  |  | //            log.info("led连接成功 ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort()); | 
 |  |  | //            deviceErrorService.deleteDeviceError("led", slave.getId()); | 
 |  |  | //        } else { | 
 |  |  | //            log.error("led连接失败!!! ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort()); | 
 |  |  | //            deviceErrorService.addDeviceError("led", slave.getId(), "led连接失败"); | 
 |  |  | //        } | 
 |  |  | //        return connRes; | 
 |  |  | //    } | 
 |  |  | // | 
 |  |  | //    @Override | 
 |  |  | //    public void close() { | 
 |  |  | //        screen.disconnect(); | 
 |  |  | //    } | 
 |  |  | // | 
 |  |  | //} | 
 
| New file | 
 |  |  | 
 |  |  | //package com.zy.acs.wcs.core.thread; | 
 |  |  | // | 
 |  |  | //import com.alibaba.fastjson.JSONObject; | 
 |  |  | //import com.core.common.Cools; | 
 |  |  | //import com.core.common.DateUtils; | 
 |  |  | //import com.core.common.SpringUtils; | 
 |  |  | //import com.zy.asrs.entity.BasDevp; | 
 |  |  | //import com.zy.asrs.service.BasDevpService; | 
 |  |  | //import com.zy.asrs.service.DeviceErrorService; | 
 |  |  | //import com.zy.acs.wcs.core.Slave; | 
 |  |  | //import com.zy.acs.wcs.core.ThreadHandler; | 
 |  |  | //import com.zy.acs.wcs.core.cache.OutputQueue; | 
 |  |  | //import lombok.Data; | 
 |  |  | //import lombok.extern.slf4j.Slf4j; | 
 |  |  | // | 
 |  |  | //import java.io.DataInputStream; | 
 |  |  | //import java.io.DataOutputStream; | 
 |  |  | //import java.io.IOException; | 
 |  |  | //import java.net.InetSocketAddress; | 
 |  |  | //import java.net.Socket; | 
 |  |  | //import java.net.SocketAddress; | 
 |  |  | //import java.net.SocketTimeoutException; | 
 |  |  | //import java.util.Date; | 
 |  |  | // | 
 |  |  | ///** | 
 |  |  | // * 磅秤线程 | 
 |  |  | // * Created by vincent on 2020/8/4 | 
 |  |  | // */ | 
 |  |  | //@Data | 
 |  |  | //@Slf4j | 
 |  |  | //public class ScaleThread implements Runnable, ThreadHandler { | 
 |  |  | // | 
 |  |  | //    private Slave slave; | 
 |  |  | //    private Double scale = 0.0D; | 
 |  |  | //    private Socket socket; | 
 |  |  | //    private DataOutputStream dataOutputStream; | 
 |  |  | //    private DataInputStream dataInputStream; | 
 |  |  | // | 
 |  |  | //    public ScaleThread(Slave slave) { | 
 |  |  | //        this.slave = slave; | 
 |  |  | //    } | 
 |  |  | // | 
 |  |  | //    @Override | 
 |  |  | //    @SuppressWarnings("InfiniteLoopStatement") | 
 |  |  | //    public void run() { | 
 |  |  | //        connect(); | 
 |  |  | //        while (true) { | 
 |  |  | //            try { | 
 |  |  | //                byte[] read = read(8, 100); | 
 |  |  | //                if (null != read) { | 
 |  |  | //                    String s = new String(read); | 
 |  |  | //                    if (!Cools.isEmpty(s) && s.startsWith("=")) { | 
 |  |  | //                        scale = Double.parseDouble(s.substring(1)); | 
 |  |  | // | 
 |  |  | //                        //将称重重量写入设备基础数据中的gross_wt字段 | 
 |  |  | //                        if (scale > 20) { | 
 |  |  | //                            BasDevpService basDevpService = SpringUtils.getBean(BasDevpService.class); | 
 |  |  | //                            Integer staNo = slave.getId() == 1 ? 101 : 201; | 
 |  |  | //                            BasDevp basDevp = basDevpService.selectById(staNo); | 
 |  |  | //                            if (!Cools.isEmpty(basDevp)) { | 
 |  |  | //                                basDevp.setGrossWt(scale); | 
 |  |  | //                                if (null != basDevpService && !basDevpService.updateById(basDevp)) { | 
 |  |  | //                                    throw new Exception("更新数据库数据失败"); | 
 |  |  | //                                } | 
 |  |  | //                                JSONObject jsonObject = new JSONObject(); | 
 |  |  | //                                jsonObject.put("time", DateUtils.convert(new Date(), DateUtils.yyyyMMddHHmmss_F)); | 
 |  |  | //                                jsonObject.put("id", staNo); | 
 |  |  | //                                jsonObject.put("scale", scale); | 
 |  |  | //                                if (OutputQueue.SCALE.size() >= 32) { | 
 |  |  | //                                    OutputQueue.SCALE.poll(); | 
 |  |  | //                                } | 
 |  |  | //                                OutputQueue.SCALE.offer(jsonObject); | 
 |  |  | //                            } | 
 |  |  | //                        } | 
 |  |  | //                    } | 
 |  |  | //                } | 
 |  |  | //                Thread.sleep(100); | 
 |  |  | //            } catch (SocketTimeoutException ignore) { | 
 |  |  | //            } catch (Exception e) { | 
 |  |  | ////                e.printStackTrace(); | 
 |  |  | //            } | 
 |  |  | //        } | 
 |  |  | //    } | 
 |  |  | // | 
 |  |  | //    @Override | 
 |  |  | //    public boolean connect() { | 
 |  |  | // | 
 |  |  | //        try { | 
 |  |  | //            close();  //1.主动释放连接 //2.某些服务器对指定ip有链路数限制 | 
 |  |  | //            socket = new Socket(); | 
 |  |  | //            //socket.setKeepAlive(true); | 
 |  |  | //            SocketAddress socketAddress = new InetSocketAddress(slave.getIp(), slave.getPort()); | 
 |  |  | //            socket.connect(socketAddress, 1000); //某些服务器ping延迟高时要增加,否则会报错connect timeout | 
 |  |  | //            dataOutputStream = new DataOutputStream(socket.getOutputStream()); | 
 |  |  | //            dataInputStream = new DataInputStream(socket.getInputStream()); | 
 |  |  | ////            log.info("条码扫描仪连接成功 ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort()); | 
 |  |  | //            DeviceErrorService deviceErrorService = SpringUtils.getBean(DeviceErrorService.class); | 
 |  |  | //            deviceErrorService.deleteDeviceError("scale", slave.getId()); | 
 |  |  | //        } catch (Exception e) { | 
 |  |  | //            socket = null; | 
 |  |  | //            log.error("磅秤连接失败!!! ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort()); | 
 |  |  | //            DeviceErrorService deviceErrorService = SpringUtils.getBean(DeviceErrorService.class); | 
 |  |  | //            deviceErrorService.addDeviceError("scale", slave.getId(), "磅秤连接失败"); | 
 |  |  | //            return false; | 
 |  |  | //        } | 
 |  |  | //        return true; | 
 |  |  | //    } | 
 |  |  | // | 
 |  |  | //    @Override | 
 |  |  | //    public void close() { | 
 |  |  | //        try { | 
 |  |  | //            if (null != dataOutputStream) { | 
 |  |  | //                dataOutputStream.close(); | 
 |  |  | //            } | 
 |  |  | //            if (null != dataInputStream) { | 
 |  |  | //                dataInputStream.close(); | 
 |  |  | //            } | 
 |  |  | ////        if (null != socket && !socket.isClosed()) { | 
 |  |  | ////            socket.close(); | 
 |  |  | ////        } | 
 |  |  | //            if (null != socket) { | 
 |  |  | //                socket.close(); | 
 |  |  | //            } | 
 |  |  | //            socket = null; | 
 |  |  | //        } catch (IOException e) { | 
 |  |  | //            log.error("SocketClient close Exception:" + e.getMessage()); | 
 |  |  | //        } | 
 |  |  | //    } | 
 |  |  | // | 
 |  |  | //    public void write(byte[] msg, int len) throws IOException { | 
 |  |  | //        if (null != dataInputStream) { | 
 |  |  | //            dataOutputStream.write(msg, 0, len); | 
 |  |  | //            dataOutputStream.flush(); | 
 |  |  | //        } | 
 |  |  | //    } | 
 |  |  | // | 
 |  |  | //    public byte[] read(int bufferSize, int timeOut) throws IOException { | 
 |  |  | ////        if (socket == null) { | 
 |  |  | ////           connect(); | 
 |  |  | ////        } | 
 |  |  | //        connect(); | 
 |  |  | //        socket.setSoTimeout(timeOut); | 
 |  |  | //        byte[] bytes = new byte[bufferSize]; | 
 |  |  | //        int len = dataInputStream.read(bytes); | 
 |  |  | //        byte[] tempBytes = null; | 
 |  |  | //        if (len > 0) { | 
 |  |  | //            tempBytes = new byte[len]; | 
 |  |  | //            System.arraycopy(bytes, 0, tempBytes, 0, len); | 
 |  |  | //        } | 
 |  |  | //        return tempBytes; | 
 |  |  | //    } | 
 |  |  | // | 
 |  |  | //    public boolean valid() throws Exception { | 
 |  |  | //        if (null == socket || socket.isClosed() || socket.isInputShutdown() || socket.isOutputShutdown()) { | 
 |  |  | //            if (dataInputStream != null) { | 
 |  |  | //                dataInputStream.close(); | 
 |  |  | //            } | 
 |  |  | //            if (dataOutputStream != null) { | 
 |  |  | //                dataOutputStream.close(); | 
 |  |  | //            } | 
 |  |  | //            if (socket != null) { | 
 |  |  | //                socket.close(); | 
 |  |  | //            } | 
 |  |  | //            return false; | 
 |  |  | //        } | 
 |  |  | //        return true; | 
 |  |  | //    } | 
 |  |  | // | 
 |  |  | //} | 
 
| New file | 
 |  |  | 
 |  |  | //package com.zy.acs.wcs.core.thread; | 
 |  |  | // | 
 |  |  | //import HslCommunication.Core.Types.OperateResult; | 
 |  |  | //import HslCommunication.Core.Types.OperateResultExOne; | 
 |  |  | //import HslCommunication.Profinet.Siemens.SiemensPLCS; | 
 |  |  | //import HslCommunication.Profinet.Siemens.SiemensS7Net; | 
 |  |  | //import com.alibaba.fastjson.JSON; | 
 |  |  | //import com.baomidou.mybatisplus.mapper.EntityWrapper; | 
 |  |  | //import com.core.common.Cools; | 
 |  |  | //import com.core.common.DateUtils; | 
 |  |  | //import com.core.common.SpringUtils; | 
 |  |  | //import com.zy.asrs.entity.*; | 
 |  |  | //import com.zy.asrs.service.*; | 
 |  |  | //import com.zy.acs.wcs.core.CrnThread; | 
 |  |  | //import com.zy.acs.wcs.core.cache.MessageQueue; | 
 |  |  | //import com.zy.acs.wcs.core.cache.OutputQueue; | 
 |  |  | //import com.zy.acs.wcs.core.enums.CommandStatusType; | 
 |  |  | //import com.zy.acs.wcs.core.enums.CrnTaskModeType; | 
 |  |  | //import com.zy.acs.wcs.core.enums.SlaveType; | 
 |  |  | //import com.zy.acs.wcs.core.model.CrnSlave; | 
 |  |  | //import com.zy.acs.wcs.core.model.Task; | 
 |  |  | //import com.zy.acs.wcs.core.model.command.CrnCommand; | 
 |  |  | //import com.zy.acs.wcs.core.model.protocol.CrnProtocol; | 
 |  |  | //import lombok.Data; | 
 |  |  | //import lombok.extern.slf4j.Slf4j; | 
 |  |  | // | 
 |  |  | //import java.text.MessageFormat; | 
 |  |  | //import java.util.Date; | 
 |  |  | // | 
 |  |  | ///** | 
 |  |  | // * 堆垛机线程 | 
 |  |  | // * Created by vincent on 2020/8/4 | 
 |  |  | // */ | 
 |  |  | //@Data | 
 |  |  | //@Slf4j | 
 |  |  | //public class SiemensCrnThread implements Runnable, CrnThread { | 
 |  |  | // | 
 |  |  | //    private SiemensS7Net siemensNet; | 
 |  |  | //    private CrnSlave slave; | 
 |  |  | //    private CrnProtocol crnProtocol; | 
 |  |  | //    private boolean resetFlag = false; | 
 |  |  | // | 
 |  |  | // | 
 |  |  | // | 
 |  |  | //    public SiemensCrnThread(CrnSlave slave) { | 
 |  |  | //        this.slave = slave; | 
 |  |  | //    } | 
 |  |  | // | 
 |  |  | //    /*****************************************************************************************/ | 
 |  |  | //    public static void main(String[] args) throws InterruptedException { | 
 |  |  | //        CrnSlave slave = new CrnSlave(); | 
 |  |  | //        slave.setId(1); | 
 |  |  | //        slave.setIp("192.168.6.9"); | 
 |  |  | //        slave.setRack(0); | 
 |  |  | //        slave.setSlot(0); | 
 |  |  | //        SiemensCrnThread crnThread = new SiemensCrnThread(slave); | 
 |  |  | //        crnThread.connect(); | 
 |  |  | //        crnThread.readStatus(); | 
 |  |  | //        System.out.println(JSON.toJSONString(crnThread.crnProtocol)); | 
 |  |  | //        Thread.sleep(3000L); | 
 |  |  | // | 
 |  |  | //        // 1.入库 源和目标都发 | 
 |  |  | ////        CrnCommand command = new CrnCommand(); | 
 |  |  | ////        command.setCrnNo(1); // 堆垛机编号 | 
 |  |  | ////        command.setTaskNo((short) 0); // 工作号 | 
 |  |  | ////        command.setAckFinish((short) 0);  // 任务完成确认位 | 
 |  |  | ////        command.setTaskMode(CrnTaskModeType.PAKIN); // 任务模式 | 
 |  |  | ////        command.setSourcePosX((short) 1);     // 源库位排 | 
 |  |  | ////        command.setSourcePosY((short) 0);     // 源库位列 | 
 |  |  | ////        command.setSourcePosZ((short) 1);     // 源库位层 | 
 |  |  | ////        command.setDestinationPosX((short) 2);     // 目标库位排 | 
 |  |  | ////        command.setDestinationPosY((short) 3);     // 目标库位列 | 
 |  |  | ////        command.setDestinationPosZ((short) 1);     // 目标库位层 | 
 |  |  | ////        crnThread.write(command); | 
 |  |  | // | 
 |  |  | //        // 2.出库 源和目标都发 | 
 |  |  | ////        CrnCommand command = new CrnCommand(); | 
 |  |  | ////        command.setCrnNo(1); // 堆垛机编号 | 
 |  |  | ////        command.setTaskNo((short) 0); // 工作号 | 
 |  |  | ////        command.setAckFinish((short) 0);  // 任务完成确认位 | 
 |  |  | ////        command.setTaskMode(CrnTaskModeType.PAKOUT); // 任务模式 | 
 |  |  | ////        command.setSourcePosX((short) 2);     // 源库位排 | 
 |  |  | ////        command.setSourcePosY((short) 4);     // 源库位列 | 
 |  |  | ////        command.setSourcePosZ((short) 3);     // 源库位层 | 
 |  |  | ////        command.setDestinationPosX((short) 1);     // 目标库位排 | 
 |  |  | ////        command.setDestinationPosY((short) 0);     // 目标库位列 | 
 |  |  | ////        command.setDestinationPosZ((short) 1);     // 目标库位层 | 
 |  |  | ////        crnThread.write(command); | 
 |  |  | // | 
 |  |  | // | 
 |  |  | ////        // 3.库位移转   源和目标都发 pass | 
 |  |  | ////        CrnCommand command = new CrnCommand(); | 
 |  |  | ////        command.setCrnNo(slave.getId()); // 堆垛机编号 | 
 |  |  | ////        command.setTaskNo((short) 0); // 工作号 | 
 |  |  | ////        command.setAckFinish((short) 0);  // 任务完成确认位 | 
 |  |  | ////        command.setTaskMode(CrnTaskModeType.LOC_MOVE); // 任务模式:  库位移转 | 
 |  |  | ////        command.setSourcePosX((short)2);     // 源库位排 | 
 |  |  | ////        command.setSourcePosY((short)2);     // 源库位列 | 
 |  |  | ////        command.setSourcePosZ((short)3);     // 源库位层 | 
 |  |  | ////        command.setDestinationPosX((short)2);     // 目标库位排 | 
 |  |  | ////        command.setDestinationPosY((short)4);     // 目标库位列 | 
 |  |  | ////        command.setDestinationPosZ((short)4);     // 目标库位层 | 
 |  |  | ////        crnThread.write(command); | 
 |  |  | // | 
 |  |  | //        // 4.站位移转   源和目标都发 | 
 |  |  | ////        CrnCommand command = new CrnCommand(); | 
 |  |  | ////        command.setCrnNo(slave.getId()); // 堆垛机编号 | 
 |  |  | ////        command.setTaskNo((short) 0); // 工作号 | 
 |  |  | ////        command.setAckFinish((short) 0);  // 任务完成确认位 | 
 |  |  | ////        command.setTaskMode(CrnTaskModeType.SITE_MOVE); // 任务模式:  库位移转 | 
 |  |  | ////        command.setSourcePosX((short)1);     // 源库位排 | 
 |  |  | ////        command.setSourcePosY((short)0);     // 源库位列 | 
 |  |  | ////        command.setSourcePosZ((short)1);     // 源库位层 | 
 |  |  | ////        command.setDestinationPosX((short)2);     // 目标库位排 | 
 |  |  | ////        command.setDestinationPosY((short)0);     // 目标库位列 | 
 |  |  | ////        command.setDestinationPosZ((short)1);     // 目标库位层 | 
 |  |  | ////        crnThread.write(command); | 
 |  |  | // | 
 |  |  | ////        // 5.回原点  不用发   pass | 
 |  |  | ////        CrnCommand command = new CrnCommand(); | 
 |  |  | ////        command.setCrnNo(1); // 堆垛机编号 | 
 |  |  | ////        command.setTaskNo((short) 0); // 工作号 | 
 |  |  | ////        command.setAckFinish((short) 0);  // 任务完成确认位 | 
 |  |  | ////        command.setTaskMode(CrnTaskModeType.GO_ORIGIN); // 任务模式 | 
 |  |  | ////        command.setSourcePosX((short) 0);     // 源库位排 | 
 |  |  | ////        command.setSourcePosY((short) 0);     // 源库位列 | 
 |  |  | ////        command.setSourcePosZ((short) 0);     // 源库位层 | 
 |  |  | ////        command.setDestinationPosX((short) 0);     // 目标库位排 | 
 |  |  | ////        command.setDestinationPosY((short) 0);     // 目标库位列 | 
 |  |  | ////        command.setDestinationPosZ((short) 0);     // 目标库位层 | 
 |  |  | ////        crnThread.write(command); | 
 |  |  | // | 
 |  |  | ////        // 7.坐标移行   目标发   pass | 
 |  |  | ////        CrnCommand command = new CrnCommand(); | 
 |  |  | ////        command.setCrnNo(1); // 堆垛机编号 | 
 |  |  | ////        command.setTaskNo((short) 0); // 工作号 | 
 |  |  | ////        command.setAckFinish((short) 0);  // 任务完成确认位 | 
 |  |  | ////        command.setTaskMode(CrnTaskModeType.OFFSET_MOVE); // 任务模式 | 
 |  |  | ////        command.setSourcePosX((short) 0);     // 源库位排 | 
 |  |  | ////        command.setSourcePosY((short) 0);     // 源库位列 | 
 |  |  | ////        command.setSourcePosZ((short) 0);     // 源库位层 | 
 |  |  | ////        command.setDestinationPosX((short) 2);     // 目标库位排 | 
 |  |  | ////        command.setDestinationPosY((short) 1);     // 目标库位列 | 
 |  |  | ////        command.setDestinationPosZ((short) 1);     // 目标库位层 | 
 |  |  | ////        crnThread.write(command); | 
 |  |  | // | 
 |  |  | //        // 只有出现指定异常才进行复位 | 
 |  |  | ////        if (crnThread.crnProtocol.getCrnError2().leftTakeNoneErr | 
 |  |  | ////                || crnThread.crnProtocol.getCrnError2().rightTakeNoneErr | 
 |  |  | ////                || crnThread.crnProtocol.getCrnError2().leftPutLoadErr | 
 |  |  | ////                || crnThread.crnProtocol.getCrnError2().rightPutLoadErr) { | 
 |  |  | ////            CrnCommand command = new CrnCommand(); | 
 |  |  | ////            command.setCrnNo(1); // 堆垛机编号 | 
 |  |  | ////            command.setAckFinish((short) 1);  // 任务完成确认位 | 
 |  |  | ////            command.setTaskMode(CrnTaskModeType.NONE); // 任务模式 | 
 |  |  | ////            Thread.sleep(3000L); | 
 |  |  | ////            crnThread.write(command); | 
 |  |  | ////        } | 
 |  |  | // | 
 |  |  | //    } | 
 |  |  | // | 
 |  |  | //    @Override | 
 |  |  | //    @SuppressWarnings("InfiniteLoopStatement") | 
 |  |  | //    public void run() { | 
 |  |  | //        initCrnProtocol(); | 
 |  |  | //        this.connect(); | 
 |  |  | //        while (true) { | 
 |  |  | //            try { | 
 |  |  | //                int step = 1; | 
 |  |  | //                Task task = MessageQueue.poll(SlaveType.Crn, slave.getId()); | 
 |  |  | //                if (task != null) { | 
 |  |  | //                    step = task.getStep(); | 
 |  |  | //                } | 
 |  |  | //                switch (step) { | 
 |  |  | //                    // 读数据 | 
 |  |  | //                    case 1: | 
 |  |  | //                        readStatus(); | 
 |  |  | //                        break; | 
 |  |  | //                    // 写入数据 | 
 |  |  | //                    case 2: | 
 |  |  | //                        write5((CrnCommand) task.getData()); | 
 |  |  | //                        break; | 
 |  |  | //                    // 复位 | 
 |  |  | //                    case 3: | 
 |  |  | //                        CrnCommand command = (CrnCommand) task.getData(); | 
 |  |  | //                        if (null == command) { | 
 |  |  | //                            command = new CrnCommand(); | 
 |  |  | //                        } | 
 |  |  | //                        command.setCrnNo(slave.getId()); // 堆垛机编号 | 
 |  |  | //                        command.setTaskNo((short) 0); // 工作号 | 
 |  |  | //                        command.setAckFinish((short) 1);  // 任务完成确认位 | 
 |  |  | //                        command.setTaskMode(CrnTaskModeType.NONE); // 任务模式 | 
 |  |  | //                        command.setSourcePosX((short) 0);     // 源库位排 | 
 |  |  | //                        command.setSourcePosY((short) 0);     // 源库位列 | 
 |  |  | //                        command.setSourcePosZ((short) 0);     // 源库位层 | 
 |  |  | //                        command.setDestinationPosX((short) 0);     // 目标库位排 | 
 |  |  | //                        command.setDestinationPosY((short) 0);     // 目标库位列 | 
 |  |  | //                        command.setDestinationPosZ((short) 0);     // 目标库位层 | 
 |  |  | //                        write(command); | 
 |  |  | //                        break; | 
 |  |  | //                    case 4: | 
 |  |  | //                        writeAuto((CrnCommand) task.getData()); | 
 |  |  | //                        break; | 
 |  |  | //                    case 5: | 
 |  |  | //                        write((CrnCommand) task.getData()); | 
 |  |  | //                        break; | 
 |  |  | //                    default: | 
 |  |  | //                        break; | 
 |  |  | //                } | 
 |  |  | //                Thread.sleep(500); | 
 |  |  | //            } catch (Exception e) { | 
 |  |  | ////                e.printStackTrace(); | 
 |  |  | //            } | 
 |  |  | // | 
 |  |  | //        } | 
 |  |  | //    } | 
 |  |  | // | 
 |  |  | //    /** | 
 |  |  | //     * 初始化堆垛机 | 
 |  |  | //     */ | 
 |  |  | //    private void initCrnProtocol() { | 
 |  |  | //        crnProtocol = new CrnProtocol(); | 
 |  |  | //        crnProtocol.setMode((short) 0); | 
 |  |  | //        crnProtocol.setStatus((short) 0); | 
 |  |  | //        crnProtocol.setTaskNo((short) 0); | 
 |  |  | //        crnProtocol.setTaskFinish((short) 0); | 
 |  |  | //        crnProtocol.setValid((short) 0); | 
 |  |  | //        crnProtocol.setBay((short) 0); | 
 |  |  | //        crnProtocol.setLevel((short) 0); | 
 |  |  | //        crnProtocol.setRow((short) 0); | 
 |  |  | //        crnProtocol.setLane((short) 0); | 
 |  |  | //    } | 
 |  |  | // | 
 |  |  | //    @Override | 
 |  |  | //    public boolean connect() { | 
 |  |  | //        boolean result = false; | 
 |  |  | //        siemensNet = new SiemensS7Net(SiemensPLCS.S1500, slave.getIp()); | 
 |  |  | //        siemensNet.setRack(slave.getRack().byteValue()); | 
 |  |  | //        siemensNet.setSlot(slave.getSlot().byteValue()); | 
 |  |  | //        OperateResult connect = siemensNet.ConnectServer(); | 
 |  |  | //        if (connect.IsSuccess) { | 
 |  |  | //            result = true; | 
 |  |  | //            OutputQueue.CRN.offer(MessageFormat.format("【{0}】堆垛机plc连接成功 ===>> [id:{1}] [ip:{2}] [port:{3}] [rack:{4}] [slot:{5}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot())); | 
 |  |  | //            log.info("堆垛机plc连接成功 ===>> [id:{}] [ip:{}] [port:{}] [rack:{}] [slot:{}]", slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot()); | 
 |  |  | //        } else { | 
 |  |  | //            OutputQueue.CRN.offer(MessageFormat.format("【{0}】堆垛机plc连接失败!!! ===>> [id:{1}] [ip:{2}] [port:{3}] [rack:{4}] [slot:{5}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot())); | 
 |  |  | //            log.error("堆垛机plc连接失败!!! ===>> [id:{}] [ip:{}] [port:{}] [rack:{}] [slot:{}]", slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot()); | 
 |  |  | ////            DeviceErrorService deviceErrorService = SpringUtils.getBean(DeviceErrorService.class); | 
 |  |  | ////            deviceErrorService.addDeviceError("crn", slave.getId(), "堆垛机plc连接失败"); | 
 |  |  | //            initCrnProtocol(); | 
 |  |  | //        } | 
 |  |  | ////        siemensNet.ConnectClose(); | 
 |  |  | //        return result; | 
 |  |  | //    } | 
 |  |  | // | 
 |  |  | //    /** | 
 |  |  | //     * 读取状态 | 
 |  |  | //     */ | 
 |  |  | //    private void readStatus() { | 
 |  |  | // | 
 |  |  | //        OperateResultExOne<byte[]> result = siemensNet.Read("DB101.0", (short) 56); | 
 |  |  | //        if (result.IsSuccess) { | 
 |  |  | //            if (null == crnProtocol) { | 
 |  |  | //                crnProtocol = new CrnProtocol(); | 
 |  |  | //            } | 
 |  |  | //            crnProtocol.setMode(siemensNet.getByteTransform().TransInt16(result.Content, 0)); | 
 |  |  | //            crnProtocol.setTaskNo(siemensNet.getByteTransform().TransInt16(result.Content, 2)); | 
 |  |  | //            crnProtocol.setStatus(siemensNet.getByteTransform().TransInt16(result.Content, 4)); | 
 |  |  | //            crnProtocol.setBay(siemensNet.getByteTransform().TransInt16(result.Content, 6)); | 
 |  |  | //            crnProtocol.setLevel(siemensNet.getByteTransform().TransInt16(result.Content, 8)); | 
 |  |  | //            crnProtocol.setForkPos(siemensNet.getByteTransform().TransInt16(result.Content, 10)); | 
 |  |  | //            crnProtocol.setLiftPos(siemensNet.getByteTransform().TransInt16(result.Content, 12)); | 
 |  |  | //            crnProtocol.setWalkPos(siemensNet.getByteTransform().TransInt16(result.Content, 14)); | 
 |  |  | //            crnProtocol.setLoaded(siemensNet.getByteTransform().TransInt16(result.Content, 16)); | 
 |  |  | //            crnProtocol.setAlarm(siemensNet.getByteTransform().TransInt16(result.Content, 18)); | 
 |  |  | ////            crnProtocol.setTemp1(siemensNet.getByteTransform().TransInt16(result.Content, 20)); | 
 |  |  | ////            crnProtocol.setTemp2(siemensNet.getByteTransform().TransInt16(result.Content, 22)); | 
 |  |  | ////            crnProtocol.setTemp3(siemensNet.getByteTransform().TransInt16(result.Content, 24)); | 
 |  |  | ////            crnProtocol.setTemp4(siemensNet.getByteTransform().TransInt16(result.Content, 26)); | 
 |  |  | //            crnProtocol.setXSpeed(siemensNet.getByteTransform().TransSingle(result.Content, 28)); | 
 |  |  | //            crnProtocol.setYSpeed(siemensNet.getByteTransform().TransSingle(result.Content, 32)); | 
 |  |  | //            crnProtocol.setZSpeed(siemensNet.getByteTransform().TransSingle(result.Content, 36)); | 
 |  |  | //            crnProtocol.setXDistance(siemensNet.getByteTransform().TransSingle(result.Content, 40)); | 
 |  |  | //            crnProtocol.setYDistance(siemensNet.getByteTransform().TransSingle(result.Content, 44)); | 
 |  |  | //            crnProtocol.setXDuration(siemensNet.getByteTransform().TransSingle(result.Content, 48)); | 
 |  |  | //            crnProtocol.setYDuration(siemensNet.getByteTransform().TransSingle(result.Content, 52)); | 
 |  |  | // | 
 |  |  | // | 
 |  |  | //            OutputQueue.CRN.offer(MessageFormat.format("【{0}】[id:{1}] <<<<< 实时数据更新成功", DateUtils.convert(new Date()), slave.getId())); | 
 |  |  | // | 
 |  |  | //            // 复位信号 | 
 |  |  | //            if (crnProtocol.getTaskFinish() == 0) { | 
 |  |  | //                if (resetFlag) { | 
 |  |  | //                    CrnCommand crnCommand = new CrnCommand(); | 
 |  |  | //                    crnCommand.setAckFinish((short) 1); | 
 |  |  | //                    if (write(crnCommand)) { | 
 |  |  | //                        resetFlag = false; | 
 |  |  | // | 
 |  |  | //                        //堆垛机任务完成后访问wms请求任务完成 locationDone 货位处理完成 | 
 |  |  | //                        TaskWrkService taskWrkService = SpringUtils.getBean(TaskWrkService.class); | 
 |  |  | //                        TaskWrk taskWrk = taskWrkService.selectOne(new EntityWrapper<TaskWrk>().eq("wrk_no", crnProtocol.getTaskNo())); | 
 |  |  | ////                        String tasktype = null; | 
 |  |  | ////                        switch (taskWrk.getIoType()) { | 
 |  |  | ////                            case 1: | 
 |  |  | ////                                tasktype = "RK"; | 
 |  |  | ////                                break; | 
 |  |  | ////                            case 2: | 
 |  |  | ////                                tasktype = "CK"; | 
 |  |  | ////                                break; | 
 |  |  | ////                            case 3: | 
 |  |  | ////                                tasktype = "YK"; | 
 |  |  | ////                                break; | 
 |  |  | ////                            default: | 
 |  |  | ////                                tasktype = "未知"; | 
 |  |  | ////                        } | 
 |  |  | ////                        Map<String, Object> map = new HashMap<>(); | 
 |  |  | ////                        map.put("x-api-key", "7a15b5db-29b6-552c-8cff-0cfec3756da2"); | 
 |  |  | ////                        TaskOverToWms taskOverToWms = new TaskOverToWms(); | 
 |  |  | ////                        taskOverToWms.setFeedbackFrom("WCS"); //来源 | 
 |  |  | ////                        taskOverToWms.setWarehouseId("1688469798893297665"); //仓库标识 | 
 |  |  | ////                        taskOverToWms.setTaskNo(taskWrk.getTaskNo()); //任务号 | 
 |  |  | ////                        taskOverToWms.setTaskType(tasktype); // 任务类型 | 
 |  |  | ////                        taskOverToWms.setContainerCode(taskWrk.getBarcode()); // 容器编码 | 
 |  |  | ////                        if (taskWrk.getIoType() == 1) { | 
 |  |  | ////                            taskOverToWms.setEquipmentCode(String.valueOf(taskWrk.getCrnNo())); //设备编码 | 
 |  |  | ////                            taskOverToWms.setTargetLocationCode(taskWrk.getOriginTargetPoint()); //目标库位 | 
 |  |  | ////                        } else if (taskWrk.getIoType() == 2) { | 
 |  |  | ////                            Map<Integer, String> map1 = new HashMap<>(); | 
 |  |  | ////                            map1.put(102, "J-1101"); | 
 |  |  | ////                            map1.put(106, "J-1103"); | 
 |  |  | ////                            map1.put(110, "J-1105"); | 
 |  |  | ////                            map1.put(114, "J-1107"); | 
 |  |  | ////                            map1.put(118, "J-1109"); | 
 |  |  | ////                            map1.put(122, "J-1111"); | 
 |  |  | ////                            map1.put(305, "H-1101"); | 
 |  |  | ////                            map1.put(405, "G-1101"); | 
 |  |  | ////                            taskOverToWms.setEquipmentCode(map1.get(taskWrk.getTargetPoint())); //设备编码 | 
 |  |  | ////                            taskOverToWms.setSourceLocationCode(taskWrk.getOriginStartPoint()); //源库位 | 
 |  |  | ////                        } else if (taskWrk.getIoType() == 3) { | 
 |  |  | ////                            taskOverToWms.setEquipmentCode(String.valueOf(taskWrk.getCrnNo())); //设备编码 | 
 |  |  | ////                            taskOverToWms.setSourceLocationCode(taskWrk.getOriginStartPoint()); | 
 |  |  | ////                            taskOverToWms.setTargetLocationCode(taskWrk.getOriginTargetPoint()); //目标库位 | 
 |  |  | ////                        } | 
 |  |  | ////                        taskOverToWms.setTaskStatus("location_done"); //任务状态 | 
 |  |  | ////                        String response = null; | 
 |  |  | ////                        try { | 
 |  |  | ////                            response = new HttpHandler.Builder() | 
 |  |  | ////                                    .setHeaders(map) | 
 |  |  | ////                                    .setUri("10.32.53.195:8080") | 
 |  |  | ////                                    .setPath("wcsManager/wcsInterface/taskStatusFeedback") | 
 |  |  | ////                                    .setJson(JSON.toJSONString(taskOverToWms)) | 
 |  |  | ////                                    .build() | 
 |  |  | ////                                    .doPost(); | 
 |  |  | ////                        } catch (Exception e) { | 
 |  |  | ////                            log.error("堆垛机任务完成,请求wms任务完成接口失败"); | 
 |  |  | ////                        } | 
 |  |  | ////                        ApiLogService apiLogService = SpringUtils.getBean(ApiLogService.class); | 
 |  |  | ////                        apiLogService.save("Wms任务完成接口" | 
 |  |  | ////                                , "10.32.53.195:8080" + "/wcsManager/wcsInterface/taskStatusFeedback" | 
 |  |  | ////                                , null | 
 |  |  | ////                                , "127.0.0.1" | 
 |  |  | ////                                , JSON.toJSONString(taskOverToWms) | 
 |  |  | ////                                , response | 
 |  |  | ////                                , true | 
 |  |  | ////                        ); | 
 |  |  | ////                        JSONObject jsonObject = JSON.parseObject(response); | 
 |  |  | ////                        if (jsonObject.getInteger("code").equals(200)) { | 
 |  |  | //                            if (taskWrk.getIoType() == 3) { | 
 |  |  | //                                taskWrk.setWrkSts(4); | 
 |  |  | //                            } | 
 |  |  | //                            taskWrk.setStatus(5); | 
 |  |  | //                            if (!taskWrkService.update(taskWrk, new EntityWrapper<TaskWrk>().eq("wrk_no", crnProtocol.getTaskNo()))) { | 
 |  |  | //                                log.error("堆垛机任务完成,改变任务状态失败"); | 
 |  |  | //                            } | 
 |  |  | // | 
 |  |  | //                            log.info("堆垛机任务完成,请求wms任务完成接口成功"); | 
 |  |  | //                        } else { | 
 |  |  | //                            log.error("堆垛机任务完成,请求wms任务完成接口完成,但返回失败"); | 
 |  |  | //                        } | 
 |  |  | // | 
 |  |  | ////                    } | 
 |  |  | // | 
 |  |  | // | 
 |  |  | //                } | 
 |  |  | //            } | 
 |  |  | // | 
 |  |  | //            try { | 
 |  |  | //                // 根据实时信息更新数据库 | 
 |  |  | //                BasCrnpService basCrnpService = SpringUtils.getBean(BasCrnpService.class); | 
 |  |  | //                BasCrnp basCrnp = new BasCrnp(); | 
 |  |  | //                basCrnp.setCrnNo(slave.getId()); | 
 |  |  | //                basCrnp.setCrnSts((int) crnProtocol.getMode()); | 
 |  |  | //                if (!basCrnpService.updateById(crnProtocol.toSqlModel(basCrnp))) { | 
 |  |  | //                    log.error("堆垛机plc数据库更新失败 ===>> [id:{}] [ip:{}] [port:{}] [rack:{}] [slot:{}]", slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot()); | 
 |  |  | //                } | 
 |  |  | //            } catch (Exception ignore) { | 
 |  |  | //            } | 
 |  |  | // | 
 |  |  | //            DeviceErrorService deviceErrorService = SpringUtils.getBean(DeviceErrorService.class); | 
 |  |  | //            deviceErrorService.deleteDeviceError("crn", slave.getId()); | 
 |  |  | //        } else { | 
 |  |  | //            OutputQueue.CRN.offer(MessageFormat.format("【{0}】读取堆垛机plc状态信息失败 ===>> [id:{1}] [ip:{2}] [port:{3}] [rack:{4}] [slot:{5}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot())); | 
 |  |  | //            log.error("读取堆垛机plc状态信息失败 ===>> [id:{}] [ip:{}] [port:{}] [rack:{}] [slot:{}]", slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot()); | 
 |  |  | //            DeviceErrorService deviceErrorService = SpringUtils.getBean(DeviceErrorService.class); | 
 |  |  | //            deviceErrorService.addDeviceError("crn", slave.getId(), "读取堆垛机plc状态信息失败"); | 
 |  |  | //        } | 
 |  |  | //    } | 
 |  |  | // | 
 |  |  | //    /** | 
 |  |  | //     * 写入数据 | 
 |  |  | //     */ | 
 |  |  | //    private boolean write(CrnCommand command) { | 
 |  |  | //        if (null == command) { | 
 |  |  | //            log.error("堆垛机写入命令为空"); | 
 |  |  | //            return false; | 
 |  |  | //        } | 
 |  |  | //        //转换前克隆一份 | 
 |  |  | //        CrnCommand crnCommand = new CrnCommand(); | 
 |  |  | //        crnCommand.setCrnNo(command.getCrnNo()); | 
 |  |  | //        crnCommand.setAckFinish(command.getAckFinish()); | 
 |  |  | //        crnCommand.setTaskNo(command.getTaskNo()); | 
 |  |  | //        crnCommand.setTaskMode(command.getTaskMode()); | 
 |  |  | //        crnCommand.setSourcePosX(command.getSourcePosX()); | 
 |  |  | //        crnCommand.setSourcePosY(command.getSourcePosY()); | 
 |  |  | //        crnCommand.setSourcePosZ(command.getSourcePosZ()); | 
 |  |  | //        crnCommand.setDestinationPosX(command.getDestinationPosX()); | 
 |  |  | //        crnCommand.setDestinationPosY(command.getDestinationPosY()); | 
 |  |  | //        crnCommand.setDestinationPosZ(command.getDestinationPosZ()); | 
 |  |  | ////        crnCommand.setSourceStaNo(command.getSourceStaNo()); | 
 |  |  | ////        crnCommand.setDestinationStaNo(command.getDestinationStaNo()); | 
 |  |  | //        crnCommand.setCommand(command.getCommand()); | 
 |  |  | //        if (command.getTaskNo() == 0 && command.getAckFinish() == 0 && command.getAuto() != 1) { | 
 |  |  | //            command.setTaskNo((short) 999); | 
 |  |  | //        } | 
 |  |  | // | 
 |  |  | //        command.setCrnNo(slave.getId()); | 
 |  |  | //        short[] array = new short[10]; | 
 |  |  | //        array[0] = command.getAckFinish(); | 
 |  |  | //        array[1] = command.getTaskNo(); | 
 |  |  | //        array[2] = command.getTaskMode(); | 
 |  |  | //        array[3] = command.getSourcePosX(); | 
 |  |  | //        array[4] = command.getSourcePosY(); | 
 |  |  | //        array[5] = command.getSourcePosZ(); | 
 |  |  | //        array[6] = command.getDestinationPosX(); | 
 |  |  | //        array[7] = command.getDestinationPosY(); | 
 |  |  | //        array[8] = command.getDestinationPosZ(); | 
 |  |  | //        array[9] = command.getCommand(); | 
 |  |  | // | 
 |  |  | //        // 作业信息 | 
 |  |  | //        OperateResult result = siemensNet.Write("DB100.0", array); | 
 |  |  | // | 
 |  |  | // | 
 |  |  | //        if (result.IsSuccess) { | 
 |  |  | //            log.warn("堆垛机命令下发[id:{},时间:{}] >>>>> {}", slave.getId(), DateUtils.convert(new Date(), DateUtils.yyyyMMddHHmmsssss_F), JSON.toJSON(command)); | 
 |  |  | //            OutputQueue.CRN.offer(MessageFormat.format("【{0}】[id:{1}] >>>>> 命令下发: {2}", DateUtils.convert(new Date()), slave.getId(), JSON.toJSON(command))); | 
 |  |  | //            return true; | 
 |  |  | //        } else { | 
 |  |  | //            OutputQueue.CRN.offer(MessageFormat.format("【{0}】写入堆垛机plc数据失败 ===>> [id:{1}] [ip:{2}] [port:{3}] [rack:{4}] [slot:{5}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot())); | 
 |  |  | //            log.error("写入堆垛机plc数据失败 ===>> [id:{}] [ip:{}] [port:{}] [rack:{}] [slot:{}]", slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot()); | 
 |  |  | //            return false; | 
 |  |  | //        } | 
 |  |  | //    } | 
 |  |  | // | 
 |  |  | //    /** | 
 |  |  | //     * 写入数据 | 
 |  |  | //     */ | 
 |  |  | //    private boolean write5(CrnCommand command) throws InterruptedException { | 
 |  |  | //        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName(); | 
 |  |  | // | 
 |  |  | //        if (null == command) { | 
 |  |  | //            log.error("堆垛机写入命令为空"); | 
 |  |  | //            return false; | 
 |  |  | //        } | 
 |  |  | ////        convertRow(command); | 
 |  |  | //        command.setCrnNo(slave.getId()); | 
 |  |  | //        short[] array = new short[10]; | 
 |  |  | //        array[0] = command.getAckFinish(); | 
 |  |  | //        array[1] = command.getTaskNo(); | 
 |  |  | //        array[2] = command.getTaskMode(); | 
 |  |  | //        array[3] = command.getSourcePosX(); | 
 |  |  | //        array[4] = command.getSourcePosY(); | 
 |  |  | //        array[5] = command.getSourcePosZ(); | 
 |  |  | //        array[6] = command.getDestinationPosX(); | 
 |  |  | //        array[7] = command.getDestinationPosY(); | 
 |  |  | //        array[8] = command.getDestinationPosZ(); | 
 |  |  | ////        array[9] = command.getSourceStaNo(); | 
 |  |  | ////        array[10] = command.getDestinationStaNo(); | 
 |  |  | //        array[9] = command.getCommand(); | 
 |  |  | // | 
 |  |  | //        OperateResult result = siemensNet.Write("DB100.0", array); | 
 |  |  | // | 
 |  |  | //        int i = 0; | 
 |  |  | //        do { | 
 |  |  | //            //堆垛机任务写入后,回读一次,看是否成功 | 
 |  |  | //            Thread.sleep(200); | 
 |  |  | //            OperateResultExOne<byte[]> resultRead = siemensNet.Read("DB100.0", (short) 20); | 
 |  |  | //            if (resultRead.IsSuccess) { | 
 |  |  | //                CrnCommand one = new CrnCommand(); | 
 |  |  | //                one.setTaskNo(siemensNet.getByteTransform().TransInt16(resultRead.Content, 2)); | 
 |  |  | //                one.setTaskMode(siemensNet.getByteTransform().TransInt16(resultRead.Content, 4)); | 
 |  |  | //                one.setSourcePosX(siemensNet.getByteTransform().TransInt16(resultRead.Content, 6)); | 
 |  |  | //                one.setSourcePosY(siemensNet.getByteTransform().TransInt16(resultRead.Content, 8)); | 
 |  |  | //                one.setSourcePosZ(siemensNet.getByteTransform().TransInt16(resultRead.Content, 10)); | 
 |  |  | //                one.setDestinationPosX(siemensNet.getByteTransform().TransInt16(resultRead.Content, 12)); | 
 |  |  | //                one.setDestinationPosY(siemensNet.getByteTransform().TransInt16(resultRead.Content, 14)); | 
 |  |  | //                one.setDestinationPosZ(siemensNet.getByteTransform().TransInt16(resultRead.Content, 16)); | 
 |  |  | //                if (!command.getTaskNo().equals(one.getTaskNo()) || !command.getTaskMode().equals(one.getTaskMode()) | 
 |  |  | //                        || !command.getSourcePosX().equals(one.getSourcePosX()) || !command.getSourcePosY().equals(one.getSourcePosY()) | 
 |  |  | //                        || !command.getSourcePosZ().equals(one.getSourcePosZ()) || !command.getDestinationPosX().equals(one.getDestinationPosX()) | 
 |  |  | //                        || !command.getDestinationPosY().equals(one.getDestinationPosY()) || !command.getDestinationPosZ().equals(one.getDestinationPosZ()) | 
 |  |  | //                ) { | 
 |  |  | //                    i++; | 
 |  |  | //                    log.error("堆垛机命令地址写入后回读失败[id:{}]>>>>重写[{}] >>>>> 写入[{}],===>>回读[{}]", slave.getId(), i, JSON.toJSON(command), JSON.toJSON(one)); | 
 |  |  | //                    result = siemensNet.Write("DB100.0", array); | 
 |  |  | //                } else { | 
 |  |  | //                    i = 5; | 
 |  |  | //                } | 
 |  |  | //            } | 
 |  |  | //        } while (i < 5); | 
 |  |  | // | 
 |  |  | // | 
 |  |  | //        try { | 
 |  |  | //            // 日志记录 | 
 |  |  | //            BasCrnOptService bean = SpringUtils.getBean(BasCrnOptService.class); | 
 |  |  | //            BasCrnOpt basCrnOpt = new BasCrnOpt( | 
 |  |  | //                    command.getTaskNo().intValue(),    // 任务号 | 
 |  |  | //                    command.getCrnNo(),    // 堆垛机[非空] | 
 |  |  | //                    new Date(),    // 下发时间 | 
 |  |  | //                    command.getTaskModeType().toString(),    // 模式 | 
 |  |  | //                    command.getSourcePosX().intValue(),    // 源排 | 
 |  |  | //                    command.getSourcePosY().intValue(),    // 源列 | 
 |  |  | //                    command.getSourcePosZ().intValue(),    // 源层 | 
 |  |  | //                    null,    // 源站 | 
 |  |  | //                    command.getDestinationPosX().intValue(),    // 目标排 | 
 |  |  | //                    command.getDestinationPosY().intValue(),    // 目标列 | 
 |  |  | //                    command.getDestinationPosZ().intValue(),    // 目标层 | 
 |  |  | //                    null,    // 目标站 | 
 |  |  | //                    null,    // 响应结果 | 
 |  |  | //                    null,    // 修改时间 | 
 |  |  | //                    null    // 修改人员 | 
 |  |  | //            ); | 
 |  |  | //            bean.insert(basCrnOpt); | 
 |  |  | //        } catch (Exception ignore) { | 
 |  |  | //        } | 
 |  |  | // | 
 |  |  | //        if (result != null && result.IsSuccess) { | 
 |  |  | //            Thread.sleep(200); | 
 |  |  | //            this.readStatus(); | 
 |  |  | //            log.info(methodName + ":堆垛机命令下发[id:{}] >>>>> {}", slave.getId(), JSON.toJSON(command)); | 
 |  |  | //            OutputQueue.CRN.offer(MessageFormat.format("【{0}】[id:{1}] >>>>> 命令下发: {2}", DateUtils.convert(new Date()), slave.getId(), JSON.toJSON(command))); | 
 |  |  | //            return true; | 
 |  |  | //        } else { | 
 |  |  | //            OutputQueue.CRN.offer(MessageFormat.format("【{0}】写入堆垛机plc数据失败 ===>> [id:{1}] [ip:{2}] [port:{3}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort())); | 
 |  |  | //            log.error(methodName + ":写入堆垛机plc数据失败 ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort()); | 
 |  |  | //            return false; | 
 |  |  | //        } | 
 |  |  | //    } | 
 |  |  | // | 
 |  |  | //    /** | 
 |  |  | //     * 写入数据 | 
 |  |  | //     */ | 
 |  |  | //    private boolean write2(CrnCommand command) { | 
 |  |  | //        if (null == command) { | 
 |  |  | //            log.error("堆垛机写入命令为空"); | 
 |  |  | //            return false; | 
 |  |  | //        } | 
 |  |  | //        //转换前克隆一份 | 
 |  |  | //        CrnCommand crnCommand = new CrnCommand(); | 
 |  |  | //        crnCommand.setCrnNo(command.getCrnNo()); | 
 |  |  | //        crnCommand.setAckFinish(command.getAckFinish()); | 
 |  |  | //        crnCommand.setTaskNo(command.getTaskNo()); | 
 |  |  | //        crnCommand.setTaskMode(command.getTaskMode()); | 
 |  |  | //        crnCommand.setSourcePosX(command.getSourcePosX()); | 
 |  |  | //        crnCommand.setSourcePosY(command.getSourcePosY()); | 
 |  |  | //        crnCommand.setSourcePosZ(command.getSourcePosZ()); | 
 |  |  | //        crnCommand.setDestinationPosX(command.getDestinationPosX()); | 
 |  |  | //        crnCommand.setDestinationPosY(command.getDestinationPosY()); | 
 |  |  | //        crnCommand.setDestinationPosZ(command.getDestinationPosZ()); | 
 |  |  | ////        crnCommand.setSourceStaNo(command.getSourceStaNo()); | 
 |  |  | ////        crnCommand.setDestinationStaNo(command.getDestinationStaNo()); | 
 |  |  | //        crnCommand.setCommand(command.getCommand()); | 
 |  |  | //        if (command.getTaskNo() == 0 && command.getAckFinish() == 0 && command.getAuto() != 1) { | 
 |  |  | //            command.setTaskNo((short) 999); | 
 |  |  | //        } | 
 |  |  | // | 
 |  |  | //        command.setCrnNo(slave.getId()); | 
 |  |  | //        short[] array = new short[10]; | 
 |  |  | //        if (Cools.isEmpty(command.getAckFinish())) { | 
 |  |  | //            array[0] = 5; | 
 |  |  | //        } else { | 
 |  |  | //            array[0] = command.getAckFinish(); | 
 |  |  | //        } | 
 |  |  | //        array[1] = command.getTaskNo(); | 
 |  |  | //        array[2] = command.getTaskMode(); | 
 |  |  | //        array[3] = command.getSourcePosX(); | 
 |  |  | //        array[4] = command.getSourcePosY(); | 
 |  |  | //        array[5] = command.getSourcePosZ(); | 
 |  |  | //        array[6] = command.getDestinationPosX(); | 
 |  |  | //        array[7] = command.getDestinationPosY(); | 
 |  |  | //        array[8] = command.getDestinationPosZ(); | 
 |  |  | //        array[9] = command.getCommand(); | 
 |  |  | //        // 作业信息 | 
 |  |  | //        OperateResult result = siemensNet.Write("DB100.0", array); | 
 |  |  | //        // 日志记录 | 
 |  |  | //        if (command.getAckFinish() != 1) { | 
 |  |  | //            BasCrnOptService bean = SpringUtils.getBean(BasCrnOptService.class); | 
 |  |  | //            BasCrnOpt basCrnOpt = new BasCrnOpt( | 
 |  |  | //                    command.getTaskNo().intValue(),    // 任务号 | 
 |  |  | //                    command.getCrnNo(),    // 堆垛机[非空] | 
 |  |  | //                    new Date(),    // 下发时间 | 
 |  |  | //                    command.getTaskModeType() == null ? null : command.getTaskModeType().toString(),    // 模式 | 
 |  |  | //                    command.getSourcePosX().intValue(),    // 源排 | 
 |  |  | //                    command.getSourcePosY().intValue(),    // 源列 | 
 |  |  | //                    command.getSourcePosZ().intValue(),    // 源层 | 
 |  |  | //                    null,    // 源站 | 
 |  |  | //                    command.getDestinationPosX().intValue(),    // 目标排 | 
 |  |  | //                    command.getDestinationPosY().intValue(),    // 目标列 | 
 |  |  | //                    command.getDestinationPosZ().intValue(),    // 目标层 | 
 |  |  | //                    null,    // 目标站 | 
 |  |  | //                    null,    // 响应结果 | 
 |  |  | //                    null,    // 修改时间 | 
 |  |  | //                    null    // 修改人员 | 
 |  |  | //            ); | 
 |  |  | //            bean.insert(basCrnOpt); | 
 |  |  | //        } | 
 |  |  | ////        } catch (Exception ignore) {} | 
 |  |  | // | 
 |  |  | //        //更新命令日志 | 
 |  |  | //        CommandInfoLogService commandInfoLogService = SpringUtils.getBean(CommandInfoLogService.class); | 
 |  |  | //        CommandInfoService commandInfoService = SpringUtils.getBean(CommandInfoService.class); | 
 |  |  | //        CommandInfo commandInfo = commandInfoService.selectById(command.getCommandId()); | 
 |  |  | //        if (Cools.isEmpty(commandInfo)) { | 
 |  |  | //            commandInfo = commandInfoService.selectOne(new EntityWrapper<CommandInfo>() | 
 |  |  | //                    .eq("wrk_no", crnProtocol.getTaskNo()) | 
 |  |  | //                    .eq("device", "Crn")); | 
 |  |  | //        } | 
 |  |  | //        CommandInfoLog commandInfoLog = JSON.parseObject(JSON.toJSONString(commandInfo), CommandInfoLog.class); | 
 |  |  | //        commandInfoLog.setId(null); | 
 |  |  | //        if (result.IsSuccess) { | 
 |  |  | //            Date now = new Date(); | 
 |  |  | //            //更新指令日志 | 
 |  |  | //            commandInfoLog.setDeviceLog("指令下发成功"); | 
 |  |  | //            commandInfoLogService.insert(commandInfoLog); | 
 |  |  | // | 
 |  |  | //            //线程暂存指令ID | 
 |  |  | //            crnProtocol.setCommandId(command.getCommandId()); | 
 |  |  | // | 
 |  |  | //            //更新指令状态 | 
 |  |  | //            commandInfo.setCommandStatus(CommandStatusType.EXECUTE.id);//执行中 | 
 |  |  | //            commandInfo.setExecuteTime(now); | 
 |  |  | //            commandInfoService.updateById(commandInfo); | 
 |  |  | // | 
 |  |  | //            //更新任务步序 | 
 |  |  | //            TaskWrkService taskWrkService = SpringUtils.getBean(TaskWrkService.class); | 
 |  |  | //            TaskWrk taskWrk = taskWrkService.selectByWrkNo(command.getTaskNo().intValue()); | 
 |  |  | //            if (taskWrk != null) { | 
 |  |  | //                taskWrk.setCommandStep(taskWrk.getCommandStep() + 1);//更新指令步序 | 
 |  |  | //                taskWrkService.updateById(taskWrk); | 
 |  |  | //            } | 
 |  |  | // | 
 |  |  | // | 
 |  |  | //        } else { | 
 |  |  | //            OutputQueue.CRN.offer(MessageFormat.format("【{0}】写入堆垛机plc数据失败 ===>> [id:{1}] [ip:{2}] [port:{3}] [rack:{4}] [slot:{5}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot())); | 
 |  |  | //            log.error("写入堆垛机plc数据失败 ===>> [id:{}] [ip:{}] [port:{}] [rack:{}] [slot:{}]", slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot()); | 
 |  |  | //        } | 
 |  |  | //        return true; | 
 |  |  | //    } | 
 |  |  | // | 
 |  |  | //    private boolean writeAuto(CrnCommand command) { | 
 |  |  | //        if (null == command) { | 
 |  |  | //            log.error("堆垛机写入命令为空"); | 
 |  |  | //            return false; | 
 |  |  | //        } | 
 |  |  | //        OperateResult result = new OperateResult(); | 
 |  |  | //        short[] array = new short[1]; | 
 |  |  | //        array[0] = command.getAuto(); | 
 |  |  | //        if (command.getAuto() != 0) { | 
 |  |  | //            array[0] = command.getAuto(); | 
 |  |  | //            result = siemensNet.Write("DB103.0", array); | 
 |  |  | //        } else if (command.getOnlineWrk1() != 0) { | 
 |  |  | //            array[0] = command.getOnlineWrk1(); | 
 |  |  | //            result = siemensNet.Write("DB103.2", array); | 
 |  |  | //        } else if (command.getOnlineWrk2() != 0) { | 
 |  |  | //            array[0] = command.getOnlineWrk2(); | 
 |  |  | //            result = siemensNet.Write("DB103.4", array); | 
 |  |  | //        } else if (command.getOnlineWrk3() != 0) { | 
 |  |  | //            array[0] = command.getOnlineWrk3(); | 
 |  |  | //            result = siemensNet.Write("DB103.6", array); | 
 |  |  | //        } else if (command.getOnlineWrk4() != 0) { | 
 |  |  | //            array[0] = command.getOnlineWrk4(); | 
 |  |  | //            result = siemensNet.Write("DB103.8", array); | 
 |  |  | //        } else if (command.getReset() != 0) { | 
 |  |  | //            array[0] = command.getReset(); | 
 |  |  | //            result = siemensNet.Write("DB103.10", array); | 
 |  |  | //        } | 
 |  |  | // | 
 |  |  | // | 
 |  |  | //        if (result.IsSuccess) { | 
 |  |  | //            log.warn("堆垛机命令下发[id:{},时间:{}] >>>>> {}", slave.getId(), DateUtils.convert(new Date(), DateUtils.yyyyMMddHHmmsssss_F), JSON.toJSON(command)); | 
 |  |  | //            OutputQueue.CRN.offer(MessageFormat.format("【{0}】[id:{1}] >>>>> 命令下发: {2}", DateUtils.convert(new Date()), slave.getId(), JSON.toJSON(command))); | 
 |  |  | // | 
 |  |  | // | 
 |  |  | //            return true; | 
 |  |  | //        } else { | 
 |  |  | //            OutputQueue.CRN.offer(MessageFormat.format("【{0}】写入堆垛机plc数据失败 ===>> [id:{1}] [ip:{2}] [port:{3}] [rack:{4}] [slot:{5}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot())); | 
 |  |  | //            log.error("写入堆垛机plc数据失败 ===>> [id:{}] [ip:{}] [port:{}] [rack:{}] [slot:{}]", slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot()); | 
 |  |  | // | 
 |  |  | //            return false; | 
 |  |  | //        } | 
 |  |  | //    } | 
 |  |  | // | 
 |  |  | //    /******************************************************************************************/ | 
 |  |  | //    /**************************************** 测试专用 *****************************************/ | 
 |  |  | // | 
 |  |  | //    @Override | 
 |  |  | //    public void close() { | 
 |  |  | //        siemensNet.ConnectClose(); | 
 |  |  | //    } | 
 |  |  | // | 
 |  |  | //} | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.acs.wcs.core.thread; | 
 |  |  |  | 
 |  |  | import HslCommunication.Core.Types.OperateResult; | 
 |  |  | import HslCommunication.Core.Types.OperateResultExOne; | 
 |  |  | import HslCommunication.Profinet.Siemens.SiemensPLCS; | 
 |  |  | import HslCommunication.Profinet.Siemens.SiemensS7Net; | 
 |  |  | import com.alibaba.fastjson.JSON; | 
 |  |  | import com.core.common.Cools; | 
 |  |  | import com.core.common.DateUtils; | 
 |  |  | import com.core.common.SpringUtils; | 
 |  |  | import com.core.exception.CoolException; | 
 |  |  | import com.zy.asrs.entity.BasDevp; | 
 |  |  | import com.zy.asrs.service.BasDevpService; | 
 |  |  | import com.zy.asrs.service.DeviceErrorService; | 
 |  |  | import com.zy.acs.wcs.core.DevpThread; | 
 |  |  | import com.zy.acs.wcs.core.cache.MessageQueue; | 
 |  |  | import com.zy.acs.wcs.core.cache.OutputQueue; | 
 |  |  | import com.zy.acs.wcs.core.cache.SlaveConnection; | 
 |  |  | import com.zy.acs.wcs.core.enums.IoModeType; | 
 |  |  | import com.zy.acs.wcs.core.enums.SlaveType; | 
 |  |  | import com.zy.acs.wcs.core.model.DevpSlave; | 
 |  |  | import com.zy.acs.wcs.core.model.Task; | 
 |  |  | import com.zy.acs.wcs.core.model.protocol.StaProtocol; | 
 |  |  | import lombok.Data; | 
 |  |  | import lombok.extern.slf4j.Slf4j; | 
 |  |  |  | 
 |  |  | import java.text.MessageFormat; | 
 |  |  | import java.util.*; | 
 |  |  | import java.util.concurrent.ConcurrentHashMap; | 
 |  |  | import java.util.stream.Collectors; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * 输送线线程 | 
 |  |  |  * Created by vincent on 2020/8/4 | 
 |  |  |  */ | 
 |  |  | @Data | 
 |  |  | @Slf4j | 
 |  |  | public class SiemensDevpThread implements Runnable, DevpThread { | 
 |  |  |  | 
 |  |  |     public static final ArrayList<Integer> staNos1 = new ArrayList<Integer>() {{ | 
 |  |  |         add(101); | 
 |  |  |         add(102); | 
 |  |  |         add(103); | 
 |  |  |         add(104); | 
 |  |  |         add(105); | 
 |  |  |         add(106); | 
 |  |  |         add(107); | 
 |  |  |         add(108); | 
 |  |  |         add(109); | 
 |  |  |         add(110); | 
 |  |  |         add(111); | 
 |  |  |         add(112); | 
 |  |  |         add(113); | 
 |  |  |         add(114); | 
 |  |  |         add(115); | 
 |  |  |         add(116); // 侧面从 index 16开始 长度12 | 
 |  |  |         add(201); | 
 |  |  |         add(202); | 
 |  |  |         add(203); | 
 |  |  |         add(204); | 
 |  |  |         add(205); | 
 |  |  |         add(206); | 
 |  |  |         add(207); | 
 |  |  |         add(208); | 
 |  |  |         add(209); | 
 |  |  |         add(210); | 
 |  |  |         add(211); | 
 |  |  |         add(212); | 
 |  |  |     }}; | 
 |  |  |  | 
 |  |  |     public static final ArrayList<Integer> staNos2 = new ArrayList<Integer>() {{ | 
 |  |  |         add(301); | 
 |  |  |         add(302); | 
 |  |  |         add(303); | 
 |  |  |         add(304); | 
 |  |  |         add(305); | 
 |  |  |         add(306); | 
 |  |  |         add(307); | 
 |  |  |         add(308); | 
 |  |  |     }}; | 
 |  |  |  | 
 |  |  |     // 正面5个条码扫描站 | 
 |  |  |     public static final ArrayList<Integer> barcodeSite2 = new ArrayList<Integer>() {{ | 
 |  |  |         add(102); | 
 |  |  |         add(105); | 
 |  |  |         add(108); | 
 |  |  |         add(111); | 
 |  |  |         add(114); | 
 |  |  |     }}; | 
 |  |  |  | 
 |  |  |     // 侧面三个条码扫描站 | 
 |  |  |     public static final ArrayList<Integer> barcodeSite = new ArrayList<Integer>() {{ | 
 |  |  |         add(202); | 
 |  |  |         add(206); | 
 |  |  |         add(211); | 
 |  |  |     }}; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 入出库模式 | 
 |  |  |      * 0:未知 | 
 |  |  |      * 1:入库启动中 | 
 |  |  |      * 2.入库模式 | 
 |  |  |      * 3.出库启动中 (不能生成入库工作档) | 
 |  |  |      * 4.出库模式 | 
 |  |  |      */ | 
 |  |  |     public IoModeType ioModeOf1F1 = IoModeType.NONE; | 
 |  |  |     public IoModeType ioModeOf1F2 = IoModeType.NONE; | 
 |  |  |     public IoModeType ioModeOf1F3 = IoModeType.NONE; | 
 |  |  |     public IoModeType ioModeOf1F4 = IoModeType.NONE; | 
 |  |  |     public IoModeType ioModeOf1F5 = IoModeType.NONE; | 
 |  |  |  | 
 |  |  |     public IoModeType ioModeOf2F1 = IoModeType.NONE; | 
 |  |  |     public IoModeType ioModeOf2F2 = IoModeType.NONE; | 
 |  |  |     public IoModeType ioModeOf2F3 = IoModeType.NONE; | 
 |  |  |  | 
 |  |  |     private DevpSlave slave; | 
 |  |  |     private SiemensS7Net siemensS7Net; | 
 |  |  |     private Map<Integer, StaProtocol> station = new ConcurrentHashMap<>(); | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 条码数量 | 
 |  |  |      */ | 
 |  |  |     private int barcodeSize = 8; | 
 |  |  |  | 
 |  |  |     public SiemensDevpThread(DevpSlave slave) { | 
 |  |  |         this.slave = slave; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     private ArrayList<Integer> getStaNo() { | 
 |  |  |         switch (slave.getId()) { | 
 |  |  |             case 1: | 
 |  |  |                 return staNos1; | 
 |  |  |             case 2: | 
 |  |  |                 return staNos2; | 
 |  |  |             default: | 
 |  |  |                 throw new CoolException("服务器异常"); | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @Override | 
 |  |  |     @SuppressWarnings("InfiniteLoopStatement") | 
 |  |  |     public void run() { | 
 |  |  |         connect(); | 
 |  |  |         while (true) { | 
 |  |  |             try { | 
 |  |  |                 int step = 1; | 
 |  |  |                 Task task = MessageQueue.poll(SlaveType.Devp, slave.getId()); | 
 |  |  |                 if (task != null) { | 
 |  |  |                     step = task.getStep(); | 
 |  |  |                 } | 
 |  |  |                 switch (step) { | 
 |  |  |                     // 读数据 | 
 |  |  |                     case 1: | 
 |  |  |                         read(); | 
 |  |  |                         break; | 
 |  |  |                     // 写数据 ID+目标站 | 
 |  |  |                     case 2: | 
 |  |  |                         write((StaProtocol) task.getData()); | 
 |  |  |                         read(); | 
 |  |  |                         break; | 
 |  |  |                     default: | 
 |  |  |                         break; | 
 |  |  |                 } | 
 |  |  |                 Thread.sleep(400); | 
 |  |  |             } catch (Exception e) { | 
 |  |  |                 e.printStackTrace(); | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 初始化站点状态 | 
 |  |  |      */ | 
 |  |  |     private void initSite() { | 
 |  |  |         ArrayList<Integer> staNos = getStaNo(); | 
 |  |  |         // 站点编号 | 
 |  |  |         for (Integer siteId : staNos) { | 
 |  |  |             StaProtocol staProtocol = station.get(siteId); | 
 |  |  |             if (null == staProtocol) { | 
 |  |  |                 staProtocol = new StaProtocol(); | 
 |  |  |                 staProtocol.setSiteId(siteId); | 
 |  |  |                 station.put(siteId, staProtocol); | 
 |  |  |             } | 
 |  |  |             staProtocol.setWorkNo((short) 0);    // ID | 
 |  |  |             staProtocol.setAutoing(false);      // 自动 | 
 |  |  |             staProtocol.setLoading(false);      // 有物 | 
 |  |  |             staProtocol.setInEnable(false);     // 可入 | 
 |  |  |             staProtocol.setOutEnable(false);    // 可出 | 
 |  |  |             staProtocol.setEmptyMk(false);      // 空板信号 | 
 |  |  |             staProtocol.setStaNo((short) 0);     // 目标站 | 
 |  |  |  | 
 |  |  |             if (!staProtocol.isPakMk() && !staProtocol.isLoading()) { | 
 |  |  |                 staProtocol.setPakMk(true); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     @Override | 
 |  |  |     public boolean connect() { | 
 |  |  |         boolean result = false; | 
 |  |  |         siemensS7Net = new SiemensS7Net(SiemensPLCS.S1200, slave.getIp()); | 
 |  |  |         siemensS7Net.setRack(slave.getRack().byteValue()); | 
 |  |  |         siemensS7Net.setSlot(slave.getSlot().byteValue()); | 
 |  |  |         OperateResult connect = siemensS7Net.ConnectServer(); | 
 |  |  |         if (connect.IsSuccess) { | 
 |  |  |             result = true; | 
 |  |  |             OutputQueue.DEVP.offer(MessageFormat.format("【{0}】输送线plc连接成功 ===>> [id:{1}] [ip:{2}] [port:{3}] [rack:{4}] [slot:{5}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot())); | 
 |  |  |             log.info("输送线plc连接成功 ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort()); | 
 |  |  |         } else { | 
 |  |  |             OutputQueue.DEVP.offer(MessageFormat.format("【{0}】输送线plc连接失败!!! ===>> [id:{1}] [ip:{2}] [port:{3}]  [rack:{4}] [slot:{5}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot())); | 
 |  |  |             log.error("输送线plc连接失败!!! ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort()); | 
 |  |  | //            DeviceErrorService deviceErrorService = SpringUtils.getBean(DeviceErrorService.class); | 
 |  |  | //            deviceErrorService.addDeviceError("devp", slave.getId(), "输送线plc连接失败"); | 
 |  |  |             initSite(); | 
 |  |  |         } | 
 |  |  |         siemensS7Net.ConnectClose(); | 
 |  |  |         return result; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 读取状态 ====> 整块plc | 
 |  |  |      */ | 
 |  |  |     private void read() throws InterruptedException { | 
 |  |  |         // 更新入出库模式 | 
 |  |  |         updateIoMode(); | 
 |  |  |  | 
 |  |  |         ArrayList<Integer> staNos = getStaNo(); | 
 |  |  |         int staNoSize = staNos.size(); | 
 |  |  |         OperateResultExOne<byte[]> result; | 
 |  |  |         if (slave.getId() == 1) { | 
 |  |  |             // 读正面货位信息反馈 | 
 |  |  |             result = siemensS7Net.Read("DB101.0", (short) (16 * 8)); | 
 |  |  |             if (result.IsSuccess) { | 
 |  |  |                 for (int i = 0; i < 16; i++) { | 
 |  |  |                     Integer siteId = staNos.get(i); // 站点编号 | 
 |  |  |                     StaProtocol staProtocol = station.get(siteId); | 
 |  |  |                     if (null == staProtocol) { | 
 |  |  |                         staProtocol = new StaProtocol(); | 
 |  |  |                         staProtocol.setSiteId(siteId); | 
 |  |  |                         station.put(siteId, staProtocol); | 
 |  |  |                     } | 
 |  |  |                     staProtocol.setWorkNo((short) siemensS7Net.getByteTransform().TransInt32(result.Content, i * 8));     // 工作号 | 
 |  |  |  | 
 |  |  |                     staProtocol.setStaNo(siemensS7Net.getByteTransform().TransInt16(result.Content, i * 8 + 4));   // 目标站 | 
 |  |  |  | 
 |  |  |                     boolean[] status = siemensS7Net.getByteTransform().TransBool(result.Content, i * 8 + 6, 2); | 
 |  |  |                     staProtocol.setAutoing(status[0]);  // 自动 | 
 |  |  |                     staProtocol.setLoading(status[1]);  // 有物 | 
 |  |  |                     staProtocol.setInEnable(status[2]); // 可入 | 
 |  |  |                     staProtocol.setOutEnable(status[3]);// 可出 | 
 |  |  |                     staProtocol.setEmptyMk(status[4]);  // 空板信号 | 
 |  |  |                     staProtocol.setFullPlt(status[5]);  // 满托盘 | 
 |  |  |                     staProtocol.setHigh(status[6]);     // 高库位 | 
 |  |  |                     staProtocol.setLow(status[7]);      // 低库位 | 
 |  |  |  | 
 |  |  |                     if (!staProtocol.isPakMk() && !staProtocol.isLoading()) { | 
 |  |  |                         staProtocol.setPakMk(true); | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |             // 读侧面货位信息反馈 | 
 |  |  |             OperateResultExOne<byte[]> resultCm = siemensS7Net.Read("DB101.800", (short) (12 * 8)); | 
 |  |  |             if (resultCm.IsSuccess) { | 
 |  |  |                 for (int i = 16; i < staNoSize; i++) { | 
 |  |  |                     Integer siteId = staNos.get(i); // 站点编号 | 
 |  |  |                     StaProtocol staProtocol = station.get(siteId); | 
 |  |  |                     if (null == staProtocol) { | 
 |  |  |                         staProtocol = new StaProtocol(); | 
 |  |  |                         staProtocol.setSiteId(siteId); | 
 |  |  |                         station.put(siteId, staProtocol); | 
 |  |  |                     } | 
 |  |  |                     staProtocol.setWorkNo((short) siemensS7Net.getByteTransform().TransInt32(resultCm.Content, (i - 16) * 8));     // 工作号 | 
 |  |  |  | 
 |  |  |                     staProtocol.setStaNo(siemensS7Net.getByteTransform().TransInt16(resultCm.Content, (i - 16) * 8 + 4));   // 目标站 | 
 |  |  |  | 
 |  |  |                     boolean[] status = siemensS7Net.getByteTransform().TransBool(resultCm.Content, (i - 16) * 8 + 6, 2); | 
 |  |  |                     staProtocol.setAutoing(status[0]);  // 自动 | 
 |  |  |                     staProtocol.setLoading(status[1]);  // 有物 | 
 |  |  |                     staProtocol.setInEnable(status[2]); // 可入 | 
 |  |  |                     staProtocol.setOutEnable(status[3]);// 可出 | 
 |  |  |                     staProtocol.setEmptyMk(status[4]);  // 空板信号 | 
 |  |  |                     staProtocol.setFullPlt(status[5]);  // 满托盘 | 
 |  |  |                     staProtocol.setHigh(status[6]);     // 高库位 | 
 |  |  |                     staProtocol.setLow(status[7]);      // 低库位 | 
 |  |  |  | 
 |  |  |                     if (!staProtocol.isPakMk() && !staProtocol.isLoading()) { | 
 |  |  |                         staProtocol.setPakMk(true); | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |             // 读取正面条码 | 
 |  |  |             OperateResultExOne<byte[]> result3 = siemensS7Net.Read("DB103.0", (short) (5 * 40)); | 
 |  |  |             if (result3.IsSuccess) { | 
 |  |  |                 for (int i = 0; i < 5; i++) { | 
 |  |  |                     String barcode = siemensS7Net.getByteTransform().TransString(result3.Content, i * 40, 40, "UTF-8"); | 
 |  |  |                     if (!Cools.isEmpty()) { | 
 |  |  |                         barcode = barcode.trim(); | 
 |  |  |                     } | 
 |  |  |                     List<String> barcodeList = Arrays.stream(barcode.split(";")).collect(Collectors.toList()); | 
 |  |  |                     Iterator<String> iterator = barcodeList.iterator(); | 
 |  |  |                     while (iterator.hasNext()) { | 
 |  |  |                         String next = iterator.next(); | 
 |  |  |                         if (next.length() == 6) { | 
 |  |  |                             barcode = next; | 
 |  |  |                             iterator.remove(); | 
 |  |  |                             break; | 
 |  |  |                         } | 
 |  |  |                     } | 
 |  |  |  | 
 |  |  |                     BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, i + 1); | 
 |  |  |                     if (!Cools.isEmpty(barcodeThread) && !barcodeThread.getBarcode().equals(barcode)) { | 
 |  |  |                         barcodeThread.setBarcode(barcode); | 
 |  |  |                     } | 
 |  |  |                     StaProtocol staProtocol = station.get(barcodeSite2.get(i)); | 
 |  |  |                     if (staProtocol != null) { | 
 |  |  |                         while (iterator.hasNext()) { | 
 |  |  |                             String next = iterator.next(); | 
 |  |  |                             if (next.length() < 7 || next.length() > 10 || !next.matches("[0-9]*")) { | 
 |  |  |                                 iterator.remove(); | 
 |  |  |                             } | 
 |  |  |                         } | 
 |  |  |                         staProtocol.setMatIdList(barcodeList); | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |             // 读取正面条码 | 
 |  |  | //            OperateResultExOne<byte[]> result2 = siemensS7Net.Read("DB101.1404", (short) (16 * 8)); | 
 |  |  | //            if (result2.IsSuccess) { | 
 |  |  | //                for (int i = 0; i < 16; i++) { | 
 |  |  | //                    int barcodeId = 0; | 
 |  |  | //                    switch (i) { | 
 |  |  | //                        case 1: | 
 |  |  | //                            barcodeId = 1; | 
 |  |  | //                            break; | 
 |  |  | //                        case 4: | 
 |  |  | //                            barcodeId = 2; | 
 |  |  | //                            break; | 
 |  |  | //                        case 7: | 
 |  |  | //                            barcodeId = 3; | 
 |  |  | //                            break; | 
 |  |  | //                        case 10: | 
 |  |  | //                            barcodeId = 4; | 
 |  |  | //                            break; | 
 |  |  | //                        case 13: | 
 |  |  | //                            barcodeId = 5; | 
 |  |  | //                            break; | 
 |  |  | //                        default: | 
 |  |  | //                    } | 
 |  |  | //                    if (barcodeId != 0) { | 
 |  |  | //                        String barcode = siemensS7Net.getByteTransform().TransString(result2.Content, i * 8, 6, "UTF-8"); | 
 |  |  | //                        BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, barcodeId); | 
 |  |  | //                        if (!Cools.isEmpty(barcodeThread) && !barcodeThread.getBarcode().equals(barcode)) { | 
 |  |  | //                            barcodeThread.setBarcode(barcode); | 
 |  |  | //                        } | 
 |  |  | //                    } | 
 |  |  | //                } | 
 |  |  | //            } | 
 |  |  |  | 
 |  |  |             // 读取侧面条码 | 
 |  |  |             OperateResultExOne<byte[]> resultCM2 = siemensS7Net.Read("DB101.2574", (short) (3 * 4 * 6)); | 
 |  |  |             if (resultCM2.IsSuccess) { | 
 |  |  |                 for (int i = 8; i >= 6; i--) { | 
 |  |  |                     BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, i); | 
 |  |  |                     List<String> barcodes = new ArrayList<>(); | 
 |  |  |                     for (int j = 0; j < 4; j++) { | 
 |  |  |                         String barcode1 = siemensS7Net.getByteTransform().TransString(resultCM2.Content, (8 - i) * 24 + j * 6, 6, "UTF-8"); | 
 |  |  |                         if (!Cools.isEmpty(barcode1) && !barcode1.equals("000000") && !barcode1.equals("NoRead")) { | 
 |  |  |                             barcodes.add(barcode1); | 
 |  |  |                         } | 
 |  |  |                     } | 
 |  |  |                     String barcode = String.join("#", barcodes); | 
 |  |  |                     if (!Cools.isEmpty(barcodeThread) && !barcodeThread.getBarcode().equals(barcode)) { | 
 |  |  |                         barcodeThread.setBarcode(barcode); | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |             // 读取正面外形检测 | 
 |  |  |             OperateResultExOne<byte[]> resultErr1 = siemensS7Net.Read("DB101.936", (short) (16 * 8)); | 
 |  |  |             if (resultErr1.IsSuccess) { | 
 |  |  |                 for (int i = 0; i < 16; i++) { | 
 |  |  |                     Integer siteId = staNos.get(i); // 站点编号 | 
 |  |  |                     StaProtocol staProtocol = station.get(siteId); | 
 |  |  |                     boolean[] status1 = siemensS7Net.getByteTransform().TransBool(resultErr1.Content, i * 2, 1); | 
 |  |  |                     staProtocol.setFrontErr(status1[0]); | 
 |  |  |                     staProtocol.setBackErr(status1[1]); | 
 |  |  |                     staProtocol.setHighErr(status1[2]); | 
 |  |  |                     staProtocol.setLeftErr(status1[3]); | 
 |  |  |                     staProtocol.setRightErr(status1[4]); | 
 |  |  |                     staProtocol.setWeightErr(status1[5]); | 
 |  |  |                     staProtocol.setBarcodeErr(status1[6]); | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |             // 读取侧面外形检测 | 
 |  |  |             OperateResultExOne<byte[]> resultErrCM1 = siemensS7Net.Read("DB101.1336", (short) (12 * 8)); | 
 |  |  |             if (resultErrCM1.IsSuccess) { | 
 |  |  |                 for (int i = 16; i < staNoSize; i++) { | 
 |  |  |                     Integer siteId = staNos.get(i); // 站点编号 | 
 |  |  |                     StaProtocol staProtocol = station.get(siteId); | 
 |  |  |                     boolean[] status1 = siemensS7Net.getByteTransform().TransBool(resultErrCM1.Content, (i - 16) * 2, 1); | 
 |  |  |                     staProtocol.setFrontErr(status1[0]); | 
 |  |  |                     staProtocol.setBackErr(status1[1]); | 
 |  |  |                     staProtocol.setHighErr(status1[2]); | 
 |  |  |                     staProtocol.setLeftErr(status1[3]); | 
 |  |  |                     staProtocol.setRightErr(status1[4]); | 
 |  |  |                     staProtocol.setWeightErr(status1[5]); | 
 |  |  |                     staProtocol.setBarcodeErr(status1[6]); | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |             // 读正面故障反馈 | 
 |  |  |             OperateResultExOne<byte[]> resultErr = siemensS7Net.Read("DB101.922.0", (short) (16 * 4)); | 
 |  |  |             if (resultErr.IsSuccess) { | 
 |  |  |                 for (int i = 0; i < 16; i++) { | 
 |  |  |                     Integer siteId = staNos.get(i); // 站点编号 | 
 |  |  |                     boolean[] status = siemensS7Net.getByteTransform().TransBool(resultErr.Content, i * 4, 1); | 
 |  |  |                     StaProtocol staProtocol = station.get(siteId); | 
 |  |  |                     staProtocol.setBreakerErr(status[0]); | 
 |  |  |                     staProtocol.setInfraredErr(status[1]); | 
 |  |  |                     staProtocol.setOutTimeErr(status[2]); | 
 |  |  |                     staProtocol.setSeizeSeatErr(status[3]); | 
 |  |  |                     staProtocol.setWrkYgoodsN(status[4]); | 
 |  |  |                     staProtocol.setInverterErr(status[5]); | 
 |  |  |                     staProtocol.setContactErr(status[6]); | 
 |  |  |                     staProtocol.setUpcontactErr(status[7]); | 
 |  |  |  | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |             // 读侧面故障反馈 | 
 |  |  |             OperateResultExOne<byte[]> resultErrCM = siemensS7Net.Read("DB101.2540.0", (short) (12 * 4)); | 
 |  |  |             if (resultErrCM.IsSuccess) { | 
 |  |  |                 for (int i = 16; i < staNoSize; i++) { | 
 |  |  |                     Integer siteId = staNos.get(i); // 站点编号 | 
 |  |  |                     boolean[] status = siemensS7Net.getByteTransform().TransBool(resultErrCM.Content, (i - 16) * 4, 1); | 
 |  |  |                     StaProtocol staProtocol = station.get(siteId); | 
 |  |  |                     staProtocol.setBreakerErr(status[0]); | 
 |  |  |                     staProtocol.setInfraredErr(status[1]); | 
 |  |  |                     staProtocol.setOutTimeErr(status[2]); | 
 |  |  |                     staProtocol.setSeizeSeatErr(status[3]); | 
 |  |  |                     staProtocol.setWrkYgoodsN(status[4]); | 
 |  |  |                     staProtocol.setInverterErr(status[5]); | 
 |  |  |                     staProtocol.setContactErr(status[6]); | 
 |  |  |                     staProtocol.setUpcontactErr(status[7]); | 
 |  |  |  | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |         } else { | 
 |  |  |             // 读外置输送线货位信息反馈 | 
 |  |  |             result = siemensS7Net.Read("DB101.0", (short) (staNoSize * 8)); | 
 |  |  |             if (result.IsSuccess) { | 
 |  |  |                 for (int i = 0; i < staNoSize; i++) { | 
 |  |  |                     Integer siteId = staNos.get(i); // 站点编号 | 
 |  |  |                     StaProtocol staProtocol = station.get(siteId); | 
 |  |  |                     if (null == staProtocol) { | 
 |  |  |                         staProtocol = new StaProtocol(); | 
 |  |  |                         staProtocol.setSiteId(siteId); | 
 |  |  |                         station.put(siteId, staProtocol); | 
 |  |  |                     } | 
 |  |  |                     staProtocol.setWorkNo((short) siemensS7Net.getByteTransform().TransInt32(result.Content, i * 8));     // 工作号 | 
 |  |  |  | 
 |  |  |                     staProtocol.setStaNo(siemensS7Net.getByteTransform().TransInt16(result.Content, i * 8 + 4));   // 目标站 | 
 |  |  |  | 
 |  |  |                     boolean[] status = siemensS7Net.getByteTransform().TransBool(result.Content, i * 8 + 6, 2); | 
 |  |  |                     staProtocol.setAutoing(status[0]);  // 自动 | 
 |  |  |                     staProtocol.setLoading(status[1]);  // 有物 | 
 |  |  |                     staProtocol.setInEnable(status[2]); // 可入 | 
 |  |  |                     staProtocol.setOutEnable(status[3]);// 可出 | 
 |  |  |                     staProtocol.setEmptyMk(status[4]);  // 空板信号 | 
 |  |  |                     staProtocol.setFullPlt(status[5]);  // 满托盘 | 
 |  |  |                     staProtocol.setHigh(status[6]);     // 高库位 | 
 |  |  |                     staProtocol.setLow(status[7]);      // 低库位 | 
 |  |  |  | 
 |  |  |                     if (!staProtocol.isPakMk() && !staProtocol.isLoading()) { | 
 |  |  |                         staProtocol.setPakMk(true); | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         if (result.IsSuccess) { | 
 |  |  |  | 
 |  |  |             OutputQueue.DEVP.offer(MessageFormat.format("【{0}】[id:{1}] <<<<< 实时数据更新成功", DateUtils.convert(new Date()), slave.getId())); | 
 |  |  |  | 
 |  |  |             // 根据实时信息更新数据库 | 
 |  |  |             try { | 
 |  |  |                 List<BasDevp> basDevps = new ArrayList<>(); | 
 |  |  |                 for (Integer siteId : staNos) { | 
 |  |  |                     StaProtocol staProtocol = station.get(siteId); | 
 |  |  |                     basDevps.add(staProtocol.toSqlModel()); | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 BasDevpService basDevpService = SpringUtils.getBean(BasDevpService.class); | 
 |  |  |                 if (null != basDevpService && !basDevpService.updateBatchById(basDevps)) { | 
 |  |  |                     throw new Exception("更新数据库数据失败"); | 
 |  |  |                 } | 
 |  |  |             } catch (Exception e) { | 
 |  |  |                 e.printStackTrace(); | 
 |  |  |                 OutputQueue.DEVP.offer(MessageFormat.format("【{0}】更新数据库数据失败 ===>> [id:{1}] [ip:{2}] [port:{3}] [rack:{4}] [slot:{5}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot())); | 
 |  |  |                 log.error("更新数据库数据失败 ===>> [id:{}] [ip:{}] [port:{}] [rack:{}] [slot:{}]", slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot()); | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |             DeviceErrorService deviceErrorService = SpringUtils.getBean(DeviceErrorService.class); | 
 |  |  |             deviceErrorService.deleteDeviceError("devp", slave.getId()); | 
 |  |  |         } else { | 
 |  |  |             OutputQueue.DEVP.offer(MessageFormat.format("【{0}】读取输送线plc状态信息失败 ===>> [id:{1}] [ip:{2}] [port:{3}] [rack:{4}] [slot:{5}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot())); | 
 |  |  | //            log.error("读取输送线plc状态信息失败 ===>> [id:{}] [ip:{}] [port:{}] [rack:{}] [slot:{}]", slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot()); | 
 |  |  |             DeviceErrorService deviceErrorService = SpringUtils.getBean(DeviceErrorService.class); | 
 |  |  |             deviceErrorService.addDeviceError("devp", slave.getId(), "读取输送线plc状态信息失败"); | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     private void write(StaProtocol staProtocol) throws InterruptedException { | 
 |  |  |         if (null == staProtocol) { | 
 |  |  |             return; | 
 |  |  |         } | 
 |  |  |         ArrayList<Integer> staNos = getStaNo(); | 
 |  |  |  | 
 |  |  |         int index = staNos.indexOf(staProtocol.getSiteId()); | 
 |  |  |         // 任务号地址 | 
 |  |  |         String workNoAddress; | 
 |  |  |         // 目标站地址 | 
 |  |  |         String staNoAddress; | 
 |  |  |         // 目标站地址 | 
 |  |  |         String heightAddress = null; | 
 |  |  |         if (index < 16) { | 
 |  |  |             workNoAddress = "DB100." + index * 4; | 
 |  |  |             staNoAddress = "DB100." + (index * 4 + 2); | 
 |  |  |         } else { | 
 |  |  |             workNoAddress = "DB100." + (400 + (index - 16) * 4); | 
 |  |  |             staNoAddress = "DB100." + (400 + (index - 16) * 4 + 2); | 
 |  |  |         } | 
 |  |  |         int i = barcodeSite2.indexOf(staProtocol.getSiteId()); | 
 |  |  |         if (i != -1) { | 
 |  |  |             heightAddress = "DB104." + (i * 2); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         OperateResult writeResult; | 
 |  |  |         //任务下发次数 | 
 |  |  |         int writeCount = 0; | 
 |  |  |         //任务下发成功标识 | 
 |  |  |         boolean writeFlag = false; | 
 |  |  |         while (writeCount < 5) { | 
 |  |  |             if (!Cools.isEmpty(staProtocol.getHeight()) && heightAddress != null) { | 
 |  |  |                 OperateResult writeResult3 = siemensS7Net.Write(heightAddress, Short.parseShort(staProtocol.getHeight())); | 
 |  |  |                 writeResult3 = siemensS7Net.Write(heightAddress, Short.parseShort(staProtocol.getHeight())); | 
 |  |  |                 writeResult3 = siemensS7Net.Write(heightAddress, Short.parseShort(staProtocol.getHeight())); | 
 |  |  |                 writeResult3 = siemensS7Net.Write(heightAddress, Short.parseShort(staProtocol.getHeight())); | 
 |  |  |                 log.info("写入高度地址:{},{}", heightAddress, writeResult3); | 
 |  |  |                 if (!writeResult3.IsSuccess) { | 
 |  |  |                     //fangzhi xierukushibai,jiu duoxiejici,meixunhuan | 
 |  |  |                     writeResult3 = siemensS7Net.Write(heightAddress, Short.parseShort(staProtocol.getHeight())); | 
 |  |  |                     if (!writeResult3.IsSuccess) { | 
 |  |  |                         writeResult3 = siemensS7Net.Write(heightAddress, Short.parseShort(staProtocol.getHeight()));    // 目标站 | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |             OperateResult writeResult1 = siemensS7Net.Write(workNoAddress, staProtocol.getWorkNo());    // 工作号 | 
 |  |  |             OperateResult writeResult2 = siemensS7Net.Write(staNoAddress, staProtocol.getStaNo());    // 目标站 | 
 |  |  |             if (writeResult1.IsSuccess && writeResult2.IsSuccess) { | 
 |  |  |                 Thread.sleep(200); | 
 |  |  |                 OperateResultExOne<byte[]> readResult = siemensS7Net.Read("DB100." + index * 4, (short) 2); | 
 |  |  |                 if (readResult.IsSuccess) { | 
 |  |  | //                    short workNo = siemensS7Net.getByteTransform().TransInt16(readResult.Content, 0); | 
 |  |  | //                    short staNo = siemensS7Net.getByteTransform().TransInt16(readResult.Content, 2); | 
 |  |  | //                    if (staProtocol.getWorkNo().equals(workNo) && staProtocol.getStaNo().equals(staNo)) { | 
 |  |  | //                        //任务命令写入成功 | 
 |  |  |                     writeFlag = true; | 
 |  |  |                     log.info("写入输送线命令后返回成功,并且回读成功。输送线plc编号={},{},写入次数={}", slave.getId(), JSON.toJSON(staProtocol), writeCount); | 
 |  |  |                     break; | 
 |  |  | //                    } else {//返回结果是成功了,但是真实值不相同 | 
 |  |  | //                        writeCount++; | 
 |  |  | //                        OutputQueue.DEVP.offer(MessageFormat.format("【{0}】写入输送线命令后返回成功,但是读取任务值不一致。输送线plc编号={1},站点数据={2},写入次数={3}", | 
 |  |  | //                                slave.getId(), JSON.toJSON(staProtocol), writeCount)); | 
 |  |  | //                        log.error("写入输送线命令后返回成功,但是读取任务值不一致。输送线plc编号={},{},写入次数={}", slave.getId(), JSON.toJSON(staProtocol), writeCount); | 
 |  |  | //                    } | 
 |  |  |                 } else { | 
 |  |  |                     writeCount++; | 
 |  |  |                     OutputQueue.DEVP.offer(MessageFormat.format("【{0}】写入输送线命令后读取失败。输送线plc编号={1},站点数据={2},写入次数={3}", | 
 |  |  |                             slave.getId(), JSON.toJSON(staProtocol), writeCount)); | 
 |  |  |                     log.error("写入输送线命令后读取失败。输送线plc编号={},站点数据={},写入次数={}", slave.getId(), JSON.toJSON(staProtocol), writeCount); | 
 |  |  |                 } | 
 |  |  |             } else { | 
 |  |  |                 writeCount++; | 
 |  |  |                 OutputQueue.DEVP.offer(MessageFormat.format("【{0}】写入输送线命令失败。输送线plc编号={1},站点数据={2},写入次数={3}", | 
 |  |  |                         slave.getId(), JSON.toJSON(staProtocol), writeCount)); | 
 |  |  |                 log.error("写入输送线命令失败。输送线plc编号={},站点数据={},写入次数={}", slave.getId(), JSON.toJSON(staProtocol), writeCount); | 
 |  |  |             } | 
 |  |  |             Thread.sleep(200); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         //写命令尝试了5次还是失败了 | 
 |  |  |         if (!writeFlag) { | 
 |  |  |             staProtocol = station.get(staProtocol.getSiteId()); | 
 |  |  |             if (staProtocol.getWorkNo() == 0 && staProtocol.getStaNo() == 0) { | 
 |  |  |                 staProtocol.setPakMk(true); | 
 |  |  |             } | 
 |  |  |             OutputQueue.DEVP.offer(MessageFormat.format("【{0}】写入输送线命令尝试5次失败。输送线plc编号={1},站点数据={2}", slave.getId(), JSON.toJSON(staProtocol))); | 
 |  |  |             log.error("写入输送线命令尝试5次失败。输送线plc编号={},站点数据={}", slave.getId(), JSON.toJSON(staProtocol)); | 
 |  |  |  | 
 |  |  | //            //重新添加数据到任务队列 | 
 |  |  | //            boolean result = MessageQueue.offer(SlaveType.Devp, slave.getId(), new Task(2, staProtocol)); | 
 |  |  | //            read();//读取1次设备状态 | 
 |  |  |         } else { | 
 |  |  |             OutputQueue.DEVP.offer(MessageFormat.format("【{0}】 输送线命令下发成功 [id:{1}] >>>>> {2}", DateUtils.convert(new Date()), slave.getId(), JSON.toJSON(staProtocol))); | 
 |  |  |             log.info("输送线命令下发 [id:{}] >>>>> 命令下发成功: {}", slave.getId(), JSON.toJSON(staProtocol)); | 
 |  |  |  | 
 |  |  | //            Integer siteId = staProtocol.getSiteId(); | 
 |  |  | //            staProtocol = station.get(siteId); | 
 |  |  | //            if ((siteId == 101 || siteId == 201)&&(staProtocol.getWorkNo() == 0 && staProtocol.getStaNo() ==0)) { | 
 |  |  | //                staProtocol.setPakMk(true); | 
 |  |  | //            } | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | //    /** | 
 |  |  | //     * 写入 ID+目标站 =====> 单站点写入 | 
 |  |  | //     */ | 
 |  |  | //    private void write(StaProtocol staProtocol) throws InterruptedException { | 
 |  |  | //        if (null == staProtocol) { | 
 |  |  | //            return; | 
 |  |  | //        } | 
 |  |  | //        int index = staNos.indexOf(staProtocol.getSiteId()); | 
 |  |  | //        short[] array = new short[2]; | 
 |  |  | //        array[0] = staProtocol.getWorkNo(); | 
 |  |  | //        array[1] = staProtocol.getStaNo(); | 
 |  |  | //        OperateResult write = siemensS7Net.Write("DB100." + index*4, array); | 
 |  |  | // | 
 |  |  |  | 
 |  |  |     /// /        OperateResult write = siemensS7Net.Write("DB100." + index*2, staProtocol.getWorkNo());    // 工作号 | 
 |  |  |     /// /        Thread.sleep(500); | 
 |  |  |     /// /        OperateResult write1 = siemensS7Net.Write("DB101." + index*2, staProtocol.getStaNo());    // 目标站 | 
 |  |  | // | 
 |  |  | //        if (!write.IsSuccess) { | 
 |  |  | //            staProtocol = station.get(staProtocol.getSiteId()); | 
 |  |  | //            if (staProtocol.getWorkNo() == 0 && staProtocol.getStaNo() ==0) { | 
 |  |  | //                staProtocol.setPakMk(true); | 
 |  |  | //            } | 
 |  |  | //            OutputQueue.DEVP.offer(MessageFormat.format("【{0}】写入输送线站点数据失败。输送线plc编号={1},站点数据={2}", slave.getId(), JSON.toJSON(staProtocol))); | 
 |  |  | //            log.error("写入输送线站点数据失败。输送线plc编号={},站点数据={}", slave.getId(), JSON.toJSON(staProtocol)); | 
 |  |  | //        } else { | 
 |  |  | //            OutputQueue.DEVP.offer(MessageFormat.format("【{0}】 输送线命令下发 [id:{1}] >>>>> {2}", DateUtils.convert(new Date()), slave.getId(), JSON.toJSON(staProtocol))); | 
 |  |  | //            log.info("输送线命令下发 [id:{}] >>>>> 命令下发: {}",  slave.getId(), JSON.toJSON(staProtocol)); | 
 |  |  | // | 
 |  |  | //            Integer siteId = staProtocol.getSiteId(); | 
 |  |  | //            staProtocol = station.get(siteId); | 
 |  |  | //            if ((siteId == 101 || siteId == 201)&&(staProtocol.getWorkNo() == 0 && staProtocol.getStaNo() ==0)) { | 
 |  |  | //                staProtocol.setPakMk(true); | 
 |  |  | //            } | 
 |  |  | //        } | 
 |  |  | //    } | 
 |  |  |     private void write2(StaProtocol staProtocol) throws InterruptedException { | 
 |  |  |         if (null == staProtocol) { | 
 |  |  |             return; | 
 |  |  |         } | 
 |  |  |         ArrayList<Integer> staNos = getStaNo(); | 
 |  |  |  | 
 |  |  |         int index = staNos.indexOf(staProtocol.getSiteId()); | 
 |  |  |         short[] array = new short[2]; | 
 |  |  |         array[0] = staProtocol.getWorkNo(); | 
 |  |  |         array[1] = staProtocol.getStaNo(); | 
 |  |  |  | 
 |  |  |         OperateResult writeResult; | 
 |  |  |         //任务下发次数 | 
 |  |  |         int writeCount = 0; | 
 |  |  |         //任务下发成功标识 | 
 |  |  |         boolean writeFlag = false; | 
 |  |  |         while (writeCount < 5) { | 
 |  |  |             writeResult = siemensS7Net.Write("DB100." + index * 4, array);    // 工作号、目标站 | 
 |  |  |  | 
 |  |  |             if (writeResult.IsSuccess) { | 
 |  |  |                 Thread.sleep(200); | 
 |  |  |                 OperateResultExOne<byte[]> readResult = siemensS7Net.Read("DB100." + index * 4, (short) 4); | 
 |  |  |                 if (readResult.IsSuccess) { | 
 |  |  |                     short workNo = siemensS7Net.getByteTransform().TransInt16(readResult.Content, 0); | 
 |  |  |                     short staNo = siemensS7Net.getByteTransform().TransInt16(readResult.Content, 2); | 
 |  |  |                     if (staProtocol.getWorkNo().equals(workNo) && staProtocol.getStaNo().equals(staNo)) { | 
 |  |  |                         //任务命令写入成功 | 
 |  |  |                         writeFlag = true; | 
 |  |  |                         log.info("写入输送线命令后返回成功,并且回读成功。输送线plc编号={},{},写入次数={}", slave.getId(), JSON.toJSON(staProtocol), writeCount); | 
 |  |  |  | 
 |  |  |                         Date now = new Date(); | 
 |  |  |                         break; | 
 |  |  |                     } else {//返回结果是成功了,但是真实值不相同 | 
 |  |  |                         writeCount++; | 
 |  |  |                         OutputQueue.DEVP.offer(MessageFormat.format("【{0}】写入输送线命令后返回成功,但是读取任务值不一致。输送线plc编号={1},站点数据={2},写入次数={3}", | 
 |  |  |                                 slave.getId(), JSON.toJSON(staProtocol), writeCount)); | 
 |  |  |                         log.error("写入输送线命令后返回成功,但是读取任务值不一致。输送线plc编号={},{},写入次数={}", slave.getId(), JSON.toJSON(staProtocol), writeCount); | 
 |  |  |  | 
 |  |  |                     } | 
 |  |  |                 } else { | 
 |  |  |                     writeCount++; | 
 |  |  |                     OutputQueue.DEVP.offer(MessageFormat.format("【{0}】写入输送线命令后读取失败。输送线plc编号={1},站点数据={2},写入次数={3}", | 
 |  |  |                             slave.getId(), JSON.toJSON(staProtocol), writeCount)); | 
 |  |  |                     log.error("写入输送线命令后读取失败。输送线plc编号={},站点数据={},写入次数={}", slave.getId(), JSON.toJSON(staProtocol), writeCount); | 
 |  |  |  | 
 |  |  |                 } | 
 |  |  |             } else { | 
 |  |  |                 writeCount++; | 
 |  |  |                 OutputQueue.DEVP.offer(MessageFormat.format("【{0}】写入输送线命令失败。输送线plc编号={1},站点数据={2},写入次数={3}", | 
 |  |  |                         slave.getId(), JSON.toJSON(staProtocol), writeCount)); | 
 |  |  |                 log.error("写入输送线命令失败。输送线plc编号={},站点数据={},写入次数={}", slave.getId(), JSON.toJSON(staProtocol), writeCount); | 
 |  |  |  | 
 |  |  |             } | 
 |  |  |             Thread.sleep(200); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         //写命令尝试了5次还是失败了 | 
 |  |  |         if (!writeFlag) { | 
 |  |  |             staProtocol = station.get(staProtocol.getSiteId()); | 
 |  |  |             if (staProtocol.getWorkNo() == 0 && staProtocol.getStaNo() == 0) { | 
 |  |  |                 staProtocol.setPakMk(true); | 
 |  |  |             } | 
 |  |  |             OutputQueue.DEVP.offer(MessageFormat.format("【{0}】写入输送线命令尝试5次失败。输送线plc编号={1},站点数据={2}", slave.getId(), JSON.toJSON(staProtocol))); | 
 |  |  |             log.error("写入输送线命令尝试5次失败。输送线plc编号={},站点数据={}", slave.getId(), JSON.toJSON(staProtocol)); | 
 |  |  |  | 
 |  |  |             //重新添加数据到任务队列 | 
 |  |  |             boolean result = MessageQueue.offer(SlaveType.Devp, slave.getId(), new Task(3, staProtocol)); | 
 |  |  |             read();//读取1次设备状态 | 
 |  |  |             return; | 
 |  |  |         } else { | 
 |  |  |             OutputQueue.DEVP.offer(MessageFormat.format("【{0}】 输送线命令下发成功 [id:{1}] >>>>> {2}", DateUtils.convert(new Date()), slave.getId(), JSON.toJSON(staProtocol))); | 
 |  |  |             //log.info("输送线命令下发 [id:{}] >>>>> 命令下发成功: {}",  slave.getId(), JSON.toJSON(staProtocol)); | 
 |  |  |  | 
 |  |  |             Integer siteId = staProtocol.getSiteId(); | 
 |  |  |             staProtocol = station.get(siteId); | 
 |  |  |             if ((siteId == 101 || siteId == 201) && (staProtocol.getWorkNo() == 0 && staProtocol.getStaNo() == 0)) { | 
 |  |  |                 staProtocol.setPakMk(true); | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     // 更新入出库模式 | 
 |  |  |     private void updateIoMode() throws InterruptedException { | 
 |  |  |         if (slave.getId() == 1 && this.ioModeOf1F1 != null) { | 
 |  |  |             if (!siemensS7Net.Write("DB105.0", this.ioModeOf1F1.id).IsSuccess) { | 
 |  |  |                 OutputQueue.DEVP.offer(MessageFormat.format("【{0}】写入输送线21F1入出库模式失败。输送线plc编号={1}", slave.getId())); | 
 |  |  |                 log.error("写入输送线1F1入出库模式失败。输送线plc编号={}", slave.getId()); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         if (slave.getId() == 1 && this.ioModeOf1F2 != null) { | 
 |  |  |             if (!siemensS7Net.Write("DB105.2", this.ioModeOf1F2.id).IsSuccess) { | 
 |  |  |                 OutputQueue.DEVP.offer(MessageFormat.format("【{0}】写入输送线2F2入出库模式失败。输送线plc编号={1}", slave.getId())); | 
 |  |  |                 log.error("写入输送线1F2入出库模式失败。输送线plc编号={}", slave.getId()); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         if (slave.getId() == 1 && this.ioModeOf1F3 != null) { | 
 |  |  |             if (!siemensS7Net.Write("DB105.4", this.ioModeOf1F3.id).IsSuccess) { | 
 |  |  |                 OutputQueue.DEVP.offer(MessageFormat.format("【{0}】写入输送线3F1入出库模式失败。输送线plc编号={1}", slave.getId())); | 
 |  |  |                 log.error("写入输送线1F3入出库模式失败。输送线plc编号={}", slave.getId()); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         if (slave.getId() == 1 && this.ioModeOf1F4 != null) { | 
 |  |  |             if (!siemensS7Net.Write("DB105.6", this.ioModeOf1F4.id).IsSuccess) { | 
 |  |  |                 OutputQueue.DEVP.offer(MessageFormat.format("【{0}】写入输送线3F2入出库模式失败。输送线plc编号={1}", slave.getId())); | 
 |  |  |                 log.error("写入输送线1F4入出库模式失败。输送线plc编号={}", slave.getId()); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         if (slave.getId() == 1 && this.ioModeOf1F5 != null) { | 
 |  |  |             if (!siemensS7Net.Write("DB105.8", this.ioModeOf1F5.id).IsSuccess) { | 
 |  |  |                 OutputQueue.DEVP.offer(MessageFormat.format("【{0}】写入输送线3F2入出库模式失败。输送线plc编号={1}", slave.getId())); | 
 |  |  |                 log.error("写入输送线1F5入出库模式失败。输送线plc编号={}", slave.getId()); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |         if (slave.getId() == 1 && this.ioModeOf2F1 != null) { | 
 |  |  |             if (!siemensS7Net.Write("DB105.10", this.ioModeOf2F1.id).IsSuccess) { | 
 |  |  |                 OutputQueue.DEVP.offer(MessageFormat.format("【{0}】写入输送线2F2入出库模式失败。输送线plc编号={1}", slave.getId())); | 
 |  |  |                 log.error("写入输送线2F1入出库模式失败。输送线plc编号={}", slave.getId()); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         if (slave.getId() == 1 && this.ioModeOf2F2 != null) { | 
 |  |  |             if (!siemensS7Net.Write("DB105.12", this.ioModeOf2F2.id).IsSuccess) { | 
 |  |  |                 OutputQueue.DEVP.offer(MessageFormat.format("【{0}】写入输送线3F1入出库模式失败。输送线plc编号={1}", slave.getId())); | 
 |  |  |                 log.error("写入输送线2F2入出库模式失败。输送线plc编号={}", slave.getId()); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         if (slave.getId() == 1 && this.ioModeOf2F3 != null) { | 
 |  |  |             if (!siemensS7Net.Write("DB105.14", this.ioModeOf2F3.id).IsSuccess) { | 
 |  |  |                 OutputQueue.DEVP.offer(MessageFormat.format("【{0}】写入输送线3F2入出库模式失败。输送线plc编号={1}", slave.getId())); | 
 |  |  |                 log.error("写入输送线2F3入出库模式失败。输送线plc编号={}", slave.getId()); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 设置入库标记 | 
 |  |  |      */ | 
 |  |  |     @Override | 
 |  |  |     public void setPakMk(Integer siteId, boolean pakMk) { | 
 |  |  |         StaProtocol staProtocol = station.get(siteId); | 
 |  |  |         if (null != staProtocol) { | 
 |  |  |             staProtocol.setPakMk(pakMk); | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @Override | 
 |  |  |     public void close() { | 
 |  |  |         siemensS7Net.ConnectClose(); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | wcs-slave: | 
 |  |  |   doubleDeep: true #双深 | 
 |  |  |   doubleLocs: 1,4,5,8,9,12 #双深库位排号 | 
 |  |  |   groupCount: 4 #一个堆垛机负责的货架排数 | 
 |  |  |  | 
 |  |  |   devp[0]: #输送线 | 
 |  |  |     id: 1 | 
 |  |  |     ip: 10.49.210.41 | 
 |  |  |     rack: 0 | 
 |  |  |     port: 102 | 
 |  |  |     slot: 0 | 
 |  |  |     emptyInSta[0]: #空板入库口0 | 
 |  |  |       staNo: 210 | 
 |  |  |     inSta[0]: #入库口1 | 
 |  |  |       staNo: 102 | 
 |  |  |       backSta: 101 | 
 |  |  |       barcode: ${wcs-slave.barcode[0].id} | 
 |  |  |     outSta[0]: #出库口1 | 
 |  |  |       staNo: 101 | 
 |  |  |  | 
 |  |  |  | 
 |  |  | #  barcode[0]: #条码扫描仪 | 
 |  |  | #    port: 51236 | 
 |  |  | #    ip: 10.49.210.44 | 
 |  |  | #    id: 1 | 
 |  |  | #  barcode[1]: #条码扫描仪 | 
 |  |  | #    port: 51236 | 
 |  |  | #    ip: 10.49.210.45 | 
 |  |  | #    id: 2 | 
 |  |  | #  barcode[2]: #条码扫描仪 | 
 |  |  | #    port: 51236 | 
 |  |  | #    ip: 10.49.210.46 | 
 |  |  | #    id: 3 | 
 |  |  | #  barcode[3]: #条码扫描仪 | 
 |  |  | #    port: 51236 | 
 |  |  | #    ip: 10.49.210.47 | 
 |  |  | #    id: 4 | 
 |  |  | #  barcode[4]: #条码扫描仪 | 
 |  |  | #    port: 51236 | 
 |  |  | #    ip: 10.49.210.48 | 
 |  |  | #    id: 5 | 
 |  |  | #  barcode[5]: #条码扫描仪 | 
 |  |  | #    port: 51236 | 
 |  |  | #    ip: 10.49.210.67 | 
 |  |  | #    id: 6 | 
 |  |  | #  barcode[6]: #条码扫描仪 | 
 |  |  | #    port: 51236 | 
 |  |  | #    ip: 10.49.210.66 | 
 |  |  | #    id: 7 | 
 |  |  | #  barcode[7]: #条码扫描仪 | 
 |  |  | #    port: 51236 | 
 |  |  | #    ip: 10.49.210.65 | 
 |  |  | #    id: 8 | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 
| New file | 
 |  |  | 
 |  |  | server: | 
 |  |  |   port: 9090 | 
 |  |  |   servlet: | 
 |  |  |     context-path: /@pom.build.finalName@ | 
 |  |  |  | 
 |  |  | spring: | 
 |  |  |   application: | 
 |  |  |     name: @pom.build.finalName@ | 
 |  |  |   datasource: | 
 |  |  |     driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver | 
 |  |  |     url: jdbc:sqlserver://127.0.0.1:1433;databasename=cosmawcs_cc | 
 |  |  |     username: sa | 
 |  |  |     password: sa@123 | 
 |  |  |  | 
 |  |  |   mvc: | 
 |  |  |     static-path-pattern: /** | 
 |  |  |   redis: | 
 |  |  |     host: localhost | 
 |  |  |     port: 6379 | 
 |  |  |     database: 0 | 
 |  |  | #    password: xltys1995 | 
 |  |  |   profiles: | 
 |  |  |     active: prod | 
 |  |  |  | 
 |  |  | mybatis-plus: | 
 |  |  |   mapper-locations: classpath:mapper/*.xml | 
 |  |  | #  global-config: | 
 |  |  | #    field-strategy: 0 | 
 |  |  |  | 
 |  |  | logging: | 
 |  |  |   path: /stock/out/@pom.build.finalName@/logs | 
 |  |  |  | 
 |  |  | super: | 
 |  |  |   pwd: xltys1995 | 
 |  |  |  | 
 |  |  | swagger: | 
 |  |  |   enable: false | 
 |  |  |  | 
 |  |  | #License相关配置 | 
 |  |  | license: | 
 |  |  |   subject: glccwcs | 
 |  |  |   publicAlias: publicCert | 
 |  |  |   storePass: public_zhongyang_123456789 | 
 |  |  |   licensePath: license.lic | 
 |  |  |   publicKeysStorePath: publicCerts.keystore | 
 |  |  |  | 
 |  |  |  |