/// <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); } }
public bool Save_before(ref IXMLDOMDocument2 domhead, ref IXMLDOMDocument2 dombody, ref string errMsg) { MomCallContext currentMomCallContext = MomCallContextCache.Instance.CurrentMomCallContext; clsLogin clsLogin = (clsLogin)currentMomCallContext.U8Login; IXMLDOMNodeList headval = domhead.selectNodes("//rs:data/z:row"); IXMLDOMNodeList bodyval = dombody.selectNodes("//rs:data/z:row"); string csocode = "", ddate = "", ccuscode = "", ccusname = ""; string cinvcode = "", iquantity = "", iunitprice = "", cinvname = ""; wl.WriteLogs("-------head start ------" + domhead.xml + "-----head end ------------"); wl.WriteLogs("-------body start ------" + dombody.xml + "-----body end ------------"); //销售订单头信息 foreach (IXMLDOMElement item in headval) { csocode = item.attributes.getNamedItem("csocode").nodeValue.ToString(); ddate = item.attributes.getNamedItem("ddate").nodeValue.ToString(); ccuscode = item.attributes.getNamedItem("ccuscode").nodeValue.ToString(); ccusname = item.attributes.getNamedItem("ccusname").nodeValue.ToString(); } //销售订单行信息 foreach (IXMLDOMElement item in bodyval) { cinvcode = item.attributes.getNamedItem("cinvcode").nodeValue.ToString(); iquantity = item.attributes.getNamedItem("iquantity").nodeValue.ToString(); iunitprice = item.attributes.getNamedItem("iunitprice").nodeValue.ToString(); cinvname = item.attributes.getNamedItem("cinvname").nodeValue.ToString(); } MessageBox.Show("订单头信息:" + csocode + "-" + ddate + "-" + ccuscode + "-" + ccusname + "\r\n" + "订单行信息:行记录数为" + bodyval.length.ToString() + " ; " + cinvcode + "-" + iquantity + "-" + iunitprice + "-" + cinvname); return(true); }
/// <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); } }
/// <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; } }
/// <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; } }
/// <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); } }