package com.zy.asrs.task; import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.core.common.Cools; import com.zy.asrs.entity.BasDevp; import com.zy.asrs.entity.WrkMast; import com.zy.asrs.entity.WrkMastSta; import com.zy.asrs.service.BasDevpService; import com.zy.asrs.service.WrkMastService; import com.zy.asrs.task.core.ReturnT; import com.zy.asrs.task.handler.WrkMastStaInItHandler; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; import java.util.ArrayList; import java.util.List; /** * Created by Monkey D. Luffy on 2023.07.25 * 徐工汉云..............以下.............上饶江铜.............自动补空板 */ @Component public class WrkMastStaInItScheduler { @Autowired private WrkMastStaInItHandler wrkMastStaInItHandler; @Autowired private BasDevpService basDevpService; @Autowired private WrkMastService wrkMastService; public static final List STA_WORK_CU = new ArrayList() {{ add(101);add(102);add(104);add(105);add(107);add(108);add(110);add(111);add(113);add(114);add(116);add(117); }}; public static final List STA_WORK_RU = new ArrayList() {{ add(118);add(119);add(120);add(121);add(122);add(123); }}; @Scheduled(cron = "0/3 * * * * ? ") private void execute(){ for(Integer staNo : STA_WORK_CU){ BasDevp basDevp = basDevpService.selectById(staNo); if (basDevp.getWrkNo()!=0 && basDevp.getLoading().equals("Y") && basDevp.getAutoing().equals("Y")){ WrkMast wrkMast = wrkMastService.selectOne(new EntityWrapper().eq("wrk_no", basDevp.getWrkNo())); if(Cools.isEmpty(wrkMast)){ continue; } if (wrkMast.getIoType()<100 || wrkMast.getIoType()==110){ if (!wrkMast.getStaNo().equals(122)){ continue; } } if (wrkMast.getWrkSts()!=14 && wrkMast.getWrkSts()!=15){ continue; } boolean wrkTypeSign = fullKM(wrkMast); if (!Cools.isEmpty(wrkMast)){ if (wrkTypeSign) { // ReturnT result = wrkMastStaInItHandler.start(wrkMast,basDevp,11);//1:取(叠盘) // if (result.getCode()==200){ // continue; // }else { // System.out.println(staNo+"失败!"); // } ReturnT result = wrkMastStaInItHandler.start(wrkMast,basDevp,13);//3:取放 if (result.getCode()==200){ continue; }else { System.out.println(staNo+"失败!"); } } else { ReturnT result = wrkMastStaInItHandler.start(wrkMast,basDevp,13);//3:取放 if (result.getCode()==200){ continue; }else { System.out.println(staNo+"失败!"); } } } } } for(Integer staNo : STA_WORK_RU){ BasDevp basDevp = basDevpService.selectById(staNo); if (basDevp.getWrkNo()!=0 && basDevp.getLoading().equals("Y") && basDevp.getAutoing().equals("Y")){ WrkMast wrkMast = wrkMastService.selectOne(new EntityWrapper().eq("wrk_no", basDevp.getWrkNo())); if (wrkMast.getWrkSts()!=2 || wrkMast.getIoType()==10){ continue; } // boolean wrkTypeSign = fullKM(wrkMast); if (!Cools.isEmpty(wrkMast)){ // if (wrkTypeSign){ ReturnT result = wrkMastStaInItHandler.start(wrkMast,basDevp,13); if (result.getCode()==200) { continue; } else { System.out.println(staNo+"失败!"); } // }else { // ReturnT result = wrkMastStaInItHandler.start(wrkMast,basDevp,23); // if (result.getCode()==200) { // continue; // } else { // System.out.println(staNo+"失败!"); // } // } } } } } public boolean fullKM(WrkMast wrkMast){ if (wrkMast.getIoType()!=10 && wrkMast.getIoType()!=110){ return true; } return false; } }