first database init / exit
still problems wearerid
This commit is contained in:
parent
7221608c43
commit
fe6b5b0326
9 changed files with 89 additions and 12 deletions
|
|
@ -48,10 +48,10 @@ namespace EpdBase
|
|||
WORD ReadDosesQualityRV;
|
||||
WORD ReadPeaksRV = 0;
|
||||
|
||||
WORD ClearDoseRV;
|
||||
WORD ClearTotalDoseRV;
|
||||
WORD ClearPeakRatesRV;
|
||||
WORD DeIssueEpdRV = 0;
|
||||
WORD ClearDoseRV;
|
||||
WORD ClearTotalDoseRV;
|
||||
WORD ClearPeakRatesRV;
|
||||
WORD DeIssueEpdRV = 0;
|
||||
|
||||
WORD WriteAlarmDoseThresholdsRV = 0;
|
||||
WORD WriteAlarmRateThresholdsRV = 0;
|
||||
|
|
@ -97,8 +97,8 @@ namespace EpdBase
|
|||
//Peaks
|
||||
DWORD Hp10Peak;
|
||||
DWORD Hp07Peak;
|
||||
DWORD Hp10Time;
|
||||
DWORD Hp07Time;
|
||||
DWORD Hp10Time;
|
||||
DWORD Hp07Time;
|
||||
|
||||
|
||||
//AlarmDoseTreshold
|
||||
|
|
|
|||
|
|
@ -93,11 +93,20 @@ int EpdBaseClr::Epd2::SetIssued()
|
|||
epd->AlarmDoseHP101G = Hp10THDose1;
|
||||
epd->AlarmDoseHP102G = Hp10THDose1;
|
||||
|
||||
|
||||
epd->Hp10Rate1On = Hp10Rate1On;
|
||||
epd->Hp10Rate2On = Hp10Rate2On;
|
||||
epd->Hp07RateOn = Hp07RateOn;
|
||||
epd->Hp10Rate1Off = Hp10Rate1Off;
|
||||
epd->Hp10Rate2Off = Hp10Rate2Off;
|
||||
epd->Hp07RateOff = Hp07RateOff;
|
||||
|
||||
|
||||
memset(epd->WearerID, ' ', WearerIDLength); epd->WearerID[WearerIDLength] = 0;
|
||||
char* str1 = (char*)(void *)Runtime::InteropServices::Marshal::StringToHGlobalAnsi(WearerID);
|
||||
int l = strlen(str1);
|
||||
if (l > WearerIDLength)l = WearerIDLength;
|
||||
_memccpy( epd->WearerID+WearerIDLength-l, str1, l, WearerIDLength);
|
||||
if (l > WearerIDLength) l = WearerIDLength;
|
||||
_memccpy( epd->WearerID + WearerIDLength - l, str1, l, WearerIDLength);
|
||||
Runtime::InteropServices::Marshal::FreeHGlobal((IntPtr)str1);
|
||||
|
||||
memset(epd->WearerName, 0, WearerNameLength + 1);
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
<userSettings>
|
||||
<eDosStation.Properties.Settings>
|
||||
<setting name="comport" serializeAs="String">
|
||||
<value>6</value>
|
||||
<value>3</value>
|
||||
</setting>
|
||||
</eDosStation.Properties.Settings>
|
||||
</userSettings>
|
||||
|
|
|
|||
|
|
@ -38,6 +38,8 @@ namespace eDosStation
|
|||
string csn, site, code;
|
||||
static User _User;
|
||||
|
||||
DataSet1.GetTaskInfoRow CurTaskRow;
|
||||
|
||||
public EntryBadge()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
|
@ -54,6 +56,9 @@ namespace eDosStation
|
|||
this.Close();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//ep.Hp07THDose =
|
||||
}
|
||||
|
||||
private void DispatcherTimer_Tick(object sender, EventArgs e)
|
||||
|
|
@ -86,6 +91,8 @@ namespace eDosStation
|
|||
|
||||
private void GetEPD()
|
||||
{
|
||||
if (_User == null || CurTaskRow == null) return;
|
||||
|
||||
ep = new EpdBaseClr.Epd2(Properties.Settings.Default.comport);
|
||||
ep.Connect();
|
||||
if (ep.DiscRV == 1 && ep.b.CurrentDeviceID > 0)
|
||||
|
|
@ -103,6 +110,41 @@ namespace eDosStation
|
|||
dispatcherTimer.Interval = new TimeSpan(0, 0, 2);
|
||||
dispatcherTimer.Start();
|
||||
}
|
||||
|
||||
bool isBG = (ep.epdType == 3);
|
||||
int? VisitID = null;
|
||||
using (var co = new System.Data.SqlClient.SqlConnection(Properties.Settings.Default.RemoteSQL))
|
||||
{
|
||||
using (var cmd1 = new SqlCommand("VisitInit", co))
|
||||
{
|
||||
cmd1.CommandType = CommandType.StoredProcedure;
|
||||
var pa = new SqlParameter("PersID", SqlDbType.Int, 4); pa.Value = _User.PersID; cmd1.Parameters.Add(pa);
|
||||
pa = new SqlParameter("ID_Task", SqlDbType.Int, 4); pa.Value = CurTaskRow.ID_Task; cmd1.Parameters.Add(pa);
|
||||
pa = new SqlParameter("ID_EPD", SqlDbType.Int, 4); pa.Value = (int)ep.EpdID; cmd1.Parameters.Add(pa);
|
||||
pa = new SqlParameter("isBG", SqlDbType.Bit, 4); pa.Value = isBG; cmd1.Parameters.Add(pa);
|
||||
pa = new SqlParameter("ID_Visit", SqlDbType.Int, 4); pa.Direction = ParameterDirection.Output; cmd1.Parameters.Add(pa);
|
||||
co.Open();
|
||||
cmd1.ExecuteNonQuery();
|
||||
VisitID = (int ?)cmd1.Parameters["ID_Visit"].Value;
|
||||
co.Close();
|
||||
}
|
||||
}
|
||||
|
||||
ep.WearerID = VisitID.ToString();
|
||||
ep.WearerName = _User.PersID.ToString();
|
||||
|
||||
ep.Hp07RateOn = CurTaskRow.HP07RateON;
|
||||
ep.Hp07RateOff = CurTaskRow.HP07RateOFF;
|
||||
ep.Hp10Rate1On = CurTaskRow.HP10Rate1ON;
|
||||
ep.Hp10Rate1Off = CurTaskRow.HP10Rate1ON;
|
||||
ep.Hp10Rate2On = CurTaskRow.HP10Rate2ON;
|
||||
ep.Hp10Rate2Off = CurTaskRow.HP10Rate2ON;
|
||||
ep.Hp10THDose1 = CurTaskRow.Hp10Dose1;
|
||||
ep.Hp10THDose2 = CurTaskRow.Hp10Dose2;
|
||||
ep.Hp07THDose = CurTaskRow.Hp07Dose;
|
||||
|
||||
ep.SetIssued();
|
||||
|
||||
}
|
||||
|
||||
void AskTask()
|
||||
|
|
@ -182,6 +224,10 @@ namespace eDosStation
|
|||
private void TaskOK_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
tbEPD.IsSelected = true;
|
||||
System.Windows.Data.CollectionViewSource getTaskListViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("getTaskListViewSource")));
|
||||
var rv = getTaskListViewSource.View.CurrentItem as DataRowView;
|
||||
CurTaskRow = rv.Row as DataSet1.GetTaskInfoRow;
|
||||
|
||||
GetEPD();
|
||||
}
|
||||
|
||||
|
|
@ -225,6 +271,7 @@ namespace eDosStation
|
|||
|
||||
|
||||
//Debug
|
||||
_User = new User("0428790A0B4E80",string.Empty);
|
||||
Dispatcher.Invoke(AskTask);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
|
@ -49,6 +51,24 @@ namespace eDosStation
|
|||
ep.GetDoses();
|
||||
HpDose07.Text = $"HP07: {ep.Hp07:0.00 µ Sv} ";
|
||||
HpDose10.Text = $"Hp10: {ep.Hp10:0.00 µ Sv}";
|
||||
|
||||
if (int.TryParse(ep.WearerID, out int VisitID)) {
|
||||
bool isBG = (ep.epdType == 3);
|
||||
using (var co = new System.Data.SqlClient.SqlConnection(Properties.Settings.Default.RemoteSQL))
|
||||
{
|
||||
using (var cmd1 = new SqlCommand("VisitExit", co))
|
||||
{
|
||||
cmd1.CommandType = CommandType.StoredProcedure;
|
||||
var pa = new SqlParameter("ID_Visit", SqlDbType.Int, 4); pa.Value = VisitID; cmd1.Parameters.Add(pa);
|
||||
pa = new SqlParameter("HP07", SqlDbType.Float); pa.Value = ep.Hp07; cmd1.Parameters.Add(pa);
|
||||
pa = new SqlParameter("HP10", SqlDbType.Float); pa.Value = ep.Hp10; cmd1.Parameters.Add(pa);
|
||||
co.Open();
|
||||
cmd1.ExecuteNonQuery();
|
||||
co.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ep.SetDeIssued();
|
||||
|
||||
}
|
||||
|
|
|
|||
BIN
eDosStation/Properties/IR_READER_MS_DLL.dll
Normal file
BIN
eDosStation/Properties/IR_READER_MS_DLL.dll
Normal file
Binary file not shown.
2
eDosStation/Properties/Settings.Designer.cs
generated
2
eDosStation/Properties/Settings.Designer.cs
generated
|
|
@ -25,7 +25,7 @@ namespace eDosStation.Properties {
|
|||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("6")]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("3")]
|
||||
public int comport {
|
||||
get {
|
||||
return ((int)(this["comport"]));
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
<Profiles />
|
||||
<Settings>
|
||||
<Setting Name="comport" Type="System.Int32" Scope="User">
|
||||
<Value Profile="(Default)">6</Value>
|
||||
<Value Profile="(Default)">3</Value>
|
||||
</Setting>
|
||||
<Setting Name="RemoteSQL" Type="(Connection string)" Scope="Application">
|
||||
<DesignTimeValue Profile="(Default)"><?xml version="1.0" encoding="utf-16"?>
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ namespace eDosStation
|
|||
{
|
||||
public class User
|
||||
{
|
||||
public int PersID {get; set; }
|
||||
public string LastName { get; set; }
|
||||
public string FirstName { get; set; }
|
||||
public string conCode { get; set; }
|
||||
|
|
@ -32,7 +33,7 @@ namespace eDosStation
|
|||
{
|
||||
object[] Values = new object[rs.FieldCount];
|
||||
int rv = rs.GetValues(Values);
|
||||
|
||||
PersID = (int)Values[rs.GetOrdinal("PersID")];
|
||||
LastName = Values[rs.GetOrdinal("LastName")].ToString();
|
||||
FirstName = Values[rs.GetOrdinal("FirstName")].ToString();
|
||||
conCode = Values[rs.GetOrdinal("conCode")].ToString();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue