Commit 5cd1e91a authored by cpatil's avatar cpatil

for stock option 0


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@93581 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 1899d658
...@@ -158,9 +158,9 @@ public class WOIssueReplacementPrc extends ProcessEJB implements GenerateReceipt ...@@ -158,9 +158,9 @@ public class WOIssueReplacementPrc extends ProcessEJB implements GenerateReceipt
ArrayList <String>listExpLev=new ArrayList<String>(); ArrayList <String>listExpLev=new ArrayList<String>();
String supp_code__mfgSep ="", lotNoIssueTemp = "", operationStr="",tranSer=""; String supp_code__mfgSep ="", lotNoIssueTemp = "", operationStr="",tranSer="";
String lotNoList[]; String lotNoList[];
HashMap hashMap = new HashMap(); HashMap hashMap = new HashMap();
try try
{ {
if(conn==null) if(conn==null)
...@@ -180,15 +180,15 @@ public class WOIssueReplacementPrc extends ProcessEJB implements GenerateReceipt ...@@ -180,15 +180,15 @@ public class WOIssueReplacementPrc extends ProcessEJB implements GenerateReceipt
if( operationStr!= null && operationStr.trim().length() > 0 ) if( operationStr!= null && operationStr.trim().length() > 0 )
{ {
for (char c : operationStr.toCharArray()) for (char c : operationStr.toCharArray())
{ {
if (!Character.isDigit(c)) if (!Character.isDigit(c))
{ {
retStr =itmDBAccessEJB.getErrorString("","VMOPERINV","","",conn); retStr =itmDBAccessEJB.getErrorString("","VM OPERINV","","",conn);
return retStr; return retStr;
} }
} }
operation = Integer.parseInt(operationStr); operation = Integer.parseInt(operationStr);
} }
deptCode = genericUtility.getColumnValue("dept_code",headerDom); deptCode = genericUtility.getColumnValue("dept_code",headerDom);
System.out.println("@@@@@ data---->workOrder["+workOrder+"]::operation["+operation+"]::dept_code["+deptCode+"]"); System.out.println("@@@@@ data---->workOrder["+workOrder+"]::operation["+operation+"]::dept_code["+deptCode+"]");
...@@ -298,7 +298,7 @@ public class WOIssueReplacementPrc extends ProcessEJB implements GenerateReceipt ...@@ -298,7 +298,7 @@ public class WOIssueReplacementPrc extends ProcessEJB implements GenerateReceipt
} }
if( operation > 0 ) if( operation > 0 )
{ {
sql ="select count(1) from workorder_bill where work_order = ? and operation = ? "; sql ="select count(1) from workorder_bill where work_order = ? and operation = ? ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1,workOrder); pstmt.setString(1,workOrder);
...@@ -910,7 +910,76 @@ public class WOIssueReplacementPrc extends ProcessEJB implements GenerateReceipt ...@@ -910,7 +910,76 @@ public class WOIssueReplacementPrc extends ProcessEJB implements GenerateReceipt
} }
if ( stockBalQty > 0 ) // test start 06/09/13
String stkOpt="";
sql = "SELECT STK_OPT FROM ITEM WHERE ITEM_CODE = ? ";
System.out.println("sql :"+sql);
pstmt.setString(1,itemCode);
rs = pstmt.executeQuery(sql);
if (rs.next())
{
stkOpt = rs.getString(1);
}
System.out.println("@@@@@@@@stkOpt["+stkOpt+"]");
if( "0".equalsIgnoreCase(stkOpt))
{
System.out.println("@@@@@@@@ inside stkOpt["+stkOpt+"]");
// insert into workorder_issdet
lnNo++;
batchLoadCnt++;
sql ="insert into workorder_issdet (tran_id,line_no,exp_lev,item_code,loc_code,lot_no," +
" lot_sl,quantity,unit,rate,gross_rate,calc_potency, potency_adj," +
" match_potency,min_potency_perc,adj_potency,work_order)" +
" values ( ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,tranId);
pstmt.setInt(2,lnNo);
pstmt.setString(3,expLev);
pstmt.setString(4,itemCode);
pstmt.setString(5,locCode);
pstmt.setString(6," ");
pstmt.setString(7," ");
pstmt.setDouble(8,reqQty);
pstmt.setString(9,unit);
pstmt.setDouble(10,rate);
pstmt.setDouble(11,grossRate);
pstmt.setString(12,calcPotency);
pstmt.setDouble(13,extraQty);
pstmt.setString(14,matchPotency);
pstmt.setDouble(15,minPotencyPerc);
pstmt.setString(16,adjPotency);
pstmt.setString(17,workOrder);
pstmt.addBatch();
pstmt.clearParameters();
// for stock allocation
System.out.println("@@@@@ inside stkopt lineNo :["+lineNo+"] itemCode :["+itemCode+"] loc_code :["+locCode+"]:: reqQty :["+reqQty+"]");
//allocQty = -1 * reqQty;
//line = " " + lineNo;
hashMap.put("tran_date", new java.sql.Date(System.currentTimeMillis()));
hashMap.put("ref_ser",tranSer1);
hashMap.put("ref_id", tranId);
hashMap.put("ref_line", lnNo);
hashMap.put("item_code", itemCode);
hashMap.put("site_code", siteCode);
hashMap.put("loc_code",locCode);
hashMap.put("lot_no"," ");
hashMap.put("lot_sl"," ");
hashMap.put("alloc_qty", new Double(reqQty));
hashMap.put("chg_win","W_WO_ISS_REPLACEMENT");
hashMap.put("chg_user", GenericUtility.getInstance().getValueFromXTRA_PARAMS(xtraParams, "loginCode"));
hashMap.put("chg_term", GenericUtility.getInstance().getValueFromXTRA_PARAMS(xtraParams, "termId"));
if (updAllocTrace(hashMap, conn) > 0)
{
System.out.println("distStkUpd.UpdAllocTrace(HashMap, Connection) : Sucessuful!");
hashMap.clear();
}
}
// end on 06/09/13
else if ( stockBalQty > 0 )
{ {
// insert into workorder_issdet // insert into workorder_issdet
lnNo++; lnNo++;
...@@ -939,12 +1008,12 @@ public class WOIssueReplacementPrc extends ProcessEJB implements GenerateReceipt ...@@ -939,12 +1008,12 @@ public class WOIssueReplacementPrc extends ProcessEJB implements GenerateReceipt
pstmt.setString(17,workOrder); pstmt.setString(17,workOrder);
pstmt.addBatch(); pstmt.addBatch();
pstmt.clearParameters(); pstmt.clearParameters();
// for stock allocation // for stock allocation
System.out.println("lineNo :"+lineNo+" itemCode :"+itemCode+" stock_loc_code :"+stock_loc_code+" stock_lot_no :"+stock_lot_no+" stock_lot_sl :"+stock_lot_sl+" reqQty :"+reqQty); System.out.println("@@@@@ normal lineNo :"+lineNo+" itemCode :"+itemCode+" stock_loc_code :"+stock_loc_code+" stock_lot_no :"+stock_lot_no+" stock_lot_sl :"+stock_lot_sl+" reqQty :"+reqQty);
//allocQty = -1 * reqQty; //allocQty = -1 * reqQty;
//line = " " + lineNo; //line = " " + lineNo;
hashMap.put("tran_date", new java.sql.Date(System.currentTimeMillis())); hashMap.put("tran_date", new java.sql.Date(System.currentTimeMillis()));
hashMap.put("ref_ser",tranSer1); hashMap.put("ref_ser",tranSer1);
...@@ -959,17 +1028,18 @@ public class WOIssueReplacementPrc extends ProcessEJB implements GenerateReceipt ...@@ -959,17 +1028,18 @@ public class WOIssueReplacementPrc extends ProcessEJB implements GenerateReceipt
hashMap.put("chg_win","W_WO_ISS_REPLACEMENT"); hashMap.put("chg_win","W_WO_ISS_REPLACEMENT");
hashMap.put("chg_user", GenericUtility.getInstance().getValueFromXTRA_PARAMS(xtraParams, "loginCode")); hashMap.put("chg_user", GenericUtility.getInstance().getValueFromXTRA_PARAMS(xtraParams, "loginCode"));
hashMap.put("chg_term", GenericUtility.getInstance().getValueFromXTRA_PARAMS(xtraParams, "termId")); hashMap.put("chg_term", GenericUtility.getInstance().getValueFromXTRA_PARAMS(xtraParams, "termId"));
//Calling DistStkUpdEJB //Calling DistStkUpdEJB
System.out.println("Calling DistStkUpdEJB....."); System.out.println("Calling DistStkUpdEJB.....");
if (updAllocTrace(hashMap, conn) > 0) if (updAllocTrace(hashMap, conn) > 0)
{ {
System.out.println("distStkUpd.UpdAllocTrace(HashMap, Connection) : Sucessuful!"); System.out.println("distStkUpd.UpdAllocTrace(HashMap, Connection) : Sucessuful!");
hashMap.clear();
} }
// end stock allocation // end stock allocation
} }
} }
} }
...@@ -985,10 +1055,7 @@ public class WOIssueReplacementPrc extends ProcessEJB implements GenerateReceipt ...@@ -985,10 +1055,7 @@ public class WOIssueReplacementPrc extends ProcessEJB implements GenerateReceipt
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
} }
} }
else else
...@@ -1094,8 +1161,8 @@ public class WOIssueReplacementPrc extends ProcessEJB implements GenerateReceipt ...@@ -1094,8 +1161,8 @@ public class WOIssueReplacementPrc extends ProcessEJB implements GenerateReceipt
} }
return s; return s;
} }
public int updAllocTrace(HashMap hmp, Connection conn) throws RemoteException,ITMException public int updAllocTrace(HashMap hmp, Connection conn) throws RemoteException,ITMException
{ {
String stkOpt = "", tranID = "", keyString = "", sql = ""; String stkOpt = "", tranID = "", keyString = "", sql = "";
String refId = "", refLine = "", refSer = "", itemCode = "", siteCode = "", locCode = "", lotNo = "", lotSl = ""; String refId = "", refLine = "", refSer = "", itemCode = "", siteCode = "", locCode = "", lotNo = "", lotSl = "";
...@@ -1149,13 +1216,13 @@ public class WOIssueReplacementPrc extends ProcessEJB implements GenerateReceipt ...@@ -1149,13 +1216,13 @@ public class WOIssueReplacementPrc extends ProcessEJB implements GenerateReceipt
SimpleDateFormat sdf = new SimpleDateFormat (genericUtility.getApplDateFormat()); SimpleDateFormat sdf = new SimpleDateFormat (genericUtility.getApplDateFormat());
tranDate1 = sdf.format(hmp.get("tran_date")); tranDate1 = sdf.format(hmp.get("tran_date"));
String transIDXmlString = "<?xml version=\"1.0\"?>\r\n<Root>\r\n" + String transIDXmlString = "<?xml version=\"1.0\"?>\r\n<Root>\r\n" +
"<header>\r\n</header>" + "<header>\r\n</header>" +
"<Detail1>" + "<Detail1>" +
"<tran_id></tran_id>" + "<tran_id></tran_id>" +
"<tran_date>" +tranDate1 + "</tran_date>" + "<tran_date>" +tranDate1 + "</tran_date>" +
"<site_code>" + siteCode + "</site_code>" + "<site_code>" + siteCode + "</site_code>" +
"</Detail1></Root>"; "</Detail1></Root>";
System.out.println("transIDXmlString : " + transIDXmlString); System.out.println("transIDXmlString : " + transIDXmlString);
//GETTING DATABASE NAME //GETTING DATABASE NAME
CommonConstants.setIBASEHOME(); CommonConstants.setIBASEHOME();
...@@ -1163,8 +1230,8 @@ public class WOIssueReplacementPrc extends ProcessEJB implements GenerateReceipt ...@@ -1163,8 +1230,8 @@ public class WOIssueReplacementPrc extends ProcessEJB implements GenerateReceipt
String tranId = tg.generateTranSeqID("ATRACE","tran_id", keyString, conn); String tranId = tg.generateTranSeqID("ATRACE","tran_id", keyString, conn);
System.out.println("tranId :"+tranId); System.out.println("tranId :"+tranId);
sql= "INSERT INTO INVALLOC_TRACE (TRAN_ID, TRAN_DATE, REF_SER, REF_ID, REF_LINE, " sql= "INSERT INTO INVALLOC_TRACE (TRAN_ID, TRAN_DATE, REF_SER, REF_ID, REF_LINE, "
+"ITEM_CODE, SITE_CODE, LOC_CODE, LOT_NO, LOT_SL, ALLOC_QTY, CHG_WIN, CHG_USER, " +"ITEM_CODE, SITE_CODE, LOC_CODE, LOT_NO, LOT_SL, ALLOC_QTY, CHG_WIN, CHG_USER, "
+"CHG_TERM, CHG_DATE)VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; +"CHG_TERM, CHG_DATE)VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
System.out.println("sql :"+sql); System.out.println("sql :"+sql);
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1,tranId); pstmt.setString(1,tranId);
...@@ -1197,11 +1264,11 @@ public class WOIssueReplacementPrc extends ProcessEJB implements GenerateReceipt ...@@ -1197,11 +1264,11 @@ public class WOIssueReplacementPrc extends ProcessEJB implements GenerateReceipt
System.out.println("lotno :"+hmp.get("lot_no")+"\n lotSl :"+hmp.get("lot_sl")); System.out.println("lotno :"+hmp.get("lot_no")+"\n lotSl :"+hmp.get("lot_sl"));
sqlUpd = "UPDATE STOCK SET ALLOC_QTY = (CASE WHEN ALLOC_QTY IS NULL THEN 0 ELSE ALLOC_QTY END) + "+((Double)hmp.get("alloc_qty")).doubleValue()+" " + sqlUpd = "UPDATE STOCK SET ALLOC_QTY = (CASE WHEN ALLOC_QTY IS NULL THEN 0 ELSE ALLOC_QTY END) + "+((Double)hmp.get("alloc_qty")).doubleValue()+" " +
" WHERE ITEM_CODE = '"+hmp.get("item_code").toString()+"'" + " WHERE ITEM_CODE = '"+hmp.get("item_code").toString()+"'" +
" AND SITE_CODE = '"+hmp.get("site_code").toString()+"' " + " AND SITE_CODE = '"+hmp.get("site_code").toString()+"' " +
" AND LOC_CODE = '"+hmp.get("loc_code").toString()+"' " + " AND LOC_CODE = '"+hmp.get("loc_code").toString()+"' " +
" AND LOT_NO = '"+hmp.get("lot_no").toString()+"' " + " AND LOT_NO = '"+hmp.get("lot_no").toString()+"' " +
" AND LOT_SL = '"+hmp.get("lot_sl").toString()+"' "; " AND LOT_SL = '"+hmp.get("lot_sl").toString()+"' ";
System.out.println("Update sql :"+sqlUpd); System.out.println("Update sql :"+sqlUpd);
stmt1 = conn.createStatement(); stmt1 = conn.createStatement();
updateCnt = stmt1.executeUpdate(sqlUpd); updateCnt = stmt1.executeUpdate(sqlUpd);
...@@ -1254,7 +1321,7 @@ public class WOIssueReplacementPrc extends ProcessEJB implements GenerateReceipt ...@@ -1254,7 +1321,7 @@ public class WOIssueReplacementPrc extends ProcessEJB implements GenerateReceipt
return retVal; return retVal;
} }
}//class }//class
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