Commit 65844fc9 authored by wansari's avatar wansari

W15GSUN003 removed linenumber space for interface table.


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@99238 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 185b5382
......@@ -10,10 +10,18 @@ import ibase.scheduler.utility.interfaces.Schedule;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.rmi.RemoteException;
import java.text.NumberFormat;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.logging.FileHandler;
import java.util.logging.Handler;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.logging.SimpleFormatter;
import java.sql.*;
import javax.naming.InitialContext;
......@@ -34,6 +42,7 @@ import ibase.webitm.ejb.dis.InvAllocTraceBean;
import ibase.webitm.ejb.dis.InvHoldGen;
import ibase.webitm.ejb.dis.adv.InvHoldConf;
import ibase.webitm.ejb.dis.adv.StockTransferConf;
import ibase.webitm.ejb.wms.UploadOrderEJB;
import ibase.webitm.utility.GenericUtility;
import ibase.utility.CommonConstants;
import ibase.system.config.*;
......@@ -93,7 +102,7 @@ public class ScheduleAWMSInOutTasks implements Schedule
Connection conn = null;
ResultSet rs = null,rsInf = null;
PreparedStatement pstmt = null, interfacePstmt = null;
String errString = "", sql = "",inOut = "",refSer = "",refId = "",palletRej = "",sqlInf = "";
String errString = "", sql = "",inOut = "",refSer = "",refId = "",palletRej = "",sqlInf = "",tranId = "";
boolean isCountPllt = false;
int flag,countError;
String lineNo = "";
......@@ -105,26 +114,20 @@ public class ScheduleAWMSInOutTasks implements Schedule
connDriver = null;
conn.setAutoCommit(false);
/*sql = "SELECT IN_OUT,ERR_COD,MSG_STAT,TRANS_DT_ACK,TRAN_ID,"
+ "ITEM_CODE,DESCR,UNIT,ITEM_TYPE,FAMILY_GRP,REF_SER,"
+ "LOT_NO,REF_ID,LOT_SL,QUANTITY,NO_ART,EXP_DATE,MFG_DATE,"
+ "PALLET_NO,PALLET_STATUS,LOCK_STAT,QC_TYPE,STRO_PREF,PALLET_REJ,"
+ "PALLET_REJ_DESC,REF_LINE_NO FROM INTERFACE "
+ "WHERE SYSDATE > TRANS_DT_ACK";*/
//sql = "SELECT DISTINCT REF_ID,REF_SER,IN_OUT,MSG_STAT FROM INTERFACE WHERE SYSDATE > TRANS_DT_ACK";
sql = "SELECT DISTINCT REF_ID,REF_SER FROM WMS_TO_HOST WHERE REF_ID IN "
+ "(SELECT REF_ID FROM SWMS_TO_AWMS WHERE SCHEDULE_STATUS IS NULL)";
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
while(rs.next())
{
try
{
refSer = checkNullAndTrim(rs.getString("REF_SER"));
refId = checkNullAndTrim(rs.getString("REF_ID"));
//isCountPllt = checkCountPalletReq(refId,conn);
//if(isCountPllt)
//{
System.out.println("Schedullar going to schedule for refId["+refId+"]["+refSer+"]");
HashMap interfaceHmap = new HashMap();
interfaceHmap.put("REF_ID", refId);
interfaceHmap.put("REF_SER", refSer);
......@@ -148,41 +151,22 @@ public class ScheduleAWMSInOutTasks implements Schedule
{
System.out.println("Going for inventory hold");
errString = inventoryHold(interfaceHmap, siteCode, xtraParams, conn);
flag = 1;
//flag = 1;
}
//if(flag == 0)
//{
System.out.println("Going for stock transfer refId["+refId+"]refSer["+refSer+"]inOut["+inOut+"]");
errString = stockTransfer(interfaceHmap,xtraParams,conn);
//}
/*if("E".equalsIgnoreCase(palletRej))
{
System.out.println("Go on inventory hold");
errString = inventoryHold(interfaceHmap, siteCode,xtraParams, conn);
}
else
{
System.out.println("Going for stock transfer refId["+refId+"]refSer["+refSer+"]inOut["+inOut+"]");
errString = stockTransfer(interfaceHmap,xtraParams,conn);
if("I".equalsIgnoreCase(inOut))
{
errString = stockTransfer(interfaceHmap,xtraParams,conn);
}
else
{
if("O".equalsIgnoreCase(inOut))
{
if("D-SO".equalsIgnoreCase(refSer) || "S-ORD".equalsIgnoreCase(refSer))
catch(Exception ex)
{
errString = stockTransfer(interfaceHmap,xtraParams,conn);
}
}
System.out.println("Exception caught for refId["+refId+"] so rollbacking and going for next ref id");
conn.rollback();
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
ex.printStackTrace(pw);
writeLog(refId,sw.toString());
continue;
}
}*/
//}//End checkCountPalletReq check
//}
}
rs.close();rs = null;
pstmt.close();pstmt = null;
......@@ -206,7 +190,7 @@ public class ScheduleAWMSInOutTasks implements Schedule
else
{
conn.commit();
errString = itmDBAccessEJB.getErrorString("","VTCONPARM","","",conn);
//errString = itmDBAccessEJB.getErrorString("","VTCONPARM","","",conn);
}
if(pstmt != null){pstmt.close();pstmt=null;}
if(interfacePstmt != null){interfacePstmt.close();interfacePstmt=null;}
......@@ -262,10 +246,6 @@ public class ScheduleAWMSInOutTasks implements Schedule
refSer = (String) interfaceMap.get("REF_SER");
refId = (String) interfaceMap.get("REF_ID");
/*lineNoInterface = (String) interfaceMap.get("LINE_NO");
lineNoInterface = " " + lineNoInterface;
lineNoInterface = lineNoInterface.substring( lineNoInterface.length()-3 );*/
if("D-SO".equalsIgnoreCase(refSer))
{
......@@ -340,10 +320,13 @@ public class ScheduleAWMSInOutTasks implements Schedule
{
isRecordExist = false;
}
lineNoInterface = rsInterface.getString("LINE_NO");
lineNoInterface = " " + lineNoInterface;
lineNoInterface = lineNoInterface.substring( lineNoInterface.length()-3 );
//Changed by wasim on 26-11-2015 to remove space for interface table [START]
//lineNoInterface = rsInterface.getString("LINE_NO");
/*lineNoInterface = " " + lineNoInterface;
lineNoInterface = lineNoInterface.substring( lineNoInterface.length()-3 );*/
lineNoInterface = checkNullAndTrim(rsInterface.getString("LINE_NO"));
//Changed by wasim on 26-11-2015 to remove space for interface table [START]
System.out.println("Line number is ["+lineNoInterface+"]");
//lineNoList.add(lineNoInterface);
......@@ -542,35 +525,10 @@ public class ScheduleAWMSInOutTasks implements Schedule
conn.rollback();
}
}
//pstmtDet.executeBatch();
//pstmtDet.clearBatch();
}
pstmtInterface.close();pstmtInterface = null;
rsInterface.close();rsInterface = null;
/*
Iterator itr = tranIdList.iterator();
StockTransferConf stkConfAdd = new StockTransferConf();
String pID = "";
System.out.println("REF SER------------"+refSer);
System.out.println("tranIdList------------"+tranIdList.toString());
while(itr.hasNext())
{
pID = (String)itr.next();
System.out.println(" Tran ID------["+pID+"]");
errString = stkConfAdd.confirm(pID, xtraParams, "", conn, false);
System.out.println(" issue created successfully------errString------["+errString+"]");
if( errString != null && errString.indexOf( "VTCONPARM" ) > -1)
{
System.out.println(" issue created successfully-------------");
conn.commit();
}
else
{
conn.rollback();
}
}*/
//if(isRecordExist && !"PR".equalsIgnoreCase(refSer))
if(isRecordExist && (!"PR".equalsIgnoreCase(refSer) && !"PRS".equalsIgnoreCase(refSer)))//Changed by wasim on 19-11-2015 to add new ref ser PRS
{
......@@ -622,7 +580,7 @@ public class ScheduleAWMSInOutTasks implements Schedule
throw new Exception (errString);
}
}
else if ("PZ".equalsIgnoreCase(refSer) || "D-SO".equalsIgnoreCase(refSer))
else if ("PZ".equalsIgnoreCase(refSer) || "D-SO".equalsIgnoreCase(refSer))//D-SO is required if dist_issue already created then only stock transfer will be done
{
System.out.println("Stock Transfer for PZ/D-SO completed successfully and committed");
conn.commit();
......@@ -774,8 +732,11 @@ public class ScheduleAWMSInOutTasks implements Schedule
{
lineNoInterface = checkNullAndTrim(rsInterface.getString("LINE_NO"));
lineNoInterface = " " + lineNoInterface;
lineNoInterface = lineNoInterface.substring( lineNoInterface.length()-3 );
System.out.println("Line no in inH["+lineNoInterface+"]");
//Changed by wasim on 26-11-2015 to remove space for interface table [START]
/*lineNoInterface = " " + lineNoInterface;
lineNoInterface = lineNoInterface.substring( lineNoInterface.length()-3 );*/
//Changed by wasim on 26-11-2015 to remove space for interface table [START]
if(headerFlag)
{
......@@ -3829,5 +3790,39 @@ public class ScheduleAWMSInOutTasks implements Schedule
}
return result;
}
public void writeLog(String refId,String errString) throws Exception
{
FileOutputStream fos1 = null;
String fileName = "";
final Logger logger = Logger.getLogger(ScheduleAWMSInOutTasks.class.getName());
try
{
fileName = "AWMS_"+refId;
System.out.println("Schdular Log Name is ="+fileName);
File dir = new File ( CommonConstants.JBOSSHOME + File.separator + "log" );
if(!dir.exists())
{
dir.mkdirs();
}
File file1 = new File( dir ,fileName);
file1.createNewFile();
System.out.println("PATH123 :"+file1.getAbsolutePath());
Handler fh = new FileHandler(file1.getAbsolutePath(), true);
fh.setFormatter(new SimpleFormatter()); // Set the log format
logger.addHandler(fh);
logger.setLevel(Level.FINE);
logger.log(Level.SEVERE, errString, errString);
fh.flush();
fh.close();
}
catch(Exception e)
{
throw new Exception(e);
}
}
}
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