Commit c6f36746 authored by cpatil's avatar cpatil

modified at urse


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@98812 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 6af8c6f1
......@@ -88,7 +88,8 @@ public class MrpWizPrsSaveBean
StockAllocationPrc stockAllocationPrc = new StockAllocationPrc() ;
ArrayList itemValueList = new ArrayList();
ArrayList<String> detail4DataInfoList = new ArrayList<String>();
try
{
conn = connDriver.getConnectDB("DriverITM");
......@@ -308,6 +309,20 @@ public class MrpWizPrsSaveBean
System.out.println("@@@@ctr["+dtlCtr+"]saleOrder["+saleOrder+"]-lineNo["+lineNo+"]-qtyReqd["+qtyReqdStr+"]prevItemWorder["+prevItemWorder+"]previousItem["+previousItem+"]@@@");
System.out.println("@@@@ctr["+dtlCtr+"]siteCode["+siteCode+"]-itemCode["+itemCode+"]-lotNo["+lotNo+"]-lotSl["+lotSl+"]-locCode["+locCode+"]-tranSer["+tranSer+"]allocQtyStr["+allocQtyStr+"]@@@");
String detail4DataInfo = checkNull(siteCode)+"@"+checkNull(itemCode)+"@"+checkNull(locCode)+"@"+checkNull(lotNo)+"@"+checkNull(lotSl)+"@"+checkNull(qtyReqdStr);
System.out.println("@@@@ detail4DataInfo["+detail4DataInfo+"]detail4DataInfoList["+detail4DataInfoList+"]");
if(detail4DataInfoList.contains(detail4DataInfo))
{
System.out.println("same allocation repeate.........continue.......");
continue;
}
else
{
System.out.println("new allocation ................");
detail4DataInfoList.add(detail4DataInfo);
}
System.out.println("@@@@@@@@ testing purpose SOP....detail4DataInfoList["+detail4DataInfoList+"].");
String itemCodeHdr="";
remarks = "From mrp process";
......@@ -345,9 +360,10 @@ public class MrpWizPrsSaveBean
}
System.out.println("@@@@@::: sorder ["+tempSO+"]tempLineNo["+tempLineNo+"] updated next i["+i+"]....");
}
if( tempSO != null && tempSO.trim().length() > 0 )
if( tempSO != null && tempSO.trim().length() > 0 && tempLineNo != null && tempLineNo.trim().length() > 0 )
{
sql1=" select work_order from workorder where sale_order = ? AND site_code = ? ";
System.out.println("@@@@@::test: sorder ["+tempSO+"]tempLineNo["+tempLineNo+"]");
/*sql1=" select work_order from workorder where sale_order = ? AND site_code = ? ";
pstmt1=conn.prepareStatement(sql1);
pstmt1.setString(1,tempSO);
pstmt1.setString(2,siteCode);
......@@ -378,9 +394,82 @@ public class MrpWizPrsSaveBean
pstmt1=null;
System.out.println("@@@@@ 2 refWorkOrder ["+refWorkOrder+"]");
}*/
int SOCnt=0,MPSCnt=0;
sql1=" select count(1) from sorder where sale_order = ? ";
pstmt1=conn.prepareStatement(sql1);
pstmt1.setString(1,tempSO);
rs1 = pstmt1.executeQuery();
if(rs1.next())
{
SOCnt = rs1.getInt(1);
}
rs1.close();
rs1=null;
pstmt1.close();
pstmt1=null;
System.out.println("@@@@@398:tempSO["+tempSO+"]SOCnt["+SOCnt+"]");
if( SOCnt == 0 )
{
sql1=" select count(1) from MPS_ORDER where tran_id = ? ";
pstmt1=conn.prepareStatement(sql1);
pstmt1.setString(1,tempSO);
rs1 = pstmt1.executeQuery();
if(rs1.next())
{
MPSCnt = rs1.getInt(1);
}
rs1.close();
rs1=null;
pstmt1.close();
pstmt1=null;
}
System.out.println("@@@@@413:tempSO["+tempSO+"]SOCnt["+SOCnt+"]MPSCnt["+MPSCnt+"]");
if( SOCnt > 0)
{
sql1=" select work_order from workorder " +
" where TRAN_ID__MPS in " +
" ( select tran_id from MPS_ORDER where sale_order = ? and trim(line_no) = ? ) " +
" order by TRAN_ID__MPS desc ";
pstmt1=conn.prepareStatement(sql1);
pstmt1.setString(1,tempSO);
pstmt1.setString(2,tempLineNo);
rs1 = pstmt1.executeQuery();
if(rs1.next())
{
refWorkOrder = rs1.getString("work_order");
}
rs1.close();
rs1=null;
pstmt1.close();
pstmt1=null;
System.out.println("@@@@@ 1 refWorkOrder from sorder["+tempSO+"] to mps to WO["+refWorkOrder+"]");
}
if( MPSCnt > 0 && ( refWorkOrder == null || refWorkOrder.trim().length() == 0 ) )
{
sql1=" select work_order from workorder " +
" where TRAN_ID__MPS in " +
" ( select tran_id from MPS_ORDER where sale_order = ? and trim(line_no) = ? )" +
" order by TRAN_ID__MPS desc ";
pstmt1=conn.prepareStatement(sql1);
pstmt1.setString(1,tempSO);
pstmt1.setString(2,tempLineNo);
rs1 = pstmt1.executeQuery();
if(rs1.next())
{
refWorkOrder = rs1.getString("work_order");
}
rs1.close();
rs1=null;
pstmt1.close();
pstmt1=null;
//System.out.println("@@@@@ 2 refWorkOrder ["+refWorkOrder+"]");
System.out.println("@@@@@ 1 refWorkOrder from MPS["+tempSO+"] to WO["+refWorkOrder+"]");
}
}
System.out.println("@@@@@ final refWorkOrder ["+refWorkOrder+"]");
// modify for ref_no end on urse 10/10/15
......@@ -420,7 +509,7 @@ public class MrpWizPrsSaveBean
if (errString != null && errString.trim().length() > 0)
{
System.out.println("@@@@@@rolledback errString :::"+ errString );
System.out.println("@@@@@@rolledback stockAllocationPrc.updateInvallocTrace errString :::"+ errString );
conn.rollback();
return errString;
}
......@@ -508,7 +597,7 @@ public class MrpWizPrsSaveBean
hashMap.put("chg_user",chgUser);
hashMap.put("chg_term",chgTerm);
hashMap.put("chg_date", date );
System.out.println("CALLING updateInvallocTrace() --");
System.out.println("CALLING updateInvallocTrace() -hashMap["+hashMap+"]");
invAllocTrace = new InvAllocTraceBean();
errString = invAllocTrace.updateInvallocTrace(hashMap, conn);
System.out.println("updateInvallocTrace 1....."+errString);
......@@ -526,7 +615,7 @@ public class MrpWizPrsSaveBean
}
}
if(( errString == null || errString.trim().length() == 0 ) && sorderList != null && (itemCodeHdr.equalsIgnoreCase(itemCode)))
{
System.out.println("@@@@@@@@@@@ sorderList["+sorderList+"]itemCodeHdr["+itemCodeHdr+"]itemCode["+itemCode+"]allocQty["+allocQty+"]");
......@@ -534,32 +623,32 @@ public class MrpWizPrsSaveBean
System.out.println("@@@@@ sorderArray.length["+sorderArray.length+"]");
//for(int i=0;i<sorderArray.length;i++)
//{
//String tempSO="",tempLineNo="";
//tempSO=sorderArray[i];
//String sorderLineArray[]=tempSO.split(",");
//System.out.println("@@@@@ sorderArray.length["+sorderArray.length+"]");
//if( sorderLineArray.length > 1)
//{
// tempSO=sorderLineArray[0];
// tempLineNo=sorderLineArray[1];
//}
System.out.println("@@@@@::: sorder ["+tempSO+"]tempLineNo["+tempLineNo+"] updated next dtlCtr["+dtlCtr+"]....");
// update qty_alloc in sorditem after finish click in ATP @urse on 12/10/15
sql2 = " update sorditem set qty_alloc= qty_alloc + ? where sale_order = ? and ltrim(rtrim(line_no)) = ? ";
System.out.println("sql2 :"+sql2 );
pstmt2 = conn.prepareStatement(sql2);
pstmt2.setDouble(1,allocQty);
pstmt2.setString(2,tempSO);
pstmt2.setString(3,tempLineNo);
int cnt4 = pstmt2.executeUpdate();
pstmt2.close();
pstmt2 = null;
System.out.println("@@@@@ sorditem qty_alloc::["+allocQty+"]::cnt4["+cnt4+"]");
//String tempSO="",tempLineNo="";
//tempSO=sorderArray[i];
//String sorderLineArray[]=tempSO.split(",");
//System.out.println("@@@@@ sorderArray.length["+sorderArray.length+"]");
//if( sorderLineArray.length > 1)
//{
// tempSO=sorderLineArray[0];
// tempLineNo=sorderLineArray[1];
//}
System.out.println("@@@@@::: sorder ["+tempSO+"]tempLineNo["+tempLineNo+"] updated next dtlCtr["+dtlCtr+"]....");
// update qty_alloc in sorditem after finish click in ATP @urse on 12/10/15
sql2 = " update sorditem set qty_alloc= qty_alloc + ? where sale_order = ? and ltrim(rtrim(line_no)) = ? ";
System.out.println("sql2 :"+sql2 );
pstmt2 = conn.prepareStatement(sql2);
pstmt2.setDouble(1,allocQty);
pstmt2.setString(2,tempSO);
pstmt2.setString(3,tempLineNo);
int cnt4 = pstmt2.executeUpdate();
pstmt2.close();
pstmt2 = null;
System.out.println("@@@@@ sorditem qty_alloc::["+allocQty+"]::cnt4["+cnt4+"]");
//}
}
/*
if ( errString == null || errString.trim().length() == 0 )
{
......@@ -772,9 +861,9 @@ public class MrpWizPrsSaveBean
*/
}
// for sorder updation
......@@ -874,6 +963,15 @@ public class MrpWizPrsSaveBean
return "";
}
private String checkNull(String input)
{
if(input == null)
{
input = "";
}
return input;
}
private String generateTranId( String windowName, String siteCode, Connection conn )throws ITMException
{
PreparedStatement pstmt = null;
......
......@@ -539,7 +539,9 @@ public class RunMRPWiz extends ValidatorEJB implements RunMRPWizLocal, RunMRPWiz
//" and case when sorder.alloc_flag is null then 'N' else sorder.alloc_flag end <> 'Y' " +
" and case when sorditem.alloc_flag is null then 'N' else sorditem.alloc_flag end <> 'Y' " +
" and ( siteitem.item_code = item.item_code ) and ( siteitem.site_code = sorditem.site_code )" +
" and (select count(1) from mps_order where mps_order.sale_order = sorder.sale_order and siteitem.mfg_type = 'S') = 0" ;
// " and (select count(1) from mps_order where mps_order.sale_order = sorder.sale_order and siteitem.mfg_type = 'S') = 0 " +
" and (select count(1) from mps_order where mps_order.sale_order = sorder.sale_order and " +
" sorder.sale_order = sorditem.sale_order and sorditem.alloc_flag='N' and siteitem.mfg_type = 'S' ) = 0 " ;
if("order_date".equalsIgnoreCase(viewByDate))
{
......
......@@ -1443,7 +1443,8 @@ public class WoTransferPrc extends ProcessEJB implements WoTransferPrcLocal,WoTr
" from inv_alloc_det where tran_id IN (SELECT TRAN_ID FROM INV_ALLOCATE "+
" WHERE WORK_ORDER IN (SELECT WORK_ORDER FROM WORKORDER WHERE CAMPGN_NO = ? AND STATUS = 'R')) "+
" and loc_code in(select loc_code from location where inv_stat in("+invstat1Str+") ) and site_code = ? and item_code= ? " // change invstat1 to invstat1Str for multiple loc code on 22/09/15 by cpatil
+ "and case when deallocated is null then 'N' else deallocated end = 'N' and lot_no=? and lot_sl=? and loc_code=? ";
+ " and case when deallocated is null then 'N' else deallocated end = 'N' and lot_no=? and lot_sl=? and loc_code=? "
+ " and (case when alloc_qty is null then 0 else alloc_qty end) <> (case when dealloc_qty is null then 0 else dealloc_qty end) "; // add this condition to remove triger error for update dealloc quaantity repeat from stock @urse 19/10/15
pstmt = connOne.prepareStatement(sql);
pstmt.setString(1,campNo);
......@@ -1475,7 +1476,7 @@ public class WoTransferPrc extends ProcessEJB implements WoTransferPrcLocal,WoTr
hashMap.put("chg_term", GenericUtility.getInstance().getValueFromXTRA_PARAMS(xtraParams, "termId"));
hashMap.put("loc_code__fr",rs.getString("loc_code"));
hashMap.put("exp_lev",rs.getString("exp_lev"));
System.out.println("Calling DistStkUpdEJB....."+ddlg);
System.out.println("Calling DistStkUpdEJB.....["+ddlg+"]hashMap["+hashMap+"]");
if (distStkUpd.updAllocTrace(hashMap, connOne) > 0)
{
System.out.println("distStkUpd.UpdAllocTrace(HashMap, Connection) : Sucessuful!");
......
......@@ -475,12 +475,46 @@ public class WorkorderPrc extends ProcessEJB implements WorkorderPrcLocal,Worko
System.out.println("Error Message=>"+errString);
return errString;
}//END OF PROCESS(2)
public String calWorkorderPrc(ArrayList tranList,Connection conn) throws Exception,ITMException
{
String errString="", xtraParams="";
errString=calWorkorderPrc(tranList,conn,xtraParams);
System.out.println("calWorkorderPrc(tranList,conn,xtraParams)@@@errString["+errString+"]");
return errString;
}
private String calWorkorderPrc(ArrayList tranList,Connection conn) throws Exception,ITMException
public String calWorkorderPrc(ArrayList tranList,Connection conn, String xtraParams) throws Exception,ITMException
{
System.out.println("@@@@@@@@@@@ calWorkorderPrc()............");
ResultSet rs1 = null,rsSql1=null,rsSql2=null;
PreparedStatement pstmt = null,pstmtInsert=null,pstmtUpdate=null,pstmtSql1=null,pstmtSql2=null;
if( this.conn==null)
{
System.out.println("@@@@@@@@@ conn null found...........");
this.conn = conn;
System.out.println("@@@@@@@@@ existing conn assign this.conn..........");
}
if( this.loginCode == null )
{
this.loginCode = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginCode");
this.loginCode = blanknull(this.loginCode).trim();
}
if( this.chgTerm == null )
{
this.chgTerm = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"termId");
this.chgTerm = blanknull(this.chgTerm).trim();
}
System.out.println("[WorkorderPrc][calWorkorderPrc][loginCode]=>["+loginCode+"]this.loginCode["+this.loginCode+"]");
System.out.println("[WorkorderPrc][calWorkorderPrc][chgTerm]=>["+chgTerm+"]this.chgTerm ["+this.chgTerm +"]");
int i=0;
double quantity=0.0;
double yieldPerc=0.0;
......
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