Merge branch 'Four-Way-Rack' of http://47.97.1.152:5880/r/zy-asrs-master into Four-Way-Rack
 
	
	
	
	
	
	
	
	
	
	
	
	
	
 |  |  | 
 |  |  | ////                    mainService.stnToCrnStnPick(); | 
 |  |  | //                    // 出库 =====>> | 
 |  |  | //                    mainService.generateOutboundWrkMast(); | 
 |  |  | //                    // 解析入库工作档 | 
 |  |  | //                    mainService.analyzeInBoundWrk(); | 
 |  |  |                     // 解析入库工作档 | 
 |  |  |                     mainService.analyzeInBoundTask(); | 
 |  |  | //                    // 异常信息记录 | 
 |  |  | //                    mainService.recErr(); | 
 |  |  | //                    // 入库  ===>> 空栈板初始化入库,叉车入库站放货 | 
 
 |  |  | 
 |  |  | package com.zy.asrs.wcs.system.controller; | 
 |  |  | package com.zy.asrs.wcs.core.controller; | 
 |  |  |  | 
 |  |  | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 
 |  |  | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 
 |  |  | 
 |  |  | import com.zy.asrs.wcs.common.domain.PageParam; | 
 |  |  | import com.zy.asrs.wcs.core.entity.Bus; | 
 |  |  | import com.zy.asrs.wcs.core.service.BusService; | 
 |  |  | import com.zy.asrs.wcs.system.controller.BaseController; | 
 |  |  | import com.zy.asrs.wcs.utils.ExcelUtil; | 
 |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
 |  |  | import org.springframework.security.access.prepost.PreAuthorize; | 
 
 |  |  | 
 |  |  | package com.zy.asrs.wcs.system.controller; | 
 |  |  | package com.zy.asrs.wcs.core.controller; | 
 |  |  |  | 
 |  |  | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 
 |  |  | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 
 |  |  | 
 |  |  | import com.zy.asrs.wcs.common.domain.PageParam; | 
 |  |  | import com.zy.asrs.wcs.core.entity.BusSts; | 
 |  |  | import com.zy.asrs.wcs.core.service.BusStsService; | 
 |  |  | import com.zy.asrs.wcs.system.controller.BaseController; | 
 |  |  | import com.zy.asrs.wcs.utils.ExcelUtil; | 
 |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
 |  |  | import org.springframework.security.access.prepost.PreAuthorize; | 
 
 |  |  | 
 |  |  | package com.zy.asrs.wcs.system.controller; | 
 |  |  | package com.zy.asrs.wcs.core.controller; | 
 |  |  |  | 
 |  |  | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 
 |  |  | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 
 |  |  | 
 |  |  | import com.zy.asrs.wcs.common.domain.PageParam; | 
 |  |  | import com.zy.asrs.wcs.core.entity.DeviceCtg; | 
 |  |  | import com.zy.asrs.wcs.core.service.DeviceCtgService; | 
 |  |  | import com.zy.asrs.wcs.system.controller.BaseController; | 
 |  |  | import com.zy.asrs.wcs.utils.ExcelUtil; | 
 |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
 |  |  | import org.springframework.security.access.prepost.PreAuthorize; | 
 
 |  |  | 
 |  |  | package com.zy.asrs.wcs.system.controller; | 
 |  |  | package com.zy.asrs.wcs.core.controller; | 
 |  |  |  | 
 |  |  | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 
 |  |  | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 
 |  |  | 
 |  |  | import com.zy.asrs.wcs.common.domain.PageParam; | 
 |  |  | import com.zy.asrs.wcs.core.entity.Loc; | 
 |  |  | import com.zy.asrs.wcs.core.service.LocService; | 
 |  |  | import com.zy.asrs.wcs.system.controller.BaseController; | 
 |  |  | import com.zy.asrs.wcs.utils.ExcelUtil; | 
 |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
 |  |  | import org.springframework.security.access.prepost.PreAuthorize; | 
 
 |  |  | 
 |  |  | package com.zy.asrs.wcs.system.controller; | 
 |  |  | package com.zy.asrs.wcs.core.controller; | 
 |  |  |  | 
 |  |  | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 
 |  |  | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 
 |  |  | 
 |  |  | import com.zy.asrs.wcs.common.domain.PageParam; | 
 |  |  | import com.zy.asrs.wcs.core.entity.LocCtg; | 
 |  |  | import com.zy.asrs.wcs.core.service.LocCtgService; | 
 |  |  | import com.zy.asrs.wcs.system.controller.BaseController; | 
 |  |  | import com.zy.asrs.wcs.utils.ExcelUtil; | 
 |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
 |  |  | import org.springframework.security.access.prepost.PreAuthorize; | 
 
 |  |  | 
 |  |  | package com.zy.asrs.wcs.system.controller; | 
 |  |  | package com.zy.asrs.wcs.core.controller; | 
 |  |  |  | 
 |  |  | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 
 |  |  | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 
 |  |  | 
 |  |  | import com.zy.asrs.wcs.common.domain.PageParam; | 
 |  |  | import com.zy.asrs.wcs.core.entity.LocSts; | 
 |  |  | import com.zy.asrs.wcs.core.service.LocStsService; | 
 |  |  | import com.zy.asrs.wcs.system.controller.BaseController; | 
 |  |  | import com.zy.asrs.wcs.utils.ExcelUtil; | 
 |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
 |  |  | import org.springframework.security.access.prepost.PreAuthorize; | 
 
 |  |  | 
 |  |  | package com.zy.asrs.wcs.system.controller; | 
 |  |  | package com.zy.asrs.wcs.core.controller; | 
 |  |  |  | 
 |  |  | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 
 |  |  | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 
 |  |  | 
 |  |  | import com.zy.asrs.wcs.common.domain.PageParam; | 
 |  |  | import com.zy.asrs.wcs.core.entity.Task; | 
 |  |  | import com.zy.asrs.wcs.core.service.TaskService; | 
 |  |  | import com.zy.asrs.wcs.system.controller.BaseController; | 
 |  |  | import com.zy.asrs.wcs.utils.ExcelUtil; | 
 |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
 |  |  | import org.springframework.security.access.prepost.PreAuthorize; | 
 
 |  |  | 
 |  |  | package com.zy.asrs.wcs.system.controller; | 
 |  |  | package com.zy.asrs.wcs.core.controller; | 
 |  |  |  | 
 |  |  | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 
 |  |  | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 
 |  |  | 
 |  |  | import com.zy.asrs.wcs.common.domain.PageParam; | 
 |  |  | import com.zy.asrs.wcs.core.entity.TaskCtg; | 
 |  |  | import com.zy.asrs.wcs.core.service.TaskCtgService; | 
 |  |  | import com.zy.asrs.wcs.system.controller.BaseController; | 
 |  |  | import com.zy.asrs.wcs.utils.ExcelUtil; | 
 |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
 |  |  | import org.springframework.security.access.prepost.PreAuthorize; | 
 
 |  |  | 
 |  |  | package com.zy.asrs.wcs.system.controller; | 
 |  |  | package com.zy.asrs.wcs.core.controller; | 
 |  |  |  | 
 |  |  | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 
 |  |  | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 
 |  |  | 
 |  |  | import com.zy.asrs.wcs.common.domain.PageParam; | 
 |  |  | import com.zy.asrs.wcs.core.entity.TaskSts; | 
 |  |  | import com.zy.asrs.wcs.core.service.TaskStsService; | 
 |  |  | import com.zy.asrs.wcs.system.controller.BaseController; | 
 |  |  | import com.zy.asrs.wcs.utils.ExcelUtil; | 
 |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
 |  |  | import org.springframework.security.access.prepost.PreAuthorize; | 
 
