产线输送机
This commit is contained in:
@@ -1,132 +0,0 @@
|
||||
package com.ruoyi.schedule.scheduleTask.ddj;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.ruoyi.api.domain.agv.genAgvSchedulingTask.GenAgvSchedulingTaskResponse;
|
||||
import com.ruoyi.api.service.IApiService;
|
||||
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||
import com.ruoyi.job.domain.MydoJob;
|
||||
import com.ruoyi.queue.agv.domain.AgvQueue;
|
||||
import com.ruoyi.queue.agv.service.IAgvQueueService;
|
||||
import com.ruoyi.device.ssj.domain.DeviceSsj;
|
||||
import com.ruoyi.schedule.plcRead.ssj.PlcSsjRead;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Slf4j
|
||||
public class Ddj2Thread implements Runnable {
|
||||
|
||||
public HashMap<String, List<String>> ssjCodeList;
|
||||
|
||||
private IApiService apiService;
|
||||
private IAgvQueueService agvQueueService;
|
||||
|
||||
public boolean isRun = true;
|
||||
|
||||
|
||||
public void init() {
|
||||
//todo 获取设备编码列表
|
||||
ssjCodeList = new HashMap<>();
|
||||
ArrayList<String> ssjCodes = new ArrayList<>();
|
||||
ssjCodes.add("G2012");
|
||||
ssjCodes.add("G3009");
|
||||
ssjCodes.add("G3018");
|
||||
ssjCodes.add("G4009");
|
||||
ssjCodes.add("G4018");
|
||||
ssjCodes.add("G5009");
|
||||
ssjCodes.add("G5018");
|
||||
ssjCodeList.put("in", ssjCodes);
|
||||
|
||||
apiService = SpringUtils.getBean(IApiService.class);
|
||||
agvQueueService = SpringUtils.getBean(IAgvQueueService.class);
|
||||
log.info("初始化服务 {},{}", apiService, agvQueueService);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
init();
|
||||
while (isRun){
|
||||
for (String type : ssjCodeList.keySet()) {
|
||||
|
||||
switch ( type){
|
||||
case "in":
|
||||
//正常入库 尾箱回流 物料入库 空料箱入库
|
||||
for (String ssjCode : ssjCodeList.get(type)) {
|
||||
try {
|
||||
if (PlcSsjRead.deviceSsjMap.containsKey(ssjCode)) {
|
||||
inDispatch(PlcSsjRead.deviceSsjMap.get(ssjCode));
|
||||
} else {
|
||||
log.error("设备不存在 ssjCode{}", ssjCode);
|
||||
}
|
||||
} catch (RuntimeException e) {
|
||||
log.error(e.getMessage(),e);
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
try {
|
||||
Thread.sleep(1500);
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void inDispatch(DeviceSsj inSsjDevice) {
|
||||
//如果入库请求1 并且 托盘码不为空
|
||||
if (inSsjDevice.getDw()==1 && inSsjDevice.getRkqq() == 1 && StrUtil.isNotEmpty(inSsjDevice.getTrayCode())) {
|
||||
//判断是否生成队列
|
||||
AgvQueue agvQueueParam = new AgvQueue();
|
||||
agvQueueParam.setWmsTraycode(inSsjDevice.getTrayCode());
|
||||
//agvQueueParam.setStatus("0");
|
||||
List<AgvQueue> agvQueues = agvQueueService.selectAgvQueueList(agvQueueParam);
|
||||
if (CollUtil.isEmpty(agvQueues)) {
|
||||
//根据入口,查询对应的入库作业
|
||||
MydoJob mydoJobParam = new MydoJob();
|
||||
mydoJobParam.setStatus("1");
|
||||
mydoJobParam.setTrayCode(inSsjDevice.getTrayCode());
|
||||
mydoJobParam.setEntranceId(inSsjDevice.getDeviceCode());
|
||||
MydoJob mydoJob = apiService.requestEnterByTrayCode(mydoJobParam);
|
||||
if (ObjUtil.isNotNull(mydoJob)) {
|
||||
|
||||
//生成agv队列
|
||||
// AgvQueue agvQueue = apiService.createAgvQueue(inSsjDevice.getName(), mydoJob.getCargoSpaceId(),mydoJob.getTrayCode(),mydoJob.getTaskNo(),"1");
|
||||
//请求任务生成
|
||||
// GenAgvSchedulingTaskResponse genAgvSchedulingTaskResponse = apiService.requestAgvQueue(agvQueue);
|
||||
// //修改wms任务状态
|
||||
// if (genAgvSchedulingTaskResponse.getCode() == 0) {
|
||||
// //修改ctu执行状态
|
||||
// agvQueue.setStatus("1");
|
||||
// agvQueueService.updateAgvQueue(agvQueue);
|
||||
// log.info("向CTU下入库库作业");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}else {
|
||||
// AgvQueue agvQueue = agvQueues.get(0);
|
||||
// if ("0".equals(agvQueue.getStatus())){
|
||||
// //请求任务生成
|
||||
// GenAgvSchedulingTaskResponse genAgvSchedulingTaskResponse = apiService.requestAgvQueue(agvQueue);
|
||||
// //修改wms任务状态
|
||||
// if (genAgvSchedulingTaskResponse.getCode() == 0) {
|
||||
// //修改ctu执行状态
|
||||
// agvQueue.setStatus("1");
|
||||
// agvQueueService.updateAgvQueue(agvQueue);
|
||||
// log.info("向CTU下入库库作业");
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user