feat: bulk-vare der også står på paller (sukkerfabrik) tages som paller af en UAL-vogn, som bulk af en tipvogn (v1.12.3.0)

This commit is contained in:
2026-09-23 11:28:14 +02:00
parent 2ff8e46306
commit 27095ec6ff
6 changed files with 46 additions and 8 deletions
+10 -3
View File
@@ -195,17 +195,24 @@ function ADOutbound.buildPlanInput(adEnv, run, vehicle)
for _, source in ipairs(sources) do
for _, item in ipairs(ADSources.getProducts(adEnv, source, farmId)) do
local policy = ADRuns.getProductPolicy(run, item.name)
local canCarry = (item.isPallet and hasAutoload) or (not item.isPallet and carriable[item.fillType] == true)
-- bulk hvis vognen kan bære varen; ellers paller hvis varen står på paller og vognen har UAL
-- (en pallebil ved sukkerfabrikken tager sukkerpallerne, en tipvogn tager bulk)
local usePallets = item.isPallet or (carriable[item.fillType] ~= true and hasAutoload and item.canPallet == true)
local canCarry = usePallets and hasAutoload or (not usePallets and carriable[item.fillType] == true)
local available = item.available
if usePallets and not item.isPallet then
available = item.palletLiters or 0
end
local emptyKey = tostring(source.wayPointId) .. ":" .. tostring(item.fillType)
local isMarkedEmpty = emptyUntil[emptyKey] ~= nil and emptyUntil[emptyKey] > time
if policy ~= "off" and canCarry and not isMarkedEmpty then
local product = byName[item.name]
if product == nil then
product = {fillType = item.fillType, name = item.name, policy = policy, isPallet = item.isPallet, sources = {}}
product = {fillType = item.fillType, name = item.name, policy = policy, isPallet = usePallets, sources = {}}
byName[item.name] = product
table.insert(products, product)
end
table.insert(product.sources, {wayPointId = source.wayPointId, available = item.available, level = item.level, capacity = item.capacity})
table.insert(product.sources, {wayPointId = source.wayPointId, available = available, level = item.level, capacity = item.capacity})
end
end
end