package com.zy.asrs.task.NewWay;
|
|
import com.baomidou.mybatisplus.mapper.EntityWrapper;
|
import com.core.common.Cools;
|
import com.core.common.R;
|
import com.zy.asrs.controller.MobileController;
|
import com.zy.asrs.entity.LocMast;
|
import com.zy.asrs.entity.WrkMast;
|
import com.zy.asrs.entity.param.EmptyPlateOutParam;
|
import com.zy.asrs.service.WorkService;
|
import com.zy.asrs.service.WrkMastService;
|
import com.zy.asrs.service.impl.LocMastServiceImpl;
|
import com.zy.system.entity.Config;
|
import com.zy.system.service.ConfigService;
|
import org.slf4j.Logger;
|
import org.slf4j.LoggerFactory;
|
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 vincent on 2020/7/7
|
*/
|
@Component
|
public class AutoEmptyOutTaskscheduler {
|
|
private static final Logger log = LoggerFactory.getLogger(AutoEmptyOutTaskscheduler.class);
|
|
@Autowired
|
private WrkMastService wrkMastService;
|
@Autowired
|
private MobileController mobileController;
|
@Autowired
|
private LocMastServiceImpl locMastService;
|
@Autowired
|
private WorkService workService;
|
@Autowired
|
private ConfigService configService;
|
|
/**
|
* 自动生成空板出库任务给RCS
|
*/
|
@Scheduled(cron = "0/3 * * * * ? ")
|
private synchronized void execute(){
|
List<WrkMast> wrkMastsEmpty = wrkMastService.selectList(new EntityWrapper<WrkMast>().eq("io_type",110));
|
if (!Cools.isEmpty(wrkMastsEmpty)){
|
return;
|
}
|
WrkMast wrkMast = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("io_type", 1).ge("wrk_sts", 3));
|
if (!Cools.isEmpty(wrkMast)){
|
//生成空板出库任务
|
EmptyPlateOutParam emptyPlateOutParam = new EmptyPlateOutParam();
|
emptyPlateOutParam.setOutSite(102);
|
List<String> strings= new ArrayList<>();
|
|
//查看空板
|
List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("loc_sts", "D").orderBy("row1",true));
|
if (Cools.isEmpty(locMasts)){
|
log.error("中转库没有空板!!!!");
|
return;
|
}
|
//获取空栈板库位
|
strings.add(locMasts.get(0).getLocNo());
|
emptyPlateOutParam.setLocNos(strings);
|
emptyPlateOutParam.setOutSite(Integer.valueOf(wrkMast.getMemo()));
|
workService.emptyPlateOut(wrkMast.getMemo(),emptyPlateOutParam, 9955L);
|
}
|
}
|
}
|