| | |
| | | defaultValue="0" |
| | | onChange={moveLocTypeChange} |
| | | style={{ width: 120 }} |
| | | options={[{ value: '0', label: '跑轨道' }, { value: '1', label: '跑库位' }, { value: '2', label: '母轨道循环跑' }, { value: '3', label: '子轨道循环跑' }]} |
| | | options={[{ value: '0', label: '跑轨道' }, { value: '1', label: '跑库位' }, { value: '2', label: '母轨道循环跑' }, { value: '3', label: '子轨道循环跑' }, { value: '4', label: '取放货' }]} |
| | | /> |
| | | </div> |
| | | <Button onClick={() => shuttleMoveLoc()}>跑库</Button> |
| | |
| | | { value: '0', label: '跑轨道' }, |
| | | { value: '1', label: '跑库位' }, |
| | | { value: '2', label: '母轨道循环跑' }, |
| | | { value: '3', label: '子轨道循环跑' } |
| | | { value: '3', label: '子轨道循环跑' }, |
| | | { value: '4', label: '取放货' } |
| | | ]} |
| | | /> |
| | | </div> |
| | |
| | | import com.zy.asrs.wcs.core.model.command.ShuttleAssignCommand; |
| | | import com.zy.asrs.wcs.core.model.command.ShuttleCommand; |
| | | import com.zy.asrs.wcs.core.model.command.ShuttleRedisCommand; |
| | | import com.zy.asrs.wcs.core.model.enums.LocStsType; |
| | | import com.zy.asrs.wcs.core.model.enums.MotionCtgType; |
| | | import com.zy.asrs.wcs.core.model.enums.ShuttleCommandModeType; |
| | | import com.zy.asrs.wcs.core.model.enums.ShuttleTaskModeType; |
| | |
| | | } |
| | | } |
| | | } |
| | | } else if (shuttleProtocol.getMoveType() == 4) {//取放货 |
| | | Integer xCurrent = shuttleProtocol.getXCurrent(); |
| | | if (xCurrent > shuttleProtocol.getXTarget()) {//当X值大于X目标值,进行归零且Y方向+1 |
| | | shuttleProtocol.setXCurrent(shuttleProtocol.getXStart()); |
| | | shuttleProtocol.setYCurrent(shuttleProtocol.getYCurrent() + 1); |
| | | return; |
| | | } |
| | | |
| | | //搜索有货库位 |
| | | List<Loc> list = locService.list(new LambdaQueryWrapper<Loc>() |
| | | .eq(Loc::getLocSts, LocStsType.F.val()) |
| | | .eq(Loc::getHostId, device.getHostId()) |
| | | .eq(Loc::getStatus, 1)); |
| | | if (list.isEmpty()) { |
| | | return; |
| | | } |
| | | |
| | | Loc start = list.get(0); |
| | | |
| | | Integer yCurrent = shuttleProtocol.getYCurrent(); |
| | | String locNo = Utils.getLocNo(xCurrent, yCurrent, lev); |
| | | Loc target = locService.getOne(new LambdaQueryWrapper<Loc>() |
| | | .eq(Loc::getLocNo, locNo) |
| | | .eq(Loc::getHostId, device.getHostId()) |
| | | .eq(Loc::getStatus, 1)); |
| | | if (target == null) { |
| | | shuttleProtocol.setXCurrent(shuttleProtocol.getXCurrent() + 1); |
| | | return; |
| | | } |
| | | |
| | | if (target.getLocSts() != LocStsType.O.val()) { |
| | | shuttleProtocol.setXCurrent(shuttleProtocol.getXCurrent() + 1); |
| | | return; |
| | | } |
| | | |
| | | //调度去目标位置 |
| | | if (shuttleProtocol.getCurrentLocNo().equals(target.getLocNo())) { |
| | | shuttleProtocol.setXCurrent(shuttleProtocol.getXCurrent() + 1);//小车和目标位置一致,跳过 |
| | | } else { |
| | | Task task = shuttleDispatcher.generateManuaTakeMoveTask(device, start.getLocNo(), target.getLocNo()); |
| | | if(task != null) {//调度成功 |
| | | shuttleProtocol.setXCurrent(shuttleProtocol.getXCurrent() + 1); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | Task selectMoveWorking(Integer shuttleNo); |
| | | |
| | | Task selectManualWorking(Integer shuttleNo); |
| | | |
| | | List<Task> selectWorkingByShuttle(Integer shuttleNo); |
| | | |
| | | List<Task> selectWorkingByLift(Integer liftNo); |
| | |
| | | |
| | | Task selectMoveWorking(Integer shuttleNo); |
| | | |
| | | Task selectManualWorking(Integer shuttleNo); |
| | | |
| | | List<Task> selectWorkingByShuttle(Integer shuttleNo); |
| | | |
| | | List<Task> selectWorkingByLift(Integer liftNo); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public Task selectManualWorking(Integer shuttleNo) { |
| | | return this.baseMapper.selectManualWorking(shuttleNo); |
| | | } |
| | | |
| | | @Override |
| | | public List<Task> selectWorkingByShuttle(Integer shuttleNo) { |
| | | return this.baseMapper.selectWorkingByShuttle(shuttleNo); |
| | | } |
| | |
| | | locService.updateById(destLoc); |
| | | } |
| | | } else if (task.getRecordLoc().equals("record-dest")) {//只记录目标库位信息 |
| | | //目标库位 => 在库 |
| | | Loc destLoc = locService.selectByLocNo(task.getDestLoc()); |
| | | if (destLoc != null) { |
| | | destLoc.setLocSts(LocStsType.F.val()); |
| | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.zy.asrs.framework.common.Cools; |
| | | import com.zy.asrs.framework.common.R; |
| | | import com.zy.asrs.framework.common.SnowflakeIdWorker; |
| | | import com.zy.asrs.framework.exception.CoolException; |
| | | import com.zy.asrs.wcs.core.entity.*; |
| | |
| | | return task; |
| | | } |
| | | |
| | | //生成手动取放货任务 |
| | | public synchronized Task generateManuaTakeMoveTask(Device device, String sourceLocNo, String locNo) { |
| | | // 已有手动任务 |
| | | if (taskService.selectManualWorking(Integer.valueOf(device.getDeviceNo())) != null) { |
| | | return null; |
| | | } |
| | | |
| | | //获取手动任务类型 |
| | | TaskCtg taskCtg = taskCtgService.getOne(new LambdaQueryWrapper<TaskCtg>() |
| | | .eq(TaskCtg::getFlag, "MANUAL") |
| | | .eq(TaskCtg::getStatus, 1)); |
| | | if (taskCtg == null) { |
| | | return null; |
| | | } |
| | | |
| | | ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, device.getId().intValue()); |
| | | if (shuttleThread == null) { |
| | | return null; |
| | | } |
| | | |
| | | Task task = new Task(); |
| | | task.setUuid(String.valueOf(snowflakeIdWorker.nextId())); |
| | | task.setTaskNo(String.valueOf(Utils.getTaskNo("MANUAL"))); |
| | | task.setTaskSts(TaskStsType.NEW_MANUAL.sts); |
| | | task.setTaskCtg(taskCtg.getId()); |
| | | task.setPriority(10); |
| | | task.setOriginSite(null); |
| | | task.setOriginLoc(sourceLocNo); |
| | | task.setDestSite(null); |
| | | task.setDestLoc(locNo); |
| | | task.setIoTime(new Date()); |
| | | task.setStartTime(new Date()); |
| | | task.setStatus(1); |
| | | task.setMemo("manual"); |
| | | task.setShuttleNo(Integer.valueOf(device.getDeviceNo())); |
| | | task.setRecordLoc("Y");//记录库存信息 |
| | | |
| | | // generate motion list |
| | | List<Motion> motionList = analyzeService.generateShuttleManualMotion(task); |
| | | if (Cools.isEmpty(motionList)) { |
| | | News.error("保存{}号四向穿梭车手动任务失败!!!", device.getDeviceNo()); |
| | | return null; |
| | | } |
| | | motionService.batchInsert(motionList, task.getUuid(), Integer.valueOf(task.getTaskNo()), device.getHostId()); |
| | | |
| | | task.setTaskSts(TaskStsType.ANALYZE_MANUAL.sts); |
| | | |
| | | if (!taskService.save(task)) { |
| | | News.error("保存{}号四向穿梭车手动任务失败!!!", device.getDeviceNo()); |
| | | return null; |
| | | } |
| | | |
| | | return task; |
| | | } |
| | | |
| | | /** |
| | | * 搜索避让库位,通过小车号和目标库位 |
| | | */ |
| | |
| | | order by priority desc,start_time,task_no asc |
| | | </select> |
| | | |
| | | <select id="selectManualWorking" resultType="com.zy.asrs.wcs.core.entity.Task"> |
| | | select * from wcs_task |
| | | where task_sts in (401,402,403) |
| | | and shuttle_no = #{shuttleNo} |
| | | order by priority desc,start_time,task_no asc |
| | | </select> |
| | | |
| | | <select id="selectWorkingByShuttle" resultType="com.zy.asrs.wcs.core.entity.Task"> |
| | | select * from wcs_task |
| | | where task_sts in (1,2,3,101,102,103,301,302,303,401,402,403) |