Trying to figure out if this is a bug, a feature or inherent in the design of the manufacturing module:
On the Production order’s operations, there are four fields related to start and end dates for the operation:
- Start Date
- End Date
- Actual Start Date
- Actual End Date
The first two always show the start and end dates of the production order.
The other two with the word “Actual” I would assume would get set as follows:
- When the first transaction for the operation is performed, the Actual Start Date is set to the date on the transaction
- When a transaction is performed that completes the qty to produce and sets the operation status to completed, the Actual End Date is set to the date of the transaction
In other words, these fields are logically set on the first and last operations of the production order.
However this is not what happens. On a clean install of 2023R2 Update 1, this is the behavior:
When a labor transaction is released, regardless of the date on the labor transaction, the Actual Start Date is always set to the current day:
Likewise, if the labor transaction completes the operation, the Actual End Date is always set to the current day, regardless of the date on the labor transaction:
The strangest behavior of all is this: When subsequent labor transactions are completed, the end date of all prior labor transactions is set to the current date.
(for the sake of illustration, I manually updated the Actual Start Date and Actual End Date to the dates that were on the labor transactions)
Before releasing operation 0020
After completing Operation 0020
Looking at the code ProductionTransactionHelper.cs reveals this:
This is inside a foreach loop for all the production order operations. Since this indiscriminately sets this to the current date, this is why we have this result.
And in ProdMaintBase.cs, we have this:
This is called for each operation and again, it is setting the dates to the current date which gives the result we see.
Why is this being set this way? Actual should mean...Actual…
The only way to get accurate production reporting data on an operation level as far as I know, is to join to the labor transactions and get the actual dates completed. This is messy because if you have multiple transactions for an operation, you have to group by and select last and first transactions etc.