|
|
@ -1481,6 +1481,9 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
paramForSplitInventory.put("iid", pidAndMidForBefore.getId()); |
|
|
paramForSplitInventory.put("iid", pidAndMidForBefore.getId()); |
|
|
// 转移之前的拆单库存记录
|
|
|
// 转移之前的拆单库存记录
|
|
|
SplitInventory splitInventoryForBefore = splitUnitMapper.findSplitInventoryByIidAndSid(paramForSplitInventory); |
|
|
SplitInventory splitInventoryForBefore = splitUnitMapper.findSplitInventoryByIidAndSid(paramForSplitInventory); |
|
|
|
|
|
if(splitInventoryForBefore != null) { |
|
|
|
|
|
//如果存在
|
|
|
|
|
|
|
|
|
// 设置转移前库存的数量
|
|
|
// 设置转移前库存的数量
|
|
|
splitInventoryForBefore.setSaveQuantity(splitInventoryForBefore.getSaveQuantity() - quantity); |
|
|
splitInventoryForBefore.setSaveQuantity(splitInventoryForBefore.getSaveQuantity() - quantity); |
|
|
// 设置转移前的出库数量
|
|
|
// 设置转移前的出库数量
|
|
|
@ -1488,6 +1491,37 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
// 修改转移前的记录
|
|
|
// 修改转移前的记录
|
|
|
splitUnitMapper.updateSplitInventory(splitInventoryForBefore); |
|
|
splitUnitMapper.updateSplitInventory(splitInventoryForBefore); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
else{ |
|
|
|
|
|
// 如果不存在
|
|
|
|
|
|
|
|
|
|
|
|
// 获取当前单位对应的进制
|
|
|
|
|
|
int scale = splitUnitService.findSplitInfoScaleQuantity(splitInfo, -1); |
|
|
|
|
|
// 计算当前转移数目对应需要减少的数目
|
|
|
|
|
|
int num = (int)Math.ceil(quantity / (double)scale); |
|
|
|
|
|
|
|
|
|
|
|
// 修改当前库存数量
|
|
|
|
|
|
inventoryByMid.setQuantity(inventoryByMid.getQuantity() - num); |
|
|
|
|
|
materialMapper.updateInventory(inventoryByMid); |
|
|
|
|
|
|
|
|
|
|
|
// 修改当前库位对应关系的数目
|
|
|
|
|
|
pidAndMidForBefore.setQuantity(pidAndMidForBefore.getQuantity() - num); |
|
|
|
|
|
placeService.updateMaterialAndPlace(pidAndMidForBefore); |
|
|
|
|
|
|
|
|
|
|
|
Map<String,Object> insertForSplitInventory = new HashMap<>(); |
|
|
|
|
|
insertForSplitInventory.put("mid",inventoryByMid.getMid()); |
|
|
|
|
|
insertForSplitInventory.put("mcode",inventoryByMid.getCode()); |
|
|
|
|
|
insertForSplitInventory.put("price",inventoryByMid.getPrice() / scale); |
|
|
|
|
|
insertForSplitInventory.put("quantity",num * scale - quantity); |
|
|
|
|
|
insertForSplitInventory.put("unit",unit); |
|
|
|
|
|
insertForSplitInventory.put("depositoryId",map.get("depositoryId")); |
|
|
|
|
|
insertForSplitInventory.put("placeId",pidAndMidForBefore.getPid()); |
|
|
|
|
|
insertForSplitInventory.put("type","in"); |
|
|
|
|
|
splitUnitService.addSplitInventory(insertForSplitInventory); |
|
|
|
|
|
Integer new_id = ObjectFormatUtil.toInteger(insertForSplitInventory.get("newInMid")); |
|
|
|
|
|
depositoryRecordMapper.deleteApplicationInRecordById(new_id); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// 定义进制时算法需要的参数
|
|
|
// 定义进制时算法需要的参数
|
|
|
Map<String, Object> paramForNewMap = new HashMap<>(); |
|
|
Map<String, Object> paramForNewMap = new HashMap<>(); |
|
|
@ -1547,7 +1581,8 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
// 修改库存数量
|
|
|
// 修改库存数量
|
|
|
splitUnitMapper.updateSplitInventory(splitInventoryForAfter); |
|
|
splitUnitMapper.updateSplitInventory(splitInventoryForAfter); |
|
|
} |
|
|
} |
|
|
} else { |
|
|
} |
|
|
|
|
|
else { |
|
|
// 如果不存在转移后的拆单库存记录
|
|
|
// 如果不存在转移后的拆单库存记录
|
|
|
|
|
|
|
|
|
// 定义用于添加拆单库存记录
|
|
|
// 定义用于添加拆单库存记录
|
|
|
|