Commit 8a1d44bf authored by caluka's avatar caluka

no of batch changes then insert new recard in mps order table


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@97196 ce508802-f39f-4f6c-b175-0d175dae99d5
parent d1f6d53d
...@@ -144,6 +144,7 @@ public class RequirementIC extends ValidatorEJB implements RequirementICLocal, R ...@@ -144,6 +144,7 @@ public class RequirementIC extends ValidatorEJB implements RequirementICLocal, R
String winName = ""; // Added by sachin on 26/6/13 String winName = ""; // Added by sachin on 26/6/13
double batchReq = 0d; double batchReq = 0d;
GenericUtility genericUtility = GenericUtility.getInstance(); GenericUtility genericUtility = GenericUtility.getInstance();
try try
...@@ -226,6 +227,7 @@ public class RequirementIC extends ValidatorEJB implements RequirementICLocal, R ...@@ -226,6 +227,7 @@ public class RequirementIC extends ValidatorEJB implements RequirementICLocal, R
valueXmlString.append("<quantity>").append("<![CDATA[" + getRequiredDecimal(quantity, 3) + "]]>").append("</quantity>\r\n"); valueXmlString.append("<quantity>").append("<![CDATA[" + getRequiredDecimal(quantity, 3) + "]]>").append("</quantity>\r\n");
valueXmlString.append("<bom_code>").append("<![CDATA[" + rs.getString("BOM_CODE") + "]]>").append("</bom_code>\r\n"); valueXmlString.append("<bom_code>").append("<![CDATA[" + rs.getString("BOM_CODE") + "]]>").append("</bom_code>\r\n");
valueXmlString.append("<mpsorder>").append("<![CDATA[" + rs.getString("MPSORDER") + "]]>").append("</mpsorder>\r\n"); valueXmlString.append("<mpsorder>").append("<![CDATA[" + rs.getString("MPSORDER") + "]]>").append("</mpsorder>\r\n");
valueXmlString.append("<batch_qty>").append("<![CDATA[" + getRequiredDecimal(batchQty, 3) + "]]>").append("</batch_qty>\r\n");//Added by chandrashekar 0n 30-Jan-2015
valueXmlString.append("</Detail2>"); valueXmlString.append("</Detail2>");
} }
rs.close(); rs.close();
...@@ -246,6 +248,7 @@ public class RequirementIC extends ValidatorEJB implements RequirementICLocal, R ...@@ -246,6 +248,7 @@ public class RequirementIC extends ValidatorEJB implements RequirementICLocal, R
valueXmlString.append("<unit protect = '1'>").append("").append("</unit>\r\n"); valueXmlString.append("<unit protect = '1'>").append("").append("</unit>\r\n");
valueXmlString.append("<bom_code>").append("").append("</bom_code>\r\n"); valueXmlString.append("<bom_code>").append("").append("</bom_code>\r\n");
valueXmlString.append("<mpsorder>").append("").append("</mpsorder>\r\n"); valueXmlString.append("<mpsorder>").append("").append("</mpsorder>\r\n");
valueXmlString.append("<batch_qty>").append("").append("</batch_qty>\r\n");
valueXmlString.append("</Detail2>"); valueXmlString.append("</Detail2>");
} }
...@@ -347,6 +350,7 @@ public class RequirementIC extends ValidatorEJB implements RequirementICLocal, R ...@@ -347,6 +350,7 @@ public class RequirementIC extends ValidatorEJB implements RequirementICLocal, R
} }
} }
} }
}// End of Inner for loop }// End of Inner for loop
if (itemCode != null && itemCode.trim().length() > 0) if (itemCode != null && itemCode.trim().length() > 0)
{ {
...@@ -390,9 +394,8 @@ public class RequirementIC extends ValidatorEJB implements RequirementICLocal, R ...@@ -390,9 +394,8 @@ public class RequirementIC extends ValidatorEJB implements RequirementICLocal, R
pstmtSel.clearParameters(); pstmtSel.clearParameters();
rs.close(); rs.close();
rs = null; rs = null;
// quantity = batchQty * noOfBatch; // quantity = batchQty * noOfBatch;
//tranIdSuffix++; //tranIdSuffix++;
if(!"MPS".equalsIgnoreCase(mpsOrder)) if(!"MPS".equalsIgnoreCase(mpsOrder))
{ {
...@@ -421,6 +424,58 @@ public class RequirementIC extends ValidatorEJB implements RequirementICLocal, R ...@@ -421,6 +424,58 @@ public class RequirementIC extends ValidatorEJB implements RequirementICLocal, R
pstmtIns.addBatch(); pstmtIns.addBatch();
pstmtIns.clearParameters(); pstmtIns.clearParameters();
} }
else
{
selectSql = "SELECT A.SITE_CODE, A.ITEM_CODE, B.DESCR, A.UNIT, C.BATCH_QTY, SUM(A.QUANTITY) AS QUANTITY," +
" C.BOM_CODE ,'MPS' AS MPSORDER " + "FROM MPS_ORDER A, ITEM B ,BOM C " + "WHERE ( A.ITEM_CODE = B.ITEM_CODE (+)) "
+ "AND A.SITE_CODE = ? AND A.ITEM_CODE = ? " + "AND A.STATUS IN ('P','T','M') " + "AND A.BOM_CODE=C.BOM_CODE "
+ "GROUP BY A.SITE_CODE, A.ITEM_CODE, B.DESCR, A.UNIT, C.BATCH_QTY, C.BOM_CODE";
pstmt = conn.prepareStatement(selectSql);
pstmt.setString(1, siteCodeFr);
pstmt.setString(2, itemCode);
rs = pstmt.executeQuery();
while (rs.next())
{
double mpsQuantity = rs.getDouble("QUANTITY");
System.out.println("mpsQuantity>>>"+mpsQuantity);
System.out.println("quantity>>>"+quantity);
if(quantity != mpsQuantity && quantity > mpsQuantity)
{
tranidIncrement=generateTranId("w_mps_order",loginSiteCode,orderType,conn);
String newTranId = "";
newTranId = newTranId + tranidIncrement;
System.out.println("newTranId for updated["+newTranId+"]");
tranIdList.add(newTranId);
System.out.println("insert qty>>>"+(quantity-mpsQuantity));
insertSql = "INSERT INTO MPS_ORDER(TRAN_ID, ORDER_TYPE, ITEM_CODE, SITE_CODE, QUANTITY, ORD_DATE, DUE_DATE, STATUS, STATUS_DATE, YIELD_PERC, UNIT , BOM_CODE ) VALUES( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )";
pstmtIns = conn.prepareStatement(insertSql);
pstmtIns.setString(1, newTranId);
pstmtIns.setString(2, orderType);
pstmtIns.setString(3, itemCode);
pstmtIns.setString(4, siteCode);
pstmtIns.setDouble(5, (quantity-mpsQuantity));
pstmtIns.setTimestamp(6, sysDate);
pstmtIns.setTimestamp(7, newsysdate);
pstmtIns.setString(8, status);
pstmtIns.setTimestamp(9, sysDate);
pstmtIns.setDouble(10, yieldPerc);
pstmtIns.setString(11, unit);
pstmtIns.setString(12, bomCode);
pstmtIns.executeUpdate();
//pstmtIns.addBatch();
//pstmtIns.clearParameters();
}
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
} }
} }
noOfItem = itemTreeSet.size(); noOfItem = itemTreeSet.size();
...@@ -453,6 +508,18 @@ public class RequirementIC extends ValidatorEJB implements RequirementICLocal, R ...@@ -453,6 +508,18 @@ public class RequirementIC extends ValidatorEJB implements RequirementICLocal, R
conn.commit(); conn.commit();
} }
} }
else
{
if(conn != null)
{
conn.commit();
}
}
if(pstmtIns != null)
{
pstmtIns.close();
pstmtIns= null;
}
Calendar cal = Calendar.getInstance(); Calendar cal = Calendar.getInstance();
Date d = new Date(); Date d = new Date();
String runDate = simpleDateFormat.format(d); String runDate = simpleDateFormat.format(d);
......
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