package com.zy.acs.manager.core.service;
|
|
import com.zy.acs.framework.common.Cools;
|
import com.zy.acs.manager.manager.entity.Loc;
|
import com.zy.acs.manager.manager.entity.Sta;
|
import com.zy.acs.manager.manager.entity.Task;
|
import com.zy.acs.manager.manager.service.AreaAgvService;
|
import com.zy.acs.manager.manager.service.LocService;
|
import com.zy.acs.manager.manager.service.StaService;
|
import lombok.extern.slf4j.Slf4j;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Service;
|
|
import javax.annotation.PostConstruct;
|
import java.util.ArrayList;
|
import java.util.Collections;
|
import java.util.List;
|
|
@Slf4j
|
@Service
|
public class AgvAreaDispatcher {
|
|
@Autowired
|
private LocService locService;
|
@Autowired
|
private StaService staService;
|
@Autowired
|
private AreaGovernService areaGovernService;
|
@Autowired
|
private AreaAgvService areaAgvService;
|
|
@PostConstruct
|
public void init() {
|
}
|
|
public List<Long> getAgvNosByTask(Task task) {
|
if (null == task) {
|
return null;
|
}
|
Loc oriLoc = null;
|
Sta oriSta = null;
|
Loc destLoc = null;
|
Sta destSta = null;
|
if (null != task.getOriLoc()) {
|
oriLoc = locService.getById(task.getOriLoc());
|
return this.getAgvIdsByCode(oriLoc.getCode$());
|
}
|
if (null != task.getOriSta()) {
|
oriSta = staService.getById(task.getOriSta());
|
return this.getAgvIdsByCode(oriSta.getCode$());
|
}
|
if (null != task.getDestLoc()) {
|
destLoc = locService.getById(task.getDestLoc());
|
return this.getAgvIdsByCode(destLoc.getCode$());
|
}
|
if (null != task.getDestSta()) {
|
destSta = staService.getById(task.getDestSta());
|
return this.getAgvIdsByCode(destSta.getCode$());
|
}
|
return null;
|
}
|
|
public List<Long> getAgvIdsByCode(String code) {
|
if (Cools.isEmpty(code)) {
|
return Collections.emptyList();
|
}
|
List<Long> areaIds = areaGovernService.queryAreas(code);
|
return areaAgvService.queryAgvIdsByAreaIds(areaIds);
|
}
|
|
public List<String> getAgvNosByStaNo(String staNo) {
|
return null;
|
}
|
|
public List<String> getAreaCodeListByAgvNo(String agvNo) {
|
List<String> areaCodeList = new ArrayList<>();
|
return areaCodeList;
|
}
|
|
}
|