|
|
@@ -165,7 +165,12 @@ public class WarehouseProductDemandAnalysisVo implements Serializable {
|
|
|
/**
|
|
|
* 构建数据, 需先写入分仓需求数, 否则计算将存在问题
|
|
|
*/
|
|
|
- public void build() {
|
|
|
+ private void build() {
|
|
|
+ procurementCycle = null != procurementCycle ? procurementCycle : 0L;
|
|
|
+ moq = null != moq ? moq : 0L;
|
|
|
+ inventoryWarningQuantity = null != inventoryWarningQuantity ? inventoryWarningQuantity : 1L;
|
|
|
+ warningCoefficient = null != warningCoefficient ? warningCoefficient : BigDecimal.ONE;
|
|
|
+
|
|
|
// 单位
|
|
|
BigDecimal uniting = BigDecimal.ONE;
|
|
|
// 如果拆箱优先级小于等于0, 默认为1
|
|
|
@@ -230,4 +235,22 @@ public class WarehouseProductDemandAnalysisVo implements Serializable {
|
|
|
procurementDemand = warehouseRequirements.subtract(surplusInventory);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 刷新数据
|
|
|
+ */
|
|
|
+ public void flash() {
|
|
|
+ build();
|
|
|
+ weeklySalesVolumeUnits = scale(weeklySalesVolumeUnits, 2);
|
|
|
+ warningCoefficient = scale(warningCoefficient, 2);
|
|
|
+ subWarehouseRequirements = scale(subWarehouseRequirements, 2);
|
|
|
+ warehouseRequirements = scale(warehouseRequirements, 2);
|
|
|
+ surplusInventory = scale(surplusInventory, 2);
|
|
|
+ expectedConsumptionDays = scale(expectedConsumptionDays, 0);
|
|
|
+ procurementDemand = scale(procurementDemand, 2);
|
|
|
+ }
|
|
|
+
|
|
|
+ private BigDecimal scale(BigDecimal val, int newScale) {
|
|
|
+ return null != val && val.compareTo(BigDecimal.ZERO) != 0 ? val.setScale(newScale, RoundingMode.HALF_UP) : BigDecimal.ZERO;
|
|
|
+ }
|
|
|
+
|
|
|
}
|