CRPSpreadHoursOverWOPeriod

CRP, Spread Hours Over WO Period

Major Business Rule

Object Name: B3300230

Parent DLL: CMFG

Location: Client/Server

Language: C

1.Functional Description

1.1Purpose
This function spreads the input Load Hours and Setup Hours over the Released Load or Planned Load 
array based on the periods between the input Start date and Requested date.


1.2Setup Notes and Prerequisites

• The calling application must call B3300200 (CRP, Initialize Bucket Dates) before calling this 
function.  The Bucket Date Array pointer returned by this function must be passed as input.

• The calling application must call B3300220 (CRP, Calculate Released Load From WO Routings) before 
calling this function to allocate and initialize the Released Load, Planned Load, and Period Summary 

arrays.


1.3Special Logic


2.Technical Specifications

Declare array ResourceUnitsArray of 31 math numerics
Clear the ResourceUnitArray

R = 1

Search for the date in BucketDateArray that is >= RequestedDate.  Set R to the index of the date 

found.

S = 1

Search for the date in BucketDateArray that is >= StartDate.  Set S to the index of the date found.

If date search successful and S > 0 and S <= NumberOfPeriods

LoadArray[S] = LoadArray[S] + SetupHours
PeriodSummaryArray[S] = PeriodSummaryArray[S] + SetupHours

If S = R

LoadArray[S] = LoadArray[S] + LoadHours
PeriodSummaryArray[S] = PeriodSummaryArray[S] + LoadHours

End


// If Start Date and Requested Date fall in different buckets, spread the hours across the 

different periods

If S <> R

WorkDate = RequestedDate

Fetch the F3007 record using key values WUMCU = WorkCenter, WUMMCU = Branch,WUUM = 
UnitOfMeasure, WUYR = year from WorkDate, WUMT = month from WorkDate.

If record not found

S = R

Else

Copy the Resource Units fields from the F3007 record into the 
ResourceUnitsArray

WUWORE = WUWORE / 100

WUWORU = WUWORU / 100

RatedHours = ResourceUnitsArray[day from WorkDate]

RatedHours = RatedHours * WUWORE * WUWORU

End


Do while LoadHours > 0 and R <> S and R > 0 and R <= NumberOfPeriods and the last 
search for RequestedDate in BucketDateArray was successful

If RatedHours <= LoadHours
LoadArray[R] = LoadArray[R] + RatedHours

PeriodSummaryArray[R] = PeriodSummaryArray[R] + RatedHours

Else

LoadArray[R] = LoadArray[R] + LoadHours
PeriodSummaryArray[R] = PeriodSummaryArray[R] + LoadHours
End

LoadHours = LoadHours - RatedHours

If day from WorkDate > 1

Subtract 1 day from WorkDate

Else

Subtract 1 day from WorkDate

Fetch the F3007 record using key values WUMCU = WorkCenter, WUMMCU = Branch, 
WUUM = UnitOfMeasure, WUYR = year from WorkDate, WUMT = month from WorkDate.

If record not found

S = R

Else

Copy the Resource Units fields from the F3007 record into the 
ResourceUnitsArray

WUWORE = WUWORE / 100

WUWORU = WUWORU / 100

End

End

RatedHours = ResourceUnitsArray[day from WorkDate]
RatedHours = RatedHours * WUWORE * WUWORU

RequestedDate = WorkDate

R = 1

Search for the date in BucketDateArray that is >= RequestedDate.  Set R to the index 

of the date found.

End

If LoadHours > 0 and R = S

LoadArray[R] = LoadArray[R] + LoadHours

PeriodSummaryArray[R] = PeriodSummaryArray[R] + LoadHours

End

End


^

Data Structure

D3300230 - CRP, Spread Hours Over WO Period


Data Item Data Structure DescriptionI/ORequiredNotes

MCU            Work Center                        IY

MMCU            Branch                        IY

UM            Unit Of Measure                  IY

DRQJ            Requested Date                  IY

STRT            Start Date                        IY

MATH01      Load Hours                        IY

MATH01      Setup Hours                        IY

GENLNG      Bucket Date Array Ptr             IY      From B3300200

INT01            Number Of Periods                  IY

GENLNG      Load Array Ptr                  IY      From B3300220

GENLNG      Period Summary Array Ptr      IY      From B3300220

SUPPS            Suppress Error Message            I      '1' = Suppress runtime error 

message 

                                                                              handling 

                                                                        ' ' = Allow runtime error 

message 

                                                                              handling

DTAI            Error Message ID                  O      ' ' = Success 

                                                                        '3143' = Table access error


^

Parameter NameData ItemData TypeReq/OptI/O/Both
szWorkCenterMCUcharNONENONE

An alphanumeric code that identifies a separate entity within a business for which you want to track costs. For example, a business unit 
might be a warehouse location, job, project, work center, branch, or plant. You can assign a business unit to a document, entity, or person for 
purposes of responsibility reporting. For example, the system provides reports of open accounts payable and accounts receivable by 
business unit to track equipment by responsible department. Business unit security might prevent you from viewing information about business units 
for which you have no authority.

szBranchMMCUcharNONENONE

A code that represents a high-level business unit. Use this code to refer to a branch or plant that might have departments or jobs, which 
represent lower-level business units, subordinate to it. For example:     o Branch/Plant (MMCU)     o Dept A (MCU)     o Dept B (MCU)     o Job 123 
(MCU) Business unit security is based on the higher-level business unit.

szUnitOfMeasureUMcharNONENONE

A user defined code (00/UM) that identifies the unit of measurement for an amount or quantity. For example, it can represent a barrel, box, 
cubic meter, liter, hour, and so on.

jdRequestedDateDRQJJDEDATENONENONE

The date that an item is scheduled to arrive or that an action is scheduled for completion.

jdStartDateSTRTJDEDATENONENONE

The start date for the order. You can enter this date manually, or have the system calculate it using a backscheduling routine. The routine 
starts with the required date and offsets the total leadtime to calculate the appropriate start date.

mnLoadHoursMATH01MATH_NUMERICNONENONE

- - - Good Performance Low Value. 

mnSetupHoursMATH01MATH_NUMERICNONENONE

- - - Good Performance Low Value. 

idBucketDateArrayPtrGENLNGIDNONENONE

General purpose ID variable.

iNumberOfPeriodsINT01integerNONENONE

Number of Days in Future to Query for Responses Due. 

idLoadArrayPtrGENLNGIDNONENONE

General purpose ID variable.

idPeriodSummaryArrayPtrGENLNGIDNONENONE

General purpose ID variable.

cSuppressErrorMessageSUPPScharNONENONE

A flag indicating whether or not runtime error messaging will occur when an error message is issued from a business function.        0 = allow 
runtime error message handling.        1 = suppress runtime error message handling.

szErrorMessageIDDTAIcharNONENONE

A code that identifies and defines a unit of information. It is an alphanumeric code up to 8 characters long that does not allow blanks or 
special characters such as %, &, or +. You create new data items using system codes 55-59. You cannot change the alias.

Related Functions

None

Related Tables

F3007 Work Center Resource Units