主要业务有:09其他出库单 11:材料出库单 32:销售出库单

主要业务代码:

'材料出库生成XML
Public Function xml_storeout(ds_head As MSHFlexGrid, ds_detail As MSHFlexGrid, as_proc As String) As Boolean
xml_storeout = True
Dim ls_xml As String
Dim ls_data As String '增加文件头相关信息
ls_xml = "<?xml version=""1.0"" encoding=""UTF-8""?>" + vbCrLf ls_xml = ls_xml & "<ufinterface sender=""" & U8_XTM & """ receiver=""u8"" roottag=""storeout"" docid="""" proc=""" & as_proc & """ renewproofno = ""Y"" codeexchanged=""N"" exportneedexch=""N"" display="""" family="""" timestamp="""">" + vbCrLf '增加文件中数据项信息 header
ls_xml = ls_xml & "<storeout>" + vbCrLf
ls_xml = ls_xml & "<header>" + vbCrLf
ls_data = ""
ls_xml = ls_xml & "<receiveflag>" & ls_data & "</receiveflag>" + vbCrLf '收发标志 入库单-收 1,出库单-发 0
ls_data = ""
ls_xml = ls_xml & "<vouchtype>" & ls_data & "</vouchtype>" + vbCrLf '单据类型 09:其他出库单 11:材料出库单 32:销售出库单
ls_data = Trim(ds_head.TextMatrix(, ))
ls_xml = ls_xml & "<businesstype>" & ls_data & "</businesstype>" + vbCrLf '业务类型
ls_data = Trim(ds_head.TextMatrix(, ))
ls_xml = ls_xml & "<source>" & ls_data & "</source>" + vbCrLf '单据来源 采购、销售、库存、存货
ls_data = Trim(ds_head.TextMatrix(, ))
ls_xml = ls_xml & "<businesscode>" & ls_data & "</businesscode>" + vbCrLf '对应业务单号
ls_data = Trim(ds_head.TextMatrix(, ))
ls_xml = ls_xml & "<warehousecode>" & ls_data & "</warehousecode>" + vbCrLf '仓库编码
ls_data = Format(Trim(ds_head.TextMatrix(, )), "0000-00-00")
ls_xml = ls_xml & "<date>" & ls_data & "</date>" + vbCrLf '单据日期
ls_data = Trim(ds_head.TextMatrix(, ))
ls_xml = ls_xml & "<code>" & ls_data & "</code>" + vbCrLf '单据号
ls_data = Trim(ds_head.TextMatrix(, )) '根据出库类别基本档案表
ls_xml = ls_xml & "<receivecode>" & ls_data & "</receivecode>" + vbCrLf '收发类别编码
ls_data = Trim(ds_head.TextMatrix(, ))
ls_xml = ls_xml & "<departmentcode>" & ls_data & "</departmentcode>" + vbCrLf '部门编码
ls_data = Trim(ds_head.TextMatrix(, ))
ls_xml = ls_xml & "<personcode>" & ls_data & "</personcode>" + vbCrLf '职员编码 业务员
ls_data = ""
ls_xml = ls_xml & "<purchasetypecode>" & ls_data & "</purchasetypecode>" + vbCrLf '采购类型编码 采购入库用
ls_data = ""
ls_xml = ls_xml & "<saletypecode>" & ls_data & "</saletypecode>" + vbCrLf '销售类型编码 销售出库用
ls_data = ""
ls_xml = ls_xml & "<customercode>" & ls_data & "</customercode>" + vbCrLf '客户编码 销售出库单、其他出库单用
ls_data = ""
ls_xml = ls_xml & "<customerccode>" & ls_data & "</customerccode>" + vbCrLf '客户分类
ls_data = ""
ls_xml = ls_xml & "<cacauthcode>" & ls_data & "</cacauthcode>" + vbCrLf '不清楚做什么用的
ls_data = ""
ls_xml = ls_xml & "<vendorcode>" & ls_data & "</vendorcode>" + vbCrLf '供应商编码 采购入库单、其他入库单用
ls_data = ""
ls_xml = ls_xml & "<ordercode>" & ls_data & "</ordercode>" + vbCrLf '订单号
ls_data = ""
ls_xml = ls_xml & "<quantity>" & ls_data & "</quantity>" + vbCrLf '产量
ls_data = ""
ls_xml = ls_xml & "<arrivecode>" & ls_data & "</arrivecode>" + vbCrLf '到货单号 采购入库单用
ls_data = ""
ls_xml = ls_xml & "<billcode>" & ls_data & "</billcode>" + vbCrLf '发票号 采购入库单、销售出库单用
ls_data = ""
ls_xml = ls_xml & "<consignmentcode>" & ls_data & "</consignmentcode>" + vbCrLf '发货单号 销售出库单用
ls_data = ""
ls_xml = ls_xml & "<arrivedate>" & ls_data & "</arrivedate>" + vbCrLf '到货日期
ls_data = ""
ls_xml = ls_xml & "<checkcode>" & ls_data & "</checkcode>" + vbCrLf '检验单号
ls_data = ""
ls_xml = ls_xml & "<checkdate>" & ls_data & "</checkdate>" + vbCrLf '检验日期
ls_data = ""
ls_xml = ls_xml & "<checkperson>" & ls_data & "</checkperson>" + vbCrLf '检验员 编码
ls_data = ""
ls_xml = ls_xml & "<templatenumber>" & ls_data & "</templatenumber>" + vbCrLf '模版号
ls_data = ""
ls_xml = ls_xml & "<serial>" & ls_data & "</serial>" + vbCrLf '生产批号 产成品入库单、材料出库单用
ls_data = "demo"
ls_xml = ls_xml & "<handler>" & ls_data & "</handler>" + vbCrLf '经手人 编码
ls_data = ""
ls_xml = ls_xml & "<memory>" & ls_data & "</memory>" + vbCrLf '备注
ls_data = Trim(ds_head.TextMatrix(, ))
ls_xml = ls_xml & "<maker>" & ls_data & "</maker>" + vbCrLf '制单人
ls_data = ""
ls_xml = ls_xml & "<chandler>" & ls_data & "</chandler>" + vbCrLf '审核人
ls_data = ""
ls_xml = ls_xml & "<define1>" & ls_data & "</define1>" + vbCrLf '自定义字段1
ls_data = ""
ls_xml = ls_xml & "<define2>" & ls_data & "</define2>" + vbCrLf '自定义字段2
ls_data = ""
ls_xml = ls_xml & "<define3>" & ls_data & "</define3>" + vbCrLf '自定义字段3
ls_data = ""
ls_xml = ls_xml & "<define4>" & ls_data & "</define4>" + vbCrLf '自定义字段4
ls_data = ""
ls_xml = ls_xml & "<define5>" & ls_data & "</define5>" + vbCrLf '自定义字段5
ls_data = ""
ls_xml = ls_xml & "<define6>" & ls_data & "</define6>" + vbCrLf '自定义字段6
ls_data = ""
ls_xml = ls_xml & "<define7>" & ls_data & "</define7>" + vbCrLf '自定义字段7
ls_data = ""
ls_xml = ls_xml & "<define8>" & ls_data & "</define8>" + vbCrLf '自定义字段8
ls_data = ""
ls_xml = ls_xml & "<define9>" & ls_data & "</define9>" + vbCrLf '自定义字段9
ls_data = ""
ls_xml = ls_xml & "<define10>" & ls_data & "</define10>" + vbCrLf '自定义字段10
ls_data = ""
ls_xml = ls_xml & "<define11>" & ls_data & "</define11>" + vbCrLf '自定义字段11
ls_data = ""
ls_xml = ls_xml & "<define12>" & ls_data & "</define12>" + vbCrLf '自定义字段12
ls_data = ""
ls_xml = ls_xml & "<define13>" & ls_data & "</define13>" + vbCrLf '自定义字段13
ls_data = ""
ls_xml = ls_xml & "<define14>" & ls_data & "</define14>" + vbCrLf '自定义字段14
ls_data = ""
ls_xml = ls_xml & "<define15>" & ls_data & "</define15>" + vbCrLf '自定义字段15
ls_data = ""
ls_xml = ls_xml & "<define16>" & ls_data & "</define16>" + vbCrLf '自定义字段16
ls_data = ""
ls_xml = ls_xml & "<auditdate>" & ls_data & "</auditdate>" + vbCrLf '审核日期
ls_data = ""
ls_xml = ls_xml & "<taxrate>" & ls_data & "</taxrate>" + vbCrLf '税率
ls_data = ""
ls_xml = ls_xml & "<exchname>" & ls_data & "</exchname>" + vbCrLf '币种名称
ls_data = ""
ls_xml = ls_xml & "<exchrate>" & ls_data & "</exchrate>" + vbCrLf '汇率
ls_data = ""
ls_xml = ls_xml & "<discounttaxtype>" & ls_data & "</discounttaxtype>" + vbCrLf '扣税类别
ls_data = ""
ls_xml = ls_xml & "<contact>" & ls_data & "</contact>" + vbCrLf '不清楚XML中含义
ls_data = ""
ls_xml = ls_xml & "<phone>" & ls_data & "</phone>" + vbCrLf '不清楚XML中含义
ls_data = ""
ls_xml = ls_xml & "<mobile>" & ls_data & "</mobile>" + vbCrLf '不清楚XML中含义
ls_data = ""
ls_xml = ls_xml & "<address>" & ls_data & "</address>" + vbCrLf '不清楚XML中含义
ls_data = ""
ls_xml = ls_xml & "<conphone>" & ls_data & "</conphone>" + vbCrLf '不清楚XML中含义
ls_data = ""
ls_xml = ls_xml & "<conmobile>" & ls_data & "</conmobile>" + vbCrLf '不清楚XML中含义
ls_data = ""
ls_xml = ls_xml & "<deliverunit>" & ls_data & "</deliverunit>" + vbCrLf '不清楚XML中含义
ls_data = ""
ls_xml = ls_xml & "<contactname>" & ls_data & "</contactname>" + vbCrLf '不清楚XML中含义
ls_data = ""
ls_xml = ls_xml & "<officephone>" & ls_data & "</officephone>" + vbCrLf '不清楚XML中含义
ls_data = ""
ls_xml = ls_xml & "<mobilephone>" & ls_data & "</mobilephone>" + vbCrLf '不清楚XML中含义
ls_data = ""
ls_xml = ls_xml & "<psnophone>" & ls_data & "</psnophone>" + vbCrLf '不清楚XML中含义
ls_data = ""
ls_xml = ls_xml & "<psnmobilephone>" & ls_data & "</psnmobilephone>" + vbCrLf '不清楚XML中含义
ls_data = ""
ls_xml = ls_xml & "<shipaddress>" & ls_data & "</shipaddress>" + vbCrLf '不清楚XML中含义
ls_data = ""
ls_xml = ls_xml & "<addcode>" & ls_data & "</addcode>" + vbCrLf '不清楚XML中含义
ls_data = ""
ls_xml = ls_xml & "<iscomplement>" & ls_data & "</iscomplement>" + vbCrLf '补料标志
ls_xml = ls_xml & "</header>" + vbCrLf 'body
ls_xml = ls_xml & "<body>" + vbCrLf
For i = To ds_detail.rows -
ls_xml = ls_xml & "<entry>" + vbCrLf
ls_data = ""
ls_xml = ls_xml & "<barcode>" & ls_data & "</barcode>" + vbCrLf '条形码
ls_data = Trim(ds_detail.TextMatrix(i, ))
ls_xml = ls_xml & "<inventorycode>" & ls_data & "</inventorycode>" + vbCrLf '存货编码
ls_data = ""
ls_xml = ls_xml & "<free1>" & ls_data & "</free1>" + vbCrLf '自由项1
ls_data = ""
ls_xml = ls_xml & "<free2>" & ls_data & "</free2>" + vbCrLf '自由项2
ls_data = ""
ls_xml = ls_xml & "<free3>" & ls_data & "</free3>" + vbCrLf '自由项3
ls_data = ""
ls_xml = ls_xml & "<free4>" & ls_data & "</free4>" + vbCrLf '自由项4
ls_data = ""
ls_xml = ls_xml & "<free5>" & ls_data & "</free5>" + vbCrLf '自由项5
ls_data = ""
ls_xml = ls_xml & "<free6>" & ls_data & "</free6>" + vbCrLf '自由项6
ls_data = ""
ls_xml = ls_xml & "<free7>" & ls_data & "</free7>" + vbCrLf '自由项7
ls_data = ""
ls_xml = ls_xml & "<free8>" & ls_data & "</free8>" + vbCrLf '自由项8
ls_data = ""
ls_xml = ls_xml & "<free9>" & ls_data & "</free9>" + vbCrLf '自由项9
ls_data = ""
ls_xml = ls_xml & "<free10>" & ls_data & "</free10>" + vbCrLf '自由项10
ls_data = ""
ls_xml = ls_xml & "<shouldquantity>" & ls_data & "</shouldquantity>" + vbCrLf '应收(发)数量
ls_data = ""
ls_xml = ls_xml & "<shouldnumber>" & ls_data & "</shouldnumber>" + vbCrLf '应收(发)件数
ls_data = Trim(ds_detail.TextMatrix(i, ))
ls_xml = ls_xml & "<quantity>" & ls_data & "</quantity>" + vbCrLf '数量(主记量数量) 应收(发)数量和数量不能同时为空。
ls_data = Trim(ds_detail.TextMatrix(i, ))
ls_xml = ls_xml & "<cmassunitname>" & ls_data & "</cmassunitname>" + vbCrLf '主记量单位名称
ls_data = ""
ls_xml = ls_xml & "<assitantunit>" & ls_data & "</assitantunit>" + vbCrLf '辅记量单位
ls_data = ""
ls_xml = ls_xml & "<assitantunitname>" & ls_data & "</assitantunitname>" + vbCrLf '辅记量单位名称
ls_data = ""
ls_xml = ls_xml & "<irate>" & ls_data & "</irate>" + vbCrLf '换算率?
ls_data = ""
ls_xml = ls_xml & "<number>" & ls_data & "</number>" + vbCrLf '件数
ls_data = ""
ls_xml = ls_xml & "<price>" & ls_data & "</price>" + vbCrLf '单价
ls_data = ""
ls_xml = ls_xml & "<cost>" & ls_data & "</cost>" + vbCrLf '金额
ls_data = ""
ls_xml = ls_xml & "<plancost>" & ls_data & "</plancost>" + vbCrLf '计划单价?
ls_data = ""
ls_xml = ls_xml & "<planprice>" & ls_data & "</planprice>" + vbCrLf '计划金额?
ls_data = ""
ls_xml = ls_xml & "<serial>" & ls_data & "</serial>" + vbCrLf '批号
ls_data = ""
ls_xml = ls_xml & "<makedate>" & ls_data & "</makedate>" + vbCrLf '生产日期
ls_data = ""
ls_xml = ls_xml & "<validdate>" & ls_data & "</validdate>" + vbCrLf '失效日期)
ls_data = ""
ls_xml = ls_xml & "<transitionid>" & ls_data & "</transitionid>" + vbCrLf '调拨单子表ID号
ls_data = ""
ls_xml = ls_xml & "<subbillcode>" & ls_data & "</subbillcode>" + vbCrLf '发票子表ID号
ls_data = ""
ls_xml = ls_xml & "<subpurchaseid>" & ls_data & "</subpurchaseid>" + vbCrLf '采购订单子表ID号
ls_data = Trim(ds_detail.TextMatrix(i, ))
ls_xml = ls_xml & "<position>" & ls_data & "</position>" + vbCrLf '货位
ls_data = ""
ls_xml = ls_xml & "<itemclasscode>" & ls_data & "</itemclasscode>" + vbCrLf '项目大类编码
ls_data = ""
ls_xml = ls_xml & "<itemclassname>" & ls_data & "</itemclassname>" + vbCrLf '项目大类名称
ls_data = Trim(ds_detail.TextMatrix(i, ))
ls_xml = ls_xml & "<itemcode>" & ls_data & "</itemcode>" + vbCrLf '项目编码
ls_data = ""
ls_xml = ls_xml & "<itemname>" & ls_data & "</itemname>" + vbCrLf '项目名称
ls_data = ""
ls_xml = ls_xml & "<define22>" & ls_data & "</define22>" + vbCrLf '表体自定义项22
ls_data = ""
ls_xml = ls_xml & "<define23>" & ls_data & "</define23>" + vbCrLf '表体自定义项23
ls_data = ""
ls_xml = ls_xml & "<define24>" & ls_data & "</define24>" + vbCrLf '表体自定义项24
ls_data = ""
ls_xml = ls_xml & "<define25>" & ls_data & "</define25>" + vbCrLf '表体自定义项25
ls_data = ""
ls_xml = ls_xml & "<define26>" & ls_data & "</define26>" + vbCrLf '表体自定义项26
ls_data = ""
ls_xml = ls_xml & "<define27>" & ls_data & "</define27>" + vbCrLf '表体自定义项27
ls_data = ""
ls_xml = ls_xml & "<define28>" & ls_data & "</define28>" + vbCrLf '表体自定义项28
ls_data = ""
ls_xml = ls_xml & "<define29>" & ls_data & "</define29>" + vbCrLf '表体自定义项29
ls_data = ""
ls_xml = ls_xml & "<define30>" & ls_data & "</define30>" + vbCrLf '表体自定义项30
ls_data = ""
ls_xml = ls_xml & "<define31>" & ls_data & "</define31>" + vbCrLf '表体自定义项31
ls_data = ""
ls_xml = ls_xml & "<define32>" & ls_data & "</define32>" + vbCrLf '表体自定义项32
ls_data = ""
ls_xml = ls_xml & "<define33>" & ls_data & "</define33>" + vbCrLf '表体自定义项33
ls_data = ""
ls_xml = ls_xml & "<define34>" & ls_data & "</define34>" + vbCrLf '表体自定义项34
ls_data = ""
ls_xml = ls_xml & "<define35>" & ls_data & "</define35>" + vbCrLf '表体自定义项35
ls_data = ""
ls_xml = ls_xml & "<define36>" & ls_data & "</define36>" + vbCrLf '表体自定义项36
ls_data = ""
ls_xml = ls_xml & "<define37>" & ls_data & "</define37>" + vbCrLf '表体自定义项37
ls_data = ""
ls_xml = ls_xml & "<subconsignmentid>" & ls_data & "</subconsignmentid>" + vbCrLf '发货单子表ID
ls_data = ""
ls_xml = ls_xml & "<delegateconsignmentid>" & ls_data & "</delegateconsignmentid>" + vbCrLf '委托代销发货单子表
ls_data = ""
ls_xml = ls_xml & "<subproducingid>" & ls_data & "</subproducingid>" + vbCrLf '生产订单子表ID
ls_data = ""
ls_xml = ls_xml & "<subcheckid>" & ls_data & "</subcheckid>" + vbCrLf '检验单子表ID
ls_data = ""
ls_xml = ls_xml & "<cRejectCode>" & ls_data & "</cRejectCode>" + vbCrLf '不良品处理单号
ls_data = ""
ls_xml = ls_xml & "<iRejectIds>" & ls_data & "</iRejectIds>" + vbCrLf '不良品处理单ID
ls_data = ""
ls_xml = ls_xml & "<cCheckPersonCode>" & ls_data & "</cCheckPersonCode>" + vbCrLf '检验员
ls_data = ""
ls_xml = ls_xml & "<dCheckDate>" & ls_data & "</dCheckDate>" + vbCrLf '检验日期
ls_data = ""
ls_xml = ls_xml & "<cCheckCode>" & ls_data & "</cCheckCode>" + vbCrLf '检验单号
ls_data = ""
ls_xml = ls_xml & "<iMassDate>" & ls_data & "</iMassDate>" + vbCrLf '保质期天数
ls_data = ""
ls_xml = ls_xml & "<ioritaxcost>" & ls_data & "</ioritaxcost>" + vbCrLf '不清楚XML中具体含义
ls_data = ""
ls_xml = ls_xml & "<ioricost>" & ls_data & "</ioricost>" + vbCrLf '不清楚XML中具体含义
ls_data = ""
ls_xml = ls_xml & "<iorimoney>" & ls_data & "</iorimoney>" + vbCrLf '不清楚XML中具体含义
ls_data = ""
ls_xml = ls_xml & "<ioritaxprice>" & ls_data & "</ioritaxprice>" + vbCrLf '不清楚XML中具体含义
ls_data = ""
ls_xml = ls_xml & "<iorisum>" & ls_data & "</iorisum>" + vbCrLf '不清楚XML中具体含义
ls_data = ""
ls_xml = ls_xml & "<taxrate>" & ls_data & "</taxrate>" + vbCrLf '不清楚XML中具体含义
ls_data = ""
ls_xml = ls_xml & "<taxprice>" & ls_data & "</taxprice>" + vbCrLf '不清楚XML中具体含义
ls_data = ""
ls_xml = ls_xml & "<isum>" & ls_data & "</isum>" + vbCrLf '不清楚XML中具体含义
ls_data = ""
ls_xml = ls_xml & "<massunit>" & ls_data & "</massunit>" + vbCrLf '保质期单位
ls_data = ""
ls_xml = ls_xml & "<vmivencode>" & ls_data & "</vmivencode>" + vbCrLf '代管商编码
ls_data = ""
ls_xml = ls_xml & "<whpersoncode>" & ls_data & "</whpersoncode>" + vbCrLf '库管员编码
ls_data = ""
ls_xml = ls_xml & "<whpersonname>" & ls_data & "</whpersonname>" + vbCrLf '库管员名称
ls_data = ""
ls_xml = ls_xml & "<batchproperty1>" & ls_data & "</batchproperty1>" + vbCrLf '属性1
ls_data = ""
ls_xml = ls_xml & "<batchproperty2>" & ls_data & "</batchproperty2>" + vbCrLf '属性2
ls_data = ""
ls_xml = ls_xml & "<batchproperty3>" & ls_data & "</batchproperty3>" + vbCrLf '属性3
ls_data = ""
ls_xml = ls_xml & "<batchproperty4>" & ls_data & "</batchproperty4>" + vbCrLf '属性4
ls_data = ""
ls_xml = ls_xml & "<batchproperty5>" & ls_data & "</batchproperty5>" + vbCrLf '属性5
ls_data = ""
ls_xml = ls_xml & "<batchproperty6>" & ls_data & "</batchproperty6>" + vbCrLf '属性6
ls_data = ""
ls_xml = ls_xml & "<batchproperty7>" & ls_data & "</batchproperty7>" + vbCrLf '属性7
ls_data = ""
ls_xml = ls_xml & "<batchproperty8>" & ls_data & "</batchproperty8>" + vbCrLf '属性8
ls_data = ""
ls_xml = ls_xml & "<batchproperty9>" & ls_data & "</batchproperty9>" + vbCrLf '属性9
ls_data = ""
ls_xml = ls_xml & "<batchproperty10>" & ls_data & "</batchproperty10>" + vbCrLf '属性10
ls_data = ""
ls_xml = ls_xml & "<iexpiratdatecalcu>" & ls_data & "</iexpiratdatecalcu>" + vbCrLf '有效期推算方式
ls_data = ""
ls_xml = ls_xml & "<dexpirationdate>" & ls_data & "</dexpirationdate>" + vbCrLf '有效期计算项
ls_data = ""
ls_xml = ls_xml & "<cexpirationdate>" & ls_data & "</cexpirationdate>" + vbCrLf '有效期至
ls_data = ""
ls_xml = ls_xml & "<memory>" & ls_data & "</memory>" + vbCrLf '备注
ls_xml = ls_xml & "</entry>" + vbCrLf
Next i
ls_xml = ls_xml & "</body>" + vbCrLf '增加文件尾相关信息
ls_xml = ls_xml & "</storeout>" + vbCrLf
ls_xml = ls_xml & "</ufinterface>" + vbCrLf
' Dim xml_document As New DOMDocument
' xml_document.loadXML (ls_xml)
' fn2 = App.Path & "\u8_code2.xml"
' xml_document.save (fn2)
Dim ls_temp As String '接收返回消息,如果成功,返回U8中出库单号,如果失败,返回错误信息
If SendToEAI(ls_xml, ls_temp) Then '成功
MsgBox "上传成功" & ls_temp
Else '失败
MsgBox ls_temp
xml_storeout = False
End If
End Function

作者:王春天 2013-11-03

地址:http://www.cnblogs.com/spring_wang/p/3404620.html

05-11 13:00