public override Model.DealResult BrokerInvoker(UFIDA.U8.U8APIFramework.U8ApiBroker broker) { Model.DealResult dr = new Model.DealResult(); //DAL.Common.WriteWinDebugLog("broker start"); if (!broker.Invoke()) { //错误处理 Exception apiEx = broker.GetException(); if (apiEx != null) { if (apiEx is MomSysException) { MomSysException sysEx = apiEx as MomSysException; dr.ResultNum = -1; dr.ResultMsg = "系统异常:" + sysEx.Message; } else if (apiEx is MomBizException) { MomBizException bizEx = apiEx as MomBizException; dr.ResultNum = -1; dr.ResultMsg = "API异常:" + bizEx.Message; } String exReason = broker.GetExceptionString(); if (exReason.Length != 0) { dr.ResultNum = -1; dr.ResultMsg = " 异常原因:" + exReason; } } broker.Release(); return(dr); } //DAL.Common.WriteWinDebugLog("broker end"); System.String result = broker.GetReturnValue() as System.String; string curIDRet = broker.GetResult("curID") as string; MSXML2.IXMLDOMDocument2 CurDomRet = (MSXML2.IXMLDOMDocument2)broker.GetResult("CurDom"); broker.Release(); //DAL.Common.WriteWinDebugLog("broker end2"); if (result != null) { dr.ResultNum = -1; dr.ResultMsg = "API错误:" + result; throw new Exception("API错误:" + result); } dr.VouchIdRet = curIDRet; broker.Release(); return(dr); }
/// <summary> /// 激发API操作 /// </summary> /// <param name="broker"></param> /// <returns></returns> public override Model.DealResult BrokerInvoker(UFIDA.U8.U8APIFramework.U8ApiBroker broker) { Model.DealResult dr = new Model.DealResult(); MSXML2.IXMLDOMDocument2 domResult = new MSXML2.DOMDocument(); MSXML2.IXMLDOMNodeList lstx; string sResult = ""; if (!broker.Invoke()) { //错误处理 Exception apiEx = broker.GetException(); if (apiEx != null) { if (apiEx is MomSysException) { MomSysException sysEx = apiEx as MomSysException; dr.ResultNum = -1; dr.ResultMsg = "系统异常:" + sysEx.Message; } else if (apiEx is MomBizException) { MomBizException bizEx = apiEx as MomBizException; dr.ResultNum = -1; dr.ResultMsg = "API异常:" + bizEx.Message; } String exReason = broker.GetExceptionString(); if (exReason.Length != 0) { dr.ResultNum = -1; dr.ResultMsg = " 异常原因:" + exReason; } } broker.Release(); return(dr); } System.String result = broker.GetReturnValue() as System.String; string vNewIDRet = broker.GetResult("vNewID") as string; broker.Release(); if (result != null) { dr.ResultNum = -1; dr.ResultMsg = result; sResult = result.ToString(); //增加可用量不足的提示,通过读取返回的DOM信息解析可用量不足的信息 if (sResult.IndexOf("<rs:data") > 0) { string sInvCode = ""; string sInvName = ""; string sWhCode = ""; string sWhName = ""; string sError = ""; sResult = sResult.Substring(sResult.IndexOf("<rs:data")); if (domResult.loadXML(sResult) == true) { lstx = domResult.selectNodes("//z:row"); foreach (MSXML2.IXMLDOMNode xmle in lstx) { sInvCode = xmle.attributes.getNamedItem("cinvcode").nodeValue.ToString(); sInvName = xmle.attributes.getNamedItem("cinvname").nodeValue.ToString(); sWhCode = xmle.attributes.getNamedItem("cwhcode").nodeValue.ToString(); sWhName = xmle.attributes.getNamedItem("cwhname").nodeValue.ToString(); sError = sError + "存货编码[" + sInvCode + "] 存货名称[" + sInvName + "] 仓库[" + sWhName + "]\r\n"; } if (sError != "") { sError = sError + "可用量不足"; result = sError; dr.ResultMsg = result; } } } throw new Exception("API错误:" + result); } dr.VouchIdRet = vNewIDRet; return(dr); }
/// <summary> /// 激发API操作 /// </summary> /// <param name="broker"></param> /// <returns></returns> public override Model.DealResult BrokerInvoker(UFIDA.U8.U8APIFramework.U8ApiBroker broker) { Model.DealResult dr = new Model.DealResult(); if (!broker.Invoke()) { //错误处理 Exception apiEx = broker.GetException(); if (apiEx != null) { if (apiEx is MomSysException) { MomSysException sysEx = apiEx as MomSysException; dr.ResultNum = -1; dr.ResultMsg = "系统异常:" + sysEx.Message; } else if (apiEx is MomBizException) { MomBizException bizEx = apiEx as MomBizException; dr.ResultNum = -1; dr.ResultMsg = "API异常:" + bizEx.Message; } String exReason = broker.GetExceptionString(); if (exReason.Length != 0) { dr.ResultNum = -1; dr.ResultMsg = " 异常原因:" + exReason; } } broker.Release(); return(dr); } System.Boolean result = Convert.ToBoolean(broker.GetReturnValue()); ExtensionBusinessEntity extboRet; // 'ExtensionBusinessObject extboRet = broker.GetExtBoEntity("extbo"); string retId = null; switch (extboRet.Name.ToLower()) { case "optransform": retId = Convert.ToString(extboRet[0].GetValue("TransformId")); break; case "workhrnote": retId = Convert.ToString(extboRet[0].GetValue("WorkHrId")); break; case "mom_order": retId = Convert.ToString(extboRet[0].GetValue("MoId")); // break; default: break; } dr.VouchIdRet = retId; //结束本次调用,释放API资源 broker.Release(); return(dr); }