Commit 7a365139 authored by manohar's avatar manohar

Validation for duplicate added


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@94261 ce508802-f39f-4f6c-b175-0d175dae99d5
parent f4600545
......@@ -215,8 +215,9 @@ public class WoContract extends ValidatorEJB implements WoContractLocal, WoContr
rs = null;
pstmt.close();
pstmt = null;
if("A".equalsIgnoreCase(editFlag))
{
System.out.println("Contract_no validation editFlag ["+editFlag + "]");
//if("A".equalsIgnoreCase(editFlag))
//{
sql = " select count(1) from wo_contract where work_order= ? and item_code = ? " ;
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,workOrder.trim());
......@@ -225,26 +226,46 @@ public class WoContract extends ValidatorEJB implements WoContractLocal, WoContr
if(rs.next())
{
cnt = rs.getInt(1);
if(cnt >= 1 )
{
errCode = "VTINVWOITM"; //duplicate item code
errString = itmDBAccessEJB.getErrorString("","VTINVWOITM",userId);
break ;
}
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
//}
if (("A".equalsIgnoreCase(editFlag) && cnt > 0 ) || ("E".equalsIgnoreCase(editFlag) && cnt > 1 ) )
{
errCode = "VTDUPITEM "; //null item code
errString = itmDBAccessEJB.getErrorString("","VTDUPITEM",userId);
break ;
}
}
// 14/01/14 manoharan allow blank so that for all rubber stereo the sae contract will be used so commented
//else
//{
// errCode = "VTITMNL"; //null item code
// errString = itmDBAccessEJB.getErrorString("","VTITMNL",userId);
// break ;
//}
else
{
sql = " select count(1) from wo_contract where work_order= ? and item_code = ? " ;
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,workOrder.trim());
pstmt.setString(2,itemCode.trim());
rs = pstmt.executeQuery();
if(rs.next())
{
cnt = rs.getInt(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
//}
if (("A".equalsIgnoreCase(editFlag) && cnt > 0 ) || ("E".equalsIgnoreCase(editFlag) && cnt > 1 ) )
{
errCode = "VTDUPITEM "; //null item code
errString = itmDBAccessEJB.getErrorString("","VTDUPITEM ",userId);
break ;
}
}
}
if(childNodeName.equalsIgnoreCase("contract_no"))
{
......@@ -255,6 +276,7 @@ public class WoContract extends ValidatorEJB implements WoContractLocal, WoContr
if(contractNo != null && contractNo.trim().length() > 0)
{
sql = " SELECT count(1) "
+ " FROM WORKORDER,BOMDET,PCONTRACT_HDR,PCONTRACT_DET "
+ " WHERE WORKORDER.BOM_CODE = BOMDET.BOM_CODE "
......
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