A Step by Step Guide to Replication

Overview

This page is based on the attempt to make sense of ADempiere Replication module of the author. It will be illustrated as a step by step guide for the reader to have the FEEL of how to setup a simple Replication case between a SOURCE and the TARGET machine.

Note: This guide is based on Adempeire 360LTS and GardenWorld

Message Queue

ADempiere use Message Queue (JMS – Java Message Service Protocol) to integrate between systems. Using message queue has many advantages comparing to direct integration at database layer or WebService call. In short, new data from SOURCE machine will be sent to the Message Queue Server in XML format and reside there waiting for the TARGET machine to pick up. This is a more loosely couple way of integration that can guarantee data delivery regardless of the TARGET machine status during the time of delivery. And by using Message Queue Server and XML as medium, integration between different system become more simple.

Mode of Delivery

To be a little bit more specific, JMS support 2 main modes of delivery

  1. Queue: This mode is good for point to point, where there is only 1 target machine. SOURCE send message to a specified queue. TARGET receive message from that queue (and dequeue message), whenever it become available. In other word, TARGET machine can be shutdown during the time of message delivery and will receive message again once it is back online.
  2. Topic: This mode is good for multi cast, where there are multiple target machine receiving the same message. Think about when we subscribe to a magazine (topic). In this approach, TARGET machines must first subscribe to a Topic. Once SOURCE send a message to that Topic, it will be boardcast to all the TARGETs. Note that, the TARGET machine must be Listening during the message sending, otherwise it miss that message.

Note: More on message queue topologies here. The example in this example is based on Topic (Publish and Subscribe) delivery mode.

Message Protocol

ActiveMQ support a 2 well know protocol out of the box.

  1. Openwire: Or TCP protocol. It is fast, flexible but at the same time more complicated. As you shall see, this is the default protocol for ADempiere.
  2. Stomp: A simple, text based protocol. As it is simple, stomp support more platform, including scripting language like Ruby, Perl, Python or PHP. It is also possible that message delivered by TCP will be received by Stomp.
We won’t discuss them in detail here. But before we move on, it is good idea to gain more understanding about ActiveMQ
Image:Note.gif Note:While there are many implementation of JMS Message Queue Server out there in the market, ADempeire is adoption Apache ActiveMQ. Apache ActiveMQ is the most popular and powerful open source messaging and Integration Patterns provider. It is fast, supports many Cross Language Clients and Protocols, comes with easy to use Enterprise Integration Patterns and many advanced features while fully supporting JMS 1.1 and J2EE 1.4. Apache ActiveMQ is released under the Apache 2.0 License

Step by Step Replication Setup in ADempiere

In this simple example, we want to replicate Product Data from SOURCE to TARGET through an ActiveMQ broker. There are 2 side of setting up, which are quite saperated in the context. 1) The setup for SOURCE machine to publish product data to ActiveMQ broker, when change is made. And 2) The setup for TARGET’s Application Server to activate its importing process in order to receive incoming message and save back to its Product table.

As simple as that.

Step 1: Prepare Environment

  1. Prepare 2 ADempiere 360LTS Environment, we will call it SOURCE and TARGET (we won’t discuss how to install Adempeire here).
  2. Install ActiveMQ Server (See Getting Start Guide)
    • Download Binary Distribution, apache-activemq-5.5.0-bin.zip from [1]
    • Unzip and place the folder to C:/apache-activemq-5.5.0-bin
    • That’s all for installation, now start ActiveMQ server by running C:/apache-activemq-5.5.0-bin/bin/activemq.bat
    • ActiveMQ Server is now ready to accept and distribute message!

replicate_1

Image:Note.gif Note:From the console, you will see that ActiveMQ

  • Listening for connections at: tcp://localhost:61616 (tcp / openwire connector).
  • Admin Console is at http://localhost:8161/admin. Here, we can view / manage, connection, queue, topic and etc.
  • Web demo is at http://localhost:8161/demo. A good place to start off understanding ActiveMQ. And also, please check out examples code at C:/apache-activemq-5.5.0-bin/example

Login to ADempiere as GardenWorld admin, open Replication Module, and you will see windows for Export and Import Settings as following picture.

replicate_2

Step 2: Setup Export Processor (on SOURCE machine)

As mentioned earlier, the message will be sent in XML format (i.e., when a new product item is created). Beside writing your own code to generate XML file of product data and put it on the queue, ADempeire Replication Module provides windows / process to help you do just that.

