Commit d40174c3 authored by kshinde's avatar kshinde

Manoj Sir component merged

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@182180 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 8ca20054
......@@ -8,12 +8,14 @@ package ibase.webitm.ejb.dis;
*/
import ibase.system.config.ConnDriver;
import ibase.utility.CommonConstants;
import ibase.utility.E12GenericUtility;
import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.ejb.sys.UtilMethods;
import ibase.webitm.utility.ITMException;
import java.io.File;
import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.PreparedStatement;
......@@ -33,6 +35,7 @@ import java.util.List;
import javax.ejb.Stateless;
import org.apache.xerces.dom.AttributeMap;
import org.jboss.util.file.Files;
import org.w3c.dom.CDATASection;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
......@@ -44,6 +47,8 @@ import org.w3c.dom.NodeList;
@Stateless
public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,CustStockGWTICRemote //implements SessionBean
{
GenLogFile genLogFile = null;
private static String fileName ="";
//GenericUtility genericUtility = GenericUtility.getInstance();
E12GenericUtility genericUtility= new E12GenericUtility();
UtilMethods utilMethod = new UtilMethods();
......@@ -108,7 +113,9 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
dom2 = parseString("<Root>" + xmlString2+ "</Root>");
}
System.out.println("xmlString2>>>>>>>>"+xmlString2);
genLogFile = new GenLogFile();
errString = wfValData(dom,dom1,dom2,objContext,editFlag,xtraParams);
//genLogFile = null;
}
catch(Exception e)
{
......@@ -128,8 +135,9 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
String invoiceId="",itemCode="",period="";
String siteCode = "",custCode="",userId="",sql="",tranId="",errCode="",errorType="",errString="",itemSer="",stmtDateStr="";
String custType="",custType1="";
String prdCodeDom="", posCodeDom="",itemSerDom="",tranIdLastDom="";
String fromDateStr ="",custTypeDom="";
String editSatus="";
String editSatus="" ,invCustCode="",custCodeXmlDataAll="";
String salePer="",countryCode1="",empCode="",positionCode="";
String invoiceDateStr="",dlvFlg="",transitGraceDaysStr="",positionCodeStr="";
String sysDate="";
......@@ -167,6 +175,8 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
//Double rate=0.0;String rateDom="";
String loginPositionCode="";
//int selectedRowRate=0;
String tranIdLast ="";
java.sql.Timestamp toDateLast=null;
int admCnt=0;String isAdmin="",itemSerChk="",fnlItmSer="";//Added by saurabh for admin login [02/02/17]
try
{
......@@ -229,6 +239,11 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
System.out.println("custCode :"+custCode);
siteCode = this.genericUtility.getColumnValue("site_code", dom);
System.out.println("siteCode@@@@@@@ :"+siteCode);
prdCodeDom = checkNull(this.genericUtility.getColumnValue("prd_code", dom));
posCodeDom = checkNull(this.genericUtility.getColumnValue("pos_code", dom));
itemSer = checkNull(this.genericUtility.getColumnValue("item_ser", dom));
tranIdLastDom = checkNull(this.genericUtility.getColumnValue("tran_id__last", dom));
System.out.println("prdCodeDom@@@@@@@ :["+prdCodeDom+"][posCodeDom]["+posCodeDom+"][itemSerDom]["+itemSer+"][tranIdLastDom]["+tranIdLastDom+"]");
if(custCode == null)
{
System.out.println("Error : customer code should not be blank!!!");
......@@ -288,6 +303,64 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
/*
* Modified by santosh to check tran_id_last is present .START
* */
sql = " SELECT max(to_date) as to_date FROM CUST_STOCK WHERE CUST_CODE = ? " +
" AND ITEM_SER = ? " +
" and pos_code is not null and confirmed='Y' and status='S' ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, custCode);
pstmt.setString(2, itemSer);
rs = pstmt.executeQuery();
if (rs.next())
{
toDateLast = rs.getTimestamp("to_date");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
fileName= custCode.trim()+"_"+itemSer+"_"+posCodeDom+"_"+prdCodeDom;
// genLogFile.writeLog(custCode.trim()+"_"+itemSer+"_"+posCodeDom+"_"+prdCodeDom, "in wfValData() case 1 ["+sql+"]");
// genLogFile.writeLog(custCode.trim()+"_"+itemSer+"_"+posCodeDom+"_"+prdCodeDom, "in wfValData() case 1 custCode ["+custCode+"][itemSer]["+itemSer+"]");
System.out.println("genLogFile in wfvaldata"+genLogFile);
genLogFile.writeLog(fileName, "in wfValData() case 1 ["+sql+"]");
genLogFile.writeLog(fileName, "in wfValData() case 1 custCode ["+custCode+"][itemSer]["+itemSer+"]");
sql = " SELECT max(tran_id) as oldTranId FROM CUST_STOCK WHERE CUST_CODE = ? " +
" AND ITEM_SER = ? " +
" and pos_code is not null and confirmed='Y' and status='S' and to_date=? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, custCode);
pstmt.setString(2, itemSer);
pstmt.setTimestamp(3, toDateLast);
rs = pstmt.executeQuery();
if (rs.next())
{
tranIdLast = checkNull(rs.getString("oldTranId"));
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
System.out.println("tranIdLast (case 1):" + tranIdLast);
genLogFile.writeLog(fileName, "in wfValData() case 1 ["+sql+"]");
genLogFile.writeLog(fileName, "in wfValData() case 1 custCode ["+custCode+"][itemSer]["+itemSer+"][toDateLast]["+toDateLast+"]");
if(tranIdLast != null && tranIdLastDom == null)
{
System.out.println("Error : tran_id__last is present in SQL");
errCode = "VTTRANIDMI";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
/*
* Modified by santosh to check tran_id_last is present .END
* */
}//cust code
......@@ -963,6 +1036,10 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
System.out.println("parentNodeListLength Detail2:::::::::"+parentNodeListLength);
stmtDateStr = this.genericUtility.getColumnValue("stmt_date",dom2);
editSatus = this.genericUtility.getColumnValue("edit_status", dom2);
String ustCodeXmlDataAll1 = genericUtility.getColumnValue("cust_code", dom1);
System.out.println("@S@custCode from xmldata1(wfvaldatacase 2) :"+ustCodeXmlDataAll1);
custCodeXmlDataAll = genericUtility.getColumnValue("cust_code", dom2);
System.out.println("@S@custCodeXmlDataAll(wfvaldatacase 2) :"+custCodeXmlDataAll);
System.out.println("editSatus>>>>>case 2>>>"+editSatus);
if(!"V".equalsIgnoreCase(editSatus))
{
......@@ -978,6 +1055,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
isInvList = true;
for (int childRow = 0; childRow < childNodeListLength; childRow++)
{
invCustCode="";
childNode1 = childNodeList.item(childRow);
childNodeName = childNode1.getNodeName();
System.out.println("childNodeName :" + childNodeName);
......@@ -986,6 +1064,47 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
if (childNode1.getFirstChild() != null)
{
invoiceId = childNode1.getFirstChild().getNodeValue();
/**Added by santosh to check invoice customer .START*/
System.out.println("@S@invoiceId["+invoiceId+"]");
sql="select cust_code from invoice where invoice_id= ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,invoiceId);
rs = pstmt.executeQuery();
if (rs.next())
{
invCustCode = rs.getString("cust_code");
}
rs.close();
rs=null;
pstmt.close();
pstmt=null;
System.out.println("@S@invCustCode["+invCustCode+"]");
if(invCustCode.trim().length()==0)
{
sql="select cust_code from sreturn where tran_id = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,invoiceId);
rs = pstmt.executeQuery();
if (rs.next())
{
invCustCode = rs.getString("cust_code");
}
rs.close();
rs=null;
pstmt.close();
pstmt=null;
}
if(!(invCustCode.trim()).equals(custCodeXmlDataAll.trim()))
{
/**Invoice customer code not match
* with site customer code**/
errCode = "VTICUSTCHG";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
/**Added by santosh to check invoice customer .END*/
}
System.out.println("invoiceId :" + invoiceId);
if (isInvList == false && !errInvList.contains(invoiceId))
......@@ -1527,6 +1646,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
String valueXmlString = "";
try
{
genLogFile = new GenLogFile();
if (xmlString.trim().length() > 0 )
{
dom = parseString(xmlString);
......@@ -1543,7 +1663,9 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
System.out.println("xmlString2 itemChanged::"+xmlString2);
}
//dom2=parseString(xmlString2);
valueXmlString = itemChanged(dom,dom1,dom2,objContext,currentColumn,editFlag,xtraParams,objName,dataMap);
//genLogFile = null;
}
catch(Exception e)
{
......@@ -1673,7 +1795,8 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
String custCodeDom="",tranIdTemp = "",selInvListMap="",selInvListMapFinal="",transitInvListFinal="";
String countryCode="",loginPositionCode="",countryCodeDom="";
String isAdmin="",transitDays="";
int admCnt=0;
int admCnt=0,count=0;
// int countDetail3=0;
try
{
......@@ -1687,6 +1810,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
sdf = new SimpleDateFormat(genericUtility.getApplDateFormat());
chgDate = sdf.format(new java.util.Date());
chgUser = checkNull(genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginCode"));
//loginEmpCode = checkNull(genericUtility.getValueFromXTRA_PARAMS(xtraParams, "entityCode"));
loginEmpCode = checkNull(genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginEmpCode"));
chgTerm = checkNull(genericUtility.getValueFromXTRA_PARAMS(xtraParams,"termId"));
loginSiteCode = checkNull(genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginSiteCode"));
......@@ -2267,6 +2391,17 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
System.out.println("login siteCode :"+siteCode);
positionCode = checkNull(genericUtility.getColumnValue("pos_code",dom));
empCode = checkNull(genericUtility.getColumnValue("emp_code",dom));
period = checkNull(genericUtility.getColumnValue("prd_code",dom));
System.out.println("@S@ inside cust_code itemChnage ["+period+"]");
fileName = custCode+"_"+itemSer+"_"+positionCode+"_"+period;
System.out.println("@S@fileName["+fileName+"]");
/*File filePath=new java.io.File(CommonConstants.JBOSSHOME + File.separator +"ES3log"+custCode+"_"+itemSer+"_"+positionCode+"_"+period);
if (fileName==null || fileName.trim().length()==0 || !filePath.exists())
{ // file exist
fileName= custCode+"_"+itemSer+"_"+positionCode+"_"+period;
}*/
spCode=empCode;
sql= " select cust_name,cust_type,order_type,STAN_CODE from customer where cust_code=? ";
pstmt = conn.prepareStatement(sql);
......@@ -2601,6 +2736,8 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
System.out.println("tranIdNew(case 2) :"+tranIdNew);
custCode = genericUtility.getColumnValue("cust_code", dom1);
System.out.println("custCode(case 2) :"+custCode);
String custCode1 = genericUtility.getColumnValue("cust_code", dom2);
System.out.println("@S@custCode(case 2) from all dom :"+custCode1);
fromdate = genericUtility.getColumnValue("from_date", dom1);
System.out.println("fromdate@@@@@@@@@@@ :"+fromdate);
todate= genericUtility.getColumnValue("to_date", dom1);
......@@ -2971,6 +3108,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
}
else
{
Node detail1Node = dom2.getElementsByTagName("Detail1").item(0);
tranId = genericUtility.getColumnValueFromNode("tran_id",detail1Node);
System.out.println("tranId form 2 :"+tranId);
......@@ -3030,7 +3168,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
//2)cosider transit invoice.
//3)Union query included for transit invoice not exist in previous month
//TODO
sql=" SELECT DISTINCT INVOICE_ID,INVOICE_DATE,TRAN_ID,REF_SER FROM ( " +
" SELECT invoice.invoice_id invoice_id,invoice.tran_date as invoice_date ,'N' as DLV_FLG ,'' as tran_id ,'S-INV' as ref_ser " +
" FROM invoice invoice,invoice_trace itrace,item item WHERE invoice.invoice_id=itrace.invoice_id " +
......@@ -3490,8 +3628,11 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
System.out.println("tranIdNew !!!!!!!!!"+tranIdNew);
System.out.println("domID3 :"+domID3);
count =0;
for(int invDomid = 1; invDomid <= domID3 ; invDomid++ )
{
count++;
System.out.println("Invoice Id : "+invMap.get("invoiceId@"+invDomid));
System.out.println("net Amt :"+invMap.get("netAmt@"+invDomid));
System.out.println("delivert flag of invoice id :"+invMap.get("invoiceId@"+invDomid)+" is : "+invMap.get(invMap.get("invoiceId@"+invDomid)));
......@@ -3577,6 +3718,14 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
valueXmlString.append("</Detail2>");
//}
}//end of for loop
/**Added by Santosh to check Invoice is present for selected used**/
System.out.println("@S@count["+count+"]");
if(count==0)
{
//valueXmlString.append("<Detail2>");
valueXmlString = new StringBuffer("<?xml version=\"1.0\"?>\r\n<Root>\r\n<Header>\r\n<editFlag>");
valueXmlString.append(editFlag).append("</editFlag>\r\n</Header>\r\n");
}
}
}
System.out.println("case 2 valueXmlString :"+valueXmlString);
......@@ -3587,7 +3736,6 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
//Node detailNode3 = dom.getElementsByTagName((new StringBuilder("Detail")).append(currentFormNo).toString()).item(0);
if(currentColumn.trim().equals("itm_default"))
{
String dlvFlg ="";
//NodeList parentNodeList1 = null;
NodeList childNodeList1 = null;
Node parentNode1 = null;
......@@ -3605,24 +3753,6 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
childNodeListLength1 = childNodeList1.getLength();
System.out.println("childNodeListLength1::: "+ childNodeListLength1+"\n");
//Added by Pratheek[to get dlv_flg value]-Start
for(int chldRow = 0; chldRow < childNodeListLength1; chldRow++ )
{
childNode1 = childNodeList1.item(chldRow);
childNodeName = childNode1.getNodeName();
System.out.println("childNodeName :"+childNodeName);
if(childNodeName.equals("dlv_flg"))
{
if(childNode1.getFirstChild()!=null)
{
dlvFlg = childNode1.getFirstChild().getNodeValue();
System.out.println("dlvFlagDom :"+dlvFlg);
}
}
}
//Added by Pratheek[to get dlv_flg value]-End
for (int childRow = 0; childRow < childNodeListLength1; childRow++)
{
childNode1 = childNodeList1.item(childRow);
......@@ -3653,12 +3783,6 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
invoiceIdDom = childNode1.getFirstChild().getNodeValue();
System.out.println("Detail3 invoiceIdDom:::]" +invoiceIdDom);
System.out.println("dlvFlagDom : "+dlvFlagDom);
//Added by Pratheek[to get dlv_flg value and set the dlv_flg value to the dom]-Start
if(dlvFlg !=null)
{
dlvFlagDom = dlvFlg;
}
//Added by Pratheek[to get dlv_flg value and set the dlv_flg value to the dom]-End
if(dlvFlagDom.equalsIgnoreCase("Y"))
{
if(childRow != (childNodeListLength1 - 1))
......@@ -3771,7 +3895,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
prdFrom = getPreviousDate(frmDateTstmp,conn);
System.out.println("prdFrom :"+prdFrom);
//TODO
sql = "select b.FR_DATE as FR_DATE,b.TO_DATE as TO_DATE " +
//",b.entry_start_dt as entry_start_dt" +
// ",b.entry_end_dt as entry_end_dt" +
......@@ -3852,6 +3976,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
itemSerHd=getItemSerList(itemSerHd,conn);
//itemSerHeaderSplit=itemSerHd;
//orderTypeHeader=orderType;
System.out.println("Retrive Item Details data from previous month or current month which is exist in CUST_STOK_DET !!!!!!!!!!!!!");
/*sql= "select item_code,unit,op_stock ,sales,purc_rcp,cl_stock,purc_ret,rate,line_no,transit_qty,item_ser ,purc_rcp__repl ,purc_rcp__free,purc_ret__repl,purc_ret__free,transit_qty__repl,transit_qty__free ,loc_type " +
" from cust_stock_det where tran_id=? ";*/
......@@ -4350,6 +4475,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
//Add prevous items
//Added by saurabh for product transfer[22/03/17|Start]
//defData=addPreviousItems(itemListLast,defData,tranIdLast,conn);
//defData=addPreviousItems(custCodeHd,itemSerDom,isItemSerLocal,frmDateTstmp,prdFrmDateTstmp,prdtoDateTstmp,itemListLast,defData,tranIdLast,conn);
defData=addPreviousItems(custCodeHd,itemSerDom,itemSerHd,isItemSerLocal,frmDateTstmp,prdFrmDateTstmp,prdtoDateTstmp,itemListLast,defData,tranIdLast,conn);
//Added by saurabh for product transfer[22/03/17|End]
......@@ -4364,7 +4490,6 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
for(itemPos = 0; itemPos < itemResLen; itemPos++ )
{
itemCode = ( ( ItemDescr )defData.get(itemPos)).lsCode;
System.out.println("itemCode @@@@@:"+itemCode);
lsOpStock= checkNull(( ( ItemDescr )defData.get(itemPos)).lsOpStock);
......@@ -4605,10 +4730,12 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
}//end of IF
}//end of for loop
//countDetail3=0;
System.out.println("lineNoItmCnt :"+lineNoItmCnt);
//TODO
for(int itemDomId = 1 ; itemDomId <= lineNoItmCnt ; itemDomId++)
{
//countDetail3 ++;
System.out.println("itemListLast!!! :"+itemListLast);
System.out.println("itemCode : "+itemMap.get("itemCode@"+itemDomId));
//valueXmlString.append( "<Detail4 dbID='' domID='"+itemDomId+"' objContext='"+currentFormNo+"' selected='N'>\r\n" );
......@@ -4813,7 +4940,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
//This code will run for auto generated transactions from where itemchange method call with objName as respective objName CHanged by Saurabh J.[27/03/17|Start]
else
{
//TODO
itmDetCnt++;
lineNoCustSt = lineNoCustSt + 1;
openingValue=0;
......@@ -4996,6 +5123,13 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
System.out.println("valueXmlString add flag >>> "+valueXmlString);
}
//Added by santosh to if invoice is not present
/*System.out.println("@S@countDetail3["+countDetail3+"]");
if(countDetail3==0)
{
valueXmlString = new StringBuffer("<?xml version=\"1.0\"?>\r\n<Root>\r\n<Header>\r\n<editFlag>");
valueXmlString.append(editFlag).append("</editFlag>\r\n</Header>\r\n");
}*/
//comented code
//coding for those item code which is other than previos item code,end
if(itemResLen == 0 && itmDetCnt==0){
......@@ -5078,10 +5212,17 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
valueXmlString.append("<cl_value>").append("<![CDATA["+0+"]]>").append("</cl_value>");
valueXmlString.append("</Detail3>");
}
}
System.out.println("itemchanged : case 3 :valueXmlString :"+valueXmlString);
/*System.out.println("@S@11countDetail3["+countDetail3+"]");
if(countDetail3==0)
{
valueXmlString = new StringBuffer("<?xml version=\"1.0\"?>\r\n<Root>\r\n<Header>\r\n<editFlag>");
valueXmlString.append(editFlag).append("</editFlag>\r\n</Header>\r\n");
}
System.out.println("itemchanged : case 3 :valueXmlString :"+valueXmlString);*/
}
/*//Change by chandra shekar on 27-10-2015
......@@ -8236,7 +8377,10 @@ private double GetFreeQty(String custCode,String itemCode,String itemSer,String
{
itemDescr = getItemBean(invItemCode,frmDateTstmp,custCode,lastTranId,resultitemSer,isItemSer,conn);
}
if(itemDescr!=null)
{
defData.add(itemDescr);
}
itemDescr=null;
}
//Item to mapped as per ES3 logic for Items from Awacs itemMap[290717|Start]
......@@ -8245,7 +8389,10 @@ private double GetFreeQty(String custCode,String itemCode,String itemSer,String
for(String itemCode : hm.keySet())
{
itemDescr = getItemBean(itemCode,frmDateTstmp,custCode,lastTranId,resultitemSer,isItemSer,conn);
if(itemDescr!=null)
{
defData.add(itemDescr);
}
itemDescr=null;
}
}
......@@ -8255,6 +8402,7 @@ private double GetFreeQty(String custCode,String itemCode,String itemSer,String
pstmt.close();
pstmt = null;
//System.out.println("Final itemList :"+itemList);
fileName ="";
}catch( Exception ex )
{
ex.printStackTrace();
......@@ -8303,7 +8451,6 @@ private double GetFreeQty(String custCode,String itemCode,String itemSer,String
" AND CS1.POS_CODE IS NOT NULL AND CS1.CONFIRMED='Y' AND CS1.STATUS='S') " +
" and CS.CUST_CODE= '"+custCode+"' AND CS.POS_CODE IS NOT NULL AND CS.CONFIRMED='Y' AND CS.STATUS='S' ";
}
pstmt1 = conn.prepareStatement(sql);
pstmt1.setTimestamp( 1, frmDateTstmp );
pstmt1.setString(2, custCode);
......@@ -8317,6 +8464,12 @@ private double GetFreeQty(String custCode,String itemCode,String itemSer,String
pstmt1.close();
pstmt1 = null;
//Added by saurabh for product transfer[14/03/17|End]
System.out.println("@s@>>>>>fileName["+fileName+"]");
//genLogFile = new GenLogFile();
System.out.println("@S@ genLogFile["+genLogFile+"]");
genLogFile.writeLog(fileName, "in getItemBean itemChange case 3 ["+sql+"]");
genLogFile.writeLog(fileName, "in getItemBean itemChange case 3 frmDateTstmp["+frmDateTstmp+"][custCode]["+custCode+"]");
sql = " select cl_stock,CASE WHEN rate IS NULL THEN 0 ELSE rate END as rate," +
" CASE WHEN rate__org IS NULL THEN 0 ELSE rate__org END as rate__org,item_ser from " +
"cust_stock_det where tran_id=? and item_code=? ";
......@@ -8344,6 +8497,10 @@ private double GetFreeQty(String custCode,String itemCode,String itemSer,String
rs1 = null;
pstmt1.close();
pstmt1 = null;
System.out.println("@S@fileName["+fileName+"]");
genLogFile.writeLog(fileName, "in getItemBean itemChange case 3 ["+sql+"]");
genLogFile.writeLog(fileName, "in getItemBean itemChange case 3 tranIdLast["+tranIdLast+"][lastTranId from dom]["+lastTranId+"]");
// commented by santosh to set item series on 18/SEP/2017[D17FSUN006]
// sql= " select descr,item_ser,item_usage from item where item_code = ?";
sql= " select descr,item_usage,fn_get_itemser_change(item.item_code,?) as item_ser from item where item_code = ?";
......@@ -8362,6 +8519,10 @@ private double GetFreeQty(String custCode,String itemCode,String itemSer,String
pstmt1.close();
pstmt1 = null;
System.out.println("@S@itemSer["+itemSer+"]");
genLogFile.writeLog(fileName, "in getItemBean itemChange case 3 ["+sql+"]");
genLogFile.writeLog(fileName, "in getItemBean itemChange case 3 frmDateTstmp["+frmDateTstmp+"][invItemCode]["+invItemCode+"]");
/**Commented by santosh to set item series by using function
* if(tranIdLast!=null && tranIdLast.trim().length() > 0)
{
......@@ -8392,6 +8553,7 @@ private double GetFreeQty(String custCode,String itemCode,String itemSer,String
itemDescr.lsrateorgold= rateOrg;
//defData.add(itemDescr);
//itemList.add(invItemCode);
}
}
......@@ -8402,6 +8564,7 @@ private double GetFreeQty(String custCode,String itemCode,String itemSer,String
}
return itemDescr;
}
private HashMap<String,ArrayList<String>> getItemwiseInvoice(String custCode, String itemSerHdr,String resultitemSer,String siteCode, String orderType,java.sql.Timestamp frmDateTstmp, java.sql.Timestamp toDateTstmp,java.sql.Timestamp prdFrDateTstmp, java.sql.Timestamp prdToDateTstmp,String lastTranId,String newTranId,String selectedInvList, Connection conn ,boolean isItemSer)
{
//long llCount = 0, llRowNum = 0;
......@@ -8425,7 +8588,7 @@ private double GetFreeQty(String custCode,String itemCode,String itemSer,String
HashMap<String ,ArrayList<String>> invHashMapStr=new HashMap<String, ArrayList<String>>();
try
{
//TODO
sql="select distinct item_code,invoice_id from ( " +
" SELECT item.item_code,invoice.invoice_id FROM invoice invoice ,invoice_trace itrace,item item " +
" WHERE invoice.invoice_id=itrace.invoice_id and itrace.item_code=item.item_code " +
......@@ -9678,7 +9841,9 @@ private double GetFreeQty(String custCode,String itemCode,String itemSer,String
return resultItemSer;
}
//private ArrayList addPreviousItems(List<String> itemListLast,ArrayList defData,String tranIdLast, Connection conn)
private ArrayList addPreviousItems(String custCodeHd ,String itemSerDom ,String resultitemSer ,boolean isItemSerLocal ,java.sql.Timestamp frmDateTstmp,java.sql.Timestamp prvMFromDate,java.sql.Timestamp prvMToDate,List<String> itemListLast,ArrayList defData,String tranIdLast, Connection conn)
private ArrayList addPreviousItems(String custCodeHd ,String itemSerDom ,String resultitemSer ,boolean isItemSerLocal ,
java.sql.Timestamp frmDateTstmp,java.sql.Timestamp prvMFromDate,java.sql.Timestamp prvMToDate,List<String> itemListLast,
ArrayList defData,String tranIdLast, Connection conn)
{
String sql = null;
......
package ibase.webitm.ejb.dis;
import java.sql.*;
import ibase.utility.CommonConstants;
import ibase.utility.E12GenericUtility;
import java.io.*;
import java.text.SimpleDateFormat;
import java.util.Calendar;
public class GenLogFile {
public void writeLog(String fileName, String msgString) throws Exception
{
String errCode = null, writeString;
//GenericUtility genericUtility = GenericUtility.getInstance();
E12GenericUtility genericUtility= new E12GenericUtility();
java.io.File logFile = null;
java.io.FileWriter logFileWtr = null;
String filePath = CommonConstants.JBOSSHOME + File.separator +"ES3log";
SimpleDateFormat sdf1 = new SimpleDateFormat(genericUtility.getDBDateFormat());
String currTime = null;
Calendar calendar = Calendar.getInstance();
try
{
logFile = new java.io.File( filePath );
if(!(logFile.exists()))
{
logFile.mkdir();
}
filePath = filePath + File.separator+ fileName+".log";
logFile = new java.io.File( filePath );
logFileWtr = new java.io.FileWriter( logFile, true );
currTime = sdf1.format(new Timestamp(System.currentTimeMillis())).toString();
currTime = currTime.replaceAll("-","");
System.out.println("Inside log file case 1"+msgString);
calendar.setTime(new java.sql.Timestamp(System.currentTimeMillis()));
System.out.println("Inside log file case 2"+msgString);
if( logFile == null )
{
errCode = "VBFILEOPEN";
System.out.println("VBFILEOPEN");
}
else
{
System.out.println("Inside log file case 3"+msgString);
writeString = "{" + currTime + " " + calendar.get(Calendar.HOUR)+":"+calendar.get(Calendar.MINUTE) + "}\t" + msgString + "\r\n";
//logFileWtr.write( writeString );
System.out.println("Inside log file case 4"+writeString);
char writeCharArr[] = new char[ writeString.length() ];
writeString.getChars( 0, writeString.length(), writeCharArr, 0 );
logFileWtr.write( writeCharArr );
}
}catch( Exception ex )
{
errCode = "VFLEIOERR";
ex.printStackTrace();
}
finally{
try{
logFileWtr.close();
logFileWtr = null;
logFile = null;
}catch( Exception e ){
errCode = "VEFCLERR";
e.printStackTrace();
}
}
//return errCode;
}
}
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