Integration 2.1g8 :
- corretta esportazione BTL.
This commit is contained in:
+62
-71
@@ -13,7 +13,6 @@ namespace ib.essetre.integration.egaltech
|
||||
public class BTL
|
||||
{
|
||||
public string projectNumber ;
|
||||
public string scaleUnit ;
|
||||
public string barLength ;
|
||||
public List<Part> parts ;
|
||||
// I seguenti Id servono per il nome del file BTL
|
||||
@@ -22,6 +21,8 @@ namespace ib.essetre.integration.egaltech
|
||||
public int projectId ;
|
||||
public int elementId ;
|
||||
public string fileName ;
|
||||
// Contatore entità di contorno libero
|
||||
private int _FcEnt ;
|
||||
|
||||
public BTL()
|
||||
{}
|
||||
@@ -36,6 +37,9 @@ namespace ib.essetre.integration.egaltech
|
||||
if ( parts == null)
|
||||
return false ;
|
||||
|
||||
// Reset entità di contorno libero
|
||||
_FcEnt = Constants.FcBaseId ;
|
||||
|
||||
// Il seguente blocco 'using' si occupa della scrittura del file di testo, poi salvato in .btl
|
||||
using ( var tw = new StreamWriter( filePath, false)) {
|
||||
|
||||
@@ -43,7 +47,7 @@ namespace ib.essetre.integration.egaltech
|
||||
tw.WriteLine( Constants.BUILD) ;
|
||||
tw.WriteLine( Constants.GENERAL) ;
|
||||
tw.WriteLine( Constants.PROJECT_NUMBER + this.projectNumber) ;
|
||||
tw.WriteLine( Constants.SCALE_UNIT + this.scaleUnit) ;
|
||||
tw.WriteLine( Constants.SCALE_UNIT + Constants.scaleUnit.ToString()) ;
|
||||
tw.WriteLine( Constants.USERATTRIBUTE + "\"PRODID\":" + "\"" + ( IsFromProject ? 0 : productionId) + "\"") ;
|
||||
barLength = barLength.Replace( ",", ".") ;
|
||||
tw.WriteLine( Constants.USERATTRIBUTE + "\"BARLEN\":" + "\"" + barLength + "\"") ;
|
||||
@@ -74,12 +78,15 @@ namespace ib.essetre.integration.egaltech
|
||||
string rot = singlePart.rotated.ToString() ;
|
||||
tw.WriteLine( Constants.USERATTRIBUTE + "\"ROTATED\":" + "\"" + rot + "\"") ;
|
||||
|
||||
tw.WriteLine( Constants.USERATTRIBUTE + "\"CUTID\":" + "\"" + ( IsFromProject ? singlePart.elementId : singlePart.cutId) + "\"") ;
|
||||
string CutId = ( IsFromProject ? singlePart.elementId : singlePart.cutId).ToString() ;
|
||||
tw.WriteLine( Constants.USERATTRIBUTE + "\"CUTID\":" + "\"" + CutId + "\"") ;
|
||||
|
||||
foreach ( Feature singleFeature in singlePart.features) {
|
||||
// Assegno identificativo del processo
|
||||
string TaskId = ( IsFromProject ? singleFeature.processId : singleFeature.taskId).ToString() ;
|
||||
// Se Contorno Libero (processo "250") elaborazione speciale
|
||||
if ( singleFeature.processKey.Contains( "250")) {
|
||||
FreeContourAnalyzer( singleFeature, tw) ;
|
||||
FreeContourAnalyzer( singleFeature, TaskId, tw) ;
|
||||
}
|
||||
else {
|
||||
// Tipo di Process
|
||||
@@ -104,8 +111,8 @@ namespace ib.essetre.integration.egaltech
|
||||
}
|
||||
tw.WriteLine( Constants.PROCESS_IDENT + singleFeature.processIdent) ;
|
||||
tw.WriteLine( Constants.PROCESS + singleFeature.process) ;
|
||||
tw.WriteLine( Constants.USERATTRIBUTE + "\"TASKID\":" + "\"" + TaskId + "\"") ;
|
||||
}
|
||||
tw.WriteLine( Constants.USERATTRIBUTE + "\"TASKID\":" + "\"" + ( IsFromProject ? singleFeature.processId : singleFeature.taskId) + "\"") ;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -114,13 +121,16 @@ namespace ib.essetre.integration.egaltech
|
||||
|
||||
// Il seguente metodo analizza il campo sag1 della singleFeature passata: se non è vuoto allora la stringa
|
||||
// viene splittata nei parametri P di POLY ed analizzata
|
||||
public void FreeContourAnalyzer( Feature singleFeature, StreamWriter tw)
|
||||
public void FreeContourAnalyzer( Feature singleFeature, String TaskId, StreamWriter tw)
|
||||
{
|
||||
// Se non ci sono dati, esco
|
||||
if ( singleFeature.sag1 == "")
|
||||
return ;
|
||||
|
||||
// Divido i dati in record punti
|
||||
string[] arrParam = singleFeature.sag1.Split( new string[] { "POLY([", "),", ")]" }, StringSplitOptions.RemoveEmptyEntries) ;
|
||||
// Se chiusa, copio il primo punto nell'ultimo elemento
|
||||
|
||||
// Se curva chiusa, copio il primo punto nell'ultimo elemento
|
||||
if ( arrParam[arrParam.Length-1] == ",'P','C')")
|
||||
arrParam[arrParam.Length-1] = arrParam[0] ;
|
||||
// altrimenti aperta, quindi elimino l'ultimo elemento
|
||||
@@ -131,16 +141,18 @@ namespace ib.essetre.integration.egaltech
|
||||
if ( singleFeature.processParameters[35] == "1")
|
||||
Array.Reverse( arrParam) ;
|
||||
|
||||
int count = 0; // Nel caso in cui ci troviamo alla fine di un Arco questa viene incrementata di 1, in modo da scrivere il numero parametro corretto nei seguenti cicli
|
||||
Boolean flagArco = false; // Nel caso in cui ci troviamo all'inizio di un Arco questa viene posta a TRUE, in modo da passare nel percorso dedicato nel prossimo ciclo
|
||||
// Ciclo sugli elementi
|
||||
Boolean flagArco = false ;
|
||||
for (int i = 0; i < arrParam.Length; i++) {
|
||||
char[] separators = { ',', '(' } ;
|
||||
string[] parts = arrParam[i].Split( separators) ; // ogni parametro P di POLY viene splittato in più parti
|
||||
// il primo elemento di parts[] indica se ci troviamo all'inizio di un Arco o no
|
||||
switch ( parts[0]) {
|
||||
case "P":
|
||||
default :
|
||||
// Se StartPoint
|
||||
if ( i == 0) {
|
||||
++ _FcEnt ;
|
||||
tw.WriteLine(Constants.PROCESS_KEY + singleFeature.processKey + " " + singleFeature.designation);
|
||||
tw.Write(Constants.PROCESS_PARAMETERS);
|
||||
tw.Write("P01:" + MultAndConvertTo8(parts[1]) + " "); // x
|
||||
@@ -153,7 +165,7 @@ namespace ib.essetre.integration.egaltech
|
||||
if ( i == arrParam.Length - 1) // Verifica se ci troviamo all'ultimo parametro di POLY
|
||||
tw.Write("P09:" + Constants.EIGHT_ZEROS + " "); // L'ultimo elemento di POLY deve avere "P09: 00000000"
|
||||
else
|
||||
tw.Write("P09:" + MultAndConvertTo8((Convert.ToDouble(singleFeature.processParameters[8]) + i - count).ToString()) + " ");
|
||||
tw.Write("P09:" + MultAndConvertTo8( (_FcEnt + 1).ToString()) + " ");
|
||||
tw.Write("P10:" + Constants.EIGHT_ZEROS + " ");
|
||||
tw.Write("P11:" + Constants.EIGHT_ZEROS + " ");
|
||||
tw.Write("P12:" + Constants.EIGHT_ZEROS + " ");
|
||||
@@ -161,16 +173,50 @@ namespace ib.essetre.integration.egaltech
|
||||
tw.Write("P14:" + Constants.EIGHT_ZEROS + " ");
|
||||
tw.Write("P15:" + Constants.EIGHT_ZEROS + " ");
|
||||
tw.WriteLine(" ");
|
||||
tw.WriteLine(Constants.PROCESS_IDENT + (Convert.ToInt16(singleFeature.processIdent) + i - count));
|
||||
tw.WriteLine(Constants.PROCESS_IDENT + _FcEnt.ToString());
|
||||
tw.WriteLine(Constants.PROCESS + singleFeature.process);
|
||||
// Parametri speciali Q diversi da 0, preceduti da "USERATTRIBUTE:"
|
||||
for ( int j = 1 ; j <= 20 ; ++ j) {
|
||||
string singleParameter = singleFeature.processParameters[j+25] ;
|
||||
if ( ! singleParameter.Equals( "0")) {
|
||||
singleParameter = singleParameter.Replace( ",", ".") ;
|
||||
tw.WriteLine( Constants.USERATTRIBUTE + "\"Q" + j.ToString( "D2") + "\":\"" + singleParameter + "\" ") ;
|
||||
}
|
||||
}
|
||||
// TaskId
|
||||
tw.WriteLine( Constants.USERATTRIBUTE + "\"TASKID\":" + "\"" + TaskId + "\"") ;
|
||||
}
|
||||
// altrimenti se FineArco
|
||||
// se altrimenti FineArco
|
||||
else if ( flagArco) {
|
||||
count++;
|
||||
++ _FcEnt ;
|
||||
tw.WriteLine(Constants.PROCESS_KEY + singleFeature.processKey + " " + singleFeature.designation);
|
||||
tw.Write(Constants.PROCESS_PARAMETERS);
|
||||
tw.Write("P01:" + MultAndConvertTo8(parts[1]) + " "); // x (EndPoint Arc)
|
||||
tw.Write("P02:" + MultAndConvertTo8(parts[2]) + " "); // y (EndPoint Arc)
|
||||
tw.Write("P03:" + MultAndConvertTo8(parts[3]) + " "); // z (Endpoint Arc)
|
||||
tw.Write("P05:" + Constants.EIGHT_ZEROS + " ");
|
||||
tw.Write("P06:" + Constants.EIGHT_ZEROS + " ");
|
||||
tw.Write("P07:" + Constants.EIGHT_ZEROS + " ");
|
||||
tw.Write("P08:" + "00000200" + " ");
|
||||
if ( i == arrParam.Length - 1)
|
||||
tw.Write("P09:" + Constants.EIGHT_ZEROS + " ");
|
||||
else
|
||||
tw.Write("P09:" + MultAndConvertTo8( (_FcEnt + 1).ToString()) + " ");
|
||||
string[] PrevParts = arrParam[i - 1].Split(separators);
|
||||
tw.Write("P10:" + MultAndConvertTo8(PrevParts[1]) + " "); // x (Point on Arc)
|
||||
tw.Write("P11:" + MultAndConvertTo8(PrevParts[2]) + " "); // y (Point on Arc)
|
||||
tw.Write("P12:" + MultAndConvertTo8(PrevParts[3]) + " "); // z (Point on Arc)
|
||||
tw.Write("P13:" + Constants.EIGHT_ZEROS + " ");
|
||||
tw.Write("P14:" + Constants.EIGHT_ZEROS + " ");
|
||||
tw.Write("P15:" + Constants.EIGHT_ZEROS + " ");
|
||||
tw.WriteLine(" ");
|
||||
tw.WriteLine(Constants.PROCESS_IDENT + _FcEnt.ToString());
|
||||
tw.WriteLine(Constants.PROCESS + singleFeature.process);
|
||||
flagArco = false ;
|
||||
}
|
||||
// altrimenti FineSegmento
|
||||
else {
|
||||
++ _FcEnt ;
|
||||
tw.WriteLine(Constants.PROCESS_KEY + singleFeature.processKey + " " + singleFeature.designation);
|
||||
tw.Write(Constants.PROCESS_PARAMETERS);
|
||||
tw.Write("P01:" + MultAndConvertTo8(parts[1]) + " "); // x
|
||||
@@ -183,7 +229,7 @@ namespace ib.essetre.integration.egaltech
|
||||
if ( i == arrParam.Length - 1)
|
||||
tw.Write("P09:" + Constants.EIGHT_ZEROS + " ");
|
||||
else
|
||||
tw.Write("P09:" + MultAndConvertTo8((Convert.ToDouble(singleFeature.processParameters[8]) + i - count).ToString()) + " ");
|
||||
tw.Write("P09:" + MultAndConvertTo8( (_FcEnt + 1).ToString()) + " ");
|
||||
tw.Write("P10:" + Constants.EIGHT_ZEROS + " ");
|
||||
tw.Write("P11:" + Constants.EIGHT_ZEROS + " ");
|
||||
tw.Write("P12:" + Constants.EIGHT_ZEROS + " ");
|
||||
@@ -191,68 +237,13 @@ namespace ib.essetre.integration.egaltech
|
||||
tw.Write("P14:" + Constants.EIGHT_ZEROS + " ");
|
||||
tw.Write("P15:" + Constants.EIGHT_ZEROS + " ");
|
||||
tw.WriteLine(" ");
|
||||
tw.WriteLine(Constants.PROCESS_IDENT + (Convert.ToInt16(singleFeature.processIdent) + i - count));
|
||||
tw.WriteLine(Constants.PROCESS_IDENT + _FcEnt.ToString());
|
||||
tw.WriteLine(Constants.PROCESS + singleFeature.process);
|
||||
}
|
||||
break;
|
||||
case "A": // Caso InizioArco
|
||||
tw.WriteLine(Constants.PROCESS_KEY + singleFeature.processKey + " " + singleFeature.designation);
|
||||
tw.Write(Constants.PROCESS_PARAMETERS);
|
||||
string[] nextParts = arrParam[i + 1].Split(separators);
|
||||
tw.Write("P01:" + MultAndConvertTo8(nextParts[1]) + " "); // x (EndPoint Arc)
|
||||
tw.Write("P02:" + MultAndConvertTo8(nextParts[2]) + " "); // y (EndPoint Arc)
|
||||
tw.Write("P03:" + MultAndConvertTo8(nextParts[3]) + " "); // z (Endpoint Arc)
|
||||
tw.Write("P05:" + Constants.EIGHT_ZEROS + " ");
|
||||
tw.Write("P06:" + Constants.EIGHT_ZEROS + " ");
|
||||
tw.Write("P07:" + Constants.EIGHT_ZEROS + " ");
|
||||
tw.Write("P08:" + "00000200" + " ");
|
||||
if ( i == arrParam.Length - 2)
|
||||
tw.Write("P09:" + Constants.EIGHT_ZEROS + " ");
|
||||
else
|
||||
tw.Write("P09:" + MultAndConvertTo8((Convert.ToDouble(singleFeature.processParameters[8]) + i - count).ToString()) + " ");
|
||||
tw.Write("P10:" + MultAndConvertTo8(parts[1]) + " "); // x (Point on Arc)
|
||||
tw.Write("P11:" + MultAndConvertTo8(parts[2]) + " "); // y (Point on Arc)
|
||||
tw.Write("P12:" + MultAndConvertTo8(parts[3]) + " "); // z (Point on Arc)
|
||||
tw.Write("P13:" + Constants.EIGHT_ZEROS + " ");
|
||||
tw.Write("P14:" + Constants.EIGHT_ZEROS + " ");
|
||||
tw.Write("P15:" + Constants.EIGHT_ZEROS + " ");
|
||||
tw.WriteLine(" ");
|
||||
tw.WriteLine(Constants.PROCESS_IDENT + (Convert.ToInt16(singleFeature.processIdent) + i - count));
|
||||
tw.WriteLine(Constants.PROCESS + singleFeature.process);
|
||||
case "A": // InizioArco
|
||||
flagArco = true;
|
||||
break;
|
||||
default:
|
||||
tw.WriteLine(Constants.PROCESS_KEY + singleFeature.processKey + " " + singleFeature.designation);
|
||||
tw.Write(Constants.PROCESS_PARAMETERS);
|
||||
tw.Write("P01:" + MultAndConvertTo8(parts[1]) + " ");
|
||||
tw.Write("P02:" + MultAndConvertTo8(parts[2]) + " ");
|
||||
tw.Write("P03:" + MultAndConvertTo8(parts[3]) + " ");
|
||||
tw.Write("P05:" + Constants.EIGHT_ZEROS + " ");
|
||||
tw.Write("P06:" + Constants.EIGHT_ZEROS + " ");
|
||||
tw.Write("P07:" + Constants.EIGHT_ZEROS + " ");
|
||||
tw.Write("P08:" + Constants.EIGHT_ZEROS + " ");
|
||||
if ( i == arrParam.Length - 1)
|
||||
tw.Write("P09:" + Constants.EIGHT_ZEROS + " ");
|
||||
else
|
||||
tw.Write("P09:" + MultAndConvertTo8((Convert.ToDouble(singleFeature.processParameters[8]) + i - count).ToString()) + " ");
|
||||
tw.Write("P10:" + Constants.EIGHT_ZEROS + " ");
|
||||
tw.Write("P11:" + Constants.EIGHT_ZEROS + " ");
|
||||
tw.Write("P12:" + Constants.EIGHT_ZEROS + " ");
|
||||
tw.Write("P13:" + Constants.EIGHT_ZEROS + " ");
|
||||
tw.Write("P14:" + Constants.EIGHT_ZEROS + " ");
|
||||
tw.Write("P15:" + Constants.EIGHT_ZEROS + " ");
|
||||
tw.WriteLine(" ");
|
||||
tw.WriteLine(Constants.PROCESS_IDENT + (Convert.ToInt16(singleFeature.processIdent) + i - count));
|
||||
tw.WriteLine(Constants.PROCESS + singleFeature.process);
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Parametri speciali Q diversi da 0, preceduti da "USERATTRIBUTE:"
|
||||
for ( int i = 1 ; i <= 20 ; ++ i) {
|
||||
string singleParameter = singleFeature.processParameters[i+25] ;
|
||||
if ( ! singleParameter.Equals( "0")) {
|
||||
singleParameter = singleParameter.Replace( ",", ".") ;
|
||||
tw.WriteLine( Constants.USERATTRIBUTE + "\"Q" + i.ToString( "D2") + "\":\"" + singleParameter + "\" ") ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,5 +38,8 @@ namespace ib.essetre.integration.egaltech
|
||||
|
||||
// Sovramateriale di testa per pezzi singoli di Vista
|
||||
public const double HeadOverMat = 10 ;
|
||||
|
||||
// Id base per punti di contorni liberi
|
||||
public const int FcBaseId = 10000 ;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -216,8 +216,11 @@ namespace ib.essetre.integration.egaltech
|
||||
else if ( nErr > 0) {
|
||||
resExe = PatternInfo.Results.WARNING ;
|
||||
bErrors = true ;
|
||||
nLastErr = nErr ;
|
||||
sLastMsg = sMsg ;
|
||||
// se non assegnata a feature la dichiaro globale
|
||||
if ( cutId == 0 || taskId == 0) {
|
||||
nLastErr = nErr ;
|
||||
sLastMsg = sMsg ;
|
||||
}
|
||||
}
|
||||
pattInfo.SetTaskState( cutId, taskId, resExe, sMsg) ;
|
||||
if ( pattInfo.IsFromProject)
|
||||
@@ -244,13 +247,37 @@ namespace ib.essetre.integration.egaltech
|
||||
pattInfo.DetailResult = PatternInfo.DetailResults.ALL_WARNING ;
|
||||
pattInfo.Message = sLastMsg ;
|
||||
}
|
||||
// Collisione non assegnata ad una feature
|
||||
else if ( nLastErr == 22 ) {
|
||||
// Errore nel calcolo lavorazione o movimento carrelli
|
||||
else if ( nLastErr == 19) {
|
||||
pattInfo.Result = PatternInfo.Results.ERROR ;
|
||||
pattInfo.DetailResult = PatternInfo.DetailResults.ALL_ERROR ;
|
||||
pattInfo.Message = sLastMsg ;
|
||||
}
|
||||
// Collisione non assegnata ad una feature
|
||||
else if ( nLastErr == 22) {
|
||||
pattInfo.Result = PatternInfo.Results.ERROR ;
|
||||
pattInfo.DetailResult = PatternInfo.DetailResults.ALL_COLLISION ;
|
||||
pattInfo.Message = sLastMsg ;
|
||||
}
|
||||
// Altro
|
||||
// Extra corsa assi
|
||||
else if ( nLastErr == 23) {
|
||||
pattInfo.Result = PatternInfo.Results.ERROR ;
|
||||
pattInfo.DetailResult = PatternInfo.DetailResults.ALL_ERROR ;
|
||||
pattInfo.Message = sLastMsg ;
|
||||
}
|
||||
// Carri che scivolano sulla trave
|
||||
else if ( nLastErr == 24) {
|
||||
pattInfo.Result = PatternInfo.Results.ERROR ;
|
||||
pattInfo.DetailResult = PatternInfo.DetailResults.ALL_ERROR ;
|
||||
pattInfo.Message = sLastMsg ;
|
||||
}
|
||||
// Errore generico
|
||||
else if ( nLastErr == 25) {
|
||||
pattInfo.Result = PatternInfo.Results.ERROR ;
|
||||
pattInfo.DetailResult = PatternInfo.DetailResults.ALL_ERROR ;
|
||||
pattInfo.Message = sLastMsg ;
|
||||
}
|
||||
// Altro
|
||||
else {
|
||||
pattInfo.Result = PatternInfo.Results.ERROR ;
|
||||
pattInfo.DetailResult = PatternInfo.DetailResults.MEMORY ;
|
||||
@@ -310,7 +337,6 @@ namespace ib.essetre.integration.egaltech
|
||||
|
||||
DataRow dRow0 = dTab.Rows[0] ;
|
||||
btlObject.projectNumber = dRow0["projectId"].ToString() ;
|
||||
btlObject.scaleUnit = "2" ;
|
||||
btlObject.barLength = Convert.ToString( GetBarLengthP( (int)dRow0["patternId"], (int)dRow0["productionId"])) ;
|
||||
btlObject.productionId = (int)dRow0["productionId"] ;
|
||||
btlObject.patternId = (int)dRow0["patternId"] ;
|
||||
@@ -422,7 +448,6 @@ namespace ib.essetre.integration.egaltech
|
||||
|
||||
DataRow dRow0 = dTab.Rows[0] ;
|
||||
btlObject.projectNumber = dRow0["projectId"].ToString() ;
|
||||
btlObject.scaleUnit = " 2" ;
|
||||
btlObject.barLength = Convert.ToString( GetBarLengthO( (int)dRow0["elementId"], (int)dRow0["projectId"])) ;
|
||||
btlObject.projectId = (int)dRow0["projectId"] ;
|
||||
btlObject.elementId = (int)dRow0["elementId"] ;
|
||||
|
||||
@@ -36,5 +36,5 @@ using System.Runtime.InteropServices;
|
||||
// È possibile specificare tutti i valori oppure impostare valori predefiniti per i numeri relativi alla revisione e alla build
|
||||
// usando l'asterisco '*' come illustrato di seguito:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("2.1.7.7")]
|
||||
[assembly: AssemblyFileVersion("2.1.7.7")]
|
||||
[assembly: AssemblyVersion("2.1.7.8")]
|
||||
[assembly: AssemblyFileVersion("2.1.7.8")]
|
||||
|
||||
Reference in New Issue
Block a user