Browse Source

修改部分bug

lwx_dev
erdanergou 3 years ago
parent
commit
fb5f9c4017
  1. 28
      src/main/java/com/dreamchaser/depository_manage/service/impl/DepositoryRecordServiceImpl.java

28
src/main/java/com/dreamchaser/depository_manage/service/impl/DepositoryRecordServiceImpl.java

@ -1269,7 +1269,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
// 获取当前出库的具体数目
int residue = (int) Math.ceil(trueOut / (double)splitInfo.getQuantity());
// 获取剩余数目
int residue_realQuantity = trueOut - residue * splitInfo.getQuantity();
int residue_realQuantity = residue * scale - trueOut;
// 设置新总额
inventory.setAmounts(inventory.getAmounts() - residue * inventory.getPrice());
@ -1282,22 +1282,28 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
// 更新对应库位的库存
// 修改当前库位存放物料的数量
placeAndMaterialByMidAndPid.setQuantity(placeAndMaterialByMidAndPid.getQuantity() - residue - 1);
placeAndMaterialByMidAndPid.setQuantity(placeAndMaterialByMidAndPid.getQuantity() - residue );
placeMapper.updateMaterialAndPlace(placeAndMaterialByMidAndPid);
// 修改库位数量
Place placeById = placeMapper.findPlaceById(placeId);
placeById.setQuantity(placeById.getQuantity() - residue - 1);
placeById.setQuantity(placeById.getQuantity() - residue);
placeMapper.UpdatePlace(placeById);
// 添加拆单库存处理记录
Map<String, Object> insertSplitInventory = new HashMap<>();
insertSplitInventory.put("sid", splitInfo.getId());
insertSplitInventory.put("iid", placeAndMaterialByMidAndPid.getId());
insertSplitInventory.put("outQuantity", trueOut);
insertSplitInventory.put("inQuantity", 0);
insertSplitInventory.put("saveQuantity", splitInfo.getQuantity() - residue_realQuantity);
splitUnitMapper.addSplitInventory(insertSplitInventory);
// 插入拆单记录
Map<String,Object> insertForSplitInventory = new HashMap<>();
insertForSplitInventory.put("mid",inventory.getMid());
insertForSplitInventory.put("mcode",inventory.getCode());
insertForSplitInventory.put("price",inventory.getPrice() / scale);
insertForSplitInventory.put("quantity",splitInfo.getQuantity() - residue_realQuantity);
insertForSplitInventory.put("unit",unit);
insertForSplitInventory.put("depositoryId",applicationOutMinById.getDepositoryId());
insertForSplitInventory.put("placeId",placeAndMaterialByMidAndPid.getPid());
insertForSplitInventory.put("type","in");
splitUnitService.addSplitInventory(insertForSplitInventory);
Integer new_id = ObjectFormatUtil.toInteger(insertForSplitInventory.get("newInMid"));
depositoryRecordMapper.deleteApplicationInRecordById(new_id);
// 如果是库存转移订单

Loading…
Cancel
Save