U9&U9C杂发单ISV接口调用示例

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using U9ISV.U9ISVCreateMiscShip;
using System.Collections;
namespace U9ISV
{
class U9ISVCreateMiscShipSub
{

    public static string CreateMiscDO(DataTable dt)
    {
        string msg = "";
        CommonCreateMiscShipStub cmisc = new CommonCreateMiscShipStub();
        MessageBase[] messageBase = null;

        List<UFIDAU9ISVMiscShipISVIC_MiscShipmentDTOData> headList = new List<UFIDAU9ISVMiscShipISVIC_MiscShipmentDTOData>();
        UFIDAU9ISVMiscShipISVIC_MiscShipmentDTOData head = new UFIDAU9ISVMiscShipISVIC_MiscShipmentDTOData();
        UFIDAU9CBOPubControllerContextDTOData context = new UFIDAU9CBOPubControllerContextDTOData();
        context.m_entCode = U9Context.EntCode;
        context.m_orgCode = U9Context.OrgCode;
        context.m_userCode = U9Context.UserName;
        //头
        //单据类型
        head.m_miscShipDocType = new UFIDAU9CBOPubControllerCommonArchiveDataDTOData();
        head.m_miscShipDocType.m_code = dt.Rows[0]["MiscShipDocType"].ToString();//"MiscShip101";
        head.m_miscShipDocType.m_iDSpecified = true;
        head.m_businessDate = DateTime.Now;
        head.m_businessDateSpecified = true;
        head.m_benefitOrg = long.Parse(dt.Rows[0]["BenefitOrg"].ToString());

        head.m_benefitOrgSpecified = true;

        if (dt.Rows[0]["Memo"] != null && dt.Rows[0]["Memo"].ToString() != "")
        {
            head.m_memo = dt.Rows[0]["Memo"].ToString();
        }


        head.m_miscShipLs = new UFIDAU9ISVMiscShipISVIC_MiscShipmentLDTOData[] { };

        //行
        List<UFIDAU9ISVMiscShipISVIC_MiscShipmentLDTOData> bom_linearr = new List<UFIDAU9ISVMiscShipISVIC_MiscShipmentLDTOData>();
        {
            for (int i = 0; i < 1; i++)
            {

                UFIDAU9ISVMiscShipISVIC_MiscShipmentLDTOData bom_line = new UFIDAU9ISVMiscShipISVIC_MiscShipmentLDTOData();
                if (dt.Rows[i]["BenefitDept"] != null && dt.Rows[i]["BenefitDept"].ToString() != "")
                {
                    bom_line.m_benefitDept = new UFIDAU9CBOPubControllerCommonArchiveDataDTOData();

                    bom_line.m_benefitDept.m_code = dt.Rows[i]["BenefitDept"].ToString();//受益部门

                }

                if (dt.Rows[i]["CustomerInfo_Code"] != null && dt.Rows[i]["CustomerInfo_Code"].ToString() != "")
                {
                    bom_line.m_customerInfo = new UFIDAU9CBOSCMCustomerCustomerMISCInfoData();
                    bom_line.m_customerInfo.m_code = dt.Rows[i]["CustomerInfo_Code"].ToString();
                }


                bom_line.m_itemInfo = new UFIDAU9CBOSCMItemItemInfoData();
                bom_line.m_itemInfo.m_itemCode = dt.Rows[i]["ItemInfo_ItemCode"].ToString();//料品编码
                if (dt.Rows[i]["Wh"] != null && dt.Rows[i]["Wh"].ToString() != "")
                {
                    bom_line.m_wh = new UFIDAU9CBOPubControllerCommonArchiveDataDTOData();

                    bom_line.m_wh.m_code = dt.Rows[i]["Wh"].ToString();

                }


                bom_line.m_storeUOMQty = decimal.Parse(dt.Rows[i]["StoreUOMQty"].ToString());//出库数量
                bom_line.m_storeUOMQtySpecified = true;


                bom_linearr.Add(bom_line);
            }
        }
        head.m_miscShipLs = bom_linearr.ToArray();
        headList.Add(head);
        try
        {

            UFIDAU9CBOPubControllerCommonArchiveDataDTOData[] li = cmisc.Do(U9Context.GetContext(), headList.ToArray(), context, out messageBase);
            if (li[0].m_code != null)
            {


                msg = msg + "杂发单 " + (li[0].m_code ?? "").ToString() + " 创建成功!";

            }
            else
            {
                msg = msg + "杂发单" + (li[0].m_code ?? "").ToString() + "创建失败!";

            }

        }
        catch (System.Web.Services.Protocols.SoapException ex)
        {
            var rtn = ex.Detail.InnerXml;

            msg = msg + "杂发单创建失败:" +rtn;




        }
        return msg;
    }
   
}

}

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值