Approval by legalizator only when !string.IsNullOrEmpty(AltProcName), legalizator full name used in reports, ver. 2.30.1986

This commit is contained in:
Milan Hanajik 2022-11-18 08:31:16 +01:00
parent a14e21eb57
commit 6a374c5af0
6 changed files with 34 additions and 14 deletions

View File

@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number
// Revision
//
[assembly: AssemblyVersion("2.30.1984.0")]
[assembly: AssemblyFileVersion("2.30.1984.0")]
[assembly: AssemblyVersion("2.30.1986.0")]
[assembly: AssemblyFileVersion("2.30.1986.0")]

View File

@ -23,7 +23,8 @@ namespace TBF.Rig.Sequences
public override string ToString() { return "Sequences.MainSeq"; }
bool approvedByLegalizator = false;
bool isApprovedByLegalizator = false;
string legalizatorName = string.Empty;
DateTime lastApprovalByLegalizatorTime;
int simultWithPurgingCount;
@ -217,7 +218,6 @@ namespace TBF.Rig.Sequences
do
{
bool approval = true;
do
{
selection = MakeSelection(MKSelContext.ProcedureNotSelected);
@ -226,13 +226,8 @@ namespace TBF.Rig.Sequences
Shutdown();
return;
}
#if KEMPNO_50 || KRAKOW_50 || TORUN_50 || WARSAW_50 || WARSAW_END
approval = (selection == Selection.Cycle || selection == Selection.Test || selection == Selection.Q1 ||
selection == Selection.Q2 || selection == Selection.Q3) && IsApprovedByLegalizator();
#endif
}
while (selection == Selection.Shutdown || !approval);
while (selection == Selection.Shutdown);
selectedTestName = (selection == Selection.Q1) ? "Q1"
: ((selection == Selection.Q2) ? "Q2"
@ -409,6 +404,16 @@ namespace TBF.Rig.Sequences
}
while (StateMachine.Procedure == null); /// Make sure a valid procedure is selected
#if KEMPNO_50 || KRAKOW_50 || TORUN_50 || WARSAW_50 || WARSAW_END
///
/// Approval of a legalizator
///
if (!string.IsNullOrEmpty(StateMachine.Procedure.AltProcName) && !IsApprovedByLegalizator())
{
goto select_procedure; /// Loop back to procedure selection if not approved by a legalizator
}
#endif
Debug.WriteLine(string.Empty);
Debug.WriteLine(string.Format("TransitionSequences {0}", NHibernateUtil.IsInitialized(StateMachine.TransitionSequences) ? "initialized" : "NOT initialized"));
Debug.WriteLine(string.Format("TransitionSteps {0}", NHibernateUtil.IsInitialized(StateMachine.TransitionSteps) ? "initialized" : "NOT initialized"));
@ -422,7 +427,6 @@ namespace TBF.Rig.Sequences
UiBridge.Bridge.OnError(this, string.Empty); /// Clear an error message (if any)
if (selection == Selection.RestoreInterruptedSession)
{
if (!LoadProcessData())
@ -1476,7 +1480,7 @@ namespace TBF.Rig.Sequences
bool IsApprovedByLegalizator()
{
if (approvedByLegalizator && DateTime.Now < lastApprovalByLegalizatorTime.Date.AddDays(1))
if (isApprovedByLegalizator && DateTime.Now < lastApprovalByLegalizatorTime.Date.AddDays(1))
{
return true;
}
@ -1484,11 +1488,13 @@ namespace TBF.Rig.Sequences
var loginDlg = new Users.Forms.PlainLoginDlg(new GID[] { GID.CalibrationSpecialists }, "Approval by legalizator");
if (loginDlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
approvedByLegalizator = true;
isApprovedByLegalizator = true;
legalizatorName = loginDlg.FullName;
lastApprovalByLegalizatorTime = DateTime.Now;
return true;
}
legalizatorName = string.Empty;
return false;
}

View File

@ -629,7 +629,11 @@ namespace TBF.Rig.Sequences
(BenchInfo != null) ? BenchInfo.Address3 : string.Empty,
(BenchInfo != null) ? BenchInfo.Address4 : string.Empty,
(BenchInfo != null) ? BenchInfo.Address5 : string.Empty,
#if BAHRAIN_50
(Users.CurrentUser.User() != null) ? Users.CurrentUser.User().ToEncodedStr() : "none",
#else
(Users.CurrentUser.User() != null) ? Users.CurrentUser.User().ToEncodedStr(legalizatorName) : "none",
#endif
Users.CurrentUser.Number(),
Program.Version,
StateMachine.Procedure,

View File

@ -55,7 +55,7 @@ namespace TBF.UI.Shared
{
benchName = predefinedBench;
#if LANG_PL || BAHRAIN_50
#if BAHRAIN_50
Height = 156;
EnableAndPrepareLegalizatorCombo(legalizatorComboBox);
#else

View File

@ -530,9 +530,15 @@ namespace Users.Entities
public virtual string ToEncodedStr()
{
/// Bahrain: legalizator from bench login dialog is used
return string.Format("{0}~{1}~{2}", UserName, FullName, legalizator);
}
public virtual string ToEncodedStr(string _legalizator)
{
return string.Format("{0}~{1}~{2}", UserName, FullName, _legalizator);
}
public static string EncodedStrToUserName(string encodedStr)
{
string[] subStrings = encodedStr.Split(new char[] { '~' });

View File

@ -22,6 +22,7 @@ namespace Users.Forms
/// Public readonly
public string UserName { get { return user; } }
public string FullName { get { return fullName; } }
/// Private fields
string user;
@ -29,6 +30,7 @@ namespace Users.Forms
GID[] requiredGroupMembership;
bool noDatabase;
Color oriBackColor;
string fullName; /// Description of the selected user
/// Smart card support, card S/N is used as user.Tag
CardNative card;
@ -175,6 +177,7 @@ namespace Users.Forms
password = passwordTextBox.Text;
bool authorized = Entities.User.IsPowerUser(user, password);
if (authorized) fullName = "Power user";
if (!authorized && !noDatabase)
{
@ -189,6 +192,7 @@ namespace Users.Forms
if (usr1.IsMemberOf(requiredGroupMembership) && usr1.IsCorrectPassword(password))
{
authorized = true;
fullName = usr1.FullName;
break;
}
}