This commit is contained in:
@@ -2791,32 +2791,27 @@ namespace AyaNova.PlugIn.V8
|
||||
await util.PostAsync("workorder/items/parts", dwip.ToString());
|
||||
}
|
||||
|
||||
//##### WORKORDER ITEM PART
|
||||
foreach (WorkorderItemPart wip in wi.Parts)
|
||||
//##### WORKORDER ITEM PARTREQUEST
|
||||
foreach (WorkorderItemPartRequest wipr in wi.Parts)
|
||||
{
|
||||
progress.SubOp("WorkorderItemPart " + wip.ID.ToString());
|
||||
dynamic dwip = new JObject();
|
||||
dwip.workOrderId = RavenId;
|
||||
dwip.workorderItemId = ravenwoitemid;
|
||||
dwip.quantity = wip.Quantity;
|
||||
var tryPartId = Getv7v8IdMapNullOk(wip.PartID);
|
||||
progress.SubOp("WorkorderItemPartRequest " + wipr.ID.ToString());
|
||||
if (wipr.Quantity == 0) continue;
|
||||
|
||||
dynamic dwipr = new JObject();
|
||||
dwipr.workOrderId = RavenId;
|
||||
dwipr.workorderItemId = ravenwoitemid;
|
||||
dwipr.quantity = wipr.Quantity;
|
||||
var tryPartId = Getv7v8IdMapNullOk(wipr.PartID);
|
||||
if (tryPartId == null)
|
||||
{
|
||||
dwip.partId = UnknownV7PartId;
|
||||
if (wip.Quantity == 0 && string.IsNullOrWhiteSpace(wip.Description))
|
||||
continue; //no part record, no quantity, no text at all, just skip it
|
||||
dwipr.partId = UnknownV7PartId;
|
||||
}
|
||||
else
|
||||
dwip.partId = tryPartId;
|
||||
dwip.partWarehouseId = Getv7v8IdMap(wip.PartWarehouseID, "warehouse");
|
||||
dwip.taxPartSaleId = Getv7v8IdMapNullOk(wip.TaxPartSaleID);
|
||||
dwip.priceOverride = wip.Price;
|
||||
dwip.price = wip.Price;
|
||||
dwip.cost = wip.Cost;
|
||||
dwip.description = wip.Description;
|
||||
if (wip.PartSerialID != Guid.Empty)
|
||||
dwip.serials = PartSerial.GetSerialNumberFromPartSerialID(wip.PartSerialID);
|
||||
await util.PostAsync("workorder/items/parts", dwip.ToString());
|
||||
dwipr.partId = tryPartId;
|
||||
dwipr.partWarehouseId = Getv7v8IdMap(wipr.PartWarehouseID, "warehouse");
|
||||
//TODO: if migrate purchase orders this is reqd
|
||||
// dwipr.purchaseOrderItemId = Getv7v8IdMapNullOk(wipr.PurchaseOrderItemID);
|
||||
await util.PostAsync("workorder/items/part-requests", dwipr.ToString());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace AyaNova.PlugIn.V8
|
||||
public static GZTW.AyaNova.BLL.LocalizedTextTable LocaleText = null;
|
||||
const string TEST_ROUTE = "notify/hello";
|
||||
const string API_BASE_ROUTE = "api/v8/";
|
||||
public static HttpClient client = null;
|
||||
public static HttpClient client = new HttpClient();
|
||||
//url once known to be good
|
||||
internal static string ApiBaseUrl { get; set; }
|
||||
internal static string JWT { get; set; }
|
||||
@@ -40,11 +40,11 @@ namespace AyaNova.PlugIn.V8
|
||||
private static void InitClient()
|
||||
{
|
||||
if (Initialized) return;
|
||||
if (client != null)
|
||||
client.Dispose();
|
||||
client = null;
|
||||
client = new HttpClient();
|
||||
client.Timeout = new TimeSpan(0, 0, 30);
|
||||
//if (client != null)
|
||||
// client.Dispose();
|
||||
//client = null;
|
||||
//client = new HttpClient();
|
||||
client.Timeout = new TimeSpan(0, 1, 0);
|
||||
client.BaseAddress = new Uri(ApiBaseUrl);
|
||||
client.DefaultRequestHeaders.Accept.Clear();
|
||||
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
|
||||
|
||||
Reference in New Issue
Block a user