aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.BL/EntitiesExtensions
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-12-13 17:16:43 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-12-13 17:16:43 +0200
commit97ea085d1fac43aedc5258486ef355eb13abc195 (patch)
tree56926888c8d35fcafd8d4b4e8db2aed9be52feba /Software/Visual_Studio/Tango.BL/EntitiesExtensions
parentd9a89773f2f283fbf5596799dd4d50d231817203 (diff)
downloadTango-97ea085d1fac43aedc5258486ef355eb13abc195.tar.gz
Tango-97ea085d1fac43aedc5258486ef355eb13abc195.zip
Fixed issues in segment indices !!!
Fixed issue with PPC fine tuning. Added support to Twine & Panton in color conversion.
Diffstat (limited to 'Software/Visual_Studio/Tango.BL/EntitiesExtensions')
-rw-r--r--Software/Visual_Studio/Tango.BL/EntitiesExtensions/BrushStop.cs10
-rw-r--r--Software/Visual_Studio/Tango.BL/EntitiesExtensions/Job.cs25
-rw-r--r--Software/Visual_Studio/Tango.BL/EntitiesExtensions/Segment.cs10
3 files changed, 40 insertions, 5 deletions
diff --git a/Software/Visual_Studio/Tango.BL/EntitiesExtensions/BrushStop.cs b/Software/Visual_Studio/Tango.BL/EntitiesExtensions/BrushStop.cs
index 19258026c..5524cbd06 100644
--- a/Software/Visual_Studio/Tango.BL/EntitiesExtensions/BrushStop.cs
+++ b/Software/Visual_Studio/Tango.BL/EntitiesExtensions/BrushStop.cs
@@ -328,6 +328,16 @@ namespace Tango.BL.Entities
typeof(BrushStop).GetProperty("V" + packIndex).SetValue(this, volume);
}
+ public void SetVolume(LiquidTypes liquidType, double volume)
+ {
+ SetVolume(Segment.Job.Machine.Configuration.IdsPacks.SingleOrDefault(x => x.LiquidType.Code == liquidType.ToInt32()).PackIndex, volume);
+ }
+
+ public double GetVolume(LiquidTypes liquidType)
+ {
+ return GetVolume(Segment.Job.Machine.Configuration.IdsPacks.SingleOrDefault(x => x.LiquidType.Code == liquidType.ToInt32()).PackIndex);
+ }
+
public int GetDispensingDivision(int packIndex)
{
return (int)typeof(BrushStop).GetProperty("V" + packIndex + "Div").GetValue(this);
diff --git a/Software/Visual_Studio/Tango.BL/EntitiesExtensions/Job.cs b/Software/Visual_Studio/Tango.BL/EntitiesExtensions/Job.cs
index 95779f03e..6ae2f1daf 100644
--- a/Software/Visual_Studio/Tango.BL/EntitiesExtensions/Job.cs
+++ b/Software/Visual_Studio/Tango.BL/EntitiesExtensions/Job.cs
@@ -150,13 +150,15 @@ namespace Tango.BL.Entities
{
if (EnableInterSegment && IsAllSegmentsPerSpool)
{
+ int max = Segments.Max(x => x.SegmentIndex);
+
ObservableCollection<Segment> effectiveSegments = new ObservableCollection<Segment>();
- foreach (var s in Segments.ToList())
+ foreach (var s in Segments.ToList().OrderBy(x => x.SegmentIndex))
{
effectiveSegments.Add(s);
- if (Segments.IndexOf(s) != Segments.Count - 1)
+ if (s.SegmentIndex != max)
{
effectiveSegments.Add(CreateInterSegment(InterSegmentLength));
}
@@ -166,12 +168,25 @@ namespace Tango.BL.Entities
}
else
{
- return Segments;
+ return Segments.OrderBy(x => x.SegmentIndex).ToObservableCollection();
}
}
}
/// <summary>
+ /// Gets the ordered segments.
+ /// </summary>
+ [NotMapped]
+ [JsonIgnore]
+ public ObservableCollection<Segment> OrderedSegments
+ {
+ get
+ {
+ return Segments.OrderBy(x => x.SegmentIndex).ToObservableCollection();
+ }
+ }
+
+ /// <summary>
/// Gets or sets the job fine tuning status.
/// </summary>
[NotMapped]
@@ -370,7 +385,7 @@ namespace Tango.BL.Entities
int fromAngle = -90;
double totalLength = Segments.Sum(x => x.Length); //Excluding inter segment.
- foreach (var segment in Segments.ToList().OrderBy(x => x.SegmentIndex))
+ foreach (var segment in OrderedSegments)
{
int toAngle = (int)((segment.Length / totalLength) * 360d);
g.FillPie(segment.CreateGdiBrush(bmp.Width - 2, bmp.Height - 2), new Rectangle(0, 0, bmp.Width - 2, bmp.Height - 2), fromAngle, toAngle);
@@ -538,7 +553,7 @@ namespace Tango.BL.Entities
jobFile.Type = job.Type;
jobFile.WindingMethodGuid = job.WindingMethodGuid;
- foreach (var segment in job.Segments.OrderBy(x => x.SegmentIndex))
+ foreach (var segment in job.OrderedSegments)
{
JobFileSegment s = new JobFileSegment();
s.Length = segment.Length;
diff --git a/Software/Visual_Studio/Tango.BL/EntitiesExtensions/Segment.cs b/Software/Visual_Studio/Tango.BL/EntitiesExtensions/Segment.cs
index e2c919938..8737e0413 100644
--- a/Software/Visual_Studio/Tango.BL/EntitiesExtensions/Segment.cs
+++ b/Software/Visual_Studio/Tango.BL/EntitiesExtensions/Segment.cs
@@ -297,6 +297,16 @@ namespace Tango.BL.Entities
return stop;
}
+ public Segment GetNextSegment()
+ {
+ return Job.OrderedSegments.FirstOrDefault(x => x.SegmentIndex > SegmentIndex);
+ }
+
+ public Segment GetPreviousSegment()
+ {
+ return Job.OrderedSegments.LastOrDefault(x => x.SegmentIndex < SegmentIndex);
+ }
+
/// <summary>
/// Gets the duration estimation for this job.
/// </summary>