This commit is contained in:
@@ -816,7 +816,7 @@ namespace AyaNova.Biz
|
||||
return await WorkOrderGetAsync(id, true, false, populateForReporting);
|
||||
var wid = await GetWorkOrderIdFromRelativeAsync(ayaType, id, ct);
|
||||
//get header only
|
||||
var ret = await ct.WorkOrder.AsNoTracking().SingleOrDefaultAsync(x => x.Id == wid.ParentId);
|
||||
var ret = await ct.WorkOrder.AsNoTracking().Include(s => s.States).SingleOrDefaultAsync(x => x.Id == wid.ParentId);
|
||||
//not found don't bomb, just return null
|
||||
if (ret == null) return ret;
|
||||
//explicit load subitems as required...
|
||||
@@ -840,10 +840,8 @@ namespace AyaNova.Biz
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
//get the single workorder item required
|
||||
woitem = await ct.WorkOrderItem.AsNoTracking().SingleOrDefaultAsync(x => x.Id == wid.ChildItemId);
|
||||
|
||||
switch (ayaType)
|
||||
{
|
||||
case AyaType.WorkOrderItemExpense:
|
||||
@@ -1445,6 +1443,12 @@ namespace AyaNova.Biz
|
||||
private async Task StatePopulateVizFields(WorkOrderState o)
|
||||
{
|
||||
o.UserViz = await ct.User.AsNoTracking().Where(x => x.Id == o.UserId).Select(x => x.Name).FirstOrDefaultAsync();
|
||||
var StateInfo = await ct.WorkOrderStatus.AsNoTracking().Where(x => x.Id == o.WorkOrderStatusId).FirstOrDefaultAsync();
|
||||
o.NameViz = StateInfo.Name;
|
||||
o.ColorViz = StateInfo.Color;
|
||||
o.CompletedViz = StateInfo.Completed;
|
||||
o.LockedViz = StateInfo.Locked;
|
||||
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -1776,7 +1780,7 @@ namespace AyaNova.Biz
|
||||
CustomerServiceRequestBiz biz = CustomerServiceRequestBiz.GetBiz(ct);
|
||||
var csr = await biz.GetAsync((long)newObject.FromCSRId, false);
|
||||
csr.WorkOrderItemId = newObject.Id;
|
||||
csr.Status=CustomerServiceRequestStatus.Accepted;
|
||||
csr.Status = CustomerServiceRequestStatus.Accepted;
|
||||
await biz.PutAsync(csr);
|
||||
}
|
||||
|
||||
@@ -1981,6 +1985,20 @@ namespace AyaNova.Biz
|
||||
if (o.FromCSRId != null)
|
||||
o.FromCSRViz = await ct.CustomerServiceRequest.AsNoTracking().Where(x => x.Id == o.FromCSRId).Select(x => x.Name).FirstOrDefaultAsync();
|
||||
|
||||
if (o.WorkOrderItemStatusId != null)
|
||||
{
|
||||
var StatusInfo = await ct.WorkOrderItemStatus.AsNoTracking().FirstOrDefaultAsync(x => x.Id == o.WorkOrderItemStatusId);
|
||||
o.WorkOrderItemStatusNameViz = StatusInfo.Name;
|
||||
o.WorkOrderItemStatusColorViz = StatusInfo.Color;
|
||||
}
|
||||
|
||||
if (o.WorkOrderItemPriorityId != null)
|
||||
{
|
||||
var PriorityInfo = await ct.WorkOrderItemPriority.AsNoTracking().FirstOrDefaultAsync(x => x.Id == o.WorkOrderItemPriorityId);
|
||||
o.WorkOrderItemPriorityNameViz = PriorityInfo.Name;
|
||||
o.WorkOrderItemPriorityColorViz = PriorityInfo.Color;
|
||||
}
|
||||
|
||||
foreach (var v in o.Expenses)
|
||||
await ExpensePopulateVizFields(v);
|
||||
foreach (var v in o.Labors)
|
||||
@@ -4874,6 +4892,252 @@ namespace AyaNova.Biz
|
||||
return true;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// GET Schedule view "more info" display values
|
||||
//
|
||||
internal async Task<object> ScheduledUserGetScheduleInfoViewAsync(long id, bool logTheGetEvent = true)
|
||||
{
|
||||
/*
|
||||
MORE INFO DISPLAY
|
||||
Summary info to display for woitem when open dialog (MUST check at server if restricted tech and not send / show some if not all of this)
|
||||
No controls to change the time / date for now
|
||||
|
||||
wosummary
|
||||
wostatus
|
||||
woitemsummary
|
||||
woitemstatus
|
||||
woitempriority
|
||||
tech
|
||||
estimated qty
|
||||
rate
|
||||
tags
|
||||
|
||||
*/
|
||||
var w = await WorkOrderGetPartialAsync(AyaType.WorkOrderItemScheduledUser, id, false, true);
|
||||
|
||||
if (UserIsRestrictedType && w.Items[0].ScheduledUsers[0].UserId != UserId)//restricted users can only see their own
|
||||
return null;
|
||||
|
||||
/*
|
||||
{
|
||||
"data": {
|
||||
"id": 6,
|
||||
"concurrency": 14171235,
|
||||
"serial": 6,
|
||||
"notes": "Esse aut totam adipisci minima optio rerum sed qui.",
|
||||
"wiki": null,
|
||||
"customFields": null,
|
||||
"tags": [
|
||||
"black",
|
||||
"jade",
|
||||
"zebra",
|
||||
"zone0",
|
||||
"zone6"
|
||||
],
|
||||
"customerId": 11,
|
||||
"customerViz": "Parker, Ryan and Denesik",
|
||||
"customerTechNotesViz": null,
|
||||
"projectId": null,
|
||||
"projectViz": null,
|
||||
"internalReferenceNumber": "irf-5922",
|
||||
"customerReferenceNumber": "crf-8231",
|
||||
"customerContactName": null,
|
||||
"fromQuoteId": null,
|
||||
"fromPMId": null,
|
||||
"createdDate": "2021-09-16T13:58:46.481767Z",
|
||||
"serviceDate": "2021-11-11T23:00:00Z",
|
||||
"completeByDate": "2021-11-16T23:00:00Z",
|
||||
"durationToCompleted": "00:00:00",
|
||||
"invoiceNumber": null,
|
||||
"customerSignature": null,
|
||||
"customerSignatureName": null,
|
||||
"customerSignatureCaptured": null,
|
||||
"techSignature": null,
|
||||
"techSignatureName": null,
|
||||
"techSignatureCaptured": null,
|
||||
"onsite": false,
|
||||
"contractId": null,
|
||||
"contractViz": "-",
|
||||
"lastStatusId": 1,
|
||||
"postAddress": "014 Roberts Garden",
|
||||
"postCity": "Chesterborough",
|
||||
"postRegion": "California",
|
||||
"postCountry": "Nauru",
|
||||
"postCode": "66467",
|
||||
"address": "0844 Zieme Prairie",
|
||||
"city": "Chesterborough",
|
||||
"region": "California",
|
||||
"country": "Nauru",
|
||||
"latitude": -2.527,
|
||||
"longitude": 132.4754,
|
||||
"items": [
|
||||
{
|
||||
"id": 14,
|
||||
"concurrency": 14171235,
|
||||
"notes": "itemnotes - 2 ",
|
||||
"wiki": null,
|
||||
"customFields": null,
|
||||
"tags": [],
|
||||
"workOrderId": 6,
|
||||
"techNotes": "technotes - 2",
|
||||
"workOrderItemStatusId": 1,
|
||||
"workOrderItemStatusNameViz": "Item is completed",
|
||||
"workOrderItemStatusColorViz": "#c00000",
|
||||
"workOrderItemPriorityId": 1,
|
||||
"workOrderItemPriorityNameViz": "Immediately",
|
||||
"workOrderItemPriorityColorViz": "#c00000",
|
||||
"requestDate": "2021-11-11T23:02:00Z",
|
||||
"warrantyService": false,
|
||||
"sequence": 3,
|
||||
"fromCSRId": null,
|
||||
"fromCSRViz": null,
|
||||
"expenses": [],
|
||||
"labors": [],
|
||||
"loans": [],
|
||||
"parts": [],
|
||||
"partRequests": [],
|
||||
"scheduledUsers": [
|
||||
{
|
||||
"id": 33,
|
||||
"concurrency": 14171866,
|
||||
"userId": 10,
|
||||
"userViz": "Eliza Hartmann - Tech",
|
||||
"estimatedQuantity": 1,
|
||||
"startDate": "2021-11-09T21:00:00Z",
|
||||
"stopDate": "2021-11-09T22:00:00Z",
|
||||
"serviceRateId": null,
|
||||
"serviceRateViz": null,
|
||||
"workOrderItemId": 14
|
||||
}
|
||||
],
|
||||
"tasks": [],
|
||||
"travels": [],
|
||||
"units": [],
|
||||
"outsideServices": []
|
||||
}
|
||||
],
|
||||
"states": [
|
||||
{
|
||||
"id": 26,
|
||||
"concurrency": 14171235,
|
||||
"workOrderId": 6,
|
||||
"workOrderStatusId": 2,
|
||||
"created": "2021-11-11T23:05:00Z",
|
||||
"userId": 25,
|
||||
"userViz": "Carroll Miller",
|
||||
"nameViz": "Needs to be assigned",
|
||||
"colorViz": "#80ffff",
|
||||
"completedViz": false,
|
||||
"lockedViz": false
|
||||
},
|
||||
{
|
||||
"id": 27,
|
||||
"concurrency": 14171235,
|
||||
"workOrderId": 6,
|
||||
"workOrderStatusId": 3,
|
||||
"created": "2021-11-12T00:00:00Z",
|
||||
"userId": 10,
|
||||
"userViz": "Eliza Hartmann - Tech",
|
||||
"nameViz": "Scheduled",
|
||||
"colorViz": "#00ff00",
|
||||
"completedViz": false,
|
||||
"lockedViz": false
|
||||
},
|
||||
{
|
||||
"id": 28,
|
||||
"concurrency": 14171235,
|
||||
"workOrderId": 6,
|
||||
"workOrderStatusId": 1,
|
||||
"created": "2021-11-12T00:05:00Z",
|
||||
"userId": 10,
|
||||
"userViz": "Eliza Hartmann - Tech",
|
||||
"nameViz": "Manager approval required",
|
||||
"colorViz": "#c00000",
|
||||
"completedViz": false,
|
||||
"lockedViz": true
|
||||
},
|
||||
{
|
||||
"id": 29,
|
||||
"concurrency": 14171235,
|
||||
"workOrderId": 6,
|
||||
"workOrderStatusId": 3,
|
||||
"created": "2021-11-12T01:00:00Z",
|
||||
"userId": 10,
|
||||
"userViz": "Eliza Hartmann - Tech",
|
||||
"nameViz": "Scheduled",
|
||||
"colorViz": "#00ff00",
|
||||
"completedViz": false,
|
||||
"lockedViz": false
|
||||
},
|
||||
{
|
||||
"id": 30,
|
||||
"concurrency": 14171235,
|
||||
"workOrderId": 6,
|
||||
"workOrderStatusId": 1,
|
||||
"created": "2021-11-12T01:00:00Z",
|
||||
"userId": 10,
|
||||
"userViz": "Eliza Hartmann - Tech",
|
||||
"nameViz": "Manager approval required",
|
||||
"colorViz": "#c00000",
|
||||
"completedViz": false,
|
||||
"lockedViz": true
|
||||
}
|
||||
],
|
||||
"isLockedAtServer": false,
|
||||
"alertViz": null,
|
||||
"fromQuoteViz": null,
|
||||
"fromPMViz": null,
|
||||
"isCompleteRecord": true,
|
||||
"userIsRestrictedType": false,
|
||||
"userIsTechRestricted": false,
|
||||
"userIsSubContractorFull": false,
|
||||
"userIsSubContractorRestricted": false,
|
||||
"userCanViewPartCosts": false,
|
||||
"userCanViewLaborOrTravelRateCosts": false,
|
||||
"userCanViewLoanerCosts": false
|
||||
}
|
||||
}
|
||||
wosummary
|
||||
wostatus
|
||||
woitemsummary
|
||||
woitemstatus
|
||||
woitempriority
|
||||
tech
|
||||
estimated qty
|
||||
rate
|
||||
tags
|
||||
*/
|
||||
string WoStatusName = string.Empty;
|
||||
string WoStatusColor = string.Empty;
|
||||
if (w.States.Count > 0)
|
||||
{
|
||||
WoStatusName = w.States[w.States.Count - 1].NameViz;
|
||||
WoStatusColor = w.States[w.States.Count - 1].ColorViz;
|
||||
}
|
||||
|
||||
return new
|
||||
{
|
||||
serial = w.Serial,
|
||||
w.CustomerViz,
|
||||
wosummary = w.Notes,
|
||||
wostatus = WoStatusName,
|
||||
wostatuscolor = WoStatusColor,
|
||||
woitemnotes = w.Items[0].Notes,
|
||||
woitemtechnotes = w.Items[0].TechNotes,
|
||||
woitemstatus = w.Items[0].WorkOrderItemStatusNameViz,
|
||||
woitemstatuscolor = w.Items[0].WorkOrderItemStatusColorViz,
|
||||
woitempriority = w.Items[0].WorkOrderItemPriorityNameViz,
|
||||
woitemprioritycolor = w.Items[0].WorkOrderItemPriorityColorViz,
|
||||
scheduser = w.Items[0].ScheduledUsers[0].UserViz,
|
||||
qty = w.Items[0].ScheduledUsers[0].EstimatedQuantity,
|
||||
rate = w.Items[0].ScheduledUsers[0].ServiceRateViz,
|
||||
wotags = w.Tags,
|
||||
woitemtags = w.Items[0].Tags
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//VIZ POPULATE
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user