Configurations for Export
  • Replication Strategy: Define what (table/document) and how data (boardcast/reference/local/merge) will be exported by which Export Processor.
  • Export Processor: Define where (i.e., host/port) and how (connection parameters) ADempiere will connect to the ActiveMQ server using which Export Process Type.
  • Export Processor Type: Define the java class that do the real connection and message delivery to ActiveMQ server. This is where the action take place. Out of the package, ADempeire only provide the connection class for Topic delivery mode, org.adempiere.process.rpl.exp.TopicExportProcessor. (once you understand more about how ActiveMQ works, you can write your own class).
  • Export Format: Define what data columns of the tables (from Replication Strategy window) will be exported. ADempeire use information here to generate XML file for export. Note that, the same Export Format must be defined in TARGET as well, ADempiere will use the same Export Format to convert from XML data back to raw data and save to the system.
  • Client’s Model Validator: Set the Export Model Validator and Replication Strategy. This is required only for SOURCE machine, as to trigger Export Process when change is made to the specified data table.

Step 2.1 Define Replication Strategy

A SOURCE can have only one working Replication Strategy (to be defined in Client window), but can have multiple table and document to replicate. In this sample, we want to export only one data, Product.

  • Open Replication Strategy window
  • Create new Replication Strategy record
    • Search Key: MyReplicationStrategy
    • Name: My Replication Strategy
    • Entity Type: User maintained
    • Export Processor: Human Readable name for – JMS Topic Export Processor
  • Create new Replication Table record
    • Replication Strategy: My Replication Strategy
    • Table: M_Product
    • Replication Type: Merge (use merge as it seems to work most here)
    • Entity Type: User maintained
Image:Note.gif Note:Replication Type define the behavior of exporting data (**this is from what I understand from the code, not guarantee on what developer intend**)

  • Broadcast: Repeating sending message to ActiveMQ
  • Local: Do not export, just keep it at SOURCE
  • Merge: Do full merge, create / update / delete
  • Reference: Only update TARGET if data exists at

Step 2.2 Define Export Processor

From previous step, we already define the Export Processor as Human Readable name for – JMS Topic Export Processor. Let’s go through its configuration.

  • Open Export Processor window
  • On Export Process tab, select record as Human Readable name for – JMS Topic Export Processor
    • Search Key: JMS Topic Export Processor
    • Name: Human Readable name for – JMS Topic Export Processor
    • Export Processor Type: Human Readable name for – JMS Topic Export Processor Type
    • Host: localhost (host machine for ActiveMQ)
    • Port: 61616 (default port for tcp)
    • Account: system
    • Password Info: manager

Note: We do not touch on security of ActiveMQ yet, let’s use the default Account/Password for ActiveMQ Server now. More information please see ActiveMQ Security.

  • On Export Processor Parameter Tab, define parameters as following,
    • topicName: MyTopic (this can be any specific topic name)
    • clientID: SourceClient (this can be any client name to be used when connect to ActiveMQ)
    • protocol: tcp
    • timeToLive: 10000 (time before message expire in milliseconds)
    • isDeliveryModePersistent: true (default)

Step 2.3 Define Export Processor Type

From previous step, we already define the Export Processor as Human Readable name for – JMS Topic Export Processor Type. Let’s go through its configuration.

  • Open Export Processor Type window
  • On Export Process Type tab, select record as Human Readable name for – JMS Topic Export Processor Type
    • Java Class: org.adempiere.process.rpl.exp.TopicExportProcessor
Image:Note.gif Note:

  • Out of the package only Topic delivery mode is provided, if you want to use Queue delivery mode, you need to create your own Java Class.
  • HDD Export Process Type (org.adempiere.process.rpl.exp.HDDExportProcessor) is nothing to do with ActiveMQ, it simply export XML into a file server. It is another method of integration without using Message Queue, and as such, we won’t discuss here.

Step 2.4 Define Export Format

Export Format is a crucial part for the replication to work. It tell ADempiere what columns in the specified table will be used to create XML. It use to export as well as to import. As such, the Export Format on SOURCE and TARGET machine must be equal. In this case, we want to export M_Product, which is not listed here yet.

You can create Export Format manually or use the Export Format Generator process.

  • On the SOURCE machine, run Export Format Generator process
    • Window: Product
    • Include only the Tabs that insert records: Checked
    • Include only mandatory columns: UnChecked

Note: During the time of writing, I found a bug which I track it here [2]. Without applying the patch to your system, you can’t run this process. You may test with other table, i.e., C_Bpartner.

  • On the TARGET machine, we will do the same, run Export Format Generator process for Product Export Formats.
  • On both machine, open Export Format window and select M_Product record.
  • Please note that by default only Name and Value is active. In real life, it depend on what column you want to replicate. For our case, select all columns.

replicate_3

 

