Commit 2d1a5321 authored by SABURI PATEKAR's avatar SABURI PATEKAR

Implemented transporter validation to allow only transporters mapped to

the selected Distribution Route during Sales Order processing.
parent ac0f4a88
......@@ -371,6 +371,38 @@ public class SalesOrderIC extends ValidatorEJB implements SalesOrderICLocal, Sal
}
}
}
//Added By Saburi
else if (childNodeName.equalsIgnoreCase("tran_code")) {
distRoute = checkNull(genericUtility.getColumnValue("dist_route", dom));
tranCode = checkNull(genericUtility.getColumnValue("tran_code", dom));
if (distRoute != null && distRoute.trim().length() > 0)
{
sql = "SELECT COUNT(*) CNT "
+ "FROM DISTROUTEDET "
+ "WHERE DIST_ROUTE = ? "
+ "AND TRAN_CODE = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, distRoute);
pstmt.setString(2, tranCode);
rs = pstmt.executeQuery();
int cnt1 = 0;
if (rs.next())
{
cnt1 = rs.getInt("CNT");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
}
if (childNodeName.equalsIgnoreCase("order_date")) {
String orderDateStr = "", despDateNew = "", currentDateStr = "", lsContractNo = "";
......@@ -9088,6 +9120,38 @@ public class SalesOrderIC extends ValidatorEJB implements SalesOrderICLocal, Sal
}
lsCustCode = checkNull(genericUtility.getColumnValue("cust_code", dom)); //added by manish mhatre on 24-sep-2019
// Added by Omkar I to check if [Start]
System.out.println("Debug ::: Inside Omkar changes !!!");
if(lsOrderType !=null && lsOrderType.trim().length()>0)
{
sql = "SELECT ALLOW_PL_CHG FROM SORDERTYPE WHERE ORDER_TYPE = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, lsOrderType);
rs = pstmt.executeQuery();
if (rs.next())
{
allowPlChg = rs.getString("ALLOW_PL_CHG");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if(allowPlChg !=null && allowPlChg.trim().length()>0)
{
if(allowPlChg.equalsIgnoreCase("Y"))
{
valueXmlString.append("<price_list protect = \"0\">").append("<![CDATA[" + lsPriceList + "]]>").append("</price_list>");
}
else
{
valueXmlString.append("<price_list protect = \"1\">").append("<![CDATA[" + lsPriceList + "]]>").append("</price_list>");
}
}
}//END
// Added by Omkar I to check if [End]
} else if (currentColumn.trim().equalsIgnoreCase("cust_code__notify")) {
BaseLogger.log("3", getUserInfo(), null, "customer code notify::");
// valueXmlString.append(itmCustCodeNotify(valueXmlString, dom, dom1, dom2, editFlag, xtraParams, objContext, conn)); //commented by Ashwini on 05-Sep23
......@@ -11334,6 +11398,23 @@ public class SalesOrderIC extends ValidatorEJB implements SalesOrderICLocal, Sal
BaseLogger.log("3", getUserInfo(), null, "Exception : [itemChangedNew] :==>\n" + e.getMessage());
throw new ITMException(e);
} finally {
//Ashish.J--15-May-2026--Connection Close code is added bcoz dirty connection Occured.
if (rs != null) {
rs.close();
rs = null;
}
if (pstmt != null) {
pstmt.close();
pstmt = null;
}
if (rs1 != null) {
rs1.close();
rs1 = null;
}
if (pstmt1 != null) {
pstmt1.close();
pstmt1 = null;
}//Ashish.J--15-May-2026--Connection Close code is added bcoz dirty connection Occured.
if (conn != null) {
conn.close();
conn = null;
......@@ -12068,7 +12149,7 @@ public class SalesOrderIC extends ValidatorEJB implements SalesOrderICLocal, Sal
rs = pstmt.executeQuery();
if (rs.next()) {
unitStd = rs.getString("unit");
suppCode=rs.getString("SUPP_CODE__PREF");//added by tejashri on 27/1/25
suppCode=checkNull(rs.getString("SUPP_CODE__PREF"));//added by tejashri on 27/1/25
}
rs.close();
rs = null;
......@@ -15674,8 +15755,26 @@ public class SalesOrderIC extends ValidatorEJB implements SalesOrderICLocal, Sal
throw new ITMException(e);
} finally
{
if (conn != null)
{
// Ashish.J--15-May-2026--Connection Close code is added bcoz dirty connection
// Occured.
if (rs != null) {
rs.close();
rs = null;
}
if (pstmt != null) {
pstmt.close();
pstmt = null;
}
if (rs1 != null) {
rs1.close();
rs1 = null;
}
if (pstmt1 != null) {
pstmt1.close();
pstmt1 = null;
} // Ashish.J--15-May-2026--Connection Close code is added bcoz dirty connection
// Occured.
if (conn != null) {
conn.close();
conn = null;
}
......@@ -19833,6 +19932,7 @@ public class SalesOrderIC extends ValidatorEJB implements SalesOrderICLocal, Sal
}
//Added By PriyankaC on 1FEB2018..[END]
//Changes by mayur on 10-MAY-2018--START
/*
private String checkNull(String input)
{
if (input == null || "null".equalsIgnoreCase(input) || "undefined".equalsIgnoreCase(input))
......@@ -19840,7 +19940,19 @@ public class SalesOrderIC extends ValidatorEJB implements SalesOrderICLocal, Sal
input= "";
}
return input.trim();
}*/
//4-MAY-26: to fix issue for SO upload where supp_code__pref set and null with trailing spaces.
private String checkNull(String input)
{
if (input == null) {
return "";
}
if ("null".equalsIgnoreCase(input.trim()) || "undefined".equalsIgnoreCase(input.trim())) {
return "";
}
return input.trim();
}
//Changes by mayur on 10-MAY-2018--END
private double checkIntNull(String str) {
if (str == null || str.trim().length() == 0) {
......@@ -23981,7 +24093,4 @@ public class SalesOrderIC extends ValidatorEJB implements SalesOrderICLocal, Sal
}
return lotMap;
}
}
}
\ No newline at end of file
......@@ -93,3 +93,6 @@ WHERE FIELD_NAME = 'TRAN_CODE'
Insert into obj_itemchange (OBJ_NAME,FORM_NO,FIELD_NAME,MANDATORY,EXEC_AT,JS_ARG) values ('despatch','1 ','dist_route','N',null,null);
Insert into MESSAGES (MSG_NO,MSG_STR,MSG_DESCR,MSG_TYPE,MSG_OPT,MSG_TIME,ALARM,ERR_SOURCE,CHG_DATE,CHG_USER,CHG_TERM,OVERRIDE_INPUT,MAIL_OPTION)
values ('VTDISTRT01','Invalid Transporter','Please select a valid Transporter for the selected Distribution Route.','E',null,null,null,null,to_date('12-06-26','DD-MM-RR'),'SABURI','SYSTEM',null,null);
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