diff --git a/hd/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/AgvServiceImpl.java b/hd/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/AgvServiceImpl.java index dc9bde7..f576095 100644 --- a/hd/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/AgvServiceImpl.java +++ b/hd/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/AgvServiceImpl.java @@ -120,11 +120,11 @@ public class AgvServiceImpl implements AgvService { JSONArray properties = new JSONArray(); JSONObject pro1 = new JSONObject(); pro1.put("key", "EntryRequired"); - pro1.put("value", "True"); + pro1.put("value", "true"); properties.add(pro1); JSONObject pro2 = new JSONObject(); pro2.put("key", "PauseOnStation"); - pro2.put("value", "True"); + pro2.put("value", "true"); properties.add(pro2); destinationOrder.put("properties", properties); //进入等待 离开不等待 @@ -132,7 +132,7 @@ public class AgvServiceImpl implements AgvService { JSONArray properties = new JSONArray(); JSONObject pro1 = new JSONObject(); pro1.put("key", "EntryRequired"); - pro1.put("value", "True"); + pro1.put("value", "true"); properties.add(pro1); JSONObject pro2 = new JSONObject(); pro2.put("key", "PauseOnStation"); @@ -148,7 +148,7 @@ public class AgvServiceImpl implements AgvService { properties.add(pro1); JSONObject pro2 = new JSONObject(); pro2.put("key", "PauseOnStation"); - pro2.put("value", "True"); + pro2.put("value", "true"); properties.add(pro2); destinationOrder.put("properties", properties); //不等待 @@ -274,7 +274,6 @@ public class AgvServiceImpl implements AgvService { jo.put("deadline", this.getNextDay(1)); //判断是否追加任务 jo.put("complete", "true"); - jo.put("task_code", inst.getInstruction_code()); //根据任务,下发指令类型 com.alibaba.fastjson.JSONArray destinations = new com.alibaba.fastjson.JSONArray(); @@ -534,7 +533,7 @@ public class AgvServiceImpl implements AgvService { String agvport = acsConfigService.findConfigFromCache().get(AcsConfig.AGVPORT); agvurl = agvurl + ":" + agvport + "/rmds/v1/transportOrders/query"; - + log.info("请求地址为{}",agvurl); HttpResponse result = HttpRequest.post(agvurl) .body("{}") .timeout(20000)//超时,毫秒 @@ -868,7 +867,6 @@ public class AgvServiceImpl implements AgvService { //取货的进入前等待和离开等待 if (action.equals("Load")) { if ("EntryRequired".equals(type)) { - // if (addressdevice.getDeviceDriver() instanceof StandardManipulatorStackingSiteDeviceDriver) { standardManipulatorStackingSiteDeviceDriver = (StandardManipulatorStackingSiteDeviceDriver) addressdevice.getDeviceDriver(); @@ -881,12 +879,18 @@ public class AgvServiceImpl implements AgvService { if (addressdevice.getDeviceDriver() instanceof StandardStorageDeviceDriver) { is_feedback = true; } - if(addressdevice.getDeviceDriver() instanceof StandardInspectSiteSmartDeviceDriver){ + if (addressdevice.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { + is_feedback = true; + log.info("设备开始请求取货"); + } + if(addressdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver){ standardInspectSiteDeviceDriver=(StandardInspectSiteDeviceDriver) addressdevice.getDeviceDriver(); - if(standardInspectSiteDeviceDriver.getMove()==1&&standardInspectSiteDeviceDriver.getAction()==1){ + + if(standardInspectSiteDeviceDriver.getError()==1){ is_feedback = true; + log.info("设备开始请求取货了"); }else { - log.info("设备{} 请求取货,光电信号:{}",addressdevice,standardInspectSiteDeviceDriver.getMove()); + log.info("设备{} 请求取货,取信号:{}",addressdevice,standardInspectSiteDeviceDriver.getError()); } } } @@ -902,13 +906,18 @@ public class AgvServiceImpl implements AgvService { if (addressdevice.getDeviceDriver() instanceof StandardStorageDeviceDriver) { is_feedback = true; } + if (addressdevice.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { + is_feedback = true; + log.info("设备开始请求离开"); + } if(addressdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver){ standardInspectSiteDeviceDriver=(StandardInspectSiteDeviceDriver) addressdevice.getDeviceDriver(); - if(standardInspectSiteDeviceDriver.getMove()==0){ +// if(standardInspectSiteDeviceDriver.getMove()==0){ is_feedback = true; - }else { - log.info("设备{} 请求离开,光电信号:{}",addressdevice,standardInspectSiteDeviceDriver.getMove()); - } + log.info("设备开始请求离开了"); +// }else { +// log.info("设备{} 请求离开,光电信号:{}",addressdevice,standardInspectSiteDeviceDriver.getMove()); +// } } } } @@ -927,12 +936,17 @@ public class AgvServiceImpl implements AgvService { if (addressdevice.getDeviceDriver() instanceof StandardStorageDeviceDriver) { is_feedback = true; } + if (addressdevice.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { + is_feedback = true; + log.info("设备开始请求放货"); + } if(addressdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver){ standardInspectSiteDeviceDriver=(StandardInspectSiteDeviceDriver) addressdevice.getDeviceDriver(); - if(standardInspectSiteDeviceDriver.getMove()==0&&standardInspectSiteDeviceDriver.getAction()==2){ + if(standardInspectSiteDeviceDriver.getTask()==1){ is_feedback = true; + log.info("设备开始请求放货了"); }else { - log.info("设备{} 请求放货,光电信号:{}",addressdevice,standardInspectSiteDeviceDriver.getMove()); + log.info("设备{} 请求放货,放信号:{}",addressdevice,standardInspectSiteDeviceDriver.getTask()); } } } @@ -948,13 +962,18 @@ public class AgvServiceImpl implements AgvService { if (addressdevice.getDeviceDriver() instanceof StandardStorageDeviceDriver) { is_feedback = true; } + if (addressdevice.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { + is_feedback = true; + log.info("设备开始请求离开"); + } if(addressdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver){ standardInspectSiteDeviceDriver=(StandardInspectSiteDeviceDriver) addressdevice.getDeviceDriver(); - if(standardInspectSiteDeviceDriver.getMove()==1){ +// if(standardInspectSiteDeviceDriver.getMove()==1){ is_feedback = true; - }else { - log.info("设备{} 请求离开,光电信号:{}",addressdevice,standardInspectSiteDeviceDriver.getMove()); - } + log.info("设备开始请求离开了"); +// }else { +// log.info("设备{} 请求离开,光电信号:{}",addressdevice,standardInspectSiteDeviceDriver.getMove()); +// } } } } @@ -974,7 +993,7 @@ public class AgvServiceImpl implements AgvService { String agvurl = acsConfigService.findConfigFromCache().get(AcsConfig.AGVURL); String agvport = acsConfigService.findConfigFromCache().get(AcsConfig.AGVPORT); - agvurl = agvurl + ":" + agvport + "/api/route/transportOrders/" + jobno + "/interact"; + agvurl = agvurl + ":" + agvport + "/rmds/v1/transportOrders/" + jobno + "/interact"; HttpResponse result = HttpRequest.post(agvurl) diff --git a/hd/nladmin-system/src/main/java/org/nl/acs/device/rest/DeviceController.java b/hd/nladmin-system/src/main/java/org/nl/acs/device/rest/DeviceController.java index e596c64..0ee0e13 100644 --- a/hd/nladmin-system/src/main/java/org/nl/acs/device/rest/DeviceController.java +++ b/hd/nladmin-system/src/main/java/org/nl/acs/device/rest/DeviceController.java @@ -21,7 +21,9 @@ import org.springframework.http.ResponseEntity; import org.springframework.transaction.annotation.Transactional; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; +import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.List; @@ -423,4 +425,11 @@ public class DeviceController { return new ResponseEntity<>(HttpStatus.CREATED); } + @PostMapping("/excelImport") + @Log("excel导入") + @ApiOperation("excel导入") + public ResponseEntity excelImport(@RequestParam("file") MultipartFile file, HttpServletRequest request) { + deviceService.excelImport(file, request); + return new ResponseEntity<>(HttpStatus.OK); + } } diff --git a/hd/nladmin-system/src/main/java/org/nl/acs/device/service/DeviceService.java b/hd/nladmin-system/src/main/java/org/nl/acs/device/service/DeviceService.java index 9ead3a9..08aa74d 100644 --- a/hd/nladmin-system/src/main/java/org/nl/acs/device/service/DeviceService.java +++ b/hd/nladmin-system/src/main/java/org/nl/acs/device/service/DeviceService.java @@ -7,7 +7,9 @@ import org.nl.acs.device.service.dto.DeviceDto; import org.nl.acs.device.service.dto.StorageCellDto; import org.nl.acs.opc.Device; import org.springframework.data.domain.Pageable; +import org.springframework.web.multipart.MultipartFile; +import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.List; @@ -285,4 +287,11 @@ public interface DeviceService { List findCacheDevice(); void updateBarcode(JSONObject json) throws Exception; + + /** + * excel导入 + * @param file + * @param request + */ + void excelImport(MultipartFile file, HttpServletRequest request); } diff --git a/hd/nladmin-system/src/main/java/org/nl/acs/device/service/impl/DeviceServiceImpl.java b/hd/nladmin-system/src/main/java/org/nl/acs/device/service/impl/DeviceServiceImpl.java index 730d58a..63e6077 100644 --- a/hd/nladmin-system/src/main/java/org/nl/acs/device/service/impl/DeviceServiceImpl.java +++ b/hd/nladmin-system/src/main/java/org/nl/acs/device/service/impl/DeviceServiceImpl.java @@ -7,6 +7,8 @@ import cn.hutool.core.map.MapUtil; import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; +import cn.hutool.poi.excel.ExcelReader; +import cn.hutool.poi.excel.ExcelUtil; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import net.sf.json.JSONArray; @@ -52,9 +54,12 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.multipart.MultipartFile; +import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; +import java.io.InputStream; import java.util.*; /** @@ -295,7 +300,6 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial @Override public void downDeviceDBload(JSONArray jsonarr, HttpServletResponse response) throws IOException { List> list = new ArrayList<>(); - for (int i = 0; i < jsonarr.size(); i++) { JSONObject jo = jsonarr.getJSONObject(i); Map map = new LinkedHashMap<>(); @@ -1576,9 +1580,9 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial String extra_code = jo.getString("extra_code"); //校验数据 格式为: RD1.RD1.A1.mode int num = countStr(extra_code, "."); - if (num != 3) { - throw new BadRequestException(extra_code + "数据格式不正确"); - } +// if (num != 3) { +// throw new BadRequestException(extra_code + "数据格式不正确"); +// } extra_code = extra_code.substring(extra_code.indexOf(".") + 1, extra_code.length()); extra_code = extra_code.substring(extra_code.indexOf(".") + 1, extra_code.length()); @@ -1818,4 +1822,70 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial } } + @Override + @Transactional(rollbackFor = Exception.class) + public void excelImport(MultipartFile file, HttpServletRequest request) { + if (file.isEmpty()) { + throw new BadRequestException("文件为空,请添加数据后重新导入"); + } + Long currentUserId = SecurityUtils.getCurrentUserId(); + String now = DateUtil.now(); + // 1.获取上传文件输入流 + InputStream inputStream = null; + try { + inputStream = file.getInputStream(); + } catch (Exception e) { + e.printStackTrace(); + } + WQLObject wo = WQLObject.getWQLObject("acs_device"); + + // 调用用 hutool 方法读取数据 默认调用第一个sheet + ExcelReader excelReader = ExcelUtil.getReader(inputStream); + // 从第二行开始获取数据 excelReader.read的结果是一个2纬的list,外层是行,内层是行对应的所有列 + List> read = excelReader.read(1, excelReader.getRowCount()); + // 循环获取的数据 + for (int i = 0; i < read.size(); i++) { + List list = read.get(i); + com.alibaba.fastjson.JSONObject param = new com.alibaba.fastjson.JSONObject(); + String device_code = list.get(0).toString(); + String device_name = list.get(1).toString(); + String device_type = list.get(2).toString(); + String is_config = list.get(3).toString(); + String is_route = list.get(4).toString(); + String region = list.get(5).toString(); + if (StrUtil.isEmpty(device_code)) { + throw new BadRequestException("设备编号为空!"); + } + if (StrUtil.isEmpty(device_name)) { + device_name = device_code; + } + if (StrUtil.isEmpty(device_type)) { + device_type = "conveyor"; + } + if (StrUtil.isEmpty(is_config)) { + is_config = "FALSE"; + } + if (StrUtil.isEmpty(is_route)) { + is_route = "false"; + } + DeviceDto dto = this.findByCode(device_code); + if (ObjectUtil.isNotEmpty(dto)) { + continue; + } + //按照列获取 + param.put("device_id", IdUtil.getSnowflake(1, 1).nextId()); + param.put("device_code", device_code); + param.put("device_name", device_name); + param.put("device_type", device_type); + param.put("is_config", is_config); + param.put("is_route", is_route); + param.put("create_by", "admin"); + param.put("create_time", now); + param.put("update_by", "admin"); + param.put("update_time", now); + param.put("region", region); + + wo.insert(param); + } + } } diff --git a/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/machines_site/MachinesSiteDefination.java b/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/machines_site/MachinesSiteDefination.java index 187d9ca..bfcd490 100644 --- a/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/machines_site/MachinesSiteDefination.java +++ b/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/machines_site/MachinesSiteDefination.java @@ -53,18 +53,9 @@ public class MachinesSiteDefination implements OpcDeviceDriverDefination { @Override public List getReadableItemDtos() { - return getReadableItemDtos2(); + return ItemProtocol.getReadableItemDtos(); } - public static List getReadableItemDtos2() { - List list = new ArrayList(); - list.add(new ItemDto(ItemProtocol.item_heartbeat, "心跳", "DB600.B0")); - list.add(new ItemDto(ItemProtocol.item_mode, "工作状态", "DB600.B1", true)); - list.add(new ItemDto(ItemProtocol.item_ioaction, "取放信号", "DB600.B3")); - list.add(new ItemDto(ItemProtocol.item_error, "报警信号", "DB600.B6")); - list.add(new ItemDto(ItemProtocol.item_task, "任务号", "DB600.D8")); - return list; - } @Override public List getWriteableItemDtos() { diff --git a/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_inspect_site/ItemProtocol.java b/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_inspect_site/ItemProtocol.java index 16850ab..5b5390a 100644 --- a/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_inspect_site/ItemProtocol.java +++ b/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_inspect_site/ItemProtocol.java @@ -13,16 +13,16 @@ 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_action = "action"; + public static String item_vehicle = "vehicle"; + public static String item_dry = "dry"; public static String item_ioaction = "ioaction"; - public static String item_error = "error"; - public static String item_task = "task"; + public static String item_take = "take"; + public static String item_put = "put"; public static String item_to_command = "to_command"; - public static String item_to_target = "to_target"; + public static String item_to_command1 = "to_command1"; public static String item_to_task = "to_task"; public static String item_weight = "weight"; - + public static String item_to_heartbeat = "to_heartbeat"; private StandardInspectSiteDeviceDriver driver; @@ -38,10 +38,10 @@ public class ItemProtocol { return this.getOpcIntegerValue(item_mode); } - public int getAction(){return this.getOpcIntegerValue(item_action);} + public int getAction(){return this.getOpcIntegerValue(item_dry);} public int getMove() { - return this.getOpcIntegerValue(item_move); + return this.getOpcIntegerValue(item_vehicle); } public int getIoaction() { @@ -49,21 +49,21 @@ public class ItemProtocol { } public int getError() { - return this.getOpcIntegerValue(item_error); + return this.getOpcIntegerValue(item_take); } public int getTask() { - return this.getOpcIntegerValue(item_task); + return this.getOpcIntegerValue(item_put); } - public int getToCommand() { - return this.getOpcIntegerValue(item_to_command); - } public int getToTarget() { - return this.getOpcIntegerValue(item_to_target); + return this.getOpcIntegerValue(item_to_command1); } + public int getToHeartbet() { + return this.getOpcIntegerValue(item_to_heartbeat); + } public int getToTask() { return this.getOpcIntegerValue(item_to_task); } @@ -91,19 +91,19 @@ public class ItemProtocol { public static List getReadableItemDtos() { ArrayList list = new ArrayList(); list.add(new ItemDto(item_heartbeat, "心跳", "DB600.B0")); - list.add(new ItemDto(item_mode, "工作状态", "DB600.B2", Boolean.valueOf(true))); - list.add(new ItemDto(item_move, "光电开关信号", "DB600.B3")); - list.add(new ItemDto(item_action,"取放信号","DB600,B4")); - list.add(new ItemDto(item_error, "报警信号", "DB600.B5")); - list.add(new ItemDto(item_task, "任务号", "DB600.D6")); + list.add(new ItemDto(item_mode, "工作模式", "DB600.B2", Boolean.valueOf(true))); + list.add(new ItemDto(item_vehicle, "底座有车", "DB600.B3")); + list.add(new ItemDto(item_dry,"干燥架","DB600,B4")); + list.add(new ItemDto(item_take, "取信号", "DB600.B5")); + list.add(new ItemDto(item_put, "放信号", "DB600.B6")); return list; } public static List getWriteableItemDtos() { ArrayList list = new ArrayList(); + list.add(new ItemDto(item_to_heartbeat, "心跳", "DB601.B0")); list.add(new ItemDto(item_to_command, "作业命令", "DB601.W2", Boolean.valueOf(true))); - list.add(new ItemDto(item_to_target, "目标站", "DB601.W4")); - list.add(new ItemDto(item_to_task, "任务号", "DB601.D8")); + list.add(new ItemDto(item_to_command1, "目标站", "DB601.W4")); return list; } diff --git a/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_inspect_site/StandardInspectSiteDefination.java b/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_inspect_site/StandardInspectSiteDefination.java index b7a9318..6fe821a 100644 --- a/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_inspect_site/StandardInspectSiteDefination.java +++ b/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_inspect_site/StandardInspectSiteDefination.java @@ -52,19 +52,10 @@ public class StandardInspectSiteDefination implements OpcDeviceDriverDefination @Override public List getReadableItemDtos() { - return getReadableItemDtos2(); + return ItemProtocol.getReadableItemDtos(); } - public static List getReadableItemDtos2() { - List list = new ArrayList(); - list.add(new ItemDto(ItemProtocol.item_heartbeat, "心跳", "DB600.B0")); - list.add(new ItemDto(ItemProtocol.item_mode, "工作状态", "DB600.B2", true)); - list.add(new ItemDto(ItemProtocol.item_move, "光电开关信号", "DB600.B3")); - list.add(new ItemDto(ItemProtocol.item_action,"取放信号","DB600,B4")); - list.add(new ItemDto(ItemProtocol.item_error, "报警信号", "DB600.B5")); - list.add(new ItemDto(ItemProtocol.item_task, "任务号", "DB600.D6")); - return list; - } + @Override public List getWriteableItemDtos() { diff --git a/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_inspect_site/StandardInspectSiteDeviceDriver.java b/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_inspect_site/StandardInspectSiteDeviceDriver.java index 0602074..115a1aa 100644 --- a/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_inspect_site/StandardInspectSiteDeviceDriver.java +++ b/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_inspect_site/StandardInspectSiteDeviceDriver.java @@ -74,6 +74,7 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp int last_task = 0; Boolean isonline = true; int hasGoods = 0; + int hasshelf=0; String message = null; Boolean iserror = false; @@ -142,6 +143,7 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp move = this.itemProtocol.getMove(); task = this.itemProtocol.getTask(); hasGoods = this.itemProtocol.getMove(); + hasshelf=this.itemProtocol.getAction(); if (mode != last_mode) { if (mode == 5){ @@ -371,9 +373,7 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + "." + ItemProtocol.item_to_command; String to_target = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + ItemProtocol.item_to_target; - String to_task = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + ItemProtocol.item_to_task; + + "." + ItemProtocol.item_to_command1; if (appendMessage == null) { appendMessage = ""; } @@ -384,7 +384,6 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp Server server = ReadUtil.getServer(opcservcerid); Map itemMap = new HashMap(); itemMap.put(to_command, 1); - itemMap.put(to_task, instruction_num); ReadUtil.write(itemMap, server); } @@ -409,9 +408,7 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + "." + ItemProtocol.item_to_command; String to_target = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + ItemProtocol.item_to_target; - String to_task = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + ItemProtocol.item_to_task; + + "." + ItemProtocol.item_to_command1; String opcservcerid = this.getDevice().getOpc_server_id(); Server server = ReadUtil.getServer(opcservcerid); Map itemMap = new HashMap(); @@ -419,9 +416,6 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp itemMap.put(to_command, command); } else if (type == 2) { itemMap.put(to_target, command); - - } else if (type == 3) { - itemMap.put(to_task, command); } ReadUtil.write(itemMap, server); diff --git a/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_photoelectric_inspect_site/StandardPhotoelectricInspectSiteDeviceDriver.java b/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_photoelectric_inspect_site/StandardPhotoelectricInspectSiteDeviceDriver.java index 4320079..f5d719c 100644 --- a/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_photoelectric_inspect_site/StandardPhotoelectricInspectSiteDeviceDriver.java +++ b/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_photoelectric_inspect_site/StandardPhotoelectricInspectSiteDeviceDriver.java @@ -239,7 +239,7 @@ public class StandardPhotoelectricInspectSiteDeviceDriver extends AbstractOpcDev String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + "." + org.nl.acs.device_driver.standard_inspect_site.ItemProtocol.item_to_command; String to_target = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + org.nl.acs.device_driver.standard_inspect_site.ItemProtocol.item_to_target; + + "." + org.nl.acs.device_driver.standard_inspect_site.ItemProtocol.item_to_command1; String to_task = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + "." + org.nl.acs.device_driver.standard_inspect_site.ItemProtocol.item_to_task; if (appendMessage == null) { diff --git a/hd/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java b/hd/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java index dc1f2f3..40a9502 100644 --- a/hd/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java +++ b/hd/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java @@ -5,6 +5,7 @@ package org.nl.acs.instruction.service.impl; import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.StrUtil; +import cn.hutool.http.HttpRequest; import cn.hutool.http.HttpResponse; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -900,6 +901,17 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu } if (flag) { + com.alibaba.fastjson.JSONObject requestjo = new com.alibaba.fastjson.JSONObject(); + requestjo.put("task_code", entity.getInstruction_code()); + String agvurl = acsConfigService.findByCode(AcsConfig.AGVURL).getValue(); + String agvport = acsConfigService.findByCode(AcsConfig.AGVPORT).getValue(); + String taskcode=entity.getInstruction_code(); + agvurl = agvurl + ":" + agvport + "/rmds/v1/transportOrders/" + taskcode + "/withdrawal"; + HttpResponse result = HttpRequest.post(agvurl) + .body(String.valueOf(requestjo)) + .timeout(20000)//超时,毫秒 + .execute(); + log.info("请求地址agvurl{},请求结果{}",agvurl,result.body()); String currentUsername = SecurityUtils.getCurrentUsername(); String now = DateUtil.now(); entity.setUpdate_time(now); diff --git a/hd/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java b/hd/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java index c2b7042..ec6871d 100644 --- a/hd/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java +++ b/hd/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java @@ -488,9 +488,9 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial { if (StrUtil.equals(DeviceType.conveyor.toString(), startDeviceType)) { if (startdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) startdevice.getDeviceDriver(); - if (standardInspectSiteDeviceDriver.getMode() != 2 || standardInspectSiteDeviceDriver.getMove() == 0) { - throw new Exception("任务起点需满足待机有货!"); - } +// if (standardInspectSiteDeviceDriver.getMode() != 2 || standardInspectSiteDeviceDriver.getMove() == 0) { +// throw new Exception("任务起点需满足待机有货!"); +// } if (!StrUtil.isEmpty(standardInspectSiteDeviceDriver.getMaterial())) { dto.setMaterial(standardInspectSiteDeviceDriver.getMaterial()); } @@ -532,9 +532,9 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial { } if (nextdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) nextdevice.getDeviceDriver(); - if (standardInspectSiteDeviceDriver.getMode() != 2 || standardInspectSiteDeviceDriver.getMove() != 0) { - throw new Exception("任务终点需满足待机无货!"); - } +// if (standardInspectSiteDeviceDriver.getMode() != 2 || standardInspectSiteDeviceDriver.getMove() != 0) { +// throw new Exception("任务终点需满足待机无货!"); +// } } if (nextdevice.getDeviceDriver() instanceof StandardManipulatorInspectSiteDeviceDriver) { standardManipulatorInspectSiteDeviceDriver = (StandardManipulatorInspectSiteDeviceDriver) nextdevice.getDeviceDriver(); diff --git a/hd/nladmin-system/src/main/java/org/nl/hand/azglny/service/impl/ZglnyHandServiceImpl.java b/hd/nladmin-system/src/main/java/org/nl/hand/azglny/service/impl/ZglnyHandServiceImpl.java index 6cb5c39..c4b2ef0 100644 --- a/hd/nladmin-system/src/main/java/org/nl/hand/azglny/service/impl/ZglnyHandServiceImpl.java +++ b/hd/nladmin-system/src/main/java/org/nl/hand/azglny/service/impl/ZglnyHandServiceImpl.java @@ -18,6 +18,7 @@ import org.nl.acs.device_driver.special_ordinary_site.SpecialOrdinarySiteDeviceD import org.nl.acs.device_driver.standard_emptypallet_site.StandardEmptyPalletSiteDeviceDriver; import org.nl.acs.device_driver.standard_inspect_site.StandardInspectSiteDeviceDriver; import org.nl.acs.device_driver.standard_manipulator_inspect_site.StandardManipulatorInspectSiteDeviceDriver; +import org.nl.acs.device_driver.standard_manipulator_stacking_site.StandardManipulatorStackingSiteDeviceDriver; import org.nl.acs.device_driver.standard_ordinary_site.StandardOrdinarySiteDeviceDriver; import org.nl.acs.device_driver.standard_storage.StandardStorageDeviceDriver; import org.nl.acs.instruction.service.InstructionService; @@ -104,104 +105,209 @@ public class ZglnyHandServiceImpl implements ZglnyHandService { } //根据value值去查所有的设备 JSONArray acs_deviceja = WQLObject.getWQLObject("ACS_DEVICE").query("region='" + value + "' and device_type='conveyor' and is_config='true' ", "seq_num,device_name").getResultJSONArray(0); - for (int i = 0; i < acs_deviceja.size(); i++) { - JSONObject devicejo = acs_deviceja.getJSONObject(i); - String device_code = devicejo.optString("device_code"); - DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class); - Device device = appService.findDeviceByCode(device_code); - //无光电普通站点 - StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver; - //货架 - StandardStorageDeviceDriver standardStorageDeviceDriver; - if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { - standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver(); - if (StrUtil.equals(device.getIslock(), "true")) { - status = "3"; - move = "有任务"; - } else { - if (standardOrdinarySiteDeviceDriver.getHasGoods() == 0) { - status = "0"; - move = "无货"; - } else if (standardOrdinarySiteDeviceDriver.getHasGoods() == 1) { - status = "1"; - move = "有托盘"; - } else if (standardOrdinarySiteDeviceDriver.getHasGoods() == 2) { - status = "2"; - move = "有托盘有货"; + if (acs_deviceja.size() > 0) { + for (int i = 0; i < acs_deviceja.size(); i++) { + JSONObject devicejo = acs_deviceja.getJSONObject(i); + String device_code = devicejo.optString("device_code"); + DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class); + Device device = appService.findDeviceByCode(device_code); + //无光电普通站点 + StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver; + //货架 + StandardStorageDeviceDriver standardStorageDeviceDriver; + //检测站点 + StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver; + if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { + standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver(); + if (StrUtil.equals(device.getIslock(), "true")) { + status = "3"; + move = "有任务"; + } else { + if (standardOrdinarySiteDeviceDriver.getHasGoods() == 0) { + status = "0"; + move = "无货"; + } else if (standardOrdinarySiteDeviceDriver.getHasGoods() == 1) { + status = "1"; + move = "有托盘"; + } else if (standardOrdinarySiteDeviceDriver.getHasGoods() == 2) { + status = "2"; + move = "有托盘有货"; + } } - } - material = device.getMaterial_type(); - //material = standardOrdinarySiteDeviceDriver.getMaterial(); - if (StrUtil.isNullOrUndefined(material)) { - material = ""; - } - batch = device.getBatch(); - //batch = standardOrdinarySiteDeviceDriver.getBatch(); - if (StrUtil.isNullOrUndefined(batch)) { - batch = ""; - } - String input_materialflag = (String) device.getExtraValue().get("input_material"); - if (!StrUtil.isEmpty(input_materialflag) && input_materialflag.equals("false")) { - input_material = "0"; - } - if (!StrUtil.isEmpty(input_materialflag) && input_materialflag.equals("true")) { - input_material = "1"; + material = device.getMaterial_type(); + //material = standardOrdinarySiteDeviceDriver.getMaterial(); + if (StrUtil.isNullOrUndefined(material)) { + material = ""; + } + batch = device.getBatch(); + //batch = standardOrdinarySiteDeviceDriver.getBatch(); + if (StrUtil.isNullOrUndefined(batch)) { + batch = ""; + } + String input_materialflag = (String) device.getExtraValue().get("input_material"); + if (!StrUtil.isEmpty(input_materialflag) && input_materialflag.equals("false")) { + input_material = "0"; + } + if (!StrUtil.isEmpty(input_materialflag) && input_materialflag.equals("true")) { + input_material = "1"; + } + jo.put("material_type", material); + jo.put("batch", batch); + jo.put("islock", device.getIslock()); + jo.put("status_name", move); + jo.put("status", status); + jo.put("device_id", devicejo.optString("device_id")); + jo.put("device_code", devicejo.optString("device_code")); + jo.put("device_name", devicejo.optString("device_name")); + jo.put("allow_update", "1"); + jo.put("input_material", input_material); + // 特殊驱动 } - jo.put("material_type", material); - jo.put("batch", batch); - jo.put("islock", device.getIslock()); - jo.put("status_name", move); - jo.put("status", status); - jo.put("device_id", devicejo.optString("device_id")); - jo.put("device_code", devicejo.optString("device_code")); - jo.put("device_name", devicejo.optString("device_name")); - jo.put("allow_update", "1"); - jo.put("input_material", input_material); - // 特殊驱动 - } + if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { + standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver(); + if (StrUtil.equals(device.getIslock(), "true")) { + status = "3"; + move = "有任务"; + } else { + if (standardInspectSiteDeviceDriver.getHasshelf() == 0) { + status = "0"; + move = "无货"; + } else if (standardInspectSiteDeviceDriver.getHasshelf() == 1) { + status = "1"; + move = "有托盘"; +// } else if (standardInspectSiteDeviceDriver.getAction() == 1) { +// status = "2"; +// move = "有托盘有货"; + } + } - if (device.getDeviceDriver() instanceof StandardStorageDeviceDriver) { - standardStorageDeviceDriver = (StandardStorageDeviceDriver) device.getDeviceDriver(); - if (StrUtil.equals(device.getIslock(), "true")) { - status = "3"; - move = "有任务"; - } - material = device.getMaterial_type(); - //material = standardOrdinarySiteDeviceDriver.getMaterial(); - if (StrUtil.isNullOrUndefined(material)) { - material = ""; - } - batch = device.getBatch(); - //batch = standardOrdinarySiteDeviceDriver.getBatch(); - if (StrUtil.isNullOrUndefined(batch)) { - batch = ""; - } - String input_materialflag = (String) device.getExtraValue().get("input_material"); - if (!StrUtil.isEmpty(input_materialflag) && input_materialflag.equals("false")) { - input_material = "0"; + material = device.getMaterial_type(); + //material = standardOrdinarySiteDeviceDriver.getMaterial(); + if (StrUtil.isNullOrUndefined(material)) { + material = ""; + } + batch = device.getBatch(); + //batch = standardOrdinarySiteDeviceDriver.getBatch(); + if (StrUtil.isNullOrUndefined(batch)) { + batch = ""; + } + String input_materialflag = (String) device.getExtraValue().get("input_material"); + if (!StrUtil.isEmpty(input_materialflag) && input_materialflag.equals("false")) { + input_material = "0"; + } + if (!StrUtil.isEmpty(input_materialflag) && input_materialflag.equals("true")) { + input_material = "1"; + } + jo.put("material_type", material); + jo.put("batch", batch); + jo.put("islock", device.getIslock()); + jo.put("status_name", move); + jo.put("status", status); + jo.put("device_id", devicejo.optString("device_id")); + jo.put("device_code", devicejo.optString("device_code")); + jo.put("device_name", devicejo.optString("device_name")); + jo.put("allow_update", "1"); + jo.put("input_material", input_material); + // 特殊驱动 } - if (!StrUtil.isEmpty(input_materialflag) && input_materialflag.equals("true")) { - input_material = "1"; + + if (device.getDeviceDriver() instanceof StandardStorageDeviceDriver) { + standardStorageDeviceDriver = (StandardStorageDeviceDriver) device.getDeviceDriver(); + if (StrUtil.equals(device.getIslock(), "true")) { + status = "3"; + move = "有任务"; + } + material = device.getMaterial_type(); + //material = standardOrdinarySiteDeviceDriver.getMaterial(); + if (StrUtil.isNullOrUndefined(material)) { + material = ""; + } + batch = device.getBatch(); + //batch = standardOrdinarySiteDeviceDriver.getBatch(); + if (StrUtil.isNullOrUndefined(batch)) { + batch = ""; + } + String input_materialflag = (String) device.getExtraValue().get("input_material"); + if (!StrUtil.isEmpty(input_materialflag) && input_materialflag.equals("false")) { + input_material = "0"; + } + if (!StrUtil.isEmpty(input_materialflag) && input_materialflag.equals("true")) { + input_material = "1"; + } + jo.put("material_type", material); + jo.put("batch", batch); + jo.put("status_name", move); + jo.put("status", status); + jo.put("device_id", devicejo.optString("device_id")); + jo.put("device_code", devicejo.optString("device_code")); + jo.put("device_name", devicejo.optString("device_name")); + jo.put("allow_update", "1"); + jo.put("input_material", input_material); + // 特殊驱动 } - jo.put("material_type", material); - jo.put("batch", batch); - jo.put("status_name", move); - jo.put("status", status); - jo.put("device_id", devicejo.optString("device_id")); - jo.put("device_code", devicejo.optString("device_code")); - jo.put("device_name", devicejo.optString("device_name")); - jo.put("allow_update", "1"); - jo.put("input_material", input_material); - // 特殊驱动 + resultArr.add(jo); +// } else { +// JSONArray acs_huojia=new JSONArray(); +// if(value.equals("14")) { +// acs_huojia = WQLObject.getWQLObject("ACS_STORAGE_CELL").query("(storage_code LIKE 'DHC01%') OR (storage_code LIKE 'DHC02%') OR (storage_code LIKE 'DHC03%')", "storage_code").getResultJSONArray(0); +// } +// if(value.equals("15")){ +// acs_huojia = WQLObject.getWQLObject("ACS_STORAGE_CELL").query("(storage_code LIKE 'DHC04%') OR (storage_code LIKE 'DHC05%') OR (storage_code LIKE 'DHC06%')", "storage_code").getResultJSONArray(0); +// } +// if (acs_huojia.size() > 0) { +// for (int i = 0; i < acs_huojia.size(); i++) { +// JSONObject devicejia = acs_huojia.getJSONObject(i); +// String device_code = devicejia.optString("storage_code"); +//// DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class); +//// Device device = appService.findDeviceByCode(device_code); +//// //货架 +//// StandardStorageDeviceDriver standardStorageDeviceDriver; +//// if (device.getDeviceDriver() instanceof StandardStorageDeviceDriver) { +//// standardStorageDeviceDriver = (StandardStorageDeviceDriver) device.getDeviceDriver(); +//// if (StrUtil.equals(device.getIslock(), "true")) { +//// status = "3"; +//// move = "有任务"; +//// } +//// material = device.getMaterial_type(); +//// //material = standardOrdinarySiteDeviceDriver.getMaterial(); +//// if (StrUtil.isNullOrUndefined(material)) { +//// material = ""; +//// } +//// batch = device.getBatch(); +//// //batch = standardOrdinarySiteDeviceDriver.getBatch(); +//// if (StrUtil.isNullOrUndefined(batch)) { +//// batch = ""; +//// } +//// String input_materialflag = (String) device.getExtraValue().get("input_material"); +//// if (!StrUtil.isEmpty(input_materialflag) && input_materialflag.equals("false")) { +//// input_material = "0"; +//// } +//// if (!StrUtil.isEmpty(input_materialflag) && input_materialflag.equals("true")) { +//// input_material = "1"; +//// } +// jo.put("material_type", material); +// jo.put("batch", batch); +// jo.put("status_name", move); +// jo.put("status", status); +// jo.put("device_code", devicejia.optString("storage_code")); +// jo.put("device_name", devicejia.optString("storage_code")); +// jo.put("allow_update", "1"); +// jo.put("input_material", input_material); +// // 特殊驱动 +//// } +// resultArr.add(jo); +// } +// } +// } } - resultArr.add(jo); } - resultJson.put("code", "1"); - resultJson.put("desc", "查询成功"); - resultJson.put("result", resultArr); - return resultJson; - } + resultJson.put("code", "1"); + resultJson.put("desc", "查询成功"); + resultJson.put("result", resultArr); + return resultJson; + } + @Override public Map queryInst(Map jsonObject) { @@ -216,6 +322,8 @@ public class ZglnyHandServiceImpl implements ZglnyHandService { @Override public Map createTask(Map jsonObject) { + //检测站点 + StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver; String start_devicecode = jsonObject.get("start_devicecode"); String next_devicecode = jsonObject.get("next_devicecode"); String material_type = jsonObject.get("material_type"); @@ -253,17 +361,42 @@ public class ZglnyHandServiceImpl implements ZglnyHandService { return resultJson; } //判断起点有货,终点为空 - if (ObjectUtil.isEmpty(startDevice.getMaterial_type()) || Integer.parseInt(startDevice.getMaterial_type()) == 0) { - resultJson.put("code", "0"); - resultJson.put("desc", "起点必须有货"); - resultJson.put("result", ""); - return resultJson; + +// if (standardInspectSiteDeviceDriver.getMode()==2&&standardInspectSiteDeviceDriver.getMove()==1&&standardInspectSiteDeviceDriver.getHasshelf()==1) { +// resultJson.put("code", "0"); +// resultJson.put("desc", "起点必须有货"); +// resultJson.put("result", ""); +// return resultJson; +// } +// +// if (standardInspectSiteDeviceDriver.getMode()==2&&standardInspectSiteDeviceDriver.getMove()==1&&standardInspectSiteDeviceDriver.getHasshelf()==0) { +// resultJson.put("code", "0"); +// resultJson.put("desc", "终点必须为空"); +// resultJson.put("result", ""); +// return resultJson; +// } + + + if(startDevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver){ + standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) startDevice.getDeviceDriver(); + if (standardInspectSiteDeviceDriver.getMode() !=2 || standardInspectSiteDeviceDriver.getMove() !=1 || + standardInspectSiteDeviceDriver.getHasshelf() !=1) { + resultJson.put("code", "0"); + resultJson.put("desc", "起点必须有货"); + resultJson.put("result", ""); + return resultJson; + } } - if (!ObjectUtil.isEmpty(nextDevice.getMaterial_type()) && !StrUtil.equals(nextDevice.getMaterial_type(), "0")) { - resultJson.put("code", "0"); - resultJson.put("desc", "终点必须为空"); - resultJson.put("result", ""); - return resultJson; + + if(nextDevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver){ + standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) nextDevice.getDeviceDriver(); + if (standardInspectSiteDeviceDriver.getMode() !=2 || standardInspectSiteDeviceDriver.getMove() !=1 || + standardInspectSiteDeviceDriver.getHasshelf() !=0) { + resultJson.put("code", "0"); + resultJson.put("desc", "终点必须为空"); + resultJson.put("result", ""); + return resultJson; + } } //判断有无这个任务 diff --git a/hd/nladmin-system/src/main/java/org/nl/modules/quartz/task/AutoCreateInst.java b/hd/nladmin-system/src/main/java/org/nl/modules/quartz/task/AutoCreateInst.java index 844a7e7..3500443 100644 --- a/hd/nladmin-system/src/main/java/org/nl/modules/quartz/task/AutoCreateInst.java +++ b/hd/nladmin-system/src/main/java/org/nl/modules/quartz/task/AutoCreateInst.java @@ -178,14 +178,14 @@ public class AutoCreateInst { this.execute_log.log("起点设备:" + startdevice.getDevice_code() + "设备未待机,任务号:" + taskcode); continue; } - if (standardInspectSiteDeviceDriver.getMove() == 0) { - log.info("目标设备:" + startdevice.getDevice_code() + "设备不满足放货条件,任务号:" + taskcode); - acsTask.setRemark("目标设备:" + startdevice.getDevice_code() + "设备不满足放货条件,任务号:" + taskcode); - taskserver.updateByCodeFromCache(acsTask); - this.execute_log.setResource(startdevice.getDevice_code(), startdevice.getDevice_code()); - this.execute_log.log("目标设备:" + startdevice.getDevice_code() + "设备不满足放货条件,任务号:" + taskcode); - continue; - } +// if (standardInspectSiteDeviceDriver.getHasshelf() == 0) { +// log.info("目标设备:" + startdevice.getDevice_code() + "设备不满足放货条件,任务号:" + taskcode); +// acsTask.setRemark("目标设备:" + startdevice.getDevice_code() + "设备不满足放货条件,任务号:" + taskcode); +// taskserver.updateByCodeFromCache(acsTask); +// this.execute_log.setResource(startdevice.getDevice_code(), startdevice.getDevice_code()); +// this.execute_log.log("目标设备:" + startdevice.getDevice_code() + "设备不满足放货条件,任务号:" + taskcode); +// continue; +// } } if (startdevice.getDeviceDriver() instanceof StandardManipulatorInspectSiteDeviceDriver) { standardManipulatorInspectSiteDeviceDriver = (StandardManipulatorInspectSiteDeviceDriver) startdevice.getDeviceDriver(); @@ -234,14 +234,14 @@ public class AutoCreateInst { this.execute_log.log("目标设备:" + nextdevice.getDevice_code() + "设备未待机,任务号:" + taskcode); continue; } - if (standardInspectSiteDeviceDriver.getMove() != 0) { - log.info("目标设备:" + nextdevice.getDevice_code() + "设备不满足放货条件,任务号:" + taskcode); - acsTask.setRemark("目标设备:" + nextdevice.getDevice_code() + "设备不满足放货条件,任务号:" + taskcode); - taskserver.updateByCodeFromCache(acsTask); - this.execute_log.setResource(nextdevice.getDevice_code(), nextdevice.getDevice_code()); - this.execute_log.log("目标设备:" + nextdevice.getDevice_code() + "设备不满足放货条件,任务号:" + taskcode); - continue; - } +// if (standardInspectSiteDeviceDriver.getHasshelf() == 0) { +// log.info("目标设备:" + nextdevice.getDevice_code() + "设备不满足放货条件,任务号:" + taskcode); +// acsTask.setRemark("目标设备:" + nextdevice.getDevice_code() + "设备不满足放货条件,任务号:" + taskcode); +// taskserver.updateByCodeFromCache(acsTask); +// this.execute_log.setResource(nextdevice.getDevice_code(), nextdevice.getDevice_code()); +// this.execute_log.log("目标设备:" + nextdevice.getDevice_code() + "设备不满足放货条件,任务号:" + taskcode); +// continue; +// } if (startdevice.getDeviceDriver() instanceof StandardEmptyPalletSiteDeviceDriver){ standardEmptsyPalletSiteDeviceDriver = (StandardEmptyPalletSiteDeviceDriver) startdevice.getDeviceDriver(); if (next_device_code.equals("Q1") || next_device_code.equals("P1")){ diff --git a/hd/nladmin-system/src/main/java/org/nl/modules/quartz/task/QueryAgvTaskStatus.java b/hd/nladmin-system/src/main/java/org/nl/modules/quartz/task/QueryAgvTaskStatus.java index 175f193..dc1345c 100644 --- a/hd/nladmin-system/src/main/java/org/nl/modules/quartz/task/QueryAgvTaskStatus.java +++ b/hd/nladmin-system/src/main/java/org/nl/modules/quartz/task/QueryAgvTaskStatus.java @@ -33,7 +33,7 @@ public class QueryAgvTaskStatus { JSONArray inst_rows = JSONArray.parseArray(response.body()); for (int i = 0; i < inst_rows.size(); i++) { JSONObject inst_jo = inst_rows.getJSONObject(i); - String inst_code = inst_jo.getString("taskCode"); + String inst_code = inst_jo.getString("task_code"); Instruction inst = instructionService.findByCodeFromCache(inst_code); if (ObjectUtil.isEmpty(inst)) { continue; @@ -41,7 +41,7 @@ public class QueryAgvTaskStatus { //反馈结果状态 log.info("instcode:" + inst_code + "," + inst_jo.toString()); - String state = inst_jo.getString("state"); + String state = inst_jo.getString("status"); String vehicle = ""; //正在执行指令agv车号 if (!StrUtil.isEmpty(inst_jo.getString("vehicle"))) { @@ -58,7 +58,7 @@ public class QueryAgvTaskStatus { // UNROUTABLE:无法规划该业务订单的执行路线 //执行中 - if ("BEING_PROCESSED".equals(state)) { + if ("BEING_PROCESSED".equals(state) || "ACTIVE".equals(state)) { if (inst != null) { inst.setInstruction_status("1"); instructionService.update(inst); diff --git a/hd/nladmin-system/src/main/java/org/nl/modules/system/service/dto/ParamDto.java b/hd/nladmin-system/src/main/java/org/nl/modules/system/service/dto/ParamDto.java new file mode 100644 index 0000000..0cc5cf1 --- /dev/null +++ b/hd/nladmin-system/src/main/java/org/nl/modules/system/service/dto/ParamDto.java @@ -0,0 +1,36 @@ +package org.nl.modules.system.service.dto; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @description / + * @author ldjun + * @date 2021-01-14 + **/ +@Data +public class ParamDto implements Serializable { + + private String id; + + private String code; + + private String name; + + private String value; + + private String remark; + + private Long create_id; + + private Long update_optid; + + private String create_name; + + private String create_time; + + private String update_optname; + + private String update_time; +} diff --git a/hd/nladmin-system/src/main/resources/log/AcsToWms.xml b/hd/nladmin-system/src/main/resources/log/AcsToWms.xml index 94a1180..b5da5f0 100644 --- a/hd/nladmin-system/src/main/resources/log/AcsToWms.xml +++ b/hd/nladmin-system/src/main/resources/log/AcsToWms.xml @@ -10,7 +10,7 @@ 15 - 200MB + 50MB 2GB diff --git a/qd/.env.production b/qd/.env.production index 83b8dae..4d79695 100644 --- a/qd/.env.production +++ b/qd/.env.production @@ -2,8 +2,8 @@ ENV = 'production' # 如果使用 Nginx 代理后端接口,那么此处需要改为 '/',文件查看 Docker 部署篇,Nginx 配置 # 接口地址,注意协议,如果你没有配置 ssl,需要将 https 改为 http -VUE_APP_BASE_API = 'http://192.168.81.122:8010' +VUE_APP_BASE_API = 'http://127.0.0.1:8010' #VUE_APP_BASE_API = 'http://127.0.0.1:8010' # 如果接口是 http 形式, wss 需要改为 ws -VUE_APP_WS_API = 'ws://192.168.81.122:8010' +VUE_APP_WS_API = 'ws://127.0.0.1:8010' #VUE_APP_WS_API = 'ws://127.0.0.1:8010' diff --git a/qd/src/api/acs/device/device.js b/qd/src/api/acs/device/device.js index 49433cc..1bada30 100644 --- a/qd/src/api/acs/device/device.js +++ b/qd/src/api/acs/device/device.js @@ -1,217 +1,253 @@ import request from '@/utils/request' export function add(data) { - return request({ - url: 'api/device', - method: 'post', - data - }) + return request({ + url: 'api/device', + method: 'post', + data + }) } export function del(ids) { - return request({ - url: 'api/device/', - method: 'delete', - data: ids - }) + return request({ + url: 'api/device/', + method: 'delete', + data: ids + }) } export function edit(data) { - return request({ - url: 'api/device', - method: 'put', - data - }) + return request({ + url: 'api/device', + method: 'put', + data + }) } export function selectDeviceList() { - return request({ - url: 'api/device/selectList', - method: 'get' - }) + return request({ + url: 'api/device/selectList', + method: 'get' + }) } export function selectConDeviceList() { - return request({ - url: 'api/device/selectConveyorList', - method: 'get' - }) + return request({ + url: 'api/device/selectConveyorList', + method: 'get' + }) } export function selectDeviceListByRegion(region) { - return request({ - url: 'api/device/region/' + region, - method: 'get' - }) + return request({ + url: 'api/device/region/' + region, + method: 'get' + }) } export function selectDeviceListOne() { - return request({ - url: 'api/device/selectListOne', - method: 'get' - }) + return request({ + url: 'api/device/selectListOne', + method: 'get' + }) } export function selectDeviceListTwo() { - return request({ - url: 'api/device/selectListTwo', - method: 'get' - }) + return request({ + url: 'api/device/selectListTwo', + method: 'get' + }) } export function selectDeviceListThree() { - return request({ - url: 'api/device/selectListThree', - method: 'get' - }) + return request({ + url: 'api/device/selectListThree', + method: 'get' + }) } export function selectDeviceDevicerInfo(status) { - return request({ - url: 'api/device/selectDeviceDevicerInfo/' + status, - method: 'get' - }) + return request({ + url: 'api/device/selectDeviceDevicerInfo/' + status, + method: 'get' + }) } export function changeDeviceStatus(data) { - return request({ - url: 'api/device/changeDeviceStatus', - method: 'post', - data - }) + return request({ + url: 'api/device/changeDeviceStatus', + method: 'post', + data + }) } export function changeFenceStatus(data) { - return request({ - url: 'api/device/changeFenceStatus', - method: 'post', - data - }) + return request({ + url: 'api/device/changeFenceStatus', + method: 'post', + data + }) } export function saveBarcode(data) { - return request({ - url: 'api/device/updateBarcode', - method: 'post', - data - }) + return request({ + url: 'api/device/updateBarcode', + method: 'post', + data + }) } export function callAgv(data) { - return request({ - url: 'api/device/callAgv', - method: 'post', - data - }) + return request({ + url: 'api/device/callAgv', + method: 'post', + data + }) } export function addMaterial(data) { - return request({ - url: 'api/device/addMaterial', - method: 'post', - data - }) + return request({ + url: 'api/device/addMaterial', + method: 'post', + data + }) } export function responseAgv(data) { - return request({ - url: 'api/device/responseAgv', - method: 'post', - data - }) + return request({ + url: 'api/device/responseAgv', + method: 'post', + data + }) } export function autoCreateTask(data) { - return request({ - url: 'api/device/autoCreateTask', - method: 'post', - data - }) + return request({ + url: 'api/device/autoCreateTask', + method: 'post', + data + }) } export function cleanTask(data) { - return request({ - url: 'api/device/cleanTask', - method: 'post', - data - }) + return request({ + url: 'api/device/cleanTask', + method: 'post', + data + }) } export function cleanMaterial(data) { - return request({ - url: 'api/device/cleanMaterial', - method: 'post', - data - }) + return request({ + url: 'api/device/cleanMaterial', + method: 'post', + data + }) } export function queryStorageExtra(storage_code) { - return request({ - url: 'api/device/queryStorageExtra/' + storage_code, - method: 'get' - }) + return request({ + url: 'api/device/queryStorageExtra/' + storage_code, + method: 'get' + }) } export function reload() { - return request({ - url: 'api/device/reload', - method: 'get' - }) + return request({ + url: 'api/device/reload', + method: 'get' + }) } export function cleans1(data) { - return request({ - url: 'api/device/cleans1', - method: 'post', - data - }) + return request({ + url: 'api/device/cleans1', + method: 'post', + data + }) } export function cleans2(data) { - return request({ - url: 'api/device/cleans2', - method: 'post', - data - }) + return request({ + url: 'api/device/cleans2', + method: 'post', + data + }) } export function enterSite1(data) { - return request({ - url: 'api/device/enterSite1', - method: 'post', - data - }) + return request({ + url: 'api/device/enterSite1', + method: 'post', + data + }) } export function enterSite2(data) { - return request({ - url: 'api/device/enterSite2', - method: 'post', - data - }) + return request({ + url: 'api/device/enterSite2', + method: 'post', + data + }) } export function cleans3(data) { - return request({ - url: 'api/device/cleans3', - method: 'post', - data - }) + return request({ + url: 'api/device/cleans3', + method: 'post', + data + }) } export function selectAGVList() { - return request({ - url: 'api/device/selectAGVList', - method: 'get' - }) + return request({ + url: 'api/device/selectAGVList', + method: 'get' + }) } export function agvTaskType(data) { - return request({ - url: 'api/device/agvTaskType', - method: 'post', - data - }) -} - -export default { add, edit, del, selectDeviceList, selectDeviceListByRegion, callAgv, responseAgv, selectDeviceDevicerInfo, autoCreateTask, - changeDeviceStatus, cleanTask, queryStorageExtra, selectConDeviceList, saveBarcode, selectDeviceListOne, selectDeviceListTwo, selectDeviceListThree, - addMaterial, cleanMaterial, changeFenceStatus,reload, cleans1, cleans2, enterSite1, enterSite2, cleans3, selectAGVList, agvTaskType} + return request({ + url: 'api/device/agvTaskType', + method: 'post', + data + }) +} + +export function excelImport(data) { + return request({ + url: 'api/device/excelImport', + method: 'post', + data + }) +} + +export default { + add, + edit, + del, + selectDeviceList, + selectDeviceListByRegion, + callAgv, + responseAgv, + selectDeviceDevicerInfo, + autoCreateTask, + changeDeviceStatus, + cleanTask, + queryStorageExtra, + selectConDeviceList, + saveBarcode, + selectDeviceListOne, + selectDeviceListTwo, + selectDeviceListThree, + addMaterial, + cleanMaterial, + changeFenceStatus, + reload, + cleans1, + cleans2, + enterSite1, + enterSite2, + cleans3, + selectAGVList, + agvTaskType, + excelImport +} \ No newline at end of file diff --git a/qd/src/views/acs/device/index.vue b/qd/src/views/acs/device/index.vue index f8847f1..7b8a225 100644 --- a/qd/src/views/acs/device/index.vue +++ b/qd/src/views/acs/device/index.vue @@ -26,9 +26,51 @@ > + + + + + + + 导出模型 + + 导入 + - - + + + + + + @@ -109,21 +160,21 @@ - + - - + + - - + + - + @@ -166,7 +215,9 @@ import crudOperation from '@crud/CRUD.operation' import udOperation from '@crud/UD.operation' import pagination from '@crud/Pagination' import { get } from '@/api/system/dictDetail' -import crudRouteLine from '@/api/acs/route/routeLine' +import UploadDialog from '@/views/acs/device/UploadDialog' +import { download } from '@/api/data' +import { downloadFile } from '@/utils' const defaultForm = { manufacturer: null, @@ -185,11 +236,12 @@ const defaultForm = { device_type: null, region: null, is_config: null, - remark: null + remark: null, + region: null } export default { name: 'Device', - components: { pagination, crudOperation, rrOperation, udOperation }, + components: { pagination, crudOperation, rrOperation, udOperation, UploadDialog }, mixins: [presenter(), header(), form(defaultForm), crud()], cruds() { return CRUD({ @@ -209,6 +261,10 @@ export default { }, device_types: [], regions: [], + is_configs: [], + uploadShow: false, + device_code: '', + regions: [], rules: { device_code: [ { required: true, message: '设备编码不能为空', trigger: 'blur' } @@ -218,8 +274,10 @@ export default { ], device_type: [ { required: true, message: '设备类型不能为空', trigger: 'blur' } + ], + region: [ + { required: true, message: '所属区域不能为空', trigger: 'blur' } ] - } } }, @@ -230,9 +288,13 @@ export default { this.device_types = data.content }) // 获取区域类型 - get('region_type').then(data => { + get('region').then(data => { this.regions = data.content }) + //获取是否配置 + get('is_config').then(data => { + this.is_configs = data.content + }) }) }, methods: { @@ -240,12 +302,25 @@ export default { [CRUD.HOOK.beforeRefresh]() { return true }, + tableChanged3() { + this.crud.toQuery() + }, reload() { crudDevice.reload().then(res => { this.crud.toQuery() }).catch(err => { console.log(err.response.data.message) }) + }, + downloadMethod() { + this.beforeInit() + this.downloadLoading = true + download(this.url + 'api/device/download', this.params).then(result => { + downloadFile(result, this.title + '数据', 'xlsx') + this.downloadLoading = false + }).catch(() => { + this.downloadLoading = false + }) } } }