Commit 972aa553 authored by prane's avatar prane

Sales order near expiry logic to be corrected

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@204457 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 09c16a84
...@@ -9666,8 +9666,11 @@ public class SalesOrderIC extends ValidatorEJB implements SalesOrderICLocal, Sal ...@@ -9666,8 +9666,11 @@ public class SalesOrderIC extends ValidatorEJB implements SalesOrderICLocal, Sal
lsNoapplyCustList = "", lsApplicableordtypes = "", lsPrevscheme = ""; lsNoapplyCustList = "", lsApplicableordtypes = "", lsPrevscheme = "";
String lsCustSchemeCode = "", lcIntegralQty = "", lsItemStru = "", lsDisPobOrdtypeList = "", String lsCustSchemeCode = "", lcIntegralQty = "", lsItemStru = "", lsDisPobOrdtypeList = "",
lsPackCode = "", toStation = "", frStation = "", lsTaxChapHdr = ""; lsPackCode = "", toStation = "", frStation = "", lsTaxChapHdr = "";
String lsTaxClassHdr = "", lsTaxEnvHdr = "", lcMinShelfLife = "", llMaxShelfLifeDet = "", //Pavan Rane 31jul19 start [Sales order near expiry logic - corrected]
lsSorder = "", lcMinLifePerc = "", llShelfLife = "", llMaxShelfLife = ""; String lsTaxClassHdr = "", lsTaxEnvHdr = "";// lcMinShelfLife = "", llMaxShelfLifeDet = "",
String lsSorder = "";//, lcMinLifePerc = "", llShelfLife = "", llMaxShelfLife = "";
double lcMinShelfLife = 0, llMaxShelfLifeDet = 0, lcMinLifePerc = 0, llShelfLife = 0, llMaxShelfLife = 0;
//Pavan Rane 31jul19 end [Sales order near expiry logic - corrected]
String lsSalesOrderType = "", lsVarvalue = "", lcStkQty = "", lsApplseg = ""; String lsSalesOrderType = "", lsVarvalue = "", lcStkQty = "", lsApplseg = "";
String ldtDateStr = ""; String ldtDateStr = "";
boolean lbProceed = false, lbOrdFlag = false; boolean lbProceed = false, lbOrdFlag = false;
...@@ -10372,33 +10375,37 @@ public class SalesOrderIC extends ValidatorEJB implements SalesOrderICLocal, Sal ...@@ -10372,33 +10375,37 @@ public class SalesOrderIC extends ValidatorEJB implements SalesOrderICLocal, Sal
valueXmlString.append("<tax_env>").append("<![CDATA[" + lsTaxEnv + "]]>").append("</tax_env>"); valueXmlString.append("<tax_env>").append("<![CDATA[" + lsTaxEnv + "]]>").append("</tax_env>");
setNodeValue(dom, "tax_env", getAbsString(lsTaxEnv)); setNodeValue(dom, "tax_env", getAbsString(lsTaxEnv));
lcMinShelfLife = checkNull(genericUtility.getColumnValue("min_shelf_life", dom1)); //Pavan Rane 31jul19 Start [Changes for Sales order near expiry logic to be corrected]
llMaxShelfLifeDet = checkNull(genericUtility.getColumnValue("max_shelf_life", dom1)); //lcMinShelfLife = checkNull(genericUtility.getColumnValue("min_shelf_life", dom1));
//llMaxShelfLifeDet = checkNull(genericUtility.getColumnValue("max_shelf_life", dom1));
lcMinShelfLife = checkDoubleNull(genericUtility.getColumnValue("min_shelf_life", dom));
llMaxShelfLifeDet = checkDoubleNull(genericUtility.getColumnValue("max_shelf_life", dom));
lsSorder = checkNull(genericUtility.getColumnValue("sale_order", dom1)); lsSorder = checkNull(genericUtility.getColumnValue("sale_order", dom1));
lsPlistDisc = checkNull(genericUtility.getColumnValue("price_list__disc", dom1)); lsPlistDisc = checkNull(genericUtility.getColumnValue("price_list__disc", dom1));
if (lcMinShelfLife == 0) //if (lcMinShelfLife == null || lcMinShelfLife.trim().length() == 0) {
if (lcMinShelfLife == null || lcMinShelfLife.trim().length() == 0) { {
sql = "select min_shelf_life ,max_shelf_life from sordertype where order_type =?"; sql = "select min_shelf_life ,max_shelf_life from sordertype where order_type =?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, lsOrderType); pstmt.setString(1, lsOrderType);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) { if (rs.next()) {
lcMinShelfLife = rs.getString("min_shelf_life"); lcMinShelfLife = rs.getDouble("min_shelf_life"); //rs.getString("min_shelf_life");
llMaxShelfLifeDet = rs.getString("max_shelf_life"); llMaxShelfLifeDet = rs.getDouble("max_shelf_life"); //rs.getString("max_shelf_life");
} }
rs.close(); rs.close();
rs = null; rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
if (lcMinShelfLife == null || lcMinShelfLife.trim().length() == 0) { if (lcMinShelfLife == 0) //if (lcMinShelfLife == null || lcMinShelfLife.trim().length() == 0) {
sql = "select min_shelf_life from customeritem where cust_code = ? and item_code = ?"; {
sql = "select min_shelf_life from customeritem where cust_code = ? and item_code = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, lsCustCode); pstmt.setString(1, lsCustCode);
pstmt.setString(2, itemCodeOrd); pstmt.setString(2, itemCodeOrd);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) { if (rs.next()) {
lcMinShelfLife = rs.getString("min_shelf_life"); lcMinShelfLife = rs.getDouble("min_shelf_life"); //lcMinShelfLife = rs.getString("min_shelf_life");
// llMaxShelfLifeDet = rs.getString("max_shelf_life"); // llMaxShelfLifeDet = rs.getString("max_shelf_life");
} }
rs.close(); rs.close();
...@@ -10406,65 +10413,76 @@ public class SalesOrderIC extends ValidatorEJB implements SalesOrderICLocal, Sal ...@@ -10406,65 +10413,76 @@ public class SalesOrderIC extends ValidatorEJB implements SalesOrderICLocal, Sal
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
if (lcMinShelfLife == null || lcMinShelfLife.trim().length() == 0) { if (lcMinShelfLife == 0) //if (lcMinShelfLife == null || lcMinShelfLife.trim().length() == 0) {
{
sql = "select case when min_shelf_perc is null then 0 else min_shelf_perc end as min_shelf_perc " sql = "select case when min_shelf_perc is null then 0 else min_shelf_perc end as min_shelf_perc "
+ " from customer_series where cust_code = ? and item_ser = ?"; + " from customer_series where cust_code = ? and item_ser = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, lsCustCode); pstmt.setString(1, lsCustCode);
pstmt.setString(2, mItemSer); pstmt.setString(2, mItemSer);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) { if (rs.next()) {
lcMinLifePerc = rs.getString("min_shelf_perc"); lcMinLifePerc = rs.getDouble("min_shelf_perc"); //lcMinLifePerc = rs.getString("min_shelf_perc");
} }
rs.close(); rs.close();
rs = null; rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
if (lcMinLifePerc != null || lcMinLifePerc.trim().length() > 0) { if (lcMinLifePerc > 0) //if (lcMinLifePerc != null || lcMinLifePerc.trim().length() > 0) {
{
sql = "select (case when shelf_life is null then 0 else shelf_life end ) as shelf_life from item where item_code = ?"; sql = "select (case when shelf_life is null then 0 else shelf_life end ) as shelf_life from item where item_code = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, itemCodeOrd); pstmt.setString(1, itemCodeOrd);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) { if (rs.next()) {
llShelfLife = rs.getString("shelf_life"); llShelfLife = rs.getDouble("shelf_life"); //llShelfLife = rs.getString("shelf_life");
} }
rs.close(); rs.close();
rs = null; rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
if (llShelfLife > 0)
{
lcMinShelfLife = Math.round((lcMinLifePerc / 100) * llShelfLife);
llMaxShelfLife = llShelfLife;
}
} }
llShelfLife = (llShelfLife == null || llShelfLife.trim().length() == 0) ? "0" : llShelfLife; /*llShelfLife = (llShelfLife == null || llShelfLife.trim().length() == 0) ? "0" : llShelfLife;
if (Integer.parseInt(llShelfLife) > 0) { if (Integer.parseInt(llShelfLife) > 0)
lcMinShelfLife = String if (llShelfLife > 0)
.valueOf(Math.round((Double.parseDouble(checkDouble(lcMinLifePerc)) / 100) {
* Double.parseDouble(checkDouble(llShelfLife)))); /*lcMinShelfLife = String.valueOf(Math.round((Double.parseDouble(checkDouble(lcMinLifePerc)) / 100)* Double.parseDouble(checkDouble(llShelfLife))));
lcMinShelfLife = Math.round((lcMinLifePerc / 100) * llShelfLife);
llMaxShelfLife = llShelfLife; llMaxShelfLife = llShelfLife;
} else { } else {
lcMinShelfLife = "0"; lcMinShelfLife = 0; //"0";
llMaxShelfLife = "0"; llMaxShelfLife = 0; //"0";
} }*/
if (lcMinShelfLife == null || lcMinShelfLife.trim().length() == 0) { //if (lcMinShelfLife == null || lcMinShelfLife.trim().length() == 0) {
if (lcMinShelfLife == 0)
{
sql = "select min_shelf_life from customer where cust_code =?"; sql = "select min_shelf_life from customer where cust_code =?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, lsCustCode); pstmt.setString(1, lsCustCode);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) { if (rs.next()) {
lcMinShelfLife = rs.getString("min_shelf_life"); lcMinShelfLife = rs.getDouble("min_shelf_life"); //lcMinShelfLife = rs.getString("min_shelf_life");
} }
rs.close(); rs.close();
rs = null; rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
if (lcMinShelfLife == 0)//if (lcMinShelfLife == null || lcMinShelfLife.trim().length() == 0) {
if (lcMinShelfLife == null || lcMinShelfLife.trim().length() == 0) { {
sql = "select min_shelf_life from item where item_code =?"; sql = "select min_shelf_life from item where item_code =?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, itemCodeOrd); pstmt.setString(1, itemCodeOrd);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) { if (rs.next()) {
lcMinShelfLife = rs.getString("min_shelf_life"); //lcMinShelfLife = rs.getString("min_shelf_life");
lcMinShelfLife = rs.getDouble("min_shelf_life");
} }
rs.close(); rs.close();
rs = null; rs = null;
...@@ -10473,7 +10491,7 @@ public class SalesOrderIC extends ValidatorEJB implements SalesOrderICLocal, Sal ...@@ -10473,7 +10491,7 @@ public class SalesOrderIC extends ValidatorEJB implements SalesOrderICLocal, Sal
} }
//---Commented conditions by Jaffar S as suggested by SM Sir on 29-01-2019 //---Commented conditions by Jaffar S as suggested by SM Sir on 29-01-2019
//if (lsPriceListDisc != null && lsPriceListDisc.trim().length() > 0) { //if (lsPriceListDisc != null && lsPriceListDisc.trim().length() > 0) {
sql = "select order_type from sorder where sale_order =?"; /*sql = "select order_type from sorder where sale_order =?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, lsSaleOrd); pstmt.setString(1, lsSaleOrd);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
...@@ -10483,44 +10501,47 @@ public class SalesOrderIC extends ValidatorEJB implements SalesOrderICLocal, Sal ...@@ -10483,44 +10501,47 @@ public class SalesOrderIC extends ValidatorEJB implements SalesOrderICLocal, Sal
rs.close(); rs.close();
rs = null; rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;*/
//if ("NE".equalsIgnoreCase(lsSalesOrderType)) {
if ("NE".equalsIgnoreCase(lsSalesOrderType)) { if ("NE".equalsIgnoreCase(lsOrderType))
sql = "select (case when no_sales_month is null then 0 else no_sales_month end) as no_sales_month from item where item_code =?"; {
pstmt = conn.prepareStatement(sql); sql = "select (case when no_sales_month is null then 0 else no_sales_month end) as no_sales_month from item where item_code =?";
pstmt.setString(1, lsSaleOrd); pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery(); pstmt.setString(1, lsSaleOrd);
if (rs.next()) { rs = pstmt.executeQuery();
llMaxShelfLife = rs.getString("no_sales_month"); if (rs.next()) {
} llMaxShelfLife = rs.getInt("no_sales_month"); //llMaxShelfLife = rs.getString("no_sales_month");
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if (Double.parseDouble(checkDouble(llMaxShelfLife)) == 0) {
lsVarvalue = distCommon.getDisparams("999999", "NEAR_EXP_SHELF_LIFE", conn);
if (lsVarvalue == null || lsVarvalue.trim().length() == 0
|| lsVarvalue.equalsIgnoreCase("NULLFOUND")) {
llMaxShelfLife = lsVarvalue;
}
}
String llTemp = llMaxShelfLife;
llMaxShelfLife = lcMinShelfLife;
lcMinShelfLife = llTemp;
} else {
llMaxShelfLife = "";
} }
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if (llMaxShelfLife == 0) //if (Double.parseDouble(checkDouble(llMaxShelfLife)) == 0)
{
lsVarvalue = distCommon.getDisparams("999999", "NEAR_EXP_SHELF_LIFE", conn);
//if (lsVarvalue == null || lsVarvalue.trim().length() == 0 || lsVarvalue.equalsIgnoreCase("NULLFOUND")) {
if (lsVarvalue != null && lsVarvalue.trim().length() > 0 )
{
llMaxShelfLife = checkDoubleNull(lsVarvalue); //llMaxShelfLife = lsVarvalue;
}
}
double llTemp = llMaxShelfLife;
llMaxShelfLife = lcMinShelfLife;
lcMinShelfLife = llTemp;
} else
{
llMaxShelfLife = 0;
}
//} //}
if (Double.parseDouble(checkDouble(llMaxShelfLifeDet)) > 0) { //if (Double.parseDouble(checkDouble(llMaxShelfLifeDet)) > 0) {
//Pavan Rane 31jul19 End [Changes for Sales order near expiry logic to be corrected]
if (llMaxShelfLifeDet > 0) {
llMaxShelfLife = llMaxShelfLifeDet; llMaxShelfLife = llMaxShelfLifeDet;
} }
valueXmlString.append("<min_shelf_life>").append("<![CDATA[" + lcMinShelfLife + "]]>") valueXmlString.append("<min_shelf_life>").append("<![CDATA[" + lcMinShelfLife + "]]>").append("</min_shelf_life>");
.append("</min_shelf_life>"); setNodeValue(dom, "min_shelf_life", String.valueOf(lcMinShelfLife));
setNodeValue(dom, "min_shelf_life", getAbsString(lcMinShelfLife)); valueXmlString.append("<max_shelf_life>").append("<![CDATA[" + llMaxShelfLife + "]]>").append("</max_shelf_life>");
valueXmlString.append("<max_shelf_life>").append("<![CDATA[" + llMaxShelfLife + "]]>") setNodeValue(dom, "max_shelf_life", String.valueOf(llMaxShelfLife));
.append("</max_shelf_life>");
setNodeValue(dom, "max_shelf_life", getAbsString(llMaxShelfLife));
if ((CommonConstants.DB_NAME).equalsIgnoreCase("mssql")) { if ((CommonConstants.DB_NAME).equalsIgnoreCase("mssql")) {
sql = "select [dbo].fn_get_itmstk(?, ?) as lc_stk_qty from dual"; sql = "select [dbo].fn_get_itmstk(?, ?) as lc_stk_qty from dual";
...@@ -10540,8 +10561,8 @@ public class SalesOrderIC extends ValidatorEJB implements SalesOrderICLocal, Sal ...@@ -10540,8 +10561,8 @@ public class SalesOrderIC extends ValidatorEJB implements SalesOrderICLocal, Sal
pstmt = null; pstmt = null;
valueXmlString.append("<stk_qty>").append("<![CDATA[" + lcStkQty + "]]>").append("</stk_qty>"); valueXmlString.append("<stk_qty>").append("<![CDATA[" + lcStkQty + "]]>").append("</stk_qty>");
setNodeValue(dom, "stk_qty", getAbsString(llMaxShelfLife)); //setNodeValue(dom, "stk_qty", getAbsString(String.valueOf(llMaxShelfLife)));
setNodeValue(dom, "stk_qty", getAbsString(String.valueOf(lcStkQty)));
sql = "select appl_seg from customeritem where cust_code = ? and item_code =?"; sql = "select appl_seg from customeritem where cust_code = ? and item_code =?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, lsCustCode); pstmt.setString(1, lsCustCode);
......
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