From 47dfef90cf220d6703c0b96943c895dc4ce29f5c Mon Sep 17 00:00:00 2001 From: erdanergou Date: Fri, 17 Mar 2023 13:15:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=85=A5=E5=BA=93=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/GroupController.java | 16 +++---- .../controller/MaterialController.java | 42 +++++++++---------- .../depository_manage/entity/Inventory.java | 3 +- .../depository_manage/pojo/InventoryP.java | 16 ++++--- .../pojo/MaterialAndPlaceForView.java | 4 +- .../service/MaterialService.java | 2 +- .../service/SplitUnitService.java | 2 +- .../impl/DepositoryRecordServiceImpl.java | 28 ++++++------- .../service/impl/GroupServiceImpl.java | 4 +- .../service/impl/MaterialServiceImpl.java | 33 ++++++++------- .../service/impl/SplitUnitServiceImpl.java | 42 +++++++++---------- .../service/impl/StockTakingServiceImpl.java | 4 +- .../templates/pages/split/split-out.html | 35 +++++++++++++++- .../depository_manage/TestForOther.java | 2 +- .../templates/pages/split/split-out.html | 35 +++++++++++++++- 15 files changed, 164 insertions(+), 104 deletions(-) diff --git a/src/main/java/com/dreamchaser/depository_manage/controller/GroupController.java b/src/main/java/com/dreamchaser/depository_manage/controller/GroupController.java index 13bd73c3..ec12c416 100644 --- a/src/main/java/com/dreamchaser/depository_manage/controller/GroupController.java +++ b/src/main/java/com/dreamchaser/depository_manage/controller/GroupController.java @@ -128,10 +128,10 @@ public class GroupController { // 获取详细信息 // 获取该物料的库存 - List inventoryByMidAndDepository = materialService.findInventoryByGroupInfoAndDepository(groupInfo, depositoryIdList); + List inventoryByMidAndDepository = materialService.findInventoryByGroupInfoAndDepository(groupInfo, depositoryIdList); // 用于标志当前物料库存是否符合要求 boolean flagForQuantity = false; - for (Integer quantity : inventoryByMidAndDepository) { + for (Double quantity : inventoryByMidAndDepository) { // 如果库存符合要求 if (quantity >= groupInfo.getQuantity()) { flagForQuantity = true; @@ -402,10 +402,10 @@ public class GroupController { // 获取详细信息 // 获取该物料的库存 - List inventoryByMidAndDepository = materialService.findInventoryByGroupInfoAndDepository(groupInfo, depositoryIdList); + List inventoryByMidAndDepository = materialService.findInventoryByGroupInfoAndDepository(groupInfo, depositoryIdList); // 用于标志当前物料库存是否符合要求 boolean flagForQuantity = false; - for (Integer quantity : inventoryByMidAndDepository) { + for (Double quantity : inventoryByMidAndDepository) { // 如果库存符合要求 if (quantity >= groupInfo.getQuantity()) { flagForQuantity = true; @@ -872,7 +872,7 @@ public class GroupController { Map isTrueForGroup(Integer gid,Integer quantity,List depositoryIdList){ List groupInfoByGid = groupService.findGroupInfoByGid(gid); - Boolean flag = true; + boolean flag = true; String mname = ""; for (GroupInfo groupInfo : groupInfoByGid) { // 获取具体信息 @@ -883,8 +883,8 @@ public class GroupController { boolean flagForInventory = false; // 获取该物料在各仓库的库存 - List inventoryByMidAndDepository = materialService.findInventoryByGroupInfoAndDepository(groupInfo, depositoryIdList); - for (Integer integer : inventoryByMidAndDepository) { + List inventoryByMidAndDepository = materialService.findInventoryByGroupInfoAndDepository(groupInfo, depositoryIdList); + for (Double integer : inventoryByMidAndDepository) { if (integer >= totalQuantity) { flagForInventory = true; break; @@ -898,7 +898,7 @@ public class GroupController { mname = groupInfo.getMname(); } Map result = new HashMap<>(); - result.put("flag",flag.toString()); + result.put("flag", Boolean.toString(flag)); result.put("mname",mname); return result; } diff --git a/src/main/java/com/dreamchaser/depository_manage/controller/MaterialController.java b/src/main/java/com/dreamchaser/depository_manage/controller/MaterialController.java index da2bc0a7..6ff92033 100644 --- a/src/main/java/com/dreamchaser/depository_manage/controller/MaterialController.java +++ b/src/main/java/com/dreamchaser/depository_manage/controller/MaterialController.java @@ -131,7 +131,7 @@ public class MaterialController { total += materialService.findInventoryCount(map); } for (InventoryP inventoryP : list) { - inventoryP.setQuantity(1); + inventoryP.setQuantity(1.0); } return new RestResponse(list, total, 200); } @@ -748,7 +748,7 @@ public class MaterialController { if ("-1".equals(unit)) { // 如果是基础单位 for (InventoryP inventoryP : inventoryPList) { - Integer integer = inventoryP.getBaseUnitQuantity(); + double integer = inventoryP.getBaseUnitQuantity(); if (quantity <= (integer - inventoryP.getNumberOfTemporary())) { // 如果当前数量合适则跳出循环 flag = true; break; @@ -775,7 +775,7 @@ public class MaterialController { // 获取对应关系 MaterialAndPlace placeAndMaterialByMidAndPid = placeService.findPlaceAndMaterialByMidAndPid(p.getId(), inventoryP.getId()); - int allInventoryForSplitInfo = splitUnitService.findAllInventoryForSplitInfo(-1, placeAndMaterialByMidAndPid, splitInfo.getId(), 0, true); + double allInventoryForSplitInfo = splitUnitService.findAllInventoryForSplitInfo(-1, placeAndMaterialByMidAndPid, splitInfo.getId(), 0, true); saveQuantity += allInventoryForSplitInfo; } @@ -812,7 +812,7 @@ public class MaterialController { // 查询当前拆单记录 SplitInfo splitInfo = splitUnitService.findSplitInfoByMidAndUnit(paramForSplitInfo); // 查询以当前拆单记录为基础单位的库存 - int allInventoryForSplitInfo = splitUnitService.findAllInventoryForSplitInfo(-1, placeAndMaterialByMidAndPid, splitInfo.getId(), 0, true); + double allInventoryForSplitInfo = splitUnitService.findAllInventoryForSplitInfo(-1, placeAndMaterialByMidAndPid, splitInfo.getId(), 0, true); if (quantity <= allInventoryForSplitInfo) { flag = true; break; @@ -1049,14 +1049,14 @@ public class MaterialController { // 如果当前物料不在该库位 flag = false; } - mp.setQuantity(placeAndMaterialByMidAndPid.getQuantity()); + mp.setQuantity((double)placeAndMaterialByMidAndPid.getQuantity() / 100); } else { MaterialAndPlace placeAndMaterialByMidAndPid = placeService.findPlaceAndMaterialByMidAndPid(0, materialP.getId()); if (placeAndMaterialByMidAndPid == null) { // 如果当前物料不在该库位 flag = false; } - mp.setQuantity(placeAndMaterialByMidAndPid.getQuantity()); + mp.setQuantity((double)placeAndMaterialByMidAndPid.getQuantity() / 100); } mp = materialP; } else { @@ -1114,7 +1114,7 @@ public class MaterialController { // 如果当前物料不在该库位 flag = false; } else { - materialP.setQuantity(placeAndMaterialByMidAndPid.getQuantity()); + materialP.setQuantity((double)placeAndMaterialByMidAndPid.getQuantity()/100); } } else { MaterialAndPlace placeAndMaterialByMidAndPid = placeService.findPlaceAndMaterialByMidAndPid(0, materialP.getId()); @@ -1122,7 +1122,7 @@ public class MaterialController { // 如果当前物料不在该库位 flag = false; } else { - materialP.setQuantity(placeAndMaterialByMidAndPid.getQuantity()); + materialP.setQuantity((double)placeAndMaterialByMidAndPid.getQuantity()/100); } } mp = materialP; @@ -1399,7 +1399,7 @@ public class MaterialController { if (placeAndMaterialByMidAndPid == null) { isExist = false; } else { - mp.setQuantity(placeAndMaterialByMidAndPid.getQuantity()); + mp.setQuantity((double)placeAndMaterialByMidAndPid.getQuantity()/100); } } else { // 获取物料与库位的对应关系 @@ -1407,7 +1407,7 @@ public class MaterialController { if (placeAndMaterialByMidAndPid == null) { isExist = false; } else { - mp.setQuantity(placeAndMaterialByMidAndPid.getQuantity()); + mp.setQuantity((double)placeAndMaterialByMidAndPid.getQuantity() / 100); } } @@ -1449,14 +1449,14 @@ public class MaterialController { // 如果当前物料不在该库位 tempflag = false; } - mp.setQuantity(placeAndMaterialByMidAndPid.getQuantity()); + mp.setQuantity((double)placeAndMaterialByMidAndPid.getQuantity() / 100); } else { // 获取物料与库位的对应关系 MaterialAndPlace placeAndMaterialByMidAndPid = placeService.findPlaceAndMaterialByMidAndPid(0, materialP.getId()); if (placeAndMaterialByMidAndPid == null) { tempflag = false; } - mp.setQuantity(placeAndMaterialByMidAndPid.getQuantity()); + mp.setQuantity((double)placeAndMaterialByMidAndPid.getQuantity() / 100); } mp = materialP; } else { @@ -1517,7 +1517,7 @@ public class MaterialController { if (placeAndMaterialByMidAndPid == null) { isExist = false; } else { - mp.setQuantity(placeAndMaterialByMidAndPid.getQuantity()); + mp.setQuantity((double)placeAndMaterialByMidAndPid.getQuantity() / 100); } } else { // 获取物料与库位的对应关系 @@ -1525,7 +1525,7 @@ public class MaterialController { if (placeAndMaterialByMidAndPid == null) { isExist = false; } else { - mp.setQuantity(placeAndMaterialByMidAndPid.getQuantity()); + mp.setQuantity((double)placeAndMaterialByMidAndPid.getQuantity()/100); } } @@ -1547,7 +1547,7 @@ public class MaterialController { for (MaterialAndProducedDate materialAndProducedDate : materialAndProducedDateByMid) { // 获取当前生产日期 producedDateList.add(DateUtil.TimeStampToDateTimeForDay(materialAndProducedDate.getProducedDate())); - material.setQuantity(materialAndProducedDate.getInventory()); + material.setQuantity((double)materialAndProducedDate.getInventory() / 100); } List splitInfoByMid = splitUnitService.findSplitInfoByMid(material.getMid()); material.setSplitInfoList(splitInfoByMid); @@ -1639,7 +1639,7 @@ public class MaterialController { List splitInfoByMid = splitUnitService.findSplitInfoByMid(materialP.getMid()); materialP.setSplitInfoList(splitInfoByMid); materialP.setMaterialAndBarCodeList(materialByBarCodeByCondition); - materialP.setBaseUnitQuantity(pm.getQuantity()); + materialP.setBaseUnitQuantity((double)pm.getQuantity() / 100); return new RestResponse(materialP, 1, 200); } else { return new RestResponse("", 0, 200); @@ -1666,7 +1666,7 @@ public class MaterialController { List splitInfoByMid = splitUnitService.findSplitInfoByMid(materialP.getMid()); materialP.setSplitInfoList(splitInfoByMid); materialP.setMaterialAndBarCodeList(materialByBarCodeByCondition); - materialP.setQuantity(pm.getQuantity()); + materialP.setQuantity((double)pm.getQuantity()/100); return new RestResponse(materialP, 1, 200); } else { return new RestResponse("", 0, 200); @@ -1724,7 +1724,7 @@ public class MaterialController { // 如果当前库位没有该物料 mp = null; } else { - mp.setQuantity(placeAndMaterialByMidAndPid.getQuantity()); + mp.setQuantity((double)placeAndMaterialByMidAndPid.getQuantity()/100); } } else { @@ -1734,7 +1734,7 @@ public class MaterialController { // 如果当前库位没有该物料 mp = null; } else { - mp.setQuantity(placeAndMaterialByMidAndPid.getQuantity()); + mp.setQuantity((double)placeAndMaterialByMidAndPid.getQuantity()/100); } } @@ -1749,7 +1749,7 @@ public class MaterialController { // 获取当前生产日期 producedDateList.add(DateUtil.TimeStampToDateTimeForDay(materialAndProducedDate.getProducedDate())); if (flagForQuantity) { - mp.setQuantity(materialAndProducedDate.getInventory()); + mp.setQuantity((double)materialAndProducedDate.getInventory()/100); flagForQuantity = false; } } @@ -1926,7 +1926,7 @@ public class MaterialController { public RestResponse findQuantityByUnit(@RequestBody Map map) { if (map.containsKey("placeId")) { // 定义最终数量 - Integer quantity = 0; + double quantity = 0; // 获取当前的计量单位 String unit = (String) map.get("unit"); // 获取当前库存id diff --git a/src/main/java/com/dreamchaser/depository_manage/entity/Inventory.java b/src/main/java/com/dreamchaser/depository_manage/entity/Inventory.java index eb7d48f5..eec139a3 100644 --- a/src/main/java/com/dreamchaser/depository_manage/entity/Inventory.java +++ b/src/main/java/com/dreamchaser/depository_manage/entity/Inventory.java @@ -169,7 +169,7 @@ public class Inventory { this.materialTypeId = Long.valueOf(mpv.getType_id()); this.typeName = mpv.getTname(); this.version = mpv.getVersion(); - this.quantity = mpv.getInventory(); + this.quantity = mpv.getInventory().intValue(); } public Inventory(MaterialAndPlace mp) { @@ -178,5 +178,4 @@ public class Inventory { } - } diff --git a/src/main/java/com/dreamchaser/depository_manage/pojo/InventoryP.java b/src/main/java/com/dreamchaser/depository_manage/pojo/InventoryP.java index 2809e494..8653b883 100644 --- a/src/main/java/com/dreamchaser/depository_manage/pojo/InventoryP.java +++ b/src/main/java/com/dreamchaser/depository_manage/pojo/InventoryP.java @@ -39,7 +39,7 @@ public class InventoryP { /** * 数量 */ - private Integer quantity; + private Double quantity; /** * 总金额 @@ -181,7 +181,7 @@ public class InventoryP { /** * 用于展示的数量 */ - private Map showQuantity; + private Map showQuantity; /** @@ -190,7 +190,6 @@ public class InventoryP { private Integer numberOfTemporary; - /** * 基础单位 */ @@ -199,7 +198,7 @@ public class InventoryP { /** * 基础单位对应数目 */ - private Integer baseUnitQuantity; + private Double baseUnitQuantity; /** * 默认单位 @@ -209,14 +208,13 @@ public class InventoryP { /** * 基础单位对应数目 */ - private Integer defaultQuantity; - + private Double defaultQuantity; public InventoryP(Integer id, Integer depositoryId, String mname, Integer quantity, Double price, String typeName) { this.id = id; this.mname = mname; - this.quantity = quantity; + this.quantity = (double) quantity / 100; this.price = price; this.typeName = typeName; @@ -226,10 +224,10 @@ public class InventoryP { this.id = inventory.getId(); // 编号 this.mid = inventory.getMid(); // 编号 this.mname = inventory.getMname(); // 物料名称 - this.quantity = inventory.getQuantity(); // 数量 + this.quantity = (double) inventory.getQuantity() / 100; // 数量 this.price = inventory.getPrice(); // 单价 this.state = inventory.getState(); // 物料状态 - this.amounts = inventory.getAmounts(); // 总额 + this.amounts = inventory.getAmounts() / 100; // 总额 this.unit = inventory.getUnit(); // 计量单位 this.texture = inventory.getTexture(); // 材质 this.code = inventory.getCode(); // 存货编码 diff --git a/src/main/java/com/dreamchaser/depository_manage/pojo/MaterialAndPlaceForView.java b/src/main/java/com/dreamchaser/depository_manage/pojo/MaterialAndPlaceForView.java index ab092037..07b3cbdc 100644 --- a/src/main/java/com/dreamchaser/depository_manage/pojo/MaterialAndPlaceForView.java +++ b/src/main/java/com/dreamchaser/depository_manage/pojo/MaterialAndPlaceForView.java @@ -23,7 +23,7 @@ public class MaterialAndPlaceForView { /** * 在当前库位的数量 */ - private Integer inventory; + private Double inventory; /** * 当前库存所处仓库 */ @@ -124,7 +124,7 @@ public class MaterialAndPlaceForView { /** * 对应库存 */ - private Map splitInventory; + private Map splitInventory; } diff --git a/src/main/java/com/dreamchaser/depository_manage/service/MaterialService.java b/src/main/java/com/dreamchaser/depository_manage/service/MaterialService.java index 40e20bd8..f5c6b6a6 100644 --- a/src/main/java/com/dreamchaser/depository_manage/service/MaterialService.java +++ b/src/main/java/com/dreamchaser/depository_manage/service/MaterialService.java @@ -147,7 +147,7 @@ public interface MaterialService { * @param depositoryList 待查询的仓库 * @return */ - List findInventoryByGroupInfoAndDepository(GroupInfo groupInfo, List depositoryList); + List findInventoryByGroupInfoAndDepository(GroupInfo groupInfo, List depositoryList); /** * 根据物料id获取其在对应仓库中的库存数 diff --git a/src/main/java/com/dreamchaser/depository_manage/service/SplitUnitService.java b/src/main/java/com/dreamchaser/depository_manage/service/SplitUnitService.java index 96b1c709..2b31a508 100644 --- a/src/main/java/com/dreamchaser/depository_manage/service/SplitUnitService.java +++ b/src/main/java/com/dreamchaser/depository_manage/service/SplitUnitService.java @@ -137,7 +137,7 @@ public interface SplitUnitService { * @param allQuantityFlag 用于标志是否获取全部库存 * @return */ - int findAllInventoryForSplitInfo(Integer splitInfoId, MaterialAndPlace materialAndPlace, Integer baseSplitInfoId, int saveQuantity, boolean allQuantityFlag); + double findAllInventoryForSplitInfo(Integer splitInfoId, MaterialAndPlace materialAndPlace, Integer baseSplitInfoId, double saveQuantity, boolean allQuantityFlag); /** * 根据库存id与拆单记录id获取对应拆单库存处理记录 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 1932968f..6c259901 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 @@ -205,7 +205,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { if (materialByCondition.size() > 0) { // 如果当前存在 Inventory mt = materialByCondition.get(0); map.put("mid", mt.getMid()); - mt.setQuantity((int) (mt.getQuantity() + quantity * 100)); + mt.setQuantity((int) (mt.getQuantity() + (quantity * 100))); mt.setProducedDate(producedDate); materialMapper.updateInventory(mt); newMid = mt.getId(); @@ -419,9 +419,9 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { for (ApplicationInRecord applicationInRecordP : applicationInRecordPForToday) { // 获取当前入库类型(1物料2组合) Integer flagForGroup = applicationInRecordP.getFlagForGroup(); - sumForToday += (double)applicationInRecordP.getQuantity() / 100; + sumForToday += (double) applicationInRecordP.getQuantity() / 100; if (applicationInRecordP.getPrice() != null) { - priceForToday += applicationInRecordP.getPrice() * (double)(applicationInRecordP.getQuantity() / 100); + priceForToday += applicationInRecordP.getPrice() * (double) (applicationInRecordP.getQuantity() / 100); } else { priceForToday += 0; } @@ -430,9 +430,9 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { } for (ApplicationInRecord applicationInRecordP : applicationInRecordPForYesterday) { - sumForYesterDay += (double)applicationInRecordP.getQuantity() / 100; + sumForYesterDay += (double) applicationInRecordP.getQuantity() / 100; if (applicationInRecordP.getPrice() != null) { - priceForYesterDay += applicationInRecordP.getPrice() * (double)(applicationInRecordP.getQuantity() / 100); + priceForYesterDay += applicationInRecordP.getPrice() * (double) (applicationInRecordP.getQuantity() / 100); } else { priceForYesterDay += 0; } @@ -1455,7 +1455,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { // 获取当前物料的库存 - int allInventoryForSplitInfo = splitUnitService.findAllInventoryForSplitInfo(-1, materialAndPlace, realSplitInfo.getId(), 0, true); + double allInventoryForSplitInfo = splitUnitService.findAllInventoryForSplitInfo(-1, materialAndPlace, realSplitInfo.getId(), 0, true); // 判断当前所有库存是否可以满足需求 if (allInventoryForSplitInfo >= nowQuantity) { // 如果当前库存数可以满足需求 @@ -2107,7 +2107,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { // 用于调用入库方法而创建的 Map paramForUpdateInventory = new HashMap<>(); paramForUpdateInventory.put("mid", record.getMid()); - paramForUpdateInventory.put("quantity", record.getQuantity()); + paramForUpdateInventory.put("quantity", (double) record.getQuantity() / 100); paramForUpdateInventory.put("depositoryId", record.getDepositoryId()); paramForUpdateInventory.put("placeId", record.getPlaceId()); if (materialById.getUnit().equals(record.getAirUnit())) { @@ -2134,7 +2134,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { paramForUpdateInventory.put("producedDate", record.getMproducedDate()); Place placeById = placeMapper.findPlaceById(record.getPlaceId()); // 修改当前库存容量 - updateInventoryInfoForApproval(paramForUpdateInventory, record.getQuantity(), materialById, placeById); + updateInventoryInfoForApproval(paramForUpdateInventory, (double) record.getQuantity() / 100, materialById, placeById); } else { // 如果是拆单单位 @@ -2179,7 +2179,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { splitInventory = splitUnitMapper.findSplitInventoryByIidAndSid(paramForInsertSplitInventory); } } - splitUnitService.realInInventoryToDepository((double) record.getQuantity(), splitInventory, paramForUpdateInventory, splitInfoForUnit, placeAndMaterialByMidAndPid, true); + splitUnitService.realInInventoryToDepository((double) record.getQuantity() / 100, splitInventory, paramForUpdateInventory, splitInfoForUnit, placeAndMaterialByMidAndPid, true); if (paramForUpdateInventory.containsKey("applicationInId")) { depositoryRecordMapper.deleteApplicationInRecordById(ObjectFormatUtil.toInteger(paramForUpdateInventory.get("applicationInId"))); } @@ -2216,7 +2216,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { @Transactional(rollbackFor = Exception.class) public Integer transferApply(Map map, UserByPort userByPort) { Integer mid = ObjectFormatUtil.toInteger(map.get("mid")); - Double quantity = Double.parseDouble((String) map.get("quantity")); + double quantity = Double.parseDouble((String) map.get("quantity")); Inventory material = materialMapper.findInventoryById(mid); map.put("depositoryId", material.getDepositoryId()); map.put("mid", mid); @@ -3587,8 +3587,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { public List findApplicationInRecordByDepository(String depositoryId) { List recordByDepository = depositoryRecordMapper.findApplicationInRecordByDepository(depositoryId); List list = new ArrayList<>(); - for (ApplicationInRecord record:recordByDepository - ) { + for (ApplicationInRecord record : recordByDepository + ) { ApplicationInRecordP recordP = new ApplicationInRecordP(record); list.add(recordP); } @@ -3825,7 +3825,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { price = applicationInRecordP.getPrice(); } sum += price * applicationInRecordP.getQuantity() / 10000; - count += (double)applicationInRecordP.getQuantity() / 100; + count += (double) applicationInRecordP.getQuantity() / 100; } BigDecimal bg = new BigDecimal(sum); sum = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); @@ -4024,7 +4024,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { double sumCount = 0; if (type == 1) { // 如果入库 - sumCount = (double)depositoryRecordMapper.findApplicationInByMonthTest(map) / 100; + sumCount = (double) depositoryRecordMapper.findApplicationInByMonthTest(map) / 100; } else { // 如果出库 sumCount = depositoryRecordMapper.findApplicationOutByMonth(map); diff --git a/src/main/java/com/dreamchaser/depository_manage/service/impl/GroupServiceImpl.java b/src/main/java/com/dreamchaser/depository_manage/service/impl/GroupServiceImpl.java index d8f499d5..23ea2b32 100644 --- a/src/main/java/com/dreamchaser/depository_manage/service/impl/GroupServiceImpl.java +++ b/src/main/java/com/dreamchaser/depository_manage/service/impl/GroupServiceImpl.java @@ -1024,9 +1024,9 @@ public class GroupServiceImpl implements GroupService { // 设置id mp.setId(materialAndPlaceForView.getId()); // 设置数量 - mp.setQuantity(materialAndPlaceForView.getInventory()); + mp.setQuantity(materialAndPlaceForView.getInventory().intValue()); // 获取当前库位下该拆单单位库存数 - int allInventoryForSplitInfo = splitUnitService.findAllInventoryForSplitInfo(-1, mp, splitInfo.getId(), 0, true); + double allInventoryForSplitInfo = splitUnitService.findAllInventoryForSplitInfo(-1, mp, splitInfo.getId(), 0, true); if (allInventoryForSplitInfo >= quantity) { // 如果当前库存充足 did = materialAndPlaceForView.getDepository_id(); 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 0ed1c240..45c4cde4 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 @@ -522,9 +522,9 @@ public class MaterialServiceImpl implements MaterialService { * @return */ @Override - public List findInventoryByGroupInfoAndDepository(GroupInfo groupInfo, List depositoryList) { + public List findInventoryByGroupInfoAndDepository(GroupInfo groupInfo, List depositoryList) { // 用于存储各仓库的库存 - List result = new ArrayList<>(); + List result = new ArrayList<>(); // 获取当前物料在组合中的单位 String unit = groupInfo.getUnit(); @@ -537,9 +537,9 @@ public class MaterialServiceImpl implements MaterialService { map.put("did", depositoryId); Inventory inventory = materialMapper.findInventoryByMidAndDid(map); if (inventory != null) { - result.add(inventory.getQuantity()); + result.add((double)inventory.getQuantity() / 100); } else { - result.add(0); + result.add(0.0); } } } else { @@ -555,13 +555,13 @@ public class MaterialServiceImpl implements MaterialService { paramForSplitInventory.put("sid", splitInfo.getId()); for (Integer depositoryId : depositoryList) { - Integer quantity = 0; + double quantity = 0; // 获取该物料在该仓库下的映射关系 List placeAndMaterialByDidAndMid = placeService.findPlaceAndMaterialByDidAndMid(depositoryId, groupInfo.getMid()); for (MaterialAndPlaceForView materialAndPlaceForView : placeAndMaterialByDidAndMid) { paramForSplitInventory.put("iid", materialAndPlaceForView.getId()); MaterialAndPlace materialAndPlace = new MaterialAndPlace(); - materialAndPlace.setQuantity(materialAndPlaceForView.getInventory()); + materialAndPlace.setQuantity((int)(materialAndPlaceForView.getInventory() / 100)); materialAndPlace.setId(materialAndPlaceForView.getId()); quantity += splitUnitService.findAllInventoryForSplitInfo(-1, materialAndPlace, splitInfo.getId(), 0, true); } @@ -813,9 +813,9 @@ public class MaterialServiceImpl implements MaterialService { List placeByMidAndDid = placeService.findPlaceByMidAndDid(m.getId(), m.getDepositoryId()); - Map splitInventoryForUnit = new HashMap<>(); - splitInventoryForUnit.put(inventory.getUnit(), inventory.getQuantity()); - m.setBaseUnitQuantity(inventory.getQuantity()); + Map splitInventoryForUnit = new HashMap<>(); + splitInventoryForUnit.put(inventory.getUnit(), (double)inventory.getQuantity() / 100); + m.setBaseUnitQuantity((double)inventory.getQuantity() / 100); // 定义最后展示单位及数目 String unit = inventory.getUnit(); @@ -833,7 +833,7 @@ public class MaterialServiceImpl implements MaterialService { for (SplitInfo splitInfo : splitInfoByMid ) { // 获取当前拆单单位的总数 - int saveQuantity = splitUnitService.findAllInventoryForSplitInfo(-1, placeAndMaterialByMidAndPid, splitInfo.getId(), 0, true); + double saveQuantity = splitUnitService.findAllInventoryForSplitInfo(-1, placeAndMaterialByMidAndPid, splitInfo.getId(), 0, true); if (splitInventoryForUnit.containsKey(splitInfo.getNewUnit())) { // 如果当前存在该拆单类型的记录 @@ -848,7 +848,8 @@ public class MaterialServiceImpl implements MaterialService { if (inventory.getPrice() == null) { inventory.setPrice(0.0); } - BigDecimal bigDecimal = BigDecimal.valueOf(inventory.getPrice() / splitInfo.getQuantity()); + int scale = splitUnitService.findSplitInfoScaleQuantity(splitInfo, -1); + BigDecimal bigDecimal = BigDecimal.valueOf(inventory.getPrice() / scale); double split_price = bigDecimal.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); amounts += split_price * saveQuantity; unit = splitInfo.getNewUnit(); @@ -2650,13 +2651,13 @@ public class MaterialServiceImpl implements MaterialService { // 获取其对应的拆单记录 List list = splitUnitMapper.findSplitInfoByMid(mpv.getMid()); // 用于获取对应的拆单记录库存 - Map splitInventory = new HashMap<>(); + Map splitInventory = new HashMap<>(); // 获取对应物料 MaterialAndPlace placeAndMaterial = placeService.findPlaceAndMaterialById(mpv.getId()); for (SplitInfo si : list ) { // 获取当前拆单单位对应的库存数 - int allInventoryForSplitInfo = splitUnitService.findAllInventoryForSplitInfo(-1, placeAndMaterial, si.getId(), 0, true); + double allInventoryForSplitInfo = splitUnitService.findAllInventoryForSplitInfo(-1, placeAndMaterial, si.getId(), 0, true); splitInventory.put(si.getNewUnit(), allInventoryForSplitInfo); } // 创建默认单位的拆单信息 @@ -2685,13 +2686,13 @@ public class MaterialServiceImpl implements MaterialService { mpv.setTakingInventory(number); if ("Inventory_down".equals(takingResult)) { // 如果盘亏 - mpv.setStockTakingQuantity(splitInventory.get(unit) - ObjectFormatUtil.toInteger(number)); + mpv.setStockTakingQuantity((int)(splitInventory.get(unit) - ObjectFormatUtil.toDouble(number))); } else if ("Inventory_up".equals(takingResult)) { // 如果盘盈 - mpv.setStockTakingQuantity(splitInventory.get(unit) + ObjectFormatUtil.toInteger(number)); + mpv.setStockTakingQuantity((int)(splitInventory.get(unit) + ObjectFormatUtil.toDouble(number))); } else { // 如果正常 - mpv.setStockTakingQuantity(splitInventory.get(unit)); + mpv.setStockTakingQuantity((int)(splitInventory.get(unit) * 100)); } } 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 031451f7..017e38d4 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 @@ -89,7 +89,7 @@ public class SplitUnitServiceImpl implements SplitUnitService { SplitInfo splitInfoForUnit = splitUnitMapper.findSplitInfoByMidAndUnit(paramForSplitInfo); - // 获取当前仓库是否有用户进行管理入库审批 + // 获取当前类型是否有用户进行管理入库审批 Map paramForMtRole = new HashMap<>(); Material materialById = materialMapper.findMaterialById(ObjectFormatUtil.toInteger(map.get("mid"))); paramForMtRole.put("mtid", materialById.getMaterialTypeId()); @@ -225,9 +225,11 @@ public class SplitUnitServiceImpl implements SplitUnitService { // 计算要进的数目 int quantity_in = (realQuantity / (scale * 100)); // 更新处理数量 - disposeQuantity = disposeQuantity * 100 + quantity_in; + disposeQuantity = disposeQuantity * 100 + quantity_in * 100; // 拆单库存实际入库的数量 - realQuantity = realQuantity - quantity_in * scale; + realQuantity = realQuantity - quantity_in * 100 * scale; + }else{ + disposeQuantity *= 100; } // 设置当前计量单位的库存 splitInventory.setSaveQuantity(realQuantity); @@ -301,9 +303,9 @@ public class SplitUnitServiceImpl implements SplitUnitService { } else { // 如果不大于设置的进制数量 - paramForInsertSplitInventory.put("inQuantity", quantity); + paramForInsertSplitInventory.put("inQuantity", quantity * 100); paramForInsertSplitInventory.put("outQuantity", 0); - paramForInsertSplitInventory.put("saveQuantity", saveQuantity); + paramForInsertSplitInventory.put("saveQuantity", saveQuantity * 100); if (placeAndMaterialByMidAndPid != null) { // 如果有库存记录 @@ -390,7 +392,7 @@ public class SplitUnitServiceImpl implements SplitUnitService { * @param allQuantityFlag 用于标志是否获取全部库存 * @return */ - public int findAllInventoryForSplitInfo(Integer splitInfoId, MaterialAndPlace materialAndPlace, Integer baseSplitInfoId, int saveQuantity, boolean allQuantityFlag) { + public double findAllInventoryForSplitInfo(Integer splitInfoId, MaterialAndPlace materialAndPlace, Integer baseSplitInfoId, double saveQuantity, boolean allQuantityFlag) { if (allQuantityFlag) { // 用于标志是否第一次计算 @@ -406,16 +408,15 @@ public class SplitUnitServiceImpl implements SplitUnitService { // 如果当前获取的为对应基础单位的所有库存 // 如果是第一次计算 - if (Integer.compare(saveQuantity, 0) == 0) { + if (saveQuantity == 0.0) { // 如果是第一次计算 - paramForSplitInventory.put("sid", baseSplitInfoId); // 当前基础单位的库存 SplitInventory baseSplitInventory = splitUnitMapper.findSplitInventoryByIidAndSid(paramForSplitInventory); if (baseSplitInventory != null) { - saveQuantity += baseSplitInventory.getSaveQuantity(); + saveQuantity += (double) baseSplitInventory.getSaveQuantity() / 100; } } if (Integer.compare(-1, splitInfoId) != 0) { @@ -425,7 +426,7 @@ public class SplitUnitServiceImpl implements SplitUnitService { paramForSplitInventory.put("sid", splitInfoId); SplitInventory splitInventoryByIidAndSid = splitUnitMapper.findSplitInventoryByIidAndSid(paramForSplitInventory); if (splitInventoryByIidAndSid != null) { - saveQuantity += splitInventoryByIidAndSid.getSaveQuantity() * splitInfoByParentId.getQuantity(); + saveQuantity += (double) (splitInventoryByIidAndSid.getSaveQuantity() / 100) * splitInfoByParentId.getQuantity(); } } @@ -446,12 +447,12 @@ public class SplitUnitServiceImpl implements SplitUnitService { return findAllInventoryForSplitInfo(parentSplitInfo.getId(), materialAndPlace, baseSplitInfoId, saveQuantity, allQuantityFlag); } else { int splitInfoScaleQuantity = findSplitInfoScaleQuantity(baseSplitInfo, -1); - return saveQuantity + materialAndPlace.getQuantity() * splitInfoScaleQuantity; + return saveQuantity + (double) (materialAndPlace.getQuantity() / 100) * splitInfoScaleQuantity; } } else { int splitInfoScaleQuantity = findSplitInfoScaleQuantity(baseSplitInfo, -1); - return saveQuantity + materialAndPlace.getQuantity() * splitInfoScaleQuantity; + return saveQuantity + (double) (materialAndPlace.getQuantity() / 100) * splitInfoScaleQuantity; } } @@ -466,14 +467,14 @@ public class SplitUnitServiceImpl implements SplitUnitService { paramForSplitInventory.put("iid", materialAndPlace.getId()); // 如果当前获取的为对应基础单位的所有库存 - if (Integer.compare(saveQuantity, 0) == 0) { + if (saveQuantity == 0.0) { // 如果是第一次计算 paramForSplitInventory.put("sid", baseSplitInfoId); // 当前基础单位的库存 SplitInventory baseSplitInventory = splitUnitMapper.findSplitInventoryByIidAndSid(paramForSplitInventory); - saveQuantity += baseSplitInventory.getSaveQuantity(); + saveQuantity += (double)baseSplitInventory.getSaveQuantity() / 100; } // 获取当前拆单记录与基础拆单记录之间的进制 @@ -481,7 +482,7 @@ public class SplitUnitServiceImpl implements SplitUnitService { paramForSplitInventory.put("sid", splitInfoId); // 获取当前拆单记录的库存 SplitInventory splitInventory = splitUnitMapper.findSplitInventoryByIidAndSid(paramForSplitInventory); - saveQuantity += splitInventory.getSaveQuantity() * splitInfoScaleQuantity; + saveQuantity += (double)splitInventory.getSaveQuantity() / 100 * splitInfoScaleQuantity; // 获取当前的子类 SplitInfo splitInfoByParentId = splitUnitMapper.findSplitInfoByParentId(splitInfoId); @@ -577,12 +578,12 @@ public class SplitUnitServiceImpl implements SplitUnitService { if (splitInventory != null) { // 如果拆单库存处理记录不为空 - if ((double)(splitInventory.getSaveQuantity() / 100) + saveQuantity >= splitInfo.getQuantity()) { + if ((double) (splitInventory.getSaveQuantity() / 100) + saveQuantity >= splitInfo.getQuantity()) { // 当前库存拆单记录与新入库的数目大于预设的进制 // 定义当前实际修改数量 - double new_saveQuantity = (double)splitInventory.getSaveQuantity() / 100 + saveQuantity - splitInfo.getQuantity(); + double new_saveQuantity = (double) splitInventory.getSaveQuantity() / 100 + saveQuantity - splitInfo.getQuantity(); // 令计算处理数量+1 disposeQuantity += 1; @@ -612,8 +613,8 @@ public class SplitUnitServiceImpl implements SplitUnitService { } } else { // 当前库存拆单记录与新入库的数目不大于预设的进制 - splitInventory.setSaveQuantity((int) (splitInventory.getSaveQuantity() + saveQuantity * 100)); - splitInventory.setInQuantity((int) (splitInventory.getInQuantity() + saveQuantity * 100)); + splitInventory.setSaveQuantity((int) (splitInventory.getSaveQuantity() + saveQuantity * 100)); + splitInventory.setInQuantity((int) (splitInventory.getInQuantity() + saveQuantity * 100)); splitUnitMapper.updateSplitInventory(splitInventory); @@ -624,8 +625,7 @@ public class SplitUnitServiceImpl implements SplitUnitService { // 删除入库订单 // depositoryRecordMapper.deleteApplicationInRecordById(ObjectFormatUtil.toInteger(map.get("id"))); } - } - else { + } else { // 如果为空 Map paramForInsertSplitInventory = new HashMap<>(); diff --git a/src/main/java/com/dreamchaser/depository_manage/service/impl/StockTakingServiceImpl.java b/src/main/java/com/dreamchaser/depository_manage/service/impl/StockTakingServiceImpl.java index 477afc34..c5e47c38 100644 --- a/src/main/java/com/dreamchaser/depository_manage/service/impl/StockTakingServiceImpl.java +++ b/src/main/java/com/dreamchaser/depository_manage/service/impl/StockTakingServiceImpl.java @@ -927,7 +927,7 @@ public class StockTakingServiceImpl implements StockTakingService { // 拆单库存如果不能满足 // 获取当前拆单单位对应的所有库存 - int allSplitInventory = splitUnitService.findAllInventoryForSplitInfo(-1, placeAndMaterialByMidAndPid, splitInfo.getId(), 0, true); + double allSplitInventory = splitUnitService.findAllInventoryForSplitInfo(-1, placeAndMaterialByMidAndPid, splitInfo.getId(), 0, true); if (allSplitInventory - inventory >= 0) { // 获取剩余不足的数量 @@ -1043,7 +1043,7 @@ public class StockTakingServiceImpl implements StockTakingService { // 如果不存在拆单记录 // 获取当前拆单单位对应的库存数 - int splitInfoInventory = splitUnitService.findAllInventoryForSplitInfo(-1, placeAndMaterialByMidAndPid, splitInfo.getId(), 0, true); + double splitInfoInventory = splitUnitService.findAllInventoryForSplitInfo(-1, placeAndMaterialByMidAndPid, splitInfo.getId(), 0, true); if (Integer.compare(minRecord.getNewInventory(), 0) == 0) { // 如果盘点数量为0 diff --git a/src/main/resources/templates/pages/split/split-out.html b/src/main/resources/templates/pages/split/split-out.html index d11c14b8..1bffcac1 100644 --- a/src/main/resources/templates/pages/split/split-out.html +++ b/src/main/resources/templates/pages/split/split-out.html @@ -76,6 +76,11 @@
+ + + diff --git a/src/test/java/com/dreamchaser/depository_manage/TestForOther.java b/src/test/java/com/dreamchaser/depository_manage/TestForOther.java index 4c072716..389faefd 100644 --- a/src/test/java/com/dreamchaser/depository_manage/TestForOther.java +++ b/src/test/java/com/dreamchaser/depository_manage/TestForOther.java @@ -46,7 +46,7 @@ public class TestForOther { ApprovalInfo_Details_Approver approver = new ApprovalInfo_Details_Approver(); approver.setUserId("PangFuZhen"); approvalInfo.setApprover(approver); - depositoryRecordService.reviewByQyWxApprovalIn("[1]",approvalInfo,"460f46eaefb46bb0c171029f62e2cea6","2","202303170008"); + depositoryRecordService.reviewByQyWxApprovalIn("[6]",approvalInfo,"460f46eaefb46bb0c171029f62e2cea6","2","202303170017"); } diff --git a/target/classes/templates/pages/split/split-out.html b/target/classes/templates/pages/split/split-out.html index d11c14b8..1bffcac1 100644 --- a/target/classes/templates/pages/split/split-out.html +++ b/target/classes/templates/pages/split/split-out.html @@ -76,6 +76,11 @@
+ + +