Fleshing otu workorder

This commit is contained in:
2020-05-03 22:55:45 +00:00
parent b9da7a45b6
commit ff54daac8f
7 changed files with 78 additions and 117 deletions

View File

@@ -15,9 +15,9 @@ namespace AyaNova.Util
//AUTOID's
//Get the highest id number issued previously and start the auto-id at that level
//Get the most recent id number issued previously and start the auto-id at that level
internal static AutoId WIDGET_SERIAL { get; set; }
internal static AutoId WORKORDER_SERIAL { get; set; }
//Diagnostic static values used during development, may not be related to config at all, this is just a convenient class to put them in
#if (DEBUG)
@@ -226,12 +226,22 @@ namespace AyaNova.Util
//query for most recently used serial number
//(note, can't query for highest serial as it can and likely will reset or be changed manually from time to time
// so the algorithm is to keep the most recent sequence going on startup of the server)
var MostRecentWidget = ct.Widget.AsNoTracking().OrderByDescending(x => x.Id).FirstOrDefault();
uint MaxWidgetId = 0;
if (MostRecentWidget != null)
MaxWidgetId = MostRecentWidget.Serial;
WIDGET_SERIAL = new AutoId(MaxWidgetId);
var serializedObject = ct.Widget.AsNoTracking().OrderByDescending(x => x.Id).FirstOrDefault();
WIDGET_SERIAL = new AutoId(serializedObject == null ? 0 : serializedObject.Serial);
// var MostRecentWidget = ct.Widget.AsNoTracking().OrderByDescending(x => x.Id).FirstOrDefault();
// uint MaxWidgetId = 0;
// if (MostRecentWidget != null)
// MaxWidgetId = MostRecentWidget.Serial;
// WIDGET_SERIAL = new AutoId(MaxWidgetId);
}
//Workorder
if (WORKORDER_SERIAL == null)
{
var serializedObject = ct.WorkOrder.AsNoTracking().OrderByDescending(x => x.Id).FirstOrDefault();
WORKORDER_SERIAL = new AutoId(serializedObject == null ? 0 : serializedObject.Serial);
}
//OTHER SERIALS HERE IN FUTURE...