Erp.LaborHead TranSet usage

I’m building a function that will be an integration point for a new application we are implementing for scheduling and managing our rotomolding process. This function has 2 purposes. It will do a kanban receipt for certain scrap operations and will make Time and Expense entries for labor Qty and Scrap Qty associated with a job.

As I’m working designing this process based on trace logs, I’m uncertain about the logic for when a new LaborHed record is expected for the same employee on the same payroll date. I understand that different clock in and clock out times require new LaborHed records but that isn’t pertinent to my observation and question.

I’ve run tests on 2 different scenarios that have provided results that are puzzling.

Scenario 1:

  1. Use Kanban receipt to report scrap on a part for User1.
  2. Wait for the submission to process through so the LaborHed record can be queried in SQL.
  3. Use Time and Expense Entry to add a “New Time Detail” for User1.
  4. Enter Job, Operation, Labor Qty and then submit.
  5. Query LaborHed for records for User1.The query result shows 1 record for User 1 with a TranSet value of Kanban.
    Query LaborDtl for records related to the LaborHed record found in step 5. The result shows 2 records. One for the kanban receipt and one for the time and expense entry.

Scenario 2:

  1. Use Time and Expense Entry to add a new Time Detail for User2.
  2. Enter Job, Operation, Labor Qty and then submit.
  3. Use Kanban receipt to report scrap on a part for User2.
  4. Query LaborHed for records for User2. The query result shows 2 records for User2. The first (lowest LaborHedSeq) has a blank TranSet value. The second record has a TranSet value of Kanban. The only other difference between the 2 records is the Feed Payroll value on the first record is 1 vs 0 in the second record.
  5. Query LaborDtl for records related to the 2 LaborHed records found in step 5. The result shows 2 records, one for each of the LaborHed records.

Does anyone know why the behavior seems to differ based on the order of entry?

Since the GetNewLaborDtlWithHdr method requires the LaborHedSeq as an input, it seems important to understand how to pick the right one…

Thanks