Image:Note.gif Note:Format Line’s Type

  • XML Element: Normal element, store raw data.
  • Referenced EXP Format: ID column will be referenced with the Name field of its reference table.
  • Embedded EXP Format: Use for Document with Document Lines, ie., C_Order have a column Order Line which reference to C_OrderLine Export Format

Step 2.5 Define Client’s Model Validator

  • Open Client window
    • Add Export Model Validation Classes: org.adempiere.model.ExportModelValidator
    • Set Replication Strategy: My Replication Strategy
That’s all for setup on SOURCE machine.

Step 3: Setup Import Processor (on TARGET machine)

Step 3.1 Define Export Format

We want to make sure that the SOURCE and TARGET machine have the same set of Export Format, in this case for Product data. If not done yet, repeat step 2.4, this time for TARGET machine.

Step 3.2 Define Import Processor

Import Processor is the process that will be run as scheduled job by Application Server. Its duty is to Listen to the specified topic on ActiveMQ server.

  • Open Import Processor window
  • On Import Process tab, select record – Human Readable name for – JMS Topic Import Processor
    • Activate this record.
    • Frequency: 1 Minutes (for testing purposes)
    • Host: localhost (host machine for ActiveMQ)
    • Port: 61616 (default port for tcp)
    • Account: system
    • Password Info: manager
  • On Import Processor Parameter Tab, define parameters as following,
    • topicName: MyTopic (same as Export Processor)
    • clientID: TargetClient
    • protocol: tcp
    • isDurableSubscription: true
    • subscriptionName: MySubscription

Step 3.3 Define Import Processor Type

From previous step, we already define the Export Processor as Human Readable name for – JMS Topic Import Processor Type. Let’s go through its configuration.

  • Open Import Processor Type window
  • On Export Process Type tab, select record as Human Readable name for – JMS Topic Export Processor Type
    • Java Class: org.adempiere.server.rpl.imp.TopicImportProcessor
Image:Note.gif Note:

  • Out of the package only Topic delivery mode is provided, if you want to use Queue delivery mode, you need to create your own Java Class.
  • HDD Import Process Type (org.adempiere.server.rpl.imp.FileImportProcessor) is nothing to do with ActiveMQ, it simply get XML from file server. It is another method of integration without using Message Queue, and as such, we won’t discuss here.

Step 4: Validate Export & Import XML File

One of the frequent problem that the replication is not through is about incorrect formatting. ADempeire provide a process to help us validate that the SOURCE and TARGET machine have compatible format.

  • On SOURCE machine, Run Process Test Export Model.
    • Export Format: Product
    • File: D:\Product_Format.xml
    • Click Start to test
  • On SOURCE machine, Run Process Test Import Model.
    • Export Format: Product
    • File: D:\Product_Format.xml
    • Click Start to test

No error message shown, we are ready to start replication!!!

Step 5: Test Replication

  • Run ActiveMQ server
    • If ActiveMQ server is not started, start it and go to URL http://localhost:8161/admin
    • Click on Topic link, now you will see that there is no topic MyTopic on the list.

replicate_4

  • Start Adempiere Application Server (make sure that it is run for the TARGET machine/database)
    • Open ADempiere Web Admin http://localhost/admin and click on ADempiere Server Management
    • Now, you should see the new Import Process running

replicate_5

Now we can start testing replication
  • On SOURCE machine, create new Product record.
    • Search Key: MyTestProduct
    • Name: My Test Product
    • UOM: Kilogram

Note: The default UOM Each is not usable as it is created by System. For the Product data to be replicated, all reference field data must be client data (GardenWorld)

  • Click Save to create new record, the Product data is now published to the ActiveMQ as you can see MyTopic is now listed in topic page.

replicate_6

  • Wait for a while, and the Product should be replicated to TARGET machine. You can open and review the new Product item in TARGET machine.
  • If there is any error, you can see from ADempiere’s Application Server Console.
  • To see the log on TARGET machine, open Import Processor | Log window

Remarks / Issues / Concern

All in all, from my experiment, the module is working as it should. But it is not false tollerance, everything have to be set correctlly for it to function. Looking through source code is a required steps to understand it.

Problem – Message not get delivered
  • Make sure that the Application Server is Listening to the Topic, before the message is sent. Remember, this is Topic (Publish and Subscribe) mode.
  • Data is very sensitive. Make sure that all the required fields are exported, otherwise, it can create Null Error when create new record at TARGET.
  • All data must be as of the same client, i.e., Product’s UOM form the SOURCE is using System’s UOM, i.e., “Each”, when reach TARGET, “Each” is not allowed, as it is no Client’s data. Make sure that any reference data is of the same client.
  • Whenever you change the Export Format at TARGET, always restart the Import Process Job.
  • (Seem to me that) Both Name and Value are used as reference when things get updated. As such, both field can not change, otherwise, it can’t find the TARGET record for update.
