1 import java.util.ArrayList; 2 import java.util.Scanner; 3 4 public class mainFrame { 5 public static void main(String[] args) { 6 ArrayList<WarehouseInformation> array=new ArrayList<WarehouseInformation>(); 7 8 9 while(true){ 10 System.out.println("**********************************"); 11 System.out.println(" 石家庄铁道大学前进22软件开发有限公司"); 12 System.out.println(" 仓库管理系统2022版"); 13 System.out.println("**********************************"); 14 System.out.println(" 1、商品入库管理"); 15 System.out.println(" 2、商品信息修改"); 16 System.out.println(" 3、商品出库管理"); 17 System.out.println(" 4、仓库盘点管理"); 18 System.out.println("**********************************"); 19 System.out.println("请输入:"); 20 Scanner sc=new Scanner(System.in); 21 String number=sc.nextLine(); 22 switch (number){ 23 case "1": 24 goodsWarehousing(array); 25 break; 26 case "2": 27 modifyWarehous(array); 28 break; 29 case "3": 30 outboundWarehouse(array); 31 break; 32 case "4": 33 countGoods(array); 34 System.exit(0); 35 36 37 38 39 40 } 41 42 } 43 } 44 public static void goodsWarehousing(ArrayList<WarehouseInformation> array){ 45 System.out.println("**********************************"); 46 System.out.println(" 石家庄铁道大学前进22软件开发有限公司"); 47 System.out.println(" 仓库管理系统2022版"); 48 System.out.println("**********************************"); 49 System.out.print("商品编号:"); 50 Scanner sc=new Scanner(System.in); 51 String itemno=sc.nextLine(); 52 System.out.print("商品名称:"); 53 String itemname=sc.nextLine(); 54 System.out.print("供货商信息:"); 55 String suppliername =sc.nextLine(); 56 System.out.print("入库时间:"); 57 String warehousingtime =sc.nextLine(); 58 System.out.print("存放仓库号:"); 59 String warehousenumber=sc.nextLine(); 60 System.out.print("存放位置信息:"); 61 String warehouseplace=sc.nextLine(); 62 System.out.print("入库商品数量:"); 63 int itemnumber=sc.nextInt(); 64 65 WarehouseInformation s=new WarehouseInformation(); 66 s.setItemno(itemno); 67 s.setItemname(itemname); 68 s.setSuppliername(suppliername); 69 s.setWarehousingtime(warehousingtime); 70 s.setWarehousenumber(warehousenumber); 71 s.setWarehouseplace(warehouseplace); 72 s.setItemnumber(itemnumber); 73 74 System.out.println("**********************************"); 75 System.out.println(" 石家庄铁道大学前进22软件开发有限公司"); 76 System.out.println(" 仓库管理系统2022版"); 77 System.out.println("**********************************"); 78 System.out.println("商品编号:"+s.getItemno()); 79 System.out.println("商品名称:"+s.getItemname()); 80 System.out.println("供货商信息:"+s.getSuppliername()); 81 System.out.println("入库时间:"+s.getWarehousingtime()); 82 System.out.println("存放仓库号:"+s.getWarehousenumber()); 83 System.out.println("存放位置信息:"+s.getWarehouseplace()); 84 System.out.println("入库商品数量:"+s.getItemnumber()); 85 System.out.println("该商品入库操作已完成,是否提交(Y/N)"); 86 87 String n=sc.nextLine(); 88 89 90 array.add(s); 91 92 93 94 95 96 } 97 98 public static void modifyWarehous(ArrayList<WarehouseInformation> array){ 99 System.out.println("**********************************"); 100 System.out.println(" 石家庄铁道大学前进22软件开发有限公司"); 101 System.out.println(" 仓库管理系统2022版"); 102 System.out.println("**********************************"); 103 System.out.println(" 请输入商品编号:XXXXXXXX"); 104 System.out.println("**********************************"); 105 Scanner sc=new Scanner(System.in); 106 String itemno=sc.nextLine(); 107 108 if(array.size()==0) 109 { 110 System.out.println("库中没有该商品"); 111 return; 112 } 113 114 WarehouseInformation s=new WarehouseInformation(); 115 for (int i=0;i<array.size();i++){ 116 s=array.get(i); 117 if(s.getItemno().equals(itemno )){ 118 System.out.println("**********************************"); 119 System.out.println(" 石家庄铁道大学前进22软件开发有限公司"); 120 System.out.println(" 仓库管理系统2022版"); 121 System.out.println("**********************************"); 122 System.out.println("1.商品编号:"+s.getItemno()); 123 System.out.println("2.商品名称:"+s.getItemname()); 124 System.out.println("3.供货商信息:"+s.getSuppliername()); 125 System.out.println("4.入库时间:"+s.getWarehousingtime()); 126 System.out.println("5.存放仓库号:"+s.getWarehousenumber()); 127 System.out.println("6.存放位置信息:"+s.getWarehouseplace()); 128 System.out.println("7.入库商品数量:"+s.getItemnumber()); 129 System.out.println("请选择需要修改的信息编号(1-7):"); 130 System.out.println("**********************************"); 131 int m=sc.nextInt(); 132 if(m>=0||m>7) 133 { 134 System.out.println("该选项不存在"); 135 return; 136 } 137 else{ 138 switch (m) { 139 case 1: 140 String itemno1 = sc.nextLine(); 141 s.setItemno(itemno1); 142 array.add(s); 143 break; 144 case 2: 145 String itemname1 = sc.nextLine(); 146 s.setItemname(itemname1); 147 array.add(s); 148 break; 149 case 3: 150 String suppliername1 = sc.nextLine(); 151 s.setSuppliername(suppliername1); 152 array.add(s); 153 break; 154 case 4: 155 String warehousingtime1= sc.nextLine(); 156 s.setWarehousingtime(warehousingtime1); 157 array.add(s); 158 break; 159 case 5: 160 String warehousenumber1 = sc.nextLine(); 161 s.setWarehousenumber(warehousenumber1); 162 array.add(s); 163 break; 164 case 6: 165 String warehouseplace1 = sc.nextLine(); 166 s.setWarehouseplace(warehouseplace1); 167 array.add(s); 168 break; 169 case 7: 170 int itemnumber1 = sc.nextInt(); 171 s.setItemnumber(itemnumber1); 172 array.add(s); 173 break; 174 } 175 } 176 } 177 } 178 179 } 180 181 public static void outboundWarehouse(ArrayList<WarehouseInformation> array) { 182 Scanner sc = new Scanner(System.in); 183 System.out.println("**********************************"); 184 System.out.println(" 石家庄铁道大学前进22软件开发有限公司"); 185 System.out.println(" 仓库管理系统2022版"); 186 System.out.println("**********************************"); 187 System.out.println(" 请输入商品编号:XXXXXXXX"); 188 System.out.println("**********************************"); 189 String itemno = sc.nextLine(); 190 191 WarehouseInformation s = new WarehouseInformation(); 192 for (int i = 0; i < array.size(); i++) { 193 s = array.get(i); 194 if (s.getItemno().equals(itemno)) { 195 System.out.println("**********************************"); 196 System.out.println(" 石家庄铁道大学前进22软件开发有限公司"); 197 System.out.println(" 仓库管理系统2022版"); 198 System.out.println("**********************************"); 199 System.out.println(" 1.商品编号:" + s.getItemno()); 200 System.out.println(" 2.商品名称:" + s.getItemname()); 201 System.out.println(" 3.供货商信息:" + s.getSuppliername()); 202 System.out.println(" 4.入库时间:" + s.getWarehousingtime()); 203 System.out.println(" 5.存放仓库号:" + s.getWarehousenumber()); 204 System.out.println(" 6.存放位置信息:" + s.getWarehouseplace()); 205 System.out.println(" 7.入库商品数量:" + s.getItemnumber()); 206 System.out.println(" 出库时间:XXXXXXXXX"); 207 System.out.println(" 出库数量:xxx "); 208 System.out.println("**********************************"); 209 210 break; 211 } 212 String shipmenttime = sc.nextLine(); 213 int outnumber = sc.nextInt(); 214 215 s.setShipmenttime(shipmenttime); 216 s.setOutnumber(outnumber); 217 218 System.out.println("请选择(Y/N)"); 219 String a = sc.nextLine(); 220 221 222 array.add(s); 223 224 } 225 226 227 } 228 229 public static void countGoods(ArrayList<WarehouseInformation> array){ 230 System.out.println("**********************************"); 231 System.out.println(" 石家庄铁道大学前进22软件开发有限公司"); 232 System.out.println(" 仓库管理系统2022版"); 233 System.out.println("***********************************"); 234 for(int i=0;i<array.size();i++) 235 { 236 WarehouseInformation s=array.get(i); 237 Scanner sc=new Scanner(System.in); 238 int n=s.getItemnumber()-s.getOutnumber(); 239 240 System.out.println("商品编号:"+s.getItemno()+"、商品名称:"+s.getItemname()+"、库存量:"+n); 241 } 242 System.out.println("***********************************"); 243 244 245 } 246 247 } 248 public class WarehouseInformation { 249 private String itemno; 250 private String itemname; 251 private String suppliername; 252 private String warehousingtime; 253 private String shipmenttime; 254 private String warehousenumber; 255 private String warehouseplace; 256 private int itemnumber; 257 private int outnumber; 258 259 public WarehouseInformation() { 260 } 261 262 263 public String getItemno() { 264 return itemno; 265 } 266 267 public void setItemno(String itemno) { 268 this.itemno = itemno; 269 } 270 271 public String getItemname() { 272 return itemname; 273 } 274 275 public void setItemname(String itemname) { 276 this.itemname = itemname; 277 } 278 279 public String getSuppliername() { 280 return suppliername; 281 } 282 283 public void setSuppliername(String suppliername) { 284 this.suppliername = suppliername; 285 } 286 287 public String getWarehousingtime() { 288 return warehousingtime; 289 } 290 291 public void setWarehousingtime(String warehousingtime) { 292 this.warehousingtime = warehousingtime; 293 } 294 295 public String getShipmenttime() { 296 return shipmenttime; 297 } 298 299 public void setShipmenttime(String shipmenttime) { 300 this.shipmenttime = shipmenttime; 301 } 302 303 public String getWarehousenumber() { 304 return warehousenumber; 305 } 306 307 public void setWarehousenumber(String warehousenumber) { 308 this.warehousenumber = warehousenumber; 309 } 310 311 public String getWarehouseplace() { 312 return warehouseplace; 313 } 314 315 public void setWarehouseplace(String warehouseplace) { 316 this.warehouseplace = warehouseplace; 317 } 318 319 public int getItemnumber() { 320 return itemnumber; 321 } 322 323 public void setItemnumber(int itemnumber) { 324 this.itemnumber = itemnumber; 325 } 326 327 public int getOutnumber() { 328 return outnumber; 329 } 330 331 public void setOutnumber(int outnumber) { 332 this.outnumber = outnumber; 333 } 334 }
标签:sc,管理系统,System,商品,String,println,array,out From: https://www.cnblogs.com/Christmas77/p/17709239.html