frePPLe / frepple

frePPLe - open source supply chain planning
https://frepple.com
Other
527 stars 252 forks source link

ForeignKeyViolation in operationplanresource_operationplan_id_fkey #578

Open zipus opened 1 year ago

zipus commented 1 year ago
INFO Finished 'Generate supply plan' at 08:10:57 

INFO Start step 400 'Erasing previous plan' at 08:10:57
INFO Finished 'Erasing previous plan' at 08:10:58 

INFO Start step 401 'Export plan' at 08:10:58
INFO Start step export2 1 'Exporting resource plans' at 08:10:58
INFO Start step export1 1 'Exporting operationplans' at 08:10:58
INFO Finished 'Exporting resource plans' at 08:10:58 
INFO Start step export2 2 'Exporting problems' at 08:10:58
INFO Finished 'Exporting problems' at 08:10:58 
INFO Start step export2 3 'Exporting constraints' at 08:10:58
INFO Finished 'Exporting constraints' at 08:10:58 
INFO Finished 'Exporting operationplans' at 08:10:58 
INFO Start step export1 2 'Exporting operationplan materials' at 08:10:58
INFO Finished 'Exporting operationplan materials' at 08:10:58 
INFO Start step export1 3 'Exporting operationplan resources' at 08:10:58
ERROR Exception caught on thread export1
Error during planning: insert or update on table "operationplanresource" violates foreign key constraint "operationplanresource_operationplan_id_fkey"
DETAIL:  Key (operationplan_id)=(47227) is not present in table "operationplan".

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3/dist-packages/freppledb/common/commands.py", line 546, in <module>
    register.run(database=database)
  File "/usr/lib/python3/dist-packages/freppledb/common/commands.py", line 489, in run
    cls.reg.run(**cls.arguments)
  File "/usr/lib/python3/dist-packages/freppledb/common/commands.py", line 217, in run
    step.run(**PlanTaskRegistry.getArguments())
  File "/usr/lib/python3/dist-packages/freppledb/common/commands.py", line 336, in run
    raise t.exception
  File "/usr/lib/python3/dist-packages/freppledb/common/commands.py", line 298, in run
    self.seq.run(**self.kwargs)
  File "/usr/lib/python3/dist-packages/freppledb/common/commands.py", line 217, in run
    step.run(**PlanTaskRegistry.getArguments())
  File "/usr/lib/python3/dist-packages/freppledb/output/commands.py", line 1178, in run
    sep="\v",
psycopg2.errors.ForeignKeyViolation: insert or update on table "operationplanresource" violates foreign key constraint "operationplanresource_operationplan_id_fkey"
DETAIL:  Key (operationplan_id)=(47227) is not present in table "operationplan".

Error: Error executing Python command
zipus commented 1 year ago

The same sale orders is well planned when plan.administrativeLeadtime is set to 0, but when setting to 999 results in this crash. Now that is isolated that this parameter is causing this, do you have any ideas about the cause?

Attached log result with 999 parameter. frepple-20230216101844.log