1.下面代码实现了VB6.0中调用U8EAI-BOM构成服务,以下代码均为项目实际代码,可直接复制应用。

2.在u811.1版本中委外BOM构成与正常的BOM构成是同系列表,不单独存储。

3.是以存货档案中有 委外标识标为是委外件。

4.下面调用的通用方法在: http://www.cnblogs.com/spring_wang/p/3393147.html

作者:王春天 2013-10-28

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

具体代码如下:

一、下面是实际调用的方法,其中一个参数是"Add"与"Edit"是新增构成还是修改构成。那条SQL查询是判断是否有在u8存在构成。

 '2.上传u8,如果上传成功再进行更新U8数据表
Dim flag '上传u8 3.先保存u8数据表 Set mrcu8 = U8Query("select * from v_BOM_BomParent where InvCode = '" & U(bpbh) & "'", msgtext) If mrcu8.EOF Then
If Outsourcing_bom(U(bpbh), labBpmc.Caption, FGridArg, "Add") = False Then
MsgBox ("委外构成上传U8出错!")
Exit Sub
End If
Else
If Outsourcing_bom(U(bpbh), labBpmc.Caption, FGridArg, "Edit") = False Then
MsgBox ("委外构成上传U8出错!")
Exit Sub
End If
End If

二、下面是公用调用EAI的BOM构成的方法。

其中更新Inventory存货档案表,是更新委外标识。