How to debug Server’s Import Process
  • Add main function in org.compiere.server.ReplicationProcessor.java and run it from Eclipse
    • Running it from eclipse equal to run by Application Server, as such it will be listening to the event.
    • Note that 1000000 below is the Process ID. This ID will be replaced by the ID of the Import Process you want to debug.
	/***************************************************************************
	 * 	Test
	 *	@param args ignored
	 */
	public static void main (String[] args)
	{
		Adempiere.startup(true);
		MIMPProcessor model = new MIMPProcessor (Env.getCtx(), 1000000, "1001");
		ReplicationProcessor rp = new ReplicationProcessor(model);
		rp.start();
	}
Miscellaneous Findings
  • How Export Format is selected to use when there is more than 1 Export Format for a table?
    • Created before –> Active Status –> Later version of Export Format will be used???
  • What happen with the message that got error during import on TARGET machine? How to re-import?

See Also

ADempiere – Thai Withholding Tax

Overview

Purpose

When an organisation render services from vendor or provide services to customer, there will be withholding tax payable or withholding tax receivable occur in business process. The tax will be withhold from the full amount of service price to pay to government at the end of month in case of Tax Payable and at end of year in case of Tax Receivable.

This enhancement is made as the extension to the existing withholding tax functionality by Colombia Localisation Withholding Tax to EXTEND the need about Partial Withholding [1] [2], as well as create a few reports for tax filings (Thai) in order to answer the Withholding Tax needs in Thailand.

Although this is done based on Thailand’s requirement first, our attempt is to make it as universal as possible, and is very welcoming the suggestions and similar business need elsewhere.

Scope

To extend the functionality for Partial Withholding during payment process (Calc on Payment). Each withholding tax line will be created for each Invoice Line incurring withholding tax. User will have ability, upon payment process to,

  1. Adjust how much he/she want to pay for the selected invoice, which will also partial the Withholding Tax to hold.
  2. Adjust Withholding Tax Rate or Tax Base Amount of each Withholding Tax line

Out of Scope

  • Although user can control the payment of withholding tax line by line (via the use of new table LCO_PaymentWithholding), the Normal Tax (VAT) will be calculated in proportion of the amount being paid as of the existing functionality.
  • This feature is not yet included in Payment Allocation form. Although the form it will be functioning as it was without withholding, it is highly recommend to disable that window when withholding tax is involved.

References

Design Considerations

  • Utilize existing features available in Colombian Withholding Tax (LCO), i.e., the setups of withholding types, categories, etc.
  • Develop as extension (on top of) Colombian Withholding Tax (LCO) to extend partial withholding
  • Ability to deploy as package on top of ADempiere 360lts + LCO
  • Make it a generic feature to be used internationally, while answering the need of Withholding Tax in Thailand

Functional Requirements

General information for Thai Tax

This section will refer to 2 majority taxation, VAT and Withholding tax.

  • VAT (Value Added Tax), it is tax added on purchasing and selling transactions which the current rate in Thailand is 7%.
  • WHT (Withholding Tax), it is a tax which is deducted from service expense or income at the point of settlement. In other words, the organisation has to withhold tax when making a payment to vendor for service charge; conversely, the organisation will be withheld tax when receiving service income from customer as well.

There are two methods for WHT calculation, Fixed rate (Percentage) and Progressive rate. However, most of WHT in Thai business is a Fixed rate; thus, for information, this section will refer to this type only.

Thai WHT category and Fixed rate (for general usage):

Insurance premium: 1%

Transportation: 1%

Bank Interest: 1%

Advertisement: 2%

Service: 3%

Liberal Profession: 3%

Commission: 3%

Rent: 5%

Prize/Award from competition: 5%

Public actor/actress: 5%

There are two majority of payment method in Thai business, Full payment (A) and Partial payment (B), therefore, following are cases required for Thai WHT will be described in both methods of payment

Business Cases

Following are business cases that, at least, this extension must cover.

Case 1: General

Case 1A: Invoice – One line, one charge => Full payment
Case 1B: Invoice – One line, one charge => Partial payment

Case 2: Telephone Rent (5%) and service (3%)

Case 2A: Invoice – Two lines, one charge, different WHT Rate => Full payment
Case 2B: Invoice – Two lines, one charge, different WHT Rate => Partial payment

Case 3: Expense allocation for internal management purpose, Guard service (3%)

Case 3A: Invoice – Two lines, one charge, same WHT Rate => Full payment
Case 3B: Invoice – Two lines, one charge, same WHT Rate => Partial payment

