This commit is contained in:
@@ -257,8 +257,8 @@ namespace AyaNova.PlugIn.V8
|
||||
await ExportHeadOffices(progress);
|
||||
await ExportContracts(progress);
|
||||
await ExportLoanItems(progress);
|
||||
//await ExportParts(progress);
|
||||
//await ExportProjects(progress);
|
||||
await ExportParts(progress);
|
||||
await ExportProjects(progress);
|
||||
//await ExportPurchaseOrders(progress);
|
||||
//await ExportUnits(progress);
|
||||
//await ExportUnitModels(progress);
|
||||
@@ -748,6 +748,73 @@ namespace AyaNova.PlugIn.V8
|
||||
}
|
||||
#endregion LoanItems
|
||||
|
||||
#region Parts
|
||||
private async System.Threading.Tasks.Task ExportParts(ProgressForm progress)
|
||||
{
|
||||
if (!progress.KeepGoing) return;
|
||||
var ObjectTypeName = "Part";
|
||||
var RavenObjectName = "Part";
|
||||
//Step 1: export the CustomFields to FormCustom if applicable so that when doing individual items we can export their custom data too
|
||||
var ocf = ObjectHasCustomFieldDataToExport(ObjectTypeName);
|
||||
bool ShouldExportCustom = ocf != null;
|
||||
var DateCustomFields = await ExportCustomFieldSchema(ocf, ObjectTypeName, RavenObjectName);
|
||||
|
||||
//Step 2: export the objects
|
||||
PartPickList pl=PartPickList.GetAllParts();
|
||||
// PickListAutoComplete pl = PickListAutoComplete.GetList("**", "loanitem");
|
||||
progress.Append("Exporting " + pl.Count.ToString() + " " + ObjectTypeName + "s");
|
||||
|
||||
foreach (PartPickList.PartPickListInfo i in pl)
|
||||
{
|
||||
if (!progress.KeepGoing) return;
|
||||
List<string> tags = new List<string>();
|
||||
tags.Add(ImportTag);
|
||||
|
||||
Part c = Part.GetItem(i.ID);
|
||||
var ObjectTID = new TypeAndID(RootObjectTypes.Part, c.ID);
|
||||
|
||||
dynamic d = new JObject();
|
||||
d.name = i.DisplayName(AyaBizUtils.GlobalSettings.DefaultPartDisplayFormat);
|
||||
progress.Op(ObjectTypeName + " " + d.name);
|
||||
d.active = c.Active;
|
||||
d.notes = c.Notes;
|
||||
|
||||
SetTags(d, tags);
|
||||
|
||||
var hasWiki = WikiPage.HasWiki(c.ID);
|
||||
if (hasWiki)
|
||||
{
|
||||
d.wiki = GetWikiContent(ObjectTID);
|
||||
}
|
||||
|
||||
//Custom fields?
|
||||
if (ShouldExportCustom)
|
||||
d.customFields = CustomFieldData(c, DateCustomFields);
|
||||
|
||||
var rMainObject = await util.PostAsync(RavenObjectName, d.ToString());
|
||||
long RavenId = util.IdFromResponse(rMainObject);
|
||||
Map.Add(c.ID, RavenId);
|
||||
|
||||
//Attachments / FILES
|
||||
await ExportAttachments(ObjectTID, progress);
|
||||
|
||||
//docs
|
||||
string NonFileUrls = await ExportDocs(ObjectTID, c.Docs, progress);
|
||||
if (!string.IsNullOrEmpty(NonFileUrls))
|
||||
{
|
||||
//need to repost the object with the notes modified
|
||||
d = rMainObject.ObjectResponse["data"];
|
||||
d.notes = NonFileUrls + "\n-----------------\n" + d.notes;
|
||||
await util.PutAsync(RavenObjectName + "/" + RavenId.ToString(), d.ToString());
|
||||
}
|
||||
|
||||
//Event log fixup
|
||||
await util.EventLog(util.AyaType.Part, RavenId, SafeGetUserMap(c.Creator), SafeGetUserMap(c.Modifier), c.Created, c.Modified);
|
||||
|
||||
}
|
||||
}
|
||||
#endregion Parts
|
||||
|
||||
|
||||
#region locales
|
||||
private async System.Threading.Tasks.Task ExportLocales(ProgressForm progress)
|
||||
|
||||
Reference in New Issue
Block a user