Commit efbab775 authored by cpandey's avatar cpandey

changes in sql for partial order by clause


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@91875 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 770f3086
...@@ -56,7 +56,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -56,7 +56,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
@Override @Override
public String actionHandler(String actionType, String xmlString, public String actionHandler(String actionType, String xmlString,
String xmlString1, String objContext, String xtraParams) String xmlString1, String objContext, String xtraParams)
throws RemoteException, ITMException { throws RemoteException, ITMException {
Document dom = null; Document dom = null;
Document dom1 = null; Document dom1 = null;
...@@ -85,14 +85,14 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -85,14 +85,14 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
} }
} catch (Exception e) { } catch (Exception e) {
System.out System.out
.println("Exception :WOrderIssueActEJB :actionHandler(String xmlString):" .println("Exception :WOrderIssueActEJB :actionHandler(String xmlString):"
+ e.getMessage() + ":"); + e.getMessage() + ":");
e.printStackTrace(); e.printStackTrace();
throw new ITMException(e); throw new ITMException(e);
} }
System.out System.out
.println("returning String from WOrderIssueActEJB : actionHandler" .println("returning String from WOrderIssueActEJB : actionHandler"
+ retString); + retString);
return retString; return retString;
} }
...@@ -126,14 +126,14 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -126,14 +126,14 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
} }
} catch (Exception e) { } catch (Exception e) {
System.out System.out
.println("Exception :WOrderIssueActEJB :actionHandlerTransform(String xmlString):" .println("Exception :WOrderIssueActEJB :actionHandlerTransform(String xmlString):"
+ e.getMessage() + ":"); + e.getMessage() + ":");
e.printStackTrace(); e.printStackTrace();
throw new ITMException(e); throw new ITMException(e);
} }
System.out System.out
.println("returning String from WOrderIssueActEJB : actionHandlerTransform" .println("returning String from WOrderIssueActEJB : actionHandlerTransform"
+ retString); + retString);
return retString; return retString;
} }
...@@ -172,13 +172,13 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -172,13 +172,13 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
conn = connDriver.getConnectDB("DriverITM"); conn = connDriver.getConnectDB("DriverITM");
tranType = genericUtility.getColumnValue("tran_type", dom1); tranType = genericUtility.getColumnValue("tran_type", dom1);
tranIdReq = genericUtility.getColumnValue("tran_id__req", dom1); tranIdReq = genericUtility.getColumnValue("tran_id__req", dom1);
// System.out.println("tranType before null :::: " + tranType + "tranIdReq :::: " + tranIdReq); //COMMENTED BY ALKA 19/07/07 AS NOT REQUIRED // System.out.println("tranType before null :::: " + tranType + "tranIdReq :::: " + tranIdReq); //COMMENTED BY ALKA 19/07/07 AS NOT REQUIRED
if (tranIdReq == null) tranIdReq = ""; if (tranIdReq == null) tranIdReq = "";
if (tranType == null) tranType = ""; if (tranType == null) tranType = "";
System.out.println("tranType :::: " + tranType + "tranIdReq :::: " + tranIdReq); System.out.println("tranType :::: " + tranType + "tranIdReq :::: " + tranIdReq);
tranType = tranType.trim(); tranType = tranType.trim();
if ((tranType.equalsIgnoreCase("D") || tranType.equalsIgnoreCase("O")) && tranIdReq.trim().length() > 0) if ((tranType.equalsIgnoreCase("D") || tranType.equalsIgnoreCase("O")) && tranIdReq.trim().length() > 0)
{ {
sql = "SELECT EXP_LEV, ITEM_CODE, QUANTITY FROM WORKORDER_ISSDET_REQ WHERE TRAN_ID = ?"; sql = "SELECT EXP_LEV, ITEM_CODE, QUANTITY FROM WORKORDER_ISSDET_REQ WHERE TRAN_ID = ?";
...@@ -193,11 +193,11 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -193,11 +193,11 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
System.out.println("expLev :: " + expLev + " itemCode :: " + itemCode); System.out.println("expLev :: " + expLev + " itemCode :: " + itemCode);
System.out.println("qtyReq :: " + qtyReq); System.out.println("qtyReq :: " + qtyReq);
// DEDUCT THE ISSUED QUANTITY FOR THIS REQ // DEDUCT THE ISSUED QUANTITY FOR THIS REQ
sql = "SELECT SUM(B.QUANTITY) FROM WORKORDER_ISS A, WORKORDER_ISSDET B " sql = "SELECT SUM(B.QUANTITY) FROM WORKORDER_ISS A, WORKORDER_ISSDET B "
+ " WHERE (A.TRAN_ID = B.TRAN_ID) AND (A.CONFIRMED = 'Y' ) AND (A.TRAN_TYPE = ?) " + " WHERE (A.TRAN_ID = B.TRAN_ID) AND (A.CONFIRMED = 'Y' ) AND (A.TRAN_TYPE = ?) "
+ " AND (A.TRAN_ID__REQ = ?) AND (B.ITEM_CODE = ?) AND (B.EXP_LEV = ?)"; + " AND (A.TRAN_ID__REQ = ?) AND (B.ITEM_CODE = ?) AND (B.EXP_LEV = ?)";
pstmt1 = conn.prepareStatement(sql); pstmt1 = conn.prepareStatement(sql);
pstmt1.setString(1, tranType); pstmt1.setString(1, tranType);
pstmt1.setString(2, tranIdReq); pstmt1.setString(2, tranIdReq);
...@@ -205,13 +205,13 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -205,13 +205,13 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
pstmt1.setString(4, expLev); pstmt1.setString(4, expLev);
System.out.println("sql ::: "+ sql); System.out.println("sql ::: "+ sql);
rs1 = pstmt1.executeQuery(); rs1 = pstmt1.executeQuery();
if (rs1.next()) if (rs1.next())
{ {
totalQtyIss = rs1.getDouble(1); totalQtyIss = rs1.getDouble(1);
System.out.println("totalQtyIss ::: " + totalQtyIss); System.out.println("totalQtyIss ::: " + totalQtyIss);
} }
if ((qtyReq - totalQtyIss) > 0) if ((qtyReq - totalQtyIss) > 0)
{ {
getItemChanged(dom, dom1, expLev, conn); getItemChanged(dom, dom1, expLev, conn);
...@@ -227,7 +227,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -227,7 +227,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
pstmt.close(); pstmt.close();
rs.close(); rs.close();
} }
// ADDED BY ALKA 19/07/07 TO DISPLAY MESSAGE THAT THE ALL ITEMS BUTTON WORKS ON INCASE OF "D" OR "O" // ADDED BY ALKA 19/07/07 TO DISPLAY MESSAGE THAT THE ALL ITEMS BUTTON WORKS ON INCASE OF "D" OR "O"
else else
{ {
errCode = "VTTRANTY"; errCode = "VTTRANTY";
...@@ -235,9 +235,9 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -235,9 +235,9 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
System.out.println("errString :" + errString); System.out.println("errString :" + errString);
return errString; return errString;
} }
// ADDITION ENDED BY ALKA 19/07/07 TO DISPLAY MESSAGE THAT THE ALL ITEMS BUTTON WORKS ON INCASE OF "D" OR "O" // ADDITION ENDED BY ALKA 19/07/07 TO DISPLAY MESSAGE THAT THE ALL ITEMS BUTTON WORKS ON INCASE OF "D" OR "O"
valueXmlString.append("</Root>\r\n"); valueXmlString.append("</Root>\r\n");
} catch (SQLException sqx) { } catch (SQLException sqx) {
System.out.println("The sqlException occure in WOrderIssueActEJB :" + sqx); System.out.println("The sqlException occure in WOrderIssueActEJB :" + sqx);
throw new ITMException(sqx); throw new ITMException(sqx);
...@@ -255,16 +255,16 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -255,16 +255,16 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
return valueXmlString.toString(); return valueXmlString.toString();
} }
private String actionStock(Document dom, Document dom1, String xtraParams) private String actionStock(Document dom, Document dom1, String xtraParams) throws RemoteException, ITMException
throws RemoteException, ITMException { {
/* /*
* ALLOWS THE USER TO SELECT STOCK FROM DIFF. LOC_CODE, LOT_NO, LOT_SL * ALLOWS THE USER TO SELECT STOCK FROM DIFF. LOC_CODE, LOT_NO, LOT_SL
GETS ALL STOCK FROM STOCK TABLE FOR FOLLOWING CONDITIONS: GETS ALL STOCK FROM STOCK TABLE FOR FOLLOWING CONDITIONS:
SITE_CODE = HEADER SITE_CODE ---- ITEM_CODE = ITEM CODE ENTERED SITE_CODE = HEADER SITE_CODE ---- ITEM_CODE = ITEM CODE ENTERED
INVSTAT.AVAILABLE = 'Y' --- EXPIRY DATE IS NULL OR EXPIRY DATE IS > HEADER EFF_DATE INVSTAT.AVAILABLE = 'Y' --- EXPIRY DATE IS NULL OR EXPIRY DATE IS > HEADER EFF_DATE
RETEST_DATE > HEADER EFF_DATE ---- QUANTITY - ALLOC_QTY > 0 RETEST_DATE > HEADER EFF_DATE ---- QUANTITY - ALLOC_QTY > 0
IF QC_REQD = 'Y' THEN ONLY EXPIRY DATE AND RETEST DATE TO BE CONSIDERED IF QC_REQD = 'Y' THEN ONLY EXPIRY DATE AND RETEST DATE TO BE CONSIDERED
*/ */
String siteCode = null, itemCode = null, dimension = null, bomCode = null, expLev = null; String siteCode = null, itemCode = null, dimension = null, bomCode = null, expLev = null;
String errCode = null, errString = null, sql = null; String errCode = null, errString = null, sql = null;
String expDate1 = null, retestDate1 = null, retestDt = null, effDate = null, itemCodeMain = null; String expDate1 = null, retestDate1 = null, retestDt = null, effDate = null, itemCodeMain = null;
...@@ -303,9 +303,9 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -303,9 +303,9 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
locGroup = genericUtility.getColumnValue("loc_group", dom1); // 26/03/12 manoharan locGroup = genericUtility.getColumnValue("loc_group", dom1); // 26/03/12 manoharan
// 18/02/12 manoharan // 18/02/12 manoharan
sql = "select w.LOT_NO__ISSUE,b.CONSIDER_LOT_NO__ISSUE,b.LOC_USAGE_TYPE from workorder w, workorder_bill b " sql = "select w.LOT_NO__ISSUE,b.CONSIDER_LOT_NO__ISSUE,b.LOC_USAGE_TYPE from workorder w, workorder_bill b "
+ " where w.work_order = b.work_order " + " where w.work_order = b.work_order "
+ " and w.work_order = ? " + " and w.work_order = ? "
+ " and b.exp_lev = ? "; + " and b.exp_lev = ? ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, workOrder); pstmt.setString(1, workOrder);
pstmt.setString(2, expLev); pstmt.setString(2, expLev);
...@@ -322,7 +322,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -322,7 +322,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
{ {
String lotNoList[]; String lotNoList[];
String lotNoIssueTemp = ""; String lotNoIssueTemp = "";
lotNoList = lotNoIssue.split(","); lotNoList = lotNoIssue.split(",");
lotNoIssue = ""; lotNoIssue = "";
for(int ctr = 0;ctr < lotNoList.length;ctr++) for(int ctr = 0;ctr < lotNoList.length;ctr++)
...@@ -336,19 +336,19 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -336,19 +336,19 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
{ {
lotNoIssue = lotNoIssue + "'".concat(lotNoIssueTemp).concat("'"); lotNoIssue = lotNoIssue + "'".concat(lotNoIssueTemp).concat("'");
} }
} }
} }
// end 18/02/12 manoharan // end 18/02/12 manoharan
// for qc_reqd to be checked from first siteitem & then item // for qc_reqd to be checked from first siteitem & then item
qcReqd = mfgCommon.chkQcReqd(siteCode, itemCode, conn); qcReqd = mfgCommon.chkQcReqd(siteCode, itemCode, conn);
autoQcReqd = mfgCommon.chkAutoQcReqd(siteCode, itemCode, conn); autoQcReqd = mfgCommon.chkAutoQcReqd(siteCode, itemCode, conn);
sql = "SELECT (CASE WHEN TRACK_SHELF_LIFE IS NULL THEN 'N' ELSE TRACK_SHELF_LIFE END) " sql = "SELECT (CASE WHEN TRACK_SHELF_LIFE IS NULL THEN 'N' ELSE TRACK_SHELF_LIFE END) "
+ " FROM ITEM WHERE ITEM_CODE = ?"; + " FROM ITEM WHERE ITEM_CODE = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, itemCode); pstmt.setString(1, itemCode);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
...@@ -373,7 +373,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -373,7 +373,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
pstmt.close(); pstmt.close();
rs.close(); rs.close();
sql = "SELECT DIMENSION, USE_INVSTATUS FROM BOMDET WHERE BOM_CODE = ? AND ITEM_CODE = ? AND ITEM_REF = ?"; sql = "SELECT DIMENSION,USE_INVSTATUS FROM BOMDET WHERE BOM_CODE = ? AND ITEM_CODE = ? AND ITEM_REF = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, bomCode); pstmt.setString(1, bomCode);
pstmt.setString(2, itemCodeMain); pstmt.setString(2, itemCodeMain);
...@@ -398,18 +398,18 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -398,18 +398,18 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
System.out.println("trackShelfLife :: " + trackShelfLife + " useInvStatus :: " + useInvStatus); System.out.println("trackShelfLife :: " + trackShelfLife + " useInvStatus :: " + useInvStatus);
if (dimension.trim().length() == 0) if (dimension.trim().length() == 0)
{ {
// check whether any valid record in stock exist for the item // check whether any valid record in stock exist for the item
// TO CHECK USE_INVSTATUS FROM BOMDET -- IF IT IS B THEN CHECK STAT_TYPE FROM INVSTAT // TO CHECK USE_INVSTATUS FROM BOMDET -- IF IT IS B THEN CHECK STAT_TYPE FROM INVSTAT
// to check all condition for auto_reqc // to check all condition for auto_reqc
// Added Location code join to invstat // Added Location code join to invstat
if (qcReqd.equalsIgnoreCase("Y") && autoQcReqd.equalsIgnoreCase("Y") && trackShelfLife.equalsIgnoreCase("Y") && useInvStatus.equalsIgnoreCase("U")) if (qcReqd.equalsIgnoreCase("Y") && autoQcReqd.equalsIgnoreCase("Y") && trackShelfLife.equalsIgnoreCase("Y") && useInvStatus.equalsIgnoreCase("U"))
{ {
sql = " SELECT COUNT(A.ITEM_CODE) FROM STOCK A, LOCATION B, INVSTAT C " sql = " SELECT COUNT(A.ITEM_CODE) FROM STOCK A, LOCATION B, INVSTAT C "
+ " WHERE A.LOC_CODE = B.LOC_CODE AND B.INV_STAT = C.INV_STAT AND " + " WHERE A.LOC_CODE = B.LOC_CODE AND B.INV_STAT = C.INV_STAT AND "
+ " A.ITEM_CODE = ? AND A.SITE_CODE = ? AND C.AVAILABLE = 'Y' " + " A.ITEM_CODE = ? AND A.SITE_CODE = ? AND C.AVAILABLE = 'Y' "
+ " AND ((CASE WHEN A.QUANTITY IS NULL THEN 0 ELSE A.QUANTITY END) - " + " AND ((CASE WHEN A.QUANTITY IS NULL THEN 0 ELSE A.QUANTITY END) - "
+ " (CASE WHEN A.ALLOC_QTY IS NULL THEN 0 ELSE A.ALLOC_QTY END)) > 0 " + " (CASE WHEN A.ALLOC_QTY IS NULL THEN 0 ELSE A.ALLOC_QTY END)) > 0 "
+ " AND ( A.EXP_DATE > ? OR A.EXP_DATE IS NULL) AND A.RETEST_DATE > ?"; + " AND ( A.EXP_DATE > ? OR A.EXP_DATE IS NULL) AND A.RETEST_DATE > ?";
// 18/02/12 manoharan // 18/02/12 manoharan
if ("Y".equals(considerLotNoIssue) && lotNoIssue != null && !"null".equals(lotNoIssue) && lotNoIssue.trim().length() > 0) if ("Y".equals(considerLotNoIssue) && lotNoIssue != null && !"null".equals(lotNoIssue) && lotNoIssue.trim().length() > 0)
{ {
...@@ -431,11 +431,11 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -431,11 +431,11 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
else if (qcReqd.equalsIgnoreCase("Y") && autoQcReqd.equalsIgnoreCase("N") && trackShelfLife.equalsIgnoreCase("Y") && useInvStatus.equalsIgnoreCase("U")) else if (qcReqd.equalsIgnoreCase("Y") && autoQcReqd.equalsIgnoreCase("N") && trackShelfLife.equalsIgnoreCase("Y") && useInvStatus.equalsIgnoreCase("U"))
{ {
sql = "SELECT COUNT(A.ITEM_CODE) FROM STOCK A, LOCATION B, INVSTAT C " sql = "SELECT COUNT(A.ITEM_CODE) FROM STOCK A, LOCATION B, INVSTAT C "
+ " WHERE A.LOC_CODE = B.LOC_CODE AND B.INV_STAT = C.INV_STAT " + " WHERE A.LOC_CODE = B.LOC_CODE AND B.INV_STAT = C.INV_STAT "
+ " AND A.ITEM_CODE = ? AND A.SITE_CODE = ? AND C.AVAILABLE = 'Y' " + " AND A.ITEM_CODE = ? AND A.SITE_CODE = ? AND C.AVAILABLE = 'Y' "
+ " AND ((CASE WHEN A.QUANTITY IS NULL THEN 0 ELSE A.QUANTITY END) - " + " AND ((CASE WHEN A.QUANTITY IS NULL THEN 0 ELSE A.QUANTITY END) - "
+ " (CASE WHEN A.ALLOC_QTY IS NULL THEN 0 ELSE A.ALLOC_QTY END)) > 0 " + " (CASE WHEN A.ALLOC_QTY IS NULL THEN 0 ELSE A.ALLOC_QTY END)) > 0 "
+ " AND (A.EXP_DATE > ? OR A.EXP_DATE IS NULL)"; + " AND (A.EXP_DATE > ? OR A.EXP_DATE IS NULL)";
// 18/02/12 manoharan // 18/02/12 manoharan
if ("Y".equals(considerLotNoIssue) && lotNoIssue != null && !"null".equals(lotNoIssue) && lotNoIssue.trim().length() > 0) if ("Y".equals(considerLotNoIssue) && lotNoIssue != null && !"null".equals(lotNoIssue) && lotNoIssue.trim().length() > 0)
{ {
...@@ -456,11 +456,11 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -456,11 +456,11 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
else if (qcReqd.equalsIgnoreCase("N") && trackShelfLife.equalsIgnoreCase("Y") && useInvStatus.equalsIgnoreCase("U")) else if (qcReqd.equalsIgnoreCase("N") && trackShelfLife.equalsIgnoreCase("Y") && useInvStatus.equalsIgnoreCase("U"))
{ {
sql = "SELECT COUNT(A.ITEM_CODE) FROM STOCK A, LOCATION B, INVSTAT C " sql = "SELECT COUNT(A.ITEM_CODE) FROM STOCK A, LOCATION B, INVSTAT C "
+ "WHERE A.LOC_CODE = B.LOC_CODE AND B.INV_STAT = C.INV_STAT AND A.ITEM_CODE = ? " + "WHERE A.LOC_CODE = B.LOC_CODE AND B.INV_STAT = C.INV_STAT AND A.ITEM_CODE = ? "
+ "AND A.SITE_CODE = ? AND C.AVAILABLE = 'Y' " + "AND A.SITE_CODE = ? AND C.AVAILABLE = 'Y' "
+ "AND ((CASE WHEN A.QUANTITY IS NULL THEN 0 ELSE A.QUANTITY END) - " + "AND ((CASE WHEN A.QUANTITY IS NULL THEN 0 ELSE A.QUANTITY END) - "
+ "(CASE WHEN A.ALLOC_QTY IS NULL THEN 0 ELSE A.ALLOC_QTY END)) > 0 " + "(CASE WHEN A.ALLOC_QTY IS NULL THEN 0 ELSE A.ALLOC_QTY END)) > 0 "
+ "AND (A.EXP_DATE > ? OR A.EXP_DATE IS NULL) "; + "AND (A.EXP_DATE > ? OR A.EXP_DATE IS NULL) ";
// 18/02/12 manoharan // 18/02/12 manoharan
if ("Y".equals(considerLotNoIssue) && lotNoIssue != null && !"null".equals(lotNoIssue) && lotNoIssue.trim().length() > 0) if ("Y".equals(considerLotNoIssue) && lotNoIssue != null && !"null".equals(lotNoIssue) && lotNoIssue.trim().length() > 0)
{ {
...@@ -481,11 +481,11 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -481,11 +481,11 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
else if (qcReqd.equalsIgnoreCase("Y") && autoQcReqd.equalsIgnoreCase("Y") && trackShelfLife.equalsIgnoreCase("N") && useInvStatus.equalsIgnoreCase("U")) else if (qcReqd.equalsIgnoreCase("Y") && autoQcReqd.equalsIgnoreCase("Y") && trackShelfLife.equalsIgnoreCase("N") && useInvStatus.equalsIgnoreCase("U"))
{ {
sql = " SELECT COUNT(A.ITEM_CODE) FROM STOCK A, LOCATION B, INVSTAT C " sql = " SELECT COUNT(A.ITEM_CODE) FROM STOCK A, LOCATION B, INVSTAT C "
+ " WHERE A.LOC_CODE = B.LOC_CODE AND B.INV_STAT = C.INV_STAT AND A.ITEM_CODE = ? " + " WHERE A.LOC_CODE = B.LOC_CODE AND B.INV_STAT = C.INV_STAT AND A.ITEM_CODE = ? "
+ " AND A.SITE_CODE = ? AND C.AVAILABLE = 'Y' " + " AND A.SITE_CODE = ? AND C.AVAILABLE = 'Y' "
+ " AND ((CASE WHEN A.QUANTITY IS NULL THEN 0 ELSE A.QUANTITY END) - " + " AND ((CASE WHEN A.QUANTITY IS NULL THEN 0 ELSE A.QUANTITY END) - "
+ " (CASE WHEN A.ALLOC_QTY IS NULL THEN 0 ELSE A.ALLOC_QTY END)) > 0 " + " (CASE WHEN A.ALLOC_QTY IS NULL THEN 0 ELSE A.ALLOC_QTY END)) > 0 "
+ " AND A.RETEST_DATE > ? "; + " AND A.RETEST_DATE > ? ";
// 18/02/12 manoharan // 18/02/12 manoharan
if ("Y".equals(considerLotNoIssue) && lotNoIssue != null && !"null".equals(lotNoIssue) && lotNoIssue.trim().length() > 0) if ("Y".equals(considerLotNoIssue) && lotNoIssue != null && !"null".equals(lotNoIssue) && lotNoIssue.trim().length() > 0)
{ {
...@@ -506,10 +506,10 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -506,10 +506,10 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
else if (qcReqd.equalsIgnoreCase("Y") && autoQcReqd.equalsIgnoreCase("N") && trackShelfLife.equalsIgnoreCase("N") && useInvStatus.equalsIgnoreCase("U")) else if (qcReqd.equalsIgnoreCase("Y") && autoQcReqd.equalsIgnoreCase("N") && trackShelfLife.equalsIgnoreCase("N") && useInvStatus.equalsIgnoreCase("U"))
{ {
sql = " SELECT COUNT(A.ITEM_CODE) FROM STOCK A, LOCATION B, INVSTAT C " sql = " SELECT COUNT(A.ITEM_CODE) FROM STOCK A, LOCATION B, INVSTAT C "
+ " WHERE A.LOC_CODE = B.LOC_CODE AND B.INV_STAT = C.INV_STAT AND A.ITEM_CODE = ? " + " WHERE A.LOC_CODE = B.LOC_CODE AND B.INV_STAT = C.INV_STAT AND A.ITEM_CODE = ? "
+ " AND A.SITE_CODE = ? AND C.AVAILABLE = 'Y' " + " AND A.SITE_CODE = ? AND C.AVAILABLE = 'Y' "
+ " AND ((CASE WHEN A.QUANTITY IS NULL THEN 0 ELSE A.QUANTITY END) - " + " AND ((CASE WHEN A.QUANTITY IS NULL THEN 0 ELSE A.QUANTITY END) - "
+ " (CASE WHEN A.ALLOC_QTY IS NULL THEN 0 ELSE A.ALLOC_QTY END)) > 0 "; + " (CASE WHEN A.ALLOC_QTY IS NULL THEN 0 ELSE A.ALLOC_QTY END)) > 0 ";
// 18/02/12 manoharan // 18/02/12 manoharan
if ("Y".equals(considerLotNoIssue) && lotNoIssue != null && !"null".equals(lotNoIssue) && lotNoIssue.trim().length() > 0) if ("Y".equals(considerLotNoIssue) && lotNoIssue != null && !"null".equals(lotNoIssue) && lotNoIssue.trim().length() > 0)
{ {
...@@ -529,10 +529,10 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -529,10 +529,10 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
else if (qcReqd.equalsIgnoreCase("N") && trackShelfLife.equalsIgnoreCase("N") && useInvStatus.equalsIgnoreCase("U")) else if (qcReqd.equalsIgnoreCase("N") && trackShelfLife.equalsIgnoreCase("N") && useInvStatus.equalsIgnoreCase("U"))
{ {
sql = " SELECT COUNT(A.ITEM_CODE) FROM STOCK A, LOCATION B, INVSTAT C " sql = " SELECT COUNT(A.ITEM_CODE) FROM STOCK A, LOCATION B, INVSTAT C "
+ " WHERE A.LOC_CODE = B.LOC_CODE AND B.INV_STAT = C.INV_STAT AND A.ITEM_CODE = ? " + " WHERE A.LOC_CODE = B.LOC_CODE AND B.INV_STAT = C.INV_STAT AND A.ITEM_CODE = ? "
+ " AND A.SITE_CODE = ? AND C.AVAILABLE = 'Y' " + " AND A.SITE_CODE = ? AND C.AVAILABLE = 'Y' "
+ " AND ((CASE WHEN A.QUANTITY IS NULL THEN 0 ELSE A.QUANTITY END) - " + " AND ((CASE WHEN A.QUANTITY IS NULL THEN 0 ELSE A.QUANTITY END) - "
+ " (CASE WHEN A.ALLOC_QTY IS NULL THEN 0 ELSE A.ALLOC_QTY END)) > 0 "; + " (CASE WHEN A.ALLOC_QTY IS NULL THEN 0 ELSE A.ALLOC_QTY END)) > 0 ";
// 18/02/12 manoharan // 18/02/12 manoharan
if ("Y".equals(considerLotNoIssue) && lotNoIssue != null && !"null".equals(lotNoIssue) && lotNoIssue.trim().length() > 0) if ("Y".equals(considerLotNoIssue) && lotNoIssue != null && !"null".equals(lotNoIssue) && lotNoIssue.trim().length() > 0)
{ {
...@@ -552,11 +552,11 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -552,11 +552,11 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
else if (qcReqd.equalsIgnoreCase("N") && trackShelfLife.equalsIgnoreCase("N") && useInvStatus.equalsIgnoreCase("B")) else if (qcReqd.equalsIgnoreCase("N") && trackShelfLife.equalsIgnoreCase("N") && useInvStatus.equalsIgnoreCase("B"))
{ {
sql = " SELECT COUNT(A.ITEM_CODE) FROM STOCK A, LOCATION B, INVSTAT C " sql = " SELECT COUNT(A.ITEM_CODE) FROM STOCK A, LOCATION B, INVSTAT C "
+ " WHERE A.LOC_CODE = B.LOC_CODE AND B.INV_STAT = C.INV_STAT AND A.ITEM_CODE = ? " + " WHERE A.LOC_CODE = B.LOC_CODE AND B.INV_STAT = C.INV_STAT AND A.ITEM_CODE = ? "
+ " AND A.SITE_CODE = ? AND C.STAT_TYPE <> 'S' " + " AND A.SITE_CODE = ? AND C.STAT_TYPE <> 'S' "
+ " AND ((CASE WHEN A.QUANTITY IS NULL THEN 0 ELSE A.QUANTITY END) - " + " AND ((CASE WHEN A.QUANTITY IS NULL THEN 0 ELSE A.QUANTITY END) - "
+ " (CASE WHEN A.ALLOC_QTY IS NULL THEN 0 ELSE A.ALLOC_QTY END)) > 0 " + " (CASE WHEN A.ALLOC_QTY IS NULL THEN 0 ELSE A.ALLOC_QTY END)) > 0 "
+ " AND DDF_COMPARE_DIMENSION(CASE WHEN A.DIMENSION IS NULL THEN ' ' ELSE A.DIMENSION END, ?, ?) = 'Y'"; + " AND DDF_COMPARE_DIMENSION(CASE WHEN A.DIMENSION IS NULL THEN ' ' ELSE A.DIMENSION END, ?, ?) = 'Y'";
// 18/02/12 manoharan // 18/02/12 manoharan
if ("Y".equals(considerLotNoIssue) && lotNoIssue != null && !"null".equals(lotNoIssue) && lotNoIssue.trim().length() > 0) if ("Y".equals(considerLotNoIssue) && lotNoIssue != null && !"null".equals(lotNoIssue) && lotNoIssue.trim().length() > 0)
{ {
...@@ -578,10 +578,10 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -578,10 +578,10 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
else if (trackShelfLife.equalsIgnoreCase("N") && useInvStatus.equalsIgnoreCase("B")) else if (trackShelfLife.equalsIgnoreCase("N") && useInvStatus.equalsIgnoreCase("B"))
{ {
sql = " SELECT COUNT(A.ITEM_CODE) FROM STOCK A, LOCATION B, INVSTAT C " sql = " SELECT COUNT(A.ITEM_CODE) FROM STOCK A, LOCATION B, INVSTAT C "
+ " WHERE A.LOC_CODE = B.LOC_CODE AND B.INV_STAT = C.INV_STAT AND A.ITEM_CODE = ? " + " WHERE A.LOC_CODE = B.LOC_CODE AND B.INV_STAT = C.INV_STAT AND A.ITEM_CODE = ? "
+ " AND A.SITE_CODE = ? AND C.STAT_TYPE <> 'S' " + " AND A.SITE_CODE = ? AND C.STAT_TYPE <> 'S' "
+ " AND ((CASE WHEN A.QUANTITY IS NULL THEN 0 ELSE A.QUANTITY END) - " + " AND ((CASE WHEN A.QUANTITY IS NULL THEN 0 ELSE A.QUANTITY END) - "
+ " (CASE WHEN A.ALLOC_QTY IS NULL THEN 0 ELSE A.ALLOC_QTY END)) > 0 "; + " (CASE WHEN A.ALLOC_QTY IS NULL THEN 0 ELSE A.ALLOC_QTY END)) > 0 ";
// 18/02/12 manoharan // 18/02/12 manoharan
if ("Y".equals(considerLotNoIssue) && lotNoIssue != null && !"null".equals(lotNoIssue) && lotNoIssue.trim().length() > 0) if ("Y".equals(considerLotNoIssue) && lotNoIssue != null && !"null".equals(lotNoIssue) && lotNoIssue.trim().length() > 0)
{ {
...@@ -601,11 +601,11 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -601,11 +601,11 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
else if (trackShelfLife.equalsIgnoreCase("Y") && useInvStatus.equalsIgnoreCase("B")) else if (trackShelfLife.equalsIgnoreCase("Y") && useInvStatus.equalsIgnoreCase("B"))
{ {
sql = " SELECT COUNT(A.ITEM_CODE) FROM STOCK A, LOCATION B, INVSTAT C " sql = " SELECT COUNT(A.ITEM_CODE) FROM STOCK A, LOCATION B, INVSTAT C "
+ " WHERE A.LOC_CODE = B.LOC_CODE AND B.INV_STAT = C.INV_STAT AND A.ITEM_CODE = ? " + " WHERE A.LOC_CODE = B.LOC_CODE AND B.INV_STAT = C.INV_STAT AND A.ITEM_CODE = ? "
+ " AND A.SITE_CODE = ? AND C.STAT_TYPE <> 'S' " + " AND A.SITE_CODE = ? AND C.STAT_TYPE <> 'S' "
+ " AND ((CASE WHEN A.QUANTITY IS NULL THEN 0 ELSE A.QUANTITY END) - " + " AND ((CASE WHEN A.QUANTITY IS NULL THEN 0 ELSE A.QUANTITY END) - "
+ " (CASE WHEN A.ALLOC_QTY IS NULL THEN 0 ELSE A.ALLOC_QTY END)) > 0 " + " (CASE WHEN A.ALLOC_QTY IS NULL THEN 0 ELSE A.ALLOC_QTY END)) > 0 "
+ " AND (A.EXP_DATE > ? OR A.EXP_DATE IS NULL) "; + " AND (A.EXP_DATE > ? OR A.EXP_DATE IS NULL) ";
// 18/02/12 manoharan // 18/02/12 manoharan
if ("Y".equals(considerLotNoIssue) && lotNoIssue != null && !"null".equals(lotNoIssue) && lotNoIssue.trim().length() > 0) if ("Y".equals(considerLotNoIssue) && lotNoIssue != null && !"null".equals(lotNoIssue) && lotNoIssue.trim().length() > 0)
{ {
...@@ -627,7 +627,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -627,7 +627,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
else else
{ {
fgItem = genericUtility.getColumnValue("item_code", dom1); fgItem = genericUtility.getColumnValue("item_code", dom1);
sql = "SELECT A.TRIM_WIDTH FROM ITEM_TYPE A, ITEM B WHERE A.ITEM_TYPE = B.ITEM_TYPE AND B.ITEM_CODE = ?"; sql = "SELECT A.TRIM_WIDTH FROM ITEM_TYPE A, ITEM B WHERE A.ITEM_TYPE = B.ITEM_TYPE AND B.ITEM_CODE = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, fgItem); pstmt.setString(1, fgItem);
...@@ -639,17 +639,17 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -639,17 +639,17 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
pstmt.close(); pstmt.close();
rs.close(); rs.close();
System.out.println("dimension :: " + dimension + " trimWidth :: " + trimWidth); System.out.println("dimension :: " + dimension + " trimWidth :: " + trimWidth);
// TO CHECK USE_INVSTATUS FROM BOMDET // TO CHECK USE_INVSTATUS FROM BOMDET
// IF IT IS B THEN CHECK STAT_TYPE FROM INVSTAT // IF IT IS B THEN CHECK STAT_TYPE FROM INVSTAT
if (qcReqd.equalsIgnoreCase("Y") && autoQcReqd.equalsIgnoreCase("Y") && trackShelfLife.equalsIgnoreCase("Y") && useInvStatus.equalsIgnoreCase("U")) if (qcReqd.equalsIgnoreCase("Y") && autoQcReqd.equalsIgnoreCase("Y") && trackShelfLife.equalsIgnoreCase("Y") && useInvStatus.equalsIgnoreCase("U"))
{ {
sql = " SELECT COUNT(A.ITEM_CODE) FROM STOCK A, LOCATION B, INVSTAT C " sql = " SELECT COUNT(A.ITEM_CODE) FROM STOCK A, LOCATION B, INVSTAT C "
+ " WHERE A.LOC_CODE = B.LOC_CODE AND B.INV_STAT = C.INV_STAT AND " + " WHERE A.LOC_CODE = B.LOC_CODE AND B.INV_STAT = C.INV_STAT AND "
+ " A.ITEM_CODE = ? AND A.SITE_CODE = ? AND C.AVAILABLE = 'Y' " + " A.ITEM_CODE = ? AND A.SITE_CODE = ? AND C.AVAILABLE = 'Y' "
+ " AND ((CASE WHEN A.QUANTITY IS NULL THEN 0 ELSE A.QUANTITY END) - " + " AND ((CASE WHEN A.QUANTITY IS NULL THEN 0 ELSE A.QUANTITY END) - "
+ " (CASE WHEN A.ALLOC_QTY IS NULL THEN 0 ELSE A.ALLOC_QTY END)) > 0 " + " (CASE WHEN A.ALLOC_QTY IS NULL THEN 0 ELSE A.ALLOC_QTY END)) > 0 "
+ " AND ( A.EXP_DATE > ? OR A.EXP_DATE IS NULL) AND A.RETEST_DATE > ?" + " AND ( A.EXP_DATE > ? OR A.EXP_DATE IS NULL) AND A.RETEST_DATE > ?"
+ " AND DDF_COMPARE_DIMENSION(CASE WHEN A.DIMENSION IS NULL THEN ' ' ELSE A.DIMENSION END, ?, ?) = 'Y'"; + " AND DDF_COMPARE_DIMENSION(CASE WHEN A.DIMENSION IS NULL THEN ' ' ELSE A.DIMENSION END, ?, ?) = 'Y'";
// 18/02/12 manoharan // 18/02/12 manoharan
if ("Y".equals(considerLotNoIssue) && lotNoIssue != null && !"null".equals(lotNoIssue) && lotNoIssue.trim().length() > 0) if ("Y".equals(considerLotNoIssue) && lotNoIssue != null && !"null".equals(lotNoIssue) && lotNoIssue.trim().length() > 0)
{ {
...@@ -673,13 +673,13 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -673,13 +673,13 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
else if (qcReqd.equalsIgnoreCase("Y") && autoQcReqd.equalsIgnoreCase("N") && trackShelfLife.equalsIgnoreCase("Y") && useInvStatus.equalsIgnoreCase("U")) else if (qcReqd.equalsIgnoreCase("Y") && autoQcReqd.equalsIgnoreCase("N") && trackShelfLife.equalsIgnoreCase("Y") && useInvStatus.equalsIgnoreCase("U"))
{ {
sql = " SELECT COUNT(A.ITEM_CODE) FROM STOCK A, LOCATION B, INVSTAT C " sql = " SELECT COUNT(A.ITEM_CODE) FROM STOCK A, LOCATION B, INVSTAT C "
+ " WHERE A.LOC_CODE = B.LOC_CODE AND B.INV_STAT = C.INV_STAT " + " WHERE A.LOC_CODE = B.LOC_CODE AND B.INV_STAT = C.INV_STAT "
+ " AND A.ITEM_CODE = ? AND A.SITE_CODE = ? AND C.AVAILABLE = 'Y' " + " AND A.ITEM_CODE = ? AND A.SITE_CODE = ? AND C.AVAILABLE = 'Y' "
+ " AND ((CASE WHEN A.QUANTITY IS NULL THEN 0 ELSE A.QUANTITY END) - " + " AND ((CASE WHEN A.QUANTITY IS NULL THEN 0 ELSE A.QUANTITY END) - "
+ " (CASE WHEN A.ALLOC_QTY IS NULL THEN 0 ELSE A.ALLOC_QTY END)) > 0 " + " (CASE WHEN A.ALLOC_QTY IS NULL THEN 0 ELSE A.ALLOC_QTY END)) > 0 "
+ " AND (A.EXP_DATE > ? OR A.EXP_DATE IS NULL)" + " AND (A.EXP_DATE > ? OR A.EXP_DATE IS NULL)"
+ " AND DDF_COMPARE_DIMENSION(CASE WHEN A.DIMENSION IS NULL THEN ' ' ELSE A.DIMENSION END, ?, ?) = 'Y'"; + " AND DDF_COMPARE_DIMENSION(CASE WHEN A.DIMENSION IS NULL THEN ' ' ELSE A.DIMENSION END, ?, ?) = 'Y'";
// 18/02/12 manoharan // 18/02/12 manoharan
if ("Y".equals(considerLotNoIssue) && lotNoIssue != null && !"null".equals(lotNoIssue) && lotNoIssue.trim().length() > 0) if ("Y".equals(considerLotNoIssue) && lotNoIssue != null && !"null".equals(lotNoIssue) && lotNoIssue.trim().length() > 0)
{ {
...@@ -702,12 +702,12 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -702,12 +702,12 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
else if (qcReqd.equalsIgnoreCase("N") && trackShelfLife.equalsIgnoreCase("Y") && useInvStatus.equalsIgnoreCase("U")) else if (qcReqd.equalsIgnoreCase("N") && trackShelfLife.equalsIgnoreCase("Y") && useInvStatus.equalsIgnoreCase("U"))
{ {
sql = " SELECT COUNT(A.ITEM_CODE) FROM STOCK A, LOCATION B, INVSTAT C " sql = " SELECT COUNT(A.ITEM_CODE) FROM STOCK A, LOCATION B, INVSTAT C "
+ " WHERE A.LOC_CODE = B.LOC_CODE AND B.INV_STAT = C.INV_STAT AND A.ITEM_CODE = ? " + " WHERE A.LOC_CODE = B.LOC_CODE AND B.INV_STAT = C.INV_STAT AND A.ITEM_CODE = ? "
+ " AND A.SITE_CODE = ? AND C.AVAILABLE = 'Y' " + " AND A.SITE_CODE = ? AND C.AVAILABLE = 'Y' "
+ " AND ((CASE WHEN A.QUANTITY IS NULL THEN 0 ELSE A.QUANTITY END) - " + " AND ((CASE WHEN A.QUANTITY IS NULL THEN 0 ELSE A.QUANTITY END) - "
+ " (CASE WHEN A.ALLOC_QTY IS NULL THEN 0 ELSE A.ALLOC_QTY END)) > 0 " + " (CASE WHEN A.ALLOC_QTY IS NULL THEN 0 ELSE A.ALLOC_QTY END)) > 0 "
+ " AND (A.EXP_DATE > ? OR A.EXP_DATE IS NULL) " + " AND (A.EXP_DATE > ? OR A.EXP_DATE IS NULL) "
+ " AND DDF_COMPARE_DIMENSION(CASE WHEN A.DIMENSION IS NULL THEN ' ' ELSE A.DIMENSION END, ?, ?) = 'Y'"; + " AND DDF_COMPARE_DIMENSION(CASE WHEN A.DIMENSION IS NULL THEN ' ' ELSE A.DIMENSION END, ?, ?) = 'Y'";
// 18/02/12 manoharan // 18/02/12 manoharan
if ("Y".equals(considerLotNoIssue) && lotNoIssue != null && !"null".equals(lotNoIssue) && lotNoIssue.trim().length() > 0) if ("Y".equals(considerLotNoIssue) && lotNoIssue != null && !"null".equals(lotNoIssue) && lotNoIssue.trim().length() > 0)
{ {
...@@ -730,12 +730,12 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -730,12 +730,12 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
else if (qcReqd.equalsIgnoreCase("Y") && autoQcReqd.equalsIgnoreCase("Y") && trackShelfLife.equalsIgnoreCase("N") && useInvStatus.equalsIgnoreCase("U")) else if (qcReqd.equalsIgnoreCase("Y") && autoQcReqd.equalsIgnoreCase("Y") && trackShelfLife.equalsIgnoreCase("N") && useInvStatus.equalsIgnoreCase("U"))
{ {
sql = " SELECT COUNT(A.ITEM_CODE) FROM STOCK A, LOCATION B, INVSTAT C " sql = " SELECT COUNT(A.ITEM_CODE) FROM STOCK A, LOCATION B, INVSTAT C "
+ " WHERE A.LOC_CODE = B.LOC_CODE AND B.INV_STAT = C.INV_STAT AND A.ITEM_CODE = ? " + " WHERE A.LOC_CODE = B.LOC_CODE AND B.INV_STAT = C.INV_STAT AND A.ITEM_CODE = ? "
+ " AND A.SITE_CODE = ? AND C.AVAILABLE = 'Y' " + " AND A.SITE_CODE = ? AND C.AVAILABLE = 'Y' "
+ " AND ((CASE WHEN A.QUANTITY IS NULL THEN 0 ELSE A.QUANTITY END) - " + " AND ((CASE WHEN A.QUANTITY IS NULL THEN 0 ELSE A.QUANTITY END) - "
+ " (CASE WHEN A.ALLOC_QTY IS NULL THEN 0 ELSE A.ALLOC_QTY END)) > 0 " + " (CASE WHEN A.ALLOC_QTY IS NULL THEN 0 ELSE A.ALLOC_QTY END)) > 0 "
+ " AND A.RETEST_DATE > ? " + " AND A.RETEST_DATE > ? "
+ " AND DDF_COMPARE_DIMENSION(CASE WHEN A.DIMENSION IS NULL THEN ' ' ELSE A.DIMENSION END, ?, ?) = 'Y'"; + " AND DDF_COMPARE_DIMENSION(CASE WHEN A.DIMENSION IS NULL THEN ' ' ELSE A.DIMENSION END, ?, ?) = 'Y'";
// 18/02/12 manoharan // 18/02/12 manoharan
if ("Y".equals(considerLotNoIssue) && lotNoIssue != null && !"null".equals(lotNoIssue) && lotNoIssue.trim().length() > 0) if ("Y".equals(considerLotNoIssue) && lotNoIssue != null && !"null".equals(lotNoIssue) && lotNoIssue.trim().length() > 0)
{ {
...@@ -758,11 +758,11 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -758,11 +758,11 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
else if (qcReqd.equalsIgnoreCase("Y") && autoQcReqd.equalsIgnoreCase("N") && trackShelfLife.equalsIgnoreCase("N") && useInvStatus.equalsIgnoreCase("U")) else if (qcReqd.equalsIgnoreCase("Y") && autoQcReqd.equalsIgnoreCase("N") && trackShelfLife.equalsIgnoreCase("N") && useInvStatus.equalsIgnoreCase("U"))
{ {
sql = " SELECT COUNT(A.ITEM_CODE) FROM STOCK A, LOCATION B, INVSTAT C " sql = " SELECT COUNT(A.ITEM_CODE) FROM STOCK A, LOCATION B, INVSTAT C "
+ " WHERE A.LOC_CODE = B.LOC_CODE AND B.INV_STAT = C.INV_STAT AND A.ITEM_CODE = ? " + " WHERE A.LOC_CODE = B.LOC_CODE AND B.INV_STAT = C.INV_STAT AND A.ITEM_CODE = ? "
+ " AND A.SITE_CODE = ? AND C.AVAILABLE = 'Y' " + " AND A.SITE_CODE = ? AND C.AVAILABLE = 'Y' "
+ " AND ((CASE WHEN A.QUANTITY IS NULL THEN 0 ELSE A.QUANTITY END) - " + " AND ((CASE WHEN A.QUANTITY IS NULL THEN 0 ELSE A.QUANTITY END) - "
+ " (CASE WHEN A.ALLOC_QTY IS NULL THEN 0 ELSE A.ALLOC_QTY END)) > 0 " + " (CASE WHEN A.ALLOC_QTY IS NULL THEN 0 ELSE A.ALLOC_QTY END)) > 0 "
+ " AND DDF_COMPARE_DIMENSION(CASE WHEN A.DIMENSION IS NULL THEN ' ' ELSE A.DIMENSION END, ?, ?) = 'Y'"; + " AND DDF_COMPARE_DIMENSION(CASE WHEN A.DIMENSION IS NULL THEN ' ' ELSE A.DIMENSION END, ?, ?) = 'Y'";
// 18/02/12 manoharan // 18/02/12 manoharan
if ("Y".equals(considerLotNoIssue) && lotNoIssue != null && !"null".equals(lotNoIssue) && lotNoIssue.trim().length() > 0) if ("Y".equals(considerLotNoIssue) && lotNoIssue != null && !"null".equals(lotNoIssue) && lotNoIssue.trim().length() > 0)
{ {
...@@ -784,11 +784,11 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -784,11 +784,11 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
else if (qcReqd.equalsIgnoreCase("N") && trackShelfLife.equalsIgnoreCase("N") && useInvStatus.equalsIgnoreCase("U")) else if (qcReqd.equalsIgnoreCase("N") && trackShelfLife.equalsIgnoreCase("N") && useInvStatus.equalsIgnoreCase("U"))
{ {
sql = " SELECT COUNT(A.ITEM_CODE) FROM STOCK A, LOCATION B, INVSTAT C " sql = " SELECT COUNT(A.ITEM_CODE) FROM STOCK A, LOCATION B, INVSTAT C "
+ " WHERE A.LOC_CODE = B.LOC_CODE AND B.INV_STAT = C.INV_STAT AND A.ITEM_CODE = ? " + " WHERE A.LOC_CODE = B.LOC_CODE AND B.INV_STAT = C.INV_STAT AND A.ITEM_CODE = ? "
+ " AND A.SITE_CODE = ? AND C.AVAILABLE = 'Y' " + " AND A.SITE_CODE = ? AND C.AVAILABLE = 'Y' "
+ " AND ((CASE WHEN A.QUANTITY IS NULL THEN 0 ELSE A.QUANTITY END) - " + " AND ((CASE WHEN A.QUANTITY IS NULL THEN 0 ELSE A.QUANTITY END) - "
+ " (CASE WHEN A.ALLOC_QTY IS NULL THEN 0 ELSE A.ALLOC_QTY END)) > 0 " + " (CASE WHEN A.ALLOC_QTY IS NULL THEN 0 ELSE A.ALLOC_QTY END)) > 0 "
+ " AND DDF_COMPARE_DIMENSION(CASE WHEN A.DIMENSION IS NULL THEN ' ' ELSE A.DIMENSION END, ?, ?) = 'Y'"; + " AND DDF_COMPARE_DIMENSION(CASE WHEN A.DIMENSION IS NULL THEN ' ' ELSE A.DIMENSION END, ?, ?) = 'Y'";
// 18/02/12 manoharan // 18/02/12 manoharan
if ("Y".equals(considerLotNoIssue) && lotNoIssue != null && !"null".equals(lotNoIssue) && lotNoIssue.trim().length() > 0) if ("Y".equals(considerLotNoIssue) && lotNoIssue != null && !"null".equals(lotNoIssue) && lotNoIssue.trim().length() > 0)
{ {
...@@ -810,11 +810,11 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -810,11 +810,11 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
else if (qcReqd.equalsIgnoreCase("N") && trackShelfLife.equalsIgnoreCase("N") && useInvStatus.equalsIgnoreCase("B")) else if (qcReqd.equalsIgnoreCase("N") && trackShelfLife.equalsIgnoreCase("N") && useInvStatus.equalsIgnoreCase("B"))
{ {
sql = " SELECT COUNT(A.ITEM_CODE) FROM STOCK A, LOCATION B, INVSTAT C " sql = " SELECT COUNT(A.ITEM_CODE) FROM STOCK A, LOCATION B, INVSTAT C "
+ " WHERE A.LOC_CODE = B.LOC_CODE AND B.INV_STAT = C.INV_STAT AND A.ITEM_CODE = ? " + " WHERE A.LOC_CODE = B.LOC_CODE AND B.INV_STAT = C.INV_STAT AND A.ITEM_CODE = ? "
+ " AND A.SITE_CODE = ? AND C.STAT_TYPE <> 'S' " + " AND A.SITE_CODE = ? AND C.STAT_TYPE <> 'S' "
+ " AND ((CASE WHEN A.QUANTITY IS NULL THEN 0 ELSE A.QUANTITY END) - " + " AND ((CASE WHEN A.QUANTITY IS NULL THEN 0 ELSE A.QUANTITY END) - "
+ " (CASE WHEN A.ALLOC_QTY IS NULL THEN 0 ELSE A.ALLOC_QTY END)) > 0 " + " (CASE WHEN A.ALLOC_QTY IS NULL THEN 0 ELSE A.ALLOC_QTY END)) > 0 "
+ " AND DDF_COMPARE_DIMENSION(CASE WHEN A.DIMENSION IS NULL THEN ' ' ELSE A.DIMENSION END, ?, ?) = 'Y'"; + " AND DDF_COMPARE_DIMENSION(CASE WHEN A.DIMENSION IS NULL THEN ' ' ELSE A.DIMENSION END, ?, ?) = 'Y'";
// 18/02/12 manoharan // 18/02/12 manoharan
if ("Y".equals(considerLotNoIssue) && lotNoIssue != null && !"null".equals(lotNoIssue) && lotNoIssue.trim().length() > 0) if ("Y".equals(considerLotNoIssue) && lotNoIssue != null && !"null".equals(lotNoIssue) && lotNoIssue.trim().length() > 0)
{ {
...@@ -836,11 +836,11 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -836,11 +836,11 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
else if (trackShelfLife.equalsIgnoreCase("N") && useInvStatus.equalsIgnoreCase("B")) else if (trackShelfLife.equalsIgnoreCase("N") && useInvStatus.equalsIgnoreCase("B"))
{ {
sql = " SELECT COUNT(A.ITEM_CODE) FROM STOCK A, LOCATION B, INVSTAT C " sql = " SELECT COUNT(A.ITEM_CODE) FROM STOCK A, LOCATION B, INVSTAT C "
+ " WHERE A.LOC_CODE = B.LOC_CODE AND B.INV_STAT = C.INV_STAT AND A.ITEM_CODE = ? " + " WHERE A.LOC_CODE = B.LOC_CODE AND B.INV_STAT = C.INV_STAT AND A.ITEM_CODE = ? "
+ " AND A.SITE_CODE = ? AND C.STAT_TYPE <> 'S' " + " AND A.SITE_CODE = ? AND C.STAT_TYPE <> 'S' "
+ " AND ((CASE WHEN A.QUANTITY IS NULL THEN 0 ELSE A.QUANTITY END) - " + " AND ((CASE WHEN A.QUANTITY IS NULL THEN 0 ELSE A.QUANTITY END) - "
+ " (CASE WHEN A.ALLOC_QTY IS NULL THEN 0 ELSE A.ALLOC_QTY END)) > 0 " + " (CASE WHEN A.ALLOC_QTY IS NULL THEN 0 ELSE A.ALLOC_QTY END)) > 0 "
+ " AND DDF_COMPARE_DIMENSION(CASE WHEN A.DIMENSION IS NULL THEN ' ' ELSE A.DIMENSION END, ?, ?) = 'Y'"; + " AND DDF_COMPARE_DIMENSION(CASE WHEN A.DIMENSION IS NULL THEN ' ' ELSE A.DIMENSION END, ?, ?) = 'Y'";
// 18/02/12 manoharan // 18/02/12 manoharan
if ("Y".equals(considerLotNoIssue) && lotNoIssue != null && !"null".equals(lotNoIssue) && lotNoIssue.trim().length() > 0) if ("Y".equals(considerLotNoIssue) && lotNoIssue != null && !"null".equals(lotNoIssue) && lotNoIssue.trim().length() > 0)
{ {
...@@ -862,12 +862,12 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -862,12 +862,12 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
else if (trackShelfLife.equalsIgnoreCase("Y") && useInvStatus.equalsIgnoreCase("B")) else if (trackShelfLife.equalsIgnoreCase("Y") && useInvStatus.equalsIgnoreCase("B"))
{ {
sql = " SELECT COUNT(A.ITEM_CODE) FROM STOCK A, LOCATION B, INVSTAT C " sql = " SELECT COUNT(A.ITEM_CODE) FROM STOCK A, LOCATION B, INVSTAT C "
+ " WHERE A.LOC_CODE = B.LOC_CODE AND B.INV_STAT = C.INV_STAT AND A.ITEM_CODE = ? " + " WHERE A.LOC_CODE = B.LOC_CODE AND B.INV_STAT = C.INV_STAT AND A.ITEM_CODE = ? "
+ " AND A.SITE_CODE = ? AND C.STAT_TYPE <> 'S' " + " AND A.SITE_CODE = ? AND C.STAT_TYPE <> 'S' "
+ " AND ((CASE WHEN A.QUANTITY IS NULL THEN 0 ELSE A.QUANTITY END) - " + " AND ((CASE WHEN A.QUANTITY IS NULL THEN 0 ELSE A.QUANTITY END) - "
+ " (CASE WHEN A.ALLOC_QTY IS NULL THEN 0 ELSE A.ALLOC_QTY END)) > 0 " + " (CASE WHEN A.ALLOC_QTY IS NULL THEN 0 ELSE A.ALLOC_QTY END)) > 0 "
+ " AND (A.EXP_DATE > ? OR A.EXP_DATE IS NULL) " + " AND (A.EXP_DATE > ? OR A.EXP_DATE IS NULL) "
+ " AND DDF_COMPARE_DIMENSION(CASE WHEN A.DIMENSION IS NULL THEN ' ' ELSE A.DIMENSION END, ?, ?) = 'Y'"; + " AND DDF_COMPARE_DIMENSION(CASE WHEN A.DIMENSION IS NULL THEN ' ' ELSE A.DIMENSION END, ?, ?) = 'Y'";
// 18/02/12 manoharan // 18/02/12 manoharan
if ("Y".equals(considerLotNoIssue) && lotNoIssue != null && !"null".equals(lotNoIssue) && lotNoIssue.trim().length() > 0) if ("Y".equals(considerLotNoIssue) && lotNoIssue != null && !"null".equals(lotNoIssue) && lotNoIssue.trim().length() > 0)
{ {
...@@ -901,9 +901,9 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -901,9 +901,9 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
System.out.println("errString :" + errString); System.out.println("errString :" + errString);
return errString; return errString;
} }
sql = "SELECT CASE WHEN TRACK_SHELF_LIFE IS NULL THEN 'N' ELSE TRACK_SHELF_LIFE END " sql = "SELECT CASE WHEN TRACK_SHELF_LIFE IS NULL THEN 'N' ELSE TRACK_SHELF_LIFE END "
+ " FROM ITEM WHERE ITEM_CODE = ? "; + " FROM ITEM WHERE ITEM_CODE = ? ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, itemCode); pstmt.setString(1, itemCode);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
...@@ -915,19 +915,19 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -915,19 +915,19 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
rs.close(); rs.close();
System.out.println("qcReqd ::: " + qcReqd + "trackShelfLife ::: " + trackShelfLife ); System.out.println("qcReqd ::: " + qcReqd + "trackShelfLife ::: " + trackShelfLife );
System.out.println("useInvStatus ::: " + useInvStatus + "dimension ::: " + dimension ); System.out.println("useInvStatus ::: " + useInvStatus + "dimension ::: " + dimension );
retestDt = effDate; retestDt = effDate;
if (qcReqd.equalsIgnoreCase("N") || autoQcReqd.equalsIgnoreCase("N")) if (qcReqd.equalsIgnoreCase("N") || autoQcReqd.equalsIgnoreCase("N"))
{ {
retestDt = genericUtility.getValidDateString("01/01/1910","dd/mm/yy", genericUtility.getApplDateFormat()); retestDt = genericUtility.getValidDateString("01/01/1910","dd/mm/yy", genericUtility.getApplDateFormat());
} }
if (trackShelfLife.equalsIgnoreCase("N")) if (trackShelfLife.equalsIgnoreCase("N"))
{ {
effDate = genericUtility.getValidDateString("01/01/1910","dd/mm/yy",genericUtility.getApplDateFormat()); effDate = genericUtility.getValidDateString("01/01/1910","dd/mm/yy",genericUtility.getApplDateFormat());
} }
if (useInvStatus == null) if (useInvStatus == null)
{ {
useInvStatus = "U"; useInvStatus = "U";
...@@ -942,7 +942,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -942,7 +942,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
sqlSB.append(" FROM STOCK A, INVSTAT B, LOCATION C WHERE ( A.LOC_CODE = C.LOC_CODE ) AND "); sqlSB.append(" FROM STOCK A, INVSTAT B, LOCATION C WHERE ( A.LOC_CODE = C.LOC_CODE ) AND ");
sqlSB.append(" ( C.INV_STAT = B.INV_STAT ) AND (A.ITEM_CODE = ?) AND (A.SITE_CODE = ?) AND "); sqlSB.append(" ( C.INV_STAT = B.INV_STAT ) AND (A.ITEM_CODE = ?) AND (A.SITE_CODE = ?) AND ");
sqlSB.append(" (A.QUANTITY - A.ALLOC_QTY > 0) AND (B.AVAILABLE = 'Y') AND (B.STAT_TYPE <> 'S') "); sqlSB.append(" (A.QUANTITY - A.ALLOC_QTY > 0) AND (B.AVAILABLE = 'Y') AND (B.STAT_TYPE <> 'S') ");
if (qcReqd.equalsIgnoreCase("Y") && autoQcReqd.equalsIgnoreCase("Y")) if (qcReqd.equalsIgnoreCase("Y") && autoQcReqd.equalsIgnoreCase("Y"))
{ {
sqlSB.append("AND (A.RETEST_DATE IS NULL OR A.RETEST_DATE > ?)"); sqlSB.append("AND (A.RETEST_DATE IS NULL OR A.RETEST_DATE > ?)");
...@@ -961,12 +961,12 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -961,12 +961,12 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
sqlSB.append(" AND CASE WHEN C.STATUS IS NULL THEN 'U' ELSE C.STATUS END) = 'U' " ); sqlSB.append(" AND CASE WHEN C.STATUS IS NULL THEN 'U' ELSE C.STATUS END) = 'U' " );
sqlSB.append(" AND (A.LOT_SL = C.LOT_SL OR C.LOT_SL IS NULL))"); sqlSB.append(" AND (A.LOT_SL = C.LOT_SL OR C.LOT_SL IS NULL))");
} }
if (trackShelfLife.equalsIgnoreCase("Y")) if (trackShelfLife.equalsIgnoreCase("Y"))
{ {
sqlSB.append(" AND (A.EXP_DATE IS NULL OR A.EXP_DATE > ?)"); sqlSB.append(" AND (A.EXP_DATE IS NULL OR A.EXP_DATE > ?)");
} }
if (dimension.trim().length() > 0) if (dimension.trim().length() > 0)
{ {
sqlSB.append("AND DDF_COMPARE_DIMENSION(CASE WHEN A.DIMENSION IS NULL THEN ' ' ELSE A.DIMENSION END, ?, 0) = 'Y'"); sqlSB.append("AND DDF_COMPARE_DIMENSION(CASE WHEN A.DIMENSION IS NULL THEN ' ' ELSE A.DIMENSION END, ?, 0) = 'Y'");
...@@ -986,41 +986,42 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -986,41 +986,42 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
} }
// end 26/03/12 manoharan // end 26/03/12 manoharan
// 02/04/12 manoharan sorting to be doen as per PB logic // 02/04/12 manoharan sorting to be doen as per PB logic
//changes by cpandey additin condition for track shelf life on 20/08/12 //changes done by cpandey additin condition for track shelf life on 20/08/12
if("N".equalsIgnoreCase(trackShelfLife)) if("N".equalsIgnoreCase(trackShelfLife))
{ {
sql = sql + " order by partial_used,decode('N','P',decode(rtrim(location.loc_group),rtrim(''),'A','B'),'0'), " ; sql = sql + " order by partial_used,decode('N','P',decode(rtrim(c.loc_group),rtrim(''),'A','B'),'0'), " ;
System.out.println("sql If track self life is N ["+sql+"]>>"); System.out.println("sql If track self life is N ["+sql+"]>>");
} }
if("Y".equalsIgnoreCase(trackShelfLife)) if("Y".equalsIgnoreCase(trackShelfLife))
{ {
sql = sql + " order by partial_used,decode('N','P',decode(rtrim(location.loc_group),rtrim(''),'A','B'),'0'), " ; sql = sql + " order by partial_used,decode('N','P',decode(rtrim(c.loc_group),rtrim(''),'A','B'),'0'), " ;
System.out.println("sql sql If track self life is Y--["+sql+"]>>"); System.out.println("sql sql If track self life is Y--["+sql+"]>>");
} }
//end of changes on 20/08/12 //end of changes on 20/08/12
//commented by cpandey //commented by cpandey
//sql = sql + " order by partial_used, (case when '" + locUsageType + "' = 'P' then (case when rtrim(c.loc_group) = rtrim('" + locGroup + "') Then 'A' else 'B' end) else '0' end), " ; //sql = sql + " order by partial_used, (case when '" + locUsageType + "' = 'P' then (case when rtrim(c.loc_group) = rtrim('" + locGroup + "') Then 'A' else 'B' end) else '0' end), " ;
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME)) if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME))
{ {
sql = sql + " nvl(a.exp_date,a.crea_date),a.crea_date,a.lot_no "; sql = sql + " nvl(a.exp_date,a.crea_date),a.crea_date,a.lot_no ";
System.out.println("after sql db converted --["+sql+"]->.");
} }
else else
{ {
sql = sql + " nvl(a.exp_date,a.crea_date),a.crea_date,a.lot_no, " sql = sql + " nvl(a.exp_date,a.crea_date),a.crea_date,a.lot_no, "
+ " decode(length(decode( substr(rtrim(a.lot_sl), length(rtrim(a.lot_sl))) ," + + " decode(length(decode( substr(rtrim(a.lot_sl), length(rtrim(a.lot_sl))) ," +
" 'S',(substr(rtrim(a.lot_sl),1,length(rtrim(a.lot_sl)) - 1)) ,rtrim(a.lot_sl)) ), " " 'S',(substr(rtrim(a.lot_sl),1,length(rtrim(a.lot_sl)) - 1)) ,rtrim(a.lot_sl)) ), "
+ " 1, '00' || decode( substr(rtrim(a.lot_sl), length(rtrim(a.lot_sl))) , " + + " 1, '00' || decode( substr(rtrim(a.lot_sl), length(rtrim(a.lot_sl))) , " +
"'S',(substr(rtrim(a.lot_sl),1,length(rtrim(a.lot_sl)) )) ,rtrim(a.lot_sl)), " "'S',(substr(rtrim(a.lot_sl),1,length(rtrim(a.lot_sl)) )) ,rtrim(a.lot_sl)), "
+" decode(length(decode( substr(rtrim(a.lot_sl), length(rtrim(a.lot_sl))) , 'S',(substr(rtrim(a.lot_sl),1,length(rtrim(a.lot_sl)) - 1)) ,rtrim(a.lot_sl)) ), " +" decode(length(decode( substr(rtrim(a.lot_sl), length(rtrim(a.lot_sl))) , 'S',(substr(rtrim(a.lot_sl),1,length(rtrim(a.lot_sl)) - 1)) ,rtrim(a.lot_sl)) ), "
+ " 2, '0' || decode( substr(rtrim(a.lot_sl), length(rtrim(a.lot_sl))) , 'S',(substr(rtrim(a.lot_sl),1,length(rtrim(a.lot_sl)) )) ,rtrim(a.lot_sl)), " + " 2, '0' || decode( substr(rtrim(a.lot_sl), length(rtrim(a.lot_sl))) , 'S',(substr(rtrim(a.lot_sl),1,length(rtrim(a.lot_sl)) )) ,rtrim(a.lot_sl)), "
+" decode( substr(rtrim(a.lot_sl), length(rtrim(a.lot_sl))) ," + +" decode( substr(rtrim(a.lot_sl), length(rtrim(a.lot_sl))) ," +
" 'S',(substr(rtrim(a.lot_sl),1,length(rtrim(a.lot_sl)) - 1)) ,rtrim(a.lot_sl)) )) "; " 'S',(substr(rtrim(a.lot_sl),1,length(rtrim(a.lot_sl)) - 1)) ,rtrim(a.lot_sl)) )) ";
} }
// end 02/04/12 manoharan // end 02/04/12 manoharan
System.out.println("sqlSB converted ::: "+ sql); System.out.println("sqlSB converted ::: "+ sql);
StringTokenizer st = new StringTokenizer(sql, "?"); StringTokenizer st = new StringTokenizer(sql, "?");
cntQ = st.countTokens(); cntQ = st.countTokens();
...@@ -1042,7 +1043,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -1042,7 +1043,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
continue; continue;
} }
} }
if (trackShelfLife.equalsIgnoreCase("Y") && flag2 == false) if (trackShelfLife.equalsIgnoreCase("Y") && flag2 == false)
{ {
pstmt.setTimestamp(i, Timestamp.valueOf(genericUtility.getValidDateString(effDate, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00")); pstmt.setTimestamp(i, Timestamp.valueOf(genericUtility.getValidDateString(effDate, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00"));
...@@ -1121,11 +1122,11 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -1121,11 +1122,11 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
return valueXmlString.toString(); return valueXmlString.toString();
} }
private String stockTransform(Document dom, Document dom1, String objContext, String xtraParams, Document selDataDom) private String stockTransform(Document dom, Document dom1, String objContext, String xtraParams, Document selDataDom) throws ITMException
throws ITMException { {
System.out.println("stockTransform is calling............."); System.out.println("stockTransform is calling.............");
StringBuffer valueXmlString = new StringBuffer("<?xml version=\"1.0\"?>\r\n<Root>\r\n"); StringBuffer valueXmlString = new StringBuffer("<?xml version=\"1.0\"?>\r\n<Root>\r\n");
String sql = null, errCode = "", errString = ""; String sql = null, errCode = "", errString = "";
Connection conn = null; Connection conn = null;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
...@@ -1150,8 +1151,8 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -1150,8 +1151,8 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
itemCode = genericUtility.getColumnValue("item_code", dom); itemCode = genericUtility.getColumnValue("item_code", dom);
itemDescr = genericUtility.getColumnValue("item_descr", dom); itemDescr = genericUtility.getColumnValue("item_descr", dom);
quantity = Double.parseDouble(genericUtility.getColumnValue("quantity", dom)); quantity = Double.parseDouble(genericUtility.getColumnValue("quantity", dom));
expLev = genericUtility.getColumnValue("exp_lev", dom); expLev = genericUtility.getColumnValue("exp_lev", dom);
System.out.println("expLev ::: " + expLev); System.out.println("expLev ::: " + expLev);
reasCode = genericUtility.getColumnValue("reas_code", dom); reasCode = genericUtility.getColumnValue("reas_code", dom);
tranType = genericUtility.getColumnValue("tran_type", dom1); tranType = genericUtility.getColumnValue("tran_type", dom1);
...@@ -1166,17 +1167,16 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -1166,17 +1167,16 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
issCriteria = rs.getString(1); issCriteria = rs.getString(1);
System.out.println("issCriteria :" + issCriteria); System.out.println("issCriteria :" + issCriteria);
} }
NodeList detailList = selDataDom.getElementsByTagName("Detail"); NodeList detailList = selDataDom.getElementsByTagName("Detail");
int noOfDetails = detailList.getLength(); int noOfDetails = detailList.getLength();
for (int ctr = 0; ctr < noOfDetails; ctr++) { for (int ctr = 0; ctr < noOfDetails; ctr++) {
currDetail = detailList.item(ctr); currDetail = detailList.item(ctr);
stkQty = stkQty + Double.parseDouble((GenericUtility.getInstance().getColumnValueFromNode("quantity", stkQty = stkQty + Double.parseDouble((GenericUtility.getInstance().getColumnValueFromNode("quantity",currDetail)));
currDetail)));
} }
System.out.println("stkQty :" + stkQty); System.out.println("stkQty :" + stkQty);
// if (stkQty < quantity) // if (stkQty < quantity)
if (quantity != 0 && stkQty < quantity) //CHANGED BY ALKA 19/07/07 FOR HANDLING NO QUANTITY ENTERED. if (quantity != 0 && stkQty < quantity) //CHANGED BY ALKA 19/07/07 FOR HANDLING NO QUANTITY ENTERED.
{ {
errCode = "VTSTOCK1"; errCode = "VTSTOCK1";
...@@ -1185,8 +1185,8 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -1185,8 +1185,8 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
conn = null; conn = null;
return errString; return errString;
} }
// remainingQty = quantity; //COMMENTED BY ALKA AS THE FOLLOWING LOGIC IS ADDED // remainingQty = quantity; //COMMENTED BY ALKA AS THE FOLLOWING LOGIC IS ADDED
// ADDED BY ALKA ON 19/07/07 FOR SELECTED STOCK TO BE ENTERED IN THE DETAIL IF THE QUANTITY IS 0 // ADDED BY ALKA ON 19/07/07 FOR SELECTED STOCK TO BE ENTERED IN THE DETAIL IF THE QUANTITY IS 0
if (quantity == 0) if (quantity == 0)
{ {
remainingQty = stkQty; remainingQty = stkQty;
...@@ -1197,7 +1197,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -1197,7 +1197,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
} }
System.out.println("quantity at the start of the forloop :::: " + quantity); System.out.println("quantity at the start of the forloop :::: " + quantity);
System.out.println("remainingQty at the start of the forloop :::: " + remainingQty); System.out.println("remainingQty at the start of the forloop :::: " + remainingQty);
// ADDITION ENDED BY ALKA 19/07/07 // ADDITION ENDED BY ALKA 19/07/07
if (noOfDetails > 0) if (noOfDetails > 0)
{ {
for (int ctr = 0; ctr < noOfDetails && remainingQty > 0; ctr++) for (int ctr = 0; ctr < noOfDetails && remainingQty > 0; ctr++)
...@@ -1233,7 +1233,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -1233,7 +1233,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
remainingQty = remainingQty - inputQty; remainingQty = remainingQty - inputQty;
} }
System.out.println("inputQty ::::::::::::: " + inputQty); System.out.println("inputQty ::::::::::::: " + inputQty);
valueXmlString.append("<tran_id isSrvCallOnChg='0'>").append("<![CDATA[").append(woIss).append("]]>").append("</tran_id>\r\n"); valueXmlString.append("<tran_id isSrvCallOnChg='0'>").append("<![CDATA[").append(woIss).append("]]>").append("</tran_id>\r\n");
valueXmlString.append("<exp_lev isSrvCallOnChg='0'>").append("<![CDATA[").append(expLev).append("]]>").append("</exp_lev>\r\n"); valueXmlString.append("<exp_lev isSrvCallOnChg='0'>").append("<![CDATA[").append(expLev).append("]]>").append("</exp_lev>\r\n");
valueXmlString.append("<item_code isSrvCallOnChg='0'>").append("<![CDATA[").append(itemCode).append("]]>").append("</item_code>\r\n"); valueXmlString.append("<item_code isSrvCallOnChg='0'>").append("<![CDATA[").append(itemCode).append("]]>").append("</item_code>\r\n");
...@@ -1250,15 +1250,15 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -1250,15 +1250,15 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
if (inputQty > 0) if (inputQty > 0)
{ {
sql = " SELECT ROUND((CASE WHEN QUANTITY IS NULL THEN 0 ELSE QUANTITY END) / " sql = " SELECT ROUND((CASE WHEN QUANTITY IS NULL THEN 0 ELSE QUANTITY END) / "
+ " (CASE WHEN NO_ART IS NULL THEN 1 ELSE NO_ART END),3) FROM INV_PACK_RCP " + " (CASE WHEN NO_ART IS NULL THEN 1 ELSE NO_ART END),3) FROM INV_PACK_RCP "
+ " WHERE ITEM_CODE = ? AND LOC_CODE = ? AND LOT_NO = ? AND LOT_SL = ? "; + " WHERE ITEM_CODE = ? AND LOC_CODE = ? AND LOT_NO = ? AND LOT_SL = ? ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, itemCode); pstmt.setString(1, itemCode);
pstmt.setString(2, stkLocCode); pstmt.setString(2, stkLocCode);
pstmt.setString(3, stkLotNo); pstmt.setString(3, stkLotNo);
pstmt.setString(4, stkLotSl); pstmt.setString(4, stkLotSl);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) if (rs.next())
{ {
perArtQty = rs.getDouble(1); perArtQty = rs.getDouble(1);
...@@ -1268,19 +1268,19 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -1268,19 +1268,19 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
perArtQty = 1; // TO AVOID DIVIDE BY ZERO ERROR perArtQty = 1; // TO AVOID DIVIDE BY ZERO ERROR
} }
noArt = inputQty/perArtQty; noArt = inputQty/perArtQty;
valueXmlString.append("<no_art isSrvCallOnChg='0'>").append("<![CDATA[").append(Math.round(noArt)).append("]]>").append("</no_art>\r\n"); valueXmlString.append("<no_art isSrvCallOnChg='0'>").append("<![CDATA[").append(Math.round(noArt)).append("]]>").append("</no_art>\r\n");
} }
pstmt.close(); pstmt.close();
rs.close(); rs.close();
} }
if ((siteCode != null) && (itemCode != null) && (stkLocCode != null) && (stkLotNo != null) && (stkLotSl != null) && if ((siteCode != null) && (itemCode != null) && (stkLocCode != null) && (stkLotNo != null) && (stkLotSl != null) &&
// (expLev != null) && (quantity != 0) && (tranType != null) ) // (expLev != null) && (quantity != 0) && (tranType != null) )
(expLev != null) && (inputQty != 0) && (tranType != null) ) //CHANGED BY ALKA 19/07/07 AS WEIGHT DATA WERE NOT DISPLAYED IN THE DETAIL (expLev != null) && (inputQty != 0) && (tranType != null) ) //CHANGED BY ALKA 19/07/07 AS WEIGHT DATA WERE NOT DISPLAYED IN THE DETAIL
{ {
gWeight = Double.parseDouble(genericUtility.getColumnValue("gross_weight", dom)); gWeight = Double.parseDouble(genericUtility.getColumnValue("gross_weight", dom));
retNoArt = setNoArt(siteCode, itemCode, stkLocCode, stkLotNo, stkLotSl, expLev, inputQty,tranType, gWeight, conn); retNoArt = setNoArt(siteCode, itemCode, stkLocCode, stkLotNo, stkLotSl, expLev, inputQty,tranType, gWeight, conn);
noArtDetArrLst = genericUtility.getTokenList(retNoArt, ":"); noArtDetArrLst = genericUtility.getTokenList(retNoArt, ":");
System.out.println("noArtDetArrLst.size :"+noArtDetArrLst.size()); System.out.println("noArtDetArrLst.size :"+noArtDetArrLst.size());
System.out.println("noArtDetArrLst.get(1) :"+(String)noArtDetArrLst.get(1)); System.out.println("noArtDetArrLst.get(1) :"+(String)noArtDetArrLst.get(1));
...@@ -1292,10 +1292,10 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -1292,10 +1292,10 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
System.out.println("netWeight :"+netWeight); System.out.println("netWeight :"+netWeight);
noArtStr = (String)noArtDetArrLst.get(3); noArtStr = (String)noArtDetArrLst.get(3);
System.out.println("noArtStr :"+noArtStr); System.out.println("noArtStr :"+noArtStr);
inputQtyStr = (String)noArtDetArrLst.get(4); inputQtyStr = (String)noArtDetArrLst.get(4);
System.out.println("inputQtyStr :"+inputQtyStr); System.out.println("inputQtyStr :"+inputQtyStr);
valueXmlString.append("<quantity isSrvCallOnChg='0'>").append("<![CDATA[").append(inputQtyStr).append("]]>").append("</quantity>\r\n"); valueXmlString.append("<quantity isSrvCallOnChg='0'>").append("<![CDATA[").append(inputQtyStr).append("]]>").append("</quantity>\r\n");
valueXmlString.append("<gross_weight isSrvCallOnChg='0'>").append("<![CDATA[").append(grossWeight).append("]]>").append("</gross_weight>\r\n"); valueXmlString.append("<gross_weight isSrvCallOnChg='0'>").append("<![CDATA[").append(grossWeight).append("]]>").append("</gross_weight>\r\n");
valueXmlString.append("<tare_weight isSrvCallOnChg='0'>").append("<![CDATA[").append(tareWeight).append("]]>").append("</tare_weight>\r\n"); valueXmlString.append("<tare_weight isSrvCallOnChg='0'>").append("<![CDATA[").append(tareWeight).append("]]>").append("</tare_weight>\r\n");
...@@ -1357,7 +1357,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -1357,7 +1357,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
ResultSet rs = null, rs1 = null, crs1 = null; ResultSet rs = null, rs1 = null, crs1 = null;
ConnDriver connDriver = new ConnDriver(); ConnDriver connDriver = new ConnDriver();
StringBuffer valueXmlString = new StringBuffer("<?xml version=\"1.0\"?>\r\n<Root>\r\n"); StringBuffer valueXmlString = new StringBuffer("<?xml version=\"1.0\"?>\r\n<Root>\r\n");
if (dom == null) if (dom == null)
{ {
valueXmlString.append("</Root>\r\n"); valueXmlString.append("</Root>\r\n");
...@@ -1374,7 +1374,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -1374,7 +1374,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
conn = connDriver.getConnectDB("DriverITM"); conn = connDriver.getConnectDB("DriverITM");
System.out.println("[Allocating .....]"); System.out.println("[Allocating .....]");
woIss = genericUtility.getColumnValue("tran_id", dom1); woIss = genericUtility.getColumnValue("tran_id", dom1);
workOrder = genericUtility.getColumnValue("work_order", dom1); workOrder = genericUtility.getColumnValue("work_order", dom1);
effDate = genericUtility.getColumnValue("eff_date", dom1); effDate = genericUtility.getColumnValue("eff_date", dom1);
...@@ -1386,8 +1386,8 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -1386,8 +1386,8 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
lotSl = genericUtility.getColumnValue("lot_sl", dom); lotSl = genericUtility.getColumnValue("lot_sl", dom);
quantity = Double.parseDouble(genericUtility.getColumnValue("quantity", dom)); quantity = Double.parseDouble(genericUtility.getColumnValue("quantity", dom));
System.out.println("Manohar 14/03/12 quantity [" + quantity + "]"); System.out.println("Manohar 14/03/12 quantity [" + quantity + "]");
expLev = genericUtility.getColumnValue("exp_lev", dom); expLev = genericUtility.getColumnValue("exp_lev", dom);
System.out.println("expLev ::: " + expLev); System.out.println("expLev ::: " + expLev);
reasCode = genericUtility.getColumnValue("reas_code", dom); reasCode = genericUtility.getColumnValue("reas_code", dom);
calcPotency = genericUtility.getColumnValue("calc_potency", dom); calcPotency = genericUtility.getColumnValue("calc_potency", dom);
tranType = genericUtility.getColumnValue("tran_type", dom1); tranType = genericUtility.getColumnValue("tran_type", dom1);
...@@ -1405,8 +1405,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -1405,8 +1405,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
pstmt.close(); pstmt.close();
rs.close(); rs.close();
if (tranType.equalsIgnoreCase("F"))
if (tranType.equalsIgnoreCase("F"))
{ {
unitAlt = genericUtility.getColumnValue("unit__alt", dom); unitAlt = genericUtility.getColumnValue("unit__alt", dom);
convQtyAlt = genericUtility.getColumnValue("conv__qty__alt", dom); convQtyAlt = genericUtility.getColumnValue("conv__qty__alt", dom);
...@@ -1414,8 +1413,8 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -1414,8 +1413,8 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
} }
operation = Double.parseDouble(genericUtility.getColumnValue("operation", dom1)); operation = Double.parseDouble(genericUtility.getColumnValue("operation", dom1));
bomCode = genericUtility.getColumnValue("bom_code", dom1); bomCode = genericUtility.getColumnValue("bom_code", dom1);
// VAL ADDED NOT TO ALLOW SAVE IF EXP_LEV IS NULL // VAL ADDED NOT TO ALLOW SAVE IF EXP_LEV IS NULL
if (expLev == null || expLev.trim().length() == 0) if (expLev == null || expLev.trim().length() == 0)
{ {
errCode = "VTEXP1"; errCode = "VTEXP1";
...@@ -1423,7 +1422,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -1423,7 +1422,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
return errString; return errString;
} }
// TRIM WIDTH FOR DIMENSION VALIDATION // TRIM WIDTH FOR DIMENSION VALIDATION
sql = "SELECT ITEM_CODE FROM WORKORDER WHERE WORK_ORDER = ?"; sql = "SELECT ITEM_CODE FROM WORKORDER WHERE WORK_ORDER = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, workOrder); pstmt.setString(1, workOrder);
...@@ -1434,7 +1433,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -1434,7 +1433,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
} }
pstmt.close(); pstmt.close();
rs.close(); rs.close();
sql = "SELECT A.TRIM_WIDTH FROM ITEM_TYPE A , ITEM B WHERE A.ITEM_TYPE = B.ITEM_TYPE AND B.ITEM_CODE = ?"; sql = "SELECT A.TRIM_WIDTH FROM ITEM_TYPE A , ITEM B WHERE A.ITEM_TYPE = B.ITEM_TYPE AND B.ITEM_CODE = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, fgItem); pstmt.setString(1, fgItem);
...@@ -1458,7 +1457,6 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -1458,7 +1457,6 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
{ {
itemCodeMain = rs.getString(1); itemCodeMain = rs.getString(1);
itemCodeRef = rs.getString(2); itemCodeRef = rs.getString(2);
sql = "SELECT DIMENSION, USE_INVSTATUS FROM BOMDET WHERE BOM_CODE = ? AND ITEM_CODE = ? AND ITEM_REF = ?"; sql = "SELECT DIMENSION, USE_INVSTATUS FROM BOMDET WHERE BOM_CODE = ? AND ITEM_CODE = ? AND ITEM_REF = ?";
pstmt1 = conn.prepareStatement(sql); pstmt1 = conn.prepareStatement(sql);
pstmt1.setString(1, bomCode); pstmt1.setString(1, bomCode);
...@@ -1479,27 +1477,27 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -1479,27 +1477,27 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
pstmt.close(); pstmt.close();
rs.close(); rs.close();
// NOT TO BE INCLUDED AS RND NOT CONSIDERED -- ALKA // NOT TO BE INCLUDED AS RND NOT CONSIDERED -- ALKA
// sql = "SELECT ORDER_TYPE FROM WORKORDER WHERE WORK_ORDER = ?"; // sql = "SELECT ORDER_TYPE FROM WORKORDER WHERE WORK_ORDER = ?";
// pstmt = conn.prepareStatement(sql); // pstmt = conn.prepareStatement(sql);
// pstmt.setString(1, workOrder); // pstmt.setString(1, workOrder);
// rs = pstmt.executeQuery(); // rs = pstmt.executeQuery();
// if (rs.next()) // if (rs.next())
// { // {
// orderType = rs.getString(1); // orderType = rs.getString(1);
// } // }
// pstmt.close(); // pstmt.close();
// rs.close(); // rs.close();
// //
// if (orderType.equalsIgnoreCase("T") // if (orderType.equalsIgnoreCase("T")
// { // {
// stkOpt = chkStkOptRnd(itemCode, siteCode); // stkOpt = chkStkOptRnd(itemCode, siteCode);
// } // }
// else // else
// { // {
// stkOpt = chkStkOpt(itemCode, siteCode); // stkOpt = chkStkOpt(itemCode, siteCode);
// } // }
stkOpt = mfgCommon.chkStkOpt(siteCode,itemCode,conn); stkOpt = mfgCommon.chkStkOpt(siteCode,itemCode,conn);
sql = "SELECT AUTO_ORD FROM BOMDET WHERE BOM_CODE = ? AND ITEM_CODE = ? AND ITEM_REF = ?"; sql = "SELECT AUTO_ORD FROM BOMDET WHERE BOM_CODE = ? AND ITEM_CODE = ? AND ITEM_REF = ?";
...@@ -1567,7 +1565,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -1567,7 +1565,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
} }
else else
{ {
// depending on calc_potency flag potency_adj considered // depending on calc_potency flag potency_adj considered
calcPotency = genericUtility.getColumnValue("calc_potency", dom); calcPotency = genericUtility.getColumnValue("calc_potency", dom);
potencyAdjQtyS = genericUtility.getColumnValue("potency_adj", dom); potencyAdjQtyS = genericUtility.getColumnValue("potency_adj", dom);
if (potencyAdjQtyS != null) if (potencyAdjQtyS != null)
...@@ -1592,12 +1590,12 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -1592,12 +1590,12 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
return errString; return errString;
} }
} }
// WHILE ISSUING PRINTED/PLAIN FOIL TO PRODUCTION...TAKE WHOLE LOTSL QUANTITY. // WHILE ISSUING PRINTED/PLAIN FOIL TO PRODUCTION...TAKE WHOLE LOTSL QUANTITY.
// FOR QC_REQD TO BE CHECKED FROM FIRST SITEITEM & THEN ITEM // FOR QC_REQD TO BE CHECKED FROM FIRST SITEITEM & THEN ITEM
qcReqd = mfgCommon.chkQcReqd(siteCode, itemCode, conn); qcReqd = mfgCommon.chkQcReqd(siteCode, itemCode, conn);
autoQcReqd = mfgCommon.chkAutoQcReqd(siteCode, itemCode, conn); autoQcReqd = mfgCommon.chkAutoQcReqd(siteCode, itemCode, conn);
sql = "SELECT ISS_CRITERIA, TRACK_SHELF_LIFE FROM ITEM WHERE ITEM_CODE = ?"; sql = "SELECT ISS_CRITERIA, TRACK_SHELF_LIFE FROM ITEM WHERE ITEM_CODE = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, itemCode); pstmt.setString(1, itemCode);
...@@ -1609,10 +1607,10 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -1609,10 +1607,10 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
} }
pstmt.close(); pstmt.close();
rs.close(); rs.close();
System.out.println("locCode ::: " + locCode + "trackShelfLife ::: " + trackShelfLife ); System.out.println("locCode ::: " + locCode + "trackShelfLife ::: " + trackShelfLife );
System.out.println("useInvStatus ::: " + useInvStatus + "dimension ::: " + dimension ); System.out.println("useInvStatus ::: " + useInvStatus + "dimension ::: " + dimension );
if ((locCode == null || locCode.trim().length() == 0) || (lotNo == null || lotNo.trim().length() == 0)) if ((locCode == null || locCode.trim().length() == 0) || (lotNo == null || lotNo.trim().length() == 0))
{ {
sqlSb.append("SELECT (CASE WHEN SUM(A.QUANTITY - A.ALLOC_QTY) IS NULL THEN 0 ELSE SUM(A.QUANTITY - A.ALLOC_QTY) END) "); sqlSb.append("SELECT (CASE WHEN SUM(A.QUANTITY - A.ALLOC_QTY) IS NULL THEN 0 ELSE SUM(A.QUANTITY - A.ALLOC_QTY) END) ");
...@@ -1622,12 +1620,12 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -1622,12 +1620,12 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
sqlSb.append("AND A.SITE_CODE = ? "); sqlSb.append("AND A.SITE_CODE = ? ");
sqlSb.append("AND (A.QUANTITY - (CASE WHEN A.ALLOC_QTY IS NULL THEN 0 ELSE A.ALLOC_QTY END)) > 0 "); sqlSb.append("AND (A.QUANTITY - (CASE WHEN A.ALLOC_QTY IS NULL THEN 0 ELSE A.ALLOC_QTY END)) > 0 ");
sqlSb.append("AND B.STAT_TYPE <> 'S'"); sqlSb.append("AND B.STAT_TYPE <> 'S'");
if (trackShelfLife.equalsIgnoreCase("Y")) if (trackShelfLife.equalsIgnoreCase("Y"))
{ {
sqlSb.append(" AND ( A.EXP_DATE > ? OR A.EXP_DATE IS NULL) "); sqlSb.append(" AND ( A.EXP_DATE > ? OR A.EXP_DATE IS NULL) ");
} }
if (useInvStatus.equalsIgnoreCase("U")) if (useInvStatus.equalsIgnoreCase("U"))
{ {
sqlSb.append(" AND B.AVAILABLE = 'Y' "); sqlSb.append(" AND B.AVAILABLE = 'Y' ");
...@@ -1636,7 +1634,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -1636,7 +1634,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
sqlSb.append(" AND ( A.RETEST_DATE > ? ) "); sqlSb.append(" AND ( A.RETEST_DATE > ? ) ");
} }
} }
if (dimension.trim().length() > 0) if (dimension.trim().length() > 0)
{ {
sqlSb.append(" AND DDF_COMPARE_DIMENSION(CASE WHEN A.DIMENSION IS NULL THEN ' ' ELSE A.DIMENSION END, ?, ?) = 'Y'"); sqlSb.append(" AND DDF_COMPARE_DIMENSION(CASE WHEN A.DIMENSION IS NULL THEN ' ' ELSE A.DIMENSION END, ?, ?) = 'Y'");
...@@ -1704,10 +1702,10 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -1704,10 +1702,10 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
errString = itmDBAccessEJB.getErrorString("",errCode, loginCode); errString = itmDBAccessEJB.getErrorString("",errCode, loginCode);
return errString; return errString;
} }
pstmt.close(); pstmt.close();
rs.close(); rs.close();
sqlSb1.append("SELECT A.LOC_CODE, A.LOT_NO, A.LOT_SL,(A.QUANTITY - A.ALLOC_QTY), A.EXP_DATE, A.UNIT, "); sqlSb1.append("SELECT A.LOC_CODE, A.LOT_NO, A.LOT_SL,(A.QUANTITY - A.ALLOC_QTY), A.EXP_DATE, A.UNIT, ");
sqlSb1.append("A.ITEM_SER, A.SITE_CODE__MFG, A.MFG_DATE, A.POTENCY_PERC, A.ALLOC_QTY, "); sqlSb1.append("A.ITEM_SER, A.SITE_CODE__MFG, A.MFG_DATE, A.POTENCY_PERC, A.ALLOC_QTY, ");
sqlSb1.append("A.PACK_CODE "); sqlSb1.append("A.PACK_CODE ");
...@@ -1718,12 +1716,12 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -1718,12 +1716,12 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
sqlSb1.append(" AND ((CASE WHEN A.QUANTITY IS NULL THEN 0 ELSE A.QUANTITY END) - "); sqlSb1.append(" AND ((CASE WHEN A.QUANTITY IS NULL THEN 0 ELSE A.QUANTITY END) - ");
sqlSb1.append(" (CASE WHEN A.ALLOC_QTY IS NULL THEN 0 ELSE A.ALLOC_QTY END)) > 0 "); sqlSb1.append(" (CASE WHEN A.ALLOC_QTY IS NULL THEN 0 ELSE A.ALLOC_QTY END)) > 0 ");
sqlSb1.append("AND B.STAT_TYPE <> 'S'"); sqlSb1.append("AND B.STAT_TYPE <> 'S'");
if (trackShelfLife.equalsIgnoreCase("Y")) if (trackShelfLife.equalsIgnoreCase("Y"))
{ {
sqlSb1.append(" AND ( A.EXP_DATE > ? OR A.EXP_DATE IS NULL) "); sqlSb1.append(" AND ( A.EXP_DATE > ? OR A.EXP_DATE IS NULL) ");
} }
if (useInvStatus.equalsIgnoreCase("U")) if (useInvStatus.equalsIgnoreCase("U"))
{ {
sqlSb1.append(" AND B.AVAILABLE = 'Y' "); sqlSb1.append(" AND B.AVAILABLE = 'Y' ");
...@@ -1732,7 +1730,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -1732,7 +1730,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
sqlSb1.append(" AND ( A.RETEST_DATE > ? ) "); sqlSb1.append(" AND ( A.RETEST_DATE > ? ) ");
} }
} }
if (dimension.trim().length() > 0) if (dimension.trim().length() > 0)
{ {
sqlSb1.append(" AND DDF_COMPARE_DIMENSION(CASE WHEN A.DIMENSION IS NULL THEN ' ' ELSE A.DIMENSION END, ?, ?) = 'Y'"); sqlSb1.append(" AND DDF_COMPARE_DIMENSION(CASE WHEN A.DIMENSION IS NULL THEN ' ' ELSE A.DIMENSION END, ?, ?) = 'Y'");
...@@ -1744,14 +1742,14 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -1744,14 +1742,14 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
sql = sql + " AND c.loc_group = '" + locGroup + "' "; sql = sql + " AND c.loc_group = '" + locGroup + "' ";
} }
// end 26/03/12 manoharan // end 26/03/12 manoharan
System.out.println("sqlSB1 converted ::: "+ sql); System.out.println("sqlSB1 converted ::: "+ sql);
StringTokenizer st1 = new StringTokenizer(sql, "?"); StringTokenizer st1 = new StringTokenizer(sql, "?");
cntQ = st1.countTokens(); cntQ = st1.countTokens();
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
flag1 = false; flag2 = false; flag1 = false; flag2 = false;
pstmt.setString(1, itemCode); pstmt.setString(1,itemCode);
pstmt.setString(2, siteCode); pstmt.setString(2,siteCode);
for (int i=3; i<cntQ; i++) for (int i=3; i<cntQ; i++)
{ {
if (trackShelfLife.equalsIgnoreCase("Y") && flag1 == false) if (trackShelfLife.equalsIgnoreCase("Y") && flag1 == false)
...@@ -1771,14 +1769,14 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -1771,14 +1769,14 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
} }
if (dimension.trim().length() > 0) if (dimension.trim().length() > 0)
{ {
pstmt.setString(i, dimension); pstmt.setString(i,dimension);
pstmt.setDouble(i+1, trimWidth); pstmt.setDouble(i+1, trimWidth);
break; break;
} }
} }
System.out.println("Setting parameters ::: itemCode ::: " + itemCode + "siteCode ::: " + siteCode); System.out.println("Setting parameters ::: itemCode ::: "+itemCode+"siteCode ::: " +siteCode);
System.out.println("effDate ::: " + effDate + "dimension ::: " + dimension + "trimWidth ::: " + trimWidth); System.out.println("effDate ::: " +effDate+ "dimension ::: " +dimension+ "trimWidth ::: " +trimWidth);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
remainingQty = quantity; remainingQty = quantity;
while (rs.next()) while (rs.next())
...@@ -1795,8 +1793,8 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -1795,8 +1793,8 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
potencyPerc = rs.getString(10); potencyPerc = rs.getString(10);
allocQty = rs.getString(11); allocQty = rs.getString(11);
packCode = rs.getString(12); packCode = rs.getString(12);
System.out.println("manohar stkQtyLot [" + stkQtyLot + "] remainingQty [" + remainingQty + "] criteria [" + criteria + "]"); System.out.println("manohar stkQtyLot [" + stkQtyLot + "] remainingQty [" + remainingQty + "] criteria [" + criteria + "]");
if (stkQtyLot >= remainingQty) if (stkQtyLot >= remainingQty)
{ {
...@@ -1816,7 +1814,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -1816,7 +1814,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
remainingQty = remainingQty - inputQty; remainingQty = remainingQty - inputQty;
} }
System.out.println("inputQty :: " + inputQty); System.out.println("inputQty :: " + inputQty);
valueXmlString.append("<Detail>\r\n"); valueXmlString.append("<Detail>\r\n");
valueXmlString.append("<tran_id>").append("<![CDATA[").append(woIss).append("]]>").append("</tran_id>\r\n"); valueXmlString.append("<tran_id>").append("<![CDATA[").append(woIss).append("]]>").append("</tran_id>\r\n");
valueXmlString.append("<exp_lev>").append("<![CDATA[").append(expLev).append("]]>").append("</exp_lev>\r\n"); valueXmlString.append("<exp_lev>").append("<![CDATA[").append(expLev).append("]]>").append("</exp_lev>\r\n");
...@@ -1838,8 +1836,8 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -1838,8 +1836,8 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
if (inputQty > 0) if (inputQty > 0)
{ {
sql = " SELECT ROUND((CASE WHEN QUANTITY IS NULL THEN 0 ELSE QUANTITY END) / " sql = " SELECT ROUND((CASE WHEN QUANTITY IS NULL THEN 0 ELSE QUANTITY END) / "
+ " (CASE WHEN NO_ART IS NULL THEN 1 ELSE NO_ART END),3) FROM INV_PACK_RCP " + " (CASE WHEN NO_ART IS NULL THEN 1 ELSE NO_ART END),3) FROM INV_PACK_RCP "
+ " WHERE ITEM_CODE = ? AND LOC_CODE = ? AND LOT_NO = ? AND LOT_SL = ? "; + " WHERE ITEM_CODE = ? AND LOC_CODE = ? AND LOT_NO = ? AND LOT_SL = ? ";
cpstmt1 = conn.prepareStatement(sql); cpstmt1 = conn.prepareStatement(sql);
cpstmt1.setString(1, itemCode); cpstmt1.setString(1, itemCode);
cpstmt1.setString(2, stkLocCode); cpstmt1.setString(2, stkLocCode);
...@@ -1850,30 +1848,30 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -1850,30 +1848,30 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
System.out.println("Setting parameters ::: itemCode ::: " + itemCode + "stkLocCode ::: " + stkLocCode); System.out.println("Setting parameters ::: itemCode ::: " + itemCode + "stkLocCode ::: " + stkLocCode);
System.out.println("stkLotNo ::: " + stkLotNo + "stkLotSl ::: " + stkLotSl ); System.out.println("stkLotNo ::: " + stkLotNo + "stkLotSl ::: " + stkLotSl );
crs1 = cpstmt1.executeQuery(); crs1 = cpstmt1.executeQuery();
if (crs1.next()) if (crs1.next())
{ {
perArtQty = crs1.getDouble(1); perArtQty = crs1.getDouble(1);
System.out.println("perArtQty ::: " + perArtQty); System.out.println("perArtQty ::: " + perArtQty);
} }
if (perArtQty == 0) if (perArtQty == 0)
{ {
perArtQty = 1; // TO AVOID DIVIDE BY ZERO ERROR perArtQty = 1; // TO AVOID DIVIDE BY ZERO ERROR
} }
noArt = inputQty/perArtQty; noArt = inputQty/perArtQty;
valueXmlString.append("<no_art>").append("<![CDATA[").append(Math.round(noArt)).append("]]>").append("</no_art>\r\n"); valueXmlString.append("<no_art>").append("<![CDATA[").append(Math.round(noArt)).append("]]>").append("</no_art>\r\n");
crs1.close(); crs1 = null; crs1.close(); crs1 = null;
cpstmt1.close(); cpstmt1 = null; cpstmt1.close(); cpstmt1 = null;
} }
if ((siteCode != null) && (itemCode != null) && (locCode != null) && (lotNo != null) && (lotSl != null) && if ((siteCode != null) && (itemCode != null) && (locCode != null) && (lotNo != null) && (lotSl != null) &&
// (expLev != null) && (quantity != 0) && (tranType != null) ) // (expLev != null) && (quantity != 0) && (tranType != null) )
(expLev != null) && (inputQty != 0) && (tranType != null) ) //CHANGED BY ALKA 19/07/07 AS WEIGHT DATA IS NOT DISPLAYED IN THE DETAIL (expLev != null) && (inputQty != 0) && (tranType != null) ) //CHANGED BY ALKA 19/07/07 AS WEIGHT DATA IS NOT DISPLAYED IN THE DETAIL
{ {
gWeight = Double.parseDouble(genericUtility.getColumnValue("gross_weight", dom)); gWeight = Double.parseDouble(genericUtility.getColumnValue("gross_weight", dom));
retNoArt = setNoArt(siteCode, itemCode, locCode, lotNo, lotSl, expLev, inputQty,tranType, gWeight, conn); retNoArt = setNoArt(siteCode, itemCode, locCode, lotNo, lotSl, expLev, inputQty,tranType, gWeight, conn);
noArtDetArrLst = genericUtility.getTokenList(retNoArt, ":"); noArtDetArrLst = genericUtility.getTokenList(retNoArt, ":");
System.out.println("noArtDetArrLst.size :"+noArtDetArrLst.size()); System.out.println("noArtDetArrLst.size :"+noArtDetArrLst.size());
System.out.println("noArtDetArrLst.get(0) :"+(String)noArtDetArrLst.get(0)); System.out.println("noArtDetArrLst.get(0) :"+(String)noArtDetArrLst.get(0));
...@@ -1887,8 +1885,8 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -1887,8 +1885,8 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
System.out.println("noArtStr :"+noArtStr); System.out.println("noArtStr :"+noArtStr);
inputQtyStr = (String)noArtDetArrLst.get(4); inputQtyStr = (String)noArtDetArrLst.get(4);
System.out.println("inputQtyStr :"+inputQtyStr); System.out.println("inputQtyStr :"+inputQtyStr);
valueXmlString.append("<quantity>").append("<![CDATA[").append(inputQtyStr).append("]]>").append("</quantity>\r\n"); valueXmlString.append("<quantity>").append("<![CDATA[").append(inputQtyStr).append("]]>").append("</quantity>\r\n");
valueXmlString.append("<gross_weight>").append("<![CDATA[").append(grossWeight).append("]]>").append("</gross_weight>\r\n"); valueXmlString.append("<gross_weight>").append("<![CDATA[").append(grossWeight).append("]]>").append("</gross_weight>\r\n");
valueXmlString.append("<tare_weight>").append("<![CDATA[").append(tareWeight).append("]]>").append("</tare_weight>\r\n"); valueXmlString.append("<tare_weight>").append("<![CDATA[").append(tareWeight).append("]]>").append("</tare_weight>\r\n");
...@@ -1903,7 +1901,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -1903,7 +1901,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
}//end of while }//end of while
rs.close(); rs.close();
pstmt.close(); pstmt.close();
if (remainingQty > 0) if (remainingQty > 0)
{ {
...@@ -1915,19 +1913,19 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -1915,19 +1913,19 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
} }
else else
{ {
// IF LOC_CODE AND LOT NO AND LOT_SL ARE ENTERED BY USER // IF LOC_CODE AND LOT NO AND LOT_SL ARE ENTERED BY USER
// TO CHECK ALL CONDITIONS RELATED QC_REQD & TRACKSHELFLIFE // TO CHECK ALL CONDITIONS RELATED QC_REQD & TRACKSHELFLIFE
sqlSb.append(" SELECT (CASE WHEN SUM(A.QUANTITY-A.ALLOC_QTY) IS NULL THEN 0 ELSE SUM(A.QUANTITY-A.ALLOC_QTY) END)"); sqlSb.append(" SELECT (CASE WHEN SUM(A.QUANTITY-A.ALLOC_QTY) IS NULL THEN 0 ELSE SUM(A.QUANTITY-A.ALLOC_QTY) END)");
sqlSb.append(" FROM STOCK A, INVSTAT B, LOCATION C "); sqlSb.append(" FROM STOCK A, INVSTAT B, LOCATION C ");
sqlSb.append(" WHERE A.INV_STAT = B.INV_STAT AND A.ITEM_CODE = ? AND A.SITE_CODE = ? "); sqlSb.append(" WHERE A.INV_STAT = B.INV_STAT AND A.ITEM_CODE = ? AND A.SITE_CODE = ? ");
sqlSb.append(" AND A.LOC_CODE = ? AND A.LOT_NO = ? AND A.LOT_SL = ? "); sqlSb.append(" AND A.LOC_CODE = ? AND A.LOT_NO = ? AND A.LOT_SL = ? ");
sqlSb.append(" AND (A.QUANTITY - A.ALLOC_QTY) >= ? AND B.STAT_TYPE <> 'S' "); sqlSb.append(" AND (A.QUANTITY - A.ALLOC_QTY) >= ? AND B.STAT_TYPE <> 'S' ");
if (trackShelfLife.equalsIgnoreCase("Y")) if (trackShelfLife.equalsIgnoreCase("Y"))
{ {
sqlSb.append(" AND ( A.EXP_DATE > ? OR A.EXP_DATE IS NULL) "); sqlSb.append(" AND ( A.EXP_DATE > ? OR A.EXP_DATE IS NULL) ");
} }
if (useInvStatus.equalsIgnoreCase("U")) if (useInvStatus.equalsIgnoreCase("U"))
{ {
sqlSb.append(" AND B.AVAILABLE = 'Y' "); sqlSb.append(" AND B.AVAILABLE = 'Y' ");
...@@ -1936,12 +1934,12 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -1936,12 +1934,12 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
sqlSb.append(" AND ( A.RETEST_DATE > ? ) "); sqlSb.append(" AND ( A.RETEST_DATE > ? ) ");
} }
} }
if (dimension.trim().length() > 0) if (dimension.trim().length() > 0)
{ {
sqlSb.append(" AND DDF_COMPARE_DIMENSION(CASE WHEN A.DIMENSION IS NULL THEN ' ' ELSE A.DIMENSION END, ?, ?) = 'Y'"); sqlSb.append(" AND DDF_COMPARE_DIMENSION(CASE WHEN A.DIMENSION IS NULL THEN ' ' ELSE A.DIMENSION END, ?, ?) = 'Y'");
} }
sql = sqlSb.toString(); sql = sqlSb.toString();
// 26/03/12 manoharan // 26/03/12 manoharan
if (locGroup != null && locGroup.trim().length() > 0 && "A".equals(locUsageType) ) if (locGroup != null && locGroup.trim().length() > 0 && "A".equals(locUsageType) )
...@@ -1949,7 +1947,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -1949,7 +1947,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
sql = sql + " AND c.loc_group = '" + locGroup + "' "; sql = sql + " AND c.loc_group = '" + locGroup + "' ";
} }
// end 26/03/12 manoharan // end 26/03/12 manoharan
System.out.println("sqlSB converted ::: "+ sql); System.out.println("sqlSB converted ::: "+ sql);
StringTokenizer st1 = new StringTokenizer(sql, "?"); StringTokenizer st1 = new StringTokenizer(sql, "?");
cntQ = st1.countTokens(); cntQ = st1.countTokens();
...@@ -1963,7 +1961,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -1963,7 +1961,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
boolean flag1 = false, flag2 = false; boolean flag1 = false, flag2 = false;
for (int i=7; i<cntQ; i++) for (int i=7; i<cntQ; i++)
{ {
if (trackShelfLife.equalsIgnoreCase("Y") && flag1 == false) if (trackShelfLife.equalsIgnoreCase("Y") && flag1 == false)
{ {
pstmt.setTimestamp(i, Timestamp.valueOf(genericUtility.getValidDateString(effDate, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00")); pstmt.setTimestamp(i, Timestamp.valueOf(genericUtility.getValidDateString(effDate, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00"));
...@@ -2018,8 +2016,8 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -2018,8 +2016,8 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
if (quantity > 0) if (quantity > 0)
{ {
sql = " SELECT ROUND((CASE WHEN QUANTITY IS NULL THEN 0 ELSE QUANTITY END) / " sql = " SELECT ROUND((CASE WHEN QUANTITY IS NULL THEN 0 ELSE QUANTITY END) / "
+ " (CASE WHEN NO_ART IS NULL THEN 1 ELSE NO_ART END),3) FROM INV_PACK_RCP " + " (CASE WHEN NO_ART IS NULL THEN 1 ELSE NO_ART END),3) FROM INV_PACK_RCP "
+ " WHERE ITEM_CODE = ? AND LOC_CODE = ? AND LOT_NO = ? AND LOT_SL = ? "; + " WHERE ITEM_CODE = ? AND LOC_CODE = ? AND LOT_NO = ? AND LOT_SL = ? ";
pstmt1 = conn.prepareStatement(sql); pstmt1 = conn.prepareStatement(sql);
pstmt1.setString(1, itemCode); pstmt1.setString(1, itemCode);
pstmt1.setString(2, stkLocCode); pstmt1.setString(2, stkLocCode);
...@@ -2041,7 +2039,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -2041,7 +2039,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
{ {
noArt = quantity/perArtQty; noArt = quantity/perArtQty;
} }
valueXmlString.append("<no_art>").append("<![CDATA[").append(Math.round(noArt)).append("]]>").append("</no_art>\r\n"); valueXmlString.append("<no_art>").append("<![CDATA[").append(Math.round(noArt)).append("]]>").append("</no_art>\r\n");
} }
pstmt1.close(); pstmt1.close();
...@@ -2049,9 +2047,9 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -2049,9 +2047,9 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
} }
valueXmlString.append("</Detail>\r\n"); valueXmlString.append("</Detail>\r\n");
} }
} }
valueXmlString.append("</Root>\r\n"); valueXmlString.append("</Root>\r\n");
}//try end }//try end
catch (SQLException sqx) catch (SQLException sqx)
...@@ -2077,7 +2075,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -2077,7 +2075,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
System.out.println("Manoharan 23/03/12 valueXmlString return from WOrderIssueActEJB.actionAllocate ["+valueXmlString.toString() + "]"); System.out.println("Manoharan 23/03/12 valueXmlString return from WOrderIssueActEJB.actionAllocate ["+valueXmlString.toString() + "]");
return valueXmlString.toString(); return valueXmlString.toString();
} }
private String serializeDom(Node dom) throws ITMException { private String serializeDom(Node dom) throws ITMException {
String retString = null; String retString = null;
try { try {
...@@ -2085,7 +2083,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -2085,7 +2083,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
Transformer serializer = TransformerFactory.newInstance() Transformer serializer = TransformerFactory.newInstance()
.newTransformer(); .newTransformer();
serializer serializer
.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); .setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
serializer.transform(new DOMSource(dom), serializer.transform(new DOMSource(dom),
new javax.xml.transform.stream.StreamResult(out)); new javax.xml.transform.stream.StreamResult(out));
retString = out.toString(); retString = out.toString();
...@@ -2100,7 +2098,8 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -2100,7 +2098,8 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
return retString; return retString;
} }
private void getItemChanged(Document dom, Document dom1, String expLev, Connection conn) throws Exception { private void getItemChanged(Document dom, Document dom1, String expLev, Connection conn) throws Exception
{
PreparedStatement pstmt = null, pstmt1 = null; PreparedStatement pstmt = null, pstmt1 = null;
ResultSet rs = null, rs1 = null; ResultSet rs = null, rs1 = null;
String sql = null; String sql = null;
...@@ -2129,7 +2128,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -2129,7 +2128,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
} }
pstmt.close(); pstmt.close();
rs.close(); rs.close();
if ("T".equals(orderType)) if ("T".equals(orderType))
{ {
mfgLoc = mfgCommon.getEnvMfg("999999", "NON_STOCK", conn); mfgLoc = mfgCommon.getEnvMfg("999999", "NON_STOCK", conn);
...@@ -2146,10 +2145,10 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -2146,10 +2145,10 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
siteCode = genericUtility.getColumnValue("site_code", dom1); siteCode = genericUtility.getColumnValue("site_code", dom1);
tranId = genericUtility.getColumnValue("tran_id", dom1); tranId = genericUtility.getColumnValue("tran_id", dom1);
tranIdReq = genericUtility.getColumnValue("tran_id__req", dom1); tranIdReq = genericUtility.getColumnValue("tran_id__req", dom1);
sql = " SELECT ITEM_CODE__REF, ITEM_CODE, QUANTITY, ALLOC_QTY, MATCH_POTENCY, POTENCY_ADJ, " sql = " SELECT ITEM_CODE__REF, ITEM_CODE, QUANTITY, ALLOC_QTY, MATCH_POTENCY, POTENCY_ADJ, "
+ " ADJ_POTENCY, UNIT__ALT, CONV__QTY__ALT, QUANTITY__ALT FROM WORKORDER_BILL " + " ADJ_POTENCY, UNIT__ALT, CONV__QTY__ALT, QUANTITY__ALT FROM WORKORDER_BILL "
+ " WHERE WORK_ORDER = ? AND OPERATION = ? AND EXP_LEV = ? "; + " WHERE WORK_ORDER = ? AND OPERATION = ? AND EXP_LEV = ? ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, workOrder); pstmt.setString(1, workOrder);
pstmt.setDouble(2, operation); pstmt.setDouble(2, operation);
...@@ -2170,9 +2169,9 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -2170,9 +2169,9 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
} }
pstmt.close(); pstmt.close();
rs.close(); rs.close();
tranType = genericUtility.getColumnValue("tran_type", dom1); tranType = genericUtility.getColumnValue("tran_type", dom1);
sql = "SELECT DESCR, UNIT FROM ITEM WHERE ITEM_CODE = ?"; sql = "SELECT DESCR, UNIT FROM ITEM WHERE ITEM_CODE = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, itemCode); pstmt.setString(1, itemCode);
...@@ -2184,23 +2183,23 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -2184,23 +2183,23 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
} }
pstmt.close(); pstmt.close();
rs.close(); rs.close();
setValueInDom(dom, "exp_lev", expLev); setValueInDom(dom, "exp_lev", expLev);
setValueInDom(dom, "item_code", itemCode); setValueInDom(dom, "item_code", itemCode);
setValueInDom(dom, "item_descr", itemDescr); setValueInDom(dom, "item_descr", itemDescr);
if ("R".equals(tranType)) if ("R".equals(tranType))
{ {
// previous return quantity to consider also. // previous return quantity to consider also.
quantity = getIssueReturnQty(workOrder, expLev, itemCode, itemCodeRef, tranType, operation, bomCode, conn); quantity = getIssueReturnQty(workOrder, expLev, itemCode, itemCodeRef, tranType, operation, bomCode, conn);
returnQty = getIssueReturnQty(workOrder, expLev, itemCode, itemCodeRef, tranType, operation, bomCode, conn); returnQty = getIssueReturnQty(workOrder, expLev, itemCode, itemCodeRef, tranType, operation, bomCode, conn);
// RETURN QTY MAY BE IN -VE HENCE ABS IT BEFORE DEDUCTING FROM ISSUE // RETURN QTY MAY BE IN -VE HENCE ABS IT BEFORE DEDUCTING FROM ISSUE
quantity = quantity - Math.abs(returnQty); quantity = quantity - Math.abs(returnQty);
// QUANTITY TO BE SET BASED ON PRODUCTION ALREADY DONE AND BALANCE LEFT // QUANTITY TO BE SET BASED ON PRODUCTION ALREADY DONE AND BALANCE LEFT
sql = " SELECT QUANTITY + CASE WHEN POTENCY_ADJ IS NULL THEN 0 ELSE POTENCY_ADJ END FROM WORKORDER_BILL " sql = " SELECT QUANTITY + CASE WHEN POTENCY_ADJ IS NULL THEN 0 ELSE POTENCY_ADJ END FROM WORKORDER_BILL "
+ " WHERE WORK_ORDER = ? AND OPERATION = ? AND EXP_LEV = ?"; + " WHERE WORK_ORDER = ? AND OPERATION = ? AND EXP_LEV = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, workOrder); pstmt.setString(1, workOrder);
pstmt.setDouble(2, operation); pstmt.setDouble(2, operation);
...@@ -2213,7 +2212,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -2213,7 +2212,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
} }
pstmt.close(); pstmt.close();
rs.close(); rs.close();
sql = "SELECT CURRENT_BATCH_QTY FROM WORKORDER WHERE WORK_ORDER = ?"; sql = "SELECT CURRENT_BATCH_QTY FROM WORKORDER WHERE WORK_ORDER = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, workOrder); pstmt.setString(1, workOrder);
...@@ -2224,7 +2223,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -2224,7 +2223,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
} }
pstmt.close(); pstmt.close();
rs.close(); rs.close();
sql = "SELECT SUM(QUANTITY) FROM WORKORDER_RECEIPT WHERE WORK_ORDER = ? AND TRAN_TYPE = 'F'"; sql = "SELECT SUM(QUANTITY) FROM WORKORDER_RECEIPT WHERE WORK_ORDER = ? AND TRAN_TYPE = 'F'";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, workOrder); pstmt.setString(1, workOrder);
...@@ -2235,7 +2234,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -2235,7 +2234,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
} }
pstmt.close(); pstmt.close();
rs.close(); rs.close();
if (rcpQty >= woQty) if (rcpQty >= woQty)
{ {
quantity = 0; quantity = 0;
...@@ -2244,17 +2243,17 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -2244,17 +2243,17 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
{ {
quantity = (billQty/woQty * (woQty - rcpQty)) - Math.abs(returnQty); quantity = (billQty/woQty * (woQty - rcpQty)) - Math.abs(returnQty);
} }
setValueInDom(dom, "quantity", Double.toString(quantity*(-1))); setValueInDom(dom, "quantity", Double.toString(quantity*(-1)));
setValueInDom(dom, "potency_adj", "0"); setValueInDom(dom, "potency_adj", "0");
} }
else else
{ {
// THE FUNCTION FOR PENDING QUANTITY IS RETURNING THE PENDING QUANTITY // THE FUNCTION FOR PENDING QUANTITY IS RETURNING THE PENDING QUANTITY
// WITHOUT CONSIDERING THE CURRENT TRANSACTION QUANTITY // WITHOUT CONSIDERING THE CURRENT TRANSACTION QUANTITY
sql = " SELECT SUM(B.QUANTITY) FROM WORKORDER_ISS A, WORKORDER_ISSDET B " sql = " SELECT SUM(B.QUANTITY) FROM WORKORDER_ISS A, WORKORDER_ISSDET B "
+ " WHERE A.TRAN_ID = B.TRAN_ID AND A.TRAN_ID = ? AND A.OPERATION = ? AND B.EXP_LEV = ? " + " WHERE A.TRAN_ID = B.TRAN_ID AND A.TRAN_ID = ? AND A.OPERATION = ? AND B.EXP_LEV = ? "
+ " AND B.ITEM_CODE = ?" ; + " AND B.ITEM_CODE = ?" ;
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId); pstmt.setString(1, tranId);
pstmt.setDouble(2, operation); pstmt.setDouble(2, operation);
...@@ -2267,9 +2266,9 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -2267,9 +2266,9 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
} }
pstmt.close(); pstmt.close();
rs.close(); rs.close();
quantity = getPendingQty(workOrder, operation, expLev, conn); quantity = getPendingQty(workOrder, operation, expLev, conn);
if ("F".equals(tranType)) if ("F".equals(tranType))
{ {
setValueInDom(dom, "quantity", Double.toString(quantity)); setValueInDom(dom, "quantity", Double.toString(quantity));
...@@ -2281,19 +2280,19 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -2281,19 +2280,19 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
{ {
setValueInDom(dom, "quantity", Double.toString(quantity)); setValueInDom(dom, "quantity", Double.toString(quantity));
} }
setValueInDom(dom, "match_potency", matchPotency); setValueInDom(dom, "match_potency", matchPotency);
setValueInDom(dom, "potency_adj", Double.toString(adjQty)); setValueInDom(dom, "potency_adj", Double.toString(adjQty));
setValueInDom(dom, "adj_potency", adjWith); setValueInDom(dom, "adj_potency", adjWith);
} }
setValueInDom(dom1, "unit", unit); setValueInDom(dom1, "unit", unit);
if ("R".equals(tranType)) if ("R".equals(tranType))
{ {
sql = " SELECT COUNT(*) FROM WORKORDER_ISS A,WORKORDER_ISSDET B " sql = " SELECT COUNT(*) FROM WORKORDER_ISS A,WORKORDER_ISSDET B "
+ " WHERE A.TRAN_ID = B.TRAN_ID AND A.WORK_ORDER = ? " + " WHERE A.TRAN_ID = B.TRAN_ID AND A.WORK_ORDER = ? "
+ " AND A.TRAN_TYPE IN ('I','O','D','F') AND B.EXP_LEV = ? AND A.STATUS <> 'X'"; + " AND A.TRAN_TYPE IN ('I','O','D','F') AND B.EXP_LEV = ? AND A.STATUS <> 'X'";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, workOrder); pstmt.setString(1, workOrder);
pstmt.setString(2, expLev); pstmt.setString(2, expLev);
...@@ -2304,11 +2303,11 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -2304,11 +2303,11 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
} }
pstmt.close(); pstmt.close();
rs.close(); rs.close();
if (cnt == 1) if (cnt == 1)
{ {
sql = " SELECT B.LOT_NO,B.LOT_SL FROM WORKORDER_ISS A,WORKORDER_ISSDET B " sql = " SELECT B.LOT_NO,B.LOT_SL FROM WORKORDER_ISS A,WORKORDER_ISSDET B "
+ " WHERE A.TRAN_ID = B.TRAN_ID AND A.WORK_ORDER = ? AND B.EXP_LEV = ?"; + " WHERE A.TRAN_ID = B.TRAN_ID AND A.WORK_ORDER = ? AND B.EXP_LEV = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, workOrder); pstmt.setString(1, workOrder);
pstmt.setString(2, expLev); pstmt.setString(2, expLev);
...@@ -2320,14 +2319,14 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -2320,14 +2319,14 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
} }
pstmt.close(); pstmt.close();
rs.close(); rs.close();
setValueInDom(dom, "lot_no", lotNo); setValueInDom(dom, "lot_no", lotNo);
setValueInDom(dom, "lot_sl", lotSl); setValueInDom(dom, "lot_sl", lotSl);
} }
} }
// IF W/O RETURN AND ITEM.QC_REQD = 'Y' -- DON'T ALLOW TO CHANGE QC_REQD // IF W/O RETURN AND ITEM.QC_REQD = 'Y' -- DON'T ALLOW TO CHANGE QC_REQD
// IF WORK ORDER TYPE IS PACKING SET QC_REQD = 'N' EVEN THOUGH RETURN // IF WORK ORDER TYPE IS PACKING SET QC_REQD = 'N' EVEN THOUGH RETURN
itemCode = genericUtility.getColumnValue("item_code", dom1); itemCode = genericUtility.getColumnValue("item_code", dom1);
if ("R".equals(tranType) || "P".equals(orderType)) if ("R".equals(tranType) || "P".equals(orderType))
{ {
...@@ -2335,7 +2334,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -2335,7 +2334,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
} }
else else
{ {
// IF AUTO_REQC IS 'YES' IN SITEITEM THEN SET QC_REQD = 'YES' // IF AUTO_REQC IS 'YES' IN SITEITEM THEN SET QC_REQD = 'YES'
sql = "SELECT CASE WHEN AUTO_REQC IS NULL THEN 'N' ELSE AUTO_REQC END FROM SITEITEM WHERE SITE_CODE = ? AND ITEM_CODE = ?"; sql = "SELECT CASE WHEN AUTO_REQC IS NULL THEN 'N' ELSE AUTO_REQC END FROM SITEITEM WHERE SITE_CODE = ? AND ITEM_CODE = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, siteCode); pstmt.setString(1, siteCode);
...@@ -2362,8 +2361,8 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -2362,8 +2361,8 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
rs.close(); rs.close();
setValueInDom(dom, "qc_reqd", qcReqd); setValueInDom(dom, "qc_reqd", qcReqd);
} }
// IF DEVIATED ISSUE IS FROM REQUEST THEN SELECT THE QUANTITY. // IF DEVIATED ISSUE IS FROM REQUEST THEN SELECT THE QUANTITY.
if (tranIdReq == null) if (tranIdReq == null)
{ {
tranIdReq = ""; tranIdReq = "";
...@@ -2371,7 +2370,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -2371,7 +2370,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
if (("D".equals(tranType) || "O".equals(tranType)) && tranIdReq.trim().length() > 0) if (("D".equals(tranType) || "O".equals(tranType)) && tranIdReq.trim().length() > 0)
{ {
sql = " SELECT QUANTITY, ITEM_CODE, UNIT, REAS_CODE FROM WORKORDER_ISSDET_REQ " sql = " SELECT QUANTITY, ITEM_CODE, UNIT, REAS_CODE FROM WORKORDER_ISSDET_REQ "
+ " WHERE TRAN_ID = ? AND EXP_LEV = ? "; + " WHERE TRAN_ID = ? AND EXP_LEV = ? ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranIdReq); pstmt.setString(1, tranIdReq);
pstmt.setString(2, expLev); pstmt.setString(2, expLev);
...@@ -2385,11 +2384,11 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -2385,11 +2384,11 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
} }
pstmt.close(); pstmt.close();
rs.close(); rs.close();
// DEDUCT THE ISSUED QUANTITY FOR THIS REQ // DEDUCT THE ISSUED QUANTITY FOR THIS REQ
sql = " SELECT SUM(B.QUANTITY) FROM WORKORDER_ISS A, WORKORDER_ISSDET B " sql = " SELECT SUM(B.QUANTITY) FROM WORKORDER_ISS A, WORKORDER_ISSDET B "
+ " WHERE (A.TRAN_ID = B.TRAN_ID ) AND (A.CONFIRMED = 'Y' ) AND (A.TRAN_TYPE = ?) " + " WHERE (A.TRAN_ID = B.TRAN_ID ) AND (A.CONFIRMED = 'Y' ) AND (A.TRAN_TYPE = ?) "
+ " AND (A.TRAN_ID__REQ = ?) AND (B.ITEM_CODE = ?) AND (B.EXP_LEV = ?)"; + " AND (A.TRAN_ID__REQ = ?) AND (B.ITEM_CODE = ?) AND (B.EXP_LEV = ?)";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranType); pstmt.setString(1, tranType);
pstmt.setString(2, tranIdReq); pstmt.setString(2, tranIdReq);
...@@ -2404,13 +2403,13 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -2404,13 +2403,13 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
rs.close(); rs.close();
System.out.println("Manohar Deviated/Ondemand qtyReq [" + qtyReq + "] totQtyIss [" + totQtyIss + "] reason [" + reason + "]"); System.out.println("Manohar Deviated/Ondemand qtyReq [" + qtyReq + "] totQtyIss [" + totQtyIss + "] reason [" + reason + "]");
setValueInDom(dom, "quantity", Double.toString(qtyReq - totQtyIss)); setValueInDom(dom, "quantity", Double.toString(qtyReq - totQtyIss));
// SET THE ITEM FROM REQUEST // SET THE ITEM FROM REQUEST
if (itemCode != null && itemCode.trim().length() > 0) if (itemCode != null && itemCode.trim().length() > 0)
{ {
setValueInDom(dom, "item_code", itemCode); setValueInDom(dom, "item_code", itemCode);
setValueInDom(dom1, "unit", unit); setValueInDom(dom1, "unit", unit);
// REASON CODE SHUD COME FROM ISSUE REQUEST IN CASE OF DEVI AND ONDEMAND ISSUE // REASON CODE SHUD COME FROM ISSUE REQUEST IN CASE OF DEVI AND ONDEMAND ISSUE
setValueInDom(dom, "reas_code", reason); setValueInDom(dom, "reas_code", reason);
} }
if (reason != null &&reason.trim().length() > 0) if (reason != null &&reason.trim().length() > 0)
...@@ -2418,107 +2417,107 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -2418,107 +2417,107 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
setValueInDom(dom, "reas_code", reason); setValueInDom(dom, "reas_code", reason);
} }
} }
//ITEMCHANGE FOR ITEM_CODE BEGINS //ITEMCHANGE FOR ITEM_CODE BEGINS
itemCode = genericUtility.getColumnValue("item_code", dom); itemCode = genericUtility.getColumnValue("item_code", dom);
orderType = genericUtility.getColumnValue("order_type", dom1).trim(); orderType = genericUtility.getColumnValue("order_type", dom1).trim();
sql = "SELECT DESCR,UNIT FROM ITEM WHERE ITEM_CODE = ?"; sql = "SELECT DESCR,UNIT FROM ITEM WHERE ITEM_CODE = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, itemCode); pstmt.setString(1, itemCode);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) if (rs.next())
{ {
itemDescr = rs.getString(1); itemDescr = rs.getString(1);
unit = rs.getString(2); unit = rs.getString(2);
} }
pstmt.close(); pstmt.close();
rs.close(); rs.close();
setValueInDom(dom, "item_descr", itemDescr); setValueInDom(dom, "item_descr", itemDescr);
setValueInDom(dom, "unit", unit); setValueInDom(dom, "unit", unit);
// IF WORK ORDER TYPE IS PACKING SET QC_REQD = 'N' EVEN THOUGH RETURN // IF WORK ORDER TYPE IS PACKING SET QC_REQD = 'N' EVEN THOUGH RETURN
sql = " SELECT CASE WHEN AUTO_REQC IS NULL THEN 'N' ELSE AUTO_REQC END, " sql = " SELECT CASE WHEN AUTO_REQC IS NULL THEN 'N' ELSE AUTO_REQC END, "
+ " CASE WHEN QC_REQD IS NULL THEN 'N' ELSE QC_REQD END FROM SITEITEM " + " CASE WHEN QC_REQD IS NULL THEN 'N' ELSE QC_REQD END FROM SITEITEM "
+ " WHERE SITE_CODE = ? AND ITEM_CODE = ?"; + " WHERE SITE_CODE = ? AND ITEM_CODE = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, siteCode);
pstmt.setString(2, itemCode);
rs = pstmt.executeQuery();
if (rs.next())
{
autoQcReqd = rs.getString(1);
qcReqd = rs.getString(2);
}
pstmt.close();
rs.close();
if (autoQcReqd != null && autoQcReqd.equalsIgnoreCase("Y"))
{
qcReqd = "Y";
}
setValueInDom(dom, "qc_reqd", qcReqd);
if ((tranType != null && !tranType.equalsIgnoreCase("R")) || (orderType != null && orderType.equalsIgnoreCase("P")))
{
setValueInDom(dom, "qc_reqd", "N");
}
else
{
// IF AUTO_REQC IS 'YES' IN SITEITEM THEN SET QC_REQD = 'YES'
sql = "SELECT CASE WHEN AUTO_REQC IS NULL THEN 'N' ELSE AUTO_REQC END "
+ " FROM SITEITEM WHERE SITE_CODE = ? AND ITEM_CODE = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, siteCode); pstmt.setString(1, siteCode);
pstmt.setString(2, itemCode); pstmt.setString(2, itemCode);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) if (rs.next())
{ {
autoQcReqd = rs.getString(1); qcReqd = rs.getString(1);
qcReqd = rs.getString(2);
}
pstmt.close();
rs.close();
if (autoQcReqd != null && autoQcReqd.equalsIgnoreCase("Y"))
{
qcReqd = "Y";
}
setValueInDom(dom, "qc_reqd", qcReqd);
if ((tranType != null && !tranType.equalsIgnoreCase("R")) || (orderType != null && orderType.equalsIgnoreCase("P")))
{
setValueInDom(dom, "qc_reqd", "N");
} }
else else
{ {
// IF AUTO_REQC IS 'YES' IN SITEITEM THEN SET QC_REQD = 'YES' sql = "SELECT CASE WHEN QC_REQD IS NULL THEN 'N' ELSE QC_REQD END"
sql = "SELECT CASE WHEN AUTO_REQC IS NULL THEN 'N' ELSE AUTO_REQC END " + " FROM ITEM WHERE ITEM_CODE = ?";
+ " FROM SITEITEM WHERE SITE_CODE = ? AND ITEM_CODE = ?"; pstmt1 = conn.prepareStatement(sql);
pstmt = conn.prepareStatement(sql); pstmt1.setString(1, itemCode);
pstmt.setString(1, siteCode); rs1 = pstmt1.executeQuery();
pstmt.setString(2, itemCode); if (rs1.next())
rs = pstmt.executeQuery();
if (rs.next())
{ {
qcReqd = rs.getString(1); qcReqd = rs.getString(1);
} }
else pstmt1.close();
{ rs1.close();
sql = "SELECT CASE WHEN QC_REQD IS NULL THEN 'N' ELSE QC_REQD END"
+ " FROM ITEM WHERE ITEM_CODE = ?";
pstmt1 = conn.prepareStatement(sql);
pstmt1.setString(1, itemCode);
rs1 = pstmt1.executeQuery();
if (rs1.next())
{
qcReqd = rs.getString(1);
}
pstmt1.close();
rs1.close();
}
pstmt.close();
rs.close();
setValueInDom(dom, "qc_reqd", qcReqd);
} }
if ("R".equals(tranType)) pstmt.close();
{ rs.close();
lineNo = genericUtility.getColumnValue("line_no", dom); setValueInDom(dom, "qc_reqd", qcReqd);
sql = " SELECT SUM(B.QUANTITY) FROM WORKORDER_ISS A, WORKORDER_ISSDET B " }
if ("R".equals(tranType))
{
lineNo = genericUtility.getColumnValue("line_no", dom);
sql = " SELECT SUM(B.QUANTITY) FROM WORKORDER_ISS A, WORKORDER_ISSDET B "
+ " WHERE A.TRAN_ID = B.TRAN_ID AND A.WORK_ORDER = ? AND A.OPERATION = ? " + " WHERE A.TRAN_ID = B.TRAN_ID AND A.WORK_ORDER = ? AND A.OPERATION = ? "
+ " AND B.EXP_LEV = ? AND B.ITEM_CODE = ? " + " AND B.EXP_LEV = ? AND B.ITEM_CODE = ? "
+ " AND ((B.TRAN_ID <> ?) OR (B.TRAN_ID = ? AND B.LINE_NO <> ?))"; + " AND ((B.TRAN_ID <> ?) OR (B.TRAN_ID = ? AND B.LINE_NO <> ?))";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, workOrder); pstmt.setString(1, workOrder);
pstmt.setDouble(2, operation); pstmt.setDouble(2, operation);
pstmt.setString(3, expLev); pstmt.setString(3, expLev);
pstmt.setString(4, itemCode); pstmt.setString(4, itemCode);
pstmt.setString(5, tranId); pstmt.setString(5, tranId);
pstmt.setString(6, tranId); pstmt.setString(6, tranId);
pstmt.setString(7, lineNo); pstmt.setString(7, lineNo);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) if (rs.next())
{ {
issuedQty = rs.getDouble(1); issuedQty = rs.getDouble(1);
}
pstmt.close();
rs.close();
setValueInDom(dom, "quantity", Double.toString(issuedQty));
} }
pstmt.close();
rs.close();
setValueInDom(dom, "quantity", Double.toString(issuedQty));
}
} }
catch (Exception e) { catch (Exception e) {
System.out.println("Exception [WOrderIssueActEJBAct][getItemChanged] :" + e); System.out.println("Exception [WOrderIssueActEJBAct][getItemChanged] :" + e);
...@@ -2564,38 +2563,38 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -2564,38 +2563,38 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
throw e; throw e;
} }
} }
private double getIssueReturnQty(String workOrder, String expLev, String itemCode, String itemCodeRef, String tranType, double operation, String bomCode, Connection conn) private double getIssueReturnQty(String workOrder, String expLev, String itemCode, String itemCodeRef, String tranType, double operation, String bomCode, Connection conn)
{ {
// GETS AND RETURNS THE ISSUED/RETURNED QUANTITY FOR THE // GETS AND RETURNS THE ISSUED/RETURNED QUANTITY FOR THE
// WORK ORDER / EXP_LEV IN THE PROPORTION OF THE MAIN ITEM // WORK ORDER / EXP_LEV IN THE PROPORTION OF THE MAIN ITEM
String sql = "", iCode = null, tranId = null; String sql = "", iCode = null, tranId = null;
double qty = 0, issueReturnQty = 0; double qty = 0, issueReturnQty = 0;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
try try
{ {
if (tranId == null) if (tranId == null)
{ {
tranId = "@"; tranId = "@";
} }
if ("D".equals(tranType)) if ("D".equals(tranType))
{ {
sql = " SELECT A.ITEM_CODE, SUM(CASE WHEN A.QUANTITY IS NULL THEN 0 ELSE A.QUANTITY END + " sql = " SELECT A.ITEM_CODE, SUM(CASE WHEN A.QUANTITY IS NULL THEN 0 ELSE A.QUANTITY END + "
+ " CASE WHEN A.POTENCY_ADJ IS NULL THEN 0 ELSE A.POTENCY_ADJ END) " + " CASE WHEN A.POTENCY_ADJ IS NULL THEN 0 ELSE A.POTENCY_ADJ END) "
+ " FROM WORKORDER_ISSDET A, WORKORDER_ISS B WHERE ( B.TRAN_ID = A.TRAN_ID ) " + " FROM WORKORDER_ISSDET A, WORKORDER_ISS B WHERE ( B.TRAN_ID = A.TRAN_ID ) "
+ " AND ( ( RTRIM(LTRIM(A.EXP_LEV)) = ? ) AND ( B.TRAN_ID <> ? ) AND ( B.TRAN_TYPE <> 'D' ) " + " AND ( ( RTRIM(LTRIM(A.EXP_LEV)) = ? ) AND ( B.TRAN_ID <> ? ) AND ( B.TRAN_TYPE <> 'D' ) "
+ " AND ( B.STATUS <> 'X' ) AND ( B.WORK_ORDER = ? ) )GROUP BY A.ITEM_CODE"; + " AND ( B.STATUS <> 'X' ) AND ( B.WORK_ORDER = ? ) )GROUP BY A.ITEM_CODE";
} }
else else
{ {
sql = " SELECT A.ITEM_CODE, SUM(CASE WHEN A.QUANTITY IS NULL THEN 0 ELSE A.QUANTITY END + " sql = " SELECT A.ITEM_CODE, SUM(CASE WHEN A.QUANTITY IS NULL THEN 0 ELSE A.QUANTITY END + "
+ " CASE WHEN A.POTENCY_ADJ IS NULL THEN 0 ELSE A.POTENCY_ADJ END) " + " CASE WHEN A.POTENCY_ADJ IS NULL THEN 0 ELSE A.POTENCY_ADJ END) "
+ " FROM WORKORDER_ISSDET A, WORKORDER_ISS B WHERE ( B.TRAN_ID = A.TRAN_ID ) " + " FROM WORKORDER_ISSDET A, WORKORDER_ISS B WHERE ( B.TRAN_ID = A.TRAN_ID ) "
+ " AND ( ( RTRIM(LTRIM(A.EXP_LEV)) = ? ) AND ( B.TRAN_ID <> ? ) AND ( B.TRAN_TYPE <> 'R' ) " + " AND ( ( RTRIM(LTRIM(A.EXP_LEV)) = ? ) AND ( B.TRAN_ID <> ? ) AND ( B.TRAN_TYPE <> 'R' ) "
+ " AND ( B.STATUS <> 'X' ) AND ( B.WORK_ORDER = ? ) )GROUP BY A.ITEM_CODE"; + " AND ( B.STATUS <> 'X' ) AND ( B.WORK_ORDER = ? ) )GROUP BY A.ITEM_CODE";
} }
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, expLev); pstmt.setString(1, expLev);
...@@ -2625,7 +2624,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -2625,7 +2624,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
} }
return issueReturnQty; return issueReturnQty;
} }
private double getPendingQty(String workOrder, double operation, String expLev, Connection conn) private double getPendingQty(String workOrder, double operation, String expLev, Connection conn)
{ {
String sql = ""; String sql = "";
...@@ -2633,7 +2632,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -2633,7 +2632,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
double qty = 0,pendingQty = 0, issuedQty = 0, returnedQty = 0, issuedQtyDev = 0; double qty = 0,pendingQty = 0, issuedQty = 0, returnedQty = 0, issuedQtyDev = 0;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
try try
{ {
sql = "SELECT BOM_CODE FROM WORKORDER WHERE WORK_ORDER = ?"; sql = "SELECT BOM_CODE FROM WORKORDER WHERE WORK_ORDER = ?";
...@@ -2647,8 +2646,8 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -2647,8 +2646,8 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
pstmt.close(); pstmt.close();
rs.close(); rs.close();
sql = " SELECT ITEM_CODE__REF, ITEM_CODE, (CASE WHEN QUANTITY IS NULL THEN 0 ELSE QUANTITY END + " sql = " SELECT ITEM_CODE__REF, ITEM_CODE, (CASE WHEN QUANTITY IS NULL THEN 0 ELSE QUANTITY END + "
+ " CASE WHEN POTENCY_ADJ IS NULL THEN 0 ELSE POTENCY_ADJ END) FROM WORKORDER_BILL " + " CASE WHEN POTENCY_ADJ IS NULL THEN 0 ELSE POTENCY_ADJ END) FROM WORKORDER_BILL "
+ " WHERE WORK_ORDER = ? AND OPERATION = ? AND RTRIM(LTRIM(EXP_LEV)) = ?"; + " WHERE WORK_ORDER = ? AND OPERATION = ? AND RTRIM(LTRIM(EXP_LEV)) = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, workOrder); pstmt.setString(1, workOrder);
pstmt.setDouble(2, operation); pstmt.setDouble(2, operation);
...@@ -2662,11 +2661,11 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -2662,11 +2661,11 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
} }
pstmt.close(); pstmt.close();
rs.close(); rs.close();
issuedQty = getIssueReturnQty(workOrder, expLev, itemCode, itemCodeRef, "I", operation, bomCode, conn); issuedQty = getIssueReturnQty(workOrder, expLev, itemCode, itemCodeRef, "I", operation, bomCode, conn);
returnedQty = getIssueReturnQty(workOrder, expLev, itemCode, itemCodeRef, "I", operation, bomCode, conn); returnedQty = getIssueReturnQty(workOrder, expLev, itemCode, itemCodeRef, "I", operation, bomCode, conn);
issuedQtyDev = getIssueReturnQty(workOrder, expLev, itemCode, itemCodeRef, "I", operation, bomCode, conn); issuedQtyDev = getIssueReturnQty(workOrder, expLev, itemCode, itemCodeRef, "I", operation, bomCode, conn);
pendingQty = qty + issuedQtyDev - issuedQty + returnedQty; pendingQty = qty + issuedQtyDev - issuedQty + returnedQty;
} }
...@@ -2677,18 +2676,18 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -2677,18 +2676,18 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
} }
return pendingQty; return pendingQty;
} }
private double getProportionateQty(String bomCode,double operation,String itemCode,String itemCodeRef,String altItem,double balanceQtyAlt, Connection conn) private double getProportionateQty(String bomCode,double operation,String itemCode,String itemCodeRef,String altItem,double balanceQtyAlt, Connection conn)
{ {
double proportateQty = 0, qtyPerBom = 0, qtyPerAlt = 0; double proportateQty = 0, qtyPerBom = 0, qtyPerAlt = 0;
String sql = null; String sql = null;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
try try
{ {
sql = " SELECT QTY_PER FROM BOMDET WHERE BOM_CODE = ? AND OPERATION = ? " sql = " SELECT QTY_PER FROM BOMDET WHERE BOM_CODE = ? AND OPERATION = ? "
+ " AND ITEM_CODE = ? AND ITEM_REF = ?"; + " AND ITEM_CODE = ? AND ITEM_REF = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, bomCode); pstmt.setString(1, bomCode);
pstmt.setDouble(2, operation); pstmt.setDouble(2, operation);
...@@ -2701,9 +2700,9 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -2701,9 +2700,9 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
} }
pstmt.close(); pstmt.close();
rs.close(); rs.close();
sql = " SELECT QUANTITY FROM BOM_ALT WHERE BOM_CODE = ? AND ITEM_CODE = ? AND ITEM_REF = ? " sql = " SELECT QUANTITY FROM BOM_ALT WHERE BOM_CODE = ? AND ITEM_CODE = ? AND ITEM_REF = ? "
+ " AND ITEM_CODE__ALT = ?"; + " AND ITEM_CODE__ALT = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, bomCode); pstmt.setString(1, bomCode);
pstmt.setString(2, itemCode); pstmt.setString(2, itemCode);
...@@ -2716,7 +2715,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -2716,7 +2715,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
} }
pstmt.close(); pstmt.close();
rs.close(); rs.close();
if (Math.abs(qtyPerAlt) > 0 && Math.abs(balanceQtyAlt) > 0) if (Math.abs(qtyPerAlt) > 0 && Math.abs(balanceQtyAlt) > 0)
{ {
proportateQty = qtyPerBom / qtyPerAlt * balanceQtyAlt; proportateQty = qtyPerBom / qtyPerAlt * balanceQtyAlt;
...@@ -2735,7 +2734,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -2735,7 +2734,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
} }
private String setNoArt(String siteCode, String itemCode, String locCode, String lotNo, String lotSl, String expLev, double quantity, String tranType, double gWeight, Connection conn) private String setNoArt(String siteCode, String itemCode, String locCode, String lotNo, String lotSl, String expLev, double quantity, String tranType, double gWeight, Connection conn)
{ {
// WEIGHT TO BE SET IN DETAIL -- 1. GET FROM PACKING DETAILS -- 2. IF NO PACKING GET FROM STOCK // WEIGHT TO BE SET IN DETAIL -- 1. GET FROM PACKING DETAILS -- 2. IF NO PACKING GET FROM STOCK
long stkNoArt = 0; long stkNoArt = 0;
double inputQty = 0, stockQty = 0, stkGrossWt = 0, stkNetWt = 0, stkTareWt = 0, grossWeight = 0; double inputQty = 0, stockQty = 0, stkGrossWt = 0, stkNetWt = 0, stkTareWt = 0, grossWeight = 0;
double tareWeight = 0, netWeight = 0, noArt = 0; double tareWeight = 0, netWeight = 0, noArt = 0;
...@@ -2745,7 +2744,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -2745,7 +2744,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
ResultSet rs = null, rs1 = null; ResultSet rs = null, rs1 = null;
String sql = ""; String sql = "";
StringBuffer retString = new StringBuffer(); StringBuffer retString = new StringBuffer();
try try
{ {
sql = "SELECT CASE WHEN ISS_CRITERIA IS NULL THEN 'I' ELSE ISS_CRITERIA END FROM ITEM WHERE ITEM_CODE = ?"; sql = "SELECT CASE WHEN ISS_CRITERIA IS NULL THEN 'I' ELSE ISS_CRITERIA END FROM ITEM WHERE ITEM_CODE = ?";
...@@ -2758,12 +2757,12 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -2758,12 +2757,12 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
} }
pstmt.close(); pstmt.close();
rs.close(); rs.close();
// BASED ON NEW COLUMN VALUES IN STOCK TO BE CALCULATED // BASED ON NEW COLUMN VALUES IN STOCK TO BE CALCULATED
if (!tranType.equalsIgnoreCase("R")) if (!tranType.equalsIgnoreCase("R"))
{ {
sql = " SELECT QUANTITY, GROSS_WEIGHT, NET_WEIGHT, TARE_WEIGHT, NO_ART, QTY_PER_ART, " sql = " SELECT QUANTITY, GROSS_WEIGHT, NET_WEIGHT, TARE_WEIGHT, NO_ART, QTY_PER_ART, "
+ " GROSS_WT_PER_ART, TARE_WT_PER_ART FROM STOCK WHERE ITEM_CODE = ? AND SITE_CODE = ? " + " GROSS_WT_PER_ART, TARE_WT_PER_ART FROM STOCK WHERE ITEM_CODE = ? AND SITE_CODE = ? "
+ " AND LOC_CODE = ? AND LOT_NO = ? AND LOT_SL = ?"; + " AND LOC_CODE = ? AND LOT_NO = ? AND LOT_SL = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, itemCode); pstmt.setString(1, itemCode);
pstmt.setString(2, siteCode); pstmt.setString(2, siteCode);
...@@ -2775,7 +2774,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -2775,7 +2774,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
System.out.println("itemCode :: " + itemCode + " siteCode :: " + siteCode); System.out.println("itemCode :: " + itemCode + " siteCode :: " + siteCode);
System.out.println("locCode :: " + locCode + " lotNo :: " + lotNo); System.out.println("locCode :: " + locCode + " lotNo :: " + lotNo);
System.out.println("lotSl :: " + lotSl); System.out.println("lotSl :: " + lotSl);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) if (rs.next())
{ {
...@@ -2794,7 +2793,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -2794,7 +2793,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
System.out.println("stkNetWt :: " + stkNetWt + " stkTareWt :: " + stkTareWt); System.out.println("stkNetWt :: " + stkNetWt + " stkTareWt :: " + stkTareWt);
System.out.println("qtyPerArt :: " + qtyPerArt + " grossWtPerArt :: " + grossWtPerArt); System.out.println("qtyPerArt :: " + qtyPerArt + " grossWtPerArt :: " + grossWtPerArt);
System.out.println("tareWtPerArt :: " + tareWtPerArt); System.out.println("tareWtPerArt :: " + tareWtPerArt);
inputQty = quantity; inputQty = quantity;
System.out.println("inputQty if trantype not \"R\" = " + inputQty); System.out.println("inputQty if trantype not \"R\" = " + inputQty);
...@@ -2828,10 +2827,10 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -2828,10 +2827,10 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
} }
else else
{ {
// GET THE WEIGHT/ARTICLE DETAILS FROM THE CORRESPONDING ISSUE AND CALCULATE ACCORDINGLY // GET THE WEIGHT/ARTICLE DETAILS FROM THE CORRESPONDING ISSUE AND CALCULATE ACCORDINGLY
sql = " SELECT A.LOC_CODE FROM WORKORDER_ISSDET A, WORKORDER_ISS B " sql = " SELECT A.LOC_CODE FROM WORKORDER_ISSDET A, WORKORDER_ISS B "
+ " WHERE A.TRAN_ID = B.TRAN_ID AND B.SITE_CODE = ? AND A.ITEM_CODE = ? AND A.LOT_NO = ? " + " WHERE A.TRAN_ID = B.TRAN_ID AND B.SITE_CODE = ? AND A.ITEM_CODE = ? AND A.LOT_NO = ? "
+ " AND A.LOT_SL = ? AND A.EXP_LEV = ?"; + " AND A.LOT_SL = ? AND A.EXP_LEV = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, siteCode); pstmt.setString(1, siteCode);
pstmt.setString(2, itemCode); pstmt.setString(2, itemCode);
...@@ -2852,8 +2851,8 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -2852,8 +2851,8 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
else else
{ {
sql = " SELECT A.LOC_CODE FROM WORKORDER_ISSDET A, WORKORDER_ISS B " sql = " SELECT A.LOC_CODE FROM WORKORDER_ISSDET A, WORKORDER_ISS B "
+ " WHERE A.TRAN_ID = B.TRAN_ID AND B.SITE_CODE = ? AND A.ITEM_CODE = ? " + " WHERE A.TRAN_ID = B.TRAN_ID AND B.SITE_CODE = ? AND A.ITEM_CODE = ? "
+ " AND A.LOT_NO = ? AND A.EXP_LEV = ?"; + " AND A.LOT_NO = ? AND A.EXP_LEV = ?";
pstmt1 = conn.prepareStatement(sql); pstmt1 = conn.prepareStatement(sql);
pstmt1.setString(1, siteCode); pstmt1.setString(1, siteCode);
pstmt1.setString(2, itemCode); pstmt1.setString(2, itemCode);
...@@ -2873,10 +2872,10 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -2873,10 +2872,10 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
} }
pstmt.close(); pstmt.close();
rs.close(); rs.close();
sql = " SELECT QUANTITY, GROSS_WEIGHT, NET_WEIGHT, TARE_WEIGHT, NO_ART, QTY_PER_ART, " sql = " SELECT QUANTITY, GROSS_WEIGHT, NET_WEIGHT, TARE_WEIGHT, NO_ART, QTY_PER_ART, "
+ " GROSS_WT_PER_ART, TARE_WT_PER_ART FROM STOCK WHERE ITEM_CODE = ? AND SITE_CODE = ? " + " GROSS_WT_PER_ART, TARE_WT_PER_ART FROM STOCK WHERE ITEM_CODE = ? AND SITE_CODE = ? "
+ " AND LOC_CODE = ? AND LOT_NO = ? AND LOT_SL = ?"; + " AND LOC_CODE = ? AND LOT_NO = ? AND LOT_SL = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, itemCode); pstmt.setString(1, itemCode);
pstmt.setString(2, siteCode); pstmt.setString(2, siteCode);
...@@ -2950,7 +2949,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -2950,7 +2949,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
return retString.toString(); return retString.toString();
} }
// added by chandni shah - 21-Dec-2011 // added by chandni shah - 21-Dec-2011
public double getReqDecimal(double actVal, int prec) public double getReqDecimal(double actVal, int prec)
{ {
String fmtStr = "############0"; String fmtStr = "############0";
...@@ -2970,7 +2969,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -2970,7 +2969,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
} }
@Override @Override
public ArrayList getDetails(String woCode) throws ITMException public ArrayList getDetails(String woCode) throws ITMException
{ {
PreparedStatement pstmt = null, pstmt1 = null; PreparedStatement pstmt = null, pstmt1 = null;
ResultSet rs = null; ResultSet rs = null;
Connection conn = null; Connection conn = null;
...@@ -2988,7 +2987,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -2988,7 +2987,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
conn = connDriver.getConnectDB("DriverITM"); conn = connDriver.getConnectDB("DriverITM");
conn.setAutoCommit(false); conn.setAutoCommit(false);
connDriver = null; connDriver = null;
sql = "SELECT FN_SYSDATE() FROM DUAL"; sql = "SELECT FN_SYSDATE() FROM DUAL";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
...@@ -2999,26 +2998,26 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -2999,26 +2998,26 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
System.out.println("Current Date::::::"+currDate); System.out.println("Current Date::::::"+currDate);
rs.close(); rs.close();
pstmt.close(); pstmt.close();
if(woCode!=null) if(woCode!=null)
{ {
sql =" select b.item_code,b.descr,a.site_code,c.req_type, sum(c.qty_per) qty_per, " sql =" select b.item_code,b.descr,a.site_code,c.req_type, sum(c.qty_per) qty_per, "
+ " sum(c.min_qty), a.quantity,d.batch_qty from workorder a ,item b, bomdet c, bom d " + " sum(c.min_qty), a.quantity,d.batch_qty from workorder a ,item b, bomdet c, bom d "
+" where c.item_code = b.item_code " +" where c.item_code = b.item_code "
+ " and c.bom_code = a.bom_code " + " and c.bom_code = a.bom_code "
+ " and d.bom_code = a.bom_code " + " and d.bom_code = a.bom_code "
+" and a.work_order = ? " +" and a.work_order = ? "
+ " group by b.item_code,b.descr,a.site_code,c.req_type, a.quantity,d.batch_qty "; + " group by b.item_code,b.descr,a.site_code,c.req_type, a.quantity,d.batch_qty ";
System.out.println("MainQuery:::"+sql); System.out.println("MainQuery:::"+sql);
pstmt1 = conn.prepareStatement(sql); pstmt1 = conn.prepareStatement(sql);
pstmt1.setString(1,woCode); pstmt1.setString(1,woCode);
rs = pstmt1.executeQuery(); rs = pstmt1.executeQuery();
while(rs.next()) while(rs.next())
{ {
itemCode = rs.getString(1); itemCode = rs.getString(1);
thisBean = new woStockDtlParams(); thisBean = new woStockDtlParams();
thisBean.itemCode = rs.getString(1); thisBean.itemCode = rs.getString(1);
thisBean.descr = rs.getString(2); thisBean.descr = rs.getString(2);
...@@ -3028,7 +3027,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -3028,7 +3027,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
minQty = rs.getDouble(6); minQty = rs.getDouble(6);
woQty = rs.getDouble(7); woQty = rs.getDouble(7);
batchQty = rs.getDouble(8); batchQty = rs.getDouble(8);
if ("S".equals(reqType)) if ("S".equals(reqType))
{ {
thisBean.qtyPer = woQty / batchQty * rs.getDouble(5); thisBean.qtyPer = woQty / batchQty * rs.getDouble(5);
...@@ -3052,7 +3051,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -3052,7 +3051,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
rs1.close(); rs1.close();
StringBuffer sb = new StringBuffer(); StringBuffer sb = new StringBuffer();
sb.append("select nvl(sum(a.quantity - a.alloc_qty),0), nvl(sum(a.alloc_qty),0) from stock a, invstat b " sb.append("select nvl(sum(a.quantity - a.alloc_qty),0), nvl(sum(a.alloc_qty),0) from stock a, invstat b "
+" where a.inv_stat = b.inv_stat and a.item_code = ? and a.site_code in (select site_code from site where geo_loc in ( select geo_loc from site where site_code = ? )) and b.available = 'Y' and b.stat_type <> 'S' and b.plan_prod = 'Y' and (a.quantity - nvl(a.alloc_qty,0)) > 0 " ); +" where a.inv_stat = b.inv_stat and a.item_code = ? and a.site_code in (select site_code from site where geo_loc in ( select geo_loc from site where site_code = ? )) and b.available = 'Y' and b.stat_type <> 'S' and b.plan_prod = 'Y' and (a.quantity - nvl(a.alloc_qty,0)) > 0 " );
if(trackShelfLife != null && trackShelfLife.equalsIgnoreCase("Y")) if(trackShelfLife != null && trackShelfLife.equalsIgnoreCase("Y"))
{ {
sb.append("and ( a.exp_date is null or a.exp_date >?)"); sb.append("and ( a.exp_date is null or a.exp_date >?)");
...@@ -3072,10 +3071,10 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -3072,10 +3071,10 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
} }
rs1.close(); rs1.close();
rs1 = null; rs1 = null;
StringBuffer sbn = new StringBuffer(); StringBuffer sbn = new StringBuffer();
sbn.append(" select nvl(sum(a.quantity - a.alloc_qty),0), nvl(sum(a.alloc_qty),0) from stock a, invstat b " sbn.append(" select nvl(sum(a.quantity - a.alloc_qty),0), nvl(sum(a.alloc_qty),0) from stock a, invstat b "
+" where a.inv_stat = b.inv_stat and a.item_code = ? and a.site_code in (select site_code from site where geo_loc in ( select geo_loc from site where site_code = ? )) and b.available = 'N' and b.stat_type <> 'S' and (a.quantity - nvl(a.alloc_qty,0)) > 0 " ); +" where a.inv_stat = b.inv_stat and a.item_code = ? and a.site_code in (select site_code from site where geo_loc in ( select geo_loc from site where site_code = ? )) and b.available = 'N' and b.stat_type <> 'S' and (a.quantity - nvl(a.alloc_qty,0)) > 0 " );
if(trackShelfLife.equalsIgnoreCase("Y")) if(trackShelfLife.equalsIgnoreCase("Y"))
{ {
sbn.append("and ( a.exp_date is null or a.exp_date >?)"); sbn.append("and ( a.exp_date is null or a.exp_date >?)");
...@@ -3083,7 +3082,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -3083,7 +3082,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
pstmt = conn.prepareStatement(sbn.toString()); pstmt = conn.prepareStatement(sbn.toString());
pstmt.setString(1,itemCode); pstmt.setString(1,itemCode);
pstmt.setString(2,siteCode); pstmt.setString(2,siteCode);
if(trackShelfLife.equalsIgnoreCase("Y")) if(trackShelfLife.equalsIgnoreCase("Y"))
{ {
pstmt.setTimestamp(3,currDate); pstmt.setTimestamp(3,currDate);
...@@ -3096,7 +3095,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -3096,7 +3095,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
} }
rs1.close(); rs1.close();
rs1 = null; rs1 = null;
stkWoList.add(thisBean); stkWoList.add(thisBean);
} }
pstmt1.close(); pstmt1.close();
...@@ -3134,7 +3133,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -3134,7 +3133,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
} }
return stkWoList; return stkWoList;
} }
class woStockDtlParams implements Serializable class woStockDtlParams implements Serializable
{ {
HashMap BOMStockMap = new HashMap(); HashMap BOMStockMap = new HashMap();
......
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