aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC
diff options
context:
space:
mode:
authorRoy <Roy.mail.net@gmail.com>2022-11-13 10:36:11 +0200
committerRoy <Roy.mail.net@gmail.com>2022-11-13 10:36:11 +0200
commitc23e72b8b4eec5fe4b6ee77bc997980fcb356846 (patch)
treedf2cec52a6cd0d786432eefaf2857c1207cb7b73 /Software/Visual_Studio/PPC
parentc14680622d66176dbc90f02dbed5629297f58bb9 (diff)
downloadTango-c23e72b8b4eec5fe4b6ee77bc997980fcb356846.tar.gz
Tango-c23e72b8b4eec5fe4b6ee77bc997980fcb356846.zip
PPC "Use Flat Spool" + SpoolType logic improvements.
Added RML->SpoolType calibration new parameters.
Diffstat (limited to 'Software/Visual_Studio/PPC')
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/JobCreationView.xaml8
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/JobCreationViewVM.cs2
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobViewVM.cs203
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/Printing/IPrintingManager.cs2
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/Printing/PrintingConfiguration.cs13
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj3
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/Printing/DefaultPrintingManager.cs9
7 files changed, 159 insertions, 81 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/JobCreationView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/JobCreationView.xaml
index 97fb1d590..19ef9cf4c 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/JobCreationView.xaml
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/JobCreationView.xaml
@@ -136,6 +136,14 @@
<touch:TouchNumericTextBox Margin="20 0 0 10" FontSize="{StaticResource TangoComboBoxItemFontSize}" Value="{Binding WhiteGap, Mode=TwoWay}" IsEnabled="True" HorizontalAlignment="Left" MinWidth="250" VerticalAlignment="Center" FocusSelectionMode="SelectAll" KeyboardNavigation.TabIndex="2"></touch:TouchNumericTextBox>
</Border>
</DockPanel >
+
+ <DockPanel Visibility="{Binding ShowDuplicate,Converter={StaticResource BooleanToVisibilityConverter}}" Margin="0 50 0 0" HorizontalAlignment="Stretch">
+ <TextBlock HorizontalAlignment="Left" Margin="0 10 0 0" FontSize="{StaticResource TangoDialogFontSize}" Width="155" >
+ <Run Text="Use Flat Spool"></Run>
+ </TextBlock>
+
+ <touch:TouchToggleSlider IsChecked="{Binding UseFlatSpool,Mode=TwoWay}" Style="{StaticResource TangoToggleButtonGrayAccent}" Margin="49 0 0 0" HorizontalAlignment="Left" Width="90" />
+ </DockPanel>
</StackPanel>
<Grid Grid.Row="2" Margin="0 70 0 0" HorizontalAlignment="Stretch" Visibility="{Binding ShowDuplicate, Converter={StaticResource BooleanToVisibilityConverter}}">
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/JobCreationViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/JobCreationViewVM.cs
index a23345e59..bf3905104 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/JobCreationViewVM.cs
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/JobCreationViewVM.cs
@@ -94,6 +94,8 @@ namespace Tango.PPC.Jobs.Dialogs
}
}
+ public bool UseFlatSpool { get; set; }
+
private RmlLubricationLevel _lubricationLevel;
public RmlLubricationLevel LubricationLevel
{
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobViewVM.cs
index d85fb73e9..3e94a42c5 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobViewVM.cs
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobViewVM.cs
@@ -45,6 +45,7 @@ using Tango.PPC.Jobs.UndoRedoCommands;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Tango.PPC.Jobs.ColorCorrectionTool;
+using Tango.PPC.Common.Printing;
namespace Tango.PPC.Jobs.ViewModels
{
@@ -69,6 +70,7 @@ namespace Tango.PPC.Jobs.ViewModels
private List<ColorCatalog> _catalogs;
private string _jsonJobModelLoaded;
+
#region Properties
private Job _job;
@@ -196,7 +198,7 @@ namespace Tango.PPC.Jobs.ViewModels
get { return _approvalFineTuneItems; }
set { _approvalFineTuneItems = value; RaisePropertyChangedAuto(); }
}
-
+
private List<ColorCatalog> _availableCatalogs;
public List<ColorCatalog> AvailableCatalogs
{
@@ -204,7 +206,7 @@ namespace Tango.PPC.Jobs.ViewModels
set { _availableCatalogs = value; RaisePropertyChangedAuto(); }
}
-
+
private bool _isFullMode;
@@ -223,7 +225,9 @@ namespace Tango.PPC.Jobs.ViewModels
public bool IsSummaryOpened
{
get { return _isSummaryOpened; }
- set { _isSummaryOpened = value;
+ set
+ {
+ _isSummaryOpened = value;
RaisePropertyChangedAuto();
}
}
@@ -236,7 +240,7 @@ namespace Tango.PPC.Jobs.ViewModels
/// Gets or sets the add solid segment command.
/// </summary>
public RelayCommand<ISegmentModel> AddNewSegmentCommand { get; set; }
-
+
/// <summary>
/// Gets or sets the remove segment command.
/// </summary>
@@ -261,12 +265,12 @@ namespace Tango.PPC.Jobs.ViewModels
/// Gets or sets the replace brush stop command.
/// </summary>
public RelayCommand<BrushStop> ReplaceBrushStopCommand { get; set; }
-
+
/// <summary>
/// Gets or sets the dye command.
/// </summary>
public RelayCommand DyeCommand { get; set; }
-
+
/// <summary>
/// Gets or sets the export embroidery command.
/// </summary>
@@ -294,7 +298,7 @@ namespace Tango.PPC.Jobs.ViewModels
public RelayCommand CopyCommand { get; set; }
public RelayCommand UndoCommand { get; set; }
public RelayCommand RedoCommand { get; set; }
-
+
#endregion
#region Constructors
@@ -304,7 +308,7 @@ namespace Tango.PPC.Jobs.ViewModels
/// </summary>
static JobViewVM()
{
-
+
_jobs_fine_tune_items = new Dictionary<string, List<FineTuneItem>>();
}
@@ -327,7 +331,7 @@ namespace Tango.PPC.Jobs.ViewModels
return customer.Name.ToLower().StartsWith(filter != null ? filter.ToLower() : String.Empty);
});
-
+
//Initialize Commands
AddNewSegmentCommand = new RelayCommand<ISegmentModel>(AddNewSegment);
RemoveSegmentCommand = new RelayCommand<SegmentModel>(RemoveSegment);
@@ -363,7 +367,7 @@ namespace Tango.PPC.Jobs.ViewModels
#endregion
#region Job Management
-
+
/// <summary>
/// Loads the job.
/// </summary>
@@ -422,7 +426,7 @@ namespace Tango.PPC.Jobs.ViewModels
.WithBrushStops()
.WithSegmentsGroups()
.BuildAsync();
-
+
Job.NameChanged -= Job_NameChanged;
Job.NameChanged += Job_NameChanged;
@@ -433,7 +437,7 @@ namespace Tango.PPC.Jobs.ViewModels
LogManager.Log("Loading RMLS...");
Rmls = (await new RmlsCollectionBuilder(_db).SetAll().WithSpools().ForHeadType(MachineProvider.Machine.MachineHeadType).ForSite(MachineProvider.Machine.SiteGuid).BuildAsync()).OrderBy(x => x.FinalName).ToList();
- //Rmls = (await new RmlsCollectionBuilder(_db).SetAll().WithSpools().BuildAsync()).OrderBy(x => x.FinalName).ToList();
+ //Rmls = (await new RmlsCollectionBuilder(_db).SetAll().WithSpools().BuildAsync()).OrderBy(x => x.FinalName).ToList();
LogManager.Log("Loading Color Spaces...");
ColorSpaces = await _db.ColorSpaces.Where(x => x.Code != (int)BL.Enumerations.ColorSpaces.CMYK).ToListAsync();
LogManager.Log("Loading Spool Types...");
@@ -449,7 +453,7 @@ namespace Tango.PPC.Jobs.ViewModels
await LoadRML(_selectedRML);
LoadJobModel();
-
+
_job_to_load = null;
_current_job_string = Job.ToJobFileWhenLoaded().ToString();
@@ -459,7 +463,7 @@ namespace Tango.PPC.Jobs.ViewModels
{
Job.JobFineTuningStatus = BL.Enumerations.FineTuningStatuses.Unspecified;
}
-
+
LogManager.Log($"Job editing state = '{Job.JobEditingState}'.");
//if (Job.JobEditingState == BL.Enumerations.EditingStates.SampleDye && Job.JobSampleDyeStatus == BL.Enumerations.SampleDyeStatuses.PendingApproval)
@@ -472,7 +476,7 @@ namespace Tango.PPC.Jobs.ViewModels
// LogManager.Log("Directing view to display fine tuning region.");
// View.DisplayFineTuning();
//}
-
+
IsFullMode = true;
DyeCommand.RaiseCanExecuteChanged();
}
@@ -492,7 +496,22 @@ namespace Tango.PPC.Jobs.ViewModels
private void LoadJobModel()
{
- var PPCSpoolType = false == String.IsNullOrEmpty(Settings.SpoolTypeGuid) ? _spoolTypes.FirstOrDefault(x => x.Guid == Settings.SpoolTypeGuid) : _spoolTypes.FirstOrDefault(x => x.Guid == SpoolTypes.FirstOrDefault().Guid);
+ SpoolType PPCSpoolType = null;
+
+ if (Settings.SpoolTypeGuid.IsNotNullOrEmpty())
+ {
+ PPCSpoolType = _spoolTypes.FirstOrDefault(x => x.Guid == Settings.SpoolTypeGuid);
+ }
+ else
+ {
+ PPCSpoolType = _spoolTypes.FirstOrDefault(x => x.Type == BL.Enumerations.SpoolTypes.StandardSpool);
+ }
+
+ if (Job.SpoolType.Type == BL.Enumerations.SpoolTypes.FlatSpool)
+ {
+ PPCSpoolType = _spoolTypes.FirstOrDefault(x => x.Type == BL.Enumerations.SpoolTypes.FlatSpool);
+ }
+
var jobModel = new JobModel(ColorSpaces)
{
Name = Job.Name,
@@ -516,7 +535,7 @@ namespace Tango.PPC.Jobs.ViewModels
int segmentindex = 1;
foreach (var segm in Job.OrderedSegments)
{
- if(segm.BrushStops.Count > 1)
+ if (segm.BrushStops.Count > 1)
{
var brushes = segm.BrushStops;
Segment currentSegment = segm;
@@ -547,16 +566,16 @@ namespace Tango.PPC.Jobs.ViewModels
else
{
SegmentModel segmentModel = LoadSegmentModel(segm, jobModel);
- segmentModel.SegmentIndex = segmentindex++;
+ segmentModel.SegmentIndex = segmentindex++;
jobModel.Segments.Add(segmentModel);
}
}
-
+
}
else
{
var segments = Job.OrderedSegmentsWithGroups;
- foreach( var segment in segments)
+ foreach (var segment in segments)
{
if (segment is Segment simpleSegment)
{
@@ -566,7 +585,7 @@ namespace Tango.PPC.Jobs.ViewModels
else if (segment is SegmentsGroup group)
{
SegmentsGroupModel segmentsGroupModel = new SegmentsGroupModel(jobModel) { SegmentIndex = group.SegmentIndex, Repeats = group.Repeats };
-
+
foreach (var innerSegment in group.OrderedSegments)
{
SegmentModel segmentModel = LoadSegmentModel(innerSegment, jobModel);
@@ -578,7 +597,7 @@ namespace Tango.PPC.Jobs.ViewModels
}
}
}
-
+
jobModel.InterSegmentLength = Job.EnableInterSegment ? Job.InterSegmentLength : 0;
jobModel.LoadGroupingSegments();
JobModel = jobModel;
@@ -592,7 +611,7 @@ namespace Tango.PPC.Jobs.ViewModels
ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore,
PreserveReferencesHandling = Newtonsoft.Json.PreserveReferencesHandling.Objects
};
- _jsonJobModelLoaded = JsonConvert.SerializeObject(JobModel , Formatting.Indented, settings);
+ _jsonJobModelLoaded = JsonConvert.SerializeObject(JobModel, Formatting.Indented, settings);
}
/// <summary>
@@ -626,7 +645,7 @@ namespace Tango.PPC.Jobs.ViewModels
{
DyeCommand.RaiseCanExecuteChanged();
}
-
+
/// <summary>
/// Starts the job.
/// </summary>
@@ -640,7 +659,7 @@ namespace Tango.PPC.Jobs.ViewModels
startingJob = true;
LogManager.Log("Start job command pressed. Starting job and navigating to job progress view...");
await Save();
- var handler = await PrintingManager.Print(Job, _db);
+ var handler = await PrintingManager.Print(Job, _db, new PrintingConfiguration() { });
await NavigationManager.NavigateTo<JobsV2Module>(nameof(JobProgressView));
startingJob = false;
}
@@ -687,26 +706,45 @@ namespace Tango.PPC.Jobs.ViewModels
{
LogManager.Log("Editing the job details.");
JobCreationViewVM vm = new JobCreationViewVM(_spoolTypes.ToList(), _rmls, JobModel.Rml.Guid, JobModel.InterSegmentLength, true);
+ vm.UseFlatSpool = Job.SpoolType.Type == BL.Enumerations.SpoolTypes.FlatSpool;
vm.JobName = JobModel.Name;
vm.SelectedSpoolType = JobModel.SpoolType;
vm = await NotificationProvider.ShowDialog<JobCreationViewVM>(vm);
if (!vm.DialogResult) return;
-
+
Job.Name = vm.JobName;
JobModel.Name = vm.JobName;
+ if (vm.UseFlatSpool)
+ {
+ Job.SpoolType = _spoolTypes.FirstOrDefault(x => x.Type == BL.Enumerations.SpoolTypes.FlatSpool);
+ }
+ else
+ {
+ if (Settings.SpoolTypeGuid.IsNotNullOrEmpty())
+ {
+ Job.SpoolType = _spoolTypes.FirstOrDefault(x => x.Guid == Settings.SpoolTypeGuid);
+ }
+ else
+ {
+ Job.SpoolType = _spoolTypes.FirstOrDefault(x => x.Type == BL.Enumerations.SpoolTypes.StandardSpool);
+ }
+ }
+
+ JobModel.SpoolType = Job.SpoolType;
+ JobModel.SpoolTypeName = Job.SpoolType.Name;
Job.InterSegmentLength = vm.WhiteGap;
Job.EnableInterSegment = vm.WhiteGap > 0;
JobModel.InterSegmentLength = vm.WhiteGap;
JobModel.EnableInterSegment = vm.WhiteGap > 0;
-
- // Job.SpoolType = vm.SelectedSpoolType;
- // JobModel.SpoolType = vm.SelectedSpoolType;//update length!!!!
-
- if(vm.SelectedRML.Guid != SelectedRML.Guid)
+
+ // Job.SpoolType = vm.SelectedSpoolType;
+ // JobModel.SpoolType = vm.SelectedSpoolType;//update length!!!!
+
+ if (vm.SelectedRML.Guid != SelectedRML.Guid)
{
- SelectedRML = _rmls.FirstOrDefault(x=>x.Guid == vm.SelectedRML.Guid);
+ SelectedRML = _rmls.FirstOrDefault(x => x.Guid == vm.SelectedRML.Guid);
// for LAB color remove all available tests
foreach (var segment in JobModel.OrderedSegmentsWithGroups)
{
@@ -743,7 +781,7 @@ namespace Tango.PPC.Jobs.ViewModels
}
}
}
-
+
if (vm.IsDuplicate)
{
try
@@ -773,7 +811,7 @@ namespace Tango.PPC.Jobs.ViewModels
{
var maxLength = Job.SpoolType.Length;
var maxRep = (maxLength == 0 ? 999 : (maxLength / JobModel.Length));
-
+
var vm = await NotificationProvider.ShowDialog<RepeatJobViewVM>(new RepeatJobViewVM("Repeat All", JobModel.NumberOfUnits)
{
MaxRepeations = (int)maxRep
@@ -813,7 +851,7 @@ namespace Tango.PPC.Jobs.ViewModels
.BuildAsync();
if (JobModel != null)
JobModel.Rml = Job.Rml;
-
+
if (updateRML && JobModel != null)
{
NotificationProvider.SetGlobalBusyMessage("Updating IsOutOfGammut due to the change RML...");
@@ -823,15 +861,15 @@ namespace Tango.PPC.Jobs.ViewModels
{
innerSegment.UpdateBrushStops();
}
- else if ( segment is SegmentsGroupModel group)
+ else if (segment is SegmentsGroupModel group)
{
- foreach( var segm in group.Segments)
+ foreach (var segm in group.Segments)
{
segm.UpdateBrushStops();
}
}
}
-
+
DyeCommand.RaiseCanExecuteChanged();
NotificationProvider.ReleaseGlobalBusyMessage();
}
@@ -868,11 +906,11 @@ namespace Tango.PPC.Jobs.ViewModels
try
{
LogManager.Log("Adding new segment...");
-
+
UndoRedoManager.Instance.InsertAndExecuteCommand(new AddNewSegmentCommand(JobModel, segment, Settings.DefaultSegmentLength > 0 ? Settings.DefaultSegmentLength : 10));
- ArrangeSegmentsIndixes();
+ ArrangeSegmentsIndixes();
DyeCommand.RaiseCanExecuteChanged();
- if(segment.SegmentIndex >= (JobModel.GroupingSegments.Count() - 1))
+ if (segment.SegmentIndex >= (JobModel.GroupingSegments.Count() - 1))
{
View.ScrollToEnd();
}
@@ -884,11 +922,11 @@ namespace Tango.PPC.Jobs.ViewModels
}
}
- private async void RepeatSegmentsGroup( SegmentsGroupModel group)
+ private async void RepeatSegmentsGroup(SegmentsGroupModel group)
{
var maxLength = Job.SpoolType.Length == 0 ? 999 : Job.SpoolType.Length;
- var maxRep = (maxLength - JobModel.Length)/ group.Length;
-
+ var maxRep = (maxLength - JobModel.Length) / group.Length;
+
var vm = await NotificationProvider.ShowDialog<RepeatJobViewVM>(new RepeatJobViewVM($"Edit \"Group {group.SegmentIndex}\" Repeat", group.Repeats)
{
MaxRepeations = (int)maxRep
@@ -937,10 +975,10 @@ namespace Tango.PPC.Jobs.ViewModels
{
if (await NotificationProvider.ShowQuestion("Are you sure you want to remove the selected group of segments?"))
{
-
+
UndoRedoManager.Instance.InsertAndExecuteCommand(new DeleteSegmentsGroupCommand(JobModel, segmentsGroup));
ArrangeSegmentsIndixes();
-
+
DyeCommand.RaiseCanExecuteChanged();
}
}
@@ -962,7 +1000,7 @@ namespace Tango.PPC.Jobs.ViewModels
{
UndoRedoManager.Instance.InsertAndExecuteCommand(new DuplicateSegmentCommand(JobModel, segment));
ArrangeSegmentsIndixes();
-
+
DyeCommand.RaiseCanExecuteChanged();
if (segment.SegmentIndex >= (JobModel.GroupingSegments.Count() - 1))
{
@@ -979,7 +1017,7 @@ namespace Tango.PPC.Jobs.ViewModels
#endregion
#region Brush Stops Management
-
+
/// <summary>
/// Click on AddColor button. Add newBrush;
/// </summary>
@@ -1040,7 +1078,7 @@ namespace Tango.PPC.Jobs.ViewModels
{
UndoRedoManager.Instance.InsertAndExecuteCommand(new EditBrushStopColorCommand(segment, brushStop, vm.SelectedBrushStop));
DyeCommand.RaiseCanExecuteChanged();
-
+
}
}
@@ -1052,7 +1090,7 @@ namespace Tango.PPC.Jobs.ViewModels
if (newBrushStop == null || segment == null)
return;
- if(segment.IsGradient)
+ if (segment.IsGradient)
{
if (false == _not_show_warning)
{
@@ -1065,7 +1103,7 @@ namespace Tango.PPC.Jobs.ViewModels
}
UndoRedoManager.Instance.InsertAndExecuteCommand(new AddBrushStopCommand(JobModel, segment, newBrushStop));
ArrangeSegmentsIndixes();
-
+
}
#endregion
@@ -1106,8 +1144,6 @@ namespace Tango.PPC.Jobs.ViewModels
#endregion
-
-
#region Export Embroidery
@@ -1182,8 +1218,8 @@ namespace Tango.PPC.Jobs.ViewModels
LoadJob();
}
-
-
+
+
public override void OnBeforeNavigatedTo()
{
base.OnBeforeNavigatedTo();
@@ -1223,7 +1259,7 @@ namespace Tango.PPC.Jobs.ViewModels
if (!_can_navigate_back)
{
await Save();
-
+
Job = null;
JobModel = null;
SegmentsCollectionView = null;
@@ -1273,18 +1309,18 @@ namespace Tango.PPC.Jobs.ViewModels
{
if (false == JobModel.GroupingSegments.ToList().Any(x => x.IsSelected))
return;
-
+
UndoRedoManager.Instance.InsertAndExecuteCommand(new ReverseCommand(JobModel));
- ArrangeSegmentsIndixes();
-
+ ArrangeSegmentsIndixes();
+
}
private async void DeleteSegments()
{
if (!JobModel.HasSelectedItems)
return;
- if(JobModel.GroupingSegments.ToList().Where(x => x.IsSelected).ToList().Count == JobModel.GroupingSegments.Count)
+ if (JobModel.GroupingSegments.ToList().Where(x => x.IsSelected).ToList().Count == JobModel.GroupingSegments.Count)
{
await NotificationProvider.ShowInfo("A job must contain at least one segment. Please, change selection.");
return;
@@ -1297,9 +1333,9 @@ namespace Tango.PPC.Jobs.ViewModels
if (await NotificationProvider.ShowQuestion("Are you sure you want to remove these selected segments?"))
{
UndoRedoManager.Instance.InsertAndExecuteCommand(new RemoveSegmentsCommand(JobModel));
-
+
ArrangeSegmentsIndixes();
-
+
DyeCommand.RaiseCanExecuteChanged();
}
}
@@ -1317,7 +1353,7 @@ namespace Tango.PPC.Jobs.ViewModels
private void RepeateSegments()
{
- if ( (JobModel.GroupingSegments.ToList().Where(x => x.IsSelected).Count()) < 2)
+ if ((JobModel.GroupingSegments.ToList().Where(x => x.IsSelected).Count()) < 2)
return;
UndoRedoManager.Instance.InsertAndExecuteCommand(new RepeatCommand(JobModel));
ArrangeSegmentsIndixes();
@@ -1366,15 +1402,28 @@ namespace Tango.PPC.Jobs.ViewModels
UndoRedoManager.Instance.ClearAll();
var colorSpaces = await _db.ColorSpaces.ToListAsync();
-
+
Job.ColorSpace = colorSpaces.FirstOrDefault();
Job.Version = 2;
Job.NumberOfUnits = JobModel.NumberOfUnits;
Job.EnableInterSegment = JobModel.InterSegmentLength > 0;
Job.InterSegmentLength = JobModel.InterSegmentLength;
+ if (Job.SpoolType.Type == BL.Enumerations.SpoolTypes.FlatSpool)
+ {
+ Job.SpoolType = _spoolTypes.FirstOrDefault(x => x.Code == (int)BL.Enumerations.SpoolTypes.FlatSpool);
+ }
+ else if (Settings.SpoolTypeGuid != null)
+ {
+ Job.SpoolType = _spoolTypes.FirstOrDefault(x => x.Guid == Settings.SpoolTypeGuid);
+ }
+ else
+ {
+ Job.SpoolType = _spoolTypes.FirstOrDefault(x => x.Code == (int)BL.Enumerations.SpoolTypes.StandardSpool);
+ }
+
var oldSegments = Job.Segments.ToList();
-
+
foreach (var segment in Job.OrderedSegmentsWithGroups.ToList())
{
if (segment is Segment)
@@ -1389,7 +1438,7 @@ namespace Tango.PPC.Jobs.ViewModels
else if (segment is SegmentsGroup)
{
SegmentsGroup segmentsGroup = segment as SegmentsGroup;
- foreach(var groupSegment in segmentsGroup.Segments.ToList())
+ foreach (var groupSegment in segmentsGroup.Segments.ToList())
{
groupSegment.BrushStops.ToList().ForEach(x =>
{
@@ -1400,15 +1449,15 @@ namespace Tango.PPC.Jobs.ViewModels
_db.SegmentsGroups.Remove(segmentsGroup);
}
}
-
+
Job.Segments.Clear();
-
+
Dictionary<int, SegmentsGroup> segmentIndexToGroup = new Dictionary<int, SegmentsGroup>();
-
+
//foreach (var segment in JobModel.Segments.OrderBy(x => x.SegmentIndex).ToList())
- foreach(var segment in JobModel.OrderedSegmentsWithGroups)
+ foreach (var segment in JobModel.OrderedSegmentsWithGroups)
{
- if(segment is SegmentModel innerSegment)
+ if (segment is SegmentModel innerSegment)
{
var dbSegment = new Segment();
dbSegment.Guid = System.Guid.NewGuid().ToString();
@@ -1456,7 +1505,7 @@ namespace Tango.PPC.Jobs.ViewModels
}
_db.BrushStops.AddRange(brushStopList);
}
- else if( segment is SegmentsGroupModel group)
+ else if (segment is SegmentsGroupModel group)
{
SegmentsGroup dbSegmentsGroup = new SegmentsGroup();
dbSegmentsGroup.Guid = System.Guid.NewGuid().ToString();
@@ -1464,7 +1513,7 @@ namespace Tango.PPC.Jobs.ViewModels
dbSegmentsGroup.SegmentIndex = group.SegmentIndex;
dbSegmentsGroup.Job = Job;
_db.SegmentsGroups.Add(dbSegmentsGroup);
- foreach(var segm_group in group.Segments.OrderBy(x=>x.SegmentIndex))
+ foreach (var segm_group in group.Segments.OrderBy(x => x.SegmentIndex))
{
var dbSegment = new Segment();
dbSegment.Guid = System.Guid.NewGuid().ToString();
@@ -1517,7 +1566,7 @@ namespace Tango.PPC.Jobs.ViewModels
Job.LastUpdated = DateTime.UtcNow;
Job.IsSynchronized = false;
- if(Job.JobStatus != JobStatuses.Draft )
+ if (Job.JobStatus != JobStatuses.Draft)
{
JsonSerializerSettings settings = new JsonSerializerSettings()
{
@@ -1527,10 +1576,10 @@ namespace Tango.PPC.Jobs.ViewModels
string jsonJobModelSaved = JsonConvert.SerializeObject(JobModel, Formatting.Indented, settings);
var json1 = JObject.Parse(_jsonJobModelLoaded);
var json2 = JObject.Parse(jsonJobModelSaved);
- if(false == JToken.DeepEquals(json1, json2))
+ if (false == JToken.DeepEquals(json1, json2))
Job.JobStatus = BL.Enumerations.JobStatuses.Draft;
}
-
+
RaiseMessage(new JobSavedMessage() { Job = Job });
await _db.SaveChangesAsync();
@@ -1543,7 +1592,7 @@ namespace Tango.PPC.Jobs.ViewModels
_jsonJobModelLoaded = JsonConvert.SerializeObject(JobModel, Formatting.Indented, settings1);
}
-
+
#endregion
}
}
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Printing/IPrintingManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Printing/IPrintingManager.cs
index 0047529b0..bc05138f0 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Printing/IPrintingManager.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Printing/IPrintingManager.cs
@@ -27,7 +27,7 @@ namespace Tango.PPC.Common.Printing
/// <param name="job">The job.</param>
/// <param name="context">The context.</param>
/// <returns></returns>
- Task<JobHandler> Print(Job job, ObservablesContext context);
+ Task<JobHandler> Print(Job job, ObservablesContext context, PrintingConfiguration config = null);
/// <summary>
/// Creates a sample dye job from the specified job and prints it.
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Printing/PrintingConfiguration.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Printing/PrintingConfiguration.cs
new file mode 100644
index 000000000..815936137
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Printing/PrintingConfiguration.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.PPC.Common.Printing
+{
+ public class PrintingConfiguration
+ {
+
+ }
+}
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj b/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj
index d0476647b..e1f4efdcb 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj
@@ -185,6 +185,7 @@
<Compile Include="Notifications\AppBarPriority.cs" />
<Compile Include="Performance\DefaultPerformanceService.cs" />
<Compile Include="Performance\IPerformanceService.cs" />
+ <Compile Include="Printing\PrintingConfiguration.cs" />
<Compile Include="RemoteDesktop\DefaultRemoteDesktopService.cs" />
<Compile Include="RemoteDesktop\IRemoteDesktopService.cs" />
<Compile Include="RemoteDesktop\RemoteDesktopClient.cs" />
@@ -589,7 +590,7 @@
</Target>
<ProjectExtensions>
<VisualStudio>
- <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" />
+ <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" />
</VisualStudio>
</ProjectExtensions>
</Project> \ No newline at end of file
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Printing/DefaultPrintingManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Printing/DefaultPrintingManager.cs
index c5fc6c6b2..83f4d4f29 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Printing/DefaultPrintingManager.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Printing/DefaultPrintingManager.cs
@@ -55,7 +55,7 @@ namespace Tango.PPC.UI.Printing
/// <param name="job">The job.</param>
/// <param name="context">The context.</param>
/// <returns></returns>
- public async Task<JobHandler> Print(Job job, ObservablesContext context)
+ public async Task<JobHandler> Print(Job job, ObservablesContext context, PrintingConfiguration printConfig = null)
{
ThrowIfJobInvalid(job);
@@ -99,7 +99,12 @@ namespace Tango.PPC.UI.Printing
var spoolType = await context.SpoolTypes.FirstOrDefaultAsync(x => x.Guid == spoolTypeGuid);
if (spoolType == null)
{
- spoolType = await context.SpoolTypes.FirstOrDefaultAsync(x => x.Code == (int)BL.Enumerations.SpoolTypes.StandardSpool);
+ spoolType = await context.SpoolTypes.FirstOrDefaultAsync(x => x.Code == (int)SpoolTypes.StandardSpool);
+ }
+
+ if (job.SpoolType.Type == SpoolTypes.FlatSpool)
+ {
+ spoolType = await context.SpoolTypes.FirstOrDefaultAsync(x => x.Code == (int)SpoolTypes.FlatSpool);
}
job.SpoolType = spoolType;