Commit f7cb66e1 authored by smestry's avatar smestry

W15CSUN005, Changed by Sneha. Updated the Warehouse User Activity dashboard for bug fixing


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@98213 ce508802-f39f-4f6c-b175-0d175dae99d5
parent af83f715
......@@ -50,7 +50,8 @@ public class ConsignmentDetails extends ValidatorEJB implements ConsignmentDetai
connDriver = null;
int count = 0;
Date dt1 = null, dt2 = null, dt3 = null, dt4 = null;
String week1Date = "", week2Date = "", week3Date = "", week4Date = "";
String week1Date = "", week2Date = "", week3Date = "", week4Date = "", distWeight = "", distCases = "", consumeWeight = "",
consumeCases = "", totalWeight = "", totalCases = "";
Calendar cal = Calendar.getInstance();
Format formatter = new SimpleDateFormat("dd-MMM-yy");
......@@ -106,10 +107,10 @@ public class ConsignmentDetails extends ValidatorEJB implements ConsignmentDetai
}
// no of cases for 1st week
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 ship_docs.ref_ser ='S-DSP' and shipment.confirmed = 'Y' and "
+ "shipment.shipment_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 > ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, siteCode);
pstmt.setString(2, week1Date);
......@@ -131,10 +132,10 @@ public class ConsignmentDetails extends ValidatorEJB implements ConsignmentDetai
}
// no of weight for 1st week
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 ship_docs.ref_ser ='S-DSP' and shipment.confirmed = 'Y' and "
+ "shipment.shipment_date > ? ";
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 > ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, siteCode);
pstmt.setString(2, week1Date);
......@@ -155,11 +156,68 @@ public class ConsignmentDetails extends ValidatorEJB implements ConsignmentDetai
rs = null;
}
// sum of weight and no of cases for D-ISS 1st week
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 > ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, siteCode);
pstmt.setString(2, week1Date);
rs = pstmt.executeQuery();
if (rs.next())
{
distWeight = checkNull(rs.getString(1));
distCases = checkNull(rs.getString(2));
System.out.println("Sum of weight from D-ISS for 1st Week :::::::::: " + distWeight);
System.out.println("No of cases from D-ISS for 1st Week :::::::::: " + distCases);
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(rs != null)
{
rs.close();
rs = null;
}
// sum of weight and no of cases for C-ISS 1st week
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 > ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, siteCode);
pstmt.setString(2, week1Date);
rs = pstmt.executeQuery();
if (rs.next())
{
consumeWeight = checkNull(rs.getString(1));
consumeCases = checkNull(rs.getString(2));
System.out.println("Sum of weight from C-ISS for 1st Week :::::::::: " + consumeWeight);
System.out.println("No of cases from C-ISS for 1st Week :::::::::: " + consumeCases);
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(rs != null)
{
rs.close();
rs = null;
}
//no of tasks performed for 1st week
sql = "select count(ptcn) from wave_task_det wd, wave_task w where wd.ref_ser = 'S-DSP' and w.site_code = ? "
+ "and trim(wd.wave_id) = trim(w.wave_id) and wd.ptcn in (select sd.ptcn from ship_docs sd, shipment s where "
+ "sd.ref_ser = 'S-DSP' and s.confirmed = 'Y' and trim(sd.shipment_id) = trim(s.shipment_id) and "
+ "s.shipment_date > ?) ";
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 > ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, siteCode);
pstmt.setString(2, week1Date);
......@@ -181,10 +239,9 @@ public class ConsignmentDetails extends ValidatorEJB implements ConsignmentDetai
}
// no of order process for 1st week
sql = "select count(sale_order) from wave_task_det wd, wave_task w where ref_ser = 'S-DSP' and "
+ "w.site_code = ? and trim(wd.wave_id) = trim(w.wave_id) and wd.ptcn in (select sd.ptcn from "
+ "ship_docs sd, shipment s where sd.ref_ser = 'S-DSP' and s.confirmed = 'Y' and "
+ "trim(sd.shipment_id) = trim(s.shipment_id) and s.shipment_date > ?) ";
sql = "select COUNT(distinct wave_task_det.SALE_ORDER) 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 > ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, siteCode);
pstmt.setString(2, week1Date);
......@@ -204,12 +261,16 @@ public class ConsignmentDetails extends ValidatorEJB implements ConsignmentDetai
rs.close();
rs = null;
}
// Sum of weight and Total cont of Cases
totalWeight = weight + distWeight + consumeWeight;
totalCases = cases + distCases + consumeCases;
rowData = new JSONObject();
week = "Week 1";
rowData.put("week", week);
rowData.put("shipment", shipment);
rowData.put("cases", cases);
rowData.put("weight", weight);
rowData.put("cases", totalCases);
rowData.put("weight", totalWeight);
rowData.put("tasks", tasks);
rowData.put("order", order);
rawDataJson.put(count, rowData);
......@@ -243,10 +304,10 @@ public class ConsignmentDetails extends ValidatorEJB implements ConsignmentDetai
}
// no of cases for 2nd week
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 ship_docs.ref_ser ='S-DSP' and shipment.confirmed = 'Y' and "
+ "shipment.shipment_date between ? and ? ";
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 between ? and ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, siteCode);
pstmt.setString(2, week2Date);
......@@ -270,10 +331,10 @@ public class ConsignmentDetails extends ValidatorEJB implements ConsignmentDetai
}
// no of weight for 2nd week
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 ship_docs.ref_ser ='S-DSP' and shipment.confirmed = 'Y' and "
+ "shipment.shipment_date between ? and ? ";
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 between ? and ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, siteCode);
pstmt.setString(2, week2Date);
......@@ -295,11 +356,70 @@ public class ConsignmentDetails extends ValidatorEJB implements ConsignmentDetai
rs = null;
}
// sum of weight and no of cases for D-ISS 1st week
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 between ? and ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, siteCode);
pstmt.setString(2, week2Date);
pstmt.setString(3, week1Date);
rs = pstmt.executeQuery();
if (rs.next())
{
distWeight = checkNull(rs.getString(1));
distCases = checkNull(rs.getString(2));
System.out.println("Sum of weight from D-ISS for 2nd Week :::::::::: " + distWeight);
System.out.println("No of cases from D-ISS for 2nd Week :::::::::: " + distCases);
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(rs != null)
{
rs.close();
rs = null;
}
// sum of weight and no of cases for C-ISS 1st week
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 between ? and ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, siteCode);
pstmt.setString(2, week2Date);
pstmt.setString(3, week1Date);
rs = pstmt.executeQuery();
if (rs.next())
{
consumeWeight = checkNull(rs.getString(1));
consumeCases = checkNull(rs.getString(2));
System.out.println("Sum of weight from C-ISS for 2nd Week :::::::::: " + consumeWeight);
System.out.println("No of cases from C-ISS for 2nd Week :::::::::: " + consumeCases);
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(rs != null)
{
rs.close();
rs = null;
}
//no of tasks performed for 2nd week
sql = "select count(ptcn) from wave_task_det wd, wave_task w where wd.ref_ser = 'S-DSP' and w.site_code = ? "
+ "and trim(wd.wave_id) = trim(w.wave_id) and wd.ptcn in (select sd.ptcn from ship_docs sd, shipment s where "
+ "sd.ref_ser = 'S-DSP' and s.confirmed = 'Y' and trim(sd.shipment_id) = trim(s.shipment_id) and "
+ "s.shipment_date between ? and ?) ";
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 between ? and ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, siteCode);
pstmt.setString(2, week2Date);
......@@ -322,10 +442,9 @@ public class ConsignmentDetails extends ValidatorEJB implements ConsignmentDetai
}
// no of order process for 2nd week
sql = "select count(sale_order) from wave_task_det wd, wave_task w where ref_ser = 'S-DSP' and "
+ "w.site_code = ? and trim(wd.wave_id) = trim(w.wave_id) and wd.ptcn in (select sd.ptcn from "
+ "ship_docs sd, shipment s where sd.ref_ser = 'S-DSP' and s.confirmed = 'Y' and "
+ "trim(sd.shipment_id) = trim(s.shipment_id) and s.shipment_date between ? and ?) ";
sql = "select COUNT(distinct wave_task_det.SALE_ORDER) 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 between ? and ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, siteCode);
pstmt.setString(2, week2Date);
......@@ -346,12 +465,17 @@ public class ConsignmentDetails extends ValidatorEJB implements ConsignmentDetai
rs.close();
rs = null;
}
week = "Week 2";
// Sum of weight and Total cont of Cases
totalWeight = weight + distWeight + consumeWeight;
totalCases = cases + distCases + consumeCases;
rowData = new JSONObject();
week = "Week 2";
rowData.put("week", week);
rowData.put("shipment", shipment);
rowData.put("cases", cases);
rowData.put("weight", weight);
rowData.put("cases", totalCases);
rowData.put("weight", totalWeight);
rowData.put("tasks", tasks);
rowData.put("order", order);
rawDataJson.put(count, rowData);
......@@ -359,6 +483,7 @@ public class ConsignmentDetails extends ValidatorEJB implements ConsignmentDetai
System.out.println("2nd Week data in rowData :::::::::: " + rowData);
System.out.println("2nd Week data in rawDataJson :::::::::: " + rawDataJson);
System.out.println(" ************** 3rd week ****************** ");
// no of shipment for 3rd week
sql = "select count(shipment_id) from shipment where site_code = ? and confirmed = 'Y' and "
......@@ -385,10 +510,10 @@ public class ConsignmentDetails extends ValidatorEJB implements ConsignmentDetai
}
// no of cases for 3rd week
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 ship_docs.ref_ser ='S-DSP' and shipment.confirmed = 'Y' and "
+ "shipment.shipment_date between ? and ? ";
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 between ? and ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, siteCode);
pstmt.setString(2, week3Date);
......@@ -411,10 +536,10 @@ public class ConsignmentDetails extends ValidatorEJB implements ConsignmentDetai
}
// no of weight for 3rd week
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 ship_docs.ref_ser ='S-DSP' and shipment.confirmed = 'Y' and "
+ "shipment.shipment_date between ? and ? ";
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 between ? and ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, siteCode);
pstmt.setString(2, week3Date);
......@@ -437,11 +562,71 @@ public class ConsignmentDetails extends ValidatorEJB implements ConsignmentDetai
rs = null;
}
// sum of weight and no of cases for D-ISS 1st week
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 between ? and ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, siteCode);
pstmt.setString(2, week3Date);
pstmt.setString(3, week2Date);
rs = pstmt.executeQuery();
if (rs.next())
{
distWeight = checkNull(rs.getString(1));
distCases = checkNull(rs.getString(2));
System.out.println("Sum of weight from D-ISS for 3rd Week :::::::::: " + distWeight);
System.out.println("No of cases from D-ISS for 3rd Week :::::::::: " + distCases);
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(rs != null)
{
rs.close();
rs = null;
}
// sum of weight and no of cases for C-ISS 1st week
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 between ? and ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, siteCode);
pstmt.setString(2, week3Date);
pstmt.setString(3, week2Date);
rs = pstmt.executeQuery();
if (rs.next())
{
consumeWeight = checkNull(rs.getString(1));
consumeCases = checkNull(rs.getString(2));
System.out.println("Sum of weight from C-ISS for 3rd Week :::::::::: " + consumeWeight);
System.out.println("No of cases from C-ISS for 3rd Week :::::::::: " + consumeCases);
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(rs != null)
{
rs.close();
rs = null;
}
//no of tasks performed for 3rd week
sql = "select count(ptcn) from wave_task_det wd, wave_task w where wd.ref_ser = 'S-DSP' and w.site_code = ? "
+ "and trim(wd.wave_id) = trim(w.wave_id) and wd.ptcn in (select sd.ptcn from ship_docs sd, shipment s where "
+ "sd.ref_ser = 'S-DSP' and s.confirmed = 'Y' and trim(sd.shipment_id) = trim(s.shipment_id) and "
+ "s.shipment_date between ? and ?) ";
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 between ? and ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, siteCode);
pstmt.setString(2, week3Date);
......@@ -464,10 +649,9 @@ public class ConsignmentDetails extends ValidatorEJB implements ConsignmentDetai
}
// no of order process for 3rd week
sql = "select count(sale_order) from wave_task_det wd, wave_task w where ref_ser = 'S-DSP' and "
+ "w.site_code = ? and trim(wd.wave_id) = trim(w.wave_id) and wd.ptcn in (select sd.ptcn from "
+ "ship_docs sd, shipment s where sd.ref_ser = 'S-DSP' and s.confirmed = 'Y' and "
+ "trim(sd.shipment_id) = trim(s.shipment_id) and s.shipment_date between ? and ?) ";
sql = "select COUNT(distinct wave_task_det.SALE_ORDER) 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 between ? and ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, siteCode);
pstmt.setString(2, week3Date);
......@@ -488,12 +672,16 @@ public class ConsignmentDetails extends ValidatorEJB implements ConsignmentDetai
rs.close();
rs = null;
}
week = "Week 3";
// Sum of weight and Total cont of Cases
totalWeight = weight + distWeight + consumeWeight;
totalCases = cases + distCases + consumeCases;
rowData = new JSONObject();
week = "Week 3";
rowData.put("week", week);
rowData.put("shipment", shipment);
rowData.put("cases", cases);
rowData.put("weight", weight);
rowData.put("cases", totalCases);
rowData.put("weight", totalWeight);
rowData.put("tasks", tasks);
rowData.put("order", order);
rawDataJson.put(count, rowData);
......@@ -527,10 +715,10 @@ public class ConsignmentDetails extends ValidatorEJB implements ConsignmentDetai
}
// no of cases for 4th week
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 ship_docs.ref_ser ='S-DSP' and shipment.confirmed = 'Y' and "
+ "shipment.shipment_date between ? and ? ";
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 between ? and ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, siteCode);
pstmt.setString(2, week4Date);
......@@ -553,10 +741,10 @@ public class ConsignmentDetails extends ValidatorEJB implements ConsignmentDetai
}
// no of weight for 4th week
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 ship_docs.ref_ser ='S-DSP' and shipment.confirmed = 'Y' and "
+ "shipment.shipment_date between ? and ? ";
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 between ? and ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, siteCode);
pstmt.setString(2, week4Date);
......@@ -578,11 +766,70 @@ public class ConsignmentDetails extends ValidatorEJB implements ConsignmentDetai
rs = null;
}
// sum of weight and no of cases for D-ISS 1st week
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 between ? and ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, siteCode);
pstmt.setString(2, week4Date);
pstmt.setString(3, week3Date);
rs = pstmt.executeQuery();
if (rs.next())
{
distWeight = checkNull(rs.getString(1));
distCases = checkNull(rs.getString(2));
System.out.println("Sum of weight from D-ISS for 4th Week :::::::::: " + distWeight);
System.out.println("No of cases from D-ISS for 4th Week :::::::::: " + distCases);
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(rs != null)
{
rs.close();
rs = null;
}
// sum of weight and no of cases for C-ISS 1st week
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 between ? and ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, siteCode);
pstmt.setString(2, week4Date);
pstmt.setString(3, week3Date);
rs = pstmt.executeQuery();
if (rs.next())
{
consumeWeight = checkNull(rs.getString(1));
consumeCases = checkNull(rs.getString(2));
System.out.println("Sum of weight from C-ISS for 4th Week :::::::::: " + consumeWeight);
System.out.println("No of cases from C-ISS for 4th Week :::::::::: " + consumeCases);
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(rs != null)
{
rs.close();
rs = null;
}
//no of tasks performed for 4th week
sql = "select count(ptcn) from wave_task_det wd, wave_task w where wd.ref_ser = 'S-DSP' and w.site_code = ? "
+ "and trim(wd.wave_id) = trim(w.wave_id) and wd.ptcn in (select sd.ptcn from ship_docs sd, shipment s where "
+ "sd.ref_ser = 'S-DSP' and s.confirmed = 'Y' and trim(sd.shipment_id) = trim(s.shipment_id) and "
+ "s.shipment_date between ? and ?) ";
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 between ? and ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, siteCode);
pstmt.setString(2, week4Date);
......@@ -605,10 +852,9 @@ public class ConsignmentDetails extends ValidatorEJB implements ConsignmentDetai
}
// no of order process for 4th week
sql = "select count(sale_order) from wave_task_det wd, wave_task w where ref_ser = 'S-DSP' and "
+ "w.site_code = ? and trim(wd.wave_id) = trim(w.wave_id) and wd.ptcn in (select sd.ptcn from "
+ "ship_docs sd, shipment s where sd.ref_ser = 'S-DSP' and s.confirmed = 'Y' and "
+ "trim(sd.shipment_id) = trim(s.shipment_id) and s.shipment_date between ? and ?) ";
sql = "select COUNT(distinct wave_task_det.SALE_ORDER) 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 between ? and ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, siteCode);
pstmt.setString(2, week4Date);
......@@ -629,18 +875,22 @@ public class ConsignmentDetails extends ValidatorEJB implements ConsignmentDetai
rs.close();
rs = null;
}
week = "Week 4";
// Sum of weight and Total cont of Cases
totalWeight = weight + distWeight + consumeWeight;
totalCases = cases + distCases + consumeCases;
rowData = new JSONObject();
week = "Week 4";
rowData.put("week", week);
rowData.put("shipment", shipment);
rowData.put("cases", cases);
rowData.put("weight", weight);
rowData.put("cases", totalCases);
rowData.put("weight", totalWeight);
rowData.put("tasks", tasks);
rowData.put("order", order);
rawDataJson.put(count, rowData);
count++;
System.out.println("4th Week data in rowData :::::::::: " + rowData);
System.out.println("4th Week data in rawDataJson :::::::::: " + rawDataJson);
System.out.println("3rd Week data in rowData :::::::::: " + rowData);
System.out.println("3rd Week data in rawDataJson :::::::::: " + rawDataJson);
}
catch (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