One moment please...
Untitled Document

How-to: Consume ProductionReceipt entity

General

This document describes how to consume the ProductionReceipt entity to perform a production receipt in Exact Globe Next.

The functionality provided in this entity is very close to the functional behavior when performing a production receipt in standard Exact Globe Next application. This entity only allows you to create a production receipt for a single production order at one time.

The entity supports the following actions:

  • RetrieveSet — Return a set of records of production receipt lines for you to perform a production receipt.
  • Retrieve — Retrieve a single record of production receipt line for you to perform a production receipt.
  • Create — Save the production receipt line to a temporary table with a transaction key. There is no data validation at this stage, the system will only check for mandatory fields (exists). The line will not be process until the Update action is performed.
  • Update — Process the production receipt lines with the same transaction key. Actual fulfillment lines will be created. Standard production receipt validation will be performed at this stage. The extra budget lines will be created for the production order in case there is extra quantity or extra lines.

Properties

Property

Description

ActualQuantity

 

Mandatory field (Double)

This field indicates the actual quantity to be receipt for the production receipt line.

The value should be greater than 0. The value will be validated with free stock quantity if the Check stock setting is enabled.

This field is only required upon performing the Create action.

BackFlush

Read only field (Boolean True/False) (Available since PU408)

The field indicates whether the planned item is back flush.

ID

Mandatory field (Long)

This field refers to the ID of the production receipt plan line.

Use this ID to retrieve a single production receipt line entity.

This ID must be provided upon performing the Create action. The ID must match the receipt line. Else, an error will be thrown.

To create a production receipt or an extra production receipt, set the ID = 0.

When performing the Update action, a dummy ID needs to be provided.

IsBatchItem

 

Read only field (Boolean True/False)

The field indicates whether the item is a batch item. If true, the SerialBatchNumber field must be provided with the correct value.

IsByProduct

 

Read only field (Boolean True/False)

The field indicates whether the production receipt’s item is a by product.

IsFractionAllowedItem

 

Read only field (Boolean True/False)

The field indicates whether the item is a divisible item. If it’s false, the receipt quantity should not contain any decimal value. Else, an error will be thrown.

IsSerialNumberItem

 

Read only field (Boolean True/False)

The field indicates whether the item is a serial item. If true, the SerialBatchNumber field must be provided with the correct value. Also, the ActualQuantity field must match the serial numbers provided.

ItemCode

 

Mandatory field (String)

This field indicates the item (make/by-product) that needs to be receipt. The value must match the item code in the planned receipt line.

A value must be provided for this field when performing the Create action.

Location

 

Optional field (String)

This field indicates the warehouse location of the item to be receipt.

This field should be provided if the Multiple Location setting is enabled in Exact Globe Next. Else, the location from the planned receipt line will be the default value.

This field is only required upon performing the Create action.

Operation

 

Read only field (String)

This field shows the operation value of the planned receipt line.

PlannedQuantity

 

Read only field (Double)

This field indicate the original planned quantity for the production receipt line that need to be receipt.

ProductionOrder

 

Mandatory field (String)

This field indicates the production order that needs to be receipt.

This field is mandatory for the Create and Update actions.

RealizedQuantity

 

Read only field (Double)

This field indicates the quantity of item that has been receipt in the production order for this planned production receipt line.

Resource

 

Mandatory field (String)

This field must be provided with a valid resource ID upon the Create action.

SerialBatchNumber

 

Optional field (String)

If the item to be receipt is a serial/batch item, a value must be provided for this field.  The serial numbers provided must match the actual quantity. The Serial/batch numbers will be validated based on the Exact Globe Next settings. Production receipt line with serial number is supported in following methods

 

i.              i. Multiple (same ID) planned production receipt line with different number

ii.             This method is supported by saving multiple planned lines with same ID with different numbers with the Save action. The actual quantity of each line must be 1.

 

iii.            ii. Single planned production receipt line with different number (as a string)

This method is supported by save single planned line with different number with Save action. The serial/batch number can be provided as a string with “,” as delimiter. The maximum limit is 50 numbers.

 

Note: if ActualQuantity = 1, the serial number will be assigned as provided.

Please refer to the section below for the sample of implementation.

Step

 

Read only field (Double)

This field shows the step value of the planned receipt line.

ToBeRealizedQuantity

 

Read only field (Double)

This field indicates the outstanding quantity for the production receipt line that needs to be receipted.

TransactionKey

 

Mandatory field (Guid)

The field indicates the set of production receipt lines that should be processed in single entry. All production receipt lines should consists the same value.

The field is required in both create and update action.

Sysguid

 

Read only field (String)

The field indicate the sysguid of the planned production receipt line.

Modified

 

Read only field (String)

The field indicates the last modified date of the planned production receipt line.

Warehouse

 

Mandatory field (String)

This field indicates the warehouse location of the item receipt. The warehouse rights will be validated.