Case 4: Vendor provide service (3%) and advertisement (2%)

Case 4A: Invoice – Two lines, two charges, different WHT Rate => Full payment
Case 4B: Invoice – Two lines, two charges, different WHT Rate => Partial payment

Case 5: Vendor provide service for Transportation (1%) and Insurance (1%)

Case 5A: Invoice – Two lines, two charges, same WHT Rate => Full payment
Case 5B: Invoice – Two lines, two charges, same WHT Rate => Partial payment

Note: If vendor provides services are VAT and Non-VAT, they usually separate Tax invoice for each type. That will not be an issue for AD.

Backward Compatibility

To consider this extension completed, following cases must be covered are fully tested.

  • AP Payment & AR Receipt
  • Calculate WHT on invoice process & Calculate WHT on payment process
  • Payment by Cash with WHT (Cash Journal)
  • Work with normal VAT
  • Cases with Landed Cost
  • Cases with Void and Reverse Payment
  • Multi Currency

How it works?

Sample Business Case

The company create a new Invoice (Vendor) to pay for services to a vendor.

  1. Service Fee = $1000, Tax (VAT) 7% = $70, WHT 3% = $30 ==> Total $1070, Withhold $30
  2. Transportation Fee = $1000, No-VAT, WHT 1% = $10 ==> Total $1000, Withhold $10
Total Base Amount = $2000, Total Tax (VAT) = $70, Total WHT = $40
Total Invoice Amount = Base Amount + Tax = $2070

Setup Withholding Rules for a Charge (Sample)

Firstly, for the Withholding Tax to be generated for the specified product or service (charge), a rule must be defined for it. In this case, we need to have rule that calculate WHT for Service and Transportation.

Based on Withholding Tax from Colombian Localisation (LCO), we need to set the followings.

ad_wht_1

The above picture explain that this Withholding Category is for Service and the WHT is 3%. In Charge window, specify Service Charge to this Withholding Category.

ad_wht_2

Generate Withholding

Open Invoice (Vendor) and do the following steps
  • Create an Invoice (Vendor) with 2 line items, select charge for 1) Service and 2) Transportation.

ad_wht_3 ad_wht_4

  • On Payment tab, click on Generate Withholding button
  • Note: Make sure that for AP Invoice document type, the Generate Withholding field is marked as “Y”, and that user’s role have access to the Generate Withholding’s Process.

ad_wht_5

  • On Withholding tab, review Invoice Withholding Lines

ad_wht_6

  • Complete and Post this invoice. And since we have setup in Withholding Rules to Calculate on Payment, posting account will not take WHT in to account yet.

ad_wht_7

  • Next we want to do the payment partially for this invoice.

1st Payment – partial WHT by partial invoice pay amount

Open Payment window and create new AP Payment document.
  • On Payment Allocate Tab, select the invoice, save it and note on the following.
    • Invoice Amount is the base amount include Tax (VAT) = $2070
    • Withholding Amount = $40
    • Amount is the amount to pay = Invoice Amount – Withholding Amount = $2030
    • Tax Amount = $70
    • If pay everything in full, Over/Under Payment = $0.00

ad_wht_8

  • In this case, we only want to pay 50% of the invoice amount
    • Set Over/Under Payment = $1035
    • Withholding Amount is adjusted to the 50% proportion or = $20. This adjustment will be delegate to each Payment Withholding line we will see next.
    • Tax Amount = $35

ad_wht_9

  • On Payment’s Withholding tab, on Withholding Tax for Service you can note that
    • Tax Base Amount is adjusted to the 50% proportion or = $500
    • Withholding Tax Amount is adjusted (from $30) or = $15
  • The same apply to Withholding Tax for Transportation

ad_wht_10

  • On Payment tab, view the summary of this payment.

ad_wht_11

  • Complete this document (generate allocations) and post accounting for this payment

ad_wht_12

  • Open View Allocations window, post accounting for this allocation.

ad_wht_13

2nd Payment – partial by partial tax base amount of payment withholding

Another requirement is to pay partially by changing Tax Rate or Withholding Tax Base Amount from Payment Withholding line itself.

Open Payment window and create new AP Payment document, we want to pay another portion of the same invoice.
  • On Payment Allocate Tab, select the same invoice, save it and note on the following.
    • Invoice Amount is the remaining base amount + Tax (VAT) = $1035
    • Remaining Withholding Amount = $20
    • Amount is the amount to pay = Invoice Amount – Withholding Amount = $1015
    • Tax Amount = $35
    • If pay everything in full, Over/Under Payment = $0.00

