From 824400397ba57b887901c103ad21631ed19d3f06 Mon Sep 17 00:00:00 2001 From: gengby <858962040@qq.com> Date: Sun, 19 Jul 2026 10:29:03 +0800 Subject: [PATCH] =?UTF-8?q?rev:=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/org/nl/AppRun.java | 5 +- .../auto/run/BMSSocketConnectionAutoRun.java | 129 +++++- .../auto/run/NDCSocketConnectionAutoRun.java | 371 +++--------------- .../agv/ndctwo/AgvNdcTwoDeviceDriver.java | 11 + .../acs/ext/wms/rest/WmsToAcsController.java | 1 + .../service/impl/PdaIosOutServiceImpl.java | 24 +- .../sch_manage/service/util/AbstractTask.java | 27 ++ .../service/util/tasks/jb/JbDownAgvTask.java | 4 +- .../tasks/jb/JbDownCloseUnsealingAgvTask.java | 2 +- .../util/tasks/zw/SeparateMaterialTask.java | 2 +- .../system_manage/enums/SysParamConstant.java | 5 + .../wms/warehouse_manage/enums/IOSEnum.java | 2 +- .../controller/OutBillController.java | 7 + .../inAndOut/service/IOutBillService.java | 7 + .../inAndOut/service/dao/IOStorInv.java | 17 +- .../service/impl/OutBillServiceImpl.java | 124 ++++-- ...625_pdm_bd_workorder_add_audit_columns.sql | 4 + ...630_st_ivt_iostorinv_add_audit_columns.sql | 4 + .../src/views/wms/st/outbill/DivDialog.vue | 10 +- .../src/views/wms/st/outbill/checkoutbill.js | 9 +- .../src/views/wms/st/outbill/index.vue | 36 +- 21 files changed, 414 insertions(+), 387 deletions(-) create mode 100644 lms/nladmin-system/nlsso-server/src/main/resources/_sql/20260625_pdm_bd_workorder_add_audit_columns.sql create mode 100644 lms/nladmin-system/nlsso-server/src/main/resources/_sql/20260630_st_ivt_iostorinv_add_audit_columns.sql diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/AppRun.java b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/AppRun.java index 5f70a10..6f875a3 100644 --- a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/AppRun.java +++ b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/AppRun.java @@ -76,14 +76,14 @@ public class AppRun { @GetMapping("/kaishichongdian/{no}") @SaIgnore public String kaishichongdian(@PathVariable Integer no) { - BMSSocketConnectionAutoRun.writeStartCharge(no); + BMSSocketConnectionAutoRun.writeStartChargeAndArmExtend(no); return "Backend service started successfully"; } @GetMapping("/tingzhichongdian/{no}") @SaIgnore public String tingzhichongdian(@PathVariable Integer no) { - BMSSocketConnectionAutoRun.writeStopCharge(no); + BMSSocketConnectionAutoRun.writeStopChargeAndArmRetract(no); return "Backend service started successfully"; } @@ -115,4 +115,3 @@ public class AppRun { return String.valueOf(armExtended); } } - diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/auto/run/BMSSocketConnectionAutoRun.java b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/auto/run/BMSSocketConnectionAutoRun.java index 9f1f998..c4a8e8d 100644 --- a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/auto/run/BMSSocketConnectionAutoRun.java +++ b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/auto/run/BMSSocketConnectionAutoRun.java @@ -26,6 +26,7 @@ import org.nl.system.service.param.dao.Param; import org.nl.system.service.param.impl.SysParamServiceImpl; import org.springframework.stereotype.Component; +import java.net.InetSocketAddress; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -35,7 +36,6 @@ import java.util.Objects; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; -import java.util.zip.CRC32; @Slf4j @Component @@ -71,8 +71,10 @@ public class BMSSocketConnectionAutoRun extends AbstractAutoRunnable { private static final long RECONNECT_DELAY_MS = 3000L; private static final long CONFIG_REFRESH_MS = 5000L; private static final long STATUS_EXPIRE_MS = 3000L; + private static final long COMMAND_RESPONSE_WINDOW_MS = 5000L; private static final int CIRCUIT_FAILURE_THRESHOLD = 5; private static final long CIRCUIT_OPEN_MS = 30000L; + private static final int LOCAL_PORT_BASE = 10000; private static final Map CLIENTS = new ConcurrentHashMap<>(); private static final AtomicBoolean stopRequested = new AtomicBoolean(false); @@ -137,10 +139,18 @@ public class BMSSocketConnectionAutoRun extends AbstractAutoRunnable { write(buildFixedFrame(CHARGE_CMD_START, ARM_CMD_NONE, stationNo), stationNo); } + public static void writeStartChargeAndArmExtend(int stationNo) { + write(buildFixedFrame(CHARGE_CMD_START, ARM_CMD_EXTEND, stationNo), stationNo); + } + public static void writeStopCharge(int stationNo) { write(buildFixedFrame(CHARGE_CMD_STOP, ARM_CMD_NONE, stationNo), stationNo); } + public static void writeStopChargeAndArmRetract(int stationNo) { + write(buildFixedFrame(CHARGE_CMD_STOP, ARM_CMD_RETRACT, stationNo), stationNo); + } + public static void writeChargeComplete(int stationNo) { writeStopCharge(stationNo); } @@ -189,6 +199,41 @@ public class BMSSocketConnectionAutoRun extends AbstractAutoRunnable { return waitUntil(stationNo, timeoutMs, WaitTarget.CHARGE_STOPPED); } + private static String armStateToText(int armState) { + switch (armState) { + case ARM_STATE_RETRACTED: + return "退回到位"; + case ARM_STATE_EXTENDED: + return "伸出到位"; + case ARM_STATE_UNKNOWN: + default: + return "未知"; + } + } + + private static String chargerStateToText(int chargerState) { + switch (chargerState) { + case CHARGER_STATE_CHARGING: + return "充电中"; + case CHARGER_STATE_STOPPED: + return "停止充电/充满"; + case CHARGER_STATE_INVALID: + default: + return "未知"; + } + } + + private static String describeWord7(int word7) { + switch (word7) { + case 0x0000: + return "无附加状态"; + case 0x0006: + return "保留位返回0x0006"; + default: + return "保留位状态未知"; + } + } + public static byte[] buildFixedFrame(int chargeCmd, int armCmd, int stationNo) { if (stationNo < 0 || stationNo > 0xFFFF) { throw new IllegalArgumentException("stationNo must be in [0, 65535]"); @@ -203,7 +248,7 @@ public class BMSSocketConnectionAutoRun extends AbstractAutoRunnable { offset += 2; writeUInt16BE(frame, offset, stationNo); offset += 2; - writeUInt32BE(frame, offset, calculateCrc32(frame, FRAME_HEAD.length, 6)); + writeUInt32BE(frame, offset, 0L); offset += 4; System.arraycopy(FRAME_TAIL, 0, frame, offset, FRAME_TAIL.length); @@ -307,6 +352,10 @@ public class BMSSocketConnectionAutoRun extends AbstractAutoRunnable { log.warn("BMS站点配置无效,stationNo异常: {}", item); continue; } + if (LOCAL_PORT_BASE + stationNo > 65535) { + log.warn("BMS站点{}配置无效,本地端口{}超出范围", stationNo, LOCAL_PORT_BASE + stationNo); + continue; + } if (StrUtil.isBlank(ip)) { log.warn("BMS站点{}配置无效,ip为空", stationNo); continue; @@ -385,10 +434,12 @@ public class BMSSocketConnectionAutoRun extends AbstractAutoRunnable { | (long) (source[offset + 3] & 0xFF); } - private static long calculateCrc32(byte[] source, int offset, int len) { - CRC32 crc32 = new CRC32(); - crc32.update(source, offset, len); - return crc32.getValue(); + private static long calculateWordChecksum(byte[] source, int offset, int wordCount) { + long checksum = 0L; + for (int i = 0; i < wordCount; i++) { + checksum += readUInt16BE(source, offset + i * 2); + } + return checksum & 0xFFFFFFFFL; } private static boolean validateChecksum(byte[] frame) { @@ -397,12 +448,12 @@ public class BMSSocketConnectionAutoRun extends AbstractAutoRunnable { } if (frame.length == FRAME_LEN) { long expected = readUInt32BE(frame, FRAME_HEAD.length + 6); - long actual = calculateCrc32(frame, FRAME_HEAD.length, 6); + long actual = calculateWordChecksum(frame, FRAME_HEAD.length, 3); return expected == actual; } if (frame.length == REPORT_FRAME_LEN) { long expected = readUInt32BE(frame, FRAME_HEAD.length + 14); - long actual = calculateCrc32(frame, FRAME_HEAD.length, 14); + long actual = calculateWordChecksum(frame, FRAME_HEAD.length, 7); return expected == actual; } return false; @@ -473,6 +524,8 @@ public class BMSSocketConnectionAutoRun extends AbstractAutoRunnable { private volatile String lastConnectError = ""; private volatile long lastConnectSuccessTimeMs = 0L; private volatile long lastConnectAttemptTimeMs = 0L; + private volatile String pendingCommandHex; + private volatile long pendingCommandTimeMs = 0L; private StationClient(StationConfig config) { this.config = config; @@ -525,6 +578,7 @@ public class BMSSocketConnectionAutoRun extends AbstractAutoRunnable { .channel(NioSocketChannel.class) .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 5000) .option(ChannelOption.SO_KEEPALIVE, true) + .option(ChannelOption.SO_REUSEADDR, true) .option(ChannelOption.TCP_NODELAY, true) .handler(new ChannelInitializer() { @Override @@ -535,7 +589,9 @@ public class BMSSocketConnectionAutoRun extends AbstractAutoRunnable { }); StationConfig currentConfig = this.config; - ChannelFuture future = bootstrap.connect(currentConfig.ip, currentConfig.port); + int localPort = getLocalPort(currentConfig.stationNo); + ChannelFuture future = bootstrap.connect(new InetSocketAddress(currentConfig.ip, currentConfig.port), + new InetSocketAddress(localPort)); future.addListener((ChannelFutureListener) f -> { reconnectScheduled.set(false); if (closed.get() || stopRequested.get()) { @@ -548,7 +604,8 @@ public class BMSSocketConnectionAutoRun extends AbstractAutoRunnable { if (f.isSuccess()) { channel = f.channel(); onConnectSuccess(); - log.info("BMS站点{}连接成功 {}:{}", currentConfig.stationNo, currentConfig.ip, currentConfig.port); + log.info("BMS站点{}连接成功 localPort={}, remote={}:{}", + currentConfig.stationNo, localPort, currentConfig.ip, currentConfig.port); } else { onConnectFailure(f.cause()); } @@ -602,21 +659,31 @@ public class BMSSocketConnectionAutoRun extends AbstractAutoRunnable { ensureConnected(); return; } - log.info("下发BMS站点{}数据(HEX): {}", config.stationNo, bytesToHex(data)); + String commandHex = bytesToHex(data); + log.info("下发BMS站点{}数据(HEX): {}", config.stationNo, commandHex); current.writeAndFlush(current.alloc().buffer(data.length).writeBytes(data)).addListener((ChannelFutureListener) future -> { if (!future.isSuccess()) { - log.error("下发BMS站点{}数据失败: {}", config.stationNo, bytesToHex(data), future.cause()); + log.error("下发BMS站点{}数据失败: {}", config.stationNo, commandHex, future.cause()); Channel failedChannel = future.channel(); if (failedChannel != null && failedChannel.isOpen()) { failedChannel.close(); } + } else { + pendingCommandHex = commandHex; + pendingCommandTimeMs = System.currentTimeMillis(); } }); } private void updateStatus(byte[] frame) { if (!validateChecksum(frame)) { - log.warn("BMS站点{}收到CRC校验失败报文,忽略: {}", config.stationNo, bytesToHex(frame)); + long expected = frame.length == REPORT_FRAME_LEN ? readUInt32BE(frame, FRAME_HEAD.length + 14) : -1L; + long actual = frame.length == REPORT_FRAME_LEN ? calculateWordChecksum(frame, FRAME_HEAD.length, 7) : -1L; + log.warn("BMS站点{}收到校验失败报文,expected=0x{}, actual=0x{}, 忽略: {}", + config.stationNo, + Long.toHexString(expected), + Long.toHexString(actual), + bytesToHex(frame)); return; } int dataOffset = FRAME_HEAD.length; @@ -625,6 +692,9 @@ public class BMSSocketConnectionAutoRun extends AbstractAutoRunnable { int armState = readUInt16BE(frame, dataOffset + 4); int chargerState = readUInt16BE(frame, dataOffset + 6); int reportStationNo = readUInt16BE(frame, dataOffset + 8); + int reservedWord6 = readUInt16BE(frame, dataOffset + 10); + int reservedWord7 = readUInt16BE(frame, dataOffset + 12); + long checksum = readUInt32BE(frame, dataOffset + 14); if (reportStationNo != config.stationNo) { log.warn("BMS站点{}收到站点{}上报,忽略异常报文: {}", config.stationNo, reportStationNo, bytesToHex(frame)); return; @@ -636,12 +706,31 @@ public class BMSSocketConnectionAutoRun extends AbstractAutoRunnable { status.outputCurrentRaw = outputCurrent; status.armState = armState; status.chargerState = chargerState; + status.reservedWord6 = reservedWord6; + status.reservedWord7 = reservedWord7; + status.checksum = checksum; status.lastUpdateTimeMs = System.currentTimeMillis(); status.rawFrameHex = bytesToHex(frame); latestStatus = status; - log.info("BMS状态更新 stationNo={}, armState={}, chargerState={}, voltageRaw={}, currentRaw={}", - reportStationNo, armState, chargerState, outputVoltage, outputCurrent); + String commandHex = pendingCommandHex; + if (commandHex != null && status.lastUpdateTimeMs - pendingCommandTimeMs <= COMMAND_RESPONSE_WINDOW_MS) { + log.info("BMS站点{}下发后收到回包: commandHex={}, replyHex={}", + config.stationNo, commandHex, status.rawFrameHex); + pendingCommandHex = null; + pendingCommandTimeMs = 0L; + } + + log.info("BMS站点{}状态更新: 机械臂={}, 充电状态={}, 输出电压原始值={}, 输出电流原始值={}, 保留字6=0x{}, 保留字7=0x{}({}), 校验值=0x{}", + reportStationNo, + armStateToText(armState), + chargerStateToText(chargerState), + outputVoltage, + outputCurrent, + Integer.toHexString(reservedWord6), + Integer.toHexString(reservedWord7), + describeWord7(reservedWord7), + Long.toHexString(checksum)); } private BmsStationStatus snapshotStatus() { @@ -652,6 +741,9 @@ public class BMSSocketConnectionAutoRun extends AbstractAutoRunnable { copy.outputCurrentRaw = source.outputCurrentRaw; copy.armState = source.armState; copy.chargerState = source.chargerState; + copy.reservedWord6 = source.reservedWord6; + copy.reservedWord7 = source.reservedWord7; + copy.checksum = source.checksum; copy.lastUpdateTimeMs = source.lastUpdateTimeMs; copy.rawFrameHex = source.rawFrameHex; if (copy.lastUpdateTimeMs <= 0 || System.currentTimeMillis() - copy.lastUpdateTimeMs > STATUS_EXPIRE_MS) { @@ -699,6 +791,10 @@ public class BMSSocketConnectionAutoRun extends AbstractAutoRunnable { return latestStatus.lastUpdateTimeMs; } + private int getLocalPort(int stationNo) { + return LOCAL_PORT_BASE + stationNo; + } + private boolean allowConnectAttempt() { long now = System.currentTimeMillis(); if (circuitState == CircuitState.OPEN) { @@ -839,6 +935,9 @@ public class BMSSocketConnectionAutoRun extends AbstractAutoRunnable { public int outputCurrentRaw; public int armState = ARM_STATE_UNKNOWN; public int chargerState = CHARGER_STATE_INVALID; + public int reservedWord6; + public int reservedWord7; + public long checksum; public long lastUpdateTimeMs; public String rawFrameHex; } diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/auto/run/NDCSocketConnectionAutoRun.java b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/auto/run/NDCSocketConnectionAutoRun.java index 58eb797..15c9e6b 100644 --- a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/auto/run/NDCSocketConnectionAutoRun.java +++ b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/auto/run/NDCSocketConnectionAutoRun.java @@ -37,6 +37,8 @@ import static org.nl.acs.agv.server.impl.NDCAgvServiceImpl.Bytes2HexString; @Slf4j @Component public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable { + private static final long BMS_COMMAND_WAIT_TIMEOUT_MS = 5000L; + static volatile Socket socket; String ip = "192.168.46.225"; @@ -149,13 +151,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable { AgvNdcTwoDeviceDriver agvNdcTwoDeviceDriver; //开始任务 if (phase == 0x01) { - luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder() - .request_url("socket://ndc/phase/0x01") - .request_direction("AGV->ACS") - .method("NDCSocketConnectionAutoRun.autoRun") - .request_param(bs.toString().toUpperCase()) - .content("phase=0x01;ikey=" + ikey + ",index=" + index) - .build()); + luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder().request_url("socket://ndc/phase/0x01").request_direction("AGV->ACS").method("NDCSocketConnectionAutoRun.autoRun").request_param(bs.toString().toUpperCase()).content("phase=0x01;ikey=" + ikey + ",index=" + index).build()); if (!ObjectUtil.isEmpty(inst)) { inst.setInstruction_status("1"); @@ -163,26 +159,13 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable { inst.setSend_status("1"); instructionService.update(inst); data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); - luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder() - .request_url("socket://ndc/phase/0x01") - .request_direction("ACS->AGV") - .method("NDCSocketConnectionAutoRun.autoRun") - .request_param(bs.toString().toUpperCase()) - .response_param(ObjectUtil.isEmpty(data) ? "" : Bytes2HexString(data)) - .content("已反馈AGVphase=0x01;ikey=" + ikey + ",index=" + index) - .build()); + luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder().request_url("socket://ndc/phase/0x01").request_direction("ACS->AGV").method("NDCSocketConnectionAutoRun.autoRun").request_param(bs.toString().toUpperCase()).response_param(ObjectUtil.isEmpty(data) ? "" : Bytes2HexString(data)).content("已反馈AGVphase=0x01;ikey=" + ikey + ",index=" + index).build()); } } //任务完毕 //(无车id及状态) else if (phase == 0x14) { - luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder() - .request_url("socket://ndc/phase/0x14") - .request_direction("AGV->ACS") - .method("NDCSocketConnectionAutoRun.autoRun") - .request_param(bs.toString().toUpperCase()) - .content("phase=0x14;ikey=" + ikey + ",index=" + index) - .build()); + luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder().request_url("socket://ndc/phase/0x14").request_direction("AGV->ACS").method("NDCSocketConnectionAutoRun.autoRun").request_param(bs.toString().toUpperCase()).content("phase=0x14;ikey=" + ikey + ",index=" + index).build()); if (ObjectUtil.isEmpty(inst)) { log.info("未找到指令号{}对应的指令", ikey); } else { @@ -202,96 +185,37 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable { } } data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); - luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder() - .request_url("socket://ndc/phase/0x14") - .request_direction("ACS->AGV") - .method("NDCSocketConnectionAutoRun.autoRun") - .request_param(bs.toString().toUpperCase()) - .response_param(ObjectUtil.isEmpty(data) ? "" : Bytes2HexString(data)) - .content("已反馈AGVphase=0x14;ikey=" + ikey + ",index=" + index) - .build()); + luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder().request_url("socket://ndc/phase/0x14").request_direction("ACS->AGV").method("NDCSocketConnectionAutoRun.autoRun").request_param(bs.toString().toUpperCase()).response_param(ObjectUtil.isEmpty(data) ? "" : Bytes2HexString(data)).content("已反馈AGVphase=0x14;ikey=" + ikey + ",index=" + index).build()); } //请求删除任务 //(需要WCS反馈) else if (phase == 0x30) { - luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder() - .request_url("socket://ndc/phase/0x30") - .request_direction("AGV->ACS") - .method("NDCSocketConnectionAutoRun.autoRun") - .request_param(bs.toString().toUpperCase()) - .content("phase=0x30;ikey=" + ikey + ",index=" + index) - .build()); + luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder().request_url("socket://ndc/phase/0x30").request_direction("AGV->ACS").method("NDCSocketConnectionAutoRun.autoRun").request_param(bs.toString().toUpperCase()).content("phase=0x30;ikey=" + ikey + ",index=" + index).build()); data = ndcAgvService.sendAgvTwoModeInst(0x8F, index, 0); - luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder() - .request_url("socket://ndc/phase/0x30") - .request_direction("ACS->AGV") - .method("NDCSocketConnectionAutoRun.autoRun") - .request_param(bs.toString().toUpperCase()) - .response_param(ObjectUtil.isEmpty(data) ? "" : Bytes2HexString(data)) - .content("已反馈AGVphase=0x30;ikey=" + ikey + ",index=" + index) - .build()); + luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder().request_url("socket://ndc/phase/0x30").request_direction("ACS->AGV").method("NDCSocketConnectionAutoRun.autoRun").request_param(bs.toString().toUpperCase()).response_param(ObjectUtil.isEmpty(data) ? "" : Bytes2HexString(data)).content("已反馈AGVphase=0x30;ikey=" + ikey + ",index=" + index).build()); } //任务删除确认 //(需要WCS反馈) else if (phase == 0xFF) { - luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder() - .request_url("socket://ndc/phase/0xFF") - .request_direction("AGV->ACS") - .method("NDCSocketConnectionAutoRun.autoRun") - .request_param(bs.toString().toUpperCase()) - .content("phase=0xFF;ikey=" + ikey + ",index=" + index) - .build()); + luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder().request_url("socket://ndc/phase/0xFF").request_direction("AGV->ACS").method("NDCSocketConnectionAutoRun.autoRun").request_param(bs.toString().toUpperCase()).content("phase=0xFF;ikey=" + ikey + ",index=" + index).build()); if (ObjectUtil.isEmpty(inst)) { log.info("未找到指令号{}对应的指令", ikey); } else { instructionService.cancelNOSendAgv(inst.getInstruction_id()); } data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); - luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder() - .request_url("socket://ndc/phase/0xFF") - .request_direction("ACS->AGV") - .method("NDCSocketConnectionAutoRun.autoRun") - .request_param(bs.toString().toUpperCase()) - .response_param(ObjectUtil.isEmpty(data) ? "" : Bytes2HexString(data)) - .content("已反馈AGVphase=0xFF;ikey=" + ikey + ",index=" + index) - .build()); + luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder().request_url("socket://ndc/phase/0xFF").request_direction("ACS->AGV").method("NDCSocketConnectionAutoRun.autoRun").request_param(bs.toString().toUpperCase()).response_param(ObjectUtil.isEmpty(data) ? "" : Bytes2HexString(data)).content("已反馈AGVphase=0xFF;ikey=" + ikey + ",index=" + index).build()); } //任务删除结束 else if (phase == 0x0F) { - luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder() - .request_url("socket://ndc/phase/0x0F") - .request_direction("AGV->ACS") - .method("NDCSocketConnectionAutoRun.autoRun") - .request_param(bs.toString().toUpperCase()) - .content("phase=0x0F;ikey=" + ikey + ",index=" + index) - .build()); + luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder().request_url("socket://ndc/phase/0x0F").request_direction("AGV->ACS").method("NDCSocketConnectionAutoRun.autoRun").request_param(bs.toString().toUpperCase()).content("phase=0x0F;ikey=" + ikey + ",index=" + index).build()); data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); - luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder() - .request_url("socket://ndc/phase/0x0F") - .request_direction("ACS->AGV") - .method("NDCSocketConnectionAutoRun.autoRun") - .request_param(bs.toString().toUpperCase()) - .response_param(ObjectUtil.isEmpty(data) ? "" : Bytes2HexString(data)) - .content("已反馈AGVphase=0x0F;ikey=" + ikey + ",index=" + index) - .build()); + luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder().request_url("socket://ndc/phase/0x0F").request_direction("ACS->AGV").method("NDCSocketConnectionAutoRun.autoRun").request_param(bs.toString().toUpperCase()).response_param(ObjectUtil.isEmpty(data) ? "" : Bytes2HexString(data)).content("已反馈AGVphase=0x0F;ikey=" + ikey + ",index=" + index).build()); } // 开门 else if (phase == 0x50) { - luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder() - .request_url("socket://ndc/phase/0x50") - .request_direction("AGV->ACS") - .method("NDCSocketConnectionAutoRun.autoRun") - .request_param(bs.toString().toUpperCase()) - .content("phase=0x50;ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code) - .build()); + luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder().request_url("socket://ndc/phase/0x50").request_direction("AGV->ACS").method("NDCSocketConnectionAutoRun.autoRun").request_param(bs.toString().toUpperCase()).content("phase=0x50;ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code).build()); if (ObjectUtil.isEmpty(device_code)) { - luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder() - .request_url("socket://ndc/phase/0x50") - .request_direction("ACS->AGV") - .method("NDCSocketConnectionAutoRun.autoRun") - .request_param(bs.toString().toUpperCase()) - .response_param("原因: agvaddr=" + agvaddr + " 对应设备号为空") - .content("未反馈AGVphase=0x50;ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code) - .build()); + luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder().request_url("socket://ndc/phase/0x50").request_direction("ACS->AGV").method("NDCSocketConnectionAutoRun.autoRun").request_param(bs.toString().toUpperCase()).response_param("原因: agvaddr=" + agvaddr + " 对应设备号为空").content("未反馈AGVphase=0x50;ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code).build()); log.info(agvaddr + "对应设备号为空!"); return; } @@ -300,14 +224,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable { try { elevatorDoorDeviceDriver.writing("call", "1"); } catch (Exception e) { - luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder() - .request_url("socket://ndc/phase/0x50") - .request_direction("ACS->AGV") - .method("NDCSocketConnectionAutoRun.autoRun") - .request_param(bs.toString().toUpperCase()) - .response_param("原因: 下发开门信号异常: " + e.getMessage()) - .content("未反馈AGVphase=0x50;ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code) - .build()); + luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder().request_url("socket://ndc/phase/0x50").request_direction("ACS->AGV").method("NDCSocketConnectionAutoRun.autoRun").request_param(bs.toString().toUpperCase()).response_param("原因: 下发开门信号异常: " + e.getMessage()).content("未反馈AGVphase=0x50;ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code).build()); log.info("下发电气信号失败:" + e.getMessage()); log.error("下发呼叫电梯信号失败", e); } @@ -315,79 +232,31 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable { if (elevatorDoorDeviceDriver.getOpen() == 1 && elevatorDoorDeviceDriver.getCall() == 1 && elevatorDoorDeviceDriver.getFire_open() == 1) { log.info("下发开门信号值为:{},读取开门信号值为:{}", elevatorDoorDeviceDriver.getCall(), elevatorDoorDeviceDriver.getOpen()); data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); - luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder() - .request_url("socket://ndc/phase/0x50") - .request_direction("ACS->AGV") - .method("NDCSocketConnectionAutoRun.autoRun") - .request_param(bs.toString().toUpperCase()) - .response_param(ObjectUtil.isEmpty(data) ? "" : Bytes2HexString(data)) - .content("已反馈AGVphase=0x50;ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code) - .build()); + luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder().request_url("socket://ndc/phase/0x50").request_direction("ACS->AGV").method("NDCSocketConnectionAutoRun.autoRun").request_param(bs.toString().toUpperCase()).response_param(ObjectUtil.isEmpty(data) ? "" : Bytes2HexString(data)).content("已反馈AGVphase=0x50;ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code).build()); } else { - luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder() - .request_url("socket://ndc/phase/0x50") - .request_direction("ACS->AGV") - .method("NDCSocketConnectionAutoRun.autoRun") - .request_param(bs.toString().toUpperCase()) - .response_param("原因: 未满足反馈条件, call=" + elevatorDoorDeviceDriver.getCall() + ", open=" + elevatorDoorDeviceDriver.getOpen() + ", fire_open=" + elevatorDoorDeviceDriver.getFire_open()) - .content("未反馈AGVphase=0x50;ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code) - .build()); + luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder().request_url("socket://ndc/phase/0x50").request_direction("ACS->AGV").method("NDCSocketConnectionAutoRun.autoRun").request_param(bs.toString().toUpperCase()).response_param("原因: 未满足反馈条件, call=" + elevatorDoorDeviceDriver.getCall() + ", open=" + elevatorDoorDeviceDriver.getOpen() + ", fire_open=" + elevatorDoorDeviceDriver.getFire_open()).content("未反馈AGVphase=0x50;ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code).build()); log.info("未下发NDC信号原因: 下发开门信号值为:{},读取开门信号值为:{},读取防火门状态:{}", elevatorDoorDeviceDriver.getCall(), elevatorDoorDeviceDriver.getOpen(), elevatorDoorDeviceDriver.getFire_open()); } } else { if (elevatorDoorDeviceDriver.getOpen() == 1 && elevatorDoorDeviceDriver.getCall() == 1) { log.info("下发开门信号值为:{},读取开门信号值为:{}", elevatorDoorDeviceDriver.getCall(), elevatorDoorDeviceDriver.getOpen()); data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); - luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder() - .request_url("socket://ndc/phase/0x50") - .request_direction("ACS->AGV") - .method("NDCSocketConnectionAutoRun.autoRun") - .request_param(bs.toString().toUpperCase()) - .response_param(ObjectUtil.isEmpty(data) ? "" : Bytes2HexString(data)) - .content("已反馈AGVphase=0x50;ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code) - .build()); + luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder().request_url("socket://ndc/phase/0x50").request_direction("ACS->AGV").method("NDCSocketConnectionAutoRun.autoRun").request_param(bs.toString().toUpperCase()).response_param(ObjectUtil.isEmpty(data) ? "" : Bytes2HexString(data)).content("已反馈AGVphase=0x50;ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code).build()); } else { - luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder() - .request_url("socket://ndc/phase/0x50") - .request_direction("ACS->AGV") - .method("NDCSocketConnectionAutoRun.autoRun") - .request_param(bs.toString().toUpperCase()) - .response_param("原因: 未满足反馈条件, call=" + elevatorDoorDeviceDriver.getCall() + ", open=" + elevatorDoorDeviceDriver.getOpen()) - .content("未反馈AGVphase=0x50;ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code) - .build()); + luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder().request_url("socket://ndc/phase/0x50").request_direction("ACS->AGV").method("NDCSocketConnectionAutoRun.autoRun").request_param(bs.toString().toUpperCase()).response_param("原因: 未满足反馈条件, call=" + elevatorDoorDeviceDriver.getCall() + ", open=" + elevatorDoorDeviceDriver.getOpen()).content("未反馈AGVphase=0x50;ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code).build()); log.info("未下发NDC信号原因: 下发开门信号值为:{},读取开门信号值为:{}", elevatorDoorDeviceDriver.getCall(), elevatorDoorDeviceDriver.getOpen()); } } } else { - luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder() - .request_url("socket://ndc/phase/0x50") - .request_direction("ACS->AGV") - .method("NDCSocketConnectionAutoRun.autoRun") - .request_param(bs.toString().toUpperCase()) - .response_param("原因: device_code=" + device_code + " 不是电梯门设备") - .content("未反馈AGVphase=0x50;ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code) - .build()); + luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder().request_url("socket://ndc/phase/0x50").request_direction("ACS->AGV").method("NDCSocketConnectionAutoRun.autoRun").request_param(bs.toString().toUpperCase()).response_param("原因: device_code=" + device_code + " 不是电梯门设备").content("未反馈AGVphase=0x50;ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code).build()); log.info(agvaddr + "对应设备号为空!"); } } // 关门 else if (phase == 0x51) { - luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder() - .request_url("socket://ndc/phase/0x51") - .request_direction("AGV->ACS") - .method("NDCSocketConnectionAutoRun.autoRun") - .request_param(bs.toString().toUpperCase()) - .content("phase=0x51;ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code) - .build()); + luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder().request_url("socket://ndc/phase/0x51").request_direction("AGV->ACS").method("NDCSocketConnectionAutoRun.autoRun").request_param(bs.toString().toUpperCase()).content("phase=0x51;ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code).build()); if (ObjectUtil.isEmpty(device_code)) { - luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder() - .request_url("socket://ndc/phase/0x51") - .request_direction("ACS->AGV") - .method("NDCSocketConnectionAutoRun.autoRun") - .request_param(bs.toString().toUpperCase()) - .response_param("原因: agvaddr=" + agvaddr + " 对应设备号为空") - .content("未反馈AGVphase=0x51;ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code) - .build()); + luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder().request_url("socket://ndc/phase/0x51").request_direction("ACS->AGV").method("NDCSocketConnectionAutoRun.autoRun").request_param(bs.toString().toUpperCase()).response_param("原因: agvaddr=" + agvaddr + " 对应设备号为空").content("未反馈AGVphase=0x51;ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code).build()); log.info(agvaddr + "对应设备号为空!"); return; } @@ -396,48 +265,20 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable { try { elevatorDoorDeviceDriver.writing("call", "0"); } catch (Exception e) { - luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder() - .request_url("socket://ndc/phase/0x51") - .request_direction("ACS->AGV") - .method("NDCSocketConnectionAutoRun.autoRun") - .request_param(bs.toString().toUpperCase()) - .response_param("原因: 下发关门信号异常: " + e.getMessage()) - .content("未反馈AGVphase=0x51;ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code) - .build()); + luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder().request_url("socket://ndc/phase/0x51").request_direction("ACS->AGV").method("NDCSocketConnectionAutoRun.autoRun").request_param(bs.toString().toUpperCase()).response_param("原因: 下发关门信号异常: " + e.getMessage()).content("未反馈AGVphase=0x51;ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code).build()); log.info("下发电气信号失败:" + e.getMessage()); log.error("下发关门信号失败", e); } if (elevatorDoorDeviceDriver.getOpen() == 0 && elevatorDoorDeviceDriver.getCall() == 0) { log.info("读取关门信号值为:{}", elevatorDoorDeviceDriver.getOpen()); data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); - luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder() - .request_url("socket://ndc/phase/0x51") - .request_direction("ACS->AGV") - .method("NDCSocketConnectionAutoRun.autoRun") - .request_param(bs.toString().toUpperCase()) - .response_param(ObjectUtil.isEmpty(data) ? "" : Bytes2HexString(data)) - .content("已反馈AGVphase=0x51;ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code) - .build()); + luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder().request_url("socket://ndc/phase/0x51").request_direction("ACS->AGV").method("NDCSocketConnectionAutoRun.autoRun").request_param(bs.toString().toUpperCase()).response_param(ObjectUtil.isEmpty(data) ? "" : Bytes2HexString(data)).content("已反馈AGVphase=0x51;ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code).build()); } else { - luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder() - .request_url("socket://ndc/phase/0x51") - .request_direction("ACS->AGV") - .method("NDCSocketConnectionAutoRun.autoRun") - .request_param(bs.toString().toUpperCase()) - .response_param("原因: 未满足反馈条件, call=" + elevatorDoorDeviceDriver.getCall() + ", open=" + elevatorDoorDeviceDriver.getOpen()) - .content("未反馈AGVphase=0x51;ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code) - .build()); + luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder().request_url("socket://ndc/phase/0x51").request_direction("ACS->AGV").method("NDCSocketConnectionAutoRun.autoRun").request_param(bs.toString().toUpperCase()).response_param("原因: 未满足反馈条件, call=" + elevatorDoorDeviceDriver.getCall() + ", open=" + elevatorDoorDeviceDriver.getOpen()).content("未反馈AGVphase=0x51;ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code).build()); log.info("未下发NDC信号原因: 读取自动门信号值为:{}", elevatorDoorDeviceDriver.getOpen()); } } else { - luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder() - .request_url("socket://ndc/phase/0x51") - .request_direction("ACS->AGV") - .method("NDCSocketConnectionAutoRun.autoRun") - .request_param(bs.toString().toUpperCase()) - .response_param("原因: device_code=" + device_code + " 不是电梯门设备") - .content("未反馈AGVphase=0x51;ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code) - .build()); + luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder().request_url("socket://ndc/phase/0x51").request_direction("ACS->AGV").method("NDCSocketConnectionAutoRun.autoRun").request_param(bs.toString().toUpperCase()).response_param("原因: device_code=" + device_code + " 不是电梯门设备").content("未反馈AGVphase=0x51;ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code).build()); log.info(device_code + "对应设备号为空!"); } } //请求充电,需要充电桩伸出到位 @@ -446,83 +287,29 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable { //carno是车号 //ADDR_STATION 是AGV站点号对应的充电桩桩号 Integer stationNo = ADDR_STATION.get(ikey); - luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder() - .request_url("socket://ndc/phase/0x64") - .request_direction("AGV->ACS") - .method("NDCSocketConnectionAutoRun.autoRun") - .request_param(bs.toString().toUpperCase()) - .content("phase=0x64;ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code + ",stationNo=" + stationNo) - .build()); + luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder().request_url("socket://ndc/phase/0x64").request_direction("AGV->ACS").method("NDCSocketConnectionAutoRun.autoRun").request_param(bs.toString().toUpperCase()).content("phase=0x64;ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code + ",stationNo=" + stationNo).build()); if (ObjectUtil.isEmpty(stationNo)) { - luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder() - .request_url("socket://ndc/phase/0x64") - .request_direction("ACS->AGV") - .method("NDCSocketConnectionAutoRun.autoRun") - .request_param(bs.toString().toUpperCase()) - .response_param("原因: ikey=" + ikey + " 未映射到充电桩stationNo") - .content("未反馈AGVphase=0x64;ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code + ",stationNo=" + stationNo) - .build()); + luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder().request_url("socket://ndc/phase/0x64").request_direction("ACS->AGV").method("NDCSocketConnectionAutoRun.autoRun").request_param(bs.toString().toUpperCase()).response_param("原因: ikey=" + ikey + " 未映射到充电桩stationNo").content("未反馈AGVphase=0x64;ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code + ",stationNo=" + stationNo).build()); + continue; + } + try { + BMSSocketConnectionAutoRun.writeStartChargeAndArmExtend(stationNo); + } catch (Exception e) { + luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder().request_url("socket://ndc/phase/0x64").request_direction("ACS->AGV").method("NDCSocketConnectionAutoRun.autoRun").request_param(bs.toString().toUpperCase()).response_param("原因: 下发组合命令(开始充电+伸臂)异常: " + e.getMessage()).content("未反馈AGVphase=0x64;ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code + ",stationNo=" + stationNo).build()); continue; } boolean armExtended = false; try { - armExtended = BMSSocketConnectionAutoRun.isArmExtended(stationNo); + armExtended = BMSSocketConnectionAutoRun.waitArmExtended(stationNo, BMS_COMMAND_WAIT_TIMEOUT_MS); } catch (Exception e) { - luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder() - .request_url("socket://ndc/phase/0x64") - .request_direction("ACS->AGV") - .method("NDCSocketConnectionAutoRun.autoRun") - .request_param(bs.toString().toUpperCase()) - .response_param("原因: 查询充电臂状态异常: " + e.getMessage()) - .content("未反馈AGVphase=0x64;ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code + ",stationNo=" + stationNo) - .build()); + luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder().request_url("socket://ndc/phase/0x64").request_direction("ACS->AGV").method("NDCSocketConnectionAutoRun.autoRun").request_param(bs.toString().toUpperCase()).response_param("原因: 等待充电桩伸出到位异常: " + e.getMessage()).content("未反馈AGVphase=0x64;ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code + ",stationNo=" + stationNo).build()); continue; } if (armExtended) { - try { - BMSSocketConnectionAutoRun.writeStartCharge(stationNo); - }catch (Exception e){ - luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder() - .request_url("socket://ndc/phase/0x64") - .request_direction("ACS->AGV") - .method("NDCSocketConnectionAutoRun.autoRun") - .request_param(bs.toString().toUpperCase()) - .response_param("原因: 下发开始充电异常: " + e.getMessage()) - .content("未反馈AGVphase=0x64;ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code + ",stationNo=" + stationNo) - .build()); - continue; - } data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); - luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder() - .request_url("socket://ndc/phase/0x64") - .request_direction("ACS->AGV") - .method("NDCSocketConnectionAutoRun.autoRun") - .request_param(bs.toString().toUpperCase()) - .response_param(ObjectUtil.isEmpty(data) ? "" : Bytes2HexString(data)) - .content("已反馈AGVphase=0x64;ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code + ",stationNo=" + stationNo) - .build()); + luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder().request_url("socket://ndc/phase/0x64").request_direction("ACS->AGV").method("NDCSocketConnectionAutoRun.autoRun").request_param(bs.toString().toUpperCase()).response_param(ObjectUtil.isEmpty(data) ? "" : Bytes2HexString(data)).content("已反馈AGVphase=0x64;ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code + ",stationNo=" + stationNo).build()); } else { - try { - BMSSocketConnectionAutoRun.writeArmExtend(stationNo); - luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder() - .request_url("socket://ndc/phase/0x64") - .request_direction("ACS->AGV") - .method("NDCSocketConnectionAutoRun.autoRun") - .request_param(bs.toString().toUpperCase()) - .response_param("原因: 充电臂未伸出,已下发伸臂命令") - .content("未反馈AGVphase=0x64;ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code + ",stationNo=" + stationNo) - .build()); - } catch (Exception e) { - luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder() - .request_url("socket://ndc/phase/0x64") - .request_direction("ACS->AGV") - .method("NDCSocketConnectionAutoRun.autoRun") - .request_param(bs.toString().toUpperCase()) - .response_param("原因: 下发伸臂命令异常: " + e.getMessage()) - .content("未反馈AGVphase=0x64;ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code + ",stationNo=" + stationNo) - .build()); - continue; - } + luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder().request_url("socket://ndc/phase/0x64").request_direction("ACS->AGV").method("NDCSocketConnectionAutoRun.autoRun").request_param(bs.toString().toUpperCase()).response_param("原因: 已下发组合命令(开始充电+伸臂),但充电桩未伸出到位,不给NDC反馈").content("未反馈AGVphase=0x64;ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code + ",stationNo=" + stationNo).build()); } } //请求离开,需要充电桩缩回到位 @@ -531,61 +318,32 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable { //carno是车号 //ADDR_STATION 是AGV站点号对应的充电桩桩号 Integer stationNo = ADDR_STATION.get(ikey); - luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder() - .request_url("socket://ndc/phase/0x66") - .request_direction("AGV->ACS") - .method("NDCSocketConnectionAutoRun.autoRun") - .request_param(bs.toString().toUpperCase()) - .content("phase=0x66;ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code + ",stationNo=" + stationNo) - .build()); + luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder().request_url("socket://ndc/phase/0x66").request_direction("AGV->ACS").method("NDCSocketConnectionAutoRun.autoRun").request_param(bs.toString().toUpperCase()).content("phase=0x66;ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code + ",stationNo=" + stationNo).build()); if (ObjectUtil.isEmpty(stationNo)) { - luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder() - .request_url("socket://ndc/phase/0x66") - .request_direction("ACS->AGV") - .method("NDCSocketConnectionAutoRun.autoRun") - .request_param(bs.toString().toUpperCase()) - .response_param("原因: ikey=" + ikey + " 未映射到充电桩stationNo") - .content("未反馈AGVphase=0x66;ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code + ",stationNo=" + stationNo) - .build()); + luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder().request_url("socket://ndc/phase/0x66").request_direction("ACS->AGV").method("NDCSocketConnectionAutoRun.autoRun").request_param(bs.toString().toUpperCase()).response_param("原因: ikey=" + ikey + " 未映射到充电桩stationNo").content("未反馈AGVphase=0x66;ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code + ",stationNo=" + stationNo).build()); continue; } - boolean armRetracted = BMSSocketConnectionAutoRun.isArmRetracted(stationNo); - if (armRetracted) { - try { - BMSSocketConnectionAutoRun.writeStopCharge(stationNo); - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); - luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder() - .request_url("socket://ndc/phase/0x66") - .request_direction("ACS->AGV") - .method("NDCSocketConnectionAutoRun.autoRun") - .request_param(bs.toString().toUpperCase()) - .response_param(ObjectUtil.isEmpty(data) ? "" : Bytes2HexString(data)) - .content("已反馈AGVphase=0x66;ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code + ",stationNo=" + stationNo) - .build()); - } catch (Exception e) { - luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder() - .request_url("socket://ndc/phase/0x66") - .request_direction("ACS->AGV") - .method("NDCSocketConnectionAutoRun.autoRun") - .request_param(bs.toString().toUpperCase()) - .response_param("原因: 停止充电或反馈异常: " + e.getMessage()) - .content("未反馈AGVphase=0x66;ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code + ",stationNo=" + stationNo) - .build()); - } - } else { - BMSSocketConnectionAutoRun.writeStopCharge(stationNo); - BMSSocketConnectionAutoRun.writeArmRetract(stationNo); - luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder() - .request_url("socket://ndc/phase/0x66") - .request_direction("ACS->AGV") - .method("NDCSocketConnectionAutoRun.autoRun") - .request_param(bs.toString().toUpperCase()) - .response_param("原因: 充电臂未缩回到位,下发退回") - .content("未反馈AGVphase=0x66;ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code + ",stationNo=" + stationNo) - .build()); + try { + BMSSocketConnectionAutoRun.writeStopChargeAndArmRetract(stationNo); + } catch (Exception e) { + luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder().request_url("socket://ndc/phase/0x66").request_direction("ACS->AGV").method("NDCSocketConnectionAutoRun.autoRun").request_param(bs.toString().toUpperCase()).response_param("原因: 下发组合命令(停止充电+退回伸臂)异常," + e.getMessage()).content("未反馈AGVphase=0x66;ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code + ",stationNo=" + stationNo).build()); + continue; } - } - else { + //退回到位 + boolean armRetracted = false; + try { + armRetracted = BMSSocketConnectionAutoRun.waitArmRetracted(stationNo, BMS_COMMAND_WAIT_TIMEOUT_MS); + } catch (Exception e) { + luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder().request_url("socket://ndc/phase/0x66").request_direction("ACS->AGV").method("NDCSocketConnectionAutoRun.autoRun").request_param(bs.toString().toUpperCase()).response_param("原因: 等待停止充电/退回到位异常: " + e.getMessage()).content("未反馈AGVphase=0x66;ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code + ",stationNo=" + stationNo).build()); + continue; + } + if (armRetracted) { + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder().request_url("socket://ndc/phase/0x66").request_direction("ACS->AGV").method("NDCSocketConnectionAutoRun.autoRun").request_param(bs.toString().toUpperCase()).response_param(ObjectUtil.isEmpty(data) ? "" : Bytes2HexString(data)).content("已反馈AGVphase=0x66;ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code + ",stationNo=" + stationNo).build()); + } else { + luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder().request_url("socket://ndc/phase/0x66").request_direction("ACS->AGV").method("NDCSocketConnectionAutoRun.autoRun").request_param(bs.toString().toUpperCase()).response_param("原因: 已下发组合命令(停止充电+退回伸臂),但充电桩未同时满足停止充电和退回到位,不给NDC反馈").content("未反馈AGVphase=0x66;ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code + ",stationNo=" + stationNo).build()); + } + } else { if (phase == 0x70 || phase == 0x71 || phase == 0x72 || phase == 0x73 || phase == 0x74) { device = deviceAppService.findDeviceByCode(Integer.toString(arr[18] * 256 + arr[19])); } else { @@ -598,14 +356,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable { agvNdcTwoDeviceDriver.processSocket(arr); } } else { - luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder() - .request_url("socket://ndc/phase/0x" + Integer.toHexString(phase).toUpperCase()) - .request_direction("ACS->AGV") - .method("NDCSocketConnectionAutoRun.autoRun") - .request_param(bs.toString().toUpperCase()) - .response_param("原因: 当前phase=" + phase + " 未找到对应设备") - .content("未反馈AGVphase=0x" + Integer.toHexString(phase).toUpperCase() + ";ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code) - .build()); + luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder().request_url("socket://ndc/phase/0x" + Integer.toHexString(phase).toUpperCase()).request_direction("ACS->AGV").method("NDCSocketConnectionAutoRun.autoRun").request_param(bs.toString().toUpperCase()).response_param("原因: 当前phase=" + phase + " 未找到对应设备").content("未反馈AGVphase=0x" + Integer.toHexString(phase).toUpperCase() + ";ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code).build()); log.info("当前phase:" + phase + "未找到对应设备"); } } catch (Exception e) { diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/ndctwo/AgvNdcTwoDeviceDriver.java b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/ndctwo/AgvNdcTwoDeviceDriver.java index 9f6d86a..76b836b 100644 --- a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/ndctwo/AgvNdcTwoDeviceDriver.java +++ b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/ndctwo/AgvNdcTwoDeviceDriver.java @@ -83,6 +83,17 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic String error_type = "agv_error_type"; + /** + * 屏蔽拆封盖机需要用到 + * 四点任务从拆包机对接位->料筒库缓存位空位;从料筒库缓存位空桶位->拆包机对接位; + * 在拆包机对接位取货完成后,需要人工确认盖盖子 + * 在拆包机对接位放货前,需要人工拆盖子 + * 拆盖标记 open_flag 封盖标记close_flag + */ + private boolean open_flag = false; + private boolean close_flag = false; + + private Integer lastPhase = 0; /** diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/rest/WmsToAcsController.java b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/rest/WmsToAcsController.java index 3ecaa23..f77c3fa 100644 --- a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/rest/WmsToAcsController.java +++ b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/rest/WmsToAcsController.java @@ -53,6 +53,7 @@ public class WmsToAcsController { @PostMapping("/areaControl") @Log(value = "区域控制") + @SaIgnore public ResponseEntity areaControl(@RequestBody JSONObject whereJson) { return new ResponseEntity<>(wmstoacsService.areaControl(whereJson), HttpStatus.OK); } diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda_manage/ios_manage/service/impl/PdaIosOutServiceImpl.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda_manage/ios_manage/service/impl/PdaIosOutServiceImpl.java index 15c36d4..cb26119 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda_manage/ios_manage/service/impl/PdaIosOutServiceImpl.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda_manage/ios_manage/service/impl/PdaIosOutServiceImpl.java @@ -455,15 +455,21 @@ public class PdaIosOutServiceImpl implements PdaIosOutService { throw new BadRequestException("该点位存在正在执行的任务,请核对!"); } - iSchBasePointService.update(new LambdaUpdateWrapper() - .set(SchBasePoint::getPoint_status, whereJson.getString("point_status")) - .set("1".equals(whereJson.getString("point_status")), SchBasePoint::getVehicle_code, null) - .set("1".equals(whereJson.getString("point_status")), SchBasePoint::getVehicle_type, "") - .set("1".equals(whereJson.getString("point_status")), SchBasePoint::getVehicle_qty, 0) - .set("2".equals(whereJson.getString("point_status")),SchBasePoint::getVehicle_code, vehicle_code) - .set("2".equals(whereJson.getString("point_status")),SchBasePoint::getVehicle_type, vehicleInfo.getStoragevehicle_type()) - .set("2".equals(whereJson.getString("point_status")),SchBasePoint::getVehicle_qty, 1) - .eq(SchBasePoint::getPoint_code, whereJson.getString("point_code"))); + if ("1".equals(whereJson.getString("point_status"))) { + iSchBasePointService.update(new LambdaUpdateWrapper() + .set(SchBasePoint::getPoint_status, whereJson.getString("point_status")) + .set(SchBasePoint::getVehicle_code, "") + .set(SchBasePoint::getVehicle_type, "") + .set(SchBasePoint::getVehicle_qty, 0) + .eq(SchBasePoint::getPoint_code, whereJson.getString("point_code"))); + } else { + iSchBasePointService.update(new LambdaUpdateWrapper() + .set(SchBasePoint::getPoint_status, whereJson.getString("point_status")) + .set(SchBasePoint::getVehicle_code, vehicle_code) + .set(SchBasePoint::getVehicle_type, vehicleInfo.getStoragevehicle_type()) + .set(SchBasePoint::getVehicle_qty, 1) + .eq(SchBasePoint::getPoint_code, whereJson.getString("point_code"))); + } //查询点位上的载具 List schBasePointList = iSchBasePointService.list(new LambdaQueryWrapper() diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch_manage/service/util/AbstractTask.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch_manage/service/util/AbstractTask.java index 3ba46a3..dce34c0 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch_manage/service/util/AbstractTask.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch_manage/service/util/AbstractTask.java @@ -2,6 +2,7 @@ package org.nl.wms.sch_manage.service.util; import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; import cn.hutool.http.HttpStatus; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; @@ -15,6 +16,9 @@ import org.nl.wms.ext_manage.service.util.AcsResponse; import org.nl.wms.sch_manage.enums.TaskStatus; import org.nl.wms.sch_manage.service.ISchBaseTaskService; import org.nl.wms.sch_manage.service.dao.SchBaseTask; +import org.nl.wms.system_manage.enums.SysParamConstant; +import org.nl.wms.system_manage.service.param.ISysParamService; +import org.nl.wms.system_manage.service.param.dao.Param; import org.nl.wms.warehouse_manage.enums.IOSConstant; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -48,6 +52,8 @@ public abstract class AbstractTask { private WmsToAcsService wmsToAcsService; @Autowired private TaskFactory taskFactory; + @Autowired + private ISysParamService sysParamService; /** * 任务创建 @@ -73,6 +79,27 @@ public abstract class AbstractTask { acsTaskDto.setTask_group_seq(taskDao.getTask_group_seq()); } + /** + * AGV扫码关闭时,兼容旧ACS任务类型: + * 2 -> 1,3 -> 4;开启扫码时保持原值。 + */ + protected String normalizeAgvSystemType(String agvSystemType) { + if (StrUtil.isBlank(agvSystemType)) { + return agvSystemType; + } + Param param = sysParamService.findByCode(SysParamConstant.IS_OPEN_AGV_SCANNER); + if (param == null || !StrUtil.equals(param.getValue(), "0")) { + return agvSystemType; + } + if (StrUtil.equals(agvSystemType, "2")) { + return "1"; + } + if (StrUtil.equals(agvSystemType, "3")) { + return "4"; + } + return agvSystemType; + } + /** * 定时任务 */ diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch_manage/service/util/tasks/jb/JbDownAgvTask.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch_manage/service/util/tasks/jb/JbDownAgvTask.java index 2e41387..f10dc7a 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch_manage/service/util/tasks/jb/JbDownAgvTask.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch_manage/service/util/tasks/jb/JbDownAgvTask.java @@ -110,10 +110,10 @@ public class JbDownAgvTask extends AbstractTask { acsTaskDto.setStart_device_code2(taskDao.getPoint_code3()); acsTaskDto.setNext_device_code2(taskDao.getPoint_code4()); // 解包出桶四点任务 -> ACS 类型 3 - acsTaskDto.setAgv_system_type("3"); + acsTaskDto.setAgv_system_type(normalizeAgvSystemType("3")); } else { // 解包出桶两点任务 -> ACS 类型 2 - acsTaskDto.setAgv_system_type("2"); + acsTaskDto.setAgv_system_type(normalizeAgvSystemType("2")); } acsTaskDto.setTask_group_id(taskDao.getTask_group_id()); acsTaskDto.setTask_group_seq(taskDao.getTask_group_seq()); diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch_manage/service/util/tasks/jb/JbDownCloseUnsealingAgvTask.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch_manage/service/util/tasks/jb/JbDownCloseUnsealingAgvTask.java index 38ff48e..b12b89e 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch_manage/service/util/tasks/jb/JbDownCloseUnsealingAgvTask.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch_manage/service/util/tasks/jb/JbDownCloseUnsealingAgvTask.java @@ -100,7 +100,7 @@ public class JbDownCloseUnsealingAgvTask extends AbstractTask { acsTaskDto.setNext_device_code(taskDao.getPoint_code2()); acsTaskDto.setStart_device_code2(taskDao.getPoint_code3()); acsTaskDto.setNext_device_code2(taskDao.getPoint_code4()); - acsTaskDto.setAgv_system_type("3"); + acsTaskDto.setAgv_system_type(normalizeAgvSystemType("3")); acsTaskDto.setPriority(taskDao.getPriority()); acsTaskDto.setTask_type(taskconfig.getTask_type()); acsTaskDto.setTruss_type(object.getString("truss_type")); diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch_manage/service/util/tasks/zw/SeparateMaterialTask.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch_manage/service/util/tasks/zw/SeparateMaterialTask.java index e39d902..23fd7a3 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch_manage/service/util/tasks/zw/SeparateMaterialTask.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch_manage/service/util/tasks/zw/SeparateMaterialTask.java @@ -131,7 +131,7 @@ public class SeparateMaterialTask extends AbstractTask { acsTaskDto.setStart_device_code2(taskDao.getPoint_code3()); acsTaskDto.setNext_device_code2(taskDao.getPoint_code4()); acsTaskDto.setPriority(taskDao.getPriority()); - acsTaskDto.setAgv_system_type("2"); + acsTaskDto.setAgv_system_type(normalizeAgvSystemType("2")); acsTaskDto.setTask_type("2"); fillCommonAcsTaskFields(taskDao, acsTaskDto); return acsTaskDto; diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/system_manage/enums/SysParamConstant.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/system_manage/enums/SysParamConstant.java index 9576828..58e58ae 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/system_manage/enums/SysParamConstant.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/system_manage/enums/SysParamConstant.java @@ -22,6 +22,11 @@ public class SysParamConstant { */ public final static String ACS_URL = "acs_url"; + /** + * 是否开启AGV扫码识别 + */ + public final static String IS_OPEN_AGV_SCANNER = "is_open_agv_scanner"; + /** * ERP系统IP */ diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/warehouse_manage/enums/IOSEnum.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/warehouse_manage/enums/IOSEnum.java index 0a818b4..467033a 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/warehouse_manage/enums/IOSEnum.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/warehouse_manage/enums/IOSEnum.java @@ -25,7 +25,7 @@ public enum IOSEnum { IO_TYPE(MapOf.of("入库", "0", "出库", "1")), //单据状态 - BILL_STATUS(MapOf.of("生成", "10", "分配中", "20", "分配完", "30", "完成", "99")), + BILL_STATUS(MapOf.of("生成", "10", "审核", "15", "分配中", "20", "分配完", "30", "完成", "99")), // 入库业务类型 BILL_TYPE(MapOf.of("生产入库", "0001", "手工入库", "0009", "解包入库", "0011", "解包直接入库", "0016", "手工出库", "1009", "解包出库", "1012")), diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/warehouse_manage/inAndOut/controller/OutBillController.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/warehouse_manage/inAndOut/controller/OutBillController.java index ba81935..3988555 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/warehouse_manage/inAndOut/controller/OutBillController.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/warehouse_manage/inAndOut/controller/OutBillController.java @@ -80,6 +80,13 @@ public class OutBillController { return new ResponseEntity<>(iOutBillService.getOutBillDis(whereJson), HttpStatus.OK); } + @PostMapping("/audit") + @Log("出库单审核") + public ResponseEntity audit(@RequestBody JSONObject whereJson) { + iOutBillService.audit(whereJson); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + @PostMapping("/allDiv") @Log("出库单全部分配") public ResponseEntity allDiv(@RequestBody JSONObject whereJson) { diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/warehouse_manage/inAndOut/service/IOutBillService.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/warehouse_manage/inAndOut/service/IOutBillService.java index bac69c3..e9a4d18 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/warehouse_manage/inAndOut/service/IOutBillService.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/warehouse_manage/inAndOut/service/IOutBillService.java @@ -82,6 +82,13 @@ public interface IOutBillService extends IService { */ List getOutBillDis(Map whereJson); + /** + * 出库单审核 + * + * @param whereJson / + */ + void audit(JSONObject whereJson); + /** * 全部分配,对同一出库单明细进行分配 * diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/warehouse_manage/inAndOut/service/dao/IOStorInv.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/warehouse_manage/inAndOut/service/dao/IOStorInv.java index ddbfe37..a86b279 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/warehouse_manage/inAndOut/service/dao/IOStorInv.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/warehouse_manage/inAndOut/service/dao/IOStorInv.java @@ -90,7 +90,7 @@ public class IOStorInv implements Serializable { private Integer detail_count; /** - * 单据状态 10生成 20分配中 30分配完 99完成 + * 单据状态 10生成 15审核 20分配中 30分配完 99完成 */ private String bill_status; @@ -139,6 +139,21 @@ public class IOStorInv implements Serializable { */ private String dis_optid; + /** + * 审核人 + */ + private String audit_optid; + + /** + * 审核人姓名 + */ + private String audit_optname; + + /** + * 审核时间 + */ + private String audit_time; + /** * 分配人姓名 */ diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/warehouse_manage/inAndOut/service/impl/OutBillServiceImpl.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/warehouse_manage/inAndOut/service/impl/OutBillServiceImpl.java index 996a50a..2ce979c 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/warehouse_manage/inAndOut/service/impl/OutBillServiceImpl.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/warehouse_manage/inAndOut/service/impl/OutBillServiceImpl.java @@ -72,6 +72,11 @@ import java.util.stream.Collectors; @Service public class OutBillServiceImpl extends ServiceImpl implements IOutBillService { + private static final String OUT_BILL_STATUS_CREATED = "生成"; + private static final String OUT_BILL_STATUS_AUDITED = "审核"; + private static final String OUT_BILL_STATUS_ASSIGNING = "分配中"; + private static final String OUT_BILL_STATUS_ASSIGNED = "分配完"; + @Resource private IOStorInvMapper ioStorInvMapper; @@ -125,6 +130,24 @@ public class OutBillServiceImpl extends ServiceImpl i @Resource private IInBillService inBillService; + private IOStorInv getOutBillOrThrow(String iostorinvId) { + IOStorInv ioStorInv = ioStorInvMapper.selectById(iostorinvId); + if (ObjectUtil.isEmpty(ioStorInv)) { + throw new BadRequestException("查不到出库单信息"); + } + return ioStorInv; + } + + private void ensureOutBillStatus(IOStorInv ioStorInv, String... allowedStatuses) { + String currentStatus = ioStorInv.getBill_status(); + for (String allowedStatus : allowedStatuses) { + if (IOSEnum.BILL_STATUS.code(allowedStatus).equals(currentStatus)) { + return; + } + } + throw new BadRequestException("当前出库单状态不允许执行该操作"); + } + @Override public IPage pageQuery(Map whereJson, PageQuery page, String[] stor_id, String[] bill_status, String[] bill_type) { @@ -366,6 +389,35 @@ public class OutBillServiceImpl extends ServiceImpl i return ioStorInvDisMapper.queryOutBillDisDtl(whereJson); } + @Override + @Transactional(rollbackFor = Exception.class) + public void audit(JSONObject whereJson) { + String iostorinvId = whereJson.getString("iostorinv_id"); + IOStorInv ioStorInv = getOutBillOrThrow(iostorinvId); + ensureOutBillStatus(ioStorInv, OUT_BILL_STATUS_CREATED); + + String currentUserId = SecurityUtils.getCurrentUserId(); + String nickName = SecurityUtils.getCurrentNickName(); + String now = DateUtil.now(); + + IOStorInv updateMst = new IOStorInv(); + updateMst.setIostorinv_id(iostorinvId); + updateMst.setBill_status(IOSEnum.BILL_STATUS.code(OUT_BILL_STATUS_AUDITED)); + updateMst.setAudit_optid(currentUserId); + updateMst.setAudit_optname(nickName); + updateMst.setAudit_time(now); + updateMst.setUpdate_optid(currentUserId); + updateMst.setUpdate_optname(nickName); + updateMst.setUpdate_time(now); + ioStorInvMapper.updateById(updateMst); + + ioStorInvDtlMapper.update(new IOStorInvDtl(), + new LambdaUpdateWrapper() + .set(IOStorInvDtl::getBill_status, IOSEnum.BILL_STATUS.code(OUT_BILL_STATUS_AUDITED)) + .eq(IOStorInvDtl::getIostorinv_id, iostorinvId) + .eq(IOStorInvDtl::getBill_status, IOSEnum.BILL_STATUS.code(OUT_BILL_STATUS_CREATED))); + } + @Override @Transactional(rollbackFor = Exception.class) public void allDiv(JSONObject whereJson) { @@ -377,14 +429,12 @@ public class OutBillServiceImpl extends ServiceImpl i String iostorinv_id = whereJson.getString("iostorinv_id"); //查询主表信息 - IOStorInv ioStorInv = ioStorInvMapper.selectById(iostorinv_id); - if (ObjectUtil.isEmpty(ioStorInv)) { - throw new BadRequestException("查不到出库单信息"); - } + IOStorInv ioStorInv = getOutBillOrThrow(iostorinv_id); + ensureOutBillStatus(ioStorInv, OUT_BILL_STATUS_AUDITED, OUT_BILL_STATUS_ASSIGNING, OUT_BILL_STATUS_ASSIGNED); //查询生成和未分配完的明细 JSONObject queryDtl = new JSONObject(); - queryDtl.put("bill_status", IOSEnum.BILL_STATUS.code("分配完")); + queryDtl.put("bill_status", IOSEnum.BILL_STATUS.code(OUT_BILL_STATUS_ASSIGNED)); queryDtl.put("unassign_flag", BaseDataEnum.IS_YES_NOT.code("是")); queryDtl.put("iostorinv_id", iostorinv_id); List dtls = ioStorInvMapper.getIODtl(queryDtl); @@ -459,7 +509,7 @@ public class OutBillServiceImpl extends ServiceImpl i } //更新详情 - dtl.setBill_status(IOSEnum.BILL_STATUS.code("分配完")); + dtl.setBill_status(IOSEnum.BILL_STATUS.code(OUT_BILL_STATUS_ASSIGNED)); dtl.setUnassign_qty(unassign_qty); dtl.setAssign_qty(dtl.getAssign_qty().add(allocation_canuse_qty)); ioStorInvDtlMapper.updateById(dtl); @@ -469,7 +519,7 @@ public class OutBillServiceImpl extends ServiceImpl i //根据单据标识判断明细是否都已经分配完成 int disCount = ioStorInvDtlMapper.selectCount(new LambdaQueryWrapper<>(IOStorInvDtl.class) .eq(IOStorInvDtl::getIostorinv_id,iostorinv_id) - .lt(IOStorInvDtl::getBill_status,IOSEnum.BILL_STATUS.code("分配完")) + .lt(IOStorInvDtl::getBill_status,IOSEnum.BILL_STATUS.code(OUT_BILL_STATUS_ASSIGNED)) ); // 根据分配货位情况 更新主表单据状态 IOStorInv ios = new IOStorInv(); @@ -477,7 +527,7 @@ public class OutBillServiceImpl extends ServiceImpl i ios.setUpdate_optid(currentUserId); ios.setUpdate_optname(nickName); ios.setUpdate_time(now); - ios.setBill_status(disCount>0 ? IOSEnum.BILL_STATUS.code("分配中") : IOSEnum.BILL_STATUS.code("分配完")); + ios.setBill_status(disCount>0 ? IOSEnum.BILL_STATUS.code(OUT_BILL_STATUS_ASSIGNING) : IOSEnum.BILL_STATUS.code(OUT_BILL_STATUS_ASSIGNED)); ioStorInvMapper.updateById(ios); } @@ -490,6 +540,8 @@ public class OutBillServiceImpl extends ServiceImpl i String now = DateUtil.now(); String iostorinv_id = whereJson.getString("iostorinv_id"); + IOStorInv ioStorInv = getOutBillOrThrow(iostorinv_id); + ensureOutBillStatus(ioStorInv, OUT_BILL_STATUS_AUDITED, OUT_BILL_STATUS_ASSIGNING, OUT_BILL_STATUS_ASSIGNED); List ioStorInvDisList = ioStorInvDisMapper.selectList(new LambdaQueryWrapper<>(IOStorInvDis.class) .le(IOStorInvDis::getWork_status,IOSEnum.INBILL_DIS_STATUS.code("未生成")) @@ -538,7 +590,7 @@ public class OutBillServiceImpl extends ServiceImpl i IOStorInvDtl ioStorInvDtl = ioStorInvDtlMapper.selectById(dtlId); ioStorInvDtl.setAssign_qty(BigDecimal.ZERO); ioStorInvDtl.setUnassign_qty(ioStorInvDtl.getPlan_qty()); - ioStorInvDtl.setBill_status(IOSEnum.BILL_STATUS.code("生成")); + ioStorInvDtl.setBill_status(IOSEnum.BILL_STATUS.code(OUT_BILL_STATUS_AUDITED)); ioStorInvDtlMapper.updateById(ioStorInvDtl); } @@ -549,7 +601,7 @@ public class OutBillServiceImpl extends ServiceImpl i ios.setUpdate_optid(currentUserId); ios.setUpdate_optname(nickName); ios.setUpdate_time(now); - ios.setBill_status(IOSEnum.BILL_STATUS.code("生成")); + ios.setBill_status(IOSEnum.BILL_STATUS.code(OUT_BILL_STATUS_AUDITED)); ioStorInvMapper.updateById(ios); } @@ -563,14 +615,12 @@ public class OutBillServiceImpl extends ServiceImpl i String sectCode = whereJson.getString("sect_code"); String iostorinv_id = whereJson.getString("iostorinv_id"); //查询主表信息 - IOStorInv ioStorInv = ioStorInvMapper.selectById(iostorinv_id); - if (ObjectUtil.isEmpty(ioStorInv)) { - throw new BadRequestException("查不到出库单信息"); - } + IOStorInv ioStorInv = getOutBillOrThrow(iostorinv_id); + ensureOutBillStatus(ioStorInv, OUT_BILL_STATUS_AUDITED, OUT_BILL_STATUS_ASSIGNING, OUT_BILL_STATUS_ASSIGNED); //查询生成和未分配完的明细 JSONObject queryDtl = new JSONObject(); - queryDtl.put("bill_status", IOSEnum.BILL_STATUS.code("分配完")); + queryDtl.put("bill_status", IOSEnum.BILL_STATUS.code(OUT_BILL_STATUS_ASSIGNED)); queryDtl.put("unassign_flag", BaseDataEnum.IS_YES_NOT.code("是")); queryDtl.put("iostorinv_id", iostorinv_id); queryDtl.put("iostorinvdtl_id", whereJson.getString("iostorinvdtl_id")); @@ -642,7 +692,7 @@ public class OutBillServiceImpl extends ServiceImpl i } } //更新详情 - dtl.setBill_status(IOSEnum.BILL_STATUS.code("分配完")); + dtl.setBill_status(IOSEnum.BILL_STATUS.code(OUT_BILL_STATUS_ASSIGNED)); dtl.setUnassign_qty(unassign_qty); dtl.setAssign_qty(dtl.getAssign_qty().add(allocation_canuse_qty)); ioStorInvDtlMapper.updateById(dtl); @@ -651,7 +701,7 @@ public class OutBillServiceImpl extends ServiceImpl i //根据单据标识判断明细是否都已经分配完成 int disCount = ioStorInvDtlMapper.selectCount(new LambdaQueryWrapper<>(IOStorInvDtl.class) .eq(IOStorInvDtl::getIostorinv_id,iostorinv_id) - .lt(IOStorInvDtl::getBill_status,IOSEnum.BILL_STATUS.code("分配完")) + .lt(IOStorInvDtl::getBill_status,IOSEnum.BILL_STATUS.code(OUT_BILL_STATUS_ASSIGNED)) ); // 根据分配货位情况 更新主表单据状态 IOStorInv ios = new IOStorInv(); @@ -659,7 +709,7 @@ public class OutBillServiceImpl extends ServiceImpl i ios.setUpdate_optid(currentUserId); ios.setUpdate_optname(nickName); ios.setUpdate_time(now); - ios.setBill_status(disCount>0 ? IOSEnum.BILL_STATUS.code("分配中") : IOSEnum.BILL_STATUS.code("分配完")); + ios.setBill_status(disCount>0 ? IOSEnum.BILL_STATUS.code(OUT_BILL_STATUS_ASSIGNING) : IOSEnum.BILL_STATUS.code(OUT_BILL_STATUS_ASSIGNED)); ioStorInvMapper.updateById(ios); } @@ -670,6 +720,8 @@ public class OutBillServiceImpl extends ServiceImpl i String now = DateUtil.now(); String iostorinv_id = whereJson.getString("iostorinv_id"); + IOStorInv ioStorInv = getOutBillOrThrow(iostorinv_id); + ensureOutBillStatus(ioStorInv, OUT_BILL_STATUS_AUDITED, OUT_BILL_STATUS_ASSIGNING, OUT_BILL_STATUS_ASSIGNED); List ioStorInvDisList = ioStorInvDisMapper.selectList(new LambdaQueryWrapper<>(IOStorInvDis.class) .le(IOStorInvDis::getWork_status,IOSEnum.INBILL_DIS_STATUS.code("未生成")) @@ -719,7 +771,7 @@ public class OutBillServiceImpl extends ServiceImpl i IOStorInvDtl ioStorInvDtl = ioStorInvDtlMapper.selectById(dtlId); ioStorInvDtl.setAssign_qty(BigDecimal.ZERO); ioStorInvDtl.setUnassign_qty(ioStorInvDtl.getPlan_qty()); - ioStorInvDtl.setBill_status(IOSEnum.BILL_STATUS.code("生成")); + ioStorInvDtl.setBill_status(IOSEnum.BILL_STATUS.code(OUT_BILL_STATUS_AUDITED)); ioStorInvDtlMapper.updateById(ioStorInvDtl); } @@ -728,8 +780,8 @@ public class OutBillServiceImpl extends ServiceImpl i //根据单据标识判断明细是否都已经分配完成 int disCount = ioStorInvDtlMapper.selectCount(new LambdaQueryWrapper<>(IOStorInvDtl.class) .eq(IOStorInvDtl::getIostorinv_id,iostorinv_id) - .le(IOStorInvDtl::getBill_status,IOSEnum.BILL_STATUS.code("分配完")) - .gt(IOStorInvDtl::getBill_status,IOSEnum.BILL_STATUS.code("生成")) + .le(IOStorInvDtl::getBill_status,IOSEnum.BILL_STATUS.code(OUT_BILL_STATUS_ASSIGNED)) + .gt(IOStorInvDtl::getBill_status,IOSEnum.BILL_STATUS.code(OUT_BILL_STATUS_AUDITED)) ); // 根据分配货位情况 更新主表单据状态 @@ -738,7 +790,7 @@ public class OutBillServiceImpl extends ServiceImpl i ios.setUpdate_optid(currentUserId); ios.setUpdate_optname(nickName); ios.setUpdate_time(now); - ios.setBill_status(disCount>0 ? IOSEnum.BILL_STATUS.code("分配中") : IOSEnum.BILL_STATUS.code("生成")); + ios.setBill_status(disCount>0 ? IOSEnum.BILL_STATUS.code(OUT_BILL_STATUS_ASSIGNING) : IOSEnum.BILL_STATUS.code(OUT_BILL_STATUS_AUDITED)); ioStorInvMapper.updateById(ios); } @@ -761,14 +813,12 @@ public class OutBillServiceImpl extends ServiceImpl i String iostorinv_id = row.getString("iostorinv_id"); //查询主表信息 - IOStorInv ioStorInv = ioStorInvMapper.selectById(iostorinv_id); - if (ObjectUtil.isEmpty(ioStorInv)) { - throw new BadRequestException("当前订单无可分配出库明细"); - } + IOStorInv ioStorInv = getOutBillOrThrow(iostorinv_id); + ensureOutBillStatus(ioStorInv, OUT_BILL_STATUS_AUDITED, OUT_BILL_STATUS_ASSIGNING, OUT_BILL_STATUS_ASSIGNED); //查询生成和未分配完的明细 JSONObject queryDtl = new JSONObject(); - queryDtl.put("bill_status", IOSEnum.BILL_STATUS.code("分配完")); + queryDtl.put("bill_status", IOSEnum.BILL_STATUS.code(OUT_BILL_STATUS_ASSIGNED)); queryDtl.put("unassign_flag", BaseDataEnum.IS_YES_NOT.code("是")); queryDtl.put("iostorinv_id", iostorinv_id); queryDtl.put("iostorinvdtl_id", row.getString("iostorinvdtl_id")); @@ -853,7 +903,7 @@ public class OutBillServiceImpl extends ServiceImpl i } //更新详情 - dtl.setBill_status(unassign_qty==0 ? IOSEnum.BILL_STATUS.code("分配完"): IOSEnum.BILL_STATUS.code("分配中")); + dtl.setBill_status(unassign_qty==0 ? IOSEnum.BILL_STATUS.code(OUT_BILL_STATUS_ASSIGNED): IOSEnum.BILL_STATUS.code(OUT_BILL_STATUS_ASSIGNING)); double assign_qty = allocation_canuse_qty + dtl.getAssign_qty().doubleValue(); dtl.setUnassign_qty(BigDecimal.valueOf(unassign_qty)); dtl.setAssign_qty(BigDecimal.valueOf(assign_qty)); @@ -864,7 +914,7 @@ public class OutBillServiceImpl extends ServiceImpl i //根据单据标识判断明细是否都已经分配完成 int disCount = ioStorInvDtlMapper.selectCount(new LambdaQueryWrapper<>(IOStorInvDtl.class) .eq(IOStorInvDtl::getIostorinv_id,iostorinv_id) - .lt(IOStorInvDtl::getBill_status,IOSEnum.BILL_STATUS.code("分配完")) + .lt(IOStorInvDtl::getBill_status,IOSEnum.BILL_STATUS.code(OUT_BILL_STATUS_ASSIGNED)) ); // 根据分配货位情况 更新主表单据状态 @@ -873,7 +923,7 @@ public class OutBillServiceImpl extends ServiceImpl i ios.setUpdate_optid(currentUserId); ios.setUpdate_optname(nickName); ios.setUpdate_time(now); - ios.setBill_status(disCount>0 ? IOSEnum.BILL_STATUS.code("分配中") : IOSEnum.BILL_STATUS.code("分配完")); + ios.setBill_status(disCount>0 ? IOSEnum.BILL_STATUS.code(OUT_BILL_STATUS_ASSIGNING) : IOSEnum.BILL_STATUS.code(OUT_BILL_STATUS_ASSIGNED)); ioStorInvMapper.updateById(ios); } @@ -885,6 +935,8 @@ public class OutBillServiceImpl extends ServiceImpl i String now = DateUtil.now(); String iostorinv_id = whereJson.getString("iostorinv_id"); + IOStorInv ioStorInv = getOutBillOrThrow(iostorinv_id); + ensureOutBillStatus(ioStorInv, OUT_BILL_STATUS_AUDITED, OUT_BILL_STATUS_ASSIGNING, OUT_BILL_STATUS_ASSIGNED); List ioStorInvDisList = ioStorInvDisMapper.selectList(new LambdaQueryWrapper<>(IOStorInvDis.class) .le(IOStorInvDis::getWork_status,IOSEnum.INBILL_DIS_STATUS.code("未生成")) @@ -928,11 +980,11 @@ public class OutBillServiceImpl extends ServiceImpl i ioStorInvDtl.setAssign_qty(BigDecimal.valueOf(assign_qty)); ioStorInvDtl.setUnassign_qty(BigDecimal.valueOf(unassign_qty)); if (assign_qty == 0){ - ioStorInvDtl.setBill_status(IOSEnum.BILL_STATUS.code("生成")); + ioStorInvDtl.setBill_status(IOSEnum.BILL_STATUS.code(OUT_BILL_STATUS_AUDITED)); }else if (unassign_qty == 0){ - ioStorInvDtl.setBill_status(IOSEnum.BILL_STATUS.code("分配完")); + ioStorInvDtl.setBill_status(IOSEnum.BILL_STATUS.code(OUT_BILL_STATUS_ASSIGNED)); }else { - ioStorInvDtl.setBill_status(IOSEnum.BILL_STATUS.code("分配中")); + ioStorInvDtl.setBill_status(IOSEnum.BILL_STATUS.code(OUT_BILL_STATUS_ASSIGNING)); } ioStorInvDtlMapper.updateById(ioStorInvDtl); @@ -945,8 +997,8 @@ public class OutBillServiceImpl extends ServiceImpl i //根据单据标识判断明细是否都已经分配完成 int disCount = ioStorInvDtlMapper.selectCount(new LambdaQueryWrapper<>(IOStorInvDtl.class) .eq(IOStorInvDtl::getIostorinv_id,iostorinv_id) - .le(IOStorInvDtl::getBill_status,IOSEnum.BILL_STATUS.code("分配完")) - .gt(IOStorInvDtl::getBill_status,IOSEnum.BILL_STATUS.code("生成")) + .le(IOStorInvDtl::getBill_status,IOSEnum.BILL_STATUS.code(OUT_BILL_STATUS_ASSIGNED)) + .gt(IOStorInvDtl::getBill_status,IOSEnum.BILL_STATUS.code(OUT_BILL_STATUS_AUDITED)) ); // 根据分配货位情况 更新主表单据状态 @@ -955,7 +1007,7 @@ public class OutBillServiceImpl extends ServiceImpl i ios.setUpdate_optid(currentUserId); ios.setUpdate_optname(nickName); ios.setUpdate_time(now); - ios.setBill_status(disCount>0 ? IOSEnum.BILL_STATUS.code("分配中") : IOSEnum.BILL_STATUS.code("生成")); + ios.setBill_status(disCount>0 ? IOSEnum.BILL_STATUS.code(OUT_BILL_STATUS_ASSIGNING) : IOSEnum.BILL_STATUS.code(OUT_BILL_STATUS_AUDITED)); ioStorInvMapper.updateById(ios); } diff --git a/lms/nladmin-system/nlsso-server/src/main/resources/_sql/20260625_pdm_bd_workorder_add_audit_columns.sql b/lms/nladmin-system/nlsso-server/src/main/resources/_sql/20260625_pdm_bd_workorder_add_audit_columns.sql new file mode 100644 index 0000000..1ddd106 --- /dev/null +++ b/lms/nladmin-system/nlsso-server/src/main/resources/_sql/20260625_pdm_bd_workorder_add_audit_columns.sql @@ -0,0 +1,4 @@ +ALTER TABLE `pdm_bd_workorder` +ADD COLUMN `audit_id` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NULL DEFAULT NULL COMMENT '审核人' AFTER `workshop_code`, +ADD COLUMN `audit_name` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NULL DEFAULT NULL COMMENT '审核人姓名' AFTER `audit_id`, +ADD COLUMN `audit_time` varchar(25) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NULL DEFAULT NULL COMMENT '审核时间' AFTER `audit_name`; diff --git a/lms/nladmin-system/nlsso-server/src/main/resources/_sql/20260630_st_ivt_iostorinv_add_audit_columns.sql b/lms/nladmin-system/nlsso-server/src/main/resources/_sql/20260630_st_ivt_iostorinv_add_audit_columns.sql new file mode 100644 index 0000000..1e62ff2 --- /dev/null +++ b/lms/nladmin-system/nlsso-server/src/main/resources/_sql/20260630_st_ivt_iostorinv_add_audit_columns.sql @@ -0,0 +1,4 @@ +ALTER TABLE `st_ivt_iostorinv` +ADD COLUMN `audit_optid` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NULL DEFAULT NULL COMMENT '审核人' AFTER `update_time`, +ADD COLUMN `audit_optname` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NULL DEFAULT NULL COMMENT '审核人姓名' AFTER `audit_optid`, +ADD COLUMN `audit_time` varchar(25) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NULL DEFAULT NULL COMMENT '审核时间' AFTER `audit_optname`; diff --git a/lms/nladmin-ui/src/views/wms/st/outbill/DivDialog.vue b/lms/nladmin-ui/src/views/wms/st/outbill/DivDialog.vue index 9f6facb..f61c378 100644 --- a/lms/nladmin-ui/src/views/wms/st/outbill/DivDialog.vue +++ b/lms/nladmin-ui/src/views/wms/st/outbill/DivDialog.vue @@ -382,18 +382,22 @@ export default { this.form2.unassign_qty = current.unassign_qty this.form2.assign_qty = current.assign_qty this.tabledis = [] - if (current.bill_status === '10') { + if (current.bill_status === '15') { this.button1 = false this.button2 = true this.button3 = false - } else if (current.bill_status === '30') { + } else if (current.bill_status === '20') { this.button1 = false this.button2 = false this.button3 = false - } else if (current.bill_status === '40') { + } else if (current.bill_status === '30') { this.button1 = true this.button2 = false this.button3 = true + } else { + this.button1 = true + this.button2 = true + this.button3 = true } this.queryTableDdis(current.iostorinvdtl_id) } else { diff --git a/lms/nladmin-ui/src/views/wms/st/outbill/checkoutbill.js b/lms/nladmin-ui/src/views/wms/st/outbill/checkoutbill.js index 4287804..eba8e29 100644 --- a/lms/nladmin-ui/src/views/wms/st/outbill/checkoutbill.js +++ b/lms/nladmin-ui/src/views/wms/st/outbill/checkoutbill.js @@ -38,6 +38,13 @@ export function getOutBillDis(params) { params }) } +export function audit(data) { + return request({ + url: '/api/checkoutbill/audit', + method: 'post', + data + }) +} export function allDiv(data) { return request({ url: '/api/checkoutbill/allDiv', @@ -116,4 +123,4 @@ export function outReturn(data) { }) } -export default { add, edit, del, allDiv, allCancel, getOutBillDtl, getOutBillDis, autoCancel, getStructIvt, manualDiv, confirm, allDivOne, getOutBillTask, oneCancel, allSetPoint, outReturn } +export default { add, edit, del, audit, allDiv, allCancel, getOutBillDtl, getOutBillDis, autoCancel, getStructIvt, manualDiv, confirm, allDivOne, getOutBillTask, oneCancel, allSetPoint, outReturn } diff --git a/lms/nladmin-ui/src/views/wms/st/outbill/index.vue b/lms/nladmin-ui/src/views/wms/st/outbill/index.vue index 9cedadc..d495081 100644 --- a/lms/nladmin-ui/src/views/wms/st/outbill/index.vue +++ b/lms/nladmin-ui/src/views/wms/st/outbill/index.vue @@ -118,6 +118,18 @@ + + 审核 + + + @@ -249,7 +263,9 @@ export default { confirm: ['admin', 'checkoutbill:confirm'] }, loadingConfirm: false, + loadingAudit: false, divShow: false, + audit_flag: true, dis_flag: true, confirm_flag: true, business_confirm_flag: true, @@ -334,12 +350,13 @@ export default { buttonChange(current) { if (current !== null) { this.currentRow = current - if (current.bill_status === '10' || current.bill_status === '20' || current.bill_status === '30' || current.bill_status === '40') { + this.audit_flag = current.bill_status !== '10' + if (current.bill_status === '15' || current.bill_status === '20' || current.bill_status === '30') { this.dis_flag = false } else { this.dis_flag = true } - if (current.bill_status === '50' || current.bill_status === '40' || current.bill_status === '30') { + if (current.bill_status === '30') { this.confirm_flag = false } else { this.confirm_flag = true @@ -349,7 +366,7 @@ export default { } else { this.business_confirm_flag = true } - if (current.bill_status === '40' || current.bill_status === '30') { + if (current.bill_status === '30') { this.outReturn_flag = false } else { this.outReturn_flag = true @@ -370,6 +387,7 @@ export default { }, handleCurrentChange(current) { if (current === null) { + this.audit_flag = true this.dis_flag = true this.confirm_flag = true this.outReturn_flag = true @@ -387,6 +405,16 @@ export default { this.mstrow = this.currentRow }) }, + audit() { + this.loadingAudit = true + checkoutbill.audit({ 'iostorinv_id': this.currentRow.iostorinv_id }).then(() => { + this.querytable() + this.crud.notify('审核成功!', CRUD.NOTIFICATION_TYPE.SUCCESS) + this.loadingAudit = false + }).catch(() => { + this.loadingAudit = false + }) + }, confirm() { this.loadingConfirm = true checkoutbill.confirm({ 'iostorinv_id': this.currentRow.iostorinv_id }).then(res => {