Functional Description
Purpose
(F1307) and change the Status on the Current record within the Location Tracking Table (F1204) when
a record is added to the Asset Master Table (F1201) or when a change is made to the Status
(EQST) on the Asset Master. Additionally, the program should optionally change the Asset Status of
Children Assets when changing the Asset Status of the Parent Asset. The Location Tracking table
is only updated with the new status when there is only a single location for the Asset.
Setup Notes and Prerequisites
Special Logic
This function has the following special logic which differs from X1307 in the World A8.1 code.
function will (optionally) build an Asset Master tree which defines all children of the given
asset number and update the status of the children assets as well.
The ONLY Type of Record that this business function can handle is type '1' for Equipment
Status updates. The X1307 in the World A8.1 code was designed to handle type '1' and '2' status
updates. To handle type '2' updates in OneWorld, please use B1300030.
in OneWorld.
Technical Specification
3. Record Type (TREC) = '1'
4.End If
5.If Remark (RMK) = ""
6. Remark (RMK) = " "
7.End If
8.If Processing Mode (EV01) <> '1' And <> '2' And <> '3'
9. Processing Mode (EV01) = '1'
10.End If
11.If Update Children (EV01) <> '1' And <> '0'
12. Update Children (EV01) = '0'
13.End If
14.// Initialize Error Code
15.Error Code (ERRC) = '0'
16.Error Code (wf) = '0'
17.//
18.// Open Tables
19.Open F1201, F1307 and F1204.
20.
21.//
22.// Validate Input Date and Time for Input Asset Number (NUMR)
23.Call Internal Function Check Date Overlap (Asset Number(NUMR))
24.
25.If Error Code (wf) <> '0' And Processing Mode (EV01) = '1'
26. Error Code (ERRC) = Error Code (wf)
27.End If
28.//
29.If Error Code (ERRC) = '0' And Processing Mode (EV01) <> '1' And Write (wf) = '1'
30. // Build Asset Tree if Needed
31. If Update Children (EV01) = '1'
32. Call F1201 Create Parent Child Asset Cache (B1200050) to build Asset Tree.
33. 'C' 'e0 Mode
34. Asset Number (NUMR)'e0 Asset Number
35. End If
36.
37. // Update Status for Input Asset Item Number (NUMR)
38. Call Internal Function Update Asset Status (Asset Number(NUMR))
39. //
40. If Update Children (EV01) = '1' And Process Mode (EV01) <> '1'
41. Call Cache Process Asset Tree (B1200100) to retrieve first record
(which is the Asset Item Number (NUMR).
42. While Cache Error = '0'
43. Call Cache Process Asset Tree (B1200100) to retrieve next
record.
44. If Cache Error = '0'
45. Call Internal Function Check Date Overlap (Cache Asset
Item Number)
46. If Processing Mode (EV01) <> '1'
47. Call Internal Function Update Asset Status (Cache Asset
Item Number)
48. End If
49. End If
50. End While
51. End If
52.End If
53.
54.If Processing Mode (EV01) = '3' And Record Type (TREC) = '1' And Write (wf) = '1' And
Error Code (ERRC) = '0'
55.// Update Location Tracking Table F1204 ONLY when ONE 'C' type record is found.
56. Select from F1204 using FMNUMB=Asset Item Number (NUMR), FMAL='C'.
57. Fetch from F1204
58. If Found
59. Fetch Next from F1204
60. If Not Found
61. FMEQST = New Status of Equipment(EWST)
62. Update F1204.
63. End If
64. End If
65.End If
66.If Asset Tree was Created
67. Call F1201 Create Parent Child Asset Cache (B1200050) to Destroy Asset Tree.
68. 'D' 'e0 Mode
69. Asset Number (NUMR)'e0 Asset Number
70. End If
71.End If
Internal Function Check Date Overlap(Input Asset Number)
2.Write (wf) = '1'
3.Fetch the record from F1307 with the highest EFTB and BEGT value and matches F1NUMR=Input
Asset Number, F1TREC=Record Type (TREC). Save this record in DS_OPENHISTORYRECORD (wf)
4.If Fetch is Successful
5. If F1EFTB > Input Begin Date of Status (EFTB)
6. Error Code (wf) = '1'
7. Else
8. If F1EFTB = Begin Date of Status (EFTB) And F1BEGT > Begin Time of
Status(BEGT)
9. Error Code (wf) = '1'
10. End If
11. End If
12. // Determine if the F1307 record is the same status as the new
status.
13. If F1EWST = New Status of Equipment(EWST)
14. Write (wf) = '0'
15. End If
16. // Determine if Previous History Record before has same status.
17. Previous_Hist_STHR (wf) = 0
18. Previous_Hist_CUMH (wf) = 0
19. Select Records from F1307 using F1TREC='1', F1NUMR=Input Asset Number, And
(F1EFTB< Begin Date if Status (BEGT) Or F1EFTB=Begin Date of Status(EFTB) And F1BEGT <
Begin Time of Status(BEGT))
20. Fetch Record
21. If Fetch Was Successful
22. If F1EWST = New Status of Equipment(EWST)
23. Write (wf) = '0'
24. Copy F1CUMH to Previous_Hist_CUMH (wf)
25. Copy F1STHR to Previous_Hist_STHR (wf)
26. Else
27. While Fetch is Successful
28. If F1EWST = New Status of Equipment (EWST)
29. Copy F1CUMH to Previous_Hist_CUMH (wf)
30. Copy F1STHR to Previous_Hist_STHR (wf)
31. Break out from while loop.
32. End If
33. End While
34. End If
35. End If
36. // Check if there is a direct match on EFTB and BEGT
37. Fetch the record from F1307 using keys: F1NUMR=Input Asset Number,
F1TREC=Record Type (TREC), F1EFTB= Begin Date of Status (EFTB), F1BEGT= Begin Time of Status (BEGT)
38. If Fetch is Successful
39. // Overlap on same date/time on different status.
40. If F1EWST <> New Status of Equipment (EWST)
41. Error Code (wf) = '2'
42. End If
43. Save this record in DS_HISTORYRECORDWITHSAMESTART (wf).
44. End If
45.End If
Internal Function Update Asset Status(Input Asset Number To Update)
2.// Calculate Cumulative Hours
3.Cum Hours (wf) = Previous_Hist_CUMH (wf) + Previous_Hist_STHR (wf)
4.//
5.// Calculate Meter Readings
6.Meter (wf) = ' '
7.If Record Type (TREC) = '1' And Processing Mode (EV01) <> '1'
8. HBAL (wf) = 0
9. MBAL (wf) = 0
10. FBAL (wf) = 0
11. Fetch Record from F1201 using FANUMB=Input Asset Number To Update
12.
13. Call Accumulate Date Sensitive Balances (B1200007 ) to calculate HBAL(wf).
14. Call Accumulate Date Sensitive Balances (B1200007 ) to calculate MBAL(wf).
15. Call Accumulate Date Sensitive Balances (B1200007 ) to calculate FBAL(wf).
16.End If
17.//
18.If Error Code (wf) = '0'
19. // Normal Status Update and Insert with no Date Overlap Conditions.
20. // Update Open History record to close it.
21. If DS_OPENHISTORYRECORD.F1NUMR <> 0
22. Call Internal Function Calculate Hours (DS_OPENHISTORYRECORD.F1EFTB,
Begin Date of Status (EFTB), DS_OPENHISTORYRECORD.F1BEGT, Begin Time of Status
(BEGT), Elapsed Hrs(wf)).
23. DS_OPENHISTORYRECORD.F1EFTE = Begin Date of Status (EFTB)
24. DS_OPENHISTORYRECORD.F1BEGT = Begin Time of Status (BEGT)
25. DS_OPENHISTORYRECORD.F1STHR = Elapsed Hrs(wf)
26. DS_OPENHISTORYRECORD.Audit Information fields.
27. Update F1307 using DS_OPENHISTORYRECORD.
28. End If
29. // Insert new history record.
30. F1TREC = Record Type (TREC)
31. F1NUMR = Input Asset Number to Update
32. F1DOCO = 0
33. F1LHR = HBAL(wf)
34. F1LMR = MBAL (wf)
35. F1LFR = FBAL (wf)
36. F1EWST = New Status of Equipment (EWST)
37. F1EFTB = Begin Date of Status (EFTB)
38. F1BEGT = Begin Time of Status (BEGT)
39. F1EFTE = Null
40. F1ENDT = 0
41. F1STHR = 0
42. F1CUMH = Cum Hours (wf)
43. F1RMK = Remark (RMK)
44. Audit Information Fields.
45. Insert to F1307
46.End If
47.//
48.If Error Code (wf) <> '0'(B1)
49.// If History Record with Same Start date and time Exists, Update it.
50. Adjust Hrs (wf) = 0
51. If DS_HISTORYRECORDWITHSAMESTART.F1NUMR <> 0(B2)
52. // It Exists
53. Update Old(wf) = '1'
54. Old Status (wf) = DS_HISTORYRECORDWITHSAMESTART.F1EWST
55. Adjust Hrs(wf) = DS_HISTORYRECORDWITHSAMESTART.F1STHR
56. DS_HISTORYRECORDWITHSAMESTART.F1EWST = New Status of Equipment
(EWST)
57. DS_HISTORYRECORDWITHSAMESTART.F1CUMH = Cum Hours (wf)
58. DS_HISTORYRECORDWITHSAMESTART.F1RMK = Remark (RMK)
59. DS_HISTORYRECORDWITHSAMESTART.Audit Information fields.
60. Update F1307 using DS_HISTORYRECORDWITHSAMESTART
61. //
62. // Get the next record with higher EFTB and BEGT value and same
status.
63. Select on F1307 using F1TREC= Record Type (TREC), F1NUMR=
F1NUMR=Input Asset Number To Update, F1EFTB > Begin Date of Status (EFTB) OR F1EFTB =
Begin Date of Status (EFTB) And F1BEGT > Begin Time of Status (BEGT), Order by EFTB
Asc and BEGT Asc.
64. Fetch the F1307 record
65. If Fetch Succeeds And F1EWST = New Status of Equipment (EWST)
66. Delete from F1307 using keys in record fetched.
67. DS_HISTORYRECORDWITHSAMESTART.F1EFTE = F1EFTE(deleted rec)
68. DS_HISTORYRECORDWITHSAMESTART.F1ENDT = F1ENDT(deleted rec)
69. DS_HISTORYRECORDWITHSAMESTART.F1STHR = F1STHR(deleted rec)
70. DS_HISTORYRECORDWITHSAMESTART.Audit Information fields.
71. Update F1307 using DS_HISTORYRECORDWITHSAMESTART.
72. End If
73. //
74. // Get record next record with lower EFTB and BEGT value and
same status.
75. Select on F1307 using F1TREC= Record Type (TREC), F1NUMR=
F1NUMR=Input Asset Number To Update, F1EFTB < Begin Date of Status (EFTB) OR F1EFTB =
Begin Date of Status (EFTB) And F1BEGT < Begin Time of Status (BEGT), Order by EFTB
Dsc and BEGT Dsc.
76. Fetch the F1307 record
7'1a'1a
D1300020 - F1307, Update Asset Status
Parameter Name | Data Item | Data Type | Req/Opt | I/O/Both |
---|---|---|---|---|
cRecordType | TREC | char | OPT | NONE |
A code that indicates whether a particular record represents a change in equipment status or a change in work order status. Valid values
| ||||
mnAssetNumber | NUMR | MATH_NUMERIC | OPT | NONE |
The equipment number or work order number associated with a change of status. | ||||
szNewStatusOfEquipment | EWST | char | OPT | NONE |
The status associated with either a piece of equipment or a work order. | ||||
jdBeginDateOfStatus | EFTB | JDEDATE | OPT | NONE |
The date that an address, item, transaction, or table record becomes active. The meaning of this field differs, depending on the program.
| ||||
mnBeginTimeOfStatus | BEGT | MATH_NUMERIC | OPT | NONE |
The time at which the status of a piece of equipment or a work order changes. Use the HH:MM format (for example, 12:35). | ||||
szProgramId | PID | char | OPT | NONE |
The number that identifies the batch or interactive program (batch or interactive object). For example, the number of the Sales Order Entry
| ||||
szStatusRemark | RMK | char | OPT | NONE |
A generic field that you use for a remark, description, name, or address. | ||||
cProcessingMode | EV01 | char | OPT | NONE |
An option that specifies the type of processing for an event. | ||||
cUpdateChildrenStatus | EV01 | char | OPT | NONE |
An option that specifies the type of processing for an event. | ||||
cErrorCode | ERRC | char | OPT | NONE |
This error code indicates if any errors occurred during the creation of the Trip Document Detail (F4914) records by the Delivery Document
|
B1200007 F1202 Accumulate Date Sensitive Balances | ||||
B1200050 F1201, Create Parent Child Asset Cache | ||||
B1200100 Cache, Process Asset Tree | ||||
B9800100 Get Audit Information |
F1201 Asset Master File | ||||
F1204 Location Tracking Table | ||||
F1307 Status History File |