Commit 69fe6422 authored by dpawar's avatar dpawar

added source code partial quantity validation


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@93591 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 7500796e
...@@ -29,6 +29,7 @@ import org.w3c.dom.NodeList; ...@@ -29,6 +29,7 @@ import org.w3c.dom.NodeList;
public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLocal,ProofOfDeliveryRemote public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLocal,ProofOfDeliveryRemote
{ {
String str,confirmedInv=""; String str,confirmedInv="";
public String wfValData(String xmlString, String xmlString1, String xmlString2,String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException public String wfValData(String xmlString, String xmlString1, String xmlString2,String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException
{ {
System.out.println("------------ wfvalData method called-----------------"); System.out.println("------------ wfvalData method called-----------------");
...@@ -254,7 +255,7 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca ...@@ -254,7 +255,7 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca
//qtyResalD=qtyResalD+isTotalAmountPodQtyGrt(conn,str,qtyInvD); //qtyResalD=qtyResalD+isTotalAmountPodQtyGrt(conn,str,qtyInvD);
System.out.println("POD qty with new entry value---------->>"+qtyResalD); System.out.println("POD qty with new entry value---------->>"+qtyResalD);
System.out.println("Actual quantity after sales return---->>["+qtyInvD+"]"); System.out.println("Actual quantity after sales return---->>["+qtyInvD+"]");
if(isTotalAmountPodQtyGrt(conn,str,qtyInvD,qtyResalD)) //VTSLRETER if(isTotalAmountPodQtyGrt(conn,str,qtyInvD,qtyResalD,itemCodeSret)) //VTSLRETER
{ {
//Invoice quantity for item(s) is returned.Please check sales return. //Invoice quantity for item(s) is returned.Please check sales return.
errCode = "VTSLRETER"; errCode = "VTSLRETER";
...@@ -266,12 +267,12 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca ...@@ -266,12 +267,12 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca
} }
System.out.println("in isPartialyInvoiceChk condition------------ "); System.out.println("in isPartialyInvoiceChk condition------------ ");
sql1="select tran_id from spl_sales_por_hdr where invoice_id = ?"; //sql1="select tran_id from spl_sales_por_hdr where invoice_id = ?";
//totalInvQty=isTotalAmountPodQtyGrt(conn,str,qtyInvD); //totalInvQty=isTotalAmountPodQtyGrt(conn,str,qtyInvD);
//totalInvQty = totalInvQty+ qtyResalD; //totalInvQty = totalInvQty+ qtyResalD;
System.out.println("qtyInvD---->> "+qtyInvD+" qtyResaleD : "+qtyResaleD); System.out.println("qtyInvD---->> "+qtyInvD+" qtyResaleD : "+qtyResaleD);
System.out.println("Final totalInvQty ----->"+totalInvQty ); System.out.println("Final totalInvQty ----->"+totalInvQty );
if ( isTotalAmountPodQtyGrt(conn,str,qtyInvD,qtyResalD)) if ( isTotalAmountPodQtyGrt(conn,str,qtyInvD,qtyResaleD,itemCodeSret))
{ {
System.out.println("the total qty condition true---------"); System.out.println("the total qty condition true---------");
errCode = "VTPODGRT"; errCode = "VTPODGRT";
...@@ -671,16 +672,18 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca ...@@ -671,16 +672,18 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca
} }
private boolean isTotalAmountPodQtyGrt(Connection conn,String invID,double actualInvQty,double currentPODvalue) private boolean isTotalAmountPodQtyGrt(Connection conn,String invID,double actualInvQty,double currentPodQty,String itemCodeSret)
{ {
System.out.println("---in method getTotalAmountPodQty@@@@@@@ ------invoice ID :["+invID+"]"); System.out.println("---in method isTotalAmountPodQtyGrt@@@@@@@ ------invoice ID :["+invID+"]");
System.out.println("actualInvQty----->>"+actualInvQty+" currentPodQty----->>"+currentPodQty);
Map<String,Double> itemMap=new HashMap<String,Double>();
PreparedStatement pstmt2 = null,pstmt1=null,pstmt3=null ; PreparedStatement pstmt2 = null,pstmt1=null,pstmt3=null ;
ResultSet rs2 = null,rs1=null,rs3=null; ResultSet rs2 = null,rs1=null,rs3=null;
String sql1="",tranID="",confirmed="",itemCode=""; String sql1="",tranID="",confirmed="",itemCode="";
int lineNo=0,count=0; int lineNo=0,count=0;
double qtyInv=0.0,podQty=0.0,totalPodQty=0.0; Double totalParsingQty=0.0;
double qtyInv=0.0,podQty=0.0,totalPodQty=0.0,consumeQty=0.0,finalPodqty=0.0;
boolean isItemCodeMatch=false;
sql1="select tran_id,confirmed from spl_sales_por_hdr where invoice_id = ? and confirmed = ? and wf_status <> 'R'"; sql1="select tran_id,confirmed from spl_sales_por_hdr where invoice_id = ? and confirmed = ? and wf_status <> 'R'";
try try
{ {
...@@ -710,10 +713,12 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca ...@@ -710,10 +713,12 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca
itemCode=rs1.getString(2); itemCode=rs1.getString(2);
qtyInv=rs1.getDouble(3); qtyInv=rs1.getDouble(3);
podQty=rs1.getDouble(4); podQty=rs1.getDouble(4);
System.out.println("Line no@@@ ---->"+lineNo+ " qtyInv-->>"+qtyInv+" podQty->>"+podQty); System.out.println("Line no @@@@ ---->"+lineNo+ " qtyInv-->>"+qtyInv+" podQty->>"+podQty+" itemCode =["+itemCode+"]");
itemCode=itemCode==null ? "" : itemCode.trim();
sql1=""; sql1="";
sql1="select sum(quantity__resale) from spl_sales_por_det where item_code = ? and tran_id = ?"; /*sql1="select sum(quantity__resale) from spl_sales_por_det where item_code = ? and tran_id = ?";
pstmt3=conn.prepareStatement(sql1); pstmt3=conn.prepareStatement(sql1);
pstmt3.setString(1, itemCode); pstmt3.setString(1, itemCode);
pstmt3.setString(2, tranID); pstmt3.setString(2, tranID);
...@@ -721,30 +726,54 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca ...@@ -721,30 +726,54 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca
if(rs3.next()) if(rs3.next())
{ {
totalPodQty=rs3.getDouble(1); totalPodQty=rs3.getDouble(1);
} }*/
System.out.println("sumation of total POD itemwise ------>>"+totalPodQty);
System.out.println("Current pod value ------>>"+currentPODvalue); if(itemMap !=null)
totalPodQty=totalPodQty + currentPODvalue;
System.out.println("Fina POD qty after adding current value ------>>"+totalPodQty);
if( totalPodQty > actualInvQty)
{ {
System.out.println("---------return true value from isTotalAmountPodQtyGrt"); for (String key : itemMap.keySet())
return true; {
System.out.println("(In map$$$) Item Code--->>"+key+" itemCode--->>"+itemMap.get(key));
if(key.equalsIgnoreCase(itemCode))
{
System.out.println("item code match---------");
//totalPodQty=itemMap.get(key);
itemMap.put(itemCode, (itemMap.get(key)+ podQty));
System.out.println("item code="+itemCode+ " TotalPODqty="+(itemMap.get(key)+podQty));
isItemCodeMatch=true; }
}
} }
if(!(isItemCodeMatch))
itemMap.put(itemCode,podQty);
isItemCodeMatch=false;
rs3.close();rs3=null;
pstmt3.close();pstmt3=null;
//totalPodQty=totalPodQty + podQty;
/*if( podQty < qtyInv)
return true; */
} }
rs1.close();rs1=null; rs1.close();rs1=null;
pstmt1.close();pstmt1=null; pstmt1.close();pstmt1=null;
} }
} }
System.out.println("Item code in hashMap ---------->>");
for (String key : itemMap.keySet())
{
System.out.println("Item code -->> " + key);
}
System.out.println("PODqty FINAL in hashMap ---------->>");
for (Double key : itemMap.values())
{
System.out.println("f values = " + key);
// itemMap.get(itemCodeSret);
finalPodqty= itemMap.get(itemCodeSret) + currentPodQty;
System.out.println("Final pod Quantity------>>"+finalPodqty+" Actual POD qty--->>"+actualInvQty);
if(finalPodqty > actualInvQty)
{
System.out.println("-------------------POD quantity is greater--------------------------------------------------------");
return true;
}
}
System.out.println("Total POD quantity $$$--------->>"+totalPodQty);
//System.out.println("TranID in getTotalAmountPodQty --->>["+tranID+"] TotalPODqty -->["+totalPodqty+"]"); //System.out.println("TranID in getTotalAmountPodQty --->>["+tranID+"] TotalPODqty -->["+totalPodqty+"]");
/*if (confirmed.equalsIgnoreCase("Y")) /*if (confirmed.equalsIgnoreCase("Y"))
...@@ -779,6 +808,8 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca ...@@ -779,6 +808,8 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca
return false; return false;
} }
private boolean isPartialyInvoiceChk(Connection conn,String invID) private boolean isPartialyInvoiceChk(Connection conn,String invID)
{ {
System.out.println("---in method isPartialyInvoiceChk ------invoice ID :["+invID+"]"); System.out.println("---in method isPartialyInvoiceChk ------invoice ID :["+invID+"]");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment