feat: kæden planlægger hø og ensilage — græs med produkt, mangel/afvisning pr. vare (v1.62.29)

This commit is contained in:
2026-10-05 14:01:11 +02:00
parent 59022e99d9
commit 9971cdde8d
12 changed files with 144 additions and 61 deletions
+4 -3
View File
@@ -57,12 +57,13 @@ function ADChainRun.switchFields(data, actions)
local field = fieldById(data.fields, action.fieldId)
-- brugerens egen målafgrøde røres aldrig (dobbelttjek oven i ADCropPlan)
if action.mode == "auto" and field ~= nil and field.targetSource ~= "user" then
local ok, err = pcall(ADFieldJobs.setTarget, action.fieldId, action.to, "chain")
local ok, err = pcall(ADFieldJobs.setTarget, action.fieldId, action.to, "chain", action.product)
if ok then
switched = switched + 1
ADChain.switchCount = ADChain.switchCount + 1
local text = string.format("F%s: %s -> %s (%.1f ha) til %s", tostring(action.fieldId), tostring(action.from),
tostring(action.to), action.hectares or 0, tostring(action.reason))
local text = string.format("F%s: %s -> %s%s (%.1f ha) til %s", tostring(action.fieldId), tostring(action.from),
tostring(action.to), action.product ~= nil and (" (" .. tostring(action.product) .. ")") or "", action.hectares or 0,
tostring(action.reason))
log("%s", text)
pcall(ADFieldJobs.notify, text, false)
else