Commit 4dae5902 authored by prane's avatar prane

added deallocation of sordalloc and same will updates in sorditem and...

added deallocation of sordalloc and same will updates in sorditem and round_adj related changes in invoice

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@199454 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 1fa6df8b
......@@ -123,6 +123,7 @@ public class PostOrdDespatchGen
int lineNoDet = 0;
HashMap invAllocTraceMap = null;
InvAllocTraceBean invBean = null;
String sqlSord = "";
try {
startTime = System.currentTimeMillis();
//System.out.println("process starts---------");
......@@ -1988,7 +1989,112 @@ public class PostOrdDespatchGen
{
errString = itmDBAccessEJB.getErrorString("VTSTKNOAVL",errString,"","",conn);
return errString;
}else //Pavan R 10apr19[to deallocate in sordalloc and sorditem] start
{
double qtyAlloc = 0;
double qtyStduom = (Double)sordDetMap.get("quantity__stduom");
int updateCnt = 0;
sql = "SELECT QTY_ALLOC AS COUNT FROM SORDALLOC "
+"WHERE SALE_ORDER = ? "
+"AND LINE_NO = ? "
+"AND EXP_LEV = ? "
+"AND ITEM_CODE__ORD = ? "
+"AND ITEM_CODE = ? "
+"AND LOT_NO = ? "
+"AND LOT_SL = ? "
+"AND LOC_CODE = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,checkNull(sordDetMap.get("sord_no").toString()));
pstmt.setString(2,checkNull(sordDetMap.get("line_no__sord").toString()));
pstmt.setString(3,checkNull(sordDetMap.get("exp_lev").toString()));
pstmt.setString(4,checkNull(sordDetMap.get("item_code__ord").toString()));
pstmt.setString(5,checkNull(sordDetMap.get("item_code").toString()));
pstmt.setString(6,checkNull(sordDetMap.get("lot_no").toString()));
pstmt.setString(7,checkNull(sordDetMap.get("lot_sl").toString()));
pstmt.setString(8,checkNull(sordDetMap.get("loc_code").toString()));
rs = pstmt.executeQuery();
if(rs.next())
{
qtyAlloc = rs.getDouble(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
System.out.println("Postord Length of for loop>>"+lineNumber+"]");
System.out.println("Postord qtyallocation>>"+qtyAlloc);
System.out.println("Postord Qtystduom"+qtyStduom);
if((qtyAlloc >= qtyStduom) && (qtyAlloc > 0))//deallocation
{
if (qtyAlloc - qtyStduom <= 0)
{
sqlSord = "DELETE FROM SORDALLOC WHERE SALE_ORDER = ? "
+"AND LINE_NO = ? "
+"AND EXP_LEV = ? "
+"AND ITEM_CODE__ORD = ? "
+"AND ITEM_CODE = ? "
+"AND LOT_NO = ? "
+"AND LOT_SL = ? "
+"AND LOC_CODE = ? ";
System.out.println("Postord Delete sql sqlSord :"+sqlSord);
pstmt = conn.prepareStatement(sqlSord);
pstmt.setString(1,checkNull(sordDetMap.get("sord_no").toString()));
pstmt.setString(2,checkNull(sordDetMap.get("line_no__sord").toString()));
pstmt.setString(3,checkNull(sordDetMap.get("exp_lev").toString()));
pstmt.setString(4,checkNull(sordDetMap.get("item_code__ord").toString()));
pstmt.setString(5,checkNull(sordDetMap.get("item_code").toString()));
pstmt.setString(6,checkNull(sordDetMap.get("lot_no").toString()));
pstmt.setString(7,checkNull(sordDetMap.get("lot_sl").toString()));
pstmt.setString(8,checkNull(sordDetMap.get("loc_code").toString()));
updateCnt = pstmt.executeUpdate();
pstmt.close();
pstmt = null;
System.out.println("Postord Deleted the no of records are : updateCnt :"+updateCnt);
}
else
{
sqlSord = "UPDATE SORDALLOC SET QTY_ALLOC = QTY_ALLOC - ? "
+"WHERE SALE_ORDER = ? "
+"AND LINE_NO = ? "
+"AND EXP_LEV = ? "
+"AND ITEM_CODE__ORD = ? "
+"AND ITEM_CODE = ? "
+"AND LOT_NO = ? "
+"AND LOT_SL = ? "
+"AND LOC_CODE = ? ";
System.out.println("Postord Update sql sqlSord :"+sqlSord);
pstmt = conn.prepareStatement(sqlSord);
pstmt.setDouble(1,qtyStduom);
pstmt.setString(2,checkNull(sordDetMap.get("sord_no").toString()));
pstmt.setString(3,checkNull(sordDetMap.get("line_no__sord").toString()));
pstmt.setString(4,checkNull(sordDetMap.get("exp_lev").toString()));
pstmt.setString(5,checkNull(sordDetMap.get("item_code__ord").toString()));
pstmt.setString(6,checkNull(sordDetMap.get("item_code").toString()));
pstmt.setString(7,checkNull(sordDetMap.get("lot_no").toString()));
pstmt.setString(8,checkNull(sordDetMap.get("lot_sl").toString()));
pstmt.setString(9,checkNull(sordDetMap.get("loc_code").toString()));
updateCnt = pstmt.executeUpdate();
pstmt.close();
pstmt = null;
System.out.println("Postord Updated the no of records are : updateCnt :"+updateCnt);
}
sqlSord = "UPDATE SORDITEM SET QTY_ALLOC = QTY_ALLOC - ? "
+"WHERE SALE_ORDER = ? "
+"AND LINE_NO = ? "
+"AND EXP_LEV = ? ";
System.out.println("Postord Update sql sqlSord :"+sqlSord);
pstmt = conn.prepareStatement(sqlSord);
pstmt.setDouble(1,qtyStduom);
pstmt.setString(2,checkNull(sordDetMap.get("sord_no").toString()));
pstmt.setString(3,checkNull(sordDetMap.get("line_no__sord").toString()));
pstmt.setString(4,checkNull(sordDetMap.get("exp_lev").toString()));
updateCnt = pstmt.executeUpdate();
pstmt.close();
pstmt = null;
System.out.println("Postord Updated the no of records : updateCnt :"+updateCnt);
}
}
//Pavan R 10apr19 end
}
}
xmlBuff.append("</Header0>");
......
......@@ -77,7 +77,7 @@ public class PostOrdInvoicePost extends ActionHandlerEJB implements PostOrdInvoi
HashMap<String, String> invAcctMap = null;
ArrayList<HashMap<String, String>> invAcctList = new ArrayList<HashMap<String,String>>();
long startTime = 0, endTime = 0, totalTime = 0, totalHrs = 0, totlMts = 0, totSecs = 0; // Added
double totRecoAmt = 0;
double totRecoAmt = 0, roundAdj = 0;
try
{
//Added by wasim on 07-JUN-2017 to get GS_MODE from Xtra Params
......@@ -132,19 +132,22 @@ public class PostOrdInvoicePost extends ActionHandlerEJB implements PostOrdInvoi
}
}
//Modified by Anjali R. on [29/01/2019][To Update tran_date as todays date in case of ledg_post_conf is "Y"][End]
sql="select cust_code,item_ser,net_amt from invoice where invoice_id=?";
sql="select cust_code,item_ser,net_amt, round_adj from invoice where invoice_id=?";
pstmt2= conn.prepareStatement(sql);
pstmt2.setString(1,invoiceId );
rs2=pstmt2.executeQuery();
while(rs2.next())
//while(rs2.next())
if(rs2.next())
{
custCode=rs2.getString("cust_code");
itemSer=rs2.getString("item_ser");
netamt=rs2.getDouble("net_amt");
roundAdj=rs2.getDouble("round_adj");
}
rs2.close();//added by Pavan R 10oct18[to handle open cursor issue]
rs2 = null; pstmt2.close(); pstmt2 = null;
(roundAdj == 0)
{
sql="select round, case when round_to is null then 0.001 else round_to end as round_to " +
" from customer where cust_code = ?";
pstmt2= conn.prepareStatement(sql);
......@@ -209,7 +212,7 @@ public class PostOrdInvoicePost extends ActionHandlerEJB implements PostOrdInvoi
//xmlBuff.append("<round_adj><![CDATA["+(netamt-netamtr)+"]]></round_adj>");
//xmlBuff.append("<net_amt><![CDATA["+netamt+"]]></net_amt>");
}
}
///End of round code
/**
......@@ -931,7 +934,8 @@ public class PostOrdInvoicePost extends ActionHandlerEJB implements PostOrdInvoi
pstmt2.setString(1,invoiceId );
rs2=pstmt2.executeQuery();
while(rs2.next())
//while(rs2.next())
if(rs2.next())
{
ln_amount_radj=(rs2.getDouble("round_adj"));
System.out.println("ln_amount_radj+++++++"+ln_amount_radj);
......
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