fix(oversigt): kædeflows uden traktor foldet sammen, 'mangler traktor/vogn' som status (v1.61.12.0)

This commit is contained in:
2026-09-30 21:30:45 +02:00
parent 6b533e62eb
commit 991252848f
6 changed files with 32 additions and 8 deletions
+5
View File
@@ -83,6 +83,11 @@ function ADFlowView.shortVehicleName(name)
return short
end
-- Kædeflow uden traktor (venter på en ledig traktor/vogn).
function ADFlowView.isIdleChain(run)
return run.chain ~= nil and run.chain ~= "" and #(run.vehicleIds or {}) == 0
end
-- Kædeflows uden traktor foldes sammen i listen (de venter på en ledig traktor/vogn). -> active, idle
function ADFlowView.splitIdle(runs)
local active, idle = {}, {}
+23 -7
View File
@@ -64,7 +64,9 @@ function SmartPickupFrame:flowCells(adEnv, run)
elseif row.reason ~= nil then
status = row.reason
end
local name = (run.id == self.selectedRunId and "> " or "") .. tostring(run.name)
-- kædeflow uden traktor: sig hvorfor det står stille i stedet for flowets regel
if ADFlowView.isIdleChain(run) then status = i18n:getText("spu_flow_chainIdle") end
local name = (run.id == self.selectedRunId and "> " or "") .. ADFlowView.listName(run)
return {name, products, from, to, string.format("%d/%d", row.running, row.total), status}
end
@@ -103,15 +105,29 @@ function SmartPickupFrame:fillOverviewRows(adEnv)
local i18n = self.i18n
self:addTextRow(i18n:getText("spu_overview_hint"))
self:addCellRow(self.flowPrefab, {i18n:getText("spu_col_flow"), i18n:getText("spu_col_goods"), i18n:getText("spu_col_from"), i18n:getText("spu_col_to"), i18n:getText("spu_col_tractors"), i18n:getText("spu_col_status")})
local function addBoardRow(run)
local cells = self:addCellRow(self.flowPrefab, self:flowCells(adEnv, run))
if cells[1] ~= nil and cells[1].parent ~= nil then
local runId = run.id
self:makeRowClickable(cells[1].parent, function(frame) frame:openFlow(runId) end)
end
table.insert(self.overviewRows, {runId = run.id, cells = cells})
end
for _, group in ipairs(ADFlowView.boardGroups(ADRunsController.store.runs)) do
self:addTextRow(i18n:getText(group.chain and "spu_board_chain" or group.kind == "outbound" and "spu_board_outbound" or "spu_board_supply"))
for _, run in ipairs(group.runs) do
local cells = self:addCellRow(self.flowPrefab, self:flowCells(adEnv, run))
if cells[1] ~= nil and cells[1].parent ~= nil then
local runId = run.id
self:makeRowClickable(cells[1].parent, function(frame) frame:openFlow(runId) end)
local runs, idle = group.runs, {}
-- kædeflows uden traktor foldes sammen som i Flows-listen (in-game 30/9)
if group.chain then runs, idle = ADFlowView.splitIdle(group.runs) end
for _, run in ipairs(runs) do addBoardRow(run) end
if #idle > 0 then
local key = self.showIdleChainFlows and "spu_board_chainIdleHide" or "spu_board_chainIdleShow"
self:addLinkRow(" " .. string.format(i18n:getText(key), #idle), function(frame)
frame.showIdleChainFlows = not frame.showIdleChainFlows
frame:requestRebuild()
end)
if self.showIdleChainFlows then
for _, run in ipairs(idle) do addBoardRow(run) end
end
table.insert(self.overviewRows, {runId = run.id, cells = cells})
end
end
if #ADRunsController.store.runs == 0 then
+1
View File
@@ -352,6 +352,7 @@
<text name="spu_flow_noTarget" text="(intet mål)"/>
<text name="spu_flow_noVehicle" text="(ingen traktor)"/>
<text name="spu_flow_ruleSellAlways" text="sælg altid"/>
<text name="spu_flow_chainIdle" text="mangler traktor/vogn"/>
<text name="spu_flow_ruleSell" text="pris >= %d %%"/>
<text name="spu_flow_ruleStore" text="lager > %d %%"/>
<text name="spu_flow_ruleOut" text="pris >= %d %%, lager > %d %%"/>
+1
View File
@@ -352,6 +352,7 @@
<text name="spu_flow_noTarget" text="(no target)"/>
<text name="spu_flow_noVehicle" text="(no tractor)"/>
<text name="spu_flow_ruleSellAlways" text="always sell"/>
<text name="spu_flow_chainIdle" text="needs a tractor/trailer"/>
<text name="spu_flow_ruleSell" text="price >= %d %%"/>
<text name="spu_flow_ruleStore" text="storage > %d %%"/>
<text name="spu_flow_ruleOut" text="price >= %d %%, storage > %d %%"/>
+1 -1
View File
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<modDesc descVersion="107">
<author>masterdraco</author>
<version>1.61.11.0</version>
<version>1.61.12.0</version>
<title>
<en>AD Smart Pickup</en>
</title>