Commit 457a90f9 authored by dsawant's avatar dsawant

updated for available yn changes


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@96387 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 2ab77158
...@@ -23,6 +23,7 @@ import java.text.NumberFormat; ...@@ -23,6 +23,7 @@ import java.text.NumberFormat;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -115,7 +116,7 @@ public class DistIssWiz extends ValidatorEJB implements DistIssWizLocal, DistIss ...@@ -115,7 +116,7 @@ public class DistIssWiz extends ValidatorEJB implements DistIssWizLocal, DistIss
String errString = ""; String errString = "";
String errCode = ""; String errCode = "";
Connection conn = null; Connection conn = null;
String userId = ""; String userId = "",qcLockValue ="";
PreparedStatement pstmt = null ; PreparedStatement pstmt = null ;
ResultSet rs = null; ResultSet rs = null;
String sql = "",locCode ="",invstat="",aval="",avalyn=""; String sql = "",locCode ="",invstat="",aval="",avalyn="";
...@@ -464,6 +465,7 @@ public class DistIssWiz extends ValidatorEJB implements DistIssWizLocal, DistIss ...@@ -464,6 +465,7 @@ public class DistIssWiz extends ValidatorEJB implements DistIssWizLocal, DistIss
locCode = genericUtility.getColumnValue("loc_code",dom2); locCode = genericUtility.getColumnValue("loc_code",dom2);
lotno = genericUtility.getColumnValue("lot_no",dom2); lotno = genericUtility.getColumnValue("lot_no",dom2);
tranId = genericUtility.getColumnValue("tran_id",dom2); tranId = genericUtility.getColumnValue("tran_id",dom2);
ArrayList<String> lockList=new ArrayList<String>();
HashMap<String,String>invHoldMap=new HashMap<String,String>(); HashMap<String,String>invHoldMap=new HashMap<String,String>();
invHoldMap.put("item_code", itemCode); invHoldMap.put("item_code", itemCode);
...@@ -486,18 +488,21 @@ public class DistIssWiz extends ValidatorEJB implements DistIssWizLocal, DistIss ...@@ -486,18 +488,21 @@ public class DistIssWiz extends ValidatorEJB implements DistIssWizLocal, DistIss
} }
System.out.println("quantity>>>>>>{{{"+quantity); System.out.println("quantity>>>>>>{{{"+quantity);
cnt=getInvHoldCount(invHoldMap, conn); qcLockValue=getColumnDescr(conn, "var_value", "disparm", "var_name", "QUARNTINE_LOCKCODE");
System.out.println("qcLockValue-------->>["+qcLockValue+"]");
lockList=getInvHoldQCLock(invHoldMap, conn);
System.out.println("Return lockList-------->>["+lockList+"]");
int listCount=lockList.size();
int occurence=Collections.frequency(lockList, qcLockValue);
int otherLockCount= listCount - occurence;
System.out.println("Occurence-------->>["+occurence+"]");
if("N".equalsIgnoreCase(avalyn)){ if("N".equalsIgnoreCase(avalyn)){
if(cnt == 0){ if(otherLockCount > 0){
//Error
errCode = "DIDOLKCINC";//Despatch can not be created as qunaity is on hold. errCode = "DIDOLKCINC";//Despatch can not be created as qunaity is on hold.
errString = getErrorString("quantity",errCode,userId); errString = getErrorString("quantity",errCode,userId);
break; break;
} }
} }
/*sql = "select quantity from stock where site_code = ? AND LOT_SL = ? AND QUANTITY > 0"; /*sql = "select quantity from stock where site_code = ? AND LOT_SL = ? AND QUANTITY > 0";
pstmt=conn.prepareStatement(sql); pstmt=conn.prepareStatement(sql);
...@@ -718,7 +723,7 @@ public class DistIssWiz extends ValidatorEJB implements DistIssWizLocal, DistIss ...@@ -718,7 +723,7 @@ public class DistIssWiz extends ValidatorEJB implements DistIssWizLocal, DistIss
java.sql.Timestamp currDate = null; java.sql.Timestamp currDate = null;
double grossWeight = 0,netWeight=0,tareWeight=0,noOfArt=0,allQty=0,setQty=0; double grossWeight = 0,netWeight=0,tareWeight=0,noOfArt=0,allQty=0,setQty=0;
SimpleDateFormat sdf = null; SimpleDateFormat sdf = null;
String currAppdate = ""; String currAppdate = "",qcLockValue="";
String tranid =""; String tranid ="";
String rate = ""; String rate = "";
double amount = 0; double amount = 0;
...@@ -2206,11 +2211,12 @@ public class DistIssWiz extends ValidatorEJB implements DistIssWizLocal, DistIss ...@@ -2206,11 +2211,12 @@ public class DistIssWiz extends ValidatorEJB implements DistIssWizLocal, DistIss
if("Y".equalsIgnoreCase(avalyn)) if("Y".equalsIgnoreCase(avalyn))
{ {
setQty = squantity - (allQty + holdQty); setQty = squantity - allQty;
} }
else else
{ {
setQty = squantity - allQty; setQty = squantity - (allQty + holdQty);
} }
valueXmlString.append("<quantity protect=\"0\">").append("<![CDATA[" + setQty + "]]>").append("</quantity>"); valueXmlString.append("<quantity protect=\"0\">").append("<![CDATA[" + setQty + "]]>").append("</quantity>");
...@@ -2368,23 +2374,19 @@ public class DistIssWiz extends ValidatorEJB implements DistIssWizLocal, DistIss ...@@ -2368,23 +2374,19 @@ public class DistIssWiz extends ValidatorEJB implements DistIssWizLocal, DistIss
return valueXmlString.toString(); return valueXmlString.toString();
} }
private int getInvHoldCount(Map<String,String> invHoldMap,Connection conn) private ArrayList<String> getInvHoldQCLock(Map<String,String> invHoldMap,Connection conn)
{ {
System.out.println("----in getInvHoldQuantity method------"); System.out.println("----in getInvHoldQuantity method------");
ResultSet rs=null; ResultSet rs=null;
PreparedStatement pstmt=null; PreparedStatement pstmt=null;
String sql="",holdQty="",countS="",qcLockValue=""; String sql="";
int count=0; ArrayList<String> lockListL=new ArrayList<String>();
try{
qcLockValue=getColumnDescr(conn, "var_value", "disparm", "var_name", "QUARNTINE_LOCKCODE"); try{
qcLockValue = qcLockValue == null ? "": qcLockValue.trim();
System.out.println("qcLockValue------->>["+qcLockValue+"]");
sql="select count(*) from inv_hold h,inv_hold_det d where h.tran_id = d.tran_id " sql="select count(*) from inv_hold h,inv_hold_det d where h.tran_id = d.tran_id "
+"and d.item_code = ? and d.site_code = ? " +"and d.item_code = ? and d.site_code = ? "
+"and d.loc_code = ? and d.lot_no= ? AND h.CONFIRMED= ? " +"and d.loc_code = ? and d.lot_no= ? AND h.confirmed= ? "
+"and d.lot_sl= ? and h.lock_code = ?"; +"and d.lot_sl= ? and d.hold_status = ? ";
pstmt=conn.prepareStatement(sql); pstmt=conn.prepareStatement(sql);
pstmt.setString(1, invHoldMap.get("item_code")); pstmt.setString(1, invHoldMap.get("item_code"));
pstmt.setString(2, invHoldMap.get("site_code")); pstmt.setString(2, invHoldMap.get("site_code"));
...@@ -2392,10 +2394,11 @@ public class DistIssWiz extends ValidatorEJB implements DistIssWizLocal, DistIss ...@@ -2392,10 +2394,11 @@ public class DistIssWiz extends ValidatorEJB implements DistIssWizLocal, DistIss
pstmt.setString(4, invHoldMap.get("lot_no")); pstmt.setString(4, invHoldMap.get("lot_no"));
pstmt.setString(5, "Y"); pstmt.setString(5, "Y");
pstmt.setString(6, invHoldMap.get("lot_sl")); pstmt.setString(6, invHoldMap.get("lot_sl"));
pstmt.setString(7, qcLockValue); pstmt.setString(7, "H");
rs=pstmt.executeQuery(); rs=pstmt.executeQuery();
if(rs.next()){ while(rs.next()){
count=rs.getInt(1); lockListL.add(rs.getString(1) == null ? "":rs.getString(1).trim());
} }
if(rs!=null){ if(rs!=null){
rs.close(); rs.close();
...@@ -2406,38 +2409,14 @@ public class DistIssWiz extends ValidatorEJB implements DistIssWizLocal, DistIss ...@@ -2406,38 +2409,14 @@ public class DistIssWiz extends ValidatorEJB implements DistIssWizLocal, DistIss
pstmt=null; pstmt=null;
} }
/*sql="select hold_qty FROM stock where "
+ "item_code = ? and site_code = ? and loc_code = ? and lot_no = ? and lot_sl= ?";
pstmt=conn.prepareStatement(sql);
pstmt.setString(1, invHoldMap.get("item_code"));
pstmt.setString(2, invHoldMap.get("site_code"));
pstmt.setString(3, invHoldMap.get("loc_code"));
pstmt.setString(4, invHoldMap.get("lot_no"));
pstmt.setString(5, invHoldMap.get("lot_sl"));
rs=pstmt.executeQuery();
if(rs.next()){
holdQty=rs.getString("hold_qty");
}
if(rs!=null){
rs.close();
rs=null;
}
if(pstmt!=null){
pstmt.close();
pstmt=null;
}*/
} }
catch(Exception e){ catch(Exception e){
e.printStackTrace(); e.printStackTrace();
} }
holdQty=holdQty==null ? "0" : holdQty.trim();
countS=Integer.toString(count);
System.out.println("count---->>["+count+"]");
return count; return lockListL;
} }
private String getColumnDescr(Connection conn, String columnName ,String tableName, String columnName2, String value) private String getColumnDescr(Connection conn, String columnName ,String tableName, String columnName2, String value)
......
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