Commit 6de5d8e1 authored by smanohar's avatar smanohar

Many bug fixing and changes

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@215863 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 6897141d
......@@ -73,6 +73,7 @@ import ibase.webitm.ejb.MasterStatefulLocal;
import ibase.webitm.ejb.ProcessEJB;
import ibase.webitm.ejb.dis.DistCommon;
import ibase.webitm.ejb.dis.InvAllocTraceBean;
import ibase.webitm.ejb.dis.adv.SalesReturnConfirm;
import ibase.webitm.utility.ITMException;
import ibase.webitm.utility.TransIDGenerator;
......@@ -152,6 +153,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
Map<String,Double> AdjPotencyExplevQtyMap = null;
String leastExpdtActivRm = "";
HashMap<String, String> sqlMap=new HashMap<String, String>();
boolean isAllocateFromOtherSite = false; // 29-jan-2020 manoharan whether allocation is done from other supply site for any shortage
......@@ -189,6 +191,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
e.printStackTrace();
System.out.println("Exception :WoFirmplanPrc:getData method : " + e.getMessage() + ":");
rtrStr = e.getMessage();
throw new ITMException(e);
}
return rtrStr;
}
......@@ -442,10 +445,11 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
System.out.println("worderStkBeanList size 5="+worderStkBeanList.size());
errString = insertInInvAllocate(conn,campgnNo);
System.out.println("worderStkBeanList size 6="+worderStkBeanList.size());
errString = createDistSaleOrder(conn,campgnNo,workOrder,xtraParams,"C");
errString = createDistSaleOrder(conn,campgnNo,workOrder,xtraParams,"NC");
if(isAllocateFromOtherSite) // 29-jan-2020 in case stock allocated from other supply site then only create SO/DO
{
errString = createDistSaleOrder(conn,campgnNo,workOrder,xtraParams,"C");
errString = createDistSaleOrder(conn,campgnNo,workOrder,xtraParams,"NC");
}
//CreateDistSorderAllocation
//according to transType create dist. or sale order
errString = generateXml(conn,"S",campgnNo);//TODO
......@@ -594,7 +598,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
" DT.TAX_CLASS,DT.TAX_CHAP,DT.TAX_ENV,S.ITEM_CODE,S.LOT_NO,S.LOT_SL,S.QUANTITY,S.ALLOC_QTY,S.EXP_DATE,S.UNIT,S.UNIT__ALT,S.ITEM_SER,S.MFG_DATE," +
"S.NO_ART,S.POTENCY_PERC,S.PACK_CODE,S.LOC_CODE,S.BATCH_NO,S.GRADE ,S.GROSS_WEIGHT,S.TARE_WEIGHT,S.NET_WEIGHT,S.DIMENSION,S.RETEST_DATE," +
"S.SUPP_CODE__MFG,S.PACK_INSTR,S.RATE,S.ACCT_CODE__INV,S.CCTR_CODE__INV,DT.RATE__CLG,DT.QTY_CONFIRM,DT.QTY_SHIPPED " +
"FROM DISTORDER_ALLOC D,DISTORDER H,DISTORDER_DET DT,STOCK S " +
"FROM DISTORDER_ALLOC D,DISTORDER H,DISTORDER_DET DT,STOCK S " +.UpdAllocT
"WHERE D.DIST_ORDER = ? AND D.DIST_ORDER = H.DIST_ORDER AND H.DIST_ORDER = DT.DIST_ORDER AND" +
" D.LINE_NO = DT.LINE_NO AND D.LOT_NO = S.LOT_NO AND D.LOT_SL = S.LOT_SL AND D.ITEM_CODE = S.ITEM_CODE" +
" AND D.LOC_CODE = S.LOC_CODE AND S.SITE_CODE = H.SITE_CODE__SHIP";
......@@ -1112,6 +1116,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
}
if(isSufficient)
{
isAllocateFromOtherSite = true; // 29-jan-2020 manoharan allocation done from other supply site
tempWorderObj.setSufficient("Y");//Changed by wasim on 07-03-2016
break;
}
......@@ -2374,16 +2379,18 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
System.out.println("Finally required quantity ="+requiredQty);
//Changed by wasim on 16-03-2016 to consider and allocate minimum qty req [END]
if("R".equalsIgnoreCase(detailMap.get("USAGE_TYPE")) && (! "N".equalsIgnoreCase(detailMap.get("ALLOCATE_TYPE")) ) ){
stockAllocMap.put("ALLOC_QTY",""+updQty);
stockAllocMap.put("LOC_CODE", locCode);
stockAllocMap.put("ITEM_CODE",detailMap.get("ITEM_CODE"));
stockAllocMap.put("SITE_CODE",detailMap.get("SITE_CODE"));
stockAllocMap.put("LOT_NO",lotNo);
stockAllocMap.put("LOT_SL",lotSl);
allocRetStr = updateStockAllocQty(stockAllocMap,conn,campgnNo);
System.out.println("allocRetStr :"+allocRetStr);
}
if ("R".equalsIgnoreCase(detailMap.get("USAGE_TYPE"))
&& (!"N".equalsIgnoreCase(detailMap.get("ALLOCATE_TYPE")))) {
stockAllocMap.put("ALLOC_QTY", "" + updQty);
stockAllocMap.put("LOC_CODE", locCode);
stockAllocMap.put("ITEM_CODE", detailMap.get("ITEM_CODE"));
stockAllocMap.put("SITE_CODE", detailMap.get("SITE_CODE"));
stockAllocMap.put("LOT_NO", lotNo);
stockAllocMap.put("LOT_SL", lotSl);
stockAllocMap.put("WORK_ORDER",detailMap.get("WORK_ORDER")); // 29-jan-2020 manoharan there is no campgnNo then exception
allocRetStr = updateStockAllocQty(stockAllocMap, conn, campgnNo);
System.out.println("allocRetStr :" + allocRetStr);
}
/*String output4 = checkOutput(conn);
System.out.println("check 4:::: " + output4);*/
......@@ -2667,7 +2674,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
{
e.printStackTrace();
writeWorkOrderLog(e.toString(),campgnNo);//TODO
throw new SQLException(e);
throw new ITMException(e);
}
finally
{
......@@ -3050,7 +3057,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
}
}
//added by azhar[END][24-APR-2017] potency qty was not updated in siteitemsummary bean
stockAllocMap.put("WORK_ORDER",worderStkBeanObj.getWorkOrder()); // 29-jan-2020 manoharan there is no campgnNo then exception
if("Y".equalsIgnoreCase(worderStkBeanObj.getCritItem())){
System.out.println("check potency allocation");
......@@ -3186,6 +3193,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
//added by azhar[END][24-APR-2017] potency qty was not updated in siteitemsummary bean
//allocRetStr = updateStockAllocQty(stockAllocMap,conn,campgnNo);
stockAllocMap.put("WORK_ORDER",worderStkBeanObj.getWorkOrder()); // 29-jan-2020 manoharan there is no campgnNo then exception
if("Y".equalsIgnoreCase(worderStkBeanObj.getCritItem())){
System.out.println("check potency allocation");
allocRetStr = updateStockAllocQty(stockAllocMap,conn,campgnNo);
......@@ -3579,7 +3587,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
stockAllocMap.put("LOT_SL",worderStkBeanObj.getLotSl());
// 09-mar-16 manoharan - what will the string returned??????????
//allocRetStr = updateStockAllocQty(stockAllocMap,conn,campgnNo);
stockAllocMap.put("WORK_ORDER",worderStkBeanObj.getWorkOrder()); // 29-jan-2020 manoharan there is no campgnNo then exception
if("Y".equalsIgnoreCase(worderStkBeanObj.getCritItem())){
System.out.println("check potency allocation");
allocRetStr = updateStockAllocQty(stockAllocMap,conn,campgnNo);
......@@ -5512,7 +5520,8 @@ public String populateWorkOrderBill(Connection conn,String campgnNo) throws Exce
if(rs.next())
{
System.out.println("Allocated quantity is ="+rs.getDouble(1));
// 29-jan-2020 manoharan to allocate through allocation component
/*
sql = "UPDATE STOCK SET ALLOC_QTY =(CASE WHEN ALLOC_QTY IS NULL THEN 0 ELSE ALLOC_QTY END) + ?"
+" where item_code = ? and site_code = ? and loc_code = ? "
+" and lot_no = ? and lot_sl = ? ";
......@@ -5542,7 +5551,36 @@ public String populateWorkOrderBill(Connection conn,String campgnNo) throws Exce
{
pstmt.close();pstmt = null;
}
*/
invAllocateMap = null;
invAllocateMap = new HashMap();
invAllocTrace = new InvAllocTraceBean();
invAllocateMap.put("tran_date",getCurrtDate(campgnNo));
invAllocateMap.put("ref_ser","W-ORD");// Discuss
invAllocateMap.put("ref_id",WorderStkBeanObj.getWorkOrder());
invAllocateMap.put("ref_line", "" + lineNo);
invAllocateMap.put("site_code",WorderStkBeanObj.getSiteCode());
invAllocateMap.put("item_code",WorderStkBeanObj.getItemCode());
invAllocateMap.put("loc_code", WorderStkBeanObj.getLocCode());
invAllocateMap.put("lot_no",WorderStkBeanObj.getLotNo());
invAllocateMap.put("lot_sl",WorderStkBeanObj.getLotSl());
//invAllocateMap.put("alloc_qty", WorderStkBeanObj.getActualAllocQty());//wasim
// 31-may-16 manoharan reserve is already allocated
//invAllocateMap.put("alloc_qty", WorderStkBeanObj.getAllocQty());
invAllocateMap.put("alloc_qty", (-1 * deAllocQty));
invAllocateMap.put("chg_user",chgUser);
invAllocateMap.put("chg_term",termId);
invAllocateMap.put("chg_win","w_woFirmplan");
if (deAllocQty != 0)
{
errorString = invAllocTrace.updateInvallocTrace(invAllocateMap, conn);
System.out.println("After updateInvallocTrace errorString :["+errorString+"]");
}
// end 29-jan-2020 manoharan to allocate through allocation component
invAllocateMap = null;
invAllocateMap = new HashMap();
invAllocTrace = new InvAllocTraceBean();
invAllocateMap.put("tran_date",getCurrtDate(campgnNo));
......@@ -7691,8 +7729,11 @@ public String populateWorkOrderBill(Connection conn,String campgnNo) throws Exce
{
PreparedStatement pstmt = null,pstmtSel = null,pstmtCheck = null;
ResultSet rs = null,rsCheck = null;
String sql = "",sqlSel = "";
String sql = "",sqlSel = "", errorString = "";
int row = 0;
InvAllocTraceBean invAllocTrace = new InvAllocTraceBean(); // 28-jan-2020 manoharan allocation to be through stock allocation component
HashMap strAllocate = null;
double allocQty = 0;
try
{
if (CommonConstants.DB_NAME.equalsIgnoreCase("DB2") || CommonConstants.DB_NAME.equalsIgnoreCase("MYSQL") )
......@@ -7722,7 +7763,7 @@ public String populateWorkOrderBill(Connection conn,String campgnNo) throws Exce
if(rs.next())
{
System.out.println("Alloc qty in update stock method["+rs.getString("ALLOC_QTY")+"]");
/*// 28-jan-2020 manoharan
sql = "UPDATE STOCK SET ALLOC_QTY = (CASE WHEN ALLOC_QTY IS NULL THEN 0 ELSE ALLOC_QTY END) + ? " +
" WHERE ITEM_CODE = ? AND SITE_CODE = ? AND LOC_CODE = ? AND LOT_NO = ? AND LOT_SL = ?";
......@@ -7735,6 +7776,31 @@ public String populateWorkOrderBill(Connection conn,String campgnNo) throws Exce
pstmt.setString(6, stockAllocMap.get("LOT_SL"));
row = pstmt.executeUpdate();
*/
allocQty = Double.valueOf(stockAllocMap.get("ALLOC_QTY"));
strAllocate = null;
strAllocate = new HashMap();
strAllocate.put("tran_date",getCurrdateAppFormat(campgnNo));
strAllocate.put("ref_ser","W-ORD");
//strAllocate.put("ref_id",campgnNo); // 29-jan-2020 manoharan there is no campgnNo
strAllocate.put("ref_id",stockAllocMap.get("WORK_ORDER")); // 29-jan-2020 manoharan there is no campgnNo
strAllocate.put("ref_line", "" );
strAllocate.put("site_code",stockAllocMap.get("SITE_CODE"));
strAllocate.put("item_code",stockAllocMap.get("ITEM_CODE"));
strAllocate.put("loc_code", stockAllocMap.get("LOC_CODE"));
strAllocate.put("lot_no",stockAllocMap.get("LOT_NO"));
strAllocate.put("lot_sl",stockAllocMap.get("LOT_SL"));
strAllocate.put("alloc_qty", allocQty);
strAllocate.put("chg_user",chgUser);
strAllocate.put("chg_term",termId);
strAllocate.put("chg_win","w_wo_firmplan");
if (allocQty != 0)
{
errorString = invAllocTrace.updateInvallocTrace(strAllocate, conn);
//System.out.println("errorString after updateInvallocTrace allocate----->2["+errorString+"]");
}
strAllocate = null;
System.out.println("In updateStockAllocQty : "+row);
}
else
......@@ -7798,12 +7864,12 @@ public String populateWorkOrderBill(Connection conn,String campgnNo) throws Exce
}
}
if(row > 0)
/*if(row > 0)
{
return "Success";
}
}*/
return "Error";
return errorString;
}
/*private String updatePotencyStockAllocQty(Map<String,String> stockAllocMap,Connection conn,String campgnNo) throws Exception,ITMException
{
......@@ -7933,7 +7999,7 @@ public String populateWorkOrderBill(Connection conn,String campgnNo) throws Exce
String serviceCode = "";
String serviceURI = "";
String actionURI = "";
String sql = "";
String sql = "", compType = "";
PreparedStatement psmt = null;
ResultSet rs = null;
try
......@@ -7945,8 +8011,8 @@ public String populateWorkOrderBill(Connection conn,String campgnNo) throws Exce
System.out.println("Tran id for sale order--->>"+tranIdFr+"]");
methodName = "gbf_post";
actionURI = "http://NvoServiceurl.org/" + methodName;
sql = "SELECT SERVICE_CODE,COMP_NAME FROM SYSTEM_EVENTS WHERE OBJ_NAME = ? AND EVENT_CODE = 'pre_confirm' ";
// 29-jan-2020 manoharan check comp_type and accordingly call webservice or POJO
sql = "SELECT SERVICE_CODE,COMP_NAME,COMP_TYPE FROM SYSTEM_EVENTS WHERE OBJ_NAME = ? AND EVENT_CODE = 'pre_confirm' ";
psmt = conn.prepareStatement(sql);
psmt.setString(1,businessObj);
rs = psmt.executeQuery();
......@@ -7954,43 +8020,56 @@ public String populateWorkOrderBill(Connection conn,String campgnNo) throws Exce
{
serviceCode = rs.getString("SERVICE_CODE");
compName = rs.getString("COMP_NAME");
compType = rs.getString("COMP_TYPE");
}
compName=compName==null ? "" :compName.trim();
System.out.println("serviceCode = ["+serviceCode+"] compName ["+compName+"]");
sql = "SELECT SERVICE_URI FROM SYSTEM_EVENT_SERVICES WHERE SERVICE_CODE = ? ";
psmt = conn.prepareStatement(sql);
psmt.setString(1,serviceCode);
rs = psmt.executeQuery();
if ( rs.next() )
if ("JB".equals(compType) || "EJB".equals(compType))
{
serviceURI = rs.getString("SERVICE_URI");
if ("sorder".equals(businessObj)) // 29-jan-2020 manoharan check comp_type and accordingly call webservice or POJO
{
ibase.webitm.ejb.dis.adv.SorderConf sorderConf = new ibase.webitm.ejb.dis.adv.SorderConf();
retString = sorderConf.confirm(tranIdFr,xtraParams,"N",conn);
}
}
else
{
sql = "SELECT SERVICE_URI FROM SYSTEM_EVENT_SERVICES WHERE SERVICE_CODE = ? ";
psmt = conn.prepareStatement(sql);
psmt.setString(1,serviceCode);
rs = psmt.executeQuery();
if ( rs.next() )
{
serviceURI = rs.getString("SERVICE_URI");
}
serviceURI=serviceURI==null ? "" :serviceURI.trim();
System.out.println("serviceURI = ["+serviceURI+"]---> compName = ["+compName+"]");
Service service = new Service();
Call call = (Call)service.createCall();
call.setTargetEndpointAddress(new java.net.URL(serviceURI));
call.setOperationName( new javax.xml.namespace.QName("http://NvoServiceurl.org", methodName ) );
call.setUseSOAPAction(true);
call.setSOAPActionURI(actionURI);
Object[] aobj = new Object[4];
call.addParameter( new javax.xml.namespace.QName("http://NvoServiceurl.org", "component_name"), XMLType.XSD_STRING, ParameterMode.IN);
call.addParameter( new javax.xml.namespace.QName("http://NvoServiceurl.org", "tran_id"), XMLType.XSD_STRING, ParameterMode.IN);
call.addParameter( new javax.xml.namespace.QName("http://NvoServiceurl.org", "xtra_params"), XMLType.XSD_STRING, ParameterMode.IN);
call.addParameter( new javax.xml.namespace.QName("http://NvoServiceurl.org", "forced_flag"), XMLType.XSD_STRING, ParameterMode.IN);
aobj[0] = new String(compName);
aobj[1] = new String(tranIdFr);
aobj[2] = new String(xtraParams);
aobj[3] = new String(forcedFlag);
//System.out.println("@@@@@@@@@@loginEmpCode:" +genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginEmpCode")+":");
System.out.println("@@@@@@ call.setReturnType(XMLType.XSD_STRING) executed........");
call.setReturnType(XMLType.XSD_STRING);
retString = (String)call.invoke(aobj);
System.out.println("Confirm Complete @@@@@@@@@@@ Return string from NVO is:==>["+retString+"]");
}
serviceURI=serviceURI==null ? "" :serviceURI.trim();
System.out.println("serviceURI = ["+serviceURI+"]---> compName = ["+compName+"]");
Service service = new Service();
Call call = (Call)service.createCall();
call.setTargetEndpointAddress(new java.net.URL(serviceURI));
call.setOperationName( new javax.xml.namespace.QName("http://NvoServiceurl.org", methodName ) );
call.setUseSOAPAction(true);
call.setSOAPActionURI(actionURI);
Object[] aobj = new Object[4];
call.addParameter( new javax.xml.namespace.QName("http://NvoServiceurl.org", "component_name"), XMLType.XSD_STRING, ParameterMode.IN);
call.addParameter( new javax.xml.namespace.QName("http://NvoServiceurl.org", "tran_id"), XMLType.XSD_STRING, ParameterMode.IN);
call.addParameter( new javax.xml.namespace.QName("http://NvoServiceurl.org", "xtra_params"), XMLType.XSD_STRING, ParameterMode.IN);
call.addParameter( new javax.xml.namespace.QName("http://NvoServiceurl.org", "forced_flag"), XMLType.XSD_STRING, ParameterMode.IN);
aobj[0] = new String(compName);
aobj[1] = new String(tranIdFr);
aobj[2] = new String(xtraParams);
aobj[3] = new String(forcedFlag);
//System.out.println("@@@@@@@@@@loginEmpCode:" +genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginEmpCode")+":");
System.out.println("@@@@@@ call.setReturnType(XMLType.XSD_STRING) executed........");
call.setReturnType(XMLType.XSD_STRING);
retString = (String)call.invoke(aobj);
System.out.println("Confirm Complete @@@@@@@@@@@ Return string from NVO is:==>["+retString+"]");
}
catch(Exception e)
......@@ -9279,7 +9358,7 @@ public String populateWorkOrderBill(Connection conn,String campgnNo) throws Exce
stockAllocMap.put("SITE_CODE__MFG", StkHmap.get("site_code__mfg"));
stockAllocMap.put("MFG_DATE", StkHmap.get("mfg_date"));
stockAllocMap.put("EXP_DATE", StkHmap.get("exp_date"));
stockAllocMap.put("WORK_ORDER", siteItemBeanObj.getWorkOrder()); // 29-jan-2020 manoharan
System.out.println("first time map::["+stockAllocMap+"]");
if(siteItemBeanObj.getCritItem().equalsIgnoreCase("Y"))
{
......
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