From fb5f9c401740e57b34cc7dce344a107b59e3c12d Mon Sep 17 00:00:00 2001 From: erdanergou Date: Sat, 11 Feb 2023 13:14:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=83=A8=E5=88=86bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/DepositoryRecordServiceImpl.java | 28 +++++++++++-------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/dreamchaser/depository_manage/service/impl/DepositoryRecordServiceImpl.java b/src/main/java/com/dreamchaser/depository_manage/service/impl/DepositoryRecordServiceImpl.java index 3ee663bb..e38948a6 100644 --- a/src/main/java/com/dreamchaser/depository_manage/service/impl/DepositoryRecordServiceImpl.java +++ b/src/main/java/com/dreamchaser/depository_manage/service/impl/DepositoryRecordServiceImpl.java @@ -1269,7 +1269,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { // 获取当前出库的具体数目 int residue = (int) Math.ceil(trueOut / (double)splitInfo.getQuantity()); // 获取剩余数目 - int residue_realQuantity = trueOut - residue * splitInfo.getQuantity(); + int residue_realQuantity = residue * scale - trueOut; // 设置新总额 inventory.setAmounts(inventory.getAmounts() - residue * inventory.getPrice()); @@ -1282,22 +1282,28 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { // 更新对应库位的库存 // 修改当前库位存放物料的数量 - placeAndMaterialByMidAndPid.setQuantity(placeAndMaterialByMidAndPid.getQuantity() - residue - 1); + placeAndMaterialByMidAndPid.setQuantity(placeAndMaterialByMidAndPid.getQuantity() - residue ); placeMapper.updateMaterialAndPlace(placeAndMaterialByMidAndPid); // 修改库位数量 Place placeById = placeMapper.findPlaceById(placeId); - placeById.setQuantity(placeById.getQuantity() - residue - 1); + placeById.setQuantity(placeById.getQuantity() - residue); placeMapper.UpdatePlace(placeById); - // 添加拆单库存处理记录 - Map insertSplitInventory = new HashMap<>(); - insertSplitInventory.put("sid", splitInfo.getId()); - insertSplitInventory.put("iid", placeAndMaterialByMidAndPid.getId()); - insertSplitInventory.put("outQuantity", trueOut); - insertSplitInventory.put("inQuantity", 0); - insertSplitInventory.put("saveQuantity", splitInfo.getQuantity() - residue_realQuantity); - splitUnitMapper.addSplitInventory(insertSplitInventory); + + // 插入拆单记录 + Map insertForSplitInventory = new HashMap<>(); + insertForSplitInventory.put("mid",inventory.getMid()); + insertForSplitInventory.put("mcode",inventory.getCode()); + insertForSplitInventory.put("price",inventory.getPrice() / scale); + insertForSplitInventory.put("quantity",splitInfo.getQuantity() - residue_realQuantity); + insertForSplitInventory.put("unit",unit); + insertForSplitInventory.put("depositoryId",applicationOutMinById.getDepositoryId()); + insertForSplitInventory.put("placeId",placeAndMaterialByMidAndPid.getPid()); + insertForSplitInventory.put("type","in"); + splitUnitService.addSplitInventory(insertForSplitInventory); + Integer new_id = ObjectFormatUtil.toInteger(insertForSplitInventory.get("newInMid")); + depositoryRecordMapper.deleteApplicationInRecordById(new_id); // 如果是库存转移订单