fix(silo): varer = læssestationens pulje (tom mælketank med fuld pulje viste ingen mælk -> noProducts); sammenlægning af kilder kun for siloer, ikke staldes mælke/gyllepunkter (v1.17.4.0)

This commit is contained in:
2026-09-24 04:01:26 +02:00
parent edf6805cac
commit c0f523700e
7 changed files with 51 additions and 4 deletions
+21
View File
@@ -549,6 +549,8 @@ do
local st1, st2 = sources[1].station, sources[2].station
sources[1].station = {name = "tankA", sourceStorages = {[pool] = pool}}
sources[2].station = {name = "tankB", sourceStorages = {[pool] = pool}}
local k1, k2 = sources[1].kind, sources[2].kind
sources[1].kind, sources[2].kind = "silo", "silo"
local vPool = newVehicle("Tank", 0, 0, 10000)
runs[vPool] = outboundRun(77, {1, 2}, {{fillType = "SUGAR", policy = "sell"}}, {collectRound = true})
local inputPool = ADOutbound.buildPlanInput(adEnv, runs[vPool], vPool)
@@ -559,6 +561,25 @@ do
check("O-pool kun første kilde", table.concat(ids, ","), "1")
check("O-pool logget", lastLog("deler lager") ~= nil, true)
sources[1].station, sources[2].station = st1, st2
sources[1].kind, sources[2].kind = k1, k2
end
-- O-pool-stald: mælke- og gyllemarkør ved samme stald deler lager, men er forskellige læssepunkter
do
local pool = {}
sources[31] = {kind = "husbandry", wayPointId = 31, station = {name = "barnSlurry", sourceStorages = {[pool] = pool}}, name = "Stald"}
sources[32] = {kind = "husbandry", wayPointId = 32, station = {name = "barnMilk", sourceStorages = {[pool] = pool}}, name = "Stald"}
products[31] = {{fillType = SUGAR_FT or 5, name = "SUGAR", title = "Sukker", available = 20000, level = 20000, capacity = 50000, isPallet = false}}
products[32] = {{fillType = SUGAR_FT or 5, name = "SUGAR", title = "Sukker", available = 20000, level = 20000, capacity = 50000, isPallet = false}}
local vBarn = newVehicle("Tank2", 0, 0, 10000)
runs[vBarn] = outboundRun(78, {31, 32}, {{fillType = "SUGAR", policy = "sell"}}, {collectRound = true})
local inputBarn = ADOutbound.buildPlanInput(adEnv, runs[vBarn], vBarn)
local ids = {}
for _, product in ipairs(inputBarn.products) do
for _, source in ipairs(product.sources) do table.insert(ids, tostring(source.wayPointId)) end
end
check("O-pool-stald: stalde lægges ikke sammen", table.concat(ids, ","), "31,32")
sources[31], sources[32], products[31], products[32] = nil, nil, nil, nil
end
print(failures == 0 and "\nALLE TESTS OK" or ("\n" .. failures .. " FEJL"))
+7
View File
@@ -370,6 +370,13 @@ check("S14b stald + udvidelsestank", products14b[1].level, 138187)
check("S14b tilgængeligt = samlet", products14b[1].available, 138187)
milkStation.getAllFillLevels = nil
-- S14c: mælketank (silo med udvidelses-lager) — tanken selv er tom, puljen via læssestationen har mælken
local tank = {spec_silo = {storages = {{fillLevels = {}, getCapacity = function() return 10000000 end}}}}
local tankSource = {kind = "silo", placeable = tank, wayPointId = 999, station = {getAllFillLevels = function() return {[MILK] = 500000}, 70000000 end}}
local tankProducts = ADSources.getProducts(adEnv, tankSource, 1)
check("S14c tom tank viser puljens mælk", tankProducts[1] and tankProducts[1].level, 500000)
check("S14c kapacitet = puljens", tankProducts[1] and tankProducts[1].capacity, 70000000)
-- S15: forklaring af en markør til advarslen (hvad opslaget ser)
check("S15 forklaring stald", ADSources.explainMarker(adEnv, 10, 1), "læssestation ved markøren hører til 'Kostald' (stald)")
check("S15 forklaring ingen station", ADSources.explainMarker(adEnv, 4, 1), "ingen læssestation ved markøren, og ingen fabrik/objektlager inden for 40 m")