• 基础档案后台CO应用实例_存货档案自动同步功能


    存货档案自动同步功能

    toolbar按钮二开插件预置:直接在原存货档案卡片的“保存”按钮进行实现同步功能。

    --meta库
    delete from AA_CustomerButton  where cButtonKey ='InvCOtoSync'
    insert into AA_CustomerButton (cButtonKey,cButtonType,cProjectNO,cFormKey,cVoucherKey,cKeyBefore,iOrder,cGroup,cCustomerObjectName,cCaption,cLocaleID,cImage,cToolTip,cHotKey,bInneralCommand,cVariant,cVisibleAsKey,cEnableAsKey,cSubID,DependenceSubIdList,iheightRow ,iSetGroupRow )                        values('InvCOtoSync','system','U870','Inventory_Edit','Inventory_Edit','SaveRs',0,'bj','U8ArchiveSyn_inv.clsToolbarCommon','存货同步','ZH-CN','SaveRs','调用基础档案后台CO同步更新存货档案','','1','调用基础档案后台CO同步更新存货档案','SaveRs','SaveRs','','',1,2)
    

    二开插件代码实现:

    Public g_oLogin As Object 'UFLoginSQL.Login  '设置Login对象
    Public SrvDB As Object ' U8SrvTrans.IClsCommon '设置公共数据库事务处理对象
    Private Function Init(ologin As Object) As Boolean
        On Error Resume Next
        Set g_oLogin = ologin
        If g_oLogin Is Nothing Then
            ShowMsg g_oPub.GetResString("U8.AA.ARCHIVE.COMMON.nologin") '"没有传入Login对象!"
            Exit Function
        End If
        Set SrvDB = CreateObject("U8SrvTrans.IClsCommon")
        If SrvDB Is Nothing Then
            ShowMsg g_oPub.GetResString("U8.AA.ARCHIVE.COMMON.loadsrvdbfail") '"创建CO对象失败!"
            Exit Function
        End If
        SrvDB.Init Replace(ologin.UfDbName, "ufdata_001_2019", "ufdata_002_2019") '001 是源账套,002是目标账套
        SrvDB.SetLogin ologin
        If SrvDB.Status = False Then
            ShowMsg g_oPub.GetResString("U8.AA.ARCHIVE.COMMON.dbconnectfail") '"数据连接失败!"
            Exit Function
        End If
        Init = True
    End Function
    
    Public Function AfterRunSysCommand(ByVal objLogin As Object, ByVal objForm As Object, ByVal objVoucher As Object, _
                                ByVal sKey As String, ByVal VarentValue As Variant, ByRef Cancel As Boolean, ByVal other As String)
        Dim sErrTmp As String
        Dim succeed As Boolean
        'objForm.m_SaveXML 串可以再次加工
        If objForm.OperationType = 1 Then '新增保存
            succeed = SrvDB.Add(objForm.m_SaveXML, "Inventory", sErrTmp)
        Else                              '修改保存
            succeed = SrvDB.Modify(objForm.m_SaveXML, "Inventory", sErrTmp)
        End If
        
    End Function
    

    注:如上是直接通过预置存货档案的系统按钮“保存”的插件机制实现了从一个账套调用基础档案CO自动同步到另外一个账套的过程,如果是其他应用场景则需要自行创建U8Login对象、XML串;

    很多人问c#如何调用
    首先引用com

     U8SrvTrans.IClsCommonClass SrvDB = new U8SrvTrans.IClsCommonClass();
    ///第一步 初始化CO
    SrvDB.InitNew(DG_login);
    if (!SrvDB.Status)
    {
        throw new Exception("初始化CO接口失败!" + errMsg);
    }
    
    ///第二步 
    //调用co新增
    bool flag = SrvDB.Add(ref doc, ref vouchType, ref errMsg);
    //调用co修改
    //bool flag = SrvDB.Modify(ref doc, ref vouchType, ref errMsg);
    

    是不是很简单

    业务合作或技术交流请加我微信

  • 相关阅读:
    让层遮挡select(ie6下的问题)
    HTTP协议详解(真的很经典)
    网络编辑基础:对HTTP协议的头信息详解
    (OK) MIMP
    (OK) MIMP
    (OK) MIMP
    (OK)(OK) Android-x86-7.1.1/ kernel 4.4.62
    (OK)(OK) Android-x86-7.1.1/ kernel 4.4.62
    (OK) Android-x86-7.1.1/ kernel 4.4.62
    (OK)(OK) Android-x86-7.1.1/ kernel 4.4.62
  • 原文地址:https://www.cnblogs.com/lothar/p/13717740.html
Copyright © 2020-2023  润新知