Commit 0a0b7727 authored by manohar's avatar manohar

changes done at SUN merged


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@91813 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 7e106a6b
......@@ -42,6 +42,7 @@ public class StockAllocIc extends ValidatorEJB implements StockAllocIcLocal, Sto
{
System.out.println("Val xmlString :: " + xmlString);
System.out.println("Val xmlString1 :: " + xmlString1);
System.out.println("Val xmlString2 :: " + xmlString2);
dom = parseString(xmlString);
dom1 = parseString(xmlString1);
dom2 = parseString(xmlString2);
......@@ -77,9 +78,14 @@ public class StockAllocIc extends ValidatorEJB implements StockAllocIcLocal, Sto
String quantity = "";
String lineNoSord = "";
String expLev = "";
//Changed By Rohan on 10/07/12 To add validation sale order.start
String saleOrderHdr = "";
String sqlSOrder = "";
//Changed By Rohan on 10/07/12 To add validation sale order.end
int ctr=0;
int cnt = 0;
int cnt1 = 0;
double pendingQty = 0.0;
int currentFormNo = 0;
int childNodeListLength;
......@@ -194,6 +200,9 @@ public class StockAllocIc extends ValidatorEJB implements StockAllocIcLocal, Sto
parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes();
childNodeListLength = childNodeList.getLength();
//Changed By Rohan on 10/17/12 to add validation on sale order
saleOrderHdr = genericUtility.getColumnValue("sale_order", dom1 );
System.out.println("saleOrderHdr==*****==>"+saleOrderHdr);
for(ctr = 0; ctr < childNodeListLength; ctr ++)
{
childNode = childNodeList.item(ctr);
......@@ -226,6 +235,15 @@ public class StockAllocIc extends ValidatorEJB implements StockAllocIcLocal, Sto
}
rs.close(); rs = null;
pstmt.close(); pstmt = null;
//Changed by Rohan on 10/07/12 To addvalidation on hdr & Detail.start
if(!(saleOrder.equalsIgnoreCase(saleOrderHdr)))
{
errCode = "VMSORDER";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
//Changed by Rohan on 10/07/12 To addvalidation on hdr & Detail.end
}
}
......@@ -387,6 +405,77 @@ public class StockAllocIc extends ValidatorEJB implements StockAllocIcLocal, Sto
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
//Change by Rohan on 10/07/12 To check.start
itemCode = genericUtility.getColumnValue("item_code", dom);
siteCode = genericUtility.getColumnValue("site_code", dom);
locCode = genericUtility.getColumnValue("loc_code", dom);
lotNo = genericUtility.getColumnValue("lot_no", dom);
Map tempMap = new HashMap();
Map currentDetailMap = new HashMap();
ArrayList tempList = new ArrayList();
tempMap.put("item_code", itemCode);
tempMap.put("site_code", siteCode);
tempMap.put("loc_code", locCode);
tempMap.put("lot_no", lotNo);
tempMap.put("lot_sl", lotSl);
System.out.println(" temp map "+tempMap);
tempList.add(tempMap);
currentDetailMap.put("Detail2", tempList);
System.out.println(" current detail map "+currentDetailMap);
/*
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
*/
System.out.println("itemCode"+itemCode+"siteCode"+siteCode+"locCode"+locCode+"lotNo"+lotNo+"lotSl"+lotSl);
sql = " select count(*) as CN1 from stock where item_code = ? and site_code = ? and loc_code = ? "
+" and lot_no = ? and lot_sl = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,itemCode);
pstmt.setString(2,siteCode);
pstmt.setString(3,locCode);
pstmt.setString(4,lotNo);
pstmt.setString(5,lotSl);
rs = pstmt.executeQuery();
if(rs.next())
{
cnt1 = rs.getInt("CN1");
if(cnt1 == 0)
{
errCode = "VTNTFOUND";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
//Changed by sumit on 21/08/12 checking for repeating detail start.
else
{
boolean isDupDetail = checkDetail(dom2, conn);
if(isDupDetail)
{
errCode = "DUPDETAIL2";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
//Changed by sumit on 21/08/12 checking for repeating detail end.
}
rs.close(); rs = null;
pstmt.close(); pstmt = null;
//Change by Rohan on 10/07/12 To check.end
}
else if(childNodeName.equalsIgnoreCase("quantity"))
{
......@@ -854,5 +943,86 @@ public class StockAllocIc extends ValidatorEJB implements StockAllocIcLocal, Sto
return input;
}
//Changed by sumit on 21/08/12 checking duplicate deatil start
private boolean checkDetail(Document allDom, Connection conn) throws ITMException
{
String itemCode = "", siteCode ="", locCode = "", lotSl = "", lotNo ="";
NodeList parentNodeList = null, childNodeList = null;
Node parentNode = null, childNode = null;
int parentNodeListLength = 0;
String childNodeName = "";
String domID = "";
Map detailMap = new HashMap();
boolean isDupDetail = false;
try {
parentNodeList = allDom.getElementsByTagName("Detail2");
parentNodeListLength = parentNodeList.getLength();
for (int row = 0; row < parentNodeList.getLength(); row++)
{
parentNode = parentNodeList.item(row);
childNodeList = parentNode.getChildNodes();
System.out.println("************* first For loop *************["+ parentNode.getNodeName() + "]");
for (int col = 0; col < childNodeList.getLength(); col++) {
childNode = childNodeList.item(col);
domID = parentNode.getAttributes().getNamedItem("domID").getNodeValue();
if (childNode.getNodeType() == childNode.ELEMENT_NODE)
{
childNodeName = childNode.getNodeName();
//domID = parentNode.getAttributes().getNamedItem("domID").getNodeValue();
//System.out.println("=======--======== ["+domID+"]");
//System.out.println("childNodeNamechildNodeName ** ["+childNodeName+"]");
if ("item_code".equalsIgnoreCase(childNodeName))
{
itemCode = childNode.getFirstChild().getNodeValue().trim();
}
else if ("site_code".equalsIgnoreCase(childNodeName))
{
siteCode = childNode.getFirstChild().getNodeValue().trim();
}
else if ("loc_code".equalsIgnoreCase(childNodeName))
{
locCode = childNode.getFirstChild().getNodeValue().trim();
}
else if ("lot_no".equalsIgnoreCase(childNodeName))
{
lotNo = childNode.getFirstChild().getNodeValue().trim();
}
else if ("lot_sl".equalsIgnoreCase(childNodeName))
{
lotSl = childNode.getFirstChild().getNodeValue().trim();
/*arryList.add(childNode.getFirstChild().getNodeValue().trim());
tempMap.put("lot_sl", childNode.getFirstChild().getNodeValue().trim());*/
}
}
}
/*tempList.add(tempMap);
System.out.println(" detail arrayaList "+arryList);*/
if(detailMap.containsKey(itemCode+siteCode+locCode+lotNo+lotSl))
{
isDupDetail = true;
}
else
{
detailMap.put(itemCode+siteCode+locCode+lotNo+lotSl, "Detail2:"+domID);
}
System.out.println(" detailMap in checkdetail "+detailMap);
System.out.println(" isDupDetail "+isDupDetail);
}
}
catch (Exception e)
{
System.out.println( "Exception : StockAllocIc:wfValData:checkDetail : " + e.getMessage() );
throw new ITMException(e);
}
return isDupDetail;
}
//Changed by sumit on 21/08/12 checking duplicate deatil end.
}
This diff is collapsed.
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