'ds_data 数据列 InvCode 子件编码,desl 定额数量
Public Function Outsourcing_bom(as_fjCode As String, as_fjName As String, ds_data As MSHFlexGrid, as_proc As String) As Boolean
'as_proc = "Edit" Outsourcing_bom = False
Dim ls_xml As String
Dim ls_sender As String
Dim ls_data As String
Dim ls_BomId As String
Dim ls_BomType As String
Dim ls_Version As String
Dim ls_VersionDesc As String
Dim ls_VersionEffDate As String
Dim ls_Status As String
Dim ls_VenCode As String
Dim ls_VenDesc As String
Dim ls_InvCode As String
Dim ls_InvName As String
Dim ls_ParentScrap As String
ls_sender = U8_XTM '"001" ls_InvCode = as_fjCode '"WW" '父件编码
ls_InvName = as_fjName '"委外测试" '父件名称 ls_BomType = "" 'BOM类型 不可为空
ls_Version = "" '版本号
ls_VersionDesc = "" '版本描述
ls_Status = "" 'BOM状态
ls_ParentScrap = "" '父件损耗率
ls_BomId = "" 'BOMID 不可为空
ls_VersionEffDate = "2000-01-01T00:00:00+00:00" '版本生效日 '增加文件头相关信息
ls_xml = "<?xml version=""1.0"" encoding=""UTF-8""?>" + vbCrLf ls_xml = ls_xml & "<ufinterface sender=""" & ls_sender & """ receiver=""u8"" roottag=""bom"" docid="""" proc=""" & as_proc & """ renewproofno = ""Y"" codeexchanged=""N"" exportneedexch=""N"" display="""" family="""" timestamp="""">" + vbCrLf
ls_xml = ls_xml & "<Bom>" + vbCrLf '一、增加文件中版本信息 version
ls_xml = ls_xml & "<Version>" + vbCrLf
ls_xml = ls_xml & "<BomId>" & ls_BomId & "</BomId>" + vbCrLf 'BOMID 不可为空
ls_xml = ls_xml & "<BomType>" & ls_BomType & "</BomType>" + vbCrLf 'BOM类型 不可为空
ls_xml = ls_xml & "<Version>" & ls_Version & "</Version>" + vbCrLf '版本号
ls_xml = ls_xml & "<VersionDesc>" & ls_VersionDesc & "</VersionDesc>" + vbCrLf '版本说明
ls_xml = ls_xml & "<VersionEffDate>" & ls_VersionEffDate & "</VersionEffDate>" + vbCrLf '版本生效日
ls_xml = ls_xml & "<IdentCode/>" + vbCrLf
ls_xml = ls_xml & "<IdentDesc/>" + vbCrLf
ls_xml = ls_xml & "<Define1/>" + vbCrLf
ls_xml = ls_xml & "<Define2/>" + vbCrLf
ls_xml = ls_xml & "<Define3/>" + vbCrLf
ls_xml = ls_xml & "<Define4/>" + vbCrLf
ls_xml = ls_xml & "<Define5/>" + vbCrLf
ls_xml = ls_xml & "<Define6/>" + vbCrLf
ls_xml = ls_xml & "<Define7/>" + vbCrLf
ls_xml = ls_xml & "<Define8/>" + vbCrLf
ls_xml = ls_xml & "<Define9/>" + vbCrLf
ls_xml = ls_xml & "<Define10/>" + vbCrLf
ls_xml = ls_xml & "<Define11/>" + vbCrLf
ls_xml = ls_xml & "<Define12/>" + vbCrLf
ls_xml = ls_xml & "<Define13/>" + vbCrLf
ls_xml = ls_xml & "<Define14/>" + vbCrLf
ls_xml = ls_xml & "<Define15/>" + vbCrLf
ls_xml = ls_xml & "<Define16/>" + vbCrLf
ls_xml = ls_xml & "<ApplyCode/>" + vbCrLf
ls_xml = ls_xml & "<ApplySeq/>" + vbCrLf
ls_xml = ls_xml & "<Status>" & ls_Status & "</Status>" + vbCrLf 'BOM状态
ls_xml = ls_xml & "<ModifyTime/>" + vbCrLf
ls_xml = ls_xml & "<CustCode/>" + vbCrLf
ls_xml = ls_xml & "<CustDesc/>" + vbCrLf
ls_xml = ls_xml & "<OrderType/>" + vbCrLf
ls_xml = ls_xml & "<OrderCode/>" + vbCrLf
ls_xml = ls_xml & "<OrderSeq/>" + vbCrLf
ls_xml = ls_xml & "<OrderDId/>" + vbCrLf
ls_xml = ls_xml & "<VenCode>" & ls_VenCode & "</VenCode>" + vbCrLf '供应商编码
ls_xml = ls_xml & "<VenDesc>" & ls_VenDesc & "</VenDesc>" + vbCrLf '供应商名称
Dim ls_ufts As String
ls_ufts = "AAAAAAA6aEU"
ls_xml = ls_xml & "<Ufts>" & ls_ufts & "</Ufts>" + vbCrLf ' '<Ufts>AAAAAAA6aEU=</Ufts>
ls_xml = ls_xml & "</Version>" + vbCrLf '增加文件中父件信息 Parent
ls_xml = ls_xml & "<Parent>" + vbCrLf
ls_xml = ls_xml & "<BomId>" & ls_BomId & "</BomId>" + vbCrLf 'BOMID 不可为空
ls_xml = ls_xml & "<InvCode>" & ls_InvCode & "</InvCode>" + vbCrLf '父件编码
ls_xml = ls_xml & "<InvName>" & ls_InvName & "</InvName>" + vbCrLf '父件名称
ls_xml = ls_xml & "<InvAddCode/>" + vbCrLf
ls_xml = ls_xml & "<Free1/>" + vbCrLf
ls_xml = ls_xml & "<Free2/>" + vbCrLf
ls_xml = ls_xml & "<Free3/>" + vbCrLf
ls_xml = ls_xml & "<Free4/>" + vbCrLf
ls_xml = ls_xml & "<Free5/>" + vbCrLf
ls_xml = ls_xml & "<Free6/>" + vbCrLf
ls_xml = ls_xml & "<Free7/>" + vbCrLf
ls_xml = ls_xml & "<Free8/>" + vbCrLf
ls_xml = ls_xml & "<Free9/>" + vbCrLf
ls_xml = ls_xml & "<Free10/>" + vbCrLf
ls_xml = ls_xml & "<EngineerFigNo/>" + vbCrLf
ls_xml = ls_xml & "<ParentScrap>" & ls_ParentScrap & "</ParentScrap>" + vbCrLf '父件损耗率
ls_xml = ls_xml & "</Parent>" + vbCrLf '二、Component 子件信息
For i = To ds_data.rows - 'ds_data.RecordCount ls_xml = ls_xml & "<Component>" + vbCrLf
' ls_data = "100000000" & Trim(str(i))
ls_data = ""
For j = To - Len(Trim(str(i)))
ls_data = ls_data & ""
Next j
ls_data = ls_data & Trim(str(i)) ls_xml = ls_xml & "<OpComponentId>" & ls_data & "</OpComponentId>" + vbCrLf '子件资料Id
ls_data = ""
ls_xml = ls_xml & "<BomId>" & ls_BomId & "</BomId>" + vbCrLf 'BomId
ls_data = Trim(str(i * ))
ls_xml = ls_xml & "<SortSeq>" & ls_data & "</SortSeq>" + vbCrLf '序号
ls_xml = ls_xml & "<OpSeq>0000</OpSeq>" + vbCrLf '子件编码
' If i = 1 Then
' ls_data = "3910510723"
' Else
' ls_data = "3910510523"
' End If
ls_data = Trim(ds_data.TextMatrix(i, )) ls_xml = ls_xml & "<InvCode>" & ls_data & "</InvCode>" + vbCrLf '子件编码
ls_xml = ls_xml & "<Free1/>" + vbCrLf
ls_xml = ls_xml & "<Free2/>" + vbCrLf
ls_xml = ls_xml & "<Free3/>" + vbCrLf
ls_xml = ls_xml & "<Free4/>" + vbCrLf
ls_xml = ls_xml & "<Free5/>" + vbCrLf
ls_xml = ls_xml & "<Free6/>" + vbCrLf
ls_xml = ls_xml & "<Free7/>" + vbCrLf
ls_xml = ls_xml & "<Free8/>" + vbCrLf
ls_xml = ls_xml & "<Free9/>" + vbCrLf
ls_xml = ls_xml & "<Free10/>" + vbCrLf
ls_xml = ls_xml & "<EngineerFigNo/>" + vbCrLf
ls_data = "2000-01-01T00:00:00+00:00"
ls_xml = ls_xml & "<EffBegDate>" & ls_data & "</EffBegDate>" + vbCrLf '子件生效日期
ls_data = "2099-12-31T00:00:00+00:00"
ls_xml = ls_xml & "<EffEndDate>" & ls_data & "</EffEndDate>" + vbCrLf '子件失效日期
ls_data = ""
ls_xml = ls_xml & "<FVFlag>" & ls_data & "</FVFlag>" + vbCrLf '固定/变动批量(0/1) '子件定额数量
ls_data = Trim(ds_data.TextMatrix(i, )) ls_xml = ls_xml & "<BaseQtyN>" & ls_data & "</BaseQtyN>" + vbCrLf '基本用量-分子
ls_data = ""
ls_xml = ls_xml & "<BaseQtyD>" & ls_data & "</BaseQtyD>" + vbCrLf '基本用量-分母
ls_data = ""
ls_xml = ls_xml & "<CompScrap>" & ls_data & "</CompScrap>" + vbCrLf '子件损耗率
ls_data = "false"
ls_xml = ls_xml & "<ByproductFlag>" & ls_data & "</ByproductFlag>" + vbCrLf '是否联副产品
ls_data = "" & Trim(str(i))
ls_data = ""
For j = To - Len(Trim(str(i)))
ls_data = ls_data & ""
Next j
ls_data = ls_data & Trim(str(i)) ls_xml = ls_xml & "<OptionsId>" & ls_data & "</OptionsId>" + vbCrLf '选项资料Id
ls_xml = ls_xml & "<AuxUnitCode/>" + vbCrLf
ls_xml = ls_xml & "<ChangeRate/>" + vbCrLf
ls_xml = ls_xml & "<AuxBaseQtyN/>" + vbCrLf
ls_data = ""
ls_xml = ls_xml & "<ProductType>" & ls_data & "</ProductType>" + vbCrLf '
ls_xml = ls_xml & "<Define22/>" + vbCrLf
ls_xml = ls_xml & "<Define23/>" + vbCrLf
ls_xml = ls_xml & "<Define24/>" + vbCrLf
ls_xml = ls_xml & "<Define25/>" + vbCrLf
ls_xml = ls_xml & "<Define26/>" + vbCrLf
ls_xml = ls_xml & "<Define27/>" + vbCrLf
ls_xml = ls_xml & "<Define28/>" + vbCrLf
ls_xml = ls_xml & "<Define29/>" + vbCrLf
ls_xml = ls_xml & "<Define30/>" + vbCrLf
ls_xml = ls_xml & "<Define31/>" + vbCrLf
ls_xml = ls_xml & "<Define32/>" + vbCrLf
ls_xml = ls_xml & "<Define33/>" + vbCrLf
ls_xml = ls_xml & "<Define34/>" + vbCrLf
ls_xml = ls_xml & "<Define35/>" + vbCrLf
ls_xml = ls_xml & "<Define36/>" + vbCrLf
ls_xml = ls_xml & "<Define37/>" + vbCrLf
ls_xml = ls_xml & "<Remark/>" + vbCrLf ls_xml = ls_xml & "</Component>" + vbCrLf
Next i '三、ComponentOpt 子件其它信息
For i = To ds_data.rows - 'ds_data.RecordCount
ls_xml = ls_xml & "<ComponentOpt>" + vbCrLf
' ls_data = "100000000" & Trim(str(i))
ls_data = ""
For j = To - Len(Trim(str(i)))
ls_data = ls_data & ""
Next j
ls_data = ls_data & Trim(str(i)) ls_xml = ls_xml & "<OptionsId>" & ls_data & "</OptionsId>" + vbCrLf '选项资料Id
ls_xml = ls_xml & "<Offset>0</Offset>" + vbCrLf
ls_data = ""
ls_xml = ls_xml & "<WIPType>" & ls_data & "</WIPType>" + vbCrLf 'WIP属性(1入库/2工序/3领料/4虚拟)
ls_data = "true"
ls_xml = ls_xml & "<AccuCostFlag>" & ls_data & "</AccuCostFlag>" + vbCrLf '是/否累计成本
ls_xml = ls_xml & "<DrawDeptCode/>" + vbCrLf
ls_xml = ls_xml & "<Whcode/>" + vbCrLf
ls_data = "false"
ls_xml = ls_xml & "<OptionalFlag>" & ls_data & "</OptionalFlag>" + vbCrLf '是否可选
ls_data = ""
ls_xml = ls_xml & "<MutexRule>" & ls_data & "</MutexRule>" + vbCrLf '互斥原则(1-ONE/2-ALL/3-ANY/4-AL0)
ls_data = ""
ls_xml = ls_xml & "<PlanFactor>" & ls_data & "</PlanFactor>" + vbCrLf '计划比例
ls_data = "false"
ls_xml = ls_xml & "<CostWIPRel>" & ls_data & "</CostWIPRel>" + vbCrLf '固定/变动批量(0/1)
ls_data = ""
ls_xml = ls_xml & "<Offset>" & ls_data & "</Offset>" + vbCrLf '偏置期
ls_xml = ls_xml & "</ComponentOpt>" + vbCrLf
Next i '增加文件尾相关信息
ls_xml = ls_xml & "</Bom>" + 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 Dim sqls() As String
Dim sqls_range
Dim msgtext As String sqls_range =
ReDim Preserve sqls(sqls_range)
sqls(sqls_range) = "update Inventory set bProxyForeign = 1 where cInvCode = '" & as_fjCode & "' " If U8Update(sqls, msgtext) = False Then
'数据库更新失败退出
MsgBox msgtext
Outsourcing_bom = False
Else
Outsourcing_bom = True
End If Else '失败
MsgBox ls_temp
Outsourcing_bom = False
End If End Function

