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
double batchQty = 0;
double roundTo = 0;
char round;
String roundStr= "";
String roundToStr= "";
String suppCodeMfg= "",useInvStatus = "",mfgRef = "",dimension = "";
double minReqQty = 0;
......@@ -201,8 +203,24 @@ public class ExplodeBom
minQty = rs.getDouble(7);
operation = rs.getInt(8);
critItem = rs.getString(9);
round = rs.getString(10).charAt(0);
roundTo = rs.getDouble(11);
/**Modified by Pavan Rane 24dec19 start[system should take default value and to not give error in any definition not found.]*/
//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
matchPotency = rs.getString(12);
minPotencyPerc = rs.getDouble(13);
......@@ -313,17 +331,18 @@ public class ExplodeBom
//end by rajendra
//System.out.println("Item Code : " + itemCodeBomDet + "Item Ref : " + itemRef + " Line Type " + lineType);
if (lineType.equals("B"))
{
if (reqType.equals("S"))
//if (lineType.equals("B"))
if ("B".equals(lineType))
{
if ("S".equals(reqType))//if (reqType.equals("S"))
{
quantityUpdate = (quantity / batchQty) * perQty;
}
else if (reqType.equals("P"))
}
else if ("P".equals(reqType))//else if (reqType.equals("P"))
{
quantityUpdate = (perQty / batchQty) * quantity;
}
else if (reqType.equals("F"))
else if ("F".equals(reqType))//else if (reqType.equals("F"))
{
quantityUpdate = perQty;
}
......@@ -443,7 +462,7 @@ public class ExplodeBom
{
lineTypeInner = rsInner.getString(1);
if (!lineTypeInner.equals("F"))
if (!"F".equals(lineTypeInner))
{
lineTypeInner = "I";
}
......@@ -596,7 +615,7 @@ public class ExplodeBom
valueXmlString.append("</Detail>");
//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 to calculate due_date based on batch size
......@@ -752,5 +771,8 @@ public class ExplodeBom
//nf.setMaximumIntegerDigits(10);
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
{
errString = "";
String resultString = "",windowName1="",bomCodeParent= "",bomLevelStr="";
ResultSet rs = null;
//ResultSet rs = null;
this.wnName=windowName;
long endTime = 0, totalTime = 0, totalHrs = 0, totlMts = 0, totSecs = 0; // Added
......@@ -749,7 +749,7 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
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.........");
errString = populateAllItem();
......@@ -897,7 +897,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
BaseLogger.log("0", null, null, "Error While Populating ADPEList:..." + 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();
if (errString != null && errString.trim().length() > 0)
......@@ -965,7 +966,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
// 31/01/2008 manoharan not to insert plan demand in case of
// verification
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
//if(!isDetailReq)
......@@ -994,17 +996,18 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
int noOfPlan = 0;
//Statement stmt = 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 = "";
} else
{
if (mfgPlan.equalsIgnoreCase("Y"))
if ("Y".equalsIgnoreCase(mfgPlan))//if (mfgPlan.equalsIgnoreCase("Y"))
{
lsWhere = lsWhere + "'M'";
noOfPlan = noOfPlan + 1;
}
if (disPlan.equalsIgnoreCase("Y"))
if ("Y".equalsIgnoreCase(disPlan))//if (disPlan.equalsIgnoreCase("Y"))
{
if (noOfPlan == 0)
{
......@@ -1015,7 +1018,7 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
}
noOfPlan = noOfPlan + 1;
}
if (matPlan.equalsIgnoreCase("Y"))
if ("Y".equalsIgnoreCase(matPlan))//if (matPlan.equalsIgnoreCase("Y"))
{
if (noOfPlan == 0)
{
......@@ -1182,7 +1185,7 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
errStringXml.append(bifurErrString);
errString = "";
}
if (errorType.equalsIgnoreCase("E")) {
if ("E".equalsIgnoreCase(errorType)) {
break;
}
}
......@@ -1742,7 +1745,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
//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);
//System.out.println(">>>>>>>In val getData bomLevelStr:"+bomLevelStr);
......@@ -1834,7 +1838,7 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
{
//stmt = conn.createStatement();
standingOrdTypes = itmDBAccessEJB.getEnvDis("999999", "STANDING_ORDTYPES", conn);
if (standingOrdTypes.equals("NULLFOUND"))
if ("NULLFOUND".equals(standingOrdTypes))//if (standingOrdTypes.equals("NULLFOUND"))
{
standingOrdTypes = "";
}
......@@ -1885,7 +1889,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
}
rs.close();rs = 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";
}
......@@ -1914,7 +1919,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
BaseLogger.log("3", null, null,"mrpTrackTranId:..............." + mrpTrackTranId);
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;
} else
......@@ -1930,22 +1936,26 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
BaseLogger.log("3", null, null,"MrpClubbingHorizon:..........." + MrpClubbingHorizon);
mrpDynMinStk = itmDBAccessEJB.getEnvDis("999999", "MRP_DYN_MIN_STK", conn);
if (mrpDynMinStk.equals("NULLFOUND"))
//if (mrpDynMinStk.equals("NULLFOUND"))
if ("NULLFOUND".equals(mrpDynMinStk))
mrpDynMinStk = "N";
BaseLogger.log("3", null, null,"mrpDynMinStk:................." + mrpDynMinStk);
roundReqTo = itmDBAccessEJB.getEnvDis("999999", "ROUND_REQ_TO", conn);
if (roundReqTo.equals("NULLFOUND"))
//if (roundReqTo.equals("NULLFOUND"))
if ("NULLFOUND".equals(roundReqTo))
roundReqTo = "N";
BaseLogger.log("3", null, null,"roundReqTo:................." + roundReqTo);
minOrderChk = itmDBAccessEJB.getEnvDis("999999", "MIN_ORDER_CHK", conn);
if (minOrderChk.equals("NULLFOUND"))
//if (minOrderChk.equals("NULLFOUND"))
if ("NULLFOUND".equals(minOrderChk))
minOrderChk = "N";
BaseLogger.log("3", null, null,"minOrderChk:................." + minOrderChk);
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
{
......@@ -2309,8 +2319,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
//if(masterSh.equalsIgnoreCase("Y"))
//{
/**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";
//System.out.println("BASEsqlFileName---"+sqlFileName);
//BaseLogger.log( "0", null, null, "BASEsqlFileName---"+sqlFileName);
......@@ -2352,7 +2362,7 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
pstmt1 = null;
}
//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";
//System.out.println("BASEsqlFileName---"+sqlFileName);
......@@ -2498,10 +2508,10 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
while (itrSite.hasNext())
{
Map.Entry siteMapEntry = (Map.Entry) itrSite.next();
if (isBomReplace)
/*if (isBomReplace)
{
//System.out.println("12/06/14 manohar itemArr.size() [" + itemArr.size() + "]");
}
}*/
rowCount++;
// (String)siteMapEntry.getKey());
int ctr;
......@@ -2512,14 +2522,27 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
siteCode = (String) siteMapEntry.getKey(); //Piyush
//System.out.println("(String)itemArr.get(ctr)--" + (String) itemArr.get(ctr));
//suppSour = getSuppSour((String) siteMapEntry.getKey(), (String) itemArr.get(ctr));
suppSour = getSuppSour(siteCode, itemCode); // Piyush
suppSour = suppSour.trim();
suppSour = getSuppSour(siteCode, itemCode); // Piyush
//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(siteCode, itemCode); // Piyush
//System.out.println("SuppSour---" + suppSour + "bomCode--" + bomCode);
// System.out.println("populateAllItem(): Supp_Sour:..." +
// 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();
level = 1;
......@@ -2625,14 +2648,14 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
pstmtValidBom.close();
pstmtValidBom = null;
// 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);
validBomItemCode = (validBomItemCode.trim() + " ").substring(0, 10);
bomCode = (bomCode.trim() + " ").substring(0, 10);
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";
if("Y".equalsIgnoreCase(verifier)) //for error_report @19/09/16
......@@ -2644,7 +2667,7 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
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";
if("Y".equalsIgnoreCase(verifier)) //for error_report @19/09/16
......@@ -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));
boolean isCyclic = false;
//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++)
......@@ -2928,7 +2952,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
// Added by Jiten 07/11/06//
//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");
BaseLogger.log("3", null, null, "Cyclic Item Code is : " + itemCode);
......@@ -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));
}
}
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 : "
// + siteCode + " Item : " + rs.getString(1) + " BOM : "
......@@ -3936,15 +3962,18 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
{
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;
}
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;
}
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;
}
......@@ -4160,11 +4189,26 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
{
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);
}
}else {
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);
//Pavan Rane 09sep19 end[to validate data for mrp report]
......@@ -4260,7 +4304,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
{
orderOpt = "C";
}
if (orderOpt.equals("B") && batchQtyType == null)
//if (orderOpt.equals("B") && batchQtyType == null)
if ("B".equals(orderOpt) && batchQtyType == null)
{
adpElement.setBatchQtyType("V");
}
......@@ -4468,7 +4513,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
{
orderOpt = "C";
}
if (orderOpt.equals("B") && batchQtyType == null)
//if (orderOpt.equals("B") && batchQtyType == null)
if ("B".equals(orderOpt) && batchQtyType == null)
{
adpElement.setBatchQtyType("V");
}
......@@ -4523,11 +4569,13 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
{
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");
}
if (suppSour.equals("M"))
//if (suppSour.equals("M"))
if ("M".equals(suppSour))
{
itemSer = adpElement.getItemSer();
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
adpElement.setCctrCodeWp(cctrCodeWp);
//System.out.println("adpElement@3818=["+adpElement+"]");
sql = "SELECT BATCH_QTY FROM BOM WHERE BOM_CODE = ?";
pstmtInner = conn.prepareStatement(sql);
pstmtInner.setString(1, bomCode);
rsInner = pstmtInner.executeQuery();
if (rsInner.next())
{
adpElement.setBatchQty(rsInner.getDouble(1));
//Modified By Pavan Rane 20dec19 Start [if bom code is null then ignore sql execution and set batchQty = 0.0]
if(bomCode != null && bomCode.trim().length() > 0 && !"null".equals(bomCode))
{
sql = "SELECT BATCH_QTY FROM BOM WHERE BOM_CODE = ?";
pstmtInner = conn.prepareStatement(sql);
pstmtInner.setString(1, bomCode);
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;
pstmtInner.close(); pstmtInner = null;
//Modified By Pavan Rane 20dec19 end [if bom code is null then ignore sql execution and set batchQty = 0.0]
}
//Pavan Rane 09sep19 start [to check mfg_type and batch_qty_type in mrp report missing data validation]
if("B".equals(adpElement.getOrderOpt()))
......@@ -4643,11 +4698,12 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
}
rsInner.close(); rsInner = 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());
}
if (roundReqTo.equals("R"))
}*/
//if (roundReqTo.equals("R"))
if ("R".equals(roundReqTo))
{
//System.out.println("item [" + itemCode + " ] roundReqTo ..[" + roundReqTo + "] setting integral to [" + adpElement.getReoQty() + "]");
adpElement.setIntegralQty(adpElement.getReoQty());
......@@ -5229,17 +5285,20 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
//System.out.println("matPlan---"+matPlan+"----mfgPlan----"+mfgPlan);
//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";
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+"]");
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";
adpQuery = checkNull(externalSqlMap.get("demandsupplymaterialReqOracle"));
......@@ -5589,16 +5648,19 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
System.out.println("isDetailReq***[" + isDetailReq + "]");
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";
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 + "]");
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";
adpDetQuery = checkNull(externalSqlMap.get("demandsupplymaterialReqDetOracle"));
......@@ -5669,7 +5731,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
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();
itemCodeDet = rs.getString("item_code");
......@@ -5688,8 +5751,11 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
demandSupplyList.add(demandSupplyMap);
} else if (matPlan.equalsIgnoreCase("Y") && mfgPlan.equalsIgnoreCase("N")) {
if (wnName1.trim().equals("w_requirement"))
} //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()))
{
HashMap demandSupplyMap = new HashMap();
itemCodeDet = rs.getString("item_code");
......@@ -6908,7 +6974,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
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();
String itemCodeDet = rs.getString("item_code");
......@@ -6932,9 +6999,11 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
demandSupplyMap.put(6, tranSerDet);
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();
String itemCodeDet = rs.getString("item_code");
......@@ -7330,7 +7399,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
runningSupply = timeMrp.getRunningSupply();
runningPlanSupply = timeMrp.getRunningPlanSupply();
//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")
// )
{
......@@ -7365,7 +7435,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
{
// 28-11-2006 manoharan
//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")
// )
{
......@@ -7452,17 +7523,19 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
// if (suppSour.equals("P") &&
// adpElement.getSiteCodeSupp().trim() > 0 ) Changed by
// 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);
}
// ???????? independent demand
// *****************************
if (suppSour.equals("D"))
//if (suppSour.equals("D"))
if ("D".equals(suppSour))
{
// generate a demand for the supply site
if (balIntersite.equals("Y"))
//if (balIntersite.equals("Y"))
if ("Y".equals(balIntersite))
{
String siteIdst = null;
siteIdst = getSurplusStockSite(siteCode, itemCode, quantity, surplusList);
......@@ -7484,11 +7557,26 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
} else
{
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
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
......@@ -7906,7 +7994,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
return adpElement;// errString;
}*/
//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;
int found = -1;
......@@ -7924,7 +8013,17 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
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]
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;
adpeList.set(adpeCtr, adpElement);
break;
......@@ -7943,7 +8042,17 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
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]
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
adpeList.add(adpElement);
}
......@@ -8034,7 +8143,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
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+"]");
if (minStkDay > 0 && mrpDynMinStk.equals("Y"))
//if (minStkDay > 0 && mrpDynMinStk.equals("Y"))
if (minStkDay > 0 && "Y".equals(mrpDynMinStk))
{
stkLevel = getStkLevel(adpElement, dueDate);
} else
......@@ -8047,7 +8157,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
{*/
stkLevel = adpElement.getMinQty();
//}
if (minOrderChk.equals("Y"))
//if (minOrderChk.equals("Y"))
if ("Y".equals(minOrderChk))
{
chkOrdQty = adpElement.getMinOrderQty();
} else
......@@ -8067,13 +8178,15 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
//System.out.println("BASE@@@@2 reqQty" + decFormat(reqQty) );
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();
//System.out.println("BASE25022010 2->Item [" + adpElement.getItemCode() + "] reqQty [" + reqQty + "] reoQty [" + reoQty + "]] integralQty [" + integralQty + "] multiplier [" + multiplier + "]");
} 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();
//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
reoQty = reqQty + stkLevel;
}
//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();
//System.out.println("BASE25022010 9->Item [" + adpElement.getItemCode() + "] reqQty [" + reqQty + "] reoQty [" + reoQty + "]] integralQty [" + integralQty + "] multiplier [" + multiplier + "]");
} 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();
//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
}
}
}
if (minOrderChk.equals("Y"))
//if (minOrderChk.equals("Y"))
if ("Y".equals(minOrderChk))
{
if (reqQty < chkOrdQty && adpElement.getMinQty() < reoQty)
{
......@@ -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 + "]");
}
if (orderOpt.equals("B") && !batchQtyType.equals("V"))
if ("B".equals(orderOpt) && !"V".equals(batchQtyType))//if (orderOpt.equals("B") && !batchQtyType.equals("V"))
{
multiplier = 0;
......@@ -8468,24 +8584,24 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
if( valueNode.getFirstChild() != null )
{
nodeValue = valueNode.getFirstChild().getNodeValue();
if (nodeName.equals("site_code"))
if ("site_code".equals(nodeName))//if (nodeName.equals("site_code"))
{
siteCode = nodeValue;
}
if (nodeName.equals("item_code"))
if ("item_code".equals(nodeName))//if (nodeName.equals("item_code"))
{
itemCode = nodeValue;
}
if (nodeName.equals("quantity"))
if("quantity".equals(nodeName))//if (nodeName.equals("quantity"))
{
//Pavan R 2jun18
quantity = Double.parseDouble(nodeValue);
}
if (nodeName.equals("line_type"))
if("line_type".equals(nodeName))//if (nodeName.equals("line_type"))
{
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");
sdate = nodeValue;
......@@ -8495,23 +8611,23 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
if(!isDetailReq && !isBomReplace)
{
if (nodeName.equals("bom_code"))
if ("bom_code".equals(nodeName))//if (nodeName.equals("bom_code"))
{
bomCode = nodeValue;
}
if (nodeName.equals("batch_qty"))
if ("batch_qty".equals(nodeName))//if (nodeName.equals("batch_qty"))
{
batchQty = Double.parseDouble(nodeValue);
}
if (nodeName.equals("quantity_Ref"))
if ("quantity_Ref".equals(nodeName))//if (nodeName.equals("quantity_Ref"))
{
quantityRef = Double.parseDouble(nodeValue);
}
if (nodeName.equals("qty_per"))
if ("qty_per".equals(nodeName))//if (nodeName.equals("qty_per"))
{
qtyPer = Double.parseDouble(nodeValue);
}
if (nodeName.equals("req_type"))
if ("req_type".equals(nodeName))//if (nodeName.equals("req_type"))
{
reqType = nodeValue;
}
......@@ -8804,7 +8920,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
//tmpadpList.add()
/* added by sachin */
if (wnName.trim().equals("w_requirement"))
//if (wnName.trim().equals("w_requirement"))
if ("w_requirement".equals(wnName.trim()))
{
if (!qtyMap.isEmpty())
{
......@@ -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 = ? ";
if (matPlan.equals("Y"))
//if (matPlan.equals("Y"))
if ("Y".equals(matPlan))
{
pstmt = conn.prepareStatement(sqlIndent);
pstmt.setString(1, siteCode);
......@@ -9214,7 +9332,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
pstmt.close();pstmt = null;
}
if (mfgPlan.equals("Y"))
//if (mfgPlan.equals("Y"))
if ("Y".equals(mfgPlan))
{
pstmt = conn.prepareStatement(sqlMpsOrder);
pstmt.setString(1, siteCode);
......@@ -9250,7 +9369,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
}
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.setString(1, siteCode);
......@@ -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.setString(1, siteCode);
......@@ -9402,7 +9523,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
String errString = "";
// check stk_opt
if (getStkOpt(itemCode, siteCode).equals("0"))
//if (getStkOpt(itemCode, siteCode).equals("0"))
if ("0".equals(getStkOpt(itemCode, siteCode)))
{
return "";
}
......@@ -9458,7 +9580,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
if (independentDemand > 0)
{
// 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
{
......@@ -9499,7 +9622,7 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
}
//System.out.println("@@@@@@cpatil-indDemList["+indDemList+"]");
} else if (orderOpt.equals("C"))
} else if ("C".equals(orderOpt))//else if (orderOpt.equals("C"))
{
int findEle = -1;
IndependentDemand indDem = null;
......@@ -9554,13 +9677,14 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
//System.out.println("Indent creation Plan Supply :" +
// reqQty + " Orderopt " + orderOpt + " Suppsour " +
// 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 :" +
//reqQty + " Orderopt " + orderOpt + " Suppsour " +
//suppSour + " Mat Plan " + matPlan +" batchQty "+batchQty+" batchQtyType "+batchQtyType);
// 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
{
......@@ -9616,7 +9740,7 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
indList.add(indent);
}
//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;
Indent indent = null;
......@@ -9682,14 +9806,16 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
BaseLogger.log("3", null, null, "orderOpt--------"+orderOpt+"---");
} // (( suppSour.equals("P") || suppSour.equals("C") )&&
// 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
// IS SELECTED THEN
// SKIP CREATION OF WORKORDER......AT GNL 10/4/02 BY
// MANOJ AS PER KANDARP
//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");
return "";
......@@ -9697,7 +9823,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
// batchQtyType != v added as per Manoharan Sir - Jiten
// - 02/11/06
//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);
if (reqQty > batchQty && batchQty !=0)//Added by chandrashekar on 27-05-2015
......@@ -9730,10 +9857,10 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
}
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);
for (int planCtr = 0; planCtr < multiplier; planCtr++)
{
......@@ -9880,7 +10007,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
// 02/11/06
// Else if condition added by Jiten as per Manoharan Sir
// - 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+"]");
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
//System.out.println("BASE@@@@210315:mpsOrder.quantity["+mpsOrder.quantity+"]mpsList["+mpsList.size()+"]mpsOrder.addnOrder["+mpsOrder.addnOrder+"]");
}
// 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()+"]");
int findEle = -1;
......@@ -10237,11 +10365,12 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
}
} // ( 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 = " ";
if (balIntersite.equals("Y"))
if ("Y".equals(balIntersite))//if (balIntersite.equals("Y"))
{
String siteIdst = null;
siteIdst = getSurplusStockSite(siteCode, itemCode, reqQty, surplusListOriginal);
......@@ -10385,7 +10514,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
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());
errString = InsertPlanDemand("W_INDENT", indList);
......@@ -10434,10 +10564,16 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
if (rs.next())
{
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();
pstmt.close();
/*rs.close();
pstmt.close();*/
sql = "SELECT STK_OPT FROM ITEM WHERE ITEM_CODE = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, itemCode);
......@@ -10447,8 +10583,18 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
stkOpt = rs.getString(1);
}
}
rs.close();
pstmt.close();
rs.close(); rs=null;
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)
{
//System.out.println("SQLException :RunMRPPrcEJB :getBomCode(String siteCode, String ItemCode).." + e.getMessage());
......@@ -10686,7 +10832,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
// this.genericUtility.getDBDateFormat(),this.genericUtility.getApplDateFormat());
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+"]");
if (winName.equalsIgnoreCase("W_MPS_ORDER"))
//if (winName.equalsIgnoreCase("W_MPS_ORDER"))
if ("W_MPS_ORDER".equalsIgnoreCase(winName))
{
// System.out.println("W_MPS_ORDER");
for (int count = 0; count < list.size(); count++)
......@@ -11087,7 +11234,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
}
//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()+"]");
for (int count = 0; count < list.size(); count++)
......@@ -11249,7 +11397,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
//System.out.println("BASEIPD_INDENT valueMap["+valueMap+"]");
}
//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++)
{
......@@ -11332,7 +11481,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
//System.out.println("BASEIPD_DIST valueMap["+valueMap+"]");
}
//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++)
{
......@@ -11644,7 +11794,7 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
BaseLogger.log("3", null, null, "itemCode----"+itemCode+"---siteCode---"+siteCode);
itemSer = adpElement.getItemSer();
siteCodeSupp = adpElement.getSiteCodeSupp();
suppSour = adpElement.getSuppSour();
suppSour = checkNull(adpElement.getSuppSour()).trim();
bomCode = adpElement.getBomCode();
minQty = adpElement.getMinQty();
minOrderQty = adpElement.getMinOrderQty();
......@@ -11680,15 +11830,18 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
// added by sabyasachi on 29-03-2011 ends
// 02-03-2007 manoharan not to insert if the plan is not
// selected
if (!disPlan.equalsIgnoreCase("Y") && (suppSour.trim().equalsIgnoreCase("D")))
//if (!disPlan.equalsIgnoreCase("Y") && (suppSour.trim().equalsIgnoreCase()))
if (!"Y".equalsIgnoreCase(disPlan) && ("D".equalsIgnoreCase(suppSour)))
{
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;
}
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;
}
......@@ -13608,6 +13761,12 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
//--------4th sheet-end-------------------------
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(genericUtility.getApplDateFormat());
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++)
{
......@@ -13635,13 +13794,15 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
mfgLeadTime = adpElement.getMfgLeadTime();
desc = adpElement.getItemDescr();
PreparedStatement pstmt = null;
//Pavan Rane 19dec19 start[sql added outside the loop]
//PreparedStatement pstmt = null;
ResultSet rs = null;
String sql="";
//String sql="";
//System.out.println("@@@@@ itemCode["+itemCode+"]");
//BaseLogger.log( "0", null, null, "@@@@@ itemCode["+itemCode+"]");
sql = "select item_type from item where item_code = ? ";
pstmt = conn.prepareStatement(sql);
/*sql = "select item_type from item where item_code = ? ";
pstmt = conn.prepareStatement(sql);*/
//Pavan Rane 19dec19 end[sql added outside the loop]
pstmt.setString( 1, itemCode );
rs = pstmt.executeQuery();
if (rs.next())
......@@ -13649,7 +13810,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
itemType = checkNull(rs.getString(1));
}
rs.close();rs = null;
pstmt.close();pstmt = null;
pstmt.clearParameters();
//pstmt.close();pstmt = null;
ArrayList timeMRParr = adpElement.getTimeMrpList();
for (int timeCtr = 0; timeCtr < timeMRParr.size(); timeCtr++)
......@@ -13831,10 +13993,17 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
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
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",
"Supply", "Tran Id", "Tran Series" };
......@@ -13896,9 +14065,10 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
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",
"Demand", "Supply", "Stock Qty", "Other Supply",
......@@ -14816,7 +14986,14 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
}
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
{
double demand = 0;
......@@ -15157,17 +15334,20 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
String strQuery="";
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";
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+"]");
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";
adpQuery = checkNull(externalSqlMap.get("demandsupplymaterialReqOracle"));
......@@ -15385,17 +15565,19 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
Timestamp dueDate=null;
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";
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+"]");
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";
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