User Tools

Site Tools


implementation:manufacturing:customizationexamples

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

implementation:manufacturing:customizationexamples [2017/08/31 13:14] (current)
csuhaa created
Line 1: Line 1:
 +======Customization Examples======
 +=====1. Preset field data=====
 +With customization it is possible to preset the field data.
 +
 +Enable the Customization Assist then start Produmex PDC. Go to the screen that you would like to customize and press the Customization Assist button. ​ Because the field data is populated when the screen loads, the event to customize is the load event.
 +
 +<WRAP round box>In the example we will preset the ‘Quantity’ value on the ‘Complete Job’ screen to the open quantity on the production order. \\
 +Go to the Complete Job screen and press the Customization Assist button. The event to customize is the //​‘BXPPSMobilePDC_StopJobScreen_Load’//​ event.</​WRAP>​
 +
 +{{ :​implementation:​manufacturing:​customguide:​examples:​presetfielddata_custminfo.png?​500 |StopJobScreen}}
 +
 +Create a new query in the Query Manager. User query name will be the name of the event.
 +
 +<WRAP round box>In the example the query name will be: **‘BXPPSMobilePDC_StopJobScreen_Load’**.</​WRAP>​
 +
 +Example query:
 +<code sql>​SELECT ​
 +CASE WHEN (select SUM(U_BXPCoQty) from [@BXPPDCBOOKING] where U_BXPPrOOI = $[CurrentOperation.Code] and U_BXPIsUnd = '​N'​) > $[CurrentOperation.PlannedQuantity]
 +THEN 0
 +ELSE $[CurrentOperation.PlannedQuantity] - ISNULL( (select SUM(U_BXPCoQty) from [@BXPPDCBOOKING] where U_BXPPrOOI = $[CurrentOperation.Code] and U_BXPIsUnd = '​N'​),​ 0)
 +END as TextQuantity</​code>​
 +
 +<WRAP round box>The query in the example runs when the Complete Job screen loads. It selects the completed quantities from the PDC Booking (@BXPPDCBOOKING) table using the operation code ($[StopJobOperation.Code]). Then it subtracts the completed quantities from the Operation Planned Quantity ($StopJobOperation.PlannedQuantity]). The query sets the value to zero if the completed quantity is greater than the planned quantity.
 +</​WRAP>​
 +
 +After the query has been added, restart Produmex PDC in order to load the customization data.
 +
 +Please note: //You only need to restart the application once a new query has been added. If you only add modifications to the user query, Produmex PDC doesn’t have to be restarted.//​
 +
 +=====2. Validation=====
 +It is possible to add validation for ‘validation’ and ‘button’ events with customization. ​
 +
 +In the example we will set to show warning message if the user scans an operation on the ‘Start Job’ screen and there is no PDC booking for the previous operation of the same production order.
 +
 +Go to the Start Job screen and press the Customization Assist button. ​ For the operation validation we will use the //​BXPPSMobilePDC_StartJobScreen_TextOperation_validate//​ event.
 +
 +{{ :​implementation:​manufacturing:​customguide:​examples:​presetfielddata_validate.png?​500 |StartJobScreen}}
 +
 +Create a new query in the Query Manager. User query name will be the name of the event. ​
 +
 +Query name: **‘BXPPSMobilePDC_StartJobScreen_TextOperation_validate’**.
 +<code sql>​declare @DocEntry int
 +declare @LineNumber int
 +declare @PrevLineNum int
 +declare @PrevOperation nvarchar(max)
 +declare @PrevVisOrder nvarchar(max)
 +declare @Warning nvarchar(max)
 +declare @NumberOfBookings nvarchar(max)
 +declare @Input nvarchar(max)
 +declare @a int
 +set @Warning = ''​
 +set @Input = $[TextOperation]
 +
 +set @DocEntry = 0
 +set @LineNumber = 0
 +set @a = CHARINDEX('​-',​ @Input)
 +IF @a > 0 BEGIN
 + set @DocEntry = CAST(LEFT(@Input,​ @a - 1) as int)
 + set @Input = SUBSTRING(@Input,​ @a + 1, LEN(@Input) - @a)
 + set @a = CHARINDEX('​ ', @Input)
 + IF @a = 0 BEGIN set @a = LEN(@Input) + 1 END
 + set @LineNumber = CAST(LEFT(@Input,​ @a - 1) as int)
 +END
 +
 +select TOP 1 @PrevLineNum = WOR1.LineNum,​ @PrevOperation = WOR1.ItemCode,​ @PrevVisOrder = WOR1.VisOrder
 +from WOR1 where WOR1.DocEntry = @DocEntry AND WOR1.U_BXPRowTy = 2 
 +AND WOR1.VisOrder < (SELECT VisOrder FROM WOR1 WHERE DocEntry = @DocEntry AND LineNum = @LineNumber)
 +ORDER BY VisOrder DESC
 +IF @PrevLineNum IS NOT NULL BEGIN
 + SELECT @NumberOfBookings = COUNT(*) FROM [@BXPPDCBOOKING] book WHERE book.U_BXPPrODE = @DocEntry AND book.U_BXPPrODL = @PrevLineNum AND book.U_BXPIsUnd = '​N'​
 + IF @NumberOfBookings = 0 BEGIN
 + set @Warning = '​Warning:​ No PDC booking for previous operation, continue? Operation:'​ + @PrevOperation + ', line: ' + CAST(@PrevVisOrder as nvarchar(max))
 + END
 +END
 +IF @Warning <> '' ​
 +BEGIN
 + SELECT @Warning as '​WarningMessage$',​ '​W'​ as '​MessageType$'​
 +END</​code>​
 +
 +The example query can return two results:
 +  - No warning message - if the previous operations have PDC bookings or there is no previous operation.
 +  - Warning message – if there is no PDC booking for the previous operation.
 +
 +The user query does the following: \\
 +Parses the input ($[TextOperation]) - the value from the screen field named Operation, separate DocEntry and LineNum. The input will be something like: '​10-5',​ or '10-5 (Otuma...)'​ \\
 +Checks what is the previous operation from the same Production Order. \\
 +Checks if the previous operation has a booking (from [@BXPPDCBOOKING] table) \\
 +If there is no booking, returns a warning message in the result column named '​WarningMessage$'​ \\
 +
 +=====3. Hide existing field=====
 +It is possible to hide existing fields with customization.
 +
 +Open the [[implementation:​manufacturing:​customizationtechnology#​create_custom_field|Customization Fields user table]] and add a new record for an existing field. Set the //Visible// value to ‘No’ then press the ‘Update’ button. ​
 +
 +**Example**:​ In the example we hide the Default Work Center field from the Start Job screen. ​
 +
 +Add the following record to the Customization Fields user table:
 +^Field Name^Module^Screen^Visible^
 +|TextDefaultWorkCenter|BXPPSMobilePDC|StartJobScreen|No|
 +
 +Restart Produmex PDC. The customized Start Job screen will look like this:
 +
 +{{ :​implementation:​manufacturing:​customguide:​examples:​hidefield.png |Hide field}}
 +
 +=====4. Button customization=====
 +It is possible to set an event to trigger a button event.
 +
 +**Example**:​ Automatically press the ‘Login‘ button after the employee code has been added on the LOGIN Screen.
 +
 +Query name: //​BXPPSMobilePDC_LoginScreen_TextEmployeeID_validate_after// ​
 +
 +<code sql>IF $[TextEmployeeID] <> '' ​
 +BEGIN 
 +SELECT '​ButtonLogin'​ as '​Click$' ​
 +END</​code>​
 +
 +=====5. Custom message=====
 +It is possible to add custom messages to the events.
 +
 +**Example**:​ Display a warning message if the Employee ID is not added before pressing the ‘Login’ button.
 +
 +Query name: //​BXPPSMobilePDC_LoginScreen_ButtonLogin_click//​
 +
 +<code sql>IF $[TextEmployeeID] = '' ​
 +SELECT 'Scan Employee ID' as '​Message$',​ '​E'​ as '​MessageType$'</​code>​
 +
 +For more information about the supported message types please see: [[implementation:​manufacturing:​customizationtechnology#​create_an_sap_user_query|Supported message types]]
 +
 +=====6. Save the Destination Bin Location for the employee=====
 +This customization will save the last added bin location on the Products screen. When this screen next loads to the employee, the Bin Location code will be automatically filled. This way if the employee uses the same destination bin location, (s)he does not have to re-enter it.
 +
 +Create a new user table in SAP Business One. (In the example: PDC_TOBL). Register the new user table as an object.
 +
 +{{ :​implementation:​manufacturing:​customguide:​examples:​create_usertable.png |User Table}}
 +
 +Add the following fields to the user table: [Tools>​Customization Tools>​User Defined Fields- Management]
 +  * Employee ID (empID)
 +  * To Bin Location (ToBL)
 +
 +{{ :​implementation:​manufacturing:​customguide:​examples:​add_userfields.png |User fields}}
 +
 +Define the employees on the user table.
 +
 +{{ :​implementation:​manufacturing:​customguide:​examples:​define_employees.png |Define employees}}
 +
 +Add the following user queries:
 +
 +====6.1. Save the destination Bin Location to the employee ====
 +This query will save the added destination Bin Location to the U_ToBL field.
 +
 +Query name: //​BXPPSMobilePDC_ProductsAdvScreen_TextBinLocation_validate_after//​
 +
 +Example query: ​
 +<code sql>IF (SELECT ISNULL ([@PDC_TOBL].U_ToBL,''​) ​
 +FROM [@PDC_TOBL] ​
 +WHERE U_empID = $[Employee.EmpNumber]) <> $[TextBinLocation]
 +UPDATE [@PDC_TOBL] SET [U_ToBL]=$[TextBinLocation] WHERE U_empID = $[Employee.EmpNumber]</​code>​
 +
 +====6.2. Load the saved Bin Location====
 +This query will populate the Bin Location field with the saved value when the screen loads.
 +
 +Query name: //​BXPPSMobilePDC_ProductsAdvScreen _Load//
 +
 +Example query: ​
 +<code sql>​SELECT
 +(SELECT [@PDC_TOBL].U_ToBL FROM [@PDC_TOBL] WHERE U_empID = $[Employee.EmpNumber])
 +AS '​TextBinLocation'</​code>​
  
implementation/manufacturing/customizationexamples.txt · Last modified: 2017/08/31 13:14 by csuhaa