org.ofbiz.manufacturing.techdata
Class TechDataServices

java.lang.Object
  extended by org.ofbiz.manufacturing.techdata.TechDataServices

public class TechDataServices
extends java.lang.Object

TechDataServices - TechData related Services


Field Summary
static java.lang.String module
           
static java.lang.String resource
           
 
Constructor Summary
TechDataServices()
           
 
Method Summary
static java.sql.Timestamp addBackward(GenericValue techDataCalendar, java.sql.Timestamp dateFrom, long amount)
          Used to move backward in a TechDataCalendar, start from the dateFrom and move backward only on available period.
static java.sql.Timestamp addForward(GenericValue techDataCalendar, java.sql.Timestamp dateFrom, long amount)
          Used to move forward in a TechDataCalenda, start from the dateFrom and move forward only on available period.
static long capacityRemaining(GenericValue techDataCalendar, java.sql.Timestamp dateFrom)
          Used to to request the remain capacity available for dateFrom in a TechDataCalenda, If the dateFrom (param in) is not in an available TechDataCalendar period, the return value is zero.
static long capacityRemainingBackward(GenericValue techDataCalendar, java.sql.Timestamp dateFrom)
          Used to request the remaining capacity available for dateFrom in a TechDataCalenda, If the dateFrom (param in) is not in an available TechDataCalendar period, the return value is zero.
static java.util.Map<java.lang.String,java.lang.Object> checkRoutingTaskAssoc(DispatchContext ctx, java.util.Map<java.lang.String,? extends java.lang.Object> context)
          Used to check if there is not two routing task with the same SeqId valid at the same period
static java.util.Map<java.lang.String,java.lang.Object> dayEndCapacityAvailable(GenericValue techDataCalendarWeek, int dayEnd)
          Used to find the last day in the TechDataCalendarWeek where capacity != 0, ending at dayEnd, dayEnd included.
static java.util.Map<java.lang.String,java.lang.Object> dayStartCapacityAvailable(GenericValue techDataCalendarWeek, int dayStart)
          Used to find the fisrt day in the TechDataCalendarWeek where capacity != 0, beginning at dayStart, dayStart included.
static java.util.Map<java.lang.String,java.lang.Object> endPreviousDay(GenericValue techDataCalendar, java.sql.Timestamp dateFrom)
          Used to move in a TechDataCalenda, produce the Timestamp for the end of the previous day available and its associated capacity.
static GenericValue getTechDataCalendar(GenericValue routingTask)
          Used to get the techDataCalendar for a routingTask, if there is a entity exception or routingTask associated with no MachineGroup the DEFAULT TechDataCalendar is return.
static java.util.Map<java.lang.String,java.lang.Object> lookupRoutingTask(DispatchContext ctx, java.util.Map<java.lang.String,? extends java.lang.Object> context)
          Used to retrieve some RoutingTasks (WorkEffort) selected by Name or MachineGroup ordered by Name
static java.util.Map<java.lang.String,java.lang.Object> startNextDay(GenericValue techDataCalendar, java.sql.Timestamp dateFrom)
          Used to move in a TechDataCalenda, produce the Timestamp for the begining of the next day available and its associated capacity.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

module

public static final java.lang.String module

resource

public static final java.lang.String resource
See Also:
Constant Field Values
Constructor Detail

TechDataServices

public TechDataServices()
Method Detail

lookupRoutingTask

public static java.util.Map<java.lang.String,java.lang.Object> lookupRoutingTask(DispatchContext ctx,
                                                                                 java.util.Map<java.lang.String,? extends java.lang.Object> context)
Used to retrieve some RoutingTasks (WorkEffort) selected by Name or MachineGroup ordered by Name

