Exemple #1
0
        public ReturnMessage LoginU8(string sSubId, string sAccID, string sYear, string sUserID, string sPassword, string sDate, string sServer, string sSerial)
        {
            ReturnMessage msg = new ReturnMessage();

            u8Login = new U8Login.clsLogin();
            try
            {
                if (!u8Login.Login(ref sSubId, ref sAccID, ref sYear, ref sUserID, ref sPassword, ref sDate, ref sServer, ref sSerial))
                {
                    string error = u8Login.ShareString;
                    Marshal.FinalReleaseComObject(u8Login);
                    msg.Success = false;
                    msg.Msg     = error;
                    msg.Code    = 500;
                }
                else
                {
                    userToken = u8Login.userToken;
                    UFDataConnstringForNet = u8Login.UFDataConnstringForNet;
                    cUserID     = u8Login.cUserId;
                    cUserName   = u8Login.cUserName;
                    msg.Success = true;
                    msg.Msg     = "";
                }
            }
            catch (Exception ex)
            {
                msg.Success = false;
                msg.Msg     = ex.Message.ToString();
                msg.Code    = 500;
            }
            return(msg);
        }
Exemple #2
0
        /// <summary>
        /// 物料清单
        /// 保存、删除事件接口方法
        /// </summary>
        /// <param name="ds">传入的数据集</param>
        /// <param name="errmsg">用于返回的错误信息</param>
        /// <returns>true=操作成功;false=操作失败</returns>
        public bool DoAPI_DataSet(ref DataSet ds, ref string errmsg)
        {
            try
            {
                //获取插件上下文
                MomCallContext context = MomCallContextCache.Instance.CurrentMomCallContext;

                //从上下文获取帐套库连接对象
                ADODB.Connection conn = context.BizDbConnection as ADODB.Connection;

                //从上下文获取U8Login对象
                U8Login.clsLogin login = context.U8Login as U8Login.clsLogin;

                string eventIdentity = context.EventIdentity;

                if (ds is StandardBomDs)
                {
                    //(ds as StandardBomDs).WriteXml("C:\\" + eventIdentity.Replace("/", ".") + ".xml");
                }

                Biz.BizBase oper;
                switch (eventIdentity.ToLower())
                {
                //删除后
                case "u8api/bom/delete_after":
                    //DataSet delDs = ds.Copy();
                    //delDs.RejectChanges();
                    //oper = new U8.Interface.Bus.Event.SyncAdapter.Biz.StandBom(ref conn,delDs, login.UFDataConnstringForNet.ToString());
                    //oper.LinkDelete();
                    break;

                //保存前  制造参数设为保存并默认审核时,不会设审核事件。所以在添加保存前事件
                case "u8api/bom/save_before":
                //保存后
                case "u8api/bom/save_after":
                    oper = (Biz.BizBase)System.Reflection.Assembly.Load(U8.Interface.Bus.Config.ConfigUtility.EventBizDllName).CreateInstance(U8.Interface.Bus.Config.ConfigUtility.EventBizNamespace + "." + "Bom_bom",
                                                                                                                                              true, System.Reflection.BindingFlags.CreateInstance, null,
                                                                                                                                              new object[] { conn, ds, login.UFDataConnstringForNet.ToString(), "a" }, null, null);
                    //oper = new U8.Interface.Bus.Event.SyncAdapter.Biz.Factory.HM.Bom_bom(ref conn, ref ds, login.UFDataConnstringForNet.ToString());
                    using (System.Transactions.TransactionScope tra = new System.Transactions.TransactionScope(System.Transactions.TransactionScopeOption.Suppress))
                    {
                        oper.Insert();
                    }
                    break;
                }

                return(true);
            }
            catch (Exception ex)
            {
                errmsg = ex.Message;
                return(false);
            }
        }
