Clothing Management Solution
The clothing industry is one of the most dynamic retailer-driven and global economic sectors. This sector is also organizationally complex and supply chains are very long with different parties involved taking different roles. Globalization trends have made supply chains broader and more international and the clothing industry has seen the outsourcing of most of its production activities to suppliers in developing countries. Moreover, price sensitive customers, short product life cycles, a wide product range, as well as volatile and unpredictable demand have characterized this industry.
Despite this, the traditional configuration is a forecast driven supply chain distributing in Sri Lanka. There are few more seasonal times, who are celebrating different nationalities, and their needs depend on their functions. To facilitate this, the major retailers, brand owners lead, and coordinate different agents and activities, franchised stores, own design departments, product category manufacturing suppliers, garment manufacturing and yarn procurement in low cost countries and in Sri Lanka.
The supply chain complexity is not only a function of the number of links, nodes and items in the network. It is also affected by the level of inter-relationship between the organizational units. Hence, all these agents and activities have to be integrated in order to be effective in two key value process, which are new product collection development and order fulfilment. There are few more questions of proposed solution.
- Difficulties to get allocations on time
2. Leading to loss of sales in stores and orders at sales conventions with customer retailors.
3. Overstock after the campaigns due to forecast driven manufacturing and procurement with difficulties to have an accurate demand forecast.
4. Lack of manufacturing responsiveness from suppliers.
The retail business vision is to maximize profit from customer satisfaction and loyalty towards the store by providing more personalize service for the customer. However retail business are easy to lose its possible customer if they do not have sufficient stocks in the store.
By proposing Clothing Management System to the store as the replacement of old manual ways, the project aims in providing system with enhanced and more flexible functions to the store. The objective of the system is to provide functions in managing goods in the store more efficiently. In addition, customer can pick preferred goods by using customer portal. It will be productive during this pandemic situation since no one is unable to go out.
The expected result of the system is that the user interface to be developed will be user friendly so that it can be handle easily by people. Besides, the system is expected to serve its functions and reducing time and paper work by managing their inventory.
Inventory is one of the important departments that must be well managed in order to ensure daily business activities. However, current system is not equipped in computerized system in running their business. As a result, the security level of all data, documents and anything that related to daily transaction is very low. Many documents have been keep for each products and for each supplier, which consume a lot of time and not effective for future references. In addition, due to poor sales and inventory management, problem comes in identifying the quantity sold for each items per day and available inventory level of the items.
During the pandemic situation, customers prefer to purchase products via online since it makes secure for most of people. By using online facility, they can buy more products under the right health regulations. Customer need to get the status of the ordered product without giving any telephone conversation. Customer does not get proper receipt once he purchased product since they could not have to return the item if the item is not suit for customer expectation.
When the products are delivered, there should be a proper communication link in between seller, customer and delivery. Otherwise, seller does not know whether customer picked the item or not.
There should be a proper tracking system with the product instead of searching product code when cashier create the invoice. Thus, there is no proper guideline in making reports in the store’s logbook, which result in different kind of reports being prepared each time.
Significance of the project
Proposed system will contain database that enable data storage and retrieving of each transactions and data about inventory of each transactions in the store, manage the product releases and storage and summarize point of sales. This would generate a faster improvisation of work with less time and effort. As the concept of Clothing Management System is to reduce paper works and ineffective ways of managing inventory, this system is expected to assist in making the right decision in the process of managing inventory aligned with the sales level in the store.
Proposed system contains enhanced and more flexible functions to the user. The objectives include
1. Provide functions to manage products in the store more efficiently. Basic CRUD operation for data management will be made available.
2. Filling system in managing all transactions and documents that are relevant as the aid in the stock tracking routines.
3. Automatically generate weekly report on sales and inventory activities.
4. Provide notifications on the products when decreasing quantity on hand.
5. Generate receipt with proper format for customer references.
6. Provide point of sales for each day.
7. Reduce time, cost to control, and manage inventory.
8. Customer web portal introduced. By using Order no customer can get the status of their order.
9. Maintain accurate order flow with manager and customer.
10. Customer receives SMS by updating the status of order as well as email notifications.
11. System reads whole products by scanning barcode number.
12. Introduce GPS tracker for delivery.
13. Authentication and authorization is made for whole system.
14. System can upload supplier documents.
15. Maintain customer and supplier base for higher profits.
16. Consider customer feedbacks.
Functional requirements for the proposed system are listed below.
1. Importing and exporting files.
2. Scan product through barcode machine.
3. Customer feedbacks through customer portal.
4. Report generations.
5. Show notifications in progress of sales.
Micro services architecture enables to accelerate deployments, increase flexibility and quickly innovate the organization and it adapts to changing market conditions. Micro services are an increasingly popular way of building cloud applications and a natural fit for container-development environments.
Typically, micro services are used to speed up application development. It use libraries but they consider componentizing their own software by breaking down into services. One main reason of using services as components, services are independently deployable and scalable. If the system consists of multiple libraries in a single process, a change to any single component results in having to redeploy the entire application. But in micro services, we can expect many single service changes to only require that service to be redeployed.
Decentralized data management will give fully decoupled micro services and the liberty of choosing desperate data management techniques (ex:-SQL/NOSQL). When you need synchronous messaging across multiple micro services, we can use several techniques. This includes building a service composition where one service calls multiple services to update the required database with service API. We can also use event-based messaging between services to propagate data across multiple services and form different materialized views of data. There are some related patterns such as Command Query Responsibility Segregation (CQRS), which relates to data management in micro services.
Whole system developed using java since it is user-friendly programming language and Object Oriented Programming language (OOP) since OOP offers a neat modular structure, thereby making it easier to easier to solve complex problems. In addition, it helps to write reusable code and enhances the development process. Java Runtime Environment (JRE) is compatible with almost all devices and platforms, from Macintosh, Linux/Unix, Windows, to other mainframe systems and even mobile systems.
Java uses multi-threaded web server that processes each request in a separate thread. That enables to perform several tasks simultaneously without querying the events. Java is secured programming language. Its security obtains from a large set of APIs, tools and implementations of commonly used security algorithms, mechanisms and protocols. Java APIs include cryptography, public key infrastructure, secure communication, authentication and access control. JDK was originally developed with a strong emphasis on security allowing for creating secure applications from the very start.
The automatic memory management and garbage collection make java highly scalable and speeds up the development of web applications. It also allows good and optimized code written. Java has a strong type checking mechanism, which makes java robust. JVM (Java Virtual Machine) provides dynamic and safe environment and allows java to run everywhere.
Spring is a very popular java-based framework for building web and enterprise applications. Unlike many other frameworks, which focus only one area, spring framework provides a wide variety of features addressing the modern business needs via its portfolio projects.
Spring framework provides flexibility to configure beans in multiple ways such as, XML, Annotations and JavaConfig. Spring dependency injection approach encourages writing testable code and it has powerful database transaction management. Spring simplifies integration with other java frameworks like JPA/Hibernate ORM/etc.
Along the spring framework, spring has many facilities to build applications which needs to business market. Spring Data simplifies data access form relational and NoSql data stores. Spring Batch provides powerful batch processing framework. Spring Security brings out secure for applications and Spring Integration facilitates integration with other enterprise applications using lightweight messaging and declarative adaptors. Proposed system might helpful by using spring boot since it is an enterprise application.
Front end of the proposed system is implemented using Angular 11 version. It is easy platform and framework for building single page client applications using HTML and Typescript. Angular is written in Typescript. Since this framework enhances interactive mechanisms, can easily create dynamic web pages with instantly updated content. Angular eliminates the unnecessary code; it ensures a smooth and easy development. It also has simplified MVC architecture. It can save time and reach deadlines faster, lowering the web app production time.
In contrast to React, Angular is a fully-fledged responsive web design framework. A key feature is that there is one suggested way to create a component, service or module. Angular supports superb code maintainability of code in several ways. When moving up from one major version to another, all Angular related packages are updated at the same time (ex: — HTTP, Routing and Angular material).
The nature of Angular brings out; it can effectively divide code into modules. This allows for easy organization of app functionality and the creation of reusable chunks of code which can vastly reduce development time and cost.
Architectural diagram for proposed system
Proposed system has seven services, which belongs to seven databases. Those are customer, product, order, payment, supplier, delivery and notification. Customer service brings out customer registration by company staff it has an interconnection with delivery and notification service. Whole product details are updated in product service it might have an interconnection with order, payment, delivery and notification services. When order comes, order service facilitates whole customer orders by using product service. Customer payments and invoices are handled by payment service and it has interconnected with order and product service. Supplier registration and supplier chain details are included in supplier service. Delivery details including the history of delivery are maintained in delivery service. It has interconnected with product, customer, order, payment and notification services. Status of order will be maintained in notification service. Finally customer will be received the status of their orders through SMS and emails.
Why Eureka Sever Discovery Service?
Proposed system has used eureka server discovery service for locating services for the purpose of load balancing and failover of middle-tier servers. It holds the information about all client-service applications. The server can be configured and deployed to be highly available, with each server replicating state about the registered services to the others.
When eureka server gives the application’s services the ability to find other services without knowing where they are hosted or the full URL required to reach them since no need to provide complete URLs for each service that needs to reach another service.
Micro services are just REST-services. When two services run under different ports, call the consumer-service from the other, need to use discovery service in spring-boot application by writing @EnableEurekaServer annotation (need to add the appropriate dependency in the POM file). After that, adding @EnableDiscoveryClient annotation to the main classes and and the default zone pointing to eureka service in the application. Every service will register into eureka server and it knows all the client applications running on each port and IP address.
Eureka server does not have a back end store, but the service instances in the registry all have to send heartbeats to keep their registrations up to date. Clients also have an in memory cache of Eureka registrations.
Here, I have mentioned the code which I used…..
Why Hystrix Circuit Breaker?
Circuit breaker concept is same as an electrical circuit. When the circuit is closed, electrons through the circuit, but if any unusual things happened, it trips the circuit, and the circuit is opened up so there is no flow electrons through the circuit. It provides the circuit time to recover itself and after a certain amount of time, the circuit closes and the flow of electrons continues.
Proposed system has used Netflix Hystrix since it is such a framework, which works on the same scenario. It is always monitoring the calls, so if any dependent service response is greater than the threshold limit, it trips the circuit, so no further calls will flow to the dependent service. It gives the dependent service time to recover itself. In that time fallback policy; all the requests go to that fallback path. After a certain amount of time, the circuit is closed again request flow is as.
Let’s assume order service. It calls order service to find orders based on the order id. Currently, if order service is unavailable, the order service does not get the result and shows an error. But if we want to show a default order value, if order service is not available, need to incorporate the Hystrix command in order service. First need to add Hystrix plugin in to pom.xml. Then need to add @EnableCircuitBreaker on top of the order service to enable the Hystrix on order service. After that, it can use related controller in application to enable Hystrix. By using @HystrixCommand annotation on top of the method, it instructs spring to proxy to the related method. So, if any error occurs or order service is not available, it goes through the fallback method and calls it, and shows the default value rather than showing an error.
Following code reveals how I implement Hystrix circuit breaker pattern in order service.
Why API Gateway?
API gateway is the single entry point for all clients. It handles requests in one of two ways. Some requests are simply routes to the appropriate service. It handles other requests by fanning out to multiple services. It is the entry point of micro services and act as a gatekeeper doing all the functionalities before passing the request to the respective micro service. All the functionalities reside at a centralized place and making it easy to maintain and analyze them. When a new service comes up, all it has to do is to process the requests and send the response back to the gateway. API gateway takes care of the rest.
API gateway encapsulates the internal system architecture and provides an API that is tailored to each client. It might have other responsibilities such as authentication, monitoring, load balancing, caching, request shaping, management and static response handling.
API gateway is responsible for request routing, composition and protocol translation. All requests from clients first go through the API gateway. It routes requests to appropriate micro service. It will often handle a request by invoking multiple micro services and aggregating the results. It can translate between web protocols such as HTTP and WebSockets and web unfriendly protocols that are used internally. API gateway can also provide each client with a custom API. It can provide an endpoint (/orderDetails?orderId=xxx) that enables a mobile client to retrieve all the order details with a single request. The API gateway handles the request by invoking the various services, recommendations, reviews and etc;
How I used Authentication and Authorization?
Authentication means who you are and authorization means what you can do. One of the key challenges is how to implement authentication and authorization in micro services so that I could manage security and access control. There are few more ways to implement authentication in micro services. Here I have used token-based approach. E.g. — JSON Web Tokens (JWT). Token based approach works at the application layer. Token is a container caller ID and its permissions. Caller micro service can obtain token service using its own service ID and password and then attaches it to every outgoing requests E.g- via HTTP headers. Proposed system I have used bearer token in the header. It will need to handle the tokens in the same way and it makes to create a package utility that can be shared by each micro service. Payload of JWT was helpful to define the token issuer and expiration of the token.
Why I used Docker?
Docker is the most dominant tool in the container eco system and it is a world leading container as a service platform. Container is way to package software along with binaries and settings required to make the software that runs isolated on sharing an operating system. Proposed system I have deployed using Docker since it brought much more advantages. Those are…
A major benefit of containers is that they offer the possibility of horizontal scaling, meaning you add more identical containers within a cluster to scale out. With smart scaling, where you only run the containers needed in real time, you can reduce your resource costs drastically and accelerate your return on investment.
Individual applications can be scaled out independently without affecting other services.
Container orchestration takes care of better utilization of resources and places the services based on the resources available on the host.
A container is lightweight and it starts and stops in less than a second, as they do not require any operating system boot. That eventually helps us to achieve faster deployment and high availability.
Containers by contrast are much smaller because they do not require the operating system spin up time with associated with a virtual machine. Containers are more efficient at initialization. Overall containers start in seconds. That’s much faster than VMs.
Running microservices on containers helps me to see the true advantage of microservices with lower cost.
A major benefit of containers is their portability. A container wraps up an application with everything it needs to run, like configuration files and dependencies. This enables you to easily and reliably run applications on different environments, such as your local desktop, physical servers, virtual servers, testing, staging, production environments, and public or private clouds. This portability grants organizations a great amount of flexibility, speeds up the development process, and makes it easier to switch to another cloud environment or provider if need be.
Dockerized microservices can run in containers. So, I could deploy those containers to any servers with Docker installed.
Containers running on the same machine using the same resources are isolated from each other. So, if one application crashes, it will not impact the other application.
The engines like Docker provide basic support for defining simple multi-container applications, for example Docker Compose. However, full orchestration involves scheduling of how and when containers should run, cluster management and the provision of extra resources, often across multiple hosts. Container orchestration tools include specific ones — Docker Swarm, Google Kubernetes, etc.
Docker now comes with a special mode —Swarm mode — that you can use to manage clusters of containers. Docker Swarm lets you use the Docker CLI to run swarm commands, so you can easily initialize groups of containers, add, and remove containers from those groups.
To make the Docker containers work together, we must first register each of them in the Docker-compose file as Docker compose coordinates all services.
Docker containers aren’t created out of thin air. They’re instantiated from Docker images, which serve as blueprints for containers and are the second component in the Docker architecture. To run a Docker image, we have to use Dockerfiles as I shown in the below.
Using microservices and containers is considered the proper modern way to build scalable and manageable web applications. If you do not containerize microservices, you will face many difficulties when deploying and managing them. That is why we use Docker: to avoid any troubles when deploying microservices. Add in a Container Orchestration System, and you will be able to handle your Dockerized applications with no limits.
Online Payment Facility
Allowing online payment facility is an important future development which is expected in this system. This function brings out efficiency and accuracy between customer and company.
The main goal of proposed system is to provide an overall solution, which could cover clothing management process such as customer, product, order, supplier chain, delivery management and customer web portal. Objectives of developed system includes efficiency of searching data, delivery without any delays, maintain information accurately and provide online facility. Proposed system brings out fast tracking system to order status and product will be identified through bar code. SMS facility is another task of proposed system it is increased the efficiency internal and external stockholders of the system.