Parameters:
ctx - the dispatch context
context - a map containing workEffortName (routingTaskName) and fixedAssetId (MachineGroup or ANY)
Returns:
result a map containing lookupResult (list of RoutingTask <=> workEffortId with currentStatusId = "ROU_ACTIVE" and workEffortTypeId = "ROU_TASK"

checkRoutingTaskAssoc

public static java.util.Map<java.lang.String,java.lang.Object> checkRoutingTaskAssoc(DispatchContext ctx,
                                                                                     java.util.Map<java.lang.String,? extends java.lang.Object> context)
Used to check if there is not two routing task with the same SeqId valid at the same period

Parameters:
ctx - The DispatchContext that this service is operating in.
context - a map containing workEffortIdFrom (routing) and SeqId, fromDate thruDate
Returns:
result a map containing sequenceNumNotOk which is equal to "Y" if it's not Ok

getTechDataCalendar

public static GenericValue getTechDataCalendar(GenericValue routingTask)
Used to get the techDataCalendar for a routingTask, if there is a entity exception or routingTask associated with no MachineGroup the DEFAULT TechDataCalendar is return.

Parameters:
routingTask - the routingTask for which we are looking for
Returns:
the techDataCalendar associated

dayStartCapacityAvailable

public static java.util.Map<java.lang.String,java.lang.Object> dayStartCapacityAvailable(GenericValue techDataCalendarWeek,
                                                                                         int dayStart)
Used to find the fisrt day in the TechDataCalendarWeek where capacity != 0, beginning at dayStart, dayStart included.

Parameters:
techDataCalendarWeek - The TechDataCalendarWeek cover
dayStart -
Returns:
a map with the capacity (Double) available and moveDay (int): the number of day it's necessary to move to have capacity available

capacityRemaining

public static long capacityRemaining(GenericValue techDataCalendar,
                                     java.sql.Timestamp dateFrom)
Used to to request the remain capacity available for dateFrom in a TechDataCalenda, If the dateFrom (param in) is not in an available TechDataCalendar period, the return value is zero.

Parameters:
techDataCalendar - The TechDataCalendar cover
dateFrom - the date
Returns:
long capacityRemaining

startNextDay

public static java.util.Map<java.lang.String,java.lang.Object> startNextDay(GenericValue techDataCalendar,
                                                                            java.sql.Timestamp dateFrom)
Used to move in a TechDataCalenda, produce the Timestamp for the begining of the next day available and its associated capacity. If the dateFrom (param in) is not in an available TechDataCalendar period, the return value is the next day available

Parameters:
techDataCalendar - The TechDataCalendar cover
dateFrom - the date
Returns:
a map with Timestamp dateTo, Double nextCapacity

addForward

public static java.sql.Timestamp addForward(GenericValue techDataCalendar,
                                            java.sql.Timestamp dateFrom,
                                            long amount)
Used to move forward in a TechDataCalenda, start from the dateFrom and move forward only on available period. If the dateFrom (param in) is not a available TechDataCalendar period, the startDate is the begining of the next day available

Parameters:
techDataCalendar - The TechDataCalendar cover
dateFrom - the start date
amount - the amount of millisecond to move forward
Returns:
the dateTo

dayEndCapacityAvailable

public static java.util.Map<java.lang.String,java.lang.Object> dayEndCapacityAvailable(GenericValue techDataCalendarWeek,
                                                                                       int dayEnd)
Used to find the last day in the TechDataCalendarWeek where capacity != 0, ending at dayEnd, dayEnd included.

Parameters:
techDataCalendarWeek - The TechDataCalendarWeek cover
dayEnd -
Returns:
a map with the capacity (Double) available, the startTime and moveDay (int): the number of day it's necessary to move to have capacity available

capacityRemainingBackward

public static long capacityRemainingBackward(GenericValue techDataCalendar,
                                             java.sql.Timestamp dateFrom)
Used to request the remaining capacity available for dateFrom in a TechDataCalenda, If the dateFrom (param in) is not in an available TechDataCalendar period, the return value is zero.

Parameters:
techDataCalendar - The TechDataCalendar cover
dateFrom - the date
Returns:
long capacityRemaining

endPreviousDay

public static java.util.Map<java.lang.String,java.lang.Object> endPreviousDay(GenericValue techDataCalendar,
                                                                              java.sql.Timestamp dateFrom)
Used to move in a TechDataCalenda, produce the Timestamp for the end of the previous day available and its associated capacity. If the dateFrom (param in) is not in an available TechDataCalendar period, the return value is the previous day available

Parameters:
techDataCalendar - The TechDataCalendar cover
dateFrom - the date
Returns:
a map with Timestamp dateTo, Double previousCapacity

addBackward

public static java.sql.Timestamp addBackward(GenericValue techDataCalendar,
                                             java.sql.Timestamp dateFrom,
                                             long amount)
Used to move backward in a TechDataCalendar, start from the dateFrom and move backward only on available period. If the dateFrom (param in) is not a available TechDataCalendar period, the startDate is the end of the previous day available

Parameters:
techDataCalendar - The TechDataCalendar cover
dateFrom - the start date
amount - the amount of millisecond to move backward
Returns:
the dateTo