| | |
| | | package com.zy.asrs.task; |
| | | |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.core.common.Cools; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.AgvBasDevp; |
| | | import com.zy.asrs.entity.AgvLocMast; |
| | | import com.zy.asrs.entity.AgvWrkMast; |
| | |
| | | import com.zy.asrs.service.AgvWrkMastService; |
| | | import com.zy.asrs.task.core.ReturnT; |
| | | import com.zy.asrs.task.handler.AutoMoveHandler; |
| | | import com.zy.system.entity.Config; |
| | | import com.zy.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 java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | |
| | | private AgvWrkMastService agvWrkMastService; |
| | | @Autowired |
| | | private AgvBasDevpService agvBasDevpService; |
| | | @Autowired |
| | | private ConfigService configService; |
| | | |
| | | // 调拨出库 |
| | | // @Scheduled(cron = "0/2 * * * * ? ") |
| | |
| | | * ioType 108.自动调拨 |
| | | * crnNo :2目标楼层 |
| | | */ |
| | | @Scheduled(cron = "0/3 * * * * ? ") |
| | | @Scheduled(cron = "0/1 * * * * ? ") |
| | | private synchronized void execute2(){ |
| | | List<AgvWrkMast> agvWrkMastList = agvWrkMastService.selectList(new EntityWrapper<AgvWrkMast>() |
| | | .eq("wrk_sts", 22) |
| | |
| | | try{ |
| | | autoMoveHandler.start2(agvWrkMast); |
| | | } catch (Exception e){ |
| | | log.error("工作号"+agvWrkMast.getWrkNo()+"调拨出库,处理失败:===》异常原因:"+e.getMessage()); |
| | | //log.error("工作号"+agvWrkMast.getWrkNo()+"调拨出库,处理失败:===》异常原因:"+e.getMessage()); |
| | | } |
| | | } |
| | | |
| | |
| | | try{ |
| | | autoMoveHandler.start3(agvWrkMast); |
| | | } catch (Exception e){ |
| | | log.error("工作号"+agvWrkMast.getWrkNo()+"调拨出库,处理失败:===》异常原因:"+e.getMessage()); |
| | | //log.error("工作号"+agvWrkMast.getWrkNo()+"调拨出库,处理失败:===》异常原因:"+e.getMessage()); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 自动移库 |
| | | * |
| | | */ |
| | | @Scheduled(cron = "0/2 * * * * ? ") |
| | | private void autoEmptyBack7() throws ParseException { |
| | | Date now = new Date(); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | String currentDay = sdf.format(now); |
| | | Config config = configService.selectOne(new EntityWrapper<Config>().eq("code", "autoTime")); |
| | | if (Cools.isEmpty(config)) { |
| | | |
| | | } else { |
| | | if (config.getStatus().intValue() == 0) { |
| | | return; |
| | | } |
| | | JSONObject jsonObject = JSON.parseObject(config.getValue().toString()); |
| | | Integer maxTansk = jsonObject.getInteger("maxTansk"); |
| | | //Integer startTime = jsonObject.getInteger("startTime"); |
| | | String startTime = jsonObject.getString("startTime"); |
| | | long time1 = new SimpleDateFormat("yyyy-MM-dd HH:mm").parse(currentDay + " " + startTime).getTime(); |
| | | long time = now.getTime(); |
| | | long time3 = time - time1; |
| | | |
| | | |
| | | |
| | | if (time3 > 0 && time3 < (1000* 60 * 10)) { |
| | | |
| | | List<AgvWrkMast> agvWrkMasts = agvWrkMastService.selectList(new EntityWrapper<AgvWrkMast>().like("loc_no", "02F1").like("source_loc_no", "F1").eq("io_type",12)); |
| | | if (maxTansk <= agvWrkMasts.size()){ |
| | | return; |
| | | } |
| | | |
| | | List<AgvLocMast> agvLocMasts = agvLocMastService.selectList( |
| | | new EntityWrapper<AgvLocMast>() |
| | | .eq("floor", 1) |
| | | .eq("lev1", 1) |
| | | .eq("loc_sts","F") |
| | | .eq("loc_type1",3)); |
| | | if (agvLocMasts.isEmpty()) { |
| | | return; |
| | | } |
| | | for (AgvLocMast agvLocMast : agvLocMasts) { |
| | | try{ |
| | | autoMoveHandler.autoTransfers(agvLocMast,maxTansk); |
| | | } catch (Exception e){ |
| | | log.error("库位号"+agvLocMast.getLocNo()+"定时移库任务 吸塑一楼 --> 吸塑二楼,处理失败:===》异常原因:"+e.getMessage()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |