1 // 2 // Source code recreated from a .class file by IntelliJ IDEA 3 // (powered by FernFlower decompiler) 4 // 5 6 import java.io.PrintStream; 7 import java.util.ArrayList; 8 import java.util.Scanner; 9 10 public class test { 11 public test() { 12 } 13 14 public static void main(String[] args) { 15 ArrayList<WarehouseInformation> list = new ArrayList(); 16 17 while(true) { 18 printMenu(); 19 Scanner sc = new Scanner(System.in); 20 switch (sc.next()) { 21 case "1": 22 input(list); 23 break; 24 case "2": 25 modify(list); 26 break; 27 case "3": 28 delete(list); 29 break; 30 case "4": 31 check(list); 32 break; 33 case "5": 34 System.out.println("正在退出系统"); 35 System.exit(0); 36 default: 37 System.out.println("输入有误,请重新输入"); 38 } 39 } 40 } 41 42 public static void printMenu() { 43 System.out.println("***********************************************************"); 44 System.out.println("石家庄铁道大学前进22软件开发有限公司"); 45 System.out.println("***********************************************************"); 46 System.out.println("1、商品入库管理"); 47 System.out.println("2、商品信息修改"); 48 System.out.println("3、商品出库管理"); 49 System.out.println("4、仓库盘点管理"); 50 System.out.println("5、退出"); 51 System.out.println("**********************************************************"); 52 } 53 54 public static void printTitle() { 55 System.out.println("***********************************************************"); 56 System.out.println("石家庄铁道大学前进22软件开发有限公司"); 57 System.out.println("***********************************************************"); 58 } 59 60 public static void input(ArrayList<WarehouseInformation> list) { 61 printTitle(); 62 WarehouseInformation good = new WarehouseInformation(); 63 Scanner sc = new Scanner(System.in); 64 System.out.print("商品编号:"); 65 66 while(true) { 67 String itemNo = sc.next(); 68 if (itemNo.length() == 8) { 69 good.setItemNo(itemNo); 70 System.out.print("商品名称:"); 71 String itemName = sc.next(); 72 good.setItemName(itemName); 73 System.out.print("供货商信息:"); 74 String supplierName = sc.next(); 75 good.setSupplierName(supplierName); 76 System.out.print("入库时间:"); 77 78 while(true) { 79 String warehousingTime = sc.next(); 80 if (warehousingTime.length() == 8) { 81 good.setWarehousingTime(warehousingTime); 82 System.out.print("存放仓库号:"); 83 84 while(true) { 85 String warehouseNumber = sc.next(); 86 if (warehouseNumber.length() == 3) { 87 good.setWarehouseNumber(warehouseNumber); 88 System.out.print("存放位置信息:"); 89 90 while(true) { 91 String warehousePlace = sc.next(); 92 if (warehousePlace.length() == 8) { 93 good.setWarehousePlace(warehousePlace); 94 System.out.print("入库商品数量:"); 95 int itemNumber = sc.nextInt(); 96 good.setItemNumber(itemNumber); 97 System.out.println("该商品入库操作已完成,是否提交(Y/N)"); 98 System.out.println("***********************************************************"); 99 String s = sc.next(); 100 if (s.equals("Y")) { 101 list.add(good); 102 System.out.println("录入成功"); 103 return; 104 } else { 105 return; 106 } 107 } 108 109 System.out.println("录入错误,请重新录入"); 110 } 111 } 112 113 System.out.println("录入错误,请重新录入"); 114 } 115 } 116 117 System.out.println("录入错误,请重新录入"); 118 } 119 } 120 121 System.out.println("录入错误,请重新录入"); 122 } 123 } 124 125 public static void modify(ArrayList<WarehouseInformation> list) { 126 while(true) { 127 printTitle(); 128 Scanner sc = new Scanner(System.in); 129 System.out.print("请输入八位的商品编号"); 130 String number = sc.next(); 131 System.out.println("***********************************************************"); 132 int i = index(list, number); 133 if (i >= 0) { 134 new WarehouseInformation(); 135 new WarehouseInformation(); 136 WarehouseInformation good = (WarehouseInformation)list.get(i); 137 WarehouseInformation good1 = (WarehouseInformation)list.get(i); 138 printTitle(); 139 System.out.println("1,商品编号:" + good.getItemNo()); 140 System.out.println("2,商品名称:" + good.getItemName()); 141 System.out.println("3,供货商信息:" + good.getSupplierName()); 142 System.out.println("4,入库时间:" + good.getWarehousingTime()); 143 System.out.println("5,存放仓库号:" + good.getWarehouseNumber()); 144 System.out.println("6,存放位置信息:" + good.getWarehousePlace()); 145 System.out.println("7,入库商品数量:" + good.getItemNumber()); 146 System.out.println("请输入要修改的信息编号(1-7)"); 147 int n = sc.nextInt(); 148 String s; 149 switch (n) { 150 case 1: 151 System.out.print("请输入修改后的商品编号:"); 152 s = sc.next(); 153 good.setItemNo(s); 154 break; 155 case 2: 156 System.out.print("请输入修改后的商品名称:"); 157 s = sc.next(); 158 good.setItemName(s); 159 break; 160 case 3: 161 System.out.print("请输入修改后的供货商信息:"); 162 s = sc.next(); 163 good.setSupplierName(s); 164 break; 165 case 4: 166 System.out.print("请输入修改后的入库时间:"); 167 s = sc.next(); 168 good.setWarehousingTime(s); 169 break; 170 case 5: 171 System.out.print("请输入修改后的存放仓库号:"); 172 s = sc.next(); 173 good.setWarehouseNumber(s); 174 break; 175 case 6: 176 System.out.print("请输入修改后的存放位置信息:"); 177 s = sc.next(); 178 good.setWarehousePlace(s); 179 break; 180 case 7: 181 System.out.print("请输入修改后的入库商品数量:"); 182 int itemNumber = sc.nextInt(); 183 good.setItemNumber(itemNumber); 184 break; 185 default: 186 System.out.println("该选项不存在"); 187 return; 188 } 189 190 System.out.println("修改成功"); 191 System.out.println("该商品入库操作已完成,是否提交(Y/N)"); 192 s = sc.next(); 193 if (s.equals("Y")) { 194 return; 195 } 196 197 good.setItemNo(good1.getItemNo()); 198 good.setItemName(good1.getItemName()); 199 good.setSupplierName(good1.getSupplierName()); 200 good.setWarehousingTime(good1.getWarehousingTime()); 201 good.setWarehousingTime(good1.getWarehousingTime()); 202 good.setWarehouseNumber(good1.getWarehouseNumber()); 203 good.setItemNumber(good1.getItemNumber()); 204 return; 205 } 206 207 System.out.println("不存在该商品信息"); 208 } 209 } 210 211 public static int index(ArrayList<WarehouseInformation> list, String number) { 212 for(int i = 0; i < list.size(); ++i) { 213 new WarehouseInformation(); 214 WarehouseInformation good = (WarehouseInformation)list.get(i); 215 if (good.getItemNo().equals(number)) { 216 return i; 217 } 218 } 219 220 return -1; 221 } 222 223 public static void delete(ArrayList<WarehouseInformation> list) { 224 while(true) { 225 printTitle(); 226 Scanner sc = new Scanner(System.in); 227 System.out.print("请输入八位的商品编号"); 228 String number = sc.next(); 229 System.out.println("***********************************************************"); 230 int i = index(list, number); 231 if (i >= 0) { 232 new WarehouseInformation(); 233 new WarehouseInformation(); 234 WarehouseInformation good = (WarehouseInformation)list.get(i); 235 printTitle(); 236 System.out.println("1,商品编号:" + good.getItemNo()); 237 System.out.println("2,商品名称:" + good.getItemName()); 238 System.out.println("3,供货商信息:" + good.getSupplierName()); 239 System.out.println("4,入库时间:" + good.getWarehousingTime()); 240 System.out.println("5,存放仓库号:" + good.getWarehouseNumber()); 241 System.out.println("6,存放位置信息:" + good.getWarehousePlace()); 242 System.out.println("7,入库商品数量:" + good.getItemNumber()); 243 System.out.print("出库时间:"); 244 String shipmentTime = sc.next(); 245 good.setShipmentTime(shipmentTime); 246 System.out.print("出库数量:"); 247 int outNumber = sc.nextInt(); 248 good.setOutNumber(outNumber); 249 System.out.println("该商品入库操作已完成,是否提交(Y/N)"); 250 String s = sc.next(); 251 if (s.equals("Y")) { 252 return; 253 } 254 255 good.setShipmentTime((String)null); 256 good.setOutNumber(0); 257 return; 258 } 259 260 System.out.println("不存在该商品信息"); 261 } 262 } 263 264 public static void check(ArrayList<WarehouseInformation> list) { 265 if (list.size() == 0) { 266 System.out.println("没有任何商品信息,请先录入"); 267 } else { 268 printTitle(); 269 270 for(int i = 0; i < list.size(); ++i) { 271 new WarehouseInformation(); 272 WarehouseInformation good = (WarehouseInformation)list.get(i); 273 int number = good.getItemNumber() - good.getOutNumber(); 274 System.out.print(i + 1); 275 PrintStream var10000 = System.out; 276 String var10001 = good.getItemNo(); 277 var10000.println(".商品编号:" + var10001 + ",商品名称:" + good.getItemName() + ",库存数量:" + number); 278 } 279 280 System.out.println("***********************************************************"); 281 } 282 } 283 } 284 // 285 // Source code recreated from a .class file by IntelliJ IDEA 286 // (powered by FernFlower decompiler) 287 // 288 289 public class WarehouseInformation { 290 private String itemNo; 291 private String itemName; 292 private String supplierName; 293 private String warehousingTime; 294 private String shipmentTime; 295 private String warehouseNumber; 296 private String warehousePlace; 297 private int itemNumber; 298 private int outNumber; 299 300 public WarehouseInformation() { 301 } 302 303 public WarehouseInformation(String itemNo, String itemName, String supplierName, String warehousingTime, String shipmentTime, String warehouseNumber, String warehousePlace, int itemNumber, int outNumber) { 304 this.itemNo = itemNo; 305 this.itemName = itemName; 306 this.supplierName = supplierName; 307 this.warehousingTime = warehousingTime; 308 this.shipmentTime = shipmentTime; 309 this.warehouseNumber = warehouseNumber; 310 this.warehousePlace = warehousePlace; 311 this.itemNumber = itemNumber; 312 this.outNumber = outNumber; 313 } 314 315 public String getItemNo() { 316 return this.itemNo; 317 } 318 319 public void setItemNo(String itemNo) { 320 this.itemNo = itemNo; 321 } 322 323 public String getItemName() { 324 return this.itemName; 325 } 326 327 public void setItemName(String itemName) { 328 this.itemName = itemName; 329 } 330 331 public String getSupplierName() { 332 return this.supplierName; 333 } 334 335 public void setSupplierName(String supplierName) { 336 this.supplierName = supplierName; 337 } 338 339 public String getWarehousingTime() { 340 return this.warehousingTime; 341 } 342 343 public void setWarehousingTime(String warehousingTime) { 344 this.warehousingTime = warehousingTime; 345 } 346 347 public String getShipmentTime() { 348 return this.shipmentTime; 349 } 350 351 public void setShipmentTime(String shipmentTime) { 352 this.shipmentTime = shipmentTime; 353 } 354 355 public String getWarehouseNumber() { 356 return this.warehouseNumber; 357 } 358 359 public void setWarehouseNumber(String warehouseNumber) { 360 this.warehouseNumber = warehouseNumber; 361 } 362 363 public String getWarehousePlace() { 364 return this.warehousePlace; 365 } 366 367 public void setWarehousePlace(String warehousePlace) { 368 this.warehousePlace = warehousePlace; 369 } 370 371 public int getItemNumber() { 372 return this.itemNumber; 373 } 374 375 public void setItemNumber(int itemNumber) { 376 this.itemNumber = itemNumber; 377 } 378 379 public int getOutNumber() { 380 return this.outNumber; 381 } 382 383 public void setOutNumber(int outNumber) { 384 this.outNumber = outNumber; 385 } 386 }
标签:good,java,String,第一节,System,源码,println,public,out From: https://www.cnblogs.com/Lyh3012648079/p/17700514.html