This commit is contained in:
2021-08-14 00:34:52 +00:00
parent 868d4c75fc
commit 8ae51cda29

View File

@@ -1748,6 +1748,15 @@ namespace AyaNova.PlugIn.V8
#endregion Projects
#region PurchaseOrders
//map poitems to workorderitempartrequests in future
public class poitemtowoitempartrequest
{
public Guid v7woitempartrequestid { get; set; }
public Guid v7poid { get; set; }
//will use new v8 vendorpartnumber field to temporarily store the v7woitempartrequest
//check list of this item on woitempartrequest creation, if it matches then need to fixup that po during wo export
}
List<poitemtowoitempartrequest> PoItemPartRequestMap = new List<poitemtowoitempartrequest>();
private async System.Threading.Tasks.Task ExportPurchaseOrders(ProgressForm progress)
{
@@ -1820,16 +1829,23 @@ namespace AyaNova.PlugIn.V8
dItem.partWarehouseId = Getv7v8IdMap(pi.PartWarehouseID, "warehouse for poitem");
dItem.quantityOrdered = pi.QuantityOrdered;
dItem.quantityReceived = 0;
dItem.serials=string.Empty;
dItem.serials = string.Empty;
dItem.purchaseOrderCost = pi.PurchaseOrderCost;
dItem.partRequestedById = Getv7v8IdMapNullOk(pi.PartRequestedByID);
dItem.purchaseTaxCodeId = Getv7v8IdMapNullOk(pi.PurchaseTaxCodeID);
if (pi.WorkorderItemPartRequestID != Guid.Empty)
{
dItem.vendorPartNumber = pi.WorkorderItemPartRequestID.ToString();//temp holder for guid, not used in v7 so available
PoItemPartRequestMap.Add(new poitemtowoitempartrequest(){v7woitempartrequestid=pi.WorkorderItemPartRequestID,v7poid=c.ID});
}
foreach (PurchaseOrderReceipt r in receipts)
{
if (!string.IsNullOrWhiteSpace(r.Text1))
sbText1.Append(r.Text1+",");
sbText1.Append(r.Text1 + ",");
if (!string.IsNullOrWhiteSpace(r.Text2))
sbText2.Append(r.Text2 + ",");
foreach (PurchaseOrderReceiptItem ri in r.Items)
{
if (ri.PurchaseOrderItemID == pi.ID)
@@ -1837,21 +1853,24 @@ namespace AyaNova.PlugIn.V8
//Note: in v7 must receive to same warehouse as ordered, no option otherwise so no need
//to worry about that here
dItem.quantityReceived += ri.QuantityReceived;
dItem.receivedCost = ri.ReceiptCost;
//ri.SerialNumbers
dItem.receivedCost = ri.ReceiptCost;//yes, last receipt wins for cost
foreach (PartSerial sn in ri.SerialNumbers)
dItem.serials += sn.SerialNumber + ", ";
dItem.receivedDate = util.DateToV8(ri.Created);//yes, last receipt wins for the official received date, no options otherwise
}
}
}
//dItem.quantityReceived=//tbc
}
}//end of poreceiptitem loop
}//end of poreceipt loop
dItem.serials=dItem.serials.trim().trimEnd(',');
dItems.add(dItem);
}//end of poitem loop
if(sbText1.Length>0)
d.text1=sbText1.ToString().TrimEnd(',');
if(sbText2.Length>0)
d.text2=sbText2.ToString().TrimEnd(',');
d.items=dItems;
// Tagit(c.RegionID, tags);
SetTags(d, tags);
@@ -1886,7 +1905,7 @@ namespace AyaNova.PlugIn.V8
//Event log fixup
await util.EventLog(util.AyaType.PurchaseOrder, RavenId, SafeGetUserMap(c.Creator), SafeGetUserMap(c.Modifier), c.Created, c.Modified);
}
}//end of PO loop
}
#endregion PurchaseOrders
@@ -2898,6 +2917,12 @@ namespace AyaNova.PlugIn.V8
//TODO: if migrate purchase orders this is reqd
// dwipr.purchaseOrderItemId = Getv7v8IdMapNullOk(wipr.PurchaseOrderItemID);
await util.PostAsync("workorder/items/part-requests", dwipr.ToString());
//todo: consult map to see if this workorderitempart requet has any poitems to tag and
//if so fetch the po from v8, look in the vnedorpartnumber of items for the mtching guid of this v7woitempart request
//clear that vendpartnumber but set the long?woitempartrequestid and save the po
//also it apears needs reverse here as well to back link so need to update this part request with the poitem id I think
//todo: this PoItemPartRequestMap
}
//##### WORKORDER ITEM LOANERS