This commit is contained in:
seahi 2024-11-25 12:35:57 +08:00
parent c2923336e6
commit d1ec1423dd

View File

@ -37,8 +37,6 @@ public class Manager {
System.out.print("请输入要出库的商品编号:");
int id = sc.nextInt();
removeGoods(id);
System.out.println("商品出库成功,出库后仓库商品如下:");
showWareHouse();
break;
}
}
@ -65,7 +63,13 @@ public class Manager {
// 商品出库从goodList中删除指定位置的元素
static void removeGoods(int index) {
goodsList.remove(index);
if (index >= 0 && index < goodsList.size()) {
goodsList.remove(index);
System.out.println("商品出库成功,出库后仓库商品如下:");
showWareHouse();
} else {
System.out.println("商品不存在!");
}
}
// 使用迭代器遍历商品