Commit cdfd600c authored by rtiwari's avatar rtiwari

updated


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@96035 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 430223ab
......@@ -75,6 +75,8 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc
CommonConstants commonConstants = new CommonConstants();
String chgUser = null;
String chgTerm = null;
boolean stkAllocateFlag = false;
/*public void ejbCreate() throws RemoteException, CreateException
{
......@@ -1335,7 +1337,14 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc
errString = "PROCSUCC";
errString = itmDBAccessEJB.getErrorString("",errString,"","",conn);
}*/
errString = "PROCSUCC";
if(stkAllocateFlag)
{
errString = "PROCSUCC";
}
else
{
errString = "VTPRCERR";
}
errString = itmDBAccessEJB.getErrorString("",errString,"","",conn);
System.out.println("before errString=="+errString);
String begPart = errString.substring( 0, errString.indexOf("<trace>") + 7 );
......@@ -1542,7 +1551,7 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc
// private String sorderAllocate(String saleOrder, String lineNo, String itemCode, double allocQty, String expLev ,String holdFlag,String activeAllow,String xtraParams) throws ITMException
private String sorderAllocate(HashMap soLnValues,String xtraParams) throws ITMException
{
System.out.println("updateSOrder calling .08/08/14.............");
System.out.println("sorderAllocate calling ..............");
String saleOrder = "", lineNo = "", itemCode = "";
double allocQty = 0d;
String expLev = "" ,holdFlag = "", activeAllow= "";
......@@ -1599,7 +1608,7 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc
ResultSet rs = null ;
ResultSet rsSItem = null;
StringBuffer xmlBuff = null;
String xmlString = null,retString = null;
String xmlString = "",retString = null;
DistCommon dComm = new DistCommon();
Timestamp sysDate = null;
Calendar currentDate = Calendar.getInstance();
......@@ -1621,6 +1630,7 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc
int count =0;
boolean isHdr = true;
String allocqtyStr = "";
boolean allocQtyFlag = false;
// ADDED BY RITESH ON 15/07/14 END
try
{
......@@ -1657,10 +1667,9 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc
boolean checkLocation = false;
boolean isActives = false;
boolean getLotFlag = false ;
if(count>1)
isHdr = false;
String key = (String)it.next();System.out.println("key value::"+key);System.out.println("soLnValues.get(key)::"+soLnValues.get(key));
String key = (String)it.next();System.out.println("key value:[]:"+key);System.out.println("soLnValues.get(key)::"+soLnValues.get(key));
String solnValueList[] = ((String)soLnValues.get(key)).split(",");System.out.println("solnValueList::"+solnValueList);
......@@ -1787,7 +1796,7 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc
}
else
{
sqlSorditem = " select * from sorditem where sale_order = '"+saleOrder+"' and line_no = '"+lineNo+"' for update nowait ";
sqlSorditem = " select * from sorditem where sale_order = '"+saleOrder+"' and line_no = '"+lineNo+"' ";//for update nowait ";
}
psmtSord = conn.prepareStatement(sqlSorditem);
......@@ -1839,13 +1848,26 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc
if(rs.next())
{
pendingQty = rs.getInt("PENDING_QUANTITY");
singleLot = rs.getString("SINGLE_LOT")==null?"N":rs.getString("SINGLE_LOT"); //ADDED BY RITESH ON 15/07/14
// singleLot = rs.getString("SINGLE_LOT")==null?"N":rs.getString("SINGLE_LOT"); //ADDED BY RITESH ON 15/07/14
}
rs.close();
rs = null;
pstmt1.close();
pstmt1 = null;
sql = " SELECT SINGLE_LOT FROM SORDER WHERE SALE_ORDER = ? ";
pstmt1 = conn.prepareStatement(sql);
pstmt1.setString(1,saleOrder);
rs = pstmt1.executeQuery();
if(rs.next())
{
singleLot = rs.getString("SINGLE_LOT")==null?"N":rs.getString("SINGLE_LOT");
}
rs.close();
rs = null;
pstmt1.close();
pstmt1 = null;
HashMap itemVolMap = getItemVoumeMap(itemCode, "", conn);
double packSize = (Double)itemVolMap.get("PACK_SIZE");
System.out.println(" pendingQty = "+pendingQty+" packSize ="+packSize);
......@@ -1952,7 +1974,7 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc
//CHANGE BY RITESH ON 18/07/14 START
while(rs.next())//for(lotListNew)
{
System.out.println( " INSIDE WHILE LOOP.............SINGLELOT ["+singleLot+"]");
System.out.println( " INSIDE WHILE LOOP.............SINGLELOT __12 ["+singleLot+"]");
//LOT_NO
lotNo = rs.getString(1);
//LOT_SL
......@@ -2008,8 +2030,10 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc
if(totalQtyAvailAlloc >= allocQty)
{
isQtyAvail = true;
lotDeatilList.add(lotNo+"@"+lotSl+"@"+locCode+"@"+unit+"@"+qtyAvailAlloc+"@"+grade+"@"+convQtyStduom+"@"+quantity+"@"+siteCodeMfg);
}
lotDeatilList.add(lotNo+"@"+lotSl+"@"+locCode+"@"+unit+"@"+qtyAvailAlloc+"@"+grade+"@"+convQtyStduom+"@"+quantity+"@"+siteCodeMfg);
// lotDeatilList.add(lotNo+"@"+lotSl+"@"+locCode+"@"+unit+"@"+qtyAvailAlloc+"@"+grade+"@"+convQtyStduom+"@"+quantity+"@"+siteCodeMfg);
System.out.println("lotDeatilList1 ::"+lotDeatilList);
}
System.out.println("lotDeatilList2 ::"+lotDeatilList);
......@@ -2122,6 +2146,7 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc
xmlBuff.append("<alloc_flag><![CDATA[A]]></alloc_flag>");
xmlBuff.append("</Detail1>");
}
HashMap mapDet = new HashMap();
for(int i = 0; i < lotDeatilList.size();i++)
{
......@@ -2206,7 +2231,7 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc
}
//added by ritesh on 07/10/13 for request DI3ESUN009 end
System.out.println("allocQty =::2"+allocQty);
System.out.println("allocQty =::"+allocQty);
invallocTrace.setAllocQty(lotQtyToBeAllocated);
//
allocQty -= lotQtyToBeAllocated ;
......@@ -2277,232 +2302,57 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc
// xmlBuff.append("<active_pick_allow><![CDATA["+ activeAllow +"]]></active_pick_allow>");
// xmlBuff.append("</Detail1>");
linenoDet ++;
xmlBuff.append("<Detail2 dbID='' domID=\"1\" objName=\"sord_alloc\" objContext=\"2\">");
xmlBuff.append("<attribute pkNames=\"\" selected=\"N\" updateFlag=\"A\" status=\"N\" />");
xmlBuff.append("<line_no><![CDATA["+linenoDet+"]]></line_no>");
xmlBuff.append("<tran_id/>");
xmlBuff.append("<sale_order><![CDATA["+ saleOrder +"]]></sale_order>");
xmlBuff.append("<line_no__sord><![CDATA["+lineNo +"]]></line_no__sord>");
xmlBuff.append("<item_code><![CDATA["+ itemCode +"]]></item_code>");
xmlBuff.append("<loc_code><![CDATA["+locCode+"]]></loc_code>");
xmlBuff.append("<lot_no><![CDATA["+ lotNo +"]]></lot_no>");
xmlBuff.append("<lot_sl><![CDATA["+lotSl+"]]></lot_sl>");
xmlBuff.append("<quantity><![CDATA["+ lotQtyToBeAllocated +"]]></quantity>");
xmlBuff.append("<dealloc_qty><![CDATA[0]]></dealloc_qty>");
xmlBuff.append("<site_code><![CDATA["+ siteCodeShip +"]]></site_code>");
xmlBuff.append("<exp_lev><![CDATA["+ expLev +"]]></exp_lev>");
xmlBuff.append("<pending_qty><![CDATA["+ qty +"]]></pending_qty>");
xmlBuff.append("</Detail2>");
// xmlBuff.append("</Header0>");
// xmlBuff.append("</group0>");
// xmlBuff.append("</DocumentRoot>");
// xmlString = xmlBuff.toSlinenoDettring();
// System.out.println("@@@@@2: xmlString:"+xmlBuff.toString());
// System.out.println("...............just before savdata()");
// System.out.println("Getting site code value");
// siteCode = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginSiteCode");
// System.out.println("==site code =="+siteCode);
// System.out.println("Printing xmlString"+xmlString);
// System.out.println("Going to save data method++++++++++++++++++++++++");
//
// retString = saveData(siteCode,xmlString,conn);
// System.out.println("@@@@@2: retString11111111111:"+retString);
// if (retString.indexOf("linenoDetSuccess") > -1)
// {
// System.out.println("@@@@@@3: retString22222222222"+retString);
//
// String[] arrayForTranId = retString.split("<TranID>");
// int endIndex = arrayForTranId[1].indexOf("</TranID>");
// System.out.println("***********going for confirmation************");
// String tranIdForIssue = arrayForTranId[1].substring(0,endIndex);
// System.out.println("tranIdForIssue"+ tranIdForIssue);
// retString=allocPrc.confirm(tranIdForIssue, xtraParams, "",conn);
//
// System.out.println(linenoDet"@@@@@@3: retString Confirm"+retString);
// System.out.println("=====Its Confirmed=====");
// System.out.println("retString from conf ::"+retString);
// }
// else
// {
// //System.out.println("[" + retString + "]");
// return retString;
// }
String linenoDetStr = Integer.toString(linenoDet);
mapDet.put(linenoDetStr,linenoDet+","+saleOrder+","+lineNo+","+itemCode+","+locCode+","+lotSl+","+lotNo+","+lotQtyToBeAllocated+","+siteCodeShip+","+expLev+","+qty);
// xmlBuff.append("<Detail2 dbID='' domID=\"1\" objName=\"sord_alloc\" objContext=\"2\">");
// xmlBuff.append("<attribute pkNames=\"\" selected=\"N\" updateFlag=\"A\" status=\"N\" />");
// xmlBuff.append("<line_no><![CDATA["+linenoDet+"]]></line_no>");
// xmlBuff.append("<tran_id/>");
// xmlBuff.append("<sale_order><![CDATA["+ saleOrder +"]]></sale_order>");
// xmlBuff.append("<line_no__sord><![CDATA["+lineNo +"]]></line_no__sord>");
// xmlBuff.append("<item_code><![CDATA["+ itemCode +"]]></item_code>");
// xmlBuff.append("<loc_code><![CDATA["+locCode+"]]></loc_code>");
// xmlBuff.append("<lot_no><![CDATA["+ lotNo +"]]></lot_no>");
// xmlBuff.append("<lot_sl><![CDATA["+lotSl+"]]></lot_sl>");
// xmlBuff.append("<quantity><![CDATA["+ lotQtyToBeAllocated +"]]></quantity>");
// xmlBuff.append("<dealloc_qty><![CDATA[0]]></dealloc_qty>");
// xmlBuff.append("<site_code><![CDATA["+ siteCodeShip +"]]></site_code>");
// xmlBuff.append("<exp_lev><![CDATA["+ expLev +"]]></exp_lev>");
// xmlBuff.append("<pending_qty><![CDATA["+ qty +"]]></pending_qty>");
// xmlBuff.append("</Detail2>");
}
/*if (lotQtyToBeAllocated > linenoDet0)
{
invallocTrace.setChgUser(chgUser);
invallocTrace.setChgTerm(chgTerm);
invallocTrace.setChgWin("W_SORDALLOC" );
errString = updateInvallocTrace(invallocTrace, conn);
if (errString != null && errString.trim().length() > 0)
{
System.out.println("manohar connection rolledback errString :::"+ errString );
conn.rollback();linenoDet
return errString;
}
if (!saleOrderArr.contains(saleOrder))
{
saleOrderArr.add(saleOrderArr.size() , saleOrder);
}
updateSorditem ="UPDATE SORDITEM SET QTY_ALLOC = CASE WHEN QTY_ALLOC IS NULL THEN 0 ELSE QTY_ALLOC END + " + new Double(lotQtyToBeAllocated).toString()
+" WHERE SALE_ORDER = '" + saleOrder + "' "
+" AND LINE_NO = '" + lineNo + "' "
+" AND EXP_LEV = '" + expLev + "' ";
tran_id
System.out.println("updateSql------->"+updateSorditem);
st = conn.createStatement();
st.executeUpdate(updateSorditem);
System.out.println("UPDATE SUCCESS FOR SORDITEM....>>>>>>>>");
sorditemSql = "SELECT COUNT(1) FROM SORDALLOC "
+ " WHERE SALE_ORDER = '" + saleOrder + "' "
+ " AND LINE_NO = '" + lineNo + "' "
+ " AND EXP_LEV = '" + expLev + "' "
+ " AND ITEM_CODE__ORD = '" + itemCodeOrd + "' "
+ " AND ITEM_CODE = '" + itemCode + "' "
+ " AND LOT_NO = '" + lotNo + "' "
+ " AND LOT_SL = '" + lotSl + "' "
+ " AND LOC_CODE = '" + locCode + "' " ;
rsSItem = st.executeQuery(sorditemSql);
int count = 0 ;
if (rsSItem.next())
{
count = rsSItem.getInt(1);
}
rsSItem.close();
rsSItem=null;
st.close();
st=null;
if (count > 0 )
}//end of while
System.out.println("mapDet::"+mapDet);
if(mapDet.size() > 0 && allocQty == 0)
{
allocQtyFlag = true;
Set<String> lotKey=mapDet.keySet();
Iterator<String> lot=lotKey.iterator();
System.out.println("lotKey ::mapDet:: [-"+lotKey+"-]");
while(lot.hasNext())
{
updateSql = "UPDATE SORDALLOC SET QTY_ALLOC = QTY_ALLOC + " + new Double(lotQtyToBeAllocated).toString()
+ " WHERE SALE_ORDER = '" + saleOrder + " ' "
+ " AND LINE_NO = '" + lineNo + "' "
+ " AND EXP_LEV = '" + expLev + "' "
+ " AND ITEM_CODE__ORD = '" + itemCodeOrd + "' "
+ " AND ITEM_CODE = '" + itemCode + "' "
+ " AND LOT_NO = '" + lotNo + "' "
+ " AND LOT_SL = '" + lotSl + "' "
+ " AND LOC_CODE = '" + locCode + "' " ;
System.out.println("updateSql:::>>>>"+ updateSql);
st = conn.createStatement();
st.executeUpdate(updateSql);
st.close();
st=null;
System.out.println("UPDATE SUCCESS FOR SORDALLOC....");
String lotKeyVal=lot.next();
String detStr = (String)mapDet.get(lotKeyVal);
String[] detHdr = detStr.split(",");
xmlBuff.append("<Detail2 dbID='' domID=\"1\" objName=\"sord_alloc\" objContext=\"2\">");
xmlBuff.append("<attribute pkNames=\"\" selected=\"N\" updateFlag=\"A\" status=\"N\" />");
xmlBuff.append("<line_no><![CDATA["+Integer.parseInt((String)detHdr[0])+"]]></line_no>");
xmlBuff.append("<tran_id/>");
xmlBuff.append("<sale_order><![CDATA["+ (String)detHdr[1] +"]]></sale_order>");
xmlBuff.append("<line_no__sord><![CDATA["+(String)detHdr[2] +"]]></line_no__sord>");
xmlBuff.append("<item_code><![CDATA["+ (String)detHdr[3] +"]]></item_code>");
xmlBuff.append("<loc_code><![CDATA["+(String)detHdr[4]+"]]></loc_code>");
xmlBuff.append("<lot_sl><![CDATA["+ (String)detHdr[5] +"]]></lot_sl>");
xmlBuff.append("<lot_no><![CDATA["+(String)detHdr[6]+"]]></lot_no>");
xmlBuff.append("<quantity><![CDATA["+ Double.parseDouble((String)detHdr[7]) +"]]></quantity>");
xmlBuff.append("<dealloc_qty><![CDATA[0]]></dealloc_qty>");
xmlBuff.append("<site_code><![CDATA["+(String)detHdr[8] +"]]></site_code>");
xmlBuff.append("<exp_lev><![CDATA["+ (String)detHdr[9] +"]]></exp_lev>");
xmlBuff.append("<pending_qty><![CDATA["+Double.parseDouble((String)detHdr[10]) +"]]></pending_qty>");
xmlBuff.append("</Detail2>");
}
else
{
insertSql ="INSERT INTO SORDALLOC (SALE_ORDER,LINE_NO,EXP_LEV,ITEM_CODE__ORD,SITE_CODE ,"
+"ITEM_CODE,QUANTITY ,LOT_NO, LOT_SL, LOC_CODE, UNIT, QTY_ALLOC,"
+"ITEM_REF, DATE_ALLOC, STATUS,ITEM_GRADE, EXP_DATE, ALLOC_MODE, "
+" CONV__QTY_STDUOM, UNIT__STD, QUANTITY__STDUOM, "
+"MFG_DATE, SITEtranIdForIssue_CODE__MFG ) "
+"VALUES ( ?, ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? ,"
+" ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ) " ;
pstmtStockInsertSordAlloc = conn.prepareStatement(insertSql);
System.out.println("Insert Sql :"+ insertSql );
//SALE_ORDER
pstmtStockInsertSordAlloc.setString(1, saleOrder);
System.out.println("saleOrder------->"+saleOrder);
//LINE_NO
pstmtStockInsertSordAlloc.setString(2, lineNo);
System.out.println("lineNo------->"+lineNo);
//EXP_LEV
pstmtStockInsertSordAlloc.setString(3, expLev);
System.out.println("EXP_LEV------->"+expLev);
//ITEM_CODE__ORD
pstmtStockInsertSordAlloc.setString(4, itemCodeOrd);
System.out.println("itemCode------->"+itemCodeOrd);
//SITE_CODE
pstmtStockInsertSordAlloc.setString(5, siteCodeShip);
System.out.println("siteCode------->"+siteCodeShip);
//ITEM_CODE
pstmtStockInsertSordAlloc.setString(6, itemCode);
System.out.println("itemCode------->"+itemCode);
//QUANTITY***** set pending qty
pstmtStockInsertSordAlloc.setDouble(7, pendingQuantity);
System.out.println("pendingQuantity------->"+pendingQuantity);
//LOT_NO
pstmtStockInsertSordAlloc.setString(8, lotNo);
System.out.println("lotNo------->"+lotNo);
//LOT_SL
pstmtStockInsertSordAlloc.setString(9, lotSl);
System.out.println("lotSl------->"+lotSl);
//LOC_CODE
pstmtStockInsertSordAlloc.setString(10, locCode);
System.out.println("locCode------->"+locCode);
//UNIT
pstmtStockInsertSordAlloc.setString(11, unit);
System.out.println("unit------->"+unit);
tranIdForIssue //QTY_ALLOC
pstmtStockInsertSordAlloc.setDouble(12, lotQtyToBeAllocated);
System.out.println("lotQtyToBeAllocated------->"+lotQtyToBeAllocated);
//ITEM_REF
pstmtStockInsertSordAlloc.setString(13,itemRef);
System.out.println("itemRef------->"+itemRef);
//DATE_ALLOC
pstmtStockInsertSordAlloc.setDate(14,dateAlloc);
System.out.println("dateAlloc------->"+dateAlloc);
//STATUS
pstmtStockInsertSordAllotranIdForIssuec.setString(15,"P");
System.out.println("status------->P");
//ITEM_GRADE
pstmtStockInsertSordAlloc.setString(16,grade);
System.out.println("grade------->"+grade);
//EXP_DATE
pstmtStockInsertSordAlloc.setDate(17,expDate);
System.out.println("expDate------->"+expDate);
//ALLOC_MODE
pstmtStockInsertSordAlloc.setString(18,"M");
//CONV__QTY_STDUOM
pstmtStockInsertSordAlloc.setDouble(19,convQtyStduom);
System.out.println("convQtyStduom------->"+convQtyStduom);
//UNIT__STD
pstmtStockInsertSordAlloc.setString(20,unitStd);
System.out.println("unitStd------->"+unitStd);
quantityStduom = convQtyStduom * lotQtyToBeAllocated ;
//QUANTITY__STDUOM
pstmtStockInsertSordAlloc.setDouble(21,quantityStduom);
System.out.println("quantityStduom------->"+quantityStduom);
1788//MFG_DATE
pstmtStockInsertSordAlloc.setDate(22,mfgDate);
System.out.println("mfgDate------->"+mfgDate);
//SITE_CODE__MFG
pstmtStockInsertSordAlloc.setString(23,siteCodeMfg);
System.out.println("siteCodeMfg------->"+siteCodeMfg);
//QTY_DESP
intCnt = pstmtStockInsertSordAlloc.executeUpdate();
System.out.println("insertion success ...............>>>>>>>>");
pstmtStockInsertSordAlloc.close();
}//end else
//st.close();
//added by akhilesh to update hold_flag
updateSql = "UPDATE SORDDET SET HOLD_FLAG ='"+holdFlag+"'"
+ " WHERE SALE_ORDER = '" + saleOrder + " ' "
+ " AND LINE_NO = '" + lineNo + "' ";
System.out.println("updateSql::>>>>"+ updateSql);
st = conn.createStatement();
st.executeUpdate(updateSql);
st.close();
st=null;
System.out.println("UPDATE SUCCESS FOR SORDDET....");
//ended by akhilesh
}//end of if(lotQtyToBeAllocated > 0)
*/
}//end of while
}
}
}
if(xmlBuff!=null)
......@@ -2549,10 +2399,15 @@ tran_id
pstmtStock.close();
System.out.println("manohar connection errString :::"+ errString );
System.out.println("manoj if Quantity is fuly allocated commiting transaction else rollbacking :::"+ allocQty );
if(allocQty==0)
if(allocQty==0 || allocQtyFlag)
{
conn.commit();
stkAllocateFlag = true;
System.out.println("Transaction commited while allocQty =="+allocQty);
if(allocQty != 0 )
{
errString = itmDBAccessEJB.getErrorString("", "VSTQTYER", "", "", conn);
}
}
else
{
......
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