This commit is contained in:
@@ -355,6 +355,7 @@ namespace AyaNova.PlugIn.V8
|
|||||||
await InitInventory(progress);
|
await InitInventory(progress);
|
||||||
await ExportWarehouses(progress);
|
await ExportWarehouses(progress);
|
||||||
await ExportParts(progress);
|
await ExportParts(progress);
|
||||||
|
await ExportPartAssemblies(progress);
|
||||||
await ExportProjects(progress);
|
await ExportProjects(progress);
|
||||||
|
|
||||||
if (V7UseInventory)
|
if (V7UseInventory)
|
||||||
@@ -1637,6 +1638,74 @@ namespace AyaNova.PlugIn.V8
|
|||||||
#endregion Parts
|
#endregion Parts
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#region Part assemblies
|
||||||
|
private async System.Threading.Tasks.Task ExportPartAssemblies(ProgressForm progress)
|
||||||
|
{
|
||||||
|
ResetUniqueNames();
|
||||||
|
if (!progress.KeepGoing) return;
|
||||||
|
progress.Op("Start part assemblies export");
|
||||||
|
progress.SubOp("");
|
||||||
|
var ObjectTypeName = "Part Assembly";
|
||||||
|
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");
|
||||||
|
Guid gCurrentPartAssemblyId = Guid.Empty;
|
||||||
|
string sCurrentPartAssemblyName = string.Empty;
|
||||||
|
List<long> partsInAssembly = new List<long>();
|
||||||
|
foreach (PartList.PartListInfo i in pl)
|
||||||
|
{
|
||||||
|
if (!progress.KeepGoing) return;
|
||||||
|
//change of assembly in list
|
||||||
|
if (gCurrentPartAssemblyId != i.LT_O_PartAssembly.Value)
|
||||||
|
{
|
||||||
|
if (gCurrentPartAssemblyId != Guid.Empty)
|
||||||
|
{
|
||||||
|
foreach (PartAssembly p in pa)
|
||||||
|
{
|
||||||
|
if (p.ID == gCurrentPartAssemblyId)
|
||||||
|
{
|
||||||
|
//Save the current assembly
|
||||||
|
dynamic d = new JObject();
|
||||||
|
d.name = sCurrentPartAssemblyName;
|
||||||
|
progress.Op(ObjectTypeName + " " + d.name);
|
||||||
|
d.active = p.Active;
|
||||||
|
d.notes = p.Description;
|
||||||
|
JArray dItems = new JArray();
|
||||||
|
foreach (long l in partsInAssembly)
|
||||||
|
{
|
||||||
|
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"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion part assemblies
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region Warehouses
|
#region Warehouses
|
||||||
private async System.Threading.Tasks.Task ExportWarehouses(ProgressForm progress)
|
private async System.Threading.Tasks.Task ExportWarehouses(ProgressForm progress)
|
||||||
{
|
{
|
||||||
@@ -3663,7 +3732,7 @@ namespace AyaNova.PlugIn.V8
|
|||||||
{
|
{
|
||||||
JObject jsa = (await util.GetAsync("part/stock-levels/" + v8PartId)).ObjectResponse;
|
JObject jsa = (await util.GetAsync("part/stock-levels/" + v8PartId)).ObjectResponse;
|
||||||
bool setMinStock = false;
|
bool setMinStock = false;
|
||||||
JArray ja=(JArray)jsa["data"];
|
JArray ja = (JArray)jsa["data"];
|
||||||
foreach (JObject js in ja)
|
foreach (JObject js in ja)
|
||||||
{
|
{
|
||||||
if ((long)js["partWarehouseId"] == (long)v8o["partWarehouseId"])
|
if ((long)js["partWarehouseId"] == (long)v8o["partWarehouseId"])
|
||||||
|
|||||||
Reference in New Issue
Block a user