This document describes how to consume the ProductionScrap entity to perform a production scrap in Exact Globe Next.
The functionality provided in this entity is very close to the functional behavior when performing a production scrap in standard Exact Globe Next application. However, the standard Exact Globe Next user interface splits the actual to match the scrap lines. This logic is done in the scrap exe. This entity uses query to retrieve the actual line a scrap records, it is unable to return the same format as in the standard Exact Globe Next, but grouping of scrap lines matches with actual line is returned from the RetrieveSet.
The entity supports the following actions:
Property
Description
ID
Mandatory field (Long)
This field refers to the ID of the actual header/line.
Use this ID to retrieve single production scrap line entity.
This ID must be provided upon performing the Create action. The ID must match the scrap line. Else, an error will be thrown.
When performing the Update action, a dummy ID needs to be provided.
CostCenter
Read only field (String)
The field indicates the production line’s cost center.
CostUnit
The field indicates the production line’s cost unit, if any.
ItemCode
This field indicates the item that needs to be scrapped.
ItemDescription
Read field (String)
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 create action.
ItemType
This field indicates the type of the item in the production order. It could be: END-ITEM, PART-ITEM, BY-PRODUCTION.
Location
Mandatory field (String)
This field indicates the warehouse location of the item scrapped.
LotNumber
This field indicates the lot number for the serial batch item during receipt.
Operation
This field indicates the operation of the production line if the Operation setting is enabled.Production head will not have Operation.
ReturnedQuantity
Read only field (Double)
This field indicates the total quantity returned for the record.
Person
Read only field (Number)
ProductionOrder
This field indicates the production order number. This field is mandatory when processing a scrap line.
Quantity
Mandatory field (Double)
This field indicates the quantity to scrap for the line. This field is mandatory when processing a scrap line.
SerialBatchNumber
If the scrap 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.
This field is only required upon performing the Create action.
RealizedQuantity
This field indicates the total quantity realized for the record.
ReasonCode
The field indicates the set of Reason Code for scrapping the production order. This code will be validated during processing.
TransactionKey
Mandatory field (Guid)
The field indicates the set of production scrap lines that should be processed in a single entry. All production scrap lines should consist of the same value.
The field is required in both the Create and Update actions.
Resource
Mandatory field (Number)
This field indicates the resource who scraps this line.
ScrapQUantity
This field indicates the total quantity of the scrapped item.
UnitSelcode
This field indicates the unit of quantity in Sales unit.
Step
This field indicates the step of the production line if the Operation setting is enabled.Production head will not have Step.
Warehouse
This field indicates the warehouse of the scrapped item.
To create a production scrap with the ProductionScrap entity, user should consume the entity in the following sequence:
Please refer to document 22.148.798 for the general guideline on how to consume Exact Entity.
Step 1: Retrieve set
Private Function GetProductionScrapRetrieveSet(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 = "ProductionScrap"
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 scrap line (Optional)
Private Function RetrieveSingleProductionScrapLine(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 = "ProductionScrap", .Properties = p})
Catch ex As Exception
Throw
End Try
Step 3: Create single production line
Private Sub SaveProductionScrapLine(ByVal ID As String, ByVal ProductionOrder As String,
ByVal ResourceID As String, ByVal Quantity As Double,
ByVal ReasonCode As Double, ByVal TranKey As String)
Dim ent As New EntityData
With ent
.EntityName = "ProductionScrap"
.Properties.Add(New PropertyData() With {.Name = "ID", .Value = ID})
.Properties.Add(New PropertyData() With {.Name = "ProductionOrder", .Value = ProductionOrder})
.Properties.Add(New PropertyData() With {.Name = "ReasonCode", .Value = ReasonCode})
.Properties.Add(New PropertyData() With {.Name = "Resource", .Value = ResourceID})
.Properties.Add(New PropertyData() With {.Name = "Quantity", .Value = Quantity})
.Properties.Add(New PropertyData() With {.Name = "TransactionKey", .Value = TranKey})
End With
_Client.Create(ent)
End Sub
Step 4: Process production scrap
Private Sub ProcessProductionScrap(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 ProductionScraps 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"
ProductionScraps = GetProductionScrapRetrieveSet(ProductionOrder)
If ProductionScraps.Entities.Count > 0 Then
Dim TranKey As String = Guid.NewGuid().ToString
For Each scrapline As EntityData In ProductionScraps.Entities
Dim ID As String = (From p In scrapline.Properties Where p.Name = "ID" Select p.Value).Single
Dim ItemCode As String = (From p In scrapline.Properties Where p.Name = "ItemCode"
Select p.Value).Single
Dim ReasonCode As String = (From p In scrapline.Properties Where p.Name = "ReasonCode"
Dim Resource As String = (From p In scrapline.Properties Where p.Name = "Resource"
Dim ScrapQty As Double = (From p In scrapline.Properties Where p.Name = "Quantity"
SaveProductionScrapLine(ID, ProductionOrder, Resource, ScrapQty, ReasonCode ,TranKey)
Next
ProcessProductionScrap(0, ProductionOrder, TranKey)
End If
The ProductionScrap entity is available from product update 406 onwards.
Document Number: 24.245.640
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.