acs驱动与交互
This commit is contained in:
@@ -29,7 +29,9 @@ public enum DriverTypeEnum {
|
||||
|
||||
AUTODOOR(10, "standard_autodoor", "标准版-自动门", "autodoor"),
|
||||
|
||||
CW_SITE(11, "cw_site", "超威-检测站点", "conveyor");
|
||||
SSX_SITE(11, "ssx_site", "输送线", "conveyor");
|
||||
|
||||
|
||||
|
||||
//驱动索引
|
||||
private int index;
|
||||
|
||||
@@ -12,10 +12,11 @@ import com.alibaba.fastjson.JSONObject;
|
||||
public enum RequestMethodEnum {
|
||||
|
||||
feedback_task_status(1, "feedback_task_status", "反馈任务状态","1"),
|
||||
apply_mjxl(2, "MJXLTask", "涂板线满架下料","1"),
|
||||
apply_bpsl(3, "BPSLTask", "包片上料","1"),
|
||||
apply_tbxbkj(4, "TBXBKJTask", "涂板线补空架","1"),
|
||||
apply_kghjrk(5, "KGHJRKTask", "空固化架入库","1");
|
||||
apply_point(2, "POINTTask", "点对点任务","1"),
|
||||
apply_yclrk(3, "YCLRKTask", "原材料入库","1"),
|
||||
apply_yclck(4, "YCLCKTask", "原材料出库","1"),
|
||||
apply_ssxbkj(5, "SSXBKJTask", "输送线补空架","1"),
|
||||
apply_kjrk(6, "KJRKTask", "空固化架入库","1");
|
||||
|
||||
|
||||
//驱动索引
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
package org.nl.acs.device_driver.basedriver.fold_disc_site;
|
||||
|
||||
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
|
||||
import org.nl.acs.device_driver.DeviceDriver;
|
||||
import org.nl.acs.device_driver.defination.OpcDeviceDriverDefinition;
|
||||
import org.nl.acs.opc.Device;
|
||||
import org.nl.acs.opc.DeviceType;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 晟华叠盘机
|
||||
*/
|
||||
@Service
|
||||
public class FoldDiscSiteDefinition implements OpcDeviceDriverDefinition {
|
||||
@Override
|
||||
public String getDriverCode() {
|
||||
return "fold_disc_site";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDriverName() {
|
||||
return "叠盘机";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDriverDescription() {
|
||||
return "叠盘机";
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeviceDriver getDriverInstance(Device device) {
|
||||
return (new FoldDiscSiteDeviceDriver()).setDevice(device).setDriverDefinition(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends DeviceDriver> getDeviceDriverType() {
|
||||
return FoldDiscSiteDeviceDriver.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeviceType> getFitDeviceTypes() {
|
||||
List<DeviceType> types = new LinkedList<>();
|
||||
types.add(DeviceType.station);
|
||||
return types;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemDto> getReadableItemDTOs() {
|
||||
return getReadableItemDtos2();
|
||||
}
|
||||
|
||||
public static List<ItemDto> getReadableItemDtos2() {
|
||||
return ItemProtocol.getReadableItemDtos();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemDto> getWriteableItemDTOs() {
|
||||
return ItemProtocol.getWriteableItemDtos();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,247 @@
|
||||
package org.nl.acs.device_driver.basedriver.fold_disc_site;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.device.domain.Device;
|
||||
import org.nl.acs.device.service.DeviceService;
|
||||
import org.nl.acs.device_driver.DeviceDriver;
|
||||
import org.nl.acs.device_driver.RequestMethodEnum;
|
||||
import org.nl.acs.device_driver.RouteableDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
||||
import org.nl.acs.ext.wms.data.feedBackTaskStatus.FeedBackTaskStatusRequest;
|
||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.log.service.DeviceExecuteLogService;
|
||||
import org.nl.acs.monitor.DeviceStageMonitor;
|
||||
import org.nl.acs.route.service.RouteLineService;
|
||||
import org.nl.acs.route.service.dto.RouteLineDto;
|
||||
import org.nl.acs.task.service.TaskService;
|
||||
import org.nl.acs.utils.ReadUtil;
|
||||
import org.nl.config.SpringContextHolder;
|
||||
import org.openscada.opc.lib.da.Server;
|
||||
import org.springframework.http.HttpStatus;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 叠盘机
|
||||
*/
|
||||
@Slf4j
|
||||
@Getter
|
||||
@Setter
|
||||
@RequiredArgsConstructor
|
||||
public class FoldDiscSiteDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor {
|
||||
protected ItemProtocol itemProtocol = new ItemProtocol(this);
|
||||
|
||||
InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl");
|
||||
|
||||
DeviceService deviceservice = SpringContextHolder.getBean("deviceServiceImpl");
|
||||
|
||||
RouteLineService routelineserver = SpringContextHolder.getBean("routeLineServiceImpl");
|
||||
|
||||
TaskService taskserver = SpringContextHolder.getBean("taskServiceImpl");
|
||||
|
||||
DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl");
|
||||
|
||||
AcsToWmsService acsToWmsService = SpringContextHolder.getBean("acsToWmsServiceImpl");
|
||||
String device_code;
|
||||
int mode = 0;
|
||||
int error = 0;
|
||||
int move = 0;
|
||||
int last_mode = 0;
|
||||
int last_error = 0;
|
||||
int last_move = 0;
|
||||
Boolean isonline = true;
|
||||
int hasGoods = 0;
|
||||
Boolean iserror = false;
|
||||
|
||||
boolean requireSucess = false;
|
||||
boolean requireQtySuccess = false;
|
||||
boolean errorDeviceRecord = false;
|
||||
JSONObject errorDeviceRecordRequest = new JSONObject();
|
||||
|
||||
int heartbeat;
|
||||
int last_heartbeat;
|
||||
private Date checkHeartbeattime = new Date();
|
||||
private Date last_checkHeartbeattime = new Date();
|
||||
|
||||
int branchProtocol = 0;
|
||||
|
||||
private Date instruction_require_time = new Date();
|
||||
private Date instruction_finished_time = new Date();
|
||||
|
||||
private int instruction_require_time_out = 3000;
|
||||
private int instruction_finished_time_out;
|
||||
|
||||
String message;
|
||||
|
||||
int number = 0;
|
||||
int last_number = 0;
|
||||
|
||||
int task = 0;
|
||||
int last_task = 0;
|
||||
|
||||
@Override
|
||||
public Device getDevice() {
|
||||
return this.device;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
try {
|
||||
device_code = this.getDeviceCode();
|
||||
|
||||
mode = itemProtocol.getMode();
|
||||
move = itemProtocol.getMove();
|
||||
number = itemProtocol.getNumber();
|
||||
error = itemProtocol.getError();
|
||||
task = itemProtocol.getTask();
|
||||
|
||||
if (number != last_number) {
|
||||
int max_emptypalletnum = Integer.parseInt(this.getDevice().getExtraValue().get("max_emptypalletnum").toString());
|
||||
if (number == max_emptypalletnum) {
|
||||
this.requireSucess = false;
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception var17) {
|
||||
return;
|
||||
}
|
||||
|
||||
//急停
|
||||
if (this.isStop()) {
|
||||
|
||||
//未在线无心跳
|
||||
} else if (!this.itemProtocol.getIsonline()) {
|
||||
this.setIsonline(false);
|
||||
this.setIserror(true);
|
||||
message = "信号量同步异常";
|
||||
//未联机
|
||||
} else if (mode == 0) {
|
||||
this.setIsonline(false);
|
||||
this.setIserror(true);
|
||||
message = "未联机";
|
||||
//有报警
|
||||
} else if (error != 0) {
|
||||
this.setIsonline(false);
|
||||
this.setIserror(true);
|
||||
message = "有报警";
|
||||
//无报警
|
||||
} else {
|
||||
this.setIsonline(true);
|
||||
this.setIserror(false);
|
||||
message = "";
|
||||
switch (mode) {
|
||||
case 1:
|
||||
log.debug("设备运转模式:等待工作");
|
||||
break;
|
||||
case 2:
|
||||
if (!this.requireSucess) {
|
||||
this.shipDeviceUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
last_mode = mode;
|
||||
last_move = move;
|
||||
last_number = number;
|
||||
last_error = error;
|
||||
last_task = task;
|
||||
}
|
||||
|
||||
public void writing(String param, String value) {
|
||||
|
||||
String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||
+ "." + param;
|
||||
String opcservcerid = this.getDevice().getOpc_server_id();
|
||||
Server server = ReadUtil.getServer(opcservcerid);
|
||||
Map<String, Object> itemMap = new HashMap<>();
|
||||
itemMap.put(to_param, value);
|
||||
ReadUtil.write(itemMap, server);
|
||||
server.disconnect();
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", param + " 写入 " + value);
|
||||
}
|
||||
|
||||
public void executing(Server server, Map<String, Object> itemMap) {
|
||||
ReadUtil.write(itemMap, server);
|
||||
server.disconnect();
|
||||
}
|
||||
|
||||
public void writing(int command) {
|
||||
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||
+ "." + ItemProtocol.item_to_command;
|
||||
|
||||
String opcservcerid = this.getDevice().getOpc_server_id();
|
||||
Server server = ReadUtil.getServer(opcservcerid);
|
||||
Map<String, Object> itemMap = new HashMap<String, Object>();
|
||||
itemMap.put(to_command, command);
|
||||
ReadUtil.write(itemMap, server);
|
||||
ReadUtil.write(itemMap, server);
|
||||
server.disconnect();
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "to_command 写入 " + command);
|
||||
}
|
||||
|
||||
private void shipDeviceUpdate() {
|
||||
Date date = new Date();
|
||||
if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) {
|
||||
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
|
||||
} else {
|
||||
this.instruction_require_time = date;
|
||||
FeedBackTaskStatusRequest request = new FeedBackTaskStatusRequest();
|
||||
request.setDevice_code(this.device_code);
|
||||
request.setRequest_medthod_code(RequestMethodEnum.apply_kjrk.getCode());
|
||||
request.setRequest_medthod_name(RequestMethodEnum.apply_kjrk.getName());
|
||||
String resp = acsToWmsService.applyTask(request);
|
||||
JSONObject res_jo = JSONObject.parseObject(resp);
|
||||
if (StrUtil.equals(res_jo.getString("code"), "200")) {
|
||||
log.info("叠盘位堆叠数量满自动申请搬运任务成功!");
|
||||
this.requireSucess = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject getDeviceStatusName() throws Exception {
|
||||
String mode;
|
||||
|
||||
switch (this.mode) {
|
||||
case 0:
|
||||
mode = "脱机";
|
||||
break;
|
||||
case 2:
|
||||
mode = "待机";
|
||||
break;
|
||||
default:
|
||||
mode = String.valueOf(this.mode);
|
||||
}
|
||||
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("device_name", this.getDevice().getDevice_name());
|
||||
jo.put("mode", mode);
|
||||
jo.put("move", move);
|
||||
jo.put("error", error);
|
||||
jo.put("number", number);
|
||||
jo.put("isError", iserror);
|
||||
jo.put("isOnline", isonline);
|
||||
jo.put("message", message);
|
||||
return jo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDeviceStatus(JSONObject data) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
package org.nl.acs.device_driver.basedriver.fold_disc_site;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Getter
|
||||
@Setter
|
||||
@SuppressWarnings("unused")
|
||||
public class ItemProtocol {
|
||||
public static String item_heartbeat = "heartbeat";
|
||||
public static String item_mode = "mode";
|
||||
public static String item_move = "move";
|
||||
public static String item_number = "number";
|
||||
public static String item_error = "error";
|
||||
public static String item_task = "task";
|
||||
|
||||
public static String item_to_command = "to_command";
|
||||
public static String item_to_target = "to_target";
|
||||
public static String item_to_task = "to_task";
|
||||
Boolean isonline;
|
||||
|
||||
private FoldDiscSiteDeviceDriver driver;
|
||||
|
||||
public ItemProtocol(FoldDiscSiteDeviceDriver driver) {
|
||||
this.driver = driver;
|
||||
}
|
||||
|
||||
public int getHeartbeat() {
|
||||
return this.getOpcIntegerValue(item_heartbeat);
|
||||
}
|
||||
|
||||
public int getMode() {
|
||||
return this.getOpcIntegerValue(item_mode);
|
||||
}
|
||||
|
||||
public int getMove() {
|
||||
return this.getOpcIntegerValue(item_move);
|
||||
}
|
||||
|
||||
public int getNumber() {
|
||||
return this.getOpcIntegerValue(item_number);
|
||||
}
|
||||
|
||||
public int getError() {
|
||||
return this.getOpcIntegerValue(item_error);
|
||||
}
|
||||
|
||||
public int getTask() {
|
||||
return this.getOpcIntegerValue(item_task);
|
||||
}
|
||||
|
||||
public int getToCommand() {
|
||||
return this.getOpcIntegerValue(item_to_command);
|
||||
}
|
||||
|
||||
public int getToTarget() {
|
||||
return this.getOpcIntegerValue(item_to_target);
|
||||
}
|
||||
|
||||
public int getToTask() {
|
||||
return this.getOpcIntegerValue(item_to_task);
|
||||
}
|
||||
|
||||
//是否有货
|
||||
public int hasGoods(int move) {
|
||||
return move;
|
||||
}
|
||||
|
||||
|
||||
public int getOpcIntegerValue(String protocol) {
|
||||
Integer value = this.driver.getIntegeregerValue(protocol);
|
||||
if (value == null) {
|
||||
// log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!");
|
||||
setIsonline(false);
|
||||
} else {
|
||||
setIsonline(true);
|
||||
return value;
|
||||
}
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
public String getOpcStringValue(String protocol) {
|
||||
String value = this.driver.getStringValue(protocol);
|
||||
if (value != null) {
|
||||
return value;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public static List<ItemDto> getReadableItemDtos() {
|
||||
ArrayList<ItemDto> list = new ArrayList<>();
|
||||
list.add(new ItemDto(item_heartbeat, "心跳", "DB1.B0"));
|
||||
list.add(new ItemDto(item_mode, "工作模式", "DB1.B1", Boolean.TRUE));
|
||||
list.add(new ItemDto(item_move, "广电信号", "DB1.B2"));
|
||||
list.add(new ItemDto(item_number, "数量", "DB1.B3"));
|
||||
list.add(new ItemDto(item_error, "error", "DB1.B5"));
|
||||
list.add(new ItemDto(item_task, "任务号", "DB1.D6"));
|
||||
return list;
|
||||
}
|
||||
|
||||
public static List<ItemDto> getWriteableItemDtos() {
|
||||
ArrayList<ItemDto> list = new ArrayList<>();
|
||||
list.add(new ItemDto(item_to_command, "下发指令", "DB2.W0", Boolean.TRUE));
|
||||
list.add(new ItemDto(item_to_target, "下发目标站", "DB2.W2"));
|
||||
list.add(new ItemDto(item_to_task, "下发任务号", "DB2.D4"));
|
||||
return list;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.nl.acs.device_driver.basedriver.cw_site;
|
||||
package org.nl.acs.device_driver.basedriver.ssx_site;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -19,9 +19,9 @@ public class ItemProtocol {
|
||||
public static String item_tier = "tier";
|
||||
public static String item_to_command = "to_command";
|
||||
|
||||
private CwSiteDeviceDriver driver;
|
||||
private SsxSiteDeviceDriver driver;
|
||||
|
||||
public ItemProtocol(CwSiteDeviceDriver driver) {
|
||||
public ItemProtocol(SsxSiteDeviceDriver driver) {
|
||||
this.driver = driver;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.nl.acs.device_driver.basedriver.cw_site;
|
||||
package org.nl.acs.device_driver.basedriver.ssx_site;
|
||||
|
||||
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
|
||||
import org.nl.acs.device.domain.Device;
|
||||
@@ -15,31 +15,31 @@ import java.util.List;
|
||||
* 说明:该站点为普通带光电检测站点
|
||||
*/
|
||||
@Service
|
||||
public class CwSiteDefination implements OpcDeviceDriverDefination {
|
||||
public class SsxSiteDefination implements OpcDeviceDriverDefination {
|
||||
@Override
|
||||
public String getDriverCode() {
|
||||
return "cw_site";
|
||||
return "ssx_site";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDriverName() {
|
||||
return "超威-检测站点";
|
||||
return "输送线-检测站点";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDriverDescription() {
|
||||
return "超威-检测站点";
|
||||
return "输送线-检测站点";
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeviceDriver getDriverInstance(Device device) {
|
||||
return (new CwSiteDeviceDriver()).setDevice(device).setDriverDefination(this);
|
||||
return (new SsxSiteDeviceDriver()).setDevice(device).setDriverDefination(this);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends DeviceDriver> getDeviceDriverType() {
|
||||
return CwSiteDeviceDriver.class;
|
||||
return SsxSiteDeviceDriver.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1,7 +1,5 @@
|
||||
package org.nl.acs.device_driver.basedriver.cw_site;
|
||||
package org.nl.acs.device_driver.basedriver.ssx_site;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.Data;
|
||||
@@ -19,15 +17,9 @@ import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||
import org.nl.acs.instruction.domain.Instruction;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.monitor.DeviceStageMonitor;
|
||||
import org.nl.acs.opc.WcsConfig;
|
||||
import org.nl.acs.route.service.RouteLineService;
|
||||
import org.nl.acs.route.service.dto.RouteLineDto;
|
||||
import org.nl.acs.task.domain.Task;
|
||||
import org.nl.acs.task.service.TaskService;
|
||||
import org.nl.acs.task.service.dto.TaskDto;
|
||||
import org.nl.acs.task.service.mapper.TaskMapper;
|
||||
import org.nl.acs.utils.ConvertUtil;
|
||||
import org.nl.common.utils.CodeUtil;
|
||||
import org.nl.config.SpringContextHolder;
|
||||
import org.openscada.opc.lib.da.Server;
|
||||
|
||||
@@ -42,7 +34,7 @@ import java.util.Map;
|
||||
@Slf4j
|
||||
@Data
|
||||
@RequiredArgsConstructor
|
||||
public class CwSiteDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver , DeviceStageMonitor {
|
||||
public class SsxSiteDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver , DeviceStageMonitor {
|
||||
protected ItemProtocol itemProtocol = new ItemProtocol(this);
|
||||
|
||||
InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl");
|
||||
@@ -179,7 +171,7 @@ public class CwSiteDeviceDriver extends AbstractOpcDeviceDriver implements Devic
|
||||
}
|
||||
if (error != last_error) {
|
||||
}
|
||||
if (action != last_action) {
|
||||
if (mode != last_mode) {
|
||||
this.setRequireSucess(false);
|
||||
}
|
||||
|
||||
@@ -215,38 +207,21 @@ public class CwSiteDeviceDriver extends AbstractOpcDeviceDriver implements Devic
|
||||
return;
|
||||
case 2:
|
||||
break;
|
||||
}
|
||||
|
||||
switch (action) {
|
||||
//呼叫负极板
|
||||
case 1:
|
||||
if (move==0 && !requireSucess) {
|
||||
apply(1,"2");
|
||||
}
|
||||
break;
|
||||
//呼叫边负极板
|
||||
case 2:
|
||||
if (move==0 && !requireSucess) {
|
||||
apply(2,"3");
|
||||
}
|
||||
break;
|
||||
//呼叫正极板
|
||||
case 3:
|
||||
if (move==0 && !requireSucess) {
|
||||
apply(3,"1");
|
||||
}
|
||||
break;
|
||||
//出负极空固化架
|
||||
case 4:
|
||||
if (move!=0 && !requireSucess) {
|
||||
apply(4,"2");
|
||||
}
|
||||
break;
|
||||
//出正极空固化架
|
||||
case 5:
|
||||
if (move!=0 && !requireSucess) {
|
||||
apply(5,"1");
|
||||
}
|
||||
log.info("呼叫空盅");
|
||||
this.apply(5);
|
||||
break;
|
||||
case 6:
|
||||
log.info("空盅出库");
|
||||
this.apply(6);
|
||||
break;
|
||||
case 7:
|
||||
log.info("呼叫满料");
|
||||
this.apply(7);
|
||||
break;
|
||||
case 8:
|
||||
log.info("满料出库");
|
||||
this.apply(8);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -357,7 +332,7 @@ public class CwSiteDeviceDriver extends AbstractOpcDeviceDriver implements Devic
|
||||
*
|
||||
* @param
|
||||
*/
|
||||
public synchronized boolean apply(Integer type,String materialType) {
|
||||
public synchronized boolean apply(Integer type) {
|
||||
Date date = new Date();
|
||||
if (date.getTime() - this.time.getTime() < (long) this.instruction_require_time_out) {
|
||||
log.trace("触发时间因为小于{}毫秒,而被无视", this.time);
|
||||
@@ -366,22 +341,21 @@ public class CwSiteDeviceDriver extends AbstractOpcDeviceDriver implements Devic
|
||||
this.time = date;
|
||||
FeedBackTaskStatusRequest request = new FeedBackTaskStatusRequest();
|
||||
request.setDevice_code(devicecode);
|
||||
request.setMaterial_type(materialType);
|
||||
if (type==1 ||type==2||type==3) {
|
||||
//包片上料
|
||||
request.setRequest_medthod_code(RequestMethodEnum.apply_bpsl.getCode());
|
||||
request.setRequest_medthod_name(RequestMethodEnum.apply_bpsl.getName());
|
||||
}else if (type==4||type==5) {
|
||||
//空托盘出库,包片机和销售出库空位都可以
|
||||
request.setRequest_medthod_code(RequestMethodEnum.apply_kghjrk.getCode());
|
||||
request.setRequest_medthod_name(RequestMethodEnum.apply_kghjrk.getName());
|
||||
if (type==5) {
|
||||
//呼叫空固化架
|
||||
request.setRequest_medthod_code(RequestMethodEnum.apply_ssxbkj.getCode());
|
||||
request.setRequest_medthod_name(RequestMethodEnum.apply_ssxbkj.getName());
|
||||
}else if (type==8) {
|
||||
//原材料入库
|
||||
request.setRequest_medthod_code(RequestMethodEnum.apply_yclrk.getCode());
|
||||
request.setRequest_medthod_name(RequestMethodEnum.apply_yclrk.getName());
|
||||
}
|
||||
String resp = acsToWmsService.applyTask(request);
|
||||
JSONObject res_jo = JSONObject.parseObject(resp);
|
||||
if (StrUtil.equals(res_jo.getString("code"), "200")) {
|
||||
this.writing(type);
|
||||
this.setRequireSucess(true);
|
||||
log.info("acs申请任务", this.devicecode, "满盅入库任务申请成功!");
|
||||
log.info("acs申请任务", this.devicecode, "任务申请成功!");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
Reference in New Issue
Block a user