Commit 36c4a0f6 authored by smestry's avatar smestry

W15ESUN005, Changed by Sneha. Updated warehouse user activity dashboard.


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@98594 ce508802-f39f-4f6c-b175-0d175dae99d5
parent a84f1fdc
......@@ -50,6 +50,8 @@ public class ConsignmentDetails extends ValidatorEJB implements ConsignmentDetai
ConnDriver connDriver = new ConnDriver();
String shipment = "", cases = "", weight = "", tasks = "", order = "", week = "", distWeight = "", distCases = "",
consumeWeight = "", consumeCases = "", totalWeight = "", totalCases = "", inputDate = "", date = "";
//Changed by Sneha on 21-07-2015, Request ID: W15ESUN005
Timestamp shipDate = null;
......@@ -60,6 +62,7 @@ public class ConsignmentDetails extends ValidatorEJB implements ConsignmentDetai
conn = connDriver.getConnectDB(dataSourceName);
connDriver = null;
int count = 0;
int noOfDays = 0, dtCount = 0;
Calendar cal = Calendar.getInstance();
Calendar cal1 = Calendar.getInstance();
......@@ -67,6 +70,7 @@ public class ConsignmentDetails extends ValidatorEJB implements ConsignmentDetai
SimpleDateFormat dbDateFormat = new SimpleDateFormat(genericUtility.getDBDateFormat());
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(genericUtility.getApplDateFormat());
Format formatter = new SimpleDateFormat("dd-MMM-yy");
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yy");
if(fromDate.equals(null) || toDate.equals(null) || fromDate.equals("") || toDate.equals(""))
{
......@@ -277,6 +281,227 @@ public class ConsignmentDetails extends ValidatorEJB implements ConsignmentDetai
}
else
{
//Changed by Sneha on 23-09-2015 for date format, Request ID: W15ESUN005
sql = "SELECT to_date(?,'dd/mm/yy') - to_date(?,'dd/mm/yy') AS NO_OF_DAYS from dual ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, toDate);
pstmt.setString(2, fromDate);
rs = pstmt.executeQuery();
if (rs.next())
{
noOfDays = rs.getInt("NO_OF_DAYS");
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(rs != null)
{
rs.close();
rs = null;
}
System.out.println("noOfDays :::::::::::: " + noOfDays);
while(noOfDays >= dtCount)
{
sql = "select count(shipment_id) from shipment where site_code = ? and confirmed = 'Y' and "
+ "shipment_date = to_date(?,'dd/mm/yy') ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, siteCode);
pstmt.setString(2, fromDate);
rs = pstmt.executeQuery();
if (rs.next())
{
shipment = checkNull(rs.getString(1));
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(rs != null)
{
rs.close();
rs = null;
}
// no of cases for parameter date
sql = "select sum(despatchdet.no_art) from despatchdet despatchdet ,despatch despatch, ship_docs ship_docs, shipment shipment "
+ "where despatch.site_code = ? and despatch.desp_id = despatchdet.desp_id and ship_docs.ref_id = despatchdet.desp_id "
+ "and despatch.desp_id = ship_docs.ref_id and ship_docs.ref_ser ='S-DSP' and ship_docs.shipment_id = shipment.shipment_id "
+ "and ship_docs.ref_ser ='S-DSP' and shipment.confirmed = 'Y' and shipment.shipment_date = to_date(?,'dd/mm/yy') ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, siteCode);
pstmt.setString(2, fromDate);
rs = pstmt.executeQuery();
if (rs.next())
{
cases = checkNull(rs.getString(1));
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(rs != null)
{
rs.close();
rs = null;
}
// no of weight
sql = "select sum(despatchdet.gross_weight) from despatchdet despatchdet ,despatch despatch, ship_docs ship_docs, shipment shipment "
+ "where despatch.site_code = ? and despatch.desp_id = despatchdet.desp_id and ship_docs.ref_id = despatchdet.desp_id and "
+ "despatch.desp_id = ship_docs.ref_id and ship_docs.ref_ser ='S-DSP' and ship_docs.shipment_id = shipment.shipment_id and "
+ "ship_docs.ref_ser ='S-DSP' and shipment.confirmed = 'Y' and shipment.shipment_date = to_date(?,'dd/mm/yy') ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, siteCode);
pstmt.setString(2, fromDate);
rs = pstmt.executeQuery();
if (rs.next())
{
weight = checkNull(rs.getString(1));
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(rs != null)
{
rs.close();
rs = null;
}
// sum of weight and no of cases for D-ISS
sql = "select sum(case when distord_issdet.gross_weight is null then 0 else distord_issdet.gross_weight end), "
+ "sum(case when distord_issdet.no_art is null then 0 else distord_issdet.no_art end) from distord_iss distord_iss, "
+ "distord_issdet distord_issdet, ship_docs ship_docs, shipment shipment where ship_docs.ref_ser ='D-ISS' and "
+ "shipment.confirmed = 'Y' and ship_docs.ref_id = distord_iss.tran_id and distord_issdet.tran_id = distord_iss.tran_id and "
+ "distord_issdet.tran_id = ship_docs.ref_id and ship_docs.shipment_id = shipment.shipment_id and shipment.site_code = ? and "
+ "shipment.shipment_date = to_date(?,'dd/mm/yy') ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, siteCode);
pstmt.setString(2, fromDate);
rs = pstmt.executeQuery();
if (rs.next())
{
distWeight = checkNull(rs.getString(1));
distCases = checkNull(rs.getString(2));
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(rs != null)
{
rs.close();
rs = null;
}
// sum of weight and no of cases for C-ISS
sql = "select sum(case when consume_iss.gross_weight is null then 0 else consume_iss.gross_weight end), "
+ "sum(case when consume_iss_det.no_art is null then 0 else consume_iss_det.no_art end) from consume_iss consume_iss, "
+ "consume_iss_det consume_iss_det, ship_docs ship_docs, shipment shipment where ship_docs.ref_ser ='C-ISS' and "
+ "shipment.confirmed = 'Y' and consume_iss_det.cons_issue = consume_iss.cons_issue and ship_docs.ref_id = consume_iss.cons_issue "
+ "and consume_iss_det.cons_issue = ship_docs.ref_id and ship_docs.shipment_id = shipment.shipment_id and shipment.site_code = ? "
+ "and shipment.shipment_date = to_date(?,'dd/mm/yy') ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, siteCode);
pstmt.setString(2, fromDate);
rs = pstmt.executeQuery();
if (rs.next())
{
consumeWeight = checkNull(rs.getString(1));
consumeCases = checkNull(rs.getString(2));
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(rs != null)
{
rs.close();
rs = null;
}
//no of tasks performed
sql = "select COUNT(*) from ship_docs ship_docs, shipment shipment, wave_task_det wave_task_det where "
+ "shipment.site_code = ? and ship_docs.ptcn = wave_task_det.ptcn and ship_docs.shipment_id = shipment.shipment_id and "
+ "ship_docs.ref_ser ='S-DSP' and shipment.confirmed = 'Y' and shipment.shipment_date = to_date(?,'dd/mm/yy') ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, siteCode);
pstmt.setString(2, fromDate);
rs = pstmt.executeQuery();
if (rs.next())
{
tasks = checkNull(rs.getString(1));
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(rs != null)
{
rs.close();
rs = null;
}
// no of order process
sql = "select COUNT(distinct wave_task_det.ptcn) from ship_docs ship_docs, shipment shipment, wave_task_det wave_task_det "
+ "where shipment.site_code = ? and ship_docs.ptcn = wave_task_det.ptcn and ship_docs.shipment_id = shipment.shipment_id and "
+ "ship_docs.ref_ser ='S-DSP' and shipment.confirmed = 'Y' and shipment.shipment_date = to_date(?,'dd/mm/yy') ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, siteCode);
pstmt.setString(2, fromDate);
rs = pstmt.executeQuery();
if (rs.next())
{
order = checkNull(rs.getString(1));
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(rs != null)
{
rs.close();
rs = null;
}
// Sum of weight and Total count of Cases
totalWeight = weight + distWeight + consumeWeight;
totalCases = cases + distCases + consumeCases;
firstDate = sdf.parse(fromDate);
cal1.setTime(firstDate);
firstDate = cal1.getTime();
date = formatter.format(firstDate);
rowData = new JSONObject();
rowData.put("date", date);
rowData.put("shipment", shipment);
rowData.put("cases", totalCases);
rowData.put("weight", totalWeight);
rowData.put("tasks", tasks);
rowData.put("order", order);
rawDataJson.put(count, rowData);
count++;
cal1.add(Calendar.DATE, + 1);
firstDate = cal1.getTime();
fromDate = sdf.format(firstDate);
System.out.println("Added 1day to fromDate :::::::::: " + firstDate);
dtCount++;
}
//End by Sneha on 23-09-2015 for date format, Request ID: W15ESUN005
/*
firstDate = simpleDateFormat.parse(fromDate);
lastDate = simpleDateFormat.parse(toDate);
......@@ -285,15 +510,16 @@ public class ConsignmentDetails extends ValidatorEJB implements ConsignmentDetai
lastDate = cal1.getTime();
System.out.println("Added 1day to To_Date :::::::::: " + lastDate);
while(firstDate.before(lastDate))
{
cal.setTime(firstDate);
cal.setTime(firstDate);
inputDate = dbDateFormat.format(cal.getTime());
shipDate = Timestamp.valueOf(inputDate + " 00:00:00.0");
System.out.println("Shipment Date :::::: " + shipDate);
System.out.println("Shipment Date :::::: " + shipDate);*/
// no of shipment for parameter date
sql = "select count(shipment_id) from shipment where site_code = ? and confirmed = 'Y' and "
/*sql = "select count(shipment_id) from shipment where site_code = ? and confirmed = 'Y' and "
+ "shipment_date = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, siteCode);
......@@ -479,7 +705,7 @@ public class ConsignmentDetails extends ValidatorEJB implements ConsignmentDetai
cal.add(Calendar.DATE, + 1);
firstDate = cal.getTime();
System.out.println("Added 1day in current date :::::: " + firstDate);
}
} */
}
//End by Sneha on 21-07-2015, Request ID: W15ESUN005
......
......@@ -44,11 +44,8 @@ public class UserActivity extends ValidatorEJB implements UserActivityRemote, Us
PreparedStatement pstmt = null;
// Changed by Sneha Mestry on 29-07-2015, Request ID: W15DSUN014
String sql = "", empCode = "", empName = "", pickOrder = "", pickType = "", noArt = "", locCode = "",
inputDate = "";
String sql = "", empCode = "", empName = "", pickOrder = "", pickType = "", noArt = "", locCode = "", inputDate = "";
Timestamp tranDateTo = null, tranDateFrom = null;
// End by Sneha Mestry on 29-07-2015, Request ID: W15DSUN014
/*
......@@ -64,7 +61,7 @@ public class UserActivity extends ValidatorEJB implements UserActivityRemote, Us
connDriver = null;
int count = 0;
// Changed by Sneha Mestry on 29-07-2015, Request ID: W15DSUN014
String dbDateFormat = genericUtility.getDBDateFormat();
/*String dbDateFormat = genericUtility.getDBDateFormat();
String simpleDateFormat = genericUtility.getApplDateFormat();
inputDate = genericUtility.getValidDateString(fromDate, simpleDateFormat, dbDateFormat);
......@@ -75,21 +72,25 @@ public class UserActivity extends ValidatorEJB implements UserActivityRemote, Us
inputDate = genericUtility.getValidDateString(toDate, simpleDateFormat, dbDateFormat);
System.out.println("inputDate fromDate :::::: " + inputDate);
tranDateTo = Timestamp.valueOf(inputDate + " 00:00:00.0");
System.out.println("TimeStamp toDate :::::: " + tranDateTo);
System.out.println("TimeStamp toDate :::::: " + tranDateTo);*/
sql = "SELECT DDF_GET_EMP_NAME(PIH.EMP_CODE__APRV) AS EMP_NAME, PIH.EMP_CODE__APRV AS EMP_CODE__APRV, "
+ "COUNT(PID.PICK_ORDER) AS COUNT_PICK_ORDER, PIH.PICK_TYPE, "
+ "(CASE WHEN PIH.PICK_TYPE = 'A' THEN SUM(PID.QUANTITY) ELSE SUM(PID.NO_ART) END) AS SUM_NO_ART, "
+ "COUNT(PID.LOC_CODE) AS COUNT_LOC_CODE FROM PICK_ISS_HDR PIH, PICK_ISS_DET PID "
+ "WHERE PIH.EMP_CODE__APRV >= ? AND PIH.EMP_CODE__APRV <= ? AND PIH.TRAN_DATE >= ? AND PIH.TRAN_DATE <= ? "
+ "WHERE PIH.EMP_CODE__APRV >= ? AND PIH.EMP_CODE__APRV <= ? "
+ "AND PIH.TRAN_DATE >= to_date(?,'dd/mm/yy') "
+ "AND PIH.TRAN_DATE <= to_date(?,'dd/mm/yy') "
+ "AND PIH.PICK_ORDER = PID.PICK_ORDER AND PIH.TRAN_ID=PID.TRAN_ID AND PIH.CONFIRMED ='Y' AND PIH.site_code = ? AND "
+ "INSTR(CASE WHEN pick_type = 'C' THEN Q'(C','M)' WHEN pick_type = 'A' THEN 'A' WHEN pick_type = 'B' THEN Q'(C','M','A)' END, "
+ "PIH.PICK_TYPE) > 0 GROUP BY PIH.EMP_CODE__APRV, PID.PICK_ORDER, PIH.PICK_TYPE ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCodeFrom);
pstmt.setString(2, empCodeTo);
pstmt.setTimestamp(3, tranDateFrom);
pstmt.setTimestamp(4, tranDateTo);
pstmt.setString(3, fromDate);
pstmt.setString(4, toDate);
/*pstmt.setTimestamp(3, tranDateFrom);
pstmt.setTimestamp(4, tranDateTo);*/
pstmt.setString(5, siteCode);
rs = pstmt.executeQuery();
while (rs.next())
......
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