Commit 9767d354 authored by manohar's avatar manohar

Many bug fixing and validation as per requirement


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@96566 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 1e252707
......@@ -86,7 +86,7 @@ public class DespatchPos extends ValidatorEJB implements DespatchPosLocal, Despa
private String executepostSaveRec(Document dom, String domID,String objContext,String editFlag, String xtraParams, Connection conn)throws RemoteException,ITMException
{
Statement stmt = null, stmt1 = null;
Statement stmt = null, stmt1 = null, stmt2 = null;
ResultSet rs = null, rs1 = null, rs2 = null, rs3 = null, rs4 = null, rs5 = null;
PreparedStatement pstmt = null;
String siteCode = "", itemCode = "", lineNo = "",locCode = "", lotNo = "", lotSl = "";
......@@ -109,6 +109,7 @@ public class DespatchPos extends ValidatorEJB implements DespatchPosLocal, Despa
{
stmt = conn.createStatement();
stmt1 = conn.createStatement();
stmt2 = conn.createStatement();
distStkUpd = getComponent("DistStkUpd");
currDate = new java.sql.Date(System.currentTimeMillis());
......@@ -162,7 +163,7 @@ public class DespatchPos extends ValidatorEJB implements DespatchPosLocal, Despa
rate = rs1.getDouble(1);
System.out.println("rate :"+rate);
}
stmt1.close();
//stmt1.close();
/* -- Commented and Changes by gulzar - 12/11/07
sql = "UPDATE DESPATCHDET SET COST_RATE = ? "
+"WHERE DESP_ID = ? "
......@@ -199,6 +200,7 @@ public class DespatchPos extends ValidatorEJB implements DespatchPosLocal, Despa
pstmt.close(); pstmt = null;
System.out.println("updateCnt in despatchDet :"+updateCnt);
//End Added - Gulzar - 12/11/07
/* 10/10/14 manoharan commented
sql = "SELECT QTY_ALLOC FROM SORDALLOC WHERE SALE_ORDER = '"+sordNo+"' "
+"AND LINE_NO = '"+lineNoSord+"' "
+"AND EXP_LEV = '"+expLev+"' "
......@@ -209,8 +211,8 @@ public class DespatchPos extends ValidatorEJB implements DespatchPosLocal, Despa
+"AND LOT_SL = '"+lotSl+"' ";
//+"AND ALLOC_MODE = 'M' ";//Manual allocation. //Commented Jiten 10/10/06, It should check for both 'A' and 'M'.
System.out.println("Select sql :"+sql);
stmt1 = conn.createStatement();
rs2 = stmt1.executeQuery(sql);
*/
/*
if (rs2.next())
{
......@@ -218,10 +220,12 @@ public class DespatchPos extends ValidatorEJB implements DespatchPosLocal, Despa
System.out.println("qtyAlloc :"+qtyAlloc);
}
*/
if (!rs2.next())
{
//if (!rs2.next())
//{
sql = "SELECT CUST_CODE,LOC_GROUP FROM SORDER WHERE SALE_ORDER ='"+sordNo+"' ";
System.out.println("sql :"+sql);
//stmt1 = conn.createStatement();
rs3 = stmt1.executeQuery(sql);
if (rs3.next())
{
......@@ -230,66 +234,67 @@ public class DespatchPos extends ValidatorEJB implements DespatchPosLocal, Despa
locGroup = rs3.getString(2);
System.out.println("locGroup :"+locGroup);
}
if (locGroup == null || locGroup.trim().length() == 0)
{
sql = "SELECT A.EXP_DATE, A.GRADE, A.MFG_DATE, A.SITE_CODE__MFG "
+"FROM STOCK A WHERE A.ITEM_CODE = '"+itemCode+"' "
+"AND A.SITE_CODE = '"+siteCode+"' "
+"AND A.LOC_CODE = '"+locCode+"' "
+"AND A.LOT_NO = '"+lotNo+"' "
+"AND A.LOT_SL = '"+lotSl+"'" ;
System.out.println("sql :"+sql);
rs4 = stmt1.executeQuery(sql);
if (rs4.next())
{
expDate = rs4.getDate(1);
System.out.println("expDate :"+expDate);
grade = rs4.getString(2);
System.out.println("grade :"+grade);
mfgDate = rs4.getDate(3);
System.out.println("mfgDate :"+mfgDate);
siteCodeMfg = rs4.getString(4);
System.out.println("siteCodeMfg :"+siteCodeMfg);
}
}
else
{
sql = "SELECT A.EXP_DATE, A.GRADE, A.MFG_DATE, A.SITE_CODE__MFG "
+"FROM STOCK A, LOCATION B "
+"WHERE A.LOC_CODE = B.LOC_CODE "
+"AND B.LOC_GROUP = '"+locGroup+"' "
+"AND A.ITEM_CODE = '"+itemCode+"' "
+"AND A.SITE_CODE = '"+siteCode+"' "
+"AND A.LOC_CODE = '"+locCode+"' "
+"AND A.LOT_NO = '"+lotNo+"' "
+"AND A.LOT_SL = '"+lotSl+"'";
System.out.println("sql :"+sql);
rs4 = stmt1.executeQuery(sql);
if (rs4.next())
{
expDate = rs4.getDate(1);
System.out.println("expDate :"+expDate);
grade = rs4.getString(2);
System.out.println("grade :"+grade);
mfgDate = rs4.getDate(3);
System.out.println("mfgDate :"+mfgDate);
siteCodeMfg = rs4.getString(4);
System.out.println("siteCodeMfg :"+siteCodeMfg);
}
}//end else
sql = "SELECT UNIT__STD, CONV__QTY_STDUOM FROM SORDDET "
+"WHERE SALE_ORDER = '"+sordNo+"' "
+"AND LINE_NO = '"+lineNoSord+"'";
System.out.println("sql :"+sql);
rs5 = stmt1.executeQuery(sql);
if (rs5.next())
{
unitStd = rs5.getString(1);
System.out.println("unitStd :"+unitStd);
convQtyStdUom = rs5.getDouble(2);
System.out.println("convQtyStdUom :"+convQtyStdUom);
}
sqlInsert = "INSERT INTO SORDALLOC (SALE_ORDER, LINE_NO, EXP_LEV, ITEM_CODE__ORD ,ITEM_CODE, "
// if (locGroup == null || locGroup.trim().length() == 0)
// {
// sql = "SELECT A.EXP_DATE, A.GRADE, A.MFG_DATE, A.SITE_CODE__MFG "
// +"FROM STOCK A WHERE A.ITEM_CODE = '"+itemCode+"' "
// +"AND A.SITE_CODE = '"+siteCode+"' "
// +"AND A.LOC_CODE = '"+locCode+"' "
// +"AND A.LOT_NO = '"+lotNo+"' "
// +"AND A.LOT_SL = '"+lotSl+"'" ;
// System.out.println("sql :"+sql);
// rs4 = stmt1.executeQuery(sql);
// if (rs4.next())
// {
// expDate = rs4.getDate(1);
// System.out.println("expDate :"+expDate);
// grade = rs4.getString(2);
// System.out.println("grade :"+grade);
// mfgDate = rs4.getDate(3);
// System.out.println("mfgDate :"+mfgDate);
// siteCodeMfg = rs4.getString(4);
// System.out.println("siteCodeMfg :"+siteCodeMfg);
// }
// }
// else
// {
// sql = "SELECT A.EXP_DATE, A.GRADE, A.MFG_DATE, A.SITE_CODE__MFG "
// +"FROM STOCK A, LOCATION B "
// +"WHERE A.LOC_CODE = B.LOC_CODE "
// +"AND B.LOC_GROUP = '"+locGroup+"' "
// +"AND A.ITEM_CODE = '"+itemCode+"' "
// +"AND A.SITE_CODE = '"+siteCode+"' "
// +"AND A.LOC_CODE = '"+locCode+"' "
// +"AND A.LOT_NO = '"+lotNo+"' "
// +"AND A.LOT_SL = '"+lotSl+"'";
// System.out.println("sql :"+sql);
// rs4 = stmt1.executeQuery(sql);
// if (rs4.next())
// {
// expDate = rs4.getDate(1);
// System.out.println("expDate :"+expDate);
// grade = rs4.getString(2);
// System.out.println("grade :"+grade);
// mfgDate = rs4.getDate(3);
// System.out.println("mfgDate :"+mfgDate);
// siteCodeMfg = rs4.getString(4);
// System.out.println("siteCodeMfg :"+siteCodeMfg);
// }
// }//end else
// sql = "SELECT UNIT__STD, CONV__QTY_STDUOM FROM SORDDET "
// +"WHERE SALE_ORDER = '"+sordNo+"' "
// +"AND LINE_NO = '"+lineNoSord+"'";
// System.out.println("sql :"+sql);
// rs5 = stmt1.executeQuery(sql);
// if (rs5.next())
// {
// unitStd = rs5.getString(1);
// System.out.println("unitStd :"+unitStd);
// convQtyStdUom = rs5.getDouble(2);
// System.out.println("convQtyStdUom :"+convQtyStdUom);
// }
// 10/10/14 manoharan not required to insert
/*sqlInsert = "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, "
+"ALLOC_MODE, SITE_CODE ,ITEM_GRADE, EXP_DATE, MFG_DATE, SITE_CODE__MFG, UNIT__STD, "
+"CONV__QTY_STDUOM, QUANTITY__STDUOM )"
......@@ -322,7 +327,7 @@ public class DespatchPos extends ValidatorEJB implements DespatchPosLocal, Despa
updateCnt = pstmt.executeUpdate();
System.out.println("Inserted the no of records : updateCnt :"+updateCnt);
pstmt.clearParameters();
*/
/*strAllocate.put("tran_date",tranDate);
strAllocate.put("ref_ser","S-DSP");
strAllocate.put("ref_id",tranId);
......@@ -355,33 +360,33 @@ public class DespatchPos extends ValidatorEJB implements DespatchPosLocal, Despa
updateCnt = pstmt.executeUpdate();
System.out.println("Updated the no of records : updateCnt :"+updateCnt);
pstmt.clearParameters();*/
}
else{
sqlUpdate = "UPDATE SORDALLOC "+
"SET QTY_ALLOC = QTY_ALLOC + ? "+
"WHERE SALE_ORDER = ? "+
"AND LINE_NO = ? "+
"AND EXP_LEV = ? "+
"AND ITEM_CODE__ORD = ? "+
"AND ITEM_CODE = ? "+
"AND LOT_NO = ? "+
"AND LOT_SL = ? "+
"AND LOC_CODE = ? ";
pstmt = conn.prepareStatement(sqlUpdate);
pstmt.setDouble(1,qtyStduom);
pstmt.setString(2,sordNo);
pstmt.setString(3,lineNoSord);
pstmt.setString(4,expLev);
pstmt.setString(5,itemCodeOrd);
pstmt.setString(6,itemCode);
pstmt.setString(7,lotNo);
pstmt.setString(8,lotSl);
pstmt.setString(9,locCode);
updateCnt = pstmt.executeUpdate();
pstmt.clearParameters();
pstmt.close();
pstmt = null;
}
//}
//else{
// sqlUpdate = "UPDATE SORDALLOC "+
// "SET QTY_ALLOC = QTY_ALLOC + ? "+
// "WHERE SALE_ORDER = ? "+
// "AND LINE_NO = ? "+
// "AND EXP_LEV = ? "+
// "AND ITEM_CODE__ORD = ? "+
// "AND ITEM_CODE = ? "+
// "AND LOT_NO = ? "+
// "AND LOT_SL = ? "+
// "AND LOC_CODE = ? ";
// pstmt = conn.prepareStatement(sqlUpdate);
// pstmt.setDouble(1,qtyStduom);
// pstmt.setString(2,sordNo);
// pstmt.setString(3,lineNoSord);
// pstmt.setString(4,expLev);
// pstmt.setString(5,itemCodeOrd);
// pstmt.setString(6,itemCode);
// pstmt.setString(7,lotNo);
// pstmt.setString(8,lotSl);
// pstmt.setString(9,locCode);
// updateCnt = pstmt.executeUpdate();
// pstmt.clearParameters();
// pstmt.close();
// pstmt = null;
//}
/////Customer wise manual allocation/deallocatuin.
/////If edit mode then only diff qty is re-allocated.
String tranIdSOAlloc = "";
......@@ -416,7 +421,7 @@ public class DespatchPos extends ValidatorEJB implements DespatchPosLocal, Despa
rs = null;
////////
conn1 = getConnection();
Statement stmt2 = conn1.createStatement();
//Statement stmt2 = conn1.createStatement();
double oldQty = 0,qtyUpdate = 0;
if(tranIdSOAlloc != null && tranIdSOAlloc.trim().length() > 0){
sql = "SELECT QUANTITY__STDUOM FROM DESPATCHDET WHERE DESP_ID = '"+tranId+"' AND LINE_NO = '"+lineNo+"'";
......@@ -424,8 +429,8 @@ public class DespatchPos extends ValidatorEJB implements DespatchPosLocal, Despa
if(rs.next()){
oldQty = rs.getDouble(1);
}
stmt2.close();
stmt2 = null;
//stmt2.close();
//stmt2 = null;
conn1.close();
conn1 = null;
rs = null;
......@@ -515,11 +520,52 @@ public class DespatchPos extends ValidatorEJB implements DespatchPosLocal, Despa
{
try
{
if(rs != null)
{
rs.close();
rs = null;
}
if(rs1 != null)
{
rs1.close();
rs1 = null;
}
if(rs2 != null)
{
rs2.close();
rs2 = null;
}
if(rs3 != null)
{
rs3.close();
rs3 = null;
}
if(rs4 != null)
{
rs4.close();
rs4 = null;
}
if(rs5 != null)
{
rs5.close();
rs5 = null;
}
if(stmt != null)
{
stmt.close();
stmt = null;
}
if(stmt1 != null)
{
stmt1.close();
stmt1 = null;
}
if(stmt2 != null)
{
stmt2.close();
stmt2 = null;
}
if (pstmt != null)
{
pstmt.close();
......
......@@ -143,9 +143,9 @@ public class DespatchPrs extends ValidatorEJB implements DespatchPrsLocal, Despa
currDetail = getCurrentDetailFromDom(dom,domID);
updateStatus = getCurrentUpdateFlag(currDetail);
System.out.println("*************** Update Status *************** ");
System.out.println("DomID :: "+domID+"\n Update Status ::"+updateStatus);
System.out.println("*************** Update Status *************** ");
System.out.println("manohar executepreSaveRec DomID ["+domID+"] Update Status ["+updateStatus + "]");
//01/11/2012 manoj sharma for deallocation
int length=0;
NodeList parentNodeList = null;
......@@ -162,9 +162,12 @@ public class DespatchPrs extends ValidatorEJB implements DespatchPrsLocal, Despa
double totAllocQty=0;
if (currDetail != null ) //&& !updateStatus.equalsIgnoreCase("A")) // 22/02/10 manoharan if allocation found in sordalloc the deallocate
{
currlineNo =GenericUtility.getInstance().getColumnValueFromNode("line_no",currDetail);
itemCode = GenericUtility.getInstance().getColumnValueFromNode("item_code",currDetail);
//if (!updateStatus.equalsIgnoreCase("A")) // 09/10/14 manoharan edit/delete mode get detail from database
lineNo = GenericUtility.getInstance().getColumnValueFromNode("line_no",currDetail);
currlineNo =GenericUtility.getInstance().getColumnValueFromNode("line_no",currDetail);
itemCode = GenericUtility.getInstance().getColumnValueFromNode("item_code",currDetail);
locCode = GenericUtility.getInstance().getColumnValueFromNode("loc_code",currDetail);
lotNo = GenericUtility.getInstance().getColumnValueFromNode("lot_no",currDetail);
lotSl = GenericUtility.getInstance().getColumnValueFromNode("lot_sl",currDetail);
......@@ -173,6 +176,8 @@ public class DespatchPrs extends ValidatorEJB implements DespatchPrsLocal, Despa
itemCodeOrd = GenericUtility.getInstance().getColumnValueFromNode("item_code__ord",currDetail);
sordNo = GenericUtility.getInstance().getColumnValueFromNode("sord_no",currDetail);
lineNoSord = GenericUtility.getInstance().getColumnValueFromNode("line_no__sord",currDetail);
currkey=itemCode.trim()+"@"+sordNo.trim()+"@"+lineNoSord.trim()+"@"+locCode.trim()+"@"+lotNo.trim()+"@"+lotSl.trim()+"@"+expLev.trim()+"@"+itemCodeOrd.trim();
System.out.println("currkey---"+currkey);
sql="SELECT SUM(QUANTITY) FROM DESPATCHDET "
......@@ -428,20 +433,24 @@ public class DespatchPrs extends ValidatorEJB implements DespatchPrsLocal, Despa
+"AND LOT_NO = '"+lotNo+"' "
+"AND LOT_SL = '"+lotSl+"' ";
// +"AND ALLOC_MODE = 'A' "; //Commented by Jiten 10/10/06 as Commented in PB - manual allocation should also get deallocated.
System.out.println("Select SQL sqlSordAlloc :"+sqlSordAlloc);
System.out.println("manohar Select SQL sqlSordAlloc ["+sqlSordAlloc + "]");
System.out.println("manohar executepreSaveRec DomID ["+domID+"] Update Status ["+updateStatus + "]");
rs1 = stmt1.executeQuery(sqlSordAlloc);
if (rs1.next())
{
qtyAlloc = rs1.getDouble(1);
System.out.println("qtyAlloc :"+qtyAlloc);
//System.out.println("qtyAlloc :"+qtyAlloc);
if (String.valueOf(qtyAlloc) == null)
{
qtyAlloc = 0;
}
// 22/02/10 manoharan if allocation found in sordalloc then deallocate
System.out.println("manohar executepreSaveRec qtyAlloc ["+qtyAlloc+"] qtyStduom ["+qtyStduom + "]");
if (qtyAlloc - qtyStduom <= 0)
{
System.out.println("manohar executepreSaveRec deleting qtyAlloc ["+qtyAlloc+"] qtyStduom ["+qtyStduom + "]");
sqlSord = "DELETE FROM SORDALLOC WHERE SALE_ORDER = ? "
+"AND LINE_NO = ? "
+"AND EXP_LEV = ? "
......@@ -450,7 +459,7 @@ public class DespatchPrs extends ValidatorEJB implements DespatchPrsLocal, Despa
+"AND LOT_NO = ? "
+"AND LOT_SL = ? "
+"AND LOC_CODE = ? ";
System.out.println("Delete sql sqlSord :"+sqlSord);
//System.out.println("Delete sql sqlSord :"+sqlSord);
pstmt = conn.prepareStatement(sqlSord);
pstmt.setString(1,sordNo);
pstmt.setString(2,lineNoSord);
......@@ -467,6 +476,7 @@ public class DespatchPrs extends ValidatorEJB implements DespatchPrsLocal, Despa
}
else
{
System.out.println("manohar executepreSaveRec updating qtyAlloc ["+qtyAlloc+"] qtyStduom ["+qtyStduom + "]");
sqlSord = "UPDATE SORDALLOC SET QTY_ALLOC = QTY_ALLOC - ? "
+"WHERE SALE_ORDER = ? "
+"AND LINE_NO = ? "
......@@ -476,7 +486,7 @@ public class DespatchPrs extends ValidatorEJB implements DespatchPrsLocal, Despa
+"AND LOT_NO = ? "
+"AND LOT_SL = ? "
+"AND LOC_CODE = ? ";
System.out.println("Update sql sqlSord :"+sqlSord);
//System.out.println("Update sql sqlSord :"+sqlSord);
pstmt = conn.prepareStatement(sqlSord);
pstmt.setDouble(1,qtyStduom);
pstmt.setString(2,sordNo);
......
......@@ -131,10 +131,16 @@ public class DespatchWiz extends ValidatorEJB implements DespatchWizLocal, Despa
StringBuffer errStringXml = new StringBuffer("<?xml version=\"1.0\"?>\r\n<Root><Errors>");
ArrayList <String> errList = new ArrayList<String>();
ArrayList <String>errFields = new ArrayList <String> ();
String sql = "",locCode ="",invstat="",aval="",avalyn="",status="",errorType="";
String sql = "",locCode ="",invstat="",aval="",avalyn="",status="",errorType="",despId = "";
double qtyConf=0,qtyShip=0,totQty=0,detquantity=0,stkquantity=0,quantity=0,totquantity=0;
String squantity="",distOrder = "",itemCode="",confirmed="",tranId="",siteCode="",lotSl="",addUser="",tranCode="";
String itemCodeL="",SiteCodeL="",CustCodeL="",ChanPart="",sorderNo="";
ArrayList<String> lockList=new ArrayList<String>();
HashMap<String,String>invHoldMap=new HashMap<String,String>();
String lotNo="",locCodeL="",qcLockValue="";
double sdetQty=0,despatchQty=0,actQty=0;
ArrayList <String> itemCodeList=new ArrayList<String>();
int count=0;
try {
genericUtility = GenericUtility.getInstance();
......@@ -348,6 +354,29 @@ public class DespatchWiz extends ValidatorEJB implements DespatchWizLocal, Despa
}
}
}
else if(childNodeName.equalsIgnoreCase("desp_id"))
{
despId = genericUtility.getColumnValue("desp_id",dom2);
sql = "select count(1) from ship_docs where ref_ser = 'S-DSP' and ref_id = ?";
pstmt=conn.prepareStatement(sql);
pstmt.setString(1,tranId);
rs = pstmt.executeQuery();
if(rs.next())
{
cnt = rs.getInt(1);
}
pstmt.close();
rs.close();
pstmt = null;
rs = null;
if(cnt > 0)
{
errCode = "DIDOEISHDO";
errList.add( errCode );
errFields.add( childNodeName.toLowerCase() );
}
}
}
......@@ -411,9 +440,7 @@ public class DespatchWiz extends ValidatorEJB implements DespatchWizLocal, Despa
else if(childNodeName.equalsIgnoreCase("item_code"))
{
System.out.println("----------in wfvaldata of item_code............");
ArrayList <String> itemCodeList=new ArrayList<String>();
String qcLockValue="";
int count=0;
qcLockValue="";
sorderNo = checkNull(genericUtility.getColumnValue("sale_order_no", dom1));
itemCode = checkNull(genericUtility.getColumnValue("item_code", dom2,"3"));
//lotSlL=checkNull(genericUtility.getColumnValue("lot_sl", dom2,"3"));
......@@ -458,10 +485,6 @@ public class DespatchWiz extends ValidatorEJB implements DespatchWizLocal, Despa
else if(childNodeName.equalsIgnoreCase("quantity"))
{
System.out.println("-------------wfvalData..quantity.............");
String lotNo="",locCodeL="",despId="",qcLockValue="";
double sdetQty=0,despatchQty=0,actQty=0;
ArrayList<String> lockList=new ArrayList<String>();
HashMap<String,String>invHoldMap=new HashMap<String,String>();
sorderNo = checkNull(genericUtility.getColumnValue("sale_order_no", dom1));
squantity = genericUtility.getColumnValue("quantity",dom2);
siteCode = genericUtility.getColumnValue("site_code",dom2,"2");
......
......@@ -237,10 +237,6 @@ public class DistIssWiz extends ValidatorEJB implements DistIssWizLocal, DistIss
}
}
break;
case 2:
......@@ -337,6 +333,29 @@ public class DistIssWiz extends ValidatorEJB implements DistIssWizLocal, DistIss
}
}
}
else if(childNodeName.equalsIgnoreCase("tran_id"))
{
tranId = genericUtility.getColumnValue("tran_id",dom2);
sql = "select count(1) from ship_docs where ref_ser = 'D-ISS' and ref_id = ?";
pstmt=conn.prepareStatement(sql);
pstmt.setString(1,tranId);
rs = pstmt.executeQuery();
if(rs.next())
{
cnt = rs.getInt(1);
}
pstmt.close();
rs.close();
pstmt = null;
rs = null;
if(cnt > 0)
{
errCode = "DIDOEISHDO";
errList.add( errCode );
errFields.add( childNodeName.toLowerCase() );
}
}
}
......
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