Exemple #3
0
        /// <summary>
        /// 生产制造
        /// 审核、弃审事件插口方法
        /// </summary>
        /// <param name="bomid">BomId</param>
        /// <param name="errmsg">用于返回的错误信息</param>
        /// <returns>true=操作成功;false=操作失败</returns>
        public bool DoAPIEvent(int moid, int modid, ref string errmsg)
        {
            Output.OutputDebugString("moid:" + moid);
            Output.OutputDebugString("modid:" + modid);
            //System.Diagnostics.Process p = System.Diagnostics.Process.GetCurrentProcess();
            //throw new Exception(p.Id.ToString());
            //System.Windows.Forms.MessageBox.Show(p.Id.ToString());

            try
            {
                //获取插件上下文
                MomCallContext context = MomCallContextCache.Instance.CurrentMomCallContext;

                //从上下文获取帐套库连接对象
                ADODB.Connection conn = context.BizDbConnection as ADODB.Connection;

                //从上下文获取U8Login对象
                U8Login.clsLogin login = context.U8Login as U8Login.clsLogin;

                string eventIdentity = context.EventIdentity;
                if (string.IsNullOrEmpty(eventIdentity))
                {
                    eventIdentity = oldEventIdentity;
                }
                else
                {
                    oldEventIdentity = eventIdentity;
                }

                string connStr;
                if (login != null)
                {
                    connStr    = login.UFDataConnstringForNet.ToString();
                    oldConnStr = connStr;
                }
                else
                {
                    connStr = oldConnStr;
                }

                //System.Windows.Forms.MessageBox.Show(eventIdentity);

                Biz.BizBase oper;
                switch (eventIdentity.ToLower())
                {
                //审核前
                case "u8api/morder/audit_before":
                //审核后
                case "u8api/morder/audit_after":
                    oper = (Biz.BizBase)System.Reflection.Assembly.Load(U8.Interface.Bus.Config.ConfigUtility.EventBizDllName).CreateInstance(U8.Interface.Bus.Config.ConfigUtility.EventBizNamespace + "." + "Mom_order", true, System.Reflection.BindingFlags.CreateInstance, null, new object[] { conn, moid, modid, connStr, "a" }, null, null);
                    oper.Insert();
                    break;

                //弃审前
                case "u8api/morder/unaudit_before":
                case "u8api/morder/cancelaudit_before":
                //弃审后
                case "u8api/morder/unaudit_after":
                case "u8api/morder/cancelaudit_after":
                    oper = (Biz.BizBase)System.Reflection.Assembly.Load(U8.Interface.Bus.Config.ConfigUtility.EventBizDllName).CreateInstance(U8.Interface.Bus.Config.ConfigUtility.EventBizNamespace + "." + "Mom_order", true, System.Reflection.BindingFlags.CreateInstance, null, new object[] { conn, moid, modid, connStr, "d" }, null, null);
                    oper.Delete();
                    break;
                }

                return(true);
            }
            catch (Exception ex)
            {
                errmsg = ex.Message;
                return(false);
            }
        }
