StatisticsStockView.java 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. package com.cyksj.model.views;
  2. import com.alibaba.excel.annotation.ExcelIgnore;
  3. import com.alibaba.excel.annotation.ExcelProperty;
  4. import lombok.Getter;
  5. import lombok.Setter;
  6. import java.math.BigDecimal;
  7. /**
  8. * @author chan
  9. * @date 2022/12/8 2:55 PM
  10. */
  11. @Getter
  12. @Setter
  13. public class StatisticsStockView {
  14. /**
  15. * 商品
  16. */
  17. @ExcelProperty("商品名称")
  18. private String title;
  19. /**
  20. * 当前总数
  21. */
  22. @ExcelProperty("当前库存数量")
  23. private Integer thenTotal = 0;
  24. /**
  25. * 当前价值
  26. */
  27. @ExcelProperty("当前库存价值")
  28. private BigDecimal thenPrice = BigDecimal.ZERO;
  29. /**
  30. * 入库总数
  31. */
  32. @ExcelProperty("入库")
  33. private Integer putTotal = 0;
  34. /**
  35. * 入库总额
  36. */
  37. @ExcelProperty("入库价值")
  38. private BigDecimal putPrice = BigDecimal.ZERO;
  39. /**
  40. * 出库总数
  41. */
  42. @ExcelProperty("出库")
  43. private Integer outTotal = 0;
  44. /**
  45. * 出库金额
  46. */
  47. @ExcelProperty("出库价值")
  48. private BigDecimal outPrice = BigDecimal.ZERO;
  49. /**
  50. * 不可用总数
  51. */
  52. @ExcelProperty("不可用总数")
  53. private Integer unavailable;
  54. /**
  55. * 不可用金额
  56. */
  57. @ExcelIgnore
  58. private BigDecimal unavailablePrice = BigDecimal.ZERO;
  59. /**
  60. * 退货总数
  61. */
  62. @ExcelProperty("退货库存")
  63. private Integer refundTotal = 0;
  64. /**
  65. * 退货金额
  66. */
  67. @ExcelProperty("退货库存价值")
  68. private BigDecimal refundPrice = BigDecimal.ZERO;
  69. /**
  70. * put
  71. * out
  72. * clean
  73. * refund
  74. * transport
  75. */
  76. public void setTotalWithPrice(String type, Integer num, BigDecimal price) {
  77. switch (type){
  78. case "put":
  79. this.putTotal += num;
  80. this.putPrice = this.putPrice.add(price);
  81. break;
  82. case "transport":
  83. this.outTotal += num;
  84. this.outPrice = this.outPrice.add(price);
  85. break;
  86. case "refund":
  87. this.refundTotal += num;
  88. this.refundPrice = this.refundPrice.add(price);
  89. break;
  90. default:
  91. }
  92. }
  93. }