static public async Task NotFoundIdUpdateVariantAsync() { while (!variantUpdateDone || NotFoundIdVariantUpdateQueue.Count > 0) { if (NotFoundIdVariantUpdateQueue.Count == 0) { await Task.Delay(500); } ProductVariant p = null; // SQLDone can become true whithout adding anything to Queue if (NotFoundIdVariantUpdateQueue.TryDequeue(out p)) { try { if (GeneralAdapter.FindIdFromSku(p)) { //TODO DI API //await updateVariantService.UpdateAsync((long)p.Id, p); } else { GeneralAdapter.OutputString($"Couldn't find the SKU: {p.SKU}"); } } catch { GeneralAdapter.OutputErrorString($"Couldn't resolve the variant {p.Id} SKU: {p.SKU}"); } } } checkIdVariantDone = true; GeneralAdapter.OutputString("checkIdVariantDone Done."); }
/// <summary> /// Update variant (price) and check Ids (update them in SAP). Use checkIdInventoryUpdateQueue, should check <see cref=ProductExport.variantDone></cref> before running /// </summary> static public void CheckIdInventoryUpdateThread() { while (!inventoryUpdateDone || NotFoundIdInventoryUpdateQueue.Count > 0) { InventoryLevel p = null; // SQLDone can become true whithout adding anything to Queue if (NotFoundIdInventoryUpdateQueue.TryDequeue(out p)) { try { if (GeneralAdapter.FindIdFromSku(p)) { var result = Task.Run(() => { return(updateInventoryService.SetAsync(p)); }).Result; } else { GeneralAdapter.OutputString($"Couldn't find the SKU: {p.SKU}"); } } catch { GeneralAdapter.OutputErrorString($"Couldn't resolve the inventory {p.Id} SKU: {p.SKU}"); } } } checkIdInventoryDone = true; GeneralAdapter.OutputString("checkIdInventoryDone Done."); }
/// <summary> /// Update variant (price) and check Ids (update them in SAP). Use checkIdInventoryUpdateQueue, should check <see cref=ProductExport.variantDone></cref> before running /// </summary> static public void CheckIdUpdateVariantThread() { while (!variantUpdateDone || NotFoundIdVariantUpdateQueue.Count > 0) { ProductVariant p = null; // SQLDone can become true whithout adding anything to Queue if (NotFoundIdVariantUpdateQueue.TryDequeue(out p)) { try { if (GeneralAdapter.FindIdFromSku(p)) { //TODO DI API //var result = Task.Run(() => { return updateVariantService.UpdateAsync((long)p.Id, p); }).Result; } else { GeneralAdapter.OutputString($"Couldn't find the SKU: {p.SKU}"); } } catch { GeneralAdapter.OutputErrorString($"Couldn't resolve the variant {p.Id} SKU: {p.SKU}"); } } } checkIdVariantDone = true; GeneralAdapter.OutputString("checkIdVariantDone Done."); }