In PanelSaw migliorata gestione scrittura dati. Dato F7 uniformato a F1 e F2. Versione funzionante, testata in macchina.

This commit is contained in:
andrea.villa
2025-09-18 11:30:16 +02:00
parent fc5071a9ae
commit bc467fc784
+10 -23
View File
@@ -80,18 +80,18 @@ local function GetProjectInfo()
return ProjectInfo
end
local function GetFormattedLine( Table, LineToPrint)
local function GetFormattedLine( ValuesList, ValuesPlaceholders, FieldFixLength)
local sLine = ''
local Values = Table.ValuesList[LineToPrint]
local Values = ValuesList
local nPos = 1 -- posizione partenza linea
for j, Value in ipairs( Values) do
local Placeholder = Table.ValuesPlaceholders[j]
local Placeholder = ValuesPlaceholders[j]
local sFormatted = string.format( Placeholder, Value)
-- se il campo ha lunghezza fissa, si aggiungono spazi
if Table.FieldFixLength and Table.FieldFixLength[j] then
local sFieldLength = Table.FieldFixLength[j]
if FieldFixLength and FieldFixLength[j] then
local sFieldLength = FieldFixLength[j]
-- troncamento se troppo lungo
if #sFormatted > sFieldLength then
sFormatted = string.sub( sFormatted, 1, sFieldLength)
@@ -166,19 +166,7 @@ local function BuildCuttingList_Cutty( PanelList, SheetList, ProjectInfo)
{ 164, 164},
{ 150, 150}
},
ValuesPlaceholders = {
{ '%s', '%s'},
{ '%s', '%s'},
{ '%s', '%s'},
{ '%s', '%s'},
{ '%s', '%s'},
{ '%s', '%s'},
{ '%s', '%s'},
{ '%s', '%s'},
{ '%s', '%s'},
{ '%s', '%s'},
{ '%s', '%s'}
}
ValuesPlaceholders = { '%s', '%s'}
}
local F7b = {
@@ -224,7 +212,7 @@ local function BuildCuttingList_Cutty( PanelList, SheetList, ProjectInfo)
-- F1 - sheets
table.insert( Lines, string.format( table.concat( F1.HeaderPlaceholders, ' '), table.unpack( F1.Header)))
for i = 1, #F1.ValuesList do
local sLine = GetFormattedLine( F1, i)
local sLine = GetFormattedLine( F1.ValuesList[i], F1.ValuesPlaceholders, F1.FieldFixLength)
table.insert( Lines, sLine)
end
@@ -234,7 +222,7 @@ local function BuildCuttingList_Cutty( PanelList, SheetList, ProjectInfo)
-- F2 - panels
table.insert( Lines, string.format( table.concat( F2.HeaderPlaceholders, ' '), table.unpack( F2.Header)))
for i = 1, #F2.ValuesList do
local sLine = GetFormattedLine( F2, i)
local sLine = GetFormattedLine( F2.ValuesList[i], F2.ValuesPlaceholders, F2.FieldFixLength)
table.insert( Lines, sLine)
end
@@ -244,9 +232,8 @@ local function BuildCuttingList_Cutty( PanelList, SheetList, ProjectInfo)
-- F7
table.insert( Lines, string.format( table.concat( F7.HeaderPlaceholders, ' '), table.unpack( F7.Header)))
for i = 1, #F7.ValuesList do
local Values = F7.ValuesList[i]
local Placeholders = F7.ValuesPlaceholders[i]
table.insert( Lines, string.format( table.concat( Placeholders, ' '), table.unpack( Values)))
local sLine = GetFormattedLine( F7.ValuesList[i], F7.ValuesPlaceholders, F7.FieldFixLength)
table.insert( Lines, sLine)
end
-- linea vuota