10
RECIPIENT NAME Send SMS | Young’s Food Pvt. Ltd.| Head Office | Karachi 2016-10-26 Marketing department create a delivery Chillan when order product loaded into a track and other source off traveling to the final outlet or where houses, department required when operator enter the final delivery Chillan voucher has been printed on the same time SMS delivered to the related party or customer. CONTACT Abdul Waqar Young’s ERP Karachi [email protected] +92-3333306242 Contents Recipient Name............................................................... 1 Send SMS | Young’s | Head Office | Karachi..................................1 Contact...................................................................... 1 Abdul Waqar Young’s ERP.....................................................1 Karachi.....................................................................1 [email protected]..................................................1 1 Document By: Abdul Waqar | Young’s ERP | 2016-10-26

Technical SMS Service Report

Embed Size (px)

Citation preview

Page 1: Technical SMS Service Report

R E C I P I E N T N A M ESend SMS | Young’s Food Pvt. Ltd.| Head Office |

Karachi

2016-10-26

Marketing department create a delivery Chillan when order product loaded into a track and other source off traveling to the final outlet or where houses, department required when operator enter the final delivery Chillan voucher has been printed on the same time SMS delivered to the related party or customer.

C O N T A C TAbdul WaqarYoung’s ERP

[email protected]

+92-3333306242

ContentsRecipient Name......................................................................................................................... 1

Send SMS | Young’s | Head Office | Karachi............................................................................1Contact...................................................................................................................................... 1

Abdul Waqar Young’s ERP.......................................................................................................1Karachi.................................................................................................................................... 1Abdul.waqar@youngsfood.com..............................................................................................1+92-3333306242.................................................................................................................... 1

1 Document By: Abdul Waqar | Young’s ERP | 2016-10-26

Page 2: Technical SMS Service Report

Introduction.................................................................................................................................. 3Scenario..................................................................................................................................... 3Alert Message Details................................................................................................................3Analysis phase........................................................................................................................... 3

SMS Service Provider....................................................................................................................3U-FONE Business SMS API’s.......................................................................................................3API’s description........................................................................................................................ 4

user menual.................................................................................................................................. 4Data entry Instruction................................................................................................................4

How to integrate SMS Alert Service with current System.............................................................4Job in Dynamics AX 2012...........................................................................................................4Web client.................................................................................................................................. 4IO Stream................................................................................................................................... 4Stream Reader........................................................................................................................... 4

Sample code for job...................................................................................................................... 5Job summary.............................................................................................................................. 5

Actual code in dynamics ax 2012 R3............................................................................................6Class declaration code...............................................................................................................6Method: SMS Details.................................................................................................................. 6Method: Authentication..............................................................................................................7Method: Locator......................................................................................................................... 7Method: Order Dispatch Details................................................................................................8Forms code................................................................................................................................ 9database table........................................................................................................................... 9Table Field................................................................................................................................. 9

I N T R O D U C T I O N Sales and marketing department required SMS alert service when items loaded into the track for delivery.

S C E N A R I O Marketing department create a delivery Chillan when order product loaded into a track and other source off traveling to the final outlet or where houses, department required when operator enter the final delivery Chillan voucher has been printed on the same time SMS delivered to the related party or customer.

2 Document By: Abdul Waqar | Young’s ERP | 2016-10-26

Page 3: Technical SMS Service Report

A L E R T M E S S A G E D E T A I L S 1. DC Number 2. Customer Name3. City 4. Total Number of carton (items)5. Adda Name (Station Name)6. Adda phone Number7. Finally Message like (Has been Dispatched.)8. Total number of ctns

A N A L Y S I S P H A S E 1. SMS Service Provider 2. How to integrate SMS Alert Service with current System3. Integration phase with dynamics 4. Effected database table 5. Impacts of integration

S M S S E R V I C E P R O V I D E R

U - F O N E B U S I N E S S S M S A P I ’ SUfone Business SMS is a Graphical User Interface and Bilingual SMS service that you can access worldwide via the Internet to send prepaid one-way SMS.

A P I ’ S D E S C R I P T I O N

Parameter Value DescriptionMSISDN Service provider

noAccount ID

Password ******* Account password Short code Young’s SMS masking for the customerMobile number

92123456789 Any valid number to whom you want to send message starting with 92 and characters length 12.

Lang English Language is English. Group name Administrator Optional

3 Document By: Abdul Waqar | Young’s ERP | 2016-10-26

