Commit a65bf027 authored by jshinde's avatar jshinde

Request Id:[W16CSUN010] Quantity updation in physical count:

In Physical count transaction Stock quantity should get set in physcandet table


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@102097 ce508802-f39f-4f6c-b175-0d175dae99d5
parent ff670e5a
......@@ -27,7 +27,7 @@ import org.w3c.dom.*;
public class PhysicalCountIC extends ValidatorEJB implements PhysicalCountICLocal, PhysicalCountICRemote
{
E12GenericUtility genericUtility = new E12GenericUtility();
@Override
public String wfValData() throws RemoteException, ITMException
{
......@@ -106,21 +106,21 @@ public class PhysicalCountIC extends ValidatorEJB implements PhysicalCountICLoca
ArrayList <String> errList = new ArrayList<String>();
ArrayList <String> errFields = new ArrayList <String> ();
String locCode = "", itemCode = "", siteCode = "", lotNo = "", lotSl = "";
String locCode = "", itemCode = "", siteCode = "", lotNo = "", lotSl = "",sql= "";
int locationCount = 0, itemCodeCount = 0, lotNoCount = 0, lotSlCount = 0;
try
{
System.out.println("<<========= Inside wfValData ===========>>"); // remove
ConnDriver connDriver = new ConnDriver();
conn = connDriver.getConnectDB("DriverITM");
conn.setAutoCommit(false);
connDriver = null;
userId = getValueFromXTRA_PARAMS(xtraParams, "loginCode");
siteCode = getValueFromXTRA_PARAMS(xtraParams, "loginSiteCode");
System.out.println("xtraParam----->>["+xtraParams+"]");
System.out.println("DOM---->>["+genericUtility.serializeDom(dom).toString()+"]");
System.out.println("DOM1----->>["+genericUtility.serializeDom(dom1).toString()+"]");
......@@ -134,23 +134,23 @@ public class PhysicalCountIC extends ValidatorEJB implements PhysicalCountICLoca
switch ( currentFormNo )
{
case 1:
System.out.println("------in detail1 validation----------------");
break;
case 2:
System.out.println("------in detail2 validation----------------");
locCode = checkNullAndTrim(genericUtility.getColumnValue("loc_code",dom2));
itemCode = checkNullAndTrim(genericUtility.getColumnValue("item_code",dom2));
lotNo = checkNullAndTrim(genericUtility.getColumnValue("lot_no",dom2));
lotSl = checkNullAndTrim(genericUtility.getColumnValue("lot_sl",dom2));
System.out.println(" locCode in detail2 case2 ========>>"+locCode);
System.out.println(" itemCode in detail2 case2 ========>>"+itemCode);
System.out.println(" lotNo in detail2 case2 ========>>"+lotNo);
System.out.println(" lot_sl in detail2 case2 ========>>"+lotSl);
parentNodeList = dom2.getElementsByTagName("Detail2");
parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes();
......@@ -161,7 +161,7 @@ public class PhysicalCountIC extends ValidatorEJB implements PhysicalCountICLoca
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
//System.out.println("value of child node name ["+childNodeName + "]");
if("loc_code".equalsIgnoreCase(childNodeName))
{
if(locCode.length() == 0 || locCode.equalsIgnoreCase("")) //BLANK
......@@ -221,7 +221,7 @@ public class PhysicalCountIC extends ValidatorEJB implements PhysicalCountICLoca
else
{
lotNoCount = getLotNoCount(siteCode, locCode, itemCode, lotNo, conn);
if(lotNoCount == 0)
{
//System.out.println("<<========== No lotNo found =============>> ");
......@@ -245,7 +245,7 @@ public class PhysicalCountIC extends ValidatorEJB implements PhysicalCountICLoca
else
{
lotSlCount = getLotSlCount(siteCode, locCode, itemCode, lotNo, lotSl, conn);
if(lotSlCount == 0)
{
//System.out.println("<<========== No lotSl found =============>> ");
......@@ -391,7 +391,7 @@ public class PhysicalCountIC extends ValidatorEJB implements PhysicalCountICLoca
Document hdrDataDom = null;
Document allFormDataDom = null;
String errString = null;
System.out.println("xmlString in itemChanged ["+xmlString+"]");
System.out.println("xmlString1 in itemChanged ["+xmlString1+"]");
System.out.println("xmlString2 in itemChanged ["+xmlString2+"]");
......@@ -428,20 +428,24 @@ public class PhysicalCountIC extends ValidatorEJB implements PhysicalCountICLoca
{
Connection conn = null;
int currentFormNo = 0;
String chgUser = "", chgTerm = "", loginSite = "", locCode = "", locDescr = "", itemCode = "", itemDescr = "", unit = "";
String chgUser = "", chgTerm = "", loginSite = "", locCode = "", locDescr = "", itemCode = "", itemDescr = "", unit = ""
,lotSl ="" ,lotNo="",sql= "";
StringBuffer valueXmlString;
double quantity=0;
valueXmlString = new StringBuffer("<?xml version=\"1.0\"?>\r\n<Root>\r\n<Header>\r\n<editFlag>").append(editFlag);
System.out.println("xtraParams=["+xtraParams+"]");
System.out.println("Physical Count itemChanged Called........................... : ["+currentColumn+"]");
try
{
System.out.println("<<========= Inside wfValData ===========>>"); // remove
System.out.println("<<========= Inside itemChanged ===========>>"); // remove
ConnDriver connDriver = new ConnDriver();
conn = connDriver.getConnectDB( "DriverITM" );
connDriver = null;
PreparedStatement pstmt = null;
ResultSet rs= null;
Calendar currentDate = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat(genericUtility.getApplDateFormat());
String currDate = sdf.format(currentDate.getTime());
......@@ -449,7 +453,7 @@ public class PhysicalCountIC extends ValidatorEJB implements PhysicalCountICLoca
System.out.println("hdrDataDom------->>["+genericUtility.serializeDom(hdrDataDom)+"]");
System.out.println("currFormDataDom------>>["+genericUtility.serializeDom(currFormDataDom)+"]");
System.out.println("allFormDataDom------>>["+genericUtility.serializeDom(allFormDataDom)+"]");
loginSite = checkNull(genericUtility.getValueFromXTRA_PARAMS( xtraParams, "loginSiteCode" ));
chgUser = checkNull(genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode"));
chgTerm = checkNull(genericUtility.getValueFromXTRA_PARAMS(xtraParams, "termId"));
......@@ -460,76 +464,114 @@ public class PhysicalCountIC extends ValidatorEJB implements PhysicalCountICLoca
currentFormNo = Integer.parseInt( objContext );
}
System.out.println("current form no["+currentFormNo+"]");
valueXmlString.append("</editFlag>\r\n</Header>\r\n");
switch ( currentFormNo )
{
case 1:
case 1:
{
System.out.println("<<------------------- Inside case1 itemChanged physical count -------------------->>"); // remove
if( currentColumn.trim().equalsIgnoreCase( "itm_default" ) )
{
System.out.println("<<------------------- Inside case1 itemChanged physical count -------------------->>"); // remove
valueXmlString.append( "<Detail1>\r\n" );
valueXmlString.append( "<tran_date><![CDATA[" ).append( currDate ).append( "]]></tran_date>\r\n" );
valueXmlString.append( "<site_code><![CDATA[" ).append( loginSite ).append( "]]></site_code>\r\n" );
valueXmlString.append( "<confirmed><![CDATA[" ).append( "N" ).append( "]]></confirmed>\r\n" );
valueXmlString.append( "<chg_date><![CDATA[" ).append( currDate ).append( "]]></chg_date>\r\n" );
valueXmlString.append( "<chg_user><![CDATA[" ).append( chgUser ).append( "]]></chg_user>\r\n" );
valueXmlString.append( "<chg_term><![CDATA[" ).append( chgTerm ).append( "]]></chg_term>\r\n" );
valueXmlString.append("</Detail1>\r\n");
}
} //Case 1. End
break;
case 2:
{
System.out.println("<<------------------- Inside case2 itemChanged Physical count -------------------->>"); // remove
valueXmlString.append( "<Detail2>\r\n" );
if( currentColumn.trim().equalsIgnoreCase( "itm_default" ) )
if( currentColumn.trim().equalsIgnoreCase( "itm_default" ) )
{
valueXmlString.append( "<site_code><![CDATA[" ).append( loginSite ).append( "]]></site_code>\r\n" );
}
else if( currentColumn.trim().equalsIgnoreCase( "loc_code" ) )
{
locCode = checkNullAndTrim(genericUtility.getColumnValue("loc_code",currFormDataDom));
System.out.println("locCode ==========>> ["+locCode+"]"); // remove
if(locCode.length() > 0)
{
valueXmlString.append( "<Detail1>\r\n" );
valueXmlString.append( "<tran_date><![CDATA[" ).append( currDate ).append( "]]></tran_date>\r\n" );
valueXmlString.append( "<site_code><![CDATA[" ).append( loginSite ).append( "]]></site_code>\r\n" );
valueXmlString.append( "<confirmed><![CDATA[" ).append( "N" ).append( "]]></confirmed>\r\n" );
valueXmlString.append( "<chg_date><![CDATA[" ).append( currDate ).append( "]]></chg_date>\r\n" );
valueXmlString.append( "<chg_user><![CDATA[" ).append( chgUser ).append( "]]></chg_user>\r\n" );
valueXmlString.append( "<chg_term><![CDATA[" ).append( chgTerm ).append( "]]></chg_term>\r\n" );
valueXmlString.append("</Detail1>\r\n");
locDescr = checkNullAndTrim(getColumnDescr(conn, "descr", "location", "loc_code", locCode));
valueXmlString.append( "<location_descr><![CDATA[" ).append( locDescr ).append( "]]></location_descr>\r\n" );
}
} //Case 1. End
break;
case 2:
else
{
valueXmlString.append( "<location_descr><![CDATA[" ).append( "" ).append( "]]></location_descr>\r\n" );
}
}
else if( currentColumn.trim().equalsIgnoreCase( "item_code" ) )
{
System.out.println("<<------------------- Inside case2 itemChanged Physical count -------------------->>"); // remove
valueXmlString.append( "<Detail2>\r\n" );
if( currentColumn.trim().equalsIgnoreCase( "itm_default" ) )
itemCode = checkNullAndTrim(genericUtility.getColumnValue("item_code",currFormDataDom));
System.out.println("itemCode ==========>> ["+itemCode+"]"); // remove
if(itemCode.length() > 0)
{
valueXmlString.append( "<site_code><![CDATA[" ).append( loginSite ).append( "]]></site_code>\r\n" );
itemDescr = checkNullAndTrim(getColumnDescr(conn, "descr", "item", "item_code", itemCode));
unit = checkNullAndTrim(getColumnDescr(conn, "unit", "item", "item_code", itemCode));
valueXmlString.append( "<item_descr><![CDATA[" ).append( itemDescr ).append( "]]></item_descr>\r\n" );
valueXmlString.append( "<unit><![CDATA[" ).append( unit ).append( "]]></unit>\r\n" );
}
else if( currentColumn.trim().equalsIgnoreCase( "loc_code" ) )
{
locCode = checkNullAndTrim(genericUtility.getColumnValue("loc_code",currFormDataDom));
System.out.println("locCode ==========>> ["+locCode+"]"); // remove
if(locCode.length() > 0)
{
locDescr = checkNullAndTrim(getColumnDescr(conn, "descr", "location", "loc_code", locCode));
valueXmlString.append( "<location_descr><![CDATA[" ).append( locDescr ).append( "]]></location_descr>\r\n" );
}
else
{
valueXmlString.append( "<location_descr><![CDATA[" ).append( "" ).append( "]]></location_descr>\r\n" );
}
else
{
valueXmlString.append( "<item_descr><![CDATA[" ).append( "" ).append( "]]></item_descr>\r\n" );
valueXmlString.append( "<unit><![CDATA[" ).append( "" ).append( "]]></unit>\r\n" );
}
else if( currentColumn.trim().equalsIgnoreCase( "item_code" ) )
}
//Changed by Jagruti Shinde request Id:[W16CSUN010][Start]
else if( currentColumn.trim().equalsIgnoreCase( "lot_sl" ) )
{
lotSl = checkNullAndTrim(genericUtility.getColumnValue("lot_sl",currFormDataDom));
lotNo = checkNullAndTrim(genericUtility.getColumnValue("lot_no",currFormDataDom));
itemCode = checkNullAndTrim(genericUtility.getColumnValue("item_code",currFormDataDom));
locCode = checkNullAndTrim(genericUtility.getColumnValue("loc_code",currFormDataDom));
loginSite = checkNull(genericUtility.getValueFromXTRA_PARAMS( xtraParams, "loginSiteCode" ));
sql = "SELECT QUANTITY FROM STOCK WHERE SITE_CODE = ? AND INV_STAT = ? AND LOC_CODE = ? AND ITEM_CODE = ? AND LOT_NO = ? AND LOT_SL = ? AND QUANTITY > 0";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, loginSite);
pstmt.setString(2, "AWMS");
pstmt.setString(3, locCode);
pstmt.setString(4, itemCode);
pstmt.setString(5, lotNo);
pstmt.setString(6, lotSl);
rs = pstmt.executeQuery();
if(rs.next())
{
itemCode = checkNullAndTrim(genericUtility.getColumnValue("item_code",currFormDataDom));
System.out.println("itemCode ==========>> ["+itemCode+"]"); // remove
if(itemCode.length() > 0)
{
itemDescr = checkNullAndTrim(getColumnDescr(conn, "descr", "item", "item_code", itemCode));
unit = checkNullAndTrim(getColumnDescr(conn, "unit", "item", "item_code", itemCode));
valueXmlString.append( "<item_descr><![CDATA[" ).append( itemDescr ).append( "]]></item_descr>\r\n" );
valueXmlString.append( "<unit><![CDATA[" ).append( unit ).append( "]]></unit>\r\n" );
}
else
{
valueXmlString.append( "<item_descr><![CDATA[" ).append( "" ).append( "]]></item_descr>\r\n" );
valueXmlString.append( "<unit><![CDATA[" ).append( "" ).append( "]]></unit>\r\n" );
}
quantity = rs.getDouble("QUANTITY");
System.out.println("quantityStock>>>>>>>" +quantity);
System.out.println( "LOT_SL itemChanged");
}
valueXmlString.append("</Detail2>\r\n");
} //Case 2. End
break;
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(rs != null)
{
rs.close();
rs = null;
}
}
valueXmlString.append( "<quantity><![CDATA[" ).append( quantity ).append( "]]></quantity>\r\n" );
//Changed by Jagruti Shinde request Id:[W16CSUN010][End]
valueXmlString.append("</Detail2>\r\n");
} //Case 2. End
break;
}//End of switch block
valueXmlString.append( "</Root>\r\n" );
}
......@@ -579,7 +621,7 @@ public class PhysicalCountIC extends ValidatorEJB implements PhysicalCountICLoca
}
return inputVal;
}
private String getColumnDescr(Connection conn, String columnName ,String tableName, String columnName2, String value) throws Exception
{
PreparedStatement pstmt = null ;
......@@ -629,7 +671,7 @@ public class PhysicalCountIC extends ValidatorEJB implements PhysicalCountICLoca
System.out.println("returning String from getColumnDescr " + findValue);
return findValue;
}
private int getLocationCount(String locCode, Connection conn) throws Exception
{
PreparedStatement pstmt = null ;
......@@ -680,7 +722,7 @@ public class PhysicalCountIC extends ValidatorEJB implements PhysicalCountICLoca
System.out.println("return value from getLocationCount :::::::::: " + count);
return count;
}
private int getItemCodeCount(String siteCode, String locCode, String itemCode, Connection conn) throws Exception
{
PreparedStatement pstmt = null ;
......@@ -733,7 +775,7 @@ public class PhysicalCountIC extends ValidatorEJB implements PhysicalCountICLoca
System.out.println("return value from getItemCodeCount :::::::::: " + count);
return count;
}
private int getLotNoCount(String siteCode, String locCode, String itemCode, String lotNo, Connection conn) throws Exception
{
PreparedStatement pstmt = null ;
......@@ -787,7 +829,7 @@ public class PhysicalCountIC extends ValidatorEJB implements PhysicalCountICLoca
System.out.println("return value from getLotNoCount :::::::::: " + count);
return count;
}
private int getLotSlCount(String siteCode, String locCode, String itemCode, String lotNo, String lotSl, Connection conn) throws Exception
{
PreparedStatement pstmt = null ;
......
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