Class TechDataServices

java.lang.Object
org.apache.ofbiz.manufacturing.techdata.TechDataServices

public class TechDataServices extends Object
TechDataServices - TechData related Services
  • Constructor Details

    • TechDataServices

      public TechDataServices()
  • Method Details

    • lookupRoutingTask

      public static Map<String,Object> lookupRoutingTask(DispatchContext ctx, Map<String,? extends 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 Map<String,Object> checkRoutingTaskAssoc(DispatchContext ctx, Map<String,? extends 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 Map<String,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, 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 Map<String,Object> startNextDay(GenericValue techDataCalendar, 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 Timestamp addForward(GenericValue techDataCalendar, 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 Map<String,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, 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 Map<String,Object> endPreviousDay(GenericValue techDataCalendar, 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 Timestamp addBackward(GenericValue techDataCalendar, 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