add:海柔输送线申请空框任务
This commit is contained in:
@@ -1,22 +1,24 @@
|
|||||||
package org.nl.acs.device_driver.basedriver.hailiang_old.hailiang_hr_ssx;
|
package org.nl.acs.device_driver.basedriver.hailiang_old.hailiang_hr_ssx;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import cn.hutool.http.HttpResponse;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.nl.acs.acsEnum.StatusEnum;
|
||||||
import org.nl.acs.acsEnum.WorkerOrderEnum;
|
import org.nl.acs.acsEnum.WorkerOrderEnum;
|
||||||
import org.nl.acs.device_driver.DeviceDriver;
|
import org.nl.acs.device_driver.DeviceDriver;
|
||||||
import org.nl.acs.device_driver.RouteableDeviceDriver;
|
import org.nl.acs.device_driver.RouteableDeviceDriver;
|
||||||
import org.nl.acs.device_driver.basedriver.hailiang_one.IssuedDeviceOrderInfo;
|
import org.nl.acs.device_driver.basedriver.hailiang_one.IssuedDeviceOrderInfo;
|
||||||
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
|
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
|
||||||
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
||||||
import org.nl.acs.ext.wms.liKuData.Resp;
|
|
||||||
import org.nl.acs.ext.wms.liKuData.a.ContainerArrivedRequest;
|
|
||||||
import org.nl.acs.ext.wms.liKuData.a.NodeStates;
|
|
||||||
import org.nl.acs.ext.wms.service.AcsToLiKuService;
|
import org.nl.acs.ext.wms.service.AcsToLiKuService;
|
||||||
|
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||||
import org.nl.acs.ext.wms.service.LiKuToAcsService;
|
import org.nl.acs.ext.wms.service.LiKuToAcsService;
|
||||||
import org.nl.acs.ext.wms.service.impl.AcsToLiKuServiceImpl;
|
import org.nl.acs.ext.wms.service.impl.AcsToLiKuServiceImpl;
|
||||||
|
import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl;
|
||||||
import org.nl.acs.ext.wms.service.impl.LiKuToAcsServiceImpl;
|
import org.nl.acs.ext.wms.service.impl.LiKuToAcsServiceImpl;
|
||||||
import org.nl.acs.history.ErrorUtil;
|
import org.nl.acs.history.ErrorUtil;
|
||||||
import org.nl.acs.history.service.DeviceErrorLogService;
|
import org.nl.acs.history.service.DeviceErrorLogService;
|
||||||
@@ -33,7 +35,6 @@ import org.nl.acs.task.service.dto.TaskDto;
|
|||||||
import org.nl.modules.wql.util.SpringContextHolder;
|
import org.nl.modules.wql.util.SpringContextHolder;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -53,6 +54,8 @@ public class HailiangHrSsxDeviceDriver extends AbstractOpcDeviceDriver implement
|
|||||||
AcsToLiKuService acsToLiKuService = SpringContextHolder.getBean(AcsToLiKuServiceImpl.class);
|
AcsToLiKuService acsToLiKuService = SpringContextHolder.getBean(AcsToLiKuServiceImpl.class);
|
||||||
@Autowired
|
@Autowired
|
||||||
TaskService taskServer = SpringContextHolder.getBean("taskServiceImpl");
|
TaskService taskServer = SpringContextHolder.getBean("taskServiceImpl");
|
||||||
|
@Autowired
|
||||||
|
AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsServiceImpl.class);
|
||||||
|
|
||||||
int heartbeat = 0;
|
int heartbeat = 0;
|
||||||
int mode = 0;
|
int mode = 0;
|
||||||
@@ -156,6 +159,13 @@ public class HailiangHrSsxDeviceDriver extends AbstractOpcDeviceDriver implement
|
|||||||
Instruction instruction = null;
|
Instruction instruction = null;
|
||||||
List toInstructions;
|
List toInstructions;
|
||||||
|
|
||||||
|
String applyEmpty = ObjectUtil.isEmpty(this.getDevice().getExtraValue().get("apply_task")) ? "false" : this.getDevice().getExtraValue().get("apply_task").toString();
|
||||||
|
if (StrUtil.equals("true", applyEmpty)) {
|
||||||
|
//申请空框任务
|
||||||
|
if (mode == 2 && move == 0 && !requireSucess) {
|
||||||
|
this.applyEmptyTask();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -167,6 +177,23 @@ public class HailiangHrSsxDeviceDriver extends AbstractOpcDeviceDriver implement
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 申请出空框任务
|
||||||
|
*/
|
||||||
|
public void applyEmptyTask() {
|
||||||
|
JSONObject reqParam = new JSONObject();
|
||||||
|
reqParam.put("device_code", this.getDevice_code());
|
||||||
|
reqParam.put("type", StatusEnum.HAIROU_LIKU_REQ.getCode());
|
||||||
|
reqParam.put("item_type", StatusEnum.HAIROU_EMPTY_OUT_REQ.getCode());
|
||||||
|
reqParam.put("number", this.getDevice().getExtraValue().get("apply_num"));
|
||||||
|
HttpResponse httpResponse = acsToWmsService.applyTaskToWms(reqParam);
|
||||||
|
if (httpResponse != null && httpResponse.getStatus() == 200) {
|
||||||
|
requireSucess = true;
|
||||||
|
log.info("{}:申请空框任务成功!", this.getDevice_code());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JSONObject getDeviceStatusName() {
|
public JSONObject getDeviceStatusName() {
|
||||||
JSONObject jo = new JSONObject();
|
JSONObject jo = new JSONObject();
|
||||||
@@ -226,7 +253,6 @@ public class HailiangHrSsxDeviceDriver extends AbstractOpcDeviceDriver implement
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void issuedOrderFinish(String autoFinish) {
|
public void issuedOrderFinish(String autoFinish) {
|
||||||
if (StrUtil.equals(autoFinish, WorkerOrderEnum.FORCEFINISH.getCode())) {
|
if (StrUtil.equals(autoFinish, WorkerOrderEnum.FORCEFINISH.getCode())) {
|
||||||
|
|||||||
@@ -207,7 +207,7 @@ public class WithStationDeviceDriver extends AbstractOpcDeviceDriver implements
|
|||||||
!requireSucess
|
!requireSucess
|
||||||
) {
|
) {
|
||||||
//判断是否超过等待时间
|
//判断是否超过等待时间
|
||||||
if (new Date().getTime() - hailiangHrSsxDeviceDriver.getInstruction_require_time().getTime()
|
if (System.currentTimeMillis() - hailiangHrSsxDeviceDriver.getInstruction_require_time().getTime()
|
||||||
> Integer.parseInt(this.getExtraValue().get("apply_time").toString()) * 1000) {
|
> Integer.parseInt(this.getExtraValue().get("apply_time").toString()) * 1000) {
|
||||||
//否则对接位单独申请任务
|
//否则对接位单独申请任务
|
||||||
JSONObject reqParam = new JSONObject();
|
JSONObject reqParam = new JSONObject();
|
||||||
|
|||||||
Reference in New Issue
Block a user