Merge branch 'release/eni_7.10'
This commit is contained in:
commit
4d7211a39e
@ -78,6 +78,9 @@
|
||||
<DataTrigger Binding="{Binding Status}" Value="{x:Static db:MaerskData+MDStatus.NO_ID_AND_DUE}">
|
||||
<Setter Property="Background" Value="Red"></Setter>
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding Status}" Value="{x:Static db:MaerskData+MDStatus.CANCELLED}">
|
||||
<Setter Property="Foreground" Value="DarkGray"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</local:ENIDataGrid.RowStyle>
|
||||
|
||||
@ -18,6 +18,7 @@ using ENI2.Locode;
|
||||
using ENI2.Util;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ENI2.Controls
|
||||
{
|
||||
@ -30,7 +31,6 @@ namespace ENI2.Controls
|
||||
#region Fields
|
||||
|
||||
private readonly ObservableCollection<MaerskData> maerskDataList = new ObservableCollection<MaerskData>();
|
||||
private const uint MAX_EMPTY_ROWS_ON_IMPORT = 3; // import breaks if more than this count of empty rows have been read
|
||||
private readonly DatabaseEntityWatchdog _dbWatchDog;
|
||||
|
||||
#endregion
|
||||
@ -73,7 +73,16 @@ namespace ENI2.Controls
|
||||
md.MessageCore = core;
|
||||
md.Status = MaerskData.MDStatus.ID;
|
||||
md.ColM = core.VisitId;
|
||||
await DBManagerAsync.Save(md);
|
||||
if (core.PoC.Equals("DEBRE") && md.ColJ.Equals("MSK"))
|
||||
core.Flags = 1;
|
||||
if (core.PoC.Equals("DEWVN") && md.ColJ.Equals("MSK"))
|
||||
core.Flags = 1;
|
||||
if (core.PoC.Equals("DEBRE") && md.ColJ.Equals("SGL"))
|
||||
core.Flags = 2;
|
||||
if (core.PoC.Equals("DEWVN") && md.ColJ.Equals("SGL"))
|
||||
core.Flags = 3;
|
||||
await DBManagerAsync.SaveAsync(core);
|
||||
await DBManagerAsync.SaveAsync(md);
|
||||
_dbWatchDog.UnRegister(core);
|
||||
this.Dispatcher.Invoke(() =>
|
||||
{
|
||||
@ -150,7 +159,7 @@ namespace ENI2.Controls
|
||||
maerskData.Remark = el.Text;
|
||||
|
||||
if (maerskData.MessageCore != null)
|
||||
await DBManagerAsync.Save(maerskData);
|
||||
await DBManagerAsync.SaveAsync(maerskData);
|
||||
}
|
||||
/*
|
||||
if(e.Column == gridColumnGroup)
|
||||
@ -235,6 +244,11 @@ namespace ENI2.Controls
|
||||
// no ETA means done
|
||||
md.Status = MaerskData.MDStatus.NO_ETA;
|
||||
}
|
||||
|
||||
// if there is an declaration and it has been cancelled.. override the state to CANCELLED
|
||||
if (md.MessageCore != null && (md.MessageCore.Cancelled ?? false))
|
||||
md.Status = MaerskData.MDStatus.CANCELLED;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -248,8 +262,6 @@ namespace ENI2.Controls
|
||||
DateTime toDate = this.dateTimePickerTo.SelectedDate.Value.ToUniversalTime().Add(new TimeSpan(23, 59, 59));
|
||||
uint to = toDate.ToUnixTimeStamp();
|
||||
filterDict.Add(MessageCore.SearchFilterType.FILTER_ETA, string.Format("{0}:{1}", from.ToString() ?? "", to.ToString() ?? ""));
|
||||
// eingeschränkt auf flags
|
||||
filterDict.Add(MessageCore.SearchFilterType.FILTER_FLAG_EQ, "0");
|
||||
|
||||
// suche auslösen
|
||||
List<MessageCore> searchResult = DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).GetMessageCoresWithFilters(filterDict);
|
||||
@ -267,7 +279,14 @@ namespace ENI2.Controls
|
||||
md.MessageCoreId = core.Id.Value;
|
||||
this.UpdateStatus(md);
|
||||
if (!maerskDataList.Contains(md)) // DatabaseEntity implements IEquatable
|
||||
{
|
||||
this.maerskDataList.Add(md);
|
||||
if(!core.VisitId.IsNullOrEmpty() && md.ColM.IsNullOrEmpty())
|
||||
{
|
||||
md.ColM = core.VisitId; // this can happen if client is closed before an Id has been returned, so we have to manually set it here
|
||||
Task<int> saveResult = DBManagerAsync.SaveAsync(md); // actually we do not need to await this
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
this.TimeFilterItemSource();
|
||||
@ -287,7 +306,6 @@ namespace ENI2.Controls
|
||||
return reader.GetInt32(fieldNum).ToString();
|
||||
if (reader.GetFieldType(fieldNum) == typeof(double))
|
||||
return ((int) reader.GetDouble(fieldNum)).ToString();
|
||||
Type theType = reader.GetFieldType(fieldNum);
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -355,13 +373,16 @@ namespace ENI2.Controls
|
||||
using (IExcelDataReader reader = ExcelReaderFactory.CreateReader(stream))
|
||||
{
|
||||
List<MaerskData> importData = new List<MaerskData>();
|
||||
uint emptyRowCnt = 0;
|
||||
|
||||
bool isFirstRow = true;
|
||||
int currentRow = 0;
|
||||
bool imosAreOkay = true;
|
||||
|
||||
try
|
||||
{
|
||||
while (reader.Read())
|
||||
{
|
||||
currentRow++;
|
||||
|
||||
if (isFirstRow)
|
||||
{
|
||||
@ -411,11 +432,33 @@ namespace ENI2.Controls
|
||||
if (!reader.IsDBNull(12)) md.ColM = ReadFieldAsString(reader, 12);
|
||||
if (!reader.IsDBNull(13)) md.Remark = ReadFieldAsString(reader, 13);
|
||||
|
||||
if (!md.ColF.IsNullOrEmpty()) // only add this if IMO is set
|
||||
importData.Add(md);
|
||||
if(!md.ColF.IsNullOrEmpty())
|
||||
{
|
||||
if (Int32.TryParse(md.ColF, out int imo))
|
||||
{
|
||||
if ((imo < 1000000) || (imo > 9999999))
|
||||
{
|
||||
imosAreOkay = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
emptyRowCnt++;
|
||||
if (emptyRowCnt > MAX_EMPTY_ROWS_ON_IMPORT) break;
|
||||
{
|
||||
imosAreOkay = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
imosAreOkay = false;
|
||||
}
|
||||
|
||||
if (!imosAreOkay)
|
||||
{
|
||||
MessageBox.Show($"Invalid IMO in row {currentRow}, aborting import", Properties.Resources.textCaptionError, MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
break;
|
||||
}
|
||||
|
||||
importData.Add(md);
|
||||
|
||||
if (isFirstRow) isFirstRow = false;
|
||||
}
|
||||
}
|
||||
@ -424,7 +467,7 @@ namespace ENI2.Controls
|
||||
MessageBox.Show("Error reading Excel: " + ex.Message, Properties.Resources.textCaptionError, MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
|
||||
if (importData.Count > 0)
|
||||
if (imosAreOkay && importData.Count > 0)
|
||||
{
|
||||
busyControl.BusyState = Util.UIHelper.BusyStateEnum.BUSY;
|
||||
|
||||
@ -453,10 +496,10 @@ namespace ENI2.Controls
|
||||
this.TimeFilterItemSource();
|
||||
// this.SortItemSource();
|
||||
busyControl.BusyState = Util.UIHelper.BusyStateEnum.NEUTRAL;
|
||||
}
|
||||
|
||||
this.dataGridPOCores.Items.Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
stream.Close();
|
||||
}
|
||||
@ -557,9 +600,9 @@ namespace ENI2.Controls
|
||||
md.MessageCore.BSMDStatusInternal = MessageCore.BSMDStatus.TOSEND;
|
||||
md.MessageCore.Incoming = true;
|
||||
md.MessageCore.DefaultReportingPartyId = App.UserId.Value;
|
||||
await DBManagerAsync.Save(md.MessageCore);
|
||||
await DBManagerAsync.SaveAsync(md.MessageCore);
|
||||
md.MessageCoreId = md.MessageCore.Id.Value;
|
||||
await DBManagerAsync.Save(md);
|
||||
await DBManagerAsync.SaveAsync(md);
|
||||
|
||||
// Meldeklassen für neuen Anlauf erzeugen
|
||||
// TODO: pre-set certain fields taken from Maersk data
|
||||
|
||||
@ -36,8 +36,8 @@
|
||||
<MinimumRequiredVersion>5.4.0.0</MinimumRequiredVersion>
|
||||
<CreateWebPageOnPublish>true</CreateWebPageOnPublish>
|
||||
<WebPage>publish.html</WebPage>
|
||||
<ApplicationRevision>11</ApplicationRevision>
|
||||
<ApplicationVersion>7.9.0.%2a</ApplicationVersion>
|
||||
<ApplicationRevision>8</ApplicationRevision>
|
||||
<ApplicationVersion>7.10.0.%2a</ApplicationVersion>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<CreateDesktopShortcut>true</CreateDesktopShortcut>
|
||||
<PublishWizardCompleted>true</PublishWizardCompleted>
|
||||
@ -137,11 +137,11 @@
|
||||
<Reference Include="ExcelDataReader, Version=3.6.0.0, Culture=neutral, PublicKeyToken=93517dbe6a4012fa, processorArchitecture=MSIL">
|
||||
<HintPath>packages\ExcelDataReader.3.6.0\lib\net45\ExcelDataReader.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="log4net, Version=2.0.14.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||
<HintPath>packages\log4net.2.0.14\lib\net45\log4net.dll</HintPath>
|
||||
<Reference Include="log4net, Version=2.0.15.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||
<HintPath>packages\log4net.2.0.15\lib\net45\log4net.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Office.Interop.Excel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
|
||||
<HintPath>packages\Microsoft.Office.Interop.Excel.15.0.4795.1000\lib\net20\Microsoft.Office.Interop.Excel.dll</HintPath>
|
||||
<HintPath>packages\Microsoft.Office.Interop.Excel.15.0.4795.1001\lib\net20\Microsoft.Office.Interop.Excel.dll</HintPath>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
</Reference>
|
||||
<Reference Include="MigraDoc.DocumentObjectModel-gdi, Version=1.50.5147.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
|
||||
@ -162,8 +162,8 @@
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Data.SQLite, Version=1.0.115.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
|
||||
<HintPath>packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.115.0\lib\net46\System.Data.SQLite.dll</HintPath>
|
||||
<Reference Include="System.Data.SQLite, Version=1.0.117.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
|
||||
<HintPath>packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.117.0\lib\net46\System.Data.SQLite.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.IO.Compression" />
|
||||
@ -1009,12 +1009,12 @@
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>"$(SignToolPath)signtool.exe" sign /f $(ProjectDir)\..\misc\codesigning.pfx /p t5bj2dk9ifdIWBPhPra4U $(TargetPath)</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<Import Project="packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.115.0\build\net46\Stub.System.Data.SQLite.Core.NetFramework.targets" Condition="Exists('packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.115.0\build\net46\Stub.System.Data.SQLite.Core.NetFramework.targets')" />
|
||||
<Import Project="packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.117.0\build\net46\Stub.System.Data.SQLite.Core.NetFramework.targets" Condition="Exists('packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.117.0\build\net46\Stub.System.Data.SQLite.Core.NetFramework.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.115.0\build\net46\Stub.System.Data.SQLite.Core.NetFramework.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.115.0\build\net46\Stub.System.Data.SQLite.Core.NetFramework.targets'))" />
|
||||
<Error Condition="!Exists('packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.117.0\build\net46\Stub.System.Data.SQLite.Core.NetFramework.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.117.0\build\net46\Stub.System.Data.SQLite.Core.NetFramework.targets'))" />
|
||||
</Target>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
|
||||
@ -28,7 +28,7 @@
|
||||
</AccessText>
|
||||
</Label>
|
||||
<Image x:Name="imageSource" Grid.Row="1" Grid.Column="1" Margin="4" Source="../Resources/import2.png" AllowDrop="True" Drop="imageSource_Drop" DragEnter="imageSource_DragEnter"/>
|
||||
<TextBox TextWrapping="Wrap" x:Name="textBoxSource" Grid.Row="1" Grid.Column="2" IsReadOnly="True" Margin="2" Drop="imageSource_Drop" AllowDrop="True" DragEnter="imageSource_DragEnter" PreviewDragOver="textBoxSource_PreviewDragOver"/>
|
||||
<TextBox TextWrapping="Wrap" x:Name="textBoxSource" Grid.Row="1" Grid.Column="2" IsReadOnly="True" Margin="2" Drop="imageSource_Drop" AllowDrop="True" DragEnter="imageSource_DragEnter" PreviewDragOver="textBoxSource_PreviewDragOver" PreviewMouseDown="textBoxSource_PreviewMouseDown"/>
|
||||
|
||||
<Label VerticalAlignment="Center" Grid.Row="2" Grid.Column="0">
|
||||
<AccessText TextWrapping="Wrap">
|
||||
@ -36,7 +36,7 @@
|
||||
</AccessText>
|
||||
</Label>
|
||||
<Image x:Name="imageTarget" Grid.Row="2" Grid.Column="1" Margin="4" Source="../Resources/import1.png" AllowDrop="True" Drop="imageTarget_Drop" DragEnter="imageSource_DragEnter"/>
|
||||
<TextBox TextWrapping="Wrap" x:Name="textBoxTarget" Grid.Row="2" Grid.Column="2" IsReadOnly="True" Margin="2" AllowDrop="True" Drop="imageTarget_Drop" DragEnter="imageSource_DragEnter" PreviewDragOver="textBoxSource_PreviewDragOver"/>
|
||||
<TextBox TextWrapping="Wrap" x:Name="textBoxTarget" Grid.Row="2" Grid.Column="2" IsReadOnly="True" Margin="2" AllowDrop="True" Drop="imageTarget_Drop" DragEnter="imageSource_DragEnter" PreviewDragOver="textBoxSource_PreviewDragOver" PreviewMouseDown="textBoxTarget_PreviewMouseDown"/>
|
||||
|
||||
<Button x:Name="buttonCompare" Margin="2" Grid.Row="3" Grid.Column="1" Content="Compare" IsEnabled="False" Click="buttonCompare_Click"/>
|
||||
</Grid>
|
||||
|
||||
@ -210,5 +210,37 @@ namespace ENI2.EditControls
|
||||
|
||||
#endregion
|
||||
|
||||
#region click on textboxes opens file selection
|
||||
|
||||
private void textBoxSource_PreviewMouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
|
||||
{
|
||||
OpenFileDialog ofd = new OpenFileDialog
|
||||
{
|
||||
Filter = "Excel Files|*.xls;*.xlsx"
|
||||
};
|
||||
if (ofd.ShowDialog() ?? false)
|
||||
{
|
||||
textBoxSource.Text = ofd.FileName;
|
||||
_sourcePath = ofd.FileName;
|
||||
}
|
||||
EnableCompareButton();
|
||||
}
|
||||
|
||||
private void textBoxTarget_PreviewMouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
|
||||
{
|
||||
OpenFileDialog ofd = new OpenFileDialog
|
||||
{
|
||||
Filter = "Excel Files|*.xls;*.xlsx"
|
||||
};
|
||||
if (ofd.ShowDialog() ?? false)
|
||||
{
|
||||
textBoxTarget.Text = ofd.FileName;
|
||||
_targetPath = ofd.FileName;
|
||||
}
|
||||
EnableCompareButton();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -41,6 +41,7 @@ namespace ENI2.Excel
|
||||
for (int i = 0; i < data.Count; i++)
|
||||
{
|
||||
MaerskData md = data[i];
|
||||
|
||||
ws.Cells[i + 2, 1].NumberFormat = "TT/hh:mm";
|
||||
ws.Cells[i + 2, 1] = md.ColA;
|
||||
ws.Cells[i + 2, 2].NumberFormat = "TT/hh:mm";
|
||||
@ -57,6 +58,12 @@ namespace ENI2.Excel
|
||||
ws.Cells[i + 2, 12] = md.ColL;
|
||||
ws.Cells[i + 2, 13] = md.ColM ;
|
||||
// ws.Cells[i + 2, 14] = md.Remark;
|
||||
|
||||
if((md.MessageCore != null) && (md.MessageCore.Cancelled ?? false))
|
||||
{
|
||||
ws.Rows[i + 2].Font.Strikethrough = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
wb.SaveAs(filename, XlFileFormat.xlOpenXMLWorkbook, Type.Missing, Type.Missing, Type.Missing,
|
||||
|
||||
@ -1072,10 +1072,18 @@ namespace ENI2.Excel
|
||||
noa_nod.CallPurposes.Add(callPurpose);
|
||||
}
|
||||
callPurpose.CallPurposeCode = ((int?)reader.ReadNumber(callPurposeCodeKey)) ?? 0;
|
||||
if (callPurposeDescription.IsNullOrEmpty())
|
||||
{
|
||||
if(Util.GlobalStructures.Edifact8025.ContainsKey(callPurpose.CallPurposeCode))
|
||||
callPurpose.CallPurposeDescription = Util.GlobalStructures.Edifact8025[callPurpose.CallPurposeCode];
|
||||
}
|
||||
else
|
||||
{
|
||||
callPurpose.CallPurposeDescription = callPurposeDescription;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
string lastPort = reader.ReadText("NOA_NOD.LastPort")?.Trim().ToUpper();
|
||||
|
||||
@ -2019,7 +2027,7 @@ namespace ENI2.Excel
|
||||
{
|
||||
if (Int32.TryParse(ladg.CargoCodeNST, out int ccnst))
|
||||
{
|
||||
if ((ccnst <= 0) && (ccnst > 20))
|
||||
if ((ccnst <= 0) || (ccnst > 20))
|
||||
{
|
||||
ladg.CargoCodeNST = null;
|
||||
}
|
||||
|
||||
@ -335,6 +335,7 @@ namespace ENI2
|
||||
labelVersion.Text = "V. " + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
|
||||
labelUsername.Text = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
|
||||
Microsoft.Win32.SystemEvents.SessionEnded += SystemEvents_SessionEnded;
|
||||
this.textUsername.Focus();
|
||||
}
|
||||
|
||||
private void SystemEvents_SessionEnded(object sender, Microsoft.Win32.SessionEndedEventArgs e)
|
||||
@ -661,10 +662,11 @@ namespace ENI2
|
||||
this.labelStatusBar.Text = string.Format("Rep.Party: {0} {1} [{2}]", this.userEntity.FirstName, this.userEntity.LastName, this.userEntity.Logon);
|
||||
App.UserId = this.userEntity.Id;
|
||||
ReportingParty.CurrentReportingParty = this.userEntity;
|
||||
this.menuItemMaersk.Visibility = Visibility.Visible;
|
||||
|
||||
if (this.userEntity.IsAdmin)
|
||||
{
|
||||
this.menuItemUserAdministration.Visibility = Visibility.Visible;
|
||||
this.menuItemMaersk.Visibility = Visibility.Visible;
|
||||
this.sucheControl.AdminMode = true;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -5,9 +5,9 @@ Sample license text.
|
||||
<packages>
|
||||
<package id="ExcelDataReader" version="3.6.0" targetFramework="net452" />
|
||||
<package id="Extended.Wpf.Toolkit" version="4.3.0" targetFramework="net48" />
|
||||
<package id="log4net" version="2.0.14" targetFramework="net48" />
|
||||
<package id="Microsoft.Office.Interop.Excel" version="15.0.4795.1000" targetFramework="net452" />
|
||||
<package id="log4net" version="2.0.15" targetFramework="net48" />
|
||||
<package id="Microsoft.Office.Interop.Excel" version="15.0.4795.1001" targetFramework="net48" />
|
||||
<package id="PDFsharp-MigraDoc-gdi" version="1.50.5147" targetFramework="net452" />
|
||||
<package id="Stub.System.Data.SQLite.Core.NetFramework" version="1.0.115.0" targetFramework="net48" />
|
||||
<package id="System.Data.SQLite.Core" version="1.0.115.0" targetFramework="net48" />
|
||||
<package id="Stub.System.Data.SQLite.Core.NetFramework" version="1.0.117.0" targetFramework="net48" />
|
||||
<package id="System.Data.SQLite.Core" version="1.0.117.0" targetFramework="net48" />
|
||||
</packages>
|
||||
Binary file not shown.
Binary file not shown.
@ -34,6 +34,12 @@
|
||||
<setting name="ConnectionString" serializeAs="String">
|
||||
<value>Initial Catalog=nswtest;Data Source=192.168.2.24\SQLEXPRESS;Uid=dfuser;pwd=dfpasswd;Persist Security Info=False;Connection Reset=false</value>
|
||||
</setting>
|
||||
<setting name="PurgeFilesTimerIntervalHours" serializeAs="String">
|
||||
<value>24</value>
|
||||
</setting>
|
||||
<setting name="TempFilesMaxAgeDays" serializeAs="String">
|
||||
<value>10</value>
|
||||
</setting>
|
||||
</SendNSWMessageService.Properties.Settings>
|
||||
</applicationSettings>
|
||||
</configuration>
|
||||
|
||||
@ -13,6 +13,7 @@ namespace SendNSWMessageService
|
||||
public partial class NSWSendService : ServiceBase
|
||||
{
|
||||
private Timer _timer;
|
||||
private Timer _filesTimer;
|
||||
private readonly object _timerlock = new object();
|
||||
private bool processRunning = false;
|
||||
private readonly ILog _log = LogManager.GetLogger(typeof(NSWSendService));
|
||||
@ -63,10 +64,22 @@ namespace SendNSWMessageService
|
||||
this._timer.Interval = Properties.Settings.Default.SleepSeconds * 1000;
|
||||
this._timer.Elapsed += _timer_Elapsed;
|
||||
this._timer.Enabled = true;
|
||||
|
||||
this._filesTimer = new Timer();
|
||||
this._filesTimer.Interval = Properties.Settings.Default.PurgeFilesTimerIntervalHours * 60 * 60 * 1000; // hours to millisecs
|
||||
this._filesTimer.Elapsed += _filesTimer_Elapsed;
|
||||
this._filesTimer.Enabled = true;
|
||||
}
|
||||
|
||||
private void _filesTimer_Elapsed(object sender, ElapsedEventArgs e)
|
||||
{
|
||||
bsmd.dbh.MessageController.PurgeOldFiles(Properties.Settings.Default.TempFilesMaxAgeDays);
|
||||
bsmd.hisnord.transmitter.PurgeOldFiles(Properties.Settings.Default.TempFilesMaxAgeDays);
|
||||
}
|
||||
|
||||
public void DoOnce()
|
||||
{
|
||||
this._filesTimer_Elapsed(null, null);
|
||||
this._timer_Elapsed(null, null);
|
||||
}
|
||||
|
||||
@ -308,16 +321,19 @@ namespace SendNSWMessageService
|
||||
protected override void OnPause()
|
||||
{
|
||||
this._timer.Stop();
|
||||
this._filesTimer.Stop();
|
||||
}
|
||||
|
||||
protected override void OnContinue()
|
||||
{
|
||||
this._timer.Start();
|
||||
this._filesTimer.Start();
|
||||
}
|
||||
|
||||
protected override void OnStop()
|
||||
{
|
||||
this._timer.Enabled = false;
|
||||
this._filesTimer.Enabled = false;
|
||||
this.EventLog.WriteEntry("NSW Send Service stopped.", EventLogEntryType.Information);
|
||||
_log.Info("NSW Send Service stopped");
|
||||
}
|
||||
|
||||
@ -41,5 +41,23 @@ namespace SendNSWMessageService.Properties {
|
||||
return ((string)(this["ConnectionString"]));
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("24")]
|
||||
public int PurgeFilesTimerIntervalHours {
|
||||
get {
|
||||
return ((int)(this["PurgeFilesTimerIntervalHours"]));
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("10")]
|
||||
public int TempFilesMaxAgeDays {
|
||||
get {
|
||||
return ((int)(this["TempFilesMaxAgeDays"]));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,5 +8,11 @@
|
||||
<Setting Name="ConnectionString" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)">Initial Catalog=nswtest;Data Source=192.168.2.24\SQLEXPRESS;Uid=dfuser;pwd=dfpasswd;Persist Security Info=False;Connection Reset=false</Value>
|
||||
</Setting>
|
||||
<Setting Name="PurgeFilesTimerIntervalHours" Type="System.Int32" Scope="Application">
|
||||
<Value Profile="(Default)">24</Value>
|
||||
</Setting>
|
||||
<Setting Name="TempFilesMaxAgeDays" Type="System.Int32" Scope="Application">
|
||||
<Value Profile="(Default)">10</Value>
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
||||
@ -40,8 +40,8 @@
|
||||
<AssemblyOriginatorKeyFile>..\bsmdKey.snk</AssemblyOriginatorKeyFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="log4net, Version=2.0.14.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\log4net.2.0.14\lib\net45\log4net.dll</HintPath>
|
||||
<Reference Include="log4net, Version=2.0.15.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\log4net.2.0.15\lib\net45\log4net.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="log4net" version="2.0.14" targetFramework="net48" />
|
||||
<package id="log4net" version="2.0.15" targetFramework="net48" />
|
||||
</packages>
|
||||
@ -46,8 +46,8 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="log4net, Version=2.0.14.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||
<HintPath>..\ENI2\packages\log4net.2.0.14\lib\net45\log4net.dll</HintPath>
|
||||
<Reference Include="log4net, Version=2.0.15.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||
<HintPath>..\ENI2\packages\log4net.2.0.15\lib\net45\log4net.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="log4net" version="2.0.14" targetFramework="net48" />
|
||||
<package id="log4net" version="2.0.15" targetFramework="net48" />
|
||||
</packages>
|
||||
@ -38,8 +38,8 @@
|
||||
<AssemblyOriginatorKeyFile>..\bsmdKey.snk</AssemblyOriginatorKeyFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="log4net, Version=2.0.14.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\log4net.2.0.14\lib\net45\log4net.dll</HintPath>
|
||||
<Reference Include="log4net, Version=2.0.15.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\log4net.2.0.15\lib\net45\log4net.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="log4net" version="2.0.14" targetFramework="net48" />
|
||||
<package id="log4net" version="2.0.15" targetFramework="net48" />
|
||||
</packages>
|
||||
@ -29,7 +29,7 @@ namespace bsmd.database
|
||||
|
||||
#region public methods
|
||||
|
||||
public static async Task<int> Save(DatabaseEntity entity)
|
||||
public static async Task<int> SaveAsync(DatabaseEntity entity)
|
||||
{
|
||||
SqlCommand cmd = new SqlCommand();
|
||||
entity.PrepareSave(cmd);
|
||||
|
||||
@ -159,7 +159,6 @@ namespace bsmd.database
|
||||
public string VehicleLicenseNumber { get; set; }
|
||||
|
||||
[ShowReport]
|
||||
[Validation(ValidationCode.NOT_NULL)]
|
||||
[MaxLength(24)]
|
||||
[ENI2Validation]
|
||||
[MaxWordLength(9)]
|
||||
@ -515,6 +514,14 @@ namespace bsmd.database
|
||||
errors.Add(RuleEngine.CreateError(ValidationCode.IMPLAUSIBLE, "IMOClass", null, this.Title, this.Identifier, this.HAZ.IsDeparture ? "HAZD" : "HAZA"));
|
||||
}
|
||||
|
||||
if (!this.StowagePosition.IsNullOrEmpty() && (!this.Bay.IsNullOrEmpty() || !this.Row.IsNullOrEmpty() || !this.Tier.IsNullOrEmpty()))
|
||||
{
|
||||
errors.Add(RuleEngine.CreateError(ValidationCode.IMPLAUSIBLE, "StowagePosition AND Bay/Row/Tier SET", null, this.Title, this.Identifier, this.HAZ.IsDeparture ? "HAZD" : "HAZA"));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (StowagePosition.IsNullOrEmpty())
|
||||
{
|
||||
if (!this.Bay.IsNullOrEmpty())
|
||||
{
|
||||
const string pattern = @"^[0-9]{3}$";
|
||||
@ -538,7 +545,8 @@ namespace bsmd.database
|
||||
if (!regex.IsMatch(this.Tier))
|
||||
errors.Add(RuleEngine.CreateError(ValidationCode.IMPLAUSIBLE, "Tier", null, this.Title, this.Identifier, this.HAZ.IsDeparture ? "HAZD" : "HAZA"));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@ -49,7 +49,9 @@ namespace bsmd.database
|
||||
[Description("In the past, id or not")]
|
||||
DONE,
|
||||
[Description("no ETA found on data record")]
|
||||
NO_ETA
|
||||
NO_ETA,
|
||||
[Description("VISIT-ID was cancelled")]
|
||||
CANCELLED
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -2,6 +2,6 @@
|
||||
|
||||
[assembly: AssemblyCompany("schick Informatik")]
|
||||
[assembly: AssemblyProduct("BSMD NSW interface")]
|
||||
[assembly: AssemblyInformationalVersion("7.9.0")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2014-2022 schick Informatik")]
|
||||
[assembly: AssemblyInformationalVersion("7.10.0")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2014-2023 schick Informatik")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
@ -1,4 +1,4 @@
|
||||
using System.Reflection;
|
||||
|
||||
[assembly: AssemblyVersion("7.9.0.*")]
|
||||
[assembly: AssemblyVersion("7.10.0.*")]
|
||||
|
||||
|
||||
@ -205,7 +205,7 @@ namespace bsmd.database
|
||||
{
|
||||
MaxLengthAttribute mla = Attribute.GetCustomAttribute(property, typeof(MaxLengthAttribute)) as MaxLengthAttribute;
|
||||
bool isStandardML = (mla.MaxLength == 99) || (mla.MaxLength == 100);
|
||||
if((value.Length >= 90) && ((mla.MaxLength == value.Length) || isStandardML))
|
||||
if(((value.Length >= 90) && isStandardML) || ((mla.MaxLength == value.Length) && (value.Length > 20) && !isStandardML))
|
||||
{
|
||||
// put out a warning this might be truncated
|
||||
violations.Add(RuleEngine.CreateViolation(ValidationCode.TRUNCATE, property.Name, value, entity.Title, identifier, entity.Tablename));
|
||||
|
||||
@ -269,7 +269,7 @@ namespace bsmd.database
|
||||
message.MessageCore = core;
|
||||
message.MessageCoreId = core.Id;
|
||||
message.MessageNotificationClass = notificationClass;
|
||||
await DBManagerAsync.Save(message);
|
||||
await DBManagerAsync.SaveAsync(message);
|
||||
result.Add(message);
|
||||
}
|
||||
else
|
||||
@ -297,7 +297,7 @@ namespace bsmd.database
|
||||
if (classElement != null) // null für Visit/Transit
|
||||
{
|
||||
classElement.MessageHeader = message;
|
||||
await DBManagerAsync.Save(classElement);
|
||||
await DBManagerAsync.SaveAsync(classElement);
|
||||
message.Elements.Add(classElement);
|
||||
}
|
||||
}
|
||||
|
||||
@ -83,11 +83,11 @@
|
||||
<CodeAnalysisRuleSet>..\code.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="log4net, Version=2.0.14.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||
<HintPath>..\ENI2\packages\log4net.2.0.14\lib\net45\log4net.dll</HintPath>
|
||||
<Reference Include="log4net, Version=2.0.15.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\log4net.2.0.15\lib\net45\log4net.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\ENI2\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="log4net" version="2.0.14" targetFramework="net48" />
|
||||
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net45" />
|
||||
<package id="log4net" version="2.0.15" targetFramework="net48" />
|
||||
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net48" />
|
||||
</packages>
|
||||
@ -6,6 +6,7 @@ using System;
|
||||
using System.IO;
|
||||
|
||||
using bsmd.database;
|
||||
using System.Linq;
|
||||
|
||||
namespace bsmd.dbh
|
||||
{
|
||||
@ -14,6 +15,8 @@ namespace bsmd.dbh
|
||||
private static readonly ILog _log = LogManager.GetLogger(typeof(MessageController));
|
||||
private static int? _fileSequenceCounter = null;
|
||||
|
||||
#region send single message
|
||||
|
||||
public static bool SendMessage(MessageCore core, Message message)
|
||||
{
|
||||
bool result = true;
|
||||
@ -63,6 +66,10 @@ namespace bsmd.dbh
|
||||
return result;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region send cancel core messaage
|
||||
|
||||
public static bool SendCancelCore(MessageCore core)
|
||||
{
|
||||
bool result = true;
|
||||
@ -103,6 +110,10 @@ namespace bsmd.dbh
|
||||
return result;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region send and receive files (SFTP)
|
||||
|
||||
public static void SendAndReceive()
|
||||
{
|
||||
// sent unsent messages in output folder
|
||||
@ -144,5 +155,50 @@ namespace bsmd.dbh
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Purge old files
|
||||
|
||||
public static void PurgeOldFiles(int maxAgeDays)
|
||||
{
|
||||
try
|
||||
{
|
||||
int cnt = 0;
|
||||
DirectoryInfo info = new DirectoryInfo(Properties.Settings.Default.IncomingArchiveFolder);
|
||||
FileInfo[] files = info.GetFiles();
|
||||
foreach (FileInfo file in files)
|
||||
{
|
||||
if (file.CreationTime < DateTime.Now.AddDays(-maxAgeDays))
|
||||
{
|
||||
_log.Debug($"deleting {file.Name}");
|
||||
file.Delete();
|
||||
cnt++;
|
||||
}
|
||||
}
|
||||
_log.Info($"deleted {cnt} files from {Properties.Settings.Default.IncomingArchiveFolder}");
|
||||
|
||||
cnt = 0;
|
||||
info = new DirectoryInfo(Properties.Settings.Default.OutgoingArchiveFolder);
|
||||
files = info.GetFiles();
|
||||
foreach (FileInfo file in files)
|
||||
{
|
||||
if (file.CreationTime < DateTime.Now.AddDays(-maxAgeDays))
|
||||
{
|
||||
_log.Debug($"deleting {file.Name}");
|
||||
file.Delete();
|
||||
cnt++;
|
||||
}
|
||||
}
|
||||
_log.Info($"deleted {cnt} files from {Properties.Settings.Default.OutgoingArchiveFolder}");
|
||||
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
_log.ErrorFormat("Error deleting old files: {0}", ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -38,8 +38,8 @@
|
||||
<AssemblyOriginatorKeyFile>..\bsmdKey.snk</AssemblyOriginatorKeyFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="log4net, Version=2.0.14.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\log4net.2.0.14\lib\net45\log4net.dll</HintPath>
|
||||
<Reference Include="log4net, Version=2.0.15.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\log4net.2.0.15\lib\net45\log4net.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="log4net" version="2.0.14" targetFramework="net48" />
|
||||
<package id="log4net" version="2.0.15" targetFramework="net48" />
|
||||
</packages>
|
||||
12
bsmd.hisnord/Properties/Settings.Designer.cs
generated
12
bsmd.hisnord/Properties/Settings.Designer.cs
generated
@ -34,7 +34,7 @@ namespace bsmd.hisnord.Properties {
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("E:\\svnlager\\BSMD\\nsw\\HIS-NORD\\Transmitter-Tool\\IMP")]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("Transmitter-Tool\\IMP")]
|
||||
public string OutputDir {
|
||||
get {
|
||||
return ((string)(this["OutputDir"]));
|
||||
@ -43,7 +43,7 @@ namespace bsmd.hisnord.Properties {
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("E:\\svnlager\\BSMD\\nsw\\HIS-NORD\\Transmitter-Tool\\client.bat")]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("Transmitter-Tool\\client.bat")]
|
||||
public string Transmitter {
|
||||
get {
|
||||
return ((string)(this["Transmitter"]));
|
||||
@ -52,7 +52,7 @@ namespace bsmd.hisnord.Properties {
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("E:\\svnlager\\BSMD\\nsw\\HIS-NORD\\Transmitter-Tool\\RESULTS")]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("Transmitter-Tool\\RESULTS")]
|
||||
public string ResultDir {
|
||||
get {
|
||||
return ((string)(this["ResultDir"]));
|
||||
@ -61,7 +61,7 @@ namespace bsmd.hisnord.Properties {
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("E:\\svnlager\\BSMD\\nsw\\HIS-NORD\\Transmitter-Tool\\ANSWERS")]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("Transmitter-Tool\\ANSWERS")]
|
||||
public string AnswerDir {
|
||||
get {
|
||||
return ((string)(this["AnswerDir"]));
|
||||
@ -70,7 +70,7 @@ namespace bsmd.hisnord.Properties {
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("E:\\svnlager\\BSMD\\nsw\\HIS-NORD\\Transmitter-Tool\\ANSWERS_DONE")]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("Transmitter-Tool\\ANSWERS_DONE")]
|
||||
public string AnswerArchiveDir {
|
||||
get {
|
||||
return ((string)(this["AnswerArchiveDir"]));
|
||||
@ -79,7 +79,7 @@ namespace bsmd.hisnord.Properties {
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("E:\\svnlager\\BSMD\\nsw\\HIS-NORD\\Transmitter-Tool\\ANSWERS_CORRUPT")]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("Transmitter-Tool\\ANSWERS_CORRUPT")]
|
||||
public string AnswerCorruptDir {
|
||||
get {
|
||||
return ((string)(this["AnswerCorruptDir"]));
|
||||
|
||||
@ -6,22 +6,22 @@
|
||||
<Value Profile="(Default)">1</Value>
|
||||
</Setting>
|
||||
<Setting Name="OutputDir" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)">E:\svnlager\BSMD\nsw\HIS-NORD\Transmitter-Tool\IMP</Value>
|
||||
<Value Profile="(Default)">Transmitter-Tool\IMP</Value>
|
||||
</Setting>
|
||||
<Setting Name="Transmitter" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)">E:\svnlager\BSMD\nsw\HIS-NORD\Transmitter-Tool\client.bat</Value>
|
||||
<Value Profile="(Default)">Transmitter-Tool\client.bat</Value>
|
||||
</Setting>
|
||||
<Setting Name="ResultDir" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)">E:\svnlager\BSMD\nsw\HIS-NORD\Transmitter-Tool\RESULTS</Value>
|
||||
<Value Profile="(Default)">Transmitter-Tool\RESULTS</Value>
|
||||
</Setting>
|
||||
<Setting Name="AnswerDir" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)">E:\svnlager\BSMD\nsw\HIS-NORD\Transmitter-Tool\ANSWERS</Value>
|
||||
<Value Profile="(Default)">Transmitter-Tool\ANSWERS</Value>
|
||||
</Setting>
|
||||
<Setting Name="AnswerArchiveDir" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)">E:\svnlager\BSMD\nsw\HIS-NORD\Transmitter-Tool\ANSWERS_DONE</Value>
|
||||
<Value Profile="(Default)">Transmitter-Tool\ANSWERS_DONE</Value>
|
||||
</Setting>
|
||||
<Setting Name="AnswerCorruptDir" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)">E:\svnlager\BSMD\nsw\HIS-NORD\Transmitter-Tool\ANSWERS_CORRUPT</Value>
|
||||
<Value Profile="(Default)">Transmitter-Tool\ANSWERS_CORRUPT</Value>
|
||||
</Setting>
|
||||
<Setting Name="TransmitterRoot" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)">E:\svnlager\BSMD\nsw\HIS-NORD\</Value>
|
||||
|
||||
@ -76,6 +76,8 @@ namespace bsmd.hisnord
|
||||
}
|
||||
}
|
||||
|
||||
#region Create message file to send
|
||||
|
||||
public static bool? CreateSendFile(MessageCore core, Message message)
|
||||
{
|
||||
bool? retval;
|
||||
@ -1809,6 +1811,8 @@ namespace bsmd.hisnord
|
||||
return retval;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region helper func for HAZ positions
|
||||
|
||||
private static void SetHAZPositions(dglist hn_dgList, HAZ haz)
|
||||
|
||||
@ -11,22 +11,22 @@
|
||||
<value>1</value>
|
||||
</setting>
|
||||
<setting name="OutputDir" serializeAs="String">
|
||||
<value>E:\svnlager\BSMD\nsw\HIS-NORD\Transmitter-Tool\IMP</value>
|
||||
<value>Transmitter-Tool\IMP</value>
|
||||
</setting>
|
||||
<setting name="Transmitter" serializeAs="String">
|
||||
<value>E:\svnlager\BSMD\nsw\HIS-NORD\Transmitter-Tool\client.bat</value>
|
||||
<value>Transmitter-Tool\client.bat</value>
|
||||
</setting>
|
||||
<setting name="ResultDir" serializeAs="String">
|
||||
<value>E:\svnlager\BSMD\nsw\HIS-NORD\Transmitter-Tool\RESULTS</value>
|
||||
<value>Transmitter-Tool\RESULTS</value>
|
||||
</setting>
|
||||
<setting name="AnswerDir" serializeAs="String">
|
||||
<value>E:\svnlager\BSMD\nsw\HIS-NORD\Transmitter-Tool\ANSWERS</value>
|
||||
<value>Transmitter-Tool\ANSWERS</value>
|
||||
</setting>
|
||||
<setting name="AnswerArchiveDir" serializeAs="String">
|
||||
<value>E:\svnlager\BSMD\nsw\HIS-NORD\Transmitter-Tool\ANSWERS_DONE</value>
|
||||
<value>Transmitter-Tool\ANSWERS_DONE</value>
|
||||
</setting>
|
||||
<setting name="AnswerCorruptDir" serializeAs="String">
|
||||
<value>E:\svnlager\BSMD\nsw\HIS-NORD\Transmitter-Tool\ANSWERS_CORRUPT</value>
|
||||
<value>Transmitter-Tool\ANSWERS_CORRUPT</value>
|
||||
</setting>
|
||||
<setting name="TransmitterRoot" serializeAs="String">
|
||||
<value>E:\svnlager\BSMD\nsw\HIS-NORD\</value>
|
||||
|
||||
@ -38,8 +38,8 @@
|
||||
<AssemblyOriginatorKeyFile>..\bsmdKey.snk</AssemblyOriginatorKeyFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="log4net, Version=2.0.14.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\log4net.2.0.14\lib\net45\log4net.dll</HintPath>
|
||||
<Reference Include="log4net, Version=2.0.15.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\log4net.2.0.15\lib\net45\log4net.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="log4net" version="2.0.14" targetFramework="net48" />
|
||||
<package id="log4net" version="2.0.15" targetFramework="net48" />
|
||||
</packages>
|
||||
@ -61,7 +61,7 @@ namespace bsmd.hisnord
|
||||
// _log.DebugFormat("started {0}", transmitterProcess.ProcessName);
|
||||
int timeout = Properties.Settings.Default.BatchTimeoutMins * 1000 * 60; // convert to ms
|
||||
|
||||
_log.InfoFormat($"starting transmitter, process ID: {processId}, timeout {timeout} ms.");
|
||||
_log.DebugFormat($"starting transmitter, process ID: {processId}, timeout {timeout} ms.");
|
||||
|
||||
if (!transmitterProcess.WaitForExit((timeout == 0) ? int.MaxValue : timeout))
|
||||
{
|
||||
@ -84,7 +84,7 @@ namespace bsmd.hisnord
|
||||
private static void TransmitterProcess_OutputDataReceived(object sender, DataReceivedEventArgs e)
|
||||
{
|
||||
if(!e.Data.IsNullOrEmpty())
|
||||
_log.Info(e.Data);
|
||||
_log.Debug(e.Data);
|
||||
}
|
||||
|
||||
private static void TransmitterProcess_ErrorDataReceived(object sender, DataReceivedEventArgs e)
|
||||
@ -95,7 +95,7 @@ namespace bsmd.hisnord
|
||||
|
||||
private static void TransmitterProcess_Exited(object sender, EventArgs e)
|
||||
{
|
||||
_log.Info("Transmitter process exited");
|
||||
_log.Debug("Transmitter process exited");
|
||||
processId = null;
|
||||
}
|
||||
|
||||
@ -108,6 +108,61 @@ namespace bsmd.hisnord
|
||||
return result.ReadResult(resultFullPath);
|
||||
}
|
||||
|
||||
public static void PurgeOldFiles(int maxAgeDays)
|
||||
{
|
||||
try
|
||||
{
|
||||
// "ANSWERS_DONE"
|
||||
DirectoryInfo info = new DirectoryInfo(Path.Combine(Properties.Settings.Default.TransmitterRoot, Properties.Settings.Default.AnswerArchiveDir));
|
||||
FileInfo[] files = info.GetFiles();
|
||||
int cnt = 0;
|
||||
foreach (FileInfo file in files)
|
||||
{
|
||||
if (file.CreationTime < DateTime.Now.AddDays(-maxAgeDays))
|
||||
{
|
||||
_log.Debug($"deleting {file.Name}");
|
||||
file.Delete();
|
||||
cnt++;
|
||||
}
|
||||
}
|
||||
_log.Info($"deleted {cnt} files from {Properties.Settings.Default.AnswerArchiveDir}");
|
||||
|
||||
// "RESULTS"
|
||||
cnt = 0;
|
||||
info = new DirectoryInfo(Path.Combine(Properties.Settings.Default.TransmitterRoot, Properties.Settings.Default.ResultDir));
|
||||
files = info.GetFiles();
|
||||
foreach (FileInfo file in files)
|
||||
{
|
||||
if (file.CreationTime < DateTime.Now.AddDays(-maxAgeDays))
|
||||
{
|
||||
_log.Debug($"deleting {file.Name}");
|
||||
file.Delete();
|
||||
cnt++;
|
||||
}
|
||||
}
|
||||
_log.Info($"deleted {cnt} files from {Properties.Settings.Default.ResultDir}");
|
||||
|
||||
// "READY"
|
||||
cnt = 0;
|
||||
info = new DirectoryInfo(Path.Combine(Properties.Settings.Default.TransmitterRoot, "READY"));
|
||||
files = info.GetFiles();
|
||||
foreach (FileInfo file in files)
|
||||
{
|
||||
if (file.CreationTime < DateTime.Now.AddDays(-maxAgeDays))
|
||||
{
|
||||
_log.Debug($"deleting {file.Name}");
|
||||
file.Delete();
|
||||
cnt++;
|
||||
}
|
||||
}
|
||||
_log.Info($"deleted {cnt} files from READY");
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
_log.ErrorFormat("Error trying to delete old files: {0}", ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// class to read transmitter result xml files
|
||||
/// </summary>
|
||||
|
||||
@ -38,8 +38,8 @@
|
||||
<AssemblyOriginatorKeyFile>..\bsmdKey.snk</AssemblyOriginatorKeyFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="log4net, Version=2.0.14.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\log4net.2.0.14\lib\net45\log4net.dll</HintPath>
|
||||
<Reference Include="log4net, Version=2.0.15.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\log4net.2.0.15\lib\net45\log4net.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="log4net" version="2.0.14" targetFramework="net48" />
|
||||
<package id="log4net" version="2.0.15" targetFramework="net48" />
|
||||
</packages>
|
||||
Loading…
Reference in New Issue
Block a user