ad_wht_14

  • We want to pay withholding tax of service only 50%.
    • Open Payment’s Withholding tab.
    • Initially, Service’s Tax Base Amount of = $500 and Withholding Tax = $15 & Transportation’s Tax Base Amount = $500 and Withholding Tax = $5.
    • Adjust Service’s Tax Base Amount = $250, Withholding Tax = $7.5. Click Save. The adjustment here also make a partial payment.

ad_wht_15

  • Back to Payment Allocate tab, you will see that the reduced Tax Base Amount adjust the payment of this invoice.
    • Remaining Withholding Amount = 7.5 + 5 = $12.50
    • Tax Amount = 3.5% (Avg Tax Rate) X Base Amount = 0.035 X 750 = $26.25
    • Over/Under Payment = Reduced Tax Base Amount + Reduced Tax Amt = 250 + (35 – 26.25) = $258.75
    • Amount to pay = Invoice Amount – Withholding Amount – Over/Under Payment = 1,035 – 12.5 – 258.75 = $763.75

ad_wht_16

  • On Payment tab, view the summary of this payment.

ad_wht_17

  • Complete this document (generate allocations) and post accounting for this payment

ad_wht_18

  • Open View Allocations window, post accounting for this allocation.

ad_wht_19

A Step by Step Guide to Libero Manufacturing

Overview

This page is based on the attempt to make sense of ADempiere Libero Manufacturing module of the author. It will be illustrated as a step by step guide for the reader to have the FEEL of what Libero Manufacturing can do and how to do it. All the cases here, I am referring to the Libero Manufacturing Work Shop conducted by Victor Perez some time back in 2009.

As such, this is by no mean the as the reference manual of Manufacturing Management in ADempiere and you can always find more reference from the original source in LIBERO

Note: All cases are based on initial data in Adempiere360LTS database.

Briefing about Manufacturing Process

Libero Manufacturing Process is the mean of producing new Product based on specified Bill of Material (BOM & Formula), Manufacturing Resources, Workflows (how to produce) and Distribution (where to deliver).

1) First, we have to tell the system on how to produce products.
  • On how the product will be produced, Bill of Material tell us what material to use, Workflow Process tell us how to do with what Resources.
  • Product Planning Data is where the relationship between Product and all (BOM, Process, Resources) is defined together with Setup Data, i.e., Order Policy, Order Period, Minimum Order Quantity, etc.
2) After the relationship of How to produce a product is defined we can start producing things.
  • Without planning (pre-order), we can directly use Manufacturing Order to produce things (of course with the above information). We then use the Component Check Process to verify and use Print and Release Order process to print out checklist for user on the field. Once completed, store can use Order Receipt & Issue to accept the newly created products into warehouse (and of course, reduce the inventory of raw material).
  • With demand forecast or pre-order, we can then use MRP to help us determine what when where and how (much) to produce.

Business Case: Chemical Industry (Process Production)

The Management of Garden World evaluated the possibility of getting a profitable increase by manufacturing the fertilizer and took a decision to open a new manufacturing plant to produce the fertilizer which previously Garden World only purchased and sold.

So the engineering department designs two bills of materials to produce the Fertilizer in 50 and 70 kg packages and also a formula used for gross production of the fertilizer. The Lawn Fertilizer uses following raw materials:

  • Phosphorus 17%
  • Nitrogen 17%
  • Potassium 17%
  • Water 49%
OK, Let’s start with Libero Manufacturing!

Step 1: Define BOM

Bill of Materials & Formula

  • Prepare BOM for Fertilizer_Lawn Fertilizer, which has the formula in % as above
  • Prepare BOM for Fertilizer#50 and Fertilizer#70, of which components are Fertilizer and Bag
  • See the summary of prepared BOM in BOM & Formula Info

manu_1

Step 2: Define Manufacturing Workflow and Resources used in Production Process

Manufacturing Resource

  • Define Plant (with Manufacturing Resource Type = Plant) that govern the entire production process.
    • Fertilizer Plant with Planning Horizon = 120
  • Defines Resources’ (with Manufacturing Resource Type = Work Center) that will be used in Production Process (Manufacturing Workflow).
    • Mixed Area
    • Inspection Area
    • Packing Production Line

manu_2

Manufacturing Workflow

  • Define Manufacturing Workflow process to produce the fertilizer products
    1. Lawn Fertilizer
    2. Lawn Fertilizer Packing

manu_3 manu_4

  • Define Workflow Activities and Resources

manu_5 manu_6

Step 3: Generate Demand for Manufacturing

Theoretically there are 2 kinds of demand, Independent and Dependent Demand.

The MRP system takes in a number of parameters as inputs and performs some level of analysis and generates recommendations that can either be accepted or rejected by the planner. One of the inputs of MRP is the BOM, which is a list of all components (and in what quantity) needed to produce finished good(s). For example, the bill of material needed to produce a dinning set is 6 chairs and 1 table (supposedly). The demand for the dinning set here is independent while that for the chairs and table are dependent.

