This commit is contained in:
@@ -1648,58 +1648,39 @@ namespace AyaNova.PlugIn.V8
|
|||||||
progress.SubOp("");
|
progress.SubOp("");
|
||||||
var ObjectTypeName = "Part Assembly";
|
var ObjectTypeName = "Part Assembly";
|
||||||
PartAssemblies pa = PartAssemblies.GetItems();
|
PartAssemblies pa = PartAssemblies.GetItems();
|
||||||
string crit = "<?xml version=\"1.0\" encoding=\"utf-16\" standalone=\"yes\"?><GRIDCRITERIA> <COLUMNITEM CM=\"aPartAssembly.aName\" UI=\"LT_O_PartAssembly\" PIN=\"0\" WIDTH=\"120\" SORT=\"ASC\" /> <COLUMNITEM CM=\"aPart.aPartNumber\" UI=\"LT_Part_Label_PartNumber\" PIN=\"0\" WIDTH=\"111\" /> <COLUMNITEM CM=\"aPart.aName\" UI=\"LT_O_Part\" PIN=\"0\" WIDTH=\"135\" /> <COLUMNITEM CM=\"aManufacturers.aName\" UI=\"LT_Part_Label_ManufacturerID\" PIN=\"0\" WIDTH=\"114\" /> <WHEREITEMGROUP GROUPLOGICALOPERATOR=\"And\" UI=\"LT_O_PartAssembly\"> <WHEREITEM COMPAREOPERATOR=\"NotEquals\" CM=\"aPartAssembly.aName\" UICOMPAREVALUE=\"\" TYPE=\"System.String\" COMPAREVALUE=\"\" /> </WHEREITEMGROUP></GRIDCRITERIA>";
|
|
||||||
PartList pl = PartList.GetList(crit);
|
|
||||||
|
|
||||||
progress.Append("Exporting " + pl.Count.ToString() + " " + ObjectTypeName + " part records");
|
progress.Append("Exporting " + pa.Count.ToString() + " " + ObjectTypeName + " part records");
|
||||||
Guid gCurrentPartAssemblyId = Guid.Empty;
|
foreach (PartAssembly p in pa)
|
||||||
string sCurrentPartAssemblyName = string.Empty;
|
|
||||||
List<long> partsInAssembly = new List<long>();
|
|
||||||
foreach (PartList.PartListInfo i in pl)
|
|
||||||
{
|
{
|
||||||
if (!progress.KeepGoing) return;
|
if (!progress.KeepGoing) return;
|
||||||
//change of assembly in list
|
string crit = "<?xml version=\"1.0\" encoding=\"utf-16\" standalone=\"yes\"?><GRIDCRITERIA> <COLUMNITEM CM=\"aPartAssembly.aName\" UI=\"LT_O_PartAssembly\" PIN=\"0\" WIDTH=\"120\" SORT=\"ASC\" /> <COLUMNITEM CM=\"aPart.aPartNumber\" UI=\"LT_Part_Label_PartNumber\" PIN=\"0\" WIDTH=\"111\" /> <COLUMNITEM CM=\"aPart.aName\" UI=\"LT_O_Part\" PIN=\"0\" WIDTH=\"135\" /> <COLUMNITEM CM=\"aManufacturers.aName\" UI=\"LT_Part_Label_ManufacturerID\" PIN=\"0\" WIDTH=\"114\" /> "
|
||||||
if (gCurrentPartAssemblyId != i.LT_O_PartAssembly.Value)
|
+ "<WHEREITEMGROUP GROUPLOGICALOPERATOR=\"And\" UI=\"LT_O_PartAssembly\">"
|
||||||
{
|
+ "<WHEREITEM COMPAREOPERATOR=\"Equals\" CM=\"aPartAssembly.aID\" UICOMPAREVALUE=\"\" TYPE=\"System.Guid\" COMPAREVALUE=\"{" + p.ID.ToString().ToUpperInvariant() + "}\" /> "
|
||||||
if (gCurrentPartAssemblyId != Guid.Empty)
|
+ "</WHEREITEMGROUP></GRIDCRITERIA>";
|
||||||
{
|
PartList pl = PartList.GetList(crit);
|
||||||
foreach (PartAssembly p in pa)
|
dynamic d = new JObject();
|
||||||
{
|
d.name = GetUniqueName(p.Name);
|
||||||
if (p.ID == gCurrentPartAssemblyId)
|
progress.Op(ObjectTypeName + " " + d.name);
|
||||||
{
|
d.active = p.Active;
|
||||||
//Save the current assembly
|
d.notes = p.Description;
|
||||||
dynamic d = new JObject();
|
JArray dItems = new JArray();
|
||||||
d.name = sCurrentPartAssemblyName;
|
foreach (PartList.PartListInfo i in pl)
|
||||||
progress.Op(ObjectTypeName + " " + d.name);
|
{
|
||||||
d.active = p.Active;
|
dynamic ditem = new JObject();
|
||||||
d.notes = p.Description;
|
ditem.partId = Getv7v8IdMap(i.LT_O_Part.Value, "part id for assembly");
|
||||||
JArray dItems = new JArray();
|
ditem.partAssemblyId = 0;
|
||||||
foreach (long l in partsInAssembly)
|
ditem.quantity = 1;
|
||||||
{
|
dItems.Add(ditem);
|
||||||
dynamic ditem = new JObject();
|
|
||||||
ditem.partId = l;
|
|
||||||
ditem.partAssemblyId = 0;
|
|
||||||
ditem.quantity = 1;
|
|
||||||
dItems.Add(ditem);
|
|
||||||
}
|
|
||||||
d.items = dItems;
|
|
||||||
|
|
||||||
List<string> tags = new List<string>();
|
|
||||||
AddImportTag(tags);
|
|
||||||
SetTags(d, tags);
|
|
||||||
var rMainObject = await util.PostAsync("part-assembly", d.ToString());
|
|
||||||
long RavenId = util.IdFromResponse(rMainObject);
|
|
||||||
//Event log fixup
|
|
||||||
await util.EventLog(util.AyaType.Project, RavenId, SafeGetUserMap(p.Creator), SafeGetUserMap(p.Modifier), p.Created, p.Modified);
|
|
||||||
break;
|
|
||||||
}//matches passembly list
|
|
||||||
}//each partassembly to match
|
|
||||||
}//not empty
|
|
||||||
partsInAssembly.Clear();
|
|
||||||
gCurrentPartAssemblyId = i.LT_O_PartAssembly.Value;
|
|
||||||
sCurrentPartAssemblyName = GetUniqueName(i.LT_O_PartAssembly.Display);
|
|
||||||
}
|
}
|
||||||
partsInAssembly.Add(Getv7v8IdMap(i.LT_O_Part.Value, "part id for assembly"));
|
d.items = dItems;
|
||||||
|
|
||||||
|
List<string> tags = new List<string>();
|
||||||
|
AddImportTag(tags);
|
||||||
|
SetTags(d, tags);
|
||||||
|
var rMainObject = await util.PostAsync("part-assembly", d.ToString());
|
||||||
|
long RavenId = util.IdFromResponse(rMainObject);
|
||||||
|
//Event log fixup
|
||||||
|
await util.EventLog(util.AyaType.Project, RavenId, SafeGetUserMap(p.Creator), SafeGetUserMap(p.Modifier), p.Created, p.Modified);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion part assemblies
|
#endregion part assemblies
|
||||||
|
|||||||
Reference in New Issue
Block a user