Вы находитесь на странице: 1из 4

whm_inventory.update invent updateinventship updateinventship_del

*****************INSERT NEW SHIPMENT LOGIC***************************

1. INSERT RECORD INTO WHM_SHIPMENT

2. For each item in shipment Add a record in the shipment_items table.

3.Follow the following logic to update inventory

if status is PLANNED

ignore this condition.

NO EFFECTS ARE ON INVENTORY.

End IF

if status is STARTED IF (FROM_LOC_TYPE == WAREHOUSE) REDUCE INVENTORY AT FROM WAREHOUSE (call update_inventory for each item in the shipment with direction 'out'.) END IF

End IF

if status is REACHED IF (FROM_LOC_TYPE == WAREHOUSE) REDUCE INVENTORY AT FROM WAREHOUSE (call update_inventory for each item in the shipment with direction 'out'.) END IF IF (TO_LOC_TYPE == WAREHOUSE) INCREASE INVENTORY AT TO WAREHOUSE (call update_inventory for each item in the shipment with direction 'in'.) END IF

End IF

*****************DELETE SHIPMENT LOGIC***************************

1. for each record in the shipment_items for this shipment, follow the following logic to revert

inventory

if Current status is PLANNED

ignore this condition.

NO EFFECTS ARE ON INVENTORY.

End IF

if Current status is STARTED IF (FROM_LOC_TYPE == WAREHOUSE) INCREASE INVENTORY AT FROM WAREHOUSE(call update_inventory for each item in the shipment with direction 'in'.) END IF

End IF

if Current status is REACHED IF (FROM_LOC_TYPE == WAREHOUSE) INCREASE INVENTORY AT FROM WAREHOUSE(call update_inventory for

each item in the shipment with direction 'in'.) END IF IF (TO_LOC_TYPE == WAREHOUSE) DECREASE INVENTORY AT TO WAREHOUSE(call update_inventory for each item in the shipment with direction 'out'.) END IF

End IF

2. delete each record in the shipment_items table for that shipment.

3. Delete Shipment record from whm_shipments.

*****************UPDATE SHIPMENT LOGIC*************************** 1. UPDATE RECORD INTO WHM_SHIPMENT 2.Follow the following logic to update inventory

if new status is PLANNED if old_Status IS PLANNED

//this case does not matter. Ignore in implementation.

if old_status is STARTED IF (OLD_FROM_LOC_TYP == WAREHOUSE) REVERT Quantity each item from for OLD_FROM_LOC END IF

End if

if old_status is REACHED IF (OLD_FROM_LOC_TYP == WAREHOUSE) REVERT Quantity for each item from OLD_FROM_LOC END IF IF (OLD_TO_LOC == WAREHOUSE) REVERT Quantity for each item from OLD_TO_LOC END IF

End if

End IF

if new status is STARTED

if old_Status IS PLANNED

END IF

if old_status is STARTED

//this case does not matter. Ignore in implementation.

IF (OLD_FROM_LOC != NEW_FROM_LOC) OR (OLD_TO_LOC_TYP !=

NEW_TO_LOC_TYP)

//this condition does not matter. Ignore in implementation.

END IF IF (OLD_FROM_LOC_TYP == WAREHOUSE) REVERT Quantity for OLD_FROM_LOC END IF

End if

if old_status is REACHED IF (OLD_FROM_LOC_TYP == WAREHOUSE) REVERT Quantity for each item from OLD_FROM_LOC END IF IF (OLD_TO_LOC == WAREHOUSE) REVERT Quantity for OLD_TO_LOC END IF

End if

End IF

if new status is REACHED

if old_Status IS PLANNED

//this case does not matter. Ignore in implementation.

if old_status is STARTED IF (OLD_FROM_LOC_TYP == WAREHOUSE) REVERT Quantity for OLD_FROM_LOC END IF

End if

if old_status is REACHED IF (OLD_FROM_LOC_TYP == WAREHOUSE) REVERT Quantity for OLD_FROM_LOC END IF IF (OLD_TO_LOC == WAREHOUSE) REVERT Quantity for OLD_TO_LOC END IF

End if

End IF

3. Delete all the existing records from shipment_items for the particular shipment. 4.Insert 1 record in shipment items for each item in the shipment.

1 record in shipment items for each item in the shipment. List of program units 1.
1 record in shipment items for each item in the shipment. List of program units 1.

List of program units

1. insert record in shipment

2. update record in shipment

3. delete record in shipment

4. insert record in shipment_items

5. update record in shipment_items

6. delete record in shipment_items

7. update_inventory

8. revert_inventory.

update_inventory(item_id,Item_typ,Direction, Warehouse,quantity,unit)

{

if (Direction==IN) increase the quantity of that item at that warehouse. IF (DIRECTION==OUT) Decrease the quantity of that item at that warehouse

}