An independent demand is a demand that is not based on the demand for another item while a dependent demand is based on the demand for another item. Hence, it can be concluded that the demand for the 6 chairs and the table is based on the demand for dinning set. Thus, you can forecast an independent demand while dependent demands are calculated based on the independent demand item. The role of the MRP therefore is to perform this calculation.

And so, now, we will be creating 2 Independent Demands.

Sales Order

  • Create and complete 2 Sales Orders
    • Sales Order #1> Org: Fertilizer | DocType: Standard Order | Date Promised: <same date next month> | BPartner: Seed Farm | Delivery Rule: Available
      • Sales Order Line> Product: Fertilizer#70 | Quantity: 70 | Price: 33 | Tax: Standard
    • Sales Order #2> Org: Fertilizer | DocType: Standard Order | Date Promised: <same date next month> | BPartner: Seed Farm | Delivery Rule: Available
      • Sales Order Line> Product: Fertilizer#50 | Quantity: 60 | Price: 20 | Tax: Standard

Forecast

ADempiere do not provide sophisticated Forecasting module but rather providing Forecasting Data Input window. The calculation need to be done elsewhere using 3rd party software. I.e., Lokad business forecasting

  • Define Forecast Data for manufacturing of fertilizer
Sales Representative Warehouse Product Quantity Date Promised
SuperUser Fertilizer Fertilizer#70 10 12/03/10
GardenAdmin Fertilizer Fertilizer#50 22 12/03/10
SuperUser Fertilizer Fertilizer#70 11 12/10/10
GardenAdmin Fertilizer Fertilizer#50 21 12/10/10
SuperUser Fertilizer Fertilizer#70 11 12/17/09
GardenAdmin Fertilizer Fertilizer#50 21 12/17/10
SuperUser Fertilizer Fertilizer#70 11 12/24/10
GardenAdmin Fertilizer Fertilizer#50 20 12/24/10
SuperUser Fertilizer Fertilizer#70 10 12/31/10
GardenAdmin Fertilizer Fertilizer#50 20 12/31/10
  • View the total amount of Forecast by Forecast Report

manu_7

MRP Info

  • View Material Resource Planning by MRP Info
  • Note that we are focusing on Fertilizer only. The view will display both demand from Sales Orders (1) and from Forecast (2).
  • In this view you can look at both demands as gross requirement and an On-Hand project quantity that indicates the availability of material in the future. If this is negative then the system shall generate a production plan for us to know what materials to produce in our plant.

manu_8

Product Data Planning

  • And before we run the Calculate Material Plan, we will check out the Product Planning Data.
  • Product Planning Data is the master data that manages the relationships between Products and BOMs with their Manufacturing Resources, Manufacturing Processes (Workflow) and Distribution. It also stores the initial data about manufacturing process of each product, such as, Order Policy, Order Period, Batch Quantity, etc.

manu_9

Now that we have the independent Demand and Planning data, we shall calculate the Material Plan to issue the manufacturing orders.

Image:Note.gif Note:Use Create Product Planning process to create this data. Running this process helps to create or update data in batch or bulk.Following are the meaning of other parameters,

  • Is MPS: ???
  • Create Plan: If checked, indicates that MRP must create Planned orders for this Product-organization-warehouse. If not checked, then you need to use the Replenishment tab in the product window and control the inventory level using the Replenish Report.
  • Required Calculate MRP: This means it has been a change in some element which affect the MRP Calculation for this product, i.e BOM, Orders, Inventory, MPS, etc. and therefore you need to recalculate the MRP to adjust the Planned Orders to the new conditions and to get the updated action messages.
  • Time Fence: The number of days since you execute the MRP process inside of which the system must not change the planned orders.
  • Order Policy: ???
  • Order Period: ???
  • Batch Quantity: ???
  • Yield %: ???

Step 4: Calculate MRP

Calculate Material Plan

  • Supply parameters and run the process

manu_10 manu_11

Image:Note.gif Note:

  • What Calculate Material Plan process is doing can be found here at Calculate MRP logics
  • Following are the meaning of other parameters
    • Required calculated DRP ???

When this process ends it shows that Manufacturing Orders or Material Requisitions and Notice Messages that were generated. Repeating MRP Info we can see how MRP create the Planned Orders and material requisitions.