Exemple #4
0
        /// <summary>
        /// 单据事件调插件方法
        /// </summary>
        /// <param name="domhead" datetype="MSXML2.IXMLDocument2" out="1">单据表头 DOM 对象实例</param>
        /// <param name="dombody" datetype="MSXML2.IXMLDocument2" out="1">单据表体 DOM 对象实例</param>
        /// <param name="message" datatype="string" out="1">错误信息。用于插件方法返回单据的错误信息</param>
        /// <returns datatype="bool" comment="返回值决定原档案业务流程是否会继续">
        ///   <return value="True">操作成功</return>
        ///   <return value="False">操作失败</return>
        /// </returns>
        public bool InvokeVoucherEvent(ref IXMLDOMDocument2 domhead, ref IXMLDOMDocument2 dombody, ref string message)
        {
            try
            {
                /********** 获取插件上下文信息:登录对象、连接、事件ID ***************/

                //获取插件上下文
                MomCallContext context = MomCallContextCache.Instance.CurrentMomCallContext;

                //从上下文获取U8Login对象
                U8Login.clsLogin login = context.U8Login as U8Login.clsLogin;

                //从上下文获取帐套库连接对象
                ADODB.Connection conn = context.BizDbConnection as ADODB.Connection;

                //从上下文获取事件ID
                string eventId = context.EventIdentity;

                Output.mWriteLog(eventId, domhead, dombody, conn, login);


                Biz.BizBase oper;
                switch (eventId.ToLower())
                {
                //条码管理
                case "u8api/genbarcode/delete_before":
                case "u8api/genbarcode/delete_after":
                    oper = (Biz.BizBase)System.Reflection.Assembly.Load(U8.Interface.Bus.Config.ConfigUtility.EventBizDllName).CreateInstance(U8.Interface.Bus.Config.ConfigUtility.EventBizNamespace + "." + "BarCodeMain", true, System.Reflection.BindingFlags.CreateInstance, null, new object[] { conn, dombody, login.UFDataConnstringForNet.ToString() }, null, null);
                    oper.Delete();
                    break;

                case "u8api/genbarcode/save_before":
                case "u8api/genbarcode/save_after":
                    oper = (Biz.BizBase)System.Reflection.Assembly.Load(U8.Interface.Bus.Config.ConfigUtility.EventBizDllName).CreateInstance(U8.Interface.Bus.Config.ConfigUtility.EventBizNamespace + "." + "BarCodeMain", true, System.Reflection.BindingFlags.CreateInstance, null, new object[] { conn, dombody, login.UFDataConnstringForNet.ToString() }, null, null);
                    oper.Save();
                    break;

                //销售订单
                case "u8api/saleorder/audit_after":
                case "u8api/saleorder/audit_before":
                    oper = (Biz.BizBase)System.Reflection.Assembly.Load(U8.Interface.Bus.Config.ConfigUtility.EventBizDllName).CreateInstance(U8.Interface.Bus.Config.ConfigUtility.EventBizNamespace + "." + "SO_SOMain", true, System.Reflection.BindingFlags.CreateInstance, null, new object[] { conn, domhead, dombody, login.UFDataConnstringForNet.ToString(), "a" }, null, null);
                    oper.Insert();
                    break;

                case "u8api/saleorder/cancelaudit_after":
                case "u8api/saleorder/cancelaudit_before":
                    oper = (Biz.BizBase)System.Reflection.Assembly.Load(U8.Interface.Bus.Config.ConfigUtility.EventBizDllName).CreateInstance(U8.Interface.Bus.Config.ConfigUtility.EventBizNamespace + "." + "SO_SOMain", true, System.Reflection.BindingFlags.CreateInstance, null, new object[] { conn, domhead, dombody, login.UFDataConnstringForNet.ToString(), "d" }, null, null);
                    oper.Delete();
                    break;

                //采购到货单
                case "u8api/arrivedgoods/audit_before":
                case "u8api/arrivedgoods/audit_after":
                    oper = (Biz.BizBase)System.Reflection.Assembly.Load(U8.Interface.Bus.Config.ConfigUtility.EventBizDllName).CreateInstance(U8.Interface.Bus.Config.ConfigUtility.EventBizNamespace + "." + "PU_ArrivalVouch", true, System.Reflection.BindingFlags.CreateInstance, null, new object[] { conn, domhead, dombody, login.UFDataConnstringForNet.ToString(), "a" }, null, null);
                    oper.Insert();
                    break;

                case "u8api/arrivedgoods/cancelaudit_before":
                case "u8api/arrivedgoods/cancelaudit_after":
                    oper = (Biz.BizBase)System.Reflection.Assembly.Load(U8.Interface.Bus.Config.ConfigUtility.EventBizDllName).CreateInstance(U8.Interface.Bus.Config.ConfigUtility.EventBizNamespace + "." + "PU_ArrivalVouch", true, System.Reflection.BindingFlags.CreateInstance, null, new object[] { conn, domhead, dombody, login.UFDataConnstringForNet.ToString(), "d" }, null, null);
                    oper.Delete();
                    break;

                //组装单
                case "u8api/groupvouch/audit_before":
                case "u8api/groupvouch/audit_after":
                    //oper = (Biz.BizBase)System.Reflection.Assembly.Load(U8.Interface.Bus.Config.ConfigUtility.EventBizDllName).CreateInstance(U8.Interface.Bus.Config.ConfigUtility.EventBizNamespace + "." + "GroupVouch", true, System.Reflection.BindingFlags.CreateInstance, null, new object[] { conn, domhead, dombody, login.UFDataConnstringForNet.ToString(), "a" }, null, null);
                    oper = (Biz.BizBase)System.Reflection.Assembly.Load(U8.Interface.Bus.Config.ConfigUtility.EventBizDllName).CreateInstance(U8.Interface.Bus.Config.ConfigUtility.EventBizNamespace + "." + "AssemVouch", true, System.Reflection.BindingFlags.CreateInstance, null, new object[] { conn, domhead, dombody, login.UFDataConnstringForNet.ToString(), "a" }, null, null);
                    oper.Insert();
                    break;

                case "u8api/groupvouch/cancelaudit_before":
                case "u8api/groupvouch/cancelaudit_after":
                    //oper = (Biz.BizBase)System.Reflection.Assembly.Load(U8.Interface.Bus.Config.ConfigUtility.EventBizDllName).CreateInstance(U8.Interface.Bus.Config.ConfigUtility.EventBizNamespace + "." + "GroupVouch", true, System.Reflection.BindingFlags.CreateInstance, null, new object[] { conn, domhead, dombody, login.UFDataConnstringForNet.ToString(), "d" }, null, null);
                    oper = (Biz.BizBase)System.Reflection.Assembly.Load(U8.Interface.Bus.Config.ConfigUtility.EventBizDllName).CreateInstance(U8.Interface.Bus.Config.ConfigUtility.EventBizNamespace + "." + "AssemVouch", true, System.Reflection.BindingFlags.CreateInstance, null, new object[] { conn, domhead, dombody, login.UFDataConnstringForNet.ToString(), "d" }, null, null);
                    oper.Delete();
                    break;


                //拆卸单
                case "u8api/sepvouch/audit_before":
                case "u8api/sepvouch/audit_after":
                    oper = (Biz.BizBase)System.Reflection.Assembly.Load(U8.Interface.Bus.Config.ConfigUtility.EventBizDllName).CreateInstance(U8.Interface.Bus.Config.ConfigUtility.EventBizNamespace + "." + "AssemVouchRet", true, System.Reflection.BindingFlags.CreateInstance, null, new object[] { conn, domhead, dombody, login.UFDataConnstringForNet.ToString(), "a" }, null, null);
                    oper.Insert();
                    break;

                case "u8api/sepvouch/cancelaudit_before":
                case "u8api/sepvouch/cancelaudit_after":
                    oper = (Biz.BizBase)System.Reflection.Assembly.Load(U8.Interface.Bus.Config.ConfigUtility.EventBizDllName).CreateInstance(U8.Interface.Bus.Config.ConfigUtility.EventBizNamespace + "." + "AssemVouchRet", true, System.Reflection.BindingFlags.CreateInstance, null, new object[] { conn, domhead, dombody, login.UFDataConnstringForNet.ToString(), "d" }, null, null);
                    oper.Delete();
                    break;

                //采购订单 保存
                case "u8api/purchaseorder/save_before":
                case "u8api/purchaseorder/save_after":
                    break;

                //采购到货单  保存
                case "u8api/arrivedgoods/save_before":
                case "u8api/arrivedgoods/save_after":
                    string te = U8.Interface.Bus.Config.ConfigUtility.EventBizDllName;
                    break;

                //采购入库单d
                case "u8api/pustorein/save_before":
                case "u8api/pustorein/save_after":
                    string te1 = U8.Interface.Bus.Config.ConfigUtility.EventBizDllName;
                    break;
                }

                return(true);
            }
            catch (Exception ex)
            {
                Output.mWriteLog(ex.Message);
                throw ex;
            }
        }