This field must be provided when performing the ` action.

How do I create production receipt with entity?

To create a production receipt with the ProductionReceipt entity, user should consume the entity in the following sequence:

  1. Retrieve the planned production lines for receipt with Retrieveset (entities).
  2. Retrieve each single production receipt with entity Retrieve action.
  3. Type the actual receipt quantity and also provide the transaction key.
  4. Perform the entity Create action.
  5. Repeat steps 2 - 4 for each production receipt line (* with the same transaction key).
  6. Perform the entity Update action.
  7. Capture the error in case there is any error thrown due to incorrect data when process production receipt.

Note: To split a receipt line into multiple lines with different warehouse locations, perform multiple entity Create actions with the same ID and different locations and quantities.

How do I create production receipt with serial items?

Method 1: Multiple (same ID) planned production receipt line with different number

  1. Retrieve each single production receipt with entity retrieve action.
  2. Check if IsSerialItem is true.
  3. Copy the production receipt line.
  4. Assign serial number to SerialBatchNumber field and assign 1 to ActualQuantity.
  5. Perform the entity Create action.
  6. Repeat steps 3 - 5 until all ToBeRealizedQuantity.
  7. Perform the entity Update action.
  8. Capture the error in case there is any error thrown due to incorrect data when process production receipt.

 

Method 2: Single planned production receipt line with different number (as a string)

  1. Retrieve each single production receipt with entity retrieve action.
  2. Check if IsSerialItem is true.
  3. Assign all serial numbers to SerialBatchNumber as a string with “,” as delimiter.
  4. Assign total serial numbers quantity to ActualQuantity.
  5. Perform the entity Create action.
  6. Perform the entity Update action.
  7. Capture the error in case there is any error thrown due to incorrect data when processing the production receipt.

 

Examples

Please refer to document 22.148.798 for the general guideline on how to consume Exact Entity.

Step 1: Retrieve set

Private Function GetProductionReceiptRetrieveSet(ByVal ProductionOrder As String) As EntitiesData

Dim rc As New RetrieveCriteria

Dim ent As EntitiesData

Dim client As New EntitiesClientEG(_Service, "(local)\sql2008r2", "399")

 

rc.BatchSize = 10

rc.EntityName = _EntityName

rc.FilterQuery.Properties.Add(New QueryProperty() With {.PropertyName = "ProductionOrder", .Operation = "=", .PropertyValue = ProductionOrder})

 

ent = client.RetrieveSet(rc)

Return ent

End Function

 

Step 2: Retrieve single production receipt line (Optional)

Private Function RetrieveSingleProductionReceiptLine(ByVal ID As String) As EntityData

Dim p As NamedPropertyCollection(Of PropertyData)

'Dim client As New EntityClientEG(_Service, "(local)\sql2008r2", "399")

 

p.Add(New PropertyData() With {.Name = "ID", .Value = ID})

 

Try

Return _Client.Retrieve(New EntityData With {.EntityName = _EntityName, .Properties = p})

Catch ex As Exception

Throw

End Try

 

End Function

 

Step 3: Create single production line

Private Sub SaveProductionReceiptLine(ByVal ID As String, ByVal ProductionOrder As String,

ByVal ItemCode As String, ByVal Warehouse As String,

ByVal ResourceID As String, ByVal ActualQuantity As Double,

ByVal TranKey As String)

 

Dim ent As New EntityData

'Dim client As New EntityClientEG(_Service, "(local)\sql2008r2", "399")

 

With ent

.EntityName = _EntityName

.Properties.Add(New PropertyData() With {.Name = "ID", .Value = ID})

.Properties.Add(New PropertyData() With {.Name = "ProductionOrder", .Value = ProductionOrder})

.Properties.Add(New PropertyData() With {.Name = "ItemCode", .Value = ItemCode})

.Properties.Add(New PropertyData() With {.Name = "Warehouse", .Value = Warehouse})

.Properties.Add(New PropertyData() With {.Name = "Resource", .Value = ResourceID})

.Properties.Add(New PropertyData() With {.Name = "ActualQuantity", .Value = ActualQuantity})

.Properties.Add(New PropertyData() With {.Name = "TransactionKey", .Value = TranKey})

End With

 

Try

_Client.Create(ent)

 

Catch ex As Exception

Throw

End Try

 

End Sub

 

Step 4: Process production receipt

Private Sub ProcessProductionReceipt (ByVal ID As String, ByVal ProductionOrder As String, ByVal TranKey As String)

 

Dim ent As New EntityData

'Dim client As New EntityClientEG(_Service, "(local)\sql2008r2", "399")

 

With ent

.EntityName = _EntityName

.Properties.Add(New PropertyData() With {.Name = "ID", .Value = ID})

.Properties.Add(New PropertyData() With {.Name = "ProductionOrder", .Value = ProductionOrder})

.Properties.Add(New PropertyData() With {.Name = "TransactionKey", .Value = TranKey})

End With

 

Try

_Client.Update(ent)

 

Catch ex As Exception

Throw

End Try

 

End Sub

 

Main Code

Private _Service As String

Private _Client As EntityClientEG

 

Private _EntityName As String = "ProductionReceipt"

 

Sub Main()

Dim ProductionReceipts As New EntitiesData

Dim ProductionOrder As String

 

_Service = String.Format("http://{0}:{1}/services", "localhost", "8010")

_Client = New EntityClientEG(_Service, "(local)\sql2008r2", "399")

 

ProductionOrder = "PR0400043996"

ProductionReceipts = GetProductionReceiptRetrieveSet(ProductionOrder)

 

If ProductionReceipts.Entities.Count > 0 Then

Dim TranKey As String = Guid.NewGuid().ToString

 

For Each ReceiptLine As EntityData In ProductionReceipts.Entities

Dim ID As String = (From p In ReceiptLine.Properties Where p.Name = "ID" Select p.Value).Single

Dim ItemCode As String = (From p In ReceiptLine.Properties Where p.Name = "ItemCode" Select p.Value).Single

Dim Warehouse As String = (From p In ReceiptLine.Properties Where p.Name = "Warehouse" Select p.Value).Single

Dim Resource As String = (From p In ReceiptLine.Properties Where p.Name = "Resource" Select p.Value).Single

Dim ActualQty As Double = (From p In ReceiptLine.Properties Where p.Name = "ToBeRealizedQuantity" Select p.Value).Single

 

SaveProductionReceiptLine(ID, ProductionOrder, ItemCode, Warehouse, Resource, ActualQty, TranKey)

Next

 

'CreateMultipleProductionReceiptlinesWithMultipleSerialNumbers(5899)

'CreateSingleProductionReceiptlineWithMultipleSerialNumbers(5899)

End Sub

 

 

Method 1: Multiple (same ID) planned production receipt line with different number

Private Sub CreateMultipleProductionReceiptlinesWithMultipleSerialNumbers(ByVal ID As String)

Dim p As New NamedPropertyCollection(Of PropertyData)

Dim ent As EntityData

 

p.Add(New PropertyData() With {.Name = "ID", .Value = ID})

 

Try

ent = _Client.Retrieve(New EntityData With {.EntityName = _EntityName, .Properties = p})

 

If ent IsNot Nothing Then

Dim TranKey As String = Guid.NewGuid().ToString

 

If ent.Properties("IsSerialNumberItem").Value = True Then

'Assign serial number to for all to be relized quantity

For i As Long = 1 To ent.Properties("ToBeRealizedQuantity").Value

ent.Properties("SerialBatchNumber").Value = String.Concat("Serial", i)

ent.Properties("ActualQuantity").Value = 1

ent.Properties("TransactionKey").Value = TranKey

_Client.Create(ent)

Next

'Process the lines

ProcessProductionReceipt(0, ent.Properties("ProductionOrder").Value, TranKey)

End If

End If

 

Catch ex As Exception

Throw

End Try

 

End Sub

 

 

Method 2: Single planned production receipt line with different number (as a string)

Private Sub CreateSingleProductionReceiptlineWithMultipleSerialNumbers(ByVal ID As String)

Dim p As New NamedPropertyCollection(Of PropertyData)

Dim ent As EntityData

 

p.Add(New PropertyData() With {.Name = "ID", .Value = ID})

 

Try

ent = _Client.Retrieve(New EntityData With {.EntityName = _EntityName, .Properties = p})

 

If ent IsNot Nothing Then

Dim TranKey As String = Guid.NewGuid().ToString

Dim serialNumber As New List(Of String)

 

If ent.Properties("IsSerialNumberItem").Value = True Then

'Assign serial number to for all to be relized quantity

For i As Long = 1 To ent.Properties("ToBeRealizedQuantity").Value

serialNumber.Add(String.Concat("Serial", i))

Next

 

ent.Properties("SerialBatchNumber").Value = String.Join(",", serialNumber.ToArray())

ent.Properties("ActualQuantity").Value = ent.Properties("ToBeRealizedQuantity").Value

ent.Properties("TransactionKey").Value = TranKey

_Client.Create(ent)

 

'Process the lines

ProcessProductionReceipt(0, ent.Properties("ProductionOrder").Value, TranKey)

End If

End If

 

Catch ex As Exception

Throw

End Try

 

End Sub

 

Supported release

The ProductionReceipt entity is available from product update 405 onwards.

Related documents

 

Document Number: 26.158.240

Disclaimer
Despite the continued efforts of Exact to ensure that the information in this document is as complete and up-to-date as possible, Exact can not be held accountable for the correctness and/or completeness and/or specific applicability of the published and/or requested information in this document. Exact shall not be liable for any direct, indirect, incidental, special or consequential damages, lost profits or for business interruption arising out of the use of this document. The extraction and use of information from this document remains at all times completely within the user's own risk.


Attachments
How to consume Production Receipt Entity.docx 45.4 KB View Download
ProductionRealizationEntityTestApp.zip 282.0 KB Download