This document describes how to consume the ProductionReturn entity to perform production return in Exact Globe Next.
The functionality provided in this entity is very close to the functional behavior when performing a production return in standard Exact Globe Next application. This entity only allows you to create a production return for a single production order at one time.
The entity supports the following actions:
Property
Description
ID
Mandatory field (Long)
This field refers to the ID of the actual receipt line.
Use this ID to retrieve single production return line entity.
This ID must be provided upon the Create action. The ID must matched with the return line. Else, error will be thrown.
When you perform 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.
IsFractionAllowedItem
The field indicates whether the item is a divisible item. If it is false, the return quantity should not contain any decimal value. Else, an error will be thrown.
IsSerialNumberItem
The field indicates whether the item is a serial item. If true, the SerialBatchNumber field must be provided with the correct value. Also, the ReturnQuantity field must be 1.
ItemCode
Mandatory field (String)
This field indicates the item (make/by-product) that needs to be returned.
This field must be provided when you perform the Create action. The value must match the item code in the actual receipt line.
Location
Optional field (String)
This field indicates the warehouse location of the item returned.
This field should be provided if the Multiple Location setting is enabled in Exact Globe Next. Else, the location from the actual 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 Step + Operation value of return line.
ProductionOrder
This field indicates the production order that needs to be returned.
This field is mandatory for the Create and Update actions.
ReceivedQuantity
Read only field (Double)
This field indicates the quantity of item that has been received in the production order. This shows the quantity of item received minus the returned quantity. If the Stock check setting is enabled, this value does not include the free stock checking.
Resource
This field must be provided with a valid resource ID upon performing the Create action.
ReturnQuantity
Mandatory field (Double)
This field allows user to fill the quantity of item to be returned. The return quantity should not exceed the received quantity. If the Stock check setting is enabled, the value should not exceed the free stock available.
This field is mandatory upon performing the Create action.
SerialBatchNumber
If the return item is a serial/batch item, a value must be provided for this field. The serial/batch number must match the value in the actual serial/batch number received.
TransactionKey
Mandatory field (Guid)
The field indicates a set of production return lines that should be processed in a single entry. All production return lines should consist the same value.
The field is required in both the Create and Update actions.
Unit
This field indicates the unit of quantity in Sales unit.
Warehouse
A value must be provided for this field if the Multiple Location setting is enabled in Exact Globe Next.
To create a production return with the ProductionReturn entity, user should consume the entity in the following sequence:
Note: To split a return line into multiple lines with different warehouse locations, perform multiple entity Create actions with same ID and different locations and quantities.
Please refer to document 22.148.798 for the general guideline on how to consume Exact Entity.
Step 1: Retrieve set
Private Function GetProductionReturnRetrieveSet(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 = "ProductionReturn"
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 return line (Optional)
Private Function RetrieveSingleProductionReturnLine(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 = "ProductionReturn", .Properties = p})
Catch ex As Exception
Throw
End Try
Step 3: Create single production line
Private Sub SaveProductionReturnLine(ByVal ID As String, ByVal ProductionOrder As String,
ByVal ItemCode As String, ByVal Warehouse As String,
ByVal ResourceID As String, ByVal ReturnQuantity As Double,
ByVal TranKey As String)
Dim ent As New EntityData
With ent
.EntityName = "ProductionReturn"
.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 = "ReturnQuantity", .Value = ReturnQuantity})
.Properties.Add(New PropertyData() With {.Name = "TransactionKey", .Value = TranKey})
End With
_Client.Create(ent)
End Sub
Step 4: Process production return
Private Sub ProcessProductionReturn(ByVal ID As String, ByVal ProductionOrder As String, ByVal TranKey As String)
_Client.Update(ent)
Main Code
Private _Service As String
Private _Client As EntityClientEG
Sub Main()
Dim ProductionReturns 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"
ProductionReturns = GetProductionReturnRetrieveSet(ProductionOrder)
If ProductionReturns.Entities.Count > 0 Then
Dim TranKey As String = Guid.NewGuid().ToString
For Each retunline As EntityData In ProductionReturns.Entities
Dim ID As String = (From p In retunline.Properties Where p.Name = "ID" Select p.Value).Single
Dim ItemCode As String = (From p In retunline.Properties Where p.Name = "ItemCode"
Select p.Value).Single
Dim Warehouse As String = (From p In retunline.Properties Where p.Name = "Warehouse"
Dim Resource As String = (From p In retunline.Properties Where p.Name = "Resource"
Dim ReturnQty As Double = (From p In retunline.Properties Where p.Name = "ReceivedQuantity"
SaveProductionReturnLine(ID, ProductionOrder, ItemCode, Warehouse, Resource, ReturnQty, TranKey)
Next
ProcessProductionReturn(0, ProductionOrder, TranKey)
End If
The ProductionReturn entity is available from product update 405 onwards.
Document Number: 26.158.239
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.