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