Merge branch 'develop'
This commit is contained in:
@@ -450,5 +450,17 @@
|
||||
"maxVal": 999999999,
|
||||
"unit": "#"
|
||||
}
|
||||
},
|
||||
"fileDecod": {
|
||||
"Product": 3,
|
||||
"Variety": 9,
|
||||
"Supplier": 8,
|
||||
"ExtDoc": 2,
|
||||
"DateRif": 14,
|
||||
"QtyTot": 22,
|
||||
"NumPack": 21,
|
||||
"NumPed": 17,
|
||||
"PackPed": 18,
|
||||
"PesoPack": 20
|
||||
}
|
||||
}
|
||||
@@ -45,6 +45,6 @@ CLI_INST=SteamWareSim
|
||||
;STARTLIST=BAGLIETTO_CIMOLAI_01
|
||||
;STARTLIST=SIMUL_01
|
||||
;STARTLIST=GIACO_SAIM_003
|
||||
STARTLIST=GIACO_SAIM_003
|
||||
STARTLIST=SIMUL_01
|
||||
|
||||
MAXCNC=10
|
||||
@@ -85,15 +85,15 @@
|
||||
}
|
||||
},
|
||||
"fileDecod": {
|
||||
"Product": 2,
|
||||
"Variety": 3,
|
||||
"Supplier": 4,
|
||||
"ExtDoc": 0,
|
||||
"DateRif": 1,
|
||||
"QtyTot": 15,
|
||||
"NumPack": 14,
|
||||
"NumPed": 11,
|
||||
"PackPed": 12,
|
||||
"PesoPack": 13
|
||||
"Product": 3,
|
||||
"Variety": 9,
|
||||
"Supplier": 8,
|
||||
"ExtDoc": 2,
|
||||
"DateRif": 14,
|
||||
"QtyTot": 22,
|
||||
"NumPack": 21,
|
||||
"NumPed": 17,
|
||||
"PackPed": 18,
|
||||
"PesoPack": 20
|
||||
}
|
||||
}
|
||||
@@ -83,5 +83,17 @@
|
||||
"minVal": 0,
|
||||
"maxVal": 1500
|
||||
}
|
||||
},
|
||||
"fileDecod": {
|
||||
"Product": 2,
|
||||
"Variety": 3,
|
||||
"Supplier": 4,
|
||||
"ExtDoc": 0,
|
||||
"DateRif": 1,
|
||||
"QtyTot": 15,
|
||||
"NumPack": 14,
|
||||
"NumPed": 11,
|
||||
"PackPed": 12,
|
||||
"PesoPack": 13
|
||||
}
|
||||
}
|
||||
@@ -1508,16 +1508,63 @@ namespace IOB_WIN_NEXT
|
||||
break;
|
||||
|
||||
case modBusAddrType.InputRegister:
|
||||
listInt = readInputReg(item.Value.index, item.Value.size);
|
||||
if (item.Value.tipoMem == plcDataType.String)
|
||||
if (useLUT)
|
||||
{
|
||||
// valore string...
|
||||
valString = ModbusClient.ConvertRegistersToString(listInt, 0, item.Value.size);
|
||||
int lutAddress = 30000 + item.Value.index + deltaBase + indexLutCorr;
|
||||
// se size = 1 --> devo cambiare modo recupero
|
||||
if (item.Value.size == 1)
|
||||
{
|
||||
//if (item.Value.index % 2 == 0)
|
||||
if (lutAddress % 2 == 0)
|
||||
{
|
||||
//Array.Copy(HoldingRegisterLUT[lutAddress], listInt, 1);
|
||||
Array.Copy(InputRegisterLUT[lutAddress], 0, listInt, 0, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
lutAddress--;
|
||||
Array.Copy(InputRegisterLUT[lutAddress], 1, listInt, 0, 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (InputRegisterLUT.ContainsKey(lutAddress))
|
||||
{
|
||||
try
|
||||
{
|
||||
if (listInt.Length == 2)
|
||||
{
|
||||
listInt = InputRegisterLUT[lutAddress];
|
||||
}
|
||||
else
|
||||
{
|
||||
// faccio ciclo x copiare 2 alla volta...
|
||||
for (int i = 0; i < listInt.Length; i += 2)
|
||||
{
|
||||
Array.Copy(InputRegisterLUT[lutAddress + i], 0, listInt, i, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
lgError($"Errore in lettura da InputRegisterLUT per indirizzo {lutAddress} | item {item.Key}{Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// valori numerici...
|
||||
valore = convertFromReg(listInt, item.Value.size, item.Value.tipoMem);
|
||||
listInt = readInputReg(item.Value.index, item.Value.size);
|
||||
if (item.Value.tipoMem == plcDataType.String)
|
||||
{
|
||||
// valore string...
|
||||
valString = ModbusClient.ConvertRegistersToString(listInt, 0, item.Value.size);
|
||||
}
|
||||
else
|
||||
{
|
||||
// valori numerici...
|
||||
valore = convertFromReg(listInt, item.Value.size, item.Value.tipoMem);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -1565,7 +1612,6 @@ namespace IOB_WIN_NEXT
|
||||
lgError($"Errore in lettura da HoldingRegisterLUT per indirizzo {lutAddress} | item {item.Key}{Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
// altrimenti cerco swappando a -1...
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -223,53 +223,68 @@ namespace IOB_WIN_NEXT
|
||||
double qtyTot = 0;
|
||||
int numPack = 0;
|
||||
string ddt = tabella.Rows[i].ItemArray[FileDecod["ExtDoc"]].ToString().Trim();
|
||||
string prod = tabella.Rows[i].ItemArray[FileDecod["Product"]].ToString().Trim();
|
||||
string variety = tabella.Rows[i].ItemArray[FileDecod["Variety"]].ToString().Trim();
|
||||
string suppl = tabella.Rows[i].ItemArray[FileDecod["Supplier"]].ToString().Trim();
|
||||
string sDate = tabella.Rows[i].ItemArray[FileDecod["DateRif"]].ToString().Trim();
|
||||
string sQty = tabella.Rows[i].ItemArray[FileDecod["QtyTot"]].ToString().Trim();
|
||||
string sNum = tabella.Rows[i].ItemArray[FileDecod["NumPack"]].ToString().Trim();
|
||||
string numPed = tabella.Rows[i].ItemArray[FileDecod["NumPed"]].ToString().Trim();
|
||||
string packPed = tabella.Rows[i].ItemArray[FileDecod["PackPed"]].ToString().Trim();
|
||||
string pesoPack = tabella.Rows[i].ItemArray[FileDecod["PesoPack"]].ToString().Trim();
|
||||
DateTime.TryParse(sDate, out dtRif);
|
||||
int.TryParse(sNum, out numPack);
|
||||
double.TryParse(sQty, out qtyTot);
|
||||
string identRG = ddt.Length > 2 ? $"{strFixId(ddt)}.{strFixId(prod)}.{strFixId(variety)}.{strFixId(suppl)}" : $"{dtRif:yyyyMMdd}.{strFixId(prod)}.{strFixId(variety)}.{strFixId(suppl)}";
|
||||
string notes = $"{numPed}x{packPed}x{pesoPack}";
|
||||
// verifico di avere dati per proseguire...
|
||||
bool checkIdent = !string.IsNullOrEmpty($"{prod}{variety}{suppl}");
|
||||
string prod = tabella.Rows[i].ItemArray[FileDecod["Product"]].ToString().Trim();
|
||||
// verifiche x import: header, data e DDT (vuoti o "-") --> SKIP!
|
||||
bool checkHeaderKo = (ddt == "DDT" || prod == "PRODOTTO");
|
||||
if (checkIdent && !checkHeaderKo)
|
||||
bool checkEmptyDdt = (string.IsNullOrEmpty(ddt) || ddt == "-");
|
||||
bool checkEmptyDate = (string.IsNullOrEmpty(sDate) || sDate == "-");
|
||||
if (checkHeaderKo)
|
||||
{
|
||||
BatchRec newRow = new BatchRec()
|
||||
{
|
||||
IdxODL = idxODL,
|
||||
IdentRG = identRG,
|
||||
DateRif = dtRif,
|
||||
ExtDoc = ddt,
|
||||
Product = prod,
|
||||
Variety = variety,
|
||||
Supplier = suppl,
|
||||
NumPack = numPack,
|
||||
QtyTot = qtyTot,
|
||||
Notes = notes
|
||||
};
|
||||
// verifico: se manca aggiungo
|
||||
if (!listaGiac.ContainsKey(identRG))
|
||||
{
|
||||
listaGiac.Add(identRG, newRow);
|
||||
}
|
||||
else
|
||||
{
|
||||
// altrimenti aggiorno giacenza con valori numerici
|
||||
listaGiac[identRG].NumPack += newRow.NumPack;
|
||||
listaGiac[identRG].QtyTot += newRow.QtyTot;
|
||||
}
|
||||
lgTrace($"SKIP header");
|
||||
}
|
||||
else if (checkEmptyDdt || checkEmptyDate)
|
||||
{
|
||||
lgTrace($"SKIP linea vuota | i: {i} | ddt: {ddt} | date: {sDate} | prod: {prod}");
|
||||
}
|
||||
else
|
||||
{
|
||||
numErr++;
|
||||
string variety = tabella.Rows[i].ItemArray[FileDecod["Variety"]].ToString().Trim();
|
||||
string suppl = tabella.Rows[i].ItemArray[FileDecod["Supplier"]].ToString().Trim();
|
||||
string sQty = tabella.Rows[i].ItemArray[FileDecod["QtyTot"]].ToString().Trim();
|
||||
string sNum = tabella.Rows[i].ItemArray[FileDecod["NumPack"]].ToString().Trim();
|
||||
string numPed = tabella.Rows[i].ItemArray[FileDecod["NumPed"]].ToString().Trim();
|
||||
string packPed = tabella.Rows[i].ItemArray[FileDecod["PackPed"]].ToString().Trim();
|
||||
string pesoPack = tabella.Rows[i].ItemArray[FileDecod["PesoPack"]].ToString().Trim();
|
||||
DateTime.TryParse(sDate, out dtRif);
|
||||
int.TryParse(sNum, out numPack);
|
||||
double.TryParse(sQty, out qtyTot);
|
||||
string identRG = ddt.Length > 2 ? $"{strFixId(ddt)}.{strFixId(prod)}.{strFixId(variety)}.{strFixId(suppl)}" : $"{dtRif:yyyyMMdd}.{strFixId(prod)}.{strFixId(variety)}.{strFixId(suppl)}";
|
||||
string notes = $"{numPed}x{packPed}x{pesoPack}";
|
||||
// verifico di avere dati per proseguire...
|
||||
bool checkIdent = !string.IsNullOrEmpty($"{prod}{variety}{suppl}");
|
||||
if (checkIdent)
|
||||
{
|
||||
BatchRec newRow = new BatchRec()
|
||||
{
|
||||
IdxODL = idxODL,
|
||||
IdentRG = identRG,
|
||||
DateRif = dtRif,
|
||||
ExtDoc = ddt,
|
||||
Product = prod,
|
||||
Variety = variety,
|
||||
Supplier = suppl,
|
||||
NumPack = numPack,
|
||||
QtyTot = qtyTot,
|
||||
Notes = notes
|
||||
};
|
||||
// verifico: se manca aggiungo
|
||||
if (!listaGiac.ContainsKey(identRG))
|
||||
{
|
||||
listaGiac.Add(identRG, newRow);
|
||||
}
|
||||
else
|
||||
{
|
||||
// altrimenti aggiorno giacenza con valori numerici
|
||||
listaGiac[identRG].NumPack += newRow.NumPack;
|
||||
listaGiac[identRG].QtyTot += newRow.QtyTot;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
lgError($"Errore verifica identità riga | prod: {prod} | variety: {variety} | suppl: {suppl}");
|
||||
numErr++;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
|
||||
+56
-41
@@ -575,53 +575,68 @@ namespace IOB_WIN_NEXT
|
||||
double qtyTot = 0;
|
||||
int numPack = 0;
|
||||
string ddt = tabella.Rows[i].ItemArray[FileDecod["ExtDoc"]].ToString().Trim();
|
||||
string prod = tabella.Rows[i].ItemArray[FileDecod["Product"]].ToString().Trim();
|
||||
string variety = tabella.Rows[i].ItemArray[FileDecod["Variety"]].ToString().Trim();
|
||||
string suppl = tabella.Rows[i].ItemArray[FileDecod["Supplier"]].ToString().Trim();
|
||||
string sDate = tabella.Rows[i].ItemArray[FileDecod["DateRif"]].ToString().Trim();
|
||||
string sQty = tabella.Rows[i].ItemArray[FileDecod["QtyTot"]].ToString().Trim();
|
||||
string sNum = tabella.Rows[i].ItemArray[FileDecod["NumPack"]].ToString().Trim();
|
||||
string numPed = tabella.Rows[i].ItemArray[FileDecod["NumPed"]].ToString().Trim();
|
||||
string packPed = tabella.Rows[i].ItemArray[FileDecod["PackPed"]].ToString().Trim();
|
||||
string pesoPack = tabella.Rows[i].ItemArray[FileDecod["PesoPack"]].ToString().Trim();
|
||||
DateTime.TryParse(sDate, out dtRif);
|
||||
int.TryParse(sNum, out numPack);
|
||||
double.TryParse(sQty, out qtyTot);
|
||||
string identRG = ddt.Length > 2 ? $"{strFixId(ddt)}.{strFixId(prod)}.{strFixId(variety)}.{strFixId(suppl)}" : $"{dtRif:yyyyMMdd}.{strFixId(prod)}.{strFixId(variety)}.{strFixId(suppl)}";
|
||||
string notes = $"{numPed}x{packPed}x{pesoPack}";
|
||||
// verifico di avere dati per proseguire...
|
||||
bool checkIdent = !string.IsNullOrEmpty($"{prod}{variety}{suppl}");
|
||||
string prod = tabella.Rows[i].ItemArray[FileDecod["Product"]].ToString().Trim();
|
||||
// verifiche x import: header, data e DDT (vuoti o "-") --> SKIP!
|
||||
bool checkHeaderKo = (ddt == "DDT" || prod == "PRODOTTO");
|
||||
if (checkIdent && !checkHeaderKo)
|
||||
bool checkEmptyDdt = (string.IsNullOrEmpty(ddt) || ddt == "-");
|
||||
bool checkEmptyDate = (string.IsNullOrEmpty(sDate) || sDate == "-");
|
||||
if (checkHeaderKo)
|
||||
{
|
||||
BatchRec newRow = new BatchRec()
|
||||
{
|
||||
IdxODL = idxODL,
|
||||
IdentRG = identRG,
|
||||
DateRif = dtRif,
|
||||
ExtDoc = ddt,
|
||||
Product = prod,
|
||||
Variety = variety,
|
||||
Supplier = suppl,
|
||||
NumPack = numPack,
|
||||
QtyTot = qtyTot,
|
||||
Notes = notes
|
||||
};
|
||||
// verifico: se manca aggiungo
|
||||
if (!listaGiac.ContainsKey(identRG))
|
||||
{
|
||||
listaGiac.Add(identRG, newRow);
|
||||
}
|
||||
else
|
||||
{
|
||||
// altrimenti aggiorno giacenza con valori numerici
|
||||
listaGiac[identRG].NumPack += newRow.NumPack;
|
||||
listaGiac[identRG].QtyTot += newRow.QtyTot;
|
||||
}
|
||||
lgTrace($"SKIP header");
|
||||
}
|
||||
else if (checkEmptyDdt || checkEmptyDate)
|
||||
{
|
||||
lgTrace($"SKIP linea vuota | i: {i} | ddt: {ddt} | date: {sDate} | prod: {prod}");
|
||||
}
|
||||
else
|
||||
{
|
||||
numErr++;
|
||||
string variety = tabella.Rows[i].ItemArray[FileDecod["Variety"]].ToString().Trim();
|
||||
string suppl = tabella.Rows[i].ItemArray[FileDecod["Supplier"]].ToString().Trim();
|
||||
string sQty = tabella.Rows[i].ItemArray[FileDecod["QtyTot"]].ToString().Trim();
|
||||
string sNum = tabella.Rows[i].ItemArray[FileDecod["NumPack"]].ToString().Trim();
|
||||
string numPed = tabella.Rows[i].ItemArray[FileDecod["NumPed"]].ToString().Trim();
|
||||
string packPed = tabella.Rows[i].ItemArray[FileDecod["PackPed"]].ToString().Trim();
|
||||
string pesoPack = tabella.Rows[i].ItemArray[FileDecod["PesoPack"]].ToString().Trim();
|
||||
DateTime.TryParse(sDate, out dtRif);
|
||||
int.TryParse(sNum, out numPack);
|
||||
double.TryParse(sQty, out qtyTot);
|
||||
string identRG = ddt.Length > 2 ? $"{strFixId(ddt)}.{strFixId(prod)}.{strFixId(variety)}.{strFixId(suppl)}" : $"{dtRif:yyyyMMdd}.{strFixId(prod)}.{strFixId(variety)}.{strFixId(suppl)}";
|
||||
string notes = $"{numPed}x{packPed}x{pesoPack}";
|
||||
// verifico di avere dati per proseguire...
|
||||
bool checkIdent = !string.IsNullOrEmpty($"{prod}{variety}{suppl}");
|
||||
if (checkIdent)
|
||||
{
|
||||
BatchRec newRow = new BatchRec()
|
||||
{
|
||||
IdxODL = idxODL,
|
||||
IdentRG = identRG,
|
||||
DateRif = dtRif,
|
||||
ExtDoc = ddt,
|
||||
Product = prod,
|
||||
Variety = variety,
|
||||
Supplier = suppl,
|
||||
NumPack = numPack,
|
||||
QtyTot = qtyTot,
|
||||
Notes = notes
|
||||
};
|
||||
// verifico: se manca aggiungo
|
||||
if (!listaGiac.ContainsKey(identRG))
|
||||
{
|
||||
listaGiac.Add(identRG, newRow);
|
||||
}
|
||||
else
|
||||
{
|
||||
// altrimenti aggiorno giacenza con valori numerici
|
||||
listaGiac[identRG].NumPack += newRow.NumPack;
|
||||
listaGiac[identRG].QtyTot += newRow.QtyTot;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
lgError($"Errore verifica identità riga | prod: {prod} | variety: {variety} | suppl: {suppl}");
|
||||
numErr++;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
|
||||
Reference in New Issue
Block a user