This commit is contained in:
@@ -13,11 +13,16 @@ CONCURRENCY decision / research - updating, in bits seperately, entirely at once
|
|||||||
Things that might require an entire workorder graph be updated at once:
|
Things that might require an entire workorder graph be updated at once:
|
||||||
Major header changes?
|
Major header changes?
|
||||||
Customer, Contract because pricing and policies might change?
|
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?)
|
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 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
|
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
|
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...
|
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
|
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
|
i.e. have non-mapped dirty fields for every woitemrecord
|
||||||
@@ -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)
|
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 ########################################
|
########### 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:
|
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.WorkOrderItemTravel:
|
||||||
case AyaType.WorkOrderItemOutsideService:
|
case AyaType.WorkOrderItemOutsideService:
|
||||||
case AyaType.WorkOrderItemUnit:
|
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 }));
|
return Ok(ApiOkResponse.Response(new { AyaType = TypeId.ATypeAsInt, Id = TypeId.ObjectId }));
|
||||||
default:
|
default:
|
||||||
return BadRequest(new ApiErrorResponse(ApiErrorCode.VALIDATION_INVALID_VALUE, null, "Only types with ancestors are valid"));
|
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
|
//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;
|
long woitemid = 0;
|
||||||
switch (ayaType)
|
switch (ayaType)
|
||||||
{
|
{
|
||||||
|
case AyaType.WorkOrder:
|
||||||
|
return id;
|
||||||
case AyaType.WorkOrderItem:
|
case AyaType.WorkOrderItem:
|
||||||
woitemid = id;
|
woitemid = id;
|
||||||
break;
|
break;
|
||||||
@@ -346,6 +348,9 @@ namespace AyaNova.Biz
|
|||||||
//run validation and biz rules
|
//run validation and biz rules
|
||||||
bool isNew = currentObj == null;
|
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:
|
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}");
|
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
|
#endregion utility
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -64,6 +64,11 @@ namespace AyaNova.Models
|
|||||||
public List<WorkOrderState> States { get; set; } = new List<WorkOrderState>();
|
public List<WorkOrderState> States { get; set; } = new List<WorkOrderState>();
|
||||||
|
|
||||||
|
|
||||||
|
//UTILITY FIELDS
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[NotMapped, JsonIgnore]
|
[NotMapped, JsonIgnore]
|
||||||
public AyaType AyaType { get => AyaType.WorkOrder; }
|
public AyaType AyaType { get => AyaType.WorkOrder; }
|
||||||
}//eoc
|
}//eoc
|
||||||
|
|||||||
@@ -19,7 +19,10 @@ namespace AyaNova.Models
|
|||||||
[Required]
|
[Required]
|
||||||
public long UserId { get; set; }
|
public long UserId { get; set; }
|
||||||
|
|
||||||
[NotMapped, JsonIgnore]
|
//related
|
||||||
|
public WorkOrderStatus WorkOrderStatus { get; set; }
|
||||||
|
|
||||||
|
[NotMapped, JsonIgnore]
|
||||||
public AyaType AyaType { get => AyaType.WorkOrderStatus; }
|
public AyaType AyaType { get => AyaType.WorkOrderStatus; }
|
||||||
|
|
||||||
}//eoc
|
}//eoc
|
||||||
|
|||||||
Reference in New Issue
Block a user