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 6ff92033..d3cec534 100644 --- a/src/main/java/com/dreamchaser/depository_manage/controller/MaterialController.java +++ b/src/main/java/com/dreamchaser/depository_manage/controller/MaterialController.java @@ -82,7 +82,7 @@ public class MaterialController { return new RestResponse(null); } else { map.put("userTokenId", userToken.getId()); - List inventoryForStockTaking = materialService.findInventoryForStockTaking(map); + List inventoryForStockTaking = materialService.findInventoryForStockTaking(map); return new RestResponse(inventoryForStockTaking, placeService.findPlaceAndMaterialCountByCondition(map), 200); } } @@ -1991,7 +1991,7 @@ public class MaterialController { } } map.put("userTokenId",userToken.getId()); - List materialAndPlaceForViews = materialService.findInventoryByMidAndDepository(map, depositoryIdList); + List materialAndPlaceForViews = materialService.findInventoryByMidAndDepository(map, depositoryIdList); Integer count = placeService.findPlaceAndMaterialCountByDidsAndMid(depositoryIdList, map); return new RestResponse(materialAndPlaceForViews,count,200); }else{ 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 eec139a3..9d98fbce 100644 --- a/src/main/java/com/dreamchaser/depository_manage/entity/Inventory.java +++ b/src/main/java/com/dreamchaser/depository_manage/entity/Inventory.java @@ -1,6 +1,6 @@ package com.dreamchaser.depository_manage.entity; -import com.dreamchaser.depository_manage.pojo.MaterialAndPlaceForView; +import com.dreamchaser.depository_manage.pojo.MaterialAndPlaceForViewP; import lombok.Data; import java.util.List; @@ -161,7 +161,7 @@ public class Inventory { public Inventory() { } - public Inventory(MaterialAndPlaceForView mpv) { + public Inventory(MaterialAndPlaceForViewP mpv) { this.id = mpv.getIid(); this.mid = mpv.getMid(); this.mname = mpv.getMname(); diff --git a/src/main/java/com/dreamchaser/depository_manage/mapper/PlaceMapper.java b/src/main/java/com/dreamchaser/depository_manage/mapper/PlaceMapper.java index 69255426..d0c0253b 100644 --- a/src/main/java/com/dreamchaser/depository_manage/mapper/PlaceMapper.java +++ b/src/main/java/com/dreamchaser/depository_manage/mapper/PlaceMapper.java @@ -2,7 +2,7 @@ package com.dreamchaser.depository_manage.mapper; import com.dreamchaser.depository_manage.entity.MaterialAndPlace; import com.dreamchaser.depository_manage.entity.Place; -import com.dreamchaser.depository_manage.pojo.MaterialAndPlaceForView; +import com.dreamchaser.depository_manage.pojo.MaterialAndPlaceForViewP; import org.apache.ibatis.annotations.Mapper; import org.springframework.stereotype.Repository; @@ -141,21 +141,21 @@ public interface PlaceMapper { * @param map 待查询条件 * @return */ - List findPlaceAndMaterialByDidAndMid(Map map); + List findPlaceAndMaterialByDidAndMid(Map map); /** * 根据仓库id及物料id获取对应库位存储的物料 * @param map 待查询条件 * @return */ - List findPlaceAndMaterialByDidsAndMid(Map map); + List findPlaceAndMaterialByDidsAndMid(Map map); /** * 根据主键获取物料与库位的对应关系的具体数据 * @param id 待查询id * @return */ - MaterialAndPlaceForView findPlaceAndMaterialForViewById(Integer id); + MaterialAndPlaceForViewP findPlaceAndMaterialForViewById(Integer id); /** @@ -170,7 +170,7 @@ public interface PlaceMapper { * @param map 待查询条件 * @return */ - List findPlaceAndMaterialByCondition(Map map); + List findPlaceAndMaterialByCondition(Map map); /** * 根据条件获取对应库位存储的物料数量 diff --git a/src/main/java/com/dreamchaser/depository_manage/mapper/PlaceMapper.xml b/src/main/java/com/dreamchaser/depository_manage/mapper/PlaceMapper.xml index 73dc42e8..1b8c6fe7 100644 --- a/src/main/java/com/dreamchaser/depository_manage/mapper/PlaceMapper.xml +++ b/src/main/java/com/dreamchaser/depository_manage/mapper/PlaceMapper.xml @@ -33,7 +33,7 @@ - + diff --git a/src/main/java/com/dreamchaser/depository_manage/pojo/MaterialAndPlaceForView.java b/src/main/java/com/dreamchaser/depository_manage/pojo/MaterialAndPlaceForViewP.java similarity index 98% rename from src/main/java/com/dreamchaser/depository_manage/pojo/MaterialAndPlaceForView.java rename to src/main/java/com/dreamchaser/depository_manage/pojo/MaterialAndPlaceForViewP.java index 07b3cbdc..12b489d4 100644 --- a/src/main/java/com/dreamchaser/depository_manage/pojo/MaterialAndPlaceForView.java +++ b/src/main/java/com/dreamchaser/depository_manage/pojo/MaterialAndPlaceForViewP.java @@ -7,7 +7,7 @@ import java.util.List; import java.util.Map; @Data -public class MaterialAndPlaceForView { +public class MaterialAndPlaceForViewP { /** * 物料与库位映射关系id */ @@ -126,5 +126,4 @@ public class MaterialAndPlaceForView { */ 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 f5c6b6a6..347237e2 100644 --- a/src/main/java/com/dreamchaser/depository_manage/service/MaterialService.java +++ b/src/main/java/com/dreamchaser/depository_manage/service/MaterialService.java @@ -2,7 +2,7 @@ package com.dreamchaser.depository_manage.service; import com.dreamchaser.depository_manage.entity.*; import com.dreamchaser.depository_manage.pojo.InventoryP; -import com.dreamchaser.depository_manage.pojo.MaterialAndPlaceForView; +import com.dreamchaser.depository_manage.pojo.MaterialAndPlaceForViewP; import com.dreamchaser.depository_manage.pojo.MaterialP; import java.util.List; @@ -156,7 +156,7 @@ public interface MaterialService { * @param depositoryList 待查询的仓库 * @return */ - List findInventoryByMidAndDepository(Map map, List depositoryList); + List findInventoryByMidAndDepository(Map map, List depositoryList); @@ -429,5 +429,5 @@ public interface MaterialService { * @param map 具体条件 * @return */ - List findInventoryForStockTaking(Map map); + List findInventoryForStockTaking(Map map); } diff --git a/src/main/java/com/dreamchaser/depository_manage/service/PlaceService.java b/src/main/java/com/dreamchaser/depository_manage/service/PlaceService.java index 9881af07..1dd5164c 100644 --- a/src/main/java/com/dreamchaser/depository_manage/service/PlaceService.java +++ b/src/main/java/com/dreamchaser/depository_manage/service/PlaceService.java @@ -3,7 +3,7 @@ package com.dreamchaser.depository_manage.service; import com.dreamchaser.depository_manage.entity.MaterialAndPlace; import com.dreamchaser.depository_manage.entity.PidOrDidAndCode; import com.dreamchaser.depository_manage.entity.Place; -import com.dreamchaser.depository_manage.pojo.MaterialAndPlaceForView; +import com.dreamchaser.depository_manage.pojo.MaterialAndPlaceForViewP; import com.dreamchaser.depository_manage.pojo.PlaceP; import java.util.List; @@ -122,7 +122,7 @@ public interface PlaceService { * @param mid 物料id * @return */ - List findPlaceAndMaterialByDidAndMid(Integer did, Integer mid); + List findPlaceAndMaterialByDidAndMid(Integer did, Integer mid); /** * 根据仓库id及物料id获取对应库位存储的物料 @@ -130,7 +130,7 @@ public interface PlaceService { * @param map 待查询的其他数据 * @return */ - List findPlaceAndMaterialByDidsAndMid(List dids, Map map); + List findPlaceAndMaterialByDidsAndMid(List dids, Map map); /** * 根据仓库id及物料id获取对应库位存储的物料数量 @@ -145,7 +145,7 @@ public interface PlaceService { * @param map 待查询条件 * @return */ - List findPlaceAndMaterialByCondition(Map map); + List findPlaceAndMaterialByCondition(Map map); /** * 根据条件获取对应库位存储的物料数量 * @param map 待查询条件 @@ -171,7 +171,7 @@ public interface PlaceService { * @param id 待查询id * @return */ - MaterialAndPlaceForView findPlaceAndMaterialForViewById(Integer id); + MaterialAndPlaceForViewP findPlaceAndMaterialForViewById(Integer id); /** 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 09964fe1..2bd312a3 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 @@ -1032,11 +1032,11 @@ public class GroupServiceImpl implements GroupService { for (Integer depositoryId : depositoryIdList) { paramForPlace.put("depositoryId", depositoryId); // 获取当前仓库中该物料与库位的对应关系 - List materialAndPlaceForViews = placeMapper.findPlaceAndMaterialByDidAndMid(paramForPlace); + List materialAndPlaceForViews = placeMapper.findPlaceAndMaterialByDidAndMid(paramForPlace); // 定义标志位用于判断是否跳出循环 boolean flag = false; - for (MaterialAndPlaceForView materialAndPlaceForView : + for (MaterialAndPlaceForViewP materialAndPlaceForView : materialAndPlaceForViews) { // 定义物料与库位的对应关系 MaterialAndPlace mp = new MaterialAndPlace(); 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 b228df60..593741b1 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 @@ -6,15 +6,13 @@ import com.alibaba.fastjson.JSONObject; import com.dreamchaser.depository_manage.entity.*; import com.dreamchaser.depository_manage.mapper.*; import com.dreamchaser.depository_manage.pojo.InventoryP; -import com.dreamchaser.depository_manage.pojo.MaterialAndPlaceForView; +import com.dreamchaser.depository_manage.pojo.MaterialAndPlaceForViewP; import com.dreamchaser.depository_manage.pojo.MaterialP; import com.dreamchaser.depository_manage.pojo.PlaceP; import com.dreamchaser.depository_manage.service.*; import com.dreamchaser.depository_manage.utils.DateUtil; import com.dreamchaser.depository_manage.utils.ObjectFormatUtil; -import lombok.Data; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.data.redis.core.RedisOperations; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -537,8 +535,8 @@ public class MaterialServiceImpl implements MaterialService { double quantity = 0; // 获取该物料在该仓库下的映射关系 - List placeAndMaterialByDidAndMid = placeService.findPlaceAndMaterialByDidAndMid(depositoryId, groupInfo.getMid()); - for (MaterialAndPlaceForView materialAndPlaceForView : placeAndMaterialByDidAndMid) { + List placeAndMaterialByDidAndMid = placeService.findPlaceAndMaterialByDidAndMid(depositoryId, groupInfo.getMid()); + for (MaterialAndPlaceForViewP materialAndPlaceForView : placeAndMaterialByDidAndMid) { paramForSplitInventory.put("iid", materialAndPlaceForView.getId()); MaterialAndPlace materialAndPlace = new MaterialAndPlace(); materialAndPlace.setQuantity((int)(materialAndPlaceForView.getInventory() / 100)); @@ -563,15 +561,18 @@ public class MaterialServiceImpl implements MaterialService { * @return */ @Override - public List findInventoryByMidAndDepository(Map map, List depositoryList) { + public List findInventoryByMidAndDepository(Map map, List depositoryList) { Integer mid = ObjectFormatUtil.toInteger(map.get("mid")); // 获取当前物料的所有拆单记录 List splitInfoList = splitUnitMapper.findSplitInfoByMid(mid); // 定义参数用于获取当前物料在仓库下的各库位记录 - List placeAndMaterialByDidsAndMid = placeService.findPlaceAndMaterialByDidsAndMid(depositoryList, map); + List placeAndMaterialByDidsAndMid = placeService.findPlaceAndMaterialByDidsAndMid(depositoryList, map); if (placeAndMaterialByDidsAndMid.size() > 0) { // 如果存在库存记录 - + for (MaterialAndPlaceForViewP materialByDidsAndMid:placeAndMaterialByDidsAndMid + ) { + materialByDidsAndMid.setInventory(materialByDidsAndMid.getInventory() / 100); + } return packMpvList(placeAndMaterialByDidsAndMid, map); } @@ -2606,7 +2607,7 @@ public class MaterialServiceImpl implements MaterialService { * @return */ @Override - public List findInventoryForStockTaking(Map map) { + public List findInventoryForStockTaking(Map map) { Integer size = 10, page = 1; if (map.containsKey("size")) { size = ObjectFormatUtil.toInteger(map.get("size")); @@ -2620,13 +2621,17 @@ public class MaterialServiceImpl implements MaterialService { if (Integer.compare(placeId, 0) == 0) { map.remove("placeId"); } - List placeAndMaterialByCondition = placeService.findPlaceAndMaterialByCondition(map); + List placeAndMaterialByCondition = placeService.findPlaceAndMaterialByCondition(map); + for (MaterialAndPlaceForViewP placeAndPlaceForViewP:placeAndMaterialByCondition + ) { + placeAndPlaceForViewP.setInventory(placeAndPlaceForViewP.getInventory() / 100); + } return packMpvList(placeAndMaterialByCondition, map); } - List packMpvList(List materialAndPlaceForViewList, Map map) { - for (MaterialAndPlaceForView mpv : materialAndPlaceForViewList + List packMpvList(List materialAndPlaceForViewList, Map map) { + for (MaterialAndPlaceForViewP mpv : materialAndPlaceForViewList ) { // 获取其对应的拆单记录 List list = splitUnitMapper.findSplitInfoByMid(mpv.getMid()); diff --git a/src/main/java/com/dreamchaser/depository_manage/service/impl/PlaceServiceImpl.java b/src/main/java/com/dreamchaser/depository_manage/service/impl/PlaceServiceImpl.java index 3429a943..458e1a4a 100644 --- a/src/main/java/com/dreamchaser/depository_manage/service/impl/PlaceServiceImpl.java +++ b/src/main/java/com/dreamchaser/depository_manage/service/impl/PlaceServiceImpl.java @@ -5,7 +5,7 @@ import com.dreamchaser.depository_manage.entity.*; import com.dreamchaser.depository_manage.mapper.MaterialMapper; import com.dreamchaser.depository_manage.mapper.PlaceMapper; import com.dreamchaser.depository_manage.mapper.QrCodeMapper; -import com.dreamchaser.depository_manage.pojo.MaterialAndPlaceForView; +import com.dreamchaser.depository_manage.pojo.MaterialAndPlaceForViewP; import com.dreamchaser.depository_manage.pojo.PlaceP; import com.dreamchaser.depository_manage.service.DepositoryService; import com.dreamchaser.depository_manage.service.PlaceService; @@ -278,7 +278,7 @@ public class PlaceServiceImpl implements PlaceService { * @return */ @Override - public List findPlaceAndMaterialByDidAndMid(Integer did, Integer mid) { + public List findPlaceAndMaterialByDidAndMid(Integer did, Integer mid) { Map map = new HashMap<>(); map.put("depositoryId", did); map.put("mid", mid); @@ -294,7 +294,7 @@ public class PlaceServiceImpl implements PlaceService { * @return */ @Override - public List findPlaceAndMaterialByDidsAndMid(List dids, Map map) { + public List findPlaceAndMaterialByDidsAndMid(List dids, Map map) { Integer size = 10, page = 1; if (map.containsKey("size")) { size = ObjectFormatUtil.toInteger(map.get("size")); @@ -322,7 +322,7 @@ public class PlaceServiceImpl implements PlaceService { * @return */ @Override - public List findPlaceAndMaterialByCondition(Map map) { + public List findPlaceAndMaterialByCondition(Map map) { return placeMapper.findPlaceAndMaterialByCondition(map); } @@ -358,7 +358,7 @@ public class PlaceServiceImpl implements PlaceService { } @Override - public MaterialAndPlaceForView findPlaceAndMaterialForViewById(Integer id) { + public MaterialAndPlaceForViewP findPlaceAndMaterialForViewById(Integer id) { return placeMapper.findPlaceAndMaterialForViewById(id); } 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 c5e47c38..bf490333 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 @@ -25,7 +25,6 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import javax.servlet.http.HttpServletRequest; -import javax.sound.sampled.Port; import java.math.BigDecimal; import java.util.*; import java.util.concurrent.TimeUnit; @@ -139,11 +138,11 @@ public class StockTakingServiceImpl implements StockTakingService { */ @Transactional(rollbackFor = Exception.class) @Override - public Integer insertStockTakingByMaterial(Map map, Set keys,UserByPort userToken) { + public Integer insertStockTakingByMaterial(Map map, Set keys, UserByPort userToken) { int success = 0; // 定义用于存储仓库与当前对应关系的map - Map> paramForDepositoryAndPid = new HashMap<>(); + Map> paramForDepositoryAndPid = new HashMap<>(); for (String key : keys) { Boolean flagForSubmit = ObjectFormatUtil.toBoolean(redisTemplate.opsForHash().get(key, "flagForSubmit")); if (flagForSubmit != null && !flagForSubmit) { @@ -151,11 +150,11 @@ public class StockTakingServiceImpl implements StockTakingService { // 获取盘点时的物料与库位的对应关系id Integer id = ObjectFormatUtil.toInteger(redisTemplate.opsForHash().get(key, "id")); // 获取物料与库位的对应关系 - MaterialAndPlaceForView placeAndMaterial = placeMapper.findPlaceAndMaterialForViewById(id); + MaterialAndPlaceForViewP placeAndMaterial = placeMapper.findPlaceAndMaterialForViewById(id); // 获取对应的仓库编码 String dcode = placeAndMaterial.getDcode(); // 判断该仓库是否已经存在 - List materialAndPlaceForViews = paramForDepositoryAndPid.get(dcode); + List materialAndPlaceForViews = paramForDepositoryAndPid.get(dcode); if (materialAndPlaceForViews != null && materialAndPlaceForViews.size() > 0) { // 如果已经存在 @@ -163,7 +162,7 @@ public class StockTakingServiceImpl implements StockTakingService { materialAndPlaceForViews.add(placeAndMaterial); } else { // 如果不存在 - List list = new ArrayList<>(); + List list = new ArrayList<>(); list.add(placeAndMaterial); paramForDepositoryAndPid.put(dcode, list); } @@ -174,12 +173,12 @@ public class StockTakingServiceImpl implements StockTakingService { Set strings = paramForDepositoryAndPid.keySet(); for (String string : strings ) { - List materialAndPlaceForViews = paramForDepositoryAndPid.get(string); + List materialAndPlaceForViews = paramForDepositoryAndPid.get(string); // 定义用于插入的盘点记录 Map param = new HashMap<>(); - for (MaterialAndPlaceForView mpv:materialAndPlaceForViews - ) { - String key = "wms_stockTaking_" + userToken.getId() + "_" + DateUtil.getNowTime() + "_"+mpv.getId(); + for (MaterialAndPlaceForViewP mpv : materialAndPlaceForViews + ) { + String key = "wms_stockTaking_" + userToken.getId() + "_" + DateUtil.getNowTime() + "_" + mpv.getId(); Object unit = redisTemplate.opsForHash().get(key, "unit"); @@ -216,7 +215,7 @@ public class StockTakingServiceImpl implements StockTakingService { } mainIdList.add(param.get("mainId")); } - map.put("mainIdList",mainIdList); + map.put("mainIdList", mainIdList); } return success; } @@ -243,7 +242,7 @@ public class StockTakingServiceImpl implements StockTakingService { @Override public List findMyTask(Map map, HttpServletRequest request) { String token = request.getHeader("user-token"); - if(token == null){ + if (token == null) { token = (String) request.getSession().getAttribute("userToken"); } UserByPort userToken = AuthenticationTokenPool.getUserToken(token); @@ -292,7 +291,7 @@ public class StockTakingServiceImpl implements StockTakingService { public List findMyApply(Map map, HttpServletRequest request) { Integer size = 10, page = 1; String token = request.getHeader("user-token"); - if(token == null){ + if (token == null) { token = (String) request.getSession().getAttribute("userToken"); } UserByPort userToken = AuthenticationTokenPool.getUserToken(token); @@ -456,7 +455,6 @@ public class StockTakingServiceImpl implements StockTakingService { // 定义出错信息 List err = new ArrayList<>(); - Integer depositoryId = mainRecord.getDepositoryId(); // 获取所有子单 @@ -495,9 +493,9 @@ public class StockTakingServiceImpl implements StockTakingService { Integer newInventory = minRecord.getNewInventory(); // 获取当前库位上物料数量 - Integer oldQuantity = inventoryById.getQuantity() - placeAndMaterialByMidAndPid.getQuantity(); + int oldQuantity = inventoryById.getQuantity() - placeAndMaterialByMidAndPid.getQuantity(); - inventoryById.setQuantity(oldQuantity + newInventory); + inventoryById.setQuantity(oldQuantity + newInventory * 100); // 用于计算新的库位数量 @@ -508,7 +506,7 @@ public class StockTakingServiceImpl implements StockTakingService { // 如果盘盈 // 更新当前库位数量 - newNumberForPlace = placeById.getQuantity() + inventory; + newNumberForPlace = placeById.getQuantity() + inventory * 100; if (newNumberForPlace < placeById.getMax()) { @@ -524,14 +522,14 @@ public class StockTakingServiceImpl implements StockTakingService { continue; } - newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() + inventory; + newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() + inventory * 100; // 更新物料与库位对应关系的数量 placeAndMaterialByMidAndPid.setQuantity(newNumberForMatrialAndPlace); } else { // 如果盘亏 - newNumberForPlace = placeById.getQuantity() - inventory; + newNumberForPlace = placeById.getQuantity() - inventory * 100; if (newNumberForPlace > placeById.getMin()) { //如果更新后的库位数量没有下溢 @@ -540,7 +538,7 @@ public class StockTakingServiceImpl implements StockTakingService { placeById.setQuantity(newNumberForPlace); // 更新物料与库位对应关系的数量 - newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() - inventory; + newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() - inventory * 100; } else { placeById.setQuantity(0); @@ -745,28 +743,28 @@ public class StockTakingServiceImpl implements StockTakingService { // 获取当前生产日期下的物料与生产日期的对应关系 MaterialAndProducedDate materialAndProducedDate = materialMapper.findMaterialAndProducedDateByMidAndProducedDate(mapForProducedDate); Integer oldInventory = materialAndProducedDate.getInventory(); - if (newInventory > oldInventory) { + if (newInventory * 100 >= oldInventory) { // 如果当前盘点数量大于库存数量 // 修改当前库存 - materialAndProducedDate.setInventory(newInventory); + materialAndProducedDate.setInventory(newInventory * 100); // 修改使用数量 - materialAndProducedDate.setExpendnum(materialAndProducedDate.getQuantity() - newInventory); + materialAndProducedDate.setExpendnum(materialAndProducedDate.getQuantity() - newInventory * 100); // 修改物料对应数量 - inventoryById.setQuantity(inventoryById.getQuantity() + newInventory - oldInventory); + inventoryById.setQuantity(inventoryById.getQuantity() + newInventory * 100 - oldInventory * 100); } else { // 如果当前盘点数量小于库存数量 // 修改当前库存 - materialAndProducedDate.setInventory(newInventory); + materialAndProducedDate.setInventory(newInventory * 100); // 修改使用数量 - materialAndProducedDate.setExpendnum(materialAndProducedDate.getQuantity() - newInventory); + materialAndProducedDate.setExpendnum(materialAndProducedDate.getQuantity() - newInventory * 100); // 修改物料对应数量 - inventoryById.setQuantity(inventoryById.getQuantity() - oldInventory + newInventory); + inventoryById.setQuantity(inventoryById.getQuantity() - oldInventory * 100 + newInventory * 100); } materialMapper.updateMaterialAndProducedDate(materialAndProducedDate); @@ -784,7 +782,7 @@ public class StockTakingServiceImpl implements StockTakingService { if ("-1".equals(unit) || inventoryById.getUnit().equals(minRecord.getUnit())) { // 更新当前库位数量 - newNumberForPlace = placeById.getQuantity() + inventory; + newNumberForPlace = placeById.getQuantity() + inventory * 100; if (newNumberForPlace <= placeById.getMax()) { // 如果更新后的库位数量没有上溢 @@ -798,9 +796,9 @@ public class StockTakingServiceImpl implements StockTakingService { continue; } - inventoryById.setQuantity(inventoryById.getQuantity() + inventory); + inventoryById.setQuantity(inventoryById.getQuantity() + inventory * 100); - newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() + inventory; + newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() + inventory * 100; // 更新物料与库位对应关系的数量 placeAndMaterialByMidAndPid.setQuantity(newNumberForMatrialAndPlace); @@ -820,7 +818,7 @@ public class StockTakingServiceImpl implements StockTakingService { // 如果存在拆单库存记录 if (splitInventory != null) { // 获取当前盘点后的库存数 - int realQuantity = Math.round(inventory) + splitInventory.getSaveQuantity(); + double realQuantity = Math.round(inventory) + (double) (splitInventory.getSaveQuantity() / 100); // 定义当前进制 int scale = splitInfo.getQuantity(); if (realQuantity >= scale) { @@ -830,7 +828,7 @@ public class StockTakingServiceImpl implements StockTakingService { int disposeQuantity = (int) Math.round(Math.floor((double) inventory / scale)); // 计算要进的数目 - int quantity_in = (realQuantity / scale); + double quantity_in = (realQuantity / (scale)); // 更新处理数量 disposeQuantity += quantity_in; @@ -838,7 +836,7 @@ public class StockTakingServiceImpl implements StockTakingService { realQuantity = realQuantity - quantity_in * scale; // 设置当前数量为实际数量 - splitInventory.setSaveQuantity(realQuantity); + splitInventory.setSaveQuantity((int) realQuantity * 100); // 修改当前拆单库存 splitUnitMapper.updateSplitInventory(splitInventory); @@ -847,15 +845,15 @@ public class StockTakingServiceImpl implements StockTakingService { map.put("quantity", String.valueOf(disposeQuantity)); splitUnitService.updateSplitInfoSaveQuantity(parentSplitInfo, disposeQuantity, placeAndMaterialByMidAndPid.getId(), map, inventory, splitInfo); } else { - placeById.setQuantity(placeById.getQuantity() + disposeQuantity); - placeAndMaterialByMidAndPid.setQuantity(placeAndMaterialByMidAndPid.getQuantity() + disposeQuantity); + placeById.setQuantity(placeById.getQuantity() + disposeQuantity * 100); + placeAndMaterialByMidAndPid.setQuantity(placeAndMaterialByMidAndPid.getQuantity() + disposeQuantity * 100); } } else { // 如果不需要进位 // 修改当前库存 - splitInventory.setSaveQuantity(realQuantity); + splitInventory.setSaveQuantity((int) realQuantity * 100); // 修改拆单库存 splitUnitMapper.updateSplitInventory(splitInventory); } @@ -882,7 +880,7 @@ public class StockTakingServiceImpl implements StockTakingService { if ("-1".equals(unit) || inventoryById.getUnit().equals(minRecord.getUnit())) { // 如果盘点的是基础单位 - newNumberForPlace = placeById.getQuantity() - inventory; + newNumberForPlace = placeById.getQuantity() - inventory * 100; if (newNumberForPlace > placeById.getMin()) { //如果更新后的库位数量没有下溢 @@ -891,14 +889,14 @@ public class StockTakingServiceImpl implements StockTakingService { placeById.setQuantity(newNumberForPlace); // 更新物料与库位对应关系的数量 - newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() - inventory; + newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() - inventory * 100; } else { placeById.setQuantity(0); newNumberForMatrialAndPlace = 0; } - inventoryById.setQuantity(inventoryById.getQuantity() - inventory); + inventoryById.setQuantity(inventoryById.getQuantity() - inventory * 100); placeAndMaterialByMidAndPid.setQuantity(newNumberForMatrialAndPlace); @@ -916,11 +914,11 @@ public class StockTakingServiceImpl implements StockTakingService { if (splitInventory != null) { // 如果存在拆单记录 - if (splitInventory.getSaveQuantity() - inventory >= 0) { + if (splitInventory.getSaveQuantity() - inventory * 100 >= 0) { // 如果单纯的拆单库存满足数量 // 设置当前拆单库存的数量 - splitInventory.setSaveQuantity(splitInventory.getSaveQuantity() - inventory); + splitInventory.setSaveQuantity(splitInventory.getSaveQuantity() - inventory * 100); // 修改拆单库存 splitUnitMapper.updateSplitInventory(splitInventory); } else { @@ -931,7 +929,7 @@ public class StockTakingServiceImpl implements StockTakingService { if (allSplitInventory - inventory >= 0) { // 获取剩余不足的数量 - int surplus = inventory - splitInventory.getSaveQuantity(); + double surplus = inventory - (double) splitInventory.getSaveQuantity() / 100; // 如果盘点后库存数大于0 if (splitInfo.getParentId() != null) { // 如果当前拆单有父级 @@ -961,58 +959,58 @@ public class StockTakingServiceImpl implements StockTakingService { // 如果当前未处理的数量小于当前拆单库存数量 // 如果物料数量可以出库并且库位数量充足 - if (placeAndMaterialByMidAndPid.getQuantity() >= 1) { + if (placeAndMaterialByMidAndPid.getQuantity() >= 100) { // 令库存-1 - inventoryById.setQuantity(inventoryById.getQuantity() - 1); + inventoryById.setQuantity(inventoryById.getQuantity() - 100); // 修改当前库位存放物料的数量 - placeAndMaterialByMidAndPid.setQuantity(placeAndMaterialByMidAndPid.getQuantity() - 1); + placeAndMaterialByMidAndPid.setQuantity(placeAndMaterialByMidAndPid.getQuantity() - 100); placeMapper.updateMaterialAndPlace(placeAndMaterialByMidAndPid); - placeById.setQuantity(placeById.getQuantity() - 1); + placeById.setQuantity(placeById.getQuantity() - 100); // 设置剩余拆单库存处理数量 - splitInventory.setSaveQuantity(splitInfo.getQuantity() + splitInventory.getSaveQuantity() - inventory); - splitInventory.setOutQuantity(splitInventory.getOutQuantity() + inventory); + splitInventory.setSaveQuantity(splitInfo.getQuantity() + splitInventory.getSaveQuantity() - inventory * 100); + splitInventory.setOutQuantity(splitInventory.getOutQuantity() + inventory * 100); splitUnitMapper.updateSplitInventory(splitInventory); } } else { // 如果大于 // 获取库存重要减少的数量 - int surplus_redundant = surplus / splitInfo.getQuantity(); + double surplus_redundant = surplus / splitInfo.getQuantity(); // 获取拆单库存处理中要处理数量 - int saveQuantity = surplus - surplus_redundant * splitInfo.getQuantity(); + double saveQuantity = surplus - surplus_redundant * splitInfo.getQuantity(); - if (saveQuantity > splitInventory.getSaveQuantity()) { + if (saveQuantity * 100 >= splitInventory.getSaveQuantity()) { // 如果要处理的数量大于剩余数量 // 获取一个数量 - surplus_redundant += 1; - splitInventory.setSaveQuantity(splitInfo.getQuantity() + splitInventory.getSaveQuantity() - saveQuantity); + surplus_redundant += 1.0; + splitInventory.setSaveQuantity(splitInfo.getQuantity() + splitInventory.getSaveQuantity() - (int) saveQuantity * 100); } else { // 如果不大于 - splitInventory.setSaveQuantity(splitInventory.getSaveQuantity() - saveQuantity); + splitInventory.setSaveQuantity(splitInventory.getSaveQuantity() - (int) saveQuantity * 100); } - if (placeAndMaterialByMidAndPid.getQuantity() >= surplus_redundant) { + if (placeAndMaterialByMidAndPid.getQuantity() >= surplus_redundant * 100) { // 如果能够出库 // 令库存-1 - inventoryById.setQuantity(inventoryById.getQuantity() - surplus_redundant); + inventoryById.setQuantity(inventoryById.getQuantity() - (int) surplus_redundant * 100); // 修改当前库位存放物料的数量 - placeAndMaterialByMidAndPid.setQuantity(placeAndMaterialByMidAndPid.getQuantity() - surplus_redundant); + placeAndMaterialByMidAndPid.setQuantity(placeAndMaterialByMidAndPid.getQuantity() - (int) surplus_redundant * 100); - placeById.setQuantity(placeById.getQuantity() - surplus_redundant); + placeById.setQuantity(placeById.getQuantity() - (int) surplus_redundant * 100); } else { inventoryById.setQuantity(inventoryById.getQuantity() - placeAndMaterialByMidAndPid.getQuantity()); @@ -1066,11 +1064,11 @@ public class StockTakingServiceImpl implements StockTakingService { // 更新库存数量 - inventoryById.setQuantity(inventoryById.getQuantity() - residue); + inventoryById.setQuantity(inventoryById.getQuantity() - residue * 100); - placeAndMaterialByMidAndPid.setQuantity(placeAndMaterialByMidAndPid.getQuantity() - residue); + placeAndMaterialByMidAndPid.setQuantity(placeAndMaterialByMidAndPid.getQuantity() - residue * 100); - placeById.setQuantity(placeById.getQuantity() - residue); + placeById.setQuantity(placeById.getQuantity() - residue * 100); // 插入拆单记录 Map insertForSplitInventory = new HashMap<>(); @@ -1205,44 +1203,50 @@ public class StockTakingServiceImpl implements StockTakingService { // 获取所有子单 List minRecordList = stockTakingMapper.selectStockTakingChildByMainId(mainId); + // 遍历当前拆单的子单详情 for (StockTakingChildP minRecord : minRecordList) { - // 获取当前盘点的计量单位 - String unit = minRecord.getUnit(); - // 获取盘点的库位id + // 获取子单详情 + Integer placeId = minRecord.getPid(); // 获取库位详情 Place placeById = placeMapper.findPlaceById(placeId); // 获取当前盘点结果 String takingResult = minRecord.getTakingResult(); - if ("Inventory_normal".equals(takingResult)) { - // 如果盘点结果正常 - continue; - } - // 获取盈亏数量 - Integer inventory = minRecord.getInventory(); + // 获取当前盘点的计量单位 + String unit = minRecord.getUnit(); // 获取盘点物料信息 Inventory inventoryById = materialMapper.findInventoryById(minRecord.getMid()); - // 用于获取物料与库位的对应关系 + // 定义用于获取物料与库位的对应关系的参数 Map paramForMaterialAndPlace = new HashMap<>(); paramForMaterialAndPlace.put("mid", inventoryById.getId()); paramForMaterialAndPlace.put("pid", placeById.getId()); // 获取物料与库位的对应关系 MaterialAndPlace placeAndMaterialByMidAndPid = placeMapper.findPlaceAndMaterialByMidAndPid(paramForMaterialAndPlace); - // 根据盘点结果重新计算物料的单价 + String key = "wms_stockTaking_" + userByPort.getId() + "_" + DateUtil.getNowTime() + "_" + placeAndMaterialByMidAndPid.getId(); + + redisTemplate.delete(key); + + + if ("Inventory_normal".equals(takingResult)) { + // 如果盘点结果正常 + continue; + } + + // 获取盈亏数量 + Integer inventory = minRecord.getInventory(); + // 获取判断对应的生产日期 Long producedDate = minRecord.getProducedDate(); - // 数据库中的总额 - double amounts = (inventoryById.getAmounts() / 100); // 当前盘点数目 Integer newInventory = minRecord.getNewInventory(); @@ -1256,120 +1260,49 @@ public class StockTakingServiceImpl implements StockTakingService { mapForProducedDate.put("producedDate", producedDate); // 获取当前生产日期下的物料与生产日期的对应关系 MaterialAndProducedDate materialAndProducedDate = materialMapper.findMaterialAndProducedDateByMidAndProducedDate(mapForProducedDate); - Integer oldInventroy = materialAndProducedDate.getInventory(); - if (newInventory > oldInventroy) { + Integer oldInventory = materialAndProducedDate.getInventory(); + if (newInventory * 100 >= oldInventory) { // 如果当前盘点数量大于库存数量 // 修改当前库存 - materialAndProducedDate.setInventory(newInventory); + materialAndProducedDate.setInventory(newInventory * 100); // 修改使用数量 - materialAndProducedDate.setExpendnum(materialAndProducedDate.getQuantity() - newInventory); - if (materialAndProducedDate.getQuantity() - newInventory < 0) { - materialAndProducedDate.setExpendnum(0); - } + materialAndProducedDate.setExpendnum(materialAndProducedDate.getQuantity() - newInventory * 100); + // 修改物料对应数量 - inventoryById.setQuantity(inventoryById.getQuantity() + newInventory - oldInventroy); + inventoryById.setQuantity(inventoryById.getQuantity() + newInventory * 100 - oldInventory * 100); } else { // 如果当前盘点数量小于库存数量 // 修改当前库存 - materialAndProducedDate.setInventory(newInventory); + materialAndProducedDate.setInventory(newInventory * 100); // 修改使用数量 - materialAndProducedDate.setExpendnum(materialAndProducedDate.getQuantity() - newInventory); + materialAndProducedDate.setExpendnum(materialAndProducedDate.getQuantity() - newInventory * 100); // 修改物料对应数量 - inventoryById.setQuantity(inventoryById.getQuantity() - oldInventroy + newInventory); - } - - // 定义平均价格 - Double avgPrice = 0.0; - // 获取当前物料数目 - Integer quantity = inventoryById.getQuantity(); - if (quantity > 0) { - // 如果当前物料数目不为零 - avgPrice = amounts / quantity; - BigDecimal bg = new BigDecimal(avgPrice); - avgPrice = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); + inventoryById.setQuantity(inventoryById.getQuantity() - oldInventory * 100 + newInventory * 100); } - // 更新物料单价 - inventoryById.setPrice(avgPrice); materialMapper.updateMaterialAndProducedDate(materialAndProducedDate); - } else { - // 如果没有生产日期 - - // 获取当前生产日期中的物料 - List materialAndProducedDateByMid = materialMapper.findMaterialAndProducedDateByMid(inventoryById.getId()); - if (materialAndProducedDateByMid.size() > 0) { // 如果数量大于0 - MaterialAndProducedDate materialAndProducedDate = materialAndProducedDateByMid.get(materialAndProducedDateByMid.size() - 1); - // 获取当前生产日期下物料的数量 - Integer oldInventroy = materialAndProducedDate.getInventory(); - if (newInventory > oldInventroy) { - // 如果当前盘点数量大于库存数量 - - // 修改当前库存 - materialAndProducedDate.setInventory(newInventory); - // 修改使用数量 - materialAndProducedDate.setExpendnum(materialAndProducedDate.getQuantity() - newInventory); - if (materialAndProducedDate.getQuantity() - newInventory < 0) { - materialAndProducedDate.setExpendnum(0); - } - - } else { - // 如果当前盘点数量小于库存数量 - - // 修改当前库存 - materialAndProducedDate.setInventory(newInventory); - // 修改使用数量 - materialAndProducedDate.setExpendnum(materialAndProducedDate.getQuantity() - newInventory); - - // 修改物料对应数量 - inventoryById.setQuantity(inventoryById.getQuantity() - oldInventroy + newInventory); - } - materialMapper.updateMaterialAndProducedDate(materialAndProducedDate); - } - - - // 获取当前库位以外的物料数量 - Integer oldQuantity = inventoryById.getQuantity() - placeAndMaterialByMidAndPid.getQuantity(); - // 获取新的物料数目 - int quantity = oldQuantity + newInventory; - - // 平均价格 - Double avgPrice = 0.0; - if (Integer.compare(newInventory, 0) != 0) { - // 如果新的库存不是0 - - // 新的均价 - avgPrice = (amounts / (quantity)) * 100; - BigDecimal bg = new BigDecimal(avgPrice); - avgPrice = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); - } - // 更新物料单价 - inventoryById.setPrice(avgPrice); - - // 更新物料数目 - inventoryById.setQuantity(quantity); } - // 用于计算新的库位数量 - Integer newNumberForPlace = 0; + int newNumberForPlace = 0; // 用于计算新的库位与物料对应关系的数量 - Integer newNumberForMatrialAndPlace = 0; + int newNumberForMatrialAndPlace = 0; + if ("Inventory_up".equals(takingResult)) { // 如果盘盈 // 如果是基础单位 - if ("-1".equals(unit)) { + if ("-1".equals(unit) || inventoryById.getUnit().equals(minRecord.getUnit())) { // 更新当前库位数量 - newNumberForPlace = placeById.getQuantity() + inventory; + newNumberForPlace = placeById.getQuantity() + inventory * 100; if (newNumberForPlace <= placeById.getMax()) { - // 如果更新后的库位数量没有上溢 // 更新当前库位的数量 @@ -1381,23 +1314,16 @@ public class StockTakingServiceImpl implements StockTakingService { continue; } + inventoryById.setQuantity(inventoryById.getQuantity() + inventory * 100); - newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() + inventory; + newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() + inventory * 100; // 更新物料与库位对应关系的数量 placeAndMaterialByMidAndPid.setQuantity(newNumberForMatrialAndPlace); } else { // 如果是拆单单位 - // 更新当前库位数量 - newNumberForPlace = placeById.getQuantity() + inventory; - if (newNumberForPlace > placeById.getMax()) { - // 添加错误信息 - errIds.add(minRecord.getId()); - err.add("当前库位数量溢出,需要转移"); - continue; - } // 用于查找对应的拆单记录 Map paramForSplitInfo = new HashMap<>(); paramForSplitInfo.put("newUnit", unit); @@ -1407,20 +1333,20 @@ public class StockTakingServiceImpl implements StockTakingService { // 查找当前拆单记录对应的库存记录 SplitInventory splitInventory = splitUnitService.findSplitInventoryByIidAndSid(placeAndMaterialByMidAndPid.getId(), splitInfo.getId()); - + // 如果存在拆单库存记录 if (splitInventory != null) { - int realQuantity = Math.round(inventory) + splitInventory.getSaveQuantity(); + // 获取当前盘点后的库存数 + double realQuantity = Math.round(inventory) + (double) (splitInventory.getSaveQuantity() / 100); // 定义当前进制 int scale = splitInfo.getQuantity(); if (realQuantity >= scale) { // 如果当前盘点的数量大于拆单规定的进制数量 - // 计算当前进制下的进位数量 int disposeQuantity = (int) Math.round(Math.floor((double) inventory / scale)); // 计算要进的数目 - int quantity_in = (realQuantity / scale); + double quantity_in = (realQuantity / (scale)); // 更新处理数量 disposeQuantity += quantity_in; @@ -1428,57 +1354,51 @@ public class StockTakingServiceImpl implements StockTakingService { realQuantity = realQuantity - quantity_in * scale; // 设置当前数量为实际数量 - splitInventory.setSaveQuantity(realQuantity); + splitInventory.setSaveQuantity((int) realQuantity * 100); // 修改当前拆单库存 splitUnitMapper.updateSplitInventory(splitInventory); if (splitInfo.getParentId() != null) { SplitInfo parentSplitInfo = splitUnitMapper.findSplitInfoById(splitInfo.getParentId()); - map.put("price", String.valueOf(inventoryById.getPrice() / 100)); map.put("quantity", String.valueOf(disposeQuantity)); splitUnitService.updateSplitInfoSaveQuantity(parentSplitInfo, disposeQuantity, placeAndMaterialByMidAndPid.getId(), map, inventory, splitInfo); } else { - placeById.setQuantity(placeById.getQuantity() + disposeQuantity); - placeAndMaterialByMidAndPid.setQuantity(placeAndMaterialByMidAndPid.getQuantity() + disposeQuantity); + placeById.setQuantity(placeById.getQuantity() + disposeQuantity * 100); + placeAndMaterialByMidAndPid.setQuantity(placeAndMaterialByMidAndPid.getQuantity() + disposeQuantity * 100); } } else { // 如果不需要进位 // 修改当前库存 - splitInventory.setSaveQuantity(realQuantity); + splitInventory.setSaveQuantity((int) realQuantity * 100); // 修改拆单库存 splitUnitMapper.updateSplitInventory(splitInventory); } } else { + // 如果不存在拆单库存记录 - // 获取进制数目 - int scale = splitUnitService.findSplitInfoScaleQuantity(splitInfo, -1); - - Map insertForSplitInventory = new HashMap<>(); - - insertForSplitInventory.put("mid", inventoryById.getMid()); - insertForSplitInventory.put("mcode", inventoryById.getCode()); - insertForSplitInventory.put("price", inventoryById.getPrice() / scale); - insertForSplitInventory.put("quantity", inventory); - insertForSplitInventory.put("unit", unit); - insertForSplitInventory.put("depositoryId", mainRecord.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); + Map paramForUpdateSplitInventory = new HashMap<>(); + paramForUpdateSplitInventory.put("placeId", minRecord.getPid()); + paramForUpdateSplitInventory.put("depositoryId", mainRecord.getDepositoryId()); + paramForUpdateSplitInventory.put("quantity", inventory); + paramForUpdateSplitInventory.put("mid", inventoryById.getMid()); + paramForUpdateSplitInventory.put("unit", minRecord.getUnit()); + splitUnitService.realInInventoryToDepository(Double.valueOf(inventory), null, paramForUpdateSplitInventory, splitInfo, placeAndMaterialByMidAndPid, false); + if (paramForUpdateSplitInventory.containsKey("applicationInId")) { + depositoryRecordMapper.deleteApplicationInRecordById(ObjectFormatUtil.toInteger(paramForUpdateSplitInventory.get("applicationInId"))); + } } } } else { // 如果盘亏 - if ("-1".equals(unit)) { + if ("-1".equals(unit) || inventoryById.getUnit().equals(minRecord.getUnit())) { // 如果盘点的是基础单位 - newNumberForPlace = placeById.getQuantity() - inventory; + newNumberForPlace = placeById.getQuantity() - inventory * 100; if (newNumberForPlace > placeById.getMin()) { //如果更新后的库位数量没有下溢 @@ -1487,19 +1407,19 @@ public class StockTakingServiceImpl implements StockTakingService { placeById.setQuantity(newNumberForPlace); // 更新物料与库位对应关系的数量 - newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() - inventory; + newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() - inventory * 100; } else { placeById.setQuantity(0); newNumberForMatrialAndPlace = 0; } + inventoryById.setQuantity(inventoryById.getQuantity() - inventory * 100); placeAndMaterialByMidAndPid.setQuantity(newNumberForMatrialAndPlace); } else { // 如果是拆单单位 - // 用于查找对应的拆单记录 Map paramForSplitInfo = new HashMap<>(); paramForSplitInfo.put("newUnit", unit); @@ -1512,50 +1432,178 @@ public class StockTakingServiceImpl implements StockTakingService { if (splitInventory != null) { // 如果存在拆单记录 - if (splitInventory.getSaveQuantity() - inventory > 0) { - // 如果当前数量没有下溢 + if (splitInventory.getSaveQuantity() - inventory * 100 >= 0) { + // 如果单纯的拆单库存满足数量 // 设置当前拆单库存的数量 - splitInventory.setSaveQuantity(splitInventory.getSaveQuantity() - inventory); + splitInventory.setSaveQuantity(splitInventory.getSaveQuantity() - inventory * 100); // 修改拆单库存 splitUnitMapper.updateSplitInventory(splitInventory); } else { - // 如果发生下溢 + // 拆单库存如果不能满足 + // 获取当前拆单单位对应的所有库存 + double allSplitInventory = splitUnitService.findAllInventoryForSplitInfo(-1, placeAndMaterialByMidAndPid, splitInfo.getId(), 0, true); + if (allSplitInventory - inventory >= 0) { - // 设置当前拆单库存的数量 - splitInventory.setSaveQuantity(0); - // 修改拆单库存 - splitUnitMapper.updateSplitInventory(splitInventory); + // 获取剩余不足的数量 + double surplus = inventory - (double) splitInventory.getSaveQuantity() / 100; + // 如果盘点后库存数大于0 + if (splitInfo.getParentId() != null) { + // 如果当前拆单有父级 + + + // 设置剩余拆单库存处理数量 + + + // 设置当前拆单库存出库数量 + splitInventory.setOutQuantity(splitInventory.getOutQuantity() + splitInventory.getSaveQuantity()); + + // 将当前库存设置为0 + splitInventory.setSaveQuantity(0); + // 修改库存数量 + splitUnitMapper.updateSplitInventory(splitInventory); + + + // 获取当前父级拆单记录 + SplitInfo parentSplitInfo = splitUnitMapper.findSplitInfoById(splitInfo.getParentId()); + + depositoryRecordService.updateOutSplitInventoryInfo(parentSplitInfo, placeAndMaterialByMidAndPid, inventory, surplus, splitInfo); + + } else { + // 如果没有父级 + if (surplus <= splitInfo.getQuantity()) { + + // 如果当前未处理的数量小于当前拆单库存数量 + + // 如果物料数量可以出库并且库位数量充足 + if (placeAndMaterialByMidAndPid.getQuantity() >= 100) { + + + // 令库存-1 + inventoryById.setQuantity(inventoryById.getQuantity() - 100); + + + // 修改当前库位存放物料的数量 + placeAndMaterialByMidAndPid.setQuantity(placeAndMaterialByMidAndPid.getQuantity() - 100); + placeMapper.updateMaterialAndPlace(placeAndMaterialByMidAndPid); + + + placeById.setQuantity(placeById.getQuantity() - 100); + + + // 设置剩余拆单库存处理数量 + splitInventory.setSaveQuantity(splitInfo.getQuantity() + splitInventory.getSaveQuantity() - inventory * 100); + splitInventory.setOutQuantity(splitInventory.getOutQuantity() + inventory * 100); + splitUnitMapper.updateSplitInventory(splitInventory); + } + } else { + // 如果大于 + + // 获取库存重要减少的数量 + double surplus_redundant = surplus / splitInfo.getQuantity(); + // 获取拆单库存处理中要处理数量 + double saveQuantity = surplus - surplus_redundant * splitInfo.getQuantity(); + + if (saveQuantity * 100 >= splitInventory.getSaveQuantity()) { + // 如果要处理的数量大于剩余数量 + + // 获取一个数量 + surplus_redundant += 1.0; + splitInventory.setSaveQuantity(splitInfo.getQuantity() + splitInventory.getSaveQuantity() - (int) saveQuantity * 100); + } else { + // 如果不大于 + splitInventory.setSaveQuantity(splitInventory.getSaveQuantity() - (int) saveQuantity * 100); + } + + + if (placeAndMaterialByMidAndPid.getQuantity() >= surplus_redundant * 100) { + // 如果能够出库 + + // 令库存-1 + inventoryById.setQuantity(inventoryById.getQuantity() - (int) surplus_redundant * 100); + + + // 修改当前库位存放物料的数量 + placeAndMaterialByMidAndPid.setQuantity(placeAndMaterialByMidAndPid.getQuantity() - (int) surplus_redundant * 100); + + + placeById.setQuantity(placeById.getQuantity() - (int) surplus_redundant * 100); + + } else { + inventoryById.setQuantity(inventoryById.getQuantity() - placeAndMaterialByMidAndPid.getQuantity()); + placeById.setQuantity(placeById.getQuantity() - placeAndMaterialByMidAndPid.getQuantity()); + placeAndMaterialByMidAndPid.setQuantity(0); + } + } + } + + + } else { + // 如果盘点后的库存数非法 + + placeById.setQuantity(placeById.getQuantity() - placeAndMaterialByMidAndPid.getQuantity()); + + inventoryById.setQuantity(inventoryById.getQuantity() - placeAndMaterialByMidAndPid.getQuantity()); + + placeAndMaterialByMidAndPid.setQuantity(0); + List splitInventoryList = splitUnitMapper.findSplitInventoryByIid(placeAndMaterialByMidAndPid.getId()); + for (SplitInventory si : splitInventoryList + ) { + si.setSaveQuantity(0); + splitUnitMapper.updateSplitInventory(si); + } + } } } else { - // 如果不存在 + // 如果不存在拆单记录 + // 获取当前拆单单位对应的库存数 + double splitInfoInventory = splitUnitService.findAllInventoryForSplitInfo(-1, placeAndMaterialByMidAndPid, splitInfo.getId(), 0, true); - // 获取进制 - int scale = splitUnitService.findSplitInfoScaleQuantity(splitInfo, -1); - // 获取当前盘点数目 - int now_inventory = placeAndMaterialByMidAndPid.getQuantity() * scale; + if (Integer.compare(minRecord.getNewInventory(), 0) == 0) { + // 如果盘点数量为0 + placeById.setQuantity(placeById.getQuantity() - placeAndMaterialByMidAndPid.getQuantity()); - // 更新当前库存 - inventoryById.setQuantity(inventoryById.getQuantity() - placeAndMaterialByMidAndPid.getQuantity()); - placeAndMaterialByMidAndPid.setQuantity(0); + inventoryById.setQuantity(inventoryById.getQuantity() - placeAndMaterialByMidAndPid.getQuantity()); + + placeAndMaterialByMidAndPid.setQuantity(0); + } else { + // 如果不是0 + + // 获取当前拆单单位与基础单位之间的进制 + int scale = splitUnitService.findSplitInfoScaleQuantity(splitInfo, -1); + + // 获取当前盘点对应基础单位的数量 + int residue = (int) Math.ceil(inventory / (double) scale); + + // 获取剩余数目 + int residue_realQuantity = residue * scale - inventory; + + + // 更新库存数量 + inventoryById.setQuantity(inventoryById.getQuantity() - residue * 100); + + placeAndMaterialByMidAndPid.setQuantity(placeAndMaterialByMidAndPid.getQuantity() - residue * 100); + + placeById.setQuantity(placeById.getQuantity() - residue * 100); + + // 插入拆单记录 + Map insertForSplitInventory = new HashMap<>(); + insertForSplitInventory.put("mid", inventoryById.getMid()); + insertForSplitInventory.put("mcode", inventoryById.getCode()); + insertForSplitInventory.put("price", 0); + insertForSplitInventory.put("quantity", residue_realQuantity); + insertForSplitInventory.put("unit", unit); + insertForSplitInventory.put("depositoryId", mainRecord.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); + } - // 当前盘点数目 - int new_inventory = now_inventory - inventory; - Map insertForSplitInventory = new HashMap<>(); - insertForSplitInventory.put("mid", inventoryById.getMid()); - insertForSplitInventory.put("mcode", inventoryById.getCode()); - insertForSplitInventory.put("price", inventoryById.getPrice() / scale); - insertForSplitInventory.put("quantity", new_inventory); - insertForSplitInventory.put("unit", unit); - insertForSplitInventory.put("depositoryId", mainRecord.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); } @@ -1574,7 +1622,18 @@ public class StockTakingServiceImpl implements StockTakingService { // 更新当前物料信息 materialMapper.updateInventory(inventoryById); + minIds.add(minRecord.getId()); + + if (errIds.size() > 0) { + // 如果有出错的情况 + + errMsg.put("errIds", errIds); + errMsg.put("errMsg", err); + + result.put("errMsg", errMsg); + } + } if (errIds.size() > 0) { @@ -1859,7 +1918,6 @@ public class StockTakingServiceImpl implements StockTakingService { // 获取当前转移的id List minIds = (List) map.get("minIds"); - // Integer res = 0; // 获取对应主订单 @@ -1874,10 +1932,11 @@ public class StockTakingServiceImpl implements StockTakingService { // 设置转移后盘点库位的总数 - Integer sumTransferAfter = 0; + double sumTransferAfter = 0; // 设置转移到到库位的总数 - Integer sumTransfer = newPlace.getQuantity(); + double sumTransfer = (double) newPlace.getQuantity() / 100; + for (Integer minId : minIds) { // 获取对应子订单 @@ -1895,14 +1954,14 @@ public class StockTakingServiceImpl implements StockTakingService { // 查询当前主订单对应的盘点库位 oldPlace = placeMapper.findPlaceById(minRecord.getPid()); // 设置当前转移前库位的总数 - sumTransferAfter = oldPlace.getQuantity(); + sumTransferAfter = (double) oldPlace.getQuantity() / 100; } // 获取当前的转移数量 - Integer inventory_transfer = ObjectFormatUtil.toInteger(map.get("invnetory" + minId)); + Double inventory_transfer = ObjectFormatUtil.toDouble(map.get("invnetory" + minId)); // 获取转移后库位的总数 - sumTransfer += inventory_transfer; + sumTransfer += (inventory_transfer); // 获取当前盘点的计量单位 String unit = minRecord.getUnit(); @@ -1914,7 +1973,7 @@ public class StockTakingServiceImpl implements StockTakingService { map.put("placeId", newPlace.getId()); // 获取转移后的数量 - Integer newInventory = minRecord.getNewInventory() - inventory_transfer; + double newInventory = minRecord.getNewInventory() - inventory_transfer; // 获取转移后盘点库位的总数 sumTransferAfter += minRecord.getInventory() - inventory_transfer; @@ -1930,7 +1989,7 @@ public class StockTakingServiceImpl implements StockTakingService { if (Integer.compare(newPlace.getDid(), oldPlace.getDid()) != 0) { // 转移前后不在同一仓库 - inventoryById.setQuantity(newInventory); + inventoryById.setQuantity((int) newInventory * 100); // 用于获取转移后仓库的物料信息 Map paramForMaterialToDepository = new HashMap<>(); @@ -1959,14 +2018,14 @@ public class StockTakingServiceImpl implements StockTakingService { if (newPlaceAndMaterial == null) { // 如果转移之后的库位没有该物料 - paramForMaterialAndPlace.put("quantity", inventory_transfer); + paramForMaterialAndPlace.put("quantity", (int)(inventory_transfer * 100)); // 添加物料记录 placeMapper.addMaterialOnPlace(paramForMaterialAndPlace); } else { // 如果转移之后有该物料 // 更新对应库存数量 - newPlaceAndMaterial.setQuantity(newPlaceAndMaterial.getQuantity() + inventory_transfer); + newPlaceAndMaterial.setQuantity(newPlaceAndMaterial.getQuantity() + (int) (inventory_transfer * 100)); placeMapper.updateMaterialAndPlace(newPlaceAndMaterial); } } else { @@ -2002,8 +2061,8 @@ public class StockTakingServiceImpl implements StockTakingService { // 最终存储到拆单处理的数量 double saveQuantity = inventory_transfer - disposeQuantity * splitInfo.getQuantity(); - insertForSplitInventory.put("saveQuantity", saveQuantity); - insertForSplitInventory.put("inQuantity", saveQuantity); + insertForSplitInventory.put("saveQuantity",(int) (saveQuantity * 100)); + insertForSplitInventory.put("inQuantity",(int) (saveQuantity * 100)); // 添加一条拆单库存记录 res += splitUnitMapper.addSplitInventory(insertForSplitInventory); @@ -2033,8 +2092,8 @@ public class StockTakingServiceImpl implements StockTakingService { // 如果不大于 - insertForSplitInventory.put("saveQuantity", inventory_transfer); - insertForSplitInventory.put("inQuantity", inventory_transfer); + insertForSplitInventory.put("saveQuantity", (int)(inventory_transfer * 100)); + insertForSplitInventory.put("inQuantity", (int)(inventory_transfer * 100)); // 添加一条拆单库存记录 res += splitUnitMapper.addSplitInventory(insertForSplitInventory); @@ -2065,7 +2124,7 @@ public class StockTakingServiceImpl implements StockTakingService { // 如果存在库存拆单记录 // 当前拆单库存最终存储数量 - int realQuantity = (int) Math.round(saveQuantity) + splitInventory.getSaveQuantity(); + double realQuantity = Math.round(saveQuantity) + (double) splitInventory.getSaveQuantity() / 100; // 用于标志是否大于进制数 @@ -2078,7 +2137,7 @@ public class StockTakingServiceImpl implements StockTakingService { flag = true; // 计算要进制的数目 - int quantity_in = (realQuantity / scale); + double quantity_in = (realQuantity / scale); // 更新处理数量 disposeQuantity += quantity_in; @@ -2088,7 +2147,7 @@ public class StockTakingServiceImpl implements StockTakingService { } // 设置当前拆单对应的库存数量 - splitInventory.setSaveQuantity(realQuantity); + splitInventory.setSaveQuantity((int) realQuantity * 100); // 修改库存数量 splitUnitMapper.updateSplitInventory(splitInventory); @@ -2134,21 +2193,21 @@ public class StockTakingServiceImpl implements StockTakingService { insertForSplitInventory.put("outQuantity", 0); - int realQuantity = (int) Math.round(saveQuantity); + double realQuantity = Math.round(saveQuantity); if (realQuantity >= scale) { // 如果当前处理的数量大于进制数 // 计算要进的数目 - int quantity_in = (inventory_transfer / scale); + double quantity_in = (inventory_transfer / scale); // 更新处理数量 disposeQuantity += quantity_in; // 拆单库存实际入库的数量 realQuantity = realQuantity - quantity_in * scale; - insertForSplitInventory.put("saveQuantity", realQuantity); - insertForSplitInventory.put("inQuantity", realQuantity); + insertForSplitInventory.put("saveQuantity", (int)(realQuantity * 100)); + insertForSplitInventory.put("inQuantity", (int)(realQuantity * 100)); splitUnitMapper.addSplitInventory(insertForSplitInventory); @@ -2184,8 +2243,8 @@ public class StockTakingServiceImpl implements StockTakingService { } else { - insertForSplitInventory.put("saveQuantity", realQuantity); - insertForSplitInventory.put("inQuantity", realQuantity); + insertForSplitInventory.put("saveQuantity", (int) (realQuantity * 100)); + insertForSplitInventory.put("inQuantity", (int) (realQuantity * 100)); splitUnitMapper.addSplitInventory(insertForSplitInventory); @@ -2215,7 +2274,7 @@ public class StockTakingServiceImpl implements StockTakingService { if ("-1".equals(unit)) { // 如果是基础单位 - inventory.setQuantity(inventory_transfer); + inventory.setQuantity((int) (inventory_transfer * 100)); inventory.setAmounts(inventory_transfer * inventoryById.getPrice()); // 添加一条库存记录 @@ -2225,7 +2284,7 @@ public class StockTakingServiceImpl implements StockTakingService { Map paramForMaterialAndPlace = new HashMap<>(); paramForMaterialAndPlace.put("mid", inventory.getId()); paramForMaterialAndPlace.put("pid", newPlace.getId()); - paramForMaterialAndPlace.put("quantity", newInventory); + paramForMaterialAndPlace.put("quantity", (int) (newInventory * 100)); placeMapper.addMaterialOnPlace(paramForMaterialAndPlace); } else { // 如果是拆单单位 @@ -2262,7 +2321,7 @@ public class StockTakingServiceImpl implements StockTakingService { double saveQuantity = inventory_transfer - disposeQuantity * splitInfo.getQuantity(); // 最终存储数量 - int realQuantity = (int) Math.round(saveQuantity); + double realQuantity = Math.round(saveQuantity); // 用于添加一条拆单库存记录 Map insertForSplitInventory = new HashMap<>(); @@ -2274,15 +2333,15 @@ public class StockTakingServiceImpl implements StockTakingService { // 如果当前处理的数量大于进制数 // 计算要进的数目 - int quantity_in = (inventory_transfer / scale); + double quantity_in = (inventory_transfer / scale); // 更新处理数量 disposeQuantity += quantity_in; // 拆单库存实际入库的数量 realQuantity = realQuantity - quantity_in * scale; - insertForSplitInventory.put("saveQuantity", realQuantity); - insertForSplitInventory.put("inQuantity", realQuantity); + insertForSplitInventory.put("saveQuantity", (int) (realQuantity * 100)); + insertForSplitInventory.put("inQuantity", (int) (realQuantity * 100)); splitUnitMapper.addSplitInventory(insertForSplitInventory); if (splitInfo.getParentId() != null) { @@ -2301,8 +2360,8 @@ public class StockTakingServiceImpl implements StockTakingService { map.remove("id"); } } else { - insertForSplitInventory.put("saveQuantity", realQuantity); - insertForSplitInventory.put("inQuantity", realQuantity); + insertForSplitInventory.put("saveQuantity", (int) (realQuantity * 100)); + insertForSplitInventory.put("inQuantity", (int) (realQuantity * 100)); splitUnitMapper.addSplitInventory(insertForSplitInventory); } } @@ -2317,7 +2376,7 @@ public class StockTakingServiceImpl implements StockTakingService { // 获取转移前物料于库位的对应关系 if ("-1".equals(unit)) { // 如果是基础单位 - oldPlaceAndMaterial.setQuantity(newInventory); + oldPlaceAndMaterial.setQuantity((int) newInventory * 100); placeMapper.updateMaterialAndPlace(oldPlaceAndMaterial); } else { // 如果是拆单单位 @@ -2339,7 +2398,7 @@ public class StockTakingServiceImpl implements StockTakingService { // 如果当前记录存在 // 设置当前拆单库存数 - splitInventory.setSaveQuantity(newInventory); + splitInventory.setSaveQuantity((int) newInventory * 100); // 修改当前拆单库存 splitUnitMapper.updateSplitInventory(splitInventory); @@ -2350,9 +2409,9 @@ public class StockTakingServiceImpl implements StockTakingService { Map insertForSplitInventory = new HashMap<>(); insertForSplitInventory.put("sid", splitInfo.getId()); insertForSplitInventory.put("iid", oldPlaceAndMaterial.getId()); - insertForSplitInventory.put("inQuantity", newInventory); + insertForSplitInventory.put("inQuantity", (int) (newInventory * 100)); insertForSplitInventory.put("outQuantity", 0); - insertForSplitInventory.put("saveQuantity", newInventory); + insertForSplitInventory.put("saveQuantity", (int) (newInventory * 100)); // 添加一条拆单库存记录 splitUnitMapper.addSplitInventory(insertForSplitInventory); @@ -2376,7 +2435,7 @@ public class StockTakingServiceImpl implements StockTakingService { if ("-1".equals(unit)) { // 如果是基础单位 - oldPlaceAndMaterial.setQuantity(newInventory); + oldPlaceAndMaterial.setQuantity((int) newInventory * 100); placeMapper.updateMaterialAndPlace(oldPlaceAndMaterial); @@ -2385,11 +2444,11 @@ public class StockTakingServiceImpl implements StockTakingService { MaterialAndPlace newPlaceAndMaterial = placeMapper.findPlaceAndMaterialByMidAndPid(paramForMaterialAndPlace); if (newPlaceAndMaterial == null) { // 如果转移后没有该物料 - paramForMaterialAndPlace.put("quantity", inventory_transfer); + paramForMaterialAndPlace.put("quantity", inventory_transfer * 100); placeMapper.addMaterialOnPlace(paramForMaterialAndPlace); } else { // 如果转移后有该物料 - newPlaceAndMaterial.setQuantity(newPlaceAndMaterial.getQuantity() + inventory_transfer); + newPlaceAndMaterial.setQuantity(newPlaceAndMaterial.getQuantity() + (int) (inventory_transfer * 100)); placeMapper.updateMaterialAndPlace(newPlaceAndMaterial); } } else { @@ -2419,7 +2478,7 @@ public class StockTakingServiceImpl implements StockTakingService { if (oldSplitInventory != null) { // 如果该拆单库存存在 - oldSplitInventory.setSaveQuantity(newInventory); + oldSplitInventory.setSaveQuantity((int) newInventory * 100); // 修改当前物料库存 splitUnitMapper.updateSplitInventory(oldSplitInventory); } else { @@ -2427,8 +2486,8 @@ public class StockTakingServiceImpl implements StockTakingService { // 添加相关数据 paramForSplitInventory.put("outQuantity", 0); - paramForSplitInventory.put("inQuantity", newInventory); - paramForSplitInventory.put("saveQuantity", newInventory); + paramForSplitInventory.put("inQuantity", (int) (newInventory * 100)); + paramForSplitInventory.put("saveQuantity", (int) (newInventory * 100)); // 添加一条拆单库存记录 splitUnitMapper.addSplitInventory(paramForSplitInventory); @@ -2454,7 +2513,7 @@ public class StockTakingServiceImpl implements StockTakingService { // 当前拆单库存最终存储数量 - int realQuantity = (int) Math.round(saveQuantity) + newSplitInventory.getSaveQuantity(); + double realQuantity = Math.round(saveQuantity) + (double) newSplitInventory.getSaveQuantity() / 100; // 用于标志是否大于进制数 @@ -2467,7 +2526,7 @@ public class StockTakingServiceImpl implements StockTakingService { flag = true; // 计算要进制的数目 - int quantity_in = (realQuantity / scale); + double quantity_in = (realQuantity / scale); // 更新处理数量 disposeQuantity += quantity_in; @@ -2477,7 +2536,7 @@ public class StockTakingServiceImpl implements StockTakingService { } // 设置当前拆单对应的库存数量 - newSplitInventory.setSaveQuantity(realQuantity); + newSplitInventory.setSaveQuantity((int) realQuantity * 100); // 修改库存数量 splitUnitMapper.updateSplitInventory(newSplitInventory); @@ -2523,21 +2582,21 @@ public class StockTakingServiceImpl implements StockTakingService { insertForSplitInventory.put("outQuantity", 0); // 定义当前实际保存的数量 - int realQuantity = (int) Math.round(saveQuantity); + double realQuantity = Math.round(saveQuantity); if (realQuantity >= scale) { // 如果当前处理的数量大于进制数 // 计算要进的数目 - int quantity_in = (inventory_transfer / scale); + double quantity_in = (inventory_transfer / scale); // 更新处理数量 disposeQuantity += quantity_in; // 拆单库存实际入库的数量 realQuantity = realQuantity - quantity_in * scale; - insertForSplitInventory.put("saveQuantity", realQuantity); - insertForSplitInventory.put("inQuantity", realQuantity); + insertForSplitInventory.put("saveQuantity", (int) (realQuantity * 100)); + insertForSplitInventory.put("inQuantity", (int) (realQuantity * 100)); splitUnitMapper.addSplitInventory(insertForSplitInventory); @@ -2573,8 +2632,8 @@ public class StockTakingServiceImpl implements StockTakingService { } else { - insertForSplitInventory.put("saveQuantity", realQuantity); - insertForSplitInventory.put("inQuantity", realQuantity); + insertForSplitInventory.put("saveQuantity", (int) (realQuantity * 100)); + insertForSplitInventory.put("inQuantity", (int) (realQuantity * 100)); splitUnitMapper.addSplitInventory(insertForSplitInventory); @@ -2606,8 +2665,8 @@ public class StockTakingServiceImpl implements StockTakingService { // 最终存储到拆单处理的数量 double saveQuantity = inventory_transfer - disposeQuantity * splitInfo.getQuantity(); - insertForSplitInventory.put("saveQuantity", saveQuantity); - insertForSplitInventory.put("inQuantity", saveQuantity); + insertForSplitInventory.put("saveQuantity", saveQuantity * 100); + insertForSplitInventory.put("inQuantity", saveQuantity * 100); // 添加一条拆单库存记录 res += splitUnitMapper.addSplitInventory(insertForSplitInventory); @@ -2639,8 +2698,8 @@ public class StockTakingServiceImpl implements StockTakingService { } else { // 如果不大于 - insertForSplitInventory.put("saveQuantity", inventory_transfer); - insertForSplitInventory.put("inQuantity", inventory_transfer); + insertForSplitInventory.put("saveQuantity", (int) (inventory_transfer * 100)); + insertForSplitInventory.put("inQuantity", (int) (inventory_transfer * 100)); // 添加一条拆单库存记录 res += splitUnitMapper.addSplitInventory(insertForSplitInventory); @@ -2660,11 +2719,11 @@ public class StockTakingServiceImpl implements StockTakingService { if (oldPlace != null) { // 更新转移前库位数量 - oldPlace.setQuantity(sumTransferAfter); + oldPlace.setQuantity((int) sumTransferAfter * 100); placeMapper.UpdatePlace(oldPlace); } // 更新转移后库位数量 - newPlace.setQuantity(sumTransfer); + newPlace.setQuantity((int) sumTransfer * 100); placeMapper.UpdatePlace(newPlace); // 开启一个线程用于发送转移信息给盘点人员 diff --git a/target/classes/com/dreamchaser/depository_manage/mapper/PlaceMapper.xml b/target/classes/com/dreamchaser/depository_manage/mapper/PlaceMapper.xml index 73dc42e8..1b8c6fe7 100644 --- a/target/classes/com/dreamchaser/depository_manage/mapper/PlaceMapper.xml +++ b/target/classes/com/dreamchaser/depository_manage/mapper/PlaceMapper.xml @@ -33,7 +33,7 @@ - +