Commit aa7f2d10 authored by rtiwari's avatar rtiwari

UPDATE FOR Issue Tracker point # 328


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@94357 ce508802-f39f-4f6c-b175-0d175dae99d5
parent ff8e609d
...@@ -40,6 +40,8 @@ public class PhyItemVerifyPos extends ValidatorEJB implements PhyItemVerifyPosLo ...@@ -40,6 +40,8 @@ public class PhyItemVerifyPos extends ValidatorEJB implements PhyItemVerifyPosLo
int refLineNo=0; int refLineNo=0;
int rec=0; int rec=0;
String tranType=""; String tranType="";
String empCode = "",loginCode= "";
int upd = 0;
try try
{ {
conn.setAutoCommit(false); conn.setAutoCommit(false);
...@@ -51,6 +53,30 @@ public class PhyItemVerifyPos extends ValidatorEJB implements PhyItemVerifyPosLo ...@@ -51,6 +53,30 @@ public class PhyItemVerifyPos extends ValidatorEJB implements PhyItemVerifyPosLo
siteCode = genericUtility.getValueFromXTRA_PARAMS( xtraParams, "loginSiteCode" ); siteCode = genericUtility.getValueFromXTRA_PARAMS( xtraParams, "loginSiteCode" );
parentNodeList = dom.getElementsByTagName("Detail2"); parentNodeList = dom.getElementsByTagName("Detail2");
parentNodeListLength = parentNodeList.getLength(); parentNodeListLength = parentNodeList.getLength();
// added BY RITESH ON 01/mar/14 start
loginCode = genericUtility.getValueFromXTRA_PARAMS( xtraParams, "loginCode" );
System.out.println("********* login code ["+loginCode+"]");
sql = "SELECT EMP_CODE FROM USERS WHERE CODE = ?";
pstmt = conn.prepareStatement( sql );
pstmt.setString(1, loginCode);
rs = pstmt.executeQuery();
if( rs.next() )
{
empCode = rs.getString("EMP_CODE");
}
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
// added BY RITESH on 01/mar/14 end
sSQL="SELECT * FROM PHYSCANDET WHERE TRAN_ID=? "; sSQL="SELECT * FROM PHYSCANDET WHERE TRAN_ID=? ";
pstmt2=conn.prepareStatement(sSQL); pstmt2=conn.prepareStatement(sSQL);
pstmt2.setString(1, tranId); pstmt2.setString(1, tranId);
...@@ -153,8 +179,59 @@ public class PhyItemVerifyPos extends ValidatorEJB implements PhyItemVerifyPosLo ...@@ -153,8 +179,59 @@ public class PhyItemVerifyPos extends ValidatorEJB implements PhyItemVerifyPosLo
pstmt1.executeUpdate(); pstmt1.executeUpdate();
pstmt1.close(); pstmt1.close();
pstmt1=null; pstmt1=null;
}
// added BY RITESH on 01/mar/14 start
sql="select count(*) from physcandet where tran_id=? and item_code=? and QUANTITY<>QTY_PHYSICAL";
pstmt1=conn.prepareStatement(sql);
pstmt1.setString(1,refId);
pstmt1.setString(2,itemCode);
rs1=pstmt1.executeQuery();
if(rs1.next())
{
rec=rs1.getInt(1);
} }
//} rs1.close();
rs1=null;
pstmt1.close();
pstmt1=null;
if(rec > 0)
{
System.out.println("rec > 1 : qty mismatch found");
sql="update physcandet set EMP_CODE__VERIFY = ? where tran_id=? and item_code=? ";
pstmt1=conn.prepareStatement(sql);
pstmt1.setString(1,empCode);
pstmt1.setString(2,refId);
pstmt1.setString(3,itemCode);
pstmt1.executeUpdate();
pstmt1.close();
pstmt1=null;
}
else
{
System.out.println("EMP_CODE__USER UPDATED");
sql="update physcandet set EMP_CODE__USER = '"+empCode +"' ,EMP_CODE__VERIFY = '"+empCode+"' where tran_id=? and item_code=? "; // change on 01/mar/14 start
pstmt1=conn.prepareStatement(sql);
pstmt1.setString(1,refId);
pstmt1.setString(2,itemCode);
pstmt1.executeUpdate();
pstmt1.close();
pstmt1=null;
}
sql="update physcandet set EMP_CODE__VERIFY = ? where tran_id=? and reverify='N' ";
pstmt1=conn.prepareStatement(sql);
pstmt1.setString(1,empCode);
pstmt1.setString(2,tranId);
upd = pstmt1.executeUpdate();
pstmt1.close();
pstmt1=null;
System.out.println(" upd success::"+upd);
// added BY RITESH 01/mar/14 end
} }
rs2.close(); rs2.close();
rs2=null; rs2=null;
......
...@@ -83,8 +83,10 @@ public class PhysicalCountSchedule implements Schedule ...@@ -83,8 +83,10 @@ public class PhysicalCountSchedule implements Schedule
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
String queryString=""; String queryString="";
String sql="";
try try
{ {
//Chnaged by Rohan on 7/2/12.start //Chnaged by Rohan on 7/2/12.start
//insertSchedule(); //insertSchedule();
System.out.println("************ ["+scheduleParamXML+"]"); System.out.println("************ ["+scheduleParamXML+"]");
...@@ -96,7 +98,25 @@ public class PhysicalCountSchedule implements Schedule ...@@ -96,7 +98,25 @@ public class PhysicalCountSchedule implements Schedule
{ {
disparmLoginSiteCode = ""; disparmLoginSiteCode = "";
} }
// added by ritesh on 28/02/14 START
int cnt= 0;
sql = " select COUNT(*) from users where name = TRIM('SYSTEM') ";
pstmt=conn.prepareStatement(sql);
rs = pstmt.executeQuery();
if(rs.next())
{
cnt = rs.getInt(1);
}
rs.close();rs = null;
pstmt.close();
pstmt=null;
System.out.println("Testing::user available::");
if(cnt ==0)
{
return "";
}
// added by ritesh on 28/02/14 END
if(disparmLoginSiteCode.trim().length() == 0) if(disparmLoginSiteCode.trim().length() == 0)
{ {
queryString="select distinct(site_code) from stock"; queryString="select distinct(site_code) from stock";
...@@ -151,11 +171,11 @@ public class PhysicalCountSchedule implements Schedule ...@@ -151,11 +171,11 @@ public class PhysicalCountSchedule implements Schedule
} }
public void insertSchedule(String loginSiteCode,String empCode,UserInfoBean userInfo) public void insertSchedule(String loginSiteCode,String empCode,UserInfoBean userInfo)
{ {
String errString = null;
Connection conn = null; Connection conn = null;
PreparedStatement pstmt = null,pstmt1 = null; PreparedStatement pstmt = null,pstmt1 = null;
PreparedStatement pstmtInsert = null; PreparedStatement pstmtInsert = null;
ResultSet rs = null,rs1 = null; ResultSet rs = null,rs1 = null, rs2 = null;
Statement stmt = null; Statement stmt = null;
java.util.Date todayDate=null; java.util.Date todayDate=null;
...@@ -265,7 +285,6 @@ public class PhysicalCountSchedule implements Schedule ...@@ -265,7 +285,6 @@ public class PhysicalCountSchedule implements Schedule
int priority=1; int priority=1;
int workDay=0; int workDay=0;
ArrayList<String> locationMap = new ArrayList<String>() ; ArrayList<String> locationMap = new ArrayList<String>() ;
try try
{ {
...@@ -416,10 +435,8 @@ public class PhysicalCountSchedule implements Schedule ...@@ -416,10 +435,8 @@ public class PhysicalCountSchedule implements Schedule
} }
else else
{ {
chgUser="WMS"; chgUser="WMS";
//queryString="update physcandet set status='X' where status is null ";commented by chandrashekar //queryString="update physcandet set status='X' where status is null ";commented by chandrashekar
queryString="update physcandet A set status='X' WHERE 1 IN(SELECT 1 FROM PHYSCAN B WHERE A.TRAN_ID=B.TRAN_ID AND B.SITE_CODE=?) AND A.status is null"; queryString="update physcandet A set status='X' WHERE 1 IN(SELECT 1 FROM PHYSCAN B WHERE A.TRAN_ID=B.TRAN_ID AND B.SITE_CODE=?) AND A.status is null";
pstmt=conn.prepareStatement(queryString); pstmt=conn.prepareStatement(queryString);
...@@ -427,6 +444,7 @@ public class PhysicalCountSchedule implements Schedule ...@@ -427,6 +444,7 @@ public class PhysicalCountSchedule implements Schedule
pstmt.executeUpdate(); pstmt.executeUpdate();
pstmt.close(); pstmt.close();
pstmt=null; pstmt=null;
System.out.println("currentMonthInString="+currentMonthInString); System.out.println("currentMonthInString="+currentMonthInString);
queryString="insert into physcan (tran_id,tran_date,site_code,chg_date,chg_user,chg_term,tran_type) values(?,?,?,?,?,?,?)"; queryString="insert into physcan (tran_id,tran_date,site_code,chg_date,chg_user,chg_term,tran_type) values(?,?,?,?,?,?,?)";
pstmt=conn.prepareStatement(queryString); pstmt=conn.prepareStatement(queryString);
...@@ -434,8 +452,10 @@ public class PhysicalCountSchedule implements Schedule ...@@ -434,8 +452,10 @@ public class PhysicalCountSchedule implements Schedule
pstmt.setTimestamp(2,dts); pstmt.setTimestamp(2,dts);
pstmt.setString(3,loginSiteCode); pstmt.setString(3,loginSiteCode);
pstmt.setTimestamp(4,dts); pstmt.setTimestamp(4,dts);
pstmt.setString(5,userInfo.getLoginCode()); // pstmt.setString(5,userInfo.getLoginCode());
pstmt.setString(6,userInfo.getRemoteHost()); // pstmt.setString(6,userInfo.getRemoteHost());
pstmt.setString(5,"SYSTEM"); // ADDED BY RITESH ON 28/MAR/2014
pstmt.setString(6,"SYSTEM"); // ADDED BY RITESH ON 28/MAR/2014
pstmt.setString(7,"A"); pstmt.setString(7,"A");
pstmt.executeUpdate(); pstmt.executeUpdate();
pstmt.close(); pstmt.close();
...@@ -706,7 +726,6 @@ public class PhysicalCountSchedule implements Schedule ...@@ -706,7 +726,6 @@ public class PhysicalCountSchedule implements Schedule
rs.close(); rs.close();
rs=null; rs=null;
} }
queryString="select distinct(work_date) from work_calendar where WORKING='Y' "// and WORK_DATE>=to_date(sysdate,'DD-MON-YY') " queryString="select distinct(work_date) from work_calendar where WORKING='Y' "// and WORK_DATE>=to_date(sysdate,'DD-MON-YY') "
+" and site_code = ? and work_date between ? and ? "; +" and site_code = ? and work_date between ? and ? ";
System.out.println("5-Print queryString---"+queryString); System.out.println("5-Print queryString---"+queryString);
...@@ -803,7 +822,6 @@ public class PhysicalCountSchedule implements Schedule ...@@ -803,7 +822,6 @@ public class PhysicalCountSchedule implements Schedule
System.out.println("3--rec----"+rec); System.out.println("3--rec----"+rec);
queryString=" SELECT DISTINCT T.ITEM_CODE,T.LOT_NO,T.LOT_SL,T.LOC_CODE,T.SITE_CODE,CYCLE_CRITERIA,0 QUANTITY,T.UNIT,I.ANALYSIS_CLASS , T.TRAN_ID FROM ITEM I,LOCATION L,INVTRACE T,ITEM_LOT_PACKSIZE P WHERE " + queryString=" SELECT DISTINCT T.ITEM_CODE,T.LOT_NO,T.LOT_SL,T.LOC_CODE,T.SITE_CODE,CYCLE_CRITERIA,0 QUANTITY,T.UNIT,I.ANALYSIS_CLASS , T.TRAN_ID FROM ITEM I,LOCATION L,INVTRACE T,ITEM_LOT_PACKSIZE P WHERE " +
//" AND I.ITEM_CODE NOT IN (SELECT ITEM_CODE FROM PHYSCAN A,PHYSCANDET B WHERE A.TRAN_ID=B.TRAN_ID AND ANALYSIS_CLASS='A' AND TO_CHAR(TRAN_DATE, 'MON/YYYY')=? AND CASE WHEN B.STATUS IS NULL THEN 'N' ELSE B.STATUS END ='Y' and A.tran_type='A') " + //" AND I.ITEM_CODE NOT IN (SELECT ITEM_CODE FROM PHYSCAN A,PHYSCANDET B WHERE A.TRAN_ID=B.TRAN_ID AND ANALYSIS_CLASS='A' AND TO_CHAR(TRAN_DATE, 'MON/YYYY')=? AND CASE WHEN B.STATUS IS NULL THEN 'N' ELSE B.STATUS END ='Y' and A.tran_type='A') " +
//" AND S.ITEM_CODE = I.ITEM_CODE AND S.LOC_CODE=L.LOC_CODE AND CYCLE_COUNT_REQD='Y' " + //" AND S.ITEM_CODE = I.ITEM_CODE AND S.LOC_CODE=L.LOC_CODE AND CYCLE_COUNT_REQD='Y' " +
...@@ -825,11 +843,10 @@ public class PhysicalCountSchedule implements Schedule ...@@ -825,11 +843,10 @@ public class PhysicalCountSchedule implements Schedule
rec++; rec++;
//change done by kunal on 1/04/13 for previous day empty //change done by kunal on 1/04/13 for previous day empty
boolean fromStock = false; boolean fromStock = false;
if(!locationMap.contains((String)rs.getString("LOC_CODE").trim())) if(!locationMap.contains((String)rs.getString("LOC_CODE").trim()))
{ {
System.out.println("Kunal Test"); System.out.println("Kunal Test");
sql = " select stock.quantity,stock.loc_code,stock.item_code,stock.lot_no,stock.lot_sl , item.analysis_class,item.cycle_criteria," sql = " select stock.quantity,stock.loc_code,stock.item_code,stock.lot_no,stock.lot_sl , item.analysis_class,item.cycle_criteria,"
+" item.unit from stock ,item where stock.item_code = item.item_code and stock.site_code = ? and stock.loc_code = ? and stock.quantity > 0 "; +" item.unit from stock ,item where stock.item_code = item.item_code and stock.site_code = ? and stock.loc_code = ? and stock.quantity > 0 ";
pstmt1 = conn.prepareStatement(sql); pstmt1 = conn.prepareStatement(sql);
...@@ -838,6 +855,7 @@ public class PhysicalCountSchedule implements Schedule ...@@ -838,6 +855,7 @@ public class PhysicalCountSchedule implements Schedule
rs1 = pstmt1.executeQuery(); rs1 = pstmt1.executeQuery();
while(rs1.next()) while(rs1.next())
{ {
System.out.println("insert from stock "); System.out.println("insert from stock ");
fromStock = true ; fromStock = true ;
insertItemProcess="insert into PHYSCANDET (TRAN_ID,LINE_NO,SITE_CODE,ITEM_CODE," + insertItemProcess="insert into PHYSCANDET (TRAN_ID,LINE_NO,SITE_CODE,ITEM_CODE," +
...@@ -856,7 +874,7 @@ public class PhysicalCountSchedule implements Schedule ...@@ -856,7 +874,7 @@ public class PhysicalCountSchedule implements Schedule
pstmtInsert.setString(9,rs1.getString("ANALYSIS_CLASS")); pstmtInsert.setString(9,rs1.getString("ANALYSIS_CLASS"));
pstmtInsert.setInt(10,0); pstmtInsert.setInt(10,0);
pstmtInsert.setString(11,rs1.getString("CYCLE_CRITERIA")); pstmtInsert.setString(11,rs1.getString("CYCLE_CRITERIA"));
pstmtInsert.setString(12,empCode); pstmtInsert.setString(12,empCode); //change ON 28/02/14
pstmtInsert.setString(13,rs1.getString("UNIT")); pstmtInsert.setString(13,rs1.getString("UNIT"));
//pstmtInsert.setString(14,"A");Commented by Manoj dtd 13/09/2013 to mark record as E if Previous Day Empty //pstmtInsert.setString(14,"A");Commented by Manoj dtd 13/09/2013 to mark record as E if Previous Day Empty
pstmtInsert.setString(14,"E"); pstmtInsert.setString(14,"E");
...@@ -873,7 +891,6 @@ public class PhysicalCountSchedule implements Schedule ...@@ -873,7 +891,6 @@ public class PhysicalCountSchedule implements Schedule
if(!fromStock) if(!fromStock)
{ {
System.out.println("insert from query "); System.out.println("insert from query ");
insertItemProcess="insert into PHYSCANDET (TRAN_ID,LINE_NO,SITE_CODE,ITEM_CODE," + insertItemProcess="insert into PHYSCANDET (TRAN_ID,LINE_NO,SITE_CODE,ITEM_CODE," +
"LOC_CODE,LOT_NO,LOT_SL,QUANTITY," + "LOC_CODE,LOT_NO,LOT_SL,QUANTITY," +
"ANALYSIS_CLASS,PRIORITY_SEQ,CYCLE_CRITERIA,EMP_CODE__USER,UNIT,TRAN_TYPE) " + "ANALYSIS_CLASS,PRIORITY_SEQ,CYCLE_CRITERIA,EMP_CODE__USER,UNIT,TRAN_TYPE) " +
...@@ -1004,7 +1021,6 @@ public class PhysicalCountSchedule implements Schedule ...@@ -1004,7 +1021,6 @@ public class PhysicalCountSchedule implements Schedule
} }
} }
} }
private boolean isExist(Connection conn, String tableName, String columnName, String value) throws ITMException, RemoteException private boolean isExist(Connection conn, String tableName, String columnName, String value) throws ITMException, RemoteException
{ {
...@@ -1625,10 +1641,15 @@ private int generateDetRec(String empCode,int rec,Connection conn,String tranId, ...@@ -1625,10 +1641,15 @@ private int generateDetRec(String empCode,int rec,Connection conn,String tranId,
rec++; rec++;
System.out.println("lineNo---"+rec); System.out.println("lineNo---"+rec);
System.out.println("Setting tranType Auto ---"); System.out.println("Setting tranType Auto ---");
// insertItemProcess="insert into PHYSCANDET (TRAN_ID,LINE_NO,SITE_CODE,ITEM_CODE," +
// "LOC_CODE,LOT_NO,LOT_SL,QUANTITY," +
// "ANALYSIS_CLASS,PRIORITY_SEQ,CYCLE_CRITERIA,EMP_CODE__USER,UNIT,TRAN_TYPE) " +
// "values(?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
// CHANGE BY RITESH ON 28/02/14 REMOVE EMP_CODE__USER
insertItemProcess="insert into PHYSCANDET (TRAN_ID,LINE_NO,SITE_CODE,ITEM_CODE," + insertItemProcess="insert into PHYSCANDET (TRAN_ID,LINE_NO,SITE_CODE,ITEM_CODE," +
"LOC_CODE,LOT_NO,LOT_SL,QUANTITY," + "LOC_CODE,LOT_NO,LOT_SL,QUANTITY," +
"ANALYSIS_CLASS,PRIORITY_SEQ,CYCLE_CRITERIA,EMP_CODE__USER,UNIT,TRAN_TYPE) " + "ANALYSIS_CLASS,PRIORITY_SEQ,CYCLE_CRITERIA,UNIT,TRAN_TYPE) " +
"values(?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; "values(?,?,?,?,?,?,?,?,?,?,?,?,?)";
pstmtInsert = conn.prepareStatement(insertItemProcess); pstmtInsert = conn.prepareStatement(insertItemProcess);
pstmtInsert.setString(1,tranId); pstmtInsert.setString(1,tranId);
pstmtInsert.setInt(2,rec); pstmtInsert.setInt(2,rec);
...@@ -1641,9 +1662,11 @@ private int generateDetRec(String empCode,int rec,Connection conn,String tranId, ...@@ -1641,9 +1662,11 @@ private int generateDetRec(String empCode,int rec,Connection conn,String tranId,
pstmtInsert.setString(9,aitem.getAnalysisClass()); pstmtInsert.setString(9,aitem.getAnalysisClass());
pstmtInsert.setInt(10,priority); pstmtInsert.setInt(10,priority);
pstmtInsert.setString(11,aitem.getCycleCriteria()); pstmtInsert.setString(11,aitem.getCycleCriteria());
pstmtInsert.setString(12,empCode); // pstmtInsert.setString(12,empCode);
pstmtInsert.setString(13,aitem.getUnit()); // pstmtInsert.setString(13,aitem.getUnit());
pstmtInsert.setString(14,"A"); pstmtInsert.setString(12,aitem.getUnit()); //CHANGE BY RITESH ON 28/02/14 REMOVE EMP_CODE__USER
// pstmtInsert.setString(14,"A");
pstmtInsert.setString(13,"A");
pstmtInsert.executeUpdate(); pstmtInsert.executeUpdate();
pstmtInsert.close(); pstmtInsert.close();
pstmtInsert=null; pstmtInsert=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