Commit 22afe201 authored by cpatil's avatar cpatil

added condition ( Double.parseDouble(batchQuantityStr) > WOrderQty - prevIssQty )


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@98100 ce508802-f39f-4f6c-b175-0d175dae99d5
parent d3226bda
...@@ -30,7 +30,7 @@ import org.w3c.dom.NodeList; ...@@ -30,7 +30,7 @@ import org.w3c.dom.NodeList;
public class WoIssPartialPrc extends ProcessEJB implements WoIssPartialPrcLocal,WoIssPartialPrcRemote public class WoIssPartialPrc extends ProcessEJB implements WoIssPartialPrcLocal,WoIssPartialPrcRemote
{ {
String batchQuantityStr=""; String batchQuantityStr="";
public String process() throws RemoteException,ITMException public String process() throws RemoteException,ITMException
{ {
return ""; return "";
...@@ -41,8 +41,8 @@ public class WoIssPartialPrc extends ProcessEJB implements WoIssPartialPrcLocal, ...@@ -41,8 +41,8 @@ public class WoIssPartialPrc extends ProcessEJB implements WoIssPartialPrcLocal,
Document headerDom = null; Document headerDom = null;
GenericUtility genericUtility = GenericUtility.getInstance(); GenericUtility genericUtility = GenericUtility.getInstance();
String retStr = ""; String retStr = "";
try try
{ {
System.out.println("xmlString[process]::::::::::;;;"+xmlString); System.out.println("xmlString[process]::::::::::;;;"+xmlString);
...@@ -75,7 +75,7 @@ public class WoIssPartialPrc extends ProcessEJB implements WoIssPartialPrcLocal, ...@@ -75,7 +75,7 @@ public class WoIssPartialPrc extends ProcessEJB implements WoIssPartialPrcLocal,
e.printStackTrace(); e.printStackTrace();
} }
return retStr; return retStr;
} //end of confirm method } //end of confirm method
public String process(Document headerDom, Document detailDom, String windowName,String xtraParams) throws RemoteException, ITMException public String process(Document headerDom, Document detailDom, String windowName,String xtraParams) throws RemoteException, ITMException
{ {
...@@ -116,7 +116,7 @@ public class WoIssPartialPrc extends ProcessEJB implements WoIssPartialPrcLocal, ...@@ -116,7 +116,7 @@ public class WoIssPartialPrc extends ProcessEJB implements WoIssPartialPrcLocal,
worder = checkNull(genericUtility.getColumnValue("work_order", headerDom)); worder = checkNull(genericUtility.getColumnValue("work_order", headerDom));
deptCode = checkNull(genericUtility.getColumnValue("dept_code", headerDom)); deptCode = checkNull(genericUtility.getColumnValue("dept_code", headerDom));
operationStr = checkNull(genericUtility.getColumnValue("operation", headerDom)); operationStr = checkNull(genericUtility.getColumnValue("operation", headerDom));
if(worder == null || worder.trim().length() <= 0) if(worder == null || worder.trim().length() <= 0)
{ {
System.out.println("worder:: is null "+ worder); System.out.println("worder:: is null "+ worder);
...@@ -143,55 +143,55 @@ public class WoIssPartialPrc extends ProcessEJB implements WoIssPartialPrcLocal, ...@@ -143,55 +143,55 @@ public class WoIssPartialPrc extends ProcessEJB implements WoIssPartialPrcLocal,
sql = "select count(*) from workorder where work_order = ? and status = 'R' "; sql = "select count(*) from workorder where work_order = ? and status = 'R' ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1,worder); pstmt.setString(1,worder);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if(rs.next()) if(rs.next())
{ {
cnt = rs.getInt(1); cnt = rs.getInt(1);
} }
if(rs != null) if(rs != null)
rs.close(); rs.close();
rs = null; rs = null;
if(pstmt != null) if(pstmt != null)
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
if(cnt == 0) if(cnt == 0)
{ {
errString = itmDBAccessEJB.getErrorString("","VPWOINV ","","",conn); errString = itmDBAccessEJB.getErrorString("","VPWOINV ","","",conn);
return errString; return errString;
} }
} }
sql = "select quantity from workorder where work_order = ? "; sql = "select quantity from workorder where work_order = ? ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1,worder); pstmt.setString(1,worder);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if(rs.next()) if(rs.next())
{ {
quantity = rs.getDouble(1); quantity = rs.getDouble(1);
} }
if(rs != null) if(rs != null)
rs.close(); rs.close();
rs = null; rs = null;
if(pstmt != null) if(pstmt != null)
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
if(batchQuantityStr != null && batchQuantityStr.trim().length() > 0) if(batchQuantityStr != null && batchQuantityStr.trim().length() > 0)
{ {
batchQuantity = Double.parseDouble(batchQuantityStr); batchQuantity = Double.parseDouble(batchQuantityStr);
System.out.println(" batchQuantity ::"+batchQuantity); System.out.println(" batchQuantity ::"+batchQuantity);
if(batchQuantity > quantity) if(batchQuantity > quantity)
{ {
errString = itmDBAccessEJB.getErrorString("","VPBATNOT ","","",conn); errString = itmDBAccessEJB.getErrorString("","VPBATNOT ","","",conn);
return errString; return errString;
} }
else if(batchQuantity <= 0) else if(batchQuantity <= 0)
{ {
errString = itmDBAccessEJB.getErrorString("","VPBATQTY2 ","","",conn); errString = itmDBAccessEJB.getErrorString("","VPBATQTY2 ","","",conn);
return errString; return errString;
} }
} }
if(deptCode != null && deptCode.trim().length() > 0) if(deptCode != null && deptCode.trim().length() > 0)
{ {
sql ="select count(1) from department where dept_code = ? "; sql ="select count(1) from department where dept_code = ? ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1,deptCode); pstmt.setString(1,deptCode);
...@@ -225,9 +225,9 @@ public class WoIssPartialPrc extends ProcessEJB implements WoIssPartialPrcLocal, ...@@ -225,9 +225,9 @@ public class WoIssPartialPrc extends ProcessEJB implements WoIssPartialPrcLocal,
return errString; return errString;
} }
} }
if(operation == 0 ) if(operation == 0 )
{ {
errString =itmDBAccessEJB.getErrorString("","VMITEMCZ","","",conn); errString =itmDBAccessEJB.getErrorString("","VMITEMCZ","","",conn);
return errString; return errString;
} }
if(operation > 0 ) if(operation > 0 )
...@@ -273,56 +273,56 @@ public class WoIssPartialPrc extends ProcessEJB implements WoIssPartialPrcLocal, ...@@ -273,56 +273,56 @@ public class WoIssPartialPrc extends ProcessEJB implements WoIssPartialPrcLocal,
} }
catch( Exception e) catch( Exception e)
{ {
try try
{ {
conn.rollback(); conn.rollback();
} }
catch (SQLException ex) catch (SQLException ex)
{ {
Logger.getLogger(WoIssPartialPrc.class.getName()).log(Level.SEVERE, null, ex); Logger.getLogger(WoIssPartialPrc.class.getName()).log(Level.SEVERE, null, ex);
} }
e.printStackTrace(); e.printStackTrace();
} }
finally finally
{ {
try try
{
if(errString != null && errString.trim().length() > 0)
{ {
if(errString != null && errString.trim().length() > 0) if(errString.indexOf("VPSUCC1") > -1 )
{
if(errString.indexOf("VPSUCC1") > -1 )
{
conn.commit();
System.out.println("--transaction commited--");
}
else
{
conn.rollback();
System.out.println("--transaction rollback--");
}
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if( conn != null && ! conn.isClosed() )
{ {
conn.close(); conn.commit();
conn = null; System.out.println("--transaction commited--");
} }
else
if(rs != null)
{ {
rs.close(); conn.rollback();
rs = null; System.out.println("--transaction rollback--");
} }
} }
catch(Exception e) if(pstmt != null)
{ {
System.out.println("Exception : "+e);e.printStackTrace(); pstmt.close();
throw new ITMException(e); pstmt = null;
}
if( conn != null && ! conn.isClosed() )
{
conn.close();
conn = null;
} }
if(rs != null)
{
rs.close();
rs = null;
}
}
catch(Exception e)
{
System.out.println("Exception : "+e);e.printStackTrace();
throw new ITMException(e);
} }
}
return errString; return errString;
} }
private String generateWoIssue(double woQty,String worder,String deptCode,int operation,double batchQuantity,String xtraParams,Connection conn) throws RemoteException, ITMException private String generateWoIssue(double woQty,String worder,String deptCode,int operation,double batchQuantity,String xtraParams,Connection conn) throws RemoteException, ITMException
...@@ -348,27 +348,27 @@ public class WoIssPartialPrc extends ProcessEJB implements WoIssPartialPrcLocal, ...@@ -348,27 +348,27 @@ public class WoIssPartialPrc extends ProcessEJB implements WoIssPartialPrcLocal,
int upd = 0,lineNo=0,updDet=0; int upd = 0,lineNo=0,updDet=0;
double rate=0,minPotencyPerc=0,quantity=0,potencyAdj=0,grossRate=0,issueQtyBill=0,allocQty=0,issQty=0; double rate=0,minPotencyPerc=0,quantity=0,potencyAdj=0,grossRate=0,issueQtyBill=0,allocQty=0,issQty=0;
String expLev="",itemCode="",lotNo="",lotSl="",lotNoIss="",unit="",matchPotency="",adjPotency="",calcPotency=""; String expLev="",itemCode="",lotNo="",lotSl="",lotNoIss="",unit="",matchPotency="",adjPotency="",calcPotency="";
double issuedQty = 0; double issuedQty = 0;
double propReqQty = 0d,issueQtyDiff = 0d,extraQty=0d; double propReqQty = 0d,issueQtyDiff = 0d,extraQty=0d;
ArrayList list = new ArrayList(); ArrayList list = new ArrayList();
boolean flag = false; boolean flag = false;
DecimalFormat df = new DecimalFormat("0.000"); // DecimalFormat df = new DecimalFormat("0.000"); //cpatil on 11/11/14 DecimalFormat df = new DecimalFormat("0.000"); // DecimalFormat df = new DecimalFormat("0.000"); //cpatil on 11/11/14
CommonConstants commonConstants = new CommonConstants(); CommonConstants commonConstants = new CommonConstants();
String itemCodeInv=""; double quantityInv=0,issueQtyInv=0; // added by cpatil String itemCodeInv=""; double quantityInv=0,issueQtyInv=0; // added by cpatil
double noArt = 0,netWeight = 0, grossWeight=0, stkQty=0; // added by cpatil on 02/04/15 urse double noArt = 0,netWeight = 0, grossWeight=0, stkQty=0; // added by cpatil on 02/04/15 urse
try try
{ {
System.out.println("@@@@@@@ generateWoIssue function called::"); System.out.println("@@@@@@@ generateWoIssue function called::");
genericUtility = GenericUtility.getInstance(); genericUtility = GenericUtility.getInstance();
SimpleDateFormat sdf1 = new SimpleDateFormat(genericUtility.getDBDateFormat()); SimpleDateFormat sdf1 = new SimpleDateFormat(genericUtility.getDBDateFormat());
// currDate = java.sql.Timestamp.valueOf(sdf1.format(new java.util.Date()).toString() + " 00:00:00.0"); // currDate = java.sql.Timestamp.valueOf(sdf1.format(new java.util.Date()).toString() + " 00:00:00.0");
userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode"); System.out.println("--login code--"+userId); userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode"); System.out.println("--login code--"+userId);
termId = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "termId"); System.out.println("--term id--"+termId); termId = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "termId"); System.out.println("--term id--"+termId);
chgUser = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"chgUser"); chgUser = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"chgUser");
chgTerm = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"chgTerm"); chgTerm = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"chgTerm");
sql = "SELECT EMP_CODE FROM USERS WHERE CODE = ? "; sql = "SELECT EMP_CODE FROM USERS WHERE CODE = ? ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, userId); pstmt.setString(1, userId);
...@@ -383,8 +383,8 @@ public class WoIssPartialPrc extends ProcessEJB implements WoIssPartialPrcLocal, ...@@ -383,8 +383,8 @@ public class WoIssPartialPrc extends ProcessEJB implements WoIssPartialPrcLocal,
if(pstmt != null) if(pstmt != null)
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
sql =" select SITE_CODE,LOC_GROUP,ITEM_CODE,ORDER_TYPE,lot_no,lot_sl,lot_no__issue from workorder where work_order= ? "; sql =" select SITE_CODE,LOC_GROUP,ITEM_CODE,ORDER_TYPE,lot_no,lot_sl,lot_no__issue from workorder where work_order= ? ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1,worder); pstmt.setString(1,worder);
...@@ -438,16 +438,17 @@ public class WoIssPartialPrc extends ProcessEJB implements WoIssPartialPrcLocal, ...@@ -438,16 +438,17 @@ public class WoIssPartialPrc extends ProcessEJB implements WoIssPartialPrcLocal,
TransIDGenerator tg = new TransIDGenerator(xmlValues, "BASE", commonConstants.DB_NAME); TransIDGenerator tg = new TransIDGenerator(xmlValues, "BASE", commonConstants.DB_NAME);
tranId = tg.generateTranSeqID(tranSer1, keyCol, keyString, conn); tranId = tg.generateTranSeqID(tranSer1, keyCol, keyString, conn);
System.out.println("@@@@ generated tranId :["+tranId+"]"); System.out.println("@@@@ generated tranId :["+tranId+"]");
date1 = sdf1.parse(currDate1.toString()); date1 = sdf1.parse(currDate1.toString());
currDate1 = java.sql.Timestamp.valueOf(sdf1.format(date1).toString() + " 00:00:00.0"); currDate1 = java.sql.Timestamp.valueOf(sdf1.format(date1).toString() + " 00:00:00.0");
System.out.println("currDate:"+currDate1); System.out.println("currDate:"+currDate1);
insertHed =" insert into workorder_iss (TRAN_ID,TRAN_DATE,EFF_DATE,WORK_ORDER,OPERATION,SITE_CODE, " insertHed =" insert into workorder_iss (TRAN_ID,TRAN_DATE,EFF_DATE,WORK_ORDER,OPERATION,SITE_CODE, "
+" REMARKS,CHG_DATE,CHG_USER,CHG_TERM,DEPT_CODE,TRAN_TYPE, " +" REMARKS,CHG_DATE,CHG_USER,CHG_TERM,DEPT_CODE,TRAN_TYPE, "
+" LOC_GROUP,ITEM_CODE,WOIR_TYPE,STATUS,CONFIRMED ,LOT_NO__FG,LOT_SL__FG) " +" LOC_GROUP,ITEM_CODE,WOIR_TYPE,STATUS,CONFIRMED ,LOT_NO__FG,LOT_SL__FG"
+" values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) "; +" ,UDF__STR1) "
+" values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) ";
pstmt = conn.prepareStatement(insertHed); pstmt = conn.prepareStatement(insertHed);
pstmt.setString(1,tranId); pstmt.setString(1,tranId);
pstmt.setTimestamp(2,currDate1); pstmt.setTimestamp(2,currDate1);
...@@ -455,7 +456,7 @@ public class WoIssPartialPrc extends ProcessEJB implements WoIssPartialPrcLocal, ...@@ -455,7 +456,7 @@ public class WoIssPartialPrc extends ProcessEJB implements WoIssPartialPrcLocal,
pstmt.setString(4,worder); pstmt.setString(4,worder);
pstmt.setInt(5,operation); pstmt.setInt(5,operation);
pstmt.setString(6,siteCode); pstmt.setString(6,siteCode);
// pstmt.setString(7,"issue generated partially for work order "+worder); // pstmt.setString(7,"issue generated partially for work order "+worder);
//pstmt.setString(7,"issue generated partially for WO "+worder+" for Qty " +batchQuantityStr);//comment added by sagar on 28/04/2015 //pstmt.setString(7,"issue generated partially for WO "+worder+" for Qty " +batchQuantityStr);//comment added by sagar on 28/04/2015
pstmt.setString(7,"Partial Issue for WO "+worder+" for Qty " +batchQuantityStr);//code added by sagar on 28/04/2015 pstmt.setString(7,"Partial Issue for WO "+worder+" for Qty " +batchQuantityStr);//code added by sagar on 28/04/2015
pstmt.setTimestamp(8,currDate1); pstmt.setTimestamp(8,currDate1);
...@@ -470,6 +471,7 @@ public class WoIssPartialPrc extends ProcessEJB implements WoIssPartialPrcLocal, ...@@ -470,6 +471,7 @@ public class WoIssPartialPrc extends ProcessEJB implements WoIssPartialPrcLocal,
pstmt.setString(17,"N"); pstmt.setString(17,"N");
pstmt.setString(18,lotNo); pstmt.setString(18,lotNo);
pstmt.setString(19,lotSl); pstmt.setString(19,lotSl);
pstmt.setString(20,batchQuantityStr);
upd = pstmt.executeUpdate(); upd = pstmt.executeUpdate();
pstmt.close(); pstmt.close();
...@@ -505,9 +507,9 @@ public class WoIssPartialPrc extends ProcessEJB implements WoIssPartialPrcLocal, ...@@ -505,9 +507,9 @@ public class WoIssPartialPrc extends ProcessEJB implements WoIssPartialPrcLocal,
issueQtyBill = quantity + potencyAdj ; issueQtyBill = quantity + potencyAdj ;
System.out.println("@@@@@@ workorder_bill-qty -- item wise -->["+issueQtyBill+"]"); System.out.println("@@@@@@ workorder_bill-qty -- item wise -->["+issueQtyBill+"]");
sql =" select nvl(sum(nvl(quantity,0) + nvl(potency_adj,0)),0) " sql =" select nvl(sum(nvl(quantity,0) + nvl(potency_adj,0)),0) "
+" from workorder_iss a, workorder_issdet b " +" from workorder_iss a, workorder_issdet b "
+" where a.tran_id = b.tran_id " +" where a.tran_id = b.tran_id "
...@@ -526,19 +528,19 @@ public class WoIssPartialPrc extends ProcessEJB implements WoIssPartialPrcLocal, ...@@ -526,19 +528,19 @@ public class WoIssPartialPrc extends ProcessEJB implements WoIssPartialPrcLocal,
rs1.close();rs1=null; rs1.close();rs1=null;
pstmt1.close();pstmt1=null; pstmt1.close();pstmt1=null;
System.out.println("@@@@@@ issuedQty for the item--->["+issuedQty+"]"); System.out.println("@@@@@@ issuedQty for the item--->["+issuedQty+"]");
/* /*
propReqQty = (issueQtyBill/woQty)*batchQuantity; propReqQty = (issueQtyBill/woQty)*batchQuantity;
propReqQty = Double.parseDouble(df.format(propReqQty)); propReqQty = Double.parseDouble(df.format(propReqQty));
System.out.println("@@@@@@ propReqQty for the item--->["+propReqQty+"]"); System.out.println("@@@@@@ propReqQty for the item--->["+propReqQty+"]");
issueQtyDiff = issueQtyBill - issuedQty ; issueQtyDiff = issueQtyBill - issuedQty ;
issueQtyDiff = Double.parseDouble(df.format(issueQtyDiff)); issueQtyDiff = Double.parseDouble(df.format(issueQtyDiff));
System.out.println("@@@@@@ issueQtyDiff for the item--->["+issueQtyDiff+"]"); System.out.println("@@@@@@ issueQtyDiff for the item--->["+issueQtyDiff+"]");
*/ */
/* /*
if(propReqQty > issueQtyDiff) if(propReqQty > issueQtyDiff)
{ {
list.add(itemCode); list.add(itemCode);
...@@ -546,33 +548,33 @@ public class WoIssPartialPrc extends ProcessEJB implements WoIssPartialPrcLocal, ...@@ -546,33 +548,33 @@ public class WoIssPartialPrc extends ProcessEJB implements WoIssPartialPrcLocal,
list.add(issueQtyBill); list.add(issueQtyBill);
flag = true; flag = true;
break; // added break condition on 05/11/14 by cpatil break; // added break condition on 05/11/14 by cpatil
} }
*/ */
if(flag == false) if(flag == false)
{
//sql2 = " SELECT LOC_CODE,LOT_NO,LOT_SL FROM INV_ALLOC_DET WHERE TRAN_ID IN (SELECT TRAN_ID FROM INV_ALLOCATE WHERE WORK_ORDER = ? ) AND ITEM_CODE = ? ";
sql2 = " SELECT LOC_CODE,LOT_NO,LOT_SL,ITEM_CODE,SITE_CODE, quantity , issue_qty " +
" FROM INV_ALLOC_DET " +
" WHERE TRAN_ID IN (SELECT TRAN_ID FROM INV_ALLOCATE WHERE WORK_ORDER = ? ) " +
" and 'Y' <> case when deallocated is null then 'N' else deallocated end " +
" and exp_lev = ? ";
pstmt2 = conn.prepareStatement(sql2);
pstmt2.setString(1,worder);
pstmt2.setString(2,expLev);
//pstmt2.setString(2,itemCode);
rs2 = pstmt2.executeQuery();
while(rs2.next())
{ {
//sql2 = " SELECT LOC_CODE,LOT_NO,LOT_SL FROM INV_ALLOC_DET WHERE TRAN_ID IN (SELECT TRAN_ID FROM INV_ALLOCATE WHERE WORK_ORDER = ? ) AND ITEM_CODE = ? "; lineNo++;
sql2 = " SELECT LOC_CODE,LOT_NO,LOT_SL,ITEM_CODE,SITE_CODE, quantity , issue_qty " + locCode =rs2.getString("LOC_CODE");
" FROM INV_ALLOC_DET " + lotNoInv =rs2.getString("LOT_NO");
" WHERE TRAN_ID IN (SELECT TRAN_ID FROM INV_ALLOCATE WHERE WORK_ORDER = ? ) " + lotSlInv =rs2.getString("LOT_SL");
" and 'Y' <> case when deallocated is null then 'N' else deallocated end " + itemCodeInv =rs2.getString("ITEM_CODE");
" and exp_lev = ? "; siteCode =rs2.getString("SITE_CODE");
pstmt2 = conn.prepareStatement(sql2); quantityInv =rs2.getDouble("quantity");
pstmt2.setString(1,worder); issueQtyInv =rs2.getDouble("issue_qty");
pstmt2.setString(2,expLev);
//pstmt2.setString(2,itemCode);
rs2 = pstmt2.executeQuery();
while(rs2.next())
{
lineNo++;
locCode =rs2.getString("LOC_CODE");
lotNoInv =rs2.getString("LOT_NO");
lotSlInv =rs2.getString("LOT_SL");
itemCodeInv =rs2.getString("ITEM_CODE");
siteCode =rs2.getString("SITE_CODE");
quantityInv =rs2.getDouble("quantity");
issueQtyInv =rs2.getDouble("issue_qty");
String propReqQtyStr = df.format(propReqQty); String propReqQtyStr = df.format(propReqQty);
propReqQty = Double.parseDouble(propReqQtyStr); propReqQty = Double.parseDouble(propReqQtyStr);
System.out.println("propReqQty @@@::["+propReqQty+"]for item["+itemCode + "]quantityInv["+quantityInv+"]issueQtyInv["+issueQtyInv+"]"); System.out.println("propReqQty @@@::["+propReqQty+"]for item["+itemCode + "]quantityInv["+quantityInv+"]issueQtyInv["+issueQtyInv+"]");
...@@ -587,36 +589,36 @@ public class WoIssPartialPrc extends ProcessEJB implements WoIssPartialPrcLocal, ...@@ -587,36 +589,36 @@ public class WoIssPartialPrc extends ProcessEJB implements WoIssPartialPrcLocal,
+" and a.loc_code in ( select loc_code from location where loc_group ='"+locGroup+"' ) " +" and a.loc_code in ( select loc_code from location where loc_group ='"+locGroup+"' ) "
+" and lot_no in ('" +lotNoIss+ "')" +" and lot_no in ('" +lotNoIss+ "')"
+" and ( a.quantity - a.alloc_qty ) > 0 "; +" and ( a.quantity - a.alloc_qty ) > 0 ";
*/ */
noArt = 0; noArt = 0;
netWeight = 0; netWeight = 0;
grossWeight= 0 ; grossWeight= 0 ;
stkQty = 0; stkQty = 0;
stockSql ="select a.NO_ART , a.NET_WEIGHT , a.GROSS_WEIGHT, a.quantity " //added on 02/04/15 by cpatil stockSql ="select a.NO_ART , a.NET_WEIGHT , a.GROSS_WEIGHT, a.quantity " //added on 02/04/15 by cpatil
+" from stock a, invstat b, item c " +" from stock a, invstat b, item c "
+" Where a.inv_stat = b.inv_stat and a.item_code = c.item_code " +" Where a.inv_stat = b.inv_stat and a.item_code = c.item_code "
+" and a.item_code = '" + itemCodeInv + "' " +" and a.item_code = '" + itemCodeInv + "' "
+" and a.site_code = '"+siteCode+"' " +" and a.site_code = '"+siteCode+"' "
+" and b.stat_type <> 'S' and b.available = 'Y' " +" and b.stat_type <> 'S' and b.available = 'Y' "
+" and a.loc_code ='"+locCode+"' " +" and a.loc_code ='"+locCode+"' "
+" and a.lot_no = ('" +lotNoInv+ "') " +" and a.lot_no = ('" +lotNoInv+ "') "
+" and a.quantity > 0 "; +" and a.quantity > 0 ";
pstmt1 = conn.prepareStatement(stockSql); pstmt1 = conn.prepareStatement(stockSql);
rs1 = pstmt1.executeQuery(); rs1 = pstmt1.executeQuery();
if(rs1.next()) if(rs1.next())
{ {
noArt = rs1.getDouble(1); // added by cpatil on 02/04/15 noArt = rs1.getDouble(1); // added by cpatil on 02/04/15
netWeight = rs1.getDouble(2); // added by cpatil on 02/04/15 netWeight = rs1.getDouble(2); // added by cpatil on 02/04/15
grossWeight= rs1.getDouble(3); // added by cpatil on 02/04/15 grossWeight= rs1.getDouble(3); // added by cpatil on 02/04/15
stkQty= rs1.getDouble(4); // added by cpatil on 02/04/15 stkQty= rs1.getDouble(4); // added by cpatil on 02/04/15
} }
rs1.close();rs1=null; rs1.close();rs1=null;
pstmt1.close();pstmt1=null; pstmt1.close();pstmt1=null;
stockSql ="select a.lot_no, a.loc_code, a.lot_sl, a.rate, a.gross_rate,a.supp_code__mfg " stockSql ="select a.lot_no, a.loc_code, a.lot_sl, a.rate, a.gross_rate,a.supp_code__mfg "
+" ,(a.quantity-a.alloc_qty) as stockBalQty " +" ,(a.quantity-a.alloc_qty) as stockBalQty "
+" from stock a, invstat b, item c " +" from stock a, invstat b, item c "
...@@ -627,34 +629,34 @@ public class WoIssPartialPrc extends ProcessEJB implements WoIssPartialPrcLocal, ...@@ -627,34 +629,34 @@ public class WoIssPartialPrc extends ProcessEJB implements WoIssPartialPrcLocal,
+" and a.loc_code ='"+locCode+"' " +" and a.loc_code ='"+locCode+"' "
+" and a.lot_no = ('" +lotNoInv+ "')" +" and a.lot_no = ('" +lotNoInv+ "')"
+" and ( a.quantity - a.alloc_qty ) > 0 "; +" and ( a.quantity - a.alloc_qty ) > 0 ";
pstmt1 = conn.prepareStatement(stockSql); pstmt1 = conn.prepareStatement(stockSql);
rs1 = pstmt1.executeQuery(); rs1 = pstmt1.executeQuery();
if(rs1.next()) if(rs1.next())
{ {
// String stock_lot_no = rs1.getString(1); // String stock_lot_no = rs1.getString(1);
// String stock_loc_code = rs1.getString(2); // String stock_loc_code = rs1.getString(2);
// String stock_lot_sl = rs1.getString(3); // String stock_lot_sl = rs1.getString(3);
rate = rs1.getDouble(4); rate = rs1.getDouble(4);
grossRate = rs1.getDouble(5); grossRate = rs1.getDouble(5);
// String suppCodeMfg = rs1.getString(6); // String suppCodeMfg = rs1.getString(6);
// double stockBalQty = rs1.getDouble(7); // double stockBalQty = rs1.getDouble(7);
} }
rs1.close();rs1=null; rs1.close();rs1=null;
pstmt1.close();pstmt1=null; pstmt1.close();pstmt1=null;
// for quantity check // for quantity check
System.out.println("@@@@@@090315 quantityInv["+quantityInv+"]woQty["+woQty+"]batchQuantity["+batchQuantity+"]issueQtyInv["+issueQtyInv+"]issuedQty["+issuedQty+"]"); System.out.println("@@@@@@090315 quantityInv["+quantityInv+"]woQty["+woQty+"]batchQuantity["+batchQuantity+"]issueQtyInv["+issueQtyInv+"]issuedQty["+issuedQty+"]");
propReqQty = (quantityInv/woQty)*batchQuantity; propReqQty = (quantityInv/woQty)*batchQuantity;
propReqQty = Double.parseDouble(df.format(propReqQty)); propReqQty = Double.parseDouble(df.format(propReqQty));
System.out.println("@@@@@@1 propReqQty for the item--->["+propReqQty+"]"); System.out.println("@@@@@@1 propReqQty for the item--->["+propReqQty+"]");
//issueQtyDiff = quantityInv - issuedQty ; //comment this condition on 09/03/15 //issueQtyDiff = quantityInv - issuedQty ; //comment this condition on 09/03/15
issueQtyDiff = quantityInv - issueQtyInv ; issueQtyDiff = quantityInv - issueQtyInv ;
issueQtyDiff = Double.parseDouble(df.format(issueQtyDiff)); issueQtyDiff = Double.parseDouble(df.format(issueQtyDiff));
System.out.println("@@@@@@ issueQtyDiff for the item--->["+issueQtyDiff+"]"); System.out.println("@@@@@@ issueQtyDiff for the item--->["+issueQtyDiff+"]");
// added by cpatil on 01/06/15 for iss_varience start // added by cpatil on 01/06/15 for iss_varience start
...@@ -671,24 +673,56 @@ public class WoIssPartialPrc extends ProcessEJB implements WoIssPartialPrcLocal, ...@@ -671,24 +673,56 @@ public class WoIssPartialPrc extends ProcessEJB implements WoIssPartialPrcLocal,
issVarience = rs1.getDouble("iss_varience"); issVarience = rs1.getDouble("iss_varience");
issVarienceType = checkNull(rs1.getString("iss_varience_type")); issVarienceType = checkNull(rs1.getString("iss_varience_type"));
qtyPer = rs1.getDouble("qty_per"); qtyPer = rs1.getDouble("qty_per");
} }
rs1.close();rs1=null; rs1.close();rs1=null;
pstmt1.close();pstmt1=null; pstmt1.close();pstmt1=null;
System.out.println("@@@@@@ item ["+itemCodeInv+"]---->issVarience["+issVarience+"]/qtyPer["+qtyPer+"]*issueQtyBill["+issueQtyBill+"]issVarienceType["+issVarienceType+"]"); System.out.println("@@@@@@ item ["+itemCodeInv+"]---->issVarience["+issVarience+"]/qtyPer["+qtyPer+"]*issueQtyBill["+issueQtyBill+"]issVarienceType["+issVarienceType+"]");
varValue = issVarience / qtyPer * issueQtyBill ; varValue = issVarience / qtyPer * issueQtyBill ;
System.out.println("@@@@@@ issVarience for the item ["+itemCodeInv+"]---->Varience Value["+varValue+"]"); System.out.println("@@@@@@ issVarience for the item ["+itemCodeInv+"]---->Varience Value["+varValue+"]");
*/ */
// end by cpatil on 01/06/15 for iss_varience // end by cpatil on 01/06/15 for iss_varience
if( propReqQty > issueQtyDiff ) if( propReqQty > issueQtyDiff )
{ {
propReqQty = propReqQty - ( propReqQty - issueQtyDiff ) ; propReqQty = propReqQty - ( propReqQty - issueQtyDiff ) ;
} }
System.out.println("@@@@@@@@@@@ propReqQty["+propReqQty+"]issueQtyDiff["+issueQtyDiff+"]"); System.out.println("@@@@@@@@@@@ propReqQty["+propReqQty+"]issueQtyDiff["+issueQtyDiff+"]");
// if(propReqQty > ( issueQtyDiff + varValue ) ) // added by cpatil on 01/06/15 for iss_varience
if(propReqQty > issueQtyDiff ) // added by cpatil on 01/06/15 for iss_varience // added by cpatil on 01/06/15 for iss_varience start
String sql4 = "", udfStr1="";
double prevIssQty=0, WOrderQty=0;
sql4 = " select udf__str1 from workorder_iss where work_order = ? and tran_id not in ( ? ) ";
pstmt1 = conn.prepareStatement(sql4);
pstmt1.setString(1,worder);
pstmt1.setString(2,tranId);
rs1 = pstmt1.executeQuery();
while(rs1.next())
{
udfStr1 = rs1.getString("udf__str1")==null?"0":rs1.getString("udf__str1");
prevIssQty = prevIssQty + Double.parseDouble(udfStr1);
}
rs1.close();rs1=null;
pstmt1.close();pstmt1=null;
System.out.println("@@@@@@ prevIssQty ["+prevIssQty+"]");
sql4 = " select quantity from workorder where work_order = ? ";
pstmt1 = conn.prepareStatement(sql4);
pstmt1.setString(1,worder);
rs1 = pstmt1.executeQuery();
while(rs1.next())
{
WOrderQty = rs1.getDouble("quantity");
}
rs1.close();rs1=null;
pstmt1.close();pstmt1=null;
System.out.println("@@@@@@ :batchQuantity["+batchQuantityStr+"] > WOrderQty["+WOrderQty+"]-prevIssQty["+prevIssQty+"]");
// if(propReqQty > ( issueQtyDiff + varValue ) ) // added by cpatil on 01/06/15 for iss_varience
if(propReqQty > issueQtyDiff || issueQtyDiff == 0 || ( Double.parseDouble(batchQuantityStr) > WOrderQty - prevIssQty ) ) // added by cpatil on 01/06/15 for iss_varience
{ {
System.out.println("propReqQty["+propReqQty+"]issueQtyDiff["+issueQtyDiff+"]"); System.out.println("propReqQty["+propReqQty+"]issueQtyDiff["+issueQtyDiff+"]");
list.add(itemCode); list.add(itemCode);
...@@ -697,26 +731,26 @@ public class WoIssPartialPrc extends ProcessEJB implements WoIssPartialPrcLocal, ...@@ -697,26 +731,26 @@ public class WoIssPartialPrc extends ProcessEJB implements WoIssPartialPrcLocal,
flag = true; // remove comment on 05/03/15 for validate over issue quantity //comment by cpatil for remove validation on 11/11/14 as per shailesh n manoharan sir discussion. flag = true; // remove comment on 05/03/15 for validate over issue quantity //comment by cpatil for remove validation on 11/11/14 as per shailesh n manoharan sir discussion.
break; // remove comment on 05/03/15 for validate over issue quantity //comment by cpatil for remove validation on 11/11/14 as per shailesh n manoharan sir discussion. break; // remove comment on 05/03/15 for validate over issue quantity //comment by cpatil for remove validation on 11/11/14 as per shailesh n manoharan sir discussion.
// added break condition on 05/11/14 by cpatil // added break condition on 05/11/14 by cpatil
} }
// end // end
// NO_ART , NET_WEIGHT , GROSS_WEIGHT added urse // NO_ART , NET_WEIGHT , GROSS_WEIGHT added urse
System.out.println("@@@@@@@@@ before calculation : netWeight["+netWeight+"]grossWeight["+grossWeight+"]noArt["+noArt+"]stkQty["+stkQty+"]propReqQty["+propReqQty+"]"); System.out.println("@@@@@@@@@ before calculation : netWeight["+netWeight+"]grossWeight["+grossWeight+"]noArt["+noArt+"]stkQty["+stkQty+"]propReqQty["+propReqQty+"]");
netWeight = ( netWeight * propReqQty ) / stkQty ; netWeight = ( netWeight * propReqQty ) / stkQty ;
grossWeight = ( grossWeight * propReqQty ) / stkQty ; grossWeight = ( grossWeight * propReqQty ) / stkQty ;
noArt = new Double( Math.ceil( ( noArt * propReqQty ) / stkQty )) ; noArt = new Double( Math.ceil( ( noArt * propReqQty ) / stkQty )) ;
System.out.println("@@@@@@@@@ after calculation : netWeight["+netWeight+"]grossWeight["+grossWeight+"]noArt["+noArt+"]"); System.out.println("@@@@@@@@@ after calculation : netWeight["+netWeight+"]grossWeight["+grossWeight+"]noArt["+noArt+"]");
System.out.println("@@@@@@@@@ locGroup work order["+locGroup+"]locCode["+locCode+"]"); System.out.println("@@@@@@@@@ locGroup work order["+locGroup+"]locCode["+locCode+"]");
String locGroupLoc = ""; String locGroupLoc = "";
String locSql =" select loc_group from location where loc_code = ? "; String locSql =" select loc_group from location where loc_code = ? ";
pstmt1 = conn.prepareStatement(locSql); pstmt1 = conn.prepareStatement(locSql);
...@@ -735,9 +769,9 @@ public class WoIssPartialPrc extends ProcessEJB implements WoIssPartialPrcLocal, ...@@ -735,9 +769,9 @@ public class WoIssPartialPrc extends ProcessEJB implements WoIssPartialPrcLocal,
System.out.println("@@@@@@@@@ locGroup miss match in work order["+locGroup+"]location["+locGroupLoc+"]"); System.out.println("@@@@@@@@@ locGroup miss match in work order["+locGroup+"]location["+locGroupLoc+"]");
return retString ; return retString ;
} }
insertDetail ="insert into workorder_issdet (tran_id,line_no,exp_lev,item_code,loc_code,lot_no," + insertDetail ="insert into workorder_issdet (tran_id,line_no,exp_lev,item_code,loc_code,lot_no," +
" lot_sl,quantity,unit,rate,gross_rate,calc_potency, potency_adj," + " lot_sl,quantity,unit,rate,gross_rate,calc_potency, potency_adj," +
" match_potency,min_potency_perc,adj_potency,work_order" + " match_potency,min_potency_perc,adj_potency,work_order" +
...@@ -762,14 +796,14 @@ public class WoIssPartialPrc extends ProcessEJB implements WoIssPartialPrcLocal, ...@@ -762,14 +796,14 @@ public class WoIssPartialPrc extends ProcessEJB implements WoIssPartialPrcLocal,
pstmt1.setDouble(15,minPotencyPerc); pstmt1.setDouble(15,minPotencyPerc);
pstmt1.setString(16,adjPotency); pstmt1.setString(16,adjPotency);
pstmt1.setString(17,worder); pstmt1.setString(17,worder);
pstmt1.setDouble(18,noArt); // added by cpatil on 02/04/15 pstmt1.setDouble(18,noArt); // added by cpatil on 02/04/15
pstmt1.setDouble(19,netWeight); // added by cpatil on 02/04/15 pstmt1.setDouble(19,netWeight); // added by cpatil on 02/04/15
pstmt1.setDouble(20,grossWeight); // added by cpatil on 02/04/15 pstmt1.setDouble(20,grossWeight); // added by cpatil on 02/04/15
updDet = updDet + pstmt1.executeUpdate(); updDet = updDet + pstmt1.executeUpdate();
pstmt1.close();pstmt1=null; pstmt1.close();pstmt1=null;
sql = " update inv_alloc_det set issue_qty = (CASE WHEN issue_qty IS NULL THEN 0 ELSE issue_qty END) + ? ,"//Add case condition for removing null value sql = " update inv_alloc_det set issue_qty = (CASE WHEN issue_qty IS NULL THEN 0 ELSE issue_qty END) + ? ,"//Add case condition for removing null value
+ " dealloc_qty = (CASE WHEN dealloc_qty IS NULL THEN 0 ELSE dealloc_qty END) + ?" + " dealloc_qty = (CASE WHEN dealloc_qty IS NULL THEN 0 ELSE dealloc_qty END) + ?"
+ " where tran_id in (select tran_id from inv_allocate where work_order = ? )" + " where tran_id in (select tran_id from inv_allocate where work_order = ? )"
...@@ -788,18 +822,18 @@ public class WoIssPartialPrc extends ProcessEJB implements WoIssPartialPrcLocal, ...@@ -788,18 +822,18 @@ public class WoIssPartialPrc extends ProcessEJB implements WoIssPartialPrcLocal,
int cnt=pstmt1.executeUpdate(); int cnt=pstmt1.executeUpdate();
System.out.println("Count after PSTM is:- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%["+cnt+"]"); System.out.println("Count after PSTM is:- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%["+cnt+"]");
pstmt1.close();pstmt1=null; pstmt1.close();pstmt1=null;
}
rs2.close();
rs2=null;
pstmt2.close();
pstmt2=null;
} }
} rs2.close();
System.out.println("detail record :: inserted "+updDet); rs2=null;
if(flag) pstmt2.close();
retString = "VTBATQTY"; pstmt2=null;
else if(updDet > 0) }
retString = "VPSUCC1"; }
System.out.println("detail record :: inserted "+updDet);
if(flag)
retString = "VTBATQTY";
else if(updDet > 0)
retString = "VPSUCC1";
} }
catch(Exception e) catch(Exception e)
{ {
...@@ -850,7 +884,7 @@ public class WoIssPartialPrc extends ProcessEJB implements WoIssPartialPrcLocal, ...@@ -850,7 +884,7 @@ public class WoIssPartialPrc extends ProcessEJB implements WoIssPartialPrcLocal,
} }
return input; return input;
} }
private String getCurrdateAppFormat() private String getCurrdateAppFormat()
{ {
String s = ""; String s = "";
......
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