Home  >  Article  >  Java  >  Customer management and sales order functions of Java warehouse management system

Customer management and sales order functions of Java warehouse management system

WBOY
WBOYOriginal
2023-09-24 20:40:41687browse

Customer management and sales order functions of Java warehouse management system

The customer management and sales order functions of the Java warehouse management system require specific code examples

With the rapid development of e-commerce, warehouse management systems have become a challenge faced by various industries. an important question. In order to improve the efficiency and management level of the warehouse, enterprises need to build a complete warehouse management system. This article will introduce the customer management and sales order functions in the Java warehouse management system and give corresponding code examples.

Customer management is an important module, which is used to manage customer information in the warehouse system. Customer information includes the customer's basic information, contact information, historical orders, etc. Here is a code example for a simple customer management function:

public class Customer {
    private String name;
    private String address;
    private String phone;

    public Customer(String name, String address, String phone) {
        this.name = name;
        this.address = address;
        this.phone = phone;
    }

    // getters and setters

    public String toString() {
        return "Name: " + name + ", Address: " + address + ", Phone: " + phone;
    }
}

public class CustomerManagementSystem {
    private List<Customer> customerList;

    public CustomerManagementSystem() {
        customerList = new ArrayList<>();
    }

    public void addCustomer(Customer customer) {
        customerList.add(customer);
    }

    public void removeCustomer(Customer customer) {
        customerList.remove(customer);
    }

    public List<Customer> getCustomerList() {
        return customerList;
    }
}

// 使用示例
public class Main {
    public static void main(String[] args) {
        CustomerManagementSystem cms = new CustomerManagementSystem();

        Customer customer1 = new Customer("张三", "北京市朝阳区", "13888888888");
        Customer customer2 = new Customer("李四", "上海市浦东新区", "13999999999");

        cms.addCustomer(customer1);
        cms.addCustomer(customer2);

        // 输出客户列表
        List<Customer> customers = cms.getCustomerList();
        for (Customer customer : customers) {
            System.out.println(customer);
        }
    }
}

Sales orders are another important function in a warehouse management system. It is used to record and manage sales order information, including order number, order date, customer information, product information, etc. The following is a code example of a simple sales order function:

public class SalesOrder {
    private String orderId;
    private Date orderDate;
    private Customer customer;
    private List<Product> productList;

    public SalesOrder(String orderId, Date orderDate, Customer customer, List<Product> productList) {
        this.orderId = orderId;
        this.orderDate = orderDate;
        this.customer = customer;
        this.productList = productList;
    }

    // getters and setters

    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("Order ID: ").append(orderId).append("
");
        sb.append("Order Date: ").append(orderDate).append("
");
        sb.append("Customer: ").append(customer).append("
");
        sb.append("Product List:
");
        for (Product product : productList) {
            sb.append(product).append("
");
        }
        return sb.toString();
    }
}

public class SalesOrderManagementSystem {
    private List<SalesOrder> salesOrderList;

    public SalesOrderManagementSystem() {
        salesOrderList = new ArrayList<>();
    }

    public void addSalesOrder(SalesOrder salesOrder) {
        salesOrderList.add(salesOrder);
    }

    public void removeSalesOrder(SalesOrder salesOrder) {
        salesOrderList.remove(salesOrder);
    }

    public List<SalesOrder> getSalesOrderList() {
        return salesOrderList;
    }
}

// 使用示例
public class Main {
    public static void main(String[] args) {
        Customer customer = new Customer("王五", "广州市天河区", "13666666666");

        List<Product> productList = new ArrayList<>();
        productList.add(new Product("商品1", 10.0, 5));
        productList.add(new Product("商品2", 20.0, 3));

        SalesOrder salesOrder = new SalesOrder("202001010001", new Date(), customer, productList);

        SalesOrderManagementSystem soms = new SalesOrderManagementSystem();
        soms.addSalesOrder(salesOrder);

        // 输出销售订单列表
        List<SalesOrder> salesOrders = soms.getSalesOrderList();
        for (SalesOrder order : salesOrders) {
            System.out.println(order);
        }
    }
}

The above is a simple implementation of the customer management and sales order functions in the Java warehouse management system. Of course, actual warehouse management systems require more complete functions and more complex implementations. The code examples provided here are just to give readers a simple reference, and readers can conduct further design and development based on actual needs. Hope this article is helpful to you!

The above is the detailed content of Customer management and sales order functions of Java warehouse management system. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn