|
@@ -186,11 +186,13 @@ namespace PRSDesktop
|
|
|
{
|
|
|
materials.Clear();
|
|
|
activities.Clear();
|
|
|
+ byte[] exceldata = null;
|
|
|
var import = new LogikalElevationSelection(Master, LogikalElevationSelectionType.BOM, (project, boms) =>
|
|
|
{
|
|
|
var bom = boms.FirstOrDefault();
|
|
|
if (bom != null)
|
|
|
{
|
|
|
+ exceldata = bom.ExcelData;
|
|
|
if (_logikalSettings.SaveFiles)
|
|
|
{
|
|
|
File.WriteAllBytes(
|
|
@@ -220,14 +222,25 @@ namespace PRSDesktop
|
|
|
return false;
|
|
|
});
|
|
|
if (import.ShowDialog() == true && (materials.Any() || activities.Any()))
|
|
|
- CreateBOM(null);
|
|
|
+ {
|
|
|
+ var bom = CreateBOM(null);
|
|
|
+ if (exceldata != null)
|
|
|
+ {
|
|
|
+ var ss = new JobSpreadsheet();
|
|
|
+ ss.Code = $"BOM {bom.Number}";
|
|
|
+ ss.Description = $"Logikal BOM {bom.Number} Imported {DateTime.Now:f}";
|
|
|
+ ss.Data = exceldata;
|
|
|
+ ss.Parent.ID = Master.ID;
|
|
|
+ Client.Save(ss, "Imported From Logikal");
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- private void CreateBOM(JobScope? scope)
|
|
|
+ private JobBillOfMaterials CreateBOM(JobScope? scope)
|
|
|
{
|
|
|
+ JobBillOfMaterials bom = new();
|
|
|
Progress.ShowModal("Creating Bill of Materials", progress =>
|
|
|
{
|
|
|
- var bom = new JobBillOfMaterials();
|
|
|
bom.Job.CopyFrom(Master);
|
|
|
bom.Description = $"BOM Imported {DateTime.Now}";
|
|
|
Client.Save(bom, "Imported From Logikal");
|
|
@@ -257,6 +270,7 @@ namespace PRSDesktop
|
|
|
});
|
|
|
|
|
|
Refresh(false,true);
|
|
|
+ return bom;
|
|
|
}
|
|
|
|
|
|
private void CreateBOMPart(ProductLink product, ProductStyleLink? style, IBaseDimensions dimensions, double quantity, double cost)
|