Commit c9bc0078 authored by dsawant's avatar dsawant

updated for SCR FLAG FFT


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@95870 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 58841a8b
...@@ -215,65 +215,7 @@ public class WorkOrdRcpDet extends ValidatorEJB implements WorkOrdRcpDetLocal, W ...@@ -215,65 +215,7 @@ public class WorkOrdRcpDet extends ValidatorEJB implements WorkOrdRcpDetLocal, W
childNodeList = parentNode.getChildNodes(); childNodeList = parentNode.getChildNodes();
childNodeListLength = childNodeList.getLength(); childNodeListLength = childNodeList.getLength();
/* boolean flag = false;
parentNodeList = dom.getElementsByTagName("Detail2");
if(parentNodeList != null)
{
System.out.println("for dom >>>>");
parentNode = parentNodeList.item(0);
if(parentNode != null)
{
try{
childNodeList = parentNode.getChildNodes();
childNodeListLength = childNodeList.getLength();
}catch(Exception e)
{
e.printStackTrace();
flag = true;
}
}
}
if(flag)
{
flag = false;
parentNodeList = dom1.getElementsByTagName("Detail2");
if(parentNodeList != null)
{
System.out.println("for dom 1");
parentNode = parentNodeList.item(0);
if(parentNode != null)
{
try{
childNodeList = parentNode.getChildNodes();
childNodeListLength = childNodeList.getLength();
}catch(Exception e)
{
e.printStackTrace();
flag = true;
}
}
}
if(flag)
{
System.out.println("for dom 2");
parentNodeList = dom2.getElementsByTagName("Detail2");
parentNode = parentNodeList.item(0);
if(parentNode != null)
{
try{
childNodeList = parentNode.getChildNodes();
childNodeListLength = childNodeList.getLength();
}catch(Exception e)
{
e.printStackTrace();
flag = true;
}
}
}
}
*/
for(ctr = 0; ctr < childNodeListLength; ctr++) for(ctr = 0; ctr < childNodeListLength; ctr++)
{ {
...@@ -345,7 +287,7 @@ public class WorkOrdRcpDet extends ValidatorEJB implements WorkOrdRcpDetLocal, W ...@@ -345,7 +287,7 @@ public class WorkOrdRcpDet extends ValidatorEJB implements WorkOrdRcpDetLocal, W
if (itemCode == null || itemCode.trim().length() == 0) if (itemCode == null || itemCode.trim().length() == 0)
{ {
errCode = ""; errCode = "WORDWIICCB";
errString = getErrorString("item_code",errCode,userId); errString = getErrorString("item_code",errCode,userId);
break; break;
} }
...@@ -366,7 +308,7 @@ public class WorkOrdRcpDet extends ValidatorEJB implements WorkOrdRcpDetLocal, W ...@@ -366,7 +308,7 @@ public class WorkOrdRcpDet extends ValidatorEJB implements WorkOrdRcpDetLocal, W
rs = null; rs = null;
if(cnt == 0) if(cnt == 0)
{ {
errCode = ""; errCode = "WORDWIICNE";
errString = getErrorString("item_code",errCode,userId); errString = getErrorString("item_code",errCode,userId);
break; break;
} }
...@@ -374,7 +316,7 @@ public class WorkOrdRcpDet extends ValidatorEJB implements WorkOrdRcpDetLocal, W ...@@ -374,7 +316,7 @@ public class WorkOrdRcpDet extends ValidatorEJB implements WorkOrdRcpDetLocal, W
} }
} }
else if(childNodeName.equalsIgnoreCase("no_art")) /*else if(childNodeName.equalsIgnoreCase("no_art"))
{ {
String noArt = genericUtility.getColumnValue("no_art",dom2); String noArt = genericUtility.getColumnValue("no_art",dom2);
...@@ -393,9 +335,9 @@ public class WorkOrdRcpDet extends ValidatorEJB implements WorkOrdRcpDetLocal, W ...@@ -393,9 +335,9 @@ public class WorkOrdRcpDet extends ValidatorEJB implements WorkOrdRcpDetLocal, W
errString = getErrorString("no_art",errCode,userId); errString = getErrorString("no_art",errCode,userId);
break; break;
} }
} }*/
else if(childNodeName.equalsIgnoreCase("quantity")) /*else if(childNodeName.equalsIgnoreCase("quantity"))
{ {
squantity = genericUtility.getColumnValue("quantity",dom2); squantity = genericUtility.getColumnValue("quantity",dom2);
...@@ -414,12 +356,12 @@ public class WorkOrdRcpDet extends ValidatorEJB implements WorkOrdRcpDetLocal, W ...@@ -414,12 +356,12 @@ public class WorkOrdRcpDet extends ValidatorEJB implements WorkOrdRcpDetLocal, W
errString = getErrorString("quantity",errCode,userId); errString = getErrorString("quantity",errCode,userId);
break; break;
} }
} }*/
} }
break; break;
case 3: case 3:
parentNodeList = dom2.getElementsByTagName("Detail3"); parentNodeList = dom2.getElementsByTagName("Detail3");
parentNode = parentNodeList.item(0); parentNode = parentNodeList.item(0);
...@@ -639,7 +581,7 @@ public class WorkOrdRcpDet extends ValidatorEJB implements WorkOrdRcpDetLocal, W ...@@ -639,7 +581,7 @@ public class WorkOrdRcpDet extends ValidatorEJB implements WorkOrdRcpDetLocal, W
SimpleDateFormat simpleDateFormat = null; SimpleDateFormat simpleDateFormat = null;
GenericUtility genutility = new GenericUtility(); GenericUtility genutility = new GenericUtility();
String locCode="",lotNo="",lotsl="",itmdesc="",loginSite="",siteCode="",atranid=""; String locCode="",lotNo="",lotsl="",itmdesc="",loginSite="",siteCode="",atranid="";
System.out.println("DOM111 Elements>>["+genericUtility.serializeDom(dom).toString()+"]"); System.out.println("DOM111 Elements>>["+genericUtility.serializeDom(dom).toString()+"]");
System.out.println("DOM222 Elements>>["+genericUtility.serializeDom(dom1).toString()+"]"); System.out.println("DOM222 Elements>>["+genericUtility.serializeDom(dom1).toString()+"]");
System.out.println("DOM322 Elements>>["+genericUtility.serializeDom(dom2).toString()+"]"); System.out.println("DOM322 Elements>>["+genericUtility.serializeDom(dom2).toString()+"]");
...@@ -684,7 +626,7 @@ public class WorkOrdRcpDet extends ValidatorEJB implements WorkOrdRcpDetLocal, W ...@@ -684,7 +626,7 @@ public class WorkOrdRcpDet extends ValidatorEJB implements WorkOrdRcpDetLocal, W
childNodeList = parentNode.getChildNodes(); childNodeList = parentNode.getChildNodes();
break; break;
case 2 : case 2 :
parentNodeList = dom.getElementsByTagName("Detail2"); parentNodeList = dom.getElementsByTagName("Detail2");
parentNode = parentNodeList.item(0); parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes(); childNodeList = parentNode.getChildNodes();
...@@ -704,338 +646,307 @@ public class WorkOrdRcpDet extends ValidatorEJB implements WorkOrdRcpDetLocal, W ...@@ -704,338 +646,307 @@ public class WorkOrdRcpDet extends ValidatorEJB implements WorkOrdRcpDetLocal, W
rs.close(); rs.close();
pstmt = null; pstmt = null;
rs = null; rs = null;
if(cnt == 0) int count = 0;
{
System.out.println("for new tran id"); if(cnt > 0)
sql = "update obj_forms set scr_flag = ? where win_name = 'w_worder_rcp_det_wiz' and form_no = '2'"; {
pstmt = conn.prepareStatement(sql); if(currentColumn.trim().equalsIgnoreCase("itm_default"))
pstmt.setString(1, "F"); {
cnt = pstmt.executeUpdate(); System.out.println("work order from header is"+workOrder);
System.out.println(">>>>>>>successfully updated record bom post save cnt1:" + cnt);
conn.commit();
pstmt.close();
pstmt = null;
sdf=new SimpleDateFormat(genutility.getApplDateFormat());
currDate = new java.sql.Timestamp(System.currentTimeMillis()) ;
todayDate = simpleDateFormat.format(currDate);
System.out.println(">>>>>>>>>>>SXD"+workOrder);
String xmlValues ="<?xml version=\"1.0\" encoding=\"utf-8\"?><Root>"; sql = "select a.tran_id,a.tran_date,a.site_code,a.work_order,a.date__start,"
xmlValues = xmlValues + "<Header></Header>"; + "a.item_code,b.descr,a.loc_code,a.lot_sl,a.quantity,a.no_art,a.unit,a.gross_weight,a.tare_weight,a.net_weight "
xmlValues = xmlValues + "<Detail1>"; + "FROM workorder_receipt a,item b WHERE a.item_code = b.item_code and a.work_order = ?";
xmlValues = xmlValues + "<tran_id></tran_id>"; pstmt=conn.prepareStatement(sql);
xmlValues = xmlValues + "<site_code>" + loginSite + "</site_code>"; pstmt.setString(1,workOrder);
xmlValues = xmlValues + "<tran_date>" + todayDate + "</tran_date>"; rs = pstmt.executeQuery();
xmlValues = xmlValues + "<tran_type>F</tran_type>"; while(rs.next())
xmlValues = xmlValues + "</Detail1></Root>"; {
System.out.println("xmlValues :["+xmlValues+"]"); tranid = rs.getString(1) == null ? "":rs.getString(1);
TransIDGenerator tg = new TransIDGenerator(xmlValues, "BASE", CommonConstants.DB_NAME); currDate = rs.getTimestamp(2);
atranid = tg.generateTranSeqID("WORDWI","tran_id","_spsite_code,T,tran_type,_pptran_date,seq04",conn); siteCode = rs.getString(3) == null ? "":rs.getString(3);
System.out.println(">>>>>NEW id"+atranid); workOrder = rs.getString(4) == null ? "":rs.getString(4);
startDate = rs.getTimestamp(5);
itemCode = rs.getString(6) == null ? "":rs.getString(6);
itemDescr = rs.getString(7) == null ? "":rs.getString(7);
locCode = rs.getString(8) == null ? "":rs.getString(8);
lotsl = rs.getString(9) == null ? "":rs.getString(9);
quantity = rs.getDouble(10);
noOfArt = rs.getDouble(11);
unit = rs.getString(12) == null ? "":rs.getString(12);
grossWeight = rs.getDouble(13);
tareWeight = rs.getDouble(14);
netWeight = rs.getDouble(15);
simpleDateFormat=new SimpleDateFormat(genutility.getApplDateFormat());
currAppdate = simpleDateFormat.format(currDate);
sdf=new SimpleDateFormat(genutility.getApplDateFormat());
if(startDate != null)
{
sStartDate = simpleDateFormat.format(startDate);
}
}else sdf=new SimpleDateFormat(genutility.getApplDateFormat());
{ tdate = new java.sql.Timestamp(System.currentTimeMillis()) ;
System.out.println("for existing tran id"); stdate = simpleDateFormat.format(tdate);
sql = "update obj_forms set scr_flag = ? where win_name = 'w_worder_rcp_det_wiz' and form_no = '2'";
pstmt = conn.prepareStatement(sql); count++;
pstmt.setString(1, "T"); valueXmlString.append("<Detail2 domID='" +count+ "' objContext = '"+currentFormNo+"' selected=\"Y\">\r\n");
cnt = pstmt.executeUpdate(); valueXmlString.append("<attribute selected=\"Y\" updateFlag=\"E\" status=\"O\" pkNames=\"\"/>\r\n");
System.out.println(">>>>>>>successfully updated record bom post save cnt1:" + cnt); valueXmlString.append("<tran_id>").append("<![CDATA[" + tranid + "]]>").append("</tran_id>");
conn.commit(); valueXmlString.append("<tran_date>").append("<![CDATA[" + currAppdate + "]]>").append("</tran_date>");
pstmt.close(); valueXmlString.append("<site_code>").append("<![CDATA[" + siteCode + "]]>").append("</site_code>");
pstmt = null; valueXmlString.append("<work_order>").append("<![CDATA[" + workOrder + "]]>").append("</work_order>");
} valueXmlString.append("<date__start>").append("<![CDATA[" + sStartDate + "]]>").append("</date__start>");
valueXmlString.append("<item_code>").append("<![CDATA[" + itemCode + "]]>").append("</item_code>");
valueXmlString.append("<descr>").append("<![CDATA[" + itemDescr + "]]>").append("</descr>");
valueXmlString.append("<loc_code>").append("<![CDATA["+ locCode +"]]>").append("</loc_code>");
valueXmlString.append("<lot_sl>").append("<![CDATA["+ lotsl +"]]>").append("</lot_sl>");
valueXmlString.append("<quantity>").append("<![CDATA[" + quantity + "]]>").append("</quantity>");
valueXmlString.append("<no_art>").append("<![CDATA[" + noOfArt + "]]>").append("</no_art>");
valueXmlString.append("<unit>").append("<![CDATA[" + unit + "]]>").append("</unit>");
valueXmlString.append("<gross_weight>").append("<![CDATA[" + grossWeight + "]]>").append("</gross_weight>");
valueXmlString.append("<tare_weight>").append("<![CDATA[" + tareWeight + "]]>").append("</tare_weight>");
valueXmlString.append("<net_weight>").append("<![CDATA[" + netWeight + "]]>").append("</net_weight>");
valueXmlString.append("<chg_user>").append("<![CDATA[" + chgUser + "]]>").append("</chg_user>");
valueXmlString.append("<chg_term>").append("<![CDATA[" + chgTerm + "]]>").append("</chg_term>");
valueXmlString.append("<chg_date>").append("<![CDATA[" + stdate + "]]>").append("</chg_date>");
valueXmlString.append("</Detail2>");
sql = "select scr_flag from obj_forms where win_name = 'w_worder_rcp_det_wiz' and form_no = '2'";
pstmt=conn.prepareStatement(sql);
rs = pstmt.executeQuery();
if(rs.next())
{
scrFlag = rs.getString(1) == null ? "":rs.getString(1);
}
pstmt.close();
rs.close();
pstmt = null;
rs = null;
if(scrFlag.equals("T")) }
{ pstmt.close();
System.out.println("non add record"); rs.close();
if(currentColumn.trim().equalsIgnoreCase("itm_default")) pstmt = null;
rs = null;
}
}
else
{ {
System.out.println("work order from header is"+workOrder);
System.out.println(">>>>>>>>>>>SXD"+workOrder);
sql = "select a.tran_id,a.tran_date,a.site_code,a.work_order,a.date__start,"
+ "a.item_code,b.descr,a.loc_code,a.lot_sl,a.quantity,a.no_art,a.unit,a.gross_weight,a.tare_weight,a.net_weight "
+ "FROM workorder_receipt a,item b WHERE a.item_code = b.item_code and a.work_order = ?";
pstmt=conn.prepareStatement(sql);
pstmt.setString(1,workOrder);
rs = pstmt.executeQuery();
while(rs.next())
{
tranid = rs.getString(1) == null ? "":rs.getString(1);
currDate = rs.getTimestamp(2);
siteCode = rs.getString(3) == null ? "":rs.getString(3);
workOrder = rs.getString(4) == null ? "":rs.getString(4);
startDate = rs.getTimestamp(5);
itemCode = rs.getString(6) == null ? "":rs.getString(6);
itemDescr = rs.getString(7) == null ? "":rs.getString(7);
locCode = rs.getString(8) == null ? "":rs.getString(8);
lotsl = rs.getString(9) == null ? "":rs.getString(9);
quantity = rs.getDouble(10);
noOfArt = rs.getDouble(11);
unit = rs.getString(12) == null ? "":rs.getString(12);
grossWeight = rs.getDouble(13);
tareWeight = rs.getDouble(14);
netWeight = rs.getDouble(15);
simpleDateFormat=new SimpleDateFormat(genutility.getApplDateFormat());
currAppdate = simpleDateFormat.format(currDate);
System.out.println("in add >>>>>");
if(currentColumn.trim().equalsIgnoreCase("itm_default_add"))
{
sdf=new SimpleDateFormat(genutility.getApplDateFormat()); sdf=new SimpleDateFormat(genutility.getApplDateFormat());
currDate = new java.sql.Timestamp(System.currentTimeMillis()) ;
currAppdate = sdf.format(currDate);
String xmlValues ="<?xml version=\"1.0\" encoding=\"utf-8\"?><Root>";
xmlValues = xmlValues + "<Header></Header>";
xmlValues = xmlValues + "<Detail1>";
xmlValues = xmlValues + "<tran_id></tran_id>";
xmlValues = xmlValues + "<site_code>" + loginSite + "</site_code>";
xmlValues = xmlValues + "<tran_date>" + currAppdate + "</tran_date>";
xmlValues = xmlValues + "<tran_type>F</tran_type>";
xmlValues = xmlValues + "</Detail1></Root>";
System.out.println("xmlValues :["+xmlValues+"]");
TransIDGenerator tg = new TransIDGenerator(xmlValues, "BASE", CommonConstants.DB_NAME);
atranid = tg.generateTranSeqID("WORDWI","tran_id","_spsite_code,T,tran_type,_pptran_date,seq04",conn);
System.out.println(">>>>>NEW id"+atranid);
System.out.println("in add >>>>>enter");
sql = "select site_code,rel_date,item_code,lot_no,exp_date,mfg_date__start from workorder where work_order = ?";
pstmt=conn.prepareStatement(sql);
pstmt.setString(1,workOrder);
rs = pstmt.executeQuery();
if(rs.next())
{
woSiteCode = rs.getString(1) == null ? "":rs.getString(1);
startDate = rs.getTimestamp(2);
itemCode = rs.getString(3) == null ? "":rs.getString(3);
lotNo = rs.getString(4) == null ? "":rs.getString(4);
expDate = rs.getTimestamp(5);
mfgDateStart = rs.getTimestamp(6);
}
pstmt.close();
rs.close();
pstmt = null;
rs = null;
sdf=new SimpleDateFormat(genutility.getApplDateFormat());
if(startDate != null) if(startDate != null)
{ {
sStartDate = simpleDateFormat.format(startDate); sStartDate = simpleDateFormat.format(startDate);
} }
if(expDate != null)
{
sExpDate = simpleDateFormat.format(expDate);
}
if(mfgDateStart != null)
{
sMfgDateStart = simpleDateFormat.format(mfgDateStart);
}
sdf=new SimpleDateFormat(genutility.getApplDateFormat());
tdate = new java.sql.Timestamp(System.currentTimeMillis()) ;
stdate = simpleDateFormat.format(tdate);
valueXmlString.append("<Detail2 objContext = '"+currentFormNo+"' selected=\"Y\">\r\n"); count++;
valueXmlString.append("<attribute selected=\"Y\" updateFlag=\"E\" status=\"O\" pkNames=\"\"/>\r\n"); valueXmlString.append("<Detail2 domID='" + count + "' objContext = '"+currentFormNo+"' selected=\"N\">\r\n");
valueXmlString.append("<tran_id>").append("<![CDATA[" + tranid + "]]>").append("</tran_id>"); valueXmlString.append("<attribute selected=\"N\" updateFlag=\"A\" status=\"N\" pkNames=\"\"/>\r\n");
//valueXmlString.append("<tran_id/>\r\n");
valueXmlString.append("<tran_id>").append("<![CDATA[" + atranid + "]]>").append("</tran_id>");
valueXmlString.append("<tran_date>").append("<![CDATA[" + currAppdate + "]]>").append("</tran_date>"); valueXmlString.append("<tran_date>").append("<![CDATA[" + currAppdate + "]]>").append("</tran_date>");
valueXmlString.append("<site_code>").append("<![CDATA[" + siteCode + "]]>").append("</site_code>"); valueXmlString.append("<site_code>").append("<![CDATA[" + loginSite + "]]>").append("</site_code>");
valueXmlString.append("<work_order>").append("<![CDATA[" + workOrder + "]]>").append("</work_order>"); valueXmlString.append("<work_order>").append("<![CDATA[" + workOrder + "]]>").append("</work_order>");
valueXmlString.append("<date__start>").append("<![CDATA[" + sStartDate + "]]>").append("</date__start>"); valueXmlString.append("<date__start>").append("<![CDATA[" + sStartDate + "]]>").append("</date__start>");
valueXmlString.append("<date__compl>").append("<![CDATA[" + currAppdate + "]]>").append("</date__compl>");
valueXmlString.append("<item_code>").append("<![CDATA[" + itemCode + "]]>").append("</item_code>"); valueXmlString.append("<item_code>").append("<![CDATA[" + itemCode + "]]>").append("</item_code>");
valueXmlString.append("<descr>").append("<![CDATA[" + itemDescr + "]]>").append("</descr>");
valueXmlString.append("<loc_code>").append("<![CDATA["+ locCode +"]]>").append("</loc_code>");
valueXmlString.append("<lot_sl>").append("<![CDATA["+ lotsl +"]]>").append("</lot_sl>");
valueXmlString.append("<quantity>").append("<![CDATA[" + quantity + "]]>").append("</quantity>");
valueXmlString.append("<no_art>").append("<![CDATA[" + noOfArt + "]]>").append("</no_art>");
valueXmlString.append("<unit>").append("<![CDATA[" + unit + "]]>").append("</unit>");
valueXmlString.append("<gross_weight>").append("<![CDATA[" + grossWeight + "]]>").append("</gross_weight>");
valueXmlString.append("<tare_weight>").append("<![CDATA[" + tareWeight + "]]>").append("</tare_weight>");
valueXmlString.append("<net_weight>").append("<![CDATA[" + netWeight + "]]>").append("</net_weight>");
valueXmlString.append("<chg_user>").append("<![CDATA[" + chgUser + "]]>").append("</chg_user>");
valueXmlString.append("<chg_term>").append("<![CDATA[" + chgTerm + "]]>").append("</chg_term>");
valueXmlString.append("<chg_date>").append("<![CDATA[" + stdate + "]]>").append("</chg_date>");
valueXmlString.append("</Detail2>");
}
pstmt.close();
rs.close();
pstmt = null;
rs = null;
}
}else
{
System.out.println("add record");
if(currentColumn.trim().equalsIgnoreCase("itm_default"))
{
sql = "select site_code,rel_date,item_code,lot_no,exp_date,mfg_date__start from workorder where work_order = ?";
pstmt=conn.prepareStatement(sql);
pstmt.setString(1,workOrder);
rs = pstmt.executeQuery();
if(rs.next())
{
woSiteCode = rs.getString(1) == null ? "":rs.getString(1);
startDate = rs.getTimestamp(2);
itemCode = rs.getString(3) == null ? "":rs.getString(3);
lotNo = rs.getString(4) == null ? "":rs.getString(4);
expDate = rs.getTimestamp(5);
mfgDateStart = rs.getTimestamp(6);
}
pstmt.close();
rs.close();
pstmt = null;
rs = null;
sdf=new SimpleDateFormat(genutility.getApplDateFormat());
if(startDate != null)
{
sStartDate = simpleDateFormat.format(startDate);
}
if(expDate != null)
{
sExpDate = simpleDateFormat.format(expDate);
}
if(mfgDateStart != null)
{
sMfgDateStart = simpleDateFormat.format(mfgDateStart);
}
valueXmlString.append("<Detail2 objContext = '"+currentFormNo+"' selected=\"N\">\r\n"); sql = "select descr from item where item_code = ?";
valueXmlString.append("<attribute selected=\"N\" updateFlag=\"A\" status=\"O\" pkNames=\"\"/>\r\n"); pstmt=conn.prepareStatement(sql);
valueXmlString.append("<tran_id>").append("<![CDATA[" + atranid + "]]>").append("</tran_id>"); pstmt.setString(1,itemCode);
valueXmlString.append("<tran_date>").append("<![CDATA[" + todayDate + "]]>").append("</tran_date>"); rs = pstmt.executeQuery();
valueXmlString.append("<site_code>").append("<![CDATA[" + loginSite + "]]>").append("</site_code>"); if(rs.next())
valueXmlString.append("<work_order>").append("<![CDATA[" + workOrder + "]]>").append("</work_order>"); {
valueXmlString.append("<date__start>").append("<![CDATA[" + sStartDate + "]]>").append("</date__start>"); itemDescr = rs.getString(1) == null ? "":rs.getString(1);
valueXmlString.append("<date__compl>").append("<![CDATA[" + todayDate + "]]>").append("</date__compl>"); }
valueXmlString.append("<item_code>").append("<![CDATA[" + itemCode + "]]>").append("</item_code>"); pstmt.close();
rs.close();
sql = "select descr from item where item_code = ?"; pstmt = null;
pstmt=conn.prepareStatement(sql); rs = null;
pstmt.setString(1,itemCode); valueXmlString.append("<descr>").append("<![CDATA[" + itemDescr + "]]>").append("</descr>");
rs = pstmt.executeQuery();
if(rs.next())
{
itemDescr = rs.getString(1) == null ? "":rs.getString(1);
}
pstmt.close();
rs.close();
pstmt = null;
rs = null;
valueXmlString.append("<descr>").append("<![CDATA[" + itemDescr + "]]>").append("</descr>");
valueXmlString.append("<loc_code>").append("<![CDATA[ ]]>").append("</loc_code>"); valueXmlString.append("<loc_code>").append("<![CDATA[ ]]>").append("</loc_code>");
valueXmlString.append("<lot_no>").append("<![CDATA[" + lotNo + "]]>").append("</lot_no>"); valueXmlString.append("<lot_no>").append("<![CDATA[" + lotNo + "]]>").append("</lot_no>");
valueXmlString.append("<lot_sl>").append("<![CDATA[ ]]>").append("</lot_sl>"); valueXmlString.append("<lot_sl>").append("<![CDATA[ ]]>").append("</lot_sl>");
valueXmlString.append("<exp_date>").append("<![CDATA[" + sExpDate + "]]>").append("</exp_date>"); valueXmlString.append("<exp_date>").append("<![CDATA[" + sExpDate + "]]>").append("</exp_date>");
valueXmlString.append("<site_code__own>").append("<![CDATA[" + woSiteCode + "]]>").append("</site_code__own>"); valueXmlString.append("<site_code__own>").append("<![CDATA[" + woSiteCode + "]]>").append("</site_code__own>");
sql = "select sum(quantity) from workorder_rcp_det where work_order = ?";
pstmt=conn.prepareStatement(sql);
pstmt.setString(1,workOrder);
rs = pstmt.executeQuery();
if(rs.next())
{
totDetQuan = rs.getDouble(1);
}
pstmt.close();
rs.close();
pstmt = null;
rs = null;
valueXmlString.append("<quantity>").append("<![CDATA[" + totDetQuan + "]]>").append("</quantity>"); sql = "select sum(quantity) from workorder_rcp_det where work_order = ?";
pstmt=conn.prepareStatement(sql);
pstmt.setString(1,workOrder);
rs = pstmt.executeQuery();
if(rs.next())
{
totDetQuan = rs.getDouble(1);
}
pstmt.close();
rs.close();
pstmt = null;
rs = null;
sql = "select unit from item where item_code = ?"; valueXmlString.append("<quantity>").append("<![CDATA[" + totDetQuan + "]]>").append("</quantity>");
pstmt=conn.prepareStatement(sql);
pstmt.setString(1,itemCode);
rs = pstmt.executeQuery();
if(rs.next())
{
unit = rs.getString(1) == null ? "":rs.getString(1);
}
pstmt.close();
rs.close();
pstmt = null;
rs = null;
valueXmlString.append("<unit>").append("<![CDATA[" + unit + "]]>").append("</unit>"); sql = "select unit from item where item_code = ?";
pstmt=conn.prepareStatement(sql);
pstmt.setString(1,itemCode);
rs = pstmt.executeQuery();
if(rs.next())
{
unit = rs.getString(1) == null ? "":rs.getString(1);
}
pstmt.close();
rs.close();
pstmt = null;
rs = null;
sql = "select pack_code from item where item_code = ?"; valueXmlString.append("<unit>").append("<![CDATA[" + unit + "]]>").append("</unit>");
pstmt=conn.prepareStatement(sql);
pstmt.setString(1,itemCode);
rs = pstmt.executeQuery();
if(rs.next())
{
packCode = rs.getString(1) == null ? "":rs.getString(1);
}
pstmt.close();
rs.close();
pstmt = null;
rs = null;
valueXmlString.append("<pack_code>").append("<![CDATA[" + packCode + "]]>").append("</pack_code>");
valueXmlString.append("<potency_perc>").append("<![CDATA[0]]>").append("</potency_perc>");
valueXmlString.append("<chg_user>").append("<![CDATA[" + chgUser + "]]>").append("</chg_user>"); sql = "select pack_code from item where item_code = ?";
valueXmlString.append("<chg_term>").append("<![CDATA[" + chgTerm + "]]>").append("</chg_term>"); pstmt=conn.prepareStatement(sql);
valueXmlString.append("<chg_date>").append("<![CDATA[" + todayDate + "]]>").append("</chg_date>"); pstmt.setString(1,itemCode);
rs = pstmt.executeQuery();
if(rs.next())
{
packCode = rs.getString(1) == null ? "":rs.getString(1);
}
pstmt.close();
rs.close();
pstmt = null;
rs = null;
valueXmlString.append("<pack_code>").append("<![CDATA[" + packCode + "]]>").append("</pack_code>");
valueXmlString.append("<potency_perc>").append("<![CDATA[0]]>").append("</potency_perc>");
valueXmlString.append("<confirmed>").append("<![CDATA[N]]>").append("</confirmed>"); valueXmlString.append("<chg_user>").append("<![CDATA[" + chgUser + "]]>").append("</chg_user>");
valueXmlString.append("<mfg_date>").append("<![CDATA[" + sMfgDateStart + "]]>").append("</mfg_date>"); valueXmlString.append("<chg_term>").append("<![CDATA[" + chgTerm + "]]>").append("</chg_term>");
valueXmlString.append("<tran_type>").append("<![CDATA[F]]>").append("</tran_type>"); valueXmlString.append("<chg_date>").append("<![CDATA[" + currAppdate + "]]>").append("</chg_date>");
valueXmlString.append("<operation>").append("<![CDATA[0]]>").append("</operation>");
valueXmlString.append("<confirmed>").append("<![CDATA[N]]>").append("</confirmed>");
valueXmlString.append("<mfg_date>").append("<![CDATA[" + sMfgDateStart + "]]>").append("</mfg_date>");
valueXmlString.append("<tran_type>").append("<![CDATA[F]]>").append("</tran_type>");
valueXmlString.append("<operation>").append("<![CDATA[0]]>").append("</operation>");
sql = "select qc_reqd from siteitem where site_code = ? and item_code = ?";
pstmt=conn.prepareStatement(sql);
pstmt.setString(1,loginSite);
pstmt.setString(2,itemCode);
rs = pstmt.executeQuery();
if(rs.next())
{
qcReqd = rs.getString(1) == null ? "":rs.getString(1);
}
pstmt.close();
rs.close();
pstmt = null;
rs = null;
valueXmlString.append("<qc_reqd>").append("<![CDATA[" + qcReqd + "]]>").append("</qc_reqd>"); sql = "select qc_reqd from siteitem where site_code = ? and item_code = ?";
valueXmlString.append("<conv__qty_stduom>").append("<![CDATA[1]]>").append("</conv__qty_stduom>"); pstmt=conn.prepareStatement(sql);
pstmt.setString(1,loginSite);
pstmt.setString(2,itemCode);
rs = pstmt.executeQuery();
if(rs.next())
{
qcReqd = rs.getString(1) == null ? "":rs.getString(1);
}
pstmt.close();
rs.close();
pstmt = null;
rs = null;
valueXmlString.append("<qc_reqd>").append("<![CDATA[" + qcReqd + "]]>").append("</qc_reqd>");
valueXmlString.append("<conv__qty_stduom>").append("<![CDATA[1]]>").append("</conv__qty_stduom>");
sql = "select sum(no_art) from workorder_rcp_det where work_order = ?";
pstmt=conn.prepareStatement(sql);
pstmt.setString(1,workOrder);
rs = pstmt.executeQuery();
if(rs.next())
{
totNoArt = rs.getDouble(1);
}
pstmt.close();
rs.close();
pstmt = null;
rs = null;
valueXmlString.append("<no_art>").append("<![CDATA[" + totNoArt + "]]>").append("</no_art>");
valueXmlString.append("<unit__std>").append("<![CDATA[" + unit + "]]>").append("</unit__std>");
valueXmlString.append("<std_qty>").append("<![CDATA[" + totDetQuan + "]]>").append("</std_qty>");
valueXmlString.append("<create_stab>").append("<![CDATA[N]]>").append("</create_stab>");
valueXmlString.append("<gross_weight>").append("<![CDATA[0]]>").append("</gross_weight>");
valueXmlString.append("<tare_weight>").append("<![CDATA[0]]>").append("</tare_weight>");
valueXmlString.append("<net_weight>").append("<![CDATA[0]]>").append("</net_weight>");
if(qcReqd.equalsIgnoreCase("Y"))
{
sql = "select var_value from mfgparm where var_name = 'WORCP_LOCK_GROUP'"; sql = "select sum(no_art) from workorder_rcp_det where work_order = ?";
pstmt=conn.prepareStatement(sql); pstmt=conn.prepareStatement(sql);
pstmt.setString(1,workOrder);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if(rs.next()) if(rs.next())
{ {
locGrp = rs.getString(1) == null ? "":rs.getString(1); totNoArt = rs.getDouble(1);
} }
pstmt.close(); pstmt.close();
rs.close(); rs.close();
pstmt = null; pstmt = null;
rs = null; rs = null;
valueXmlString.append("<no_art>").append("<![CDATA[" + totNoArt + "]]>").append("</no_art>");
if(locGrp != null && locGrp.trim().length() > 0) valueXmlString.append("<unit__std>").append("<![CDATA[" + unit + "]]>").append("</unit__std>");
valueXmlString.append("<std_qty>").append("<![CDATA[" + totDetQuan + "]]>").append("</std_qty>");
valueXmlString.append("<create_stab>").append("<![CDATA[N]]>").append("</create_stab>");
valueXmlString.append("<gross_weight>").append("<![CDATA[0]]>").append("</gross_weight>");
valueXmlString.append("<tare_weight>").append("<![CDATA[0]]>").append("</tare_weight>");
valueXmlString.append("<net_weight>").append("<![CDATA[0]]>").append("</net_weight>");
if(qcReqd.equalsIgnoreCase("Y"))
{ {
valueXmlString.append("<lock_group>").append("<![CDATA[" + locGrp + "]]>").append("</lock_group>");
sql = "select var_value from mfgparm where var_name = 'WORCP_LOCK_GROUP'";
pstmt=conn.prepareStatement(sql);
rs = pstmt.executeQuery();
if(rs.next())
{
locGrp = rs.getString(1) == null ? "":rs.getString(1);
}
pstmt.close();
rs.close();
pstmt = null;
rs = null;
if(locGrp != null && locGrp.trim().length() > 0)
{
valueXmlString.append("<lock_group>").append("<![CDATA[" + locGrp + "]]>").append("</lock_group>");
}
} }
valueXmlString.append("</Detail2>");
} }
valueXmlString.append("</Detail2>");
} }
}
break; break;
case 3 : case 3 :
parentNodeList = dom2.getElementsByTagName("Detail3"); parentNodeList = dom2.getElementsByTagName("Detail3");
parentNode = parentNodeList.item(0); parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes(); childNodeList = parentNode.getChildNodes();
tranid = genericUtility.getColumnValue("tran_id", dom2, "2").trim(); tranid = genericUtility.getColumnValue("tran_id", dom2, "2");
//childNodeListLength = childNodeList.getLength(); //childNodeListLength = childNodeList.getLength();
System.out.println("tran val"+tranid);
if(currentColumn.trim().equalsIgnoreCase("itm_default")) if(currentColumn.trim().equalsIgnoreCase("itm_default"))
{ {
...@@ -1090,9 +1001,11 @@ public class WorkOrdRcpDet extends ValidatorEJB implements WorkOrdRcpDetLocal, W ...@@ -1090,9 +1001,11 @@ public class WorkOrdRcpDet extends ValidatorEJB implements WorkOrdRcpDetLocal, W
} }
else if(currentColumn.trim().equalsIgnoreCase("itm_default_add")) else if(currentColumn.trim().equalsIgnoreCase("itm_default_add"))
{ {
tranid = genericUtility.getColumnValue("tran_id", dom2, "2").trim();
workOrder = genericUtility.getColumnValue("work_order", dom2, "2").trim();
itemCode = genericUtility.getColumnValue("item_code", dom2, "2").trim(); tranid = genericUtility.getColumnValue("tran_id", dom2, "2");
workOrder = genericUtility.getColumnValue("work_order", dom2, "2");
itemCode = genericUtility.getColumnValue("item_code", dom2, "2");
System.out.println("TRANID IS>>>"+tranid); System.out.println("TRANID IS>>>"+tranid);
NodeList nodeList = dom2.getElementsByTagName("Detail3"); NodeList nodeList = dom2.getElementsByTagName("Detail3");
...@@ -1102,6 +1015,8 @@ public class WorkOrdRcpDet extends ValidatorEJB implements WorkOrdRcpDetLocal, W ...@@ -1102,6 +1015,8 @@ public class WorkOrdRcpDet extends ValidatorEJB implements WorkOrdRcpDetLocal, W
System.out.println("tran id is"+tranid); System.out.println("tran id is"+tranid);
sql = "select work_order,item_code,lot_sl,lot_no,no_art,quantity,gross_weight,tare_weight,net_weight " sql = "select work_order,item_code,lot_sl,lot_no,no_art,quantity,gross_weight,tare_weight,net_weight "
+ "from workorder_receipt where tran_id = ?"; + "from workorder_receipt where tran_id = ?";
pstmt=conn.prepareStatement(sql); pstmt=conn.prepareStatement(sql);
...@@ -1195,8 +1110,41 @@ public class WorkOrdRcpDet extends ValidatorEJB implements WorkOrdRcpDetLocal, W ...@@ -1195,8 +1110,41 @@ public class WorkOrdRcpDet extends ValidatorEJB implements WorkOrdRcpDetLocal, W
}
else if(currentColumn.trim().equalsIgnoreCase("no_art"))
{
sql = "select shipper_size from item_lot_packsize where item_code = ?";
pstmt1=conn.prepareStatement(sql);
pstmt1.setString(1,itemCode);
rs1 = pstmt1.executeQuery();
if(rs1.next())
{
shippsize = rs1.getDouble(1);
} }
pstmt1.close();
rs1.close();
pstmt1 = null;
rs1 = null;
quantity = shippsize * noOfArt;
if(quantity == 0)
{
valueXmlString.append("<quantity protect=\"0\">").append("<![CDATA[" + quantity + "]]>").append("</quantity>");
setNodeValue( dom, "quantity", getAbsString(""+quantity));
}else
{
valueXmlString.append("<quantity protect=\"1\">").append("<![CDATA[" + quantity + "]]>").append("</quantity>");
setNodeValue( dom, "quantity", getAbsString(""+quantity));
}
}
break; break;
......
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