Page 4: Technical SMS Service Report

U S E R M E N U A L

D A T A E N T R Y I N S T R U C T I O N Cell phone number most be Enter in this format style 92333221234Only mobile number valid for sending SMS.

H O W T O I N T E G R A T E S M S A L E R T S E R V I C E W I T H C U R R E N T S Y S T E MNumber of article read for SMS alert related now I fended SMS Alert blogs on dynamics ax community SMS Alert Ax 2012 by Mr. Alam

J O B I N D Y N A M I C S A X 2 0 1 2Create a job in ax 2012 AOT name of job is SENDSMS

W E B C L I E N TProvides common methods for sending data to and receiving data from a resource identified by a URI.

I O S T R E A MUsed to read from and write to any location in a file.

S T R E A M R E A D E RIs used for reading from a string buffer.

S A M P L E C O D E F O R J O Bstatic void SendSMS(Args _args){ System.Net.WebClient wClient; System.IO.Stream infoData; System.IO.StreamReader streamReader; System.String URLAddress; Str SMSConfimID;

4 Document By: Abdul Waqar | Young’s ERP | 2016-10-26

Page 5: Technical SMS Service Report

// Service UserName and Password

Str u_msisdn = '<MSISDN>'; Str u_password = '<password>'; Str u_shortcode = '<short code>'; Str u_lang = '<Language>';

// User Iformation Str u_message = 'Hello Mr. Waqar This is test Message for Youngs Food-ERP'; Str u_ReceiveNo = 'Receiver numbers '; Str u_groupname = 'Administrator';

wClient = new System.Net.WebClient();

URLAddress = "http://bsms.ufone.com/bsms_app5/sendapi.jsp?id="+ u_msisdn +"&message=" + u_message +"&shortcode="+ u_shortcode +"&lang="+ u_lang +"&mobilenum="+ u_ReceiveNo +"&password="+ u_password +"&groupname="+ u_groupname +"";

infoData = wClient.OpenRead(URLAddress); streamReader = new System.IO.StreamReader(infoData); SMSConfimID = streamReader.ReadToEnd(); infoData.Close(); streamReader.Close(); info(SMSConfimID);}

J O B S U M M A R Y Send SMS job is a onetime action job for test code in my scenario is successfully achieve results, multiple variable are creates in job name of variables are MSISDN, PASSWORD, SHORTCODE, LANGUAGE, GROUPNAME, RECEIVER NUMBER, and MESSAGE

A C T U A L C O D E I N D Y N A M I C S A X 2 0 1 2 R 3

C L A S S D E C L A R A T I O N C O D E Class is a public type all variable define in class declaration and system class also.

class YPLSendSMS{ System.Net.WebClient wClient; System.IO.Stream infoData; System.IO.StreamReader streamReader; System.String URLAddress;

5 Document By: Abdul Waqar | Young’s ERP | 2016-10-26

Page 6: Technical SMS Service Report

Str SMSConfimID; Str u_id ; Str u_shortcode; Str u_lang ; Str u_pwd; Str u_authentication; Str u_message; Str u_ReceiveNo; Str u_groupname; Str MsgData;}

M E T H O D : S M S D E T A I L SSMS Detail is a main method it’s take argument as input (AccountNum and PackingSlipId).Send SMS is a class create object of this class in SMS Details method for using functionally of this class Number of variables are used in SMS Details method declare in class declaration or method Web client object is create in SMS Details Method for passing URL AddressTry and catch function use for if any error accrue during run the application code catch Exception

