Commit a41e669d authored by pjain's avatar pjain

changed by sankara on 04/09/14 updated deallocartconf and wavegenerationprc...

changed by sankara on 04/09/14 updated deallocartconf and wavegenerationprc and docktranpos and shipmentprc and docktranconf and wave_task metadta


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@96158 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 54b55b66
......@@ -642,6 +642,8 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
{
updateWaveStatusDespatch(tempPTCN,conn);
updateCartonMasterstatus(tempPTCN, conn);
//changed by sankara on 29/07/14 update despatch deallocate status in wave_task_det.
updateDespatchDeallocateStatus(tempPTCN, conn);
}
//Changed By Pragyan 02-JUL-14 (Issue tracker No 396)To get proper count from pick order and pick line no.
}
......@@ -2334,6 +2336,8 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
updateWaveStatusTasks(currentReplOrder, "R", conn);
}
pstmt.close(); pstmt = null;
//changed by sankara on 29/07/14 for update deallocate status in wave_task_det
updateTaskDeallocateStatus(currentReplOrder,conn);
}
}
// this below task is usefull for stock to dock case start
......@@ -2423,6 +2427,8 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
updateWaveStatusTasks(parentReplOrder, "R", conn);
}
pstmt.close(); pstmt = null;
//changed by sankara on 29/07/14 update deallocate status in wave_task_det
updateTaskDeallocateStatus(parentReplOrder,conn);
}
//changed by sankara on 20/06/14 update status in wave_task_det end.
//changed by sankara on 03/05/14 update cancel_mode for parent repl order only
......@@ -2474,6 +2480,8 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
updateWaveStatusTasks(currentReplOrder, "R", conn);
}
pstmt.close(); pstmt = null;
//changed by sankara on 29/07/14 for update status in wave_task_det.
updateTaskDeallocateStatus(currentReplOrder, conn);
}
//changed by sankara on 20/06/14 update status in wave_task_det end.
}
......@@ -2498,6 +2506,8 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
updateWaveStatusTasks(parentReplOrder, "R", conn);
}
pstmt.close(); pstmt = null;
//changed by sankara on 29/07/14 for update status in wave_task_det.
updateTaskDeallocateStatus(parentReplOrder, conn);
}
}
////////////// FOR PSO TASK CANCELLING IF NO DEPENDANCY END
......@@ -2550,7 +2560,8 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
updateWaveStatusTasks(parentReplOrder, "R", conn);
}
pstmt.close(); pstmt = null;
//changed by sankara on 29/07/14 for update status in wave_task_det.
updateTaskDeallocateStatus(parentReplOrder, conn);
///////////////////////////////////////////////
System.out.println(" DSO repl deallocating ");
sql = "UPDATE REPL_ORD_DET SET CANCEL_MODE = 'Y',ACTUAL_QTY = 0 WHERE REPL_ORDER = ? AND LINE_NO = ? ";
......@@ -2573,7 +2584,8 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
updateWaveStatusTasks(supRerplOrder, "R", conn);
}
pstmt.close(); pstmt = null;
//changed by sankara on 29/07/14 for update status in wave_task_det.
updateTaskDeallocateStatus(supRerplOrder, conn);
}
////////////// FOR DSO TASK CANCELLING IF NO DEPENDANCY END
}
......@@ -2750,6 +2762,8 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
updateWaveStatusTasks(currentReplOrder, "R", conn);
}
pstmt.close(); pstmt = null;
//changed by sankara on 29/07/14 for update status in wave_task_det.
updateTaskDeallocateStatus(currentReplOrder, conn);
}
}
if( parentReplOrder.trim().length() > 0 )
......@@ -2799,6 +2813,8 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
updateWaveStatusTasks(parentReplOrder, "R", conn);
}
pstmt.close(); pstmt = null;
//changed by sankara on 29/07/14 for update status in wave_task_det.
updateTaskDeallocateStatus(parentReplOrder, conn);
sql = "UPDATE REPL_ORD_DET SET CANCEL_MODE = 'Y' WHERE REPL_ORDER = ? AND LINE_NO = ? ";
pstmt = conn.prepareStatement(sql);
......@@ -2819,7 +2835,8 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
System.out.println(" WAVE_TASK_DET updated succesfully ");
}
pstmt.close(); pstmt = null;
//changed by sankara on 29/07/14 for update status in wave_task_det.
updateTaskDeallocateStatus(currentReplOrder, conn);
}
}
......@@ -3128,6 +3145,8 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
updateWaveStatusTasks(refId, "P", conn);
}
//changed by sankara on 29/07/14 for update status in wave_task_det.
updateTaskDeallocateStatus(refId, conn);
if("M".equalsIgnoreCase(pickType))
{
......@@ -3220,6 +3239,8 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
updateWaveStatusTasks(refId, "P", conn);
System.out.println(refId+ " WAVE_TASK_DET is updated susessfully ");
}
//changed by sankara on 29/07/14 for update status in wave_task_det.
updateTaskDeallocateStatus(refId, conn);
//Changed by Dhanraj START 10-JUL-14 (Pragyan) FOR Task Status CREATED not HELD when order id confirmed(Y).
if("M".equalsIgnoreCase(pickType))
{
......@@ -3266,6 +3287,8 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
{
updateWaveStatusTasks(refId, "R", conn);
}
//changed by sankara on 29/07/14 for update status in wave_task_det.
updateTaskDeallocateStatus(refId, conn);
}
}
}
......@@ -3566,6 +3589,8 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
}
pstmt.close(); pstmt = null;
} // 16/06/14 end.
//changed by sankara on 29/07/14 for update deallocate status in wave_task_det
updateTaskDeallocateStatus(replOrder, conn);
if(parentReplOrder.trim().length() > 0)
{
......@@ -3876,6 +3901,8 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
updateWaveStatusTasks(refId, "R", conn);
}
pstmt.close(); pstmt = null;
//changed by sankara on 29/07/14 for update status in wave_task_det.
updateTaskDeallocateStatus(refId, conn);
/*sql = "UPDATE CARTON_MASTER SET STATUS = 'R' WHERE PICK_ORDER = ? AND LINE_NO__PICK = ? ";
pstmt = conn.prepareStatement(sql);
......@@ -4323,6 +4350,202 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
return updateCount;
}
//Changed By Pragyan 02-JUL-14 (Issue tracker No 396)To update status as C if consolidated to doc called.start
//changed by sankara on 29/07/14 for update deallocated status in wave_task_det start.
private int updateTaskDeallocateStatus(String refID, Connection conn) throws ITMException
{
String sql = "";
PreparedStatement pstmt = null, pstmt1=null;
ResultSet rs = null, rs1=null;
String refSeries = "";
int updateCount = 0;
int deallocQty = 0;
int count = 0;
String ptcn = "";
try
{
System.out.println("refId::::::"+refID);
sql = " SELECT PTCN, REF_SER FROM WAVE_TASK_DET WHERE REF_ID = ? AND REF_SER <> 'S-DSP' AND STATUS = 'Y' AND WAVE_STATUS NOT IN ('D','V') ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, refID);
rs = pstmt.executeQuery();
if(rs.next())
{
ptcn = checkNull(rs.getString(1));
refSeries = checkNull(rs.getString(2));
System.out.println("ptcn:::::::::"+ptcn);
System.out.println("refSeries:::::::::"+refSeries);
}
rs.close();rs = null;
pstmt.close(); pstmt = null;
if( "C-PICK".equalsIgnoreCase(refSeries) || "A-PICK".equalsIgnoreCase(refSeries) || "M-PICK".equalsIgnoreCase(refSeries) )
{
sql = " SELECT SUM ( QUANTITY - CASE WHEN DEALLOC_QTY IS NULL THEN 0 ELSE DEALLOC_QTY END ) AS DEALLOC_QTY FROM " +
" PICK_ORD_DET WHERE PICK_ORDER = ? AND STATUS ='C' ";
pstmt1 = conn.prepareStatement(sql);
pstmt1.setString(1, refID);
rs1 = pstmt1.executeQuery();
if(rs1.next())
{
deallocQty = rs1.getInt("DEALLOC_QTY");
System.out.println("deallocQty::::::"+deallocQty);
}
rs1.close();rs1 = null;
pstmt1.close(); pstmt1 = null;
if( deallocQty == 0 )
{
sql = " UPDATE WAVE_TASK_DET SET WAVE_STATUS = 'D' WHERE PTCN = ? AND REF_SER = ? AND REF_ID = ? ";
pstmt1 = conn.prepareStatement(sql);
pstmt1.setString(1, ptcn);
pstmt1.setString(2, refSeries);
pstmt1.setString(3, refID);
updateCount = pstmt1.executeUpdate();
if(updateCount > 0)
{
System.out.println("wave_task_det Has been updated["+updateCount+"]");
}
if(pstmt1 != null)
{
pstmt1.close();
pstmt1 = null;
}
}
}
else
{
sql = " SELECT COUNT(*) AS COUNT FROM REPL_ORD_DET WHERE REPL_ORDER = ? AND (CASE WHEN CANCEL_MODE IS NULL THEN 'N' ELSE CANCEL_MODE END) = 'N' ";
pstmt1 = conn.prepareStatement(sql);
pstmt1.setString(1, refID);
rs1 = pstmt1.executeQuery();
if(rs1.next())
{
count = rs1.getInt(1);
System.out.println("count::::::"+count);
}
rs1.close();rs1 = null;
pstmt1.close(); pstmt1 = null;
if( count == 0 )
{
sql = " UPDATE WAVE_TASK_DET SET WAVE_STATUS = 'D' WHERE PTCN = ? AND REF_SER = ? AND REF_ID = ? ";
pstmt1 = conn.prepareStatement(sql);
pstmt1.setString(1, ptcn);
pstmt1.setString(2, refSeries);
pstmt1.setString(3, refID);
updateCount = pstmt1.executeUpdate();
if(updateCount > 0)
{
System.out.println("wave_task_det Has been updated["+updateCount+"]");
}
if(pstmt1 != null)
{
pstmt1.close();
pstmt1 = null;
}
}
}
}
catch(Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
finally
{
try
{
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
catch (Exception e2)
{
e2.printStackTrace();
throw new ITMException(e2);
}
}
return updateCount;
}
//changed by sankara on 29/07/14 for update deallocated status in wave_task_det end.
//changed by sankara on 29/07/14 for update dealloc despatch status in wave_task_det start.
private int updateDespatchDeallocateStatus(String ptcn, Connection conn) throws ITMException
{
String sql = "";
PreparedStatement pstmt1=null;
ResultSet rs1 = null;
int count = 0;
int updateCount = 0;
try
{
System.out.println("ptcn::::::"+ptcn);
sql = " SELECT COUNT(*) AS COUNT FROM WAVE_TASK_DET WHERE PTCN = ? AND REF_SER <> 'S-DSP' AND WAVE_STATUS IN ('C','W','D') ";
pstmt1 = conn.prepareStatement(sql);
pstmt1.setString(1, ptcn);
rs1 = pstmt1.executeQuery();
if(rs1.next())
{
count = rs1.getInt("COUNT");
System.out.println("despatchcount::::::"+count);
}
rs1.close();rs1 = null;
pstmt1.close(); pstmt1 = null;
if(count == 0)
{
sql = " UPDATE WAVE_TASK_DET SET WAVE_STATUS = 'D' WHERE PTCN = ? AND REF_SER = 'S-DSP' ";
pstmt1 = conn.prepareStatement(sql);
pstmt1.setString(1, ptcn);
updateCount = pstmt1.executeUpdate();
if(updateCount > 0)
{
System.out.println("wave_task_det Has been updated["+updateCount+"]");
}
if(pstmt1 != null)
{
pstmt1.close();
pstmt1 = null;
}
}
}
catch(Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
finally
{
try
{
if(rs1 != null)
{
rs1.close();
rs1 = null;
}
if(pstmt1 != null)
{
pstmt1.close();
pstmt1 = null;
}
}
catch (Exception e2)
{
e2.printStackTrace();
throw new ITMException(e2);
}
}
return updateCount;
}
//changed by sankara on 29/07/14 for update dealloc despatch status in wave_task_det end.
//changed by sankara on 23/08/14 for update active repl quantity to normal repl start.
private int updateActiveReplquantity(String parentReplOrder, int parentReplOrdLine, Connection conn) throws ITMException
{
......
/*******************************************
Title : DocTranPostSaveEJB
Date : 03/08/12
Author: CPandey
********************************************************/
package ibase.webitm.ejb.wms;
import ibase.system.config.*;
import ibase.webitm.ejb.*;
import ibase.webitm.ejb.dis.DistCommon;
import ibase.webitm.ejb.dis.InvAllocTraceBean;
import ibase.webitm.ejb.dis.StockUpdate;
import ibase.webitm.utility.GenericUtility;
import ibase.webitm.utility.ITMException;
import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.utility.TransIDGenerator;
import ibase.utility.CommonConstants;
import java.io.*;
import java.rmi.RemoteException;
import java.sql.*;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.*;
import org.w3c.dom.*;
import javax.ejb.*;
import javax.naming.InitialContext;
@javax.ejb.Stateless
public class DockTranConf extends ValidatorEJB implements DockTranConfLocal,DockTranConfRemote
{
/*public String postSave()throws RemoteException,ITMException
{
return "";
}*/
//Changed By Pragyan 09-MAY-14 to Take Local connection
//public String postSave(String domString, String tranId,String editFlag, String xtraParams, Connection conn ) throws RemoteException,ITMException
public String confirm(String domString, String tranID,String editFlag, String xtraParams, Connection conn ) throws RemoteException,ITMException
{
System.out.println( "Calling DockTranConfejb.........................................." );
String forcedFlag = "false" ;
String errString = "";
String sql = "";
String pickOrder = "";
String pickType = "";
String palletNo = "";
String itemCode = "",siteCode = "",locCode = "",lotNo = "",lotSl = "",locCodeSys = "",
saleOrder = "",lineNoSord = "",replOrder = "",retString = "",ptcn="";
double quantity = 0.0,noArt = 0.0;
int totOrdDet = 0,lineNo = 0;
int ordDetScaned = 0;
int updCnt = 0;
boolean toCommit = false;
java.sql.Timestamp expDate = null,mfgDate = null,restestDate = null;
Document dom = null;
GenericUtility genericUtility = GenericUtility.getInstance();
java.util.Date currDate1 = new java.util.Date();
java.sql.Timestamp currDate = new java.sql.Timestamp( System.currentTimeMillis() );
StockUpdate stkUpdate = null;
String acctCodeDr = "",cctrCodeDr = "",packCode = "",unit = "",grade = "",remarks = "",
unitAlt = "",stagingLoc = "", batchNo = "",siteCodeMfg = "",packInstr = "",
suppCodeMfg = "",dimension = "",locCodeTo = "", tranId = "";
String updateSql = "";
boolean isError = false;
String empCode = genericUtility.getValueFromXTRA_PARAMS( xtraParams, "loginEmpCode" );
//StockUpdate stkUpdate = null;
InvAllocTraceBean invAllocTrace = null;
HashMap strAllocate = null;
DistCommon distCommon = new DistCommon();
//stagingLoc = distCommon.getDisparams( "999999", "STAGING_LOC", conn );
stkUpdate = new StockUpdate();
invAllocTrace = new InvAllocTraceBean();
double stkRate = 0.0,stkGrossRate = 0.0,convQtyStduom = 0.0,batchSize = 0.0;
PreparedStatement pstmt = null,pstmtStock = null,pstmtUpd = null;
ResultSet rs = null,rsStock = null;
HashMap updateRowMap = null;
PickIssConf pickConf = new PickIssConf();
// 10/10/12 manoharan
HashMap itmVolumeMap = new HashMap();
double shipperSize = 0, itemGrossWeight = 0, caseGrossWeight = 0, itemNetWeight = 0, caseNetWeight = 0;
// end 10/10/12 manoharan
//Changed By 02/05/13 Pragyan To check the sordalloc allocated quantity > quantity then insert new record deducte quantity from old location.start
PreparedStatement pstmt1 = null,pstmtSord = null;
ResultSet rs1 = null,rsSord = null;
String expLev = "",itemCodeOrd = "",itemRef = "",status = "",allocMode = "",
itemGrade = "",reasCode = "",unitStd = "",sSQL = "";
java.sql.Timestamp dateAlloc = null;
double qtyOrd = 0.0,sordAllocQty = 0.0;
ITMDBAccessEJB itmDBAccess = new ITMDBAccessEJB();
//Changed By 02/05/13 Pragyan To check the sordalloc allocated quantity > quantity then insert new record deducte quantity from old location.end
//Changed By Pragyan 09-MAY-14 to Take Local connection.Start
/*ConnDriver connDriver = null;
Connection conn=null;*/
try
{
//Changed By Pragyan 09-MAY-14 to Take Local connection.Start
/*connDriver = new ConnDriver();
conn = connDriver.getConnectDB("DriverValidator");
if(conn==null)
{
System.out.println("Connection is null");
return "";
}*/
conn.setAutoCommit(false);
stagingLoc = distCommon.getDisparams( "999999", "STAGING_LOC", conn );
//Changed By Pragyan 09-MAY-14 to Take Local connection.end
updateRowMap = new HashMap() ;
String applDateFormat = genericUtility.getApplDateFormat();
String dbDateFormat = genericUtility.getDBDateFormat();
SimpleDateFormat sdf = new SimpleDateFormat(applDateFormat);
String currDateStr = sdf.format(currDate1);
java.sql.Timestamp tranDate = java.sql.Timestamp.valueOf(genericUtility.getValidDateString( currDateStr , applDateFormat, dbDateFormat ) + " 00:00:00.0") ;
//conn.setAutoCommit(false);
dom = genericUtility.parseString(domString);
palletNo = genericUtility.getColumnValue("pallet_no", dom, "1", "1");
//locCodeSys = genericUtility.getColumnValue("loc_code__sys", dom, "1", "1");
System.out.println("Location code to ->>["+locCodeSys+"]");
locCodeTo = genericUtility.getColumnValue("loc_code__to", dom, "2" );
//pickOrder = genericUtility.getColumnValueFromNode("pick_order", dom.getElementsByTagName("Detail2").item(0));
System.out.println("palert no from generic utility ["+palletNo+"] locCodeTo [" + locCodeTo + "]");
//sql = "SELECT HDR1.tran_id tran_id,HDR.PICK_TYPE,HDR1.PICK_ORDER FROM PICK_ORD_HDR HDR,PICK_ISS_HDR HDR1 WHERE HDR.PICK_ORDER = HDR1.PICK_ORDER AND HDR1.PALLET_NO = ?";//PICK_ISS_HDR
//Changed By Pragyan 06/03/12 To check only "N" trf status
//sql = "SELECT HDR.PICK_TYPE,HDR1.PICK_ORDER FROM PICK_ORD_HDR HDR,PICK_ISS_HDR HDR1 WHERE HDR.PICK_ORDER = HDR1.PICK_ORDER AND HDR1.PALLET_NO = ?";//PICK_ISS_HDR
/* sql = "SELECT HDR1.TRAN_ID TRAN_ID,HDR.PICK_TYPE,HDR1.PICK_ORDER FROM PICK_ORD_HDR HDR,PICK_ISS_HDR HDR1 WHERE HDR.PICK_ORDER = HDR1.PICK_ORDER AND HDR1.PALLET_NO = ? AND (CASE WHEN HDR1.TRF_STATUS IS NULL THEN 'N' ELSE HDR1.TRF_STATUS END) = ?";//PICK_ISS_HDR
pstmt = conn.prepareStatement(sql);
pstmt.setString( 1, palletNo);
pstmt.setString( 2, "N");
rs = pstmt.executeQuery();
if(rs.next())
{
tranId = rs.getString("tran_id")==null?"":rs.getString("tran_id");
pickType = rs.getString("pick_type")==null?"":rs.getString("pick_type");
pickOrder = rs.getString("pick_order")==null?"":rs.getString("pick_order");
System.out.println("pick order and pick type---- ["+palletNo+"] and pickType is ----["+pickType+"]");
}
rs.close(); rs = null;
pstmt.close(); pstmt = null;*/
sql = " SELECT TRAN_ID__ISS FROM DOCK_TRAN WHERE TRAN_ID = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString( 1, tranID);
rs = pstmt.executeQuery();
if(rs.next())
{
tranId = rs.getString("TRAN_ID__ISS");
}
rs.close(); rs = null;
pstmt.close(); pstmt = null;
sql = "UPDATE PICK_ISS_DET SET LOC_CODE__TO = ? WHERE TRAN_ID = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString( 1, locCodeTo);
pstmt.setString( 2, tranId);
pstmt.executeUpdate();
pstmt.close(); pstmt = null;
sql = "UPDATE DOCK_TRAN_DET SET LOC_CODE__TO = ? WHERE TRAN_ID = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString( 1, locCodeTo);
pstmt.setString( 2, tranID);
pstmt.executeUpdate();
pstmt.close(); pstmt = null;
//Update the carton master
/*
sql = "UPDATE CARTON_MASTER SET STATUS = 'U' WHERE CARTON_NO IN(SELECT CARTON_NO FROM PICK_ISS_DET WHERE PICK_ORDER = ? )";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, pickOrder);
int updCnt = pstmt.executeUpdate();
pstmt.close(); pstmt = null;
if(updCnt > 0)
{
System.out.println("---row updated sucessfully of master pick---->"+updCnt);
}
*/
//validation for null
//stagingLoc = distCommon.getDisparams( "999999", "STAGING_LOC", conn )==null?"":distCommon.getDisparams( "999999", "STAGING_LOC", conn );
if("M".equalsIgnoreCase(pickType))
{
stagingLoc = distCommon.getDisparams( "999999", "STAGING_LOC_MPK", conn)==null?"":distCommon.getDisparams( "999999", "STAGING_LOC_MPK", conn);
}
else
{
stagingLoc = distCommon.getDisparams( "999999", "STAGING_LOC", conn)==null?"":distCommon.getDisparams( "999999", "STAGING_LOC", conn);
}
//allocation for dock location
sql = "select acct_code__inv, cctr_code__inv, "
+ "exp_date, pack_code, mfg_date, site_code__mfg, "
+ "pack_instr, supp_code__mfg, retest_date, rate, "
+ "gross_rate, conv__qty_stduom, unit__alt, batch_no, batch_size, unit, grade, remarks, dimension "
+ "from stock "
+ "where item_code = ? "
+ "and site_code = ? "
+ "and loc_code = ? "
+ "and lot_no = ? "
+ "and lot_sl = ? ";
pstmtStock = conn.prepareStatement(sql);
/*sql = "SELECT R.LINE_NO LINE_NO, R.ITEM_CODE ITEM_CODE, R.SITE_CODE SITE_CODE, R.LOC_CODE LOC_CODE, "
//Changed by sumit on 14/03/13 getting quantity as (quantity - dealloc_qty)
//+ " R.LOT_NO LOT_NO, R.LOT_SL LOT_SL, R.QUANTITY QUANTITY, R.NO_ART NO_ART, "
+ " R.LOT_NO LOT_NO, R.LOT_SL LOT_SL, ( R.QUANTITY - CASE WHEN R.DEALLOC_QTY IS NULL THEN 0 ELSE R.DEALLOC_QTY END) AS QUANTITY, R.NO_ART NO_ART, "
+ " R.LOC_CODE__TO LOC_CODE__TO, O.SALE_ORDER SALE_ORDER, O.LINE_NO__SORD LINE_NO__SORD, O.PICK_ORDER,H.PICK_TYPE "
+ " FROM PICK_ISS_DET R, PICK_ORD_DET O,PICK_ORD_HDR H"
+ " WHERE R.TRAN_ID = ? "
+ " AND R.PICK_ORDER = O.PICK_ORDER "
+"AND H.PICK_ORDER = O.PICK_ORDER"
+ " AND O.LINE_NO = R.LINE_NO__ORD "
//Changed by Rohan on 29-06-13 for adding condition of quantity > 0
+" AND ( R.QUANTITY - CASE WHEN R.DEALLOC_QTY IS NULL THEN 0 ELSE R.DEALLOC_QTY END) > 0 "
+" AND R.LOC_CODE <> R.LOC_CODE__TO ";*/
sql = " SELECT D.SITE_CODE, D.TRAN_ID__ISS, DT.ITEM_CODE, DT.LOC_CODE, DT.LOT_NO, DT.LOT_SL, DT.QUANTITY, DT.NO_ART, DT.LOC_CODE__TO, DT.SALE_ORDER, DT.LINE_NO__SORD, " +
" DT.PICK_ORDER, DT.LINE_NO__PICK, DT.PICK_TYPE FROM DOCK_TRAN D, DOCK_TRAN_DET DT WHERE D.TRAN_ID = DT.TRAN_ID AND DT.TRAN_ID = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranID);
rs = pstmt.executeQuery();
while(rs.next())
{
itemCode = rs.getString( "item_code" );
siteCode = rs.getString( "site_code" );
locCode = rs.getString( "loc_code" );
lotNo = rs.getString( "lot_no" );
lotSl = rs.getString( "lot_sl" );
quantity = rs.getDouble( "quantity" );
noArt = rs.getDouble( "no_art" );
locCodeTo = rs.getString( "loc_code__to" );
saleOrder = rs.getString( "SALE_ORDER" );
lineNoSord = rs.getString( "LINE_NO__SORD" );
pickOrder = rs.getString( "PICK_ORDER" );
lineNo = rs.getInt( "LINE_NO__PICK" );
pickType = rs.getString( "PICK_TYPE" );
tranId = rs.getString( "TRAN_ID__ISS" );
System.out.println("pick type from hdr->> ["+pickType+"]");
System.out.println("tranIdissue->> ["+tranId+"]");
// 16/10/11 manoharan check whether allocation against sales order is there
// if allocation against sales order found change allocation to point to loc_code__to
// and deallocate the same for loc_code in stock
// update sordalloc with loc_code__to
// This utility methods to update old and new location should be in
// a separate probably in stockupdate so that we can call the same from various places
//
//
pstmtStock.setString(1,itemCode);
pstmtStock.setString(2,siteCode);
pstmtStock.setString(3,locCode);
pstmtStock.setString(4,lotNo);
pstmtStock.setString(5,lotSl);
rsStock = pstmtStock.executeQuery();
if ( rsStock.next() )
{
acctCodeDr = rsStock.getString("acct_code__inv");
cctrCodeDr = rsStock.getString("cctr_code__inv");
expDate = rsStock.getTimestamp("exp_date");
packCode = rsStock.getString("pack_code");
mfgDate = rsStock.getTimestamp("mfg_date");
siteCodeMfg = rsStock.getString("site_code__mfg");
packInstr = rsStock.getString("pack_instr");
suppCodeMfg = rsStock.getString("supp_code__mfg");
restestDate = rsStock.getTimestamp("retest_date");
stkRate = rsStock.getDouble("rate");
stkGrossRate = rsStock.getDouble("gross_rate");
convQtyStduom = rsStock.getDouble("conv__qty_stduom");
unitAlt = rsStock.getString("unit__alt");
batchNo = rsStock.getString("batch_no");
batchSize = rsStock.getDouble("batch_size");
unit = rsStock.getString("unit");
grade = rsStock.getString("grade");
remarks = rsStock.getString("remarks");
dimension = rsStock.getString("dimension");
}
rsStock.close(); rsStock = null;
pstmtStock.clearParameters();
// 10/10/12 manoharan
itmVolumeMap.clear();
itmVolumeMap = getItemVoumeMap(itemCode,lotNo,conn);
shipperSize = (Double) itmVolumeMap.get("SHIPPER_SIZE");
itemGrossWeight = (Double) itmVolumeMap.get("ITEM_GROSS_WEIGHT");
caseGrossWeight = (Double) itmVolumeMap.get("CASE_GROSS_WEIGHT");
itemNetWeight = (Double) itmVolumeMap.get("ITEM_NET_WEIGHT");
caseNetWeight = (Double) itmVolumeMap.get("CASE_NET_WEIGHT");
// end 10/10/12 manoharan
updateRowMap.put("item_code", itemCode);
updateRowMap.put("site_code", siteCode);
updateRowMap.put("loc_code", stagingLoc);
updateRowMap.put("lot_no", lotNo);
updateRowMap.put("lot_sl", lotSl);
updateRowMap.put("quantity", ""+quantity);
updateRowMap.put("no_art", noArt);
updateRowMap.put("tran_ser", "PICISS");
updateRowMap.put("acct_code__cr",acctCodeDr);
updateRowMap.put("cctr_code__cr",cctrCodeDr);
updateRowMap.put("acct_code_inv",acctCodeDr);
updateRowMap.put("cctr_code_inv",cctrCodeDr);
updateRowMap.put("rate",Double.toString(stkRate));
updateRowMap.put("gross_rate",Double.toString(stkGrossRate));
updateRowMap.put("tran_id", tranId );
// 17/10/11 manoharan
updateRowMap.put("line_no", "" + lineNo );
// end 17/10/11 manoharan
updateRowMap.put("tran_date", tranDate );
//Changed By Pragyan
//updateRowMap.put("tran_type","I");
updateRowMap.put("tran_type","ID");
updateRowMap.put("qty_stduom", ""+quantity);
updateRowMap.put("unit",unit);
updateRowMap.put("grade",grade);
updateRowMap.put("remarks",remarks);
updateRowMap.put("dimension",dimension);
//updateRowMap.put("tran_type", "I");//Creating issue
//changed by gulzar on 12/24/2011
updateRowMap.put("exp_date", expDate);
updateRowMap.put("pack_code", packCode);
updateRowMap.put("mfg_date", mfgDate);
updateRowMap.put("site_code__mfg", siteCodeMfg);
updateRowMap.put("pack_instr", packInstr);
updateRowMap.put("supp_code__mfg", suppCodeMfg);
updateRowMap.put("retest_date", restestDate);
updateRowMap.put("conv__qty_stduom", ""+convQtyStduom);
updateRowMap.put("unit__alt", unitAlt);
updateRowMap.put("batch_no", batchNo);
updateRowMap.put("batch_size", ""+batchSize);
//End changes by gulzar on 12/24/2011
// 10/10/12 manoharan weight and no_art to be set properly
if("A".equalsIgnoreCase(pickType))
{
noArt = 1;
}
else
{
noArt = Math.floor((quantity) / shipperSize) ;
}
updateRowMap.put("no_art", noArt);
updateRowMap.put("gross_weight", caseGrossWeight * noArt);
updateRowMap.put("net_weight", caseNetWeight * noArt);
updateRowMap.put("tare_weight", (caseGrossWeight - caseNetWeight) * noArt);
// end 10/10/12 manoharan
retString = stkUpdate.updateStock( updateRowMap, xtraParams, conn );
if ( retString != null && retString.trim().length() > 0 )
{
isError = true;
break;
}
updateRowMap.put("loc_code", locCodeTo);
// else
// {
// updateRowMap.put("loc_code", locCodeTo);
// }
updateRowMap.put("tran_type", "R");//Creating receipt
retString = stkUpdate.updateStock( updateRowMap, xtraParams, conn );
if ( retString != null && retString.trim().length() > 0 )
{
isError = true;
break;
}
updateRowMap.clear();
// 16/10/11 manoharan check whether allocation/hold are there
// if so update the same
//added by cpandey on
//if(!("A".equalsIgnoreCase(pickType)))
//{
strAllocate = new HashMap();
strAllocate.put("tran_date",tranDate);
strAllocate.put("ref_ser","PICISS");
strAllocate.put("ref_id",tranId);
strAllocate.put("ref_line", "" + lineNo);
strAllocate.put("site_code",siteCode);
strAllocate.put("item_code",itemCode);
strAllocate.put("loc_code",locCodeTo);
strAllocate.put("lot_no",lotNo);
strAllocate.put("lot_sl",lotSl);
strAllocate.put("alloc_qty",new Double(quantity));
strAllocate.put("chg_user",GenericUtility.getInstance().getValueFromXTRA_PARAMS(xtraParams,"loginCode"));
strAllocate.put("chg_term",GenericUtility.getInstance().getValueFromXTRA_PARAMS(xtraParams,"termId"));
strAllocate.put("chg_win","w_pick_iss");
//}
retString = invAllocTrace.updateInvallocTrace(strAllocate, conn);
if ( retString != null && retString.trim().length() > 0 )
{
isError = true;
break;
}
System.out.println("retString ::: " + retString);
if (retString != null && retString.trim().length() > 0 )
{
isError = true;
break;
}
strAllocate = null;
lineNoSord = " " + lineNoSord;
lineNoSord = lineNoSord.substring(lineNoSord.length()-3);
//Changed By 02/05/13 Pragyan To check the sordalloc allocated quantity > quantity then insert new record deducte quantity from old location.start
/*// end 16/10/11 manoharan allocation stock for new location
// 16/10/11 manoharan update sordalloc
updateSql = "UPDATE SORDALLOC SET LOC_CODE = ? "
+ " WHERE SALE_ORDER = ? AND LINE_NO = ? "
+ " AND ITEM_CODE = ? "
+ " AND LOC_CODE = ? "
+ " AND LOT_NO = ? "
+ " AND LOT_SL = ? "
+ " AND QTY_ALLOC > 0";
pstmtUpd = conn.prepareStatement(updateSql);
pstmtUpd.setString(1, locCodeTo);
pstmtUpd.setString(2, saleOrder);
pstmtUpd.setString(3, lineNoSord);
pstmtUpd.setString(4, itemCode);
pstmtUpd.setString(5, locCode);
pstmtUpd.setString(6, lotNo);
pstmtUpd.setString(7, lotSl);
updCnt = pstmtUpd.executeUpdate(); //change done by kunal on 14/09/12 uncomment sql query
// end 16/10/11 manoharan update sordalloc
*/
sql = " SELECT EXP_LEV, ITEM_CODE__ORD, "
+ " ITEM_REF, UNIT, DATE_ALLOC, STATUS, ITEM_GRADE, EXP_DATE, ALLOC_MODE, SITE_CODE, "
+ " CONV__QTY_STDUOM, UNIT__STD, MFG_DATE, SITE_CODE__MFG, REAS_CODE,QUANTITY,QTY_ALLOC FROM SORDALLOC "
+ " WHERE SALE_ORDER = ? AND LINE_NO = ? "
+ " AND ITEM_CODE = ? "
+ " AND LOC_CODE = ? "
+ " AND LOT_NO = ? "
+ " AND LOT_SL = ? "
+ " AND QTY_ALLOC > 0";
pstmt1 = conn.prepareStatement(sql);
pstmt1.setString(1, saleOrder);
pstmt1.setString(2, lineNoSord);
pstmt1.setString(3, itemCode);
pstmt1.setString(4, locCode);
pstmt1.setString(5, lotNo);
pstmt1.setString(6, lotSl);
rs1 = pstmt1.executeQuery();
if( rs1.next())
{
expLev = rs1.getString( "EXP_LEV" );
itemCodeOrd = rs1.getString( "ITEM_CODE__ORD" );
itemRef = rs1.getString( "ITEM_REF" );
unit = rs1.getString( "UNIT" );
status = rs1.getString( "STATUS" );
itemGrade = rs1.getString( "ITEM_GRADE" );
allocMode = rs1.getString( "ALLOC_MODE" );
siteCode = rs1.getString( "SITE_CODE" );
siteCodeMfg = rs1.getString( "SITE_CODE__MFG" );
reasCode = rs1.getString( "REAS_CODE" );
unitStd = rs1.getString( "UNIT__STD" );
convQtyStduom = rs1.getDouble( "CONV__QTY_STDUOM" );
dateAlloc = rs1.getTimestamp("DATE_ALLOC");
expDate = rs1.getTimestamp("EXP_DATE");
mfgDate = rs1.getTimestamp("MFG_DATE");
qtyOrd = rs1.getDouble( "QUANTITY" );
sordAllocQty = rs1.getDouble( "QTY_ALLOC" );
}
else
{
isError = true;
retString = itmDBAccess.getErrorString("","RECNOTSORA","");
return retString;
}
rs1.close();
rs1 = null;
pstmt1.close();
pstmt1 = null;
sSQL = "SELECT COUNT(*) AS COUNT FROM SORDALLOC WHERE "
+ " SALE_ORDER = ? AND LINE_NO = ? "
+ " AND ITEM_CODE = ? "
+ " AND LOC_CODE = ? "
+ " AND LOT_NO = ? "
+ " AND LOT_SL = ? ";
int count = 0;
if(sordAllocQty > quantity)
{
//Changed by sumit on 09/05/13 substituting QUANTITY__STDUOM too.
//updateSql = "UPDATE SORDALLOC SET QTY_ALLOC = QTY_ALLOC - ? "
//changed by sankara on 17/10/13 for update wave_flag
//updateSql = "UPDATE SORDALLOC SET QTY_ALLOC = QTY_ALLOC - ? ,QUANTITY__STDUOM = QUANTITY__STDUOM - ?" //LOC_CODE = ? ,LOT_SL = ? "
updateSql = "UPDATE SORDALLOC SET QTY_ALLOC = QTY_ALLOC - ? ,QUANTITY__STDUOM = QUANTITY__STDUOM - ?, WAVE_FLAG = 'Y' "
+ " WHERE SALE_ORDER = ? AND LINE_NO = ? "
+ " AND ITEM_CODE = ? "
+ " AND LOC_CODE = ? "
+ " AND LOT_NO = ? "
+ " AND LOT_SL = ? "
+ " AND QTY_ALLOC > 0";
pstmtUpd = conn.prepareStatement(updateSql);
pstmtUpd.setDouble(1, quantity);
////Changed by sumit on 09/05/13 setting value as per sql.
pstmtUpd.setDouble(2, quantity * convQtyStduom);
pstmtUpd.setString(3, saleOrder);
pstmtUpd.setString(4, lineNoSord);
pstmtUpd.setString(5, itemCode);
pstmtUpd.setString(6, locCode);
pstmtUpd.setString(7, lotNo);
pstmtUpd.setString(8, lotSl);
updCnt = pstmtUpd.executeUpdate();
System.out.println("Changed By 02/05/13 Pragyan sordalloc updated updCnt [" + updCnt + "]");
pstmtSord = conn.prepareStatement(sSQL);
pstmtSord.setString(1, saleOrder);
pstmtSord.setString(2, lineNoSord);
pstmtSord.setString(3, itemCode);
/*if(("A".equalsIgnoreCase(pickType)) || ("M".equalsIgnoreCase(pickType)))
{
pstmtSord.setString(4, stagingLoc);
}
else
{
pstmtSord.setString(4, locCodeTo);
}
*/
pstmtSord.setString(4, locCodeTo);
pstmtSord.setString(5, lotNo);
pstmtSord.setString(6, lotSl);
rsSord = pstmtSord.executeQuery();
if(rsSord.next())
{
count = rsSord.getInt(1);
}
if(count > 0)
{
System.out.println("Changed By 02/05/13 Pragyan sordalloc If alrady exist Location Update Inside grater updCnt1st [" + updCnt + "]");
//changed by sankara on 17/10/13 for update wave_flag
//updateSql = "UPDATE SORDALLOC SET QTY_ALLOC = QTY_ALLOC + ? ,QUANTITY__STDUOM = QUANTITY__STDUOM + ?"
updateSql = "UPDATE SORDALLOC SET QTY_ALLOC = QTY_ALLOC + ? ,QUANTITY__STDUOM = QUANTITY__STDUOM + ?, WAVE_FLAG = 'Y' "
+ " WHERE SALE_ORDER = ? AND LINE_NO = ? "
+ " AND ITEM_CODE = ? "
+ " AND LOC_CODE = ? "
+ " AND LOT_NO = ? "
+ " AND LOT_SL = ? "
+ " AND QTY_ALLOC > 0";
pstmtUpd = conn.prepareStatement(updateSql);
pstmtUpd.setDouble(1, quantity);
pstmtUpd.setDouble(2, quantity);
pstmtUpd.setString(3, saleOrder);
pstmtUpd.setString(4, lineNoSord);
pstmtUpd.setString(5, itemCode);
/*if(("A".equalsIgnoreCase(pickType)) || ("M".equalsIgnoreCase(pickType)))
{
pstmtUpd.setString(6, stagingLoc);
}
else
{
pstmtUpd.setString(6, locCodeTo);
}
*/
pstmtUpd.setString(6, locCodeTo);
pstmtUpd.setString(7, lotNo);
pstmtUpd.setString(8, lotSl);
updCnt = pstmtUpd.executeUpdate();
System.out.println("Changed By 02/05/13 Pragyan sordalloc If alrady exist Location Update Inside grater updCnt2nd [" + updCnt + "]");
}
else
{
updateSql = "insert into sordalloc( SALE_ORDER, LINE_NO, EXP_LEV, ITEM_CODE__ORD, "
+ " ITEM_CODE, LOT_NO, LOT_SL, LOC_CODE, ITEM_REF, QUANTITY, UNIT, "
+ " QTY_ALLOC, DATE_ALLOC, STATUS, ITEM_GRADE, EXP_DATE, ALLOC_MODE, SITE_CODE, "
+ " CONV__QTY_STDUOM, UNIT__STD, QUANTITY__STDUOM, MFG_DATE, SITE_CODE__MFG, "
//changed by sankara on 15/10/13 for update wave_flag start.
/* + " REAS_CODE ) VALUES (?, ?, ?, ?, "
+ " ?, ?, ? , ?, ?, ?, ?, "
+ " ?,?, ?, ?, ?, ?, ?, "
+ " ?, ?, ? , ?, ?, ?) "; */
+ " REAS_CODE, WAVE_FLAG ) VALUES (?, ?, ?, ?, "
+ " ?, ?, ? , ?, ?, ?, ?, "
+ " ?,?, ?, ?, ?, ?, ?, "
+ " ?, ?, ? , ?, ?, ?, ?) ";
//changed by sankara on 15/10/13 for update wave_flag end.
pstmtUpd = conn.prepareStatement(updateSql);
pstmtUpd.setString(1, saleOrder);
pstmtUpd.setString(2, lineNoSord);
pstmtUpd.setString(3, expLev);
pstmtUpd.setString(4, itemCodeOrd);
pstmtUpd.setString(5, itemCode);
pstmtUpd.setString(6, lotNo);
pstmtUpd.setString(7, lotSl);
//pstmtUpd.setString(8, locCodeTo);
/*if(("A".equalsIgnoreCase(pickType)) || ("M".equalsIgnoreCase(pickType)))
{
pstmtUpd.setString(8, stagingLoc);
}
else
{
pstmtUpd.setString(8, locCodeTo);
} */
//Changed by sumit on 09/05/13
pstmtUpd.setString(8, locCodeTo);
pstmtUpd.setString(9, itemRef);
pstmtUpd.setDouble(10, qtyOrd);
pstmtUpd.setString(11, unit);
pstmtUpd.setDouble(12, quantity);
pstmtUpd.setTimestamp(13, dateAlloc);
pstmtUpd.setString(14, status);
pstmtUpd.setString(15, itemGrade);
pstmtUpd.setTimestamp(16, expDate);
pstmtUpd.setString(17, allocMode);
pstmtUpd.setString(18, siteCode);
pstmtUpd.setDouble(19, convQtyStduom );
pstmtUpd.setString(20, unitStd);
pstmtUpd.setDouble(21, quantity * convQtyStduom);
pstmtUpd.setTimestamp(22, mfgDate );
pstmtUpd.setString(23, siteCodeMfg);
pstmtUpd.setString(24, reasCode);
//changed by sankara on 15/10/13 for update of wave_flag
pstmtUpd.setString( 25, "Y");
updCnt = pstmtUpd.executeUpdate();
System.out.println("Changed By 02/05/13 Pragyan sordalloc inserted updCnt [" + updCnt + "]");
}
}
else
{
pstmtSord = conn.prepareStatement(sSQL);
pstmtSord.setString(1, saleOrder);
pstmtSord.setString(2, lineNoSord);
pstmtSord.setString(3, itemCode);
/*if(("A".equalsIgnoreCase(pickType)) || ("M".equalsIgnoreCase(pickType)))
{
pstmtSord.setString(4, stagingLoc);
}
else
{
pstmtSord.setString(4, locCodeTo);
} */
pstmtSord.setString(4, locCodeTo);
pstmtSord.setString(5, lotNo);
pstmtSord.setString(6, lotSl);
rsSord = pstmtSord.executeQuery();
if(rsSord.next())
{
count = rsSord.getInt(1);
}
if(count > 0)
{
//changed by sankara on 17/10/13 update wave_flag
//updateSql = "UPDATE SORDALLOC SET QTY_ALLOC = QTY_ALLOC - ? ,QUANTITY__STDUOM = QUANTITY__STDUOM - ?" //LOC_CODE = ? ,LOT_SL = ? "
updateSql = "UPDATE SORDALLOC SET QTY_ALLOC = QTY_ALLOC - ? ,QUANTITY__STDUOM = QUANTITY__STDUOM - ?, WAVE_FLAG = 'Y' "
+ " WHERE SALE_ORDER = ? AND LINE_NO = ? "
+ " AND ITEM_CODE = ? "
+ " AND LOC_CODE = ? "
+ " AND LOT_NO = ? "
+ " AND LOT_SL = ? "
+ " AND QTY_ALLOC > 0";
pstmtUpd = conn.prepareStatement(updateSql);
pstmtUpd.setDouble(1, quantity);
pstmtUpd.setDouble(2, quantity);
pstmtUpd.setString(3, saleOrder);
pstmtUpd.setString(4, lineNoSord);
pstmtUpd.setString(5, itemCode);
pstmtUpd.setString(6, locCode);
pstmtUpd.setString(7, lotNo);
pstmtUpd.setString(8, lotSl);
updCnt = pstmtUpd.executeUpdate();
System.out.println("Changed By 02/05/13 Pragyan If alrady exist Location Update updCnt1st [" + updCnt + "]");
//changed by sankara on 17/10/13 update wave_flag
//updateSql = "UPDATE SORDALLOC SET QTY_ALLOC = QTY_ALLOC + ? ,QUANTITY__STDUOM = QUANTITY__STDUOM + ?"
updateSql = "UPDATE SORDALLOC SET QTY_ALLOC = QTY_ALLOC + ? ,QUANTITY__STDUOM = QUANTITY__STDUOM + ?, WAVE_FLAG = 'Y' "
+ " WHERE SALE_ORDER = ? AND LINE_NO = ? "
+ " AND ITEM_CODE = ? "
+ " AND LOC_CODE = ? "
+ " AND LOT_NO = ? "
+ " AND LOT_SL = ? "
+ " AND QTY_ALLOC > 0";
pstmtUpd = conn.prepareStatement(updateSql);
pstmtUpd.setDouble(1, quantity);
pstmtUpd.setDouble(2, quantity);
pstmtUpd.setString(3, saleOrder);
pstmtUpd.setString(4, lineNoSord);
pstmtUpd.setString(5, itemCode);
/*if(("A".equalsIgnoreCase(pickType)) || ("M".equalsIgnoreCase(pickType)))
{
pstmtUpd.setString(6, stagingLoc);
}
else
{
pstmtUpd.setString(6, locCodeTo);
} */
pstmtUpd.setString(6, locCodeTo);
pstmtUpd.setString(7, lotNo);
pstmtUpd.setString(8, lotSl);
updCnt = pstmtUpd.executeUpdate();
System.out.println("Changed By 02/05/13 Pragyan sordalloc If alrady exist Location Update updCnt2nd [" + updCnt + "]");
}
else
{
//changed by sankara on 15/10/13 for update wave_flag
//updateSql = "UPDATE SORDALLOC SET LOC_CODE = ? "
updateSql = "UPDATE SORDALLOC SET LOC_CODE = ?, WAVE_FLAG = 'Y' "
+ " WHERE SALE_ORDER = ? AND LINE_NO = ? "
+ " AND ITEM_CODE = ? "
+ " AND LOC_CODE = ? "
+ " AND LOT_NO = ? "
+ " AND LOT_SL = ? "
+ " AND QTY_ALLOC > 0";
pstmtUpd = conn.prepareStatement(updateSql);
pstmtUpd.setString(1, locCodeTo);
pstmtUpd.setString(2, saleOrder);
pstmtUpd.setString(3, lineNoSord);
pstmtUpd.setString(4, itemCode);
pstmtUpd.setString(5, locCode);
pstmtUpd.setString(6, lotNo);
pstmtUpd.setString(7, lotSl);
updCnt = pstmtUpd.executeUpdate();
}
}
//Changed By 02/05/13 Pragyan To check the sordalloc allocated quantity > quantity then insert new record deducte quantity from old location.end
updateSql = "UPDATE PICK_ISS_DET SET LOC_CODE__TO = ? "
+ " WHERE TRAN_ID = ? AND LINE_NO = ? ";
pstmtUpd = conn.prepareStatement(updateSql);
pstmtUpd.setString(1, locCodeTo);
pstmtUpd.setString(2, tranId);
pstmtUpd.setInt(3, lineNo);
updCnt = pstmtUpd.executeUpdate();
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if (retString != null && retString.trim().length() > 0 )
{
isError = true;
return retString;
}
updateSql = "UPDATE PICK_ISS_HDR SET TRF_STATUS = 'Y' "
+ " WHERE TRAN_ID = ? ";
pstmtUpd = conn.prepareStatement(updateSql);
pstmtUpd.setString(1, tranId);
updCnt = pstmtUpd.executeUpdate();
pstmtUpd.close();
pstmtUpd = null;
//Changed by Sankara on 03/oct/13 adding validation to prevent doc transfer in case of pending/aborted picking.start
int countConf = 0;
sql = " SELECT COUNT(*) FROM PICK_ISS_HDR PIH, PICK_ISS_DET PH WHERE "
+" PIH.PICK_ORDER = PH.PICK_ORDER AND PH.TRAN_ID = PIH.TRAN_ID AND PIH.CONFIRMED = ? "
+" AND PIH.PICK_ORDER = ? AND PICK_TYPE IN ('A','M') AND PIH.TRF_STATUS IS NULL ";
pstmt = conn.prepareStatement( sql );
pstmt.setString( 1, "Y");
pstmt.setString( 2, pickOrder);
rs = pstmt.executeQuery();
if(rs.next())
{
countConf = rs.getInt(1);
System.out.println(" Pending Transfer Count["+countConf);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if( countConf > 0)
{
return errString = "";
}
//Changed by Sankara on 03/oct/13 adding validation to prevent doc transfer in case of pending/aborted picking.start
//update the status of pick order in wave_task_det table
//Changed by sumit on 10/08/12 update wave_status 'V' with updating status = 'Y'
//updateSql = "UPDATE WAVE_TASK_DET SET STATUS = 'Y' WHERE REF_ID = ? ";
updateSql = "UPDATE WAVE_TASK_DET SET STATUS = 'Y', WAVE_STATUS = 'V' WHERE REF_ID = ? ";
pstmt = conn.prepareStatement(updateSql);
pstmt.setString(1, pickOrder);
updCnt = pstmt.executeUpdate();
if( updCnt > 0 )
{
System.out.println( updCnt + " rows updated successfully" );
}
pstmt.close();pstmt = null;
//Changed by sumit on 30/08/12 for updating wave_status start.
//Changed by sumit on 21/01/13 for updating wave_status for M-PACK task start
System.out.println(" ** pick_type ["+pickType+"]");
if( "M".equalsIgnoreCase(pickType))
{
updateSql =" UPDATE WAVE_TASK_DET SET STATUS = 'Y', WAVE_STATUS = 'V' " +
" WHERE REF_ID IN (SELECT TRAN_ID FROM PACK_HDR WHERE PICK_ORDER = ?)";
pstmt = conn.prepareStatement(updateSql);
pstmt.setString(1, pickOrder);
updCnt = pstmt.executeUpdate();
if( updCnt > 0 )
{
System.out.println( updCnt + " rows updated successfully" );
}
pstmt.close();pstmt = null;
}
//Changed by sumit on 21/01/13 for updating wave_status for M-PACK task end
updCnt= 0;
updCnt = waveStatusUpdate(pickOrder, conn);
if( updCnt > 0)
{
System.out.println( updCnt + " row of wave_status updated successfully" );
}
//Changed by sumit on 30/08/12 for updating wave_status end.
sql = "select ptcn from wave_task_det where ref_id = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,pickOrder);
rs = pstmt.executeQuery();
if( rs.next() )
{
ptcn = rs.getString("ptcn") == null?"":rs.getString("ptcn");
}
if( rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
//Changed By 02/05/13 Pragyan To Close The Connections.start
if( rs1 != null)
{
rs1.close();
rs1 = null;
}
if( rsSord != null)
{
rsSord.close();
rsSord = null;
}
if(pstmt1 != null)
{
pstmt1.close();
pstmt1 = null;
}
if(pstmtSord != null)
{
pstmtSord.close();
pstmtSord = null;
}
//Changed By 02/05/13 Pragyan Close The Connections.end
ConsolidatToDoc conToDoc = new ConsolidatToDoc();
//Changed by Rohan on 10-06-12 to add xtraParams in process as argument for hazmap report to get chg user
//retString = conToDoc.process(ptcn, conn);
retString = conToDoc.process(ptcn, conn,xtraParams);
System.out.println("pick type from pick_ord_hdr table--->>["+pickType+"]");
}
catch(Exception e)
{
System.out.println("Exception before rollback "+e.getMessage());
try
{
conn.rollback();
}
catch (SQLException e1)
{
e1.printStackTrace();
}
e.printStackTrace();
throw new ITMException(e);
}
finally
{
try
{
if( !isError )
{
System.out.println("commmit");
conn.commit();
}
else if ( isError )
{
System.out.println("rollback");
conn.rollback();
}
if( rs != null )
{
rs.close();
rs = null;
}
if( pstmt != null )
{
pstmt.close();
pstmt = null;
}
//Changed By 02/05/13 Pragyan To Close The Connections.start
if( rs1 != null)
{
rs1.close();
rs1 = null;
}
if( rsSord != null)
{
rsSord.close();
rsSord = null;
}
if(pstmt1 != null)
{
pstmt1.close();
pstmt1 = null;
}
if(pstmtSord != null)
{
pstmtSord.close();
pstmtSord = null;
}
//Changed By 02/05/13 Pragyan Close The Connections.end
}
catch(Exception e)
{
System.err.println("Exception :PickIssPos :\n"+e.getMessage());
e.printStackTrace();
throw new ITMException(e);
}
}
return errString;
}
//Changed by sumit on 30/08/12 update wave_status after all task completed for wave_id and sale order start.
private int waveStatusUpdate(String replOrder, Connection conn) throws ITMException
{
String sql = "", sql1 = "";
String waveId = "";
String saleOrder = "";
PreparedStatement pstmt = null, pstmt1 = null;
ResultSet rs = null, rs1 = null;
int updateCount = 0;
int firstCount = 0, secCount = 0;
try
{
sql = "SELECT WAVE_ID, SALE_ORDER FROM WAVE_TASK_DET WHERE REF_ID = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, replOrder);
rs = pstmt.executeQuery();
if(rs.next())
{
waveId = rs.getString("WAVE_ID");
saleOrder = rs.getString("SALE_ORDER");
sql1 = "SELECT COUNT(*) AS CONT FROM WAVE_TASK_DET WHERE WAVE_ID = ? AND SALE_ORDER = ? AND REF_SER <> 'S-DSP' ";
pstmt1 = conn.prepareStatement(sql1);
pstmt1.setString(1, waveId);
pstmt1.setString(2, saleOrder);
rs1 = pstmt1.executeQuery();
if(rs1.next())
{
firstCount = rs1.getInt("CONT");
}
rs1.close();rs1 = null;
pstmt1.close();pstmt1 = null;
//Changed by sumit on 19/03/13 changing condition check it from status flag
//sql1 = "SELECT COUNT(*) AS CONT FROM WAVE_TASK_DET WHERE WAVE_STATUS = 'V' AND WAVE_ID = ? AND SALE_ORDER = ? AND REF_SER <> 'S-DSP' ";
sql1 = "SELECT COUNT(*) AS CONT FROM WAVE_TASK_DET WHERE STATUS = 'Y' AND WAVE_ID = ? AND SALE_ORDER = ? AND REF_SER <> 'S-DSP' ";
pstmt1 = conn.prepareStatement(sql1);
pstmt1.setString(1, waveId);
pstmt1.setString(2, saleOrder);
rs1 = pstmt1.executeQuery();
if(rs1.next())
{
secCount = rs1.getInt("CONT");
}
rs1.close();rs1 = null;
pstmt1.close();pstmt1 = null;
}
rs.close();rs = null;
pstmt.close();pstmt = null;
if( secCount == firstCount)
{
sql = "UPDATE WAVE_TASK_DET SET WAVE_STATUS = 'C' WHERE WAVE_ID = ? AND SALE_ORDER = ? AND REF_SER = 'S-DSP' ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, waveId);
pstmt.setString(2, saleOrder);
updateCount = pstmt.executeUpdate();
pstmt.close();pstmt = null;
}
}
catch(Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
return updateCount;
}
//Changed by sumit on 30/08/12 update wave_status after all task completed for wave_id and sale order end.
private HashMap getItemVoumeMap(String itemCode,String lotNo,Connection con)throws Exception
{
double shipperSize = 0,itemVolume = 0,caseVolume = 0;
PreparedStatement pstmt = null;
String sql="";
ResultSet rs = null;
double itmLen = 0,itmWidth = 0,itmHeight = 0,itemGrossWeight = 0,lotLen = 0 ,lotHeight = 0,lotWidth = 0,caseGrossWeight = 0,itemNetWeight = 0, caseNetWeight = 0;
HashMap dataVolumeMap = new HashMap();
try {
sql = "SELECT I.LENGTH ITEM_LEN,I.WIDTH ITEM_WID,I.HEIGHT ITEM_HEIGHT,I.GROSS_WEIGHT ITEM_GROSS_WEIGHT,I.NET_WEIGHT ITEM_NET_WEIGHT,"
+" L.LENGTH LITEM_LEN,L.WIDTH LITEM_WID,L.HEIGHT LITEM_HEIGHT,L.SHIPPER_SIZE SHIPSIZE,L.GROSS_WEIGHT CASE_GROSS_WEIGHT,L.NET_WEIGHT CASE_NET_WEIGHT FROM"
+" ITEM I,ITEM_LOT_PACKSIZE L"
+" WHERE I.ITEM_CODE = L.ITEM_CODE"
+" AND L.LOT_NO__FROM <= ? AND L.LOT_NO__TO >= ?"
+" AND I.ITEM_CODE = ?";
pstmt = con.prepareStatement(sql);
if(lotNo != null && lotNo.length() > 0)
{
pstmt.setString(1, lotNo);
pstmt.setString(2, lotNo);
}
else
{
pstmt.setString(1, "00");
pstmt.setString(2, "ZZ");
}
pstmt.setString(3, itemCode);
rs = pstmt.executeQuery();
if(rs.next())
{
itmLen = rs.getDouble("ITEM_LEN");
itmWidth = rs.getDouble("ITEM_WID");
itmHeight = rs.getDouble("ITEM_HEIGHT");
itemGrossWeight = rs.getDouble("ITEM_GROSS_WEIGHT");
lotLen = rs.getDouble("LITEM_LEN");
lotWidth = rs.getDouble("LITEM_WID");
lotHeight = rs.getDouble("LITEM_HEIGHT");
shipperSize = rs.getDouble("SHIPSIZE");
caseGrossWeight = rs.getDouble("CASE_GROSS_WEIGHT");
itemNetWeight = rs.getDouble("ITEM_NET_WEIGHT");
caseNetWeight = rs.getDouble("CASE_NET_WEIGHT");
}
//shipperSize = (lotHeight * lotWidth * lotLen)/(itmLen * itmWidth * itmHeight);
itemVolume = (itmLen * itmWidth * itmHeight);
caseVolume = (lotHeight * lotWidth * lotLen);
dataVolumeMap.put("SHIPPER_SIZE", shipperSize);
dataVolumeMap.put("ITEM_VOLUME", itemVolume);
dataVolumeMap.put("CASE_VOLUME", caseVolume);
dataVolumeMap.put("ITEM_GROSS_WEIGHT", itemGrossWeight);
dataVolumeMap.put("CASE_GROSS_WEIGHT", caseGrossWeight);
dataVolumeMap.put("ITEM_NET_WEIGHT", itemNetWeight);
dataVolumeMap.put("CASE_NET_WEIGHT", caseNetWeight);
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(rs != null)
{
rs.close();
rs = null;
}
} catch (Exception e) {
// TODO: handle exception
throw e;
}
finally
{
try
{
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(rs != null)
{
rs.close();
rs = null;
}
}
catch (Exception e) {
// TODO: handle exception
throw e;
}
}
return dataVolumeMap;
}
}
/**
Title : PickPostSaveLocalEJB
Date : 04/11/11
Author: Chitranjan Pandey
*/
package ibase.webitm.ejb.wms;
import ibase.webitm.ejb.*;
import ibase.webitm.utility.ITMException;
import java.rmi.RemoteException;
import java.sql.Connection;
import org.w3c.dom.*;
@javax.ejb.Local
public interface DockTranConfLocal
{
//public String postSave()throws RemoteException,ITMException;
public String confirm( String domString,String tranId, String editFlag, String xtraParams, Connection conn ) throws RemoteException,ITMException;
}
\ No newline at end of file
/**
Title : PickPostSaveRemoteEJB
Date : 03/08/12
Author: Chitranjan Pandey
*/
package ibase.webitm.ejb.wms;
import ibase.webitm.ejb.*;
import ibase.webitm.utility.ITMException;
import java.rmi.RemoteException;
import java.sql.Connection;
import org.w3c.dom.*;
@javax.ejb.Remote
public interface DockTranConfRemote
{
//public String postSave()throws RemoteException,ITMException;
public String confirm( String domString,String tranId, String editFlag, String xtraParams, Connection conn ) throws RemoteException,ITMException;
}
......@@ -17,8 +17,10 @@ import ibase.webitm.utility.TransIDGenerator;
import ibase.utility.CommonConstants;
import java.io.*;
import java.net.InetAddress;
import java.rmi.RemoteException;
import java.sql.*;
import java.sql.Date;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.*;
......@@ -35,10 +37,9 @@ public class DockTranPos extends ValidatorEJB implements DockTranPosLocal, DockT
return "";
}
//Changed By Pragyan 09-MAY-14 to Take Local connection
//public String postSave(String domString, String tranId,String editFlag, String xtraParams, Connection conn ) throws RemoteException,ITMException
public String postSave(String domString, String tranId,String editFlag, String xtraParams, Connection conn1 ) throws RemoteException,ITMException
public String postSave(String domString, String tranId,String editFlag, String xtraParams, Connection conn ) throws RemoteException,ITMException
{
System.out.println( "Calling DockTranPos.........................................." );
String forcedFlag = "false" ;
String errString = "";
......@@ -47,96 +48,55 @@ public class DockTranPos extends ValidatorEJB implements DockTranPosLocal, DockT
String pickType = "";
String palletNo = "";
String itemCode = "",siteCode = "",locCode = "",lotNo = "",lotSl = "",locCodeSys = "",
saleOrder = "",lineNoSord = "",replOrder = "",retString = "",ptcn="";
saleOrder = "",lineNoSord = "",ptcn="";
double quantity = 0.0,noArt = 0.0;
int totOrdDet = 0,lineNo = 0;
int ordDetScaned = 0;
int lineNo = 0,lineNumber = 0;
int updCnt = 0;
boolean toCommit = false;
java.sql.Timestamp expDate = null,mfgDate = null,restestDate = null;
Document dom = null;
GenericUtility genericUtility = GenericUtility.getInstance();
java.util.Date currDate1 = new java.util.Date();
java.sql.Timestamp currDate = new java.sql.Timestamp( System.currentTimeMillis() );
StockUpdate stkUpdate = null;
String acctCodeDr = "",cctrCodeDr = "",packCode = "",unit = "",grade = "",remarks = "",
unitAlt = "",stagingLoc = "", batchNo = "",siteCodeMfg = "",packInstr = "",
suppCodeMfg = "",dimension = "",locCodeTo = "";
String suppCodeMfg = "",dimension = "",locCodeTo = "", chguser = "",chgdate = "",chgterm = "",
employeeCode = "",conmfirmed = "",waveId = "",tranIdissue = "",tranID = "";
String updateSql = "";
String chgTerm ="";
boolean isError = false;
boolean isRecordexist = false;
String empCode = genericUtility.getValueFromXTRA_PARAMS( xtraParams, "loginEmpCode" );
//StockUpdate stkUpdate = null;
InvAllocTraceBean invAllocTrace = null;
HashMap strAllocate = null;
DistCommon distCommon = new DistCommon();
//stagingLoc = distCommon.getDisparams( "999999", "STAGING_LOC", conn );
stkUpdate = new StockUpdate();
invAllocTrace = new InvAllocTraceBean();
double stkRate = 0.0,stkGrossRate = 0.0,convQtyStduom = 0.0,batchSize = 0.0;
PreparedStatement pstmt = null,pstmtStock = null,pstmtUpd = null;
ResultSet rs = null,rsStock = null;
HashMap updateRowMap = null;
PickIssConf pickConf = new PickIssConf();
// 10/10/12 manoharan
HashMap itmVolumeMap = new HashMap();
double shipperSize = 0, itemGrossWeight = 0, caseGrossWeight = 0, itemNetWeight = 0, caseNetWeight = 0;
// end 10/10/12 manoharan
//Changed By 02/05/13 Pragyan To check the sordalloc allocated quantity > quantity then insert new record deducte quantity from old location.start
PreparedStatement pstmt1 = null,pstmtSord = null;
ResultSet rs1 = null,rsSord = null;
String expLev = "",itemCodeOrd = "",itemRef = "",status = "",allocMode = "",
itemGrade = "",reasCode = "",unitStd = "",sSQL = "";
java.sql.Timestamp dateAlloc = null;
double qtyOrd = 0.0,sordAllocQty = 0.0;
PreparedStatement pstmt = null,pstmtUpd = null;
ResultSet rs = null;
ITMDBAccessEJB itmDBAccess = new ITMDBAccessEJB();
//Changed By 02/05/13 Pragyan To check the sordalloc allocated quantity > quantity then insert new record deducte quantity from old location.end
//Changed By Pragyan 09-MAY-14 to Take Local connection.Start
ConnDriver connDriver = null;
Connection conn=null;
java.util.Date confDate = new java.util.Date();
DockTranConf dockconf = new DockTranConf();
/* Connection conn1 = null;
ConnDriver connDriver = null;*/
try
{
//Changed By Pragyan 09-MAY-14 to Take Local connection.Start
connDriver = new ConnDriver();
conn = connDriver.getConnectDB("DriverValidator");
if(conn==null)
{
System.out.println("Connection is null");
return "";
}
stagingLoc = distCommon.getDisparams( "999999", "STAGING_LOC", conn );
//Changed By Pragyan 09-MAY-14 to Take Local connection.end
updateRowMap = new HashMap() ;
/*connDriver = new ConnDriver();
conn1 = connDriver.getConnectDB("DriverValidator");*/
String applDateFormat = genericUtility.getApplDateFormat();
String dbDateFormat = genericUtility.getDBDateFormat();
SimpleDateFormat sdf = new SimpleDateFormat(applDateFormat);
String currDateStr = sdf.format(currDate1);
java.sql.Timestamp tranDate = java.sql.Timestamp.valueOf(genericUtility.getValidDateString( currDateStr , applDateFormat, dbDateFormat ) + " 00:00:00.0") ;
conn.setAutoCommit(false);
dom = genericUtility.parseString(domString);
chguser = genericUtility.getValueFromXTRA_PARAMS( xtraParams, "loginCode" );
InetAddress ownIP=InetAddress.getLocalHost();
chgTerm = ownIP.getHostAddress();
currDate = new Timestamp(System.currentTimeMillis());
palletNo = genericUtility.getColumnValue("pallet_no", dom, "1", "1");
//locCodeSys = genericUtility.getColumnValue("loc_code__sys", dom, "1", "1");
System.out.println("Location code to ->>["+locCodeSys+"]");
locCodeTo = genericUtility.getColumnValue("loc_code__to", dom, "2" );
//pickOrder = genericUtility.getColumnValueFromNode("pick_order", dom.getElementsByTagName("Detail2").item(0));
System.out.println("palert no from generic utility ["+palletNo+"] locCodeTo [" + locCodeTo + "]");
//sql = "SELECT HDR1.tran_id tran_id,HDR.PICK_TYPE,HDR1.PICK_ORDER FROM PICK_ORD_HDR HDR,PICK_ISS_HDR HDR1 WHERE HDR.PICK_ORDER = HDR1.PICK_ORDER AND HDR1.PALLET_NO = ?";//PICK_ISS_HDR
//Changed By Pragyan 06/03/12 To check only "N" trf status
//sql = "SELECT HDR.PICK_TYPE,HDR1.PICK_ORDER FROM PICK_ORD_HDR HDR,PICK_ISS_HDR HDR1 WHERE HDR.PICK_ORDER = HDR1.PICK_ORDER AND HDR1.PALLET_NO = ?";//PICK_ISS_HDR
sql = "SELECT HDR1.TRAN_ID TRAN_ID,HDR.PICK_TYPE,HDR1.PICK_ORDER FROM PICK_ORD_HDR HDR,PICK_ISS_HDR HDR1 WHERE HDR.PICK_ORDER = HDR1.PICK_ORDER AND HDR1.PALLET_NO = ? AND (CASE WHEN HDR1.TRF_STATUS IS NULL THEN 'N' ELSE HDR1.TRF_STATUS END) = ?";//PICK_ISS_HDR
//conn.setAutoCommit(false);
sql = "SELECT HDR1.TRAN_ID TRAN_ID,HDR.PICK_TYPE,HDR1.PICK_ORDER FROM PICK_ORD_HDR HDR,PICK_ISS_HDR HDR1 WHERE HDR.PICK_ORDER = HDR1.PICK_ORDER AND HDR1.PALLET_NO = ? AND (CASE WHEN HDR1.TRF_STATUS IS NULL THEN 'N' ELSE HDR1.TRF_STATUS END) = ?"; //PICK_ISS_HDR
pstmt = conn.prepareStatement(sql);
pstmt.setString( 1, palletNo);
pstmt.setString( 2, "N");
rs = pstmt.executeQuery();
if(rs.next())
{
tranId = rs.getString("tran_id")==null?"":rs.getString("tran_id");
......@@ -146,751 +106,186 @@ public class DockTranPos extends ValidatorEJB implements DockTranPosLocal, DockT
}
rs.close(); rs = null;
pstmt.close(); pstmt = null;
sql = "UPDATE PICK_ISS_DET SET LOC_CODE__TO = ? WHERE TRAN_ID = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString( 1, locCodeTo);
pstmt.setString( 2, tranId);
pstmt.executeUpdate();
pstmt.close(); pstmt = null;
//Update the carton master
/*
sql = "UPDATE CARTON_MASTER SET STATUS = 'U' WHERE CARTON_NO IN(SELECT CARTON_NO FROM PICK_ISS_DET WHERE PICK_ORDER = ? )";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, pickOrder);
int updCnt = pstmt.executeUpdate();
pstmt.close(); pstmt = null;
if(updCnt > 0)
{
System.out.println("---row updated sucessfully of master pick---->"+updCnt);
}
*/
//validation for null
//stagingLoc = distCommon.getDisparams( "999999", "STAGING_LOC", conn )==null?"":distCommon.getDisparams( "999999", "STAGING_LOC", conn );
if("M".equalsIgnoreCase(pickType))
{
stagingLoc = distCommon.getDisparams( "999999", "STAGING_LOC_MPK", conn)==null?"":distCommon.getDisparams( "999999", "STAGING_LOC_MPK", conn);
}
else
{
stagingLoc = distCommon.getDisparams( "999999", "STAGING_LOC", conn)==null?"":distCommon.getDisparams( "999999", "STAGING_LOC", conn);
}
//allocation for dock location
sql = "select acct_code__inv, cctr_code__inv, "
+ "exp_date, pack_code, mfg_date, site_code__mfg, "
+ "pack_instr, supp_code__mfg, retest_date, rate, "
+ "gross_rate, conv__qty_stduom, unit__alt, batch_no, batch_size, unit, grade, remarks, dimension "
+ "from stock "
+ "where item_code = ? "
+ "and site_code = ? "
+ "and loc_code = ? "
+ "and lot_no = ? "
+ "and lot_sl = ? ";
pstmtStock = conn.prepareStatement(sql);
tranID = generateTranId( "w_dock_tran",siteCode,conn );
System.out.println("tranID:"+tranID);
sql = "SELECT R.LINE_NO LINE_NO, R.ITEM_CODE ITEM_CODE, R.SITE_CODE SITE_CODE, R.LOC_CODE LOC_CODE, "
//Changed by sumit on 14/03/13 getting quantity as (quantity - dealloc_qty)
//+ " R.LOT_NO LOT_NO, R.LOT_SL LOT_SL, R.QUANTITY QUANTITY, R.NO_ART NO_ART, "
/* sql = " SELECT R.LINE_NO LINE_NO, R.ITEM_CODE ITEM_CODE, R.SITE_CODE SITE_CODE, R.LOC_CODE LOC_CODE, "
+ " R.LOT_NO LOT_NO, R.LOT_SL LOT_SL, ( R.QUANTITY - CASE WHEN R.DEALLOC_QTY IS NULL THEN 0 ELSE R.DEALLOC_QTY END) AS QUANTITY, R.NO_ART NO_ART, "
+ " R.LOC_CODE__TO LOC_CODE__TO, O.SALE_ORDER SALE_ORDER, O.LINE_NO__SORD LINE_NO__SORD, O.PICK_ORDER,H.PICK_TYPE "
+ " FROM PICK_ISS_DET R, PICK_ORD_DET O,PICK_ORD_HDR H"
+ " WHERE R.TRAN_ID = ? "
+ " AND R.PICK_ORDER = O.PICK_ORDER "
+"AND H.PICK_ORDER = O.PICK_ORDER"
+ " AND H.PICK_ORDER = O.PICK_ORDER"
+ " AND O.LINE_NO = R.LINE_NO__ORD "
//Changed by Rohan on 29-06-13 for adding condition of quantity > 0
+" AND ( R.QUANTITY - CASE WHEN R.DEALLOC_QTY IS NULL THEN 0 ELSE R.DEALLOC_QTY END) > 0 "
+" AND R.LOC_CODE <> R.LOC_CODE__TO ";
pstmt = conn.prepareStatement(sql);
+" AND R.LOC_CODE <> R.LOC_CODE__TO ";*/
sql = " SELECT R.LINE_NO LINE_NO, R.ITEM_CODE ITEM_CODE, R.SITE_CODE SITE_CODE, R.LOC_CODE LOC_CODE, " +
" R.LOT_NO LOT_NO, R.LOT_SL LOT_SL, ( R.QUANTITY - CASE WHEN R.DEALLOC_QTY IS NULL THEN 0 ELSE R.DEALLOC_QTY END) AS QUANTITY, " +
" R.NO_ART NO_ART, R.LOC_CODE__TO LOC_CODE__TO, R.LOC_CODE__SYS LOC_CODE__SYS, O.SALE_ORDER SALE_ORDER, O.LINE_NO__SORD LINE_NO__SORD, "+
" O.PICK_ORDER, H.PICK_TYPE, S.CONFIRMED, S.CONF_DATE, S.PALLET_NO, S.TRAN_ID, "+
" S.EMP_CODE__APRV, WT.PTCN, WT.WAVE_ID, S.CHG_USER, S.CHG_DATE, S.CHG_TERM "+
" FROM PICK_ISS_DET R, PICK_ORD_DET O, PICK_ORD_HDR H, PICK_ISS_HDR S, WAVE_TASK_DET WT, WAVE_TASK W "+
" WHERE R.TRAN_ID = ? "+
" AND R.PICK_ORDER = O.PICK_ORDER "+
" AND H.PICK_ORDER = O.PICK_ORDER "+
" AND O.LINE_NO = R.LINE_NO__ORD "+
" AND W.WAVE_ID = WT.WAVE_ID " +
" AND S.PICK_ORDER = R.PICK_ORDER " +
" AND S.PICK_ORDER = WT.REF_ID "+
" AND ( R.QUANTITY - CASE WHEN R.DEALLOC_QTY IS NULL THEN 0 ELSE R.DEALLOC_QTY END) > 0 "+
" AND R.LOC_CODE <> R.LOC_CODE__TO ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId);
rs = pstmt.executeQuery();
rs = pstmt.executeQuery();
System.out.println("isRecordexist::"+isRecordexist);
while(rs.next())
{
itemCode = rs.getString( "item_code" );
siteCode = rs.getString( "site_code" );
locCode = rs.getString( "loc_code" );
lotNo = rs.getString( "lot_no" );
lotSl = rs.getString( "lot_sl" );
quantity = rs.getDouble( "quantity" );
noArt = rs.getDouble( "no_art" );
locCodeTo = rs.getString( "loc_code__to" );
System.out.println("isRecordexist0::"+isRecordexist);
itemCode = rs.getString( "ITEM_CODE" );
siteCode = rs.getString( "SITE_CODE" );
locCode = rs.getString( "LOC_CODE" );
lotNo = rs.getString( "LOT_NO" );
lotSl = rs.getString( "LOT_SL" );
quantity = rs.getDouble( "QUANTITY" );
noArt = rs.getDouble( "NO_ART" );
locCodeTo = rs.getString( "LOC_CODE__TO" );
saleOrder = rs.getString( "SALE_ORDER" );
lineNoSord = rs.getString( "LINE_NO__SORD" );
pickOrder = rs.getString( "PICK_ORDER" );
lineNo = rs.getInt( "LINE_NO" );
pickType = rs.getString( "PICK_TYPE" );
locCodeSys = rs.getString( "LOC_CODE__SYS" );
employeeCode = rs.getString( "EMP_CODE__APRV" );
conmfirmed = rs.getString( "CONFIRMED" );
confDate = rs.getDate( "CONF_DATE" );
ptcn = rs.getString( "PTCN" );
waveId = rs.getString( "WAVE_ID" );
palletNo = rs.getString( "PALLET_NO" );
tranIdissue = rs.getString( "TRAN_ID" );
System.out.println("pick type from hdr->> ["+pickType+"]");
lineNumber++;
System.out.println("confDate:"+confDate);
System.out.println("confDate1:"+(Date)confDate);
// 16/10/11 manoharan check whether allocation against sales order is there
// if allocation against sales order found change allocation to point to loc_code__to
// and deallocate the same for loc_code in stock
// update sordalloc with loc_code__to
// This utility methods to update old and new location should be in
// a separate probably in stockupdate so that we can call the same from various places
//
//
pstmtStock.setString(1,itemCode);
pstmtStock.setString(2,siteCode);
pstmtStock.setString(3,locCode);
pstmtStock.setString(4,lotNo);
pstmtStock.setString(5,lotSl);
rsStock = pstmtStock.executeQuery();
if ( rsStock.next() )
{
acctCodeDr = rsStock.getString("acct_code__inv");
cctrCodeDr = rsStock.getString("cctr_code__inv");
expDate = rsStock.getTimestamp("exp_date");
packCode = rsStock.getString("pack_code");
mfgDate = rsStock.getTimestamp("mfg_date");
siteCodeMfg = rsStock.getString("site_code__mfg");
packInstr = rsStock.getString("pack_instr");
suppCodeMfg = rsStock.getString("supp_code__mfg");
restestDate = rsStock.getTimestamp("retest_date");
stkRate = rsStock.getDouble("rate");
stkGrossRate = rsStock.getDouble("gross_rate");
convQtyStduom = rsStock.getDouble("conv__qty_stduom");
unitAlt = rsStock.getString("unit__alt");
batchNo = rsStock.getString("batch_no");
batchSize = rsStock.getDouble("batch_size");
unit = rsStock.getString("unit");
grade = rsStock.getString("grade");
remarks = rsStock.getString("remarks");
dimension = rsStock.getString("dimension");
}
rsStock.close(); rsStock = null;
pstmtStock.clearParameters();
// 10/10/12 manoharan
itmVolumeMap.clear();
itmVolumeMap = getItemVoumeMap(itemCode,lotNo,conn);
shipperSize = (Double) itmVolumeMap.get("SHIPPER_SIZE");
itemGrossWeight = (Double) itmVolumeMap.get("ITEM_GROSS_WEIGHT");
caseGrossWeight = (Double) itmVolumeMap.get("CASE_GROSS_WEIGHT");
itemNetWeight = (Double) itmVolumeMap.get("ITEM_NET_WEIGHT");
caseNetWeight = (Double) itmVolumeMap.get("CASE_NET_WEIGHT");
// end 10/10/12 manoharan
updateRowMap.put("item_code", itemCode);
updateRowMap.put("site_code", siteCode);
updateRowMap.put("loc_code", stagingLoc);
updateRowMap.put("lot_no", lotNo);
updateRowMap.put("lot_sl", lotSl);
updateRowMap.put("quantity", ""+quantity);
updateRowMap.put("no_art", noArt);
updateRowMap.put("tran_ser", "PICISS");
updateRowMap.put("acct_code__cr",acctCodeDr);
updateRowMap.put("cctr_code__cr",cctrCodeDr);
updateRowMap.put("acct_code_inv",acctCodeDr);
updateRowMap.put("cctr_code_inv",cctrCodeDr);
updateRowMap.put("rate",Double.toString(stkRate));
updateRowMap.put("gross_rate",Double.toString(stkGrossRate));
updateRowMap.put("tran_id", tranId );
// 17/10/11 manoharan
updateRowMap.put("line_no", "" + lineNo );
// end 17/10/11 manoharan
updateRowMap.put("tran_date", tranDate );
//Changed By Pragyan
//updateRowMap.put("tran_type","I");
updateRowMap.put("tran_type","ID");
updateRowMap.put("qty_stduom", ""+quantity);
updateRowMap.put("unit",unit);
updateRowMap.put("grade",grade);
updateRowMap.put("remarks",remarks);
updateRowMap.put("dimension",dimension);
//updateRowMap.put("tran_type", "I");//Creating issue
//changed by gulzar on 12/24/2011
updateRowMap.put("exp_date", expDate);
updateRowMap.put("pack_code", packCode);
updateRowMap.put("mfg_date", mfgDate);
updateRowMap.put("site_code__mfg", siteCodeMfg);
updateRowMap.put("pack_instr", packInstr);
updateRowMap.put("supp_code__mfg", suppCodeMfg);
updateRowMap.put("retest_date", restestDate);
updateRowMap.put("conv__qty_stduom", ""+convQtyStduom);
updateRowMap.put("unit__alt", unitAlt);
updateRowMap.put("batch_no", batchNo);
updateRowMap.put("batch_size", ""+batchSize);
//End changes by gulzar on 12/24/2011
// 10/10/12 manoharan weight and no_art to be set properly
if("A".equalsIgnoreCase(pickType))
{
noArt = 1;
}
else
{
noArt = Math.floor((quantity) / shipperSize) ;
}
updateRowMap.put("no_art", noArt);
updateRowMap.put("gross_weight", caseGrossWeight * noArt);
updateRowMap.put("net_weight", caseNetWeight * noArt);
updateRowMap.put("tare_weight", (caseGrossWeight - caseNetWeight) * noArt);
// end 10/10/12 manoharan
retString = stkUpdate.updateStock( updateRowMap, xtraParams, conn );
if ( retString != null && retString.trim().length() > 0 )
{
isError = true;
break;
}
updateRowMap.put("loc_code", locCodeTo);
// else
// {
// updateRowMap.put("loc_code", locCodeTo);
// }
updateRowMap.put("tran_type", "R");//Creating receipt
retString = stkUpdate.updateStock( updateRowMap, xtraParams, conn );
if ( retString != null && retString.trim().length() > 0 )
{
isError = true;
break;
}
if(isRecordexist == false)
{
updateSql = " INSERT INTO DOCK_TRAN (TRAN_ID, SITE_CODE, PALLET_NO, TRAN_ID__ISS, EMP_CODE , " +
" PTCN, WAVE_ID, CHG_DATE, CHG_USER, CHG_TERM) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ) ";
updateRowMap.clear();
// 16/10/11 manoharan check whether allocation/hold are there
// if so update the same
//added by cpandey on
//if(!("A".equalsIgnoreCase(pickType)))
//{
strAllocate = new HashMap();
strAllocate.put("tran_date",tranDate);
strAllocate.put("ref_ser","PICISS");
strAllocate.put("ref_id",tranId);
strAllocate.put("ref_line", "" + lineNo);
strAllocate.put("site_code",siteCode);
strAllocate.put("item_code",itemCode);
strAllocate.put("loc_code",locCodeTo);
strAllocate.put("lot_no",lotNo);
strAllocate.put("lot_sl",lotSl);
strAllocate.put("alloc_qty",new Double(quantity));
strAllocate.put("chg_user",GenericUtility.getInstance().getValueFromXTRA_PARAMS(xtraParams,"loginCode"));
strAllocate.put("chg_term",GenericUtility.getInstance().getValueFromXTRA_PARAMS(xtraParams,"termId"));
strAllocate.put("chg_win","w_pick_iss");
//}
retString = invAllocTrace.updateInvallocTrace(strAllocate, conn);
if ( retString != null && retString.trim().length() > 0 )
{
isError = true;
break;
}
System.out.println("retString ::: " + retString);
if (retString != null && retString.trim().length() > 0 )
{
isError = true;
break;
}
strAllocate = null;
lineNoSord = " " + lineNoSord;
lineNoSord = lineNoSord.substring(lineNoSord.length()-3);
//Changed By 02/05/13 Pragyan To check the sordalloc allocated quantity > quantity then insert new record deducte quantity from old location.start
/*// end 16/10/11 manoharan allocation stock for new location
// 16/10/11 manoharan update sordalloc
updateSql = "UPDATE SORDALLOC SET LOC_CODE = ? "
+ " WHERE SALE_ORDER = ? AND LINE_NO = ? "
+ " AND ITEM_CODE = ? "
+ " AND LOC_CODE = ? "
+ " AND LOT_NO = ? "
+ " AND LOT_SL = ? "
+ " AND QTY_ALLOC > 0";
pstmtUpd = conn.prepareStatement(updateSql);
pstmtUpd.setString(1, locCodeTo);
pstmtUpd.setString(2, saleOrder);
pstmtUpd.setString(3, lineNoSord);
pstmtUpd.setString(4, itemCode);
pstmtUpd.setString(5, locCode);
pstmtUpd.setString(6, lotNo);
pstmtUpd.setString(7, lotSl);
updCnt = pstmtUpd.executeUpdate(); //change done by kunal on 14/09/12 uncomment sql query
// end 16/10/11 manoharan update sordalloc
*/
sql = " SELECT EXP_LEV, ITEM_CODE__ORD, "
+ " ITEM_REF, UNIT, DATE_ALLOC, STATUS, ITEM_GRADE, EXP_DATE, ALLOC_MODE, SITE_CODE, "
+ " CONV__QTY_STDUOM, UNIT__STD, MFG_DATE, SITE_CODE__MFG, REAS_CODE,QUANTITY,QTY_ALLOC FROM SORDALLOC "
+ " WHERE SALE_ORDER = ? AND LINE_NO = ? "
+ " AND ITEM_CODE = ? "
+ " AND LOC_CODE = ? "
+ " AND LOT_NO = ? "
+ " AND LOT_SL = ? "
+ " AND QTY_ALLOC > 0";
pstmt1 = conn.prepareStatement(sql);
pstmt1.setString(1, saleOrder);
pstmt1.setString(2, lineNoSord);
pstmt1.setString(3, itemCode);
pstmt1.setString(4, locCode);
pstmt1.setString(5, lotNo);
pstmt1.setString(6, lotSl);
rs1 = pstmt1.executeQuery();
if( rs1.next())
{
expLev = rs1.getString( "EXP_LEV" );
itemCodeOrd = rs1.getString( "ITEM_CODE__ORD" );
itemRef = rs1.getString( "ITEM_REF" );
unit = rs1.getString( "UNIT" );
status = rs1.getString( "STATUS" );
itemGrade = rs1.getString( "ITEM_GRADE" );
allocMode = rs1.getString( "ALLOC_MODE" );
siteCode = rs1.getString( "SITE_CODE" );
siteCodeMfg = rs1.getString( "SITE_CODE__MFG" );
reasCode = rs1.getString( "REAS_CODE" );
unitStd = rs1.getString( "UNIT__STD" );
convQtyStduom = rs1.getDouble( "CONV__QTY_STDUOM" );
dateAlloc = rs1.getTimestamp("DATE_ALLOC");
expDate = rs1.getTimestamp("EXP_DATE");
mfgDate = rs1.getTimestamp("MFG_DATE");
qtyOrd = rs1.getDouble( "QUANTITY" );
sordAllocQty = rs1.getDouble( "QTY_ALLOC" );
}
else
{
isError = true;
retString = itmDBAccess.getErrorString("","RECNOTSORA","");
return retString;
}
rs1.close();
rs1 = null;
pstmt1.close();
pstmt1 = null;
sSQL = "SELECT COUNT(*) AS COUNT FROM SORDALLOC WHERE "
+ " SALE_ORDER = ? AND LINE_NO = ? "
+ " AND ITEM_CODE = ? "
+ " AND LOC_CODE = ? "
+ " AND LOT_NO = ? "
+ " AND LOT_SL = ? ";
int count = 0;
if(sordAllocQty > quantity)
{
//Changed by sumit on 09/05/13 substituting QUANTITY__STDUOM too.
//updateSql = "UPDATE SORDALLOC SET QTY_ALLOC = QTY_ALLOC - ? "
//changed by sankara on 17/10/13 for update wave_flag
//updateSql = "UPDATE SORDALLOC SET QTY_ALLOC = QTY_ALLOC - ? ,QUANTITY__STDUOM = QUANTITY__STDUOM - ?" //LOC_CODE = ? ,LOT_SL = ? "
updateSql = "UPDATE SORDALLOC SET QTY_ALLOC = QTY_ALLOC - ? ,QUANTITY__STDUOM = QUANTITY__STDUOM - ?, WAVE_FLAG = 'Y' "
+ " WHERE SALE_ORDER = ? AND LINE_NO = ? "
+ " AND ITEM_CODE = ? "
+ " AND LOC_CODE = ? "
+ " AND LOT_NO = ? "
+ " AND LOT_SL = ? "
+ " AND QTY_ALLOC > 0";
pstmtUpd = conn.prepareStatement(updateSql);
pstmtUpd.setDouble(1, quantity);
////Changed by sumit on 09/05/13 setting value as per sql.
pstmtUpd.setDouble(2, quantity * convQtyStduom);
pstmtUpd.setString(3, saleOrder);
pstmtUpd.setString(4, lineNoSord);
pstmtUpd.setString(5, itemCode);
pstmtUpd.setString(6, locCode);
pstmtUpd.setString(7, lotNo);
pstmtUpd.setString(8, lotSl);
pstmtUpd.setString(1, tranID);
pstmtUpd.setString(2, siteCode);
pstmtUpd.setString(3, palletNo);
pstmtUpd.setString(4, tranIdissue);
pstmtUpd.setString(5, employeeCode);
pstmtUpd.setString(6, ptcn);
pstmtUpd.setString(7, waveId);
pstmtUpd.setTimestamp(8,currDate);
pstmtUpd.setString(9, chguser);
pstmtUpd.setString(10, chgTerm);
updCnt = pstmtUpd.executeUpdate();
System.out.println("Changed By 02/05/13 Pragyan sordalloc updated updCnt [" + updCnt + "]");
pstmtSord = conn.prepareStatement(sSQL);
pstmtSord.setString(1, saleOrder);
pstmtSord.setString(2, lineNoSord);
pstmtSord.setString(3, itemCode);
/*if(("A".equalsIgnoreCase(pickType)) || ("M".equalsIgnoreCase(pickType)))
{
pstmtSord.setString(4, stagingLoc);
}
else
{
pstmtSord.setString(4, locCodeTo);
}
*/
pstmtSord.setString(4, locCodeTo);
pstmtSord.setString(5, lotNo);
pstmtSord.setString(6, lotSl);
rsSord = pstmtSord.executeQuery();
if(rsSord.next())
{
count = rsSord.getInt(1);
}
if(count > 0)
if(updCnt > 0)
{
System.out.println("Changed By 02/05/13 Pragyan sordalloc If alrady exist Location Update Inside grater updCnt1st [" + updCnt + "]");
//changed by sankara on 17/10/13 for update wave_flag
//updateSql = "UPDATE SORDALLOC SET QTY_ALLOC = QTY_ALLOC + ? ,QUANTITY__STDUOM = QUANTITY__STDUOM + ?"
updateSql = "UPDATE SORDALLOC SET QTY_ALLOC = QTY_ALLOC + ? ,QUANTITY__STDUOM = QUANTITY__STDUOM + ?, WAVE_FLAG = 'Y' "
+ " WHERE SALE_ORDER = ? AND LINE_NO = ? "
+ " AND ITEM_CODE = ? "
+ " AND LOC_CODE = ? "
+ " AND LOT_NO = ? "
+ " AND LOT_SL = ? "
+ " AND QTY_ALLOC > 0";
pstmtUpd = conn.prepareStatement(updateSql);
pstmtUpd.setDouble(1, quantity);
pstmtUpd.setDouble(2, quantity);
pstmtUpd.setString(3, saleOrder);
pstmtUpd.setString(4, lineNoSord);
pstmtUpd.setString(5, itemCode);
/*if(("A".equalsIgnoreCase(pickType)) || ("M".equalsIgnoreCase(pickType)))
{
pstmtUpd.setString(6, stagingLoc);
}
else
{
pstmtUpd.setString(6, locCodeTo);
}
*/
pstmtUpd.setString(6, locCodeTo);
pstmtUpd.setString(7, lotNo);
pstmtUpd.setString(8, lotSl);
updCnt = pstmtUpd.executeUpdate();
System.out.println("Changed By 02/05/13 Pragyan sordalloc If alrady exist Location Update Inside grater updCnt2nd [" + updCnt + "]");
}
else
{
updateSql = "insert into sordalloc( SALE_ORDER, LINE_NO, EXP_LEV, ITEM_CODE__ORD, "
+ " ITEM_CODE, LOT_NO, LOT_SL, LOC_CODE, ITEM_REF, QUANTITY, UNIT, "
+ " QTY_ALLOC, DATE_ALLOC, STATUS, ITEM_GRADE, EXP_DATE, ALLOC_MODE, SITE_CODE, "
+ " CONV__QTY_STDUOM, UNIT__STD, QUANTITY__STDUOM, MFG_DATE, SITE_CODE__MFG, "
//changed by sankara on 15/10/13 for update wave_flag start.
/* + " REAS_CODE ) VALUES (?, ?, ?, ?, "
+ " ?, ?, ? , ?, ?, ?, ?, "
+ " ?,?, ?, ?, ?, ?, ?, "
+ " ?, ?, ? , ?, ?, ?) "; */
+ " REAS_CODE, WAVE_FLAG ) VALUES (?, ?, ?, ?, "
+ " ?, ?, ? , ?, ?, ?, ?, "
+ " ?,?, ?, ?, ?, ?, ?, "
+ " ?, ?, ? , ?, ?, ?, ?) ";
//changed by sankara on 15/10/13 for update wave_flag end.
pstmtUpd = conn.prepareStatement(updateSql);
pstmtUpd.setString(1, saleOrder);
pstmtUpd.setString(2, lineNoSord);
pstmtUpd.setString(3, expLev);
pstmtUpd.setString(4, itemCodeOrd);
pstmtUpd.setString(5, itemCode);
pstmtUpd.setString(6, lotNo);
pstmtUpd.setString(7, lotSl);
//pstmtUpd.setString(8, locCodeTo);
/*if(("A".equalsIgnoreCase(pickType)) || ("M".equalsIgnoreCase(pickType)))
{
pstmtUpd.setString(8, stagingLoc);
}
else
{
pstmtUpd.setString(8, locCodeTo);
} */
//Changed by sumit on 09/05/13
pstmtUpd.setString(8, locCodeTo);
pstmtUpd.setString(9, itemRef);
pstmtUpd.setDouble(10, qtyOrd);
pstmtUpd.setString(11, unit);
pstmtUpd.setDouble(12, quantity);
pstmtUpd.setTimestamp(13, dateAlloc);
pstmtUpd.setString(14, status);
pstmtUpd.setString(15, itemGrade);
pstmtUpd.setTimestamp(16, expDate);
pstmtUpd.setString(17, allocMode);
pstmtUpd.setString(18, siteCode);
pstmtUpd.setDouble(19, convQtyStduom );
pstmtUpd.setString(20, unitStd);
pstmtUpd.setDouble(21, quantity * convQtyStduom);
pstmtUpd.setTimestamp(22, mfgDate );
pstmtUpd.setString(23, siteCodeMfg);
pstmtUpd.setString(24, reasCode);
//changed by sankara on 15/10/13 for update of wave_flag
pstmtUpd.setString( 25, "Y");
updCnt = pstmtUpd.executeUpdate();
System.out.println("Changed By 02/05/13 Pragyan sordalloc inserted updCnt [" + updCnt + "]");
}
}
else
{
pstmtSord = conn.prepareStatement(sSQL);
pstmtSord.setString(1, saleOrder);
pstmtSord.setString(2, lineNoSord);
pstmtSord.setString(3, itemCode);
/*if(("A".equalsIgnoreCase(pickType)) || ("M".equalsIgnoreCase(pickType)))
{
pstmtSord.setString(4, stagingLoc);
}
else
{
pstmtSord.setString(4, locCodeTo);
} */
pstmtSord.setString(4, locCodeTo);
pstmtSord.setString(5, lotNo);
pstmtSord.setString(6, lotSl);
rsSord = pstmtSord.executeQuery();
if(rsSord.next())
{
count = rsSord.getInt(1);
}
if(count > 0)
{
//changed by sankara on 17/10/13 update wave_flag
//updateSql = "UPDATE SORDALLOC SET QTY_ALLOC = QTY_ALLOC - ? ,QUANTITY__STDUOM = QUANTITY__STDUOM - ?" //LOC_CODE = ? ,LOT_SL = ? "
updateSql = "UPDATE SORDALLOC SET QTY_ALLOC = QTY_ALLOC - ? ,QUANTITY__STDUOM = QUANTITY__STDUOM - ?, WAVE_FLAG = 'Y' "
+ " WHERE SALE_ORDER = ? AND LINE_NO = ? "
+ " AND ITEM_CODE = ? "
+ " AND LOC_CODE = ? "
+ " AND LOT_NO = ? "
+ " AND LOT_SL = ? "
+ " AND QTY_ALLOC > 0";
pstmtUpd = conn.prepareStatement(updateSql);
pstmtUpd.setDouble(1, quantity);
pstmtUpd.setDouble(2, quantity);
pstmtUpd.setString(3, saleOrder);
pstmtUpd.setString(4, lineNoSord);
pstmtUpd.setString(5, itemCode);
pstmtUpd.setString(6, locCode);
pstmtUpd.setString(7, lotNo);
pstmtUpd.setString(8, lotSl);
updCnt = pstmtUpd.executeUpdate();
System.out.println("Changed By 02/05/13 Pragyan If alrady exist Location Update updCnt1st [" + updCnt + "]");
//changed by sankara on 17/10/13 update wave_flag
//updateSql = "UPDATE SORDALLOC SET QTY_ALLOC = QTY_ALLOC + ? ,QUANTITY__STDUOM = QUANTITY__STDUOM + ?"
updateSql = "UPDATE SORDALLOC SET QTY_ALLOC = QTY_ALLOC + ? ,QUANTITY__STDUOM = QUANTITY__STDUOM + ?, WAVE_FLAG = 'Y' "
+ " WHERE SALE_ORDER = ? AND LINE_NO = ? "
+ " AND ITEM_CODE = ? "
+ " AND LOC_CODE = ? "
+ " AND LOT_NO = ? "
+ " AND LOT_SL = ? "
+ " AND QTY_ALLOC > 0";
pstmtUpd = conn.prepareStatement(updateSql);
pstmtUpd.setDouble(1, quantity);
pstmtUpd.setDouble(2, quantity);
pstmtUpd.setString(3, saleOrder);
pstmtUpd.setString(4, lineNoSord);
pstmtUpd.setString(5, itemCode);
/*if(("A".equalsIgnoreCase(pickType)) || ("M".equalsIgnoreCase(pickType)))
{
pstmtUpd.setString(6, stagingLoc);
}
else
{
pstmtUpd.setString(6, locCodeTo);
} */
pstmtUpd.setString(6, locCodeTo);
pstmtUpd.setString(7, lotNo);
pstmtUpd.setString(8, lotSl);
updCnt = pstmtUpd.executeUpdate();
System.out.println("Changed By 02/05/13 Pragyan sordalloc If alrady exist Location Update updCnt2nd [" + updCnt + "]");
System.out.println("record inserted in dock_tran["+updCnt+"]");
}
else
{
//changed by sankara on 15/10/13 for update wave_flag
//updateSql = "UPDATE SORDALLOC SET LOC_CODE = ? "
updateSql = "UPDATE SORDALLOC SET LOC_CODE = ?, WAVE_FLAG = 'Y' "
+ " WHERE SALE_ORDER = ? AND LINE_NO = ? "
+ " AND ITEM_CODE = ? "
+ " AND LOC_CODE = ? "
+ " AND LOT_NO = ? "
+ " AND LOT_SL = ? "
+ " AND QTY_ALLOC > 0";
pstmtUpd = conn.prepareStatement(updateSql);
pstmtUpd.setString(1, locCodeTo);
pstmtUpd.setString(2, saleOrder);
pstmtUpd.setString(3, lineNoSord);
pstmtUpd.setString(4, itemCode);
pstmtUpd.setString(5, locCode);
pstmtUpd.setString(6, lotNo);
pstmtUpd.setString(7, lotSl);
updCnt = pstmtUpd.executeUpdate();
}
}
//Changed By 02/05/13 Pragyan To check the sordalloc allocated quantity > quantity then insert new record deducte quantity from old location.end
System.out.println("Changed By 02/05/13 Pragyan sordalloc inserted updCnt [" + updCnt + "]");
pstmtUpd.close();pstmtUpd = null;
}
updateSql = " INSERT INTO DOCK_TRAN_DET ( TRAN_ID, LINE_NO,LINE_NO__ISS,PICK_ORDER,LINE_NO__PICK,PICK_TYPE,ITEM_CODE,LOC_CODE,LOT_NO,LOT_SL,NO_ART,QUANTITY," +
" LOC_CODE__TO,LOC_CODE__SYS,SALE_ORDER,LINE_NO__SORD) VALUES ( ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,? ) ";
updateSql = "UPDATE PICK_ISS_DET SET LOC_CODE__TO = ? "
+ " WHERE TRAN_ID = ? AND LINE_NO = ? ";
pstmtUpd = conn.prepareStatement(updateSql);
pstmtUpd.setString(1, locCodeTo);
pstmtUpd.setString(2, tranId);
pstmtUpd.setInt(3, lineNo);
pstmtUpd.setString(1, tranID);
pstmtUpd.setInt(2, lineNumber);
pstmtUpd.setInt(3, lineNo);
pstmtUpd.setString(4, pickOrder);
pstmtUpd.setInt(5, lineNo);
pstmtUpd.setString(6, pickType);
pstmtUpd.setString(7, itemCode);
pstmtUpd.setString(8, locCode);
pstmtUpd.setString(9, lotNo);
pstmtUpd.setString(10, lotSl);
pstmtUpd.setDouble(11, noArt);
pstmtUpd.setDouble(12, quantity);
pstmtUpd.setString(13, locCodeTo);
pstmtUpd.setString(14, locCodeSys);
pstmtUpd.setString(15, saleOrder);
pstmtUpd.setString(16, lineNoSord);
updCnt = pstmtUpd.executeUpdate();
if(updCnt > 0)
{
System.out.println("record inserted in dock_tran_det["+updCnt+"]");
}
pstmtUpd.close();pstmtUpd = null;
isRecordexist = true;
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if (retString != null && retString.trim().length() > 0 )
{
isError = true;
return retString;
}
rs.close();rs = null;
pstmt.close();pstmt = null;
System.out.println("isRecordexist1::"+isRecordexist);
/*updateSql = " INSERT INTO DOCK_TRAN (TRAN_ID, SITE_CODE, PALLET_NO, TRAN_ID__ISS, EMP_CODE , " +
" PTCN, WAVE_ID, CHG_DATE, CHG_USER, CHG_TERM) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ) ";
updateSql = "UPDATE PICK_ISS_HDR SET TRF_STATUS = 'Y' "
+ " WHERE TRAN_ID = ? ";
pstmtUpd = conn.prepareStatement(updateSql);
pstmtUpd.setString(1, tranId);
pstmtUpd.setString(1, tranID);
pstmtUpd.setString(2, siteCode);
pstmtUpd.setString(3, palletNo);
pstmtUpd.setString(4, tranIdissue);
pstmtUpd.setString(5, employeeCode);
pstmtUpd.setString(6, ptcn);
pstmtUpd.setString(7, waveId);
pstmtUpd.setTimestamp(8,currDate);
pstmtUpd.setString(9, chguser);
pstmtUpd.setString(10, chgTerm);
updCnt = pstmtUpd.executeUpdate();
pstmtUpd.close();
pstmtUpd = null;
//Changed by Sankara on 03/oct/13 adding validation to prevent doc transfer in case of pending/aborted picking.start
int countConf = 0;
sql = " SELECT COUNT(*) FROM PICK_ISS_HDR PIH, PICK_ISS_DET PH WHERE "
+" PIH.PICK_ORDER = PH.PICK_ORDER AND PH.TRAN_ID = PIH.TRAN_ID AND PIH.CONFIRMED = ? "
+" AND PIH.PICK_ORDER = ? AND PICK_TYPE IN ('A','M') AND PIH.TRF_STATUS IS NULL ";
pstmt = conn.prepareStatement( sql );
pstmt.setString( 1, "Y");
pstmt.setString( 2, pickOrder);
rs = pstmt.executeQuery();
if(rs.next())
{
countConf = rs.getInt(1);
System.out.println(" Pending Transfer Count["+countConf);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if( countConf > 0)
{
return errString = "";
}
//Changed by Sankara on 03/oct/13 adding validation to prevent doc transfer in case of pending/aborted picking.start
//update the status of pick order in wave_task_det table
//Changed by sumit on 10/08/12 update wave_status 'V' with updating status = 'Y'
//updateSql = "UPDATE WAVE_TASK_DET SET STATUS = 'Y' WHERE REF_ID = ? ";
updateSql = "UPDATE WAVE_TASK_DET SET STATUS = 'Y', WAVE_STATUS = 'V' WHERE REF_ID = ? ";
pstmt = conn.prepareStatement(updateSql);
pstmt.setString(1, pickOrder);
updCnt = pstmt.executeUpdate();
if( updCnt > 0 )
{
System.out.println( updCnt + " rows updated successfully" );
}
pstmt.close();pstmt = null;
//Changed by sumit on 30/08/12 for updating wave_status start.
//Changed by sumit on 21/01/13 for updating wave_status for M-PACK task start
System.out.println(" ** pick_type ["+pickType+"]");
if( "M".equalsIgnoreCase(pickType))
{
updateSql =" UPDATE WAVE_TASK_DET SET STATUS = 'Y', WAVE_STATUS = 'V' " +
" WHERE REF_ID IN (SELECT TRAN_ID FROM PACK_HDR WHERE PICK_ORDER = ?)";
pstmt = conn.prepareStatement(updateSql);
pstmt.setString(1, pickOrder);
updCnt = pstmt.executeUpdate();
if( updCnt > 0 )
{
System.out.println( updCnt + " rows updated successfully" );
}
pstmt.close();pstmt = null;
}
//Changed by sumit on 21/01/13 for updating wave_status for M-PACK task end
updCnt= 0;
updCnt = waveStatusUpdate(pickOrder, conn);
if( updCnt > 0)
if(updCnt > 0)
{
System.out.println( updCnt + " row of wave_status updated successfully" );
System.out.println("record inserted in dock_tran["+updCnt+"]");
}
//Changed by sumit on 30/08/12 for updating wave_status end.
sql = "select ptcn from wave_task_det where ref_id = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,pickOrder);
rs = pstmt.executeQuery();
if( rs.next() )
{
ptcn = rs.getString("ptcn") == null?"":rs.getString("ptcn");
}
if( rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
//Changed By 02/05/13 Pragyan To Close The Connections.start
if( rs1 != null)
{
rs1.close();
rs1 = null;
}
if( rsSord != null)
{
rsSord.close();
rsSord = null;
}
if(pstmt1 != null)
{
pstmt1.close();
pstmt1 = null;
}
if(pstmtSord != null)
{
pstmtSord.close();
pstmtSord = null;
}
//Changed By 02/05/13 Pragyan Close The Connections.end
System.out.println("Changed By 02/05/13 Pragyan sordalloc inserted updCnt [" + updCnt + "]");
pstmtUpd.close();pstmtUpd = null; */
AppConnectParm appConnect = new AppConnectParm();
Properties p = appConnect.getProperty();
InitialContext ctx = new InitialContext(p);
DockTranConfLocal docktranConfLocal = null;
docktranConfLocal = (DockTranConfLocal)ctx.lookup("ibase/DockTranConf/local");
errString = docktranConfLocal.confirm(domString,tranID,editFlag,xtraParams,conn );
System.out.println(" ************ errString ******** ["+errString+"]");
ConsolidatToDoc conToDoc = new ConsolidatToDoc();
//Changed by Rohan on 10-06-12 to add xtraParams in process as argument for hazmap report to get chg user
//retString = conToDoc.process(ptcn, conn);
retString = conToDoc.process(ptcn, conn,xtraParams);
System.out.println("pick type from pick_ord_hdr table--->>["+pickType+"]");
//errString = dockconf.confirm(domString,tranID,editFlag,xtraParams,conn );
if(errString == null || errString.trim().length() == 0 )
{
updateSql = " UPDATE DOCK_TRAN SET CONFIRMED = ?, CONF_DATE = ? WHERE TRAN_ID = ? ";
pstmtUpd = conn.prepareStatement(updateSql);
pstmtUpd.setString(1, "Y");
pstmtUpd.setTimestamp(2,currDate);
pstmtUpd.setString(3, tranID);
updCnt = pstmtUpd.executeUpdate();
if(updCnt > 0)
{
System.out.println("updte record in dock_tran["+updCnt+"]");
}
pstmtUpd.close();pstmtUpd = null;
}
}
catch(Exception e)
{
System.out.println("Exception before rollback "+e.getMessage());
try
{
isError = true;
conn.rollback();
}
catch (SQLException e1)
{
e1.printStackTrace();
}
e.printStackTrace();
throw new ITMException(e);
}
......@@ -898,12 +293,12 @@ public class DockTranPos extends ValidatorEJB implements DockTranPosLocal, DockT
{
try
{
if( !isError )
/*if( !isError )
{
System.out.println("commmit");
conn.commit();
}
else if ( isError )
}*/
if ( isError )
{
System.out.println("rollback");
conn.rollback();
......@@ -918,32 +313,11 @@ public class DockTranPos extends ValidatorEJB implements DockTranPosLocal, DockT
pstmt.close();
pstmt = null;
}
//Changed By 02/05/13 Pragyan To Close The Connections.start
if( rs1 != null)
{
rs1.close();
rs1 = null;
}
if( rsSord != null)
{
rsSord.close();
rsSord = null;
}
if(pstmt1 != null)
{
pstmt1.close();
pstmt1 = null;
}
if(pstmtSord != null)
if( pstmtUpd != null )
{
pstmtSord.close();
pstmtSord = null;
pstmtUpd.close();
pstmtUpd = null;
}
//Changed By 02/05/13 Pragyan Close The Connections.end
}
catch(Exception e)
{
......@@ -952,185 +326,101 @@ public class DockTranPos extends ValidatorEJB implements DockTranPosLocal, DockT
throw new ITMException(e);
}
}
return errString;
return errString;
}
//Changed by sumit on 30/08/12 update wave_status after all task completed for wave_id and sale order start.
private int waveStatusUpdate(String replOrder, Connection conn) throws ITMException
private String generateTranId( String windowName, String siteCode, Connection conn )throws ITMException
{
String sql = "", sql1 = "";
String waveId = "";
String saleOrder = "";
PreparedStatement pstmt = null, pstmt1 = null;
ResultSet rs = null, rs1 = null;
int updateCount = 0;
int firstCount = 0, secCount = 0;
PreparedStatement pstmt = null;
ResultSet rs = null;
String selSql = "";
String tranId = "";
String tranSer = "";
String keyString = "";
String keyCol = "";
String xmlValues = "";
String paySiteCode = "";
String effectiveDate = "";
java.sql.Timestamp currDate = null;
java.sql.Date effDate = null;
GenericUtility genericUtility = GenericUtility.getInstance();
try
{
sql = "SELECT WAVE_ID, SALE_ORDER FROM WAVE_TASK_DET WHERE REF_ID = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, replOrder);
SimpleDateFormat sdfAppl = new SimpleDateFormat(genericUtility.getApplDateFormat());
currDate = new java.sql.Timestamp(System.currentTimeMillis());
String currDateStr = sdfAppl.format(currDate);
selSql = "SELECT KEY_STRING, TRAN_ID_COL, REF_SER FROM TRANSETUP WHERE TRAN_WINDOW = ? ";
//System.out.println("selSql :"+selSql);
pstmt = conn.prepareStatement(selSql);
pstmt.setString( 1, windowName );
rs = pstmt.executeQuery();
if(rs.next())
if (rs.next())
{
waveId = rs.getString("WAVE_ID");
saleOrder = rs.getString("SALE_ORDER");
sql1 = "SELECT COUNT(*) AS CONT FROM WAVE_TASK_DET WHERE WAVE_ID = ? AND SALE_ORDER = ? AND REF_SER <> 'S-DSP' ";
pstmt1 = conn.prepareStatement(sql1);
pstmt1.setString(1, waveId);
pstmt1.setString(2, saleOrder);
rs1 = pstmt1.executeQuery();
if(rs1.next())
{
firstCount = rs1.getInt("CONT");
}
rs1.close();rs1 = null;
pstmt1.close();pstmt1 = null;
//Changed by sumit on 19/03/13 changing condition check it from status flag
//sql1 = "SELECT COUNT(*) AS CONT FROM WAVE_TASK_DET WHERE WAVE_STATUS = 'V' AND WAVE_ID = ? AND SALE_ORDER = ? AND REF_SER <> 'S-DSP' ";
sql1 = "SELECT COUNT(*) AS CONT FROM WAVE_TASK_DET WHERE STATUS = 'Y' AND WAVE_ID = ? AND SALE_ORDER = ? AND REF_SER <> 'S-DSP' ";
pstmt1 = conn.prepareStatement(sql1);
pstmt1.setString(1, waveId);
pstmt1.setString(2, saleOrder);
rs1 = pstmt1.executeQuery();
if(rs1.next())
{
secCount = rs1.getInt("CONT");
}
rs1.close();rs1 = null;
pstmt1.close();pstmt1 = null;
keyString = rs.getString("KEY_STRING");
keyCol = rs.getString("TRAN_ID_COL");
tranSer = rs.getString("REF_SER");
}
rs.close();rs = null;
pstmt.close();pstmt = null;
if( secCount == firstCount)
{
sql = "UPDATE WAVE_TASK_DET SET WAVE_STATUS = 'C' WHERE WAVE_ID = ? AND SALE_ORDER = ? AND REF_SER = 'S-DSP' ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, waveId);
pstmt.setString(2, saleOrder);
updateCount = pstmt.executeUpdate();
pstmt.close();pstmt = null;
}
System.out.println("keyString :"+keyString);
System.out.println("keyCol :"+keyCol);
System.out.println("tranSer :"+tranSer);
xmlValues ="<?xml version=\"1.0\" encoding=\"utf-8\"?><Root>";
xmlValues = xmlValues + "<Header></Header>";
xmlValues = xmlValues + "<Detail1>";
xmlValues = xmlValues + "<tran_id></tran_id>";
xmlValues = xmlValues + "<site_code>" + siteCode + "</site_code>";
xmlValues = xmlValues + "<tran_date>" + currDateStr + "</tran_date>";
xmlValues = xmlValues + "</Detail1></Root>";
System.out.println("xmlValues :["+xmlValues+"]");
TransIDGenerator tg = new TransIDGenerator(xmlValues, "BASE", CommonConstants.DB_NAME);
tranId = tg.generateTranSeqID(tranSer, keyCol, keyString, conn);
System.out.println("tranId :"+tranId);
}
catch(Exception e)
catch (SQLException ex)
{
System.out.println("Exception ::" +selSql+ ex.getMessage() + ":");
ex.printStackTrace();
throw new ITMException(ex);
}
catch (Exception e)
{
System.out.println("Exception ::" + e.getMessage() + ":");
e.printStackTrace();
throw new ITMException(e);
}
return updateCount;
}
//Changed by sumit on 30/08/12 update wave_status after all task completed for wave_id and sale order end.
private HashMap getItemVoumeMap(String itemCode,String lotNo,Connection con)throws Exception
{
double shipperSize = 0,itemVolume = 0,caseVolume = 0;
PreparedStatement pstmt = null;
String sql="";
ResultSet rs = null;
double itmLen = 0,itmWidth = 0,itmHeight = 0,itemGrossWeight = 0,lotLen = 0 ,lotHeight = 0,lotWidth = 0,caseGrossWeight = 0,itemNetWeight = 0, caseNetWeight = 0;
HashMap dataVolumeMap = new HashMap();
try {
sql = "SELECT I.LENGTH ITEM_LEN,I.WIDTH ITEM_WID,I.HEIGHT ITEM_HEIGHT,I.GROSS_WEIGHT ITEM_GROSS_WEIGHT,I.NET_WEIGHT ITEM_NET_WEIGHT,"
+" L.LENGTH LITEM_LEN,L.WIDTH LITEM_WID,L.HEIGHT LITEM_HEIGHT,L.SHIPPER_SIZE SHIPSIZE,L.GROSS_WEIGHT CASE_GROSS_WEIGHT,L.NET_WEIGHT CASE_NET_WEIGHT FROM"
+" ITEM I,ITEM_LOT_PACKSIZE L"
+" WHERE I.ITEM_CODE = L.ITEM_CODE"
+" AND L.LOT_NO__FROM <= ? AND L.LOT_NO__TO >= ?"
+" AND I.ITEM_CODE = ?";
pstmt = con.prepareStatement(sql);
if(lotNo != null && lotNo.length() > 0)
{
pstmt.setString(1, lotNo);
pstmt.setString(2, lotNo);
}
else
{
pstmt.setString(1, "00");
pstmt.setString(2, "ZZ");
}
pstmt.setString(3, itemCode);
rs = pstmt.executeQuery();
if(rs.next())
{
itmLen = rs.getDouble("ITEM_LEN");
itmWidth = rs.getDouble("ITEM_WID");
itmHeight = rs.getDouble("ITEM_HEIGHT");
itemGrossWeight = rs.getDouble("ITEM_GROSS_WEIGHT");
lotLen = rs.getDouble("LITEM_LEN");
lotWidth = rs.getDouble("LITEM_WID");
lotHeight = rs.getDouble("LITEM_HEIGHT");
shipperSize = rs.getDouble("SHIPSIZE");
caseGrossWeight = rs.getDouble("CASE_GROSS_WEIGHT");
itemNetWeight = rs.getDouble("ITEM_NET_WEIGHT");
caseNetWeight = rs.getDouble("CASE_NET_WEIGHT");
}
//shipperSize = (lotHeight * lotWidth * lotLen)/(itmLen * itmWidth * itmHeight);
itemVolume = (itmLen * itmWidth * itmHeight);
caseVolume = (lotHeight * lotWidth * lotLen);
dataVolumeMap.put("SHIPPER_SIZE", shipperSize);
dataVolumeMap.put("ITEM_VOLUME", itemVolume);
dataVolumeMap.put("CASE_VOLUME", caseVolume);
dataVolumeMap.put("ITEM_GROSS_WEIGHT", itemGrossWeight);
dataVolumeMap.put("CASE_GROSS_WEIGHT", caseGrossWeight);
dataVolumeMap.put("ITEM_NET_WEIGHT", itemNetWeight);
dataVolumeMap.put("CASE_NET_WEIGHT", caseNetWeight);
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(rs != null)
{
rs.close();
rs = null;
}
} catch (Exception e) {
// TODO: handle exception
throw e;
}
finally
{
try
{
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(rs != null)
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
catch (Exception e) {
// TODO: handle exception
throw e;
}
catch(Exception e){}
}
return dataVolumeMap;
return checkNull(tranId);
}
private String checkNull( String input )
{
if( input == null )
{
input = "";
}
return input;
}
}
......@@ -12,6 +12,7 @@ import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
......@@ -482,7 +483,9 @@ public class ShipmentPrc extends ProcessEJB implements ShipmentPrcLocal,Shipment
System.out.println("detailDom:"+detailDom);
System.out.println("windowName:"+windowName);
System.out.println("xtraParams:"+xtraParams);
//changed by sankara on 30/08/14 for insert close out date in carton_master
Timestamp currDate = new Timestamp(System.currentTimeMillis());
parentNodeList = detailDom.getElementsByTagName("Detail2");
parentNodeListLength = parentNodeList.getLength();
for (int selectedRow = 0; selectedRow < parentNodeListLength; selectedRow++)
......@@ -865,17 +868,24 @@ public class ShipmentPrc extends ProcessEJB implements ShipmentPrcLocal,Shipment
{
//changed by sankara on 04/03/14 considered active also for close out
//updateSql = " UPDATE CARTON_MASTER SET SF_IDENTITY = ? WHERE PTCN IN (SELECT PTCN FROM SHIP_DOCS WHERE SHIPMENT_ID = ? ) AND STATUS = 'U' AND CARTON_TYPE IN ('M','P') AND SF_IDENTITY IS NULL " ;
updateSql = " UPDATE CARTON_MASTER SET SF_IDENTITY = ? WHERE PTCN IN (SELECT PTCN FROM SHIP_DOCS WHERE SHIPMENT_ID = ? ) AND STATUS = 'U' AND CARTON_TYPE IN ('M','P','A') AND SF_IDENTITY IS NULL " ;
//changed by sankara on 30/08/14 update close out date
//updateSql = " UPDATE CARTON_MASTER SET SF_IDENTITY = ? WHERE PTCN IN (SELECT PTCN FROM SHIP_DOCS WHERE SHIPMENT_ID = ? ) AND STATUS = 'U' AND CARTON_TYPE IN ('M','P','A') AND SF_IDENTITY IS NULL " ;
updateSql = " UPDATE CARTON_MASTER SET SF_IDENTITY = ?, CLOSEOUT_DATE = ? WHERE PTCN IN (SELECT PTCN FROM SHIP_DOCS WHERE SHIPMENT_ID = ? ) AND STATUS = 'U' AND CARTON_TYPE IN ('M','P','A') AND SF_IDENTITY IS NULL " ;
}
if((ptcns == null || ptcns.trim().length() == 0) && !refser.trim().equalsIgnoreCase("S-DSP") )
{
updateSql = " UPDATE CARTON_MASTER SET SF_IDENTITY = ? WHERE CARTON_NO IN ( SELECT CARTON_NO FROM SHIPMENT_CONTENT C, SHIP_DOCS D, SHIPMENT S " +
" WHERE S.SHIPMENT_ID = D.SHIPMENT_ID OR D.SHIPMENT_ID IS NULL AND S.SHIPMENT_ID = C.SHIPMENT_ID " +
" AND S.SHIPMENT_ID = ? ) AND STATUS = 'U' AND SF_IDENTITY IS NULL " ;
//changed by sankara on 30/08/14 update close out date
//updateSql = " UPDATE CARTON_MASTER SET SF_IDENTITY = ? WHERE CARTON_NO IN ( SELECT CARTON_NO FROM SHIPMENT_CONTENT C, SHIP_DOCS D, SHIPMENT S " +
updateSql = " UPDATE CARTON_MASTER SET SF_IDENTITY = ?, CLOSEOUT_DATE = ? WHERE CARTON_NO IN ( SELECT CARTON_NO FROM SHIPMENT_CONTENT C, SHIP_DOCS D, SHIPMENT S " +
" WHERE S.SHIPMENT_ID = D.SHIPMENT_ID OR D.SHIPMENT_ID IS NULL AND S.SHIPMENT_ID = C.SHIPMENT_ID " +
" AND S.SHIPMENT_ID = ? ) AND STATUS = 'U' AND SF_IDENTITY IS NULL " ;
}
pstmt = conn.prepareStatement(updateSql);
pstmt.setString(1,sfIdentity);
pstmt.setString(2,shipmentIDs);
//changed by sankara on 30/08/14 update close out date
//pstmt.setString(2,shipmentIDs);
pstmt.setTimestamp(2,currDate);
pstmt.setString(3,shipmentIDs);
count = pstmt.executeUpdate();
if(count > 0)
{
......
......@@ -3211,74 +3211,115 @@ public class WaveGenerationPrc extends ProcessEJB implements WaveGenerationPrcLo
System.out.println("childNodeName---->>> "+ childNodeName);
if (childNodeName.equals("stock_quantity"))
{
stockQuantity = childNode.getFirstChild().getNodeValue();
if ( childNode != null && childNode.getFirstChild() != null )
{
stockQuantity = childNode.getFirstChild().getNodeValue();
}
}
if (childNodeName.equals("sale_order"))
{
saleOrder = childNode.getFirstChild().getNodeValue();
if ( childNode != null && childNode.getFirstChild() != null )
{
saleOrder = childNode.getFirstChild().getNodeValue();
}
}
if (childNodeName.equals("line_no"))
{
lineNo = childNode.getFirstChild().getNodeValue();
if ( childNode != null && childNode.getFirstChild() != null )
{
lineNo = childNode.getFirstChild().getNodeValue();
}
}
if (childNodeName.equals("item_code"))
{
itemCode = childNode.getFirstChild().getNodeValue();
if ( childNode != null && childNode.getFirstChild() != null )
{
itemCode = childNode.getFirstChild().getNodeValue();
}
}
if (childNodeName.equals("qty_alloc"))
{
allocQty = Double.parseDouble(childNode.getFirstChild().getNodeValue());
System.out.println("qty_alloc======>"+allocQty);
if ( childNode != null && childNode.getFirstChild() != null )
{
allocQty = Double.parseDouble(childNode.getFirstChild().getNodeValue());
System.out.println("qty_alloc======>"+allocQty);
}
}
if (childNodeName.equals("exp_lev"))
{
expLev = childNode.getFirstChild().getNodeValue();
if ( childNode != null && childNode.getFirstChild() != null )
{
expLev = childNode.getFirstChild().getNodeValue();
}
}
//changed by sankara on 03-08-2012 adding pending quantity[start]
if (childNodeName.equals("pending_quantity"))
{
pendingQuantity = Double.parseDouble(childNode.getFirstChild().getNodeValue());
if ( childNode != null && childNode.getFirstChild() != null )
{
pendingQuantity = Double.parseDouble(childNode.getFirstChild().getNodeValue());
}
}
if (childNodeName.equals("cust_code"))
{
custCode = childNode.getFirstChild().getNodeValue();
if ( childNode != null && childNode.getFirstChild() != null )
{
custCode = childNode.getFirstChild().getNodeValue();
}
}
if (childNodeName.equals("single_lot"))
{
singleLot = childNode.getFirstChild().getNodeValue();
if ( childNode != null && childNode.getFirstChild() != null )
{
singleLot = childNode.getFirstChild().getNodeValue();
}
}
//changed by sankara on 03-08-2012 adding pending quantity[end]
if (childNodeName.equals("active_pick_allow"))
{
isActivePickChecked = childNode.getFirstChild().getNodeValue();
if ( childNode != null && childNode.getFirstChild() != null )
{
isActivePickChecked = childNode.getFirstChild().getNodeValue();
}
}
if (childNodeName.equals("stock_to_dock_allow"))
{
isStockToDockChecked = childNode.getFirstChild().getNodeValue();
if ( childNode != null && childNode.getFirstChild() != null )
{
isStockToDockChecked = childNode.getFirstChild().getNodeValue();
}
}
if (childNodeName.equals("master_pack_allow"))
{
isMasterPickChecked = childNode.getFirstChild().getNodeValue();
System.out.println("isMasterPickChecked["+childNode.getFirstChild().getNodeValue()+"]");
if ( childNode != null && childNode.getFirstChild() != null )
{
isMasterPickChecked = childNode.getFirstChild().getNodeValue();
System.out.println("isMasterPickChecked["+childNode.getFirstChild().getNodeValue()+"]");
}
}
//Changed By Pragyan 31/12/12 To get Parcel Pack Flag.start
if (childNodeName.equals("parcelpack_allow"))
{
System.out.println("isParcelPickChecked["+childNode.getFirstChild().getNodeValue()+"]");
isParcelPickChecked = childNode.getFirstChild().getNodeValue();
if ( childNode != null && childNode.getFirstChild() != null )
{
System.out.println("isParcelPickChecked["+childNode.getFirstChild().getNodeValue()+"]");
isParcelPickChecked = childNode.getFirstChild().getNodeValue();
}
}
if (childNodeName.equals("ship_type"))
{
System.out.println("shipTypeLine["+childNode.getFirstChild().getNodeValue()+"]");
shipTypeLine = childNode.getFirstChild().getNodeValue();
}
if ( childNode != null && childNode.getFirstChild() != null )
{
System.out.println("shipTypeLine["+childNode.getFirstChild().getNodeValue()+"]");
shipTypeLine = childNode.getFirstChild().getNodeValue();
}
}
//Changed By Pragyan 31/12/12 To get Parcel Pack Flag.end
//Changed by sumit on 14/12/12 adding validation incase of manualy allocating saleorder and modifiying qty_allow start.
if (childNodeName.equals("manual_allocqty"))
......
......@@ -99,18 +99,6 @@
<name>sale_order</name>
<dbname>wave_task_det.sale_order</dbname>
</table_column>
<table_column>
<type size="8">char</type>
<update>yes</update>
<updatewhereclause>yes</updatewhereclause>
<name>wave_status</name>
<dbname>wave_status</dbname>
<values>
<item display="CREATED" data="C"/>
<item display="VERIFIED" data="V"/>
<item display="WAITING" data="W"/>
</values>
</table_column>
<table_column>
<type precision="0">decimal</type>
<updatewhereclause>yes</updatewhereclause>
......@@ -123,7 +111,19 @@
<name>descr</name>
<dbname>descr</dbname>
</table_column>
<retrieve>PBSELECT( VERSION(400) TABLE(NAME=&quot;wave_task_det&quot; ) TABLE(NAME=&quot;wave_seq&quot; ) COLUMN(NAME=&quot;wave_task_det.wave_id&quot;) COLUMN(NAME=&quot;wave_task_det.line_no&quot;) COLUMN(NAME=&quot;wave_task_det.ref_ser&quot;) COLUMN(NAME=&quot;wave_task_det.ref_id&quot;) COLUMN(NAME=&quot;wave_task_det.status&quot;) COLUMN(NAME=&quot;wave_task_det.ptcn&quot;) COLUMN(NAME=&quot;wave_task_det.sale_order&quot;) COMPUTE(NAME=&quot;case when wave_status = &apos;C&apos; then &apos;Created&apos; when wave_status = &apos;V&apos; then &apos;Verified&apos; when wave_status = &apos;W&apos; then &apos;Held&apos; else &apos; &apos; end wave_status&quot;) COLUMN(NAME=&quot;wave_seq.priority&quot;) COMPUTE(NAME=&quot;FN_WAVE_DESCRIPTION(WAVE_TASK_DET.REF_SER,WAVE_TASK_DET.REF_ID,WAVE_TASK_DET.PTCN) AS descr&quot;) JOIN (LEFT=&quot;wave_task_det.ref_ser&quot; OP =&quot;=&quot;RIGHT=&quot;wave_seq.ref_ser&quot; OUTER1 =&quot;wave_task_det.ref_ser&quot; )WHERE( EXP1 =&quot;wave_task_det.wave_id&quot; OP =&quot;=&quot; EXP2 =&quot;:wave_id&quot; ) ) ORDER(NAME=&quot;wave_seq.priority&quot; ASC=yes ) ARG(NAME = &quot;wave_id&quot; TYPE = string) </retrieve>
<table_column>
<type size="11">char</type>
<update>yes</update>
<updatewhereclause>yes</updatewhereclause>
<name>wave_status</name>
<dbname>wave_status</dbname>
<values>
<item display="CREATED" data="C"/>
<item display="VERIFIED" data="V"/>
<item display="WAITING" data="W"/>
</values>
</table_column>
<retrieve>PBSELECT( VERSION(400) TABLE(NAME=&quot;wave_task_det&quot; ) TABLE(NAME=&quot;wave_seq&quot; ) COLUMN(NAME=&quot;wave_task_det.wave_id&quot;) COLUMN(NAME=&quot;wave_task_det.line_no&quot;) COLUMN(NAME=&quot;wave_task_det.ref_ser&quot;) COLUMN(NAME=&quot;wave_task_det.ref_id&quot;) COLUMN(NAME=&quot;wave_task_det.status&quot;) COLUMN(NAME=&quot;wave_task_det.ptcn&quot;) COLUMN(NAME=&quot;wave_task_det.sale_order&quot;) COLUMN(NAME=&quot;wave_seq.priority&quot;) COMPUTE(NAME=&quot;FN_WAVE_DESCRIPTION(WAVE_TASK_DET.REF_SER,WAVE_TASK_DET.REF_ID,WAVE_TASK_DET.PTCN) AS descr&quot;) COMPUTE(NAME=&quot;case when wave_status = &apos;C&apos; then &apos;Created&apos; when wave_status = &apos;V&apos; then &apos;Verified&apos; when wave_status = &apos;W&apos; then &apos;Held&apos; when wave_status = &apos;D&apos; then &apos;Deallocated&apos; else &apos; &apos; end wave_status&quot;) JOIN (LEFT=&quot;wave_task_det.ref_ser&quot; OP =&quot;=&quot;RIGHT=&quot;wave_seq.ref_ser&quot; OUTER1 =&quot;wave_task_det.ref_ser&quot; )WHERE( EXP1 =&quot;wave_task_det.wave_id&quot; OP =&quot;=&quot; EXP2 =&quot;:wave_id&quot; ) ) ORDER(NAME=&quot;wave_seq.priority&quot; ASC=yes ) ARG(NAME = &quot;wave_id&quot; TYPE = string) </retrieve>
<update>WAVE_TASK_DET</update>
<updatewhere>0</updatewhere>
<updatekeyinplace>no</updatekeyinplace>
......@@ -132,665 +132,665 @@
<type>string</type>
</argument>
</TableDefinition>
<ColumnObject>
<band>Detail</band>
<id>1</id>
<TextObject>
<band>Header</band>
<alignment>2</alignment>
<tabsequence>10</tabsequence>
<border>5</border>
<color>33554432</color>
<text>Wave ID</text>
<border>6</border>
<color>0</color>
<x>2</x>
<y>0</y>
<y>2</y>
<height>16</height>
<width>82</width>
<format>[general]</format>
<html>
<valueishtml>0</valueishtml>
</html>
<name>wave_id</name>
<tag>Transaction ID of wave task</tag>
<name>wave_id_t</name>
<visible>1</visible>
<EditStyle style="edit">
<limit>12</limit>
<case>any</case>
<focusrectangle>no</focusrectangle>
<autoselect>yes</autoselect>
<autohscroll>yes</autohscroll>
<imemode>2</imemode>
</EditStyle>
<font>
<face>Times New Roman</face>
<height>-10</height>
<weight>400</weight>
<family>2</family>
<family>1</family>
<pitch>2</pitch>
<charset>0</charset>
</font>
<background>
<mode>2</mode>
<color>16777215</color>
<mode>1</mode>
<color>536870912</color>
</background>
</ColumnObject>
<ColumnObject>
<band>Detail</band>
<id>2</id>
</TextObject>
<TextObject>
<band>Header</band>
<alignment>2</alignment>
<tabsequence>20</tabsequence>
<border>5</border>
<color>33554432</color>
<text>Line No</text>
<border>6</border>
<color>0</color>
<x>86</x>
<y>0</y>
<y>2</y>
<height>16</height>
<width>72</width>
<format>[general]</format>
<html>
<valueishtml>0</valueishtml>
</html>
<name>line_no</name>
<tag>Line Number of the Wave Task detail line</tag>
<name>line_no_t</name>
<visible>1</visible>
<EditStyle style="edit">
<limit>0</limit>
<case>any</case>
<focusrectangle>no</focusrectangle>
<autoselect>yes</autoselect>
<autohscroll>yes</autohscroll>
<imemode>0</imemode>
</EditStyle>
<font>
<face>Times New Roman</face>
<height>-10</height>
<weight>400</weight>
<family>2</family>
<family>1</family>
<pitch>2</pitch>
<charset>0</charset>
</font>
<background>
<mode>2</mode>
<color>16777215</color>
<mode>1</mode>
<color>536870912</color>
</background>
</ColumnObject>
<ColumnObject>
<band>Detail</band>
<id>3</id>
</TextObject>
<TextObject>
<band>Header</band>
<alignment>2</alignment>
<tabsequence>30</tabsequence>
<border>5</border>
<color>33554432</color>
<text>Ref series</text>
<border>6</border>
<color>0</color>
<x>160</x>
<y>0</y>
<y>2</y>
<height>16</height>
<width>64</width>
<format>[general]</format>
<html>
<valueishtml>0</valueishtml>
</html>
<name>ref_ser</name>
<tag>Reference series of particular transaction (R-ORDH, P-ORDH, P-PACK, S-DSP)</tag>
<name>ref_ser_t</name>
<visible>1</visible>
<EditStyle style="edit">
<limit>6</limit>
<case>any</case>
<focusrectangle>no</focusrectangle>
<autoselect>yes</autoselect>
<autohscroll>yes</autohscroll>
<imemode>0</imemode>
</EditStyle>
<font>
<face>Times New Roman</face>
<height>-10</height>
<weight>400</weight>
<family>2</family>
<family>1</family>
<pitch>2</pitch>
<charset>0</charset>
</font>
<background>
<mode>2</mode>
<color>16777215</color>
<mode>1</mode>
<color>536870912</color>
</background>
</ColumnObject>
<ColumnObject>
<band>Detail</band>
<id>4</id>
</TextObject>
<TextObject>
<band>Header</band>
<alignment>2</alignment>
<tabsequence>50</tabsequence>
<border>5</border>
<color>33554432</color>
<text>Ref ID</text>
<border>6</border>
<color>0</color>
<x>431</x>
<y>0</y>
<y>2</y>
<height>16</height>
<width>82</width>
<format>[general]</format>
<html>
<valueishtml>0</valueishtml>
</html>
<name>ref_id</name>
<tag>reference id (Transaction ID of Particular transaction (Replenishment, picking, pack, dispatch/shipment))</tag>
<name>ref_id_t</name>
<visible>1</visible>
<EditStyle style="edit">
<limit>10</limit>
<case>any</case>
<focusrectangle>no</focusrectangle>
<autoselect>yes</autoselect>
<autohscroll>yes</autohscroll>
<imemode>0</imemode>
</EditStyle>
<font>
<face>Times New Roman</face>
<height>-10</height>
<weight>400</weight>
<family>2</family>
<family>1</family>
<pitch>2</pitch>
<charset>0</charset>
</font>
<background>
<mode>2</mode>
<color>16777215</color>
<mode>1</mode>
<color>536870912</color>
</background>
</ColumnObject>
<ColumnObject>
<band>Detail</band>
<id>5</id>
</TextObject>
<TextObject>
<band>Header</band>
<alignment>2</alignment>
<tabsequence>60</tabsequence>
<border>5</border>
<color>33554432</color>
<text>Status</text>
<border>6</border>
<color>0</color>
<x>515</x>
<y>0</y>
<y>2</y>
<height>16</height>
<width>48</width>
<format>[general]</format>
<html>
<valueishtml>0</valueishtml>
</html>
<name>status</name>
<tag>Status of wave task</tag>
<name>status_t</name>
<visible>1</visible>
<EditStyle style="edit">
<limit>1</limit>
<case>any</case>
<focusrectangle>no</focusrectangle>
<autoselect>yes</autoselect>
<autohscroll>yes</autohscroll>
<imemode>0</imemode>
</EditStyle>
<font>
<face>Times New Roman</face>
<height>-10</height>
<weight>400</weight>
<family>2</family>
<family>1</family>
<pitch>2</pitch>
<charset>0</charset>
</font>
<background>
<mode>2</mode>
<color>16777215</color>
<mode>1</mode>
<color>536870912</color>
</background>
</ColumnObject>
<ColumnObject>
<band>Detail</band>
<id>6</id>
<alignment>0</alignment>
<tabsequence>70</tabsequence>
<border>5</border>
<color>33554432</color>
</TextObject>
<TextObject>
<band>Header</band>
<alignment>2</alignment>
<text>PTCN</text>
<border>6</border>
<color>0</color>
<x>565</x>
<y>0</y>
<y>2</y>
<height>16</height>
<width>81</width>
<format>[general]</format>
<html>
<valueishtml>0</valueishtml>
</html>
<name>ptcn</name>
<name>ptcn_t</name>
<visible>1</visible>
<EditStyle style="edit">
<limit>10</limit>
<case>any</case>
<focusrectangle>no</focusrectangle>
<autoselect>yes</autoselect>
<autohscroll>yes</autohscroll>
<imemode>0</imemode>
</EditStyle>
<font>
<face>Times New Roman</face>
<height>-10</height>
<weight>400</weight>
<family>2</family>
<family>1</family>
<pitch>2</pitch>
<charset>0</charset>
</font>
<background>
<mode>2</mode>
<color>16777215</color>
<mode>1</mode>
<color>536870912</color>
</background>
</ColumnObject>
<ColumnObject>
<band>Detail</band>
<id>7</id>
<alignment>0</alignment>
<tabsequence>80</tabsequence>
<border>5</border>
<color>33554432</color>
</TextObject>
<TextObject>
<band>Header</band>
<alignment>2</alignment>
<text>Sale Order</text>
<border>6</border>
<color>0</color>
<x>648</x>
<y>0</y>
<y>2</y>
<height>16</height>
<width>111</width>
<format>[general]</format>
<html>
<valueishtml>0</valueishtml>
</html>
<name>sale_order</name>
<name>sale_order_t</name>
<visible>1</visible>
<EditStyle style="edit">
<limit>10</limit>
<case>any</case>
<focusrectangle>no</focusrectangle>
<autoselect>yes</autoselect>
<autohscroll>yes</autohscroll>
<imemode>0</imemode>
</EditStyle>
<font>
<face>Times New Roman</face>
<height>-10</height>
<weight>400</weight>
<family>2</family>
<family>1</family>
<pitch>2</pitch>
<charset>0</charset>
</font>
<background>
<mode>2</mode>
<color>16777215</color>
<mode>1</mode>
<color>536870912</color>
</background>
</ColumnObject>
<ColumnObject>
<band>Detail</band>
<id>8</id>
<alignment>0</alignment>
<tabsequence>90</tabsequence>
<border>5</border>
<color>33554432</color>
</TextObject>
<TextObject>
<band>Header</band>
<alignment>2</alignment>
<text>Task Status</text>
<border>6</border>
<color>0</color>
<x>761</x>
<y>0</y>
<y>2</y>
<height>16</height>
<width>77</width>
<format>[general]</format>
<html>
<valueishtml>0</valueishtml>
</html>
<name>wave_status</name>
<name>wave_status_t</name>
<visible>1</visible>
<EditStyle style="ddlb">
<limit>3</limit>
<allowedit>no</allowedit>
<case>upper</case>
<imemode>0</imemode>
</EditStyle>
<font>
<face>Arial</face>
<face>Times New Roman</face>
<height>-10</height>
<weight>400</weight>
<family>2</family>
<family>1</family>
<pitch>2</pitch>
<charset>0</charset>
</font>
<background>
<mode>2</mode>
<color>16777215</color>
<mode>1</mode>
<color>536870912</color>
</background>
</ColumnObject>
<ColumnObject>
<band>Detail</band>
<id>9</id>
</TextObject>
<TextObject>
<band>Header</band>
<alignment>0</alignment>
<tabsequence>100</tabsequence>
<border>5</border>
<color>33554432</color>
<text>Priority</text>
<border>6</border>
<color>0</color>
<x>840</x>
<y>0</y>
<y>2</y>
<height>16</height>
<width>62</width>
<format>[general]</format>
<html>
<valueishtml>0</valueishtml>
</html>
<name>priority</name>
<name>priority_t</name>
<visible>0</visible>
<EditStyle style="edit">
<limit>0</limit>
<case>any</case>
<autoselect>yes</autoselect>
<imemode>0</imemode>
</EditStyle>
<font>
<face>Arial</face>
<face>Times New Roman</face>
<height>-10</height>
<weight>400</weight>
<family>2</family>
<family>1</family>
<pitch>2</pitch>
<charset>0</charset>
</font>
<background>
<mode>2</mode>
<color>16777215</color>
<mode>1</mode>
<color>536870912</color>
</background>
</ColumnObject>
<ColumnObject>
<band>Detail</band>
<id>10</id>
<alignment>0</alignment>
<tabsequence>40</tabsequence>
<border>5</border>
<color>33554432</color>
</TextObject>
<TextObject>
<band>Header</band>
<alignment>2</alignment>
<text>Descr</text>
<border>6</border>
<color>0</color>
<x>226</x>
<y>0</y>
<y>2</y>
<height>16</height>
<width>203</width>
<format>[general]</format>
<html>
<valueishtml>0</valueishtml>
</html>
<name>descr</name>
<name>descr_t</name>
<visible>1</visible>
<EditStyle style="edit">
<limit>0</limit>
<case>any</case>
<autoselect>yes</autoselect>
<imemode>0</imemode>
</EditStyle>
<font>
<face>Times New Roman</face>
<height>-10</height>
<weight>400</weight>
<family>2</family>
<family>1</family>
<pitch>2</pitch>
<charset>0</charset>
</font>
<background>
<mode>2</mode>
<color>16777215</color>
<mode>1</mode>
<color>536870912</color>
</background>
</ColumnObject>
<TextObject>
<band>Header</band>
</TextObject>
<ColumnObject>
<band>Detail</band>
<id>1</id>
<alignment>2</alignment>
<text>Wave ID</text>
<border>6</border>
<color>0</color>
<tabsequence>10</tabsequence>
<border>5</border>
<color>33554432</color>
<x>2</x>
<y>2</y>
<y>0</y>
<height>16</height>
<width>82</width>
<format>[general]</format>
<html>
<valueishtml>0</valueishtml>
</html>
<name>wave_id_t</name>
<name>wave_id</name>
<tag>Transaction ID of wave task</tag>
<visible>1</visible>
<EditStyle style="edit">
<limit>12</limit>
<case>any</case>
<focusrectangle>no</focusrectangle>
<autoselect>yes</autoselect>
<autohscroll>yes</autohscroll>
<imemode>2</imemode>
</EditStyle>
<font>
<face>Times New Roman</face>
<height>-10</height>
<weight>400</weight>
<family>1</family>
<family>2</family>
<pitch>2</pitch>
<charset>0</charset>
</font>
<background>
<mode>1</mode>
<color>536870912</color>
<mode>2</mode>
<color>16777215</color>
</background>
</TextObject>
<TextObject>
<band>Header</band>
</ColumnObject>
<ColumnObject>
<band>Detail</band>
<id>2</id>
<alignment>2</alignment>
<text>Line No</text>
<border>6</border>
<color>0</color>
<tabsequence>20</tabsequence>
<border>5</border>
<color>33554432</color>
<x>86</x>
<y>2</y>
<y>0</y>
<height>16</height>
<width>72</width>
<format>[general]</format>
<html>
<valueishtml>0</valueishtml>
</html>
<name>line_no_t</name>
<name>line_no</name>
<tag>Line Number of the Wave Task detail line</tag>
<visible>1</visible>
<EditStyle style="edit">
<limit>0</limit>
<case>any</case>
<focusrectangle>no</focusrectangle>
<autoselect>yes</autoselect>
<autohscroll>yes</autohscroll>
<imemode>0</imemode>
</EditStyle>
<font>
<face>Times New Roman</face>
<height>-10</height>
<weight>400</weight>
<family>1</family>
<family>2</family>
<pitch>2</pitch>
<charset>0</charset>
</font>
<background>
<mode>1</mode>
<color>536870912</color>
<mode>2</mode>
<color>16777215</color>
</background>
</TextObject>
<TextObject>
<band>Header</band>
</ColumnObject>
<ColumnObject>
<band>Detail</band>
<id>3</id>
<alignment>2</alignment>
<text>Ref series</text>
<border>6</border>
<color>0</color>
<tabsequence>30</tabsequence>
<border>5</border>
<color>33554432</color>
<x>160</x>
<y>2</y>
<y>0</y>
<height>16</height>
<width>64</width>
<format>[general]</format>
<html>
<valueishtml>0</valueishtml>
</html>
<name>ref_ser_t</name>
<name>ref_ser</name>
<tag>Reference series of particular transaction (R-ORDH, P-ORDH, P-PACK, S-DSP)</tag>
<visible>1</visible>
<EditStyle style="edit">
<limit>6</limit>
<case>any</case>
<focusrectangle>no</focusrectangle>
<autoselect>yes</autoselect>
<autohscroll>yes</autohscroll>
<imemode>0</imemode>
</EditStyle>
<font>
<face>Times New Roman</face>
<height>-10</height>
<weight>400</weight>
<family>1</family>
<family>2</family>
<pitch>2</pitch>
<charset>0</charset>
</font>
<background>
<mode>1</mode>
<color>536870912</color>
<mode>2</mode>
<color>16777215</color>
</background>
</TextObject>
<TextObject>
<band>Header</band>
</ColumnObject>
<ColumnObject>
<band>Detail</band>
<id>4</id>
<alignment>2</alignment>
<text>Ref ID</text>
<border>6</border>
<color>0</color>
<tabsequence>50</tabsequence>
<border>5</border>
<color>33554432</color>
<x>431</x>
<y>2</y>
<y>0</y>
<height>16</height>
<width>82</width>
<format>[general]</format>
<html>
<valueishtml>0</valueishtml>
</html>
<name>ref_id_t</name>
<name>ref_id</name>
<tag>reference id (Transaction ID of Particular transaction (Replenishment, picking, pack, dispatch/shipment))</tag>
<visible>1</visible>
<EditStyle style="edit">
<limit>10</limit>
<case>any</case>
<focusrectangle>no</focusrectangle>
<autoselect>yes</autoselect>
<autohscroll>yes</autohscroll>
<imemode>0</imemode>
</EditStyle>
<font>
<face>Times New Roman</face>
<height>-10</height>
<weight>400</weight>
<family>1</family>
<family>2</family>
<pitch>2</pitch>
<charset>0</charset>
</font>
<background>
<mode>1</mode>
<color>536870912</color>
<mode>2</mode>
<color>16777215</color>
</background>
</TextObject>
<TextObject>
<band>Header</band>
</ColumnObject>
<ColumnObject>
<band>Detail</band>
<id>5</id>
<alignment>2</alignment>
<text>Status</text>
<border>6</border>
<color>0</color>
<tabsequence>60</tabsequence>
<border>5</border>
<color>33554432</color>
<x>515</x>
<y>2</y>
<y>0</y>
<height>16</height>
<width>48</width>
<format>[general]</format>
<html>
<valueishtml>0</valueishtml>
</html>
<name>status_t</name>
<name>status</name>
<tag>Status of wave task</tag>
<visible>1</visible>
<EditStyle style="edit">
<limit>1</limit>
<case>any</case>
<focusrectangle>no</focusrectangle>
<autoselect>yes</autoselect>
<autohscroll>yes</autohscroll>
<imemode>0</imemode>
</EditStyle>
<font>
<face>Times New Roman</face>
<height>-10</height>
<weight>400</weight>
<family>1</family>
<family>2</family>
<pitch>2</pitch>
<charset>0</charset>
</font>
<background>
<mode>1</mode>
<color>536870912</color>
<mode>2</mode>
<color>16777215</color>
</background>
</TextObject>
<TextObject>
<band>Header</band>
<alignment>2</alignment>
<text>PTCN</text>
<border>6</border>
<color>0</color>
</ColumnObject>
<ColumnObject>
<band>Detail</band>
<id>6</id>
<alignment>0</alignment>
<tabsequence>70</tabsequence>
<border>5</border>
<color>33554432</color>
<x>565</x>
<y>2</y>
<y>0</y>
<height>16</height>
<width>81</width>
<format>[general]</format>
<html>
<valueishtml>0</valueishtml>
</html>
<name>ptcn_t</name>
<name>ptcn</name>
<visible>1</visible>
<EditStyle style="edit">
<limit>10</limit>
<case>any</case>
<focusrectangle>no</focusrectangle>
<autoselect>yes</autoselect>
<autohscroll>yes</autohscroll>
<imemode>0</imemode>
</EditStyle>
<font>
<face>Times New Roman</face>
<height>-10</height>
<weight>400</weight>
<family>1</family>
<family>2</family>
<pitch>2</pitch>
<charset>0</charset>
</font>
<background>
<mode>1</mode>
<color>536870912</color>
<mode>2</mode>
<color>16777215</color>
</background>
</TextObject>
<TextObject>
<band>Header</band>
<alignment>2</alignment>
<text>Sale Order</text>
<border>6</border>
<color>0</color>
</ColumnObject>
<ColumnObject>
<band>Detail</band>
<id>7</id>
<alignment>0</alignment>
<tabsequence>80</tabsequence>
<border>5</border>
<color>33554432</color>
<x>648</x>
<y>2</y>
<y>0</y>
<height>16</height>
<width>111</width>
<format>[general]</format>
<html>
<valueishtml>0</valueishtml>
</html>
<name>sale_order_t</name>
<name>sale_order</name>
<visible>1</visible>
<EditStyle style="edit">
<limit>10</limit>
<case>any</case>
<focusrectangle>no</focusrectangle>
<autoselect>yes</autoselect>
<autohscroll>yes</autohscroll>
<imemode>0</imemode>
</EditStyle>
<font>
<face>Times New Roman</face>
<height>-10</height>
<weight>400</weight>
<family>1</family>
<family>2</family>
<pitch>2</pitch>
<charset>0</charset>
</font>
<background>
<mode>1</mode>
<color>536870912</color>
<mode>2</mode>
<color>16777215</color>
</background>
</TextObject>
<TextObject>
<band>Header</band>
<alignment>2</alignment>
<text>Task Status</text>
<border>6</border>
<color>0</color>
</ColumnObject>
<ColumnObject>
<band>Detail</band>
<id>10</id>
<alignment>0</alignment>
<tabsequence>90</tabsequence>
<border>5</border>
<color>33554432</color>
<x>761</x>
<y>2</y>
<y>0</y>
<height>16</height>
<width>77</width>
<format>[general]</format>
<html>
<valueishtml>0</valueishtml>
</html>
<name>wave_status_t</name>
<name>wave_status</name>
<visible>1</visible>
<EditStyle style="ddlb">
<limit>3</limit>
<allowedit>no</allowedit>
<case>upper</case>
<imemode>0</imemode>
</EditStyle>
<font>
<face>Times New Roman</face>
<face>Arial</face>
<height>-10</height>
<weight>400</weight>
<family>1</family>
<family>2</family>
<pitch>2</pitch>
<charset>0</charset>
</font>
<background>
<mode>1</mode>
<color>536870912</color>
<mode>2</mode>
<color>16777215</color>
</background>
</TextObject>
<TextObject>
<band>Header</band>
</ColumnObject>
<ColumnObject>
<band>Detail</band>
<id>8</id>
<alignment>0</alignment>
<text>Priority</text>
<border>6</border>
<color>0</color>
<tabsequence>100</tabsequence>
<border>5</border>
<color>33554432</color>
<x>840</x>
<y>2</y>
<y>0</y>
<height>16</height>
<width>62</width>
<format>[general]</format>
<html>
<valueishtml>0</valueishtml>
</html>
<name>priority_t</name>
<name>priority</name>
<visible>0</visible>
<EditStyle style="edit">
<limit>0</limit>
<case>any</case>
<autoselect>yes</autoselect>
<imemode>0</imemode>
</EditStyle>
<font>
<face>Times New Roman</face>
<face>Arial</face>
<height>-10</height>
<weight>400</weight>
<family>1</family>
<family>2</family>
<pitch>2</pitch>
<charset>0</charset>
</font>
<background>
<mode>1</mode>
<color>536870912</color>
<mode>2</mode>
<color>16777215</color>
</background>
</TextObject>
<TextObject>
<band>Header</band>
<alignment>2</alignment>
<text>Descr</text>
<border>6</border>
<color>0</color>
</ColumnObject>
<ColumnObject>
<band>Detail</band>
<id>9</id>
<alignment>0</alignment>
<tabsequence>40</tabsequence>
<border>5</border>
<color>33554432</color>
<x>226</x>
<y>2</y>
<y>0</y>
<height>16</height>
<width>203</width>
<format>[general]</format>
<html>
<valueishtml>0</valueishtml>
</html>
<name>descr_t</name>
<name>descr</name>
<visible>1</visible>
<EditStyle style="edit">
<limit>0</limit>
<case>any</case>
<autoselect>yes</autoselect>
<imemode>0</imemode>
</EditStyle>
<font>
<face>Times New Roman</face>
<height>-10</height>
<weight>400</weight>
<family>1</family>
<family>2</family>
<pitch>2</pitch>
<charset>0</charset>
</font>
<background>
<mode>1</mode>
<color>536870912</color>
<mode>2</mode>
<color>16777215</color>
</background>
</TextObject>
</ColumnObject>
<HtmlTable>
<border>1</border>
</HtmlTable>
......
......@@ -94,20 +94,20 @@
<name>sale_order</name>
<dbname>wave_task_det.sale_order</dbname>
</table_column>
<table_column>
<type size="8">char</type>
<update>yes</update>
<updatewhereclause>yes</updatewhereclause>
<name>wave_status</name>
<dbname>wave_status</dbname>
</table_column>
<table_column>
<type size="4000">char</type>
<updatewhereclause>yes</updatewhereclause>
<name>descr</name>
<dbname>descr</dbname>
</table_column>
<retrieve>PBSELECT( VERSION(400) TABLE(NAME=&quot;wave_task_det&quot; ) COLUMN(NAME=&quot;wave_task_det.wave_id&quot;) COLUMN(NAME=&quot;wave_task_det.line_no&quot;) COLUMN(NAME=&quot;wave_task_det.ref_ser&quot;) COLUMN(NAME=&quot;wave_task_det.ref_id&quot;) COLUMN(NAME=&quot;wave_task_det.status&quot;) COLUMN(NAME=&quot;wave_task_det.ptcn&quot;) COLUMN(NAME=&quot;wave_task_det.sale_order&quot;) COMPUTE(NAME=&quot;case when wave_status = &apos;C&apos; then &apos;Created&apos; when wave_status = &apos;V&apos; then &apos;Verified&apos; when wave_status = &apos;W&apos; then &apos;Held&apos; else &apos; &apos; end wave_status&quot;) COMPUTE(NAME=&quot;FN_WAVE_DESCRIPTION(WAVE_TASK_DET.REF_SER,REF_ID,PTCN) AS DESCR&quot;)WHERE( EXP1 =&quot;wave_task_det.wave_id&quot; OP =&quot;=&quot; EXP2 =&quot;:wave_id&quot; LOGIC =&quot;And&quot; ) WHERE( EXP1 =&quot;wave_task_det.line_no&quot; OP =&quot;=&quot; EXP2 =&quot;:line_no&quot; ) ) ARG(NAME = &quot;wave_id&quot; TYPE = string) ARG(NAME = &quot;line_no&quot; TYPE = number) </retrieve>
<table_column>
<type size="11">char</type>
<update>yes</update>
<updatewhereclause>yes</updatewhereclause>
<name>wave_status</name>
<dbname>wave_status</dbname>
</table_column>
<retrieve>PBSELECT( VERSION(400) TABLE(NAME=&quot;wave_task_det&quot; ) COLUMN(NAME=&quot;wave_task_det.wave_id&quot;) COLUMN(NAME=&quot;wave_task_det.line_no&quot;) COLUMN(NAME=&quot;wave_task_det.ref_ser&quot;) COLUMN(NAME=&quot;wave_task_det.ref_id&quot;) COLUMN(NAME=&quot;wave_task_det.status&quot;) COLUMN(NAME=&quot;wave_task_det.ptcn&quot;) COLUMN(NAME=&quot;wave_task_det.sale_order&quot;) COMPUTE(NAME=&quot;FN_WAVE_DESCRIPTION(WAVE_TASK_DET.REF_SER,REF_ID,PTCN) AS DESCR&quot;) COMPUTE(NAME=&quot;case when wave_status = &apos;C&apos; then &apos;Created&apos; when wave_status = &apos;V&apos; then &apos;Verified&apos; when wave_status = &apos;W&apos; then &apos;Held&apos; when wave_status = &apos;D&apos; then &apos;Deallocated&apos; else &apos; &apos; end wave_status&quot;)WHERE( EXP1 =&quot;wave_task_det.wave_id&quot; OP =&quot;=&quot; EXP2 =&quot;:wave_id&quot; LOGIC =&quot;And&quot; ) WHERE( EXP1 =&quot;wave_task_det.line_no&quot; OP =&quot;=&quot; EXP2 =&quot;:line_no&quot; ) ) ARG(NAME = &quot;wave_id&quot; TYPE = string) ARG(NAME = &quot;line_no&quot; TYPE = number) </retrieve>
<update>WAVE_TASK_DET</update>
<updatewhere>0</updatewhere>
<updatekeyinplace>no</updatekeyinplace>
......@@ -189,7 +189,7 @@
</TextObject>
<ColumnObject>
<band>Detail</band>
<id>9</id>
<id>8</id>
<alignment>0</alignment>
<tabsequence>32766</tabsequence>
<border>5</border>
......@@ -225,7 +225,7 @@
</ColumnObject>
<ColumnObject>
<band>Detail</band>
<id>8</id>
<id>9</id>
<alignment>0</alignment>
<tabsequence>32766</tabsequence>
<border>5</border>
......
......@@ -49339,7 +49339,36 @@ values
update MESSAGES SET MSG_NO='VTNOTPARCT' WHERE MSG_NO='VTNOTPOAT';
COMMIT;
--changed by sankara on 04/09/14 updated function sql
create or replace
function fn_wave_status(SI_WAVE_ID IN CHAR)
return CHAR IS STATUS CHAR;
CNT NUMBER;
CNT1 NUMBER;
CNT2 NUMBER;
BEGIN
BEGIN
SELECT count(*) INTO CNT FROM WAVE_TASK_DET WHERE WAVE_ID = SI_WAVE_ID;
SELECT count(*) INTO CNT1 FROM WAVE_TASK_DET WHERE WAVE_ID = SI_WAVE_ID AND STATUS = 'Y';
SELECT COUNT(*) INTO CNT2 FROM WAVE_TASK_DET WHERE WAVE_ID = SI_WAVE_ID AND REF_SER <> 'S-DSP' AND WAVE_STATUS IN ('C','W','V') ;
IF (CNT = cnt1 ) THEN
STATUS := 'Y';
ELSE
STATUS := 'N';
IF (CNT2 = '0' ) THEN
STATUS := 'Y';
ELSE
STATUS := 'N';
END IF;
END IF;
EXCEPTION
WHEN NO_DATA_FOUND THEN
STATUS :='N';
END;
RETURN STATUS;
END;
-- changed by sankara on 29/07/14 for update deallocate status in wave task det and master pack hold sqls end
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