This commit is contained in:
@@ -839,7 +839,7 @@ namespace AyaNova.Api.Controllers
|
||||
return StatusCode(403, new ApiNotAuthorizedResponse());
|
||||
if (!ModelState.IsValid)
|
||||
return BadRequest(new ApiErrorResponse(ModelState));
|
||||
WorkOrderItemPart o = await biz.CreatePartAsync(newObject);
|
||||
WorkOrderItemPart o = await biz.PartCreateAsync(newObject);
|
||||
if (o == null)
|
||||
return BadRequest(new ApiErrorResponse(biz.Errors));
|
||||
else
|
||||
|
||||
@@ -948,7 +948,7 @@ namespace AyaNova.Biz
|
||||
public async Task PMHandlePotentialNotificationEvent(AyaEvent ayaEvent, ICoreBizObjectModel proposedObj, ICoreBizObjectModel currentObj = null)
|
||||
{
|
||||
ILogger log = AyaNova.Util.ApplicationLogging.CreateLogger<PMBiz>();
|
||||
if(ServerBootConfig.SEEDING || ServerBootConfig.MIGRATING) return;
|
||||
if (ServerBootConfig.SEEDING || ServerBootConfig.MIGRATING) return;
|
||||
log.LogDebug($"HandlePotentialNotificationEvent processing: [AyaType:{this.BizType}, AyaEvent:{ayaEvent}]");
|
||||
|
||||
bool isNew = currentObj == null;
|
||||
@@ -1377,7 +1377,7 @@ namespace AyaNova.Biz
|
||||
public async Task ItemHandlePotentialNotificationEvent(AyaEvent ayaEvent, ICoreBizObjectModel proposedObj, ICoreBizObjectModel currentObj = null)
|
||||
{
|
||||
ILogger log = AyaNova.Util.ApplicationLogging.CreateLogger<PMBiz>();
|
||||
if(ServerBootConfig.SEEDING || ServerBootConfig.MIGRATING) return;
|
||||
if (ServerBootConfig.SEEDING || ServerBootConfig.MIGRATING) return;
|
||||
log.LogDebug($"HandlePotentialNotificationEvent processing: [AyaType:{proposedObj.AyaType}, AyaEvent:{ayaEvent}]");
|
||||
|
||||
bool isNew = currentObj == null;
|
||||
@@ -1730,7 +1730,7 @@ namespace AyaNova.Biz
|
||||
public async Task ExpenseHandlePotentialNotificationEvent(AyaEvent ayaEvent, ICoreBizObjectModel proposedObj, ICoreBizObjectModel currentObj = null)
|
||||
{
|
||||
ILogger log = AyaNova.Util.ApplicationLogging.CreateLogger<PMBiz>();
|
||||
if(ServerBootConfig.SEEDING || ServerBootConfig.MIGRATING) return;
|
||||
if (ServerBootConfig.SEEDING || ServerBootConfig.MIGRATING) return;
|
||||
log.LogDebug($"HandlePotentialNotificationEvent processing: [AyaType:{proposedObj.AyaType}, AyaEvent:{ayaEvent}]");
|
||||
|
||||
bool isNew = currentObj == null;
|
||||
@@ -2101,7 +2101,7 @@ namespace AyaNova.Biz
|
||||
public async Task LaborHandlePotentialNotificationEvent(AyaEvent ayaEvent, ICoreBizObjectModel proposedObj, ICoreBizObjectModel currentObj = null)
|
||||
{
|
||||
ILogger log = AyaNova.Util.ApplicationLogging.CreateLogger<PMBiz>();
|
||||
if(ServerBootConfig.SEEDING || ServerBootConfig.MIGRATING) return;
|
||||
if (ServerBootConfig.SEEDING || ServerBootConfig.MIGRATING) return;
|
||||
log.LogDebug($"HandlePotentialNotificationEvent processing: [AyaType:{proposedObj.AyaType}, AyaEvent:{ayaEvent}]");
|
||||
|
||||
bool isNew = currentObj == null;
|
||||
@@ -2488,7 +2488,7 @@ namespace AyaNova.Biz
|
||||
public async Task LoanHandlePotentialNotificationEvent(AyaEvent ayaEvent, ICoreBizObjectModel proposedObj, ICoreBizObjectModel currentObj = null)
|
||||
{
|
||||
ILogger log = AyaNova.Util.ApplicationLogging.CreateLogger<PMBiz>();
|
||||
if(ServerBootConfig.SEEDING || ServerBootConfig.MIGRATING) return;
|
||||
if (ServerBootConfig.SEEDING || ServerBootConfig.MIGRATING) return;
|
||||
log.LogDebug($"HandlePotentialNotificationEvent processing: [AyaType:{proposedObj.AyaType}, AyaEvent:{ayaEvent}]");
|
||||
|
||||
bool isNew = currentObj == null;
|
||||
@@ -2795,7 +2795,7 @@ namespace AyaNova.Biz
|
||||
OutsideServiceReceived = 17,//* Workorder object , WorkOrderItemOutsideService updated, instant notification when item received, tag filterable
|
||||
*/
|
||||
ILogger log = AyaNova.Util.ApplicationLogging.CreateLogger<PMBiz>();
|
||||
if(ServerBootConfig.SEEDING || ServerBootConfig.MIGRATING) return;
|
||||
if (ServerBootConfig.SEEDING || ServerBootConfig.MIGRATING) return;
|
||||
log.LogDebug($"HandlePotentialNotificationEvent processing: [AyaType:{proposedObj.AyaType}, AyaEvent:{ayaEvent}]");
|
||||
|
||||
bool isNew = currentObj == null;
|
||||
@@ -3233,7 +3233,7 @@ namespace AyaNova.Biz
|
||||
public async Task PartHandlePotentialNotificationEvent(AyaEvent ayaEvent, ICoreBizObjectModel proposedObj, ICoreBizObjectModel currentObj = null)
|
||||
{
|
||||
ILogger log = AyaNova.Util.ApplicationLogging.CreateLogger<PMBiz>();
|
||||
if(ServerBootConfig.SEEDING || ServerBootConfig.MIGRATING) return;
|
||||
if (ServerBootConfig.SEEDING || ServerBootConfig.MIGRATING) return;
|
||||
log.LogDebug($"HandlePotentialNotificationEvent processing: [AyaType:{proposedObj.AyaType}, AyaEvent:{ayaEvent}]");
|
||||
|
||||
bool isNew = currentObj == null;
|
||||
@@ -3467,7 +3467,7 @@ namespace AyaNova.Biz
|
||||
public async Task ScheduledUserHandlePotentialNotificationEvent(AyaEvent ayaEvent, ICoreBizObjectModel proposedObj, ICoreBizObjectModel currentObj = null)
|
||||
{
|
||||
ILogger log = AyaNova.Util.ApplicationLogging.CreateLogger<PMBiz>();
|
||||
if(ServerBootConfig.SEEDING || ServerBootConfig.MIGRATING) return;
|
||||
if (ServerBootConfig.SEEDING || ServerBootConfig.MIGRATING) return;
|
||||
log.LogDebug($"HandlePotentialNotificationEvent processing: [AyaType:{proposedObj.AyaType}, AyaEvent:{ayaEvent}]");
|
||||
|
||||
bool isNew = currentObj == null;
|
||||
@@ -3730,7 +3730,7 @@ namespace AyaNova.Biz
|
||||
public async Task TaskHandlePotentialNotificationEvent(AyaEvent ayaEvent, ICoreBizObjectModel proposedObj, ICoreBizObjectModel currentObj = null)
|
||||
{
|
||||
ILogger log = AyaNova.Util.ApplicationLogging.CreateLogger<PMBiz>();
|
||||
if(ServerBootConfig.SEEDING || ServerBootConfig.MIGRATING) return;
|
||||
if (ServerBootConfig.SEEDING || ServerBootConfig.MIGRATING) return;
|
||||
log.LogDebug($"HandlePotentialNotificationEvent processing: [AyaType:{proposedObj.AyaType}, AyaEvent:{ayaEvent}]");
|
||||
|
||||
bool isNew = currentObj == null;
|
||||
@@ -4087,7 +4087,7 @@ namespace AyaNova.Biz
|
||||
public async Task TravelHandlePotentialNotificationEvent(AyaEvent ayaEvent, ICoreBizObjectModel proposedObj, ICoreBizObjectModel currentObj = null)
|
||||
{
|
||||
ILogger log = AyaNova.Util.ApplicationLogging.CreateLogger<PMBiz>();
|
||||
if(ServerBootConfig.SEEDING || ServerBootConfig.MIGRATING) return;
|
||||
if (ServerBootConfig.SEEDING || ServerBootConfig.MIGRATING) return;
|
||||
log.LogDebug($"HandlePotentialNotificationEvent processing: [AyaType:{proposedObj.AyaType}, AyaEvent:{ayaEvent}]");
|
||||
|
||||
bool isNew = currentObj == null;
|
||||
@@ -4370,7 +4370,7 @@ namespace AyaNova.Biz
|
||||
public async Task UnitHandlePotentialNotificationEvent(AyaEvent ayaEvent, ICoreBizObjectModel proposedObj, ICoreBizObjectModel currentObj = null)
|
||||
{
|
||||
ILogger log = AyaNova.Util.ApplicationLogging.CreateLogger<PMBiz>();
|
||||
if(ServerBootConfig.SEEDING || ServerBootConfig.MIGRATING) return;
|
||||
if (ServerBootConfig.SEEDING || ServerBootConfig.MIGRATING) return;
|
||||
log.LogDebug($"HandlePotentialNotificationEvent processing: [AyaType:{proposedObj.AyaType}, AyaEvent:{ayaEvent}]");
|
||||
|
||||
bool isNew = currentObj == null;
|
||||
@@ -4865,6 +4865,9 @@ namespace AyaNova.Biz
|
||||
|
||||
internal static async Task<bool> NewServiceWorkOrderFromPMAsync(PM p, AyContext ct, ILogger log)
|
||||
{
|
||||
WorkOrderBiz biz = WorkOrderBiz.GetBiz(ct);
|
||||
|
||||
|
||||
WorkOrder wo = new WorkOrder();
|
||||
wo.Address = p.Address;
|
||||
wo.City = p.City;
|
||||
@@ -4895,9 +4898,20 @@ namespace AyaNova.Biz
|
||||
wo.Wiki = p.Wiki;
|
||||
if (p.CopyAttachments)
|
||||
wo.GenCopyAttachmentsFrom = new AyaTypeId(AyaType.PM, p.Id);
|
||||
|
||||
var NewWoHeader = await biz.WorkOrderCreateAsync(wo, false);
|
||||
if (NewWoHeader == null)
|
||||
{
|
||||
var err = $"PMBiz::NewServiceWorkOrderFromPMAsync error creating from PM {p.Serial}\r\n{biz.GetErrorsAsString()}";
|
||||
log.LogError(err);
|
||||
await NotifyEventHelper.AddGeneralNotifyEvent(AyaType.PM, p.Id, NotifyEventType.PMGenerationFailed, $"Error generating Work order from PM {p.Serial}\r\n{biz.GetErrorsAsString()}", "Preventive Maintenance");
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach (PMItem pmi in p.Items)
|
||||
{
|
||||
var woi = new WorkOrderItem();
|
||||
woi.WorkOrderId = NewWoHeader.Id;
|
||||
woi.Notes = pmi.Notes;
|
||||
woi.RequestDate = pmi.RequestDate;//DATE ADJUST
|
||||
woi.Sequence = pmi.Sequence;
|
||||
@@ -4909,9 +4923,19 @@ namespace AyaNova.Biz
|
||||
woi.WorkOrderItemPriorityId = pmi.WorkOrderItemPriorityId;
|
||||
woi.WorkOrderItemStatusId = pmi.WorkOrderItemStatusId;
|
||||
|
||||
var NewWoItem = await biz.ItemCreateAsync(woi);
|
||||
if (NewWoItem == null)
|
||||
{
|
||||
var err = $"PMBiz::NewServiceWorkOrderFromPMAsync error creating ITEM from PM {p.Serial}\r\n{biz.GetErrorsAsString()}";
|
||||
log.LogError(err);
|
||||
await NotifyEventHelper.AddGeneralNotifyEvent(AyaType.PM, p.Id, NotifyEventType.PMGenerationFailed, $"Error generating Work order from PM {p.Serial}\r\n{biz.GetErrorsAsString()}", "Preventive Maintenance");
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach (PMItemUnit pmiunit in pmi.Units)
|
||||
{
|
||||
var woiunit = new WorkOrderItemUnit();
|
||||
woiunit.WorkOrderItemId = NewWoItem.Id;
|
||||
woiunit.CustomFields = pmiunit.CustomFields;
|
||||
woiunit.Notes = pmiunit.Notes;
|
||||
woiunit.Tags = pmiunit.Tags;
|
||||
@@ -4919,12 +4943,21 @@ namespace AyaNova.Biz
|
||||
if (p.CopyWiki)
|
||||
woiunit.Wiki = pmiunit.Wiki;
|
||||
|
||||
woi.Units.Add(woiunit);
|
||||
//woi.Units.Add(woiunit);
|
||||
|
||||
if (await biz.UnitCreateAsync(woiunit) == null)
|
||||
{
|
||||
var err = $"PMBiz::NewServiceWorkOrderFromPMAsync error creating WOITEMUNIT from PM {p.Serial}\r\n{biz.GetErrorsAsString()}";
|
||||
log.LogError(err);
|
||||
await NotifyEventHelper.AddGeneralNotifyEvent(AyaType.PM, p.Id, NotifyEventType.PMGenerationFailed, $"Error generating WOITEMUNIT from PM {p.Serial}\r\n{biz.GetErrorsAsString()}", "Preventive Maintenance");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (PMItemScheduledUser pmsu in pmi.ScheduledUsers)
|
||||
{
|
||||
var wois = new WorkOrderItemScheduledUser();
|
||||
wois.WorkOrderItemId = NewWoItem.Id;
|
||||
wois.ServiceRateId = pmsu.ServiceRateId;
|
||||
wois.StartDate = pmsu.StartDate;//DATE ADJUST
|
||||
wois.StopDate = pmsu.StopDate;//DATE ADJUST
|
||||
@@ -4932,7 +4965,14 @@ namespace AyaNova.Biz
|
||||
wois.UserId = pmsu.UserId;
|
||||
wois.IsPMGenerated = true;//signifies to ignore schedule conflicts
|
||||
|
||||
woi.ScheduledUsers.Add(wois);
|
||||
//woi.ScheduledUsers.Add(wois);
|
||||
if (await biz.ScheduledUserCreateAsync(wois) == null)
|
||||
{
|
||||
var err = $"PMBiz::NewServiceWorkOrderFromPMAsync error creating WOITEMSCHEDUSER from PM {p.Serial}\r\n{biz.GetErrorsAsString()}";
|
||||
log.LogError(err);
|
||||
await NotifyEventHelper.AddGeneralNotifyEvent(AyaType.PM, p.Id, NotifyEventType.PMGenerationFailed, $"Error generating WOITEMSCHEDUSER from PM {p.Serial}\r\n{biz.GetErrorsAsString()}", "Preventive Maintenance");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (PMItemPart pmp in pmi.Parts)
|
||||
@@ -4986,14 +5026,23 @@ namespace AyaNova.Biz
|
||||
if (requestQuantity != 0)
|
||||
{
|
||||
var wipr = new WorkOrderItemPartRequest();
|
||||
wipr.WorkOrderItemId = NewWoItem.Id;
|
||||
wipr.PartId = pmp.PartId;
|
||||
wipr.PartWarehouseId = pmp.PartWarehouseId;
|
||||
wipr.Quantity = requestQuantity;
|
||||
woi.PartRequests.Add(wipr);
|
||||
//woi.PartRequests.Add(wipr);
|
||||
if (await biz.PartRequestCreateAsync(wipr) == null)
|
||||
{
|
||||
var err = $"PMBiz::NewServiceWorkOrderFromPMAsync error creating WorkOrderItemPartRequest from PM {p.Serial}\r\n{biz.GetErrorsAsString()}";
|
||||
log.LogError(err);
|
||||
await NotifyEventHelper.AddGeneralNotifyEvent(AyaType.PM, p.Id, NotifyEventType.PMGenerationFailed, $"Error generating WorkOrderItemPartRequest from PM {p.Serial}\r\n{biz.GetErrorsAsString()}", "Preventive Maintenance");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//Add part
|
||||
var wip = new WorkOrderItemPart();
|
||||
wip.WorkOrderItemId = NewWoItem.Id;
|
||||
wip.Description = pmp.Description;
|
||||
wip.PartId = pmp.PartId;
|
||||
wip.PartWarehouseId = pmp.PartWarehouseId;
|
||||
@@ -5002,12 +5051,20 @@ namespace AyaNova.Biz
|
||||
wip.Tags = pmp.Tags;
|
||||
wip.TaxPartSaleId = pmp.TaxPartSaleId;
|
||||
|
||||
woi.Parts.Add(wip);
|
||||
//woi.Parts.Add(wip);
|
||||
if (await biz.PartCreateAsync(wip) == null)
|
||||
{
|
||||
var err = $"PMBiz::NewServiceWorkOrderFromPMAsync error creating WorkOrderItemPart from PM {p.Serial}\r\n{biz.GetErrorsAsString()}";
|
||||
log.LogError(err);
|
||||
await NotifyEventHelper.AddGeneralNotifyEvent(AyaType.PM, p.Id, NotifyEventType.PMGenerationFailed, $"Error generating WorkOrderItemPart from PM {p.Serial}\r\n{biz.GetErrorsAsString()}", "Preventive Maintenance");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (PMItemLoan pml in pmi.Loans)
|
||||
{
|
||||
var wil = new WorkOrderItemLoan();
|
||||
wil.WorkOrderItemId = NewWoItem.Id;
|
||||
wil.LoanUnitId = pml.LoanUnitId;
|
||||
wil.Notes = pml.Notes;
|
||||
wil.PriceOverride = pml.PriceOverride;
|
||||
@@ -5019,12 +5076,20 @@ namespace AyaNova.Biz
|
||||
wil.OutDate = pml.OutDate;//DATE ADJUST
|
||||
wil.ReturnDate = pml.ReturnDate;//DATE ADJUST
|
||||
|
||||
woi.Loans.Add(wil);
|
||||
//woi.Loans.Add(wil);
|
||||
if (await biz.LoanCreateAsync(wil) == null)
|
||||
{
|
||||
var err = $"PMBiz::NewServiceWorkOrderFromPMAsync error creating WorkOrderItemLoan from PM {p.Serial}\r\n{biz.GetErrorsAsString()}";
|
||||
log.LogError(err);
|
||||
await NotifyEventHelper.AddGeneralNotifyEvent(AyaType.PM, p.Id, NotifyEventType.PMGenerationFailed, $"Error generating WorkOrderItemLoan from PM {p.Serial}\r\n{biz.GetErrorsAsString()}", "Preventive Maintenance");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (PMItemLabor pmlab in pmi.Labors)
|
||||
{
|
||||
var wilab = new WorkOrderItemLabor();
|
||||
wilab.WorkOrderItemId = NewWoItem.Id;
|
||||
wilab.NoChargeQuantity = pmlab.NoChargeQuantity;
|
||||
wilab.PriceOverride = pmlab.PriceOverride;
|
||||
wilab.ServiceDetails = pmlab.ServiceDetails;
|
||||
@@ -5037,12 +5102,20 @@ namespace AyaNova.Biz
|
||||
wilab.ServiceStartDate = pmlab.ServiceStartDate;//DATE ADJUST
|
||||
wilab.ServiceStopDate = pmlab.ServiceStopDate;//DATE ADJUST
|
||||
|
||||
woi.Labors.Add(wilab);
|
||||
//woi.Labors.Add(wilab);
|
||||
if (await biz.LaborCreateAsync(wilab) == null)
|
||||
{
|
||||
var err = $"PMBiz::NewServiceWorkOrderFromPMAsync error creating WorkOrderItemLabor from PM {p.Serial}\r\n{biz.GetErrorsAsString()}";
|
||||
log.LogError(err);
|
||||
await NotifyEventHelper.AddGeneralNotifyEvent(AyaType.PM, p.Id, NotifyEventType.PMGenerationFailed, $"Error generating WorkOrderItemLabor from PM {p.Serial}\r\n{biz.GetErrorsAsString()}", "Preventive Maintenance");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (PMItemTravel pmtrav in pmi.Travels)
|
||||
{
|
||||
var witrav = new WorkOrderItemTravel();
|
||||
witrav.WorkOrderItemId = NewWoItem.Id;
|
||||
witrav.Distance = pmtrav.Distance;
|
||||
witrav.NoChargeQuantity = pmtrav.NoChargeQuantity;
|
||||
witrav.PriceOverride = pmtrav.PriceOverride;
|
||||
@@ -5054,24 +5127,40 @@ namespace AyaNova.Biz
|
||||
witrav.TravelStartDate = pmtrav.TravelStartDate;//DATE ADJUST
|
||||
witrav.TravelStopDate = pmtrav.TravelStopDate;//DATE ADJUST
|
||||
|
||||
woi.Travels.Add(witrav);
|
||||
//woi.Travels.Add(witrav);
|
||||
if (await biz.TravelCreateAsync(witrav) == null)
|
||||
{
|
||||
var err = $"PMBiz::NewServiceWorkOrderFromPMAsync error creating WorkOrderItemTravel from PM {p.Serial}\r\n{biz.GetErrorsAsString()}";
|
||||
log.LogError(err);
|
||||
await NotifyEventHelper.AddGeneralNotifyEvent(AyaType.PM, p.Id, NotifyEventType.PMGenerationFailed, $"Error generating WorkOrderItemTravel from PM {p.Serial}\r\n{biz.GetErrorsAsString()}", "Preventive Maintenance");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (PMItemTask pmt in pmi.Tasks)
|
||||
{
|
||||
var wit = new WorkOrderItemTask();
|
||||
wit.WorkOrderItemId = NewWoItem.Id;
|
||||
wit.CompletedByUserId = pmt.CompletedByUserId;
|
||||
wit.Sequence = pmt.Sequence;
|
||||
wit.Status = pmt.Status;
|
||||
wit.Task = pmt.Task;
|
||||
wit.CompletedDate = pmt.CompletedDate;//DATE ADJUST
|
||||
|
||||
woi.Tasks.Add(wit);
|
||||
//woi.Tasks.Add(wit);
|
||||
if (await biz.TaskCreateAsync(wit) == null)
|
||||
{
|
||||
var err = $"PMBiz::NewServiceWorkOrderFromPMAsync error creating WorkOrderItemTask from PM {p.Serial}\r\n{biz.GetErrorsAsString()}";
|
||||
log.LogError(err);
|
||||
await NotifyEventHelper.AddGeneralNotifyEvent(AyaType.PM, p.Id, NotifyEventType.PMGenerationFailed, $"Error generating WorkOrderItemTask from PM {p.Serial}\r\n{biz.GetErrorsAsString()}", "Preventive Maintenance");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (PMItemExpense pme in pmi.Expenses)
|
||||
{
|
||||
var wie = new WorkOrderItemExpense();
|
||||
wie.WorkOrderItemId = NewWoItem.Id;
|
||||
wie.ChargeAmount = pme.ChargeAmount;
|
||||
wie.ChargeTaxCodeId = pme.ChargeTaxCodeId;
|
||||
wie.ChargeToCustomer = pme.ChargeToCustomer;
|
||||
@@ -5081,12 +5170,20 @@ namespace AyaNova.Biz
|
||||
wie.TotalCost = pme.TotalCost;
|
||||
wie.UserId = pme.UserId;
|
||||
|
||||
woi.Expenses.Add(wie);
|
||||
//woi.Expenses.Add(wie);
|
||||
if (await biz.ExpenseCreateAsync(wie) == null)
|
||||
{
|
||||
var err = $"PMBiz::NewServiceWorkOrderFromPMAsync error creating WorkOrderItemExpense from PM {p.Serial}\r\n{biz.GetErrorsAsString()}";
|
||||
log.LogError(err);
|
||||
await NotifyEventHelper.AddGeneralNotifyEvent(AyaType.PM, p.Id, NotifyEventType.PMGenerationFailed, $"Error generating WorkOrderItemExpense from PM {p.Serial}\r\n{biz.GetErrorsAsString()}", "Preventive Maintenance");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (PMItemOutsideService pmo in pmi.OutsideServices)
|
||||
{
|
||||
var wio = new WorkOrderItemOutsideService();
|
||||
wio.WorkOrderItemId = NewWoItem.Id;
|
||||
wio.Notes = pmo.Notes;
|
||||
wio.RepairCost = pmo.RepairCost;
|
||||
wio.RepairPrice = pmo.RepairPrice;
|
||||
@@ -5102,23 +5199,30 @@ namespace AyaNova.Biz
|
||||
wio.ReturnDate = pmo.ReturnDate;//DATE ADJUST
|
||||
wio.ETADate = pmo.ETADate;//DATE ADJUST
|
||||
|
||||
woi.OutsideServices.Add(wio);
|
||||
//woi.OutsideServices.Add(wio);
|
||||
if (await biz.OutsideServiceCreateAsync(wio) == null)
|
||||
{
|
||||
var err = $"PMBiz::NewServiceWorkOrderFromPMAsync error creating WorkOrderItemOutsideService from PM {p.Serial}\r\n{biz.GetErrorsAsString()}";
|
||||
log.LogError(err);
|
||||
await NotifyEventHelper.AddGeneralNotifyEvent(AyaType.PM, p.Id, NotifyEventType.PMGenerationFailed, $"Error generating WorkOrderItemOutsideService from PM {p.Serial}\r\n{biz.GetErrorsAsString()}", "Preventive Maintenance");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
wo.Items.Add(woi);
|
||||
//wo.Items.Add(woi);
|
||||
}
|
||||
|
||||
WorkOrderBiz biz = WorkOrderBiz.GetBiz(ct);
|
||||
var NewObject = await biz.WorkOrderCreateAsync(wo, false);
|
||||
if (NewObject == null)
|
||||
{
|
||||
var err = $"PMBiz::NewServiceWorkOrderFromPMAsync error creating from PM {p.Serial}\r\n{biz.GetErrorsAsString()}";
|
||||
log.LogError(err);
|
||||
await NotifyEventHelper.AddGeneralNotifyEvent(AyaType.PM, p.Id, NotifyEventType.PMGenerationFailed, $"Error generating Work order from PM {p.Serial}\r\n{biz.GetErrorsAsString()}", "Preventive Maintenance");
|
||||
return false;
|
||||
}
|
||||
// WorkOrderBiz biz = WorkOrderBiz.GetBiz(ct);
|
||||
// var NewObject = await biz.WorkOrderCreateAsync(wo, false);
|
||||
// if (NewObject == null)
|
||||
// {
|
||||
// var err = $"PMBiz::NewServiceWorkOrderFromPMAsync error creating from PM {p.Serial}\r\n{biz.GetErrorsAsString()}";
|
||||
// log.LogError(err);
|
||||
// await NotifyEventHelper.AddGeneralNotifyEvent(AyaType.PM, p.Id, NotifyEventType.PMGenerationFailed, $"Error generating Work order from PM {p.Serial}\r\n{biz.GetErrorsAsString()}", "Preventive Maintenance");
|
||||
// return false;
|
||||
// }
|
||||
#if (DEBUG)
|
||||
log.LogInformation($"PMBiz::NewServiceWorkOrderFromPMAsync created new workorder {NewObject.Serial}");
|
||||
log.LogInformation($"PMBiz::NewServiceWorkOrderFromPMAsync created new workorder {NewWoHeader.Serial}");
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -3672,7 +3672,7 @@ namespace AyaNova.Biz
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//CREATE
|
||||
//
|
||||
internal async Task<WorkOrderItemPart> CreatePartAsync(WorkOrderItemPart newObject)
|
||||
internal async Task<WorkOrderItemPart> PartCreateAsync(WorkOrderItemPart newObject)
|
||||
{
|
||||
using (var transaction = await ct.Database.BeginTransactionAsync())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user