This commit is contained in:
@@ -13,12 +13,17 @@ CONCURRENCY decision / research - updating, in bits seperately, entirely at once
|
||||
Things that might require an entire workorder graph be updated at once:
|
||||
Major header changes?
|
||||
Customer, Contract because pricing and policies might change?
|
||||
|
||||
Anything that affects balances and totals (are there new features happening showing dollar amounts billable right on workorder?)
|
||||
in v7 not an issue because need to preview report to see totals
|
||||
in v8 some talk of seeing totals, so need to determine if that's still a thing, if not then this whole class of concurrency issues dissappears
|
||||
This would be entirely resolved with a "view" showing a type of "invoice" summary kind of thing where you open that tab and it fetches and calcs and displays
|
||||
however this would be little difference from a report and a little worse because the end user can't edit it to calculate how they would like it to so...
|
||||
|
||||
ENTIRE GRAPH AFFECTING CHANGES
|
||||
One idea to support this is if a change is made at header that affects all children then change their concurrency values so updates will fail
|
||||
This is a good idea, need a clean way to support it but this makes sense
|
||||
|
||||
Dirty tracking at every level and object would save having to send entire workorder, just dirty bits
|
||||
i.e. have non-mapped dirty fields for every woitemrecord
|
||||
client uses them to track changes and what needs to be saved
|
||||
@@ -36,6 +41,21 @@ CONCURRENCY decision / research - updating, in bits seperately, entirely at once
|
||||
if locked then bumps back with error that wo is now locked (of course they could just change teh status in the header and resave I guess)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
########### PLANNING BELOW HERE, OUTDATED NOW ########################################
|
||||
Lot's to go in here but for now this is holding my planning and thoughts until can set in stone:
|
||||
|
||||
|
||||
@@ -141,7 +141,7 @@ namespace AyaNova.Api.Controllers
|
||||
case AyaType.WorkOrderItemTravel:
|
||||
case AyaType.WorkOrderItemOutsideService:
|
||||
case AyaType.WorkOrderItemUnit:
|
||||
AyaTypeId TypeId = new AyaTypeId(AyaType.WorkOrder, await WorkOrderBiz.GetWorkOrderIdFromDescendant(ayaType, id, ct));
|
||||
AyaTypeId TypeId = new AyaTypeId(AyaType.WorkOrder, await WorkOrderBiz.GetWorkOrderIdFromRelativeAsync(ayaType, id, ct));
|
||||
return Ok(ApiOkResponse.Response(new { AyaType = TypeId.ATypeAsInt, Id = TypeId.ObjectId }));
|
||||
default:
|
||||
return BadRequest(new ApiErrorResponse(ApiErrorCode.VALIDATION_INVALID_VALUE, null, "Only types with ancestors are valid"));
|
||||
|
||||
@@ -253,11 +253,13 @@ namespace AyaNova.Biz
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//GET WORKORDER ID FROM DESCENDANT TYPE AND ID
|
||||
//
|
||||
internal static async Task<long> GetWorkOrderIdFromDescendant(AyaType ayaType, long id, AyContext ct)
|
||||
internal static async Task<long> GetWorkOrderIdFromRelativeAsync(AyaType ayaType, long id, AyContext ct)
|
||||
{
|
||||
long woitemid = 0;
|
||||
switch (ayaType)
|
||||
{
|
||||
case AyaType.WorkOrder:
|
||||
return id;
|
||||
case AyaType.WorkOrderItem:
|
||||
woitemid = id;
|
||||
break;
|
||||
@@ -346,6 +348,9 @@ namespace AyaNova.Biz
|
||||
//run validation and biz rules
|
||||
bool isNew = currentObj == null;
|
||||
|
||||
|
||||
//Check state if updatable right now
|
||||
|
||||
/*
|
||||
|
||||
todo: workorder status list first, it's a table of created items, keep properties from v7 but add the following properties:
|
||||
@@ -3597,6 +3602,25 @@ namespace AyaNova.Biz
|
||||
throw new System.ArgumentOutOfRangeException($"WorkOrder::GetWorkOrderGraphItem -> Invalid ayaType{ayaType}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//GET UPDATEABLE STATUS FOR WORKORDER FROM DESCENDANT
|
||||
//
|
||||
internal static async Task<WorkOrderStatus> GetCurrentWorkOrderStatusFromRelatedAsync(AyaType ayaType, long id, AyContext ct)
|
||||
{
|
||||
long WoId = await GetWorkOrderIdFromRelativeAsync(ayaType, id, ct);
|
||||
|
||||
return await ct.WorkOrderState.AsNoTracking()
|
||||
.Include(z => z.WorkOrderStatus)
|
||||
.Where(z => z.WorkOrderId == WoId)
|
||||
.OrderBy(z => z.Created)
|
||||
.Select(z => z.WorkOrderStatus)
|
||||
.Take(1)
|
||||
.FirstOrDefaultAsync();
|
||||
|
||||
}
|
||||
#endregion utility
|
||||
|
||||
|
||||
|
||||
@@ -64,6 +64,11 @@ namespace AyaNova.Models
|
||||
public List<WorkOrderState> States { get; set; } = new List<WorkOrderState>();
|
||||
|
||||
|
||||
//UTILITY FIELDS
|
||||
|
||||
|
||||
|
||||
|
||||
[NotMapped, JsonIgnore]
|
||||
public AyaType AyaType { get => AyaType.WorkOrder; }
|
||||
}//eoc
|
||||
|
||||
@@ -19,6 +19,9 @@ namespace AyaNova.Models
|
||||
[Required]
|
||||
public long UserId { get; set; }
|
||||
|
||||
//related
|
||||
public WorkOrderStatus WorkOrderStatus { get; set; }
|
||||
|
||||
[NotMapped, JsonIgnore]
|
||||
public AyaType AyaType { get => AyaType.WorkOrderStatus; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user