Commit 63e81f9e authored by vlagad's avatar vlagad

changes related to QR code

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@195622 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 6874fa43
......@@ -15,9 +15,9 @@ import ibase.webitm.ejb.ValidatorEJB;
import ibase.utility.UserInfoBean;
import ibase.webitm.utility.ITMException;
public class AsnPoNumber extends ValidatorEJB
public class AsnPoNumber extends ValidatorEJB
{
private E12GenericUtility genericUtility = new E12GenericUtility();
public String getQRJsonData(String asnNo, UserInfoBean userInfoBean) throws ITMException
{
......@@ -29,52 +29,52 @@ public class AsnPoNumber extends ValidatorEJB
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
String transDB = userInfoBean.getTransDB();
String sqlStr = "SELECT TRAN_ID,SUPP_CODE FROM ASN_HDR WHERE ASN_NO = ?";
String sqlQuery = "SELECT * FROM ASN_DET WHERE TRAN_ID = ?";
String tranId = "",suppCode = "",suppName = "";
String itemCode = "",quantity ="",lotNo = "",lpnNo = "",noArt = "",packSize ="";
String itemDescr = "";
JSONObject jsonObject = null;
JSONArray jsonArray = new JSONArray();
try
try
{
conn = connDriver.getConnectDB(transDB);
pstmt = conn.prepareStatement(sqlStr);
pstmt.setString(1, asnNo);
rs = pstmt.executeQuery();
while(rs.next())
while(rs.next())
{
tranId = rs.getString("TRAN_ID");
suppCode = rs.getString("SUPP_CODE");
suppName = getSuppName(conn,pstmt,rs,suppCode);
}
if(rs != null)
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(tranId != null && tranId.trim().length() > 0 )
if(tranId != null && tranId.trim().length() > 0 )
{
System.out.println("###### Tran ID "+tranId);
pstmt = conn.prepareStatement(sqlQuery);
pstmt.setString(1, tranId.trim());
rs = pstmt.executeQuery();
while( rs.next())
while( rs.next())
{
itemCode = rs.getString("ITEM_CODE");
quantity = rs.getString("QUANTITY");
......@@ -85,23 +85,23 @@ public class AsnPoNumber extends ValidatorEJB
itemDescr = getItemDescr(conn,pstmt,rs,itemCode);
System.out.println("##### ItemCode : ["+itemCode+"] Quantity ["+quantity+"] PackSize ["+packSize+"] LotNo ["+lotNo);
System.out.println("##### LpnNo ["+lpnNo+"] NoArt ["+noArt+"] ItemDescr ["+itemDescr);
if(noArt == null)
if(noArt == null)
{
noArt = "1";
}
int noOfLotSl = 0;
if(quantity != null)
int noOfLotSl = 0;
if(quantity != null)
{
noOfLotSl = Integer.parseInt(quantity)/Integer.parseInt(noArt);
}
System.out.println("###### noOfLotSl "+noOfLotSl);
int count = 0;
for(int i = 0 ; i< Integer.parseInt(noArt);i++)
for(int i = 0 ; i< Integer.parseInt(noArt);i++)
{
jsonObject = new JSONObject();
jsonArray.add(jsonObject);
jsonObject.put("supp_name",genericUtility.checkNull(suppName));
jsonObject.put("item_code",genericUtility.checkNull(itemCode));
jsonObject.put("item_descr",genericUtility.checkNull(itemDescr));
......@@ -111,21 +111,21 @@ public class AsnPoNumber extends ValidatorEJB
jsonObject.put("part_qty",genericUtility.checkNull(""+0));
jsonObject.put("no_art",genericUtility.checkNull(noArt));
jsonObject.put("lot_no",genericUtility.checkNull(lotNo));
}
}
}
}
catch(Exception e)
catch(Exception e)
{
e.printStackTrace();
}
finally
{
if(conn != null)
if(conn != null)
{
try
{
......@@ -140,7 +140,7 @@ public class AsnPoNumber extends ValidatorEJB
System.out.println("##### Final JSON Array "+jsonArray.toString());
return jsonArray.toString();
}
private String getSuppName(Connection conn, PreparedStatement pstmt, ResultSet rs, String suppCode)
{
System.out.println("##### SUPP_CODE "+suppCode);
......@@ -151,21 +151,21 @@ public class AsnPoNumber extends ValidatorEJB
pstmt = conn.prepareStatement(sqlQuery);
pstmt.setString(1, suppCode.trim());
rs = pstmt.executeQuery();
while(rs.next())
while(rs.next())
{
suppName = rs.getString("SUPP_NAME");
}
if(rs != null)
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
catch (SQLException e)
{
......@@ -175,7 +175,7 @@ public class AsnPoNumber extends ValidatorEJB
return suppName;
}
private String getItemDescr(Connection conn, PreparedStatement pstmt, ResultSet rs, String itemCode)
private String getItemDescr(Connection conn, PreparedStatement pstmt, ResultSet rs, String itemCode)
{
String descr = "";
String sqlQuery = "SELECT DESCR FROM ITEM WHERE ITEM_CODE = ?";
......@@ -184,21 +184,21 @@ public class AsnPoNumber extends ValidatorEJB
pstmt = conn.prepareStatement(sqlQuery);
pstmt.setString(1, itemCode.trim());
rs = pstmt.executeQuery();
while(rs.next())
while(rs.next())
{
descr = rs.getString("DESCR");
}
if(rs != null)
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
catch (SQLException e)
{
......@@ -208,4 +208,126 @@ public class AsnPoNumber extends ValidatorEJB
return descr;
}
//Added by Vikas L on 10-1-19 For Regerating QR code [start]
public String regenrateQrData(String asnNo,String itemCode1,String noOfQr, UserInfoBean userInfoBean) throws ITMException
{
ConnDriver connDriver = new ConnDriver();
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
String transDB = userInfoBean.getTransDB();
String sqlStr = "SELECT TRAN_ID,SUPP_CODE FROM ASN_HDR WHERE ASN_NO = ?";
String sqlQuery = "SELECT * FROM ASN_DET WHERE TRAN_ID = ? and ITEM_CODE = ?";
String tranId = "",suppCode = "",suppName = "",noOfPallet="";
String itemCode = "",quantity ="",lotNo = "",lpnNo = "",noArt = "",packSize ="";
String itemDescr = "";
int reqQrCode=Integer.parseInt(noOfQr);
System.out.println(">>>>>> reqQrCode :"+reqQrCode);
JSONObject jsonObject = null;
JSONArray jsonArray = new JSONArray();
try
{
conn = connDriver.getConnectDB(transDB);
pstmt = conn.prepareStatement(sqlStr);
pstmt.setString(1, asnNo);
rs = pstmt.executeQuery();
while(rs.next())
{
tranId = rs.getString("TRAN_ID");
suppCode = rs.getString("SUPP_CODE");
suppName = getSuppName(conn,pstmt,rs,suppCode);
}
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(tranId != null && tranId.trim().length() > 0 )
{
System.out.println("###### Tran ID "+tranId);
System.out.println("###### itemCode1 "+itemCode1);
pstmt = conn.prepareStatement(sqlQuery);
pstmt.setString(1, tranId.trim());
pstmt.setString(2, itemCode1);
rs = pstmt.executeQuery();
while( rs.next())
{
itemCode = rs.getString("ITEM_CODE");
quantity = rs.getString("QUANTITY");
packSize = rs.getString("PACK_SIZE");
lotNo = rs.getString("LOT_NO");
lpnNo = rs.getString("LPN_NO");
noArt = rs.getString("NO_ART");
noOfPallet=rs.getString("NO_PALLET");
itemDescr = getItemDescr(conn,pstmt,rs,itemCode);
System.out.println("##### ItemCode : ["+itemCode+"] Quantity ["+quantity+"] PackSize ["+packSize+"] LotNo ["+lotNo);
System.out.println("##### LpnNo ["+lpnNo+"] NoArt ["+noArt+"] ItemDescr ["+itemDescr);
if(noArt == null)
{
noArt = "1";
}
int noOfLotSl = 0;
if(quantity != null)
{
noOfLotSl = Integer.parseInt(quantity)/Integer.parseInt(noArt);
}
System.out.println("###### noOfLotSl "+noOfLotSl);
int count = Integer.parseInt(noOfPallet);
System.out.println(">>>>>>Count "+count);
for(int i = 0 ; i< reqQrCode;i++)
{
jsonObject = new JSONObject();
jsonObject.put("supp_name",genericUtility.checkNull(suppName));
jsonObject.put("item_code",genericUtility.checkNull(itemCode));
jsonObject.put("item_descr",genericUtility.checkNull(itemDescr));
jsonObject.put("asn_no",genericUtility.checkNull(asnNo));
jsonObject.put("lot_sl",genericUtility.checkNull(asnNo)+"_"+ (++count));
jsonObject.put("quantity",genericUtility.checkNull(""+noOfLotSl));
jsonObject.put("part_qty",genericUtility.checkNull(""+0));
jsonObject.put("no_art",genericUtility.checkNull(noArt));
jsonObject.put("lot_no",genericUtility.checkNull(lotNo));
jsonArray.add(jsonObject);
}
}
}
}
catch(Exception e)
{
e.printStackTrace();
}
finally
{
if(conn != null)
{
try
{
conn.close();
conn = null;
} catch (SQLException e)
{
e.printStackTrace();
}
}
}
System.out.println("##### Final JSON Array "+jsonArray.toString());
return jsonArray.toString();
}
//Added by Vikas L on 10-1-19 For Regerating QR code [start]
}
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