Commit ca4e477a authored by msalla's avatar msalla

Channel partner - Missing items in PO to consider and show confirmed status of...

Channel partner - Missing items in PO to consider and show confirmed status of PO, also to show quantity of the PO line

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@205813 ce508802-f39f-4f6c-b175-0d175dae99d5
parent b6010d2f
......@@ -26,8 +26,8 @@ public class MissingItem extends ValidatorEJB {
// TODO Auto-generated method stub
E12GenericUtility genericUtility = new E12GenericUtility();
ArrayList<MissingItemBean> missingitemList = new ArrayList<MissingItemBean>();
PreparedStatement pstmt = null,pstmt1=null;
ResultSet rs = null,rs1=null;
PreparedStatement pstmt = null,pstmt1=null,pstmt2=null;
ResultSet rs = null,rs1=null,rs2=null;
Connection conn = null;
String sql,itemCodeOrd = null,itemDescr,chPartner = null;
String retString="";
......@@ -252,8 +252,10 @@ public class MissingItem extends ValidatorEJB {
pstmt1=null;
}
//else cnt<0
else
if (cntPO == 0)
{
cnt=0;
sql = "select a.purc_order,a.status,b.status,b.quantity,b.dlv_qty,b.line_no from porder a, porddet b"
+ " where a.purc_order = b.purc_order "
+ " and a.supp_code = ? and a.site_code__dlv = ? "
......@@ -275,15 +277,10 @@ public class MissingItem extends ValidatorEJB {
lineno=rs1.getString("line_no");
System.out.println("count missing data:1"+cntPO);
cnt++;
}
rs1.close();
rs1=null;
pstmt1.close();
pstmt1=null;
if(cnt>0)
{
if("X".equalsIgnoreCase(statushdr))//CANCEL STATUS IN HEADER
{
// retString = "Purchase order Cancelled for the "+pOrder;//order no
retString = "Order status is cancelled for the Purchase order("+pOrder+")";//order no
MissingItemBean missingbean=new MissingItemBean();
missingbean.setItemCode(itemCode);
......@@ -291,10 +288,12 @@ public class MissingItem extends ValidatorEJB {
missingbean.setItemQuantity(qtyhdr);
missingbean.setStatus(retString);
missingitemList.add(missingbean);
System.out.println("Purchase order already canceled("+pOrder+")");
}
if("C".equalsIgnoreCase(statushdr))//Closed STATUS IN HEADER
{
//retString = "Purchase order Closed for the "+salesOrder;
retString = "Order status is closed for the Purchase order("+pOrder+")";//order no
MissingItemBean missingbean=new MissingItemBean();
missingbean.setItemCode(itemCode);
......@@ -302,9 +301,12 @@ public class MissingItem extends ValidatorEJB {
missingbean.setItemQuantity(qtyhdr);
missingbean.setStatus(retString);
missingitemList.add(missingbean);
System.out.println("purchase order already closed"+itemCode);
}
if("X".equalsIgnoreCase(statusdet))//CANCEL STATUS IN DETAIL
{
//retString = "Purchase order Cancelled for line item for "+itemCode +" "+itemDescr;
retString = "Order status is opened for Purchase order ("+pOrder+") but line no("+lineno+") status is Cancelled";
MissingItemBean missingbean=new MissingItemBean();
missingbean.setItemCode(itemCode);
......@@ -312,10 +314,12 @@ public class MissingItem extends ValidatorEJB {
missingbean.setItemQuantity(qtyhdr);
missingbean.setStatus(retString);
missingitemList.add(missingbean);
System.out.println("Purchase order Cancelled for line item for "+itemCode);
}
if("C".equalsIgnoreCase(statusdet))//Closed STATUS IN DETAIL
{
//retString = "Purchase order Closed for line item for "+itemCode +" "+itemDescr;
retString = "Order status is opened for ("+pOrder+") but line no("+lineno+") status is Closed";
MissingItemBean missingbean=new MissingItemBean();
missingbean.setItemCode(itemCode);
......@@ -323,43 +327,65 @@ public class MissingItem extends ValidatorEJB {
missingbean.setItemQuantity(qtyhdr);
missingbean.setStatus(retString);
missingitemList.add(missingbean);
System.out.println("Purchase order Closed for line item for "+itemCode);
}
else
{
/*sql = "select b.quantity,b.dlv_qty 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 = ? ";
System.out.println("count missing data111:2"+cntPO);
pstmt1=conn.prepareStatement(sql);
pstmt1.setString(1,suppCodeCh);
pstmt1.setString(2,siteCodeCh);
pstmt1.setString(3,itemSer);
pstmt1.setString(4,itemCode);*/
sql = "select b.quantity,b.dlv_qty,a.purc_order from porder a, porddet b"
+ " where a.purc_order = b.purc_order "
+ " and b.line_no=? ";
pstmt1=conn.prepareStatement(sql);
pstmt1.setString(1,lineno);
rs1=pstmt1.executeQuery();
if(rs1.next())
{
pOrder=rs1.getString("purc_order");
qtyhdr=rs1.getDouble("quantity");
qtydlv=rs1.getDouble("dlv_qty");
}
rs1.close();
rs1=null;
pstmt1.close();
pstmt1=null;
System.out.println("count missing data111:2"+cntPO);
pstmt2=conn.prepareStatement(sql);
pstmt2.setString(1,lineno);
rs2=pstmt2.executeQuery();
if(rs2.next())
{
pOrder=rs2.getString("purc_order");
qtyhdr=rs2.getDouble("quantity");
qtydlv=rs2.getDouble("dlv_qty");
System.out.println("count missing data:2"+cntPO);
}
rs2.close();
rs2=null;
pstmt2.close();
pstmt2=null;
potqty=qtyhdr-qtydlv;
if(sqty>potqty)
{
System.out.println("item is missing2"+itemCode);
retString = "Purchase Order quantity ("+potqty+") is less than SaleOrder quantity ("+sqty+") for orderno ("+pOrder+") and line no("+lineno+")";
MissingItemBean missingbean=new MissingItemBean();
missingbean.setItemCode(itemCode);
missingbean.setItemDesc(itemDescr);
missingbean.setItemQuantity(potqty);
missingbean.setStatus(retString);
missingitemList.add(missingbean);
System.out.println("Purchase Order quantity ("+potqty+") is less than SaleOrder quantity ("+sqty+") for orderno ("+pOrder+")");
}
}//end else
}//end if
else
}
rs1.close();
rs1=null;
pstmt1.close();
pstmt1=null;
if(cnt==0)
{
retString = "Item("+itemDescr+"-"+ itemCode+") missing";
retString = "Item Missing";
MissingItemBean missingbean=new MissingItemBean();
missingbean.setItemCode(itemCode);
missingbean.setItemDesc(itemDescr);
......@@ -367,8 +393,7 @@ public class MissingItem extends ValidatorEJB {
missingbean.setStatus(retString);
missingitemList.add(missingbean);
}
}
}//end if
}
rs.close();
rs=null;
......
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