feat(diagnose): palleskur-afvisning i 'Lager til' siger præcis grund (siger nej til varen / fuldt / ingen vej / ingen markør) (v1.19.5.0)
This commit is contained in:
@@ -187,19 +187,30 @@ local function findStoreMarker(adEnv, vehicle, product, capacity, sources, liter
|
||||
if product.isPallet then
|
||||
-- "Lager til" med palleskure: første valgte der tager varen, har plads og kan nås
|
||||
local forcedSheds = run ~= nil and ADRunsController ~= nil and ADRunsController.getStoreBuildings ~= nil and ADRunsController.getStoreBuildings(adEnv, run) or {}
|
||||
local hasForcedShed = false
|
||||
local hasForcedShed, reasons = false, {}
|
||||
for _, building in ipairs(forcedSheds) do
|
||||
if building.kind == "objectStorage" then
|
||||
hasForcedShed = true
|
||||
local marker = building.unloadMarker or building.loadMarker
|
||||
if marker ~= nil and ADSources.objectStorageAccepts(building.placeable, product.fillType)
|
||||
and ADSources.objectStorageFreeSlots(building.placeable) >= 1 and isReachable(marker.id) then
|
||||
return {wayPointId = marker.id, name = tostring(building.name), free = ADSources.objectStorageFreeSlots(building.placeable)}
|
||||
local free = ADSources.objectStorageFreeSlots(building.placeable)
|
||||
local why = nil
|
||||
if marker == nil then
|
||||
why = "ingen markør"
|
||||
elseif not ADSources.objectStorageAccepts(building.placeable, product.fillType) then
|
||||
why = "palleskuret siger nej til varen"
|
||||
elseif free < 1 then
|
||||
why = "fuldt"
|
||||
elseif not isReachable(marker.id) then
|
||||
why = "ingen vej til '" .. tostring(marker.name) .. "'"
|
||||
end
|
||||
if why == nil then
|
||||
return {wayPointId = marker.id, name = tostring(building.name), free = free}
|
||||
end
|
||||
table.insert(reasons, string.format("%s: %s (%d ledige pladser)", tostring(building.name), why, free == math.huge and -1 or free))
|
||||
end
|
||||
end
|
||||
if hasForcedShed then
|
||||
warnOnce(adEnv, vehicle, "forcedShed:" .. tostring(product.name), string.format("'%s': %s kan ikke sættes på lager — intet af de valgte palleskure tager varen, har plads og kan nås", tostring(ADRuns.vehicleLabel(vehicle)), tostring(product.name)))
|
||||
warnOnce(adEnv, vehicle, "forcedShed:" .. tostring(product.name) .. ":" .. table.concat(reasons, ";"), string.format("'%s': %s kan ikke sættes på lager — %s", tostring(ADRuns.vehicleLabel(vehicle)), tostring(product.name), table.concat(reasons, "; ")))
|
||||
return nil
|
||||
end
|
||||
if ADSources.findPalletStore == nil then
|
||||
|
||||
Reference in New Issue
Block a user