From 555398355918dcfb9def941aab7e9490ebe4a1ff Mon Sep 17 00:00:00 2001 From: psh Date: Fri, 23 Feb 2024 16:29:00 +0800 Subject: [PATCH] =?UTF-8?q?acs=E9=A9=B1=E5=8A=A8=E4=B8=8E=E4=BA=A4?= =?UTF-8?q?=E4=BA=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../device/device_driver/DriverTypeEnum.java | 4 +- .../acs/device_driver/RequestMethodEnum.java | 9 +- .../FoldDiscSiteDefinition.java | 64 +++ .../FoldDiscSiteDeviceDriver.java | 247 +++++++++ .../fold_disc_site/ItemProtocol.java | 117 +++++ .../{cw_site => ssx_site}/ItemProtocol.java | 6 +- .../SsxSiteDefination.java} | 14 +- .../SsxSiteDeviceDriver.java} | 76 +-- .../src/views/acs/device/driver/cw_site.vue | 489 ------------------ .../sch/task_manage/task/tasks/KJRKTask.java | 236 +++++++++ .../task_manage/task/tasks/SSXBKJTask.java | 236 +++++++++ 11 files changed, 943 insertions(+), 555 deletions(-) create mode 100644 acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/fold_disc_site/FoldDiscSiteDefinition.java create mode 100644 acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/fold_disc_site/FoldDiscSiteDeviceDriver.java create mode 100644 acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/fold_disc_site/ItemProtocol.java rename acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/{cw_site => ssx_site}/ItemProtocol.java (94%) rename acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/{cw_site/CwSiteDefination.java => ssx_site/SsxSiteDefination.java} (77%) rename acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/{cw_site/CwSiteDeviceDriver.java => ssx_site/SsxSiteDeviceDriver.java} (84%) delete mode 100644 acs/nladmin-ui/src/views/acs/device/driver/cw_site.vue create mode 100644 lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/KJRKTask.java create mode 100644 lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/SSXBKJTask.java diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/device_driver/DriverTypeEnum.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/device_driver/DriverTypeEnum.java index e61dc16..8c1ff23 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/device_driver/DriverTypeEnum.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/device_driver/DriverTypeEnum.java @@ -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; diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/RequestMethodEnum.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/RequestMethodEnum.java index 2e7c1ed..9365972 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/RequestMethodEnum.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/RequestMethodEnum.java @@ -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"); //驱动索引 diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/fold_disc_site/FoldDiscSiteDefinition.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/fold_disc_site/FoldDiscSiteDefinition.java new file mode 100644 index 0000000..d7d3102 --- /dev/null +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/fold_disc_site/FoldDiscSiteDefinition.java @@ -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 getDeviceDriverType() { + return FoldDiscSiteDeviceDriver.class; + } + + @Override + public List getFitDeviceTypes() { + List types = new LinkedList<>(); + types.add(DeviceType.station); + return types; + } + + @Override + public List getReadableItemDTOs() { + return getReadableItemDtos2(); + } + + public static List getReadableItemDtos2() { + return ItemProtocol.getReadableItemDtos(); + } + + @Override + public List getWriteableItemDTOs() { + return ItemProtocol.getWriteableItemDtos(); + } + +} diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/fold_disc_site/FoldDiscSiteDeviceDriver.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/fold_disc_site/FoldDiscSiteDeviceDriver.java new file mode 100644 index 0000000..d656a25 --- /dev/null +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/fold_disc_site/FoldDiscSiteDeviceDriver.java @@ -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 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 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 itemMap = new HashMap(); + 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) { + + } +} diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/fold_disc_site/ItemProtocol.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/fold_disc_site/ItemProtocol.java new file mode 100644 index 0000000..7652066 --- /dev/null +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/fold_disc_site/ItemProtocol.java @@ -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 getReadableItemDtos() { + ArrayList 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 getWriteableItemDtos() { + ArrayList 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; + } + +} + diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/cw_site/ItemProtocol.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/ssx_site/ItemProtocol.java similarity index 94% rename from acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/cw_site/ItemProtocol.java rename to acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/ssx_site/ItemProtocol.java index 610b114..f71ddd2 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/cw_site/ItemProtocol.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/ssx_site/ItemProtocol.java @@ -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; } diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/cw_site/CwSiteDefination.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/ssx_site/SsxSiteDefination.java similarity index 77% rename from acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/cw_site/CwSiteDefination.java rename to acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/ssx_site/SsxSiteDefination.java index a75b865..347960a 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/cw_site/CwSiteDefination.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/ssx_site/SsxSiteDefination.java @@ -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 getDeviceDriverType() { - return CwSiteDeviceDriver.class; + return SsxSiteDeviceDriver.class; } @Override diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/cw_site/CwSiteDeviceDriver.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/ssx_site/SsxSiteDeviceDriver.java similarity index 84% rename from acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/cw_site/CwSiteDeviceDriver.java rename to acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/ssx_site/SsxSiteDeviceDriver.java index 3cd8b20..7ae14a7 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/cw_site/CwSiteDeviceDriver.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/ssx_site/SsxSiteDeviceDriver.java @@ -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"); - } + case 5: + log.info("呼叫空盅"); + this.apply(5); break; - //呼叫正极板 - case 3: - if (move==0 && !requireSucess) { - apply(3,"1"); - } + case 6: + log.info("空盅出库"); + this.apply(6); break; - //出负极空固化架 - case 4: - if (move!=0 && !requireSucess) { - apply(4,"2"); - } + case 7: + log.info("呼叫满料"); + this.apply(7); break; - //出正极空固化架 - case 5: - if (move!=0 && !requireSucess) { - apply(5,"1"); - } + 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; } diff --git a/acs/nladmin-ui/src/views/acs/device/driver/cw_site.vue b/acs/nladmin-ui/src/views/acs/device/driver/cw_site.vue deleted file mode 100644 index 2a71c31..0000000 --- a/acs/nladmin-ui/src/views/acs/device/driver/cw_site.vue +++ /dev/null @@ -1,489 +0,0 @@ - - - - - diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/KJRKTask.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/KJRKTask.java new file mode 100644 index 0000000..e262d1c --- /dev/null +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/KJRKTask.java @@ -0,0 +1,236 @@ +package org.nl.wms.sch.task_manage.task.tasks; + +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.IdUtil; +import cn.hutool.core.util.ObjectUtil; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import lombok.extern.slf4j.Slf4j; +import org.nl.common.exception.BadRequestException; +import org.nl.wms.ext.service.AcsToWmsService; +import org.nl.wms.ext.service.dto.to.BaseResponse; +import org.nl.wms.pdm.service.IPdmBdWorkorderService; +import org.nl.wms.pdm.service.dao.PdmBdWorkorder; +import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService; +import org.nl.wms.sch.group.service.dao.SchBaseVehiclematerialgroup; +import org.nl.wms.sch.point.service.ISchBasePointService; +import org.nl.wms.sch.point.service.dao.SchBasePoint; +import org.nl.wms.sch.task.service.ISchBaseTaskService; +import org.nl.wms.sch.task.service.ISchBaseTaskconfigService; +import org.nl.wms.sch.task.service.dao.SchBaseTask; +import org.nl.wms.sch.task.service.dao.SchBaseTaskconfig; +import org.nl.wms.sch.task_manage.AbstractTask; +import org.nl.wms.sch.task_manage.enums.GroupBindMaterialStatusEnum; +import org.nl.wms.sch.task_manage.enums.GroupStatusEnum; +import org.nl.wms.sch.task_manage.task.TaskType; +import org.nl.wms.sch.task_manage.task.core.TaskStatus; +import org.nl.wms.sch.task_manage.task.tasks.mapper.PointMapper; +import org.nl.wms.util.PointUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Lazy; +import org.springframework.stereotype.Component; + +import java.math.BigDecimal; +import java.util.List; + +/** + * @Author: psh + * @Description: 空架入库 + * @Date: 2024/1/24 + */ +@Slf4j +@Component +@TaskType("KJRKTask") +@Lazy +public class KJRKTask extends AbstractTask { + private static String TASK_CONFIG_CODE = "KJRKTask"; + /** + * 入口 + */ + private static String ENTRANCE = "1"; + @Autowired + private ISchBasePointService pointService; + @Autowired + private ISchBaseTaskService taskService; + @Autowired + private ISchBaseTaskconfigService taskConfigService; + @Autowired + private IPdmBdWorkorderService workorderService; + @Autowired + private ISchBaseVehiclematerialgroupService vehiclematerialgroupService; + @Autowired + private PointMapper pointMapper; + @Autowired + private AcsToWmsService acsToWmsService; + + @Override +// @Transactional(rollbackFor = Exception.class) + protected void create() throws BadRequestException { + // 获取任务 + List tasks = taskService.findTasksByTaskStatus(TASK_CONFIG_CODE, TaskStatus.APPLY); + // 配置信息 + SchBaseTaskconfig taskConfig = taskConfigService.getOne(new LambdaQueryWrapper() + .eq(SchBaseTaskconfig::getConfig_code, TASK_CONFIG_CODE)); + for (SchBaseTask task : tasks) { + // 找终点 + SchBasePoint startPoint = pointService.getOne(new LambdaQueryWrapper() + .eq(SchBasePoint::getPoint_code, task.getPoint_code1())); + String extGroupData = task.getExt_group_data(); + JSONObject jsonObject = JSONObject.parseObject(extGroupData); +// String materialType = jsonObject.getString("material_type"); + SchBasePoint point = findNextPoint(); + if (ObjectUtil.isEmpty(point)) { + task.setRemark("未找到所需点位!"); + taskService.update(task); + // 消息通知 + log.info("原材料入库未找到当前符合条件的点位!"); + continue; + } + // 设置终点并修改创建成功状态 + task.setPoint_code2(point.getPoint_code()); + task.setTask_status(TaskStatus.CREATED.getCode()); + task.setRemark(""); + taskService.update(task); + + //发起任务时先把点位占用,防止发起重复任务 + point.setIng_task_code(task.getTask_code()); +// point.setVehicle_type(materialType); + pointService.update(point); + + //下发 + this.renotifyAcs(task); + } + } + + /** + * 判断目标点位 + * + * @return + */ + private SchBasePoint findNextPoint() { + String regionCode = "YL"; + List schBasePointList = pointMapper.findPointByRegion(regionCode, "2"); + for (SchBasePoint schBasePoint : schBasePointList) { + if ("2".equals(schBasePoint.getPoint_status()) + && schBasePoint.getVehicle_qty() ==0) { + log.info("原材料入库找到当前符合条件的点位{}", schBasePoint.getPoint_code()); + return schBasePoint; + } + } + return null; + } + + @Override +// @Transactional(rollbackFor = Exception.class) + protected void updateStatus(String task_code, TaskStatus status) { + // 校验任务 + SchBaseTask taskObj = taskService.getById(task_code); + if (taskObj.getTask_status().equals(TaskStatus.FINISHED.getCode())) { + throw new BadRequestException("该任务已完成!"); + } + if (taskObj.getTask_status().equals(TaskStatus.CANCELED.getCode())) { + throw new BadRequestException("该任务已取消!"); + } + // 获取参数 + JSONObject extGroupData = ObjectUtil.isNotEmpty(taskObj.getExt_group_data()) + ? JSONObject.parseObject(taskObj.getExt_group_data()) + : null; + // 载具编码:没有就创建一个 + String vehicle_code = ObjectUtil.isNotEmpty(taskObj.getVehicle_code()) + ? taskObj.getVehicle_code() + : IdUtil.getSnowflake(1, 1).nextIdStr(); + PdmBdWorkorder workorderCode = null; + if (extGroupData != null) { + workorderCode = ObjectUtil.isNotEmpty(extGroupData.getString("workorder_code")) + ? workorderService.getOne(new LambdaQueryWrapper() + .eq(PdmBdWorkorder::getWorkorder_code, extGroupData.getString("workorder_code"))) + : null; + } + String startPoint = taskObj.getPoint_code1(); // 获取起点 + String endPoint = ObjectUtil.isNotEmpty(taskObj.getPoint_code2())?taskObj.getPoint_code2().substring(0,taskObj.getPoint_code2().length()-2):"0"; // 获取终点 + SchBasePoint startPointObj = pointService.getById(startPoint); + SchBasePoint endPointObj = pointService.getById(endPoint); + // 根据传来的类型去对任务进行操作 + if (status.equals(TaskStatus.EXECUTING)) { // 执行中 + taskObj.setTask_status(TaskStatus.EXECUTING.getCode()); + taskObj.setRemark("执行中"); + } + if (status.equals(TaskStatus.FINISHED)) { // 完成 + // 起点清空 + if (ObjectUtil.isNotEmpty(startPointObj)) { + PointUtils.clearPoint(startPointObj); + } + // 终点解锁 + endPointObj.setIng_task_code(""); + endPointObj.setVehicle_code(ObjectUtil.isEmpty(endPointObj.getVehicle_code()) ? vehicle_code + "," : endPointObj.getVehicle_code() + vehicle_code + ","); + endPointObj.setVehicle_qty(1); + pointService.update(endPointObj); + // 要把数据存到组盘表 -> 改造公共方法,返回id + //todo 组盘表需要关联外部mes晶棒数据,一对多 + SchBaseVehiclematerialgroup groupEntity = new SchBaseVehiclematerialgroup(); + groupEntity.setGroup_id(IdUtil.getSnowflake(1, 1).nextIdStr()); + groupEntity.setCreate_id("2"); + groupEntity.setCreate_name("ACS"); + groupEntity.setCreate_time(DateUtil.now()); + groupEntity.setMaterial_id(ObjectUtil.isNotEmpty(workorderCode) + ? workorderCode.getMaterial_id() + : ""); + groupEntity.setStanding_time(ObjectUtil.isNotEmpty(workorderCode) + ? workorderCode.getStanding_time() + : 0); + groupEntity.setMaterial_weight(ObjectUtil.isNotEmpty(extGroupData) + ? extGroupData.getBigDecimal("material_qty") + : BigDecimal.valueOf(0)); + groupEntity.setWorkorder_code(ObjectUtil.isNotEmpty(workorderCode) + ? workorderCode.getWorkorder_code() + : ""); + groupEntity.setVehicle_code(vehicle_code); + groupEntity.setVehicle_type(taskObj.getVehicle_type()); + groupEntity.setPoint_code(startPoint); + groupEntity.setPoint_name(startPointObj.getPoint_name()); + groupEntity.setPcsn(DateUtil.format(DateUtil.date(), "yyyyMMdd")); + groupEntity.setInstorage_time(DateUtil.now()); + groupEntity.setTask_code(taskObj.getTask_code()); + groupEntity.setGroup_bind_material_status(GroupBindMaterialStatusEnum.BOUND.getValue()); // 绑定 + groupEntity.setGroup_status(GroupStatusEnum.IN_STORAGE.getType()); // 暂时不维护。 + groupEntity.setIs_delete(false); + groupEntity.setMove_way(startPoint); + vehiclematerialgroupService.save(groupEntity); + // 任务完成 + taskObj.setTask_status(TaskStatus.FINISHED.getCode()); + taskObj.setGroup_id(groupEntity.getGroup_id()); + taskObj.setRemark("任务完成"); + try { + //todo 入库成功后上报mes + }catch (Exception e){ + log.error("原材料入库上报MES失败{}",e.getMessage(),e); + } + } + if (status.equals(TaskStatus.CANCELED)) { // 取消 + // 终点解锁 + if (ObjectUtil.isNotEmpty(endPointObj)) { + endPointObj.setIng_task_code(""); + //任务取消把原先占用的位置释放 + pointService.update(endPointObj); + } + taskObj.setRemark("任务取消"); + taskObj.setTask_status(TaskStatus.CANCELED.getCode()); + } + taskService.update(taskObj); + } + + @Override + public void forceFinish(String task_code) { + this.updateStatus(task_code, TaskStatus.FINISHED); + } + + @Override + public void cancel(String task_code) { + this.updateStatus(task_code, TaskStatus.CANCELED); + } + + @Override + protected void feedbackTaskState(JSONObject param, SchBaseTask schBaseTask, BaseResponse result) { + //该场景无需重算等待点 + } +} diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/SSXBKJTask.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/SSXBKJTask.java new file mode 100644 index 0000000..205480b --- /dev/null +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/SSXBKJTask.java @@ -0,0 +1,236 @@ +package org.nl.wms.sch.task_manage.task.tasks; + +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.IdUtil; +import cn.hutool.core.util.ObjectUtil; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import lombok.extern.slf4j.Slf4j; +import org.nl.common.exception.BadRequestException; +import org.nl.wms.ext.service.AcsToWmsService; +import org.nl.wms.ext.service.dto.to.BaseResponse; +import org.nl.wms.pdm.service.IPdmBdWorkorderService; +import org.nl.wms.pdm.service.dao.PdmBdWorkorder; +import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService; +import org.nl.wms.sch.group.service.dao.SchBaseVehiclematerialgroup; +import org.nl.wms.sch.point.service.ISchBasePointService; +import org.nl.wms.sch.point.service.dao.SchBasePoint; +import org.nl.wms.sch.task.service.ISchBaseTaskService; +import org.nl.wms.sch.task.service.ISchBaseTaskconfigService; +import org.nl.wms.sch.task.service.dao.SchBaseTask; +import org.nl.wms.sch.task.service.dao.SchBaseTaskconfig; +import org.nl.wms.sch.task_manage.AbstractTask; +import org.nl.wms.sch.task_manage.enums.GroupBindMaterialStatusEnum; +import org.nl.wms.sch.task_manage.enums.GroupStatusEnum; +import org.nl.wms.sch.task_manage.task.TaskType; +import org.nl.wms.sch.task_manage.task.core.TaskStatus; +import org.nl.wms.sch.task_manage.task.tasks.mapper.PointMapper; +import org.nl.wms.util.PointUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Lazy; +import org.springframework.stereotype.Component; + +import java.math.BigDecimal; +import java.util.List; + +/** + * @Author: psh + * @Description: 输送线补空架 + * @Date: 2024/1/24 + */ +@Slf4j +@Component +@TaskType("SSXBKJTask") +@Lazy +public class SSXBKJTask extends AbstractTask { + private static String TASK_CONFIG_CODE = "SSXBKJTask"; + /** + * 入口 + */ + private static String ENTRANCE = "1"; + @Autowired + private ISchBasePointService pointService; + @Autowired + private ISchBaseTaskService taskService; + @Autowired + private ISchBaseTaskconfigService taskConfigService; + @Autowired + private IPdmBdWorkorderService workorderService; + @Autowired + private ISchBaseVehiclematerialgroupService vehiclematerialgroupService; + @Autowired + private PointMapper pointMapper; + @Autowired + private AcsToWmsService acsToWmsService; + + @Override +// @Transactional(rollbackFor = Exception.class) + protected void create() throws BadRequestException { + // 获取任务 + List tasks = taskService.findTasksByTaskStatus(TASK_CONFIG_CODE, TaskStatus.APPLY); + // 配置信息 + SchBaseTaskconfig taskConfig = taskConfigService.getOne(new LambdaQueryWrapper() + .eq(SchBaseTaskconfig::getConfig_code, TASK_CONFIG_CODE)); + for (SchBaseTask task : tasks) { + // 找终点 + SchBasePoint startPoint = pointService.getOne(new LambdaQueryWrapper() + .eq(SchBasePoint::getPoint_code, task.getPoint_code1())); + String extGroupData = task.getExt_group_data(); + JSONObject jsonObject = JSONObject.parseObject(extGroupData); +// String materialType = jsonObject.getString("material_type"); + SchBasePoint point = findNextPoint(); + if (ObjectUtil.isEmpty(point)) { + task.setRemark("未找到所需点位!"); + taskService.update(task); + // 消息通知 + log.info("原材料入库未找到当前符合条件的点位!"); + continue; + } + // 设置终点并修改创建成功状态 + task.setPoint_code2(point.getPoint_code()); + task.setTask_status(TaskStatus.CREATED.getCode()); + task.setRemark(""); + taskService.update(task); + + //发起任务时先把点位占用,防止发起重复任务 + point.setIng_task_code(task.getTask_code()); +// point.setVehicle_type(materialType); + pointService.update(point); + + //下发 + this.renotifyAcs(task); + } + } + + /** + * 判断目标点位 + * + * @return + */ + private SchBasePoint findNextPoint() { + String regionCode = "YL"; + List schBasePointList = pointMapper.findPointByRegion(regionCode, "2"); + for (SchBasePoint schBasePoint : schBasePointList) { + if ("2".equals(schBasePoint.getPoint_status()) + && schBasePoint.getVehicle_qty() ==0) { + log.info("原材料入库找到当前符合条件的点位{}", schBasePoint.getPoint_code()); + return schBasePoint; + } + } + return null; + } + + @Override +// @Transactional(rollbackFor = Exception.class) + protected void updateStatus(String task_code, TaskStatus status) { + // 校验任务 + SchBaseTask taskObj = taskService.getById(task_code); + if (taskObj.getTask_status().equals(TaskStatus.FINISHED.getCode())) { + throw new BadRequestException("该任务已完成!"); + } + if (taskObj.getTask_status().equals(TaskStatus.CANCELED.getCode())) { + throw new BadRequestException("该任务已取消!"); + } + // 获取参数 + JSONObject extGroupData = ObjectUtil.isNotEmpty(taskObj.getExt_group_data()) + ? JSONObject.parseObject(taskObj.getExt_group_data()) + : null; + // 载具编码:没有就创建一个 + String vehicle_code = ObjectUtil.isNotEmpty(taskObj.getVehicle_code()) + ? taskObj.getVehicle_code() + : IdUtil.getSnowflake(1, 1).nextIdStr(); + PdmBdWorkorder workorderCode = null; + if (extGroupData != null) { + workorderCode = ObjectUtil.isNotEmpty(extGroupData.getString("workorder_code")) + ? workorderService.getOne(new LambdaQueryWrapper() + .eq(PdmBdWorkorder::getWorkorder_code, extGroupData.getString("workorder_code"))) + : null; + } + String startPoint = taskObj.getPoint_code1(); // 获取起点 + String endPoint = ObjectUtil.isNotEmpty(taskObj.getPoint_code2())?taskObj.getPoint_code2().substring(0,taskObj.getPoint_code2().length()-2):"0"; // 获取终点 + SchBasePoint startPointObj = pointService.getById(startPoint); + SchBasePoint endPointObj = pointService.getById(endPoint); + // 根据传来的类型去对任务进行操作 + if (status.equals(TaskStatus.EXECUTING)) { // 执行中 + taskObj.setTask_status(TaskStatus.EXECUTING.getCode()); + taskObj.setRemark("执行中"); + } + if (status.equals(TaskStatus.FINISHED)) { // 完成 + // 起点清空 + if (ObjectUtil.isNotEmpty(startPointObj)) { + PointUtils.clearPoint(startPointObj); + } + // 终点解锁 + endPointObj.setIng_task_code(""); + endPointObj.setVehicle_code(ObjectUtil.isEmpty(endPointObj.getVehicle_code()) ? vehicle_code + "," : endPointObj.getVehicle_code() + vehicle_code + ","); + endPointObj.setVehicle_qty(1); + pointService.update(endPointObj); + // 要把数据存到组盘表 -> 改造公共方法,返回id + //todo 组盘表需要关联外部mes晶棒数据,一对多 + SchBaseVehiclematerialgroup groupEntity = new SchBaseVehiclematerialgroup(); + groupEntity.setGroup_id(IdUtil.getSnowflake(1, 1).nextIdStr()); + groupEntity.setCreate_id("2"); + groupEntity.setCreate_name("ACS"); + groupEntity.setCreate_time(DateUtil.now()); + groupEntity.setMaterial_id(ObjectUtil.isNotEmpty(workorderCode) + ? workorderCode.getMaterial_id() + : ""); + groupEntity.setStanding_time(ObjectUtil.isNotEmpty(workorderCode) + ? workorderCode.getStanding_time() + : 0); + groupEntity.setMaterial_weight(ObjectUtil.isNotEmpty(extGroupData) + ? extGroupData.getBigDecimal("material_qty") + : BigDecimal.valueOf(0)); + groupEntity.setWorkorder_code(ObjectUtil.isNotEmpty(workorderCode) + ? workorderCode.getWorkorder_code() + : ""); + groupEntity.setVehicle_code(vehicle_code); + groupEntity.setVehicle_type(taskObj.getVehicle_type()); + groupEntity.setPoint_code(startPoint); + groupEntity.setPoint_name(startPointObj.getPoint_name()); + groupEntity.setPcsn(DateUtil.format(DateUtil.date(), "yyyyMMdd")); + groupEntity.setInstorage_time(DateUtil.now()); + groupEntity.setTask_code(taskObj.getTask_code()); + groupEntity.setGroup_bind_material_status(GroupBindMaterialStatusEnum.BOUND.getValue()); // 绑定 + groupEntity.setGroup_status(GroupStatusEnum.IN_STORAGE.getType()); // 暂时不维护。 + groupEntity.setIs_delete(false); + groupEntity.setMove_way(startPoint); + vehiclematerialgroupService.save(groupEntity); + // 任务完成 + taskObj.setTask_status(TaskStatus.FINISHED.getCode()); + taskObj.setGroup_id(groupEntity.getGroup_id()); + taskObj.setRemark("任务完成"); + try { + //todo 入库成功后上报mes + }catch (Exception e){ + log.error("原材料入库上报MES失败{}",e.getMessage(),e); + } + } + if (status.equals(TaskStatus.CANCELED)) { // 取消 + // 终点解锁 + if (ObjectUtil.isNotEmpty(endPointObj)) { + endPointObj.setIng_task_code(""); + //任务取消把原先占用的位置释放 + pointService.update(endPointObj); + } + taskObj.setRemark("任务取消"); + taskObj.setTask_status(TaskStatus.CANCELED.getCode()); + } + taskService.update(taskObj); + } + + @Override + public void forceFinish(String task_code) { + this.updateStatus(task_code, TaskStatus.FINISHED); + } + + @Override + public void cancel(String task_code) { + this.updateStatus(task_code, TaskStatus.CANCELED); + } + + @Override + protected void feedbackTaskState(JSONObject param, SchBaseTask schBaseTask, BaseResponse result) { + //该场景无需重算等待点 + } +}