U811.1接口EAI系列之二-BOM构成-委外BOM构成--VB语言的更多相关文章

  1. U811.1接口EAI系列之二--生成销售出库单调用U8的EAI通用处理方法--PowerBuilder语言

    1.销售系统销售出库,更新U811.1材料库存的EAI的XML生成. 2.主要根据U8配置会生成出库单和同时是否更新库存量,还是更新现存量等等. 3.具体参考代码如下: 作者:王春天 2013-11- ...

  2. U811.1接口EAI系列之六--物料上传--VB语言

    1. 业务系统同步U811.1存货档案通用方法. 2.具体代码处理如下: 作者:王春天 2013-11-06 地址:http://www.cnblogs.com/spring_wang/p/34098 ...

  3. U811.1接口EAI系列之四--委外订单生成--VB语言

    委外订单主细表.子个构成需求.具体代码与参数说明. 下面调用的通用方法在: http://www.cnblogs.com/spring_wang/p/3393147.html 作者:王春天 2013- ...

  4. U811.1接口EAI系列之一-通用访问EAI方法--统一调用EAI公共方法--VB语言

    1.现在做的项目是关于业务系统与U811.1的接口项目. 2.那么就需要调整通过EAI调用生成U8业务单据. 3.下面就一个通用的向U8-EAI传递XML的通用方法 4.肯定有人会问怎么还用VB调用呢 ...

  5. U811.1接口EAI系列之一--通用把XML传送给EAI处理方法--PowerBuilder语言

    1.前面配置参考:http://www.cnblogs.com/spring_wang/p/3393147.html 2.pb通用调EAI方法代码如下: //===================== ...

  6. U811.1接口EAI系列之五--材料出库--VB语言

    主要业务有:09其他出库单 11:材料出库单 32:销售出库单 主要业务代码: '材料出库生成XML Public Function xml_storeout(ds_head As MSHFlexGr ...

  7. U811.1接口EAI系列之三--采购订单生成--VB语言

    采购订单业务,下面是具体代码与参数说明: 下面调用的通用方法在: http://www.cnblogs.com/spring_wang/p/3393147.html 作者:王春天 2013-10-31 ...

  8. 【MM系列】SAP MM模块-委外采购订单 把Warning转换成Error信息提示

    公众号:SAP Technical 本文作者:matinal 原文出处:http://www.cnblogs.com/SAPmatinal/ 原文链接:[MM系列]SAP MM模块-委外采购订单 把W ...

  9. C#微信公众号开发系列教程二(新手接入指南)

    http://www.cnblogs.com/zskbll/p/4093954.html 此系列前面已经更新了两篇博文了,都是微信开发的前期准备工作,现在切入正题,本篇讲解新手接入的步骤与方法,大神可 ...

