package cn.com.lzt.tools; import java.util.ArrayList; import java.util.List; public class SCMConsole { /**现存量*/ public static String ONHAND = "onhand"; /**上两个月出库量*/ public static String LAST2MONTHOUTQUANTITY = "last2MonthOutQuantity"; /**货品分类编码-工程*/ public static String CATEGORY_CODE_GONGCHENG = "rootA01"; /**货品分类编码-保洁*/ public static String CATEGORY_CODE_BAOJIE = "rootA02"; /**货品分类编码-办公*/ public static String CATEGORY_CODE_BANGONG = "rootA03"; /**货品分类编码-固定资产*/ public static String CATEGORY_CODE_GUDING = "rootA04"; /**货品分类编码-应急采购*/ public static String CATEGORY_CODE_YINGJI= "rootA05"; /**货品分类编码-其他*/ public static String CATEGORY_CODE_QITA = "rootA06"; /**date参数格式:yyyy-MM*/ public static List getLastMonth(String date) { List last2monthList = new ArrayList(); String year = date.substring(0, 4); String month = date.substring(5); String lastyear="",lastmonth="",last2year="",last2month=""; if(month.equals("01")) { lastyear = Integer.toString(Integer.parseInt(year)-1); last2year = lastyear; lastmonth = "12"; last2month = "11"; }else if(month.equals("02")) { lastyear = year; last2year = Integer.toString(Integer.parseInt(year)-1); lastmonth = "01"; last2month = "12"; }else { lastyear = year; last2year = year; lastmonth = ((Integer.parseInt(month)-1 >9)? "" : "0") +Integer.toString(Integer.parseInt(month)-1); last2month = ((Integer.parseInt(month)-2 >9)? "" : "0") +Integer.toString(Integer.parseInt(month)-2); } last2monthList.add(lastyear+"-"+lastmonth); last2monthList.add(last2year+"-"+last2month); return last2monthList; } }