One moment please...
Untitled Document

How-to: Consume ProductionScrap entity

General

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:

  • RetrieveSet — Return a set of records of production actual lines for you to perform a production scrap.
  • Retrieve — Retrieve a single record of production header/line for you to perform a production scrap.
  • Create — Save the production scrap line to a temporary table with a transaction key. The line will not be processed until the Update action is performed.
  • Update — Process the production scrap lines with the same transaction key. Actual scrap lines will be created. The extra budget lines will be created for the production order.

Properties

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

 

Read only field (String)

The field indicates the production line’s cost unit, if any.

ItemCode

 

Read only field (String)

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

 

Read only field (String)

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.

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.

 

LotNumber

 

Read only field (String)

This field indicates the lot number for the serial batch item during receipt.

Operation

 

Read only field (String)

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

Mandatory field (String)

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

 

Read only field (String)

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

Read only field (Double)

This field indicates the total quantity realized for the record.

ReasonCode

Mandatory field (String)

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

Read only field (Double)

This field indicates the total quantity of the scrapped item.

UnitSelcode

 

Read only field (String)

This field indicates the unit of quantity in Sales unit.

Step

Read only field (Number)

This field indicates the step of the production line if the Operation setting is enabled.
Production head will not have Step.

Warehouse

 

Read only field (String)

This field indicates the warehouse of the scrapped item.

How do I create production scrap with entity?

To create a production scrap with the ProductionScrap entity, user should consume the entity in the following sequence:

  1. Retrieve the production header/lines to be scrapped with RetrieveSet (entities).
  2. Retrieve each single production line with entity retrieve action.
  3. Enter the scrap Quantity, ReasonCode, ProductionOrder, and Resource, and provide the transaction key.
  4. Perform the entity Create action.
  5. Repeat steps 2 - 4 for each production scrap 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 processing the production scrap.

Examples

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

 

End Function

 

 

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

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

 

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

 

Try

_Client.Create(ent)

 

Catch ex As Exception

Throw

End Try

 

End Sub

 

 

Step 4: Process production scrap

Private Sub ProcessProductionScrap(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 = "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 = "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

 

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"

Select p.Value).Single

Dim Resource As String = (From p In scrapline.Properties Where p.Name = "Resource"

Select p.Value).Single

Dim ScrapQty As Double = (From p In scrapline.Properties Where p.Name = "Quantity"

Select p.Value).Single

 

SaveProductionScrapLine(ID, ProductionOrder, Resource, ScrapQty, ReasonCode ,TranKey)

Next

 

ProcessProductionScrap(0, ProductionOrder, TranKey)

End If

 

End Sub

 

Supported release

The ProductionScrap entity is available from product update 406 onwards.

Related documents

 

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.


Attachments
How to consume ProductionScrap Entity.docx 32.9 KB View Download