委外订单主细表、子个构成需求。具体代码与参数说明。
下面调用的通用方法在: http://www.cnblogs.com/spring_wang/p/3393147.html
作者:王春天 2013-10-31
地址:http://www.cnblogs.com/spring_wang/p/3399331.html
1.具体代码:
'委外订单生成XML Public Function xml_omorder(ds_data As ADODB.Recordset, as_proc As String) As Boolean xml_omorder = True Dim ls_xml As String Dim ls_sender As String Dim ls_code As String Dim ls_date As String Dim ls_vendorcode As String Dim ls_deptcode As String Dim ls_personcode As String Dim ls_purchase_type_code As String Dim ls_operation_type_code As String Dim ls_address As String Dim ls_recsend_type As String Dim ls_idiscounttaxtype As String Dim ls_currency_name As String Dim ls_currency_rate As String Dim ls_tax_rate As String Dim ls_paycondition_code As String Dim ls_traffic_money As String Dim ls_bargain As String Dim ls_remark As String Dim ls_period As String Dim ls_maker As String Dim i As Long Dim j As Long Dim ls_data As String ls_code = "ddd000312" '订单编号 ls_date = "2013-10-14" '订单日期 ls_vendorcode = "00001" '供应商编号 ls_deptcode = "" '"101" '部门编号 ls_personcode = "koutao" '业务员 ls_purchase_type_code = "" '采购类型编码 ls_operation_type_code = "委外加工" '业务类型 ls_address = "" '到货地址 ls_recsend_type = "" '运输方式 ' ls_idiscounttaxtype = "0" '扣税类别 (0应税外加,1应税内含) ls_currency_name = "美元" '外币名称 ls_currency_rate = "8" '汇率 ls_tax_rate = "17" '税率 ls_paycondition_code = "" '付款条件 ls_traffic_money = "0" '运费 ls_bargain = "0" '定金 ls_remark = "" '备注 ls_period = "" '采购计划期间 ls_maker = "肖雨" '制单人 '增加文件头相关信息 ls_xml = "<?xml version=""1.0"" encoding=""UTF-8""?>" + vbCrLf ls_xml = ls_xml & "<ufinterface sender=""" & u8_xtm & """ receiver=""u8"" roottag=""omorder"" docid="""" proc=""" & as_proc & """ renewproofno = ""Y"" codeexchanged=""N"" exportneedexch=""N"" display="""" family="""" timestamp="""">" + vbCrLf '增加文件中数据项信息 header ls_xml = ls_xml & "<omorder>" + vbCrLf ls_xml = ls_xml & "<header>" + vbCrLf ls_xml = ls_xml & "<code>" & ls_code & "</code>" + vbCrLf '订单编号 ls_xml = ls_xml & "<date>" & ls_date & "</date>" + vbCrLf '订单日期 ls_xml = ls_xml & "<vendorcode>" & ls_vendorcode & "</vendorcode>" + vbCrLf '供应商编号 ls_xml = ls_xml & "<deptcode>" & ls_deptcode & "</deptcode>" + vbCrLf '部门编号 ls_xml = ls_xml & "<personcode>" & ls_personcode & "</personcode>" + vbCrLf '业务员 ls_xml = ls_xml & "<purchase_type_code>" & ls_purchase_type_code & "</purchase_type_code>" + vbCrLf '采购类型编码
ls_xml = ls_xml & "<ordertype>0</ordertype>" + vbCrLf
ls_xml = ls_xml & "<operation_type_code>" & ls_operation_type_code & "</operation_type_code>" + vbCrLf '业务类型 ls_xml = ls_xml & "<address>" & ls_address & "</address>" + vbCrLf '到货地址 ls_xml = ls_xml & "<recsend_type>" & ls_recsend_type & "</recsend_type>" + vbCrLf '运输方式 ls_xml = ls_xml & "<currency_name>" & ls_currency_name & "</currency_name>" + vbCrLf '外币名称 ls_xml = ls_xml & "<currency_rate>" & ls_currency_rate & "</currency_rate>" + vbCrLf '汇率 ls_xml = ls_xml & "<tax_rate>" & ls_tax_rate & "</tax_rate>" + vbCrLf '税率 ls_xml = ls_xml & "<paycondition_code>" & ls_paycondition_code & "</paycondition_code>" + vbCrLf '付款条件 ls_xml = ls_xml & "<traffic_money>" & ls_traffic_money & "</traffic_money>" + vbCrLf '运费 ls_xml = ls_xml & "<bargain>" & ls_bargain & "</bargain>" + vbCrLf '定金 ls_xml = ls_xml & "<remark>" & ls_remark & "</remark>" + vbCrLf '备注 ls_xml = ls_xml & "<maker>" & ls_maker & "</maker>" + vbCrLf '制单人 ls_xml = ls_xml & "</header>" + vbCrLf 'body ls_xml = ls_xml & "<body>" + vbCrLf For i = 1 To 1 'ds_data.RecordCount ls_xml = ls_xml & "<entry>" + vbCrLf ls_data = "A0001" ls_xml = ls_xml & "<inventorycode>" & ls_data & "</inventorycode>" + vbCrLf '母件存货编码 ls_data = "0" ls_xml = ls_xml & "<checkflag>" & ls_data & "</checkflag>" + vbCrLf '是否检验 ls_data = "002002" ls_xml = ls_xml & "<unitcode>" & ls_data & "</unitcode>" + vbCrLf '物料单位编码 ls_data = "10" ls_xml = ls_xml & "<quantity>" & ls_data & "</quantity>" + vbCrLf '主计量数量 ls_data = "0" ls_xml = ls_xml & "<num>" & ls_data & "</num>" + vbCrLf '辅计量数量 ls_data = "" ls_xml = ls_xml & "<quotedprice>" & ls_data & "</quotedprice>" + vbCrLf '报价 ls_data = "1000" ls_xml = ls_xml & "<price>" & ls_data & "</price>" + vbCrLf '单价(原币,无税) ls_data = "1170" ls_xml = ls_xml & "<taxprice>" & ls_data & "</taxprice>" + vbCrLf '含税单价(原币,无税) ls_data = "10000" ls_xml = ls_xml & "<money>" & ls_data & "</money>" + vbCrLf '金额(原币,无税) ls_data = "1700" ls_xml = ls_xml & "<tax>" & ls_data & "</tax>" + vbCrLf '税额(原币) ls_data = "11700" ls_xml = ls_xml & "<sum>" & ls_data & "</sum>" + vbCrLf '价税合计(原币) ls_data = "" '"1000" ls_xml = ls_xml & "<natprice>" & ls_data & "</natprice>" + vbCrLf '单价(本币,无税) ls_data = "" '"10000" ls_xml = ls_xml & "<natmoney>" & ls_data & "</natmoney>" + vbCrLf '金额(本币,无税) ls_data = "" '"1700" ls_xml = ls_xml & "<nattax>" & ls_data & "</nattax>" + vbCrLf '税额(本币) ls_data = "" '"11700" ls_xml = ls_xml & "<natsum>" & ls_data & "</natsum>" + vbCrLf '价税合计(本币) ls_data = "" ls_xml = ls_xml & "<natdiscount>" & ls_data & "</natdiscount>" + vbCrLf '折扣额(本币) ls_data = "17" ls_xml = ls_xml & "<taxrate>" & ls_data & "</taxrate>" + vbCrLf '税率 ls_data = "" ls_xml = ls_xml & "<item_class>" & ls_data & "</item_class>" + vbCrLf '项目大类 ls_data = "" ls_xml = ls_xml & "<item_code>" & ls_data & "</item_code>" + vbCrLf '项目 ls_data = "" ls_xml = ls_xml & "<item_name>" & ls_data & "</item_name>" + vbCrLf '项目名 ls_data = "2013-11-24" ls_xml = ls_xml & "<arrivedate>" & ls_data & "</arrivedate>" + vbCrLf '计划到货日期 ls_data = "2013-11-24" ls_xml = ls_xml & "<startdate>" & ls_data & "</startdate>" + vbCrLf '计划下达日期 ls_data = "1000000001" ls_xml = ls_xml & "<bomid>" & ls_data & "</bomid>" + vbCrLf 'BOMID ls_data = "0" ls_xml = ls_xml & "<fparentscrp>" & ls_data & "</fparentscrp>" + vbCrLf '母件损耗率 ls_data = "1" ls_xml = ls_xml & "<btaxcost>" & ls_data & "</btaxcost>" + vbCrLf '价格标准(0无税,1含税) ls_xml = ls_xml & "<details ivouchrowno = """ & Trim(Str(i)) & """>" + vbCrLf For j = 1 To 3 ls_xml = ls_xml & "<entrys>" + vbCrLf ls_data = "Z00" & Trim(Str(j)) ls_xml = ls_xml & "<inventorycode>" & ls_data & "</inventorycode>" + vbCrLf '子件存货编码 ls_data = Trim(Str(j * 10)) ls_xml = ls_xml & "<quantity>" & ls_data & "</quantity>" + vbCrLf '数量 ls_data = "2013-10-20" ls_xml = ls_xml & "<requireddate>" & ls_data & "</requireddate>" + vbCrLf '需求日期 ls_data = "1" ls_xml = ls_xml & "<baseqtyn>" & ls_data & "</baseqtyn>" + vbCrLf '基本用量(分子) ls_data = "1" ls_xml = ls_xml & "<baseqtyd>" & ls_data & "</baseqtyd>" + vbCrLf '基本用量(分母) ls_data = "0" ls_xml = ls_xml & "<basenumn>" & ls_data & "</basenumn>" + vbCrLf '辅助基本用量 ls_data = "0" ls_xml = ls_xml & "<unitnum>" & ls_data & "</unitnum>" + vbCrLf '辅助使用数量 ls_data = "0" ls_xml = ls_xml & "<num>" & ls_data & "</num>" + vbCrLf '应领辅助数量 ls_data = "0" ls_xml = ls_xml & "<compscrp>" & ls_data & "</compscrp>" + vbCrLf '子件耗损率 ls_data = "0" ls_xml = ls_xml & "<fvgty>" & ls_data & "</fvgty>" + vbCrLf 'F/V(0:否/1:是) ls_data = "3" ls_xml = ls_xml & "<wiptype>" & ls_data & "</wiptype>" + vbCrLf '供应类型(1:倒冲/3:领用) ls_data = "3" ls_xml = ls_xml & "<opcomponentid>" & ls_data & "</opcomponentid>" + vbCrLf '子件BOM子表ID ls_data = "0" ls_xml = ls_xml & "<sendtype>" & ls_data & "</sendtype>" + vbCrLf '领料方式 ls_data = Trim(Str(i)) ls_xml = ls_xml & "<usequantity>" & ls_data & "</usequantity>" + vbCrLf ls_xml = ls_xml & "</entrys>" + vbCrLf Next j ls_xml = ls_xml & "</details>" + vbCrLf ls_xml = ls_xml & "</entry>" + vbCrLf Next i ls_xml = ls_xml & "</body>" + vbCrLf '增加文件尾相关信息 ls_xml = ls_xml & "</omorder>" + vbCrLf ls_xml = ls_xml & "</ufinterface>" + vbCrLf Dim xml_document As New DOMDocument xml_document.loadXML (ls_xml) fn2 = App.Path & "u8_temp.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_omorder = False End If End Function
2.参数说明
主表: | |||
项目 | 是否必传 | 对应业务系统字段 | 描述 |
订单编号 | 是 | 将在U8中自动生成一个新编号,但注意:不能获取到U8新生成的编号 | |
订单日期 | 是 | YYYY-MM-DD | |
供应商编号 | 是 | ||
部门编号 | 否 | ||
业务员编号 | 否 | ||
采购类型编码 | 否 | ||
业务类型 | 是 | 委外加工 | |
到货地址 | 否 | ||
运输方式 | 否 | ||
外币名称 | 是 | 人民币、美元、日元 | |
汇率 | 是 | ||
税率 | 是 | 如:17 | |
付款条件 | 否 | ||
运费 | 否 | ||
定金 | 否 | ||
备注 | 否 | ||
采购计划期间 | 否 | ||
制单人名称 | 否 | 如果需要上传,传入名称 | |
母件信息: | |||
项目 | 是否必传 | 对应业务系统字段 | 描述 |
母件编码 | 是 | ||
是否检验 | 是 | 1 or 0,在U8直接做时默认为0 | |
物料单位编码 | 是 | ||
主计量数量 | 是 | ||
辅计量数量 | 否 | 如果是浮动转换率不传,如果是固定转换率必传 | |
报价 | 否 | ||
单价(原币,无税) | 否 | 不传在话,在U8的委外订单中为空 | |
含税单价(原币,无税) | 否 | 不传在话,在U8的委外订单中为空 | |
金额(原币,无税) | 否 | 不传在话,在U8的委外订单中为空 | |
税额(原币) | 否 | 不传在话,在U8的委外订单中为空 | |
价税合计(原币) | 否 | 不传在话,在U8的委外订单中为空 | |
单价(本币,无税) | 否 | 不传在话,在U8的委外订单中为空 | |
金额(本币,无税) | 否 | 不传在话,在U8的委外订单中为空 | |
税额(本币) | 否 | 不传在话,在U8的委外订单中为空 | |
价税合计(本币) | 否 | 不传在话,在U8的委外订单中为空 | |
折扣额(本币) | 否 | 不传在话,在U8的委外订单中为空 | |
税率 | 是 | 如17 | |
项目大类 | 否 | ||
项目 | 否 | ||
项目名 | 否 | ||
到货日期 | 是 | YYYY-MM-DD | |
计划下达日期 | 是 | YYYY-MM-DD | |
BOMID | 是 | 母件委外BOMID | |
母件损耗率 | 否 | ||
价格标准 | 否 | 0无税,1含税,不知道和后续有什么关系 | |
子件信息: | |||
项目 | 是否必传 | 对应业务系统字段 | 描述 |
子件编码 | 是 | ||
数量 | 是 | ||
需求日期 | 否 | 注意:以下字段都可以不传,但不传,在U8中数据为空,不知道后续是否有影响 | |
基本用量(分子) | 否 | ||
基本用量(分母) | 否 | ||
辅助基本用量 | 否 | ||
辅助使用数量 | 否 | ||
应领辅助数量 | 否 | ||
子件耗损率 | 否 | ||
F/V | 否 | (0:否/1:是),默认0 | |
供应类型 | 否 | (1:倒冲/3:领用),默认3 | |
子件BOM子表ID | 否 | ||
领料方式 | 否 | ||