JobRequisitionStore.cs 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. using Comal.Classes;
  2. using Comal.Stores;
  3. using InABox.Core;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Text;
  8. namespace PRSStores
  9. {
  10. public class JobRequisitionStore : BaseStore<JobRequisition>
  11. {
  12. protected override void AfterSave(JobRequisition entity)
  13. {
  14. base.AfterSave(entity);
  15. //this was originally written for Job Requisition tracked kanbans - no longer needed?
  16. //If reinstating this code, refer to:
  17. // - JobRequisitionStore
  18. // - JobBillOfMaterialsItemGrid (where JobRequisitions are created) - Create Requi Method
  19. // - PurchaseOrderItemStore (needed to trigger aftersave of JobRequisition to update tracked kanban when items are received)
  20. //UpdateTrackingKanban<JobRequisitionKanban, JobRequisition, JobRequisitionLink>(entity, m =>
  21. //{
  22. // CoreTable table = Provider.Query<JobRequisitionItem>(
  23. // new Filter<JobRequisitionItem>(x => x.Requisition.ID).IsEqualTo(entity.ID),
  24. // new Columns<JobRequisitionItem>(
  25. // x => x.PurchaseOrderItem.ID, //0
  26. // x => x.PurchaseOrderItem.ReceivedDate, //1
  27. // x => x.Status //2
  28. // )
  29. // );
  30. // if (table.Rows.Any())
  31. // {
  32. // bool keepKanbanOpen = false;
  33. // foreach (CoreRow row in table.Rows)
  34. // {
  35. // JobRequisitionItem item = row.ToObject<JobRequisitionItem>();
  36. // if (item.PurchaseOrderItem.ReceivedDate == DateTime.MinValue)
  37. // {
  38. // if (item.PurchaseOrderItem.ID == Guid.Empty)
  39. // {
  40. // if (item.Status != JobRequisitionItemStatus.NotChecked) //no purchase order but at least one item has been checked
  41. // {
  42. // return KanbanCategory.InProgress;
  43. // }
  44. // else
  45. // keepKanbanOpen = true;
  46. // }
  47. // else
  48. // return KanbanCategory.Waiting; //at least one purchase order item not received, but also at least one purchase order has been raised
  49. // }
  50. // }
  51. // if (keepKanbanOpen)
  52. // return KanbanCategory.Open; //no purchase orders raised and no items have been checked to arrive here
  53. // else
  54. // return KanbanCategory.Complete; //all jobrequiitem.purchaseorderitems have to be received AND keepKanbanOpen must have remained false to arrive here
  55. // }
  56. // return KanbanCategory.Open;
  57. //});
  58. }
  59. }
  60. }