Hi,
I write some rules related to discount price it's working fine.like
Get Five BabySoap1 at 50% Discount
Get Two BabySoap1 at 25% Discount
actually objects are available in working
memory.But,I am giving some free
item.like,
Buy BabySoap2 & Get BabySoap3 Free
how to find out.
List list = new ArrayList();
CashMemoHdr hdr = new CashMemoHdr();
hdr.setLineItems(2l);
List<CashMemoDtl> cashMemoDtls = new ArrayList<CashMemoDtl>();
CashMemoDtl dtl = new CashMemoDtl();
dtl.setArticleCode("BabySoap1");
dtl.setLineItemNumber(1);
dtl.setPrice(250L);
dtl.setLineDiscount(5L);
dtl.setQuantity(5l);
cashMemoDtls.add(dtl);
list.add(dtl);
dtl = new CashMemoDtl();
dtl.setArticleCode("BabySoap2");
dtl.setLineItemNumber(2);
dtl.setPrice(40L);
dtl.setLineDiscount(3L);
dtl.setQuantity(5l);
cashMemoDtls.add(dtl);
list.add(dtl);
dtl = new CashMemoDtl();
dtl.setArticleCode("BabySoap3");
dtl.setLineItemNumber(3);
dtl.setPrice(30L);
dtl.setLineDiscount(2L);
dtl.setQuantity(2l);
cashMemoDtls.add(dtl);
list.add(dtl);
hdr.setCashMemoDtls(list);
rule "Buy BabySoap2 & Get BabySoap3 Free"
when
$h:
:CashMemoHdr(lineItems:lineItems,totalItems:totalItems,costAmt:costAmt
,cashMemoDtls:cashMemoDtls)
$c
:CashMemoDtl(articleCode:articleCode,lineItemNumber:lineItemNumber,price:price,
netAmount:netAmount,lineDiscount:lineDiscount,quantity:quantity,
promotionId:promotionId)
//> eval($c.getArticleCode()== "BabySoap2")
....................//how to test here
then
System.out.println("=====================================");
System.out.println("Buy BabySoap2 & Get BabySoap3 Free :"
+$c.getArticleCode());
System.out.println("=====================================");
end
pls give me proper idea about of this.
Thanks,
-manya
--
View this message in context:
http://www.nabble.com/How-to-check-diff-objects-in-same-condition.-tp2170...
Sent from the drools - user mailing list archive at
Nabble.com.