Exemple #5
0
        /// <summary>
        /// 基础档案事件调插件方法
        /// </summary>
        /// <param name="document" datetype="MSXML2.IXMLDocument2" out="1">基础档案 DOM 对象实例</param>
        /// <param name="message" datatype="string" out="1">错误信息。用于插件方法返回档案的错误信息</param>
        /// <returns datatype="bool" comment="返回值决定原档案业务流程是否会继续">
        ///   <return value="True">操作成功</return>
        ///   <return value="False">操作失败</return>
        /// </returns>
        public bool InvokeArchiveEvent(ref IXMLDOMDocument2 document, ref string message)
        {
            try
            {
                Output.gDebugView("CSharp.SyncAdapter.Archive.Entering...");

                /********** 获取插件上下文信息:登录对象、连接、事件ID ***************/

                //获取插件上下文
                MomCallContext context = MomCallContextCache.Instance.CurrentMomCallContext;

                //从上下文获取U8Login对象
                U8Login.clsLogin login = context.U8Login as U8Login.clsLogin;

                //从上下文获取帐套库连接对象
                ADODB.Connection conn = context.BizDbConnection as ADODB.Connection;

                //从上下文获取事件ID
                string eventId = context.EventIdentity;

                Biz.BizBase oper;
                switch (eventId.ToLower())
                {
                //部门
                case "u8api/department/add_after":
                case "u8api/department/add_before":
                    oper = (Biz.BizBase)System.Reflection.Assembly.Load(U8.Interface.Bus.Config.ConfigUtility.EventBizDllName).CreateInstance(U8.Interface.Bus.Config.ConfigUtility.EventBizNamespace + "." +
                                                                                                                                              "Department", true, System.Reflection.BindingFlags.CreateInstance, null,
                                                                                                                                              new object[] { conn, document, login.UFDataConnstringForNet.ToString(), "a" }, null, null);
                    oper.Insert();
                    break;

                case "u8api/department/delete_after":
                case "u8api/department/delete_before":
                    oper = (Biz.BizBase)System.Reflection.Assembly.Load(U8.Interface.Bus.Config.ConfigUtility.EventBizDllName).CreateInstance(U8.Interface.Bus.Config.ConfigUtility.EventBizNamespace + "." +
                                                                                                                                              "Department", true, System.Reflection.BindingFlags.CreateInstance, null,
                                                                                                                                              new object[] { conn, document, login.UFDataConnstringForNet.ToString(), "d" }, null, null);
                    oper.Delete();
                    break;

                case "u8api/department/modify_after":
                case "u8api/department/modify_before":
                    oper = (Biz.BizBase)System.Reflection.Assembly.Load(U8.Interface.Bus.Config.ConfigUtility.EventBizDllName).CreateInstance(U8.Interface.Bus.Config.ConfigUtility.EventBizNamespace + "." +
                                                                                                                                              "Department", true, System.Reflection.BindingFlags.CreateInstance, null,
                                                                                                                                              new object[] { conn, document, login.UFDataConnstringForNet.ToString(), "m" }, null, null);
                    oper.Update();
                    break;

                //人员
                case "u8api/hr_hi_person/add_after":
                case "u8api/hr_hi_person/add_before":
                    oper = (Biz.BizBase)System.Reflection.Assembly.Load(U8.Interface.Bus.Config.ConfigUtility.EventBizDllName).CreateInstance(U8.Interface.Bus.Config.ConfigUtility.EventBizNamespace + "." +
                                                                                                                                              "Person", true, System.Reflection.BindingFlags.CreateInstance, null,
                                                                                                                                              new object[] { conn, document, login.UFDataConnstringForNet.ToString(), "a" }, null, null);
                    oper.Insert();
                    break;

                case "u8api/hr_hi_person/delete_after":
                case "u8api/hr_hi_person/delete_before":
                    oper = (Biz.BizBase)System.Reflection.Assembly.Load(U8.Interface.Bus.Config.ConfigUtility.EventBizDllName).CreateInstance(U8.Interface.Bus.Config.ConfigUtility.EventBizNamespace + "." +
                                                                                                                                              "Person", true, System.Reflection.BindingFlags.CreateInstance, null,
                                                                                                                                              new object[] { conn, document, login.UFDataConnstringForNet.ToString(), "d" }, null, null);
                    oper.Delete();
                    break;

                case "u8api/hr_hi_person/modify_after":
                case "u8api/hr_hi_person/modify_before":
                    oper = (Biz.BizBase)System.Reflection.Assembly.Load(U8.Interface.Bus.Config.ConfigUtility.EventBizDllName).CreateInstance(U8.Interface.Bus.Config.ConfigUtility.EventBizNamespace + "." +
                                                                                                                                              "Person", true, System.Reflection.BindingFlags.CreateInstance, null,
                                                                                                                                              new object[] { conn, document, login.UFDataConnstringForNet.ToString(), "m" }, null, null);
                    oper.Update();
                    break;

                //主计量单位
                case "u8api/computationunit/add_after":
                case "u8api/computationunit/add_before":
                    oper = (Biz.BizBase)System.Reflection.Assembly.Load(U8.Interface.Bus.Config.ConfigUtility.EventBizDllName).CreateInstance(U8.Interface.Bus.Config.ConfigUtility.EventBizNamespace + "." +
                                                                                                                                              "ComputationUnit", true, System.Reflection.BindingFlags.CreateInstance, null,
                                                                                                                                              new object[] { conn, document, login.UFDataConnstringForNet.ToString(), "a" }, null, null);
                    oper.Insert();
                    break;

                case "u8api/computationunit/delete_after":
                case "u8api/computationunit/delete_before":
                    oper = (Biz.BizBase)System.Reflection.Assembly.Load(U8.Interface.Bus.Config.ConfigUtility.EventBizDllName).CreateInstance(U8.Interface.Bus.Config.ConfigUtility.EventBizNamespace + "." +
                                                                                                                                              "ComputationUnit", true, System.Reflection.BindingFlags.CreateInstance, null,
                                                                                                                                              new object[] { conn, document, login.UFDataConnstringForNet.ToString(), "d" }, null, null);
                    oper.Delete();
                    break;

                case "u8api/computationunit/modify_after":
                case "u8api/computationunit/modify_before":
                    oper = (Biz.BizBase)System.Reflection.Assembly.Load(U8.Interface.Bus.Config.ConfigUtility.EventBizDllName).CreateInstance(U8.Interface.Bus.Config.ConfigUtility.EventBizNamespace + "." +
                                                                                                                                              "ComputationUnit", true, System.Reflection.BindingFlags.CreateInstance, null,
                                                                                                                                              new object[] { conn, document, login.UFDataConnstringForNet.ToString(), "m" }, null, null);
                    oper.Update();
                    break;

                //存货
                case "u8api/inventory/add_after":
                case "u8api/inventory/add_before":
                    oper = (Biz.BizBase)System.Reflection.Assembly.Load(U8.Interface.Bus.Config.ConfigUtility.EventBizDllName).CreateInstance(U8.Interface.Bus.Config.ConfigUtility.EventBizNamespace + "." +
                                                                                                                                              "Inventory", true, System.Reflection.BindingFlags.CreateInstance, null,
                                                                                                                                              new object[] { conn, document, login.UFDataConnstringForNet.ToString(), "a" }, null, null);
                    oper.Insert();
                    break;

                case "u8api/inventory/delete_after":
                case "u8api/inventory/delete_before":
                    oper = (Biz.BizBase)System.Reflection.Assembly.Load(U8.Interface.Bus.Config.ConfigUtility.EventBizDllName).CreateInstance(U8.Interface.Bus.Config.ConfigUtility.EventBizNamespace + "." +
                                                                                                                                              "Inventory", true, System.Reflection.BindingFlags.CreateInstance, null,
                                                                                                                                              new object[] { conn, document, login.UFDataConnstringForNet.ToString(), "d" }, null, null);
                    oper.Delete();
                    break;

                case "u8api/inventory/modify_after":
                case "u8api/inventory/modify_before":
                    oper = (Biz.BizBase)System.Reflection.Assembly.Load(U8.Interface.Bus.Config.ConfigUtility.EventBizDllName).CreateInstance(U8.Interface.Bus.Config.ConfigUtility.EventBizNamespace + "." +
                                                                                                                                              "Inventory", true, System.Reflection.BindingFlags.CreateInstance, null,
                                                                                                                                              new object[] { conn, document, login.UFDataConnstringForNet.ToString(), "m" }, null, null);
                    oper.Update();
                    break;

                //存货分类
                case "u8api/inventoryclass/add_before":
                case "u8api/inventoryclass/add_after":
                    oper = (Biz.BizBase)System.Reflection.Assembly.Load(U8.Interface.Bus.Config.ConfigUtility.EventBizDllName).CreateInstance(U8.Interface.Bus.Config.ConfigUtility.EventBizNamespace + "." + "InventoryClass", true, System.Reflection.BindingFlags.CreateInstance, null,
                                                                                                                                              new object[] { conn, document, login.UFDataConnstringForNet.ToString(), "a" }, null, null);
                    oper.Insert();
                    break;

                case "u8api/inventoryclass/delete_before":
                case "u8api/inventoryclass/delete_after":
                    oper = (Biz.BizBase)System.Reflection.Assembly.Load(U8.Interface.Bus.Config.ConfigUtility.EventBizDllName).CreateInstance(U8.Interface.Bus.Config.ConfigUtility.EventBizNamespace + "." + "InventoryClass", true, System.Reflection.BindingFlags.CreateInstance, null,
                                                                                                                                              new object[] { conn, document, login.UFDataConnstringForNet.ToString(), "d" }, null, null);
                    oper.Delete();
                    break;

                case "u8api/inventoryclass/modify_before":
                case "u8api/inventoryclass/modify_after":
                    oper = (Biz.BizBase)System.Reflection.Assembly.Load(U8.Interface.Bus.Config.ConfigUtility.EventBizDllName).CreateInstance(U8.Interface.Bus.Config.ConfigUtility.EventBizNamespace + "." + "InventoryClass", true, System.Reflection.BindingFlags.CreateInstance, null,
                                                                                                                                              new object[] { conn, document, login.UFDataConnstringForNet.ToString(), "m" }, null, null);
                    oper.Update();
                    break;

                //供应商
                case "u8api/vendor/add_after":
                case "u8api/vendor/add_before":
                    oper = (Biz.BizBase)System.Reflection.Assembly.Load(U8.Interface.Bus.Config.ConfigUtility.EventBizDllName).CreateInstance(U8.Interface.Bus.Config.ConfigUtility.EventBizNamespace + "." + "Vendor", true, System.Reflection.BindingFlags.CreateInstance, null, new object[] { conn, document, login.UFDataConnstringForNet.ToString() }, null, null);
                    oper.Insert();
                    break;

                case "u8api/vendor/delete_after":
                case "u8api/vendor/delete_before":
                    oper = (Biz.BizBase)System.Reflection.Assembly.Load(U8.Interface.Bus.Config.ConfigUtility.EventBizDllName).CreateInstance(U8.Interface.Bus.Config.ConfigUtility.EventBizNamespace + "." + "Vendor", true, System.Reflection.BindingFlags.CreateInstance, null, new object[] { conn, document, login.UFDataConnstringForNet.ToString() }, null, null);
                    oper.Delete();
                    break;

                case "u8api/vendor/modify_after":
                case "u8api/vendor/modify_before":
                    oper = (Biz.BizBase)System.Reflection.Assembly.Load(U8.Interface.Bus.Config.ConfigUtility.EventBizDllName).CreateInstance(U8.Interface.Bus.Config.ConfigUtility.EventBizNamespace + "." + "Vendor", true, System.Reflection.BindingFlags.CreateInstance, null, new object[] { conn, document, login.UFDataConnstringForNet.ToString() }, null, null);
                    oper.Update();
                    break;

                case "u8api/vendor/merge_before":
                case "u8api/vendor/merge_after":
                    oper = (Biz.BizBase)System.Reflection.Assembly.Load(U8.Interface.Bus.Config.ConfigUtility.EventBizDllName).CreateInstance(U8.Interface.Bus.Config.ConfigUtility.EventBizNamespace + "." + "Vendor", true, System.Reflection.BindingFlags.CreateInstance, null, new object[] { conn, document, login.UFDataConnstringForNet.ToString() }, null, null);
                    oper.LinkMerge(document);
                    break;

                //客户
                case "u8api/customer/add_after":
                case "u8api/customer/add_before":
                    oper = (Biz.BizBase)System.Reflection.Assembly.Load(U8.Interface.Bus.Config.ConfigUtility.EventBizDllName).CreateInstance(U8.Interface.Bus.Config.ConfigUtility.EventBizNamespace + "." + "Customer", true, System.Reflection.BindingFlags.CreateInstance, null, new object[] { conn, document, login.UFDataConnstringForNet.ToString() }, null, null);
                    oper.Insert();
                    break;

                case "u8api/customer/delete_after":
                case "u8api/customer/delete_before":
                    oper = (Biz.BizBase)System.Reflection.Assembly.Load(U8.Interface.Bus.Config.ConfigUtility.EventBizDllName).CreateInstance(U8.Interface.Bus.Config.ConfigUtility.EventBizNamespace + "." + "Customer", true, System.Reflection.BindingFlags.CreateInstance, null, new object[] { conn, document, login.UFDataConnstringForNet.ToString() }, null, null);
                    oper.Delete();
                    break;

                case "u8api/customer/modify_after":
                case "u8api/customer/modify_before":
                    oper = (Biz.BizBase)System.Reflection.Assembly.Load(U8.Interface.Bus.Config.ConfigUtility.EventBizDllName).CreateInstance(U8.Interface.Bus.Config.ConfigUtility.EventBizNamespace + "." + "Customer", true, System.Reflection.BindingFlags.CreateInstance, null, new object[] { conn, document, login.UFDataConnstringForNet.ToString() }, null, null);
                    oper.Update();
                    break;

                case "u8api/customer/merge_before":
                case "u8api/customer/merge_after":
                    oper = (Biz.BizBase)System.Reflection.Assembly.Load(U8.Interface.Bus.Config.ConfigUtility.EventBizDllName).CreateInstance(U8.Interface.Bus.Config.ConfigUtility.EventBizNamespace + "." + "Customer", true, System.Reflection.BindingFlags.CreateInstance, null, new object[] { conn, document, login.UFDataConnstringForNet.ToString() }, null, null);
                    oper.LinkMerge(document);
                    break;
                }


                Output.gDebugView("CSharp.SyncAdapter.Archive." + eventId + ".Writing log...");
                Output.mWriteLog(eventId, document, null, conn, login);
                Output.gDebugView("CSharp.SyncAdapter.Archive." + eventId + ".Creating BO Instance...");
                Output.gDebugView("CSharp.SyncAdapter.Archive." + eventId + ".Simulating Business Rule...");
                Output.gDebugView("CSharp.SyncAdapter.Archive." + eventId + ".ShowDialog...");

                bool result = true;


                Output.gDebugView("CSharp.SyncAdapter.Archive." + eventId + ".Complete");
                return(result);
            }
            catch (Exception ex)
            {
                Output.mWriteLog(ex.Message);
                throw ex;
            }
        }
