Commit 4427f71b authored by ssalve's avatar ssalve

Sarita : Done changes on 18MARCH2018

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@182235 ce508802-f39f-4f6c-b175-0d175dae99d5
parent b64a4f82
......@@ -7,7 +7,10 @@ import java.sql.ResultSet;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import javax.ejb.Stateless;
......@@ -74,12 +77,15 @@ public class SRLContainerIC extends ValidatorEJB implements SRLContainerICRemote
PreparedStatement pstmt = null;
ResultSet rs = null ;
int currentFormNo = 0 , cnt = 0 , detlCnt = 0;
String updateFlag = "", detItemCode="", contentType = "", itemCodeDtl = "", quantity = "";
String updateFlag = "", detItemCode="", contentType = "", itemCodeDtl = "", quantity = "",lotSlExist="";
List<String> DetItemCodeList = new ArrayList<String>();
//Added by sarita on 18MARCH2018
HashMap<Integer,String> lotSlVal = null;
try
{
conn = getConnection();
//Added by sarita on 18MARCH2018
lotSlVal = new HashMap<Integer,String>();
if(objContext != null && objContext.trim().length() > 0)
{
currentFormNo = Integer.parseInt(objContext);
......@@ -169,7 +175,8 @@ public class SRLContainerIC extends ValidatorEJB implements SRLContainerICRemote
errList.add(errCode);
errFields.add("lot_no");
}
else if(lotNo != null && lotNo.length() > 0)
//Deleted by sarita on 18MARCH2018
/* else if(lotNo != null && lotNo.length() > 0)
{
sql = "select count(*) as cnt from Stock where lot_no=?";
pstmt = conn.prepareStatement(sql);
......@@ -196,13 +203,16 @@ public class SRLContainerIC extends ValidatorEJB implements SRLContainerICRemote
errFields.add("lot_no");
}
}
//}
//} */
}//end of validation for lot_no
else if("lot_sl".equalsIgnoreCase(childNodeName))
{
itemCode = checkNullAndTrim(genericUtility.getColumnValue("item_code",dom)).trim();
lotNo = checkNullAndTrim(genericUtility.getColumnValue("lot_no",dom)).trim();
lotSl = checkNullAndTrim(genericUtility.getColumnValue("lot_sl",dom)).trim();
System.out.println("[Lot SL ["+lotSl+"]]");
System.out.println("Lot SL Validation of Header foritemCode["+itemCode+"] , lotNo["+lotNo+"], lotSl["+lotSl+"]");
if(lotSl == null || lotSl.trim().trim().length() == 0)
{
......@@ -210,33 +220,59 @@ public class SRLContainerIC extends ValidatorEJB implements SRLContainerICRemote
errList.add(errCode);
errFields.add("lot_sl");
}
//Added by sarita on 18MARCH2018
else if(lotSl != null && lotSl.length() > 0)
{
sql = "select count(*) as cnt from Stock where lot_sl=?";
if(lotNo != null && lotNo.trim().length() >0)
{
if(itemCode != null && itemCode.trim().length() > 0)
{
sql = "select count(*) as cnt from stock where item_code=? and lot_no=? and lot_sl=? and quantity > 0";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,lotSl);
pstmt.setString(1, itemCode);
pstmt.setString(2, lotNo);
pstmt.setString(3, lotSl);
rs = pstmt.executeQuery();
if(rs.next())
{
cnt = rs.getInt("cnt");
System.out.println("Count of Stock for item_code , lotNo and lotSL is ["+cnt+"]");
}
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(rs != null)
{
rs.close();
rs = null;
}
}
}
if(cnt == 0)
{
errCode = "STKVALLOSE";
errCode = "VTNOSTK";//No records of stock for item_code,lot_no and lot_sl
errList.add(errCode);
errFields.add("lot_sl");
}
else if(cnt > 1)
{
errCode = "INVRCDSTOC";//Multiple Records Found in stock for item_code,lot_no and lot_sl
errList.add(errCode);
errFields.add("lot_sl");
}
/* else
{
String serialNo = checkNullAndTrim(genericUtility.getColumnValue("serial_no",dom)).trim();
if(serialNo == null || serialNo.length() == 0)
{
serialNo = "*";
}
}*/ // Need to work on it
}//end of validation for lot_sl
}//-------------------- End of For Loop -----------------------------
......@@ -343,7 +379,7 @@ public class SRLContainerIC extends ValidatorEJB implements SRLContainerICRemote
}
}//end of validation for item_code
else if("lot_no".equalsIgnoreCase(childNodeName))
/*else if("lot_no".equalsIgnoreCase(childNodeName))
{
lotNo = checkNullAndTrim(genericUtility.getColumnValue("lot_no",dom)).trim();
contentType = checkNullAndTrim(genericUtility.getColumnValue("content_type", dom));
......@@ -384,12 +420,14 @@ public class SRLContainerIC extends ValidatorEJB implements SRLContainerICRemote
errFields.add("lot_no");
}
}
}//end of validation for lot_no
}//end of validation for lot_no*/
else if("lot_sl".equalsIgnoreCase(childNodeName))
{
itemCode = checkNullAndTrim(genericUtility.getColumnValue("item_code", dom1));
lotSl = checkNullAndTrim(genericUtility.getColumnValue("lot_sl",dom)).trim();
System.out.println("[Lot SL ["+lotSl+"]]");
lotNo = checkNullAndTrim(genericUtility.getColumnValue("lot_no",dom)).trim();
System.out.println("Lot SL Validation in Detail :::: [itemCode["+itemCode+"] , lotSl["+lotSl+"] , lotNo["+lotNo+"]]");
if(lotSl == null || lotSl.trim().length() == 0)
{
......@@ -397,11 +435,13 @@ public class SRLContainerIC extends ValidatorEJB implements SRLContainerICRemote
errList.add(errCode);
errFields.add("lot_sl");
}
else if(lotSl != null && lotSl.length() > 0)
if(lotSl != null && lotSl.length() > 0)
{
sql = "select count(*) as cnt from Stock where lot_sl=?";
sql = "select count(*) as cnt from stock where item_code=? and lot_no=? and lot_sl=? and quantity > 0";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,lotSl);
pstmt.setString(1, itemCode);
pstmt.setString(2, lotNo);
pstmt.setString(3, lotSl);
rs = pstmt.executeQuery();
if(rs.next())
{
......@@ -423,6 +463,39 @@ public class SRLContainerIC extends ValidatorEJB implements SRLContainerICRemote
errList.add(errCode);
errFields.add("lot_sl");
}
//Added by sarita on 18MARCH2018
else
{
System.out.println("Value of ItemCode and LotNumber in Details Screen : +itemCode["+itemCode+"] , lotNo["+lotNo+"]");
System.out.println("detailString value is =="+genericUtility.serializeDom(dom2));
NodeList detailNoteList = dom2.getElementsByTagName("Detail2");
for(int cntr = 0;cntr<detailNoteList.getLength();cntr++)
{
Node pNode=detailNoteList.item(cntr);
childNodeName = pNode.getNodeName();
updateFlag = getAttributeVal(pNode,"updateFlag");
if("D".equalsIgnoreCase(updateFlag))
{
continue;
}
else
{
lotSlExist = checkNullAndTrim(genericUtility.getColumnValueFromNode("lot_sl", pNode));
System.out.println("Lot SL Value is XML:::"+lotSlExist);
System.out.println("Current Lot SL Value is :::"+lotSl);
if(!(lotSlVal.isEmpty()) && (lotSlVal.containsValue(lotSlExist) ) && !("D".equalsIgnoreCase(updateFlag)))
{
errCode = "INVDTLRCD";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
else
{
lotSlVal.put(cntr, lotSlExist);
}
}
}
}
}
}//end of validation for lot_sl
......@@ -441,7 +514,7 @@ public class SRLContainerIC extends ValidatorEJB implements SRLContainerICRemote
try
{
int qty = Integer.parseInt(quantity);
if(qty == 0)
if(qty == 0 || qty < 0)
{
errCode = "VMNOART";
errList.add(errCode);
......@@ -968,6 +1041,47 @@ public class SRLContainerIC extends ValidatorEJB implements SRLContainerICRemote
return AttribValue;
}//end of method getAttributeVal
/* private int duplicateDetailRecoeds(String itemCode , String lotNo, String lotSl,Document dom2) throws ITMException
{
int duplicateRecord = 0;
String updateFlag = "";
NodeList parentNodeList = null;
int parentNodeListLength = 0;
//Set<List<String>> listSet = null;
try
{
parentNodeList = dom2.getElementsByTagName("Detail2");
parentNodeListLength = parentNodeList.getLength();
String itemCodeTmp = "",lotNoTemp="",lotSlTemp="";
for(int ptr = 0; ptr < parentNodeListLength; ptr++)
{
Node pNode=parentNodeList.item(ptr);
updateFlag = getAttributeVal(pNode,"updateFlag");
System.out.println("Update Flag is ::"+updateFlag);
if("D".equalsIgnoreCase(updateFlag) == false)
{
itemCodeTmp = genericUtility.getColumnValueFromNode("item_code", dom2);
lotNoTemp = genericUtility.getColumnValueFromNode("lot_no", dom2);
lotSlTemp = genericUtility.getColumnValueFromNode("lot_sl", dom2);
if((lotSlTemp.equalsIgnoreCase(lotSl)))
{
duplicateRecord = 1;
}
System.out.println("Values in duplicateDetailRecoeds [itemCode ["+itemCode+"] , lotNo ["+lotNo+"] , [lotSl ["+lotSl+"]] ");
}
}
}
catch(Exception e)
{
System.out.println("Exception in method duplicateDetailRecoeds :"+e);
throw new ITMException(e);
}
return duplicateRecord;
}*/
}//end of class SRLContainerIC
......
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