U811.1接口EAI系列之二-BOM构成-委外BOM构成--VB语言
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语言的更多相关文章
- U811.1接口EAI系列之二--生成销售出库单调用U8的EAI通用处理方法--PowerBuilder语言
1.销售系统销售出库,更新U811.1材料库存的EAI的XML生成. 2.主要根据U8配置会生成出库单和同时是否更新库存量,还是更新现存量等等. 3.具体参考代码如下: 作者:王春天 2013-11- ...
- U811.1接口EAI系列之六--物料上传--VB语言
1. 业务系统同步U811.1存货档案通用方法. 2.具体代码处理如下: 作者:王春天 2013-11-06 地址:http://www.cnblogs.com/spring_wang/p/34098 ...
- U811.1接口EAI系列之四--委外订单生成--VB语言
委外订单主细表.子个构成需求.具体代码与参数说明. 下面调用的通用方法在: http://www.cnblogs.com/spring_wang/p/3393147.html 作者:王春天 2013- ...
- U811.1接口EAI系列之一-通用访问EAI方法--统一调用EAI公共方法--VB语言
1.现在做的项目是关于业务系统与U811.1的接口项目. 2.那么就需要调整通过EAI调用生成U8业务单据. 3.下面就一个通用的向U8-EAI传递XML的通用方法 4.肯定有人会问怎么还用VB调用呢 ...
- U811.1接口EAI系列之一--通用把XML传送给EAI处理方法--PowerBuilder语言
1.前面配置参考:http://www.cnblogs.com/spring_wang/p/3393147.html 2.pb通用调EAI方法代码如下: //===================== ...
- U811.1接口EAI系列之五--材料出库--VB语言
主要业务有:09其他出库单 11:材料出库单 32:销售出库单 主要业务代码: '材料出库生成XML Public Function xml_storeout(ds_head As MSHFlexGr ...
- U811.1接口EAI系列之三--采购订单生成--VB语言
采购订单业务,下面是具体代码与参数说明: 下面调用的通用方法在: http://www.cnblogs.com/spring_wang/p/3393147.html 作者:王春天 2013-10-31 ...
- 【MM系列】SAP MM模块-委外采购订单 把Warning转换成Error信息提示
公众号:SAP Technical 本文作者:matinal 原文出处:http://www.cnblogs.com/SAPmatinal/ 原文链接:[MM系列]SAP MM模块-委外采购订单 把W ...
- C#微信公众号开发系列教程二(新手接入指南)
http://www.cnblogs.com/zskbll/p/4093954.html 此系列前面已经更新了两篇博文了,都是微信开发的前期准备工作,现在切入正题,本篇讲解新手接入的步骤与方法,大神可 ...
随机推荐
- Zabbix,Nagios,OneAPM Servers 安装部署大比拼
怎样高速实现对 Linux server的监控? 做过server监控的开发人员差点儿都知道 Zabbix 和 Nagios ,他们都是提供系统监控以及网络监控功能的开源解决方式.资历比較老.在不久前 ...
- hdu4403A very hard Aoshu problem 线段树
//给一个长度为大于2小于15的字符串 //在当中间加'+'或'='使得其成为一个等式的方法的个数 //枚举等号位置.暴力搜索加号加的位置 #include<cstdio> #includ ...
- Spring面试题一
目录一.Spring工作原理 二.为什么要用Spring三.请你谈谈SSH整合四.介绍一下Spring的事务管理五.什么是依赖注入,依赖注入的作用是什么? 六.什么是AOP,AOP的作用是什么? 七. ...
- DWR组件——基于远程过程调用实现Ajax
转载请注明原文地址:http://www.cnblogs.com/ygj0930/p/6686115.html 一:DWR的用途 DWR(Direct Web Remoting)是一个Web远程调用 ...
- python之模块cmath
# -*- coding: utf-8 -*-#python 27#xiaodeng#python之模块cmath #复数的数学函数,如log.tan.sin等函数用法,针对我目前的情况用途较少,暂不 ...
- 基于springboot的多数据源配置
发布时间:2018-12-11 技术:springboot1.5.1 + maven3.0.1+ mybatis-plus-boot-starter2.3.1 + dynamic-datasour ...
- CSVWriter生成文件时writer.writeRecord();方法保存的文件末尾多一个空行
一.问题,CSVWriter生成文件时使用writer.writeRecord();方法保存的文件末尾多一个空行,效果图如下: 目标结果:(去掉末尾空行) 二.关键代码如下(修改前代码): /** * ...
- ILP32、ILP64、LP64、LLP64、64位系统
Data Type ILP32 ILP64 LP64 LLP64char 8 8 8 ...
- windows修改环境变量
windows的环境变量有两套: 系统的 当前用户的 不同的用户可以拥有不同的环境变量,当前用户的环境变量优先级比系统的环境变量优先级高,PATH环境变量比较特殊,它不是替换而是拼接. 在命令行下也可 ...
- 进阶之路(基础篇) - 004 I/O的模拟量输出
/********************************* 代码功能:某输出模拟量 使用函数: analogWrite(引脚号,模拟量); //调用8位AD 创作时间:2016*10*08 ...