POS数据收集WebService方式开发示例V10

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

1/33销售数据采集开发示例WebService2/33一、概述以下是在PowerBuilder8.0.3环境下编写的用webservice发送销售数据的开发示例。二、开发实现1)当一笔交易完成后,把生成的销售数据写成标准的XML文件格式,然后连接webserviceserver端,把XML文件发送到webserviceserver端。代码说明:1.交易处理过程中,先把交易数据保存到用户对象里面,这里调用了函数uo_sendsalesws.uf_setstruct(lstr_saleswsdata,lstr_TxSalesTotal,lstr_TxSalesItem_ws[],lstr_TxSalesTender_ws[])详细代码:publicsubroutineuf_setstruct(struct_saleswsdataastr_saleswsdata,struct_txsalestotalastr_txsalestotal,struct_txsalesitemastr_txsalesitem[],struct_txsalestenderastr_txsalestender[]);istr_saleswsdata=istr_saleswsdata_nullistr_txsalestotal=istr_txsalestotal_nullistr_txsalesitem[]=istr_txsalesitem_null[]istr_txsalestender[]=istr_txsalestender_null[]istr_saleswsdata=astr_saleswsdataistr_txsalestotal=astr_txsalestotalistr_txsalesitem[]=astr_txsalesitem[]istr_txsalestender[]=astr_txsalestender[]endsubroutineistr_saleswsdata保存的是销售数据的唯一标示istr_TxSalesTotal保存的是销售数据的抬头信息istr_TxSalesItem_ws[]保存的是销售数据的明细信息istr_TxSalesTender_ws[]保存的是销售数据的是付款方式信息2.在交易完成后,再调用函数3/33ls_Request=uo_sendsalesws.uf_buildxml()创建标准的XML文件。详细代码:publicfunctionstringuf_buildxml();stringls_Request=longll_rowstruct_saleswsdatalstr_salesdatastruct_txsalestotallstr_totalstruct_txsalesitemlstr_item[]struct_txsalestenderlstr_tender[]lstr_salesdata=istr_saleswsdatalstr_total=istr_txsalestotallstr_item[]=istr_txsalesitem_null[]lstr_item[]=istr_txsalesitem[]lstr_tender[]=istr_txsalestender_null[]lstr_tender[]=istr_txsalestender[]ls_Request='?xmlversion=1.0encoding=utf-8?'+'~r~n'ls_Request+='soap12:Envelopexmlns:xsi=:xsd=:soap12=~r~n'ls_Request+='soap12:Body'+'~r~n'ls_Request+='postsalescreatexmlns=~r~n'ls_Request+='astr_request'+'~r~n'ls_Request+='header'+'~r~n'ls_Request+='licensekey/licensekey'+'~r~n'ls_Request+='username'+lstr_salesdata.s_localstorecode+'/username'+'~r~n'ls_Request+='password'+lstr_salesdata.s_localstorecode+'/password'+'~r~n'ls_Request+='lang/lang'+'~r~n'ls_Request+='pagerecords'+is_pagerecords+'/pagerecords'+'~r~n'ls_Request+='pageno'+is_pageno+'/pageno'+'~r~n'ls_Request+='updatecount0/updatecount'+'~r~n'ls_Request+='messagetype'+is_messagetype+'/messagetype'+'~r~n'ls_Request+='messageid'+is_messageid+'/messageid'+'~r~n'ls_Request+='version'+is_version+'/version'+'~r~n'ls_Request+='/header'+'~r~n'4/33ls_Request+='salestotal'+'~r~n'ls_Request+='localstorecode'+lstr_salesdata.s_localstorecode+'/localstorecode'+'~r~n'ls_Request+='reservedocno/reservedocno'+'~r~n'ls_Request+='txdate_yyyymmdd'+STRING(lstr_salesdata.DT_TXDATE,'YYYYMMDD')+'/txdate_yyyymmdd'+'~r~n'ls_Request+='txtime_hhmmss'+lstr_salesdata.s_txtime+'/txtime_hhmmss'+'~r~n'ifisnull(lstr_salesdata.s_mallid)thenlstr_salesdata.s_mallid=''ls_Request+='mallid'+lstr_salesdata.s_mallid+'/mallid'+'~r~n'ls_Request+='storecode'+lstr_salesdata.s_storecode+'/storecode'+'~r~n'ls_Request+='tillid'+lstr_salesdata.s_tillid+'/tillid'+'~r~n'ls_Request+='salestype'+is_salestype+'/salestype'+'~r~n'ls_Request+='txdocno'+lstr_salesdata.s_docno+'/txdocno'+'~r~n'ls_Request+='orgtxdate_yyyymmdd/orgtxdate_yyyymmdd'+'~r~n'ls_Request+='orgstorecode/orgstorecode'+'~r~n'ls_Request+='orgtillid/orgtillid'+'~r~n'ls_Request+='txorgdocno/txorgdocno'+'~r~n'ls_Request+='mallitemcode/mallitemcode'+'~r~n'ls_Request+='cashier'+lstr_total.s_cashier+'/cashier'+'~r~n'ifisnull(lstr_total.s_clientcode)thenlstr_total.s_clientcode=''ls_Request+='vipcode'+lstr_total.s_clientcode+'/vipcode'+'~r~n'ifisnull(lstr_total.s_salesman)thenlstr_total.s_salesman=''ls_Request+='salesman'+lstr_total.s_salesman+'/salesman'+'~r~n'ls_Request+='demographiccode/demographiccode'+'~r~n'ls_Request+='demographicdata/demographicdata'+'~r~n'ls_Request+='netqty'+string(lstr_total.dec_NetQty,###########0.00)+'/netqty'+'~r~n'ls_Request+='originalamount'+string(lstr_total.dec_OriginalAmount,###########0.00)+'/originalamount'+'~r~n'ls_Request+='sellingamount'+string(lstr_total.dec_SellingAmount,###########0.00)+'/sellingamount'+'~r~n'ls_Request+='couponnumber/couponnumber'+'~r~n'ls_Request+='coupongroup/coupongroup'+'~r~n'ls_Request+='coupontype/coupontype'+'~r~n'ls_Request+='couponqty0/couponqty'+'~r~n'ls_Request+='totaldiscount'+'~r~n'ls_Request+='/totaldiscount'+'~r~n'ls_Request+='ttltaxamount10/ttltaxamount1'+'~r~n'ls_Request+='ttltaxamount20/ttltaxamount2'+'~r~n'5/33ls_Request+='netamount'+string(lstr_total.dec_NetAmount,###########0.00)+'/netamount'+'~r~n'ls_Request+='paidamount'+string(lstr_total.dec_PaidAmount,###########0.00)+'/paidamount'+'~r~n'ls_Request+='changeamount'+string(lstr_total.dec_ChangeAmount,###########0.00)+'/changeamount'+'~r~n'ls_Request+='priceincludetax/priceincludetax'+'~r~n'ls_Request+='shoptaxgroup/shoptaxgroup'+'~r~n'ls_Request+='extendparam/extendparam'+'~r~n'ls_Request+='in

1 / 33
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功