Description of the "Materials management" task
The information system being created using the lsFusion platform must support very basic supply chain execution capabilities.
For simplicity, let's define one type of document in our system that increases the stock balance — a receipt from the supplier; and one type of document that does the opposite — a shipment for a wholesale to a customer.
Defining domain logic
The information system will consist of a set of modules, each implementing a logically isolated piece of functionality. Each module can use the functionality of other modules, which involves special syntax constructions for defining module dependencies.
Based on our task, let's define the list of modules to be implemented: stock module, item module, legal entity module, receipt module, shipment module, current balance module. We will separately define the main module that will be executed and will basically be a compound solution. The composition of modules can be different and is determined by the developer depending on the need to re-use the functionality elsewhere.
Defining a stock
Let's create a module where we will define a stock instance and its attributes.
Defining an item
Let's create a module in which we'll define the concept of an item and its attributes.
Defining a legal entity
Let's create a module where we will define a legal entity instance and its attributes. In the system, legal entities will act as suppliers and customers.
The legalEntityINN property binds an organization and a Tax ID one-to-one and allows to find a legal entity by a Tax ID. The expression of the property can be interpreted as follows: when grouping legal entities by Tax ID (innLegalEntity property), each group must contain a non-repeating legal entity.
Defining a receipt
Let's create a module where we'll define all instances and attributes required for defining the logic of a supplier receipt.
Defining a shipment
Let's create a module where we will define all instances and attributes required for a wholesale shipment.
HTML Include url http://localhost:5000/samphighl?file=mm%2FShipment&original=1&block=priceset
Defining current item balance
The current item balance is defined as a difference between all item receipts and all its shipments.
HTML Include url http://localhost:5000/samphighl?file=mm%2FStockItem&original=1&block=constraint
Defining view logic
In order to be able to work with the created solution, let's add directory forms and a current balances form, and also a set of paired forms for working with documents: a form for listing receipts and a form for editing them, a form for listing shipments and a form for editing them.
The process of creating an information system is completed.
The complete source code (on Github)