Browse Source

修改部分bug

lwx_dev
erdanergou 3 years ago
parent
commit
273762324a
  1. 89
      src/main/java/com/dreamchaser/depository_manage/service/impl/StockTakingServiceImpl.java

89
src/main/java/com/dreamchaser/depository_manage/service/impl/StockTakingServiceImpl.java

@ -750,7 +750,8 @@ public class StockTakingServiceImpl implements StockTakingService {
// 更新物料与库位对应关系的数量 // 更新物料与库位对应关系的数量
placeAndMaterialByMidAndPid.setQuantity(newNumberForMatrialAndPlace); placeAndMaterialByMidAndPid.setQuantity(newNumberForMatrialAndPlace);
} else { }
else {
// 如果是拆单单位 // 如果是拆单单位
// 更新当前库位数量 // 更新当前库位数量
newNumberForPlace = placeById.getQuantity() + inventory; newNumberForPlace = placeById.getQuantity() + inventory;
@ -772,13 +773,13 @@ public class StockTakingServiceImpl implements StockTakingService {
// 查找当前拆单记录对应的库存记录 // 查找当前拆单记录对应的库存记录
SplitInventory splitInventory = splitUnitService.findSplitInventoryByIidAndSid(placeAndMaterialByMidAndPid.getId(), splitInfo.getId()); SplitInventory splitInventory = splitUnitService.findSplitInventoryByIidAndSid(placeAndMaterialByMidAndPid.getId(), splitInfo.getId());
if(splitInventory != null){
int realQuantity = Math.round(inventory) + splitInventory.getSaveQuantity(); int realQuantity = Math.round(inventory) + splitInventory.getSaveQuantity();
// 定义当前进制 // 定义当前进制
int scale = splitInfo.getQuantity(); int scale = splitInfo.getQuantity();
if (realQuantity >= scale) { if (realQuantity >= scale) {
// 如果当前盘点的数量大于拆单规定的进制数量 // 如果当前盘点的数量大于拆单规定的进制数量
// 计算当前进制下的进位数量 // 计算当前进制下的进位数量
int disposeQuantity = (int) Math.round(Math.floor((double) inventory / scale)); int disposeQuantity = (int) Math.round(Math.floor((double) inventory / scale));
@ -805,7 +806,8 @@ public class StockTakingServiceImpl implements StockTakingService {
placeAndMaterialByMidAndPid.setQuantity(placeAndMaterialByMidAndPid.getQuantity() + disposeQuantity); placeAndMaterialByMidAndPid.setQuantity(placeAndMaterialByMidAndPid.getQuantity() + disposeQuantity);
} }
} else { }
else {
// 如果不需要进位 // 如果不需要进位
// 修改当前库存 // 修改当前库存
@ -813,9 +815,14 @@ public class StockTakingServiceImpl implements StockTakingService {
// 修改拆单库存 // 修改拆单库存
splitUnitMapper.updateSplitInventory(splitInventory); splitUnitMapper.updateSplitInventory(splitInventory);
} }
}else{
int scale = splitUnitService.findSplitInfoScaleQuantity(splitInfo, -1);
}
} }
} else { }
else {
// 如果盘亏 // 如果盘亏
if ("-1".equals(unit)) { if ("-1".equals(unit)) {
@ -840,7 +847,8 @@ public class StockTakingServiceImpl implements StockTakingService {
placeAndMaterialByMidAndPid.setQuantity(newNumberForMatrialAndPlace); placeAndMaterialByMidAndPid.setQuantity(newNumberForMatrialAndPlace);
} else { }
else {
// 如果是拆单单位 // 如果是拆单单位
// 用于查找对应的拆单记录 // 用于查找对应的拆单记录
Map<String, Object> paramForSplitInfo = new HashMap<>(); Map<String, Object> paramForSplitInfo = new HashMap<>();
@ -1166,7 +1174,8 @@ public class StockTakingServiceImpl implements StockTakingService {
// 更新物料与库位对应关系的数量 // 更新物料与库位对应关系的数量
placeAndMaterialByMidAndPid.setQuantity(newNumberForMatrialAndPlace); placeAndMaterialByMidAndPid.setQuantity(newNumberForMatrialAndPlace);
} else { }
else {
// 如果是拆单单位 // 如果是拆单单位
// 更新当前库位数量 // 更新当前库位数量
newNumberForPlace = placeById.getQuantity() + inventory; newNumberForPlace = placeById.getQuantity() + inventory;
@ -1188,6 +1197,7 @@ public class StockTakingServiceImpl implements StockTakingService {
// 查找当前拆单记录对应的库存记录 // 查找当前拆单记录对应的库存记录
SplitInventory splitInventory = splitUnitService.findSplitInventoryByIidAndSid(placeAndMaterialByMidAndPid.getId(), splitInfo.getId()); SplitInventory splitInventory = splitUnitService.findSplitInventoryByIidAndSid(placeAndMaterialByMidAndPid.getId(), splitInfo.getId());
if(splitInventory != null){
int realQuantity = Math.round(inventory) + splitInventory.getSaveQuantity(); int realQuantity = Math.round(inventory) + splitInventory.getSaveQuantity();
// 定义当前进制 // 定义当前进制
int scale = splitInfo.getQuantity(); int scale = splitInfo.getQuantity();
@ -1221,7 +1231,8 @@ public class StockTakingServiceImpl implements StockTakingService {
placeAndMaterialByMidAndPid.setQuantity(placeAndMaterialByMidAndPid.getQuantity() + disposeQuantity); placeAndMaterialByMidAndPid.setQuantity(placeAndMaterialByMidAndPid.getQuantity() + disposeQuantity);
} }
} else { }
else {
// 如果不需要进位 // 如果不需要进位
// 修改当前库存 // 修改当前库存
@ -1229,9 +1240,31 @@ public class StockTakingServiceImpl implements StockTakingService {
// 修改拆单库存 // 修改拆单库存
splitUnitMapper.updateSplitInventory(splitInventory); splitUnitMapper.updateSplitInventory(splitInventory);
} }
}
else{
// 获取进制数目
int scale = splitUnitService.findSplitInfoScaleQuantity(splitInfo, -1);
Map<String,Object> 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);
}
} }
} else { }
else {
// 如果盘亏 // 如果盘亏
if ("-1".equals(unit)) { if ("-1".equals(unit)) {
@ -1256,7 +1289,8 @@ public class StockTakingServiceImpl implements StockTakingService {
placeAndMaterialByMidAndPid.setQuantity(newNumberForMatrialAndPlace); placeAndMaterialByMidAndPid.setQuantity(newNumberForMatrialAndPlace);
} else { }
else {
// 如果是拆单单位 // 如果是拆单单位
// 用于查找对应的拆单记录 // 用于查找对应的拆单记录
@ -1269,6 +1303,8 @@ public class StockTakingServiceImpl implements StockTakingService {
// 查找当前拆单记录对应的库存记录 // 查找当前拆单记录对应的库存记录
SplitInventory splitInventory = splitUnitService.findSplitInventoryByIidAndSid(placeAndMaterialByMidAndPid.getId(), splitInfo.getId()); SplitInventory splitInventory = splitUnitService.findSplitInventoryByIidAndSid(placeAndMaterialByMidAndPid.getId(), splitInfo.getId());
if(splitInventory != null){
// 如果存在拆单记录
if (splitInventory.getSaveQuantity() - inventory > 0) { if (splitInventory.getSaveQuantity() - inventory > 0) {
// 如果当前数量没有下溢 // 如果当前数量没有下溢
@ -1276,7 +1312,8 @@ public class StockTakingServiceImpl implements StockTakingService {
splitInventory.setSaveQuantity(splitInventory.getSaveQuantity() - inventory); splitInventory.setSaveQuantity(splitInventory.getSaveQuantity() - inventory);
// 修改拆单库存 // 修改拆单库存
splitUnitMapper.updateSplitInventory(splitInventory); splitUnitMapper.updateSplitInventory(splitInventory);
} else { }
else {
// 如果发生下溢 // 如果发生下溢
@ -1285,6 +1322,35 @@ public class StockTakingServiceImpl implements StockTakingService {
// 修改拆单库存 // 修改拆单库存
splitUnitMapper.updateSplitInventory(splitInventory); splitUnitMapper.updateSplitInventory(splitInventory);
} }
} else{
// 如果不存在
// 获取进制
int scale = splitUnitService.findSplitInfoScaleQuantity(splitInfo, -1);
// 获取当前盘点数目
int now_inventory = placeAndMaterialByMidAndPid.getQuantity() * scale;
// 更新当前库存
inventoryById.setQuantity(inventoryById.getQuantity() - placeAndMaterialByMidAndPid.getQuantity());
placeAndMaterialByMidAndPid.setQuantity(0);
// 当前盘点数目
int new_inventory = now_inventory - inventory;
Map<String,Object> 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);
}
} }
@ -1377,6 +1443,7 @@ public class StockTakingServiceImpl implements StockTakingService {
StringBuilder QyWxUid = new StringBuilder(); StringBuilder QyWxUid = new StringBuilder();
String stockTakingResult = "驳回"; String stockTakingResult = "驳回";
// 获取主单 // 获取主单
StockTaking mainRecord = stockTakingMapper.selectStockTakingById(ObjectFormatUtil.toInteger(mainId)); StockTaking mainRecord = stockTakingMapper.selectStockTakingById(ObjectFormatUtil.toInteger(mainId));
@ -1421,8 +1488,6 @@ public class StockTakingServiceImpl implements StockTakingService {
// 获取库位详情 // 获取库位详情
Place placeById = placeMapper.findPlaceById(placeId); Place placeById = placeMapper.findPlaceById(placeId);
Integer depositoryId = mainRecord.getDepositoryId(); Integer depositoryId = mainRecord.getDepositoryId();
// 获取仓库详情
Depository depositoryById = depositoryMapper.findDepositoryById(depositoryId);
// 获取所有子单 // 获取所有子单
List<StockTakingChildP> minRecordList = stockTakingMapper.selectStockTakingChildByMainId(ObjectFormatUtil.toInteger(mainId)); List<StockTakingChildP> minRecordList = stockTakingMapper.selectStockTakingChildByMainId(ObjectFormatUtil.toInteger(mainId));

Loading…
Cancel
Save