Commit bfa93d0b authored by wansari's avatar wansari

S16IBAS005 updated source for QC issues for Stock Ammendment added item...

S16IBAS005 updated source  for QC issues for Stock Ammendment added item change for gross weight and tare weight, added validation for inventory stat from period master.


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@105392 ce508802-f39f-4f6c-b175-0d175dae99d5
parent f38c83f1
......@@ -236,6 +236,62 @@ public class StockAmdIC extends ValidatorEJB implements StockAmdICLocal, StockAm
errList.add( errCode );
errFields.add(childNodeName.toLowerCase());
}
//Changed by wasim on 18-APR-2017 for period status validation [START]
String prdCode = "",statIC = "";
count = 0;
sql = " SELECT CODE FROM PERIOD WHERE ? BETWEEN FR_DATE AND TO_DATE ";
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1, getCurrtDate());
rs = pstmt.executeQuery();
if (rs.next())
{
prdCode = checkNullAndTrim(rs.getString("CODE"));
count++;
}
if (rs != null)
{
rs.close();rs = null;
}
if (pstmt != null )
{
pstmt.close();pstmt = null;
}
if(count == 0)
{
errList.add( "VTSITEPD" );
errFields.add( childNodeName.toLowerCase() );
}
else
{
sql = " SELECT STAT_IC FROM PERIOD_STAT WHERE PRD_CODE = ? AND SITE_CODE = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, prdCode);
pstmt.setString(2, ls_sitecode);
rs = pstmt.executeQuery();
if (rs.next())
{
statIC = checkNullAndTrim(rs.getString("STAT_IC"));
}
if (rs != null)
{
rs.close();rs = null;
}
if (pstmt != null )
{
pstmt.close();pstmt = null;
}
System.out.println("Inventory Status["+statIC+"]");
if("N".equalsIgnoreCase(statIC))
{
errList.add( "VTPRDINV" );
errFields.add( childNodeName.toLowerCase() );
}
}
//Changed by wasim on 18-APR-2017 for period status validation [END]
}
}
......@@ -1204,7 +1260,9 @@ public class StockAmdIC extends ValidatorEJB implements StockAmdICLocal, StockAm
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, ls_item_code);
pstmt.setString(2, ls_site_code);
pstmt.setString(3, ls_loccode);
//Changed by wasim on 18-APR-2017 to set proper varaible in pstmt
//pstmt.setString(3, ls_loccode);
pstmt.setString(3, ls_loc_code);
pstmt.setString(4, ls_lot_no);
pstmt.setString(5, ls_lot_sl);
rs = pstmt.executeQuery();
......@@ -1223,24 +1281,47 @@ public class StockAmdIC extends ValidatorEJB implements StockAmdICLocal, StockAm
pstmt = null;
}
ll_modqty = lc_quantity - (Integer.parseInt(lc_qtyperart) * (lc_quantity/Integer.parseInt(lc_qtyperart)));
lc_divqty = lc_quantity / Integer.parseInt(lc_qtyperart);
//Changed by wasim on 18-APR-2017 as per NVO
//ll_modqty = lc_quantity - (Integer.parseInt(lc_qtyperart) * (lc_quantity/Integer.parseInt(lc_qtyperart)));
//lc_divqty = lc_quantity / Integer.parseInt(lc_qtyperart);
ll_modqty = lc_quantity - (Double.parseDouble(lc_qtyperart) * (int) (lc_quantity/Double.parseDouble(lc_qtyperart)));
lc_divqty = lc_quantity / Double.parseDouble(lc_qtyperart);
System.out.println("ll_modqty ========= >>"+ll_modqty);
System.out.println("lc_divqty ========= >>"+lc_divqty);
if(lc_divqty > 0)
//Changed by wasim on 18-APR-2017 for getting no art as per NVO
//if(lc_divqty > 0)
if(ll_modqty > 0)
{
ll_noart = lc_divqty;
//Changed by wasim on 18-APR-2017 as per NVO
//ll_noart = lc_divqty;
ll_noart = (int) lc_divqty;
ll_noart++;
}
else
{
ll_noart = lc_divqty;
//Changed by wasim on 18-APR-2017 as per NVO
//ll_noart = lc_divqty;
ll_noart = (int) lc_divqty;
}
valueXmlString.append( "<no_art><![CDATA[" ).append( ll_noart ).append( "]]></no_art>\r\n" );
}
//Changed by wasim on 18-APR-2017 for calculating net weight as issue given by QC [START]
if(currentColumn.trim().equalsIgnoreCase("gross_weight") || currentColumn.trim().equalsIgnoreCase("tare_weight") )
{
double grossWeight = 0, tareWeight = 0, netWeight = 0;
grossWeight = checkDoubleNull(genericUtility.getColumnValue("gross_weight", currFormDataDom));
tareWeight = checkDoubleNull(genericUtility.getColumnValue("tare_weight", currFormDataDom));
netWeight = grossWeight - tareWeight;
System.out.println("Gross["+grossWeight+"] Tare["+tareWeight+"] Net["+netWeight+"]");
valueXmlString.append("<net_weight protect = '1'><![CDATA[" ).append( netWeight ).append( "]]></net_weight>\r\n" );
}
//Changed by wasim on 18-APR-2017 for calculating net weight as issue given by QC [END]
valueXmlString.append( "</Detail1>\r\n" );
} //Case 1. End
......@@ -1607,4 +1688,35 @@ public class StockAmdIC extends ValidatorEJB implements StockAmdICLocal, StockAm
return valueXmlString;
}
//Changed by wasim on 18-APR-17 to get current date in Timestamp format [START]
private java.sql.Timestamp getCurrtDate() throws RemoteException,ITMException
{
java.sql.Timestamp currDate = null;
try
{
Object date = null;
currDate = new java.sql.Timestamp(System.currentTimeMillis());
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(genericUtility.getDBDateFormat());
date = sdf.parse(currDate.toString());
currDate = java.sql.Timestamp.valueOf(sdf.format(date).toString()+ " 00:00:00.0");
}
catch (Exception e)
{
throw new ITMException(e);
}
return (currDate);
}
private double checkDoubleNull(String str)
{
if (str == null || str.trim().length() == 0)
{
return 0.0;
}
else
{
return Double.parseDouble(str);
}
}
//Changed by wasim on 18-APR-17 to get current date in Timestamp format [END]
}
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