Commit 298328f7 authored by manohar's avatar manohar

MF89SUN092 various bugs rectified


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@91590 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 9d245e02
...@@ -530,6 +530,9 @@ public class InvPackAct extends ActionHandlerEJB implements InvPackActLocal, Inv ...@@ -530,6 +530,9 @@ public class InvPackAct extends ActionHandlerEJB implements InvPackActLocal, Inv
ConnDriver connDriver = new ConnDriver(); ConnDriver connDriver = new ConnDriver();
GenericUtility genericUtility = GenericUtility.getInstance(); GenericUtility genericUtility = GenericUtility.getInstance();
ITMDBAccessEJB itmDBAccess = new ITMDBAccessEJB(); ITMDBAccessEJB itmDBAccess = new ITMDBAccessEJB();
PreparedStatement pstmt = null; // 12/03/12 manoharan
String locDescr = "";
double tareTmp = 0, grossTmp = 0, netTmp = 0;
try try
{ {
conn = connDriver.getConnectDB("DriverITM"); conn = connDriver.getConnectDB("DriverITM");
...@@ -601,22 +604,53 @@ public class InvPackAct extends ActionHandlerEJB implements InvPackActLocal, Inv ...@@ -601,22 +604,53 @@ public class InvPackAct extends ActionHandlerEJB implements InvPackActLocal, Inv
{ {
retNumber = 1; retNumber = 1;
} }
// 12/03/12 manoharan
sql = "SELECT DESCR FROM LOCATION WHERE LOC_CODE = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, locCode);
rs = pstmt.executeQuery();
if (rs.next())
{
locDescr = rs.getString(1)==null?"":rs.getString(1);
}
pstmt.close();
rs.close();
pstmt = null;
rs = null;
for (int i = 0; i < Integer.parseInt(noArt); i++) for (int i = 0; i < Integer.parseInt(noArt); i++)
{ {
lotSl = String.valueOf(Long.parseLong(lotSl)+1); lotSl = String.valueOf(Long.parseLong(lotSl)+1);
System.out.println("lotSl :"+lotSl); System.out.println("lotSl :"+lotSl);
// 12/03/12 manoharan itemchanged should not happen for any column as it is working very slow
valueXmlString.append("<Detail>\r\n"); valueXmlString.append("<Detail>\r\n");
valueXmlString.append("<loc_code>").append("<![CDATA[").append(locCode).append("]]>").append("</loc_code>\r\n"); valueXmlString.append("<loc_code isSrvCallOnChg='0'>").append("<![CDATA[").append(locCode).append("]]>").append("</loc_code>\r\n");
valueXmlString.append("<dimension>").append("<![CDATA[").append(dimension).append("]]>").append("</dimension>\r\n"); valueXmlString.append("<dimension isSrvCallOnChg='0'>").append("<![CDATA[").append(dimension).append("]]>").append("</dimension>\r\n");
valueXmlString.append("<pack_code>").append("<![CDATA[").append(packCode).append("]]>").append("</pack_code>\r\n"); valueXmlString.append("<pack_code isSrvCallOnChg='0'>").append("<![CDATA[").append(packCode).append("]]>").append("</pack_code>\r\n");
valueXmlString.append("<grosswt_pack>").append("<![CDATA[").append(grossWtPack).append("]]>").append("</grosswt_pack>\r\n"); valueXmlString.append("<grosswt_pack isSrvCallOnChg='0'>").append("<![CDATA[").append(grossWtPack).append("]]>").append("</grosswt_pack>\r\n");
valueXmlString.append("<tarewt_pack>").append("<![CDATA[").append(tareWtPack).append("]]>").append("</tarewt_pack>\r\n"); valueXmlString.append("<tarewt_pack isSrvCallOnChg='0'>").append("<![CDATA[").append(tareWtPack).append("]]>").append("</tarewt_pack>\r\n");
valueXmlString.append("<gross_weight>").append("<![CDATA[").append(grossWt).append("]]>").append("</gross_weight>\r\n"); valueXmlString.append("<gross_weight isSrvCallOnChg='0'>").append("<![CDATA[").append(grossWt).append("]]>").append("</gross_weight>\r\n");
valueXmlString.append("<tare_weight>").append("<![CDATA[").append(tareWt).append("]]>").append("</tare_weight>\r\n"); valueXmlString.append("<tare_weight isSrvCallOnChg='0'>").append("<![CDATA[").append(tareWt).append("]]>").append("</tare_weight>\r\n");
valueXmlString.append("<qty_pack>").append("<![CDATA[").append(qtyPack).append("]]>").append("</qty_pack>\r\n"); valueXmlString.append("<qty_pack isSrvCallOnChg='0'>").append("<![CDATA[").append(qtyPack).append("]]>").append("</qty_pack>\r\n");
valueXmlString.append("<quantity>").append("<![CDATA[").append(qtyPack).append("]]>").append("</quantity>\r\n"); valueXmlString.append("<quantity isSrvCallOnChg='0'>").append("<![CDATA[").append(qtyPack).append("]]>").append("</quantity>\r\n");
valueXmlString.append("<no_art>").append("<![CDATA[").append(1).append("]]>").append("</no_art>\r\n"); valueXmlString.append("<no_art isSrvCallOnChg='0'>").append("<![CDATA[").append(1).append("]]>").append("</no_art>\r\n");
valueXmlString.append("<lot_sl>").append("<![CDATA[").append(lotSl).append("]]>").append("</lot_sl>\r\n"); valueXmlString.append("<lot_sl isSrvCallOnChg='0'>").append("<![CDATA[").append(lotSl).append("]]>").append("</lot_sl>\r\n");
// 12/03/12 manoharan additional values set
if (tareWt == null)
{
tareWt = "0";
}
if (grossWt == null)
{
grossWt = "0";
}
tareTmp = Double.parseDouble(tareWt);
grossTmp = Double.parseDouble(grossWt);
netTmp = grossTmp - tareTmp;
valueXmlString.append("<net_weight isSrvCallOnChg='0'>").append("<![CDATA[").append(netTmp).append("]]>").append("</net_weight>\r\n");
valueXmlString.append("<location_descr isSrvCallOnChg='0'>").append("<![CDATA[").append(locDescr).append("]]>").append("</location_descr>\r\n");
// end 12/03/12 manoharan
if (!checkIsNumber(str)) if (!checkIsNumber(str))
{ {
packInst = str + String.valueOf(retNumber); packInst = str + String.valueOf(retNumber);
...@@ -625,7 +659,7 @@ public class InvPackAct extends ActionHandlerEJB implements InvPackActLocal, Inv ...@@ -625,7 +659,7 @@ public class InvPackAct extends ActionHandlerEJB implements InvPackActLocal, Inv
{ {
packInst = String.valueOf(retNumber); packInst = String.valueOf(retNumber);
} }
valueXmlString.append("<pack_instr>").append("<![CDATA[").append(packInst).append("]]>").append("</pack_instr>\r\n"); valueXmlString.append("<pack_instr isSrvCallOnChg='0'>").append("<![CDATA[").append(packInst).append("]]>").append("</pack_instr>\r\n");
valueXmlString.append("</Detail>\r\n"); valueXmlString.append("</Detail>\r\n");
retNumber = retNumber + 1; retNumber = retNumber + 1;
}//end for }//end for
......
...@@ -136,7 +136,7 @@ public class SalesReturnFormSplit extends ActionHandlerEJB implements SalesRetur ...@@ -136,7 +136,7 @@ public class SalesReturnFormSplit extends ActionHandlerEJB implements SalesRetur
pstmt.setString(1,"S"); pstmt.setString(1,"S");
pstmt.setString(2,tranId); pstmt.setString(2,tranId);
pstmt.executeQuery(); pstmt.executeUpdate();
retString = itmDBAccessLocal.getErrorString("","VTSRSPLIT",""); retString = itmDBAccessLocal.getErrorString("","VTSRSPLIT","");
...@@ -482,6 +482,7 @@ public class SalesReturnFormSplit extends ActionHandlerEJB implements SalesRetur ...@@ -482,6 +482,7 @@ public class SalesReturnFormSplit extends ActionHandlerEJB implements SalesRetur
pstmt2 = null; pstmt2 = null;
rs2.close(); rs2.close();
rs2 = null; rs2 = null;
// 26/11/11 manoharan salesperson to be set // 26/11/11 manoharan salesperson to be set
sql1 = "select curr_code,cust_code__bil,price_list,trans_mode, price_list__clg, sales_pers from customer where cust_code = ?"; sql1 = "select curr_code,cust_code__bil,price_list,trans_mode, price_list__clg, sales_pers from customer where cust_code = ?";
// end 26/11/11 manoharan salesperson to be set // end 26/11/11 manoharan salesperson to be set
...@@ -516,6 +517,27 @@ public class SalesReturnFormSplit extends ActionHandlerEJB implements SalesRetur ...@@ -516,6 +517,27 @@ public class SalesReturnFormSplit extends ActionHandlerEJB implements SalesRetur
rs2.close(); rs2.close();
rs2 = null; rs2 = null;
sql1 = "select sales_pers from customer_series where cust_code = ? and item_ser = ?";
// end 26/11/11 manoharan salesperson to be set
pstmt2 = conn.prepareStatement(sql1);
pstmt2.setString(1,custCd);
pstmt2.setString(2,itemSerDet);
rs2 = pstmt2.executeQuery();
String salesPersTmp = "";
if(rs2.next())
{
salesPersTmp = rs2.getString("sales_pers") == null ? " " : rs2.getString("sales_pers");
}
pstmt2.close();
pstmt2 = null;
rs2.close();
rs2 = null;
if (salesPersTmp != null && salesPersTmp.trim().length() > 0 )
{
salesPers = salesPersTmp;
}
sql2 ="select unit,unit__rate from item where item_code = ?"; sql2 ="select unit,unit__rate from item where item_code = ?";
pstmt2 = conn.prepareStatement(sql2); pstmt2 = conn.prepareStatement(sql2);
pstmt2.setString(1,itemCode); pstmt2.setString(1,itemCode);
...@@ -686,8 +708,8 @@ public class SalesReturnFormSplit extends ActionHandlerEJB implements SalesRetur ...@@ -686,8 +708,8 @@ public class SalesReturnFormSplit extends ActionHandlerEJB implements SalesRetur
xmlBuff.append("<group0>"); xmlBuff.append("<group0>");
xmlBuff.append("<description>").append("Group0 description").append("</description>"); xmlBuff.append("<description>").append("Group0 description").append("</description>");
xmlBuff.append("<Header0>"); xmlBuff.append("<Header0>");
//xmlBuff.append("<objName><![CDATA[").append("salesreturn").append("]]></objName>"); xmlBuff.append("<objName><![CDATA[").append("salesreturn").append("]]></objName>");
xmlBuff.append("<objName><![CDATA[").append("salesreturn_split_tr").append("]]></objName>"); //xmlBuff.append("<objName><![CDATA[").append("salesreturn_split_tr").append("]]></objName>");
xmlBuff.append("<pageContext><![CDATA[").append("1").append("]]></pageContext>"); xmlBuff.append("<pageContext><![CDATA[").append("1").append("]]></pageContext>");
xmlBuff.append("<objContext><![CDATA[").append("1").append("]]></objContext>"); xmlBuff.append("<objContext><![CDATA[").append("1").append("]]></objContext>");
xmlBuff.append("<editFlag><![CDATA[").append("A").append("]]></editFlag>"); xmlBuff.append("<editFlag><![CDATA[").append("A").append("]]></editFlag>");
......
...@@ -28,8 +28,10 @@ import ibase.webitm.utility.GenericUtility; ...@@ -28,8 +28,10 @@ import ibase.webitm.utility.GenericUtility;
import ibase.ejb.*; import ibase.ejb.*;
import javax.annotation.*; import javax.annotation.*;
import ibase.system.config.*; import ibase.system.config.*;
import ibase.utility.CommonConstants;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.text.DecimalFormat;
import javax.ejb.Stateless; // added for ejb3 import javax.ejb.Stateless; // added for ejb3
@Stateless // added for ejb3 @Stateless // added for ejb3
...@@ -37,6 +39,8 @@ import javax.ejb.Stateless; // added for ejb3 ...@@ -37,6 +39,8 @@ import javax.ejb.Stateless; // added for ejb3
public class BOMAct extends ActionHandlerEJB implements BOMActLocal , BOMActRemote //SessionBean public class BOMAct extends ActionHandlerEJB implements BOMActLocal , BOMActRemote //SessionBean
{ {
GenericUtility genericUtility = null; GenericUtility genericUtility = null;
CommonConstants commonConstants = new CommonConstants();
/*@PostConstruct /*@PostConstruct
public void ejbCreate() //throws RemoteException//, CreateException public void ejbCreate() //throws RemoteException//, CreateException
{ {
...@@ -184,7 +188,8 @@ public String actionHandler(String actionType, String xmlString,String xmlString ...@@ -184,7 +188,8 @@ public String actionHandler(String actionType, String xmlString,String xmlString
GenericUtility genericUtility = GenericUtility.getInstance(); GenericUtility genericUtility = GenericUtility.getInstance();
Connection conn = null; Connection conn = null;
StringBuffer valueXmlString = null; StringBuffer valueXmlString = null;
valueXmlString = new StringBuffer("<?xml version=\"1.0\"?>\r\n<Root>\r\n"); //valueXmlString = new StringBuffer("<?xml version=\"1.0\" encoding=\"UTF-8\"?> \r\n<Root>\r\n");
valueXmlString = new StringBuffer("<?xml version='1.0' encoding='"+commonConstants.ENCODING+"'?> \r\n<Root>\r\n");
int currentFormNo = 0,cnt = 0; int currentFormNo = 0,cnt = 0;
String sql="",sqlPreBom = "",bomCodeHeader=""; String sql="",sqlPreBom = "",bomCodeHeader="";
ResultSet rs = null,rsDescr = null; ResultSet rs = null,rsDescr = null;
...@@ -269,7 +274,8 @@ public String actionHandler(String actionType, String xmlString,String xmlString ...@@ -269,7 +274,8 @@ public String actionHandler(String actionType, String xmlString,String xmlString
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
String sql = null; String sql = null;
StringBuffer valueXmlString = new StringBuffer("<?xml version=\"1.0\"?>\r\n<Root>\r\n"); //StringBuffer valueXmlString = new StringBuffer("<?xml version=\"1.0\" encoding=\"UTF-8\"?> \r\n<Root>\r\n");
StringBuffer valueXmlString = new StringBuffer("<?xml version='1.0' encoding='"+commonConstants.ENCODING+"'?> \r\n<Root>\r\n");
String bomCode = null; String bomCode = null;
GenericUtility genericUtility = GenericUtility.getInstance(); GenericUtility genericUtility = GenericUtility.getInstance();
...@@ -365,7 +371,8 @@ public String actionHandler(String actionType, String xmlString,String xmlString ...@@ -365,7 +371,8 @@ public String actionHandler(String actionType, String xmlString,String xmlString
double minQty = 0.0; double minQty = 0.0;
double reqQty =0.0; double reqQty =0.0;
StringBuffer valueXmlString = new StringBuffer("<?xml version=\"1.0\"?>\r\n<Root>\r\n"); StringBuffer valueXmlString = new StringBuffer("<?xml version='1.0' encoding='"+commonConstants.ENCODING+"'?> \r\n<Root>\r\n"); //new StringBuffer("<?xml version=\"1.0\" encoding=\"UTF-8\"?> \r\n<Root>\r\n");
GenericUtility genericUtility = GenericUtility.getInstance(); GenericUtility genericUtility = GenericUtility.getInstance();
ConnDriver connDriver = new ConnDriver(); ConnDriver connDriver = new ConnDriver();
try try
...@@ -516,6 +523,23 @@ public String actionHandler(String actionType, String xmlString,String xmlString ...@@ -516,6 +523,23 @@ public String actionHandler(String actionType, String xmlString,String xmlString
System.out.println("valueXmlString.toString() "+valueXmlString.toString()); System.out.println("valueXmlString.toString() "+valueXmlString.toString());
return valueXmlString.toString(); return valueXmlString.toString();
} }
public double getReqDecimal(double actVal, int prec)
{
String fmtStr = "############0";
String strValue = null;
double retVal = 0;
if (prec > 0)
{
fmtStr = fmtStr + "." + "000000000".substring(0, prec);
}
DecimalFormat decFormat = new DecimalFormat(fmtStr);
retVal = Double.parseDouble(decFormat.format(actVal));
if (Math.abs(retVal) == 0)
{
retVal = 0;
}
return retVal;
}
private String actionTransform(Document dom,Document dom1, String objContext, String xtraParams, Document selDataDom)throws ITMException private String actionTransform(Document dom,Document dom1, String objContext, String xtraParams, Document selDataDom)throws ITMException
{ {
String schemeCode = null; String schemeCode = null;
...@@ -531,15 +555,17 @@ public String actionHandler(String actionType, String xmlString,String xmlString ...@@ -531,15 +555,17 @@ public String actionHandler(String actionType, String xmlString,String xmlString
int cnt = 0; int cnt = 0;
NodeList detailList = null; NodeList detailList = null;
int detailListLength = 0; int detailListLength = 0;
StringBuffer valueXmlString = new StringBuffer("<?xml version=\"1.0\"?>\r\n<Root>\r\n"); StringBuffer valueXmlString = new StringBuffer("<?xml version='1.0' encoding='"+commonConstants.ENCODING+"'?> \r\n<Root>\r\n"); //new StringBuffer("<?xml version=\"1.0\" encoding=\"UTF-8\"?> \r\n<Root>\r\n");
ConnDriver connDriver = new ConnDriver(); ConnDriver connDriver = new ConnDriver();
ITMDBAccessEJB itmDbAccessEJB = new ITMDBAccessEJB(); ITMDBAccessEJB itmDbAccessEJB = new ITMDBAccessEJB();
String userId = null,descr; String userId = null,descr;
String bomCode = "",itemDescr = "",bomCodeHeader = ""; String bomCode = "",itemDescr = "",bomCodeHeader = "";
String sql1 = "",sqlSpec= "",sqlDescr = "",sqlPreBom =""; String sql1 = "",sqlSpec= "",sqlDescr = "",sqlPreBom ="";
String effFromStr = "",validUptoStr="",itemCode="",itemRef="",qtyPer="",reqType="",minQty="",operation="",reqlt="",critItem="",autoOrd="",appMinQty="",appMaxQty="",effCost="",nature="",matchPotency="",minPotencyPerc="",adjPotency="",round="",roundTo="",usageType="",allocateType="",considerPartialAltlocUsageType="",considerLotNoIssueuseInvstatus="",dimension="",minReqQty="",manualAlt="",potencyFormula="",remarks="",unit="",suppCodeMfg="",issVarienceType="",issVarience="",unitAlt="",convQtyStduom="",qtyPerAlt="",qtyPerUnit="",prntFlg="",backflushType="",locCodeWip="",rbfFormula="",pendStk="",potencyInput="",issVarValtype="",itemCodeOut="",storeCode="",specMetadata="",specDimension="",mfgRef="",itemCategory="",strengthValue="",strengthUnit="",itemType="", itemTypeValue="",dispContainerSizeitemCodeWip="",settingMethod="",qtyCalcFormula="",itemCodePreOp="",operationUsed="" ; String effFromStr = "",validUptoStr="",itemCode="",itemRef="",qtyPerStr="",reqType="",minQty="",operation="",reqlt="",critItem="",autoOrd="",appMinQty="",appMaxQty="",effCost="",nature="",matchPotency="",minPotencyPerc="",adjPotency="",round="",roundTo="",usageType="",allocateType="",considerPartialAltlocUsageType="",considerLotNoIssueuseInvstatus="",dimension="",minReqQty="",manualAlt="",potencyFormula="",remarks="",unit="",suppCodeMfg="",issVarienceType="",issVarience="",unitAlt="",convQtyStduom="",qtyPerAlt="",qtyPerUnit="",prntFlg="",backflushType="",locCodeWip="",rbfFormula="",pendStk="",potencyInput="",issVarValtype="",itemCodeOut="",storeCode="",specMetadata="",specDimension="",mfgRef="",itemCategory="",strengthValue="",strengthUnit="",itemType="", itemTypeValue="",dispContainerSizeitemCodeWip="",settingMethod="",qtyCalcFormula="",itemCodePreOp="",operationUsed="" ;
String considerPartialAlt = "",locUsageType="",considerLotNoIssue="",useInvstatus="",dispContainerSize="",itemCodeWip=""; String considerPartialAlt = "",locUsageType="",considerLotNoIssue="",useInvstatus="",dispContainerSize="",itemCodeWip="";
Timestamp effFrom=null,validUpto= null; Timestamp effFrom=null,validUpto= null;
double oldBatchQty = 0, curBatchQty = 0, qtyPer = 0; // 14/03/12 manoharan
String batchQtyStr = ""; // 14/03/12 manoharan
try try
{ {
...@@ -549,6 +575,29 @@ public String actionHandler(String actionType, String xmlString,String xmlString ...@@ -549,6 +575,29 @@ public String actionHandler(String actionType, String xmlString,String xmlString
detailListLength = detailList.getLength(); detailListLength = detailList.getLength();
bomCode = GenericUtility.getInstance().getColumnValueFromNode("bom_code",detailList.item(0)); bomCode = GenericUtility.getInstance().getColumnValueFromNode("bom_code",detailList.item(0));
bomCodeHeader = GenericUtility.getInstance().getColumnValue("bom_code",dom1); bomCodeHeader = GenericUtility.getInstance().getColumnValue("bom_code",dom1);
// 14/03/12 manoharan
batchQtyStr = GenericUtility.getInstance().getColumnValue("batch_qty",dom1);
sqlPreBom = "select batch_qty from bom where bom_code = ? " ;
pstmtDescr = conn.prepareStatement(sqlPreBom);
pstmtDescr.setString(1,bomCode);
rsDescr = pstmtDescr.executeQuery();
if (rsDescr.next())
{
oldBatchQty = rsDescr.getDouble(1);
}
rsDescr.close();
pstmtDescr.close();
if (batchQtyStr == null || batchQtyStr.trim().length() == 0)
{
curBatchQty = oldBatchQty;
}
else
{
curBatchQty = Double.parseDouble(batchQtyStr);
}
// end 14/03/12 manoharan
sqlPreBom = "select count(*) from bomdet where bom_code = ? " ; sqlPreBom = "select count(*) from bomdet where bom_code = ? " ;
pstmtDescr = conn.prepareStatement(sqlPreBom); pstmtDescr = conn.prepareStatement(sqlPreBom);
pstmtDescr.setString(1,bomCodeHeader); pstmtDescr.setString(1,bomCodeHeader);
...@@ -559,6 +608,8 @@ public String actionHandler(String actionType, String xmlString,String xmlString ...@@ -559,6 +608,8 @@ public String actionHandler(String actionType, String xmlString,String xmlString
} }
rsDescr.close(); rsDescr.close();
pstmtDescr.close(); pstmtDescr.close();
// end 14/03/12/ manoharan
GenericUtility genericUtility = GenericUtility.getInstance(); GenericUtility genericUtility = GenericUtility.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat(genericUtility.getApplDateFormat()); SimpleDateFormat sdf = new SimpleDateFormat(genericUtility.getApplDateFormat());
...@@ -587,7 +638,7 @@ public String actionHandler(String actionType, String xmlString,String xmlString ...@@ -587,7 +638,7 @@ public String actionHandler(String actionType, String xmlString,String xmlString
{ {
itemCode= rs.getString("ITEM_CODE") == null ? "" :rs.getString("ITEM_CODE"); itemCode= rs.getString("ITEM_CODE") == null ? "" :rs.getString("ITEM_CODE");
itemRef = rs.getString("ITEM_REF") == null ? "" :rs.getString("ITEM_REF"); itemRef = rs.getString("ITEM_REF") == null ? "" :rs.getString("ITEM_REF");
qtyPer = rs.getString("QTY_PER") == null ? "" :rs.getString("QTY_PER"); qtyPerStr = rs.getString("QTY_PER") == null ? "" :rs.getString("QTY_PER");
// date value // date value
effFrom = rs.getTimestamp("EFF_FROM") ; effFrom = rs.getTimestamp("EFF_FROM") ;
if (effFrom != null) if (effFrom != null)
...@@ -610,6 +661,17 @@ public String actionHandler(String actionType, String xmlString,String xmlString ...@@ -610,6 +661,17 @@ public String actionHandler(String actionType, String xmlString,String xmlString
// date value end // date value end
reqType = rs.getString("REQ_TYPE") == null ? "" :rs.getString("REQ_TYPE"); reqType = rs.getString("REQ_TYPE") == null ? "" :rs.getString("REQ_TYPE");
// 14/03/12 manoharan
if (qtyPerStr == null || qtyPerStr.trim().length() == 0)
{
qtyPerStr = "0";
}
qtyPer = Double.parseDouble(qtyPerStr);
if (!"F".equals(reqType))
{
qtyPer = getReqDecimal(qtyPer / oldBatchQty * curBatchQty,3);
}
// end 14/03/12 manoharan
minQty = rs.getString("MIN_QTY") == null ? "" :rs.getString("MIN_QTY"); minQty = rs.getString("MIN_QTY") == null ? "" :rs.getString("MIN_QTY");
operation = rs.getString("OPERATION") == null ? "" :rs.getString("OPERATION"); operation = rs.getString("OPERATION") == null ? "" :rs.getString("OPERATION");
reqlt = rs.getString("REQ_LT") == null ? "" :rs.getString("REQ_LT"); reqlt = rs.getString("REQ_LT") == null ? "" :rs.getString("REQ_LT");
...@@ -766,7 +828,7 @@ public String actionHandler(String actionType, String xmlString,String xmlString ...@@ -766,7 +828,7 @@ public String actionHandler(String actionType, String xmlString,String xmlString
public ArrayList getDetails(String bomCode, String batchQtyD) throws ITMException public ArrayList getDetails(String bomCode, String batchQtyD) throws ITMException
{ {
PreparedStatement pstmt = null; PreparedStatement pstmt = null,pstmt1 = null;
ResultSet rs = null; ResultSet rs = null;
Connection conn = null; Connection conn = null;
BOMStockDtlParams thisBean = null; BOMStockDtlParams thisBean = null;
...@@ -775,6 +837,7 @@ public String actionHandler(String actionType, String xmlString,String xmlString ...@@ -775,6 +837,7 @@ public String actionHandler(String actionType, String xmlString,String xmlString
String trackShelfLife = null; String trackShelfLife = null;
String itemCode = null; String itemCode = null;
String reqType = null; String reqType = null;
String siteCode = null;
Timestamp currDate =null; Timestamp currDate =null;
double batchQty = 0.0; double batchQty = 0.0;
double qtyPar = 0.0; double qtyPar = 0.0;
...@@ -803,6 +866,21 @@ public String actionHandler(String actionType, String xmlString,String xmlString ...@@ -803,6 +866,21 @@ public String actionHandler(String actionType, String xmlString,String xmlString
rs.close(); rs.close();
pstmt.close(); pstmt.close();
/*sql = "SELECT s.GEO_LOC FROM siteitem i, site s where i.site_code = s.site_code "
+ " and i.bom_code = ? and case when i.active is null then 'Y' else i.active end = 'Y' ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,bomCode);
rs = pstmt.executeQuery();
if(rs.next())
{
siteCode = rs.getString(1);
}
System.out.println("Current Date::::::"+currDate);
rs.close();
pstmt.close();
*/
if(bomCode!=null) if(bomCode!=null)
{ {
sql = "SELECT BOM.ITEM_CODE, BOM.BOM_CODE,BOMDET.ITEM_CODE,ITEM_A.DESCR,BOMDET.REQ_TYPE," sql = "SELECT BOM.ITEM_CODE, BOM.BOM_CODE,BOMDET.ITEM_CODE,ITEM_A.DESCR,BOMDET.REQ_TYPE,"
...@@ -860,29 +938,34 @@ public String actionHandler(String actionType, String xmlString,String xmlString ...@@ -860,29 +938,34 @@ public String actionHandler(String actionType, String xmlString,String xmlString
} }
thisBean.reqQty = reqQty; thisBean.reqQty = reqQty;
pstmt = null; pstmt1 = conn.prepareStatement("select nvl(track_shelf_life,'N') from item where item_code = ?") ;
pstmt = conn.prepareStatement("select nvl(track_shelf_life,'N') from item where item_code = ?") ; pstmt1.setString(1,rs.getString(3));
pstmt.setString(1,itemCode); ResultSet rs1 = pstmt1.executeQuery();
ResultSet rs1 = pstmt.executeQuery();
if(rs1.next()) if(rs1.next())
{ {
trackShelfLife = rs1.getString(1); trackShelfLife = rs1.getString(1);
} }
rs1.close(); rs1.close();
rs1 = null;
pstmt1.close();
pstmt1 = null;
StringBuffer sb = new StringBuffer(); StringBuffer sb = new StringBuffer();
sb.append("select nvl(sum(a.quantity - a.alloc_qty),0), nvl(sum(a.alloc_qty),0) from stock a, invstat b " sb.append("select nvl(sum(a.quantity - a.alloc_qty),0), nvl(sum(a.alloc_qty),0), nvl(sum(a.alloc_qty),0) from stock a, invstat b "
+" where a.inv_stat = b.inv_stat and a.item_code = ? and b.available = 'Y' and b.stat_type <> 'S' and (a.quantity - nvl(a.alloc_qty,0)) > 0 " ); + " where a.inv_stat = b.inv_stat and a.item_code = ? and b.available = 'Y' and b.plan_prod = 'Y' and b.stat_type <> 'S' and (a.quantity - nvl(a.alloc_qty,0)) > 0 "
+ " and site_code in ( select site_code from site where geo_loc in (SELECT s.GEO_LOC FROM siteitem i, site s where i.site_code = s.site_code "
+ " and i.bom_code = ? and case when i.active is null then 'Y' else i.active end = 'Y' ) )" );
if(trackShelfLife != null && trackShelfLife.equalsIgnoreCase("Y")) if(trackShelfLife != null && trackShelfLife.equalsIgnoreCase("Y"))
{ {
sb.append("and ( a.exp_date is null or a.exp_date >?)"); sb.append("and ( a.exp_date is null or a.exp_date >?)");
} }
pstmt = conn.prepareStatement(sb.toString()); pstmt1 = conn.prepareStatement(sb.toString());
pstmt.setString(1,itemCode); pstmt1.setString(1,rs.getString(3));
pstmt1.setString(2,bomCode);
if(trackShelfLife != null && trackShelfLife.equalsIgnoreCase("Y")) if(trackShelfLife != null && trackShelfLife.equalsIgnoreCase("Y"))
{ {
pstmt.setTimestamp(2,currDate); pstmt1.setTimestamp(3,currDate);
} }
rs1 = pstmt.executeQuery(); rs1 = pstmt1.executeQuery();
while(rs1.next()) while(rs1.next())
{ {
thisBean.stkQty = rs1.getDouble(1); thisBean.stkQty = rs1.getDouble(1);
...@@ -890,32 +973,41 @@ public String actionHandler(String actionType, String xmlString,String xmlString ...@@ -890,32 +973,41 @@ public String actionHandler(String actionType, String xmlString,String xmlString
} }
rs1.close(); rs1.close();
rs1 = null; rs1 = null;
pstmt1.close();
pstmt1 = null;
StringBuffer sbn = new StringBuffer(); StringBuffer sbn = new StringBuffer();
sbn.append(" select nvl(sum(a.quantity - a.alloc_qty),0), nvl(sum(a.alloc_qty),0) from stock a, invstat b " sbn.append(" select nvl(sum(a.quantity - a.alloc_qty),0) from stock a, invstat b "
+" where a.inv_stat = b.inv_stat and a.item_code = ? and b.available = 'N' and b.stat_type <> 'S' and (a.quantity - nvl(a.alloc_qty,0)) > 0 " ); +" where a.inv_stat = b.inv_stat and a.item_code = ? and b.available = 'N' and b.stat_type <> 'S' and (a.quantity - nvl(a.alloc_qty,0)) > 0 "
+ " and site_code in ( select site_code from site where geo_loc in(SELECT s.GEO_LOC FROM siteitem i, site s where i.site_code = s.site_code "
+ " and i.bom_code = ? and case when i.active is null then 'Y' else i.active end = 'Y' ))" );
if(trackShelfLife.equalsIgnoreCase("Y")) if(trackShelfLife.equalsIgnoreCase("Y"))
{ {
sbn.append("and ( a.exp_date is null or a.exp_date >?)"); sbn.append("and ( a.exp_date is null or a.exp_date >?)");
} }
pstmt = conn.prepareStatement(sbn.toString()); pstmt1 = conn.prepareStatement(sbn.toString());
pstmt.setString(1,itemCode); pstmt1.setString(1,rs.getString(3));
pstmt1.setString(2,bomCode);
if(trackShelfLife.equalsIgnoreCase("Y")) if(trackShelfLife.equalsIgnoreCase("Y"))
{ {
pstmt.setTimestamp(2,currDate); pstmt1.setTimestamp(3,currDate);
} }
rs1 = pstmt.executeQuery(); rs1 = pstmt1.executeQuery();
while(rs1.next()) if(rs1.next())
{ {
thisBean.nonStkQty = rs1.getDouble(1); thisBean.nonStkQty = rs1.getDouble(1);
thisBean.allockQty = rs1.getDouble(2); //thisBean.allockQty = rs1.getDouble(2);
} }
rs1.close(); rs1.close();
rs1 = null; rs1 = null;
pstmt1.close();
pstmt1 = null;
stkBOMList.add(thisBean); stkBOMList.add(thisBean);
} }
rs.close();
rs = null;
pstmt.close();
pstmt = null;
} }
} }
......
...@@ -21,7 +21,7 @@ import java.text.SimpleDateFormat; ...@@ -21,7 +21,7 @@ import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.StringTokenizer; import java.util.StringTokenizer;
import java.text.DecimalFormat;
import javax.ejb.CreateException; import javax.ejb.CreateException;
import javax.ejb.SessionBean; import javax.ejb.SessionBean;
import javax.xml.transform.OutputKeys; import javax.xml.transform.OutputKeys;
...@@ -303,7 +303,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -303,7 +303,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
sql = "select w.LOT_NO__ISSUE,b.CONSIDER_LOT_NO__ISSUE from workorder w, workorder_bill b " sql = "select w.LOT_NO__ISSUE,b.CONSIDER_LOT_NO__ISSUE from workorder w, workorder_bill b "
+ " where w.work_order = b.work_order " + " where w.work_order = b.work_order "
+ " and w.work_order = ? " + " and w.work_order = ? "
+ " and b.emp_lev = ? "; + " and b.exp_lev = ? ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, workOrder); pstmt.setString(1, workOrder);
pstmt.setString(2, expLev); pstmt.setString(2, expLev);
...@@ -1232,7 +1232,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -1232,7 +1232,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
lotNo = genericUtility.getColumnValue("lot_no", dom); lotNo = genericUtility.getColumnValue("lot_no", dom);
lotSl = genericUtility.getColumnValue("lot_sl", dom); lotSl = genericUtility.getColumnValue("lot_sl", dom);
quantity = Double.parseDouble(genericUtility.getColumnValue("quantity", dom)); quantity = Double.parseDouble(genericUtility.getColumnValue("quantity", dom));
System.out.println("Manohar quantity [" + quantity + "]"); System.out.println("Manohar 14/03/12 quantity [" + quantity + "]");
expLev = genericUtility.getColumnValue("exp_lev", dom); expLev = genericUtility.getColumnValue("exp_lev", dom);
System.out.println("expLev ::: " + expLev); System.out.println("expLev ::: " + expLev);
reasCode = genericUtility.getColumnValue("reas_code", dom); reasCode = genericUtility.getColumnValue("reas_code", dom);
...@@ -1601,7 +1601,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -1601,7 +1601,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
System.out.println("effDate ::: " + effDate + "dimension ::: " + dimension + "trimWidth ::: " + trimWidth); System.out.println("effDate ::: " + effDate + "dimension ::: " + dimension + "trimWidth ::: " + trimWidth);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
remainingQty = quantity;
while (rs.next()) while (rs.next())
{ {
stkLocCode = rs.getString(1); stkLocCode = rs.getString(1);
...@@ -1617,8 +1617,8 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -1617,8 +1617,8 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
allocQty = rs.getString(11); allocQty = rs.getString(11);
packCode = rs.getString(12); packCode = rs.getString(12);
remainingQty = quantity;
System.out.println("stkQtyLot ::: " + stkQtyLot + "criteria ::: " + criteria); System.out.println("manohar stkQtyLot [" + stkQtyLot + "] remainingQty [" + remainingQty + "] criteria [" + criteria + "]");
if (stkQtyLot >= remainingQty) if (stkQtyLot >= remainingQty)
{ {
if (criteria != null && criteria.equalsIgnoreCase("W")) if (criteria != null && criteria.equalsIgnoreCase("W"))
...@@ -1888,7 +1888,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -1888,7 +1888,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
} }
catch (Exception e){} catch (Exception e){}
} }
System.out.println("valueXmlString return from WOrderIssueActEJB :"+valueXmlString.toString()); System.out.println("valueXmlString return from WOrderIssueActEJB.actionAllocate ["+valueXmlString.toString() + "]");
return valueXmlString.toString(); return valueXmlString.toString();
} }
...@@ -2765,6 +2765,23 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -2765,6 +2765,23 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
} }
// added by chandni shah - 21-Dec-2011 // added by chandni shah - 21-Dec-2011
public double getReqDecimal(double actVal, int prec)
{
String fmtStr = "############0";
String strValue = null;
double retVal = 0;
if (prec > 0)
{
fmtStr = fmtStr + "." + "000000000".substring(0, prec);
}
DecimalFormat decFormat = new DecimalFormat(fmtStr);
retVal = Double.parseDouble(decFormat.format(actVal));
if (Math.abs(retVal) == 0)
{
retVal = 0;
}
return retVal;
}
public ArrayList getDetails(String woCode) throws ITMException public ArrayList getDetails(String woCode) throws ITMException
{ {
PreparedStatement pstmt = null, pstmt1 = null; PreparedStatement pstmt = null, pstmt1 = null;
...@@ -2776,8 +2793,8 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -2776,8 +2793,8 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
String trackShelfLife = null; String trackShelfLife = null;
String itemCode = null,siteCode = null; String itemCode = null,siteCode = null;
Timestamp currDate =null; Timestamp currDate =null;
double qtyPer = 0; double qtyPer = 0, minQty = 0, woQty = 0, batchQty = 0;
String reqType = "";
try try
{ {
ConnDriver connDriver = new ConnDriver(); ConnDriver connDriver = new ConnDriver();
...@@ -2798,11 +2815,13 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -2798,11 +2815,13 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
if(woCode!=null) if(woCode!=null)
{ {
sql =" select b.item_code,b.descr,a.site_code, sum(c.qty_per) qty_per from workorder a ,item b, bomdet c " sql =" select b.item_code,b.descr,a.site_code,c.req_type, sum(c.qty_per) qty_per, "
+ " sum(c.min_qty), a.quantity,d.batch_qty from workorder a ,item b, bomdet c, bom d "
+" where c.item_code = b.item_code " +" where c.item_code = b.item_code "
+ " and c.bom_code = a.bom_code " + " and c.bom_code = a.bom_code "
+ " and d.bom_code = a.bom_code "
+" and a.work_order = ? " +" and a.work_order = ? "
+ " group by b.item_code,b.descr,a.site_code "; + " group by b.item_code,b.descr,a.site_code,c.req_type, a.quantity,d.batch_qty ";
System.out.println("MainQuery:::"+sql); System.out.println("MainQuery:::"+sql);
pstmt1 = conn.prepareStatement(sql); pstmt1 = conn.prepareStatement(sql);
...@@ -2817,8 +2836,25 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -2817,8 +2836,25 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
thisBean.itemCode = rs.getString(1); thisBean.itemCode = rs.getString(1);
thisBean.descr = rs.getString(2); thisBean.descr = rs.getString(2);
siteCode = rs.getString(3); siteCode = rs.getString(3);
thisBean.qtyPer = rs.getDouble(4); reqType = rs.getString(4);
thisBean.qtyPer = rs.getDouble(5);
minQty = rs.getDouble(6);
woQty = rs.getDouble(7);
batchQty = rs.getDouble(8);
if ("S".equals(reqType))
{
thisBean.qtyPer = woQty / batchQty * rs.getDouble(5);
}
else if ("P".equals(reqType))
{
thisBean.qtyPer = rs.getDouble(5) / batchQty * woQty;
}
if (thisBean.qtyPer < minQty)
{
thisBean.qtyPer = minQty;
}
thisBean.qtyPer = getReqDecimal(thisBean.qtyPer, 3);
pstmt = conn.prepareStatement("select nvl(track_shelf_life,'N') from item where item_code = ?") ; pstmt = conn.prepareStatement("select nvl(track_shelf_life,'N') from item where item_code = ?") ;
pstmt.setString(1,itemCode); pstmt.setString(1,itemCode);
ResultSet rs1 = pstmt.executeQuery(); ResultSet rs1 = pstmt.executeQuery();
......
...@@ -14,7 +14,7 @@ import javax.ejb.*; ...@@ -14,7 +14,7 @@ import javax.ejb.*;
public class WoStockBean public class WoStockBean
{ {
public String itemCode = "",descr = "",workOrder = "",allockQty = ""; public String itemCode = "",descr = "",workOrder = "",allockQty = "";
public double stkQty = 0.0,nonStkQty = 0.0; public double stkQty = 0.0,nonStkQty = 0.0, qtyPer = 0;
public void setWorkOrder(String workOrderJsp) public void setWorkOrder(String workOrderJsp)
{ {
...@@ -46,6 +46,10 @@ public class WoStockBean ...@@ -46,6 +46,10 @@ public class WoStockBean
for (int i=0; i<stkWoRetArr.size(); i++ ) for (int i=0; i<stkWoRetArr.size(); i++ )
{ {
stkParms = (WOrderIssueAct.woStockDtlParams)(stkWoRetArr.get(i)); stkParms = (WOrderIssueAct.woStockDtlParams)(stkWoRetArr.get(i));
System.out.println("stkParms.stkQty [" + stkParms.stkQty + "]");
System.out.println("stkParms.nonStkQty [" + stkParms.nonStkQty + "]");
System.out.println("stkParms.allockQty [" + stkParms.allockQty + "]");
System.out.println("stkParms.qtyPer [" + stkParms.qtyPer + "]");
stkWoBean = new WoStockBean(); stkWoBean = new WoStockBean();
stkWoBean.itemCode = stkParms.itemCode; stkWoBean.itemCode = stkParms.itemCode;
...@@ -54,6 +58,7 @@ public class WoStockBean ...@@ -54,6 +58,7 @@ public class WoStockBean
stkWoBean.stkQty = stkParms.stkQty; stkWoBean.stkQty = stkParms.stkQty;
stkWoBean.nonStkQty = stkParms.nonStkQty; stkWoBean.nonStkQty = stkParms.nonStkQty;
stkWoBean.allockQty = stkParms.allockQty; stkWoBean.allockQty = stkParms.allockQty;
stkWoBean.qtyPer = stkParms.qtyPer;
thisBeanArray.add(stkWoBean); thisBeanArray.add(stkWoBean);
} }
......
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