2017-02-15 68 views
1

我使用的是Github上的同一個應用程序(https://github.com/Acumatica/InventoryItemImportMultiThreaded),並根據我的要求以CSV的方式進行自定義,我需要將項目導入庫存。我將數據導入到近90個字段中,其中包括許多自定義字段。我創建了基於屏幕的API並導入數據。它不會給出任何錯誤,但它甚至不會導入任何數據。可能是什麼問題?多線程導入StockItem

我正在使用Acumatica版本6.00.1263。

這裏是ItemImport.cs>導入方法

public void Import(List<Item> items) 
 
{ 
 
\t Console.WriteLine("[{0}] Submitting {1} items to Acumatica...", System.Threading.Thread.CurrentThread.ManagedThreadId, items.Count); 
 

 
\t var commands = new IN202500.Command[] 
 
\t { 
 
\t \t _itemsSchema.StockItemSummary.InventoryID, 
 
\t \t _itemsSchema.GeneralSettingsItemDefaults.PostingClass, 
 
\t \t _itemsSchema.GeneralSettingsItemDefaults.LotSerialClass, 
 
\t \t _itemsSchema.GeneralSettingsItemDefaults.TaxCategory, 
 
\t \t _itemsSchema.GLAccounts.InventoryAccount, 
 
\t \t _itemsSchema.GLAccounts.SalesAccount, 
 
\t \t _itemsSchema.GLAccounts.COGSAccount, 
 
\t \t _itemsSchema.GLAccounts.POAccrualAccount, 
 
\t \t _itemsSchema.FeedControlMarketPlaces.AmazonCAActive, 
 
\t \t _itemsSchema.FeedControlMarketPlaces.AmazonUSActive, 
 
\t \t _itemsSchema.FeedControlMarketingBarcodes.MarketingUPC, 
 
\t \t _itemsSchema.FeedControlMarketingBarcodes.MarketingEAN, 
 
\t \t _itemsSchema.FeedControlMarketingBarcodes.MarketingISBN, 
 
\t \t _itemsSchema.FeedControlMarketingBarcodes.ASIN, 
 
\t \t _itemsSchema.FeedControlFeedControl.DisableAllFeeds, 
 
\t \t _itemsSchema.FeedControlWebsites.EQCActive, 
 
\t \t _itemsSchema.FeedControlWebsites.HLZActive, 
 
\t \t _itemsSchema.ItemHandlingAFNPrep.AFNAdditionalNotes, 
 
\t \t _itemsSchema.ItemHandlingAFNPrep.AFNBubbleWrap, 
 
\t \t _itemsSchema.ItemHandlingAFNPrep.AFNClearPolyBag, 
 
\t \t _itemsSchema.ItemHandlingAFNPrep.AFNExtraLabelNeeded, 
 
\t \t _itemsSchema.ItemHandlingAFNPrep.AFNOpaquePolyBag, 
 
\t \t _itemsSchema.ItemHandlingAFNPrep.AFNSuffocationLabel, 
 
\t \t _itemsSchema.ItemHandlingAFNPrep.AFNTaping, 
 
\t \t _itemsSchema.ItemHandlingAFNPrep.AFNFNSKUCA, 
 
\t \t _itemsSchema.ItemHandlingAFNPrep.AFNFNSKUUS, 
 
\t \t _itemsSchema.ItemHandlingOther.CountryOfOrigin, 
 
\t \t _itemsSchema.ItemHandlingOther.GenHarmCode, 
 
\t \t _itemsSchema.ItemHandlingOther.JustInTimeFlag, 
 
\t \t _itemsSchema.ItemHandlingOther.MSDSPDF, 
 
\t \t _itemsSchema.ItemHandlingShipmentPrep.BubbleWrap, 
 
\t \t _itemsSchema.ItemHandlingShipmentPrep.ClearPolyBag, 
 
\t \t _itemsSchema.ItemHandlingShipmentPrep.SuffocationLabel, 
 
\t \t _itemsSchema.ItemHandlingShipmentPrep.TapeSeal, 
 
\t \t _itemsSchema.JITControlsProductAvailability.OversellProtect, 
 
\t \t _itemsSchema.JITControlsProductAvailability.RemoteOH, 
 
\t \t _itemsSchema.JITControlsProductAvailability.PALastCostDate, 
 
\t \t _itemsSchema.JITControlsProductAvailability.PALastFeedDate, 
 
\t \t _itemsSchema.JITControlsPurchasing.Dropship, 
 
\t \t _itemsSchema.JITControlsPurchasing.PriceHoldCost, 
 
\t \t _itemsSchema.JITControlsPurchasing.PriceHoldDate, 
 
\t \t _itemsSchema.JITControlsPurchasing.PriceHoldNote, 
 
\t \t _itemsSchema.JITControlsPurchasing.PriceHoldPrice, 
 
\t \t _itemsSchema.OtherOtherCosts.ConsignRefCost, 
 
\t \t _itemsSchema.OtherOtherItemNumbers.BaseMaster, 
 
\t \t _itemsSchema.OtherOtherItemNumbers.BaseNumber, 
 
\t \t _itemsSchema.Other.CompositeMaster, 
 
\t \t _itemsSchema.Other.CostCommission, 
 
\t \t _itemsSchema.Other.CustNonReturnable, 
 
\t \t _itemsSchema.Other.ProductLifecycleStatus, 
 
\t \t _itemsSchema.Other.Discountable, 
 
\t \t _itemsSchema.Other.FirstLiveDate, 
 
\t \t _itemsSchema.Other.NewProdDate, 
 
\t \t _itemsSchema.Other.ParkStatus, 
 
\t \t _itemsSchema.Other.PKQFlag, 
 
\t \t _itemsSchema.Other.ProdId, 
 
\t \t _itemsSchema.Other.ShortTitle, 
 
\t \t _itemsSchema.Other.VendorBaseSKU, 
 
\t \t _itemsSchema.Other.CorpCategoryId, 
 
\t \t _itemsSchema.Other.ParentItemClass, 
 
\t \t _itemsSchema.PricingMAPMSRP.SRP, 
 
\t \t _itemsSchema.PricingMAPMSRP.MapPrice, 
 
\t \t _itemsSchema.PricingMAPMSRP.IgnoreMapPrice, 
 
\t \t _itemsSchema.PricingRepricer.LastRepricerWebPriceUpdate, 
 
\t \t _itemsSchema.PricingRepricer.SendRepricer, 
 
\t \t _itemsSchema.PricingRetailLocations.RetailShowPrice, 
 
\t \t _itemsSchema.PricingRetailLocations.RetailStorePrice, 
 
\t \t _itemsSchema.PricingWholesale.DistributorPrice, 
 
\t \t _itemsSchema.PricingWholesale.DLRQPrice, 
 
\t \t _itemsSchema.PricingWholesale.DLREAPrice, 
 
\t \t _itemsSchema.PricingRepricer.LastRepricerAzusPriceUpdate, 
 
\t \t _itemsSchema.PackagingDimensions.Length, 
 
\t \t _itemsSchema.PackagingDimensions.Height, 
 
\t \t _itemsSchema.StockItemSummary.Description, 
 
\t \t _itemsSchema.PricingWebPrice.WebPrice, 
 
\t \t _itemsSchema.Other.MakeOffer, 
 
\t \t _itemsSchema.Other.ManuBaseNumber, 
 
\t \t _itemsSchema.Other.FixData, 
 
\t \t _itemsSchema.Other.FixDataReason, 
 
\t \t _itemsSchema.FeedControlMarketingBarcodes.Barcode, 
 
\t \t _itemsSchema.Other.ManuProdNo, 
 
\t \t _itemsSchema.StockItemSummary.ItemStatus, 
 
\t \t _itemsSchema.Other.ManuId, 
 
\t \t _itemsSchema.VendorDetails.VendorID, 
 
\t \t _itemsSchema.VendorDetails.VendorInventoryID, 
 
\t \t _itemsSchema.VendorDetails.PurchaseUnit, 
 
\t \t _itemsSchema.PackagingDimensions.Weight, 
 
\t \t _itemsSchema.OtherOtherCosts.ReplacementCost, 
 
\t \t _itemsSchema.ItemHandlingShipmentPrep.ShippingNotes, 
 
\t \t _itemsSchema.PackagingDimensions.Width, 
 
     new Value 
 
      { Value = "Size", LinkedCommand = _itemsSchema.AttributesAttributes.Attribute, Commit = true }, 
 
\t \t _itemsSchema.Actions.Save 
 
\t }; 
 

 
\t string[][] data = new string[items.Count][]; 
 

 
\t int count = 0; 
 
\t foreach(Item item in items) 
 
\t { 
 
\t \t data[count] = new string[92]; 
 
\t \t 
 
\t \t data[count][0] = item.int_prod_no.ToString(); 
 
\t \t data[count][1] = item.item_class; 
 
\t \t data[count][2] = "DEFAULT"; 
 
\t \t data[count][3] = "NOTRACK"; 
 
\t \t data[count][4] = "DEFAULT"; 
 
\t \t data[count][5] = "12010"; 
 
\t \t data[count][6] = "40010"; 
 
\t \t data[count][7] = "50010"; 
 
\t \t data[count][8] = "20265"; 
 
\t \t data[count][9] = item.amazon_ca_active.ToString(); 
 
\t \t data[count][10] = item.amazon_us_active.ToString(); 
 
\t \t data[count][11] = item.marketing_upc; 
 
\t \t data[count][12] = item.marketing_ean; 
 
\t \t data[count][13] = item.marketing_isbn; 
 
\t \t data[count][14] = item.asin; 
 
\t \t data[count][15] = item.digital_quarantine.ToString(); 
 
\t \t data[count][16] = item.eqc_active.ToString(); 
 
\t \t data[count][17] = item.hlz_active.ToString(); 
 
\t \t data[count][18] = item.afn_additional_notes; 
 
\t \t data[count][19] = item.afn_bubble_wrap.ToString(); 
 
\t \t data[count][20] = item.afn_clear_poly_bag.ToString(); 
 
\t \t data[count][21] = item.afn_extra_label_needed.ToString(); 
 
\t \t data[count][22] = item.afn_opaque_poly_bag.ToString(); 
 
\t \t data[count][23] = item.afn_suffocation_label.ToString(); 
 
\t \t data[count][24] = item.afn_taping.ToString(); 
 
\t \t data[count][25] = item.afn_fnsku_ca; 
 
\t \t data[count][26] = item.afn_fnsku_us; 
 
\t \t data[count][27] = item.country_of_origin; 
 
\t \t data[count][28] = item.gen_harm_code; 
 
\t \t data[count][29] = item.just_in_time_flag.ToString(); 
 
\t \t data[count][30] = item.msds_pdf; 
 
\t \t data[count][31] = item.shipment_prep_bubble_wrap.ToString(); 
 
\t \t data[count][32] = item.shipment_prep_clear_poly_bag.ToString(); 
 
\t \t data[count][33] = item.shipment_prep_suffocation_label.ToString(); 
 
\t \t data[count][34] = item.shipment_prep_tape_seal.ToString(); 
 
\t \t data[count][35] = item.oversell_protect.ToString(); 
 
\t \t data[count][36] = item.remote_oh.ToString(); 
 
\t \t data[count][37] = item.pa_last_cost_date.ToString(); 
 
\t \t data[count][38] = item.pa_last_feed_date.ToString(); 
 
\t \t data[count][39] = item.dropship.ToString(); 
 
\t \t data[count][40] = item.price_hold_cost.ToString(); 
 
\t \t data[count][41] = item.price_hold_date.ToString(); 
 
\t \t data[count][42] = item.price_hold_note; 
 
\t \t data[count][43] = item.price_hold_price.ToString(); 
 
\t \t data[count][44] = item.consign_ref_cost.ToString(); 
 
\t \t data[count][45] = item.base_master; 
 
\t \t data[count][46] = item.base_number; 
 
\t \t data[count][47] = item.composite_master; 
 
\t \t data[count][48] = item.cost_commission.ToString(); 
 
\t \t data[count][49] = item.cust_non_returnable.ToString(); 
 
\t \t data[count][50] = item.product_lifecycle_status; 
 
\t \t data[count][51] = item.discountable.ToString(); 
 
\t \t data[count][52] = item.first_live_date.ToString(); 
 
\t \t data[count][53] = item.new_prod_date.ToString(); 
 
\t \t data[count][54] = item.park_status.ToString(); 
 
\t \t data[count][55] = item.pkq_flag; 
 
\t \t data[count][56] = item.global_prod_id; 
 
\t \t data[count][57] = item.global_short_title; 
 
\t \t data[count][58] = item.vendor_base_sku; 
 
\t \t data[count][59] = item.corp_class_id.ToString(); 
 
\t \t data[count][60] = item.attribute_class; 
 
\t \t data[count][61] = item.srp.ToString(); 
 
\t \t data[count][62] = item.map_price.ToString(); 
 
\t \t data[count][63] = item.ignore_map_price.ToString(); 
 
\t \t data[count][64] = item.last_repricer_web_price_update.ToString(); 
 
\t \t data[count][65] = item.send_repricer.ToString(); 
 
\t \t data[count][66] = item.retail_show_price.ToString(); 
 
\t \t data[count][67] = item.retail_store_price.ToString(); 
 
\t \t data[count][68] = item.distributor_price.ToString(); 
 
\t \t data[count][69] = item.dlr_q_price.ToString(); 
 
\t \t data[count][70] = item.dlr_ea_price.ToString(); 
 
\t \t data[count][71] = item.last_repricer_azus_price_update.ToString(); 
 
\t \t data[count][72] = item.length.ToString(); 
 
\t \t data[count][73] = item.height.ToString(); 
 
\t \t data[count][74] = item.desc; 
 
\t \t data[count][75] = item.global_web_price.ToString(); 
 
\t \t data[count][76] = item.global_make_offer; 
 
\t \t data[count][77] = item.manu_base_sku; 
 
\t \t data[count][78] = item.fix_data.ToString(); 
 
\t \t data[count][79] = item.fix_data_reason; 
 
\t \t data[count][80] = item.barcode; 
 
\t \t data[count][81] = item.manu_prod_no; 
 
\t \t data[count][82] = "Active"; 
 
\t \t data[count][83] = item.manu_id; 
 
\t \t data[count][84] = item.vendor_id.ToString(); 
 
\t \t data[count][85] = item.vendor_prod_no; 
 
\t \t data[count][86] = "EA"; 
 
\t \t data[count][87] = item.weight.ToString(); 
 
\t \t data[count][88] = item.replacement_cost.ToString(); 
 
\t \t data[count][89] = item.shipment_prep_shipping_notes; 
 
\t \t data[count][90] = item.width.ToString(); 
 
     data[cound][91] = item.size; 
 

 
\t \t count++; 
 
\t } 
 

 
\t _itemsScreen.Import(commands, null, data, false, true, true); 
 

 
\t Console.WriteLine("[{0}] Submitted {1} items to Acumatica.", System.Threading.Thread.CurrentThread.ManagedThreadId, items.Count); 
 
}

+0

導入(..)方法有返回參數,這實際上是可能包含錯誤的結果數組。你認爲你可以檢查結果數組嗎? –

+0

謝謝@Sergey。這有幫助,這是因爲一個領域沒有適當的映射。 – Krunal

+0

一旦我給它添加屬性,不知道它是否會再次中斷 – Krunal

回答

0

它唯一的映射需要校正和在正確的順序。

+0

導入有兩個不同的命令和值的參數,所以很難填充屬性,除非我在這裏丟失了一些東西。請建議 – Krunal