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
......@@ -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