| New file | 
 |  |  | 
 |  |  | package com.zy.asrs.wcs.core.controller; | 
 |  |  |  | 
 |  |  | import com.zy.asrs.framework.common.R; | 
 |  |  | import com.zy.asrs.framework.common.SnowflakeIdWorker; | 
 |  |  | import com.zy.asrs.wcs.core.entity.Task; | 
 |  |  | import com.zy.asrs.wcs.core.service.TaskService; | 
 |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
 |  |  | import org.springframework.web.bind.annotation.RequestMapping; | 
 |  |  | import org.springframework.web.bind.annotation.RestController; | 
 |  |  |  | 
 |  |  | import java.util.Date; | 
 |  |  |  | 
 |  |  | @RestController | 
 |  |  | public class TestController { | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private TaskService taskService; | 
 |  |  |     @Autowired | 
 |  |  |     private SnowflakeIdWorker snowflakeIdWorker; | 
 |  |  |  | 
 |  |  |     @RequestMapping("/testGenerateTask") | 
 |  |  |     public R testGenerateTask() { | 
 |  |  |         Task task = new Task(); | 
 |  |  |         task.setUuid(String.valueOf(snowflakeIdWorker.nextId())); | 
 |  |  |         task.setTaskNo("9999"); | 
 |  |  |         task.setTaskSts(1L); | 
 |  |  |         task.setTaskCtg(1L); | 
 |  |  |         task.setPriority(10); | 
 |  |  |         task.setOriginSite("1"); | 
 |  |  |         task.setOriginLoc(""); | 
 |  |  |         task.setDestSite("2"); | 
 |  |  |         task.setDestLoc("0100101"); | 
 |  |  |         task.setEmptyMk(0); | 
 |  |  |         task.setZpallet("80000001"); | 
 |  |  |         task.setIoTime(new Date()); | 
 |  |  |         task.setStartTime(new Date()); | 
 |  |  |         task.setHostId(1L); | 
 |  |  |         task.setStatus(1); | 
 |  |  |  | 
 |  |  |         taskService.save(task); | 
 |  |  |         return R.ok(); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | } | 
 
 |  |  | 
 |  |  | package com.zy.asrs.wcs.system.controller; | 
 |  |  | package com.zy.asrs.wcs.core.controller; | 
 |  |  |  | 
 |  |  | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 
 |  |  | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 
 |  |  | 
 |  |  | import com.zy.asrs.wcs.common.domain.PageParam; | 
 |  |  | import com.zy.asrs.wcs.core.entity.Zone; | 
 |  |  | import com.zy.asrs.wcs.core.service.ZoneService; | 
 |  |  | import com.zy.asrs.wcs.system.controller.BaseController; | 
 |  |  | import com.zy.asrs.wcs.utils.ExcelUtil; | 
 |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
 |  |  | import org.springframework.security.access.prepost.PreAuthorize; | 
 
 |  |  | 
 |  |  | import com.zy.asrs.wcs.core.utils.LiftDispatcher; | 
 |  |  | import com.zy.asrs.wcs.core.utils.ShuttleDispatcher; | 
 |  |  | import com.zy.asrs.wcs.core.utils.Utils; | 
 |  |  | import com.zy.asrs.wcs.rcs.cache.SlaveConnection; | 
 |  |  | import com.zy.asrs.wcs.rcs.entity.Motion; | 
 |  |  | import com.zy.asrs.wcs.rcs.model.enums.SlaveType; | 
 |  |  | import com.zy.asrs.wcs.rcs.model.protocol.LiftProtocol; | 
 |  |  | import com.zy.asrs.wcs.rcs.model.protocol.ShuttleProtocol; | 
 |  |  | import com.zy.asrs.wcs.rcs.service.MotionService; | 
 |  |  | 
 |  |  |          * 5.穿梭车入库至目标库位 | 
 |  |  |          */ | 
 |  |  |         if (task.getTaskSts() == TaskStsType.NEW_INBOUND.sts) { | 
 |  |  |             // lift | 
 |  |  |             LiftThread liftThread = liftDispatcher.queryLiftForTransport(task.getOriginSite()); | 
 |  |  |             LiftProtocol liftProtocol = liftThread.getStatus(); | 
 |  |  |             if (liftProtocol == null) { | 
 |  |  |                 return motionList; | 
 |  |  |             } | 
 |  |  | //            // lift | 
 |  |  | //            LiftThread liftThread = liftDispatcher.queryLiftForTransport(task.getOriginSite()); | 
 |  |  | //            LiftProtocol liftProtocol = liftThread.getStatus(); | 
 |  |  | //            if (liftProtocol == null) { | 
 |  |  | //                return motionList; | 
 |  |  | //            } | 
 |  |  |  | 
 |  |  |             // shuttle | 
 |  |  |             ShuttleThread shuttleThread = shuttleDispatcher.queryShuttleWhichConvenient(task, Integer.parseInt(liftThread.getStatus().getLiftNo())); | 
 |  |  | //            ShuttleThread shuttleThread = shuttleDispatcher.queryShuttleWhichConvenient(task, Integer.parseInt(liftThread.getStatus().getLiftNo())); | 
 |  |  | //            ShuttleThread shuttleThread = shuttleDispatcher.queryShuttleWhichConvenient(task, 1); | 
 |  |  |             ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, 6); | 
 |  |  |             if (Cools.isEmpty(shuttleThread)) { return motionList; } | 
 |  |  |             ShuttleProtocol shuttleProtocol = shuttleThread.getStatus(); | 
 |  |  |             String shuttleLocNo = shuttleProtocol.getCurrentLocNo(); | 
 |  |  | //            String shuttleLocNo = shuttleProtocol.getCurrentLocNo(); | 
 |  |  |             String shuttleLocNo = "0100201"; | 
 |  |  |  | 
 |  |  | //            // conveyor | 
 |  |  | //            DevpSlave devpSlave = conveyorDispatcher.queryByInBound(task.getSourceStaNo()); | 
 |  |  | 
 |  |  | //                return motionList; | 
 |  |  | //            } | 
 |  |  |  | 
 |  |  |             //穿梭车到提升机库位号 | 
 |  |  |             String liftLocNoTo = LiftCodeType.getLocNo(Integer.parseInt(liftNo), Utils.getLev(shuttleLocNo), task.getHostId()); | 
 |  |  |  | 
 |  |  |             //穿梭车出提升机库位号 | 
 |  |  |             String liftLocNoFrom = LiftCodeType.getLocNo(Integer.parseInt(liftNo), Utils.getLev(task.getDestLoc()), task.getHostId()); | 
 |  |  |  | 
 |  |  |             //穿梭车到提升机待机位库位号 | 
 |  |  |             String standbyLocNoTo = LiftCodeType.getStandbyLocNo(Integer.parseInt(liftNo), Utils.getLev(shuttleLocNo)); | 
 |  |  |  | 
 |  |  |             //穿梭车出提升机待机位库位号 | 
 |  |  |             String standbyLocNoFrom = LiftCodeType.getStandbyLocNo(Integer.parseInt(liftNo), Utils.getLev(task.getDestLoc())); | 
 |  |  | //            //穿梭车到提升机库位号 | 
 |  |  | //            String liftLocNoTo = LiftCodeType.getLocNo(Integer.parseInt(liftNo), Utils.getLev(shuttleLocNo), task.getHostId()); | 
 |  |  | // | 
 |  |  | //            //穿梭车出提升机库位号 | 
 |  |  | //            String liftLocNoFrom = LiftCodeType.getLocNo(Integer.parseInt(liftNo), Utils.getLev(task.getDestLoc()), task.getHostId()); | 
 |  |  | // | 
 |  |  | //            //穿梭车到提升机待机位库位号 | 
 |  |  | //            String standbyLocNoTo = LiftCodeType.getStandbyLocNo(Integer.parseInt(liftNo), Utils.getLev(shuttleLocNo)); | 
 |  |  | // | 
 |  |  | //            //穿梭车出提升机待机位库位号 | 
 |  |  | //            String standbyLocNoFrom = LiftCodeType.getStandbyLocNo(Integer.parseInt(liftNo), Utils.getLev(task.getDestLoc())); | 
 |  |  |  | 
 |  |  |             // 入库目标层有穿梭车 | 
 |  |  |             if (Utils.getLev(shuttleLocNo) == Utils.getLev(task.getOriginLoc())) { | 
 |  |  |             if (Utils.getLev(shuttleLocNo) == Utils.getLev(task.getDestLoc())) { | 
 |  |  |  | 
 |  |  |                 // 穿梭车走行至库位 | 
 |  |  |                 motionList.addAll(kernelService.shuttleMove( | 
 |  |  | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |             shuttleNo = String.valueOf(shuttleProtocol.getShuttleNo()); | 
 |  |  |             liftNo = String.valueOf(liftProtocol.getLiftNo()); | 
 |  |  | //            liftNo = String.valueOf(liftProtocol.getLiftNo()); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         /** | 
 
 |  |  | 
 |  |  |  | 
 |  |  |     List<Task> selectByExecuteSts(); | 
 |  |  |  | 
 |  |  |     List<Task> selectWaitAnalyzeInBoundTask(); | 
 |  |  |  | 
 |  |  | } | 
 
 |  |  | 
 |  |  |  | 
 |  |  | public enum WorkZoneType { | 
 |  |  |  | 
 |  |  |     FIRST_ZONE(new ArrayList<Integer>(){{add(1);add(2);}}, 2, 1), | 
 |  |  |     SECOND_ZONE(new ArrayList<Integer>(){{add(3);add(4);}}, 2, 1), | 
 |  |  |     FIRST_ZONE(new ArrayList<Integer>(){{add(1);add(2);}}, 1, 1), | 
 |  |  |     SECOND_ZONE(new ArrayList<Integer>(){{add(3);add(4);}}, 1, 1), | 
 |  |  |     THIRD_ZONE(new ArrayList<Integer>(){{add(5);add(6);add(7);add(8);add(9);add(10);add(11);}}, 1, 2) | 
 |  |  |     ; | 
 |  |  |  | 
 |  |  | 
 |  |  |  | 
 |  |  |     public static WorkZoneType query(String sta) { | 
 |  |  |         for (WorkZoneType value : WorkZoneType.values()) { | 
 |  |  |             if (value.staList.contains(String.valueOf(sta))) { | 
 |  |  |             if (value.staList.contains(Integer.valueOf(sta))) { | 
 |  |  |                 return value; | 
 |  |  |             } | 
 |  |  |         } | 
 
 |  |  | 
 |  |  |  | 
 |  |  |     List<Task> selectByExecuteSts(); | 
 |  |  |  | 
 |  |  |     List<Task> selectWaitAnalyzeInBoundTask(); | 
 |  |  |  | 
 |  |  | } | 
 
 |  |  | 
 |  |  | package com.zy.asrs.wcs.core.service.impl; | 
 |  |  |  | 
 |  |  | import com.alibaba.fastjson.JSON; | 
 |  |  | import com.alibaba.fastjson.JSONObject; | 
 |  |  | import com.zy.asrs.wcs.core.entity.Task; | 
 |  |  | import com.zy.asrs.wcs.core.kernel.AnalyzeService; | 
 |  |  | import com.zy.asrs.wcs.core.model.enums.TaskStsType; | 
 |  |  | import com.zy.asrs.wcs.core.service.TaskService; | 
 |  |  | import com.zy.asrs.wcs.rcs.News; | 
 |  |  | import com.zy.asrs.wcs.rcs.entity.Motion; | 
 |  |  | import com.zy.asrs.wcs.rcs.service.MotionService; | 
 |  |  | 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.util.Date; | 
 |  |  | import java.util.List; | 
 |  |  | 
 |  |  | @Transactional | 
 |  |  | public class MainServiceImpl { | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private TaskService taskService; | 
 |  |  |     @Autowired | 
 |  |  |     private AnalyzeService analyzeService; | 
 |  |  |     @Autowired | 
 |  |  |     private MotionService motionService; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 组托 | 
 |  |  |      * 入库站,根据条码扫描生成入库工作档,工作状态 2 | 
 |  |  | 
 |  |  |  | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     // 解析入库工作档 | 
 |  |  |     public synchronized void analyzeInBoundTask() { | 
 |  |  |         for (Task task : taskService.selectWaitAnalyzeInBoundTask()) { | 
 |  |  |             // generate motion list | 
 |  |  |             List<Motion> motionList = analyzeService.generateMotion(task); | 
 |  |  |             if (motionList.isEmpty()) { | 
 |  |  |                 continue; | 
 |  |  |             } | 
 |  |  |             motionService.batchInsert(motionList, task.getUuid(), Integer.valueOf(task.getTaskNo())); | 
 |  |  |  | 
 |  |  |             // 更新工作主档 | 
 |  |  |             task.setTaskSts(TaskStsType.ANALYZE_INBOUND.sts); // 工作状态 | 
 |  |  |             task.setUpdateTime(new Date()); | 
 |  |  |             if (!taskService.updateById(task)) { | 
 |  |  |                 News.error("更新工作档失败!!! [工作号:{}]", task.getTaskNo()); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | } | 
 
 |  |  | 
 |  |  |     public List<Task> selectByExecuteSts() { | 
 |  |  |         return this.baseMapper.selectByExecuteSts(); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @Override | 
 |  |  |     public List<Task> selectWaitAnalyzeInBoundTask() { | 
 |  |  |         return this.baseMapper.selectWaitAnalyzeInBoundTask(); | 
 |  |  |     } | 
 |  |  | } | 
 
 |  |  | 
 |  |  | import java.text.SimpleDateFormat; | 
 |  |  | import java.util.Date; | 
 |  |  |  | 
 |  |  | import com.zy.asrs.wcs.core.entity.DeviceCtg; | 
 |  |  | import com.zy.asrs.wcs.core.service.DeviceCtgService; | 
 |  |  | import com.zy.asrs.wcs.rcs.service.DeviceTypeService; | 
 |  |  | import com.zy.asrs.wcs.system.entity.Host; | 
 |  |  | import com.zy.asrs.wcs.system.entity.User; | 
 |  |  | 
 |  |  |      * 设备类型 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value= "设备类型") | 
 |  |  |     private Long deviceType; | 
 |  |  |     private Long deviceCtg; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 编号 | 
 |  |  | 
 |  |  |  | 
 |  |  |     public MotionCtg() {} | 
 |  |  |  | 
 |  |  |     public MotionCtg(Long deviceType,String uuid,String name,String flag,Integer status,Long createBy,Date createTime,Long updateBy,Date updateTime,String memo,Integer deleted,Long hostId) { | 
 |  |  |         this.deviceType = deviceType; | 
 |  |  |     public MotionCtg(Long deviceCtg,String uuid,String name,String flag,Integer status,Long createBy,Date createTime,Long updateBy,Date updateTime,String memo,Integer deleted,Long hostId) { | 
 |  |  |         this.deviceCtg = deviceCtg; | 
 |  |  |         this.uuid = uuid; | 
 |  |  |         this.name = name; | 
 |  |  |         this.flag = flag; | 
 |  |  | 
 |  |  | //            null    // 所属机构 | 
 |  |  | //    ); | 
 |  |  |  | 
 |  |  |     public String getDeviceType$(){ | 
 |  |  |         DeviceTypeService service = SpringUtils.getBean(DeviceTypeService.class); | 
 |  |  |         DeviceType deviceType = service.getById(this.deviceType); | 
 |  |  |         if (!Cools.isEmpty(deviceType)){ | 
 |  |  |             return String.valueOf(deviceType.getId()); | 
 |  |  |     public String getDeviceCtg$(){ | 
 |  |  |         DeviceCtgService service = SpringUtils.getBean(DeviceCtgService.class); | 
 |  |  |         DeviceCtg deviceCtg = service.getById(this.deviceCtg); | 
 |  |  |         if (!Cools.isEmpty(deviceCtg)){ | 
 |  |  |             return String.valueOf(deviceCtg.getId()); | 
 |  |  |         } | 
 |  |  |         return null; | 
 |  |  |     } | 
 
 |  |  | 
 |  |  |  | 
 |  |  |     Motion selectOfNext(String uuid, Motion motion); | 
 |  |  |  | 
 |  |  |     // 持久化 motion 并生产priority | 
 |  |  |     int batchInsert(List<Motion> motionList, String uuid, Integer taskNo); | 
 |  |  |  | 
 |  |  | } | 
 
 |  |  | 
 |  |  | package com.zy.asrs.wcs.rcs.service.impl; | 
 |  |  |  | 
 |  |  | import com.alibaba.fastjson.JSON; | 
 |  |  | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 
 |  |  | import com.zy.asrs.framework.exception.CoolException; | 
 |  |  | import com.zy.asrs.wcs.core.model.enums.DeviceCtgType; | 
 |  |  | 
 |  |  |     public Motion selectOfNext(String uuid, Motion motion) { | 
 |  |  |         return this.baseMapper.selectOfNext(uuid, motion.getPriority(), motion.getHostId()); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @Override | 
 |  |  |     public int batchInsert(List<Motion> motionList, String uuid, Integer taskNo) { | 
 |  |  |         int i = motionList.size(); | 
 |  |  |         for (Motion motion : motionList) { | 
 |  |  |             motion.setPriority(i); | 
 |  |  |             motion.setWrkNo(taskNo); | 
 |  |  |             motion.setUuid(uuid); | 
 |  |  |             if (!this.save(motion)) { | 
 |  |  |                 throw new CoolException(JSON.toJSONString(motion) + "动作保存失败"); | 
 |  |  |             } | 
 |  |  |             i -= 1; | 
 |  |  |         } | 
 |  |  |         return motionList.size(); | 
 |  |  |     } | 
 |  |  | } | 
 
 |  |  | 
 |  |  |         order by priority desc,start_time,task_no asc | 
 |  |  |     </select> | 
 |  |  |  | 
 |  |  |     <select id="selectWaitAnalyzeInBoundTask" resultType="com.zy.asrs.wcs.core.entity.Task"> | 
 |  |  |         select * from wcs_task where task_ctg = 1 and task_sts = 1 | 
 |  |  |     </select> | 
 |  |  |  | 
 |  |  | </mapper> | 
 
 |  |  | 
 |  |  | <mapper namespace="com.zy.asrs.wcs.rcs.mapper.MotionMapper"> | 
 |  |  |  | 
 |  |  |     <select id="selectOfTop1" resultType="com.zy.asrs.wcs.rcs.entity.Motion"> | 
 |  |  |         select top 1 * from rcs_motion | 
 |  |  |         select * from rcs_motion | 
 |  |  |         where 1=1 | 
 |  |  |         and uuid = #{uuid} | 
 |  |  |         and motion_sts = #{motionSts} | 
 |  |  |         order by priority desc | 
 |  |  |         limit 0,1 | 
 |  |  |     </select> | 
 |  |  |  | 
 |  |  |     <select id="selectOfNext" resultType="com.zy.asrs.wcs.rcs.entity.Motion"> |