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
lsNoapplyCustList = "", lsApplicableordtypes = "", lsPrevscheme = "";
String lsCustSchemeCode = "", lcIntegralQty = "", lsItemStru = "", lsDisPobOrdtypeList = "",
lsPackCode = "", toStation = "", frStation = "", lsTaxChapHdr = "";
String lsTaxClassHdr = "", lsTaxEnvHdr = "", lcMinShelfLife = "", llMaxShelfLifeDet = "",
lsSorder = "", lcMinLifePerc = "", llShelfLife = "", llMaxShelfLife = "";
//Pavan Rane 31jul19 start [Sales order near expiry logic - corrected]
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 ldtDateStr = "";
boolean lbProceed = false, lbOrdFlag = false;
......@@ -10372,33 +10375,37 @@ public class SalesOrderIC extends ValidatorEJB implements SalesOrderICLocal, Sal
valueXmlString.append("<tax_env>").append("<![CDATA[" + lsTaxEnv + "]]>").append("</tax_env>");
setNodeValue(dom, "tax_env", getAbsString(lsTaxEnv));
lcMinShelfLife = checkNull(genericUtility.getColumnValue("min_shelf_life", dom1));
llMaxShelfLifeDet = checkNull(genericUtility.getColumnValue("max_shelf_life", dom1));
//Pavan Rane 31jul19 Start [Changes for Sales order near expiry logic to be corrected]
//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));
lsPlistDisc = checkNull(genericUtility.getColumnValue("price_list__disc", dom1));
if (lcMinShelfLife == null || lcMinShelfLife.trim().length() == 0) {
if (lcMinShelfLife == 0) //if (lcMinShelfLife == null || lcMinShelfLife.trim().length() == 0) {
{
sql = "select min_shelf_life ,max_shelf_life from sordertype where order_type =?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, lsOrderType);
rs = pstmt.executeQuery();
if (rs.next()) {
lcMinShelfLife = rs.getString("min_shelf_life");
llMaxShelfLifeDet = rs.getString("max_shelf_life");
lcMinShelfLife = rs.getDouble("min_shelf_life"); //rs.getString("min_shelf_life");
llMaxShelfLifeDet = rs.getDouble("max_shelf_life"); //rs.getString("max_shelf_life");
}
rs.close();
rs = null;
pstmt.close();
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 = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, lsCustCode);
pstmt.setString(2, itemCodeOrd);
rs = pstmt.executeQuery();
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");
}
rs.close();
......@@ -10406,7 +10413,8 @@ public class SalesOrderIC extends ValidatorEJB implements SalesOrderICLocal, Sal
pstmt.close();
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 "
+ " from customer_series where cust_code = ? and item_ser = ?";
pstmt = conn.prepareStatement(sql);
......@@ -10414,57 +10422,67 @@ public class SalesOrderIC extends ValidatorEJB implements SalesOrderICLocal, Sal
pstmt.setString(2, mItemSer);
rs = pstmt.executeQuery();
if (rs.next()) {
lcMinLifePerc = rs.getString("min_shelf_perc");
lcMinLifePerc = rs.getDouble("min_shelf_perc"); //lcMinLifePerc = rs.getString("min_shelf_perc");
}
rs.close();
rs = null;
pstmt.close();
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 = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, itemCodeOrd);
rs = pstmt.executeQuery();
if (rs.next()) {
llShelfLife = rs.getString("shelf_life");
llShelfLife = rs.getDouble("shelf_life"); //llShelfLife = rs.getString("shelf_life");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if (llShelfLife > 0)
{
lcMinShelfLife = Math.round((lcMinLifePerc / 100) * llShelfLife);
llMaxShelfLife = llShelfLife;
}
}
llShelfLife = (llShelfLife == null || llShelfLife.trim().length() == 0) ? "0" : llShelfLife;
if (Integer.parseInt(llShelfLife) > 0) {
lcMinShelfLife = String
.valueOf(Math.round((Double.parseDouble(checkDouble(lcMinLifePerc)) / 100)
* Double.parseDouble(checkDouble(llShelfLife))));
/*llShelfLife = (llShelfLife == null || llShelfLife.trim().length() == 0) ? "0" : llShelfLife;
if (Integer.parseInt(llShelfLife) > 0)
if (llShelfLife > 0)
{
/*lcMinShelfLife = String.valueOf(Math.round((Double.parseDouble(checkDouble(lcMinLifePerc)) / 100)* Double.parseDouble(checkDouble(llShelfLife))));
lcMinShelfLife = Math.round((lcMinLifePerc / 100) * llShelfLife);
llMaxShelfLife = llShelfLife;
} else {
lcMinShelfLife = "0";
llMaxShelfLife = "0";
}
if (lcMinShelfLife == null || lcMinShelfLife.trim().length() == 0) {
lcMinShelfLife = 0; //"0";
llMaxShelfLife = 0; //"0";
}*/
//if (lcMinShelfLife == null || lcMinShelfLife.trim().length() == 0) {
if (lcMinShelfLife == 0)
{
sql = "select min_shelf_life from customer where cust_code =?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, lsCustCode);
rs = pstmt.executeQuery();
if (rs.next()) {
lcMinShelfLife = rs.getString("min_shelf_life");
lcMinShelfLife = rs.getDouble("min_shelf_life"); //lcMinShelfLife = rs.getString("min_shelf_life");
}
rs.close();
rs = null;
pstmt.close();
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 item where item_code =?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, itemCodeOrd);
rs = pstmt.executeQuery();
if (rs.next()) {
lcMinShelfLife = rs.getString("min_shelf_life");
//lcMinShelfLife = rs.getString("min_shelf_life");
lcMinShelfLife = rs.getDouble("min_shelf_life");
}
rs.close();
rs = null;
......@@ -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
//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.setString(1, lsSaleOrd);
rs = pstmt.executeQuery();
......@@ -10483,44 +10501,47 @@ public class SalesOrderIC extends ValidatorEJB implements SalesOrderICLocal, Sal
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if ("NE".equalsIgnoreCase(lsSalesOrderType)) {
pstmt = null;*/
//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);
pstmt.setString(1, lsSaleOrd);
rs = pstmt.executeQuery();
if (rs.next()) {
llMaxShelfLife = rs.getString("no_sales_month");
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) {
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")) {
llMaxShelfLife = lsVarvalue;
//if (lsVarvalue == null || lsVarvalue.trim().length() == 0 || lsVarvalue.equalsIgnoreCase("NULLFOUND")) {
if (lsVarvalue != null && lsVarvalue.trim().length() > 0 )
{
llMaxShelfLife = checkDoubleNull(lsVarvalue); //llMaxShelfLife = lsVarvalue;
}
}
String llTemp = llMaxShelfLife;
double llTemp = llMaxShelfLife;
llMaxShelfLife = lcMinShelfLife;
lcMinShelfLife = llTemp;
} else {
llMaxShelfLife = "";
} 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;
}
valueXmlString.append("<min_shelf_life>").append("<![CDATA[" + lcMinShelfLife + "]]>")
.append("</min_shelf_life>");
setNodeValue(dom, "min_shelf_life", getAbsString(lcMinShelfLife));
valueXmlString.append("<max_shelf_life>").append("<![CDATA[" + llMaxShelfLife + "]]>")
.append("</max_shelf_life>");
setNodeValue(dom, "max_shelf_life", getAbsString(llMaxShelfLife));
valueXmlString.append("<min_shelf_life>").append("<![CDATA[" + lcMinShelfLife + "]]>").append("</min_shelf_life>");
setNodeValue(dom, "min_shelf_life", String.valueOf(lcMinShelfLife));
valueXmlString.append("<max_shelf_life>").append("<![CDATA[" + llMaxShelfLife + "]]>").append("</max_shelf_life>");
setNodeValue(dom, "max_shelf_life", String.valueOf(llMaxShelfLife));
if ((CommonConstants.DB_NAME).equalsIgnoreCase("mssql")) {
sql = "select [dbo].fn_get_itmstk(?, ?) as lc_stk_qty from dual";
......@@ -10540,8 +10561,8 @@ public class SalesOrderIC extends ValidatorEJB implements SalesOrderICLocal, Sal
pstmt = null;
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 =?";
pstmt = conn.prepareStatement(sql);
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