Commit c45d2c89 authored by ppatro's avatar ppatro

changed by sankara on 20/01/2014 updated wavegeneprc,shipmentconf,replissic...

changed by sankara on 20/01/2014 updated wavegeneprc,shipmentconf,replissic and messages sql given by pragyan


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@94141 ce508802-f39f-4f6c-b175-0d175dae99d5
parent cdebcca6
...@@ -410,14 +410,15 @@ public class ReplIssIC extends ValidatorEJB implements ReplIssICLocal, ReplIssIC ...@@ -410,14 +410,15 @@ public class ReplIssIC extends ValidatorEJB implements ReplIssICLocal, ReplIssIC
} }
else else
{ {
errList.add( "ACTIVEPICK" ); errList.add( "VTACTREPLO" );
errFields.add( childNodeName.toLowerCase() ); errFields.add( childNodeName.toLowerCase() );
} }
} }
//Changed By Pragyan //Changed By Pragyan
//else if ( "repl_iss".equalsIgnoreCase(objName) && ! orderType.trim().equalsIgnoreCase("C") && ! orderType.trim().equalsIgnoreCase("M") && ! orderType.trim().equalsIgnoreCase("E") && ! orderType.trim().equalsIgnoreCase("F") && ! orderType.trim().equalsIgnoreCase("G") && ! orderType.trim().equalsIgnoreCase("H") && ! orderType.trim().equalsIgnoreCase("J") && ! orderType.trim().equalsIgnoreCase("K") && ! orderType.trim().equalsIgnoreCase("I") )//added by akhilesh on 23/jun/2012 put upper condition(orderType.trim().equalsIgnoreCase("I")) in this if //else if ( "repl_iss".equalsIgnoreCase(objName) && ! orderType.trim().equalsIgnoreCase("C") && ! orderType.trim().equalsIgnoreCase("M") && ! orderType.trim().equalsIgnoreCase("E") && ! orderType.trim().equalsIgnoreCase("F") && ! orderType.trim().equalsIgnoreCase("G") && ! orderType.trim().equalsIgnoreCase("H") && ! orderType.trim().equalsIgnoreCase("J") && ! orderType.trim().equalsIgnoreCase("K") && ! orderType.trim().equalsIgnoreCase("I") )//added by akhilesh on 23/jun/2012 put upper condition(orderType.trim().equalsIgnoreCase("I")) in this if
//Changed by Rohan on 05-09-12 for stock to dock replanishment //Changed by Rohan on 05-09-12 for stock to dock replanishment
else if ( "repl_iss".equalsIgnoreCase(objName) && ! orderType.trim().equalsIgnoreCase("C") && ! orderType.trim().equalsIgnoreCase("M") && ! orderType.trim().equalsIgnoreCase("E") && ! orderType.trim().equalsIgnoreCase("F") && ! orderType.trim().equalsIgnoreCase("G") && ! orderType.trim().equalsIgnoreCase("H") && ! orderType.trim().equalsIgnoreCase("J") && ! orderType.trim().equalsIgnoreCase("K") && ! orderType.trim().equalsIgnoreCase("I") && ! orderType.trim().equalsIgnoreCase("Q") && ! orderType.trim().equalsIgnoreCase("D") && ! orderType.trim().equalsIgnoreCase("L"))//added by akhilesh on 23/jun/2012 put upper condition(orderType.trim().equalsIgnoreCase("I")) in this if //else if ( "repl_iss".equalsIgnoreCase(objName) && ! orderType.trim().equalsIgnoreCase("C") && ! orderType.trim().equalsIgnoreCase("M") && ! orderType.trim().equalsIgnoreCase("E") && ! orderType.trim().equalsIgnoreCase("F") && ! orderType.trim().equalsIgnoreCase("G") && ! orderType.trim().equalsIgnoreCase("H") && ! orderType.trim().equalsIgnoreCase("J") && ! orderType.trim().equalsIgnoreCase("K") && ! orderType.trim().equalsIgnoreCase("I") && ! orderType.trim().equalsIgnoreCase("Q") && ! orderType.trim().equalsIgnoreCase("D") && ! orderType.trim().equalsIgnoreCase("L"))//added by akhilesh on 23/jun/2012 put upper condition(orderType.trim().equalsIgnoreCase("I")) in this if
else if ( "repl_iss".equalsIgnoreCase(objName) && ! orderType.trim().equalsIgnoreCase("C") && ! orderType.trim().equalsIgnoreCase("M") && ! orderType.trim().equalsIgnoreCase("E") && ! orderType.trim().equalsIgnoreCase("F") && ! orderType.trim().equalsIgnoreCase("G") && ! orderType.trim().equalsIgnoreCase("H") && ! orderType.trim().equalsIgnoreCase("J") && ! orderType.trim().equalsIgnoreCase("K") && ! orderType.trim().equalsIgnoreCase("I") && ! orderType.trim().equalsIgnoreCase("D") && ! orderType.trim().equalsIgnoreCase("L"))//added by akhilesh on 23/jun/2012 put upper condition(orderType.trim().equalsIgnoreCase("I")) in this if
{ {
/*System.out.println("equals ignores case"); /*System.out.println("equals ignores case");
errList.add( "CASEPICK" ); errList.add( "CASEPICK" );
...@@ -433,7 +434,7 @@ public class ReplIssIC extends ValidatorEJB implements ReplIssICLocal, ReplIssIC ...@@ -433,7 +434,7 @@ public class ReplIssIC extends ValidatorEJB implements ReplIssICLocal, ReplIssIC
else else
{ {
System.out.println("equals ignores case"); System.out.println("equals ignores case");
errList.add( "CASEPICK" ); errList.add( "VTCASREPLO" );
errFields.add( childNodeName.toLowerCase() ); errFields.add( childNodeName.toLowerCase() );
} }
} }
......
...@@ -302,7 +302,7 @@ public class ShipmentConf extends ActionHandlerEJB implements ShipmentConfLocal, ...@@ -302,7 +302,7 @@ public class ShipmentConf extends ActionHandlerEJB implements ShipmentConfLocal,
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }//if(("".equalsIgnoreCase(refSer.trim())) || ("D-ISS".equalsIgnoreCase(refSer.trim()) || "C-ISS".equalsIgnoreCase(refSer.trim()) || "P-RET".equalsIgnoreCase(refSer.trim()) ))
sql = "SELECT COUNT(*) as COUNT FROM SHIPMENT_CONTENT WHERE SHIPMENT_ID = ?"; sql = "SELECT COUNT(*) as COUNT FROM SHIPMENT_CONTENT WHERE SHIPMENT_ID = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
...@@ -3065,7 +3065,10 @@ public class ShipmentConf extends ActionHandlerEJB implements ShipmentConfLocal, ...@@ -3065,7 +3065,10 @@ public class ShipmentConf extends ActionHandlerEJB implements ShipmentConfLocal,
ResultSet rs = null; ResultSet rs = null;
//changed by sankara on 03/01/14 for update pro_no //changed by sankara on 03/01/14 for update pro_no
String shiprono = ""; String shiprono = "";
String adsiFlag = "N";
System.out.println(" sumit inside update shipment "); System.out.println(" sumit inside update shipment ");
try try
{ {
...@@ -3086,7 +3089,50 @@ public class ShipmentConf extends ActionHandlerEJB implements ShipmentConfLocal, ...@@ -3086,7 +3089,50 @@ public class ShipmentConf extends ActionHandlerEJB implements ShipmentConfLocal,
{ {
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
//changed by sankara on 03/01/14 for update pro_no end.
sql = "SELECT tran_name, PRONO_LAST , PRONO_FROM, PREFIX,ADSI_FLAG FROM transporter WHERE tran_code = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranCode);
rs = pstmt.executeQuery();
if( rs.next() )
{
descr = rs.getString(1);
descr1 = rs.getString(2);
prefix = rs.getString(4);
adsiFlag = rs.getString(5);
if(descr1 == null || descr1.trim().length() == 0)
{
descr1 = checkNull(rs.getString(3));
}
}
if( rs != null)
{
rs.close();
rs = null;
}
if( pstmt != null)
{
pstmt.close();
pstmt = null;
}
if("Y".equalsIgnoreCase(adsiFlag))
{
return 0;
}
if(descr1.trim().length() > 0)
{
pronoLast = Long.parseLong(descr1) + 1;
}
//changed by sankara on 03/01/14 for update pro_no start. //changed by sankara on 03/01/14 for update pro_no start.
sql = " SELECT PRO_NO FROM SHIPMENT WHERE SHIPMENT_ID = ? "; sql = " SELECT PRO_NO FROM SHIPMENT WHERE SHIPMENT_ID = ? ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
...@@ -3106,7 +3152,7 @@ public class ShipmentConf extends ActionHandlerEJB implements ShipmentConfLocal, ...@@ -3106,7 +3152,7 @@ public class ShipmentConf extends ActionHandlerEJB implements ShipmentConfLocal,
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
//changed by sankara on 03/01/14 for update pro_no end. /*//changed by sankara on 03/01/14 for update pro_no end.
sql = "SELECT tran_name, PRONO_LAST , PRONO_FROM, PREFIX FROM transporter WHERE tran_code = ? "; sql = "SELECT tran_name, PRONO_LAST , PRONO_FROM, PREFIX FROM transporter WHERE tran_code = ? ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranCode); pstmt.setString(1, tranCode);
...@@ -3136,7 +3182,7 @@ public class ShipmentConf extends ActionHandlerEJB implements ShipmentConfLocal, ...@@ -3136,7 +3182,7 @@ public class ShipmentConf extends ActionHandlerEJB implements ShipmentConfLocal,
{ {
pronoLast = Long.parseLong(descr1) + 1; pronoLast = Long.parseLong(descr1) + 1;
} }
// changed by sankara on 03/01/14 for update pro_no */ // changed by sankara on 03/01/14 for update pro_no
//if(pronoLast != 0) //if(pronoLast != 0)
//{ //{
//valueXmlString.append( "<lr_no><![CDATA[" ).append( pronoLast ).append( "]]></lr_no>\r\n" ); // commented to generate SSCC18 complaint number //valueXmlString.append( "<lr_no><![CDATA[" ).append( pronoLast ).append( "]]></lr_no>\r\n" ); // commented to generate SSCC18 complaint number
......
...@@ -2839,7 +2839,8 @@ public class WaveGenerationPrc extends ProcessEJB implements WaveGenerationPrcLo ...@@ -2839,7 +2839,8 @@ public class WaveGenerationPrc extends ProcessEJB implements WaveGenerationPrcLo
String invSt = ""; String invSt = "";
//Changed by Rohan on 7/6/12 To set Reason detai null.start //Changed by Rohan on 7/6/12 To set Reason detai null.start
String SqlSord = ""; String SqlSord = "";
PreparedStatement pstmtSord = null; PreparedStatement pstmtSord = null,pstmtMan = null,pstmtInv=null;
ResultSet rsMan = null,rsInv = null;
//Changed by Rohan on 7/6/12 To set Reason detai null.end //Changed by Rohan on 7/6/12 To set Reason detai null.end
double qtyAllocate = 0; double qtyAllocate = 0;
double noOfArticals = 0; double noOfArticals = 0;
...@@ -3928,7 +3929,7 @@ public class WaveGenerationPrc extends ProcessEJB implements WaveGenerationPrcLo ...@@ -3928,7 +3929,7 @@ public class WaveGenerationPrc extends ProcessEJB implements WaveGenerationPrcLo
if(rs.next()) if(rs.next())
{ {
waveFlag = rs.getString("WAVE_FLAG"); waveFlag = rs.getString("WAVE_FLAG");
if(waveFlag == null) /* if(waveFlag == null)
waveFlag = "N"; waveFlag = "N";
} }
if( rs != null) if( rs != null)
...@@ -3943,311 +3944,342 @@ public class WaveGenerationPrc extends ProcessEJB implements WaveGenerationPrcLo ...@@ -3943,311 +3944,342 @@ public class WaveGenerationPrc extends ProcessEJB implements WaveGenerationPrcLo
} }
System.out.print("Current Wave Flag ["+waveFlag+"]"); System.out.print("Current Wave Flag ["+waveFlag+"]");
if("N".equalsIgnoreCase(waveFlag)) */
{ waveFlag = waveFlag != null?waveFlag:"N";
manualStock = true;
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(rs != null)
{
rs.close();
rs = null;
}
sodreAlloc = "SELECT S.QTY_ALLOC AS QTY_ALLOC,S.QUANTITY AS QUANTITY,S.LOT_SL AS LOT_SL,S.LOT_NO AS LOT_NO,"+
" S.LOC_CODE AS LOC_CODE,I.LOC_TYPE__PARENT AS LOC_TYPE__PARENT,I.LOC_TYPE AS LOC_TYPE,I.LOC_ZONE__PREF " +
" AS LOC_ZONE__PREF FROM SORDALLOC S,ITEM I"+
" WHERE S.SALE_ORDER = ? AND S.ITEM_CODE = I.ITEM_CODE"+
" AND S.LINE_NO = ?"+
" AND S.ITEM_CODE = ?"+
" AND S.EXP_LEV = ? "+
" AND S.ALLOC_MODE <> ?";
pstmt = conn.prepareStatement(sodreAlloc);
pstmt.setString(1,saleOrder);
pstmt.setString(2, lineNo);
pstmt.setString(3,itemCode);
pstmt.setString(4,expLev);
pstmt.setString(5,"W");
rs = pstmt.executeQuery();
if(rs.next())
{
qtyAllocate = rs.getInt("QTY_ALLOC");
noOfArticals = rs.getInt("QUANTITY");
lotSl = rs.getString("LOT_SL");
lotNo = rs.getString("LOT_NO");
locCd = rs.getString("LOC_CODE");
locTypeParent = rs.getString("LOC_TYPE__PARENT");
locType = rs.getString("LOC_TYPE");
locZonePref = rs.getInt("LOC_ZONE__PREF");
System.out.println("lotSl===<"+lotSl);
System.out.println("lot_no===<"+lotNo);
System.out.println("locCd===<"+locCd);
System.out.println("locType===<"+locType);
System.out.println("locTypeParent===<"+locTypeParent);
}
sqlinvStat = "SELECT INV_STAT FROM LOCATION WHERE LOC_CODE= ?";
pstmt = conn.prepareStatement(sqlinvStat);
pstmt.setString(1,locCd);
rs = pstmt.executeQuery();
if(rs.next())
{
invSt= rs.getString("INV_STAT");
System.out.println("INV STATSSS"+invSt);
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(rs != null)
{
rs.close();
rs = null;
}
String resvInvStat = "";
resvInvStat = discommon.getDisparams("999999","RESERV_LOCATION",conn);
if (resvInvStat == null)
{
resvInvStat = "";
}
HashMap itmVolumeMap = getItemVoumeMap(itemCode,lotNo,conn);
double itemPackSize = (Double)itmVolumeMap.get("PACK_SIZE");
double stkQuantity = getStockQuantity(itemCode,siteCode,locCd,lotNo,lotSl,qtyAllocate,conn);
//changed by Pragyan to Mannualy Allocated Stock is on Hold.start
if(stkQuantity <= 0)
{
System.out.println(" Mannualy Allocated Stock is on Hold");
errString = getError(saleOrder + "] Line No ["+lineNo+"]Item Code["+itemCode+"]","VTMNSTKHLD",conn);
return errString;
}
//changed by Pragyan to Mannualy Allocated Stock is on Hold.end
populateReplHistory(itemCode,siteCode,lotNo,lotSl,locCd,conn);
Map tempMapReplenishment =new HashMap();
String lastReplenishmentID="",locCodeTo="";
int lineNoRepl=0;
if(itemInfoMapForRepl.containsKey(itemCode+":"+siteCode+":"+lotNo+":"+lotSl+":"+locCd))
{
ArrayList tempListTestForRepl = (ArrayList)itemInfoMapForRepl.get(itemCode+":"+siteCode+":"+lotNo+":"+lotSl+":"+locCd);
}
else
{
tempListForRepl = new ArrayList();
qtyActual=0.0;
stkQuantity = Math.floor(stkQuantity/itemPackSize) * itemPackSize;
tempMapReplenishment.put("QTY_ACTUAL", qtyActual);
tempMapReplenishment.put("LAST_REPL_ID", lastReplenishmentID);
tempMapReplenishment.put("REPL_LINE_NO", lineNoRepl);
tempMapReplenishment.put("REPL_LOC_TO",locCd);
tempMapReplenishment.put("IS_REPLAINSH","Y");
tempMapReplenishment.put("STOCK_QTY",stkQuantity);
tempListForRepl.add(tempMapReplenishment);
itemInfoMapForRepl.put(itemCode+":"+siteCode+":"+lotNo+":"+lotSl+":"+locCd, tempListForRepl);
}
perItemVolume = (Double)itmVolumeMap.get("ITEM_SIZE");
caseVolume = (Double)itmVolumeMap.get("LOT_SIZE");
caseWeight = (Double)itmVolumeMap.get("PACK_WEIGHT");
hazardous = (String)itmVolumeMap.get("HAZARDOUS");
itemWeight = (Double)itmVolumeMap.get("ITEM_WEIGHT");
caseCount = qtyAllocate /packSize;
if(invSt != null && invSt.trim().equalsIgnoreCase(resvInvStat.trim()))
{
double palletVolume = Double.parseDouble(discommon.getDisparams("999999","PER_PALLET__VOLUME",conn)); if("N".equalsIgnoreCase(waveFlag))
if(caseCount > 0 && (caseCount * caseVolume) <= palletVolume && ((palletVolume - (caseCount * caseVolume)) < caseVolume))
{
isStockToDock = true;
}
else if((qtyAllocate * perItemVolume) <= palletVolume && ((palletVolume - (qtyAllocate * perItemVolume)) < perItemVolume))
{
isStockToDock = true;
}
}
if(tempList != null)
{
System.out.println("Before Manual tempList["+tempList.size()+"]data["+tempList.toString()+"]");
}
if(saleOrderWiseMap.containsKey(saleOrder+":"+locTypeParent))
{
tempList = (ArrayList) saleOrderWiseMap.get(saleOrder+":"+locTypeParent);
}
else
{
tempList = new ArrayList();
}
tempMap = new HashMap();
tempMap.put("site_code", siteCode);
tempMap.put("item_code", itemCode);
tempMap.put("loc_code", locCd);
tempMap.put("lot_no", lotNo);
tempMap.put("lot_sl", lotSl);
tempMap.put("no_art", String.valueOf(noOfArticals));
tempMap.put("alloc_qty", qtyAllocate);
tempMap.put("inv_stat", invSt);
if(isStockToDock)
{
tempMap.put("stock2_dock", "Y");
}
else
{
tempMap.put("stock2_dock", "N");
}
tempMap.put("exp_lev", expLev);
tempMap.put("pack_size", itemPackSize);
tempMap.put("sord_lineNo", lineNo);
tempMap.put("loc_type", locType);
tempMap.put("loc_type_parent", locTypeParent);
tempMap.put("loc_zone_pref", locZonePref);
tempMap.put("master_pack", isMasterPickChecked);
tempMap.put("active_pick", isActivePickChecked);
tempMap.put("parcel_pick", isParcelPickChecked);
tempMap.put("ship_type", shipTypeLine);
tempMap.put("exp_lev", expLev);
tempMap.put("pack_size", packSize);
tempMap.put("sord_lineNo", lineNo);
tempMap.put("item_weight", itemWeight);
if(((invSt.trim().equalsIgnoreCase(resrvLoc) || invSt.trim().equalsIgnoreCase(deepStoreLoc)) && (qtyAllocate >= packSize)) || invSt.trim().equalsIgnoreCase(partialResrvLoc))
{
System.out.println("Inside For Creating Repelnishment packSizeActive:::::["+packSize+"]lotQtyToBeAllocated["+qtyAllocate+"]");
if(itemInfoMapForRepl.containsKey(itemCode+":"+siteCode+":"+lotNo+":"+lotSl+":"+locCode))
{ {
isStockToDock = false;
System.out.println("Replenishment str for ["+quantity+"]"); manualStock = true;
replHistStr = checkForReplenishment(itemCode, siteCode, lotNo, lotSl, locCode, qtyAllocate, 2, conn);
System.out.println("Replenishment str for this ["+replHistStr+"]");
StringTokenizer stReplQtyID = new StringTokenizer(replHistStr, ":");
while(stReplQtyID.hasMoreTokens()) /*if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(rs != null)
{ {
isRepl = stReplQtyID.nextToken(); rs.close();
if("Y".equalsIgnoreCase(isRepl)) rs = null;
}*/
sodreAlloc = "SELECT S.QTY_ALLOC AS QTY_ALLOC,S.QUANTITY AS QUANTITY,S.LOT_SL AS LOT_SL,S.LOT_NO AS LOT_NO,"+
" S.LOC_CODE AS LOC_CODE,I.LOC_TYPE__PARENT AS LOC_TYPE__PARENT,I.LOC_TYPE AS LOC_TYPE,I.LOC_ZONE__PREF " +
" AS LOC_ZONE__PREF FROM SORDALLOC S,ITEM I"+
" WHERE S.SALE_ORDER = ? AND S.ITEM_CODE = I.ITEM_CODE"+
" AND S.LINE_NO = ?"+
" AND S.ITEM_CODE = ?"+
" AND S.EXP_LEV = ? "+
" AND S.ALLOC_MODE <> ?";
pstmtMan = conn.prepareStatement(sodreAlloc);
pstmtMan.setString(1,saleOrder);
pstmtMan.setString(2, lineNo);
pstmtMan.setString(3,itemCode);
pstmtMan.setString(4,expLev);
pstmtMan.setString(5,"W");
rsMan = pstmtMan.executeQuery();
while(rsMan.next())
{
qtyAllocate = rsMan.getInt("QTY_ALLOC");
noOfArticals = rsMan.getInt("QUANTITY");
lotSl = rsMan.getString("LOT_SL");
lotNo = rsMan.getString("LOT_NO");
locCd = rsMan.getString("LOC_CODE");
locTypeParent = rsMan.getString("LOC_TYPE__PARENT");
locType = rsMan.getString("LOC_TYPE");
locZonePref = rsMan.getInt("LOC_ZONE__PREF");
System.out.println("lotSl===<"+lotSl);
System.out.println("lot_no===<"+lotNo);
System.out.println("locCd===<"+locCd);
System.out.println("locType===<"+locType);
System.out.println("locTypeParent===<"+locTypeParent);
//}
sqlinvStat = "SELECT INV_STAT FROM LOCATION WHERE LOC_CODE= ?";
pstmtInv = conn.prepareStatement(sqlinvStat);
pstmtInv.setString(1,locCd);
rsInv = pstmtInv.executeQuery();
if(rsInv.next())
{ {
replQuantity = stReplQtyID.nextToken(); invSt= rsInv.getString("INV_STAT");
System.out.println("INV STATSSS"+invSt);
} }
else if("N".equalsIgnoreCase(isRepl)) if(pstmtInv != null)
{ {
prvReplID = stReplQtyID.nextToken(); pstmtInv.close();
prvLocCodeTo = stReplQtyID.nextToken(); pstmtInv = null;
prvReplLineNo = Integer.parseInt(stReplQtyID.nextToken());
prvPickOrd = stReplQtyID.nextToken();
prvPickLineNo = Integer.parseInt(stReplQtyID.nextToken());
} }
} if(rsInv != null)
locCodeTo = prvLocCodeTo; {
rsInv.close();
if(locCodeTo == "" && locCodeTo.length() <= 0) rsInv = null;
{ }
System.out.println("Block for replenishment exist location blak ["+locCodeTo+"]"); String resvInvStat = "";
ArrayList tempItemInfoList = (ArrayList) itemInfoMapForRepl.get(itemCode+":"+siteCode+":"+lotNo+":"+lotSl+":"+locCode); resvInvStat = discommon.getDisparams("999999","RESERV_LOCATION",conn);
if (resvInvStat == null)
{
resvInvStat = "";
}
HashMap itmVolumeMap = getItemVoumeMap(itemCode,lotNo,conn);
double itemPackSize = (Double)itmVolumeMap.get("PACK_SIZE");
double stkQuantity = getStockQuantity(itemCode,siteCode,locCd,lotNo,lotSl,qtyAllocate,conn);
//changed by Pragyan to Mannualy Allocated Stock is on Hold.start
if(stkQuantity <= 0)
{
System.out.println(" Mannualy Allocated Stock is on Hold");
errString = getError(saleOrder + "] Line No ["+lineNo+"]Item Code["+itemCode+"]","VTMNSTKHLD",conn);
return errString;
}
//changed by Pragyan to Mannualy Allocated Stock is on Hold.end
populateReplHistory(itemCode,siteCode,lotNo,lotSl,locCd,conn);
Iterator itemIterator= tempItemInfoList.iterator(); Map tempMapReplenishment =new HashMap();
String lastReplenishmentID="",locCodeTo="";
int lineNoRepl=0;
while(itemIterator.hasNext()) if(itemInfoMapForRepl.containsKey(itemCode+":"+siteCode+":"+lotNo+":"+lotSl+":"+locCd))
{ {
HashMap itemSitemap = (HashMap)itemIterator.next(); ArrayList tempListTestForRepl = (ArrayList)itemInfoMapForRepl.get(itemCode+":"+siteCode+":"+lotNo+":"+lotSl+":"+locCd);
if(itemSitemap.containsKey("SUGG_LOC_TO"))
}
else
{
tempListForRepl = new ArrayList();
qtyActual=0.0;
stkQuantity = Math.floor(stkQuantity/itemPackSize) * itemPackSize;
tempMapReplenishment.put("QTY_ACTUAL", qtyActual);
tempMapReplenishment.put("LAST_REPL_ID", lastReplenishmentID);
tempMapReplenishment.put("REPL_LINE_NO", lineNoRepl);
tempMapReplenishment.put("REPL_LOC_TO",locCd);
tempMapReplenishment.put("IS_REPLAINSH","Y");
tempMapReplenishment.put("STOCK_QTY",stkQuantity);
tempListForRepl.add(tempMapReplenishment);
itemInfoMapForRepl.put(itemCode+":"+siteCode+":"+lotNo+":"+lotSl+":"+locCd, tempListForRepl);
}
perItemVolume = (Double)itmVolumeMap.get("ITEM_SIZE");
caseVolume = (Double)itmVolumeMap.get("LOT_SIZE");
caseWeight = (Double)itmVolumeMap.get("PACK_WEIGHT");
hazardous = (String)itmVolumeMap.get("HAZARDOUS");
itemWeight = (Double)itmVolumeMap.get("ITEM_WEIGHT");
caseCount = qtyAllocate /packSize;
if(invSt != null && invSt.trim().equalsIgnoreCase(resvInvStat.trim()))
{
double palletVolume = Double.parseDouble(discommon.getDisparams("999999","PER_PALLET__VOLUME",conn));
if(caseCount > 0 && (caseCount * caseVolume) <= palletVolume && ((palletVolume - (caseCount * caseVolume)) < caseVolume))
{
isStockToDock = true;
}
else if((qtyAllocate * perItemVolume) <= palletVolume && ((palletVolume - (qtyAllocate * perItemVolume)) < perItemVolume))
{ {
locCodeTo= (String)itemSitemap.get("SUGG_LOC_TO"); isStockToDock = true;
System.out.println("Suggested Location code For current wave ["+locCodeTo+"]");
} }
} }
if(tempList != null)
{
System.out.println("Before Manual tempList["+tempList.size()+"]data["+tempList.toString()+"]");
}
if(saleOrderWiseMap.containsKey(saleOrder+":"+locTypeParent))
{
tempList = (ArrayList) saleOrderWiseMap.get(saleOrder+":"+locTypeParent);
}
else
{
tempList = new ArrayList();
}
tempMap = new HashMap();
tempMap.put("site_code", siteCode);
tempMap.put("item_code", itemCode);
tempMap.put("loc_code", locCd);
tempMap.put("lot_no", lotNo);
tempMap.put("lot_sl", lotSl);
tempMap.put("no_art", String.valueOf(noOfArticals));
tempMap.put("alloc_qty", qtyAllocate);
tempMap.put("inv_stat", invSt);
if(isStockToDock)
{
tempMap.put("stock2_dock", "Y");
}
else
{
tempMap.put("stock2_dock", "N");
}
tempMap.put("exp_lev", expLev);
tempMap.put("pack_size", itemPackSize);
tempMap.put("sord_lineNo", lineNo);
tempMap.put("loc_type", locType);
tempMap.put("loc_type_parent", locTypeParent);
tempMap.put("loc_zone_pref", locZonePref);
tempMap.put("master_pack", isMasterPickChecked);
tempMap.put("active_pick", isActivePickChecked);
tempMap.put("parcel_pick", isParcelPickChecked);
tempMap.put("ship_type", shipTypeLine);
tempMap.put("exp_lev", expLev);
tempMap.put("pack_size", packSize);
tempMap.put("sord_lineNo", lineNo);
tempMap.put("item_weight", itemWeight);
if(((invSt.trim().equalsIgnoreCase(resrvLoc) || invSt.trim().equalsIgnoreCase(deepStoreLoc)) && (qtyAllocate >= packSize)) || invSt.trim().equalsIgnoreCase(partialResrvLoc))
{
System.out.println("Inside For Creating Repelnishment packSizeActive:::::["+packSize+"]lotQtyToBeAllocated["+qtyAllocate+"]");
if(itemInfoMapForRepl.containsKey(itemCode+":"+siteCode+":"+lotNo+":"+lotSl+":"+locCode))
{
isStockToDock = false;
System.out.println("Replenishment str for ["+quantity+"]");
replHistStr = checkForReplenishment(itemCode, siteCode, lotNo, lotSl, locCode, qtyAllocate, 2, conn);
System.out.println("Replenishment str for this ["+replHistStr+"]");
StringTokenizer stReplQtyID = new StringTokenizer(replHistStr, ":");
while(stReplQtyID.hasMoreTokens())
{
isRepl = stReplQtyID.nextToken();
if("Y".equalsIgnoreCase(isRepl))
{
replQuantity = stReplQtyID.nextToken();
}
else if("N".equalsIgnoreCase(isRepl))
{
prvReplID = stReplQtyID.nextToken();
prvLocCodeTo = stReplQtyID.nextToken();
prvReplLineNo = Integer.parseInt(stReplQtyID.nextToken());
prvPickOrd = stReplQtyID.nextToken();
prvPickLineNo = Integer.parseInt(stReplQtyID.nextToken());
}
}
locCodeTo = prvLocCodeTo;
if(locCodeTo == "" && locCodeTo.length() <= 0)
{
System.out.println("Block for replenishment exist location blak ["+locCodeTo+"]");
ArrayList tempItemInfoList = (ArrayList) itemInfoMapForRepl.get(itemCode+":"+siteCode+":"+lotNo+":"+lotSl+":"+locCode);
Iterator itemIterator= tempItemInfoList.iterator();
while(itemIterator.hasNext())
{
HashMap itemSitemap = (HashMap)itemIterator.next();
if(itemSitemap.containsKey("SUGG_LOC_TO"))
{
locCodeTo= (String)itemSitemap.get("SUGG_LOC_TO");
System.out.println("Suggested Location code For current wave ["+locCodeTo+"]");
}
}
}
System.out.println("Location Code To Found as Replenishment Exist ["+locCodeTo+"]");
}
else
{
System.out.println("prevsLocCode ["+prevsLocCode+"]");
System.out.println("Location Code To Found To Create Replenishment Before ["+locCodeTo+"]");
if(!isStockToDock)
{
ArrayList locCodeToList = getAvilableCasePickLocationList("C", conn, locType,locZonePref,locCode,itemCode,siteCode,lotNo,lotSl);
int suggestLocLen = locCodeToList.size();
if( suggestLocLen > 0)
{
int prvLocIndex = locCodeToList.indexOf(prevsLocCode);
if( prvLocIndex != -1 && (prvLocIndex + 1) < suggestLocLen)
{
locCodeTo = (String)locCodeToList.get((prvLocIndex + 1));
System.out.println("Inside prevsLocCode1 ["+locCodeTo+"]");
}
else
{
locCodeTo = (String)locCodeToList.get(0);
System.out.println("Inside prevsLocCode2 ["+locCodeTo+"]");
}
}
prevsLocCode = locCodeTo;
}
System.out.println("Location Code To Found To Create Replenishment After ["+locCodeTo+"]");
}
}
locCodeTo = locCodeTo != null && locCodeTo.length() > 0 ?locCodeTo:locCd;
System.out.println("Finally Loc Code["+locCode+"]Loc Code To["+locCodeTo+"]");
tempMap.put("sugg_loc", locCodeTo);
tempMap.put("hazard", hazardous);
tempList.add(tempMap);
System.out.println("Sale Order and Size Manuall allocate ["+saleOrder+"]line no ["+lineNo+"]["+itemCode+"qtyAllocate["+qtyAllocate+"]");
System.out.println("tempList["+tempList.size()+"]data["+tempList.toString()+"]");
saleOrderWiseMap.put(saleOrder+":"+locTypeParent,tempList);
} }
System.out.println("Location Code To Found as Replenishment Exist ["+locCodeTo+"]");
}
else }//if(rs.next())
{
if( rsMan != null)
System.out.println("prevsLocCode ["+prevsLocCode+"]"); {
System.out.println("Location Code To Found To Create Replenishment Before ["+locCodeTo+"]"); rsMan.close();
if(!isStockToDock) rsMan = null;
{ }
if( pstmtMan != null)
ArrayList locCodeToList = getAvilableCasePickLocationList("C", conn, locType,locZonePref,locCode,itemCode,siteCode,lotNo,lotSl); {
pstmtMan.close();
int suggestLocLen = locCodeToList.size(); pstmtMan = null;
if( suggestLocLen > 0) }
{
int prvLocIndex = locCodeToList.indexOf(prevsLocCode); if(manualStock)
if( prvLocIndex != -1 && (prvLocIndex + 1) < suggestLocLen) {
{ int update = 0;
locCodeTo = (String)locCodeToList.get((prvLocIndex + 1)); sql= "UPDATE SORDALLOC SET WAVE_FLAG = 'Y' WHERE SALE_ORDER = ? AND LINE_NO = ?";
System.out.println("Inside prevsLocCode1 ["+locCodeTo+"]"); pstmtInv = conn.prepareStatement(sql);
} pstmtInv.setString(1, saleOrder);
else pstmtInv.setString(2, lineNoSord);
{ update = pstmtInv.executeUpdate();
locCodeTo = (String)locCodeToList.get(0); if(update > 0)
System.out.println("Inside prevsLocCode2 ["+locCodeTo+"]"); {
} System.out.println(" SORD_ALLOC updated ["+update+"]");
} }
if( pstmtInv!= null)
prevsLocCode = locCodeTo; {
} pstmtInv.close();
pstmtInv = null;
System.out.println("Location Code To Found To Create Replenishment After ["+locCodeTo+"]"); }
} }
}
locCodeTo = locCodeTo != null && locCodeTo.length() > 0 ?locCodeTo:locCd;
System.out.println("Finally Loc Code["+locCode+"]Loc Code To["+locCodeTo+"]");
tempMap.put("sugg_loc", locCodeTo);
tempMap.put("hazard", hazardous);
tempList.add(tempMap);
System.out.println("Sale Order and Size Manuall allocate ["+saleOrder+"]line no ["+lineNo+"]["+itemCode+"qtyAllocate["+qtyAllocate+"]");
System.out.println("tempList["+tempList.size()+"]data["+tempList.toString()+"]");
saleOrderWiseMap.put(saleOrder+":"+locTypeParent,tempList);
} }
if(manualStock) if( rs != null)
{ {
int update = 0; rs.close();
sql= "UPDATE SORDALLOC SET WAVE_FLAG = 'Y' WHERE SALE_ORDER = ? AND LINE_NO = ?"; rs = null;
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, saleOrder);
pstmt.setString(2, lineNoSord);
update = pstmt.executeUpdate();
if(update > 0)
{
System.out.println(" SORD_ALLOC updated ["+update+"]");
}
if( pstmt!= null)
{
pstmt.close();
pstmt = null;
}
} }
if( pstmt != null)
{
pstmt.close();
pstmt = null;
}
System.out.print("Current Wave Flag ["+waveFlag+"]");
if(allocQty > 0) if(allocQty > 0)
{ {
......
...@@ -44991,4 +44991,64 @@ commit; ...@@ -44991,4 +44991,64 @@ commit;
'Base ', 'Base ',
NULL, NULL,
NULL); NULL);
commit; commit;
\ No newline at end of file -- changed by sankara on 20/01/2014 update messages sql given by pragyan.
INSERT INTO messages (
msg_no ,
msg_str ,
msg_descr ,
msg_type ,
msg_opt ,
msg_time ,
alarm ,
err_source ,
chg_date ,
chg_user ,
chg_term ,
override_input ,
mail_option )
VALUES (
'VTACTREPLO',
'Invalid Replineshment Order',
'Entered Replenishment order is not an Active Replenishment Order',
'E',
'Y',
NULL,
NULL,
NULL,
fn_sysdate(),
'Base ',
'Base ',
NULL,
NULL);
INSERT INTO messages (
msg_no ,
msg_str ,
msg_descr ,
msg_type ,
msg_opt ,
msg_time ,
alarm ,
err_source ,
chg_date ,
chg_user ,
chg_term ,
override_input ,
mail_option )
VALUES (
'VTCASREPLO',
'Invalid Replenishment Order',
'Entered Replenishment order is an Active Replenishment Order',
'E',
'Y',
NULL,
NULL,
NULL,
fn_sysdate(),
'Base ',
'Base ',
NULL,
NULL);
commit;
\ No newline at end of file
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