Commit 09462a42 authored by jshinde's avatar jshinde

Changed by Samadhan on 28/11/2015 for finding full or partial pallet.


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@99282 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 485dbfb4
...@@ -1816,4 +1816,218 @@ public class CommonWmsUtil { ...@@ -1816,4 +1816,218 @@ public class CommonWmsUtil {
} }
return responseStr; return responseStr;
} }
//Changed by Samadhan on 28/11/2015 for finding full or partial pallet Start.
public static String getFullOrPrtialPalletOut(String palletNo,String refSer,String tranId,String siteCode,Connection conn) throws Exception
{
String result="F";
PreparedStatement pstmt = null;
ResultSet rs = null;
String sqlStr="";
PreparedStatement pstmtChk = null;
ResultSet rsChk = null;
String sqlStrChk="";
PreparedStatement pstChkDSO = null;
ResultSet rsChkDSO = null;
String sqlChkDSO="";
int count = 0;
ArrayList<HashMap<String, String>> stockList = new ArrayList<HashMap<String,String>>();
System.out.println("getFullOrPrtialPalletOut::Pallet No:"+palletNo);
System.out.println("getFullOrPrtialPalletOut::Ref Ser:"+refSer);
System.out.println("getFullOrPrtialPalletOut::Tran Id:"+tranId);
System.out.println("getFullOrPrtialPalletOut::Site Code:"+siteCode);
try
{
if("PR".equalsIgnoreCase(refSer))
{
result="F";
return result;
}
sqlStr = "SELECT ITEM_CODE,LOT_NO,LOT_SL,QUANTITY FROM STOCK WHERE QUANTITY > 0 AND LOC_CODE = '"+palletNo+"' AND SITE_CODE = '"+siteCode+"' AND INV_STAT='AWMS' ";
//sqlStr = "SELECT PALLET_NO,ITEM_CODE,LOT_NO,LOT_SL,QUANTITY FROM STOCK WHERE QUANTITY > 0 AND LOC_CODE = ? AND SITE_CODE = ? AND INV_STAT='AWMS' ";
System.out.println("SQL:"+sqlStr);
pstmt = conn.prepareStatement(sqlStr);
//pstmt.setString(1, palletNo);
//pstmt.setString(2, siteCode);
rs = pstmt.executeQuery();
while(rs.next())
{
HashMap<String,String> stockHashMap = new HashMap<String, String>();
stockHashMap.put("ITEM_CODE", rs.getString("ITEM_CODE").trim());
stockHashMap.put("LOT_NO", rs.getString("LOT_NO").trim());
stockHashMap.put("LOT_SL", rs.getString("LOT_SL").trim());
stockHashMap.put("QUANTITY",String.valueOf(rs.getInt("QUANTITY")));
stockList.add(stockHashMap);
}
pstmt.close();
rs.close();
if("PRS".equalsIgnoreCase(refSer))
{
for(Iterator<HashMap<String, String>> iter = stockList.iterator();iter.hasNext();)
{
HashMap<String, String> stock = iter.next();
/*sqlStrChk = "select count (*) FROM PALLET_REQ_DET where tran_id = '"+tranId+"' " +
"and PALLET_NO='"+palletNo+"' and " +
"lot_sl = '"+stock.get("LOT_SL")+"' and " +
"lot_no ='"+stock.get("LOT_NO")+"' and item_code='"+stock.get("ITEM_CODE")+"' and quantity ='"+stock.get("QUANTITY")+"'";
*/
sqlStrChk = "select count (*) FROM PALLET_REQ_DET where tran_id = ? " +
"and PALLET_NO=? and lot_sl = ? and " +
"lot_no =? and item_code=? and quantity = ?";
System.out.println(sqlStrChk);
pstmtChk = conn.prepareStatement(sqlStrChk);
pstmtChk.setString(1, tranId);
pstmtChk.setString(2, palletNo);
pstmtChk.setString(3, stock.get("LOT_SL"));
pstmtChk.setString(4, stock.get("LOT_NO"));
pstmtChk.setString(5, stock.get("ITEM_CODE"));
pstmtChk.setString(6, stock.get("QUANTITY"));
rsChk = pstmtChk.executeQuery();
count=0;
if(rsChk.next())
{
count = rsChk.getInt(1);
if(count == 0)
{
result = "P";
break;
}
}
pstmtChk.close();
rsChk.close();
}
}
else if("D-SO".equalsIgnoreCase(refSer))
{
for(Iterator<HashMap<String, String>> iter = stockList.iterator();iter.hasNext();)
{
HashMap<String, String> stock = iter.next();
/*sqlStrChk = "select sum(quantity) from distorder_alloc where dist_order = '"+tranId+"' " +
"and loc_code = '"+palletNo+"' and item_code='"+stock.get("ITEM_CODE")+"' and " +
"lot_no='"+stock.get("LOT_NO")+"' and lot_sl ='"+stock.get("LOT_SL")+"' group by " +
"loc_code,item_code,lot_no,lot_sl";*/
sqlStrChk = "select sum(quantity) from distorder_alloc where dist_order = ? " +
"and loc_code = ? and item_code=? and lot_no=? and lot_sl =? " +
"group by loc_code,item_code,lot_no,lot_sl";
System.out.println(sqlStrChk);
pstmtChk = conn.prepareStatement(sqlStrChk);
pstmtChk.setString(1, tranId);
pstmtChk.setString(2, palletNo);
pstmtChk.setString(3, stock.get("ITEM_CODE"));
pstmtChk.setString(4, stock.get("LOT_NO"));
pstmtChk.setString(5, stock.get("LOT_SL"));
rsChk = pstmtChk.executeQuery();
int stockQty = Integer.parseInt(stock.get("QUANTITY"));
System.out.println("Stock Quantity:"+stockQty);
if(rsChk.next())
{
int qnty = rsChk.getInt(1);
System.out.println("distorder_alloc Quantity"+qnty);
if(qnty != stockQty)
{
result ="P";
}
}
else
{
/*sqlChkDSO = "select sum(quantity) from distord_issdet where dist_order = '"+tranId+"' " +
"and loc_code = '"+palletNo+"' and item_code='"+stock.get("ITEM_CODE")+"' and " +
"lot_no='"+stock.get("LOT_NO")+"' and lot_sl ='"+stock.get("LOT_SL")+"' group by " +
"loc_code,item_code,lot_no,lot_sl";*/
sqlChkDSO = "select sum(quantity) from distord_issdet where dist_order = ? " +
"and loc_code = ? and item_code= ? and lot_no=? and lot_sl =? " +
"group by loc_code,item_code,lot_no,lot_sl";
System.out.println(sqlChkDSO);
pstChkDSO = conn.prepareStatement(sqlChkDSO);
pstmtChk.setString(1, tranId);
pstmtChk.setString(2, palletNo);
pstmtChk.setString(3, stock.get("ITEM_CODE"));
pstmtChk.setString(4, stock.get("LOT_NO"));
pstmtChk.setString(5, stock.get("LOT_SL"));
rsChkDSO = pstChkDSO.executeQuery();
count=0;
if(rsChkDSO.next())
{
int qnty = rsChkDSO.getInt(1);
System.out.println("distord_issdet Quantity"+qnty);
if(qnty != stockQty)
{
result ="P";
break;
}
}
else
{
result ="P";
break;
}
pstChkDSO.close();
rsChkDSO.close();
}
pstmtChk.close();
rsChk.close();
}
}
}
catch (Exception e)
{
throw e;
}
finally
{
if(pstmt !=null)
{
pstmt.close();
pstChkDSO = null;
}
if(rs !=null)
{
rs.close();
rs = null;
}
if(pstmtChk !=null)
{
pstmtChk.close();
pstmtChk = null;
}
if(rsChk !=null)
{
rsChk.close();
rsChk = null;
}
if(pstChkDSO !=null)
{
pstChkDSO.close();
pstChkDSO = null;
}
if(rsChkDSO !=null)
{
rsChkDSO.close();
rsChkDSO = null;
}
}
System.out.println("Result returning to Caller:" +result);
return result;
}
//Changed by Samadhan on 28/11/2015 for finding full or partial pallet End.
} }
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