epd simul
This commit is contained in:
parent
6adcf2798f
commit
f76a13619e
10 changed files with 162 additions and 79 deletions
|
|
@ -11,6 +11,7 @@ EpdBase::Epd2U::Epd2U(int comport)
|
|||
{
|
||||
port = comport;
|
||||
CommsInitialized = 0;
|
||||
if (port == 0) return;
|
||||
SetAutoCommit(0);
|
||||
Error = 123;
|
||||
//SetTimeouts(port, 20, 1000, 1000);
|
||||
|
|
@ -18,6 +19,7 @@ EpdBase::Epd2U::Epd2U(int comport)
|
|||
|
||||
DWORD EpdBase::Epd2U::WriteConfig()
|
||||
{
|
||||
if (port == 0) return 1;
|
||||
return WriteDisplayConfig(00,2,40,10, 2,displayConfig, 56);
|
||||
}
|
||||
|
||||
|
|
@ -25,8 +27,11 @@ DWORD EpdBase::Epd2U::StartCom()
|
|||
{
|
||||
DWORD rv;
|
||||
ErrorReason = 0;
|
||||
|
||||
int mx = 10;
|
||||
if (port == 0) {
|
||||
CommsInitialized = 1;
|
||||
return 1;
|
||||
}
|
||||
if (CommsInitialized==0)
|
||||
do {
|
||||
InitRv = InitComms(port, 9600, 8, 0, 0);
|
||||
|
|
@ -51,7 +56,7 @@ DWORD EpdBase::Epd2U::StartCom()
|
|||
|
||||
EpdBase::Epd2U::~Epd2U()
|
||||
{
|
||||
DeinitComms(port);
|
||||
if (port>0) DeinitComms(port);
|
||||
CommsInitialized = 0;
|
||||
}
|
||||
|
||||
|
|
@ -67,9 +72,14 @@ int EpdBase::Epd2U::StartDiscover()
|
|||
|
||||
//rv =SetRetryCounts(RxRetryCount, TxRetryCount);
|
||||
|
||||
if (port == 0) {
|
||||
DeviceCount = 1;
|
||||
DeviceIDs[0] = 768;
|
||||
return 1;
|
||||
}
|
||||
|
||||
FlushDiscoveryCache(port);
|
||||
FlushBuffers(port);
|
||||
|
||||
int tries = 25; DeviceCount = 0; DiscRV = 1;
|
||||
while (tries-- > 0 && DeviceCount == 0 )
|
||||
{
|
||||
|
|
@ -88,17 +98,20 @@ int EpdBase::Epd2U::StartDiscover()
|
|||
void EpdBase::Epd2U::Open(DWORD DeviceID)
|
||||
{
|
||||
CurrentDeviceID = DeviceID;
|
||||
ConRV = Connect(DeviceID);
|
||||
if (ConRV == 0) Error = GetErrorDetails(&ErrorSource, &ErrorReason, &ErrorData);
|
||||
else {
|
||||
OpenRV = OpenDevice(port, CurrentDeviceID);
|
||||
if (OpenRV == 0) Error = GetErrorDetails(&ErrorSource, &ErrorReason, &ErrorData);
|
||||
if (port > 0) {
|
||||
ConRV = Connect(DeviceID);
|
||||
if (ConRV == 0) Error = GetErrorDetails(&ErrorSource, &ErrorReason, &ErrorData);
|
||||
else {
|
||||
OpenRV = OpenDevice(port, CurrentDeviceID);
|
||||
if (OpenRV == 0) Error = GetErrorDetails(&ErrorSource, &ErrorReason, &ErrorData);
|
||||
}
|
||||
}
|
||||
else { OpenRV = ConRV = 1; }
|
||||
}
|
||||
|
||||
void EpdBase::Epd2U::Close()
|
||||
{
|
||||
CloseDevice();
|
||||
if (port>0) CloseDevice();
|
||||
//DeinitComms(port); CommsInitialized = 0;
|
||||
}
|
||||
|
||||
|
|
@ -152,6 +165,13 @@ WORD EpdBase::Epd2U::ReadStatus()
|
|||
ErrorSource = ErrorReason = ErrorData = 0;
|
||||
EpdID = HardVersion = SoftVersion = FunctionFlags = 0;
|
||||
|
||||
if (port == 0) {
|
||||
EpdID = 4567;
|
||||
EpdType = 0;
|
||||
FunctionFlags = 0x000;
|
||||
return 1;
|
||||
}
|
||||
|
||||
CommitRV = ReadEpdStatus(&EpdClock, &RealTime, &IssueCount, &OffTime, &OperatingStatus, &ErrorStatus, &AlarmStatus, &OtherAlarms, &EEPROMBadSectors);
|
||||
if (CommitRV == 1) CommitRV = Commit();
|
||||
if (CommitRV == 1) CommitRV = ReadEpdID(
|
||||
|
|
@ -196,6 +216,8 @@ WORD EpdBase::Epd2U::ReadStatus()
|
|||
|
||||
WORD EpdBase::Epd2U::EPDReadExtraStatus()
|
||||
{
|
||||
if (port == 0) return 1;
|
||||
|
||||
byBatADC = bySupplyADC = 0;
|
||||
/*CommitRV = ReadA2ConfigStatus(
|
||||
&byBatADC,
|
||||
|
|
@ -215,6 +237,8 @@ WORD EpdBase::Epd2U::EPDReadExtraStatus()
|
|||
|
||||
WORD EpdBase::Epd2U::EPDReadConfig()
|
||||
{
|
||||
if (port == 0) return 1;
|
||||
|
||||
ReadConfigRV = ReadConfig(
|
||||
&CountDownTime,
|
||||
&ReturnTime,
|
||||
|
|
@ -237,6 +261,8 @@ WORD EpdBase::Epd2U::EPDReadConfig()
|
|||
|
||||
WORD EpdBase::Epd2U::TurnOff()
|
||||
{
|
||||
if (port == 0) return 1;
|
||||
|
||||
OffRV = EpdOff();
|
||||
if (OffRV == 0) Error = GetErrorDetails(&ErrorSource, &ErrorReason, &ErrorData);
|
||||
EndSessionRV = EndSession(AlarmCtrl,10);
|
||||
|
|
@ -251,7 +277,7 @@ WORD EpdBase::Epd2U::TurnOff()
|
|||
|
||||
WORD EpdBase::Epd2U::TurnOn()
|
||||
{
|
||||
|
||||
if (port == 0) return 1;
|
||||
//OnRV = EpdOn();
|
||||
//if (OnRV == 0) Error = GetErrorDetails(&ErrorSource, &ErrorReason, &ErrorData);
|
||||
|
||||
|
|
@ -270,6 +296,7 @@ WORD EpdBase::Epd2U::TurnOn()
|
|||
|
||||
WORD EpdBase::Epd2U::WriteCal()
|
||||
{
|
||||
if (port == 0) return 1;
|
||||
|
||||
if (K6 > 2000)
|
||||
{ CommitRV = 0;
|
||||
|
|
@ -289,8 +316,13 @@ WORD EpdBase::Epd2U::WriteCal()
|
|||
|
||||
WORD EpdBase::Epd2U::ReadTresHolds()
|
||||
{
|
||||
if (port == 0) {
|
||||
Hp10THDose1 = Hp10THDose2 = Hp10THDose2 = 123;
|
||||
Hp10Rate1On = Hp10Rate2On = Hp07RateOn = Hp10Rate1Off = Hp10Rate2Off = Hp07RateOff = 124;
|
||||
return 1;
|
||||
}
|
||||
Hp10THDose1 = Hp10THDose2 = Hp07THDose = 0;
|
||||
ReadDoseTresholdRV = ReadAlarmDoseThresholds(&Hp10THDose1, &Hp10THDose2, &Hp07THDose);
|
||||
ReadDoseTresholdRV = ReadAlarmDoseThresholds(&Hp10THDose1, &Hp10THDose2, &Hp10THDose2);
|
||||
CommitRV = Commit();
|
||||
if (CommitRV == 0) Error = GetErrorDetails(&ErrorSource, &ErrorReason, &ErrorData);
|
||||
ReadAlarmRateThresholdsRV = ReadAlarmRateThresholds(
|
||||
|
|
@ -318,6 +350,12 @@ WORD EpdBase::Epd2U::ReadTresHolds()
|
|||
|
||||
WORD EpdBase::Epd2U::ReadDoses()
|
||||
{
|
||||
if (port == 0) {
|
||||
Hp10Dose = Hp07Dose = Hp10Total = Hp07Total = Knocks = Resets = QualityData = 21;
|
||||
Hp10Peak = Hp07Peak = Hp10Time = Hp07Time = 1000;
|
||||
ErrorSource = ErrorReason = ErrorData = 0;
|
||||
return 1;
|
||||
}
|
||||
ReadDosesQualityRV = ReadPeaksRV = CommitRV = 0;
|
||||
ReadDosesQualityRV = ReadDosesQuality(
|
||||
&Hp10Dose,
|
||||
|
|
@ -333,7 +371,6 @@ WORD EpdBase::Epd2U::ReadDoses()
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
ReadPeaksRV = ReadPeaks(
|
||||
&Hp10Peak,
|
||||
&Hp07Peak,
|
||||
|
|
@ -360,14 +397,13 @@ WORD EpdBase::Epd2U::ReadDoses()
|
|||
&HG);
|
||||
CommitRV = Commit();
|
||||
if (CommitRV == 0) Error = GetErrorDetails(&ErrorSource, &ErrorReason, &ErrorData);
|
||||
|
||||
|
||||
return CommitRV;
|
||||
}
|
||||
|
||||
|
||||
WORD EpdBase::Epd2U::PrepareForIssue()
|
||||
{
|
||||
if (port == 0) return 1;
|
||||
CommitRV = WriteConfig();
|
||||
if (CommitRV) CommitRV = Commit();
|
||||
if (CommitRV) CommitRV = ClearDose();
|
||||
|
|
@ -379,6 +415,7 @@ WORD EpdBase::Epd2U::PrepareForIssue()
|
|||
WORD EpdBase::Epd2U::DeIssue()
|
||||
{
|
||||
ClearDoseRV = ClearTotalDoseRV = ClearPeakRatesRV = DeIssueEpdRV = 0;
|
||||
if (port == 0) return 1;
|
||||
if (CommitRV) CommitRV = ClearDose();
|
||||
if (CommitRV) CommitRV = ClearTotalDose();
|
||||
if (CommitRV) CommitRV = ClearPeakRates();
|
||||
|
|
@ -409,7 +446,7 @@ WORD EpdBase::Epd2U::DeIssue()
|
|||
WORD EpdBase::Epd2U::Issue()
|
||||
{
|
||||
IssueEpdRV = WriteAlarmDoseThresholdsRV = WriteAlarmRateThresholdsRV = WriteWearerNameRV = OnRV = CommitRV = 0;
|
||||
|
||||
if (port == 0) return 1;
|
||||
DWORD OKRV = SetFailFlag(); // all actions have been completed
|
||||
if (OKRV) OKRV = Commit();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +1,11 @@
|
|||
#include "stdafx.h"
|
||||
|
||||
#include "EpdBaseClr.h"
|
||||
|
||||
EpdBaseClr::Epd2::Epd2(int port)
|
||||
{
|
||||
//HANDLE hMod = LoadLibrary(L"Reader2.dll");
|
||||
epd = new EpdBase::Epd2U(port);
|
||||
b = gcnew sEpdBase();
|
||||
epd = new EpdBase::Epd2U(port);
|
||||
this->InitRV = epd->InitRv;
|
||||
epd->StartCom();
|
||||
}
|
||||
|
|
@ -25,17 +24,20 @@ EpdBaseClr::Epd2::!Epd2()
|
|||
int EpdBaseClr::Epd2::Connect(bool reinit)
|
||||
{
|
||||
ConnectError = 0;
|
||||
if (epd->CommsInitialized==0) epd->StartCom();
|
||||
b->CurrentDeviceID = 0;
|
||||
DeviceCount = 0;
|
||||
DiscRV = epd->StartDiscover();
|
||||
if (DiscRV == 1)
|
||||
{
|
||||
DeviceCount = epd->DeviceCount;
|
||||
if (epd->DeviceCount >= 0) b->CurrentDeviceID = epd->DeviceIDs[0];
|
||||
}
|
||||
else {
|
||||
ConnectError = epd->Error;
|
||||
DiscRV = 0;
|
||||
if (epd != nullptr) {
|
||||
if (epd->CommsInitialized == 0) epd->StartCom();
|
||||
DiscRV = epd->StartDiscover();
|
||||
if (DiscRV == 1)
|
||||
{
|
||||
DeviceCount = epd->DeviceCount;
|
||||
if (epd->DeviceCount >= 0) b->CurrentDeviceID = epd->DeviceIDs[0];
|
||||
}
|
||||
else {
|
||||
ConnectError = epd->Error;
|
||||
}
|
||||
}
|
||||
return DiscRV;
|
||||
}
|
||||
|
|
@ -43,8 +45,7 @@ int EpdBaseClr::Epd2::Connect(bool reinit)
|
|||
int EpdBaseClr::Epd2::Close()
|
||||
{
|
||||
b->CurrentDeviceID = 0;
|
||||
epd->Close();
|
||||
//delete epd;
|
||||
if (epd!=nullptr) epd->Close();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -85,7 +86,6 @@ int EpdBaseClr::Epd2::DecodeStatus()
|
|||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int EpdBaseClr::Epd2::GetStatus()
|
||||
{
|
||||
GetStatusError = 0; StatusRV = 0; Issued = false;
|
||||
|
|
@ -204,7 +204,6 @@ int EpdBaseClr::Epd2::SetIssued()
|
|||
|
||||
int EpdBaseClr::Epd2::WriteCalibration()
|
||||
{
|
||||
|
||||
epd->K1 = K1;
|
||||
epd->K2 = K2;
|
||||
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ namespace RegisterBAdge
|
|||
UpdPers.Parameters["LastName"].Value = (string)r["LastName"];
|
||||
UpdPers.Parameters["NickName"].Value = (string)r["NickName"];
|
||||
UpdPers.Parameters["birthDate"].Value = (DateTime)r["birthDate"];
|
||||
UpdPers.Parameters["conCode"].Value = (string)r["conCode"];
|
||||
//UpdPers.Parameters["conCode"].Value = (string)r["conCode"];
|
||||
UpdPers.Parameters["AccessAllow"].Value = (Boolean)r["AccessAllow"];
|
||||
UpdPers.Parameters["Language"].Value = (string)r["Language"];
|
||||
UpdPers.Parameters["VisitIdLocked"].Value = DBNull.Value;
|
||||
|
|
@ -168,7 +168,7 @@ namespace RegisterBAdge
|
|||
UpdPers.Parameters.Add(new System.Data.SqlClient.SqlParameter("LastName", System.Data.SqlDbType.VarChar, 30, System.Data.ParameterDirection.Input, false, 0, 0, null, System.Data.DataRowVersion.Current, DBNull.Value));
|
||||
UpdPers.Parameters.Add(new System.Data.SqlClient.SqlParameter("NickName", System.Data.SqlDbType.VarChar, 30, System.Data.ParameterDirection.Input, false, 0, 0, null, System.Data.DataRowVersion.Current, DBNull.Value));
|
||||
UpdPers.Parameters.Add(new System.Data.SqlClient.SqlParameter("birthDate", System.Data.SqlDbType.Date, 0, System.Data.ParameterDirection.Input, false, 0, 0, null, System.Data.DataRowVersion.Current, DBNull.Value));
|
||||
UpdPers.Parameters.Add(new System.Data.SqlClient.SqlParameter("conCode", System.Data.SqlDbType.VarChar, 4, System.Data.ParameterDirection.Input, false, 0, 0, null, System.Data.DataRowVersion.Current, DBNull.Value));
|
||||
//UpdPers.Parameters.Add(new System.Data.SqlClient.SqlParameter("conCode", System.Data.SqlDbType.VarChar, 4, System.Data.ParameterDirection.Input, false, 0, 0, null, System.Data.DataRowVersion.Current, DBNull.Value));
|
||||
UpdPers.Parameters.Add(new System.Data.SqlClient.SqlParameter("AccessAllow", System.Data.SqlDbType.Bit, 0, System.Data.ParameterDirection.Input, false, 0, 0, null, System.Data.DataRowVersion.Current, DBNull.Value));
|
||||
UpdPers.Parameters.Add(new System.Data.SqlClient.SqlParameter("Language", System.Data.SqlDbType.Char, 1, System.Data.ParameterDirection.Input, false, 0, 0, null, System.Data.DataRowVersion.Current, DBNull.Value));
|
||||
UpdPers.Parameters.Add(new System.Data.SqlClient.SqlParameter("VisitIdLocked", System.Data.SqlDbType.Int, 0, System.Data.ParameterDirection.Input, false, 0, 0, null, System.Data.DataRowVersion.Current, DBNull.Value));
|
||||
|
|
|
|||
|
|
@ -192,20 +192,20 @@
|
|||
<TextBlock Grid.Row="2" Grid.Column="2" Text="{Binding MinWorkerDosisMargin,StringFormat={}Margin: {0:0.00} }" />
|
||||
</Grid>
|
||||
<StackPanel Grid.Row="3" Grid.Column="0" Grid.RowSpan="1" VerticalAlignment="Center" >
|
||||
<Image Height="120" VerticalAlignment="Center" >
|
||||
<Image.Style>
|
||||
<Style TargetType="{x:Type Image}">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding EPDRad}" Value="BG">
|
||||
<Setter Property="Source" Value="{StaticResource iBG}"></Setter>
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding EPDRad}" Value="NG">
|
||||
<Setter Property="Source" Value="{StaticResource iNG}"></Setter>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Image.Style>
|
||||
</Image>
|
||||
<Image Height="120" VerticalAlignment="Center" >
|
||||
<Image.Style>
|
||||
<Style TargetType="{x:Type Image}">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding EPDRad}" Value="BG">
|
||||
<Setter Property="Source" Value="{StaticResource iBG}"></Setter>
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding EPDRad}" Value="NG">
|
||||
<Setter Property="Source" Value="{StaticResource iNG}"></Setter>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Image.Style>
|
||||
</Image>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="4" Grid.Column="0" HorizontalAlignment="Left" VerticalAlignment="Center" >
|
||||
<telerik:RadButton Name="TaskCancel" Content="Cancel" Click="TaskCancel_Click" Width="300" Height="50" CornerRadius="10" TextBlock.FontSize="25" Margin="20,0,0,0" />
|
||||
|
|
@ -220,17 +220,15 @@
|
|||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="100" />
|
||||
<RowDefinition Height="100" />
|
||||
<RowDefinition Height="100" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBlock Grid.Row="0" VerticalAlignment="Center" HorizontalAlignment="Center" TextAlignment="Center" FontSize="25" FontFamily="Comic Sans MS">
|
||||
<Run Text="Issuing EPD:" />
|
||||
<Run Name="statusEPD" Text="" />
|
||||
<LineBreak/>
|
||||
|
||||
</TextBlock>
|
||||
<Image Grid.Row="1" Source="{StaticResource iBG}"/>
|
||||
<Button Grid.Row="2" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="24" Background="LawnGreen" Padding="10,10,10,10" Content="OK" Name="bEpdDone" Visibility="Hidden" Click="bClose_Click" />
|
||||
|
||||
</Grid>
|
||||
</TabItem>
|
||||
<TabItem Name="tbNotAllowed">
|
||||
|
|
|
|||
|
|
@ -1,24 +1,13 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
using System.Windows.Threading;
|
||||
|
||||
namespace eDosStation
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Interaction logic for EntryBadge.xaml
|
||||
/// </summary>
|
||||
|
|
@ -94,7 +83,6 @@ namespace eDosStation
|
|||
}
|
||||
|
||||
return rv;
|
||||
//ep.Hp07THDose =
|
||||
}
|
||||
private void DispatcherTimer_Tick(object sender, EventArgs e)
|
||||
{
|
||||
|
|
@ -132,6 +120,7 @@ namespace eDosStation
|
|||
{
|
||||
bool isBG = (ep.epdType != 3); //3 = zwarte 0=grijs
|
||||
var co = LocalRemote.getCon(true);
|
||||
LocalRemote.VisitInitCommand.Connection = co;
|
||||
LocalRemote.VisitInitCommand.Parameters["ID_Station"].Value = thisStation.ID_Station;
|
||||
LocalRemote.VisitInitCommand.Parameters["ID_Visit"].Value = ID_Visit;
|
||||
LocalRemote.VisitInitCommand.Parameters["PersID"].Value = _User.PersID;
|
||||
|
|
@ -142,6 +131,8 @@ namespace eDosStation
|
|||
LocalRemote.VisitInitCommand.ExecuteNonQuery();
|
||||
StationVisitID = (int?)LocalRemote.VisitInitCommand.Parameters["EPDVisitID"].Value;
|
||||
co.Close();
|
||||
|
||||
|
||||
int rv = ep.PrepareForIssue();
|
||||
if (rv != 1)
|
||||
{
|
||||
|
|
@ -188,11 +179,12 @@ namespace eDosStation
|
|||
}
|
||||
else
|
||||
ep.Close();
|
||||
|
||||
}
|
||||
private void GetEPD()
|
||||
{
|
||||
if (_User == null || CurTaskRow == null) return;
|
||||
|
||||
|
||||
int ok = ep.Connect(false);
|
||||
if (ok != 1) System.Diagnostics.Debug.WriteLine($"GetEpd {ok} ConnectError: {ep.ConnectError}");
|
||||
if (ep.DeviceCount == 1 && ep.b.CurrentDeviceID>0)
|
||||
|
|
@ -210,6 +202,7 @@ namespace eDosStation
|
|||
dispatcherTimer.Start();
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
private void SetFilter(bool isAlara)
|
||||
{
|
||||
|
|
@ -418,7 +411,7 @@ namespace eDosStation
|
|||
CurTaskRow = rv.Row as DataSet1.GetTaskInfoRow;
|
||||
if (CurTaskRow.MinWorkerDosisMargin > _User.Margin)
|
||||
{
|
||||
MessageBox.Show("Margin exeeded");
|
||||
MessageBox.Show("Margin exceeded");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ namespace eDosStation
|
|||
if (rv != 1)
|
||||
MessageBox.Show($"GetDoses {rv} er:{ep.GetDosesError}");
|
||||
}
|
||||
|
||||
|
||||
HpDose07.Text = $"Hp07: {ep.Hp07:0.00} µSv ";
|
||||
HpDose10.Text = $"Hp10: {ep.Hp10:0.00} µSv";
|
||||
if (int.TryParse(ep.WearerID, out int EpdVisitID))
|
||||
|
|
@ -118,7 +118,6 @@ namespace eDosStation
|
|||
{
|
||||
MessageBox.Show($"DeIssueerror {rv}");
|
||||
}
|
||||
|
||||
var l = new SqlLog();
|
||||
try
|
||||
{
|
||||
|
|
@ -132,6 +131,21 @@ namespace eDosStation
|
|||
l.Dispose();
|
||||
}
|
||||
if (!NoTimeout) dispatcherTimer.Start(); //Knop hide
|
||||
|
||||
//int? EpdVisitID = LocalRemote.LastID();
|
||||
//if (EpdVisitID.HasValue)
|
||||
//{
|
||||
// ep.WearerName = "Hallo";
|
||||
// ep.WearerID = EpdVisitID.Value.ToString(); ;
|
||||
// ep.Hp07 = 123;
|
||||
// ep.Hp10 = 124;
|
||||
// Wearer.Text = $"Wearer: {ep.WearerName}";
|
||||
// EpdVisit.Text = $"Visit: {ep.WearerID}";
|
||||
// HpDose07.Text = $"Hp07: {ep.Hp07:0.00} µSv ";
|
||||
// HpDose10.Text = $"Hp10: {ep.Hp10:0.00} µSv";
|
||||
// LocalRemote.VisitExit(EpdVisitID.Value, ep);
|
||||
//}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ namespace eDosStation
|
|||
{
|
||||
public static class LocalRemote
|
||||
{
|
||||
static public int ID_Station;
|
||||
static public bool isLocal = false;
|
||||
static public string serverConstr;
|
||||
static public string serverTestConstr;
|
||||
|
|
@ -21,10 +22,9 @@ namespace eDosStation
|
|||
static public System.Data.SqlClient.SqlCommand VisitInitCommand;
|
||||
public static SqlCommand VisitExitCommand;
|
||||
public static SqlCommand NextIDCommand;
|
||||
|
||||
public static SqlCommand LastLocalIDCommand;
|
||||
static public DataSet1.CommentOnEventDataTable dtCOE;
|
||||
|
||||
|
||||
public static int? NextID()
|
||||
{
|
||||
int? nxtValue = null;
|
||||
|
|
@ -32,6 +32,14 @@ namespace eDosStation
|
|||
nxtValue = NextIDCommand.ExecuteScalar() as int?;
|
||||
return nxtValue;
|
||||
}
|
||||
|
||||
public static int? LastID()
|
||||
{
|
||||
int? lastValue = null;
|
||||
if (NextIDCommand.Connection.State == ConnectionState.Closed) LastLocalIDCommand.Connection.Open();
|
||||
lastValue = LastLocalIDCommand.ExecuteScalar() as int?;
|
||||
return lastValue;
|
||||
}
|
||||
static public bool checkCon(bool leaveOpen = false)
|
||||
{
|
||||
if (Connection != null && Connection.State == System.Data.ConnectionState.Open) return true;
|
||||
|
|
@ -73,6 +81,13 @@ namespace eDosStation
|
|||
return rv;
|
||||
}
|
||||
|
||||
internal static void SetStation(int curIDStation)
|
||||
{
|
||||
ID_Station = curIDStation;
|
||||
LastLocalIDCommand.Parameters["ID_Station"].Value = curIDStation;
|
||||
VisitInitCommand.Parameters["ID_Station"].Value = curIDStation;
|
||||
}
|
||||
|
||||
static public void first()
|
||||
{
|
||||
var cb = new System.Data.SqlClient.SqlConnectionStringBuilder(Properties.Settings.Default.eDosConnectionString);
|
||||
|
|
@ -94,6 +109,8 @@ namespace eDosStation
|
|||
localConstr = System.Configuration.ConfigurationManager.ConnectionStrings["eDosStation.Properties.Settings.localConnectionString"].ConnectionString;
|
||||
SequenceConnection = new SqlConnection(localConstr);
|
||||
NextIDCommand = new SqlCommand("SELECT NEXT VALUE FOR VisitSequence as VisitID", SequenceConnection);
|
||||
|
||||
|
||||
serverConstr = System.Configuration.ConfigurationManager.ConnectionStrings["eDosStation.Properties.Settings.eDosConnectionString"].ConnectionString;
|
||||
var cb = new System.Data.SqlClient.SqlConnectionStringBuilder(serverConstr);
|
||||
cb.ConnectTimeout = 5;
|
||||
|
|
@ -150,9 +167,13 @@ namespace eDosStation
|
|||
|
||||
static void MakeCommands()
|
||||
{
|
||||
LastLocalIDCommand = new SqlCommand("VisitIDLast", SequenceConnection);
|
||||
LastLocalIDCommand.CommandType = CommandType.StoredProcedure;
|
||||
var pa = new System.Data.SqlClient.SqlParameter("ID_Station", SqlDbType.Int, 4); LastLocalIDCommand.Parameters.Add(pa);
|
||||
|
||||
VisitInitCommand = new System.Data.SqlClient.SqlCommand("VisitInit", Connection);
|
||||
VisitInitCommand.CommandType = System.Data.CommandType.StoredProcedure;
|
||||
var pa = new System.Data.SqlClient.SqlParameter("ID_Station", SqlDbType.Int, 4); VisitInitCommand.Parameters.Add(pa);
|
||||
pa = new System.Data.SqlClient.SqlParameter("ID_Station", SqlDbType.Int, 4); VisitInitCommand.Parameters.Add(pa);
|
||||
pa = new System.Data.SqlClient.SqlParameter("ID_Visit", SqlDbType.Int, 4); pa.Direction = ParameterDirection.Input; VisitInitCommand.Parameters.Add(pa);
|
||||
pa = new System.Data.SqlClient.SqlParameter("PersID", SqlDbType.Int, 4); VisitInitCommand.Parameters.Add(pa);
|
||||
pa = new System.Data.SqlClient.SqlParameter("ID_Task", SqlDbType.Int, 4); VisitInitCommand.Parameters.Add(pa);
|
||||
|
|
@ -292,7 +313,7 @@ namespace eDosStation
|
|||
u.PersID = (int)Values[rs.GetOrdinal("PersID")];
|
||||
u.LastName = Values[rs.GetOrdinal("LastName")].ToString();
|
||||
u.FirstName = Values[rs.GetOrdinal("FirstName")].ToString();
|
||||
u.conCode = Values[rs.GetOrdinal("conCode")].ToString();
|
||||
//u.conCode = Values[rs.GetOrdinal("conCode")].ToString();
|
||||
u.Language = Values[rs.GetOrdinal("Language")].ToString();
|
||||
u.AccessAllow = Values[rs.GetOrdinal("AccessAllow")] as bool?;
|
||||
u.Margin = Values[rs.GetOrdinal("AccessAllow")] as double?;
|
||||
|
|
@ -300,7 +321,7 @@ namespace eDosStation
|
|||
u.ReasonNoAccess = Values[rs.GetOrdinal("ReasonNoAccess")].ToString().Replace("\\n", "\n");
|
||||
u.UserComment = Values[rs.GetOrdinal("Comment")].ToString();
|
||||
u.AllOk = (u.AccessAllow == true && u.VisitIDLocked == 0);
|
||||
rs.Close();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -308,7 +329,7 @@ namespace eDosStation
|
|||
u.PersID = 0;
|
||||
u.LastName = "Not Found";
|
||||
u.FirstName = "Not Found";
|
||||
u.conCode = "A1";
|
||||
//u.conCode = "A1";
|
||||
u.Language = "N";
|
||||
u.AccessAllow = false;
|
||||
u.Margin = 0;
|
||||
|
|
@ -317,7 +338,8 @@ namespace eDosStation
|
|||
u.UserComment = "";
|
||||
u.AllOk = (u.AccessAllow == true & u.VisitIDLocked == 0);
|
||||
}
|
||||
|
||||
rs.Close();
|
||||
|
||||
}
|
||||
return u;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
</MenuItem>
|
||||
</Menu>
|
||||
<StatusBar DockPanel.Dock="Bottom" >
|
||||
<StatusBarItem Name="Status" Content="Offline"/>
|
||||
<StatusBarItem Name="Status" Content="Offline" HorizontalContentAlignment="Center" HorizontalAlignment="Stretch"/>
|
||||
</StatusBar>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
|
|
|
|||
|
|
@ -54,6 +54,23 @@ namespace eDosStation
|
|||
s.ShowDialog();
|
||||
}
|
||||
|
||||
|
||||
private void setLocalStatus()
|
||||
{
|
||||
if (LocalRemote.isLocal)
|
||||
{
|
||||
Status.Content = "*** Offline ***";
|
||||
Status.Foreground = Brushes.Yellow;
|
||||
Status.Background = Brushes.Red;
|
||||
}
|
||||
else
|
||||
{
|
||||
Status.Content = ">>> Online >>>";
|
||||
Status.Foreground = Brushes.Green;
|
||||
Status.Background = Brushes.White;
|
||||
|
||||
}
|
||||
}
|
||||
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var cb = new System.Data.SqlClient.SqlConnectionStringBuilder(Properties.Settings.Default.eDosConnectionString);
|
||||
|
|
@ -70,9 +87,11 @@ namespace eDosStation
|
|||
{
|
||||
bool ok = true;
|
||||
LocalRemote.init();
|
||||
|
||||
try
|
||||
{
|
||||
thisStation = new Station(string.Empty);
|
||||
LocalRemote.SetStation(thisStation.ID_Station);
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
|
|
@ -85,7 +104,8 @@ namespace eDosStation
|
|||
ok = false;
|
||||
}
|
||||
|
||||
if (ok) try
|
||||
if (ok)
|
||||
try
|
||||
{
|
||||
//var sp = new System.IO.Ports.SerialPort($"com{thisStation.ComPort}");
|
||||
//sp.BaudRate = 9600;
|
||||
|
|
@ -94,10 +114,10 @@ namespace eDosStation
|
|||
//sp.Open();
|
||||
//sp.DiscardInBuffer();
|
||||
//sp.Close();
|
||||
|
||||
|
||||
#if SimulateEPD
|
||||
thisStation.ComPort = 0;
|
||||
#endif
|
||||
ep = new EpdBaseClr.Epd2(thisStation.ComPort);
|
||||
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
|
|
@ -111,13 +131,13 @@ namespace eDosStation
|
|||
InstMessage w = new InstMessage(thisStation.tbComments);
|
||||
w.ShowDialog();
|
||||
ibComment.Child = thisStation.tbComments;
|
||||
//itComment = thisStation.tbComments;
|
||||
ibComment.Visibility = Visibility.Visible;
|
||||
}
|
||||
else
|
||||
ibComment.Visibility = Visibility.Hidden;
|
||||
}
|
||||
}
|
||||
setLocalStatus();
|
||||
}
|
||||
|
||||
private void MEnc_Click(object sender, RoutedEventArgs e)
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@
|
|||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DefineConstants>TRACE;DEBUG;SimulateEPD</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue