(0068554)
|
mtaal
|
2014-07-08 11:58
|
|
Performance testing at Grape (old version rmp21) shows that the cashclose process is quite slow.
/openbravo/org.openbravo.retail.posterminal.service.jsonrest/org.openbravo.retail.posterminal.ProcessCashClose
Specifically one of the queries is slow. This query is called from this method:
OrderGroupingProcessor.groupOrders
This is the query:
select orderline0_.C_OrderLine_ID as C1_462_, orderline0_.AD_Client_ID as AD2_462_, orderline0_.AD_Org_ID as AD3_462_, orderline0_.IsActive as IsActive462_, orderline0_.Created as Created462_, orderline0_.CreatedBy as CreatedBy462_, orderline0_.Updated as Updated462_, orderline0_.UpdatedBy as UpdatedBy462_, orderline0_.C_Order_ID as C9_462_, orderline0_.Line as Line462_, orderline0_.C_BPartner_ID as C11_462_, orderline0_.C_BPartner_Location_ID as C12_462_, orderline0_.DateOrdered as DateOrd13_462_, orderline0_.DatePromised as DatePro14_462_, orderline0_.DateDelivered as DateDel15_462_, orderline0_.DateInvoiced as DateInv16_462_, orderline0_.Description as Descrip17_462_, orderline0_.M_Product_ID as M18_462_, orderline0_.M_Warehouse_ID as M19_462_, orderline0_.DirectShip as DirectShip462_, orderline0_.C_UOM_ID as C21_462_, orderline0_.QtyOrdered as QtyOrdered462_, orderline0_.QtyReserved as QtyRese23_462_, orderline0_.QtyDelivered as QtyDeli24_462_, orderline0_.QtyInvoiced as QtyInvo25_462_, orderline0_.M_Shipper_ID as M26_462_, orderline0_.C_Currency_ID as C27_462_, orderline0_.PriceList as PriceList462_, orderline0_.PriceActual as PriceAc29_462_, orderline0_.PriceLimit as PriceLimit462_, orderline0_.LineNetAmt as LineNetAmt462_, orderline0_.Discount as Discount462_, orderline0_.FreightAmt as FreightAmt462_, orderline0_.C_Charge_ID as C34_462_, orderline0_.ChargeAmt as ChargeAmt462_, orderline0_.C_Tax_ID as C36_462_, orderline0_.S_ResourceAssignment_ID as S37_462_, orderline0_.Ref_OrderLine_ID as Ref38_462_, orderline0_.M_AttributeSetInstance_ID as M39_462_, orderline0_.IsDescription as IsDescr40_462_, orderline0_.QuantityOrder as Quantit41_462_, orderline0_.M_Product_Uom_Id as M42_462_, orderline0_.M_Offer_ID as M43_462_, orderline0_.PriceStd as PriceStd462_, orderline0_.CANCELPRICEAD as CANCELP45_462_, orderline0_.C_Order_Discount_ID as C46_462_, orderline0_.Iseditlinenetamt as Iseditl47_462_, orderline0_.Taxbaseamt as Taxbaseamt462_, orderline0_.EM_Cdwp_Qty_In_Shipping as EM49_462_, orderline0_.M_Inoutline_ID as M50_462_, orderline0_.C_Return_Reason_ID as C51_462_, orderline0_.Gross_Unit_Price as Gross52_462_, orderline0_.Line_Gross_Amount as Line53_462_, orderline0_.GrossPriceList as GrossPr54_462_, orderline0_.C_Costcenter_ID as C55_462_, orderline0_.EM_Ds_Orderline_ID as EM56_462_, orderline0_.grosspricestd as grosspr57_462_, orderline0_.A_Asset_ID as A58_462_, orderline0_.M_Warehouse_Rule_ID as M59_462_, orderline0_.User1_ID as User60_462_, orderline0_.Quotationline_ID as Quotati61_462_, orderline0_.User2_ID as User62_462_, orderline0_.Create_Reservation as Create63_462_, orderline0_.C_Project_ID as C64_462_, orderline0_.SO_Res_Status as SO65_462_, orderline0_.Manage_Reservation as Manage66_462_, orderline0_.Manage_Prereservation as Manage67_462_, orderline0_.Explode as Explode462_, orderline0_.BOM_Parent_ID as BOM69_462_, orderline0_.EM_Gf_Changeproductnameinto as EM70_462_, orderline0_.EM_Gf_Isprintdiscount as EM71_462_ from C_OrderLine orderline0_ cross join C_Order order7_ where orderline0_.C_Order_ID=order7_.C_Order_ID and (exists (select 1 from FIN_Payment_ScheduleDetail fin_paymen1_ cross join FIN_Payment_Schedule fin_paymen2_ where fin_paymen1_.FIN_Payment_Schedule_Order=fin_paymen2_.Fin_Payment_Schedule_ID and fin_paymen2_.C_Order_ID=orderline0_.C_Order_ID and (exists (select 1 from FIN_Finacc_Transaction fin_finacc3_ cross join FIN_Payment_Detail fin_paymen4_ where fin_paymen1_.FIN_Payment_Detail_ID=fin_paymen4_.Fin_Payment_Detail_ID and (fin_finacc3_.FIN_Reconciliation_ID is null) and fin_finacc3_.Fin_Payment_ID=fin_paymen4_.Fin_Payment_ID))) or not (exists (select 1 from FIN_Payment_ScheduleDetail fin_paymen5_ cross join FIN_Payment_Schedule fin_paymen6_ where fin_paymen5_.FIN_Payment_Schedule_Order=fin_paymen6_.Fin_Payment_Schedule_ID and fin_paymen6_.C_Order_ID=orderline0_.C_Order_ID))) and order7_.EM_Obpos_Applications_ID=$1 and (select case when sum(ol.qtyordered) = 0 then 0 else round(coalesce(sum(ol.qtydelivered), 0)/sum(ol.qtyordered) * 100, 0) end from c_orderline ol where ol.c_order_id=order7_.c_order_id and ol.c_order_discount_id is null )>0 and not (exists (select 1 from C_OrderLine orderline9_ where orderline9_.QtyInvoiced<>0 and orderline9_.C_Order_ID=orderline0_.C_Order_ID)) and (orderline0_.AD_Org_ID in ('BE0AC4CFA26F4F408FD407033E4BFCF9' , '9DB2E1269F0149EDBD0D00C53C7DAC73' , '4525CC3279774C89AC745FE7627C701C' , '504FD243C72E40ABBA834C73B5667EF7' , '7C4A8703014F416CB5222163B9DB1BFE' , '05830B2BCB9D477B9A3F22082634DFFF' , '6C32D1DF2D504ADCA4FC5ABCFCDA18FF' , 'BF22A3C7C9CD4F70814D871A2E4EE7A2' , '6049CE77D04845969D328CA3731F033F' , '2AA41098B0AA47C791B92AE5B1D40A99' , 'DDD786B5320F4B19B19661A9CDBF74EA' , 'C11EF9BFAC03464C9B9E6925C0EE7F8C' , 'E0522AE6B2EA446D85FD69B5CC416826' , 'C11077EB595D403AA87AFEBCC45CD83D' , '387E977F25204A4DB5B6BED50554B168' , '02BC27FC439147F6BB1DF655D03623C0' , 'FB6777E278FD4ED08F9384450FEA3845' , '5F0478879DED4E2CBF387B35A779569E' , '0' , 'B1269F493B1342BE8B4B75D11B995E0E' , '83A0BB79EEDA4ECCB4BCFDF1A9A09466' , 'C069750FD29C46BF98A0F1126496C711')) and (orderline0_.AD_Client_ID in ('A65074D0843147BEB4F13FF007B52F0A' , '0')) and orderline0_.IsActive='Y' order by orderline0_.C_BPartner_ID |
|