Compare commits

...
Author SHA1 Message Date
michal c3be3bfb53 Version increment to 3.9.2143.300 2025-11-21 15:32:55 +01:00
michal a0b9909ae8 PurchaseOrderDialog logger Improvement - WRCSwindon
Add detailed logging for purchase order workflows in `CycleBeginningForm`

- Introduced `log_selected` for enhanced debugging of selected orders, items, and serial numbers.
- Added exception handling and logging for serial number loading.
- Improved visibility into runtime behavior with contextual debug and error logs.
2025-11-21 15:24:15 +01:00
michal f95198e40e revision update 2024-11-13 13:36:54 +01:00
michal d2b2bbb94b Merge branch 'refs/heads/feature/fix_Swindon' into master-3
# Conflicts:
#	TBF/Properties/AssemblyInfo.cs
2024-11-12 09:56:24 +01:00
michal a4246c7ea4 user groups based PL_LANG enabled, DB update needed 2024-11-12 09:52:41 +01:00
michal 498fc21412 DIVERTER close valve end time - Mark Chenges 2024-11-11 14:18:39 +01:00
michal fb74e2d785 fix, NullPointerExeption If Order have no name 2024-11-04 15:41:09 +01:00
7 changed files with 48 additions and 21 deletions
+2 -2
View File
@@ -17,7 +17,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;LANG_PL</DefineConstants>
<DefineConstants>TRACE;DEBUG</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
@@ -25,7 +25,7 @@
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;LANG_PL</DefineConstants>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
+3 -2
View File
@@ -128,10 +128,11 @@ namespace Config
case GID.Administrators:
#if TURA_IPERL || TURA_IPERL_NEW || TURA_SPECIAL
case GID.TraceabilityManagement:
#elif LANG_PL
//#elif LANG_PL
#endif
case GID.MetrologicalAuthority:
case GID.WaterMeterAuthority:
#endif
admin.AddGroup(group);
session.SaveOrUpdate(group); /// Save this group
break;
+2 -2
View File
@@ -19,7 +19,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;LANG_PL</DefineConstants>
<DefineConstants>TRACE;DEBUG</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>AnyCPU</PlatformTarget>
@@ -29,7 +29,7 @@
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;LANG_PL</DefineConstants>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
+2 -2
View File
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number
// Revision
//
[assembly: AssemblyVersion("3.9.2143.1")]
[assembly: AssemblyFileVersion("3.9.2143.1")]
[assembly: AssemblyVersion("3.9.2143.300")]
[assembly: AssemblyFileVersion("3.9.2143.300")]
+9 -7
View File
@@ -29,12 +29,14 @@ namespace TBF.Rig.BuiltIn
/// Relative time in [s] from the start of the operation
int timeShift; /// Set in SetValvesOp(cb, bool open, OutputPath outPath, DateTimeBox timeStamp)
/// <summary>
/// Processes coupled valves and creates switch points.
/// </summary>
/// <param name="valvesOpen">A list of opening master valves</param>
/// <param name="valvesClose">A list of closing master valves</param>
/// <returns></returns>
int waitOnCBDelay = 2; // additional wait for the correct ControlBoard response in [s]
/// <summary>
/// Processes coupled valves and creates switch points.
/// </summary>
/// <param name="valvesOpen">A list of opening master valves</param>
/// <param name="valvesClose">A list of closing master valves</param>
/// <returns></returns>
IList<SwitchPoint> AddSwitchPoints(IList<SwitchPoint> swPoints, IList<IValve> valvesOpen, IList<IValve> valvesClose, int time)
{
int ix0 = swPoints.Count;
@@ -277,7 +279,7 @@ namespace TBF.Rig.BuiltIn
{
if (nextIx >= switchPoints.Count)
{
return (StateMachine.Time >= swStartTime + maxDelayTime) ? Event.ValvesSet : Event.ValvesBusy;
return (StateMachine.Time >= swStartTime + maxDelayTime + waitOnCBDelay) ? Event.ValvesSet : Event.ValvesBusy;
}
if (StateMachine.Time >= swStartTime + switchPoints[nextIx].TimeSec)
@@ -21,6 +21,7 @@ namespace TBF.Rig.DataEntry.StandartCameraPurchaseOrder
public partial class CycleBeginningForm : Form, GenericDevices.IHasCompleted
{
private static readonly ILog log = LogManager.GetLogger(typeof(CycleBeginningForm));
private static readonly ILog log_selected = LogManager.GetLogger("PurchaseOrderHistory");
/// <summary> Number of water meters </summary>
public readonly int WaterMetersCount;
@@ -264,6 +265,11 @@ namespace TBF.Rig.DataEntry.StandartCameraPurchaseOrder
Disabled[i] = !checkBoxes[i].Checked;
}
//TODO create logger to log selected items and their order and Order number
string snTextArrString = SNText != null ? string.Join(", ", SNText) : string.Empty;
log_selected.DebugFormat("Purchase DLG - Selected Order: {0}, Last selected Box: {1}, All items: {2}",
orderComboBox.Text, purchaseBoxComboBox.Text,snTextArrString);
completed = true;
Close();
}
@@ -669,7 +675,10 @@ namespace TBF.Rig.DataEntry.StandartCameraPurchaseOrder
{
foreach (PurchaseOrder pOrder in purchaseOrderListExample)
{
orderComboBox.Items.Add(pOrder.Name);
if (pOrder != null && !String.IsNullOrEmpty(pOrder.Name))
{
orderComboBox.Items.Add(pOrder.Name);
}
}
LoadPurchaseBox("");
@@ -715,6 +724,17 @@ namespace TBF.Rig.DataEntry.StandartCameraPurchaseOrder
.SelectMany(pBox => pBox.PurchaseWaterMeterDataList)
.Select(pWM => pWM.SerialNo);
try
{
string[] iEnumerable = serialNumbers as string[] ?? serialNumbers.ToArray();
log_selected.Debug(
$"Selected order: {choosenOrder} box: {choosenBox} possible serial numbers (form DB): {string.Join(", ", iEnumerable)}");
}
catch (Exception e)
{
log_selected.Error("Error loading serial numbers: " + e);
}
//enable behaviour type
bool addOnEndOnly = false;
@@ -723,6 +743,7 @@ namespace TBF.Rig.DataEntry.StandartCameraPurchaseOrder
if (countOfFreeBoxes < serialNumbers.Count())
{
log_selected.Debug(">" + serialNumbers.Count() + " Serial Numbers in box as we have free positions!");
MessageBox.Show(this, "We have more Serial Numbers in box as we have free positions!", "Warning",
MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
@@ -750,6 +771,7 @@ namespace TBF.Rig.DataEntry.StandartCameraPurchaseOrder
if (lastComboBoxSerialNo >= 0 || lastComboBoxSerialNo < enabledComboBoxes.Count)
{
comboBoxes[lastComboBoxSerialNo].Text = serialNumber;
log_selected.Debug($"Added serial no: {serialNumber} to pos: {lastComboBoxSerialNo}");
lastComboBoxSerialNo++;
}
}
@@ -759,6 +781,7 @@ namespace TBF.Rig.DataEntry.StandartCameraPurchaseOrder
if (iNextFreeNumber >= 0 || iNextFreeNumber < enabledComboBoxes.Count)
{
comboBoxes[iNextFreeNumber].Text = serialNumber;
log_selected.Debug($"Added serial no: {serialNumber} to pos: {iNextFreeNumber}");
lastComboBoxSerialNo = iNextFreeNumber;
}
}
@@ -771,6 +794,7 @@ namespace TBF.Rig.DataEntry.StandartCameraPurchaseOrder
if (!noImplementedSerialNumbers.IsEmpty())
{
log_selected.Debug("No implemented serial numbers: " + noImplementedSerialNumbers);
MessageBox.Show(this,
string.Format("The following serial numbers were not implemented: {0}", noImplementedSerialNumbers),
"Serial Numbers repeating!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
+5 -5
View File
@@ -87,13 +87,13 @@ namespace TBF.UI.Procedures
/// SharedDlgButtons configuration
sharedButtons.ParentForm = parentForm;
#if LANG_PL
//#if LANG_PL
sharedButtons.RequiredGroupMembership = procedure.Protected ? new GID[] { GID.WaterMeterAuthority }
: new GID[] { GID.TestingSpecialists, GID.Metrologists, GID.WaterMeterAuthority };
#else
sharedButtons.RequiredGroupMembership = procedure.Protected ? new GID[] { GID.Metrologists }
: new GID[] { GID.TestingSpecialists, GID.Metrologists };
#endif
// #else
// sharedButtons.RequiredGroupMembership = procedure.Protected ? new GID[] { GID.Metrologists }
// : new GID[] { GID.TestingSpecialists, GID.Metrologists };
// #endif
sharedButtons.OptionalButtons = SharedButtons.Buttons.Add |
SharedButtons.Buttons.Remove |
SharedButtons.Buttons.Up |