.
This commit is contained in:
parent
c2923336e6
commit
d1ec1423dd
@ -37,8 +37,6 @@ public class Manager {
|
|||||||
System.out.print("请输入要出库的商品编号:");
|
System.out.print("请输入要出库的商品编号:");
|
||||||
int id = sc.nextInt();
|
int id = sc.nextInt();
|
||||||
removeGoods(id);
|
removeGoods(id);
|
||||||
System.out.println("商品出库成功,出库后仓库商品如下:");
|
|
||||||
showWareHouse();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -65,7 +63,13 @@ public class Manager {
|
|||||||
|
|
||||||
// 商品出库(从goodList中删除指定位置的元素)
|
// 商品出库(从goodList中删除指定位置的元素)
|
||||||
static void removeGoods(int index) {
|
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("商品不存在!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 使用迭代器遍历商品
|
// 使用迭代器遍历商品
|
||||||
|
Loading…
x
Reference in New Issue
Block a user