Commit f02a7a2d authored by prane's avatar prane

To handle exception/error enancement

-Default value to be set wrong or undefined values of master
-Static variables to be on lefthand side

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@214740 ce508802-f39f-4f6c-b175-0d175dae99d5
parent a884d22e
...@@ -69,6 +69,8 @@ public class ExplodeBom ...@@ -69,6 +69,8 @@ public class ExplodeBom
double batchQty = 0; double batchQty = 0;
double roundTo = 0; double roundTo = 0;
char round; char round;
String roundStr= "";
String roundToStr= "";
String suppCodeMfg= "",useInvStatus = "",mfgRef = "",dimension = ""; String suppCodeMfg= "",useInvStatus = "",mfgRef = "",dimension = "";
double minReqQty = 0; double minReqQty = 0;
...@@ -201,8 +203,24 @@ public class ExplodeBom ...@@ -201,8 +203,24 @@ public class ExplodeBom
minQty = rs.getDouble(7); minQty = rs.getDouble(7);
operation = rs.getInt(8); operation = rs.getInt(8);
critItem = rs.getString(9); critItem = rs.getString(9);
round = rs.getString(10).charAt(0); /**Modified by Pavan Rane 24dec19 start[system should take default value and to not give error in any definition not found.]*/
roundTo = rs.getDouble(11); //round = rs.getString(10).charAt(0);
//roundTo = rs.getDouble(11);
roundStr = rs.getString(10);
if (roundStr == null || roundStr.trim().length() == 0 || "null".equalsIgnoreCase(roundStr))
{
round = 'N';
}else {
round = roundStr.charAt(0);
}
roundToStr = rs.getString(11);
if (roundToStr == null || roundToStr.trim().length() == 0 || "null".equalsIgnoreCase(roundToStr))
{
roundTo = 0;
}else {
roundTo = rs.getDouble(11);
}
/**Modified by Pavan Rane 24dec19 end[system should take default value and to not give error in any definition not found.]*/
//added field by rajendra on 14/06/07 //added field by rajendra on 14/06/07
matchPotency = rs.getString(12); matchPotency = rs.getString(12);
minPotencyPerc = rs.getDouble(13); minPotencyPerc = rs.getDouble(13);
...@@ -313,17 +331,18 @@ public class ExplodeBom ...@@ -313,17 +331,18 @@ public class ExplodeBom
//end by rajendra //end by rajendra
//System.out.println("Item Code : " + itemCodeBomDet + "Item Ref : " + itemRef + " Line Type " + lineType); //System.out.println("Item Code : " + itemCodeBomDet + "Item Ref : " + itemRef + " Line Type " + lineType);
if (lineType.equals("B")) //if (lineType.equals("B"))
{ if ("B".equals(lineType))
if (reqType.equals("S")) {
if ("S".equals(reqType))//if (reqType.equals("S"))
{ {
quantityUpdate = (quantity / batchQty) * perQty; quantityUpdate = (quantity / batchQty) * perQty;
} }
else if (reqType.equals("P")) else if ("P".equals(reqType))//else if (reqType.equals("P"))
{ {
quantityUpdate = (perQty / batchQty) * quantity; quantityUpdate = (perQty / batchQty) * quantity;
} }
else if (reqType.equals("F")) else if ("F".equals(reqType))//else if (reqType.equals("F"))
{ {
quantityUpdate = perQty; quantityUpdate = perQty;
} }
...@@ -443,7 +462,7 @@ public class ExplodeBom ...@@ -443,7 +462,7 @@ public class ExplodeBom
{ {
lineTypeInner = rsInner.getString(1); lineTypeInner = rsInner.getString(1);
if (!lineTypeInner.equals("F")) if (!"F".equals(lineTypeInner))
{ {
lineTypeInner = "I"; lineTypeInner = "I";
} }
...@@ -596,7 +615,7 @@ public class ExplodeBom ...@@ -596,7 +615,7 @@ public class ExplodeBom
valueXmlString.append("</Detail>"); valueXmlString.append("</Detail>");
//Changed by Dadaso pawar on 08/09/15 [End] [D15GSUN002] //Changed by Dadaso pawar on 08/09/15 [End] [D15GSUN002]
if ( lineTypeInner.equals("B") ) if ( "B".equals(lineTypeInner) )
{ {
// 22/06/10 manoharan mfg_lead_time to be calculated as per batch size // 22/06/10 manoharan mfg_lead_time to be calculated as per batch size
// 22/06/10 manoharan to calculate due_date based on batch size // 22/06/10 manoharan to calculate due_date based on batch size
...@@ -752,5 +771,8 @@ public class ExplodeBom ...@@ -752,5 +771,8 @@ public class ExplodeBom
//nf.setMaximumIntegerDigits(10); //nf.setMaximumIntegerDigits(10);
return nf.format(num); return nf.format(num);
} }
private String checkNull(String value)
{
return E12GenericUtility.checkNull(value);
}
} }
\ No newline at end of file
...@@ -369,7 +369,7 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -369,7 +369,7 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
{ {
errString = ""; errString = "";
String resultString = "",windowName1="",bomCodeParent= "",bomLevelStr=""; String resultString = "",windowName1="",bomCodeParent= "",bomLevelStr="";
ResultSet rs = null; //ResultSet rs = null;
this.wnName=windowName; this.wnName=windowName;
long endTime = 0, totalTime = 0, totalHrs = 0, totlMts = 0, totSecs = 0; // Added long endTime = 0, totalTime = 0, totalHrs = 0, totlMts = 0, totSecs = 0; // Added
...@@ -749,7 +749,7 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -749,7 +749,7 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
if(!( isBomReplace)) // added by cpatil on 17/05/14 for BomReplace if(!( isBomReplace)) // added by cpatil on 17/05/14 for BomReplace
{ {
if (matPlan.equals("Y")) if ("Y".equals(matPlan))//if (matPlan.equals("Y"))
{ {
BaseLogger.log("2", null, null, "populateAllItem() calling........."); BaseLogger.log("2", null, null, "populateAllItem() calling.........");
errString = populateAllItem(); errString = populateAllItem();
...@@ -897,7 +897,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -897,7 +897,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
BaseLogger.log("0", null, null, "Error While Populating ADPEList:..." + errString); BaseLogger.log("0", null, null, "Error While Populating ADPEList:..." + errString);
return errString; return errString;
} }
if (disPlan.equals("Y") && balIntersite.equals("Y")) //if (disPlan.equals("Y") && balIntersite.equals("Y"))
if ("Y".equals(disPlan) && "Y".equals(balIntersite))
{ {
errString = populateInterSiteDistance(); errString = populateInterSiteDistance();
if (errString != null && errString.trim().length() > 0) if (errString != null && errString.trim().length() > 0)
...@@ -965,7 +966,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -965,7 +966,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
// 31/01/2008 manoharan not to insert plan demand in case of // 31/01/2008 manoharan not to insert plan demand in case of
// verification // verification
BaseLogger.log("3", null, null," verifier["+verifier+"]"); BaseLogger.log("3", null, null," verifier["+verifier+"]");
if (verifier != null && verifier.equalsIgnoreCase("N")) //if (verifier != null && verifier.equalsIgnoreCase("N"))
if (verifier != null && "N".equalsIgnoreCase(verifier))
{ {
//Condition added by Manoj dtd 01/01/2013 //Condition added by Manoj dtd 01/01/2013
//if(!isDetailReq) //if(!isDetailReq)
...@@ -994,17 +996,18 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -994,17 +996,18 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
int noOfPlan = 0; int noOfPlan = 0;
//Statement stmt = null; //Statement stmt = null;
PreparedStatement pstmtDet = null; PreparedStatement pstmtDet = null;
if (matPlan.equalsIgnoreCase("Y") && (mfgPlan.equalsIgnoreCase("Y")) && (disPlan.equalsIgnoreCase("Y"))) //if (matPlan.equalsIgnoreCase("Y") && (mfgPlan.equalsIgnoreCase("Y")) && (disPlan.equalsIgnoreCase("Y")))
if ("Y".equalsIgnoreCase(matPlan) && ("Y".equalsIgnoreCase(mfgPlan)) && ("Y".equalsIgnoreCase(disPlan)))
{ {
lsWhere = ""; lsWhere = "";
} else } else
{ {
if (mfgPlan.equalsIgnoreCase("Y")) if ("Y".equalsIgnoreCase(mfgPlan))//if (mfgPlan.equalsIgnoreCase("Y"))
{ {
lsWhere = lsWhere + "'M'"; lsWhere = lsWhere + "'M'";
noOfPlan = noOfPlan + 1; noOfPlan = noOfPlan + 1;
} }
if (disPlan.equalsIgnoreCase("Y")) if ("Y".equalsIgnoreCase(disPlan))//if (disPlan.equalsIgnoreCase("Y"))
{ {
if (noOfPlan == 0) if (noOfPlan == 0)
{ {
...@@ -1015,7 +1018,7 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -1015,7 +1018,7 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
} }
noOfPlan = noOfPlan + 1; noOfPlan = noOfPlan + 1;
} }
if (matPlan.equalsIgnoreCase("Y")) if ("Y".equalsIgnoreCase(matPlan))//if (matPlan.equalsIgnoreCase("Y"))
{ {
if (noOfPlan == 0) if (noOfPlan == 0)
{ {
...@@ -1182,7 +1185,7 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -1182,7 +1185,7 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
errStringXml.append(bifurErrString); errStringXml.append(bifurErrString);
errString = ""; errString = "";
} }
if (errorType.equalsIgnoreCase("E")) { if ("E".equalsIgnoreCase(errorType)) {
break; break;
} }
} }
...@@ -1742,7 +1745,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -1742,7 +1745,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
childNode = childNodeList.item(ctr); childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName(); childNodeName = childNode.getNodeName();
//System.out.println("check childNodeName for bom_level:"+childNodeName); //System.out.println("check childNodeName for bom_level:"+childNodeName);
if (childNodeName.equalsIgnoreCase("bom_level")) //if (childNodeName.equalsIgnoreCase("bom_level"))
if ("bom_level".equalsIgnoreCase(childNodeName))
{ {
bomLevelStr = genericUtility.getColumnValue("bom_level", dom); bomLevelStr = genericUtility.getColumnValue("bom_level", dom);
//System.out.println(">>>>>>>In val getData bomLevelStr:"+bomLevelStr); //System.out.println(">>>>>>>In val getData bomLevelStr:"+bomLevelStr);
...@@ -1834,7 +1838,7 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -1834,7 +1838,7 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
{ {
//stmt = conn.createStatement(); //stmt = conn.createStatement();
standingOrdTypes = itmDBAccessEJB.getEnvDis("999999", "STANDING_ORDTYPES", conn); standingOrdTypes = itmDBAccessEJB.getEnvDis("999999", "STANDING_ORDTYPES", conn);
if (standingOrdTypes.equals("NULLFOUND")) if ("NULLFOUND".equals(standingOrdTypes))//if (standingOrdTypes.equals("NULLFOUND"))
{ {
standingOrdTypes = ""; standingOrdTypes = "";
} }
...@@ -1885,7 +1889,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -1885,7 +1889,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
} }
rs.close();rs = null; rs.close();rs = null;
pstmt.close(); pstmt = null; pstmt.close(); pstmt = null;
if (expediateDaysString.equals("NULLFOUND") || expediateDaysString == null) //if (expediateDaysString.equals("NULLFOUND") || expediateDaysString == null)
if (expediateDaysString == null || "NULLFOUND".equals(expediateDaysString) || "null".equals(expediateDaysString))
{ {
expediateDaysString = "0"; expediateDaysString = "0";
} }
...@@ -1914,7 +1919,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -1914,7 +1919,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
BaseLogger.log("3", null, null,"mrpTrackTranId:..............." + mrpTrackTranId); BaseLogger.log("3", null, null,"mrpTrackTranId:..............." + mrpTrackTranId);
mrpClubbingHorizonString = itmDBAccessEJB.getEnvDis("999999", "MRP_CLUBBING_HORIZON", conn); mrpClubbingHorizonString = itmDBAccessEJB.getEnvDis("999999", "MRP_CLUBBING_HORIZON", conn);
if (mrpClubbingHorizonString.equals("NULLFOUND")) //if (mrpClubbingHorizonString.equals("NULLFOUND"))
if (mrpClubbingHorizonString == null || "NULLFOUND".equals(mrpClubbingHorizonString) || "null".equals(mrpClubbingHorizonString))
{ {
MrpClubbingHorizon = 0; MrpClubbingHorizon = 0;
} else } else
...@@ -1930,22 +1936,26 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -1930,22 +1936,26 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
BaseLogger.log("3", null, null,"MrpClubbingHorizon:..........." + MrpClubbingHorizon); BaseLogger.log("3", null, null,"MrpClubbingHorizon:..........." + MrpClubbingHorizon);
mrpDynMinStk = itmDBAccessEJB.getEnvDis("999999", "MRP_DYN_MIN_STK", conn); mrpDynMinStk = itmDBAccessEJB.getEnvDis("999999", "MRP_DYN_MIN_STK", conn);
if (mrpDynMinStk.equals("NULLFOUND")) //if (mrpDynMinStk.equals("NULLFOUND"))
if ("NULLFOUND".equals(mrpDynMinStk))
mrpDynMinStk = "N"; mrpDynMinStk = "N";
BaseLogger.log("3", null, null,"mrpDynMinStk:................." + mrpDynMinStk); BaseLogger.log("3", null, null,"mrpDynMinStk:................." + mrpDynMinStk);
roundReqTo = itmDBAccessEJB.getEnvDis("999999", "ROUND_REQ_TO", conn); roundReqTo = itmDBAccessEJB.getEnvDis("999999", "ROUND_REQ_TO", conn);
if (roundReqTo.equals("NULLFOUND")) //if (roundReqTo.equals("NULLFOUND"))
if ("NULLFOUND".equals(roundReqTo))
roundReqTo = "N"; roundReqTo = "N";
BaseLogger.log("3", null, null,"roundReqTo:................." + roundReqTo); BaseLogger.log("3", null, null,"roundReqTo:................." + roundReqTo);
minOrderChk = itmDBAccessEJB.getEnvDis("999999", "MIN_ORDER_CHK", conn); minOrderChk = itmDBAccessEJB.getEnvDis("999999", "MIN_ORDER_CHK", conn);
if (minOrderChk.equals("NULLFOUND")) //if (minOrderChk.equals("NULLFOUND"))
if ("NULLFOUND".equals(minOrderChk))
minOrderChk = "N"; minOrderChk = "N";
BaseLogger.log("3", null, null,"minOrderChk:................." + minOrderChk); BaseLogger.log("3", null, null,"minOrderChk:................." + minOrderChk);
deptCodeMfg = itmDBAccessEJB.getEnvDis("999999", "DEPT_CODE_MFG", conn); deptCodeMfg = itmDBAccessEJB.getEnvDis("999999", "DEPT_CODE_MFG", conn);
if (deptCodeMfg.equals("NULLFOUND")) //if (deptCodeMfg.equals("NULLFOUND"))
if ("NULLFOUND".equals(deptCodeMfg))
{ {
if("Y".equalsIgnoreCase(verifier)) //for error_report @19/09/16 if("Y".equalsIgnoreCase(verifier)) //for error_report @19/09/16
{ {
...@@ -2309,8 +2319,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -2309,8 +2319,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
//if(masterSh.equalsIgnoreCase("Y")) //if(masterSh.equalsIgnoreCase("Y"))
//{ //{
/**if(madeToStock.equalsIgnoreCase("0") && (!(mfgType1.trim().equalsIgnoreCase("O") || mfgType1.trim().equalsIgnoreCase("D"))))*/ /**if(madeToStock.equalsIgnoreCase("0") && (!(mfgType1.trim().equalsIgnoreCase("O") || mfgType1.trim().equalsIgnoreCase("D"))))*/
if(madeToStock.equalsIgnoreCase("0"))//Pavan R 22Jan2019[to get item having demand on sitemap loop] if("0".equalsIgnoreCase(madeToStock))//if(madeToStock.equalsIgnoreCase("0"))//Pavan R 22Jan2019[to get item having demand on sitemap loop]
{ {
//sqlFileName = CommonConstants.JBOSSHOME + File.separator + "sql" + File.separator + "demandsupplyMS"; //sqlFileName = CommonConstants.JBOSSHOME + File.separator + "sql" + File.separator + "demandsupplyMS";
//System.out.println("BASEsqlFileName---"+sqlFileName); //System.out.println("BASEsqlFileName---"+sqlFileName);
//BaseLogger.log( "0", null, null, "BASEsqlFileName---"+sqlFileName); //BaseLogger.log( "0", null, null, "BASEsqlFileName---"+sqlFileName);
...@@ -2352,7 +2362,7 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -2352,7 +2362,7 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
pstmt1 = null; pstmt1 = null;
} }
//if(madeToOrder.equalsIgnoreCase("0") && (mfgType1.trim().equalsIgnoreCase("O") || mfgType1.trim().equalsIgnoreCase("D"))) //if(madeToOrder.equalsIgnoreCase("0") && (mfgType1.trim().equalsIgnoreCase("O") || mfgType1.trim().equalsIgnoreCase("D")))
if(madeToOrder.equalsIgnoreCase("0")) //Pavan R 22Jan2019[to get item having demand on sitemap loop] if("0".equalsIgnoreCase(madeToOrder))//if(madeToOrder.equalsIgnoreCase("0")) //Pavan R 22Jan2019[to get item having demand on sitemap loop]
{ {
//sqlFileName = CommonConstants.JBOSSHOME + File.separator + "sql" + File.separator + "madeToOrderMO"; //sqlFileName = CommonConstants.JBOSSHOME + File.separator + "sql" + File.separator + "madeToOrderMO";
//System.out.println("BASEsqlFileName---"+sqlFileName); //System.out.println("BASEsqlFileName---"+sqlFileName);
...@@ -2498,10 +2508,10 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -2498,10 +2508,10 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
while (itrSite.hasNext()) while (itrSite.hasNext())
{ {
Map.Entry siteMapEntry = (Map.Entry) itrSite.next(); Map.Entry siteMapEntry = (Map.Entry) itrSite.next();
if (isBomReplace) /*if (isBomReplace)
{ {
//System.out.println("12/06/14 manohar itemArr.size() [" + itemArr.size() + "]"); //System.out.println("12/06/14 manohar itemArr.size() [" + itemArr.size() + "]");
} }*/
rowCount++; rowCount++;
// (String)siteMapEntry.getKey()); // (String)siteMapEntry.getKey());
int ctr; int ctr;
...@@ -2512,14 +2522,27 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -2512,14 +2522,27 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
siteCode = (String) siteMapEntry.getKey(); //Piyush siteCode = (String) siteMapEntry.getKey(); //Piyush
//System.out.println("(String)itemArr.get(ctr)--" + (String) itemArr.get(ctr)); //System.out.println("(String)itemArr.get(ctr)--" + (String) itemArr.get(ctr));
//suppSour = getSuppSour((String) siteMapEntry.getKey(), (String) itemArr.get(ctr)); //suppSour = getSuppSour((String) siteMapEntry.getKey(), (String) itemArr.get(ctr));
suppSour = getSuppSour(siteCode, itemCode); // Piyush suppSour = getSuppSour(siteCode, itemCode); // Piyush
suppSour = suppSour.trim(); //Pavan Rane 20DEC19 start[to validate master data for mrp report]
if (suppSour == null || "null".equalsIgnoreCase(suppSour) || suppSour.trim().length() == 0)
{
if("Y".equalsIgnoreCase(verifier))
{
msgStr = "Supplier source is blank for Item Code:"+itemCode+" Site Code:"+siteCode+" in Item master";
mrpErrDetList.add(msgStr);
}
}
else {
suppSour = suppSour.trim();
}
//Pavan Rane 20DEC19 end[to validate master data for mrp report]
//bomCode = getBomCode((String) siteMapEntry.getKey(), (String) itemArr.get(ctr)); //bomCode = getBomCode((String) siteMapEntry.getKey(), (String) itemArr.get(ctr));
bomCode = getBomCode(siteCode, itemCode); // Piyush bomCode = getBomCode(siteCode, itemCode); // Piyush
//System.out.println("SuppSour---" + suppSour + "bomCode--" + bomCode); //System.out.println("SuppSour---" + suppSour + "bomCode--" + bomCode);
// System.out.println("populateAllItem(): Supp_Sour:..." + // System.out.println("populateAllItem(): Supp_Sour:..." +
// suppSour + " Bom Code:..." + bomCode); // suppSour + " Bom Code:..." + bomCode);
if (((suppSour != null) && (!suppSour.equals("P"))) && (bomCode != null)) //if (((suppSour != null) && (!suppSour.equals("P"))) && (bomCode != null))
if (((suppSour != null) && (!"P".equals(suppSour))) && (bomCode != null))
{ {
Set levelBom = new HashSet(); Set levelBom = new HashSet();
level = 1; level = 1;
...@@ -2625,14 +2648,14 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -2625,14 +2648,14 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
pstmtValidBom.close(); pstmtValidBom.close();
pstmtValidBom = null; pstmtValidBom = null;
// this.fwInvalidBom.write("Site Code Item Code Bom Code Message\r\n"); // this.fwInvalidBom.write("Site Code Item Code Bom Code Message\r\n");
if (confirmedBom == null || confirmedBom.trim().length() == 0 || confirmedBom.equalsIgnoreCase("N") || activeBom == null || activeBom.trim().length() == 0 || activeBom.equalsIgnoreCase("N")) if (confirmedBom == null || confirmedBom.trim().length() == 0 || "N".equalsIgnoreCase(confirmedBom) || activeBom == null || activeBom.trim().length() == 0 || "N".equalsIgnoreCase(activeBom))
{ {
siteCode = (siteCode.trim() + " ").substring(0, 5); siteCode = (siteCode.trim() + " ").substring(0, 5);
validBomItemCode = (validBomItemCode.trim() + " ").substring(0, 10); validBomItemCode = (validBomItemCode.trim() + " ").substring(0, 10);
bomCode = (bomCode.trim() + " ").substring(0, 10); bomCode = (bomCode.trim() + " ").substring(0, 10);
logMsg = siteCode + " " + validBomItemCode + " " + bomCode + " "; logMsg = siteCode + " " + validBomItemCode + " " + bomCode + " ";
// ========= ========== ========== ======== // ========= ========== ========== ========
if (confirmedBom == null || confirmedBom.trim().length() == 0 || confirmedBom.equalsIgnoreCase("N")) if (confirmedBom == null || confirmedBom.trim().length() == 0 || "N".equalsIgnoreCase(confirmedBom))//confirmedBom.equalsIgnoreCase("N"))
{ {
logMsg = logMsg + "BOM not confirmed"; logMsg = logMsg + "BOM not confirmed";
if("Y".equalsIgnoreCase(verifier)) //for error_report @19/09/16 if("Y".equalsIgnoreCase(verifier)) //for error_report @19/09/16
...@@ -2644,7 +2667,7 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -2644,7 +2667,7 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
errFields.add("bom_code"); errFields.add("bom_code");
} }
} }
if (activeBom == null || activeBom.trim().length() == 0 || activeBom.equalsIgnoreCase("N")) if (activeBom == null || activeBom.trim().length() == 0 || "N".equalsIgnoreCase(activeBom))//activeBom.equalsIgnoreCase("N"))
{ {
logMsg = logMsg + " BOM not active"; logMsg = logMsg + " BOM not active";
if("Y".equalsIgnoreCase(verifier)) //for error_report @19/09/16 if("Y".equalsIgnoreCase(verifier)) //for error_report @19/09/16
...@@ -2913,7 +2936,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -2913,7 +2936,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
// System.out.println("bomExplode Function :: Site Code :: "+siteCode+"Bom Code ::"+bomCode+"Item Code ::"+rs.getString(1)); // System.out.println("bomExplode Function :: Site Code :: "+siteCode+"Bom Code ::"+bomCode+"Item Code ::"+rs.getString(1));
boolean isCyclic = false; boolean isCyclic = false;
//System.out.println("innerSuppSour-----" + innerSuppSour + "----innerBomCode----" + innerBomCode); //System.out.println("innerSuppSour-----" + innerSuppSour + "----innerBomCode----" + innerBomCode);
if (((innerSuppSour != null) && (!innerSuppSour.equals("P"))) && (innerBomCode != null)) //if (((innerSuppSour != null) && (!innerSuppSour.equals("P"))) && (innerBomCode != null))
if (((innerSuppSour != null) && (!"P".equals(innerSuppSour))) && (innerBomCode != null))
{ {
for (int i = 1; i < level; i++) for (int i = 1; i < level; i++)
...@@ -2928,7 +2952,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -2928,7 +2952,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
// Added by Jiten 07/11/06// // Added by Jiten 07/11/06//
//System.out.println("BASE>>>>>verifier is:"+verifier); //System.out.println("BASE>>>>>verifier is:"+verifier);
if (verifier != null && verifier.equalsIgnoreCase("Y")) //if (verifier != null && verifier.equalsIgnoreCase("Y"))
if (verifier != null && "Y".equalsIgnoreCase(verifier))
{ {
//this.fw.write(cyclicItem.siteCode + " " + cyclicItem.bomCode + " " + cyclicItem.itemCode + " " + rs.getString(1) + "\r\n"); //this.fw.write(cyclicItem.siteCode + " " + cyclicItem.bomCode + " " + cyclicItem.itemCode + " " + rs.getString(1) + "\r\n");
BaseLogger.log("3", null, null, "Cyclic Item Code is : " + itemCode); BaseLogger.log("3", null, null, "Cyclic Item Code is : " + itemCode);
...@@ -3090,7 +3115,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -3090,7 +3115,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
//System.out.println("manohar 14/01/12 already in itemCodeMap-------material" + rs.getString(1)); //System.out.println("manohar 14/01/12 already in itemCodeMap-------material" + rs.getString(1));
} }
} }
if (((innerSuppSour != null) && (!innerSuppSour.equals("P"))) && (innerBomCode != null) && (isCyclic == false)) //if (((innerSuppSour != null) && (!innerSuppSour.equals("P"))) && (innerBomCode != null) && (isCyclic == false))
if (((innerSuppSour != null) && (!"P".equals(innerSuppSour))) && (innerBomCode != null) && (isCyclic == false))
{ {
// System.out.println("Inner Exploding BOM for site : " // System.out.println("Inner Exploding BOM for site : "
// + siteCode + " Item : " + rs.getString(1) + " BOM : " // + siteCode + " Item : " + rs.getString(1) + " BOM : "
...@@ -3936,15 +3962,18 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -3936,15 +3962,18 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
{ {
if (adpElement.getSuppSour() != null) if (adpElement.getSuppSour() != null)
{ {
if (adpElement.getSuppSour().equals("D") && !disPlan.equals("Y")) //if (adpElement.getSuppSour().equals("D") && !disPlan.equals("Y"))
if ("D".equals(adpElement.getSuppSour()) && !"Y".equals(disPlan))
{ {
continue; continue;
} }
if (adpElement.getSuppSour().equals("M") && (!mfgPlan.equals("Y") && !matPlan.equals("Y"))) //if (adpElement.getSuppSour().equals("M") && (!mfgPlan.equals("Y") && !matPlan.equals("Y")))
if ("M".equals(adpElement.getSuppSour()) && (!"Y".equals(mfgPlan) && !"Y".equals(matPlan)))
{ {
continue; continue;
} }
if (adpElement.getSuppSour().equals("P") && !matPlan.equals("Y")) //if (adpElement.getSuppSour().equals("P") && !matPlan.equals("Y"))
if ("P".equals(adpElement.getSuppSour()) && !"Y".equals(matPlan))
{ {
continue; continue;
} }
...@@ -4160,11 +4189,26 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -4160,11 +4189,26 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
{ {
if("Y".equalsIgnoreCase(verifier)) if("Y".equalsIgnoreCase(verifier))
{ {
msgStr = "Supplier source is blank for Item Code:"+itemCode+" Site Code:"+siteCode+" in Site Item master"; msgStr = "Supplier Source is blank for Item Code:"+itemCode+" Site Code:"+siteCode+" in Site Item master";
mrpErrDetList.add(msgStr); mrpErrDetList.add(msgStr);
} }
}else { }else {
suppSour = suppSour.trim(); suppSour = suppSour.trim();
//Pavan Rane 19dec19 start[to validate wrong masters data for mrp report]
if("D".equals(suppSour))
{
siteCodeSupp = checkNullTrim(rs.getString(11));
siteCode = checkNullTrim(siteCode);
if(siteCode.equals(siteCodeSupp))
{
if("Y".equalsIgnoreCase(verifier))
{
msgStr = "Supplier Source is Distribution for Item Code: "+itemCode+" then Site :"+siteCode+" and Supply Site :"+siteCodeSupp+" should not not be same in Site Item master";
mrpErrDetList.add(msgStr);
}
}
}
//Pavan Rane 19dec19 end[to validate wrong masters data for mrp report]
} }
adpElement.setSuppSour(suppSour); adpElement.setSuppSour(suppSour);
//Pavan Rane 09sep19 end[to validate data for mrp report] //Pavan Rane 09sep19 end[to validate data for mrp report]
...@@ -4260,7 +4304,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -4260,7 +4304,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
{ {
orderOpt = "C"; orderOpt = "C";
} }
if (orderOpt.equals("B") && batchQtyType == null) //if (orderOpt.equals("B") && batchQtyType == null)
if ("B".equals(orderOpt) && batchQtyType == null)
{ {
adpElement.setBatchQtyType("V"); adpElement.setBatchQtyType("V");
} }
...@@ -4468,7 +4513,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -4468,7 +4513,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
{ {
orderOpt = "C"; orderOpt = "C";
} }
if (orderOpt.equals("B") && batchQtyType == null) //if (orderOpt.equals("B") && batchQtyType == null)
if ("B".equals(orderOpt) && batchQtyType == null)
{ {
adpElement.setBatchQtyType("V"); adpElement.setBatchQtyType("V");
} }
...@@ -4523,11 +4569,13 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -4523,11 +4569,13 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
{ {
adpElement.setSiteCodeSupp(getSiteCodeSupp(siteCode, itemCode)); adpElement.setSiteCodeSupp(getSiteCodeSupp(siteCode, itemCode));
} }
if (adpElement.getOrderOpt() != null && adpElement.getOrderOpt().equals("B") && adpElement.getBatchQtyType() == null) //if (adpElement.getOrderOpt() != null && adpElement.getOrderOpt().equals("B") && adpElement.getBatchQtyType() == null)
if (adpElement.getOrderOpt() != null && "B".equals(adpElement.getOrderOpt()) && adpElement.getBatchQtyType() == null)
{ {
adpElement.setBatchQtyType("C"); adpElement.setBatchQtyType("C");
} }
if (suppSour.equals("M")) //if (suppSour.equals("M"))
if ("M".equals(suppSour))
{ {
itemSer = adpElement.getItemSer(); itemSer = adpElement.getItemSer();
sql = "SELECT ACCT_CODE__WP, CCTR_CODE__WP FROM ITEM_ACCT_DETR WHERE ITEM_CODE = ? AND ITEM_SER = ? AND TRAN_TYPE = ' ' "; sql = "SELECT ACCT_CODE__WP, CCTR_CODE__WP FROM ITEM_ACCT_DETR WHERE ITEM_CODE = ? AND ITEM_SER = ? AND TRAN_TYPE = ' ' ";
...@@ -4591,16 +4639,23 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -4591,16 +4639,23 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
adpElement.setCctrCodeWp(cctrCodeWp); adpElement.setCctrCodeWp(cctrCodeWp);
//System.out.println("adpElement@3818=["+adpElement+"]"); //System.out.println("adpElement@3818=["+adpElement+"]");
sql = "SELECT BATCH_QTY FROM BOM WHERE BOM_CODE = ?"; //Modified By Pavan Rane 20dec19 Start [if bom code is null then ignore sql execution and set batchQty = 0.0]
pstmtInner = conn.prepareStatement(sql); if(bomCode != null && bomCode.trim().length() > 0 && !"null".equals(bomCode))
pstmtInner.setString(1, bomCode); {
rsInner = pstmtInner.executeQuery(); sql = "SELECT BATCH_QTY FROM BOM WHERE BOM_CODE = ?";
if (rsInner.next()) pstmtInner = conn.prepareStatement(sql);
{ pstmtInner.setString(1, bomCode);
adpElement.setBatchQty(rsInner.getDouble(1)); rsInner = pstmtInner.executeQuery();
if (rsInner.next())
{
adpElement.setBatchQty(rsInner.getDouble(1));
}
rsInner.close(); rsInner = null;
pstmtInner.close(); pstmtInner = null;
}else {
adpElement.setBatchQty(0.0);
} }
rsInner.close(); rsInner = null; //Modified By Pavan Rane 20dec19 end [if bom code is null then ignore sql execution and set batchQty = 0.0]
pstmtInner.close(); pstmtInner = null;
} }
//Pavan Rane 09sep19 start [to check mfg_type and batch_qty_type in mrp report missing data validation] //Pavan Rane 09sep19 start [to check mfg_type and batch_qty_type in mrp report missing data validation]
if("B".equals(adpElement.getOrderOpt())) if("B".equals(adpElement.getOrderOpt()))
...@@ -4643,11 +4698,12 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -4643,11 +4698,12 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
} }
rsInner.close(); rsInner = null; rsInner.close(); rsInner = null;
pstmtInner.close(); pstmtInner = null;*/ pstmtInner.close(); pstmtInner = null;*/
if (orderOpt.equals("B") && batchQtyType.equals("F") && suppSour.equals("M")) /*if (orderOpt.equals("B") && batchQtyType.equals("F") && suppSour.equals("M"))
{ {
// adpElement.setReoQty(adpElement.getBatchQty()); // adpElement.setReoQty(adpElement.getBatchQty());
} }*/
if (roundReqTo.equals("R")) //if (roundReqTo.equals("R"))
if ("R".equals(roundReqTo))
{ {
//System.out.println("item [" + itemCode + " ] roundReqTo ..[" + roundReqTo + "] setting integral to [" + adpElement.getReoQty() + "]"); //System.out.println("item [" + itemCode + " ] roundReqTo ..[" + roundReqTo + "] setting integral to [" + adpElement.getReoQty() + "]");
adpElement.setIntegralQty(adpElement.getReoQty()); adpElement.setIntegralQty(adpElement.getReoQty());
...@@ -5229,17 +5285,20 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -5229,17 +5285,20 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
//System.out.println("matPlan---"+matPlan+"----mfgPlan----"+mfgPlan); //System.out.println("matPlan---"+matPlan+"----mfgPlan----"+mfgPlan);
//System.out.println("isDetailReq2------["+isDetailReq+"]"); //System.out.println("isDetailReq2------["+isDetailReq+"]");
if (matPlan.equalsIgnoreCase("N") && mfgPlan.equalsIgnoreCase("N")) //if (matPlan.equalsIgnoreCase("N") && mfgPlan.equalsIgnoreCase("N"))
if ("N".equalsIgnoreCase(matPlan) && "N".equalsIgnoreCase(mfgPlan))
{ {
//sqlFileName = CommonConstants.JBOSSHOME + File.separator + "sql" + File.separator + "demandsupplyforecastonly"; //sqlFileName = CommonConstants.JBOSSHOME + File.separator + "sql" + File.separator + "demandsupplyforecastonly";
adpQuery = checkNull(externalSqlMap.get("demandsupplyforecastonlyOracle")); adpQuery = checkNull(externalSqlMap.get("demandsupplyforecastonlyOracle"));
} }
else if (matPlan.equalsIgnoreCase("Y") && mfgPlan.equalsIgnoreCase("N")) //else if (matPlan.equalsIgnoreCase("Y") && mfgPlan.equalsIgnoreCase("N"))
else if ("Y".equalsIgnoreCase(matPlan) && "N".equalsIgnoreCase(mfgPlan))
{ {
BaseLogger.log("3", null, null, "wnName1["+wnName1+"]"); BaseLogger.log("3", null, null, "wnName1["+wnName1+"]");
if(wnName1.trim().equals("w_requirement")) //if(wnName1.trim().equals("w_requirement"))
if("w_requirement".equals(wnName1.trim()))
{ {
//sqlFileName = CommonConstants.JBOSSHOME + File.separator + "sql" + File.separator + "demandsupplymaterialReq"; //sqlFileName = CommonConstants.JBOSSHOME + File.separator + "sql" + File.separator + "demandsupplymaterialReq";
adpQuery = checkNull(externalSqlMap.get("demandsupplymaterialReqOracle")); adpQuery = checkNull(externalSqlMap.get("demandsupplymaterialReqOracle"));
...@@ -5589,16 +5648,19 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -5589,16 +5648,19 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
System.out.println("isDetailReq***[" + isDetailReq + "]"); System.out.println("isDetailReq***[" + isDetailReq + "]");
System.out.println("mfgParam***[" + mfgParam + "]");*/ System.out.println("mfgParam***[" + mfgParam + "]");*/
if (matPlan.equalsIgnoreCase("N") && mfgPlan.equalsIgnoreCase("N")) //if (matPlan.equalsIgnoreCase("N") && mfgPlan.equalsIgnoreCase("N"))
if ("N".equalsIgnoreCase(matPlan) && "N".equalsIgnoreCase(mfgPlan))
{ {
//sqlFileNameDet = CommonConstants.JBOSSHOME + File.separator+"sql" + File.separator+ "demandsupplyforecastonlyDet"; //sqlFileNameDet = CommonConstants.JBOSSHOME + File.separator+"sql" + File.separator+ "demandsupplyforecastonlyDet";
adpDetQuery = checkNull(externalSqlMap.get("demandsupplyforecastonlyDetOracle")); adpDetQuery = checkNull(externalSqlMap.get("demandsupplyforecastonlyDetOracle"));
} else if (matPlan.equalsIgnoreCase("Y") && mfgPlan.equalsIgnoreCase("N")) } //else if (matPlan.equalsIgnoreCase("Y") && mfgPlan.equalsIgnoreCase("N"))
else if ("Y".equalsIgnoreCase(matPlan) && "N".equalsIgnoreCase(mfgPlan))
{ {
BaseLogger.log("3",null,null,"wnName1[" + wnName1 + "]"); BaseLogger.log("3",null,null,"wnName1[" + wnName1 + "]");
if (wnName1.trim().equals("w_requirement")) //if (wnName1.trim().equals("w_requirement"))
if ("w_requirement".equals(wnName1.trim()))
{ {
//sqlFileNameDet = CommonConstants.JBOSSHOME+ File.separator + "sql" + File.separator+ "demandsupplymaterialReqDet"; //sqlFileNameDet = CommonConstants.JBOSSHOME+ File.separator + "sql" + File.separator+ "demandsupplymaterialReqDet";
adpDetQuery = checkNull(externalSqlMap.get("demandsupplymaterialReqDetOracle")); adpDetQuery = checkNull(externalSqlMap.get("demandsupplymaterialReqDetOracle"));
...@@ -5669,7 +5731,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -5669,7 +5731,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
while (rs.next()) while (rs.next())
{ {
if (matPlan.equalsIgnoreCase("N") && mfgPlan.equalsIgnoreCase("N")) //if (matPlan.equalsIgnoreCase("N") && mfgPlan.equalsIgnoreCase("N"))
if ("N".equalsIgnoreCase(matPlan) && "N".equalsIgnoreCase(mfgPlan))
{ {
HashMap demandSupplyMap = new HashMap(); HashMap demandSupplyMap = new HashMap();
itemCodeDet = rs.getString("item_code"); itemCodeDet = rs.getString("item_code");
...@@ -5688,8 +5751,11 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -5688,8 +5751,11 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
demandSupplyList.add(demandSupplyMap); demandSupplyList.add(demandSupplyMap);
} else if (matPlan.equalsIgnoreCase("Y") && mfgPlan.equalsIgnoreCase("N")) { } //else if (matPlan.equalsIgnoreCase("Y") && mfgPlan.equalsIgnoreCase("N")) {
if (wnName1.trim().equals("w_requirement")) else if ("Y".equalsIgnoreCase(matPlan) && "N".equalsIgnoreCase(mfgPlan))
{
//if (wnName1.trim().equals("w_requirement"))
if ("w_requirement".equals(wnName1.trim()))
{ {
HashMap demandSupplyMap = new HashMap(); HashMap demandSupplyMap = new HashMap();
itemCodeDet = rs.getString("item_code"); itemCodeDet = rs.getString("item_code");
...@@ -6908,7 +6974,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -6908,7 +6974,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
while (rs.next()) while (rs.next())
{ {
if (matPlan.equalsIgnoreCase("N") && mfgPlan.equalsIgnoreCase("N")) //if (matPlan.equalsIgnoreCase("N") && mfgPlan.equalsIgnoreCase("N"))
if ("N".equalsIgnoreCase(matPlan) && "N".equalsIgnoreCase(mfgPlan))
{ {
HashMap demandSupplyMap = new HashMap(); HashMap demandSupplyMap = new HashMap();
String itemCodeDet = rs.getString("item_code"); String itemCodeDet = rs.getString("item_code");
...@@ -6932,9 +6999,11 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -6932,9 +6999,11 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
demandSupplyMap.put(6, tranSerDet); demandSupplyMap.put(6, tranSerDet);
demandSupplyList.add(demandSupplyMap); demandSupplyList.add(demandSupplyMap);
} else if (matPlan.equalsIgnoreCase("Y") && mfgPlan.equalsIgnoreCase("N")) } //else if (matPlan.equalsIgnoreCase("Y") && mfgPlan.equalsIgnoreCase("N"))
else if ("Y".equalsIgnoreCase(matPlan) && "N".equalsIgnoreCase(mfgPlan))
{ {
if (wnName1.trim().equals("w_requirement")) //if (wnName1.trim().equals("w_requirement"))
if ("w_requirement".equals(wnName1.trim()))
{ {
HashMap demandSupplyMap = new HashMap(); HashMap demandSupplyMap = new HashMap();
String itemCodeDet = rs.getString("item_code"); String itemCodeDet = rs.getString("item_code");
...@@ -7330,7 +7399,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -7330,7 +7399,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
runningSupply = timeMrp.getRunningSupply(); runningSupply = timeMrp.getRunningSupply();
runningPlanSupply = timeMrp.getRunningPlanSupply(); runningPlanSupply = timeMrp.getRunningPlanSupply();
//System.out.println("3337---itemCode--"+itemCode+"runningDemand---"+runningDemand+"---runningSupply---"+runningSupply+"---runningPlanSupply---"+runningPlanSupply); //System.out.println("3337---itemCode--"+itemCode+"runningDemand---"+runningDemand+"---runningSupply---"+runningSupply+"---runningPlanSupply---"+runningPlanSupply);
if ((suppSour.equals("M")) || (suppSour.equals("C"))) // && //if ((suppSour.equals("M")) || (suppSour.equals("C"))) // &&
if (("M".equals(suppSour)) || ("C".equals(suppSour)))
// orderOpt.equals("B") // orderOpt.equals("B")
// ) // )
{ {
...@@ -7365,7 +7435,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -7365,7 +7435,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
{ {
// 28-11-2006 manoharan // 28-11-2006 manoharan
//System.out.println("@@@@@@ suppSour ["+suppSour+"]quantity["+quantity+"]"); //System.out.println("@@@@@@ suppSour ["+suppSour+"]quantity["+quantity+"]");
if ((suppSour.equals("M")) || (suppSour.equals("C"))) // && //if ((suppSour.equals("M")) || (suppSour.equals("C"))) // &&
if (("M".equals(suppSour)) || ("C".equals(suppSour)))
// orderOpt.equals("B") // orderOpt.equals("B")
// ) // )
{ {
...@@ -7452,17 +7523,19 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -7452,17 +7523,19 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
// if (suppSour.equals("P") && // if (suppSour.equals("P") &&
// adpElement.getSiteCodeSupp().trim() > 0 ) Changed by // adpElement.getSiteCodeSupp().trim() > 0 ) Changed by
// sudhir // sudhir
if (suppSour.equals("P") && adpElement.getSiteCodeSupp() != null && adpElement.getSiteCodeSupp().trim().length() > 0) if ("P".equals(suppSour) && adpElement.getSiteCodeSupp() != null && adpElement.getSiteCodeSupp().trim().length() > 0)
{ {
updateIndependentDemand(adpElement.getSiteCodeSupp(), itemCode, quantity, dueDate, siteCode); updateIndependentDemand(adpElement.getSiteCodeSupp(), itemCode, quantity, dueDate, siteCode);
} }
// ???????? independent demand // ???????? independent demand
// ***************************** // *****************************
if (suppSour.equals("D")) //if (suppSour.equals("D"))
if ("D".equals(suppSour))
{ {
// generate a demand for the supply site // generate a demand for the supply site
if (balIntersite.equals("Y")) //if (balIntersite.equals("Y"))
if ("Y".equals(balIntersite))
{ {
String siteIdst = null; String siteIdst = null;
siteIdst = getSurplusStockSite(siteCode, itemCode, quantity, surplusList); siteIdst = getSurplusStockSite(siteCode, itemCode, quantity, surplusList);
...@@ -7484,11 +7557,26 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -7484,11 +7557,26 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
} else } else
{ {
siteCodeSupp = getSiteCodeSupp(siteCode, itemCode); siteCodeSupp = getSiteCodeSupp(siteCode, itemCode);
//Pavan Rane 20dec19 start[to validate wrong masters data for mrp report]
siteCode = checkNull(siteCode);
siteCodeSupp = checkNull(siteCodeSupp);;
if(siteCode.equals(siteCodeSupp))
{
if("Y".equalsIgnoreCase(verifier))
{
msgStr = "Supplier Source is Distribution for Item Code: "+itemCode+" then Site :"+siteCode+" and Supply Site : "+siteCodeSupp+" should not not be same in Site Item master";
mrpErrDetList.add(msgStr);
}
}
//Pavan Rane 20dec19 end[to validate wrong masters data for mrp report]
} }
updateSupplySite(siteCodeSupp, itemCode, quantity, dueDate); //Pavan Rane 20dec19 start[If site and supply-site is same then consider demand as oth_demand]
//updateSupplySite(siteCodeSupp, itemCode, quantity, dueDate);
updateSupplySite(siteCodeSupp, siteCode, itemCode, quantity, dueDate);
} }
// end 10-04-2006 manoharan // end 10-04-2006 manoharan
if (suppSour != null && suppSour.trim().equals("M") && matPlan.trim().equals("Y")) //if (suppSour != null && suppSour.trim().equals("M") && matPlan.trim().equals("Y"))
if (suppSour != null && "M".equals(suppSour.trim()) && "Y".equals(matPlan))
{ {
// 22/06/10 manoharan to calculate due_date based on // 22/06/10 manoharan to calculate due_date based on
...@@ -7906,7 +7994,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -7906,7 +7994,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
return adpElement;// errString; return adpElement;// errString;
}*/ }*/
//Pavan R Commented [END] //Pavan R Commented [END]
private void updateSupplySite(String siteCode, String itemCode, double quantity, java.sql.Timestamp dueDate) throws ITMException, Exception //private void updateSupplySite(String siteCode, String itemCode, double quantity, java.sql.Timestamp dueDate) throws ITMException, Exception
private void updateSupplySite(String siteCode, String SuppSitefrm, String itemCode, double quantity, java.sql.Timestamp dueDate) throws ITMException, Exception
{ {
ADPElement adpElement; ADPElement adpElement;
int found = -1; int found = -1;
...@@ -7924,7 +8013,17 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -7924,7 +8013,17 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
throw new ITMException(new Exception("dueDate is less than stockDate")); throw new ITMException(new Exception("dueDate is less than stockDate"));
} }
//Pavan R on 2k18-JAN-29 to check where dueDate is less than stockDate[End] //Pavan R on 2k18-JAN-29 to check where dueDate is less than stockDate[End]
adpElement.setDemand(dueDate, quantity, " ", " "); //Pavan Rane 20dec19 start[If site and supply-site is same then consider demand as oth_demand]
//adpElement.setDemand(dueDate, quantity, " ", " ");
siteCode = checkNullTrim(siteCode);
SuppSitefrm = checkNullTrim(SuppSitefrm);
if(SuppSitefrm.equals(siteCode))
{
adpElement.setOthSupply(dueDate, quantity);
}else {
adpElement.setDemand(dueDate, quantity, " ", " ");
}
//Pavan Rane 20dec19 end[If site and supply-site is same then consider demand as oth_demand]
found = adpeCtr; found = adpeCtr;
adpeList.set(adpeCtr, adpElement); adpeList.set(adpeCtr, adpElement);
break; break;
...@@ -7943,7 +8042,17 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -7943,7 +8042,17 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
throw new ITMException(new Exception("dueDate is less than stockDate")); throw new ITMException(new Exception("dueDate is less than stockDate"));
} }
//Pavan R on 2k18-JAN-29 to check where dueDate is less than stockDate[End] //Pavan R on 2k18-JAN-29 to check where dueDate is less than stockDate[End]
adpElement.setDemand(dueDate, quantity, " ", " "); //Pavan Rane 20dec19 start[If site and supply-site is same then consider demand as oth_demand]
//adpElement.setDemand(dueDate, quantity, " ", " ");
siteCode = checkNullTrim(siteCode);
SuppSitefrm = checkNullTrim(SuppSitefrm);
if(SuppSitefrm.equals(siteCode))
{
adpElement.setOthSupply(dueDate, quantity);
}else {
adpElement.setDemand(dueDate, quantity, " ", " ");
}
//Pavan Rane 20dec19 end[If site and supply-site is same then consider demand as oth_demand]
//Added by Pavan R 27-apr-18 to check duplicate item in adpelement //Added by Pavan R 27-apr-18 to check duplicate item in adpelement
adpeList.add(adpElement); adpeList.add(adpElement);
} }
...@@ -8034,7 +8143,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -8034,7 +8143,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
reorderLevel=adpElement.getReorderLevel(); reorderLevel=adpElement.getReorderLevel();
BaseLogger.log("3", null, null,"25022010 Item " + adpElement.getItemCode() + " integralQty " + decFormat(integralQty) + " req qty " + decFormat(reqQty) + " Batch Qty " + decFormat(batchQty)+"reorderLevel["+reorderLevel+"]"); BaseLogger.log("3", null, null,"25022010 Item " + adpElement.getItemCode() + " integralQty " + decFormat(integralQty) + " req qty " + decFormat(reqQty) + " Batch Qty " + decFormat(batchQty)+"reorderLevel["+reorderLevel+"]");
if (minStkDay > 0 && mrpDynMinStk.equals("Y")) //if (minStkDay > 0 && mrpDynMinStk.equals("Y"))
if (minStkDay > 0 && "Y".equals(mrpDynMinStk))
{ {
stkLevel = getStkLevel(adpElement, dueDate); stkLevel = getStkLevel(adpElement, dueDate);
} else } else
...@@ -8047,7 +8157,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -8047,7 +8157,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
{*/ {*/
stkLevel = adpElement.getMinQty(); stkLevel = adpElement.getMinQty();
//} //}
if (minOrderChk.equals("Y")) //if (minOrderChk.equals("Y"))
if ("Y".equals(minOrderChk))
{ {
chkOrdQty = adpElement.getMinOrderQty(); chkOrdQty = adpElement.getMinOrderQty();
} else } else
...@@ -8067,13 +8178,15 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -8067,13 +8178,15 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
//System.out.println("BASE@@@@2 reqQty" + decFormat(reqQty) ); //System.out.println("BASE@@@@2 reqQty" + decFormat(reqQty) );
if (reqQty > chkOrdQty && chkOrdQty > 0) if (reqQty > chkOrdQty && chkOrdQty > 0)
{ {
if (minOrderChk.equals("Y")) //if (minOrderChk.equals("Y"))
if ("Y".equals(minOrderChk))
{ {
multiplier = new Double(Math.ceil((reqQty + stkLevel) / integralQty)).intValue(); multiplier = new Double(Math.ceil((reqQty + stkLevel) / integralQty)).intValue();
//System.out.println("BASE25022010 2->Item [" + adpElement.getItemCode() + "] reqQty [" + reqQty + "] reoQty [" + reoQty + "]] integralQty [" + integralQty + "] multiplier [" + multiplier + "]"); //System.out.println("BASE25022010 2->Item [" + adpElement.getItemCode() + "] reqQty [" + reqQty + "] reoQty [" + reoQty + "]] integralQty [" + integralQty + "] multiplier [" + multiplier + "]");
} else } else
{ {
if (mfgPlan.equals("N") && matPlan.equals("N")) //if (mfgPlan.equals("N") && matPlan.equals("N"))
if ("N".equals(mfgPlan) && "N".equals(matPlan))
{ {
multiplier = new Double(Math.ceil(((reqQty + stkLevel)) / integralQty)).intValue(); multiplier = new Double(Math.ceil(((reqQty + stkLevel)) / integralQty)).intValue();
//System.out.println("BASE25022010 3->Item [" + adpElement.getItemCode() + "] reqQty [" + reqQty + "] reoQty [" + reoQty + "]] integralQty [" + integralQty + "] multiplier [" + multiplier + "]"); //System.out.println("BASE25022010 3->Item [" + adpElement.getItemCode() + "] reqQty [" + reqQty + "] reoQty [" + reoQty + "]] integralQty [" + integralQty + "] multiplier [" + multiplier + "]");
...@@ -8118,13 +8231,15 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -8118,13 +8231,15 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
reoQty = reqQty + stkLevel; reoQty = reqQty + stkLevel;
} }
//System.out.println("BASE25022010 8->Item [" + adpElement.getItemCode() + "] reqQty [" + reqQty + "] reoQty [" + reoQty + "]] integralQty [" + integralQty + "] multiplier [" + multiplier + "]"); //System.out.println("BASE25022010 8->Item [" + adpElement.getItemCode() + "] reqQty [" + reqQty + "] reoQty [" + reoQty + "]] integralQty [" + integralQty + "] multiplier [" + multiplier + "]");
if (minOrderChk.equals("Y")) //if (minOrderChk.equals("Y"))
if ("Y".equals(minOrderChk))
{ {
multiplier = new Double(Math.ceil((stkLevel + reqQty) / reoQty)).intValue(); multiplier = new Double(Math.ceil((stkLevel + reqQty) / reoQty)).intValue();
//System.out.println("BASE25022010 9->Item [" + adpElement.getItemCode() + "] reqQty [" + reqQty + "] reoQty [" + reoQty + "]] integralQty [" + integralQty + "] multiplier [" + multiplier + "]"); //System.out.println("BASE25022010 9->Item [" + adpElement.getItemCode() + "] reqQty [" + reqQty + "] reoQty [" + reoQty + "]] integralQty [" + integralQty + "] multiplier [" + multiplier + "]");
} else } else
{ {
if (mfgPlan.equals("N") && matPlan.equals("N")) //if (mfgPlan.equals("N") && matPlan.equals("N"))
if ("N".equals(mfgPlan) && "N".equals(matPlan))
{ {
multiplier = new Double(Math.ceil((reqQty + stkLevel) / reoQty)).intValue(); multiplier = new Double(Math.ceil((reqQty + stkLevel) / reoQty)).intValue();
//System.out.println("BASE25022010 10->Item [" + adpElement.getItemCode() + "] reqQty [" + reqQty + "] reoQty [" + reoQty + "]] integralQty [" + integralQty + "] multiplier [" + multiplier + "]"); //System.out.println("BASE25022010 10->Item [" + adpElement.getItemCode() + "] reqQty [" + reqQty + "] reoQty [" + reoQty + "]] integralQty [" + integralQty + "] multiplier [" + multiplier + "]");
...@@ -8151,7 +8266,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -8151,7 +8266,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
} }
} }
} }
if (minOrderChk.equals("Y")) //if (minOrderChk.equals("Y"))
if ("Y".equals(minOrderChk))
{ {
if (reqQty < chkOrdQty && adpElement.getMinQty() < reoQty) if (reqQty < chkOrdQty && adpElement.getMinQty() < reoQty)
{ {
...@@ -8168,7 +8284,7 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -8168,7 +8284,7 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
//System.out.println("BASE25022010 16->Item [" + adpElement.getItemCode() + "] reqQty [" + reqQty + "] reoQty [" + reoQty + "]] integralQty [" + integralQty + "] multiplier [" + multiplier + "]"); //System.out.println("BASE25022010 16->Item [" + adpElement.getItemCode() + "] reqQty [" + reqQty + "] reoQty [" + reoQty + "]] integralQty [" + integralQty + "] multiplier [" + multiplier + "]");
} }
if (orderOpt.equals("B") && !batchQtyType.equals("V")) if ("B".equals(orderOpt) && !"V".equals(batchQtyType))//if (orderOpt.equals("B") && !batchQtyType.equals("V"))
{ {
multiplier = 0; multiplier = 0;
...@@ -8468,24 +8584,24 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -8468,24 +8584,24 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
if( valueNode.getFirstChild() != null ) if( valueNode.getFirstChild() != null )
{ {
nodeValue = valueNode.getFirstChild().getNodeValue(); nodeValue = valueNode.getFirstChild().getNodeValue();
if (nodeName.equals("site_code")) if ("site_code".equals(nodeName))//if (nodeName.equals("site_code"))
{ {
siteCode = nodeValue; siteCode = nodeValue;
} }
if (nodeName.equals("item_code")) if ("item_code".equals(nodeName))//if (nodeName.equals("item_code"))
{ {
itemCode = nodeValue; itemCode = nodeValue;
} }
if (nodeName.equals("quantity")) if("quantity".equals(nodeName))//if (nodeName.equals("quantity"))
{ {
//Pavan R 2jun18 //Pavan R 2jun18
quantity = Double.parseDouble(nodeValue); quantity = Double.parseDouble(nodeValue);
} }
if (nodeName.equals("line_type")) if("line_type".equals(nodeName))//if (nodeName.equals("line_type"))
{ {
lineType = nodeValue; lineType = nodeValue;
} }
if (nodeName.equals("due_date")) if("due_date".equals(nodeName))//if (nodeName.equals("due_date"))
{ {
dueDate = java.sql.Timestamp.valueOf(nodeValue + " 00:00:00"); dueDate = java.sql.Timestamp.valueOf(nodeValue + " 00:00:00");
sdate = nodeValue; sdate = nodeValue;
...@@ -8495,23 +8611,23 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -8495,23 +8611,23 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
if(!isDetailReq && !isBomReplace) if(!isDetailReq && !isBomReplace)
{ {
if (nodeName.equals("bom_code")) if ("bom_code".equals(nodeName))//if (nodeName.equals("bom_code"))
{ {
bomCode = nodeValue; bomCode = nodeValue;
} }
if (nodeName.equals("batch_qty")) if ("batch_qty".equals(nodeName))//if (nodeName.equals("batch_qty"))
{ {
batchQty = Double.parseDouble(nodeValue); batchQty = Double.parseDouble(nodeValue);
} }
if (nodeName.equals("quantity_Ref")) if ("quantity_Ref".equals(nodeName))//if (nodeName.equals("quantity_Ref"))
{ {
quantityRef = Double.parseDouble(nodeValue); quantityRef = Double.parseDouble(nodeValue);
} }
if (nodeName.equals("qty_per")) if ("qty_per".equals(nodeName))//if (nodeName.equals("qty_per"))
{ {
qtyPer = Double.parseDouble(nodeValue); qtyPer = Double.parseDouble(nodeValue);
} }
if (nodeName.equals("req_type")) if ("req_type".equals(nodeName))//if (nodeName.equals("req_type"))
{ {
reqType = nodeValue; reqType = nodeValue;
} }
...@@ -8804,7 +8920,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -8804,7 +8920,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
//tmpadpList.add() //tmpadpList.add()
/* added by sachin */ /* added by sachin */
if (wnName.trim().equals("w_requirement")) //if (wnName.trim().equals("w_requirement"))
if ("w_requirement".equals(wnName.trim()))
{ {
if (!qtyMap.isEmpty()) if (!qtyMap.isEmpty())
{ {
...@@ -9202,7 +9319,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -9202,7 +9319,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
sqlDistDemand = "DELETE FROM DIST_DEMAND " + " WHERE STATUS = 'P' " + "AND SITE_CODE = ? " + "AND ITEM_CODE = ? "; sqlDistDemand = "DELETE FROM DIST_DEMAND " + " WHERE STATUS = 'P' " + "AND SITE_CODE = ? " + "AND ITEM_CODE = ? ";
if (matPlan.equals("Y")) //if (matPlan.equals("Y"))
if ("Y".equals(matPlan))
{ {
pstmt = conn.prepareStatement(sqlIndent); pstmt = conn.prepareStatement(sqlIndent);
pstmt.setString(1, siteCode); pstmt.setString(1, siteCode);
...@@ -9214,7 +9332,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -9214,7 +9332,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
pstmt.close();pstmt = null; pstmt.close();pstmt = null;
} }
if (mfgPlan.equals("Y")) //if (mfgPlan.equals("Y"))
if ("Y".equals(mfgPlan))
{ {
pstmt = conn.prepareStatement(sqlMpsOrder); pstmt = conn.prepareStatement(sqlMpsOrder);
pstmt.setString(1, siteCode); pstmt.setString(1, siteCode);
...@@ -9250,7 +9369,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -9250,7 +9369,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
} }
else else
{ {
if (mfgType != null && ((mfgType.trim()).equalsIgnoreCase("O"))) //if (mfgType != null && ((mfgType.trim()).equalsIgnoreCase("O")))
if (mfgType != null && ("O".equalsIgnoreCase(mfgType.trim())))
{ {
pstmt = conn.prepareStatement(sqlWorkOrder); pstmt = conn.prepareStatement(sqlWorkOrder);
pstmt.setString(1, siteCode); pstmt.setString(1, siteCode);
...@@ -9264,7 +9384,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -9264,7 +9384,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
} }
} }
if (disPlan.equals("Y")) //if (disPlan.equals("Y"))
if ("Y".equals(disPlan))
{ {
pstmt = conn.prepareStatement(sqlDistDemand); pstmt = conn.prepareStatement(sqlDistDemand);
pstmt.setString(1, siteCode); pstmt.setString(1, siteCode);
...@@ -9402,7 +9523,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -9402,7 +9523,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
String errString = ""; String errString = "";
// check stk_opt // check stk_opt
if (getStkOpt(itemCode, siteCode).equals("0")) //if (getStkOpt(itemCode, siteCode).equals("0"))
if ("0".equals(getStkOpt(itemCode, siteCode)))
{ {
return ""; return "";
} }
...@@ -9458,7 +9580,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -9458,7 +9580,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
if (independentDemand > 0) if (independentDemand > 0)
{ {
// independent demand to be created // independent demand to be created
if (orderOpt.equals("B")) //if (orderOpt.equals("B"))
if ("B".equals(orderOpt))
{ {
if (independentDemand > batchQty && batchQty !=0 )//Added by chandrashekar on 27-05-2015 if (independentDemand > batchQty && batchQty !=0 )//Added by chandrashekar on 27-05-2015
{ {
...@@ -9499,7 +9622,7 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -9499,7 +9622,7 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
} }
//System.out.println("@@@@@@cpatil-indDemList["+indDemList+"]"); //System.out.println("@@@@@@cpatil-indDemList["+indDemList+"]");
} else if (orderOpt.equals("C")) } else if ("C".equals(orderOpt))//else if (orderOpt.equals("C"))
{ {
int findEle = -1; int findEle = -1;
IndependentDemand indDem = null; IndependentDemand indDem = null;
...@@ -9554,13 +9677,14 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -9554,13 +9677,14 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
//System.out.println("Indent creation Plan Supply :" + //System.out.println("Indent creation Plan Supply :" +
// reqQty + " Orderopt " + orderOpt + " Suppsour " + // reqQty + " Orderopt " + orderOpt + " Suppsour " +
// suppSour + " Mat Plan " + matPlan +" batchQty "+batchQty+" batchQtyType "+batchQtyType); // suppSour + " Mat Plan " + matPlan +" batchQty "+batchQty+" batchQtyType "+batchQtyType);
if ((suppSour.equals("P") || suppSour.equals("C")) && matPlan.equals("Y")) //if ((suppSour.equals("P") || suppSour.equals("C")) && matPlan.equals("Y"))
if (("P".equals(suppSour) || "C".equals(suppSour)) && "Y".equals(matPlan))
{ {
//System.out.println("Indent creation Plan Supply :" + //System.out.println("Indent creation Plan Supply :" +
//reqQty + " Orderopt " + orderOpt + " Suppsour " + //reqQty + " Orderopt " + orderOpt + " Suppsour " +
//suppSour + " Mat Plan " + matPlan +" batchQty "+batchQty+" batchQtyType "+batchQtyType); //suppSour + " Mat Plan " + matPlan +" batchQty "+batchQty+" batchQtyType "+batchQtyType);
// independent demand to be created // independent demand to be created
if (orderOpt.equals("B")) if ("B".equals(orderOpt))//if (orderOpt.equals("B"))
{ {
if (reqQty > batchQty && batchQty !=0)//Added by chandrashekar on 27-05-2015 if (reqQty > batchQty && batchQty !=0)//Added by chandrashekar on 27-05-2015
{ {
...@@ -9616,7 +9740,7 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -9616,7 +9740,7 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
indList.add(indent); indList.add(indent);
} }
//System.out.println("BASE@@@@@@cpatil333-indList["+indList+"]"); //System.out.println("BASE@@@@@@cpatil333-indList["+indList+"]");
} else if (orderOpt.equals("C")) } else if ("C".equals(orderOpt))//else if (orderOpt.equals("C"))
{ {
int findEle = -1; int findEle = -1;
Indent indent = null; Indent indent = null;
...@@ -9682,14 +9806,16 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -9682,14 +9806,16 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
BaseLogger.log("3", null, null, "orderOpt--------"+orderOpt+"---"); BaseLogger.log("3", null, null, "orderOpt--------"+orderOpt+"---");
} // (( suppSour.equals("P") || suppSour.equals("C") )&& } // (( suppSour.equals("P") || suppSour.equals("C") )&&
// matPlan.equals("Y") ) // matPlan.equals("Y") )
else if (suppSour.equals("M") && mfgPlan.equals("Y")) //else if (suppSour.equals("M") && mfgPlan.equals("Y"))
else if ("M".equals(suppSour) && "Y".equals(mfgPlan))
{ {
// IF ITEM IS MADE TO ORDER AND IF MADE TO STOCK OPTION // IF ITEM IS MADE TO ORDER AND IF MADE TO STOCK OPTION
// IS SELECTED THEN // IS SELECTED THEN
// SKIP CREATION OF WORKORDER......AT GNL 10/4/02 BY // SKIP CREATION OF WORKORDER......AT GNL 10/4/02 BY
// MANOJ AS PER KANDARP // MANOJ AS PER KANDARP
//System.out.println("BASEmadeToOrder["+madeToOrder+"]mfgType["+mfgType+"]"); //System.out.println("BASEmadeToOrder["+madeToOrder+"]mfgType["+mfgType+"]");
if (madeToOrder.equals("1") && mfgType != null && mfgType.trim().equals("O")) //if (madeToOrder.equals("1") && mfgType != null && mfgType.trim().equals("O"))
if ("1".equals(madeToOrder) && mfgType != null && "O".equals(mfgType.trim()))
{ {
BaseLogger.log("3", null, null,"Returning value"); BaseLogger.log("3", null, null,"Returning value");
return ""; return "";
...@@ -9697,7 +9823,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -9697,7 +9823,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
// batchQtyType != v added as per Manoharan Sir - Jiten // batchQtyType != v added as per Manoharan Sir - Jiten
// - 02/11/06 // - 02/11/06
//System.out.println("BASE6912--orderOpt["+orderOpt+"]batchQtyType["+batchQtyType+"reqQty["+reqQty+"]batchQty["+batchQty+"]"); //System.out.println("BASE6912--orderOpt["+orderOpt+"]batchQtyType["+batchQtyType+"reqQty["+reqQty+"]batchQty["+batchQty+"]");
if (orderOpt.equals("B") && !(batchQtyType.equalsIgnoreCase("V"))) //if (orderOpt.equals("B") && !(batchQtyType.equalsIgnoreCase("V")))
if ("B".equals(orderOpt) && !("V".equalsIgnoreCase(batchQtyType)))
{ {
//System.out.println("BASE11012008 Req Qty : " + reqQty + " batch Qty :" + batchQty + " Min Plan :" + minPlanPerc); //System.out.println("BASE11012008 Req Qty : " + reqQty + " batch Qty :" + batchQty + " Min Plan :" + minPlanPerc);
if (reqQty > batchQty && batchQty !=0)//Added by chandrashekar on 27-05-2015 if (reqQty > batchQty && batchQty !=0)//Added by chandrashekar on 27-05-2015
...@@ -9730,10 +9857,10 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -9730,10 +9857,10 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
} }
createQty = batchQty; createQty = batchQty;
if (itemCode.trim().equalsIgnoreCase("BD0783")) /*if (itemCode.trim().equalsIgnoreCase("BD0783"))
{ {
BaseLogger.log("3", null, null,"11012008 Mulitplier : " + multiplier + " Batch Qty " + decFormat(batchQty) + " Req Qty : " + decFormat(reqQty) + " Item : " + itemCode + " Site " + siteCode); BaseLogger.log("3", null, null,"11012008 Mulitplier : " + multiplier + " Batch Qty " + decFormat(batchQty) + " Req Qty : " + decFormat(reqQty) + " Item : " + itemCode + " Site " + siteCode);
} }*/
BaseLogger.log("3", null, null,"11012008 Mulitplier : " + multiplier + " Batch Qty " + decFormat(batchQty) + " Req Qty : " + decFormat(reqQty) + " Item : " + itemCode + " Site " + siteCode); BaseLogger.log("3", null, null,"11012008 Mulitplier : " + multiplier + " Batch Qty " + decFormat(batchQty) + " Req Qty : " + decFormat(reqQty) + " Item : " + itemCode + " Site " + siteCode);
for (int planCtr = 0; planCtr < multiplier; planCtr++) for (int planCtr = 0; planCtr < multiplier; planCtr++)
{ {
...@@ -9880,7 +10007,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -9880,7 +10007,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
// 02/11/06 // 02/11/06
// Else if condition added by Jiten as per Manoharan Sir // Else if condition added by Jiten as per Manoharan Sir
// - 03/11/06 // - 03/11/06
else if (orderOpt.equals("B") && batchQtyType.equalsIgnoreCase("V")) //else if (orderOpt.equals("B") && batchQtyType.equalsIgnoreCase("V"))
else if ("B".equals(orderOpt) && "V".equalsIgnoreCase(batchQtyType))
{ {
//System.out.println("BASEreqQty["+reqQty+"]batchQty["+batchQty+"]"); //System.out.println("BASEreqQty["+reqQty+"]batchQty["+batchQty+"]");
if (reqQty >= batchQty && batchQty !=0)//Start Added by chandrashekar 0n 27-05-2015 if (reqQty >= batchQty && batchQty !=0)//Start Added by chandrashekar 0n 27-05-2015
...@@ -10059,7 +10187,7 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -10059,7 +10187,7 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
//System.out.println("BASE@@@@210315:mpsOrder.quantity["+mpsOrder.quantity+"]mpsList["+mpsList.size()+"]mpsOrder.addnOrder["+mpsOrder.addnOrder+"]"); //System.out.println("BASE@@@@210315:mpsOrder.quantity["+mpsOrder.quantity+"]mpsList["+mpsList.size()+"]mpsOrder.addnOrder["+mpsOrder.addnOrder+"]");
} }
// Jiten - End 03/11/06 // Jiten - End 03/11/06
} else if (orderOpt.equals("C")) } else if ("C".equals(orderOpt))//else if (orderOpt.equals("C"))
{ {
//System.out.println("BASE@@@@210315 adpElement.getMfgType()["+adpElement.getMfgType()+"]"); //System.out.println("BASE@@@@210315 adpElement.getMfgType()["+adpElement.getMfgType()+"]");
int findEle = -1; int findEle = -1;
...@@ -10237,11 +10365,12 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -10237,11 +10365,12 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
} }
} // ( suppSour.equals("M") && mfgPlan.equals("Y")) } // ( suppSour.equals("M") && mfgPlan.equals("Y"))
else if (suppSour.equals("D") && disPlan.equals("Y")) //else if (suppSour.equals("D") && disPlan.equals("Y"))
else if ("D".equals(suppSour) && "Y".equals(disPlan))
{ {
siteCodeSupp = " "; siteCodeSupp = " ";
if (balIntersite.equals("Y")) if ("Y".equals(balIntersite))//if (balIntersite.equals("Y"))
{ {
String siteIdst = null; String siteIdst = null;
siteIdst = getSurplusStockSite(siteCode, itemCode, reqQty, surplusListOriginal); siteIdst = getSurplusStockSite(siteCode, itemCode, reqQty, surplusListOriginal);
...@@ -10385,7 +10514,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -10385,7 +10514,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
return errString; return errString;
} }
} }
if (indList.size() > 0 && genIndent.equalsIgnoreCase("Y")) //if (indList.size() > 0 && genIndent.equalsIgnoreCase("Y"))
if (indList.size() > 0 && "Y".equalsIgnoreCase(genIndent))
{ {
// System.out.println("Ind List Size :" + mpsList.size()); // System.out.println("Ind List Size :" + mpsList.size());
errString = InsertPlanDemand("W_INDENT", indList); errString = InsertPlanDemand("W_INDENT", indList);
...@@ -10434,10 +10564,16 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -10434,10 +10564,16 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
if (rs.next()) if (rs.next())
{ {
stkOpt = rs.getString(1); stkOpt = rs.getString(1);
} else }
rs.close(); rs = null;
pstmt.close(); pstmt = null;
//Modified By Pavan Rane 19dec19 start[If siteitem defined but stk_opt not defined then check on item
// and Error if not found in both
//else
if((stkOpt == null || stkOpt.trim().length() == 0) || "null".equals(stkOpt))
{ {
rs.close(); /*rs.close();
pstmt.close(); pstmt.close();*/
sql = "SELECT STK_OPT FROM ITEM WHERE ITEM_CODE = ?"; sql = "SELECT STK_OPT FROM ITEM WHERE ITEM_CODE = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, itemCode); pstmt.setString(1, itemCode);
...@@ -10447,8 +10583,18 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -10447,8 +10583,18 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
stkOpt = rs.getString(1); stkOpt = rs.getString(1);
} }
} }
rs.close(); rs.close(); rs=null;
pstmt.close(); pstmt.close();pstmt = null;
if((stkOpt == null || stkOpt.trim().length() == 0) || "null".equals(stkOpt))
{
if("Y".equalsIgnoreCase(verifier))
{
msgStr = "Stock Option cannot be blank Item Code: "+itemCode+" Site :"+siteCode+" in Site Item or Item master";
mrpErrDetList.add(msgStr);
}
}
//Modified By Pavan Rane 19dec19 End[If siteitem defined but stk_opt not defined then check on item
} catch (SQLException e) } catch (SQLException e)
{ {
//System.out.println("SQLException :RunMRPPrcEJB :getBomCode(String siteCode, String ItemCode).." + e.getMessage()); //System.out.println("SQLException :RunMRPPrcEJB :getBomCode(String siteCode, String ItemCode).." + e.getMessage());
...@@ -10686,7 +10832,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -10686,7 +10832,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
// this.genericUtility.getDBDateFormat(),this.genericUtility.getApplDateFormat()); // this.genericUtility.getDBDateFormat(),this.genericUtility.getApplDateFormat());
feedbackReqd =mfgCommon.getEnvMfg("999999","FEEDBACK_REQD",conn); // added for feedback req 'Y' on 23/09/15 by cpatil feedbackReqd =mfgCommon.getEnvMfg("999999","FEEDBACK_REQD",conn); // added for feedback req 'Y' on 23/09/15 by cpatil
// System.out.println("@@@@@@@@ 8117 winName["+winName+"]feedbackReqd["+feedbackReqd+"]"); // System.out.println("@@@@@@@@ 8117 winName["+winName+"]feedbackReqd["+feedbackReqd+"]");
if (winName.equalsIgnoreCase("W_MPS_ORDER")) //if (winName.equalsIgnoreCase("W_MPS_ORDER"))
if ("W_MPS_ORDER".equalsIgnoreCase(winName))
{ {
// System.out.println("W_MPS_ORDER"); // System.out.println("W_MPS_ORDER");
for (int count = 0; count < list.size(); count++) for (int count = 0; count < list.size(); count++)
...@@ -11087,7 +11234,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -11087,7 +11234,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
} }
//System.out.println("BASE@@@@@cpatil:IPD_MPS_ORDER["+IPD_MPS_ORDER+"]"); //System.out.println("BASE@@@@@cpatil:IPD_MPS_ORDER["+IPD_MPS_ORDER+"]");
} }
else if (winName.equalsIgnoreCase("W_INDENT")) //else if (winName.equalsIgnoreCase("W_INDENT"))
else if ("W_INDENT".equalsIgnoreCase(winName))
{ {
//System.out.println("BASE@@@@@cpatil_W_INDENT_list.size()["+list.size()+"]"); //System.out.println("BASE@@@@@cpatil_W_INDENT_list.size()["+list.size()+"]");
for (int count = 0; count < list.size(); count++) for (int count = 0; count < list.size(); count++)
...@@ -11249,7 +11397,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -11249,7 +11397,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
//System.out.println("BASEIPD_INDENT valueMap["+valueMap+"]"); //System.out.println("BASEIPD_INDENT valueMap["+valueMap+"]");
} }
//System.out.println("BASE@@@@@cpatil:IPD_INDENT["+IPD_INDENT+"]"); //System.out.println("BASE@@@@@cpatil:IPD_INDENT["+IPD_INDENT+"]");
} else if (winName.equalsIgnoreCase("W_DIST_DEMAND")) } //else if (winName.equalsIgnoreCase("W_DIST_DEMAND"))
else if ("W_DIST_DEMAND".equalsIgnoreCase(winName))
{ {
for (int count = 0; count < list.size(); count++) for (int count = 0; count < list.size(); count++)
{ {
...@@ -11332,7 +11481,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -11332,7 +11481,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
//System.out.println("BASEIPD_DIST valueMap["+valueMap+"]"); //System.out.println("BASEIPD_DIST valueMap["+valueMap+"]");
} }
//System.out.println("BASE@@@@@cpatil:IPD_DIST["+IPD_DIST+"]"); //System.out.println("BASE@@@@@cpatil:IPD_DIST["+IPD_DIST+"]");
} else if (winName.equalsIgnoreCase("W_INDEPENDENT_DEMAND")) } //else if (winName.equalsIgnoreCase("W_INDEPENDENT_DEMAND"))
else if ("W_INDEPENDENT_DEMAND".equalsIgnoreCase(winName))
{ {
for (int count = 0; count < list.size(); count++) for (int count = 0; count < list.size(); count++)
{ {
...@@ -11644,7 +11794,7 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -11644,7 +11794,7 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
BaseLogger.log("3", null, null, "itemCode----"+itemCode+"---siteCode---"+siteCode); BaseLogger.log("3", null, null, "itemCode----"+itemCode+"---siteCode---"+siteCode);
itemSer = adpElement.getItemSer(); itemSer = adpElement.getItemSer();
siteCodeSupp = adpElement.getSiteCodeSupp(); siteCodeSupp = adpElement.getSiteCodeSupp();
suppSour = adpElement.getSuppSour(); suppSour = checkNull(adpElement.getSuppSour()).trim();
bomCode = adpElement.getBomCode(); bomCode = adpElement.getBomCode();
minQty = adpElement.getMinQty(); minQty = adpElement.getMinQty();
minOrderQty = adpElement.getMinOrderQty(); minOrderQty = adpElement.getMinOrderQty();
...@@ -11680,15 +11830,18 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -11680,15 +11830,18 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
// added by sabyasachi on 29-03-2011 ends // added by sabyasachi on 29-03-2011 ends
// 02-03-2007 manoharan not to insert if the plan is not // 02-03-2007 manoharan not to insert if the plan is not
// selected // selected
if (!disPlan.equalsIgnoreCase("Y") && (suppSour.trim().equalsIgnoreCase("D"))) //if (!disPlan.equalsIgnoreCase("Y") && (suppSour.trim().equalsIgnoreCase()))
if (!"Y".equalsIgnoreCase(disPlan) && ("D".equalsIgnoreCase(suppSour)))
{ {
continue; continue;
} }
if (!matPlan.equalsIgnoreCase("Y") && (suppSour.trim().equalsIgnoreCase("P"))) //if (!matPlan.equalsIgnoreCase("Y") && (suppSour.trim().equalsIgnoreCase("P")))
if (!"Y".equalsIgnoreCase(matPlan) && ("P".equalsIgnoreCase(suppSour)))
{ {
continue; continue;
} }
if (!mfgPlan.equalsIgnoreCase("Y") && (suppSour.trim().equalsIgnoreCase("M") || suppSour.trim().equalsIgnoreCase("C"))) //if (!mfgPlan.equalsIgnoreCase("Y") && (suppSour.trim().equalsIgnoreCase("M") || suppSour.trim().equalsIgnoreCase("C")))
if (!"Y".equalsIgnoreCase(mfgPlan) && ("M".equalsIgnoreCase(suppSour) || "C".equalsIgnoreCase(suppSour)))
{ {
continue; continue;
} }
...@@ -13608,6 +13761,12 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -13608,6 +13761,12 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
//--------4th sheet-end------------------------- //--------4th sheet-end-------------------------
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(genericUtility.getApplDateFormat()); SimpleDateFormat simpleDateFormat = new SimpleDateFormat(genericUtility.getApplDateFormat());
int insertRow = 2; int insertRow = 2;
//Pavan Rane 19dec19 start[sql added outside the loop]
PreparedStatement pstmt = null;
String sql="";
sql = "select item_type from item where item_code = ? ";
pstmt = conn.prepareStatement(sql);
//Pavan Rane 19dec19 end[sql added outside the loop]
for (int adpeCount = 0; adpeCount < adpeList.size(); adpeCount++) for (int adpeCount = 0; adpeCount < adpeList.size(); adpeCount++)
{ {
...@@ -13635,13 +13794,15 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -13635,13 +13794,15 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
mfgLeadTime = adpElement.getMfgLeadTime(); mfgLeadTime = adpElement.getMfgLeadTime();
desc = adpElement.getItemDescr(); desc = adpElement.getItemDescr();
PreparedStatement pstmt = null; //Pavan Rane 19dec19 start[sql added outside the loop]
//PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
String sql=""; //String sql="";
//System.out.println("@@@@@ itemCode["+itemCode+"]"); //System.out.println("@@@@@ itemCode["+itemCode+"]");
//BaseLogger.log( "0", null, null, "@@@@@ itemCode["+itemCode+"]"); //BaseLogger.log( "0", null, null, "@@@@@ itemCode["+itemCode+"]");
sql = "select item_type from item where item_code = ? "; /*sql = "select item_type from item where item_code = ? ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);*/
//Pavan Rane 19dec19 end[sql added outside the loop]
pstmt.setString( 1, itemCode ); pstmt.setString( 1, itemCode );
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) if (rs.next())
...@@ -13649,7 +13810,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -13649,7 +13810,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
itemType = checkNull(rs.getString(1)); itemType = checkNull(rs.getString(1));
} }
rs.close();rs = null; rs.close();rs = null;
pstmt.close();pstmt = null; pstmt.clearParameters();
//pstmt.close();pstmt = null;
ArrayList timeMRParr = adpElement.getTimeMrpList(); ArrayList timeMRParr = adpElement.getTimeMrpList();
for (int timeCtr = 0; timeCtr < timeMRParr.size(); timeCtr++) for (int timeCtr = 0; timeCtr < timeMRParr.size(); timeCtr++)
...@@ -13831,10 +13993,17 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -13831,10 +13993,17 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
cell.setCellStyle(styleBckgroud); cell.setCellStyle(styleBckgroud);
} }
} }
//Pavan Rane 19dec19 start[sql added outside the loop]
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
//Pavan Rane 19dec19 end[sql added outside the loop]
//Added by Pavan R on 09/oct/17 start //Added by Pavan R on 09/oct/17 start
if (matPlan.equalsIgnoreCase("N") && mfgPlan.equalsIgnoreCase("N")) //if (matPlan.equalsIgnoreCase("N") && mfgPlan.equalsIgnoreCase("N"))
if ("N".equalsIgnoreCase(matPlan) && "N".equalsIgnoreCase(mfgPlan))
{ {
final String[] detTitles = { "Item Code", "Due Date", "Demand", final String[] detTitles = { "Item Code", "Due Date", "Demand",
"Supply", "Tran Id", "Tran Series" }; "Supply", "Tran Id", "Tran Series" };
...@@ -13896,9 +14065,10 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -13896,9 +14065,10 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
rowDet.getCell(5).setCellValue(tranSerDet); rowDet.getCell(5).setCellValue(tranSerDet);
} }
} else if (matPlan.equalsIgnoreCase("Y") && mfgPlan.equalsIgnoreCase("N")) } //else if (matPlan.equalsIgnoreCase("Y") && mfgPlan.equalsIgnoreCase("N"))
else if ("Y".equalsIgnoreCase(matPlan) && "N".equalsIgnoreCase(mfgPlan))
{ {
if (wnName1.trim().equals("w_requirement")) if ("w_requirement".equals(wnName1.trim())) //if (wnName1.trim().equals("w_requirement"))
{ {
final String[] detTitles = { "Item Code", "Due Date", final String[] detTitles = { "Item Code", "Due Date",
"Demand", "Supply", "Stock Qty", "Other Supply", "Demand", "Supply", "Stock Qty", "Other Supply",
...@@ -14816,7 +14986,14 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -14816,7 +14986,14 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
} }
return value; return value;
} }
public String checkNullTrim(String input)
{
if (input == null || "null".equalsIgnoreCase(input) || input.trim().length() == 0)
{
input= "";
}
return input.trim();
}
private HashMap<String, ADPElement> getAltItemSupply(String siteCode,String itemCode,String altitemPerc) throws ITMException private HashMap<String, ADPElement> getAltItemSupply(String siteCode,String itemCode,String altitemPerc) throws ITMException
{ {
double demand = 0; double demand = 0;
...@@ -15157,17 +15334,20 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -15157,17 +15334,20 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
String strQuery=""; String strQuery="";
try try
{ {
if (matPlan.equalsIgnoreCase("N") && mfgPlan.equalsIgnoreCase("N")) //if (matPlan.equalsIgnoreCase("N") && mfgPlan.equalsIgnoreCase("N"))
if ("N".equalsIgnoreCase(matPlan) && "N".equalsIgnoreCase(mfgPlan))
{ {
//sqlFileName = CommonConstants.JBOSSHOME + File.separator + "sql" + File.separator + "demandsupplyforecastonly"; //sqlFileName = CommonConstants.JBOSSHOME + File.separator + "sql" + File.separator + "demandsupplyforecastonly";
adpQuery = checkNull(externalSqlMap.get("demandsupplyforecastonlyOracle")); adpQuery = checkNull(externalSqlMap.get("demandsupplyforecastonlyOracle"));
} }
else if (matPlan.equalsIgnoreCase("Y") && mfgPlan.equalsIgnoreCase("N")) //else if (matPlan.equalsIgnoreCase("Y") && mfgPlan.equalsIgnoreCase("N"))
else if ("Y".equalsIgnoreCase(matPlan) && "N".equalsIgnoreCase(mfgPlan))
{ {
//System.out.println("BASEwnName1["+wnName1+"]"); //System.out.println("BASEwnName1["+wnName1+"]");
if(wnName1.trim().equals("w_requirement")) //if(wnName1.trim().equals("w_requirement"))
if("w_requirement".equals(wnName1.trim()))
{ {
//sqlFileName = CommonConstants.JBOSSHOME + File.separator + "sql" + File.separator + "demandsupplymaterialReq"; //sqlFileName = CommonConstants.JBOSSHOME + File.separator + "sql" + File.separator + "demandsupplymaterialReq";
adpQuery = checkNull(externalSqlMap.get("demandsupplymaterialReqOracle")); adpQuery = checkNull(externalSqlMap.get("demandsupplymaterialReqOracle"));
...@@ -15385,17 +15565,19 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe ...@@ -15385,17 +15565,19 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
Timestamp dueDate=null; Timestamp dueDate=null;
try try
{ {
if (matPlan.equalsIgnoreCase("N") && mfgPlan.equalsIgnoreCase("N")) //if (matPlan.equalsIgnoreCase("N") && mfgPlan.equalsIgnoreCase("N"))
if ("N".equalsIgnoreCase(matPlan) && "N".equalsIgnoreCase(mfgPlan))
{ {
//sqlFileName = CommonConstants.JBOSSHOME + File.separator + "sql" + File.separator + "demandsupplyforecastonly"; //sqlFileName = CommonConstants.JBOSSHOME + File.separator + "sql" + File.separator + "demandsupplyforecastonly";
adpQuery = checkNull(externalSqlMap.get("demandsupplyforecastonlyOracle")); adpQuery = checkNull(externalSqlMap.get("demandsupplyforecastonlyOracle"));
} }
else if (matPlan.equalsIgnoreCase("Y") && mfgPlan.equalsIgnoreCase("N")) //else if (matPlan.equalsIgnoreCase("Y") && mfgPlan.equalsIgnoreCase("N"))
else if ("Y".equalsIgnoreCase(matPlan) && "N".equalsIgnoreCase(mfgPlan))
{ {
//System.out.println("BASEwnName1["+wnName1+"]"); //System.out.println("BASEwnName1["+wnName1+"]");
if(wnName1.trim().equals("w_requirement")) if("w_requirement".equals(wnName1.trim()))//if(wnName1.trim().equals("w_requirement"))
{ {
//sqlFileName = CommonConstants.JBOSSHOME + File.separator + "sql" + File.separator + "demandsupplymaterialReq"; //sqlFileName = CommonConstants.JBOSSHOME + File.separator + "sql" + File.separator + "demandsupplymaterialReq";
adpQuery = checkNull(externalSqlMap.get("demandsupplymaterialReqOracle")); adpQuery = checkNull(externalSqlMap.get("demandsupplymaterialReqOracle"));
......
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