Batch separation rules

Batch separation rules are the part of a batch definition that specifies how arriving loads are to be separated into batch loads. The batch separation function associated with the rule is called for each load that arrives at a batching operation.

You can create a custom batch separation rule and its corresponding function. Your function can have any name that is not a standard system function name. The function must accept two arguments in the following order:

  1. A pointer to the arriving load, Type: LOAD*.
  2. A pointer to the batch definition specified on the operation, Type: BATCHDEF*.

Your function should return a pointer to a suitable batch load from the batch definition’s list (Type: FORMBAT *) of forming loads or NULL if none exists. The forming batch load that your function selects should meet your requirements for separation and must not cause the forming batch quantity to exceed the maximum release quantity. If NULL is returned, the system will create a new forming batch load for the arriving load. Here is an example of a batch separation function:


FORMBAT *bsrl (LOAD *ldp, BATCHDEF *batch)
/*-----------------------------------------------------------------
   Function that processes the batch selection rule 1, which is
   to separate arriving loads into different batches with the same
   part number.
   ARGS:
    ldp  - pointer to load to find forming batch instance for
    batch - batch definition
   RETURNS: 
    forming batch entity to put ldp into, or 
     NULL if no appropriate batch load is forming
-----------------------------------------------------------------*/
{
   FORMBAT *fb;

   /* Look at each forming batch in the batch definition. */
   for(fb = (FORMBAT *) csfsls(batch->btfmls);
     fb != NULL;
     fb = (FORMBAT *) csnxls((CSENTITY *) fb)) 
   {
     /* Return this forming batch if its children have the same
      part as the load passed in, and the new quantity will be
      less or equal to the maximum. */
     if((strcmp(fb->fbldp->loordp->orptpt->panum,
          ldp->loordp->orptpt->panum) == 0) &&
      (fb->fbquant + sequfb(ldp, batch, batch->btqurl)
      <= batch->btmax))
     {
      return(fb);
     }
   }

   /* return null if we couldn't find one. */
   return(NULL);
}

To make your customized batch separation function available to the Scheduler, you must “install” it from the first user-initialization function ucini1 by calling the function sedfbs. The function sedfbs has two arguments in the following order:

  1. The number of the batch separation rule for which your function contains tailored logic.
  2. The address of your batch separation function