Commit d3fc1b38 authored by agaikwad's avatar agaikwad

Added column location code in update and insert query for qc_order_lots Table.


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@99420 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 4869e31d
......@@ -3200,8 +3200,13 @@ public class StockTransferConf extends ActionHandlerEJB implements StockTransfer
int cnt=0,cnt1=0,updCnt=0,updCnt1=0,cnt22=0;
double quantity=0,qtySample=0,qcOrdQty=0;
double noArt=0 , netWeight=0 , rate=0 , batchSize=0;
ITMDBAccessEJB itmDBAccess = new ITMDBAccessEJB();
int lineNo=0,qcCount=0,qcLotCount=0;
System.out.println("@@@@@ updateQcOrderLotInfo() method called..............");
DistCommon dist = new DistCommon();
String retString = "";
String locType="",locLogic ="",site ="",locUdf ="";
String locCode="";
System.out.println(" ..............");
try
{
if(updateRowMap.get("item_code")!= null)
......@@ -3245,6 +3250,84 @@ public class StockTransferConf extends ActionHandlerEJB implements StockTransfer
netWeight = Double.parseDouble(updateRowMap.get("net_weight").toString());
}
System.out.println("lotNo>>>>>>>"+lotNo);
System.out.println("locationCode>>>>>>>"+locationCode);
locLogic = dist.getDisparams ("999999","APR_LOC_LOGIC",conn);
locUdf = dist.getDisparams ("999999","APR_LOC_UDF",conn);
System.out.println ("locLogic is = ===== "+locLogic);
System.out.println ("locUdf is = ===== "+locUdf);
//
if (locLogic.equalsIgnoreCase("NULLFOUND"))
{
errCode = "VTLOCLOG";
retString = itmDBAccess.getErrorString("", errCode, "", "", conn);
}
if ("U".equalsIgnoreCase (locLogic ))
{
if (locUdf.equalsIgnoreCase("NULLFOUND")|| locUdf.trim().length() == 0)
{
System.out.println("inside if locUdf *********");
errCode = "VTLOCUDF";
retString = itmDBAccess.getErrorString("", errCode, "", "", conn);
}
}
if ("I".equalsIgnoreCase (locLogic ))
{
sql = " select LOC_CODE from item "
+" where item_code = ? " ;
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, itemCode);
rs = pstmt.executeQuery();
if(rs.next())
{
locCode = rs.getString(1);
}
pstmt.close();
}
else if ("S".equalsIgnoreCase(locLogic))
{
sql = "select LOC_CODE__APRV from siteitem "
+" where item_code = ? and site_code = ? " ;
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, itemCode);
pstmt.setString(2, site);
rs = pstmt.executeQuery();
if(rs.next())
{
locCode = rs.getString(1);
}
pstmt.close();
}
if ("U".equalsIgnoreCase(locLogic))
{
if (!(locUdf.equalsIgnoreCase("NULLFOUND")|| locUdf.trim().length() == 0))
{
System.out.println("inside 2nd if locUdf *********");
sql = "select " + locUdf + "('" + locationCode + "') from dual";
pstmt = conn.prepareStatement(sql);
//loc = rs.getString(1);
rs = pstmt.executeQuery();
if(rs.next())
{
locCode = rs.getString(1);
}
else
{
errCode = "DS000";
retString = itmDBAccess.getErrorString("", errCode, "", "", conn);
}
pstmt.close();
}
else
{
errCode = "VTLOCUDF";
retString = itmDBAccess.getErrorString("", errCode, "", "", conn);
}
}
System.out.println("LOCATION CODE :" +locCode);
System.out.println("LOCATION CODE :" +locationCode);
//
if (quantity > 0)
{
sqlQC = "select count(1) from qc_order "
......@@ -3280,6 +3363,8 @@ public class StockTransferConf extends ActionHandlerEJB implements StockTransfer
{
cnt = rs.getInt("cnt");
qcOrdQty = rs.getDouble("quantity");
System.out.println("Count **** "+ cnt);
System.out.println("QUantity ****" + qcOrdQty);
}
rs.close();
rs = null;
......@@ -3290,7 +3375,7 @@ public class StockTransferConf extends ActionHandlerEJB implements StockTransfer
if( locationCodeFrom != null && locationCodeFrom.trim().length()>0 )
{
sql = "update qc_order_lots set quantity = ?+? where item_code = ?" +
" and lot_no = ? and loc_code__issue = ? and lot_sl=? ";
" and lot_no = ? and loc_code__issue = ? and lot_sl=?";
pstmtUpd = conn.prepareStatement(sql);
pstmtUpd.setDouble(1, qcOrdQty);
pstmtUpd.setDouble(2, quantity);
......@@ -3315,6 +3400,8 @@ public class StockTransferConf extends ActionHandlerEJB implements StockTransfer
//cnt22 = rs.getInt("cnt");
cnt22 = Integer.parseInt(rs.getString("cnt") == null ? "0" : rs.getString("cnt"));
qcOrdQty = Double.parseDouble(rs.getString("quantity") == null ? "0" : rs.getString("quantity"));
System.out.println("Count 22"+ cnt22);
System.out.println("Quantity 22" + qcOrdQty);
}
rs.close();
rs = null;
......@@ -3325,7 +3412,7 @@ public class StockTransferConf extends ActionHandlerEJB implements StockTransfer
if (qcOrdQty == 0)
{
sql = " delete from qc_order_lots where item_code = ? and lot_no = ? "
+ "and loc_code__issue = ? and lot_sl=? ";
+ "and loc_code__issue = ? and lot_sl=?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, itemCode);
pstmt.setString(2, lotNo);
......@@ -3342,7 +3429,7 @@ public class StockTransferConf extends ActionHandlerEJB implements StockTransfer
else
{
sql = "update qc_order_lots set quantity = ?-? where item_code = ? " +
"and lot_no = ? and loc_code__issue = ? and lot_sl=? ";
"and lot_no = ? and loc_code__issue = ? and lot_sl=?";
pstmtUpd = conn.prepareStatement(sql);
pstmtUpd.setDouble(1, qcOrdQty);
pstmtUpd.setDouble(2, quantity);
......@@ -3356,7 +3443,7 @@ public class StockTransferConf extends ActionHandlerEJB implements StockTransfer
}
} else
{
System.out.println("Else part **** count");
sql = " select quantity from qc_order_lots "
+ "where item_code = ? and lot_no = ? and loc_code__issue=? and lot_sl=? ";
pstmt = conn.prepareStatement(sql);
......@@ -3376,18 +3463,19 @@ public class StockTransferConf extends ActionHandlerEJB implements StockTransfer
System.out.println("@@@@ qcOrdQty To:" + qcOrdQty+"quantity To:"+quantity);
if(qcOrdQty==0)
{
sql = "update qc_order_lots set quantity = ? ,loc_code__issue= ? ,no_art = ?, lot_no = ?, lot_sl=? " +
" where item_code = ? and lot_no = ? and loc_code__issue = ? and lot_sl=? ";
sql = "update qc_order_lots set quantity = ? ,loc_code__issue= ?,loc_code=? ,no_art = ?, lot_no = ?, lot_sl=? " +
" where item_code = ? and lot_no = ? and loc_code__issue = ? and lot_sl=?";
pstmtUpd = conn.prepareStatement(sql);
pstmtUpd.setDouble(1, quantity);
pstmtUpd.setString(2, locationCode);
pstmtUpd.setDouble(3, noArt);
pstmtUpd.setString(4, lotNo);
pstmtUpd.setString(5, lotSl);
pstmtUpd.setString(6, itemCode);
pstmtUpd.setString(7, lotNo);
pstmtUpd.setString(8, locationCodeFrom);
pstmtUpd.setString(9, lotSl);
pstmtUpd.setString(3, locCode);
pstmtUpd.setDouble(4, noArt);
pstmtUpd.setString(5, lotNo);
pstmtUpd.setString(6, lotSl);
pstmtUpd.setString(7, itemCode);
pstmtUpd.setString(8, lotNo);
pstmtUpd.setString(9, locationCodeFrom);
pstmtUpd.setString(10, lotSl);
updCnt = pstmtUpd.executeUpdate();
pstmtUpd.close();
pstmtUpd = null;
......@@ -3433,7 +3521,7 @@ public class StockTransferConf extends ActionHandlerEJB implements StockTransfer
lineNo++;
sql = " Insert into qc_order_lots (QC_ORDER,LINE_NO,ITEM_CODE,LOT_NO,LOT_SL,LOC_CODE,QUANTITY," +
"UNIT,SAMPLE_QTY,LOCTYPE,LOC_CODE__ISSUE,QORDER_NO,NO_ART,NET_WEIGHT) " +
"UNIT,SAMPLE_QTY,LOCTYPE,LOC_CODE__ISSUE,QORDER_NO,NO_ART,NET_WEIGHT,LOC_CODE) " +
" values (?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
pstmtInsert = conn.prepareStatement(sql);
pstmtInsert.setString(1, qorderNo);
......@@ -3452,6 +3540,7 @@ public class StockTransferConf extends ActionHandlerEJB implements StockTransfer
pstmtInsert.setString(12, qorderNo);
pstmtInsert.setDouble(13, noArt);
pstmtInsert.setDouble(14, netWeight);
pstmtInsert.setString(15, locCode);
updCnt1 = pstmtInsert.executeUpdate();
pstmtInsert.close();
pstmtInsert = 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