add:海柔输送线申请空框任务
This commit is contained in:
@@ -1,22 +1,24 @@
|
||||
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.http.HttpResponse;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.Data;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.acsEnum.StatusEnum;
|
||||
import org.nl.acs.acsEnum.WorkerOrderEnum;
|
||||
import org.nl.acs.device_driver.DeviceDriver;
|
||||
import org.nl.acs.device_driver.RouteableDeviceDriver;
|
||||
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.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.AcsToWmsService;
|
||||
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.AcsToWmsServiceImpl;
|
||||
import org.nl.acs.ext.wms.service.impl.LiKuToAcsServiceImpl;
|
||||
import org.nl.acs.history.ErrorUtil;
|
||||
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.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -43,16 +44,18 @@ import java.util.Map;
|
||||
@Data
|
||||
@RequiredArgsConstructor
|
||||
public class HailiangHrSsxDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor, IssuedDeviceOrderInfo {
|
||||
protected ItemProtocol itemProtocol=new ItemProtocol(this);
|
||||
protected ItemProtocol itemProtocol = new ItemProtocol(this);
|
||||
DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl");
|
||||
@Autowired
|
||||
DeviceErrorLogService deviceErrorLogService = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class);
|
||||
@Autowired
|
||||
LiKuToAcsService liKuToAcsService = SpringContextHolder.getBean(LiKuToAcsServiceImpl.class);
|
||||
LiKuToAcsService liKuToAcsService = SpringContextHolder.getBean(LiKuToAcsServiceImpl.class);
|
||||
@Autowired
|
||||
AcsToLiKuService acsToLiKuService = SpringContextHolder.getBean(AcsToLiKuServiceImpl.class);
|
||||
AcsToLiKuService acsToLiKuService = SpringContextHolder.getBean(AcsToLiKuServiceImpl.class);
|
||||
@Autowired
|
||||
TaskService taskServer = SpringContextHolder.getBean("taskServiceImpl");
|
||||
@Autowired
|
||||
AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsServiceImpl.class);
|
||||
|
||||
int heartbeat = 0;
|
||||
int mode = 0;
|
||||
@@ -61,7 +64,7 @@ public class HailiangHrSsxDeviceDriver extends AbstractOpcDeviceDriver implement
|
||||
int task = 0;
|
||||
int move = 0;
|
||||
int to_command = 0;
|
||||
String barcode,last_barcode;
|
||||
String barcode, last_barcode;
|
||||
|
||||
int last_heartbeat = 0;
|
||||
int last_mode = 0;
|
||||
@@ -100,10 +103,10 @@ public class HailiangHrSsxDeviceDriver extends AbstractOpcDeviceDriver implement
|
||||
if (mode != last_mode) {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode:" + last_mode + "->" + mode + "复位请求标记");
|
||||
}
|
||||
if (move != last_move){
|
||||
if (move != last_move) {
|
||||
message = null;
|
||||
requireSucess =false;
|
||||
if (move == 1 && barcode.length() > 0){
|
||||
requireSucess = false;
|
||||
if (move == 1 && barcode.length() > 0) {
|
||||
TaskDto vehicle_dto = taskServer.findByContainer(barcode);
|
||||
if (vehicle_dto == null) {
|
||||
instruction_require_time = new Date();
|
||||
@@ -156,6 +159,13 @@ public class HailiangHrSsxDeviceDriver extends AbstractOpcDeviceDriver implement
|
||||
Instruction instruction = null;
|
||||
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
|
||||
public JSONObject getDeviceStatusName() {
|
||||
JSONObject jo = new JSONObject();
|
||||
@@ -226,7 +253,6 @@ public class HailiangHrSsxDeviceDriver extends AbstractOpcDeviceDriver implement
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void issuedOrderFinish(String autoFinish) {
|
||||
if (StrUtil.equals(autoFinish, WorkerOrderEnum.FORCEFINISH.getCode())) {
|
||||
|
||||
@@ -207,7 +207,7 @@ public class WithStationDeviceDriver extends AbstractOpcDeviceDriver implements
|
||||
!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) {
|
||||
//否则对接位单独申请任务
|
||||
JSONObject reqParam = new JSONObject();
|
||||
|
||||
Reference in New Issue
Block a user