Commit 4ee32ab5 authored by prane's avatar prane

Channle partner depatch confirmation - Auto receipt is giving error if there...

Channle partner depatch confirmation - Auto receipt is giving error if there are multiple open PO and depatch item is in different PO

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@201618 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 96d29d40
...@@ -230,6 +230,7 @@ public class PostOrderActivity { ...@@ -230,6 +230,7 @@ public class PostOrderActivity {
String xmlString="",chgUser="",chgTerm="",loginEmpCode=""; String xmlString="",chgUser="",chgTerm="",loginEmpCode="";
Timestamp sysDate=null; Timestamp sysDate=null;
String userId = "";//Added By Pavan R 27/DEC/17 String userId = "";//Added By Pavan R 27/DEC/17
String custPordPO = "", itemCodeDesp = "";
try try
{ {
//Modified by Anjali R. on [23/11/2018][Start] //Modified by Anjali R. on [23/11/2018][Start]
...@@ -315,6 +316,7 @@ public class PostOrderActivity { ...@@ -315,6 +316,7 @@ public class PostOrderActivity {
//Changed by wasim on 14-FEB-17 as getting correct result set //Changed by wasim on 14-FEB-17 as getting correct result set
//custPord=checkNull(rs.getString("cust_pord")); //custPord=checkNull(rs.getString("cust_pord"));
custPord=checkNull(rs1.getString("cust_pord")); custPord=checkNull(rs1.getString("cust_pord"));
System.out.println("sorder custPord["+custPord+"]");
} }
rs1.close(); rs1.close();
rs1=null; rs1=null;
...@@ -416,6 +418,21 @@ public class PostOrderActivity { ...@@ -416,6 +418,21 @@ public class PostOrderActivity {
{ {
return retString; return retString;
} }
//added by Pavan R 04Jun19 start[to get first item from despatchdet ]
sql= "select item_code from despatchdet where desp_id = ?";
pstmt=conn.prepareStatement(sql);
pstmt.setString(1,despId);
rs=pstmt.executeQuery();
if(rs.next())
{
itemCodeDesp = checkNull(rs.getString(1));
System.out.println("custPord::> despatch itemCode["+itemCodeDesp+"]");
}
rs.close();
rs=null;
pstmt.close();
pstmt=null;
//Pavan R 04Jun19 end
/* // 28-Nov-16 manoharan commented /* // 28-Nov-16 manoharan commented
sql=" select cust_pord from sorder " sql=" select cust_pord from sorder "
+ " where sale_order = ? "; + " where sale_order = ? ";
...@@ -447,24 +464,33 @@ public class PostOrderActivity { ...@@ -447,24 +464,33 @@ public class PostOrderActivity {
pstmt=null; pstmt=null;
if(!"O".equalsIgnoreCase(poStatus)) if(!"O".equalsIgnoreCase(poStatus))
{ {
sql="select purc_order from porder " //Modified by Pavan R 04Jun19 start
/*sql="select purc_order from porder "
+ " where supp_code = ? " + " where supp_code = ? "
+ " and site_code__dlv = ? and item_ser = ? and status = 'O' " + " and site_code__dlv = ? and item_ser = ? and status = 'O' "
+ " order by purc_order "; + " order by purc_order ";*/
sql = "select porder.purc_order from porder , porddet"
+ " where porder.purc_order = porddet.purc_order"
+ " and porder.supp_code = ? and porder.site_code__dlv = ?"
+ " and porder.item_ser = ? and porddet.item_code = ?"
+ " and porder.status = 'O' order by porder.purc_order";
pstmt=connCP.prepareStatement(sql); pstmt=connCP.prepareStatement(sql);
pstmt.setString(1, suppCodeCh); pstmt.setString(1, suppCodeCh);
pstmt.setString(2, siteCodeCh); pstmt.setString(2, siteCodeCh);
pstmt.setString(3, itemSer); pstmt.setString(3, itemSer);
pstmt.setString(4, itemCodeDesp);
rs=pstmt.executeQuery(); rs=pstmt.executeQuery();
if(rs.next()) if(rs.next())
{ {
custPord=checkNull(rs.getString(1)); custPordPO=checkNull(rs.getString(1));
System.out.println("After sorder custPord["+custPord+"]");
} }
rs.close(); rs.close();
rs=null; rs=null;
pstmt.close(); pstmt.close();
pstmt=null; pstmt=null;
if(custPord.trim().length()==0) //if(custPord.trim().length()==0)
if(custPordPO.trim().length()==0)
{ {
errCode="VTPOINV"; errCode="VTPOINV";
//Modified by Anjali R. on [23/11/2018][Start] //Modified by Anjali R. on [23/11/2018][Start]
...@@ -474,7 +500,6 @@ public class PostOrderActivity { ...@@ -474,7 +500,6 @@ public class PostOrderActivity {
return errCode; return errCode;
} }
} }
}else }else
{ {
sql="select count(*) from porder " sql="select count(*) from porder "
...@@ -503,32 +528,72 @@ public class PostOrderActivity { ...@@ -503,32 +528,72 @@ public class PostOrderActivity {
//Modified by Anjali R. on [23/11/2018][end] //Modified by Anjali R. on [23/11/2018][end]
return errCode; return errCode;
} }
//added and modifed by Pavan R 04Jun19 [to get populate PO if there are multiple open PO and depatch item is in different PO] start
sql="select purc_order from porder " if(countPO > 1)
{
sql = "select a.purc_order from porder a, porddet b, sorder s, despatchdet d where"
+" a.purc_order = b.purc_order"
+" and b.item_code = d.item_code"
+" and s.sale_order = d.sord_no"
+" and d.desp_id= ? and a.supp_code = ?"
+" and a.site_code__dlv = ? and a.item_ser = ? "
+" and d.item_code= ? and a.status = 'O'"
+" order by a.purc_order ";
pstmt=connCP.prepareStatement(sql);
pstmt.setString(1, despId);
pstmt.setString(2, suppCodeCh);
pstmt.setString(3, siteCodeCh);
pstmt.setString(4, itemSer);
pstmt.setString(5, itemCodeDesp);
rs=pstmt.executeQuery();
if(rs.next())
{
custPordPO = checkNull(rs.getString(1));
}
rs.close();
rs=null;
pstmt.close();
pstmt=null;
}
else
{
/* sql="select purc_order from porder "
+ " where supp_code = ? " + " where supp_code = ? "
+ " and site_code__dlv = ? and item_ser = ? and status = 'O' " + " and site_code__dlv = ? and item_ser = ? and status = 'O' "
+ " order by purc_order "; + " order by purc_order ";*/
sql = "select a.purc_order from porder a, porddet b"
+ " where a.purc_order = b.purc_order"
+ " and a.supp_code = ? and a.site_code__dlv = ? "
+ " and a.item_ser = ? and b.item_code = ? "
+ " and a.status = 'O' order by purc_order ";
pstmt=connCP.prepareStatement(sql); pstmt=connCP.prepareStatement(sql);
pstmt.setString(1, suppCodeCh); pstmt.setString(1, suppCodeCh);
pstmt.setString(2, siteCodeCh); pstmt.setString(2, siteCodeCh);
pstmt.setString(3, itemSer); pstmt.setString(3, itemSer);
pstmt.setString(4, itemCodeDesp);
rs=pstmt.executeQuery(); rs=pstmt.executeQuery();
if(rs.next()) if(rs.next())
{ {
custPord=checkNull(rs.getString(1)); //custPord=checkNull(rs.getString(1));
custPordPO=checkNull(rs.getString(1));
} }
rs.close(); rs.close();
rs=null; rs=null;
pstmt.close(); pstmt.close();
pstmt=null; pstmt=null;
} }
}
if (custPordPO == null || custPordPO.trim().length() == 0)
{
custPordPO = custPord;
}
//added and modifed by Pavan R 04Jun19 end
sql= //"select pord_type ,curr_code " sql= //"select pord_type ,curr_code "
"select pord_type ,curr_code, accept_criteria "//Changed By PriyankaC on 05JAN18. "select pord_type ,curr_code, accept_criteria "//Changed By PriyankaC on 05JAN18.
+ " from porder where purc_order = ? "; + " from porder where purc_order = ? ";
pstmt=connCP.prepareStatement(sql); pstmt=connCP.prepareStatement(sql);
pstmt.setString(1,custPord); //pstmt.setString(1,custPord); //modifed by Pavan R 04Jun19 end
pstmt.setString(1,custPordPO);
rs=pstmt.executeQuery(); rs=pstmt.executeQuery();
if(rs.next()) if(rs.next())
{ {
...@@ -634,7 +699,8 @@ public class PostOrderActivity { ...@@ -634,7 +699,8 @@ public class PostOrderActivity {
xmlBuff.append("<tran_type><![CDATA[FOR]]></tran_type>"); xmlBuff.append("<tran_type><![CDATA[FOR]]></tran_type>");
xmlBuff.append("<item_ser><![CDATA["+ checkNull(itemSer).trim() +"]]></item_ser>"); xmlBuff.append("<item_ser><![CDATA["+ checkNull(itemSer).trim() +"]]></item_ser>");
xmlBuff.append("<site_code><![CDATA["+ checkNull(siteCodeCh).trim() +"]]></site_code>"); xmlBuff.append("<site_code><![CDATA["+ checkNull(siteCodeCh).trim() +"]]></site_code>");
xmlBuff.append("<purc_order><![CDATA["+ checkNull(custPord).trim() +"]]></purc_order>"); //xmlBuff.append("<purc_order><![CDATA["+ checkNull(custPord).trim() +"]]></purc_order>");//modifed by Pavan R 04Jun19 end
xmlBuff.append("<purc_order><![CDATA["+ checkNull(custPordPO).trim() +"]]></purc_order>");
xmlBuff.append("<supp_code><![CDATA["+ checkNull(suppCodeCh).trim() +"]]></supp_code>"); xmlBuff.append("<supp_code><![CDATA["+ checkNull(suppCodeCh).trim() +"]]></supp_code>");
xmlBuff.append("<tran_code><![CDATA["+ checkNull(tranCode).trim() +"]]></tran_code>"); xmlBuff.append("<tran_code><![CDATA["+ checkNull(tranCode).trim() +"]]></tran_code>");
xmlBuff.append("<trans_mode><![CDATA["+ checkNull(transMode).trim() +"]]></trans_mode>"); xmlBuff.append("<trans_mode><![CDATA["+ checkNull(transMode).trim() +"]]></trans_mode>");
...@@ -824,9 +890,10 @@ public class PostOrderActivity { ...@@ -824,9 +890,10 @@ public class PostOrderActivity {
pstmt1.close(); pstmt1.close();
pstmt1=null; pstmt1=null;
//System.out.println("custPord>>>>>"+custPord); System.out.println("custPordPO>>>>>"+custPordPO);
if(custPord.trim().length()>0) //if(custPord.trim().length()>0)//Changed by Pavan R 04Jun19 end
if(custPordPO.trim().length()>0)
{ {
cntPO=0; //added by arun 06-OCT-2017 cntPO=0; //added by arun 06-OCT-2017
//Added and Commented by sarita to set tax_class , tax_chap and tax_env from porddet table on 26 DEC 2018 [START] //Added and Commented by sarita to set tax_class , tax_chap and tax_env from porddet table on 26 DEC 2018 [START]
...@@ -839,13 +906,14 @@ public class PostOrderActivity { ...@@ -839,13 +906,14 @@ public class PostOrderActivity {
+ " d.quantity, (case when d.dlv_qty is null then 0 else d.dlv_qty end) as dlvqty, " + " d.quantity, (case when d.dlv_qty is null then 0 else d.dlv_qty end) as dlvqty, "
+ " d.tax_class, d.tax_chap, d.tax_env " + " d.tax_class, d.tax_chap, d.tax_env "
+ " from porder h, porddet d where d.purc_order = h.purc_order " + " from porder h, porddet d where d.purc_order = h.purc_order "
+ " and d.purc_order = ? and d.line_no__sord = ? " //+ " and d.purc_order = ? and d.line_no__sord = ? "
+ " and d.line_no__sord = ? " //Pavan R 04jun19
+ " and d.status = 'O' and d.item_code = ?"; + " and d.status = 'O' and d.item_code = ?";
//Added and Commented by sarita to set tax_class , tax_chap and tax_env from porddet table on 26 DEC 2018 [END] //Added and Commented by sarita to set tax_class , tax_chap and tax_env from porddet table on 26 DEC 2018 [END]
pstmt1=connCP.prepareStatement(sql); pstmt1=connCP.prepareStatement(sql);
pstmt1.setString(1,custPord); //pstmt1.setString(1,custPord);
pstmt1.setString(2,soLineNoDet); pstmt1.setString(1,soLineNoDet);
pstmt1.setString(3,itemCode); pstmt1.setString(2,itemCode);
rs1=pstmt1.executeQuery(); rs1=pstmt1.executeQuery();
if(rs1.next()) if(rs1.next())
...@@ -859,9 +927,9 @@ public class PostOrderActivity { ...@@ -859,9 +927,9 @@ public class PostOrderActivity {
ordQty=rs1.getDouble("quantity"); ordQty=rs1.getDouble("quantity");
dlvQty=rs1.getDouble("dlvqty"); dlvQty=rs1.getDouble("dlvqty");
//Added by sarita to get tax_class , tax_chap and tax_env from porddet table on 26 DEC 2018[START] //Added by sarita to get tax_class , tax_chap and tax_env from porddet table on 26 DEC 2018[START]
taxClass=checkNull(rs.getString("tax_class")); taxClass=checkNull(rs1.getString("tax_class"));
taxChap=checkNull(rs.getString("tax_chap")); taxChap=checkNull(rs1.getString("tax_chap"));
taxEnv=checkNull(rs.getString("tax_env")); taxEnv=checkNull(rs1.getString("tax_env"));
//Added by sarita to get tax_class , tax_chap and tax_env from porddet table on 26 DEC 2018 [END] //Added by sarita to get tax_class , tax_chap and tax_env from porddet table on 26 DEC 2018 [END]
} }
rs1.close(); rs1.close();
...@@ -882,7 +950,8 @@ public class PostOrderActivity { ...@@ -882,7 +950,8 @@ public class PostOrderActivity {
+ " and d.purc_order = ? and d.status = 'O' and d.item_code = ? "; + " and d.purc_order = ? and d.status = 'O' and d.item_code = ? ";
//Added and Commented by sarita to set tax_class , tax_chap and tax_env from porddet table on 26 DEC 2018 [END] //Added and Commented by sarita to set tax_class , tax_chap and tax_env from porddet table on 26 DEC 2018 [END]
pstmt1=connCP.prepareStatement(sql); pstmt1=connCP.prepareStatement(sql);
pstmt1.setString(1,custPord); //pstmt1.setString(1,custPord);
pstmt1.setString(1,custPordPO);
pstmt1.setString(2,itemCode); pstmt1.setString(2,itemCode);
rs1=pstmt1.executeQuery(); rs1=pstmt1.executeQuery();
// 28-Nov-16 Manoharan // 28-Nov-16 Manoharan
...@@ -917,7 +986,7 @@ public class PostOrderActivity { ...@@ -917,7 +986,7 @@ public class PostOrderActivity {
return errCode; return errCode;
} }
} }
custPord = custPordPO;
}else }else
{ {
cntPO=0; cntPO=0;
...@@ -961,9 +1030,9 @@ public class PostOrderActivity { ...@@ -961,9 +1030,9 @@ public class PostOrderActivity {
ordQty=rs1.getDouble("quantity"); ordQty=rs1.getDouble("quantity");
dlvQty=rs1.getDouble("dlvqty"); dlvQty=rs1.getDouble("dlvqty");
//Added by sarita to get tax_class , tax_chap and tax_env from porddet table on 26 DEC 2018[START] //Added by sarita to get tax_class , tax_chap and tax_env from porddet table on 26 DEC 2018[START]
taxClass=checkNull(rs.getString("tax_class")); taxClass=checkNull(rs1.getString("tax_class"));
taxChap=checkNull(rs.getString("tax_chap")); taxChap=checkNull(rs1.getString("tax_chap"));
taxEnv=checkNull(rs.getString("tax_env")); taxEnv=checkNull(rs1.getString("tax_env"));
//Added by sarita to get tax_class , tax_chap and tax_env from porddet table on 26 DEC 2018 [END] //Added by sarita to get tax_class , tax_chap and tax_env from porddet table on 26 DEC 2018 [END]
} }
rs1.close(); rs1.close();
...@@ -1026,9 +1095,9 @@ public class PostOrderActivity { ...@@ -1026,9 +1095,9 @@ public class PostOrderActivity {
ordQty=rs1.getDouble("quantity"); ordQty=rs1.getDouble("quantity");
dlvQty=rs1.getDouble("dlvqty"); dlvQty=rs1.getDouble("dlvqty");
//Added by sarita to get tax_class , tax_chap and tax_env from porddet table on 26 DEC 2018[START] //Added by sarita to get tax_class , tax_chap and tax_env from porddet table on 26 DEC 2018[START]
taxClass=checkNull(rs.getString("tax_class")); taxClass=checkNull(rs1.getString("tax_class"));
taxChap=checkNull(rs.getString("tax_chap")); taxChap=checkNull(rs1.getString("tax_chap"));
taxEnv=checkNull(rs.getString("tax_env")); taxEnv=checkNull(rs1.getString("tax_env"));
//Added by sarita to get tax_class , tax_chap and tax_env from porddet table on 26 DEC 2018 [END] //Added by sarita to get tax_class , tax_chap and tax_env from porddet table on 26 DEC 2018 [END]
} }
rs1.close(); rs1.close();
......
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