Commit 155882a4 authored by ssarkar's avatar ssarkar

changes done on 01/02/13 as per qty_stduom


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@92630 ce508802-f39f-4f6c-b175-0d175dae99d5
parent d7653d26
......@@ -50,7 +50,6 @@ public class ConsolidatToDoc {
String tarHaz = "";
String source = "";
String user = "";
//Changed by Rohan on 06-10-12 to define variable for hazmap report.end
PreparedStatement pstmt = null, pstmt1 = null,pstmtHdr = null;
ResultSet rs = null, rs1 = null;
......@@ -73,6 +72,8 @@ public class ConsolidatToDoc {
double meffQty = 0, qtyStduom = 0,qtyStduom1= 0, convQtyStduom = 0, conRtuStduom = 0, convFact = 1, quantity = 0;
double grossWeight = 0d, tareWeight = 0d, netWeight = 0d;//Gulzar on 29/12/11
double rate = 0d;
//Changed by sumit on 01/02/13
double convertQty = 0.0;
int noArt = 0;
double shipperSize = 0;
double totalGrossWeight = 0,totalTareWeight = 0,totalNetWeight = 0;
......@@ -207,7 +208,7 @@ public class ConsolidatToDoc {
stockSql = "SELECT (CASE WHEN GROSS_WT_PER_ART IS NULL THEN 0 ELSE GROSS_WT_PER_ART END) AS GROSS_WT_PER_ART,"
+ " (CASE WHEN TARE_WT_PER_ART IS NULL THEN 0 ELSE TARE_WT_PER_ART END) AS TARE_WT_PER_ART,"
+ " (CASE WHEN PALLET_WT IS NULL THEN 0 ELSE PALLET_WT END) AS PALLET_WT, "
+ " MFG_DATE, EXP_DATE, SITE_CODE__MFG, PACK_CODE, RETEST_DATE, RATE FROM STOCK "
+ " MFG_DATE, EXP_DATE, SITE_CODE__MFG, PACK_CODE, RETEST_DATE, RATE FROM STOCK "
+ " WHERE ITEM_CODE = ? AND SITE_CODE = ? AND LOC_CODE = ? AND LOT_NO = ? AND LOT_SL = ? ";
pstmtStock = conn.prepareStatement(stockSql);
......@@ -347,7 +348,7 @@ public class ConsolidatToDoc {
waveId = rs.getString("WAVE_ID");
System.out.println("Wave ID======>"+waveId);
expLev = rs.getString("EXP_LEV");
lineNoSord = rs.getString("LINE_NO__SORD");//Gulzar on 12/28/2011
lineNoSord = rs.getString("LINE_NO__SORD");//Gulzar on 12/28/2011
//Changed by Rohan on 10-11-12 to call report in at end of despacth populate.start
/*
//Changed by Rohan on 10-06-12 to get reports for hazardous material.start
......@@ -687,14 +688,14 @@ public class ConsolidatToDoc {
meffQty =0;
*/
if(qtyStduom == 0)
{
if(!unit.equalsIgnoreCase(mbaseUnit))
{
if(!unit.equalsIgnoreCase(mbaseUnit))
{
if(convQtyStduom != 0)
{
convFact = convQtyStduom;
}
ArrayList convQtyList = disCommon.getConvQuantityFact(unit, mbaseUnit, itemCode, quantity, convFact,conn);
ArrayList convQtyList = disCommon.getConvQuantityFact(unit, mbaseUnit, itemCode, quantity, convFact,conn);
System.out.println("convQtyList = "+convQtyList);
meffQty = Double.parseDouble(convQtyList.get(1).toString());
System.out.println("meffQty ["+meffQty+"]");
......@@ -724,19 +725,32 @@ public class ConsolidatToDoc {
//*********Calculating reverse conversion quantity start
if(qtyStduom1 == 0)
{
if(!unit.equalsIgnoreCase(mbaseUnit))
if(!unit.equalsIgnoreCase(mbaseUnit))
{
if(conRtuStduom != 0)
//Changed by sumit on 01/02/13 setting convFact = 0 as this need for reverse the quantity start
/*if(conRtuStduom != 0)
{
convFact = conRtuStduom;
}
ArrayList convQtyList = disCommon.getConvQuantityFact(mbaseUnit, unit, itemCode, quantity, convFact,conn);
}*/
convFact = 0;
//Changed by sumit on 01/02/13 setting convFact = 0 as this need for reverse the quantity end.
ArrayList convQtyList = disCommon.getConvQuantityFact(mbaseUnit, unit, itemCode, quantity, convFact,conn);
System.out.println("convQtyList = "+convQtyList);
//Changed by sumit on 01/02/13 converting from stock unit to order unit start
convertQty = Double.parseDouble(convQtyList.get(1).toString());
if(convertQty == -999999999)
{
convertQty = 0;
}
//Changed by sumit on 01/02/13 converting from stock unit to order unit end
if (conRtuStduom == 0)
{
conRtuStduom= Double.parseDouble(convQtyList.get(0).toString());
}
}
else
{
......@@ -749,8 +763,7 @@ public class ConsolidatToDoc {
}
}
lineNo++;
lineNo++;
//Changes by gulzar on 12/28/2011
despLineNo = " " + lineNo;
despLineNo = despLineNo.substring( despLineNo.length()-3 );
......@@ -777,13 +790,15 @@ public class ConsolidatToDoc {
else
{
pstmt1.setString(6, itemCode);
}
}
pstmt1.setString(7, itemCode.trim());
pstmt1.setString(8, lotNo.trim());
pstmt1.setString(9, lotSl.trim());
pstmt1.setDouble(10, quantityOrd);
pstmt1.setDouble(11, quantity);
//Changed by sumit on 01/02/13 inserting qty as per ordered unit
//pstmt1.setDouble(11, quantity);
pstmt1.setDouble(11, convertQty);
pstmt1.setString(12, checkNull(locCodeTo));
//Changed By Pragyan to set " " one blank character in status as per manoharan sir
......@@ -793,7 +808,9 @@ public class ConsolidatToDoc {
pstmt1.setDouble(14 , convQtyStduom );
pstmt1.setString(15 , mbaseUnit);
pstmt1.setString(16 , unit);
pstmt1.setDouble(17 , qtyStduom );
//Changed by sumit on 01/02/13 like QUANTITY__STDUOM = QUANTITY_REAL = SORDDET.QUANTITY__STDUOM
//pstmt1.setDouble(17 , qtyStduom );
pstmt1.setDouble(17 , quantity );
pstmt1.setDouble(18 , quantity);
//"RATE_STDUOM, PACK_INSTR, NO_ART, SITE_CODE, PACK_QTY, GROSS_WEIGHT, TARE_WEIGHT, " +
......@@ -1617,6 +1634,85 @@ public class ConsolidatToDoc {
return errString;
}
//Changed by Rohan 06/10/12 to printing Hazmat repoprt.end
//Changed by sumit on 31/01/12 convert qty as per as unit start
private double getStockQtyAfterConvert(String saleOrder, String lineNo,String itemCode,double quantity,int check, Connection conn) throws ITMException
{
String sql = "";
String itemUnit = "";
String orderUnit = "";
String unitStd = "";
double convQtyStduom = 0.0;
double newQty = 0.0;
double convFact = 0;
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
DistCommon discommon = new DistCommon();
//System.out.println(" -- saleOrder ["+saleOrder+"] lineNo ["+lineNo+"] itemCode ["+itemCode+"] ");
sql = "SELECT DISTINCT ITEM.UNIT ,SORDDET.UNIT AS ORDER_UNIT,SORDDET.UNIT__STD AS UNIT__STD, " +
" SORDDET.CONV__QTY_STDUOM FROM ITEM, SORDDET WHERE ITEM.ITEM_CODE = ? " +
" AND SORDDET.SALE_ORDER = ? AND SORDDET.LINE_NO = ? AND ITEM.ITEM_CODE = SORDDET.ITEM_CODE ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, itemCode);
pstmt.setString(2, saleOrder);
pstmt.setString(3, lineNo);
rs = pstmt.executeQuery();
if( rs.next())
{
itemUnit = rs.getString("UNIT");
orderUnit = rs.getString("ORDER_UNIT");
unitStd = rs.getString("UNIT__STD");
convQtyStduom = rs.getDouble("CONV__QTY_STDUOM");
}
rs.close(); rs = null;
pstmt.close(); pstmt = null;
ArrayList convQtyList = new ArrayList();
if(!orderUnit.equalsIgnoreCase(unitStd))
{
if(convQtyStduom != 0 && check == 1)
{
convFact = convQtyStduom;
}
System.out.println(" orderUnit ["+orderUnit+"] itemUnit ["+itemUnit+"] unitStd ["+unitStd+"] convQtyStduom ["+convQtyStduom+"] convFact["+convFact+"]");
if( check == 1 )
{
convQtyList = new ArrayList();
convQtyList = discommon.getConvQuantityFact(orderUnit, unitStd, itemCode, quantity, convFact,conn);
}
else if ( check == 2 )
{
convQtyList = new ArrayList();
convQtyList = discommon.getConvQuantityFact(unitStd, orderUnit, itemCode, quantity, convFact,conn);
}
System.out.println("convQtyList = "+convQtyList);
newQty = Double.parseDouble(convQtyList.get(1).toString());
System.out.println("newQty ["+newQty+"]");
if(newQty == -999999999)
{
newQty = 0;
}
if (convQtyStduom == 0)
{
convQtyStduom= Double.parseDouble(convQtyList.get(0).toString());
}
}
else
{
newQty = quantity;
}
//pendingQty = meffQty;
}
catch(Exception ex)
{
ex.printStackTrace();
throw new ITMException(ex);
}
return newQty;
}
//Changed by sumit on 31/01/12 convert qty as per as unit end
}
\ No newline at end of file
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