Commit 1e48f383 authored by manohar's avatar manohar

Few changes in xml generation and adjustment


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@102261 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 40b367cb
...@@ -857,6 +857,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -857,6 +857,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
System.out.println("Checking for item_code="+detailMap.get("ITEM_CODE")+"in site="+suppSiteCode+"for quantity"+detailMap.get("QUANTITY")); System.out.println("Checking for item_code="+detailMap.get("ITEM_CODE")+"in site="+suppSiteCode+"for quantity"+detailMap.get("QUANTITY"));
System.out.println("worderExpLevSufficient before checkCurrentSiteStock ["+worderExpLevSufficient+"]"); System.out.println("worderExpLevSufficient before checkCurrentSiteStock ["+worderExpLevSufficient+"]");
System.out.println("@@checkForother before Current site detailMap@@ : "+detailMap); System.out.println("@@checkForother before Current site detailMap@@ : "+detailMap);
detailMap.put("IS_ALTERNATE", "N");
stockReturnMap = checkCurrentSiteStock(detailMap, conn);//Check for Other site stockReturnMap = checkCurrentSiteStock(detailMap, conn);//Check for Other site
System.out.println("@@checkForother after Current site stockReturnMap@@ : "+stockReturnMap); System.out.println("@@checkForother after Current site stockReturnMap@@ : "+stockReturnMap);
System.out.println("worderExpLevSufficient after checkCurrentSiteStock ["+worderExpLevSufficient+"]"); System.out.println("worderExpLevSufficient after checkCurrentSiteStock ["+worderExpLevSufficient+"]");
...@@ -1044,11 +1045,11 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -1044,11 +1045,11 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
private String explodBomAndPopulateBean(ArrayList<String> workOrderList,Connection conn) throws ITMException,Exception private String explodBomAndPopulateBean(ArrayList<String> workOrderList,Connection conn) throws ITMException,Exception
{ {
System.out.println("iNSIDE EXPLODE bomMMMMMM"); System.out.println("iNSIDE EXPLODE bomMMMMMM");
ExplodeBom explodeBomObj = new ExplodeBom(); ExplodeBom explodeBomObj = null;
WorkOrderDetailBean worderDetailBeanObj = null; WorkOrderDetailBean worderDetailBeanObj = null;
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(genericUtility.getDBDateFormat()); SimpleDateFormat simpleDateFormat = new SimpleDateFormat(genericUtility.getDBDateFormat());
String xmlDataString = "",sql = "",itemCode = "",siteCode = "",bomCode = "",lineType = "B",considerPartialAlt = "", String xmlDataString = "",sql = "",itemCode = "",siteCode = "",bomCode = "",lineType = "B",considerPartialAlt = "",lineTypeBomDet = "",
childNodeName = null,itemDescr = ""; childNodeName = null,itemDescr = "";
double batchQty =0,qtyPer = 0,quantity = 0,minQty = 0,roundTo =0,minPotencyPerc = 0,balanceQty = 0; double batchQty =0,qtyPer = 0,quantity = 0,minQty = 0,roundTo =0,minPotencyPerc = 0,balanceQty = 0;
boolean isSufficient = false; boolean isSufficient = false;
...@@ -1070,6 +1071,8 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -1070,6 +1071,8 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
int childNodeListLength = 0; int childNodeListLength = 0;
Document dom = null; Document dom = null;
Map<String,String>stockDetailMap = new HashMap<String,String>(); Map<String,String>stockDetailMap = new HashMap<String,String>();
StringBuffer xmlString = null;
//String retXMLStr = null;
try try
{ {
...@@ -1079,6 +1082,13 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -1079,6 +1082,13 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
{ {
for(String tempWorkorder : workOrderList) for(String tempWorkorder : workOrderList)
{ {
itemCode = "";
siteCode = "";
quantity = 0;
dueDate =null;
bomCode = "";
worderType = "";
sql = "select item_code,site_code,quantity,bom_code,due_date,order_type from workorder where work_order = ?"; sql = "select item_code,site_code,quantity,bom_code,due_date,order_type from workorder where work_order = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1,tempWorkorder); pstmt.setString(1,tempWorkorder);
...@@ -1091,16 +1101,13 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -1091,16 +1101,13 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
dueDate =rs.getTimestamp("due_date"); dueDate =rs.getTimestamp("due_date");
bomCode = checkNull(rs.getString("bom_code")); bomCode = checkNull(rs.getString("bom_code"));
worderType = checkNull(rs.getString("order_type"));//Changed by wasim on 29-03-2016 to get the order type worderType = checkNull(rs.getString("order_type"));//Changed by wasim on 29-03-2016 to get the order type
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
simpleDateFormat = new SimpleDateFormat(genericUtility.getDBDateFormat()); simpleDateFormat = new SimpleDateFormat(genericUtility.getDBDateFormat());
dueDateStr = simpleDateFormat.format(dueDate); dueDateStr = simpleDateFormat.format(dueDate);
System.out.println("dueDateStr---->>["+dueDateStr+"]"); System.out.println("dueDateStr---->>["+dueDateStr+"]");
StringBuffer xmlString = new StringBuffer("<Root>"); xmlString = null;
String retXMLStr = null; xmlString = new StringBuffer("<Root>");
//retXMLStr = null;
xmlDataString = "";
xmlString.append("<Detail>"); xmlString.append("<Detail>");
xmlString.append("<work_order>").append("<![CDATA[").append(tempWorkorder).append("]]>").append("</work_order>"); xmlString.append("<work_order>").append("<![CDATA[").append(tempWorkorder).append("]]>").append("</work_order>");
xmlString.append("<site_code>").append("<![CDATA[").append(siteCode).append("]]>").append("</site_code>"); xmlString.append("<site_code>").append("<![CDATA[").append(siteCode).append("]]>").append("</site_code>");
...@@ -1115,9 +1122,10 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -1115,9 +1122,10 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
xmlString.append("</Root>"); xmlString.append("</Root>");
//make xml from workorder. //make xml from workorder.
//Explod BOM. Use existing component //Explod BOM. Use existing component
System.out.println("Before explodebom xmlString [" + xmlString.toString()+"]");
explodeBomObj = new ExplodeBom();
xmlDataString = checkNull(explodeBomObj.explodeBom(xmlString.toString()).toString()); xmlDataString = checkNull(explodeBomObj.explodeBom(xmlString.toString()).toString());
explodeBomObj = null;
System.out.println("xmlDataString in getExplodBomDetails----->>["+xmlDataString+"]"); System.out.println("xmlDataString in getExplodBomDetails----->>["+xmlDataString+"]");
...@@ -1153,7 +1161,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -1153,7 +1161,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
operation = checkNull(eElement.getElementsByTagName("operation").item(0).getTextContent()); operation = checkNull(eElement.getElementsByTagName("operation").item(0).getTextContent());
operationInt = Integer.parseInt(operation.length() == 0 ? "0" : operation); operationInt = Integer.parseInt(operation.length() == 0 ? "0" : operation);
critItem = checkNull(eElement.getElementsByTagName("crit_Item").item(0).getTextContent()); critItem = checkNull(eElement.getElementsByTagName("crit_Item").item(0).getTextContent());
lineType = checkNull(eElement.getElementsByTagName("line_type").item(0).getTextContent()); lineTypeBomDet = checkNull(eElement.getElementsByTagName("line_type").item(0).getTextContent());
considerPartialAlt = checkNull(eElement.getElementsByTagName("consider_partial_alt").item(0).getTextContent()); considerPartialAlt = checkNull(eElement.getElementsByTagName("consider_partial_alt").item(0).getTextContent());
unit = checkNull(eElement.getElementsByTagName("unit").item(0).getTextContent()); unit = checkNull(eElement.getElementsByTagName("unit").item(0).getTextContent());
...@@ -1224,7 +1232,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -1224,7 +1232,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
worderDetailBeanObj.setMfgRef(mfgRef); worderDetailBeanObj.setMfgRef(mfgRef);
worderDetailBeanObj.setMinReqQty(Double.valueOf(minReqQtyStr.length() == 0 ? "0" : minReqQtyStr)); worderDetailBeanObj.setMinReqQty(Double.valueOf(minReqQtyStr.length() == 0 ? "0" : minReqQtyStr));
worderDetailBeanObj.setLineType(lineType); worderDetailBeanObj.setLineType(lineTypeBomDet);
worderDetailBeanObj.setUnit(unit); worderDetailBeanObj.setUnit(unit);
//Changed by wasim to set batch quantity as work order quantity //Changed by wasim to set batch quantity as work order quantity
System.out.println("Batch Quantity="+quantity); System.out.println("Batch Quantity="+quantity);
...@@ -1275,6 +1283,11 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -1275,6 +1283,11 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
{ {
//return error messages. //return error messages.
} }
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}//end workOrderList for }//end workOrderList for
...@@ -1320,7 +1333,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -1320,7 +1333,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
int count1 = 0, cnt = 0, stkindex = -1; int count1 = 0, cnt = 0, stkindex = -1;
double finalAllocatedQty = 0, ItemStdPotency = 100, qtyPerArt = 0,finalAllocQty = 0,updQtyOriginal = 0; double finalAllocatedQty = 0, ItemStdPotency = 100, qtyPerArt = 0,finalAllocQty = 0,updQtyOriginal = 0;
Timestamp expDateWorkOrder = null; Timestamp expDateWorkOrder = null;
String trackShelfLifeFG = "",controlledYnFG = "",queryString = ""; String trackShelfLifeFG = "",controlledYnFG = "",queryString = "", balQtyStr = "0";
String sqlUpd = ""; String sqlUpd = "";
PreparedStatement pstmtUpd = null; PreparedStatement pstmtUpd = null;
ResultSet rsExpDate = null; ResultSet rsExpDate = null;
...@@ -1420,8 +1433,13 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -1420,8 +1433,13 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
pstmt = null; pstmt = null;
System.out.println("in checkCurrentSiteStock detailMap["+detailMap +"]"); System.out.println("in checkCurrentSiteStock detailMap["+detailMap +"]");
balQtyStr = detailMap.get("BALANCE_QTY");
if(balQtyStr == null || "null".equals(balQtyStr) || balQtyStr.trim().length() == 0)
{
balQtyStr = "0";
}
shortageQty = Double.parseDouble(detailMap.get("BALANCE_QTY")); shortageQty = Double.parseDouble(balQtyStr);
System.out.println("shortageQty......................"+shortageQty); System.out.println("shortageQty......................"+shortageQty);
if(shortageQty> 0) if(shortageQty> 0)
{ {
...@@ -2283,14 +2301,34 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -2283,14 +2301,34 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
currentLotQty = worderStkBeanObj.getAllocQty();//allocated currentLotQty = worderStkBeanObj.getAllocQty();//allocated
System.out.println("***WorkOrder["+worderStkBeanObj.getWorkOrder()+"] and ExpLev["+worderStkBeanObj.getExpLevel()+"]"); System.out.println("***WorkOrder["+worderStkBeanObj.getWorkOrder()+"] and ExpLev["+worderStkBeanObj.getExpLevel()+"]");
System.out.println("***Main bomdet Quantity["+requiredStock+"] Available ["+availableStock+"] Current Lot Qty ["+currentLotQty+"] Balance ["+balance+"] Site code ["+worderStkBeanObj.getSiteCode()+"]"); System.out.println("***Main bomdet Quantity["+requiredStock+"] Available before ["+availableStock+"] Current Lot Qty ["+currentLotQty+"] Balance ["+balance+"] Site code ["+worderStkBeanObj.getSiteCode()+"]");
/*sql = "SELECT quantity - ALLOC_QTY FROM STOCK where item_code = ? and site_code = ? and loc_code = ? "
+" and lot_no = ? and lot_sl = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, worderStkBeanObj.getItemCode());
pstmt.setString(2, worderStkBeanObj.getSiteCode());
pstmt.setString(3, worderStkBeanObj.getLocCode());
pstmt.setString(4, worderStkBeanObj.getLotNo());
pstmt.setString(5, worderStkBeanObj.getLotSl());
rs = pstmt.executeQuery();
if(rs.next())
{
availableStock = rs.getDouble(1);
}
rs.close();
rs = null;
pstmt.close();
System.out.println("***Main bomdet Quantity["+requiredStock+"] Available after ["+availableStock+"]");
*/
if("Y".equalsIgnoreCase(matchPotency)) if("Y".equalsIgnoreCase(matchPotency))
{ {
ItemStdPotency = getItemStandardPotency(itemCode, conn); ItemStdPotency = getItemStandardPotency(itemCode, conn);
System.out.println("@@ItemCode["+itemCode+"] and @@ItemStdPotency="+ItemStdPotency); System.out.println("@@ItemCode["+itemCode+"] and @@ItemStdPotency="+ItemStdPotency);
//if(currentLotQty < balance) // if stock not sufficient //if(currentLotQty < balance) // if stock not sufficient
//if (availableStock > 0)
//{
if(availableStock <= balance)//Changed by wasim on 18-04-2016 as discussion with manohar sir if(availableStock <= balance)//Changed by wasim on 18-04-2016 as discussion with manohar sir
{ {
...@@ -2436,6 +2474,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -2436,6 +2474,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
} }
}//End }//End
//}
System.out.println("manohar after potency calculation balance 44["+balance+"]" ); System.out.println("manohar after potency calculation balance 44["+balance+"]" );
if(balance > 0) if(balance > 0)
{ {
...@@ -2784,13 +2823,13 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -2784,13 +2823,13 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
} }
} }
} }
else //else
{ //{
System.out.println("allocated stock is sufficient after potency adjustment [" + workOrderPotency+ "] expLevelNew [" + expLevelNew+"]"); // System.out.println("allocated stock is sufficient after potency adjustment [" + workOrderPotency+ "] expLevelNew [" + expLevelNew+"]");
worderExpLevSufficient.put(workOrderPotency+":"+expLevelNew, true); // worderExpLevSufficient.put(workOrderPotency+":"+expLevelNew, true);
updateWoBeanSufficient(workOrderPotency, expLevelNew, "Y"); // updateWoBeanSufficient(workOrderPotency, expLevelNew, "Y");
//
} //}
} }
else else
{ {
...@@ -2836,7 +2875,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -2836,7 +2875,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
detailMap.put("STOCK_DETAIL", "Y"); detailMap.put("STOCK_DETAIL", "Y");
detailMap.put("MIN_QTY_REQ", String.valueOf(worderDetailBeanObj.getMinReqQty())); detailMap.put("MIN_QTY_REQ", String.valueOf(worderDetailBeanObj.getMinReqQty()));
//detailMap.put("BALANCE_QTY",potencyAdjExpLev+""); detailMap.put("BALANCE_QTY","0");
isReallocation = true; // 09-mar-16 manoharan reallocation templist to be populated isReallocation = true; // 09-mar-16 manoharan reallocation templist to be populated
//checkCurrentSiteStock(detailMap,conn); // 09-mar-16 manoharan commented return value to be captured and checked //checkCurrentSiteStock(detailMap,conn); // 09-mar-16 manoharan commented return value to be captured and checked
detailMap.put("PACK_LOT_NO", lotNoIssue); detailMap.put("PACK_LOT_NO", lotNoIssue);
......
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