ManufacturingPacket.cs 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Linq.Expressions;
  5. using InABox.Core;
  6. namespace Comal.Classes
  7. {
  8. public class ManufacturingPacketArea : IFormula<ManufacturingPacket, object>
  9. {
  10. public Expression<Func<ManufacturingPacket, object>> Value => x => x.Height;
  11. public Expression<Func<ManufacturingPacket, object>>[] Modifiers =>
  12. new Expression<Func<ManufacturingPacket, object>>[] { x => x.Width, x => 0.000001m };
  13. public FormulaOperator Operator => FormulaOperator.Multiply;
  14. public FormulaType Type => FormulaType.Virtual;
  15. }
  16. public class ManufacturingPacketVolume : IFormula<ManufacturingPacket, object>
  17. {
  18. public Expression<Func<ManufacturingPacket, object>> Value => x => x.Height;
  19. public Expression<Func<ManufacturingPacket, object>>[] Modifiers => new Expression<Func<ManufacturingPacket, object>>[]
  20. { x => x.Width, x => x.Length, x => 0.000000001m };
  21. public FormulaOperator Operator => FormulaOperator.Multiply;
  22. public FormulaType Type => FormulaType.Virtual;
  23. }
  24. public class ManufacturingPacketTime : CoreAggregate<ManufacturingPacket, ManufacturingPacketStage, TimeSpan>
  25. {
  26. public override Expression<Func<ManufacturingPacketStage, TimeSpan>> Aggregate => x => x.Time;
  27. public override AggregateCalculation Calculation => AggregateCalculation.Sum;
  28. public override Dictionary<Expression<Func<ManufacturingPacketStage, object>>, Expression<Func<ManufacturingPacket, object>>> Links =>
  29. new Dictionary<Expression<Func<ManufacturingPacketStage, object>>, Expression<Func<ManufacturingPacket, object>>>()
  30. {
  31. { ManufacturingPacketStage => ManufacturingPacketStage.Parent.ID, ManufacturingPacket => ManufacturingPacket.ID }
  32. };
  33. }
  34. public class ManufacturingPacketTimeRemaining : CoreAggregate<ManufacturingPacket, ManufacturingPacketStage, TimeSpan>
  35. {
  36. public override Expression<Func<ManufacturingPacketStage, TimeSpan>> Aggregate => x => x.TimeRemaining;
  37. public Expression<Func<ManufacturingPacketStage, Guid>> Link => x => x.Parent.ID;
  38. public override AggregateCalculation Calculation => AggregateCalculation.Sum;
  39. public override Dictionary<Expression<Func<ManufacturingPacketStage, object>>, Expression<Func<ManufacturingPacket, object>>> Links =>
  40. new Dictionary<Expression<Func<ManufacturingPacketStage, object>>, Expression<Func<ManufacturingPacket, object>>>()
  41. {
  42. { ManufacturingPacketStage => ManufacturingPacketStage.Parent.ID, ManufacturingPacket => ManufacturingPacket.ID }
  43. };
  44. }
  45. public class ManufacturingPacketActualTime : CoreAggregate<ManufacturingPacket, ManufacturingHistory, TimeSpan>
  46. {
  47. public override Expression<Func<ManufacturingHistory, TimeSpan>> Aggregate => x => x.WorkDuration;
  48. public override AggregateCalculation Calculation => AggregateCalculation.Sum;
  49. public override Dictionary<Expression<Func<ManufacturingHistory, object>>, Expression<Func<ManufacturingPacket, object>>> Links =>
  50. new Dictionary<Expression<Func<ManufacturingHistory, object>>, Expression<Func<ManufacturingPacket, object>>>()
  51. {
  52. { ManufacturingHistory => ManufacturingHistory.Packet.ID, ManufacturingPacket => ManufacturingPacket.ID }
  53. };
  54. }
  55. [UserTracking("Manufacturing")]
  56. [Caption("Manufacturing")]
  57. public class ManufacturingPacket : Entity, IPersistent, IRemotable, IOneToMany<Setout>, ILicense<ManufacturingLicense>, IIssues
  58. {
  59. [TextBoxEditor]
  60. [EditorSequence(1)]
  61. public string Title { get; set; }
  62. [CodeEditor(Visible = Visible.Default, Editable = Editable.Enabled)]
  63. [EditorSequence(2)]
  64. public string Serial { get; set; }
  65. private class SetoutLookup : LookupDefinitionGenerator<Setout, ManufacturingPacket>
  66. {
  67. public override Filter<Setout> DefineFilter(ManufacturingPacket[] items)
  68. {
  69. return new Filter<Setout>(x => x.JobLink.ID).IsEqualTo(items.First().SetoutLink.JobLink.ID);
  70. }
  71. public override Columns<ManufacturingPacket> DefineFilterColumns()
  72. => Columns.None<ManufacturingPacket>().Add(x => x.SetoutLink.JobLink.ID);
  73. }
  74. [LookupDefinition(typeof(SetoutLookup))]
  75. [EditorSequence(3)]
  76. [EntityRelationship(DeleteAction.Cascade)]
  77. public SetoutLink SetoutLink { get; set; }
  78. private class JobITPLookup : LookupDefinitionGenerator<JobITP, ManufacturingPacket>
  79. {
  80. public override Filter<JobITP> DefineFilter(ManufacturingPacket[] items)
  81. {
  82. if (items.Length == 1)
  83. return new Filter<JobITP>(x => x.Job.ID).IsEqualTo(items.First().SetoutLink.JobLink.ID);
  84. return LookupFactory.DefineFilter<JobITP>();
  85. }
  86. public override Columns<ManufacturingPacket> DefineFilterColumns()
  87. => Columns.None<ManufacturingPacket>().Add(x => x.SetoutLink.JobLink.ID);
  88. }
  89. [EditorSequence(4)]
  90. [LookupDefinition(typeof(JobITPLookup))]
  91. public JobITPLink ITP { get; set; }
  92. [TextBoxEditor]
  93. [EditorSequence(5)]
  94. public string Location { get; set; }
  95. // Used to calculate time & materials
  96. [EditorSequence(7)]
  97. [IntegerEditor]
  98. public int Quantity { get; set; }
  99. [EditorSequence(8)]
  100. [IntegerEditor]
  101. // Determines # of barcodes to print
  102. public int BarcodeQty { get; set; }
  103. [EditorSequence(9)]
  104. [TimestampEditor(Editable = Editable.Hidden)]
  105. public override DateTime Created
  106. {
  107. get => base.Created;
  108. set => base.Created = value;
  109. }
  110. [EditorSequence(10)]
  111. [DateTimeEditor]
  112. public DateTime DueDate { get; set; }
  113. [EditorSequence("Design", 101)]
  114. [EntityRelationship(DeleteAction.Cascade)]
  115. public PDFDocumentLink Drawing { get; set; }
  116. // To be overlaid over the PDF document
  117. [EditorSequence("Design", 102)]
  118. [TextBoxEditor]
  119. public string WaterMark { get; set; }
  120. [EditorSequence("Design", 103)]
  121. public double Height { get; set; }
  122. [EditorSequence("Design", 104)]
  123. public double Width { get; set; }
  124. [EditorSequence("Design", 105)]
  125. public double Length { get; set; }
  126. [EditorSequence("Manufacturing", 200)]
  127. public ManufacturingTemplateLink ManufacturingTemplateLink { get; set; }
  128. [EditorSequence("Manufacturing", 201)]
  129. [TimestampEditor(Editable = Editable.Disabled)]
  130. public DateTime Issued { get; set; }
  131. [EditorSequence("Manufacturing", 202)]
  132. [LoggableProperty]
  133. public bool Priority { get; set; }
  134. [EditorSequence("Manufacturing", 203)]
  135. [LoggableProperty]
  136. public bool Distributed { get; set; }
  137. [EditorSequence("Manufacturing", 204)]
  138. [TextBoxEditor(Editable = Editable.Disabled)]
  139. public string Trolleys { get; set; }
  140. [EditorSequence("Manufacturing", 205)]
  141. [TimestampEditor(Editable = Editable.Hidden)]
  142. public DateTime BarcodePrinted { get; set; }
  143. [EditorSequence("Manufacturing", 206)]
  144. [DateTimeEditor(Editable = Editable.Disabled)]
  145. [SecondaryIndex]
  146. public DateTime Completed { get; set; }
  147. [SecondaryIndex]
  148. [TimestampEditor]
  149. [EditorSequence("Manufacturing", 207)]
  150. public DateTime Archived { get; set; } = DateTime.MinValue;
  151. [CheckBoxEditor]
  152. [EditorSequence("Issues", 2)]
  153. [LoggableProperty]
  154. public bool OnHold { get; set; }
  155. [MemoEditor]
  156. [EditorSequence("Issues", 1)]
  157. [LoggableProperty]
  158. public string Issues { get; set; }
  159. public override string ToString()
  160. {
  161. return string.Format("{0} {1}", SetoutLink.Number, Serial);
  162. }
  163. public static void Progress(IEnumerable<ManufacturingPacket> packets, ManufacturingPacketStage[] Stages)
  164. {
  165. //List<ManufacturingPacketStage> updates = new List<ManufacturingPacketStage>();
  166. foreach (var packet in packets.Where(x => !x.StageLink.Equals(CoreUtils.FullGuid)))
  167. {
  168. var stages = Stages.Where(x => x.Parent.ID.Equals(packet.ID));
  169. long sequence = 0;
  170. var stage = stages.FirstOrDefault(x => x.ID.Equals(packet.StageLink.ID));
  171. if (stage != null)
  172. {
  173. stage.Completed = DateTime.Now;
  174. stage.PercentageComplete = 100.0F;
  175. sequence = stage.Sequence;
  176. }
  177. // Update the pointer to the next stage
  178. stage = stages.Where(x => x.Sequence > sequence).FirstOrDefault();
  179. if (stage != null)
  180. {
  181. stage.QualityStatus = QualityStatus.NotChecked;
  182. stage.QualityNotes = "";
  183. stage.Station = 0;
  184. stage.Started = DateTime.MinValue;
  185. stage.Completed = DateTime.MinValue;
  186. stage.PercentageComplete = 0.0F;
  187. packet.StageLink.ID = stage.ID;
  188. packet.StageLink.Synchronise(stage);
  189. }
  190. else
  191. {
  192. packet.StageLink.ID = CoreUtils.FullGuid;
  193. }
  194. packet.Issued = !packet.StageLink.IsValid() ? DateTime.MinValue : packet.Issued.IsEmpty() ? DateTime.Now : packet.Issued;
  195. packet.Completed = packet.StageLink.ID.Equals(CoreUtils.FullGuid)
  196. ? packet.Completed.IsEmpty() ? DateTime.Now : packet.Completed
  197. : DateTime.MinValue;
  198. }
  199. }
  200. public static void Regress(IEnumerable<ManufacturingPacket> pkts, ManufacturingPacketStage[] stgs)
  201. {
  202. foreach(var packet in pkts)
  203. {
  204. var stages = stgs.Where(x => x.Parent.ID.Equals(packet.ID));
  205. var sequence = long.MaxValue;
  206. var stage = stages.FirstOrDefault(x => x.ID.Equals(packet.StageLink.ID));
  207. if (stage != null)
  208. {
  209. stage.Completed = DateTime.MinValue;
  210. stage.PercentageComplete = 0.0F;
  211. stage.QualityStatus = QualityStatus.NotChecked;
  212. stage.QualityNotes = "";
  213. sequence = stage.Sequence;
  214. }
  215. // Update the pointer to the previous stage
  216. stage = stages.Where(x => x.Sequence < sequence).LastOrDefault();
  217. if (stage != null)
  218. {
  219. stage.QualityStatus = QualityStatus.NotChecked;
  220. stage.QualityNotes = "";
  221. stage.Station = 0;
  222. stage.Started = DateTime.MinValue;
  223. stage.Completed = DateTime.MinValue;
  224. stage.PercentageComplete = 0.0F;
  225. }
  226. packet.StageLink.ID = stage == null ? Guid.Empty : stage.ID;
  227. packet.Issued = !packet.StageLink.IsValid() ? DateTime.MinValue : packet.Issued.IsEmpty() ? DateTime.Now : packet.Issued;
  228. packet.DueDate = packet.Issued.IsEmpty() ? DateTime.MinValue : packet.DueDate;
  229. packet.Completed = packet.StageLink.ID.Equals(CoreUtils.FullGuid)
  230. ? packet.Completed.IsEmpty() ? DateTime.Now : packet.Completed
  231. : DateTime.MinValue;
  232. }
  233. }
  234. #region Aggregates
  235. [EditorSequence(300)]
  236. [DoubleEditor(Editable = Editable.Hidden)]
  237. [Formula(typeof(ManufacturingPacketArea))]
  238. public double Area { get; set; }
  239. [EditorSequence(301)]
  240. [DoubleEditor(Editable = Editable.Hidden)]
  241. [Formula(typeof(ManufacturingPacketVolume))]
  242. public double Volume { get; set; }
  243. [EditorSequence(302)]
  244. [Aggregate(typeof(ManufacturingPacketTime))]
  245. public TimeSpan Time { get; set; }
  246. [EditorSequence(303)]
  247. [Aggregate(typeof(ManufacturingPacketTimeRemaining))]
  248. public TimeSpan TimeRemaining { get; set; }
  249. [EditorSequence(304)]
  250. [Aggregate(typeof(ManufacturingPacketActualTime))]
  251. public TimeSpan ActualTime { get; set; }
  252. #endregion
  253. #region Internal / NullEditor Properties
  254. private class ManufacturingPacketStageLookup : LookupDefinitionGenerator<ManufacturingPacketStage, ManufacturingPacket>
  255. {
  256. public override Filter<ManufacturingPacketStage>? DefineFilter(ManufacturingPacket[] items)
  257. {
  258. if (items.Any())
  259. return new Filter<ManufacturingPacketStage>(x => x.Parent.ID).IsEqualTo(items.First().ID);
  260. return null;
  261. }
  262. public override Columns<ManufacturingPacket> DefineFilterColumns()
  263. => Columns.None<ManufacturingPacket>().Add(x => x.ID);
  264. }
  265. [LookupDefinition(typeof(ManufacturingPacketStageLookup))]
  266. [NullEditor]
  267. public ManufacturingPacketStageLink StageLink { get; set; }
  268. [NullEditor]
  269. public QAFormLink QAForm { get; set; }
  270. // I think ITPs will end up being linked to a stage,
  271. // So this might get obsoleted at some point
  272. private class JobStageLookup : LookupDefinitionGenerator<JobStage, ManufacturingPacket>
  273. {
  274. public override Filter<JobStage> DefineFilter(ManufacturingPacket[] items)
  275. {
  276. if (items.Length == 1)
  277. return new Filter<JobStage>(x => x.Job.ID).IsEqualTo(items.First().SetoutLink.JobLink.ID).And(x => x.IsHeader).IsEqualTo(false);
  278. return new Filter<JobStage>(x => x.ID).IsEqualTo(Guid.Empty);
  279. }
  280. public override Columns<ManufacturingPacket> DefineFilterColumns()
  281. => Columns.None<ManufacturingPacket>().Add(x => x.SetoutLink.JobLink.ID);
  282. }
  283. [LookupDefinition(typeof(JobStageLookup))]
  284. [NullEditor]
  285. public JobStageLink JobStage { get; set; }
  286. [NullEditor]
  287. [EntityRelationship(DeleteAction.SetNull)]
  288. public PurchaseOrderItemLink OrderItem { get; set; }
  289. [NullEditor]
  290. public DateTime EstimatedDate { get; set; }
  291. #endregion
  292. #region Obsolete Properties
  293. // The code of the Linked Manufacturing Template
  294. // Suggested - set to obsolete?
  295. [NullEditor]
  296. [Obsolete("Replaced with ManufacturingTemplateLink.Code", true)]
  297. public string Code { get; set; }
  298. // The Factory to which this packet template belongs
  299. // Suggestion - Set to obsolete?
  300. [NullEditor]
  301. [Obsolete("Replaced with ManufacturingTemplateLink.FactoryLink.ID")]
  302. public string Group { get; set; }
  303. [NullEditor]
  304. [Obsolete("Replaced with BarcodeQty")]
  305. public bool GroupedBarcode { get; set; }
  306. private BarcodeType _barcodetype = BarcodeType.Unspecified;
  307. [NullEditor]
  308. [Obsolete("Replaced with BarcodeQty")]
  309. public BarcodeType BarcodeType
  310. {
  311. get => _barcodetype == BarcodeType.Unspecified ? GroupedBarcode ? BarcodeType.Grouped : BarcodeType.Individual : _barcodetype;
  312. set => _barcodetype = value;
  313. }
  314. // Comes from Setout.Title (Should be Reference)
  315. [NullEditor]
  316. [Obsolete("Replaced with SetoutLink.Reference")]
  317. public string Reference { get; set; }
  318. // Comes from Setout.Location
  319. [NullEditor]
  320. [Obsolete("Replaced with SetoutLink.Description")]
  321. public string Description { get; set; }
  322. [Obsolete("Replaced With ManufacturingTemplateLink")]
  323. [NullEditor]
  324. public Guid ManufacturingItemID { get; set; }
  325. [NullEditor]
  326. [Obsolete("Replaced with ManufacturingPacketLink.Code")]
  327. public string Template { get; set; }
  328. [Obsolete("Replaced With SetoutLink.JobLink")]
  329. [EntityRelationship(DeleteAction.Cascade)]
  330. [NullEditor]
  331. public JobLink JobLink { get; set; }
  332. #endregion
  333. #region Functions
  334. //public void MovePrevious()
  335. //{
  336. // bool bFound = false;
  337. // SetoutStage prev = null;
  338. // foreach (SetoutStage stage in Stages)
  339. // {
  340. // if (bFound)
  341. // {
  342. // stage.Started = DateTime.MinValue;
  343. // stage.Completed = DateTime.MinValue;
  344. // stage.PercentageComplete = 0.0F;
  345. // }
  346. // else if (stage.Completed.IsEmpty())
  347. // {
  348. // stage.Started = DateTime.MinValue;
  349. // stage.Completed = DateTime.MinValue;
  350. // stage.PercentageComplete = 0.0F;
  351. // bFound = true;
  352. // if (prev != null)
  353. // prev.Completed = DateTime.MinValue;
  354. // }
  355. // else
  356. // prev = stage;
  357. // }
  358. // if (prev == null)
  359. // Issued = DateTime.MinValue;
  360. // Completed = DateTime.MinValue;
  361. // Stage = CurrentStage();
  362. //}
  363. //public void MoveNext()
  364. //{
  365. // bool bFound = false;
  366. // bool bComplete = true;
  367. // if (Issued.IsEmpty())
  368. // Issued = DateTime.Now;
  369. // foreach (SetoutStage stage in Stages)
  370. // {
  371. // if (bFound)
  372. // {
  373. // stage.Started = DateTime.MinValue;
  374. // stage.Completed = DateTime.MinValue;
  375. // stage.PercentageComplete = 0.0F;
  376. // bComplete = false;
  377. // }
  378. // else if (stage.Started.IsEmpty())
  379. // {
  380. // //stage.Started = DateTime.Now;
  381. // stage.Completed = DateTime.MinValue;
  382. // stage.PercentageComplete = 0.0F;
  383. // bComplete = false;
  384. // bFound = true;
  385. // }
  386. // else if (stage.Completed.IsEmpty())
  387. // {
  388. // stage.Completed = DateTime.Now;
  389. // stage.PercentageComplete = 100.0F;
  390. // bFound = true;
  391. // }
  392. // }
  393. // //Completed = bComplete ? DateTime.Now : DateTime.MinValue;
  394. // bool bIsComplete = !Stages.Any(x => x.Completed.Equals(DateTime.MinValue));
  395. // if (bIsComplete && Completed.Equals(DateTime.MinValue))
  396. // Completed = DateTime.Now;
  397. // Stage = CurrentStage();
  398. //}
  399. //public Boolean IsComplete()
  400. //{
  401. // if ((!Issued.IsEmpty()) && (Stages != null))
  402. // {
  403. // foreach (SetoutStage stage in Stages)
  404. // {
  405. // if (stage.Completed.IsEmpty())
  406. // return false;
  407. // }
  408. // return true;
  409. // }
  410. // return false;
  411. //}
  412. //public String Status()
  413. //{
  414. // if ((Stages == null) || (!Stages.Any()))
  415. // return "No Template!";
  416. // if (Issued.IsEmpty())
  417. // return "To Be Issued";
  418. // var stage = GetCurrentStage();
  419. // if (stage != null)
  420. // {
  421. // if (!Archived.IsEmpty())
  422. // return "Cancelled";
  423. // else
  424. // return String.Format("{0} ({1:F2}%)", stage.Name, stage.PercentageComplete);
  425. // }
  426. // return "Complete";
  427. //}
  428. //public Guid CurrentStage()
  429. //{
  430. // if (Issued.IsEmpty())
  431. // return Guid.Empty;
  432. // SetoutStage stage = GetCurrentStage();
  433. // if (stage != null)
  434. // return stage.SectionID;
  435. // return CoreUtils.FullGuid;
  436. //}
  437. //public SetoutStage GetCurrentStage()
  438. //{
  439. // if ((!Issued.IsEmpty()) && (Stages != null))
  440. // {
  441. // foreach (SetoutStage stage in Stages)
  442. // {
  443. // if (stage.Completed.IsEmpty())
  444. // return stage;
  445. // }
  446. // }
  447. // return null;
  448. //}
  449. //public void SetStage(Guid id, bool complete = false)
  450. //{
  451. // bool bFound = id == Guid.Empty;
  452. // Issued = (id == Guid.Empty) ? DateTime.MinValue : Issued.IsEmpty() ? DateTime.Now : Issued;
  453. // if (id == CoreUtils.FullGuid)
  454. // {
  455. // foreach (SetoutStage stage in Stages)
  456. // {
  457. // stage.Started = stage.Started.IsEmpty() ? DateTime.Now : stage.Started;
  458. // stage.Completed = stage.Completed.IsEmpty() ? DateTime.Now : stage.Completed;
  459. // stage.PercentageComplete = 100.0F;
  460. // Completed = stage.Completed;
  461. // }
  462. // }
  463. // else
  464. // {
  465. // //Completed = DateTime.MinValue;
  466. // foreach (SetoutStage stage in Stages)
  467. // {
  468. // if (stage.SectionID.Equals(id))
  469. // {
  470. // bFound = true;
  471. // //stage.Started = stage.Started.IsEmpty() ? DateTime.Now : stage.Started;
  472. // stage.Completed = complete ? DateTime.Now : DateTime.MinValue;
  473. // stage.PercentageComplete = stage.Completed.IsEmpty() ? 0.0F : 100.0F;
  474. // }
  475. // else
  476. // {
  477. // if (!bFound)
  478. // {
  479. // // Stages Before this stage - Update Started and Completed if Empty
  480. // if (stage.Started.IsEmpty())
  481. // stage.Started = DateTime.Now;
  482. // if (stage.Completed.IsEmpty())
  483. // stage.Completed = DateTime.Now;
  484. // stage.PercentageComplete = 100.0F;
  485. // }
  486. // else
  487. // {
  488. // // Stages After This Stage - Blank out Started and Completed
  489. // stage.Started = DateTime.MinValue;
  490. // stage.Completed = DateTime.MinValue;
  491. // stage.PercentageComplete = 0.0F;
  492. // }
  493. // }
  494. // }
  495. // }
  496. // bool bIsComplete = !Stages.Any(x => x.Completed.Equals(DateTime.MinValue));
  497. // if (bIsComplete && Completed.Equals(DateTime.MinValue))
  498. // Completed = DateTime.Now;
  499. // Stage = CurrentStage();
  500. //}
  501. #endregion
  502. }
  503. }