manu_12

  • MRP will summarize the demand from both Sales Order and Forecast and use the behavior of the Product (i.e., Is Sales or Is Purchase, etc.), Product Data Plan (i.e., Min Order Qty, Promised Delivery Time, Order Pack Qty, etc.), Bill of Material and Workflow Process, to determine the next action.
    • To produce packaged Fertilizer#70 & Fertilizer#50 the Fertilizer itself must be enough first, MRP generate Manufacturing Orders (1) for Fertilizer first.
      • And as the Minimum Order Qty of Fertilizer is 1000 and the Order Pack Qty is 200, MRP generate 2 Manufacturing Orders, 7,200 and 7,000 respectively.
    • For Fertilizer#70 (sales only)
      • Since this product must be manufactured, MRP generate Manufacturing Orders (1) for it.
      • And because the Minimum Order Qty is 100, MRP make it 100 for each order.
    • For Fertilizer#50 (purchase and sales)
      • Since this product is trading item, it won’t be produced in-house but rather purchase from vendor, MRP generate Material Requisition (2) for them.
    • Please make note also on the Date Start Scheduled of Orders, MRP will be based on Just-in-Time concept, making sure that required material / product is available just before it is needed.
  • Review our Master Production Schedule from Manufacturing Order Review
  • Review message generated by MRP from MRP Notice (all)

Step 5: Review and Confirm for Production

A planned manufacturing order is a manufacturing order suggested by the MRP process and contains its quantity and its release and promise dates. When you approve a planned manufacturing order, you convert it in a manufacturing order with the status of In Process.

When you approve a planned order you are telling the system that the manufacturing order is ready to start its process with the approval you change the order status from Draft to In Process.

We can run Calculate MRP as many times as we want until satisfied with the plan.

Image:Note.gif Note:

Document Status to Manufacturing Order (MO)
  • Draft: The MO with this status are Planning Order and are delete and generate again to Calculate material Plan. so this MO only are “Recommended Production Schedule”
  • In Process: The MO with this status are Firm Planned, so when I Calculate material plan, it MO do not delete because this order was approved, this case MRP only generate Notice Action.
  • Complete The MO with this status are ready to entry in shop.
    • Use Component Check here I can validate if MO have all components to release.
    • Use Printing and Release Order to Print the MO, if MO have all component then your status is change from in process to complete.
  • MO have complete doc status we can report receipt the finish good and issue component use Order Receipt and Issue
  • Close: The MO with this status do not allow receipt and issue component, but are ready to generate the variance cost to accounting

Component Check

  • Component Check is the report that tell us whether Manufacturing order can be completed (release to production shop). This report shows the material requirement vs availability in inventory. It is up to us to decide.

manu_13

Print & Release Order

  • With this option, we can get the Pick List , Pack & Tools List and workflow manufacturing as a preliminary, and if the information is right we can mark the complete check box to try to release order (Complete MO)

manu_14

Manufacturing Order

  • The Manufacturing Order is a document or schedule identity conveying authority for the manufacture of specified products in specified quantities.
  • User change the status of document to Complete to state that the Production Process (Workflow) can be stared on shop floor.
  • Note that, although the required material for production are not yet available, we can also still release the order. The real Finished Goods will be produced to stock on the next step.

manu_15

Order Receipt & Issue

  • Use this window to receive the finished goods to stock and/or components delivery to next production shop.
  • This is where, in ADempiere, the newly finished goods shall increase, and the raw materials used in production shall decreased the inventories. And as such, it will not process if the raw components are insufficient for production.
  • The Manufacturing Order will be set to Closed.

manu_16

Image:Note.gif Note:Here we can use multiple options to report the production:

  • Delivery Rule:
    • Back Flush: Allow receipt and component delivery based on the quantity to deliver
    • Only Issue: Allow delivery of components only to the production shop
    • Only receipt: Allow only receipt of finished goods.

In this case we will use Back flush for Manufacturing Order that has been released with following information:

  • Qty to Deliver: Which quantity you need to report
  • Qty Scrap: Which quantity you need to report
  • Movement Date: Which Date to Report
  • Locator: The Locator where we receive the materials.

Activity control

  • We can report the actual events that happen in the production shop.
  • Choose Manufacturing Order that you want to report choose the Manufacturing Order Activity that you need to report typed in the actual setup ,duration time and movement quantity.
  • The Activity Control report allows to register actual events that happened in the production shop and get the actual cost.

Misc (Temp)

  • The Resource Type is used to calculate the available time in a Manufacturing Resource. It allows input of starting time and end time for the slot according to the working days.
  • The Planning Horizon in Manufacturing resources is used for ???
  • If the workflow name is the same as the product name this Workflow will be the default Workflow for the product.
  • The time constraint (i.e., Queuing Time, Waiting Time) in Manufacturing WF and Manufacturing Resource is different in that = ????
  • Calculate Low Level = ???