From f02a6b9b98a10f82bb2c021e62bfe171941edbff Mon Sep 17 00:00:00 2001 From: ldj_willow Date: Tue, 8 Nov 2022 14:42:32 +0800 Subject: [PATCH 1/3] =?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 --- .../java/org/nl/acs/autotask/CleanLog.java | 2 +- .../satoken/TokenKeyExpirationListener.java | 51 ------------------- acs/nladmin-ui/src/settings.js | 2 +- .../satoken/TokenKeyExpirationListener.java | 51 ------------------- lms/nladmin-ui/src/settings.js | 2 +- 5 files changed, 3 insertions(+), 105 deletions(-) delete mode 100644 acs/nladmin-system/src/main/java/org/nl/modules/security/satoken/TokenKeyExpirationListener.java delete mode 100644 lms/nladmin-system/src/main/java/org/nl/modules/security/satoken/TokenKeyExpirationListener.java diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/autotask/CleanLog.java b/acs/nladmin-system/src/main/java/org/nl/acs/autotask/CleanLog.java index 3d82c433b..84d708436 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/autotask/CleanLog.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/autotask/CleanLog.java @@ -1,4 +1,4 @@ -package org.nl.wms.autotask; +package org.nl.acs.autotask; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; diff --git a/acs/nladmin-system/src/main/java/org/nl/modules/security/satoken/TokenKeyExpirationListener.java b/acs/nladmin-system/src/main/java/org/nl/modules/security/satoken/TokenKeyExpirationListener.java deleted file mode 100644 index 77377246e..000000000 --- a/acs/nladmin-system/src/main/java/org/nl/modules/security/satoken/TokenKeyExpirationListener.java +++ /dev/null @@ -1,51 +0,0 @@ -package org.nl.modules.security.satoken; - - -import lombok.extern.slf4j.Slf4j; -import org.nl.modules.mnt.websocket.MsgType; -import org.nl.modules.mnt.websocket.SocketMsg; -import org.nl.modules.mnt.websocket.WebSocketServer; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.data.redis.connection.Message; -import org.springframework.data.redis.core.StringRedisTemplate; -import org.springframework.data.redis.listener.KeyExpirationEventMessageListener; -import org.springframework.data.redis.listener.RedisMessageListenerContainer; -import org.springframework.stereotype.Component; - -import java.io.IOException; -import java.nio.charset.StandardCharsets; - -/** - * @author: lyd - * @description: - * @Date: 2022/10/8 - */ -@Slf4j -@Component -public class TokenKeyExpirationListener extends KeyExpirationEventMessageListener { - @Autowired - private StringRedisTemplate redisTemplate; - - public TokenKeyExpirationListener(RedisMessageListenerContainer listenerContainer) { - super(listenerContainer); - } - - @Override - public void onMessage(Message message, byte[] pattern) { - // 监听过期的key - String expireKey = new String(message.getBody(), StandardCharsets.UTF_8); - //获取key原本的value 获取不到 是null - String expireKeyValue = redisTemplate.opsForValue().get("my-satoken"); - //我是根据tokenvalues作为主键ID的 - String[] split = expireKey.split(":"); - String s = split[split.length - 1]; - try { - WebSocketServer.sendInfo(new SocketMsg("token会话过期!", MsgType.INFO), "exp-token"); - } catch (IOException e) { - log.error(e.getMessage(), e); - } - log.info("expireKey---"+expireKey); - log.info("expireKeyValue---"+expireKeyValue); - } - -} diff --git a/acs/nladmin-ui/src/settings.js b/acs/nladmin-ui/src/settings.js index 1d46e5ebf..91fbaf4d9 100644 --- a/acs/nladmin-ui/src/settings.js +++ b/acs/nladmin-ui/src/settings.js @@ -40,7 +40,7 @@ module.exports = { /** * @description token key */ - TokenKey: 'EL-ADMIN-TOEKN', + TokenKey: 'NL-ACS-TOEKN', /** * @description 请求超时时间,毫秒(默认2分钟) */ diff --git a/lms/nladmin-system/src/main/java/org/nl/modules/security/satoken/TokenKeyExpirationListener.java b/lms/nladmin-system/src/main/java/org/nl/modules/security/satoken/TokenKeyExpirationListener.java deleted file mode 100644 index 77377246e..000000000 --- a/lms/nladmin-system/src/main/java/org/nl/modules/security/satoken/TokenKeyExpirationListener.java +++ /dev/null @@ -1,51 +0,0 @@ -package org.nl.modules.security.satoken; - - -import lombok.extern.slf4j.Slf4j; -import org.nl.modules.mnt.websocket.MsgType; -import org.nl.modules.mnt.websocket.SocketMsg; -import org.nl.modules.mnt.websocket.WebSocketServer; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.data.redis.connection.Message; -import org.springframework.data.redis.core.StringRedisTemplate; -import org.springframework.data.redis.listener.KeyExpirationEventMessageListener; -import org.springframework.data.redis.listener.RedisMessageListenerContainer; -import org.springframework.stereotype.Component; - -import java.io.IOException; -import java.nio.charset.StandardCharsets; - -/** - * @author: lyd - * @description: - * @Date: 2022/10/8 - */ -@Slf4j -@Component -public class TokenKeyExpirationListener extends KeyExpirationEventMessageListener { - @Autowired - private StringRedisTemplate redisTemplate; - - public TokenKeyExpirationListener(RedisMessageListenerContainer listenerContainer) { - super(listenerContainer); - } - - @Override - public void onMessage(Message message, byte[] pattern) { - // 监听过期的key - String expireKey = new String(message.getBody(), StandardCharsets.UTF_8); - //获取key原本的value 获取不到 是null - String expireKeyValue = redisTemplate.opsForValue().get("my-satoken"); - //我是根据tokenvalues作为主键ID的 - String[] split = expireKey.split(":"); - String s = split[split.length - 1]; - try { - WebSocketServer.sendInfo(new SocketMsg("token会话过期!", MsgType.INFO), "exp-token"); - } catch (IOException e) { - log.error(e.getMessage(), e); - } - log.info("expireKey---"+expireKey); - log.info("expireKeyValue---"+expireKeyValue); - } - -} diff --git a/lms/nladmin-ui/src/settings.js b/lms/nladmin-ui/src/settings.js index 1d46e5ebf..860639a7a 100644 --- a/lms/nladmin-ui/src/settings.js +++ b/lms/nladmin-ui/src/settings.js @@ -40,7 +40,7 @@ module.exports = { /** * @description token key */ - TokenKey: 'EL-ADMIN-TOEKN', + TokenKey: 'NL-LMS-TOEKN', /** * @description 请求超时时间,毫秒(默认2分钟) */ From 714b2231eececbac6951759dfe157dafc3dc0818 Mon Sep 17 00:00:00 2001 From: ldj_willow Date: Tue, 8 Nov 2022 14:56:23 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E6=97=A5=E5=BF=97=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- acs/nladmin-system/src/main/resources/logback-spring.xml | 2 +- lms/nladmin-system/src/main/resources/logback-spring.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/acs/nladmin-system/src/main/resources/logback-spring.xml b/acs/nladmin-system/src/main/resources/logback-spring.xml index 0494228ea..4edd8e564 100644 --- a/acs/nladmin-system/src/main/resources/logback-spring.xml +++ b/acs/nladmin-system/src/main/resources/logback-spring.xml @@ -12,7 +12,7 @@ https://juejin.cn/post/6844903775631572999 nlAdmin + value="%black(%contextName-) %red(%d{yyyy-MM-dd HH:mm:ss.SSS}) %green([%thread]) %highlight(%-5level) %boldMagenta(%logger{36}) - %gray(%msg%n)"/> diff --git a/lms/nladmin-system/src/main/resources/logback-spring.xml b/lms/nladmin-system/src/main/resources/logback-spring.xml index dbc1dedb5..3e68ee79f 100644 --- a/lms/nladmin-system/src/main/resources/logback-spring.xml +++ b/lms/nladmin-system/src/main/resources/logback-spring.xml @@ -12,7 +12,7 @@ https://juejin.cn/post/6844903775631572999 nlAdmin + value="%black(%contextName-) %red(%d{yyyy-MM-dd HH:mm:ss.SSS}) %green([%thread]) %highlight(%-5level) %boldMagenta(%logger{36}) - %gray(%msg%n)"/> From 73166ee2e9590e53313b6deafe1a1f6b78019061 Mon Sep 17 00:00:00 2001 From: liuxy Date: Wed, 9 Nov 2022 09:02:35 +0800 Subject: [PATCH 3/3] =?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 --- .../wms/st/instor/rest/CheckController.java | 28 +-- .../wms/st/instor/service/CheckService.java | 4 +- .../instor/service/impl/CheckServiceImpl.java | 213 +++++++++--------- .../nl/wms/st/instor/wql/QST_IVT_CHECK.wql | 85 ++++--- .../views/wms/st/inStor/check/AddDialog.vue | 15 +- .../src/views/wms/st/inStor/check/AddDtl.vue | 7 +- .../views/wms/st/inStor/check/CheckDialog.vue | 43 ++-- .../src/views/wms/st/inStor/check/index.vue | 27 ++- 8 files changed, 208 insertions(+), 214 deletions(-) diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/st/instor/rest/CheckController.java b/lms/nladmin-system/src/main/java/org/nl/wms/st/instor/rest/CheckController.java index a0d92f2d4..eb2ca4d72 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/st/instor/rest/CheckController.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/st/instor/rest/CheckController.java @@ -25,8 +25,8 @@ public class CheckController { private final CheckService checkService; @GetMapping - @Log("查询手工移库单") - @ApiOperation("查询手工移库单") + @Log("查询盘点单") + @ApiOperation("查询盘点单") public ResponseEntity query(@RequestParam Map whereJson, Pageable page){ return new ResponseEntity<>(checkService.pageQuery(whereJson,page), HttpStatus.OK); } @@ -39,8 +39,8 @@ public class CheckController { } @GetMapping("/getOutBillDtl2") - @Log("查询移库单") - @ApiOperation("查询移库单") + @Log("查询盘点单明细2") + @ApiOperation("查询盘点单明细2") public ResponseEntity getOutBillDtl2(@RequestParam Map whereJson){ return new ResponseEntity<>(checkService.getOutBillDtl2(whereJson), HttpStatus.OK); } @@ -60,28 +60,28 @@ public class CheckController { } @PutMapping - @Log("修改移库单") - @ApiOperation("修改移库单") - public ResponseEntity update(@RequestBody Map whereJson){ + @Log("修改盘点单") + @ApiOperation("修改盘点单") + public ResponseEntity update(@RequestBody JSONObject whereJson){ checkService.update(whereJson); return new ResponseEntity<>(HttpStatus.NO_CONTENT); } @PostMapping() - @Log("新增移库单") - @ApiOperation("新增移库单") - public ResponseEntity insertDtl(@RequestBody Map whereJson){ + @Log("新增盘点单") + @ApiOperation("新增盘点单") + public ResponseEntity insertDtl(@RequestBody JSONObject whereJson){ checkService.insertDtl(whereJson); return new ResponseEntity<>(HttpStatus.CREATED); } @GetMapping("/getStructIvt") - @Log("查询可分配库存") - @ApiOperation("查询可分配库存") + @Log("查询可盘点库存") + @ApiOperation("查询可盘点库存") public ResponseEntity getStructIvt(@RequestParam Map whereJson, Pageable page){ return new ResponseEntity<>(checkService.getStructIvt(whereJson,page), HttpStatus.OK); } @PostMapping("/confirm") - @Log("移库单强制确认") - @ApiOperation("移库单强制确认") + @Log("盘点确定") + @ApiOperation("盘点确定") public ResponseEntity confirm(@RequestBody JSONObject whereJson) { checkService.confirm(whereJson); return new ResponseEntity<>(HttpStatus.NO_CONTENT); diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/st/instor/service/CheckService.java b/lms/nladmin-system/src/main/java/org/nl/wms/st/instor/service/CheckService.java index 8e39d4e73..dd807de67 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/st/instor/service/CheckService.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/st/instor/service/CheckService.java @@ -27,7 +27,7 @@ public interface CheckService { * 新增出库单 * @param whereJson / */ - void insertDtl (Map whereJson); + void insertDtl (JSONObject whereJson); /** * 查询出库单明细 * @param whereJson / @@ -46,7 +46,7 @@ public interface CheckService { * 修改出库单 * @param whereJson / */ - void update(Map whereJson); + void update(JSONObject whereJson); /** * 查询可分配库存 * @param whereJson / diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/st/instor/service/impl/CheckServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/st/instor/service/impl/CheckServiceImpl.java index 0999b035c..574ec5133 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/st/instor/service/impl/CheckServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/st/instor/service/impl/CheckServiceImpl.java @@ -97,36 +97,57 @@ public class CheckServiceImpl implements CheckService { @Override @Transactional(rollbackFor = Exception.class) - public void insertDtl(Map map) { - //主表 - WQLObject wo_mst = WQLObject.getWQLObject("ST_IVT_CheckMst"); + public void insertDtl(JSONObject jsonObject) { - ArrayList rows = (ArrayList) map.get("tableData"); - map.remove("tableData"); + WQLObject mstTab = WQLObject.getWQLObject("ST_IVT_CheckMst"); // 盘点单主表 + WQLObject dtlTab = WQLObject.getWQLObject("ST_IVT_CheckDtl"); // 盘点单明细表 + + JSONArray dtlArr = jsonObject.getJSONArray("tableData"); Long currentUserId = SecurityUtils.getCurrentUserId(); String nickName = SecurityUtils.getCurrentNickName(); - String now = DateUtil.now(); - String check_id = IdUtil.getSnowflake(1, 1).nextId() + ""; - String check_code = CodeUtil.getNewCode("PD_CODE"); - map.put("check_id", check_id); - map.put("check_code", check_code); - map.put("buss_type", ""); - map.put("create_mode", "01"); - map.put("input_optid", currentUserId + ""); - map.put("input_optname", nickName); - map.put("input_time", now); - map.put("update_optid", currentUserId + ""); - map.put("update_optname", nickName); - map.put("update_time", now); - map.put("is_delete", "0"); - map.put("is_upload", "0"); Long deptId = SecurityUtils.getDeptId(); - map.put("sysdeptid", deptId); - map.put("syscompanyid", deptId); - JSONObject jo_mst = JSONObject.parseObject(JSON.toJSONString(map)); - //调用明细处理方法 - this.insertDtlByRows(jo_mst, rows); - wo_mst.insert(map); + + // 插入主表 + JSONObject jsonMst = new JSONObject(); + jsonMst.put("check_id", IdUtil.getSnowflake(1,1).nextId()); + jsonMst.put("check_code", CodeUtil.getNewCode("PD_CODE")); + jsonMst.put("buss_type", jsonObject.getString("check_type")); + jsonMst.put("check_type", jsonObject.getString("check_type")); + jsonMst.put("stor_id", jsonObject.getLongValue("stor_id")); + jsonMst.put("stor_name", jsonObject.getString("stor_name")); + jsonMst.put("dtl_num", dtlArr.size()); + jsonMst.put("create_mode", "01"); + jsonMst.put("is_nok", "0"); + jsonMst.put("input_optid", currentUserId); + jsonMst.put("input_optname", nickName); + jsonMst.put("input_time", DateUtil.now()); + jsonMst.put("remark", jsonObject.getString("remark")); + jsonMst.put("status", "1"); + jsonMst.put("sysdeptid", deptId); + jsonMst.put("syscompanyid", deptId); + mstTab.insert(jsonMst); + + // 插入明细 + for (int i = 0; i < dtlArr.size(); i++) { + JSONObject json = dtlArr.getJSONObject(i); + JSONObject jsonDtl = new JSONObject(); + jsonDtl.put("checkdtl_id", IdUtil.getSnowflake(1,1).nextId()); + jsonDtl.put("check_id", jsonMst.getLongValue("check_id")); + jsonDtl.put("check_code", jsonMst.getString("check_code")); + jsonDtl.put("seq_no", i+1); + jsonDtl.put("sect_id", json.getLongValue("sect_id")); + jsonDtl.put("sect_name", json.getString("sect_name")); + jsonDtl.put("struct_id", json.getLongValue("struct_id")); + jsonDtl.put("struct_name", json.getString("struct_name")); + jsonDtl.put("storagevehicle_code", json.getString("storagevehicle_code")); + jsonDtl.put("material_id", json.getLongValue("material_id")); + jsonDtl.put("base_qty", json.getDoubleValue("base_qty")); + jsonDtl.put("qty_unit_id", json.getLongValue("measure_unit_id")); + jsonDtl.put("qty_unit_name", json.getString("qty_unit_name")); + jsonDtl.put("status", "1"); + jsonDtl.put("fac_qty", json.getDoubleValue("fac_qty")); + dtlTab.insert(jsonDtl); + } } /** @@ -152,19 +173,6 @@ public class CheckServiceImpl implements CheckService { row.put("is_down", "0"); wo_dtl.insert(row); } - - //锁定起点点位、仓位 - Iterator it = set.iterator(); - JSONObject from_start = new JSONObject(); - from_start.put("lock_type", "02"); - for (; it.hasNext(); ) { - String struct_id = it.next(); - from_start.put("struct_id", struct_id); - from_start.put("inv_type", jo_mst.getString("check_type")); - from_start.put("inv_id", jo_mst.getString("check_id")); - from_start.put("inv_code", jo_mst.getString("check_code")); - storPublicService.updateStructAndPoint(from_start); - } } @Override @@ -199,30 +207,46 @@ public class CheckServiceImpl implements CheckService { @Override @Transactional(rollbackFor = Exception.class) - public void update(Map whereJson) { - //主表 - WQLObject wo_mst = WQLObject.getWQLObject("ST_IVT_CheckMst"); + public void update(JSONObject jsonObject) { + WQLObject mstTab = WQLObject.getWQLObject("ST_IVT_CheckMst"); // 盘点单主表 + WQLObject dtlTab = WQLObject.getWQLObject("ST_IVT_CheckDtl"); // 盘点单明细表 - Long currentUserId = SecurityUtils.getCurrentUserId(); - String nickName = SecurityUtils.getCurrentNickName(); - String now = DateUtil.now(); - String check_id = (String) whereJson.get("check_id"); - //查询主表 - JSONObject jo_mst = wo_mst.query("check_id='" + check_id + "'").uniqueResult(0); - //调用删除明细,还原库存方法 - this.deleteById(check_id + ""); - //获取明细 - ArrayList rows = (ArrayList) whereJson.get("tableData"); - //调用明细处理方法 - this.insertDtlByRows(jo_mst, rows); - jo_mst.put("remark", whereJson.get("remark")); - jo_mst.put("dtl_num", whereJson.get("dtl_num")); - jo_mst.put("check_type", whereJson.get("check_type")); - jo_mst.put("update_optid", currentUserId + ""); - jo_mst.put("update_optname", nickName); - jo_mst.put("update_time", now); - //更新主表 - wo_mst.update(jo_mst); + JSONArray dtlArr = jsonObject.getJSONArray("tableData"); + + // 插入主表 + JSONObject jsonMst = mstTab.query("check_id = '" + jsonObject.getString("check_id") + "'").uniqueResult(0); + jsonMst.put("buss_type", jsonObject.getString("check_type")); + jsonMst.put("check_type", jsonObject.getString("check_type")); + jsonMst.put("stor_id", jsonObject.getLongValue("stor_id")); + jsonMst.put("stor_name", jsonObject.getString("stor_name")); + jsonMst.put("dtl_num", dtlArr.size()); + jsonMst.put("create_mode", "01"); + jsonMst.put("remark", jsonObject.getString("remark")); + jsonMst.put("status", "1"); + mstTab.update(jsonMst); + + // 插入明细 + dtlTab.delete("check_id = '"+jsonObject.getString("check_id")+"'"); + for (int i = 0; i < dtlArr.size(); i++) { + JSONObject json = dtlArr.getJSONObject(i); + JSONObject jsonDtl = new JSONObject(); + jsonDtl.put("checkdtl_id", IdUtil.getSnowflake(1,1).nextId()); + jsonDtl.put("check_id", jsonMst.getLongValue("check_id")); + jsonDtl.put("check_code", jsonMst.getString("check_code")); + jsonDtl.put("seq_no", i+1); + jsonDtl.put("sect_id", json.getLongValue("sect_id")); + jsonDtl.put("sect_name", json.getString("sect_name")); + jsonDtl.put("struct_id", json.getLongValue("struct_id")); + jsonDtl.put("struct_name", json.getString("struct_name")); + jsonDtl.put("storagevehicle_code", json.getString("storagevehicle_code")); + jsonDtl.put("material_id", json.getLongValue("material_id")); + jsonDtl.put("base_qty", json.getDoubleValue("base_qty")); + jsonDtl.put("qty_unit_id", json.getLongValue("measure_unit_id")); + jsonDtl.put("qty_unit_name", json.getString("qty_unit_name")); + jsonDtl.put("status", "1"); + jsonDtl.put("fac_qty", json.getDoubleValue("fac_qty")); + dtlTab.insert(jsonDtl); + } } @Override @@ -236,7 +260,7 @@ public class CheckServiceImpl implements CheckService { } JSONObject jo = WQL.getWO("QST_IVT_CHECK") .addParam("flag", "3") - .addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "struct.struct_id,struct.storagevehicle_code"); + .addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "struct.struct_code"); return jo; } @@ -254,55 +278,51 @@ public class CheckServiceImpl implements CheckService { String nickName = SecurityUtils.getCurrentNickName(); String now = DateUtil.now(); - JSONObject jo_mst = wo_mst.query("status in ('10','30') and check_id='" + form.getString("check_id") + "'").uniqueResult(0); + JSONObject jo_mst = wo_mst.query("status in ('1','3') and check_id='" + form.getString("check_id") + "'").uniqueResult(0); if (jo_mst == null) { throw new BadRequestException("盘点单状态异常!"); } - wo_dtl.delete("status in ('01','04') and check_id='" + form.getString("check_id") + "'"); + wo_dtl.delete("status in ('1','2') and check_id='" + form.getString("check_id") + "'"); //定义需要需要更新的的点位集合 - HashSet set = new HashSet<>(); for (int i = 0; i < rows.size(); i++) { JSONObject jo = rows.getJSONObject(i); String status = jo.getString("status"); double base_qty = jo.getDoubleValue("base_qty"); jo.put("seq_no", "" + (i + 1)); - set.add(jo.getString("struct_id")); //已盘点过的明细不再处理 - if ("05,06,07,99".contains(status)) { + if ("3,4,5,99".contains(status)) { wo_dtl.update(jo); continue; } - jo.put("status", "05"); + jo.put("status", "3"); jo.put("check_optid", currentUserId); jo.put("check_optname", nickName); jo.put("check_time", now); double fac_qty = jo.getDoubleValue("fac_qty"); //判断盈亏 if (fac_qty > base_qty) { - jo.put("check_result", "2"); + jo.put("check_result", "3"); } else if (fac_qty < base_qty) { - jo.put("check_result", "1"); + jo.put("check_result", "2"); } else { jo.put("status", "99"); - jo.put("check_result", "0"); - } - if (StrUtil.isEmpty(jo.getString("checkdtl_id"))) { - String checkdtl_id = IdUtil.getSnowflake(1, 1).nextId() + ""; - jo.put("checkdtl_id", checkdtl_id); + jo.put("check_result", "1"); } wo_dtl.insert(jo); } jo_mst.put("dtl_num", rows.size()); - jo_mst.put("status", "30"); + jo_mst.put("status", "3"); jo_mst.put("is_nok", "0"); - JSONArray ja_nok = wo_dtl.query("check_result <>'0' and check_id='" + form.getString("check_id") + "'").getResultJSONArray(0); + JSONArray ja_nok = wo_dtl.query("check_result <>'1' and check_id='" + form.getString("check_id") + "'").getResultJSONArray(0); if (ja_nok.size() != 0) { jo_mst.put("is_nok", "1"); } - JSONArray ja = wo_dtl.query("status in ('99','07') and check_id='" + form.getString("check_id") + "'").getResultJSONArray(0); + + JSONArray ja = wo_dtl.query("status in ('99') and check_id='" + form.getString("check_id") + "'").getResultJSONArray(0); //说明全部确认 if (ja.size() == jo_mst.getInteger("dtl_num")) { HashMap mapdtl = new HashMap<>(); + mapdtl.put("status", "99"); wo_dtl.update(mapdtl, "check_id='" + form.getString("check_id") + "'"); @@ -310,15 +330,6 @@ public class CheckServiceImpl implements CheckService { jo_mst.put("confirm_optid", currentUserId); jo_mst.put("confirm_optname", nickName); jo_mst.put("confirm_time", now); - //锁定起点点位、仓位 - Iterator it = set.iterator(); - JSONObject from_start = new JSONObject(); - from_start.put("lock_type", "00"); - for (; it.hasNext(); ) { - String struct_id = it.next(); - from_start.put("struct_id", struct_id); - storPublicService.updateStructAndPoint(from_start); - } } wo_mst.update(jo_mst); } @@ -387,48 +398,48 @@ public class CheckServiceImpl implements CheckService { JSONObject form = whereJson.getJSONObject("row"); JSONArray rows = whereJson.getJSONArray("rows"); + Long currentUserId = SecurityUtils.getCurrentUserId(); String nickName = SecurityUtils.getCurrentNickName(); String now = DateUtil.now(); - JSONObject jo_mst = wo_mst.query("status in ('10','30') and check_id='" + form.getString("check_id") + "'").uniqueResult(0); + JSONObject jo_mst = wo_mst.query("status in ('1','3') and check_id='" + form.getString("check_id") + "'").uniqueResult(0); if (jo_mst == null) { throw new BadRequestException("盘点单状态异常!"); } - wo_dtl.delete("status in ('01','04') and check_id='" + form.getString("check_id") + "'"); + wo_dtl.delete("status in ('1','2') and check_id='" + form.getString("check_id") + "'"); + for (int i = 0; i < rows.size(); i++) { JSONObject jo = rows.getJSONObject(i); String status = jo.getString("status"); double base_qty = jo.getDoubleValue("base_qty"); jo.put("seq_no", "" + (i + 1)); //已盘点过的明细不再处理 - if ("05,06,07,99".contains(status)) { + if ("3,4,5,99".contains(status)) { wo_dtl.update(jo); continue; } - jo.put("status", "04"); + jo.put("status", "2"); jo.put("check_optid", currentUserId); jo.put("check_optname", nickName); jo.put("check_time", now); double fac_qty = jo.getDoubleValue("fac_qty"); //判断盈亏 if (fac_qty > base_qty) { - jo.put("check_result", "2"); + jo.put("check_result", "3"); } else if (fac_qty < base_qty) { - jo.put("check_result", "1"); + jo.put("check_result", "2"); } else { - jo.put("check_result", "0"); - } - if (StrUtil.isEmpty(jo.getString("checkdtl_id"))) { - String checkdtl_id = IdUtil.getSnowflake(1, 1).nextId() + ""; - jo.put("checkdtl_id", checkdtl_id); + jo.put("check_result", "1"); } + wo_dtl.insert(jo); } jo_mst.put("dtl_num", rows.size()); - jo_mst.put("status", "30"); + jo_mst.put("status", "3"); jo_mst.put("is_nok", "0"); - JSONArray ja_nok = wo_dtl.query("check_result <>'0' and check_id='" + form.getString("check_id") + "'").getResultJSONArray(0); + + JSONArray ja_nok = wo_dtl.query("check_result <>'1' and check_id='" + form.getString("check_id") + "'").getResultJSONArray(0); if (ja_nok.size() != 0) { jo_mst.put("is_nok", "1"); } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/st/instor/wql/QST_IVT_CHECK.wql b/lms/nladmin-system/src/main/java/org/nl/wms/st/instor/wql/QST_IVT_CHECK.wql index d94d9e04e..755de960b 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/st/instor/wql/QST_IVT_CHECK.wql +++ b/lms/nladmin-system/src/main/java/org/nl/wms/st/instor/wql/QST_IVT_CHECK.wql @@ -69,35 +69,40 @@ FROM ST_IVT_CheckMst checkmst WHERE - 1 = 1 - AND checkmst.is_delete = '0' + checkmst.is_delete = '0' + OPTION 输入.check_code <> "" checkmst.check_code like 输入.check_code ENDOPTION + OPTION 输入.buss_type <> "" - checkmst.buss_type like 输入.buss_type + checkmst.buss_type = 输入.buss_type ENDOPTION + OPTION 输入.check_type <> "" checkmst.check_type = 输入.check_type ENDOPTION + OPTION 输入.stor_id <> "" checkmst.stor_id = 输入.stor_id ENDOPTION - OPTION 输入.deptIds <> "" - checkmst.sysdeptid in 输入.deptIds - ENDOPTION + OPTION 输入.create_mode <> "" checkmst.create_mode = 输入.create_mode ENDOPTION + OPTION 输入.status <> "" checkmst.status = 输入.status ENDOPTION + OPTION 输入.begin_time <> "" checkmst.input_time >= 输入.begin_time ENDOPTION + OPTION 输入.end_time <> "" checkmst.input_time <= 输入.end_time ENDOPTION + ENDSELECT ENDPAGEQUERY ENDIF @@ -135,61 +140,47 @@ IF 输入.flag = "3" PAGEQUERY SELECT - bucketcopy.material_id, - bucketcopy.base_qty, - bucketcopy.storage_qty, - '42' AS qty_unit_id, - '桶' AS qty_unit_name, - mb.material_code, - mb.material_name, - struct.struct_id, - struct.struct_code, - struct.struct_name, - struct.sect_id, - struct.sect_code, - struct.sect_name, - struct.storagevehicle_id, - struct.storagevehicle_code + struct.sect_id, + struct.sect_code, + struct.sect_name, + struct.struct_id, + struct.struct_code, + struct.struct_name, + struct.storagevehicle_code, + mb.material_id, + mb.material_name, + mb.material_code, + '1' AS base_qty, + '0' AS fac_qty, + '箱' AS qty_unit_name, + '1585604690706567168' AS measure_unit_id FROM - st_ivt_structattr struct - INNER JOIN ( - SELECT - bucket.storagevehicle_code, - bucket.material_id, - sum(bucket.storage_qty) AS storage_qty, - COUNT(bucket.bucketunique) AS base_qty - FROM - MD_PB_BucketRecord bucket - WHERE - 1 = 1 - AND bucket.storage_qty > 0 - GROUP BY - bucket.storagevehicle_code, - bucket.material_id - ) bucketcopy ON bucketcopy.storagevehicle_code = struct.storagevehicle_code - LEFT JOIN md_me_materialbase mb ON mb.material_id = bucketcopy.material_id + st_ivt_structivt ivt + LEFT JOIN st_ivt_structattr struct ON ivt.struct_id = struct.struct_id + LEFT JOIN md_me_materialbase mb ON mb.material_id = ivt.material_id WHERE 1 = 1 - AND struct.lock_type = '00' - AND struct.storagevehicle_id > 0 - OPTION 输入.material_id <> "" - bucketcopy.material_id = 输入.material_id - ENDOPTION + AND struct.lock_type = '1' + AND IFNULL(struct.storagevehicle_code,'') <> '' + OPTION 输入.remark <> "" (mb.material_code like 输入.remark or mb.material_name like 输入.remark) ENDOPTION - OPTION 输入.ids <> "" - struct.storagevehicle_code in (输入.ids) - ENDOPTION + OPTION 输入.struct_code <> "" struct.struct_code like 输入.struct_code ENDOPTION + OPTION 输入.stor_id <> "" struct.stor_id = 输入.stor_id ENDOPTION + OPTION 输入.sect_id <> "" struct.sect_id = 输入.sect_id ENDOPTION + + group by ivt.struct_id + ENDSELECT ENDPAGEQUERY ENDIF @@ -347,7 +338,7 @@ CheckDtl.qty_unit_name, CheckDtl.STATUS, CheckDtl.is_down, - ( CASE WHEN CheckDtl.fac_qty IS NULL OR CheckDtl.fac_qty = '' THEN CheckDtl.base_qty ELSE CheckDtl.fac_qty END ) AS fac_qty, + CheckDtl.fac_qty, CheckDtl.check_result, CheckDtl.check_optid, CheckDtl.check_optname, diff --git a/lms/nladmin-ui/src/views/wms/st/inStor/check/AddDialog.vue b/lms/nladmin-ui/src/views/wms/st/inStor/check/AddDialog.vue index 8c0fbdab2..992a822de 100644 --- a/lms/nladmin-ui/src/views/wms/st/inStor/check/AddDialog.vue +++ b/lms/nladmin-ui/src/views/wms/st/inStor/check/AddDialog.vue @@ -117,11 +117,11 @@ - + - - + +