随机推荐

  1. 〖Linux〗Kubuntu14.04 平滑字体的设置

    有没有感觉终端的字体锯齿感觉非常强? 经过搜索后发现可以平滑字体显示得更漂亮一点: System Settings > Application Appearance > Fonts I e ...

  2. 〖Android〗dropbear一些操作命令备忘

    相关命令行: # 启动dropbear后台运行 /data/local/tmp/dropbear \ -A -N android -I -C -G -p \ -R /data/local/tmp/au ...

  3. SQL Server 2012 无人值守安装(加入新实例)

    方法1,通过指定条个參数安装 setup.exe /Q /IACCEPTSQLSERVERLICENSETERMS /ACTION=install /PID=<validpid> /FEA ...

  4. txt文件匹配脚本

    # -*- coding:utf-8 -*- import time start = time.clock() data=open("Data.txt","r" ...

  5. excel 上标和下标

    开始--字体--设置单元格格式--上标/下标

  6. XC文件管理器-打造优美易用的文件管理器

    技术:Android+java   概述 XC文件管理器,是基于Android6.0+开发的一个方便易用的文件管理器,具有文件的目录管理和文件的管理,主要包括文件的新建.删除.重命名.复制,移动剪切以 ...

  7. Golang Json文件解析为结构体工具-json2go

    代码地址如下:http://www.demodashi.com/demo/14946.html 概述 json2go是一个基于Golang开发的轻量json文件解析.转换命令行工具,目前支持转换输出到 ...

  8. ubuntu 16.04 LTS 修改 国内源(以中科大源为例)

    国内有很多ubuntu的源,包括:网易源(这个之前用过,速度很快的),阿里源,还有很多教育网的源,如:清华源,中科大源. 这里要下载的是中科大ubuntu16.04的源列表,可以在这里获得:https ...

  9. 向大家介绍15个漂亮的Ubuntu GDM主题

    没事向大家介绍几个Ubuntu GDM主题,希望大家喜欢,这些Ubuntu GDM主题是我找了很久的…… "GNOME Display Manager允许用户轻松的设定登录界面主题.网上有大 ...

  10. HDUOJ-----Computer Transformation

    Computer Transformation Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/ ...