diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/scanner_weight_conveyor/ConveyorWithScannerWeightDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/scanner_weight_conveyor/ConveyorWithScannerWeightDeviceDriver.java index d3987abac..cac9dadcd 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/scanner_weight_conveyor/ConveyorWithScannerWeightDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/scanner_weight_conveyor/ConveyorWithScannerWeightDeviceDriver.java @@ -301,6 +301,12 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv } + //申请退货入库 + if (mode == 18 && move == 1 && !requireSucess){ + applyBoxReturnTask(StorageTypeEnum.BOX_RETURN.getType(), mode); + + } + //申请入库指令、异常位指令 if (mode == 2 && move == 1 && !requireSucess) { boolean res = instruction_require(); @@ -349,6 +355,55 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv last_barcode = barcode; } + private void applyBoxReturnTask(String type, int mode) { + Date date = new Date(); + if (date.getTime() - this.require_apply_strangulation_time.getTime() + < (long) this.instruction_require_time_out) { + log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); + return; + } else { + try { + JSONObject param = new JSONObject(); + param.put("device_code", device_code); + param.put("vehicle_code", barcode); + param.put("material_barcode", material_barcode); + param.put("type", type); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("申请退货入库,参数:" + param) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); + String response = acsToWmsService.applyTwo(param); + JSONObject jo = JSON.parseObject(response); + if (jo.getInteger("status") == 200) { + LuceneLogDto logDto2 = LuceneLogDto.builder() + .device_code(device_code) + .content("申请退货入库,参数,接口返回:" + jo) + .build(); + logDto2.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto2); + List list1 = new ArrayList(); + Map map = new HashMap(); + map.put("code", "to_command"); + map.put("value", mode); + list1.add(map); + this.writing(list1); + this.requireSucess = true; + }else { + LuceneLogDto logDto2 = LuceneLogDto.builder() + .device_code(device_code) + .content("申请退货入库,返回参数:" + jo.getString("body")) + .build(); + logDto2.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto2); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + } + private void applyErrorTask() { Date date = new Date(); if (date.getTime() - this.require_apply_strangulation_time.getTime() diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/enums/StorageTypeEnum.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/enums/StorageTypeEnum.java index dcb1cf2dc..0dd843f64 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/enums/StorageTypeEnum.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/enums/StorageTypeEnum.java @@ -16,7 +16,9 @@ public enum StorageTypeEnum { ERROR("4", "异常处理位"), - BOX_IN("5", "木箱入库"); + BOX_IN("5", "木箱入库"), + + BOX_RETURN("6", "退货入库"); /** * 索引 */