Disclosure of Invention
In view of the above, the invention provides a warehouse management modeling method and system based on a domain-driven design, which are used for solving the problems of inconsistent functions and requirements of the warehouse management system, difficult later-stage expansion and the like.
The invention discloses a storage management modeling method based on field-driven design, which is characterized by comprising the following steps:
adopting a field-driven design technology to perform architecture division on the warehouse management system to obtain a presentation layer, an application layer, a field layer and an infrastructure layer;
determining a plurality of domain objects according to the service types, the service flows and the service rules in the warehouse management, and dividing the services of the domain objects to obtain sub domains and service minimum boundaries;
and performing domain modeling on each domain object in the domain layer based on the subdomains of the domain objects to obtain each domain model.
Preferably, the plurality of domain objects determined in the warehousing management system include, but are not limited to, procurement, warehousing, ex-warehouse, inventory.
Preferably, the performing domain modeling on each domain object in the domain layer based on the subdomain and the service minimum boundary of each domain object specifically includes:
extracting commands and events based on the subdomain and the service minimum boundary of the domain object;
identifying a business object based on the command and the event, and finding out an entity generating the event and a value object;
identifying an aggregation root based on the dependency relationship among different entities, and collecting the aggregation root, and the entity and value object associated with the aggregation root together to form aggregation information;
dividing service boundaries based on the aggregation information, and identifying boundary context;
a domain model is established for the domain object based on the boundary context.
Preferably, the identifying the aggregation root based on the dependency relationship between the different entities specifically includes:
whether each entity is an aggregation root is determined from whether there is an independent lifecycle, whether there is a globally unique id, whether other objects can be created and modified.
Preferably, the entity and value objects within the aggregated information are accessed and manipulated through the aggregation root.
Preferably, in the plurality of domain objects of the storage management system, the domain modeling process of the warehousing domain is as follows:
performing business division on the warehousing process to obtain the following business processes:
acquiring a purchase order from a purchasing system, and synchronously creating a warehousing order in a warehousing management system;
the supplier delivers goods according to the purchase order, after the goods arrive at the warehouse, the corresponding warehousing order is searched according to the number of the purchase order, the goods inspection is started after the purchase record is confirmed, and the corresponding quality inspection order is created;
after the quality inspection is finished, printing a warehousing entry, carrying out shelving processing on the goods, recording the actual receiving quantity, and turning the current warehousing entry into the received goods;
extracting commands, events, entities and value objects based on the business process; the business objects comprise but are not limited to warehousing notes and quality control notes, and the commands corresponding to the warehousing notes comprise synchronous acquisition from a purchasing system, warehousing note creation, quality control note creation, warehousing note printing, warehousing confirmation and synchronous inventory; the events corresponding to the warehousing notes comprise that the warehousing notes are created, the quality inspection notes are created, the warehousing notes are printed, warehousing records are created, and the inventory number is synchronously increased; the command corresponding to the quality control bill comprises the steps of obtaining, creating and finishing the quality control bill from the warehousing process, and the corresponding event comprises the steps of creating and finishing the quality control bill;
identifying an aggregation root, and gathering closely associated entities and value objects together to form aggregation information; when the warehousing entry is taken as a polymerization root, the formed polymerization information comprises the warehousing entry, a warehousing entry number, a delivery unit, a supplier code and a service type; the aggregate information formed when the quality control list is taken as the aggregate root comprises the quality control list, the quality control list number, the warehouse code, the quality control date and the quality control state;
identifying a boundary context, wherein the purchase order and the quality inspection order are both boundary contexts of a warehousing process, and the purchasing system belongs to an external system;
and establishing a domain model of the warehousing process based on the boundary context.
In a second aspect of the present invention, a warehouse management modeling system based on a domain-driven design is disclosed, the system comprising:
an architecture partitioning module: adopting a field-driven design technology to perform architecture division on the warehouse management system to obtain a presentation layer, an application layer, a field layer and an infrastructure layer;
a domain division module: determining a plurality of domain objects according to the service types, the service flows and the service rules in the warehouse management, and dividing the services of the domain objects to obtain sub domains and service minimum boundaries;
a domain modeling module: performing domain modeling on each domain object in the domain layer based on the sub domain of each domain object to obtain each domain model;
compared with the prior art, the invention has the following beneficial effects:
the invention subdivides the field of the warehouse management system through the field-driven design idea, distinguishes the boundary context, defines the function of each function, establishes different field models, conveniently divides different functions, does not have unclearly-simulated boundaries, does not cause great change of the service of the whole system due to the change of the service, only needs to simply move and call the field models, has higher flexibility, can provide support for the design of warehouse management micro-service, and can cope with complex and changeable warehouse management processes.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be obtained by a person skilled in the art without any inventive step based on the embodiments of the present invention, are within the scope of the present invention.
The core idea of domain-driven design (DDD for short) is to define a domain model by a domain-driven design method, thereby determining service and application boundaries, ensuring the consistency of the service model and a code model, and solving the problem of software complexity caused by overlarge system scale.
The warehouse management system is constructed through a field-driven design idea, an architect, a development manager, a test manager, a demand worker and a field expert together establish a universal language to understand and digest the field knowledge of the warehouse management system through an event storm, the field, a sub-field, a core field, a universal field and a support field are extracted and divided from the field knowledge, a model is established on the field, and a set of model which accords with the current field is constructed.
Referring to fig. 1, the present invention provides a warehouse management modeling method based on domain-driven design, including:
s1, performing architecture division on the warehouse management system by adopting a field-driven design technology to obtain a presentation layer, an application layer, a field layer and an infrastructure layer;
the presentation layer is used for providing a visual interactive interface for a user;
the application layer is used for coordinating various operation implementation cases;
the domain layer is a core part of the warehousing management system and is used for realizing business logic, namely business data, business operation and business rules;
the infrastructure layer provides basic support for the warehousing management system, such as data persistence, logging, data tracking, caching and the like, and provides basic support services for other layers.
S2, determining a plurality of domain objects according to the service types, the service flows and the service rules in the warehouse management system, and dividing the services of the domain objects to obtain sub domains and service minimum boundaries;
specifically, the plurality of domain objects determined in the warehousing management system include, but are not limited to, purchasing, warehousing, ex-warehousing and inventory checking. And performing field subdivision on each field to obtain a sub-field, and then subdividing the sub-field to obtain small problems which are familiar to architects, development managers, test managers, demanders and field experts, are described by a universal language and can be quickly processed, namely determining the minimum boundary of research.
S3, performing domain modeling on each domain object in the domain layer based on the sub-domain of each domain object to obtain each domain model; the field modeling of each field object specifically comprises the following steps:
s21, carrying out priority ordering on the minimum boundary of the service based on the subdomain of the domain object;
s22, extracting commands, events and entities from the subdomains and the minimum business boundaries of the domain objects based on the sequence of the priorities from high to low;
s23, identifying the business object based on the command and the event, and finding out the entity and the value object generating the event;
it is mainly to find the subject object of the event, such as object XX in "XX already YY". The entity has uniqueness, such as purchasing a warehousing order, and has a unique order id; the value object also has multiple attributes, but it is not unique and is essentially a set, such as an address value object, containing multiple attributes of province, city, district, street.
S24, identifying a cluster root based on the dependency relationship among different entities, and gathering the cluster root, the entity associated with the cluster root and a value object to form aggregate information;
whether each entity is an aggregation root can be judged specifically from whether an independent life cycle exists, whether a globally unique id exists globally, and whether other objects can be created and modified. Entities and value objects in the aggregation information can be accessed and operated through the aggregation root.
S25, dividing service boundaries based on the aggregation information, and identifying boundary context;
and S26, establishing a domain model for the domain object based on the boundary context.
The present invention continues to divide the domain of warehouse management systems until it is divided into well known, rapidly processable minor problems (minimum business boundaries). And then, carrying out priority arrangement on the small problem processing, identifying an aggregation root according to a priority order, aggregating closely associated entities and value objects based on the aggregation root, determining a boundary context, and establishing a domain model according to the boundary context. Different functions can be conveniently divided, vague boundaries can not appear, the change of the service can not lead to larger change of the service of the whole system, and the field only needs to be simply moved and called, thereby providing support for the design of the micro-service.
Referring to fig. 2, fig. 2 is a schematic diagram of a domain model according to the present invention, which is constructed by aggregating tightly associated entities and value objects based on a root cluster, and then determining a boundary context.
The field modeling process is described below by taking the warehousing process in the storage management system as an example, at this time, the warehousing process is a core domain, the others are a general domain and a support domain, and the field modeling process of the warehousing process is as follows:
1) performing business division on the warehousing process to obtain the following business processes:
acquiring a warehousing note synchronously created after approval of the purchase note from a purchasing system;
the supplier delivers goods according to the purchase order, after the goods arrive at the warehouse, the corresponding warehousing order is searched according to the number of the purchase order, the goods inspection is started after the purchase record is confirmed, and the corresponding quality inspection order is created;
after the quality inspection is finished, printing a warehousing entry, carrying out shelving processing on the goods, recording the actual receiving quantity, and turning the current warehousing entry into the received goods;
2) extracting a command, an event, a business object entity and a value object based on the business process, wherein the command, the event, the business object entity and the value object can be extracted by adopting text analysis, event storm and other modes;
referring to fig. 3, the business objects include, but are not limited to, a warehousing entry and a quality inspection ticket, and the commands corresponding to the warehousing entry include synchronous acquisition from a purchasing system, warehousing entry creation, quality inspection ticket creation, warehousing entry printing, warehousing confirmation, and synchronous inventory; the events corresponding to the warehousing notes comprise that the warehousing notes are created, the quality inspection notes are created, the warehousing notes are printed, warehousing records are created, and the inventory number is synchronously increased; the command corresponding to the quality control bill comprises the steps of obtaining, creating and finishing the quality control bill from the warehousing process, and the corresponding event comprises the steps of creating and finishing the quality control bill;
3) identifying an aggregation root, and gathering closely associated entities and value objects together to form aggregation information;
referring to fig. 4, the aggregation information formed when the warehousing entry is used as the aggregation root includes the warehousing entry, the warehousing entry number, the arrival unit, the supplier code, and the service type; the aggregate information formed when the quality control list is taken as the aggregate root comprises the quality control list, the quality control list number, the warehouse code, the quality control date and the quality control state;
4) identifying a boundary context based on the aggregation information, referring to fig. 4, wherein the purchase order and the quality inspection order are both boundary contexts of a warehousing process, and the purchasing system belongs to an external system;
5) and establishing a domain model of the warehousing process based on the boundary context. Other domain models of warehouse management systems, such as procurement, ex-warehouse, inventory count, etc., may be created in the manner described above. Based on the incidence relation among different field models, a complete warehouse management system model can be obtained.
Corresponding to the embodiment of the method, the invention also provides a warehouse management modeling system based on the field-driven design, which comprises:
an architecture partitioning module: adopting a field-driven design technology to perform architecture division on the warehouse management system to obtain a presentation layer, an application layer, a field layer and an infrastructure layer;
a domain division module: determining a plurality of domain objects according to the service types, the service flows and the service rules in the warehousing management system, and dividing the services of the domain objects to obtain sub domains and service minimum boundaries;
a domain modeling module: performing domain modeling on each domain object in the domain layer based on the sub domain of each domain object to obtain each domain model; the domain modeling module is specifically configured to:
carrying out priority sequencing on the minimum boundary of the services; extracting commands, events and entities from subdomains and service minimum boundaries of the domain objects on the basis of the sequence of the priorities from high to low; identifying a business object based on the command and the event, and finding out an entity generating the event and a value object; identifying an aggregation root based on the dependency relationship among different entities, and collecting the aggregation root, and the entity and value object associated with the aggregation root together to form aggregation information; dividing service boundaries based on the aggregation information, and identifying boundary context; a domain model is established for the domain object based on the boundary context.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like that fall within the spirit and principle of the present invention are intended to be included therein.