| New file |
| | |
| | | package com.zy.acs.manager.core.service; |
| | | |
| | | import com.zy.acs.manager.manager.entity.Segment; |
| | | import com.zy.acs.manager.manager.entity.Sta; |
| | | import com.zy.acs.manager.manager.entity.Task; |
| | | import com.zy.acs.manager.manager.enums.StaReserveType; |
| | | |
| | | public interface ConveyorStationService { |
| | | |
| | | boolean allowAgvWork(Sta sta, Task task, Segment seg, StaReserveType type); |
| | | |
| | | } |
| | |
| | | private ActionSorter actionSorter; |
| | | @Autowired |
| | | private StaReserveService staReserveService; |
| | | @Autowired |
| | | private ConveyorStationService conveyorStationService; |
| | | |
| | | @SuppressWarnings("all") |
| | | @Transactional |
| | |
| | | case ORI_STA: |
| | | sta = staService.getById(currTask.getOriSta()); |
| | | success = staReserveService.waitingStaReserve(sta, currTask, 1, StaReserveType.OUT); |
| | | |
| | | boolean permit = conveyorStationService.allowAgvWork(sta, currTask, currSeg, StaReserveType.OUT); |
| | | |
| | | // load sta |
| | | // remove expiredTime |
| | | break; |
| New file |
| | |
| | | package com.zy.acs.manager.core.service; |
| | | |
| | | import com.zy.acs.manager.manager.entity.Segment; |
| | | import com.zy.acs.manager.manager.entity.Sta; |
| | | import com.zy.acs.manager.manager.entity.Task; |
| | | import com.zy.acs.manager.manager.enums.StaReserveType; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service |
| | | public class SiemensConveyorStationService implements ConveyorStationService { |
| | | |
| | | @Override |
| | | public boolean allowAgvWork(Sta sta, Task task, Segment seg, StaReserveType type) { |
| | | return true; |
| | | } |
| | | |
| | | } |
| | |
| | | , @Param("staId") Long staId |
| | | , @Param("type") String type |
| | | , @Param("state") String state |
| | | , @Param("extendMs") Long extendMs |
| | | ); |
| | | |
| | | } |
| | |
| | | public class StaReserveServiceImpl extends ServiceImpl<StaReserveMapper, StaReserve> implements StaReserveService { |
| | | |
| | | public static final Long RESERVE_EXPIRE_TIME = 30 * 60 * 1000L; |
| | | public static final Long WAITING_EXPIRE_TIME = 5 * 60 * 1000L; |
| | | |
| | | public static final Integer DEFAULT_QTY = 1; |
| | | |
| | |
| | | qty = Optional.ofNullable(qty).orElse(DEFAULT_QTY); |
| | | |
| | | // update reserve to be waiting state |
| | | if (0 < this.baseMapper.updateStateToWaiting(sta.getId() |
| | | int changed = this.baseMapper.updateStateToWaiting(sta.getId() |
| | | , task.getId() |
| | | , type.toString() |
| | | , StaReserveStateType.WAITING.toString())) { |
| | | , StaReserveStateType.WAITING.toString() |
| | | , WAITING_EXPIRE_TIME |
| | | ); |
| | | if (changed > 0) { |
| | | return true; |
| | | } |
| | | |
| | |
| | | UPDATE man_sta_reserve |
| | | SET state = #{state}, |
| | | waiting_at = IFNULL(waiting_at, NOW()), |
| | | expire_time = DATE_ADD(NOW(), INTERVAL #{extendMs} MILLISECOND), |
| | | update_time = NOW() |
| | | WHERE task_id = #{taskId} |
| | | AND sta_id = #{staId} |