| | |
| | | |
| | | //3.获取主 辅单位转换比例 |
| | | SparePart sparePart = sparePartService.getById(sparePartId); |
| | | String conversionRatio = sparePart.getConversionRatio(); |
| | | double conversionRatioD = 0; |
| | | /* String conversionRatio = sparePart.getConversionRatio();*/ |
| | | /* double conversionRatioD = 0; |
| | | if (StringUtils.isBlank(conversionRatio)) { |
| | | conversionRatioD = Double.parseDouble("0"); |
| | | } else { |
| | | conversionRatioD = Double.parseDouble(conversionRatio); |
| | | } |
| | | BigDecimal conversionRatioB = new BigDecimal(conversionRatioD); |
| | | BigDecimal conversionRatioB = new BigDecimal(conversionRatioD);*/ |
| | | |
| | | //4.计算出库数量更新库存数量(库存) |
| | | /*库存主数量*/ |
| | |
| | | BigDecimal mainQuantityB = new BigDecimal(mainQuantity); |
| | | |
| | | /*库存辅数量*/ |
| | | Double auxiliaryQuantity = sparesPartInventory.getAuxiliaryQuantity(); |
| | | BigDecimal auxiliaryQuantityB = new BigDecimal(auxiliaryQuantity); |
| | | /* Double auxiliaryQuantity = sparesPartInventory.getAuxiliaryQuantity(); |
| | | BigDecimal auxiliaryQuantityB = new BigDecimal(auxiliaryQuantity);*/ |
| | | |
| | | |
| | | BigDecimal mainQuantitySubtract = mainQuantityB.subtract(scrapMainQuantityB);//领取后库存主数量 |
| | | BigDecimal scrapAuxiliaryQuantity = mainQuantitySubtract.multiply(conversionRatioB);//领取后库存辅数量 |
| | | /* BigDecimal scrapAuxiliaryQuantity = mainQuantitySubtract.multiply(conversionRatioB);//领取后库存辅数量*/ |
| | | |
| | | |
| | | sparesPartInventory.setMainQuantity(mainQuantitySubtract.doubleValue()); |
| | | sparesPartInventory.setAuxiliaryQuantity(scrapAuxiliaryQuantity.doubleValue()); |
| | | /* sparesPartInventory.setAuxiliaryQuantity(scrapAuxiliaryQuantity.doubleValue());*/ |
| | | boolean b = sparesPartInventoryService.updateById(sparesPartInventory); |
| | | if (!b) { |
| | | return b; |