This commit is contained in:
@@ -277,7 +277,7 @@ namespace AyaNova.PlugIn.V8
|
|||||||
/// export
|
/// export
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private async void DoExport()
|
private async void DoExport()
|
||||||
{
|
{
|
||||||
//Show progress form
|
//Show progress form
|
||||||
ProgressForm progress = new ProgressForm();
|
ProgressForm progress = new ProgressForm();
|
||||||
progress.Show();
|
progress.Show();
|
||||||
@@ -300,7 +300,7 @@ namespace AyaNova.PlugIn.V8
|
|||||||
LocaleMap.Add("Français", 3);
|
LocaleMap.Add("Français", 3);
|
||||||
LocaleMap.Add("Deutsch", 4);
|
LocaleMap.Add("Deutsch", 4);
|
||||||
//admin user (not exported but is there already)
|
//admin user (not exported but is there already)
|
||||||
V7ToV8IdMap.Add(User.AdministratorID, 1);
|
V7ToV8IdMap.Add(User.AdministratorID, 1);
|
||||||
|
|
||||||
|
|
||||||
//ERASE DB
|
//ERASE DB
|
||||||
@@ -357,9 +357,9 @@ namespace AyaNova.PlugIn.V8
|
|||||||
await ExportWarehouses(progress);
|
await ExportWarehouses(progress);
|
||||||
await ExportParts(progress);
|
await ExportParts(progress);
|
||||||
await ExportProjects(progress);
|
await ExportProjects(progress);
|
||||||
|
|
||||||
if(V7UseInventory)
|
if (V7UseInventory)
|
||||||
await ExportPurchaseOrders(progress);
|
await ExportPurchaseOrders(progress);
|
||||||
await ExportUnitModels(progress);
|
await ExportUnitModels(progress);
|
||||||
await ExportUnits(progress);
|
await ExportUnits(progress);
|
||||||
await ExportExternalUsers(progress);//needs vendors, clients and headoffices already exported so needs to be here late
|
await ExportExternalUsers(progress);//needs vendors, clients and headoffices already exported so needs to be here late
|
||||||
@@ -383,7 +383,7 @@ namespace AyaNova.PlugIn.V8
|
|||||||
|
|
||||||
await ExportClientServiceRequests(progress);
|
await ExportClientServiceRequests(progress);
|
||||||
|
|
||||||
|
|
||||||
if (progress.KeepGoing)
|
if (progress.KeepGoing)
|
||||||
{
|
{
|
||||||
progress.Append("Export completed");
|
progress.Append("Export completed");
|
||||||
@@ -1748,6 +1748,7 @@ namespace AyaNova.PlugIn.V8
|
|||||||
#endregion Projects
|
#endregion Projects
|
||||||
|
|
||||||
#region PurchaseOrders
|
#region PurchaseOrders
|
||||||
|
|
||||||
private async System.Threading.Tasks.Task ExportPurchaseOrders(ProgressForm progress)
|
private async System.Threading.Tasks.Task ExportPurchaseOrders(ProgressForm progress)
|
||||||
{
|
{
|
||||||
if (!progress.KeepGoing) return;
|
if (!progress.KeepGoing) return;
|
||||||
@@ -1770,22 +1771,52 @@ namespace AyaNova.PlugIn.V8
|
|||||||
if (!progress.KeepGoing) return;
|
if (!progress.KeepGoing) return;
|
||||||
List<string> tags = new List<string>();
|
List<string> tags = new List<string>();
|
||||||
AddImportTag(tags);
|
AddImportTag(tags);
|
||||||
PurchaseOrder c = PurchaseOrder.GetItem(i.LT_PurchaseOrder_Label_PONumber.Value);
|
PurchaseOrder c = PurchaseOrder.GetItem(i.LT_PurchaseOrder_Label_PONumber.Value);
|
||||||
|
|
||||||
//get receipts for this PO
|
|
||||||
PurchaseOrderReceiptListDetailed prl = PurchaseOrderReceiptListDetailed.GetList(
|
|
||||||
"<?xml version=\"1.0\" encoding=\"utf-16\" standalone=\"yes\"?><GRIDCRITERIA><COLUMNITEM CM=\"aPurchaseOrderReceipt.aReceivedDate\" UI=\"LT_PurchaseOrderReceipt_Label_ReceivedDate\" PIN=\"0\" WIDTH=\"121\" SORT=\"ASC\" /><COLUMNITEM CM=\"aPurchaseOrder.aPONumber\" UI=\"LT_PurchaseOrder_Label_PONumber\" PIN=\"0\" WIDTH=\"105\" /><COLUMNITEM CM=\"grid\" UI=\"LT_O_PurchaseOrderReceipt\" PIN=\"0\" WIDTH=\"155\" /><WHEREITEMGROUP GROUPLOGICALOPERATOR=\"And\" UI=\"LT_PurchaseOrder_Label_PONumber\"><WHEREITEM COMPAREOPERATOR=\"Equals\" CM=\"aPurchaseOrder.aID\" UICOMPAREVALUE=\"\" TYPE=\"System.Guid\" COMPAREVALUE=\"{" +
|
|
||||||
c.ID.ToString().ToUpper()
|
|
||||||
+ "}\" /></WHEREITEMGROUP></GRIDCRITERIA>");
|
|
||||||
var ObjectTID = new TypeAndID(RootObjectTypes.PurchaseOrder, c.ID);
|
var ObjectTID = new TypeAndID(RootObjectTypes.PurchaseOrder, c.ID);
|
||||||
dynamic d = new JObject();
|
dynamic d = new JObject();
|
||||||
|
|
||||||
d.serial = c.PONumber;
|
d.serial = c.PONumber;
|
||||||
if (IsDuplicatev7v8IdMapItem(c.ID, i.LT_PurchaseOrder_Label_PONumber.Display, progress)) continue;
|
if (IsDuplicatev7v8IdMapItem(c.ID, i.LT_PurchaseOrder_Label_PONumber.Display, progress)) continue;
|
||||||
progress.Op(ObjectTypeName + " " + d.name);
|
progress.Op(ObjectTypeName + " " + d.name);
|
||||||
|
|
||||||
d.notes = c.Notes;
|
d.notes = c.Notes;
|
||||||
d.vendorMemo
|
d.vendorMemo = c.VendorMemo;
|
||||||
|
d.dropShipToCustomerId =Getv7v8IdMapNullOk(c.DropShipToClientID);
|
||||||
|
d.referenceNumber = c.ReferenceNumber;
|
||||||
|
d.vendorId = Getv7v8IdMap(c.VendorID, "Vendor for PO");
|
||||||
|
d.orderedDate = util.DateToV8(c.OrderedDate);
|
||||||
|
d.expectedReceiveDate = util.DateToV8(c.ExpectedReceiveDate);
|
||||||
|
d.status = (int)c.Status;//same enum id's so this is kosher
|
||||||
|
d.projectId = Getv7v8IdMapNullOk(c.ProjectID);
|
||||||
|
|
||||||
|
StringBuilder sbText1 = new StringBuilder();
|
||||||
|
StringBuilder sbText2 = new StringBuilder();
|
||||||
|
//get receipts for this PO
|
||||||
|
PurchaseOrderReceiptListDetailed prl = PurchaseOrderReceiptListDetailed.GetList(
|
||||||
|
"<?xml version=\"1.0\" encoding=\"utf-16\" standalone=\"yes\"?><GRIDCRITERIA><COLUMNITEM CM=\"aPurchaseOrderReceipt.aReceivedDate\" UI=\"LT_PurchaseOrderReceipt_Label_ReceivedDate\" PIN=\"0\" WIDTH=\"121\" SORT=\"ASC\" /><COLUMNITEM CM=\"aPurchaseOrder.aPONumber\" UI=\"LT_PurchaseOrder_Label_PONumber\" PIN=\"0\" WIDTH=\"105\" /><COLUMNITEM CM=\"grid\" UI=\"LT_O_PurchaseOrderReceipt\" PIN=\"0\" WIDTH=\"155\" /><WHEREITEMGROUP GROUPLOGICALOPERATOR=\"And\" UI=\"LT_PurchaseOrder_Label_PONumber\"><WHEREITEM COMPAREOPERATOR=\"Equals\" CM=\"aPurchaseOrder.aID\" UICOMPAREVALUE=\"\" TYPE=\"System.Guid\" COMPAREVALUE=\"{" +
|
||||||
|
c.ID.ToString().ToUpper()
|
||||||
|
+ "}\" /></WHEREITEMGROUP></GRIDCRITERIA>");
|
||||||
|
|
||||||
|
//compile all actual receipts into collection for later recombination
|
||||||
|
//above list is missing crucial bit which is which exact poitemid they are received against so need actual full record
|
||||||
|
//even though list has almost everything else needed
|
||||||
|
List<PurchaseOrderReceipt> receipts = new List<PurchaseOrderReceipt>();
|
||||||
|
foreach (PurchaseOrderReceiptListDetailed.PurchaseOrderReceiptListDetailedInfo prli in prl)
|
||||||
|
{
|
||||||
|
receipts.Add(PurchaseOrderReceipt.GetItem(prli.LT_O_PurchaseOrderReceipt.Value));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
foreach (PurchaseOrderItem pi in c.OrderItems)
|
||||||
|
{
|
||||||
|
//here combine potiem and poreceipts into singular items for v8
|
||||||
|
//also compile all text1,text2 to put into header for v8 later
|
||||||
|
|
||||||
|
//iterate receipt list find id's fetch actual receipts which contain exactly which poitem they were received against
|
||||||
|
//also, keep track of required woitempartrequestid's for later so can fixup when the time comes
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1837,17 +1868,17 @@ namespace AyaNova.PlugIn.V8
|
|||||||
progress.Op("Start Task Groups export");
|
progress.Op("Start Task Groups export");
|
||||||
progress.SubOp("");
|
progress.SubOp("");
|
||||||
var ObjectTypeName = "TaskGroup";
|
var ObjectTypeName = "TaskGroup";
|
||||||
|
|
||||||
|
|
||||||
//Step 2: export the objects
|
//Step 2: export the objects
|
||||||
PickListAutoComplete pl = PickListAutoComplete.GetList("**", "taskgroup");
|
PickListAutoComplete pl = PickListAutoComplete.GetList("**", "taskgroup");
|
||||||
progress.Append("Exporting " + pl.Count.ToString() + " " + ObjectTypeName + "s");
|
progress.Append("Exporting " + pl.Count.ToString() + " " + ObjectTypeName + "s");
|
||||||
//task picklist used over and over
|
//task picklist used over and over
|
||||||
var AllTasks = TaskPickList.GetList();
|
var AllTasks = TaskPickList.GetList();
|
||||||
foreach (PickListAutoComplete.PickListAutoCompleteInfo i in pl)
|
foreach (PickListAutoComplete.PickListAutoCompleteInfo i in pl)
|
||||||
{
|
{
|
||||||
if (!progress.KeepGoing) return;
|
if (!progress.KeepGoing) return;
|
||||||
|
|
||||||
TaskGroup c = TaskGroup.GetItem(i.ID);
|
TaskGroup c = TaskGroup.GetItem(i.ID);
|
||||||
var ObjectTID = new TypeAndID(RootObjectTypes.TaskGroup, c.ID);
|
var ObjectTID = new TypeAndID(RootObjectTypes.TaskGroup, c.ID);
|
||||||
dynamic d = new JObject();
|
dynamic d = new JObject();
|
||||||
@@ -1870,7 +1901,7 @@ namespace AyaNova.PlugIn.V8
|
|||||||
d.items = dTasks;
|
d.items = dTasks;
|
||||||
var rMainObject = await util.PostAsync("task-group", d.ToString());
|
var rMainObject = await util.PostAsync("task-group", d.ToString());
|
||||||
long RavenId = util.IdFromResponse(rMainObject);
|
long RavenId = util.IdFromResponse(rMainObject);
|
||||||
Addv7v8IdMap(c.ID, RavenId);
|
Addv7v8IdMap(c.ID, RavenId);
|
||||||
await util.EventLog(util.AyaType.Project, RavenId, SafeGetUserMap(c.Creator), SafeGetUserMap(c.Modifier), c.Created, c.Modified);
|
await util.EventLog(util.AyaType.Project, RavenId, SafeGetUserMap(c.Creator), SafeGetUserMap(c.Modifier), c.Created, c.Modified);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user