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,64 +215,6 @@ public class WorkOrdRcpDet extends ValidatorEJB implements WorkOrdRcpDetLocal, W ...@@ -215,64 +215,6 @@ 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,7 +356,7 @@ public class WorkOrdRcpDet extends ValidatorEJB implements WorkOrdRcpDetLocal, W ...@@ -414,7 +356,7 @@ public class WorkOrdRcpDet extends ValidatorEJB implements WorkOrdRcpDetLocal, W
errString = getErrorString("quantity",errCode,userId); errString = getErrorString("quantity",errCode,userId);
break; break;
} }
} }*/
} }
...@@ -704,64 +646,10 @@ public class WorkOrdRcpDet extends ValidatorEJB implements WorkOrdRcpDetLocal, W ...@@ -704,64 +646,10 @@ 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");
sql = "update obj_forms set scr_flag = ? where win_name = 'w_worder_rcp_det_wiz' and form_no = '2'";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, "F");
cnt = pstmt.executeUpdate();
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);
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>" + todayDate + "</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);
}else
{
System.out.println("for existing tran id");
sql = "update obj_forms set scr_flag = ? where win_name = 'w_worder_rcp_det_wiz' and form_no = '2'";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, "T");
cnt = pstmt.executeUpdate();
System.out.println(">>>>>>>successfully updated record bom post save cnt1:" + cnt);
conn.commit();
pstmt.close();
pstmt = null;
}
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")) if(cnt > 0)
{ {
System.out.println("non add record");
if(currentColumn.trim().equalsIgnoreCase("itm_default")) if(currentColumn.trim().equalsIgnoreCase("itm_default"))
{ {
System.out.println("work order from header is"+workOrder); System.out.println("work order from header is"+workOrder);
...@@ -807,8 +695,8 @@ public class WorkOrdRcpDet extends ValidatorEJB implements WorkOrdRcpDetLocal, W ...@@ -807,8 +695,8 @@ public class WorkOrdRcpDet extends ValidatorEJB implements WorkOrdRcpDetLocal, W
tdate = new java.sql.Timestamp(System.currentTimeMillis()) ; tdate = new java.sql.Timestamp(System.currentTimeMillis()) ;
stdate = simpleDateFormat.format(tdate); stdate = simpleDateFormat.format(tdate);
count++;
valueXmlString.append("<Detail2 objContext = '"+currentFormNo+"' selected=\"Y\">\r\n"); valueXmlString.append("<Detail2 domID='" +count+ "' objContext = '"+currentFormNo+"' selected=\"Y\">\r\n");
valueXmlString.append("<attribute selected=\"Y\" updateFlag=\"E\" status=\"O\" pkNames=\"\"/>\r\n"); valueXmlString.append("<attribute selected=\"Y\" updateFlag=\"E\" status=\"O\" pkNames=\"\"/>\r\n");
valueXmlString.append("<tran_id>").append("<![CDATA[" + tranid + "]]>").append("</tran_id>"); valueXmlString.append("<tran_id>").append("<![CDATA[" + tranid + "]]>").append("</tran_id>");
valueXmlString.append("<tran_date>").append("<![CDATA[" + currAppdate + "]]>").append("</tran_date>"); valueXmlString.append("<tran_date>").append("<![CDATA[" + currAppdate + "]]>").append("</tran_date>");
...@@ -837,13 +725,32 @@ public class WorkOrdRcpDet extends ValidatorEJB implements WorkOrdRcpDetLocal, W ...@@ -837,13 +725,32 @@ public class WorkOrdRcpDet extends ValidatorEJB implements WorkOrdRcpDetLocal, W
pstmt = null; pstmt = null;
rs = null; rs = null;
} }
}
}else else
{ {
System.out.println("add record");
if(currentColumn.trim().equalsIgnoreCase("itm_default"))
System.out.println("in add >>>>>");
if(currentColumn.trim().equalsIgnoreCase("itm_default_add"))
{ {
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 = ?"; 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=conn.prepareStatement(sql);
pstmt.setString(1,workOrder); pstmt.setString(1,workOrder);
...@@ -878,14 +785,16 @@ public class WorkOrdRcpDet extends ValidatorEJB implements WorkOrdRcpDetLocal, W ...@@ -878,14 +785,16 @@ public class WorkOrdRcpDet extends ValidatorEJB implements WorkOrdRcpDetLocal, W
valueXmlString.append("<Detail2 objContext = '"+currentFormNo+"' selected=\"N\">\r\n"); count++;
valueXmlString.append("<attribute selected=\"N\" updateFlag=\"A\" status=\"O\" pkNames=\"\"/>\r\n"); valueXmlString.append("<Detail2 domID='" + count + "' objContext = '"+currentFormNo+"' selected=\"N\">\r\n");
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_id>").append("<![CDATA[" + atranid + "]]>").append("</tran_id>");
valueXmlString.append("<tran_date>").append("<![CDATA[" + todayDate + "]]>").append("</tran_date>"); valueXmlString.append("<tran_date>").append("<![CDATA[" + currAppdate + "]]>").append("</tran_date>");
valueXmlString.append("<site_code>").append("<![CDATA[" + loginSite + "]]>").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[" + todayDate + "]]>").append("</date__compl>"); 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>");
sql = "select descr from item where item_code = ?"; sql = "select descr from item where item_code = ?";
...@@ -955,7 +864,7 @@ public class WorkOrdRcpDet extends ValidatorEJB implements WorkOrdRcpDetLocal, W ...@@ -955,7 +864,7 @@ public class WorkOrdRcpDet extends ValidatorEJB implements WorkOrdRcpDetLocal, W
valueXmlString.append("<chg_user>").append("<![CDATA[" + chgUser + "]]>").append("</chg_user>"); valueXmlString.append("<chg_user>").append("<![CDATA[" + chgUser + "]]>").append("</chg_user>");
valueXmlString.append("<chg_term>").append("<![CDATA[" + chgTerm + "]]>").append("</chg_term>"); valueXmlString.append("<chg_term>").append("<![CDATA[" + chgTerm + "]]>").append("</chg_term>");
valueXmlString.append("<chg_date>").append("<![CDATA[" + todayDate + "]]>").append("</chg_date>"); valueXmlString.append("<chg_date>").append("<![CDATA[" + currAppdate + "]]>").append("</chg_date>");
valueXmlString.append("<confirmed>").append("<![CDATA[N]]>").append("</confirmed>"); valueXmlString.append("<confirmed>").append("<![CDATA[N]]>").append("</confirmed>");
valueXmlString.append("<mfg_date>").append("<![CDATA[" + sMfgDateStart + "]]>").append("</mfg_date>"); valueXmlString.append("<mfg_date>").append("<![CDATA[" + sMfgDateStart + "]]>").append("</mfg_date>");
...@@ -1029,13 +938,15 @@ public class WorkOrdRcpDet extends ValidatorEJB implements WorkOrdRcpDetLocal, W ...@@ -1029,13 +938,15 @@ public class WorkOrdRcpDet extends ValidatorEJB implements WorkOrdRcpDetLocal, W
} }
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