From 2fdec3acfc525d567f84748c8fe2a657c8fba823 Mon Sep 17 00:00:00 2001 From: erdanergou Date: Wed, 22 Mar 2023 13:30:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BA=93=E4=BD=8D=E4=B9=8B?= =?UTF-8?q?=E9=97=B4=E8=BD=AC=E7=A7=BB=E6=97=B6=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/MaterialServiceImpl.java | 12 ++-- .../service/impl/SplitUnitServiceImpl.java | 2 +- .../material/selectPlaceByDepository.html | 71 ++++++++++--------- .../material/selectPlaceByDepository.html | 71 ++++++++++--------- 4 files changed, 85 insertions(+), 71 deletions(-) diff --git a/src/main/java/com/dreamchaser/depository_manage/service/impl/MaterialServiceImpl.java b/src/main/java/com/dreamchaser/depository_manage/service/impl/MaterialServiceImpl.java index d5452f24..9ca1006f 100644 --- a/src/main/java/com/dreamchaser/depository_manage/service/impl/MaterialServiceImpl.java +++ b/src/main/java/com/dreamchaser/depository_manage/service/impl/MaterialServiceImpl.java @@ -1638,7 +1638,7 @@ public class MaterialServiceImpl implements MaterialService { // 如果转移后的拆单库存记录不为空 // 获取当前转移后的总数 - int realQuantity = splitInventoryForAfter.getSaveQuantity() + (int) (quantity * 100); + double realQuantity = splitInventoryForAfter.getSaveQuantity() / 100.0 + quantity; if (realQuantity >= splitInfo.getQuantity()) { // 如果当前转移后的总数大于进制数 @@ -1648,7 +1648,7 @@ public class MaterialServiceImpl implements MaterialService { // 获取进位后当前入库的数量 realQuantity = realQuantity - dispose * splitInfo.getQuantity(); // 设置当前库存数量 - splitInventoryForAfter.setSaveQuantity(realQuantity); + splitInventoryForAfter.setSaveQuantity((int) (realQuantity * 100)); // 设置当前入库数量 splitInventoryForAfter.setInQuantity(splitInventoryForAfter.getInQuantity() + (int) (quantity * 100)); // 修改库存记录 @@ -1675,7 +1675,7 @@ public class MaterialServiceImpl implements MaterialService { // 如果不大于进制数 // 设置转移后的库存数量 - splitInventoryForAfter.setSaveQuantity(realQuantity); + splitInventoryForAfter.setSaveQuantity((int) (realQuantity * 100)); // 设置转移后的入库数量 splitInventoryForAfter.setInQuantity(splitInventoryForAfter.getSaveQuantity() + (int) (quantity * 100)); // 修改库存数量 @@ -1717,8 +1717,8 @@ public class MaterialServiceImpl implements MaterialService { } } else { // 如果不大于 - insertForSplitInventory.put("saveQuantity", quantity); - insertForSplitInventory.put("inQuantity", quantity); + insertForSplitInventory.put("saveQuantity",(int)(quantity * 100)); + insertForSplitInventory.put("inQuantity",(int)(quantity * 100)); splitUnitMapper.addSplitInventory(insertForSplitInventory); } } @@ -1753,7 +1753,7 @@ public class MaterialServiceImpl implements MaterialService { if (splitInfo.getParentId() != null) { // 获取当前父级 SplitInfo parentSplitInfo = splitUnitMapper.findSplitInfoById(splitInfo.getParentId()); - splitUnitService.updateSplitInfoSaveQuantity(parentSplitInfo, dispose, ObjectFormatUtil.toInteger(insertForSplitInventory.get("id")), paramForNewMap, quantity, splitInfo); + splitUnitService.updateSplitInfoSaveQuantity(parentSplitInfo, dispose, ObjectFormatUtil.toInteger(insertForAfter.get("id")), paramForNewMap, quantity, splitInfo); } else { if (inventoryByMid.getPrice() == null) { inventoryByMid.setPrice(0.0); diff --git a/src/main/java/com/dreamchaser/depository_manage/service/impl/SplitUnitServiceImpl.java b/src/main/java/com/dreamchaser/depository_manage/service/impl/SplitUnitServiceImpl.java index 558cf0e2..b3734318 100644 --- a/src/main/java/com/dreamchaser/depository_manage/service/impl/SplitUnitServiceImpl.java +++ b/src/main/java/com/dreamchaser/depository_manage/service/impl/SplitUnitServiceImpl.java @@ -667,7 +667,7 @@ public class SplitUnitServiceImpl implements SplitUnitService { paramForInsertSplitInventory.put("inQuantity", quantity * 100); paramForInsertSplitInventory.put("outQuantity", 0); paramForInsertSplitInventory.put("iid", iid); - if (quantity > splitInfo.getQuantity()) { + if (quantity >= splitInfo.getQuantity()) { // 如果当前处理数量大于当前设置的进制数量 // 计算需要进位的数量 diff --git a/src/main/resources/templates/pages/material/selectPlaceByDepository.html b/src/main/resources/templates/pages/material/selectPlaceByDepository.html index 84800595..896207a9 100644 --- a/src/main/resources/templates/pages/material/selectPlaceByDepository.html +++ b/src/main/resources/templates/pages/material/selectPlaceByDepository.html @@ -22,6 +22,8 @@ var $ = layui.jquery, tree = layui.tree; + // 用于标志是否为第一次提交 + let flagForForm = false; // 获取当前仓库 var depositoryId = $("#depositoryId").val(); // 当前库存总数 @@ -93,39 +95,44 @@ }) } else { // 修改当前物料所在库位 - var req = {}; - req.quantity = value; - req.mid = mid; - req.fromPlaceId = fromPlaceId; - req.toPlaceId = placeId; - req.unit = unit; - req.depositoryId = depositoryId; - $.ajax({ - url:"/material/editPlaceMaterial", - type: 'post', - dataType: 'json', - contentType: "application/json;charset=utf-8", - data: JSON.stringify(req), - success:function (data) { - if(data.status === 205){ - layer.msg("修改成功",{ - icon:1, - time:1000 - },function () { - var index = parent.layer.getFrameIndex(window.name); - parent.layer.close(index); - }) - }else{ - layer.msg(data.statusInfo.detail,{ - icon:5, - time:1000 - },function () { - var index = parent.layer.getFrameIndex(window.name); - parent.layer.close(index); - }) + if(!flagForForm){ + flagForForm = true; + var req = {}; + req.quantity = value; + req.mid = mid; + req.fromPlaceId = fromPlaceId; + req.toPlaceId = placeId; + req.unit = unit; + req.depositoryId = depositoryId; + $.ajax({ + url:"/material/editPlaceMaterial", + type: 'post', + dataType: 'json', + contentType: "application/json;charset=utf-8", + data: JSON.stringify(req), + success:function (data) { + if(data.status === 205){ + layer.msg("修改成功",{ + icon:1, + time:1000 + },function () { + var index = parent.layer.getFrameIndex(window.name); + parent.layer.close(index); + }) + }else{ + layer.msg(data.statusInfo.detail,{ + icon:5, + time:1000 + },function () { + flagForForm = false; + var index = parent.layer.getFrameIndex(window.name); + parent.layer.close(index); + }) + } } - } - }) + }) + } + } }); diff --git a/target/classes/templates/pages/material/selectPlaceByDepository.html b/target/classes/templates/pages/material/selectPlaceByDepository.html index 84800595..896207a9 100644 --- a/target/classes/templates/pages/material/selectPlaceByDepository.html +++ b/target/classes/templates/pages/material/selectPlaceByDepository.html @@ -22,6 +22,8 @@ var $ = layui.jquery, tree = layui.tree; + // 用于标志是否为第一次提交 + let flagForForm = false; // 获取当前仓库 var depositoryId = $("#depositoryId").val(); // 当前库存总数 @@ -93,39 +95,44 @@ }) } else { // 修改当前物料所在库位 - var req = {}; - req.quantity = value; - req.mid = mid; - req.fromPlaceId = fromPlaceId; - req.toPlaceId = placeId; - req.unit = unit; - req.depositoryId = depositoryId; - $.ajax({ - url:"/material/editPlaceMaterial", - type: 'post', - dataType: 'json', - contentType: "application/json;charset=utf-8", - data: JSON.stringify(req), - success:function (data) { - if(data.status === 205){ - layer.msg("修改成功",{ - icon:1, - time:1000 - },function () { - var index = parent.layer.getFrameIndex(window.name); - parent.layer.close(index); - }) - }else{ - layer.msg(data.statusInfo.detail,{ - icon:5, - time:1000 - },function () { - var index = parent.layer.getFrameIndex(window.name); - parent.layer.close(index); - }) + if(!flagForForm){ + flagForForm = true; + var req = {}; + req.quantity = value; + req.mid = mid; + req.fromPlaceId = fromPlaceId; + req.toPlaceId = placeId; + req.unit = unit; + req.depositoryId = depositoryId; + $.ajax({ + url:"/material/editPlaceMaterial", + type: 'post', + dataType: 'json', + contentType: "application/json;charset=utf-8", + data: JSON.stringify(req), + success:function (data) { + if(data.status === 205){ + layer.msg("修改成功",{ + icon:1, + time:1000 + },function () { + var index = parent.layer.getFrameIndex(window.name); + parent.layer.close(index); + }) + }else{ + layer.msg(data.statusInfo.detail,{ + icon:5, + time:1000 + },function () { + flagForForm = false; + var index = parent.layer.getFrameIndex(window.name); + parent.layer.close(index); + }) + } } - } - }) + }) + } + } });