Integration 2.3g4 :

- aggiunti controlli scrittura file BTL di passaggio.
This commit is contained in:
DarioS
2021-07-28 11:48:46 +02:00
parent d8d98fe8ae
commit ece4725781
3 changed files with 117 additions and 101 deletions
+108 -98
View File
@@ -44,126 +44,136 @@ namespace ib.essetre.integration.egaltech
_FcEnt = Constants.FcBaseId ;
// Il seguente blocco 'using' si occupa della scrittura del file di testo, poi salvato in .btl
using ( var tw = new StreamWriter( BtlPath, false)) {
try {
using ( var tw = new StreamWriter( BtlPath, false)) {
tw.WriteLine( Constants.VERSION) ;
tw.WriteLine( Constants.BUILD) ;
tw.WriteLine( Constants.GENERAL) ;
tw.WriteLine( Constants.PROJECT_NUMBER + this.projectNumber) ;
tw.WriteLine( Constants.SCALE_UNIT + Constants.scaleUnit.ToString()) ;
tw.WriteLine( Constants.USERATTRIBUTE + "\"PRODID\":" + "\"" + ( IsFromProject ? 0 : productionId) + "\"") ;
tw.WriteLine( Constants.USERATTRIBUTE + "\"PATTID\":" + "\"" + ( IsFromProject ? 0 : patternId) + "\"") ;
tw.WriteLine( Constants.USERATTRIBUTE + "\"BARLEN\":" + "\"" + barLength + "\"") ;
tw.WriteLine( Constants.USERATTRIBUTE + "\"PANELLEN\":" + "\"" + panelLength + "\"") ;
tw.WriteLine( Constants.USERATTRIBUTE + "\"PANELWIDTH\":" + "\"" + panelWidth + "\"") ;
tw.WriteLine( Constants.USERATTRIBUTE + "\"PROJECT\":" + "\"" + ( IsFromProject ? "1" : "0") + "\"") ;
tw.WriteLine( Constants.VERSION) ;
tw.WriteLine( Constants.BUILD) ;
tw.WriteLine( Constants.GENERAL) ;
tw.WriteLine( Constants.PROJECT_NUMBER + this.projectNumber) ;
tw.WriteLine( Constants.SCALE_UNIT + Constants.scaleUnit.ToString()) ;
tw.WriteLine( Constants.USERATTRIBUTE + "\"PRODID\":" + "\"" + ( IsFromProject ? 0 : productionId) + "\"") ;
tw.WriteLine( Constants.USERATTRIBUTE + "\"PATTID\":" + "\"" + ( IsFromProject ? 0 : patternId) + "\"") ;
tw.WriteLine( Constants.USERATTRIBUTE + "\"BARLEN\":" + "\"" + barLength + "\"") ;
tw.WriteLine( Constants.USERATTRIBUTE + "\"PANELLEN\":" + "\"" + panelLength + "\"") ;
tw.WriteLine( Constants.USERATTRIBUTE + "\"PANELWIDTH\":" + "\"" + panelWidth + "\"") ;
tw.WriteLine( Constants.USERATTRIBUTE + "\"PROJECT\":" + "\"" + ( IsFromProject ? "1" : "0") + "\"") ;
foreach ( Part singlePart in parts) {
tw.WriteLine( Constants.PART) ;
tw.WriteLine( Constants.SINGLE_MEMBER_NUMBER + singlePart.singleMemberNumber) ;
tw.WriteLine( Constants.COUNT + singlePart.count) ;
foreach ( Part singlePart in parts) {
tw.WriteLine( Constants.PART) ;
tw.WriteLine( Constants.SINGLE_MEMBER_NUMBER + singlePart.singleMemberNumber) ;
tw.WriteLine( Constants.COUNT + singlePart.count) ;
double len = Convert.ToDouble( singlePart.length) * Math.Pow( 10, Constants.scaleUnit) ;
int intLen = Convert.ToInt32( len) ;
tw.WriteLine( Constants.LENGTH + intLen.ToString( "D8")) ;
double len = Convert.ToDouble( singlePart.length) * Math.Pow( 10, Constants.scaleUnit) ;
int intLen = Convert.ToInt32( len) ;
tw.WriteLine( Constants.LENGTH + intLen.ToString( "D8")) ;
double hei = Convert.ToDouble( singlePart.height) * Math.Pow( 10, Constants.scaleUnit) ;
int intHei = Convert.ToInt32( hei) ;
tw.WriteLine( Constants.HEIGHT + intHei.ToString( "D8")) ;
double hei = Convert.ToDouble( singlePart.height) * Math.Pow( 10, Constants.scaleUnit) ;
int intHei = Convert.ToInt32( hei) ;
tw.WriteLine( Constants.HEIGHT + intHei.ToString( "D8")) ;
double wid = Convert.ToDouble( singlePart.width) * Math.Pow( 10, Constants.scaleUnit) ;
int intWid = Convert.ToInt32( wid) ;
tw.WriteLine( Constants.WIDTH + intWid.ToString( "D8")) ;
double wid = Convert.ToDouble( singlePart.width) * Math.Pow( 10, Constants.scaleUnit) ;
int intWid = Convert.ToInt32( wid) ;
tw.WriteLine( Constants.WIDTH + intWid.ToString( "D8")) ;
string posX = singlePart.x.ToString( "0.00", System.Globalization.CultureInfo.InvariantCulture) ;
tw.WriteLine( Constants.USERATTRIBUTE + "\"POSX\":" + "\"" + posX + "\"") ;
string posX = singlePart.x.ToString( "0.00", System.Globalization.CultureInfo.InvariantCulture) ;
tw.WriteLine( Constants.USERATTRIBUTE + "\"POSX\":" + "\"" + posX + "\"") ;
string posY = singlePart.y.ToString( "0.00", System.Globalization.CultureInfo.InvariantCulture) ;
tw.WriteLine( Constants.USERATTRIBUTE + "\"POSY\":" + "\"" + posY + "\"") ;
string posY = singlePart.y.ToString( "0.00", System.Globalization.CultureInfo.InvariantCulture) ;
tw.WriteLine( Constants.USERATTRIBUTE + "\"POSY\":" + "\"" + posY + "\"") ;
string posZ = singlePart.z.ToString( "0.00", System.Globalization.CultureInfo.InvariantCulture) ;
tw.WriteLine( Constants.USERATTRIBUTE + "\"POSZ\":" + "\"" + posZ + "\"") ;
string posZ = singlePart.z.ToString( "0.00", System.Globalization.CultureInfo.InvariantCulture) ;
tw.WriteLine( Constants.USERATTRIBUTE + "\"POSZ\":" + "\"" + posZ + "\"") ;
string inv = singlePart.inverted.ToString( "0.00", System.Globalization.CultureInfo.InvariantCulture) ;
tw.WriteLine( Constants.USERATTRIBUTE + "\"INVERTED\":" + "\"" + inv + "\"") ;
string inv = singlePart.inverted.ToString( "0.00", System.Globalization.CultureInfo.InvariantCulture) ;
tw.WriteLine( Constants.USERATTRIBUTE + "\"INVERTED\":" + "\"" + inv + "\"") ;
string rot = singlePart.rotated.ToString( "0.00", System.Globalization.CultureInfo.InvariantCulture) ;
tw.WriteLine( Constants.USERATTRIBUTE + "\"ROTATED\":" + "\"" + rot + "\"") ;
string rot = singlePart.rotated.ToString( "0.00", System.Globalization.CultureInfo.InvariantCulture) ;
tw.WriteLine( Constants.USERATTRIBUTE + "\"ROTATED\":" + "\"" + rot + "\"") ;
tw.WriteLine( Constants.USERATTRIBUTE + "\"TYPE\":" + "\"" + singlePart.Type + "\"") ;
tw.WriteLine( Constants.USERATTRIBUTE + "\"TYPE\":" + "\"" + singlePart.Type + "\"") ;
string CutId = ( IsFromProject ? singlePart.elementId : singlePart.cutId).ToString() ;
tw.WriteLine( Constants.USERATTRIBUTE + "\"CUTID\":" + "\"" + CutId + "\"") ;
string CutId = ( IsFromProject ? singlePart.elementId : singlePart.cutId).ToString() ;
tw.WriteLine( Constants.USERATTRIBUTE + "\"CUTID\":" + "\"" + CutId + "\"") ;
// Scrivo eventuale Outline
foreach ( Feature singleFeature in singlePart.features) {
// Assegno identificativo del processo
string TaskId = (IsFromProject ? singleFeature.processId : singleFeature.taskId).ToString() ;
// Se Outline (processo "251") elaborazione speciale
if ( singleFeature.processKey.Contains( "251")) {
WriteOutlineAperture( true, singleFeature, TaskId, tw) ;
}
}
// Scrivo eventuali Aperture
foreach ( Feature singleFeature in singlePart.features) {
// Assegno identificativo del processo
string TaskId = (IsFromProject ? singleFeature.processId : singleFeature.taskId).ToString() ;
// Se Aperture (processo "252") elaborazione speciale
if ( singleFeature.processKey.Contains( "252")) {
WriteOutlineAperture( false, singleFeature, TaskId, tw) ;
}
}
// Scrivo tutti gli altri processi
foreach ( Feature singleFeature in singlePart.features) {
// Assegno identificativo del processo
string TaskId = ( IsFromProject ? singleFeature.processId : singleFeature.taskId).ToString() ;
// Se Outline (processo "251") o Aperture (processo "252") salto
if ( singleFeature.processKey.Contains( "251") ||
singleFeature.processKey.Contains( "252")) {
;
}
// Se Free Contour (processo "250") elaborazione speciale
else if ( singleFeature.processKey.Contains( "250")) {
WriteFreeContour( singleFeature, TaskId, tw) ;
}
// Altri processi
else {
// Tipo di Process
tw.WriteLine( Constants.PROCESS_KEY + singleFeature.processKey + " " + singleFeature.designation) ;
// Eventuale sistema di riferimto
WriteReference( singleFeature, tw) ;
// Parametri standard del Process ( 1 .. 26)
tw.Write( Constants.PROCESS_PARAMETERS) ;
for ( int i = 1 ; i <= 26 ; ++ i) {
string singleParameter = singleFeature.processParameters[i-1] ;
if ( i != 15 || ! ( singleFeature.processKey.Contains( "060") || singleFeature.processKey.Contains( "061")))
tw.Write( "P" + i.ToString( "D2") + ":" + MultAndConvertTo8( singleParameter) + " ") ;
else
tw.Write( "P" + i.ToString( "D2") + ":" + "\"" + singleFeature.text + "\" ") ;
// Scrivo eventuale Outline
foreach ( Feature singleFeature in singlePart.features) {
// Assegno identificativo del processo
string TaskId = (IsFromProject ? singleFeature.processId : singleFeature.taskId).ToString() ;
// Se Outline (processo "251") elaborazione speciale
if ( singleFeature.processKey.Contains( "251")) {
WriteOutlineAperture( true, singleFeature, TaskId, tw) ;
}
tw.WriteLine( "") ;
// 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 + "\" ") ;
}
// Scrivo eventuali Aperture
foreach ( Feature singleFeature in singlePart.features) {
// Assegno identificativo del processo
string TaskId = (IsFromProject ? singleFeature.processId : singleFeature.taskId).ToString() ;
// Se Aperture (processo "252") elaborazione speciale
if ( singleFeature.processKey.Contains( "252")) {
WriteOutlineAperture( false, singleFeature, TaskId, tw) ;
}
}
// Scrivo tutti gli altri processi
foreach ( Feature singleFeature in singlePart.features) {
// Assegno identificativo del processo
string TaskId = ( IsFromProject ? singleFeature.processId : singleFeature.taskId).ToString() ;
// Se Outline (processo "251") o Aperture (processo "252") salto
if ( singleFeature.processKey.Contains( "251") ||
singleFeature.processKey.Contains( "252")) {
;
}
// Se Free Contour (processo "250") elaborazione speciale
else if ( singleFeature.processKey.Contains( "250")) {
WriteFreeContour( singleFeature, TaskId, tw) ;
}
// Altri processi
else {
// Tipo di Process
tw.WriteLine( Constants.PROCESS_KEY + singleFeature.processKey + " " + singleFeature.designation) ;
// Eventuale sistema di riferimto
WriteReference( singleFeature, tw) ;
// Parametri standard del Process ( 1 .. 26)
tw.Write( Constants.PROCESS_PARAMETERS) ;
for ( int i = 1 ; i <= 26 ; ++ i) {
string singleParameter = singleFeature.processParameters[i-1] ;
if ( i != 15 || ! ( singleFeature.processKey.Contains( "060") || singleFeature.processKey.Contains( "061")))
tw.Write( "P" + i.ToString( "D2") + ":" + MultAndConvertTo8( singleParameter) + " ") ;
else
tw.Write( "P" + i.ToString( "D2") + ":" + "\"" + singleFeature.text + "\" ") ;
}
tw.WriteLine( "") ;
// 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 + "\" ") ;
}
}
tw.WriteLine( Constants.PROCESS_IDENT + singleFeature.processIdent) ;
tw.WriteLine( Constants.PROCESS + singleFeature.process) ;
tw.WriteLine( Constants.USERATTRIBUTE + "\"TASKID\":" + "\"" + TaskId + "\"") ;
}
tw.WriteLine( Constants.PROCESS_IDENT + singleFeature.processIdent) ;
tw.WriteLine( Constants.PROCESS + singleFeature.process) ;
tw.WriteLine( Constants.USERATTRIBUTE + "\"TASKID\":" + "\"" + TaskId + "\"") ;
}
}
}
}
catch {
return false ;
}
// Scrittura file ausiliario con dati che non fanno ricalcolare le lavorazioni
using ( var tw = new StreamWriter( Path.ChangeExtension( BtlPath, ".btm"), false)) {
tw.WriteLine( "[AuxData]") ;
tw.WriteLine( "LOAD90=" + barLoad90) ;
try {
using ( var tw = new StreamWriter( Path.ChangeExtension( BtlPath, ".btm"), false)) {
tw.WriteLine( "[AuxData]") ;
tw.WriteLine( "LOAD90=" + barLoad90) ;
}
}
catch {
return false ;
}
return true ;
+7 -1
View File
@@ -490,8 +490,14 @@ namespace ib.essetre.integration.egaltech
pattInfo.DetailResult = PatternInfo.DetailResults.MEMORY ;
}
else {
// BTL vuoto o non scritto
if ( nLastErr == 10) {
pattInfo.Result = PatternInfo.Results.ERROR ;
pattInfo.DetailResult = PatternInfo.DetailResults.ALL_ERROR ;
pattInfo.Message = sLastMsg ;
}
// Sezione oltre i limiti
if ( nLastErr == 17) {
else if ( nLastErr == 17) {
pattInfo.Result = PatternInfo.Results.ERROR ;
pattInfo.DetailResult = PatternInfo.DetailResults.ALL_WARNING ;
pattInfo.Message = sLastMsg ;
@@ -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.3.7.2")]
[assembly: AssemblyFileVersion("2.3.7.2")]
[assembly: AssemblyVersion("2.3.7.4")]
[assembly: AssemblyFileVersion("2.3.7.4")]