SCMConsole.java 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. package cn.com.lzt.tools;
  2. import java.util.ArrayList;
  3. import java.util.List;
  4. public class SCMConsole {
  5. /**现存量*/
  6. public static String ONHAND = "onhand";
  7. /**上两个月出库量*/
  8. public static String LAST2MONTHOUTQUANTITY = "last2MonthOutQuantity";
  9. /**货品分类编码-工程*/
  10. public static String CATEGORY_CODE_GONGCHENG = "rootA01";
  11. /**货品分类编码-保洁*/
  12. public static String CATEGORY_CODE_BAOJIE = "rootA02";
  13. /**货品分类编码-办公*/
  14. public static String CATEGORY_CODE_BANGONG = "rootA03";
  15. /**货品分类编码-固定资产*/
  16. public static String CATEGORY_CODE_GUDING = "rootA04";
  17. /**货品分类编码-应急采购*/
  18. public static String CATEGORY_CODE_YINGJI= "rootA05";
  19. /**货品分类编码-其他*/
  20. public static String CATEGORY_CODE_QITA = "rootA06";
  21. /**date参数格式:yyyy-MM*/
  22. public static List<String> getLastMonth(String date)
  23. {
  24. List<String> last2monthList = new ArrayList<String>();
  25. String year = date.substring(0, 4);
  26. String month = date.substring(5);
  27. String lastyear="",lastmonth="",last2year="",last2month="";
  28. if(month.equals("01")) {
  29. lastyear = Integer.toString(Integer.parseInt(year)-1);
  30. last2year = lastyear;
  31. lastmonth = "12";
  32. last2month = "11";
  33. }else if(month.equals("02")) {
  34. lastyear = year;
  35. last2year = Integer.toString(Integer.parseInt(year)-1);
  36. lastmonth = "01";
  37. last2month = "12";
  38. }else {
  39. lastyear = year;
  40. last2year = year;
  41. lastmonth = ((Integer.parseInt(month)-1 >9)? "" : "0")
  42. +Integer.toString(Integer.parseInt(month)-1);
  43. last2month = ((Integer.parseInt(month)-2 >9)? "" : "0")
  44. +Integer.toString(Integer.parseInt(month)-2);
  45. }
  46. last2monthList.add(lastyear+"-"+lastmonth);
  47. last2monthList.add(last2year+"-"+last2month);
  48. return last2monthList;
  49. }
  50. }