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;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -115,7 +116,7 @@ public class DistIssWiz extends ValidatorEJB implements DistIssWizLocal, DistIss
String errString = "";
String errCode = "";
Connection conn = null;
String userId = "";
String userId = "",qcLockValue ="";
PreparedStatement pstmt = null ;
ResultSet rs = null;
String sql = "",locCode ="",invstat="",aval="",avalyn="";
......@@ -464,6 +465,7 @@ public class DistIssWiz extends ValidatorEJB implements DistIssWizLocal, DistIss
locCode = genericUtility.getColumnValue("loc_code",dom2);
lotno = genericUtility.getColumnValue("lot_no",dom2);
tranId = genericUtility.getColumnValue("tran_id",dom2);
ArrayList<String> lockList=new ArrayList<String>();
HashMap<String,String>invHoldMap=new HashMap<String,String>();
invHoldMap.put("item_code", itemCode);
......@@ -486,16 +488,19 @@ public class DistIssWiz extends ValidatorEJB implements DistIssWizLocal, DistIss
}
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(cnt == 0){
//Error
if(otherLockCount > 0){
errCode = "DIDOLKCINC";//Despatch can not be created as qunaity is on hold.
errString = getErrorString("quantity",errCode,userId);
break;
}
}
......@@ -718,7 +723,7 @@ public class DistIssWiz extends ValidatorEJB implements DistIssWizLocal, DistIss
java.sql.Timestamp currDate = null;
double grossWeight = 0,netWeight=0,tareWeight=0,noOfArt=0,allQty=0,setQty=0;
SimpleDateFormat sdf = null;
String currAppdate = "";
String currAppdate = "",qcLockValue="";
String tranid ="";
String rate = "";
double amount = 0;
......@@ -2206,11 +2211,12 @@ public class DistIssWiz extends ValidatorEJB implements DistIssWizLocal, DistIss
if("Y".equalsIgnoreCase(avalyn))
{
setQty = squantity - (allQty + holdQty);
setQty = squantity - allQty;
}
else
{
setQty = squantity - allQty;
setQty = squantity - (allQty + holdQty);
}
valueXmlString.append("<quantity protect=\"0\">").append("<![CDATA[" + setQty + "]]>").append("</quantity>");
......@@ -2368,23 +2374,19 @@ public class DistIssWiz extends ValidatorEJB implements DistIssWizLocal, DistIss
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------");
ResultSet rs=null;
PreparedStatement pstmt=null;
String sql="",holdQty="",countS="",qcLockValue="";
int count=0;
try{
qcLockValue=getColumnDescr(conn, "var_value", "disparm", "var_name", "QUARNTINE_LOCKCODE");
qcLockValue = qcLockValue == null ? "": qcLockValue.trim();
System.out.println("qcLockValue------->>["+qcLockValue+"]");
String sql="";
ArrayList<String> lockListL=new ArrayList<String>();
try{
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.loc_code = ? and d.lot_no= ? AND h.CONFIRMED= ? "
+"and d.lot_sl= ? and h.lock_code = ?";
+"and d.loc_code = ? and d.lot_no= ? AND h.confirmed= ? "
+"and d.lot_sl= ? and d.hold_status = ? ";
pstmt=conn.prepareStatement(sql);
pstmt.setString(1, invHoldMap.get("item_code"));
pstmt.setString(2, invHoldMap.get("site_code"));
......@@ -2392,10 +2394,11 @@ public class DistIssWiz extends ValidatorEJB implements DistIssWizLocal, DistIss
pstmt.setString(4, invHoldMap.get("lot_no"));
pstmt.setString(5, "Y");
pstmt.setString(6, invHoldMap.get("lot_sl"));
pstmt.setString(7, qcLockValue);
pstmt.setString(7, "H");
rs=pstmt.executeQuery();
if(rs.next()){
count=rs.getInt(1);
while(rs.next()){
lockListL.add(rs.getString(1) == null ? "":rs.getString(1).trim());
}
if(rs!=null){
rs.close();
......@@ -2406,37 +2409,13 @@ public class DistIssWiz extends ValidatorEJB implements DistIssWizLocal, DistIss
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){
e.printStackTrace();
}
holdQty=holdQty==null ? "0" : holdQty.trim();
countS=Integer.toString(count);
System.out.println("count---->>["+count+"]");
return count;
return lockListL;
}
......
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