From 6a2c853e8e45d276c39ec9417eed98352abdb8e8 Mon Sep 17 00:00:00 2001 From: liuxy Date: Thu, 16 Mar 2023 11:15:35 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/ProductInstorServiceImpl.java | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/service/impl/ProductInstorServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/service/impl/ProductInstorServiceImpl.java index 4b3b33d2a..c94030965 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/service/impl/ProductInstorServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/service/impl/ProductInstorServiceImpl.java @@ -162,11 +162,24 @@ public class ProductInstorServiceImpl implements ProductInstorService { // 木箱尺寸长度低于950的不入立体库,长度大于1385的立体库无法入库 String length_up = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("box_length_up").getValue(); String length_down = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("box_length_down").getValue(); - Double box_length_up = Double.valueOf(length_up); - Double box_length_down = Double.valueOf(length_down); + String with_up = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("box_with_up").getValue(); + String high_up = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("box_high_up").getValue(); + + Double box_length_up = Double.valueOf(length_up); // 木箱长度上限 + Double box_length_down = Double.valueOf(length_down); // 木箱长度下限 + Double box_with_up = Double.valueOf(with_up); // 木箱宽度上限 + Double box_high_up = Double.valueOf(high_up); // 木箱高度上限 if (!(box_length_down <= box_length && box_length <= box_length_up)) { - throw new BadRequestException("无法入立体,木箱长度为:"+box_length); + throw new BadRequestException("无法入立体库,木箱超长;当前木箱长度为:"+box_length); + } + + if (!(box_width <= box_with_up)) { + throw new BadRequestException("无法入立体库,木箱超宽;当前木箱宽度为:"+box_width); + } + + if (!(box_high <= box_high_up)) { + throw new BadRequestException("无法入立体库,木箱超高;当前木箱高度为:"+box_high); } JSONObject point_jo = WQLObject.getWQLObject("sch_base_point").query("point_code = '" + point_code + "'").uniqueResult(0); From 83af221f02e3cd8c69aad65d3e28edc9f36fb4ce Mon Sep 17 00:00:00 2001 From: gengby <858962040@qq.com> Date: Thu, 16 Mar 2023 13:58:27 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ItemProtocol.java | 6 + ...CoveyorControlWithScannerDeviceDriver.java | 117 +++++++++++++++--- 2 files changed, 107 insertions(+), 16 deletions(-) diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_scanner/ItemProtocol.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_scanner/ItemProtocol.java index f8b5abf12..03f6bb83d 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_scanner/ItemProtocol.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_scanner/ItemProtocol.java @@ -29,6 +29,8 @@ public class ItemProtocol { public static String item_barcode_length = "barcode_length"; //条码 public static String item_barcode = "barcode"; + //重量 + public static String item_weight = "weight"; //下发命令 @@ -66,6 +68,9 @@ public class ItemProtocol { public int getMove() { return this.getOpcIntegerValue(item_move); } + public int getWeight() { + return this.getOpcIntegerValue(item_weight); + } public int getCarrier_direction() { return this.getOpcIntegerValue(item_carrier_direction); @@ -126,6 +131,7 @@ public class ItemProtocol { list.add(new ItemDto(item_task, "任务号", "DB101.D260")); list.add(new ItemDto(item_barcode_length, "条码长度", "DB101.B800")); list.add(new ItemDto(item_barcode, "条码", "DB101.STRING802.50")); + list.add(new ItemDto(item_weight, "重量", "DB101.D702")); return list; } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_scanner/StandardCoveyorControlWithScannerDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_scanner/StandardCoveyorControlWithScannerDeviceDriver.java index b16ab8bd5..2d3b52bed 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_scanner/StandardCoveyorControlWithScannerDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_scanner/StandardCoveyorControlWithScannerDeviceDriver.java @@ -18,6 +18,8 @@ import org.nl.acs.device_driver.RouteableDeviceDriver; import org.nl.acs.device_driver.ScannerDeviceDriver; import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; +import org.nl.acs.ext.wms.data.ApplyLabelingAndBindingRequest; +import org.nl.acs.ext.wms.data.ApplyLabelingAndBindingResponse; import org.nl.acs.ext.wms.service.AcsToWmsService; import org.nl.acs.instruction.service.InstructionService; import org.nl.acs.instruction.service.dto.Instruction; @@ -72,6 +74,7 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe protected String barcode = null; protected String formatcode = null; + private Date require_apply_labeling_time = new Date(); private Date instruction_require_time = new Date(); private Date instruction_finished_time = new Date(); private Date instruction_apply_time = new Date(); @@ -84,6 +87,7 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe int action = 0; int error = 0; int task = 0; + int weight = 0; int to_task = 0; String plcbarcode = null; String last_plcbarcode = null; @@ -101,6 +105,7 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe int last_move = 0; int last_error = 0; int last_task = 0; + int last_weight = 0; String last_container; String inst_message; String device_code; @@ -195,6 +200,7 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe plcbarcode = this.itemProtocol.getplcBarCode(); plcbarcode_length = this.itemProtocol.getBarCode_length(); to_task = this.itemProtocol.getTotTask(); + weight = this.itemProtocol.getWeight(); if (mode != last_mode) { logServer.deviceExecuteLog(this.device_code, "", "", "信号mode:" + last_mode + "->" + mode +"复位请求标记"); if(mode == 2){ @@ -225,6 +231,9 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe if (task != last_task) { logServer.deviceExecuteLog(this.device_code, "", "", "信号task:" + last_task+ "->" + task); } + if (weight != last_weight) { + logServer.deviceExecuteLog(this.device_code, "", "", "信号weight:" + last_weight+ "->" + weight); + } if (mode == 2 && move != 0 && task > 0) { //inst_message inst = instructionService.findByCodeFromCache(String.valueOf(task)); @@ -287,6 +296,25 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe if (move > 0 && !StrUtil.isEmpty(newBarcode) && !applySucess) { instruction_apply(newBarcode.trim()); } + break; + case 5: + String newBarcodes = null; + //申请任务 + if(!StrUtil.isEmpty(barcode())){ + newBarcodes = barcode(); + } else { + // + if(plcbarcode_length>2){ + newBarcodes = plcbarcode; + } else { + break; + } + } + // 申请贴标 + if (move > 0 && !StrUtil.isEmpty(newBarcodes) && !requireSucess) { + applyLabeling(newBarcodes); + } + break; } switch (flag) { //取货完成 @@ -306,6 +334,7 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe last_task = task; last_plcbarcode_length = plcbarcode_length; last_plcbarcode = plcbarcode; + last_weight = weight; } public boolean exe_error() { @@ -337,22 +366,6 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe map3.put("code","to_command"); map3.put("value","0"); list.add(map3); - Map map4 = new HashMap(); - map4.put("code","to_strap_times"); - map4.put("value","0"); - list.add(map4); - Map map5 = new HashMap(); - map5.put("code","to_length"); - map5.put("value","0"); - list.add(map5); - Map map6 = new HashMap(); - map6.put("code","to_weight"); - map6.put("value","0"); - list.add(map6); - Map map7 = new HashMap(); - map7.put("code","to_height"); - map7.put("value","0"); - list.add(map7); this.writing(list); message = null; } @@ -798,6 +811,78 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe } + // 申请贴标 + public synchronized void applyLabeling(String newBarcodes) { + Date date = new Date(); + if (date.getTime() - this.require_apply_labeling_time.getTime() + < (long) this.instruction_require_time_out) { + log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); + return; + } else { + this.require_apply_labeling_time = date; +// String vehicle_code = ""; + if (weight == 0) { + logServer.deviceExecuteLog(device_code, "", "", "申请贴标电气设备重量:" + weight + "异常"); + message = "申请贴标电气设备重量:" + weight + "异常"; + throw new RuntimeException("重量为空!"); + } +// if (task > 0) { +// Instruction instruction = instructionService.findByCodeFromCache(String.valueOf(task)); +// if (ObjectUtil.isEmpty(instruction)) { +// instruction = instructionService.findByCode(String.valueOf(task)); +// } +// vehicle_code = instruction.getVehicle_code(); +// } else { +// logServer.deviceExecuteLog(device_code, "", "", "申请贴标电气设备任务号:" + task + "异常"); +// message = "申请贴标电气设备任务号:" + task + "异常"; +// throw new RuntimeException("任务号为空!"); +// } + if (StrUtil.isEmpty(newBarcodes)) { + logServer.deviceExecuteLog(device_code, "", "", "申请贴标电气设备载具号为空!"); + message = "申请贴标电气设备载具号为空"; + throw new RuntimeException("载具号为空!"); + } + ApplyLabelingAndBindingRequest applyLabelingAndBindingRequest = + new ApplyLabelingAndBindingRequest(); + JSONObject device_json = + WQLObject.getWQLObject("acs_storage_cell") + .query("storage_code ='" + this.device_code + "'") + .uniqueResult(0); + String start_point_code = null; + if (!ObjectUtil.isEmpty(device_json)) { + start_point_code = + (String) device_json.get("parent_storage_code") == null + ? this.device_code + : (String) device_json.get("parent_storage_code"); + } + applyLabelingAndBindingRequest.setDevice_code(start_point_code); + applyLabelingAndBindingRequest.setType("1"); + applyLabelingAndBindingRequest.setVehicle_code(newBarcodes); + applyLabelingAndBindingRequest.setWeight(String.valueOf((float) weight / 100)); + ApplyLabelingAndBindingResponse applyLabelingAndBindingResponse = + acsToWmsService.applyLabelingAndBindingRequest(applyLabelingAndBindingRequest); + logServer.deviceExecuteLog(this.device_code, "", "", "申请贴标,请求参数:"+JSON.toJSONString(applyLabelingAndBindingRequest)); + + if (applyLabelingAndBindingResponse.getstatus() == 200) { + message = "申请贴标成功"; + List list = new ArrayList(); + Map map = new HashMap(); + map.put("code", "to_command"); + map.put("value", "5"); + list.add(map); + this.writing(list); + this.writing(list); + message = "申请贴标下发电气信号成功"; + logServer.deviceExecuteLog(this.device_code, "", "", "申请贴标,返回参数:"+JSON.toJSONString(applyLabelingAndBindingResponse)); + requireSucess = true; + } else { + message = "申请贴标失败," + applyLabelingAndBindingResponse.getMessage(); + logServer.deviceExecuteLog(this.device_code, "", "", "申请贴标,返回参数:"+JSON.toJSONString(applyLabelingAndBindingResponse)); + + } + } + } + public void writing(List list) { Map itemMap = new HashMap(); for (int i = 0; i < list.size(); i++) { From 24a29cff46f67065cda80a5c20f9e93dc85be880 Mon Sep 17 00:00:00 2001 From: liuxy Date: Thu, 16 Mar 2023 17:46:00 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lms/nladmin-ui/src/views/wms/st/outbill/ViewDialog.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/lms/nladmin-ui/src/views/wms/st/outbill/ViewDialog.vue b/lms/nladmin-ui/src/views/wms/st/outbill/ViewDialog.vue index 6f76fafca..511b574fe 100644 --- a/lms/nladmin-ui/src/views/wms/st/outbill/ViewDialog.vue +++ b/lms/nladmin-ui/src/views/wms/st/outbill/ViewDialog.vue @@ -147,6 +147,7 @@ + From 5a930958452ccf82d5d8386bd85b52b0f0048c89 Mon Sep 17 00:00:00 2001 From: liyongde <1419499670@qq.com> Date: Thu, 23 Mar 2023 14:05:29 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nl/system/service/role/impl/SysRoleServiceImpl.java | 7 ++++++- lms/nladmin-ui/src/components/Permission/permission.js | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/lms/nladmin-system/src/main/java/org/nl/system/service/role/impl/SysRoleServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/system/service/role/impl/SysRoleServiceImpl.java index 08fe0a75a..c2faae344 100644 --- a/lms/nladmin-system/src/main/java/org/nl/system/service/role/impl/SysRoleServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/system/service/role/impl/SysRoleServiceImpl.java @@ -19,6 +19,8 @@ import org.nl.system.service.menu.dao.mapper.SysMenuMapper; import org.nl.system.service.role.ISysRoleService; import org.nl.system.service.role.dao.SysRole; import org.nl.system.service.role.dao.mapper.SysRoleMapper; +import org.nl.system.service.user.dao.SysUser; +import org.nl.system.service.user.dao.mapper.SysUserMapper; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; @@ -39,6 +41,7 @@ import java.util.*; public class SysRoleServiceImpl extends ServiceImpl implements ISysRoleService { private final SysRoleMapper roleMapper; + private final SysUserMapper userMapper; private final SysMenuMapper sysMenuMapper; @@ -130,7 +133,9 @@ public class SysRoleServiceImpl extends ServiceImpl impl public List getPermissionList(JSONObject userDto) { List permission = new LinkedList<>(); // 查看是否为管理员 - permission.add("admin"); + String currentUserId = SecurityUtils.getCurrentUserId(); + SysUser sysUser = userMapper.selectOne(new LambdaQueryWrapper().eq(SysUser::getUserId, currentUserId)); + if ( ObjectUtil.isNotEmpty(sysUser.getIsAdmin()) && sysUser.getIsAdmin()) permission.add("admin"); permission.addAll(sysMenuMapper.getPermissionByUserId(userDto.getString("userId"))); return permission; } diff --git a/lms/nladmin-ui/src/components/Permission/permission.js b/lms/nladmin-ui/src/components/Permission/permission.js index ce66d1150..0cc1f8714 100644 --- a/lms/nladmin-ui/src/components/Permission/permission.js +++ b/lms/nladmin-ui/src/components/Permission/permission.js @@ -1,7 +1,7 @@ import store from '@/store' export default { - inserted(el, binding, vnode) { + inserted(el, binding) { const { value } = binding const roles = store.getters && store.getters.roles if (value && value instanceof Array && value.length > 0) { @@ -15,7 +15,7 @@ export default { el.parentNode && el.parentNode.removeChild(el) } } else { - // throw new Error(`使用方式: v-permission="['admin','editor']"`) + throw new Error(`使用方式: v-permission="['admin','editor']"`) } } } From 74445eaf7db2d799920aa091ee2d884336c720bd Mon Sep 17 00:00:00 2001 From: gengby <858962040@qq.com> Date: Thu, 23 Mar 2023 15:03:58 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...CoveyorControlWithScannerDeviceDriver.java | 180 +++++++++--------- 1 file changed, 92 insertions(+), 88 deletions(-) diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_scanner/StandardCoveyorControlWithScannerDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_scanner/StandardCoveyorControlWithScannerDeviceDriver.java index 2d3b52bed..4830d09ce 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_scanner/StandardCoveyorControlWithScannerDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_scanner/StandardCoveyorControlWithScannerDeviceDriver.java @@ -148,7 +148,8 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe scanner.cleanBarcode(); logServer.deviceExecuteLog(this.device_code, "", "", "清理条码"); } - public synchronized boolean finish_instruction(){ + + public synchronized boolean finish_instruction() { try { instructionService.finish(inst); } catch (Exception e) { @@ -189,7 +190,7 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe @Override - public void execute(){ + public void execute() { try { device_code = this.getDeviceCode(); heartbeat = this.itemProtocol.getHeartbeat(); @@ -197,13 +198,13 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe move = this.itemProtocol.getMove(); error = this.itemProtocol.getError(); task = this.itemProtocol.getTask(); - plcbarcode = this.itemProtocol.getplcBarCode(); - plcbarcode_length = this.itemProtocol.getBarCode_length(); + plcbarcode = this.itemProtocol.getplcBarCode(); + plcbarcode_length = this.itemProtocol.getBarCode_length(); to_task = this.itemProtocol.getTotTask(); weight = this.itemProtocol.getWeight(); if (mode != last_mode) { - logServer.deviceExecuteLog(this.device_code, "", "", "信号mode:" + last_mode + "->" + mode +"复位请求标记"); - if(mode == 2){ + logServer.deviceExecuteLog(this.device_code, "", "", "信号mode:" + last_mode + "->" + mode + "复位请求标记"); + if (mode == 2) { this.setRequireSucess(false); this.setApplySucess(false); message = null; @@ -224,15 +225,15 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe if (plcbarcode_length != last_plcbarcode_length) { logServer.deviceExecuteLog(this.device_code, "", "", "信号plcbarcode_length:" + last_plcbarcode_length + "->" + plcbarcode_length); } - if (!StrUtil.equals(plcbarcode,last_plcbarcode) ) { + if (!StrUtil.equals(plcbarcode, last_plcbarcode)) { logServer.deviceExecuteLog(this.device_code, "", "", "信号plcbarcode:" + last_plcbarcode + "->" + plcbarcode); } if (task != last_task) { - logServer.deviceExecuteLog(this.device_code, "", "", "信号task:" + last_task+ "->" + task); + logServer.deviceExecuteLog(this.device_code, "", "", "信号task:" + last_task + "->" + task); } if (weight != last_weight) { - logServer.deviceExecuteLog(this.device_code, "", "", "信号weight:" + last_weight+ "->" + weight); + logServer.deviceExecuteLog(this.device_code, "", "", "信号weight:" + last_weight + "->" + weight); } if (mode == 2 && move != 0 && task > 0) { //inst_message @@ -266,7 +267,7 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe } else { this.setIsonline(true); this.setIserror(false); - if(error>0){ + if (error > 0) { this.setIserror(true); } Instruction instruction = null; @@ -279,11 +280,11 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe //申请任务 String newBarcode = null; - if(!StrUtil.isEmpty(barcode())){ + if (!StrUtil.isEmpty(barcode())) { newBarcode = barcode(); } else { // - if(plcbarcode_length>2){ + if (plcbarcode_length > 2) { newBarcode = plcbarcode; } else { break; @@ -300,11 +301,11 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe case 5: String newBarcodes = null; //申请任务 - if(!StrUtil.isEmpty(barcode())){ + if (!StrUtil.isEmpty(barcode())) { newBarcodes = barcode(); } else { // - if(plcbarcode_length>2){ + if (plcbarcode_length > 2) { newBarcodes = plcbarcode; } else { break; @@ -355,16 +356,16 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe this.set_last_container(container); List list = new ArrayList(); Map map = new HashMap(); - map.put("code","to_target"); - map.put("value","0"); + map.put("code", "to_target"); + map.put("value", "0"); list.add(map); Map map2 = new HashMap(); - map2.put("code","to_task"); - map2.put("value","0"); + map2.put("code", "to_task"); + map2.put("value", "0"); list.add(map2); Map map3 = new HashMap(); - map3.put("code","to_command"); - map3.put("value","0"); + map3.put("code", "to_command"); + map3.put("value", "0"); list.add(map3); this.writing(list); message = null; @@ -439,7 +440,7 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe return instruction_require(container_code, WcsConfig.task_container_type_default_desc); } - public synchronized boolean instruction_apply(String container_code) { + public synchronized boolean instruction_apply(String container_code) { Date date = new Date(); if (date.getTime() - this.instruction_apply_time.getTime() < (long) this.instruction_require_time_out) { log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); @@ -448,44 +449,45 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe this.instruction_apply_time = date; //container_code TaskDto task = taskserver.findByContainer(container_code); + logServer.deviceExecuteLog(device_code, "", "", "申请任务时,根据托盘号:" + container_code + ",查询出来得任务信息是:" + JSON.toJSONString(task)); if (!ObjectUtil.isEmpty(task)) { Instruction instdto = instructionService.findByTaskcodeAndStatus(task.getTask_code()); - if(!StrUtil.equals(instdto.getStart_device_code(),this.device_code)){ - message ="当前载具号"+container_code+"查找对应指令起点与当前设备不符"; + if (!StrUtil.equals(instdto.getStart_device_code(), this.device_code)) { + message = "当前载具号" + container_code + "查找对应指令起点与当前设备不符"; // this.setIserror(true); return false; } - if(ObjectUtil.isNotEmpty(instdto)){ + if (ObjectUtil.isNotEmpty(instdto)) { List list = new ArrayList(); Map map = new HashMap(); - if(StrUtil.isNotEmpty(task.getTo_z())){ - if(StrUtil.equals(task.getTo_z(),"01")){ - map.put("code","to_target"); - map.put("value","102"); - } else if(StrUtil.equals(task.getTo_z(),"02")){ - map.put("code","to_target"); - map.put("value","201"); - } else if(StrUtil.equals(task.getTo_z(),"03")){ - map.put("code","to_target"); - map.put("value","301"); + if (StrUtil.isNotEmpty(task.getTo_z())) { + if (StrUtil.equals(task.getTo_z(), "01")) { + map.put("code", "to_target"); + map.put("value", "102"); + } else if (StrUtil.equals(task.getTo_z(), "02")) { + map.put("code", "to_target"); + map.put("value", "201"); + } else if (StrUtil.equals(task.getTo_z(), "03")) { + map.put("code", "to_target"); + map.put("value", "301"); } } list.add(map); Map map2 = new HashMap(); - map2.put("code","to_task"); - map2.put("value",instdto.getInstruction_code()); + map2.put("code", "to_task"); + map2.put("value", instdto.getInstruction_code()); list.add(map2); Map map3 = new HashMap(); - map3.put("code","to_command"); - map3.put("value","1"); + map3.put("code", "to_command"); + map3.put("value", "1"); list.add(map3); this.writing(list); message = "下发电气任务号成功"; requireSucess = true; applySucess = true; } else { - message = "任务号:"+ task.getTask_code()+"未找到指令"; + message = "任务号:" + task.getTask_code() + "未找到指令"; } } else { @@ -498,6 +500,7 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe /** * 请求指令 * 定点任务时请求这里 + * * @param container_code * @param container_type */ @@ -510,15 +513,16 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe this.instruction_require_time = date; //container_code TaskDto taskdto = taskserver.findByContainer(container_code); + logServer.deviceExecuteLog(device_code, "", "", "申请任务时,根据托盘号:" + container_code + ",查询出来得任务信息是:" + JSON.toJSONString(taskdto)); if (!ObjectUtil.isEmpty(taskdto)) { if (!ObjectUtils.isEmpty(instructionService.findByTaskcodeAndStatus(taskdto.getTask_code()))) { - logServer.deviceExecuteLog(this.device_code, "", "", "申请任务时该载具号"+container_code - +"已存在对应任务,不再请求"); - Instruction instdto = instructionService.findByTaskcodeAndStatus(taskdto.getTask_code()); - if(!StrUtil.equals(instdto.getStart_device_code(),this.device_code)){ - message ="当前载具号"+container_code+"查找对应指令起点与当前设备不符"; + logServer.deviceExecuteLog(this.device_code, "", "", "申请任务时该载具号" + container_code + + "已存在对应任务,不再请求"); + Instruction instdto = instructionService.findByTaskcodeAndStatus(taskdto.getTask_code()); + if (!StrUtil.equals(instdto.getStart_device_code(), this.device_code)) { + message = "当前载具号" + container_code + "查找对应指令起点与当前设备不符"; logServer.deviceExecuteLog(this.device_code, "", "", "申请任务" - +"当前载具号"+container_code+"查找对应指令起点与当前设备不符"); + + "当前载具号" + container_code + "查找对应指令起点与当前设备不符"); return false; } this.setIserror(false); @@ -549,8 +553,8 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe list.add(map3); this.writing(list); message = "下发电气任务号成功"; - logServer.deviceExecuteLog(this.device_code, "", "", "申请任务时该载具号"+container_code - +"已存在对应任务,下发电气信号"); + logServer.deviceExecuteLog(this.device_code, "", "", "申请任务时该载具号" + container_code + + "已存在对应任务,下发电气信号"); requireSucess = true; applySucess = true; } else { @@ -559,10 +563,10 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe return true; } else { //需要判断指令中的指令 再次请求不能生成 - if (!ObjectUtils.isEmpty(instructionService.findByTaskcodeAndStatus(taskdto.getTask_code(),"1"))) { + if (!ObjectUtils.isEmpty(instructionService.findByTaskcodeAndStatus(taskdto.getTask_code(), "1"))) { { - Instruction instdto = instructionService.findByTaskcodeAndStatus(taskdto.getTask_code(),"1"); - if(to_task != Integer.parseInt(instdto.getInstruction_code())){ + Instruction instdto = instructionService.findByTaskcodeAndStatus(taskdto.getTask_code(), "1"); + if (to_task != Integer.parseInt(instdto.getInstruction_code())) { List list = new ArrayList(); Map map = new HashMap(); if (StrUtil.isNotEmpty(taskdto.getTo_z())) { @@ -653,8 +657,8 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe next_point_code = next_device_code; } - if(!StrUtil.equals(taskdto.getStart_device_code(),this.device_code)){ - message ="当前载具号"+container_code+"查找对应指令起点与当前设备不符"; + if (!StrUtil.equals(taskdto.getStart_device_code(), this.device_code)) { + message = "当前载具号" + container_code + "查找对应指令起点与当前设备不符"; // List list = new ArrayList(); // Map map = new HashMap(); // map.put("code","to_target"); @@ -695,8 +699,8 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe instructionService.create(instdto); } catch (Exception e) { e.printStackTrace(); - log.error("指令创建失败!",e.getMessage()); - return false; + log.error("指令创建失败!", e.getMessage()); + return false; } //创建指令后修改任务状态 taskdto.setTask_status("1"); @@ -706,26 +710,26 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe List list = new ArrayList(); Map map = new HashMap(); - if(StrUtil.isNotEmpty(taskdto.getTo_z())){ - if(StrUtil.equals(taskdto.getTo_z(),"01")){ - map.put("code","to_target"); - map.put("value","102"); - } else if(StrUtil.equals(taskdto.getTo_z(),"02")){ - map.put("code","to_target"); - map.put("value","201"); - } else if(StrUtil.equals(taskdto.getTo_z(),"03")){ - map.put("code","to_target"); - map.put("value","301"); + if (StrUtil.isNotEmpty(taskdto.getTo_z())) { + if (StrUtil.equals(taskdto.getTo_z(), "01")) { + map.put("code", "to_target"); + map.put("value", "102"); + } else if (StrUtil.equals(taskdto.getTo_z(), "02")) { + map.put("code", "to_target"); + map.put("value", "201"); + } else if (StrUtil.equals(taskdto.getTo_z(), "03")) { + map.put("code", "to_target"); + map.put("value", "301"); } } list.add(map); Map map2 = new HashMap(); - map2.put("code","to_task"); - map2.put("value",instdto.getInstruction_code()); + map2.put("code", "to_task"); + map2.put("value", instdto.getInstruction_code()); list.add(map2); Map map3 = new HashMap(); - map3.put("code","to_command"); - map3.put("value","1"); + map3.put("code", "to_command"); + map3.put("value", "1"); list.add(map3); this.writing(list); // if(task != Integer.parseInt(instdto.getInstruction_code()) ){ @@ -740,24 +744,24 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe JSONObject apply = new JSONObject(); apply.put("vehicle_code", container_code); apply.put("device_code", device_code); - apply.put("type","1"); - logServer.deviceExecuteLog(this.device_code, "", "", "申请入库,请求参数:"+apply.toString()); + apply.put("type", "1"); + logServer.deviceExecuteLog(this.device_code, "", "", "申请入库,请求参数:" + apply.toString()); String str = acsToWmsService.applyTaskToWms(apply); JSONObject jo = JSON.parseObject(str); - logServer.deviceExecuteLog(this.device_code, "", "", "申请入库,返回参数:"+jo.toString()); + logServer.deviceExecuteLog(this.device_code, "", "", "申请入库,返回参数:" + jo.toString()); if (ObjectUtil.isEmpty(jo)) { message = "接口不通"; List list = new ArrayList(); Map map = new HashMap(); - map.put("code","to_target"); - map.put("value","1011"); + map.put("code", "to_target"); + map.put("value", "1011"); list.add(map); Map map2 = new HashMap(); - map2.put("code","to_command"); - map2.put("value","1"); + map2.put("code", "to_command"); + map2.put("value", "1"); Map map3 = new HashMap(); - map3.put("code","to_task"); - map3.put("value","0"); + map3.put("code", "to_task"); + map3.put("value", "0"); list.add(map3); this.writing(list); requireSucess = true; @@ -769,25 +773,25 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe requireSucess = true; applySucess = false; } else { - if (jo.get("message")!=null){ + if (jo.get("message") != null) { message = jo.get("message").toString(); } List list = new ArrayList(); Map map = new HashMap(); - map.put("code","to_target"); - map.put("value","1011"); + map.put("code", "to_target"); + map.put("value", "1011"); list.add(map); Map map2 = new HashMap(); - map2.put("code","to_command"); - map2.put("value","1"); + map2.put("code", "to_command"); + map2.put("value", "1"); list.add(map2); Map map3 = new HashMap(); - map3.put("code","to_task"); - map3.put("value","0"); + map3.put("code", "to_task"); + map3.put("value", "0"); list.add(map3); this.writing(list); - message = "申请任务失败下发退回,"+message; + message = "申请任务失败下发退回," + message; requireSucess = true; } @@ -861,7 +865,7 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe applyLabelingAndBindingRequest.setWeight(String.valueOf((float) weight / 100)); ApplyLabelingAndBindingResponse applyLabelingAndBindingResponse = acsToWmsService.applyLabelingAndBindingRequest(applyLabelingAndBindingRequest); - logServer.deviceExecuteLog(this.device_code, "", "", "申请贴标,请求参数:"+JSON.toJSONString(applyLabelingAndBindingRequest)); + logServer.deviceExecuteLog(this.device_code, "", "", "申请贴标,请求参数:" + JSON.toJSONString(applyLabelingAndBindingRequest)); if (applyLabelingAndBindingResponse.getstatus() == 200) { message = "申请贴标成功"; @@ -873,11 +877,11 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe this.writing(list); this.writing(list); message = "申请贴标下发电气信号成功"; - logServer.deviceExecuteLog(this.device_code, "", "", "申请贴标,返回参数:"+JSON.toJSONString(applyLabelingAndBindingResponse)); + logServer.deviceExecuteLog(this.device_code, "", "", "申请贴标,返回参数:" + JSON.toJSONString(applyLabelingAndBindingResponse)); requireSucess = true; } else { message = "申请贴标失败," + applyLabelingAndBindingResponse.getMessage(); - logServer.deviceExecuteLog(this.device_code, "", "", "申请贴标,返回参数:"+JSON.toJSONString(applyLabelingAndBindingResponse)); + logServer.deviceExecuteLog(this.device_code, "", "", "申请贴标,返回参数:" + JSON.toJSONString(applyLabelingAndBindingResponse)); } }