public void SMSDetails(AccountNum accountNum, PACKINGSLIPID _packingSlipID){ YPLSendSMS sendSMS = new YPLSendSMS();

u_id = Service Provider number'; u_shortcode = 'B-SMS'; u_lang = 'English'; u_groupname = 'Administrator'; u_message = sendSMS.orderDispatchDetail( _packingSlipID ) + "Your Order has been delivered against your order Total Ctns: "; wClient = new System.Net.WebClient(); URLAddress ="http://bsms.ufone.com/bsms_app5/sendapi.jsp?id=Service Provider number&message="+ u_message +"&shortcode="+ u_shortcode +"&lang="+ u_lang +"&mobilenum="+ sendSMS.Locator(accountNum) +"&password="+ sendSMS.userAuthentication() +"&groupname="+ u_groupname +""; try { infoData = wClient.OpenRead(URLAddress); streamReader = new System.IO.StreamReader(infoData); SMSConfimID = streamReader.ReadToEnd(); infoData.Close(); streamReader.Close(); // info("Message Successfully Send to " + accountNum); } catch(Exception::Error) { info("error: SMSDetails Method"); }}

6 Document By: Abdul Waqar | Young’s ERP | 2016-10-26

Page 7: Technical SMS Service Report

M E T H O D : A U T H E N T I C A T I O N public str userAuthentication(){ u_pwd = '<password>'; return u_pwd ;}

M E T H O D : L O C A T O R

public str Locator(AccountNum Account){ DirPartyTable _DirPartyTable; CustPackingSlipJour _custPackingSlipJour;

//User Location ID LOGISTICSELECTRONICADDRESS _LOGISTICSELECTRONICADDRESS; CustTable _CustTable; DATAAREA DA;Select LOCATORfrom _LOGISTICSELECTRONICADDRESSjoin _DirPartyTablewhere _LOGISTICSELECTRONICADDRESS.RECID == _DirPartyTable.PRIMARYCONTACTPHONE && _LOGISTICSELECTRONICADDRESS.Partition == _DirPartyTable.Partitionjoin _CustTablewhere _CustTable.dataAreaId == 'ypl' && _DirPartyTable.recid == _CustTable.party && _CustTable.AccountNum == Account && _CustTable.Partition == _DirPartyTable.Partition ;return _LOGISTICSELECTRONICADDRESS.Locator;}

M E T H O D : O R D E R D I S P A T C H D E T A I L S

public str orderDispatchDetail(PACKINGSLIPID _packingSlipID){ //create Table Object (_custPackingSlipJour) CustPackingSlipJour _custPackingSlipJour; LOGISTICSPOSTALADDRESS _LOGISTICSPOSTALADDRESS; CustTable _custtable; str DcID; date DcDate;

7 Document By: Abdul Waqar | Young’s ERP | 2016-10-26

Page 8: Technical SMS Service Report

str DcCust; str DcCity; str DcQty; str DcAdda; select PACKINGSLIPID, DELIVERYDATE, DELIVERYNAME from _custPackingSlipJour join _LOGISTICSPOSTALADDRESS join _custtable where _custPackingSlipJour.PackingSlipId == _packingSlipID && _LOGISTICSPOSTALADDRESS.RECID == _custPackingSlipJour.DeliveryPostalAddress && _custPackingSlipJour.orderaccount == _custtable.accountnum ;

DcID = _custPackingSlipJour.PackingSlipId; DcDate = _custPackingSlipJour.DeliveryDate; DcCust = _custPackingSlipJour.DELIVERYNAME; DcCity = _LOGISTICSPOSTALADDRESS.City; DcAdda = _custtable.DestinationCodeId; // DcQty = _custPackingSlipJour.Qty;

/*User Message Details Total number of 14 digits but only last 4 digits are shows in message Customer name, city, date, and adda details with company define message*/ MsgData = "DC-" + subStr(DciD, 14 ,-4) + ", " + DcCust + ", " + DcCity + ", " + ",Adda Addrs- " + DcAdda + ", " + date2StrUsr( DcDate ) + " , " ; return MsgData; //info(MsgData);}

F O R M S C O D Evoid clicked(){ SendSMS sendSMS = new SendSMS(); //-- For Makro / Metro / Hyper Star Customer : sendSMS.SMSDetails( CustPackingSlipJour.InvoiceAccount, CustPackingSlipJour.PACKINGSLIPID ); } //-- For Others Customers else { //sendSMS obj is call hare sendSMS.SMSDetails(CustPackingSlipJour.InvoiceAccount, CustPackingSlipJour.PACKINGSLIPID ); }}

8 Document By: Abdul Waqar | Young’s ERP | 2016-10-26

Page 9: Technical SMS Service Report

D A T A B A S E T A B L E Cust Packing Slip journalDir Party TableLogistics Electronic AddressLogistics Postal AddressCust table

T A B L E F I E L D Cust peaking slip jour packing Slip IdCust peaking slip jour Delivery dateCust peaking slip jour Delivery nameLogistic Postal Address City Cust table Adda Number and Address

R E F E R E N C EMr. Alam - https://community.dynamics.com/ax/f/33/p/32783/210728#210728Mr. Haq Nawaz – senior Developer young’s food SSS SystemDynamics ax community

9 Document By: Abdul Waqar | Young’s ERP | 2016-10-26