Index: AXimpl/Dynamics/ProductItemUpsertIn/Converter/ProductItemConverter.cls.xml
===================================================================
diff -u -r49691 -r49703
--- AXimpl/Dynamics/ProductItemUpsertIn/Converter/ProductItemConverter.cls.xml (.../ProductItemConverter.cls.xml) (revision 49691)
+++ AXimpl/Dynamics/ProductItemUpsertIn/Converter/ProductItemConverter.cls.xml (.../ProductItemConverter.cls.xml) (revision 49703)
@@ -139,53 +139,67 @@
If $$$HasLength(Product.GeefID()){ ;nieuw product heeft nog geen ID
Do ..VerwijderIndexen(Product.GeefID())
}
+ try {
+ Do Product.ZetLeverancierId(..BepaalLeverancierId(ProductItem,LegalEntity)) ;PrimaryVendorId
+ Do Product.ZetAxGesynchroniseerd($$$True)
+ ;Do Product.ZetCifPPL(..BepaalCifPPL(ProductItem)) ;ActiveCostPrice
+ ; wat van AX komt is reeds de cifppl. In cache is dit echter een berekend veld. We moeten dus alles goed zetten zodat het correct berekend wordt.
+ ; DataMProduct.Save roept een RECALC^PRODUKT2 op die dit doet.
+ ; geen prijs gerelateerde velden aanpassen indien product kindbouwstenen (niet zeker voor hoeveel stuks de prijs is)
+ #dim BouwsteenIterator = Product.GeefKindBouwstenenIterator()
+ if (($$$Not(BouwsteenIterator.HasNext())) || (..IsProductItemSOPR(ProductItem))){
+ Do Product.ZetPPL(..BepaalCifPPL(ProductItem))
+ Do Product.ZetGrootteOrdeAankoop(##class(DOM.PM.enu.GrootteOrde).Honderd())
+ Do Product.ZetKorting(0)
+ Do Product.ZetCifPercentage(0) ;CostInsuranceFreight
+ }
+ Do Product.ZetFSCHout(..BepaalFSCHout(ProductItem)) ;CertClaimLevel
+ Do Product.ZetTelbaar(..BepaalTelbaar(ProductItem)) ;CountableOrDivisible
+ Do Product.ZetBarcodeWaarde(..BepaalBarcodeWaarde(ProductItem)) ;GTIN
+ Do Product.ZetWerkvloerEenheid(..BepaalWerkvloerEenheid(ProductItem)) ;InventUnitId
+ Do Product.ZetLevertermijn(..BepaalLevertermijn(ProductItem,LegalEntity)) ;LeadTimePurch
+ Do Product.ZetMinimumBestelhoeveelheid(..BepaalMinimumBestelhoeveelheid(ProductItem)) ;LowestQtyPurch
+ Do Product.ZetGewichtPerDuizendStuksInKG(..BepaalGewichtPerDuizendStuksInKG(ProductItem)) ;NetWeight
+ Do Product.ZetAantalInGrootVerpakking(..BepaalAantalInGrootVerpakking(ProductItem)) ;QtyGVP
+ Do Product.ZetAantalInKleinVerpakking(..BepaalAantalInKleinVerpakking(ProductItem)) ;QtyKVP
+ Do Product.ZetAantalInNormaalVerpakking(..BepaalAantalInNormaalVerpakking(ProductItem)) ;QtyNVP
+ Do Product.ZetPalletAantal(..BepaalPalletAantal(ProductItem)) ;QtyPLT
+ Do Product.ZetStockNietStock(..BepaalStockNietStock(ProductItem)) ; ReqCovType
+ Do Product.ZetMerk(" ") ; nergens gebruikt maar nodig voor ^KPL
+ Do Product.ZetActiefStatus(..BepaalCommercieelAktief(ProductItem)) ; StoppedSales
+ if ..MagLinktypeAangepastWordenBijUpdate(ProductItem,Product) {
+ Do Product.ZetLinkType(..BepaalLinkType(ProductItem,LegalEntity)) ; Ook ReqCovType Alleen bij creatie zetten, daarna afblijven.
+ }
+ Do Product.ZetKorttekst(..BepaalKorttekst(ProductItem))
+ Do ..ConvertGroepen(Product, ProductItem) ;ok
+ ; nodig want anders kan de ProductId niet opgevraagd worden, nodig om admin product aan te maken indien die niet zou bestaan.
+ ; via event wordt ook admin prod aangemaakt
+ Do Product.Save()
+
+ Do ..ConvertTranslation(Product, ##class(TECH.ListIterator).%New(ProductItem.Translation)) ; ok
- Do Product.ZetLeverancierId(..BepaalLeverancierId(ProductItem,LegalEntity)) ;PrimaryVendorId
- Do Product.ZetAxGesynchroniseerd($$$True)
- ;Do Product.ZetCifPPL(..BepaalCifPPL(ProductItem)) ;ActiveCostPrice
- ; wat van AX komt is reeds de cifppl. In cache is dit echter een berekend veld. We moeten dus alles goed zetten zodat het correct berekend wordt.
- ; DataMProduct.Save roept een RECALC^PRODUKT2 op die dit doet.
- ; geen prijs gerelateerde velden aanpassen indien product kindbouwstenen (niet zeker voor hoeveel stuks de prijs is)
- #dim BouwsteenIterator = Product.GeefKindBouwstenenIterator()
- if (($$$Not(BouwsteenIterator.HasNext())) || (..IsProductItemSOPR(ProductItem))){
- Do Product.ZetPPL(..BepaalCifPPL(ProductItem))
- Do Product.ZetGrootteOrdeAankoop(##class(DOM.PM.enu.GrootteOrde).Honderd())
- Do Product.ZetKorting(0)
- Do Product.ZetCifPercentage(0) ;CostInsuranceFreight
- }
- Do Product.ZetFSCHout(..BepaalFSCHout(ProductItem)) ;CertClaimLevel
- Do Product.ZetTelbaar(..BepaalTelbaar(ProductItem)) ;CountableOrDivisible
- Do Product.ZetBarcodeWaarde(..BepaalBarcodeWaarde(ProductItem)) ;GTIN
- Do Product.ZetWerkvloerEenheid(..BepaalWerkvloerEenheid(ProductItem)) ;InventUnitId
- Do Product.ZetLevertermijn(..BepaalLevertermijn(ProductItem,LegalEntity)) ;LeadTimePurch
- Do Product.ZetMinimumBestelhoeveelheid(..BepaalMinimumBestelhoeveelheid(ProductItem)) ;LowestQtyPurch
- Do Product.ZetGewichtPerDuizendStuksInKG(..BepaalGewichtPerDuizendStuksInKG(ProductItem)) ;NetWeight
- Do Product.ZetAantalInGrootVerpakking(..BepaalAantalInGrootVerpakking(ProductItem)) ;QtyGVP
- Do Product.ZetAantalInKleinVerpakking(..BepaalAantalInKleinVerpakking(ProductItem)) ;QtyKVP
- Do Product.ZetAantalInNormaalVerpakking(..BepaalAantalInNormaalVerpakking(ProductItem)) ;QtyNVP
- Do Product.ZetPalletAantal(..BepaalPalletAantal(ProductItem)) ;QtyPLT
- Do Product.ZetStockNietStock(..BepaalStockNietStock(ProductItem)) ; ReqCovType
- Do Product.ZetMerk(" ") ; nergens gebruikt maar nodig voor ^KPL
- Do Product.ZetActiefStatus(..BepaalCommercieelAktief(ProductItem)) ; StoppedSales
- if ..MagLinktypeAangepastWordenBijUpdate(ProductItem,Product) {
- Do Product.ZetLinkType(..BepaalLinkType(ProductItem,LegalEntity)) ; Ook ReqCovType Alleen bij creatie zetten, daarna afblijven.
- }
- Do Product.ZetKorttekst(..BepaalKorttekst(ProductItem))
- Do ..ConvertGroepen(Product, ProductItem) ;ok
- ; nodig want anders kan de ProductId niet opgevraagd worden, nodig om admin product aan te maken indien die niet zou bestaan.
- ; via event wordt ook admin prod aangemaakt
- Do Product.Save()
-
- Do ..ConvertTranslation(Product, ##class(TECH.ListIterator).%New(ProductItem.Translation)) ; ok
+ #dim Filter as TECH.Filter = ##class(AXimpl.Dynamics.ProductItemUpsertIn.Converter.ExtFilter).Maak("Vend","VendGroup")
+ Do ..ConvertExtModuleTypeVend(Product, ##class(TECH.DynamicIterator).%New(##class(TECH.ListIterator).%New(ProductItem.Ext),"",Filter))
- #dim Filter as TECH.Filter = ##class(AXimpl.Dynamics.ProductItemUpsertIn.Converter.ExtFilter).Maak("Vend","VendGroup")
- Do ..ConvertExtModuleTypeVend(Product, ##class(TECH.DynamicIterator).%New(##class(TECH.ListIterator).%New(ProductItem.Ext),"",Filter))
-
- Set Filter = ##class(AXimpl.Dynamics.ProductItemUpsertIn.Converter.ExtFilter).Maak("Cust")
- Do ..ConvertExtModuleTypeCust(Product, ##class(TECH.DynamicIterator).%New(##class(TECH.ListIterator).%New(ProductItem.Ext),"",Filter))
-
- Do Product.Save()
- Do ..MaakIndexen(Product.GeefID())
+ Set Filter = ##class(AXimpl.Dynamics.ProductItemUpsertIn.Converter.ExtFilter).Maak("Cust")
+ Do ..ConvertExtModuleTypeCust(Product, ##class(TECH.DynamicIterator).%New(##class(TECH.ListIterator).%New(ProductItem.Ext),"",Filter))
+
+ Do Product.Save()
+ Do ..MaakIndexen(Product.GeefID())
+ } catch {
+ ; als er iets fout loopt probeer dan toch de index te herstellen
+ #dim Exception as TECH.Exceptions.Exception = ##class(TECH.ExceptionHandler).Catch()
+ try {
+ If $$$HasLength(Product.GeefID()){
+ Do ..MaakIndexen(Product.GeefID())
+ }
+ } catch {
+ #dim RebuildIndexException As TECH.Exceptions.Exception = ##class(TECH.ExceptionHandler).Catch()
+ Do ..Logger.Error("Build product index","Opbouwen van index faalde, na product update")
+ Do ..Logger.LogEnMailExceptie(RebuildIndexException)
+ }
+ Do ##class(TECH.ExceptionHandler).Rethrow(Exception)
+ }
]]>
Index: vhUnitTest/AXimpl/Dynamics/ProductItemUpsertIn/Converter/ProductItemConverter/Test.cls.xml
===================================================================
diff -u -r49691 -r49703
--- vhUnitTest/AXimpl/Dynamics/ProductItemUpsertIn/Converter/ProductItemConverter/Test.cls.xml (.../Test.cls.xml) (revision 49691)
+++ vhUnitTest/AXimpl/Dynamics/ProductItemUpsertIn/Converter/ProductItemConverter/Test.cls.xml (.../Test.cls.xml) (revision 49703)
@@ -110,6 +110,46 @@
]]>
+
+
+
+