This commit is contained in:
2022-07-25 17:19:42 +08:00
parent baf747802e
commit 332ee8d089
5 changed files with 59 additions and 87 deletions

View File

@@ -27,4 +27,6 @@ public class TodayandplannumDto implements Serializable {
/** 计划数量 */
private BigDecimal num_plan;
private BigDecimal isBigZero = new BigDecimal(0);
}

View File

@@ -32,7 +32,6 @@ public class BigScreenServiceImpl implements BigScreenService, ApplicationAutoIn
List<SupplyDto> supplyDtos = new ArrayList<>();
List<StockDto> stockDtos = new ArrayList<>();
ShopinfoDto shopinfoDtos = new ShopinfoDto();
@Override
public JSONObject getData(JSONObject param) {
Integer todayPcsSum = 0;
@@ -43,7 +42,20 @@ public class BigScreenServiceImpl implements BigScreenService, ApplicationAutoIn
TodayandplannumDto todayandplannumDto = todayandplannumDtos.get(i);
int compareTo = todayandplannumDto.getNum_plan().compareTo(BigDecimal.ZERO);
if (compareTo != 0) {
todayandplannumDto.setNum_today(todayandplannumDto.getNum_today().add(new BigDecimal(random.nextInt(3) + 3)));
BigDecimal num_plan = todayandplannumDto.getNum_plan();
BigDecimal everyPro = num_plan.divide(new BigDecimal(12 * 60 * 12),4, BigDecimal.ROUND_HALF_UP);
int compare = todayandplannumDto.getIsBigZero().compareTo(new BigDecimal(1));
int compare1 = everyPro.compareTo(new BigDecimal(1));
if (compare1 != -1){
todayandplannumDto.setNum_today(todayandplannumDto.getNum_today().add(everyPro).setScale(0,BigDecimal.ROUND_DOWN));
} else {
if (compare == -1){
todayandplannumDto.setIsBigZero(todayandplannumDto.getIsBigZero().add(everyPro));
} else {
todayandplannumDto.setNum_today(todayandplannumDto.getNum_today().add(todayandplannumDto.getIsBigZero()).setScale(0,BigDecimal.ROUND_DOWN));
todayandplannumDto.setIsBigZero(new BigDecimal(0));
}
}
}
todayPcsSum += Integer.parseInt(todayandplannumDto.getNum_today().toString());
planPcsSum += Integer.parseInt(todayandplannumDto.getNum_plan().toString());