Exemple #6
0
        /// <summary>
        /// 审核、弃审事件插口方法
        /// </summary>
        /// <param name="bomid">BomId</param>
        /// <param name="errmsg">用于返回的错误信息</param>
        /// <returns>true=操作成功;false=操作失败</returns>
        public bool DoAPI_BomId(int bomid, ref string errmsg)
        {
            Output.OutputDebugString("bomid:" + bomid);

            //System.Diagnostics.Process p = System.Diagnostics.Process.GetCurrentProcess();
            //throw new Exception(p.Id.ToString());

            try
            {
                //获取插件上下文
                MomCallContext context = MomCallContextCache.Instance.CurrentMomCallContext;

                //从上下文获取帐套库连接对象
                ADODB.Connection conn = context.BizDbConnection as ADODB.Connection;

                //从上下文获取U8Login对象
                U8Login.clsLogin login         = context.U8Login as U8Login.clsLogin;
                string           eventIdentity = context.EventIdentity;

                Output.OutputDebugString("eventIdentity:" + eventIdentity);

                Biz.BizBase oper;
                switch (eventIdentity.ToLower())
                {
                //标准BOM
                //审核前
                case "u8api/bom/audit_before":
                //审核后
                case "u8api/bom/audit_after":
                    oper = (Biz.BizBase)System.Reflection.Assembly.Load(
                        U8.Interface.Bus.Config.ConfigUtility.EventBizDllName).CreateInstance(U8.Interface.Bus.Config.ConfigUtility.EventBizNamespace + "." + "Bom_bom",
                                                                                              true, System.Reflection.BindingFlags.CreateInstance, null,
                                                                                              new object[] { conn, bomid, login.UFDataConnstringForNet.ToString(), "a" }, null, null);
                    //oper = new U8.Interface.Bus.Event.SyncAdapter.Biz.Factory.HM.Bom_bom(ref conn, bomid, login.UFDataConnstringForNet.ToString());
                    oper.Insert();
                    break;

                //弃审前
                case "u8api/bom/cancelaudit_before":
                case "u8api/bom/unaudit_before":
                //弃审后
                case "u8api/bom/cancelaudit_after":
                case "u8api/bom/unaudit_after":
                    oper = (Biz.BizBase)System.Reflection.Assembly.Load(
                        U8.Interface.Bus.Config.ConfigUtility.EventBizDllName).CreateInstance(U8.Interface.Bus.Config.ConfigUtility.EventBizNamespace + "." + "Bom_bom",
                                                                                              true, System.Reflection.BindingFlags.CreateInstance, null,
                                                                                              new object[] { conn, bomid, login.UFDataConnstringForNet.ToString(), "d" }, null, null);
                    //oper = new U8.Interface.Bus.Event.SyncAdapter.Biz.Factory.HM.Bom_bom(ref conn, bomid, login.UFDataConnstringForNet.ToString());
                    oper.Delete();
                    break;

                //工艺路线
                //审核前
                case "u8api/routing/audit_before":
                //审核后
                case "u8api/routing/audit_after":
                    oper = (Biz.BizBase)System.Reflection.Assembly.Load(
                        U8.Interface.Bus.Config.ConfigUtility.EventBizDllName).CreateInstance(U8.Interface.Bus.Config.ConfigUtility.EventBizNamespace + "." + "Sfc_prouting",
                                                                                              true, System.Reflection.BindingFlags.CreateInstance, null,
                                                                                              new object[] { conn, bomid, login.UFDataConnstringForNet.ToString(), "a" }, null, null);
                    oper.Insert();
                    break;

                //弃审前
                case "u8api/routing/cancelaudit_before":
                case "u8api/routing/unaudit_before":
                //弃审后
                case "u8api/routing/cancelaudit_after":
                case "u8api/routing/unaudit_after":
                    oper = (Biz.BizBase)System.Reflection.Assembly.Load(
                        U8.Interface.Bus.Config.ConfigUtility.EventBizDllName).CreateInstance(U8.Interface.Bus.Config.ConfigUtility.EventBizNamespace + "." + "Sfc_prouting",
                                                                                              true, System.Reflection.BindingFlags.CreateInstance, null,
                                                                                              new object[] { conn, bomid, login.UFDataConnstringForNet.ToString(), "d" }, null, null);
                    oper.Delete();
                    break;
                }

                string msg = "";
                msg = "  BomId ## " + bomid.ToString();

                return(true);
            }
            catch (Exception ex)
            {
                errmsg = ex.Message;
                return(false);
            }
        }