Commit a81eb951 authored by dpawar's avatar dpawar

get desp_id from dom


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@96292 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 2ffa09f0
...@@ -500,7 +500,7 @@ public class DespatchPos extends ValidatorEJB implements DespatchPosLocal, Despa ...@@ -500,7 +500,7 @@ public class DespatchPos extends ValidatorEJB implements DespatchPosLocal, Despa
} }
//postSave() added by kunal on 11/07/13 FOR cross update //postSave() added by kunal on 11/07/13 FOR cross update
public String postSave(String winName,String editFlag,String tranId, String xtraParams,Connection conn) throws RemoteException,ITMException public String postSave(String xmlString,String editFlag,String tranId,String xtraParams,Connection conn) throws RemoteException,ITMException
{ {
String sql = "",saleOrder = "",lotsl="",siteCode=""; String sql = "",saleOrder = "",lotsl="",siteCode="";
int lineNo = 0; int lineNo = 0;
...@@ -510,9 +510,23 @@ public class DespatchPos extends ValidatorEJB implements DespatchPosLocal, Despa ...@@ -510,9 +510,23 @@ public class DespatchPos extends ValidatorEJB implements DespatchPosLocal, Despa
PreparedStatement pstmt = null,pstmt1 = null; PreparedStatement pstmt = null,pstmt1 = null;
ResultSet rs = null,rs1 = null; ResultSet rs = null,rs1 = null;
boolean isError=true; boolean isError=true;
Document dom = null;
//System.out.println("tranId="+tranId+" xtraParams="+xtraParams); //System.out.println("tranId="+tranId+" xtraParams="+xtraParams);
try try
{ {
tranId=tranId==null ? "" :tranId.trim();
System.out.println("xml_String333--->>["+xmlString+"]");
System.out.println("tranId555--->>["+tranId+"]");
if (xmlString != null && xmlString.trim().length() > 0)
{
dom = parseString(xmlString);
}
if(tranId.length() == 0 && dom !=null){
System.out.println("dom not null..................");
tranId = GenericUtility.getInstance().getColumnValue("desp_id",dom);
}
System.out.println("tranId777------>>["+tranId+"]");
conn=null; conn=null;
if(conn == null){ if(conn == null){
System.out.println("connection is null.............."); System.out.println("connection is null..............");
...@@ -598,42 +612,34 @@ public class DespatchPos extends ValidatorEJB implements DespatchPosLocal, Despa ...@@ -598,42 +612,34 @@ public class DespatchPos extends ValidatorEJB implements DespatchPosLocal, Despa
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
String itemCode="",locCode="",siteCodeL="",lotNo="",lotSl="";
//new add //new add
sql = "select lot_sl from despatchdet where desp_id = ? "; sql = "select item_code,loc_code,site_code,lot_no,lot_sl"
+ " from despatchdet where desp_id = ? order by line_no";
pstmt= conn.prepareStatement(sql); pstmt= conn.prepareStatement(sql);
//System.out.println("Second sql ["+sql + "]"); //System.out.println("Second sql ["+sql + "]");
pstmt.setString( 1, tranId ); pstmt.setString( 1, tranId );
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
while(rs.next()) while(rs.next())
{ {
lotsl = rs.getString(1) == null ? "":rs.getString(1); itemCode=rs.getString("item_code")==null ? "" : rs.getString("item_code").trim();
locCode=rs.getString("loc_code")==null ? "" : rs.getString("loc_code").trim();
sql = "select quantity,site_code from despatchdet where desp_id = ? and lot_sl = ?"; siteCode=rs.getString("site_code") == null ? "" : rs.getString("site_code");
pstmt1= conn.prepareStatement(sql); locCode=rs.getString("loc_code") == null ? "" : rs.getString("loc_code");
//System.out.println("Second sql ["+sql + "]"); lotNo=rs.getString("lot_no")== null ? "" : rs.getString("lot_no").trim();
pstmt1.setString( 1, tranId ); lotSl=rs.getString("lot_sl") == null ? "" : rs.getString("lot_sl").trim();
pstmt1.setString( 2, lotsl ); //UPDATE stock SET ALLOC_QTY = CASE WHEN ALLOC_QTY IS NULL THEN 0 ELSE ALLOC_QTY END + ? WHERE site_code = ? AND LOT_SL = ? AND LOC_CODE = ? AND QUANTITY > 0;
rs1 = pstmt1.executeQuery(); sql = "UPDATE STOCK SET ALLOC_QTY = CASE WHEN ALLOC_QTY IS NULL THEN 0 ELSE ALLOC_QTY END + ? "
if(rs1.next()) + "WHERE ITEM_CODE = ? AND SITE_CODE = ? AND LOC_CODE = ? AND LOT_SL = ? AND "
{ + "LOT_NO = ? AND QUANTITY > 0";
quantity = rs1.getDouble("quantity");
siteCode = rs1.getString("site_code") == null ? "":rs1.getString("site_code");
}
if(rs1!=null){
rs1.close();
rs1 = null;
}
if(pstmt1 !=null){
pstmt1.close();
pstmt1 = null;
}
sql = "UPDATE stock SET ALLOC_QTY = ? WHERE site_code = ? AND LOT_SL = ? AND QUANTITY > 0";
pstmt1= conn.prepareStatement(sql); pstmt1= conn.prepareStatement(sql);
//System.out.println("First sql ["+ sql + "] tranId [" + tranId + "]"); //System.out.println("First sql ["+ sql + "] tranId [" + tranId + "]");
pstmt1.setDouble( 1, quantity); pstmt1.setDouble( 1, quantity);
pstmt1.setString( 2, siteCode); pstmt1.setString( 2, itemCode);
pstmt1.setString( 3, lotsl); pstmt1.setString( 3, siteCode);
pstmt1.setString( 4, locCode);
pstmt1.setString( 5, lotsl);
pstmt1.setString( 6, lotNo);
pstmt1.executeUpdate(); pstmt1.executeUpdate();
if(pstmt1 !=null){ if(pstmt1 !=null){
pstmt1.close(); pstmt1.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