/// <summary> /// 弃审 /// </summary> /// <param name="bd"></param> /// <param name="dt"></param> /// <returns></returns> public override Model.DealResult CancelAudit(Model.APIData bd, Model.Synergismlogdt dt) { Model.DealResult dr = new Model.DealResult(); Model.APIData apidata = bd as Model.APIData; if (CheckAuditStatus(dt.Cvoucherno, apidata.ConnectInfo.Constring) == false) { return(dr); } string vouchid = GetCodeorID(dt.Cvoucherno, apidata, "id"); string auditaddress = SetApiAddressCancelAudit(); U8Login.clsLogin u8Login = new U8Login.clsLogin(); GetU8Login(apidata, u8Login); U8ApiBroker broker = null; dr = GetU8ApiBroker(apidata, u8Login, out broker, "cancelaudit"); broker.AssignNormalValue("sVouchType", apidata.SVouchType); broker.AssignNormalValue("VouchId", vouchid); broker.AssignNormalValue("cnnFrom", null); broker.AssignNormalValue("TimeStamp", DAL.Common.GetUtfsByID(vouchid, SetTableName(), apidata.ConnectInfo.Constring)); MSXML2.IXMLDOMDocument2 domMsg = new MSXML2.DOMDocument(); broker.AssignNormalValue("domMsg", domMsg); broker.AssignNormalValue("bCheck", false); broker.AssignNormalValue("bBeforCheckStock", false); broker.AssignNormalValue("bList", null); dr = BrokerInvoker(broker); return(dr); }
/// <summary> /// 删除 /// </summary> /// <param name="bd"></param> /// <param name="dt"></param> /// <returns></returns> public override Model.DealResult UndoMake(BaseData bd, Model.Synergismlogdt dt) { Model.DealResult dr = new Model.DealResult(); Model.APIData apidata = bd as Model.APIData; try { dr = CancelAudit(apidata, dt); } catch (Exception ex) { U8.Interface.Bus.Log.WriteWinLog("stockop_cancelaudit:" + ex.ToString()); dr.ResultNum = -1; dr.ResultMsg = ex.Message; return(dr); } string vouchid = GetCodeorID(dt.Cvoucherno, apidata, "id"); string auditaddress = SetApiAddressDelete(); U8Login.clsLogin u8Login = new U8Login.clsLogin(); GetU8Login(apidata, u8Login); U8ApiBroker broker = null; dr = GetU8ApiBroker(apidata, u8Login, out broker, "delete"); broker.AssignNormalValue("sVouchType", apidata.SVouchType); broker.AssignNormalValue("VouchId", vouchid); broker.AssignNormalValue("cnnFrom", null); broker.AssignNormalValue("TimeStamp", DAL.Common.GetUtfsByID(vouchid, SetTableName(), apidata.ConnectInfo.Constring)); MSXML2.IXMLDOMDocument2 domMsg = new MSXML2.DOMDocument(); broker.AssignNormalValue("domMsg", domMsg); broker.AssignNormalValue("bCheck", false); broker.AssignNormalValue("bBeforCheckStock", false); broker.AssignNormalValue("bList", null); dr = BrokerInvoker(broker); return(dr); }
/// <summary> /// 审核 /// </summary> /// <param name="bd"></param> /// <param name="vouchid"></param> /// <returns></returns> public override Model.DealResult MakeAudit(BaseData bd, Model.Synergismlogdt dt) { Model.DealResult dr = new Model.DealResult(); Model.APIData apidata = bd as Model.APIData; string vouchid = GetCodeorID(dt.Cvoucherno, apidata, "id"); string auditaddress = SetApiAddressAudit(); U8Login.clsLogin u8Login = new U8Login.clsLogin(); GetU8Login(apidata, u8Login); U8ApiBroker broker = null; dr = GetU8ApiBroker(apidata, u8Login, out broker, "audit"); broker.AssignNormalValue("sVouchType", apidata.SVouchType); broker.AssignNormalValue("VouchId", vouchid); broker.AssignNormalValue("cnnFrom", null); broker.AssignNormalValue("TimeStamp", DAL.Common.GetUtfsByID(vouchid, SetTableName(), apidata.ConnectInfo.Constring)); MSXML2.IXMLDOMDocument2 domMsg = new MSXML2.DOMDocument(); broker.AssignNormalValue("domMsg", domMsg); broker.AssignNormalValue("bCheck", false); broker.AssignNormalValue("bBeforCheckStock", false); broker.AssignNormalValue("bList", null); dr = BrokerInvoker(broker); if (!DAL.Common.SetVerifyDate(bd.ConnectInfo, dt)) { U8.Interface.Bus.Log.WriteWinLog("设置单据审核日期失败,Cvouchertype:" + dt.Cvouchertype + ";Cvoucherno:" + dt.Cvoucherno + "."); } return(dr); }
public override Model.DealResult AssignNormalValues(Model.APIData apidata, U8ApiBroker broker) { Model.DealResult dr = new Model.DealResult(); broker.AssignNormalValue("sVouchType", SetVouchType()); broker.AssignNormalValue("domPosition", null); broker.AssignNormalValue("cnnFrom", null); broker.AssignNormalValue("VouchId", ""); MSXML2.IXMLDOMDocument2 domMsg = new MSXML2.DOMDocument(); broker.AssignNormalValue("domMsg", domMsg); broker.AssignNormalValue("bCheck", true); broker.AssignNormalValue("bBeforCheckStock", true); broker.AssignNormalValue("bIsRedVouch", false); broker.AssignNormalValue("sAddedState", null); broker.AssignNormalValue("bReMote", false); return(dr); }
private void button2_Click(object sender, EventArgs e) { U8EnvContext envContext = new U8EnvContext(); envContext.U8Login = u8Login; U8ApiAddress myApiAddress = new U8ApiAddress("装载单据的地址标识"); //构造APIBroker U8ApiBroker broker = new U8ApiBroker(myApiAddress, envContext); //API参数赋值 broker.AssignNormalValue("参数名", "参数值"); //调用LOAD接口API if (!broker.Invoke()) { //错误处理 Exception apiEx = broker.GetException(); if (apiEx != null) { if (apiEx is MomSysException) { MomSysException sysEx = apiEx as MomSysException; Console.WriteLine("系统异常:" + sysEx.Message); //todo:异常处理 } else if (apiEx is MomBizException) { MomBizException bizEx = apiEx as MomBizException; Console.WriteLine("API异常:" + bizEx.Message); //todo:异常处理 } } //结束本次调用,释放API资源 broker.Release(); return; } //获取表头或表体的BO对象,如果要取原始的XMLDOM对象结果,请使用GetResult(参数名) BusinessObject DomRet = broker.GetBoParam("表头或表体参数名"); //修改获取的BO对象,对需要更改的字段重新赋值 DomRet[0]["字段名"] = "新的字段值"; //获取普通返回值 System.String result = broker.GetReturnValue() as System.String; //获取out/inout参数值 //结束本次调用,释放API资源 broker.Release(); }
/// <summary> /// 加载 /// </summary> /// <param name="bd"></param> /// <param name="dt"></param> /// <param name="domHead"></param> /// <param name="domBody"></param> /// <returns></returns> public override Model.DealResult LoadVouch(Model.APIData bd, Model.Synergismlogdt dt, out BusinessObject domHead, out BusinessObject domBody) { domHead = null; domBody = null; Model.DealResult dr = new Model.DealResult(); Model.APIData apidata = bd as Model.APIData; string vouchid = GetCodeorID(dt.Cvoucherno, apidata, "id"); string auditaddress = SetApiAddressDelete(); U8Login.clsLogin u8Login = new U8Login.clsLogin(); GetU8Login(apidata, u8Login); U8ApiBroker broker = null; dr = GetU8ApiBroker(apidata, u8Login, out broker, "load"); broker.AssignNormalValue("strWhere", ""); broker.AssignNormalValue("varVoucherID", vouchid); broker.AssignNormalValue("strLocateWhere", ""); 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; if (result != string.Empty) { domHead = broker.GetBoParam("domHead"); domBody = broker.GetBoParam("domBody"); domHead.NeedFieldsCheck = false; domBody.NeedFieldsCheck = false; } else { dr.ResultMsg = "API错误:" + result; dr.ResultNum = -1; broker.Release(); BLL.Common.ErrorMsg("", result); } broker.Release(); return(dr); }
public override Model.DealResult UndoMake(BaseData bd, Model.Synergismlogdt dt) { Model.DealResult dr = new Model.DealResult(); Model.APIData apidata = bd as Model.APIData; try { CancelAudit(apidata, dt); } catch (Exception ex) { Log.WriteWinLog("purchaseop_cancelaudit:" + ex.ToString()); dr.ResultNum = -1; dr.ResultMsg = ex.Message; return(dr); } BusinessObject domHead = null; BusinessObject domBody = null; LoadVouch(apidata, dt, out domHead, out domBody); string vouchid = GetCodeorID(dt.Cvoucherno, apidata, "id"); U8Login.clsLogin u8Login = new U8Login.clsLogin(); dr = GetU8Login(apidata, u8Login); if (dr.ResultNum < 0) { return(dr); } U8ApiBroker broker = null; dr = GetU8ApiBroker(apidata, u8Login, out broker, "delete"); if (dr.ResultNum < 0) { return(dr); } broker.SetBoParam("domHead", domHead); try { broker.SetBoParam("domBody", domBody); } catch { } MSXML2.IXMLDOMDocument2 CurDom = new MSXML2.DOMDocument(); broker.AssignNormalValue("CurDom", CurDom); 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; if (result != null) { dr.ResultNum = -1; dr.ResultMsg = "API错误:" + result; throw new Exception("API错误:" + result); } broker.Release(); DAL.Regist registdal = new DAL.Regist(); Model.Regist regist = registdal.GetModel(dt.Accid); //acccode 转 accid return(dr); }
/// <summary> /// 单据弃审 /// </summary> /// <param name="bd"></param> /// <param name="dt"></param> /// <returns></returns> public override Model.DealResult CancelAudit(Model.APIData bd, Model.Synergismlogdt dt) { Model.DealResult dr = new Model.DealResult(); Model.APIData apidata = bd as Model.APIData; BusinessObject domHead = null; BusinessObject domBody = null; if (CheckAuditStatus(dt.Cvoucherno, apidata.ConnectInfo.Constring) == false) { return(dr); } LoadVouch(apidata, dt, out domHead, out domBody); domHead.NeedFieldsCheck = false; domBody.NeedFieldsCheck = false; string vouchid = GetCodeorID(dt.Cvoucherno, apidata, "id"); U8Login.clsLogin u8Login = new U8Login.clsLogin(); dr = GetU8Login(apidata, u8Login); if (dr.ResultNum < 0) { return(dr); } U8ApiBroker broker = null; dr = GetU8ApiBroker(apidata, u8Login, out broker, "cancelaudit"); if (dr.ResultNum < 0) { return(dr); } broker.SetBoParam("domHead", domHead); broker.AssignNormalValue("bVerify", false); 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; if (result != null) { dr.ResultNum = -1; dr.ResultMsg = result; } broker.Release(); return(dr); }
/// <summary> /// 审核 /// </summary> /// <param name="bd"></param> /// <param name="dt"></param> /// <returns></returns> public override Model.DealResult MakeAudit(BaseData bd, Model.Synergismlogdt dt) { Model.DealResult dr; Model.APIData apidata = bd as Model.APIData; BusinessObject domHead = null; BusinessObject domBody = null; LoadVouch(apidata, dt, out domHead, out domBody); domHead.NeedFieldsCheck = false; domBody.NeedFieldsCheck = false; string vouchid = GetCodeorID(dt.Cvoucherno, apidata, "id"); U8Login.clsLogin u8Login = new U8Login.clsLogin(); dr = GetU8Login(apidata, u8Login); if (dr.ResultNum < 0) { return(dr); } U8ApiBroker broker = null; dr = GetU8ApiBroker(apidata, u8Login, out broker, "audit"); if (dr.ResultNum < 0) { return(dr); } broker.SetBoParam("domHead", domHead); broker.AssignNormalValue("bVerify", true); 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; broker.Release(); if (!string.IsNullOrEmpty(result)) { dr.ResultNum = -1; dr.ResultMsg = "API错误:" + result; throw new Exception(dr.ResultMsg); } else { if (!DAL.Common.SetVerifyDate(bd.ConnectInfo, dt)) { Log.WriteWinLog("设置单据审核日期失败,Cvouchertype:" + dt.Cvouchertype + ";Cvoucherno:" + dt.Cvoucherno + "."); } } return(dr); }
public string InvokeU8Api(string method,string content) { string retstr = ""; try { string AccCode = ReadXmlData("Detail", "AccCode"); string User = ReadXmlData("Detail", "User"); string Password = ReadXmlData("Detail", "Password"); string Server = ReadXmlData("Detail", "Server"); string ServiceURL = ReadXmlData("Detail", "ServiceURL"); string ServiceName = "ZhengShanWsIPort";// ZhengShanWsIService ReadXmlData("Detail", "ServiceName"); ulogin = new U8Login.clsLogin(); U8Login.clsLogin u8Login = new U8Login.clsLogin(); // string taskid = clslogin.GetTaskID("DP"); String sSubId = "DP";//AS DP String sAccId = AccCode; String sYear = DateTime.Now.Year.ToString(); String sUserID = User; String sPassword = Password; String sDate = DateTime.Now.ToShortDateString(); String sServer = Server;//USER-20150630LA String sSerial = ""; if (u8Login.Login(ref sSubId, ref sAccId, ref sYear, ref sUserID, ref sPassword, ref sDate, ref sServer, ref sSerial)) { setConnStr(u8Login.UfDbName); //retstr = "login ok!"; } else { retstr = u8Login.ShareString; Marshal.FinalReleaseComObject(u8Login); return retstr; } if(method.Equals("secret")) return u8Login.UfDbName; string api = ""; if (method.Equals("TransVouchAdd"))//调拨单生成 { api = "U8API/TransVouch/Add"; } else if (method.Equals("audit"))//调拨单审核 { api = "U8API/TransVouch/Audit"; } else if (method.Equals("load"))//调拨申请单查询 { api = "U8API/TransRequestVouch/Load"; }else if (method.Equals("OutboundOrderAdd")) api = "U8API/saleout/Add"; if (method.Equals("InventoryQTY")) { DataTable dt = getSqlData("select cinvcode,cwhcode,iquantity,fAvaQuantity from currentstock where cinvcode='" + content + "'"); if (dt != null && dt.Rows.Count > 0) { StringBuilder sb = new StringBuilder(); sb.Append("<?xml version='1.0' encoding='UTF-8'?><DATA>"); for (int i = 0; i < dt.Rows.Count; i++) { sb.Append("<RECORD>"); sb.Append("<CINVCODE>"); sb.Append(dt.Rows[i][0].ToString()); sb.Append("</CINVCODE>"); sb.Append("<CWHCODE>"); sb.Append(dt.Rows[i][1].ToString()); sb.Append("</CWHCODE>"); sb.Append("<IQUANTITY>"); sb.Append(dt.Rows[i][2].ToString()); sb.Append("</IQUANTITY>"); sb.Append("<FAVAQUANTITY>"); sb.Append(dt.Rows[i][3].ToString()); sb.Append("</FAVAQUANTITY>"); sb.Append("</RECORD>"); } sb.Append("</DATA>"); //ZhengShanWsIClient c = new ZhengShanWsIClient(ServiceName, ServiceURL);//"http://192.168.1.122:8081/freshBeef/ws/zhengShanWs" //string result = c.inventory(sb.ToString()); return sb.ToString(); }else return "查不到现存量信息"; } if (method.Equals("Inventory")) { DataTable dt = getSqlData("select cinvcode,cinvname,cinvstd,cinvccode,cComunitcode,CBARCODE,null as CISGIFT,null as gd_is_gift,iInvSaleCost,null as GD_IS_GIFT from Inventory where cinvcode='" + content + "'"); if (dt != null && dt.Rows.Count > 0) { StringBuilder sb = new StringBuilder(); sb.Append("<DATA>");//<?xml version='1.0' encoding='UTF-8'?> for (int i = 0; i < dt.Rows.Count; i++) { sb.Append("<RECORD>"); sb.Append("<CINVCODE>"); sb.Append(dt.Rows[i][0].ToString()); sb.Append("</CINVCODE>"); sb.Append("<CINVNAME>"); sb.Append(dt.Rows[i][1].ToString()); sb.Append("</CINVNAME>"); sb.Append("<CINVSTD>"); sb.Append(dt.Rows[i][2].ToString()); sb.Append("</CINVSTD>"); sb.Append("<CINVCCODE>"); sb.Append(dt.Rows[i][3].ToString()); sb.Append("</CINVCCODE>"); sb.Append("<CCOMUNITCODE>"); sb.Append(dt.Rows[i][4].ToString()); sb.Append("</CCOMUNITCODE>"); sb.Append("<CBARCODE>"); sb.Append(dt.Rows[i][5].ToString()); sb.Append("</CBARCODE>"); sb.Append("<CISGIFT>"); sb.Append(dt.Rows[i][6].ToString()); sb.Append("</CISGIFT>"); sb.Append("<IINVSALECOST>"); sb.Append(dt.Rows[i][7].ToString()); sb.Append("</IINVSALECOST>"); sb.Append("<GD_IS_GIFT>"); sb.Append(dt.Rows[i][8].ToString()); sb.Append("</GD_IS_GIFT>"); sb.Append("</RECORD>"); } sb.Append("</DATA>"); //ZhengShanWsIClient c = new ZhengShanWsIClient(ServiceName, ServiceURL);//"http://192.168.1.122:8081/freshBeef/ws/zhengShanWs" //string result = c.inventory(sb.ToString()); return sb.ToString(); } else return "查不到存货信息"; } if (method.Equals("InventoryClass")) { DataTable dt = getSqlData("select CINVCCODE,CINVCNAME,(select cInvCCode from InventoryClass b where b.iInvCGrade+1=h.iInvCGrade and LEFT(h.cinvccode,LEN(b.cinvccode))=b.cinvccode) as CINVCCODE_F from inventoryclass h "); string str = ""; str += "<DATA>"; for (int i = 0; i < dt.Rows.Count; i++) { str += "<RECORD>"; str += GetXmlTag("CINVCCODE", dt.Rows[i]["CINVCCODE"].ToString()); str += GetXmlTag("CINVCNAME", dt.Rows[i]["CINVCCODE"].ToString()); str += GetXmlTag("CINVCCODE_F", dt.Rows[i]["CINVCCODE_F"].ToString()); str += "</RECORD>"; } str += "</DATA>"; //return PostData(null, content); ZhengShanWsIClient c = new ZhengShanWsIClient(content, ServiceURL);//"http://192.168.1.122:8081/freshBeef/ws/zhengShanWs" return c.InventoryClass(str); } U8EnvContext envContext = new U8EnvContext(); envContext.U8Login = u8Login; //string method = "audit"; U8ApiAddress myApiAddress = new U8ApiAddress(api); U8ApiBroker broker = new U8ApiBroker(myApiAddress, envContext); MSXML2.DOMDocument domMsg = new MSXML2.DOMDocument(); if (method.Equals("TransVouchAdd")) { broker.AssignNormalValue("sVouchType", "12"); BusinessObject DomHead = broker.GetBoParam("DomHead"); DomHead.RowCount = 1; XmlDocument xml = new XmlDocument(); //xml.LoadXml(content.Trim()); xml.Load("c:\\DATA.xml"); XmlNodeList xnList = xml.SelectNodes("/DATA/ORDER/ORDERID/DETAIL"); foreach (XmlNode xn in xnList) { retstr += "开始读取XML"; string VOUCHID = xn["VOUCHID"].InnerText; string VOUCHDATE = xn["VOUCHDATE"].InnerText; //DomHead[0]["id"] = "2"; //主关键字段,int类型 DomHead[0]["ctvcode"] = VOUCHID; //单据号,string类型 DomHead[0]["dtvdate"] = VOUCHDATE; //日期,DateTime类型 DataTable dt = getSqlData("select cwhcode from warehouse where cwhname='" + xn["OWHNAME"].InnerText+"'"); if (dt.Rows.Count > 0) DomHead[0]["cowhcode"] = dt.Rows[0][0].ToString(); dt = getSqlData("select cwhcode from warehouse where cwhname='" + xn["IWHNAME"].InnerText + "'"); if (dt.Rows.Count > 0) DomHead[0]["ciwhcode"] = dt.Rows[0][0].ToString(); DomHead[0]["cwhname"] = xn["OWHNAME"].InnerText; //转出仓库,string类型 DomHead[0]["cwhname_1"] = xn["IWHNAME"].InnerText; //转入仓库,string类型 //DomHead[0]["ciwhcode"] = "2";//转入仓库编码,string类型 //DomHead[0]["cowhcode"] = "1"; //转出仓库编码,string类型 //DomHead[0]["cordcode"] = "2"; //出库类别编码,string类型 //DomHead[0]["cirdcode"] = "1"; //入库类别编码,string类型 //DomHead[0]["crdname_1"] = "销售出库";//出库类别 //DomHead[0]["crdname"] = "采购入库";//入库类别 //DomHead[0]["cdepname_1"] = "采购部"; //DomHead[0]["cdepname"] = "销售部"; //DomHead[0]["codepcode"] = "1"; //DomHead[0]["cidepcode"] = "2"; //DomHead[0]["cpersoncode"] = "1"; DomHead[0]["cpersonname"] = xn["PERSON"].InnerText;//经手人 dt = getSqlData("select cPersonCode from Person where cPersonName='" + xn["PERSON"].InnerText + "'"); if (dt.Rows.Count > 0) DomHead[0]["cpersoncode"] = dt.Rows[0][0].ToString(); //DomHead[0]["iamount"] = "";//现存量 DomHead[0]["dnmaketime"] = DateTime.Now; DomHead[0]["ctvmemo"] = xn["MEMO"].InnerText; DomHead[0]["cinvname"] = xn["CINVNAME"].InnerText; //DomHead[0]["iavaquantity"] = "80"; 可用量 DomHead[0]["csource"] = "1"; //1 -- 库存 2 -- 零售 3 -- 预留 DomHead[0]["cmaker"] = User; DomHead[0]["csource"] = "1"; DomHead[0]["itransflag"] = "正向"; DomHead[0]["vt_id"] = 89; DomHead[0]["dnmaketime"] = DateTime.Now.ToLongDateString(); //DomHead[0]["ufts"] = " 275.5169"; DomHead[0]["btransflag"] = false; BusinessObject domBody = broker.GetBoParam("domBody"); domBody.RowCount = 1; //domBody[0]["autoid"] = "2"; //主关键字段,int类型 domBody[0]["cinvcode"] = xn["CINVCODE"].InnerText;//存货编码,string类型 domBody[0]["cinvname"] = xn["CINVNAME"].InnerText; //domBody[0]["cinvstd"] = ""; domBody[0]["itvquantity"] =getDouble(xn["QTY"].InnerText); //数量,double类型 DataTable dt3 = getSqlData("select cComUnitCode from inventory where cinvcode='" + xn["CINVCODE"].InnerText + "'"); //domBody[0]["itvnum"] = 0.1; domBody[0]["ctvbatch"] = ""; if (dt3.Rows.Count > 0) { domBody[0]["cinvm_unit"] = dt3.Rows[0][0].ToString(); //domBody[0]["cinva_unit"] = "4"; //domBody[0]["cassunit"] = "4"; } domBody[0]["iexpiratdatecalcu"] = 0; domBody[0]["issotype"] = 0; domBody[0]["idsotype"] = 0; domBody[0]["isoseq"] = ""; domBody[0]["idsoseq"] = ""; domBody[0]["issodid"] = ""; domBody[0]["idsodid"] = ""; domBody[0]["cinvaddcode"] = ""; domBody[0]["corufts"] = " "; domBody[0]["cdsocode"] = ""; domBody[0]["csocode"] = ""; domBody[0]["bcosting"] = "1"; domBody[0]["cposition"] = ""; //domBody[0]["iinvexchrate"] = 100; domBody[0]["ctvcode"] = VOUCHID; domBody[0]["fsalecost"] = getDouble(xn["UNITPRICE"].InnerText) * getDouble(xn["QTY"].InnerText); domBody[0]["fsaleprice"] = getDouble(xn["UNITPRICE"].InnerText); //domBody[0]["itvpcost"] = getDouble(xn["itvpcost"].InnerText); ; domBody[0]["itvaprice"] = 0; domBody[0]["itvpprice"] = 0; domBody[0]["itvacost"] = 0; //domBody[0]["igrossweight"] = "3"; //domBody[0]["inetweight"] = "1"; domBody[0]["editprop"] = "A"; retstr += "读取XML完成"; } broker.AssignNormalValue("domPosition", null); broker.AssignNormalValue("errMsg", ""); broker.AssignNormalValue("cnnFrom", null); broker.AssignNormalValue("VouchId", ""); broker.AssignNormalValue("domMsg", domMsg); broker.AssignNormalValue("bCheck", false); broker.AssignNormalValue("bBeforCheckStock", false); broker.AssignNormalValue("bIsRedVouch", false); broker.AssignNormalValue("sAddedState", ""); broker.AssignNormalValue("bReMote", false); } if (method.Equals("OutboundOrderAdd")) { broker.AssignNormalValue("sVouchType", "32");//新增0 修改1 broker.AssignNormalValue("domPosition", null); broker.AssignNormalValue("errMsg", ""); broker.AssignNormalValue("cnnFrom", null); broker.AssignNormalValue("VouchId", ""); broker.AssignNormalValue("domMsg", domMsg); broker.AssignNormalValue("bCheck", false); broker.AssignNormalValue("bBeforCheckStock", false); broker.AssignNormalValue("bIsRedVouch", false); broker.AssignNormalValue("sAddedState", ""); broker.AssignNormalValue("bReMote", false); BusinessObject DomHead = broker.GetBoParam("DomHead"); DomHead.RowCount = 1; XmlDocument xml = new XmlDocument(); xml.LoadXml(content.Trim()); XmlNodeList xnList = xml.SelectNodes("/DATA/ORDER/ORDERID/DETAIL"); foreach (XmlNode xn in xnList) { string VOUCHID = xn["VOUCHID"].InnerText; string VOUCHDATE = xn["VOUCHDATE"].InnerText; } BusinessObject domBody = broker.GetBoParam("domBody"); domBody.RowCount = 1; } if (method.Equals("audit"))//调拨单审核 { DataTable dt = getSqlData("select CONVERT(money,ufts) as ufts from transvouch where cTVCode='" + content + "'"); double ufts = 0; //string ts = ""; if (dt.Rows.Count > 0) { //DataTable dt2 = getSqlData("select convert(timestamp,CONVERT(money," + String.Format("{0,30}", String.Format("{0:0.0000}", ufts)) + ")) as ufts "); ufts = double.Parse(dt.Rows[0][0].ToString()); //ts = dt2.Rows[0][0].ToString(); } else return "找不到此调拨单号:"+content; broker.AssignNormalValue("sVouchType", "12"); broker.AssignNormalValue("VouchId", content);//单据号 broker.AssignNormalValue("errMsg", ""); broker.AssignNormalValue("cnnFrom", null); broker.AssignNormalValue("TimeStamp", String.Format("{0,30}", String.Format("{0:0.0000}", ufts)));// " 275.5210" broker.AssignNormalValue("domMsg", domMsg);//new MSXML2.DOMDocument() broker.AssignNormalValue("bCheck", false); broker.AssignNormalValue("bBeforCheckStock", false); broker.AssignNormalValue("bList", false); broker.AssignNormalValue("MakeWheres", null); broker.AssignNormalValue("sWebXml", ""); broker.AssignNormalValue("oGenVouchIds", null); } if (method.Equals("load")) { broker.AssignNormalValue("sVouchType", "62"); broker.AssignNormalValue("sWhere", " VouchId='0000000001'"); broker.AssignNormalValue("bGetBlank", false); broker.AssignNormalValue("sBodyWhere_Order", "cInvcode"); broker.AssignNormalValue("errMsg", ""); broker.AssignNormalValue("domPos", domMsg); BusinessObject obj = broker.GetBoParam("domHead"); BusinessObject obj1 = broker.GetBoParam("domBody"); } if (method.Equals("submitTransRequestBill")) { string sql = "select h.cTVCode AS VOUCHID,h.dTVDate AS VOUCHDATE,wo.cwhname as OWHNAME,wo.cwhname as IWHNAME,h.cMaker as PERSON,B.CINVCODE,i.CINVNAME,B.ITVQUANTITY AS QTY,B.iUnitCost AS UNITPRICE,B.cbMemo AS MEMO"; sql += "from ST_AppTransVouch h,ST_AppTransVouchs b,Inventory i,warehouse wi,warehouse wo"; sql += "where h.ID = b.ID and i.cinvcode = b.cinvcode and wi.cwhcode = h.cIWhCode and wo.cwhcode = h.cOWhCode "; sql += "and h.cTVCode='"+content+"'"; DataTable dt3 = getSqlData(sql); if (dt3.Rows.Count == 0) return "查不到调拨申请单:"+content; string xml = "<?xml version='1.0' encoding='UTF-8'?>\n"; xml += "<DATA>\n"; xml += "<ORDER>\n"; xml += "<ORDERID>\n"; xml += "<DETAIL>\n"; xml += GetXmlTag("VOUCHID", IsNull(dt3.Rows[0]["VOUCHID"])); xml += GetXmlTag("VOUCHDATE", IsNull(dt3.Rows[0]["VOUCHDATE"])); xml += GetXmlTag("OWHNAME", IsNull(dt3.Rows[0]["OWHNAME"])); xml += GetXmlTag("IWHNAME", IsNull(dt3.Rows[0]["IWHNAME"])); xml += GetXmlTag("PERSON", IsNull(dt3.Rows[0]["PERSON"])); xml += GetXmlTag("VOUCHID", IsNull(dt3.Rows[0]["VOUCHID"])); xml += GetXmlTag("CINVCODE", IsNull(dt3.Rows[0]["CINVCODE"])); xml += GetXmlTag("CINVNAME", IsNull(dt3.Rows[0]["CINVNAME"])); xml += GetXmlTag("QTY", IsNull(dt3.Rows[0]["QTY"])); xml += GetXmlTag("UNITPRICE", IsNull(dt3.Rows[0]["UNITPRICE"])); xml += GetXmlTag("MEMO", IsNull(dt3.Rows[0]["MEMO"])); xml += "\n</DETAIL>"; xml += "\n</ORDERID>"; xml += "\n</ORDER>"; xml += "\n</DATA>"; return PostData(null, content); //ZhengShanWsIClient c = new ZhengShanWsIClient(ServiceName, ServiceURL);//"http://192.168.1.122:8081/freshBeef/ws/zhengShanWs" //return c.ST_AppTransVouchAdd(xml); } retstr += "开始调用"; if (!broker.Invoke()) { retstr += "调用失败:"; //错误处理 Exception apiEx = broker.GetException(); if (apiEx != null) { if (apiEx is MomSysException) { MomSysException sysEx = apiEx as MomSysException; //Console.WriteLine("系统异常:" + sysEx.Message); retstr = sysEx.Message + "[MomSysException]"; //todo:异常处理 } else if (apiEx is MomBizException) { MomBizException bizEx = apiEx as MomBizException; //Console.WriteLine("API异常:" + bizEx.Message); retstr = bizEx.Message + "[MomBizException]"; //todo:异常处理 } } //结束本次调用,释放API资源 broker.Release(); //return; } else { retstr += "调用成功:"; if (method.Equals("load")) { System.String result = broker.GetReturnValue() as System.String; if (string.IsNullOrEmpty(result)) { retstr += "加载调拨申请单成功!"; //Console.WriteLine("加载销售订单成功!"); //获取out/inout参数值 //MSXML2.XMLDocument xmlResult = broker.GetResult("domHead") as MSXML2.XMLDocument; MSXML2.DOMDocumentClass xmlHead = broker.GetResult("DomHead") as MSXML2.DOMDocumentClass; xmlHead.save("TransRequestVouchHead.xml"); //out参数domBody为BO对象(表体),此BO对象的业务类型为销售订单。BO参数均按引用传递,具体请参考服务接口定义 //如果要取原始的XMLDOM对象结果,请使用GetResult() MSXML2.DOMDocumentClass xmlBody = broker.GetResult("domBody") as MSXML2.DOMDocumentClass; xmlBody.save("TransRequestVouchBody.xml"); } else { retstr += "加载调拨申请单失败!"; //Console.WriteLine("加载销售订单失败!"); } }else retstr+=broker.GetResult("errMsg"); } } catch (Exception e) { retstr += "异常:" + e.Message+"\n"+e.StackTrace; return retstr; //throw; } return retstr; }
/// <summary> /// 生单 /// </summary> /// <param name="bd"></param> /// <returns></returns> public override Model.DealResult MakeVouch(BaseData bd) { System.Diagnostics.Trace.WriteLine(" begin MakeVouch "); Model.DealResult dr; Model.APIData apidata = bd as Model.APIData; U8Login.clsLogin u8Login = new U8Login.clsLogin(); System.Diagnostics.Trace.WriteLine(" before GetU8Login "); dr = GetU8Login(apidata, u8Login); System.Diagnostics.Trace.WriteLine(" after GetU8Login "); if (dr.ResultNum < 0) { return(dr); } U8ApiBroker broker = null; dr = GetU8ApiBroker(apidata, u8Login, out broker, "add"); //设置api表头数据 if (dr.ResultNum < 0) { return(dr); } dr = SetDomHead(apidata, broker); //设置api表体数据 if (dr.ResultNum < 0) { return(dr); } dr = SetDomBody(apidata, broker); //设置其它数据 if (dr.ResultNum < 0) { return(dr); } dr = AssignNormalValues(apidata, broker); if (dr.ResultNum < 0) { return(dr); } string strRow; { U8ApiBroker ubOrder = null; dr = GetU8ApiBroker(apidata, u8Login, out ubOrder, "add"); MSXML2.IXMLDOMDocument2 xmlHead = broker.GetBoParam("DomHead").ToRSDOM(); MSXML2.IXMLDOMDocument2 xmlBody = broker.GetBoParam("DomBody").ToRSDOM(); dr = AssignNormalValues(apidata, ubOrder); MSXML2.IXMLDOMNodeList lstx; MSXML2.IXMLDOMNode xmle; #region 行号 //行号赋值 lstx = xmlBody.getElementsByTagName("z:row"); switch (bd.Synergismlogdt.Cvouchertype) { case "27": //采购请购单 case "88": //采购订单 strRow = "ivouchrowno"; break; case "01": //发货、退货单 strRow = "iorderrowno"; break; case "03": //退货单 added by liuxzha 2014.11.27 strRow = "iorderrowno"; break; default: strRow = "irowno"; break; } for (int i = 0; i < lstx.length; i++) { xmle = lstx[i].attributes.getNamedItem(strRow); if (xmle == null) { xmle = xmlBody.createNode(System.Xml.XmlNodeType.Attribute, strRow, null); xmle.nodeValue = (i + 1).ToString(); lstx[i].attributes.setNamedItem(xmle); } else { xmle.nodeValue = (i + 1).ToString(); } } #endregion #region 可用量 //销售订单 if (bd.Synergismlogdt.Cvouchertype == "17") { //是否可用量检查 lstx = xmlHead.getElementsByTagName("z:row"); xmle = xmlHead.createNode(System.Xml.XmlNodeType.Attribute, "bcontinue", null); xmle.nodeValue = "0"; lstx[0].attributes.setNamedItem(xmle); } //销售发货单 else if (bd.Synergismlogdt.Cvouchertype == "01") { //是否可用量检查 lstx = xmlHead.getElementsByTagName("z:row"); xmle = xmlHead.createNode(System.Xml.XmlNodeType.Attribute, "saveafterok", null); xmle.nodeValue = "0"; // lstx[0].attributes.setNamedItem(xmle); } //销售退货单 added by liuxzha 2014.11.27 else if (bd.Synergismlogdt.Cvouchertype == "03") { //是否可用量检查 lstx = xmlHead.getElementsByTagName("z:row"); xmle = xmlHead.createNode(System.Xml.XmlNodeType.Attribute, "saveafterok", null); xmle.nodeValue = "0"; lstx[0].attributes.setNamedItem(xmle); } //销售出库单 else if (bd.Synergismlogdt.Cvouchertype == "0303") { //是否可用量检查 lstx = xmlHead.getElementsByTagName("z:row"); xmle = xmlHead.createNode(System.Xml.XmlNodeType.Attribute, "saveafterok", null); xmle.nodeValue = "0"; lstx[0].attributes.setNamedItem(xmle); } #endregion ubOrder.AssignNormalValue("domHead", xmlHead); ubOrder.AssignNormalValue("domBody", xmlBody); U8.Interface.Bus.Log.WriteFileWithName("DomHead.xml", xmlHead.xml); U8.Interface.Bus.Log.WriteFileWithName("DomBody.xml", xmlBody.xml); dr = BrokerInvoker(ubOrder); } System.Diagnostics.Trace.WriteLine(" before MakeVouch UpdateTeamworkField "); UpdateTeamworkField(bd, dr); System.Diagnostics.Trace.WriteLine(" end MakeVouch UpdateTeamworkField "); ClearUATask(bd); //if (!DAL.Common.SetCreateDate(bd, dr.VouchIdRet)) // U8.Interface.Bus.Log.WriteWinLog("设置单据制单时间失败,Cvouchertype:" + bd.Synergismlogdt.Cvouchertype + ";VouchIdRet:" + dr.VouchIdRet + "."); System.Diagnostics.Trace.WriteLine(" end MakeVouch "); return(dr); }
public static string InsertProduct(DataTable dthead, DataTable dtbody) { U8EnvContext envContext = new U8EnvContext(); envContext.U8Login = canshu.u8Login; //envContext.U8Login = u8Login; //第三步:设置API地址标识(Url) //当前API:添加新单据的地址标识为:U8API/MaterialOut/Add U8ApiAddress myApiAddress = new U8ApiAddress("U8API/ARClose/SaveVouch"); //第四步:构造APIBroker U8ApiBroker broker = new U8ApiBroker(myApiAddress, envContext); //第五步:API参数赋值 ////给普通参数sVouchType赋值。此参数的数据类型为System.String,此参数按值传递,表示单据类型:11 //broker.AssignNormalValue("sVouchType", "11"); ////该参数VouchId为INOUT型普通参数。此参数的数据类型为System.String,此参数按值传递。在API调用返回时,可以通过GetResult("VouchId")获取其值 //string vouid = ""; //broker.AssignNormalValue("VouchId", vouid); ////该参数domMsg为OUT型参数,由于其数据类型为MSXML2.IXMLDOMDocument2,非一般值类型,因此必须传入一个参数变量。在API调用返回时,可以直接使用该参数 MSXML2.IXMLDOMDocument2 domMsg = new MSXML2.DOMDocumentClass(); broker.AssignNormalValue("domMsg", domMsg); ////给普通参数bCheck赋值。此参数的数据类型为System.Boolean,此参数按值传递,表示是否控制可用量。 //broker.AssignNormalValue("bCheck", true); ////给普通参数bBeforCheckStock赋值。此参数的数据类型为System.Boolean,此参数按值传递,表示检查可用量 //broker.AssignNormalValue("bBeforCheckStock", true); ////给普通参数bIsRedVouch赋值。此参数的数据类型为System.Boolean,此参数按值传递,表示是否红字单据 //broker.AssignNormalValue("bIsRedVouch", false); ////给普通参数sAddedState赋值。此参数的数据类型为System.String,此参数按值传递,表示传空字符串 //string sadd = ""; //broker.AssignNormalValue("sAddedState", sadd); ////给普通参数bReMote赋值。此参数的数据类型为System.Boolean,此参数按值传递,表示是否远程:转入false //broker.AssignNormalValue("bReMote", false); //打开adodb连接 Connection oCon = new ConnectionClass(); oCon.Open(envContext.U8Login.UfDbName); MSXML2.IXMLDOMDocument2 domhead = new DOMDocument(); MSXML2.IXMLDOMDocument2 dombody = new DOMDocument(); //表头赋值 //表头DOM赋值 string sqlt = "select cast(null as nvarchar(2)) as editprop,* from AR_CloseR where 1=2 "; Recordset rs = new Recordset(); rs.Open(sqlt, oCon, CursorTypeEnum.adOpenForwardOnly, LockTypeEnum.adLockReadOnly); rs.Save(domhead, PersistFormatEnum.adPersistXML); //插入表头信息 IXMLDOMElement eleHead = (IXMLDOMElement)domhead.selectSingleNode("//rs:data"); IXMLDOMElement ele = (IXMLDOMElement)domhead.createElement("z:row"); eleHead.appendChild(ele); try { ele.setAttribute("editprop", "A");//A代表增加,M代表修改 ele.setAttribute("dVouchDate", DateTime.Now.ToShortDateString()); ele.setAttribute("cdwcode", "0999"); //ele.setAttribute("id", rdid); ele.setAttribute("ccode", "100"); ele.setAttribute("VT_ID", "65"); ele.setAttribute("ddate", DateTime.Now.ToShortDateString()); //出库日期 ele.setAttribute("dnmaketime", DateTime.Now.ToString()); //制单日期 ele.setAttribute("cmemo", "下料生成"); //备注 ele.setAttribute("cmaker", canshu.u8Login.cUserName); //制单人 broker.AssignNormalValue("DomHead", domhead); } catch (Exception ex) { MessageBox.Show(ex.Message, "错误发生", MessageBoxButtons.OK, MessageBoxIcon.Error); return("0"); } //表体赋值 string sqlw = "select cast(null as nvarchar(2)) as editprop,* from recordoutsq where 1=2 "; //Recordset rs = new Recordset(); rs.Close(); rs.Open(sqlw, oCon, CursorTypeEnum.adOpenForwardOnly, LockTypeEnum.adLockReadOnly); rs.Save(dombody, PersistFormatEnum.adPersistXML); //插入表体尾信息 //dombody.rowcount = IXMLDOMElement eleBody = (IXMLDOMElement)dombody.selectSingleNode("//rs:data"); for (int i = 0; i < dtbody.Rows.Count; i++) { ele = (IXMLDOMElement)dombody.createElement("z:row"); eleBody.appendChild(ele); // 表尾赋值 //string cinvcode = "01019002063"; //int autoid = 1000; //decimal sl = 4m; try { ele.setAttribute("editprop", "A"); //ele.setAttribute("autoid", autoid); ele.setAttribute("cinvcode", DbHelper.GetDbString(dtbody.Rows[i]["存货编码"])); if (string.IsNullOrEmpty(DbHelper.GetDbString(dtbody.Rows[i]["lotno"])) != true) { ele.setAttribute("cBatch", DbHelper.GetDbString(dtbody.Rows[i]["lotno"])); } ele.setAttribute("iquantity", DbHelper.GetDbString(dtbody.Rows[i]["本次下料"])); //MessageBox.Show(dtbody.Rows[i]["本次下料"].ToString()); ele.setAttribute("iMPoIds", DbHelper.GetDbInt(dtbody.Rows[i]["allocateid"])); ele.setAttribute("cmocode", DbHelper.GetDbString(dthead.Rows[0]["染料单号"])); ele.setAttribute("inquantity", DbHelper.GetDbdecimal(dtbody.Rows[i]["未下数量"])); //未下应下数量 //生产订单信息 ele.setAttribute("invcode", DbHelper.GetDbString(dthead.Rows[0]["色号"])); ele.setAttribute("imoseq", DbHelper.GetDbString(dthead.Rows[0]["sortseq"])); ele.setAttribute("iopseq", DbHelper.GetDbString(dtbody.Rows[i]["opseq"])); ele.setAttribute("copdesc", DbHelper.GetDbString(dtbody.Rows[i]["工序"])); ele.setAttribute("iExpiratDateCalcu", 0); ele.setAttribute("irowno", i + 1); } catch (Exception ex) { MessageBox.Show(ex.Message, "错误发生", MessageBoxButtons.OK, MessageBoxIcon.Error); return("0"); } } broker.AssignNormalValue("DomBody", dombody); //测试结果 //domhead.save(@"d:\2xml"); //dombody.save(@"d:\3.xm.l"); //第六步:调用API if (!broker.Invoke()) { //错误处理 Exception apiEx = broker.GetException(); if (apiEx != null) { if (apiEx is MomSysException) { MomSysException sysEx = apiEx as MomSysException; MessageBox.Show("系统异常:" + sysEx.Message); //todo:异常处理 } else if (apiEx is MomBizException) { MomBizException bizEx = apiEx as MomBizException; MessageBox.Show("API异常:" + bizEx.Message); //todo:异常处理 } //异常原因 String exReason = broker.GetExceptionString(); if (exReason.Length != 0) { MessageBox.Show("异常原因:" + exReason); } } //结束本次调用,释放API资源 broker.Release(); return("0"); } //第七步:获取返回结果 //获取返回值 //获取普通返回值。此返回值数据类型为System.Boolean,此参数按值传递,表示返回值:true:成功,false:失败 System.Boolean result = Convert.ToBoolean(broker.GetReturnValue()); if (result == false) { //获取普通OUT参数errMsg。此返回值数据类型为System.String,在使用该参数之前,请判断是否为空 System.String errMsgRet = broker.GetResult("errMsg") as System.String; if (errMsgRet != null) { MessageBox.Show(errMsgRet.ToString(), "错误提示1!"); } return("2"); //MessageBox.Show(result.ToString(), "导入成功提示"); } ////获取out/inout参数值 ////获取普通OUT参数errMsg。此返回值数据类型为System.String,在使用该参数之前,请判断是否为空 //System.String errMsgRet = broker.GetResult("errMsg") as System.String; //if (errMsgRet != null) // MessageBox.Show(errMsgRet.ToString(), "错误提示1!"); ////获取普通INOUT参数VouchId。此返回值数据类型为System.String,在使用该参数之前,请判断是否为空 System.String VouchIdRet = broker.GetResult("VouchId") as System.String; ////获取普通OUT参数domMsg。此返回值数据类型为MSXML2.IXMLDOMDocument2,在使用该参数之前,请判断是否为空 //MSXML2.IXMLDOMDocument2 domMsgRet = (broker.GetResult("domMsg")) as MSXML2.IXMLDOMDocument2; //if (domMsgRet != null) // MessageBox.Show(domMsgRet.ToString(), "错误提示2!"); //结束本次调用,释放API资源 broker.Release(); return(VouchIdRet); }
/// <summary> /// 销售订单:装载单据 /// </summary> public void LoadSaleOrder(string vouchID) { try { //第二步:构造环境上下文对象,传入login,并按需设置其它上下文参数 U8EnvContext envContext = new U8EnvContext(); envContext.U8Login = u8Login; //销售所有接口均支持内部独立事务和外部事务,默认内部事务 //如果是外部事务,则需要传递ADO.Connection对象,并将IsIndependenceTransaction属性设置为false //envContext.BizDbConnection = new ADO.Connection(); //envContext.IsIndependenceTransaction = false; //设置上下文参数 envContext.SetApiContext("VoucherType", 12); //上下文数据类型:int,含义:单据类型:12 //第三步:设置API地址标识(Url) //当前API:装载单据的地址标识为:U8API/SaleOrder/Load U8ApiAddress myApiAddress = new U8ApiAddress("U8API/SaleOrder/Load"); //第四步:构造APIBroker U8ApiBroker broker = new U8ApiBroker(myApiAddress, envContext); //第五步:API参数赋值 //给普通参数VouchID赋值。此参数的数据类型为string,此参数按值传递,表示单据号 broker.AssignNormalValue("VouchID", vouchID); //给普通参数blnAuth赋值。此参数的数据类型为System.Boolean,此参数按值传递,表示是否控制权限:true broker.AssignNormalValue("blnAuth", true); //第六步:调用API if (!broker.Invoke()) { //错误处理 Exception apiEx = broker.GetException(); if (apiEx != null) { if (apiEx is MomSysException) { MomSysException sysEx = apiEx as MomSysException; Console.WriteLine("系统异常:" + sysEx.Message); //todo:异常处理 } else if (apiEx is MomBizException) { MomBizException bizEx = apiEx as MomBizException; Console.WriteLine("API异常:" + bizEx.Message); //todo:异常处理 } //异常原因 String exReason = broker.GetExceptionString(); if (exReason.Length != 0) { Console.WriteLine("异常原因:" + exReason); } } //结束本次调用,释放API资源 broker.Release(); //return null; } //第七步:获取返回结果 //获取返回值 //获取普通返回值。此返回值数据类型为System.String,此参数按值传递,表示成功为空串 System.String result = broker.GetReturnValue() as System.String; //throw new Exception(result); if (!string.IsNullOrEmpty(result)) { throw new Exception(result); } //获取out/inout参数值 //out参数domHead为BO对象(表头),此BO对象的业务类型为销售订单。BO参数均按引用传递,具体请参考服务接口定义 //如果要取原始的XMLDOM对象结果,请使用GetResult("domHead") as MSXML2.DOMDocument BusinessObject domHeadRet = broker.GetBoParam("domHead"); Console.WriteLine("BO对象(表头)行数为:" + domHeadRet.RowCount); //获取BO对象(表头)的行数 //获取BO对象(表头)各字段的值。字段定义详见API服务接口定义 //MSXML2.DOMDocument domHead = broker.GetResult("domHead") as MSXML2.DOMDocument; //out参数domBody为BO对象(表体),此BO对象的业务类型为销售订单。BO参数均按引用传递,具体请参考服务接口定义 //如果要取原始的XMLDOM对象结果,请使用GetResult("domBody") as MSXML2.DOMDocument BusinessObject domBodyRet = broker.GetBoParam("domBody"); Console.WriteLine("BO对象(表体)行数为:" + domBodyRet.RowCount); //获取BO对象(表体)的行数 //获取BO对象(表体)各字段的值。以下代码示例只取第一行。字段定义详见API服务接口定义 //MSXML2.DOMDocument domBody = broker.GetResult("domBody") as MSXML2.DOMDocument; //结束本次调用,释放API资源 broker.Release(); /* * SO_SOMain so_somain = EntityConvert.ToSO_SOMain(domHeadRet[0]); * SO_SODetails so_sodetail; * for (int i = 0; i < domBodyRet.RowCount; i++) * { * so_sodetail = EntityConvert.ToSO_SODetails(domBodyRet[i]); * so_sodetail.cSOCode = so_somain.cSOCode; * so_somain.List.Add(so_sodetail); * } * return so_somain; */ } catch (Exception ex) { throw new Exception(ex.Message); } }
/// <summary> /// 审核 /// </summary> /// <param name="bd"></param> /// <param name="dt"></param> /// <returns></returns> public override Model.DealResult MakeAudit(BaseData bd, Model.Synergismlogdt dt) { Model.DealResult dr = new Model.DealResult(); Model.APIData apidata = bd as Model.APIData; //string vouchid = GetCodeorID(dt.Cvoucherno, apidata, "id"); string auditaddress = SetApiAddressAudit(); U8Login.clsLogin u8Login = new U8Login.clsLogin(); GetU8Login(apidata, u8Login); U8ApiBroker broker = null; dr = GetU8ApiBroker(apidata, u8Login, out broker, "audit"); broker.AssignNormalValue("mocode", dt.Cvoucherno); //第六步:调用API if (!broker.Invoke()) { //错误处理 Exception apiEx = broker.GetException(); if (apiEx != null) { if (apiEx is MomSysException) { MomSysException sysEx = apiEx as MomSysException; Console.WriteLine("系统异常:" + sysEx.Message); //todo:异常处理 } else if (apiEx is MomBizException) { MomBizException bizEx = apiEx as MomBizException; Console.WriteLine("API异常:" + bizEx.Message); //todo:异常处理 } //异常原因 String exReason = broker.GetExceptionString(); if (exReason.Length != 0) { Console.WriteLine("异常原因:" + exReason); } } //结束本次调用,释放API资源 broker.Release(); return(dr); } //第七步:获取返回结果 //获取返回值 //获取普通返回值。此返回值数据类型为System.Boolean,此参数按值传递,表示返回值: true:成功, false: 失败 System.Boolean result = Convert.ToBoolean(broker.GetReturnValue()); //结束本次调用,释放API资源 broker.Release(); //dr = BrokerInvoker(broker); if (!DAL.Common.SetVerifyDate(bd.ConnectInfo, dt)) { U8.Interface.Bus.Log.WriteWinLog("设置单据审核日期失败,Cvouchertype:" + dt.Cvouchertype + ";Cvoucherno:" + dt.Cvoucherno + "."); } return(dr); }
public string InvokeU8Api(string method,string content) { string retstr = ""; try { string AccCode = ReadXmlData("Detail", "AccCode"); string User = ReadXmlData("Detail", "User"); string Password = ReadXmlData("Detail", "Password"); string Server = ReadXmlData("Detail", "Server"); ulogin = new U8Login.clsLogin(); U8Login.clsLogin u8Login = new U8Login.clsLogin(); // string taskid = clslogin.GetTaskID("DP"); String sSubId = "DP";//AS DP String sAccId = AccCode; String sYear = DateTime.Now.Year.ToString(); String sUserID = User; String sPassword = Password; String sDate = DateTime.Now.ToShortDateString(); String sServer = Server;//USER-20150630LA String sSerial = ""; if (u8Login.Login(ref sSubId, ref sAccId, ref sYear, ref sUserID, ref sPassword, ref sDate, ref sServer, ref sSerial)) { setConnStr(u8Login.UfDbName); //retstr = "login ok!"; } else { retstr = u8Login.ShareString; Marshal.FinalReleaseComObject(u8Login); return retstr; } string ServiceURL = ReadXmlData("Detail", "ServiceURL"); string ServiceName = ReadXmlData("Detail", "ServiceName"); if (method.Equals("InventoryQTY"))//对方来调 { DataTable dt = getSqlData("select cinvcode,cwhcode,iquantity,fAvaQuantity from currentstock where cinvcode='" + content + "'"); if (dt != null && dt.Rows.Count > 0) { StringBuilder sb = new StringBuilder(); sb.Append("<?xml version='1.0' encoding='UTF-8'?> <DATA> "); for (int i = 0; i < dt.Rows.Count; i++) { sb.Append("<RECORD>"); sb.Append("<CINVCODE>"); sb.Append(dt.Rows[i][0].ToString()); sb.Append("</CINVCODE>"); sb.Append("<CWHCODE>"); sb.Append(dt.Rows[i][1].ToString()); sb.Append("</CWHCODE>"); sb.Append("<IQUANTITY>"); sb.Append(dt.Rows[i][2].ToString()); sb.Append("</IQUANTITY>"); sb.Append("<FAVAQUANTITY>"); sb.Append(dt.Rows[i][3].ToString()); sb.Append("</FAVAQUANTITY>"); sb.Append("</RECORD>"); } sb.Append("</DATA>"); return sb.ToString(); } else return "查不到现存量信息"; } if (method.Equals("Inventory"))//U8触发器调用,再调用对方ws { DataTable dt = getSqlData("select cinvcode,cinvname,cinvstd,ccomunitcode,cinvccode,cbarcode,'0' as cisgift,'0' as gd_is_gift,iinvsalecost from inventory with(nolock) where cinvcode='" + content + "'"); DataRow dr = dt.Rows[0]; StringBuilder sb = new StringBuilder(); sb.Append("<DATA><RECORD>"); ConcatXml(sb, dr, "CINVCODE", "cinvcode"); ConcatXml(sb, dr, "CINVNAME", "cinvname"); ConcatXml(sb, dr, "CINVSTD", "cinvstd"); ConcatXml(sb, dr, "CINVCCODE", "cinvccode"); ConcatXml(sb, dr, "CCOMUNITCODE", "ccomunitcode"); ConcatXml(sb, dr, "CBARCODE", "cbarcode"); ConcatXml(sb, dr, "CISGIFT", "cisgift"); ConcatXml(sb, dr, "iInvSaleCost", "iInvSaleCost"); ConcatXml(sb, dr, "gd_is_gift", "gd_is_gift"); sb.Append("</RECORD>"); sb.Append("</DATA>"); ZSNS.ZhengShanWsIClient client = new ZSNS.ZhengShanWsIClient(ServiceName,ServiceURL); return client.inventory(sb.ToString()); //return sb.ToString(); //return "SUCC"; } if (method.Equals("InventoryClass"))//暂时 不使用 { DataTable dt = getSqlData("select CINVCCODE,CINVCNAME,(select cInvCCode from InventoryClass b with(nolock) where b.iInvCGrade+1=h.iInvCGrade and LEFT(h.cinvccode,LEN(b.cinvccode))=b.cinvccode) as CINVCCODE_F from inventoryclass h with(nolock)"); string str = ""; str += "<DATA>"; for (int i = 0; i < dt.Rows.Count; i++) { str += "<RECORD>"; str += GetXmlTag("CINVCCODE", dt.Rows[i]["CINVCCODE"].ToString()); str += GetXmlTag("CINVCNAME", dt.Rows[i]["CINVCCODE"].ToString()); str += GetXmlTag("CINVCCODE_F", dt.Rows[i]["CINVCCODE_F"].ToString()); str += "</RECORD>"; } str += "</DATA>"; ZSNS.ZhengShanWsIClient client = new ZSNS.ZhengShanWsIClient(ServiceName, ServiceURL); return client.InventoryClass(str); } if (method.Equals("ST_AppTransVouchAdd"))//本地U8调拨申请单审核时触发 { StringBuilder sql = new StringBuilder(); sql.AppendLine("select h.cTVCode as vouchid,h.dtvdate as vouchdate,ow.cwhname as owhname,"); sql.AppendLine("iw.cwhname as iwhname,p.cPersonname as Person,"); sql.AppendLine("b.cinvcode,i.cinvname,b.fSaleCost as unitprice,b.itvquantity as qty,b.cbmemo as memo "); sql.AppendLine("from ST_AppTransVouch h with(nolock) inner join ST_AppTransVouchs b with(nolock) on h.ID = b.ID"); sql.AppendLine("inner join Inventory i with(nolock) on i.cInvCode = b.cInvcode "); sql.AppendLine("inner join warehouse ow with(nolock) on ow.cwhcode = h.cOWhCode"); sql.AppendLine("inner join warehouse iw with(nolock) on iw.cwhcode = h.cIWhCode"); sql.AppendLine("left join person p with(nolock) on p.cPersoncode = h.cPersonCode "); sql.AppendLine("where h.cTVCode='"+content+"'"); DataTable dt = getSqlData(sql.ToString()); if (dt.Rows.Count == 0) return "无此调拨申请单号"+content; DataRow dr = dt.Rows[0]; StringBuilder sb = new StringBuilder(); sb.Append("<RECORD>"); sb.Append("<ORDER>"); sb.Append("<ORDERID>"); sb.Append("<HEADER>"); ConcatXml(sb, dr, "VOUCHID", "vouchid"); ConcatXml(sb, dr, "VOUCHDATE", "vouchdate"); ConcatXml(sb, dr, "OWHNAME", "owhname"); ConcatXml(sb, dr, "IWHNAME", "iwhname"); ConcatXml(sb, dr, "PERSON", "person"); sb.Append("</HEADER>"); for (int i = 0; i < dt.Rows.Count; i++) { sb.Append("<DETAIL>"); ConcatXml(sb, dt.Rows[i], "CINVCODE", "cinvcode"); ConcatXml(sb, dt.Rows[i], "CINVNAME", "cinvname"); ConcatXml(sb, dt.Rows[i], "UNITPRICE", "unitprice"); ConcatXml(sb, dt.Rows[i], "QTY", "qty"); ConcatXml(sb, dt.Rows[i], "MEMO", "memo"); sb.Append("</DETAIL>"); } sb.Append("</ORDERID>"); sb.Append("</ORDER>"); sb.Append("</RECORD>"); sb.Append("</DATA>"); ZSNS.ZhengShanWsIClient c = new ZSNS.ZhengShanWsIClient(ServiceName, ServiceURL); return c.ST_AppTransVouchAdd(sb.ToString()); } string api = ""; if (method.Equals("TransVouchAdd"))//调拨单生成 { api = "U8API/TransVouch/Add"; } else if (method.Equals("audit"))//调拨单审核 { api = "U8API/TransVouch/Delete"; } else if (method.Equals("load"))//调拨申请单查询,废弃 { api = "U8API/TransRequestVouch/Load"; }else if (method.Equals("OutboundOrderAdd")) api = "U8API/saleout/Add"; if (method.Equals("OutboundOrderDone")) api = "U8API/saleout/CancelAudit";//Delete U8EnvContext envContext = new U8EnvContext(); envContext.U8Login = u8Login; //string method = "audit"; U8ApiAddress myApiAddress = new U8ApiAddress(api); U8ApiBroker broker = new U8ApiBroker(myApiAddress, envContext); MSXML2.DOMDocument domMsg = new MSXML2.DOMDocument(); if (method.Equals("TransVouchAdd"))//基本完成 { broker.AssignNormalValue("sVouchType", "12"); BusinessObject DomHead = broker.GetBoParam("DomHead"); DomHead.RowCount = 1; XmlDocument xml = new XmlDocument(); //xml.LoadXml(content.Trim()); xml.Load("c:\\DATA.xml"); XmlNodeList xnList = xml.SelectNodes("/DATA/ORDER/ORDERID/DETAIL"); foreach (XmlNode xn in xnList) { retstr += "开始读取XML"; string VOUCHID = xn["VOUCHID"].InnerText; string VOUCHDATE = xn["VOUCHDATE"].InnerText; //DomHead[0]["id"] = "2"; //主关键字段,int类型 DomHead[0]["ctvcode"] = VOUCHID; //单据号,string类型 DomHead[0]["dtvdate"] = VOUCHDATE; //日期,DateTime类型 DataTable dt = getSqlData("select cwhcode from warehouse where cwhname='" + xn["OWHNAME"].InnerText+"'"); if (dt.Rows.Count > 0) DomHead[0]["cowhcode"] = dt.Rows[0][0].ToString(); dt = getSqlData("select cwhcode from warehouse where cwhname='" + xn["IWHNAME"].InnerText + "'"); if (dt.Rows.Count > 0) DomHead[0]["ciwhcode"] = dt.Rows[0][0].ToString(); DomHead[0]["cwhname"] = xn["OWHNAME"].InnerText; //转出仓库,string类型 DomHead[0]["cwhname_1"] = xn["IWHNAME"].InnerText; //转入仓库,string类型 //DomHead[0]["ciwhcode"] = "2";//转入仓库编码,string类型 //DomHead[0]["cowhcode"] = "1"; //转出仓库编码,string类型 //DomHead[0]["cordcode"] = "2"; //出库类别编码,string类型 //DomHead[0]["cirdcode"] = "1"; //入库类别编码,string类型 //DomHead[0]["crdname_1"] = "销售出库";//出库类别 //DomHead[0]["crdname"] = "采购入库";//入库类别 //DomHead[0]["cdepname_1"] = "采购部"; //DomHead[0]["cdepname"] = "销售部"; //DomHead[0]["codepcode"] = "1"; //DomHead[0]["cidepcode"] = "2"; //DomHead[0]["cpersoncode"] = "1"; DomHead[0]["cpersonname"] = xn["PERSON"].InnerText;//经手人 dt = getSqlData("select cPersonCode from Person where cPersonName='" + xn["PERSON"].InnerText + "'"); if (dt.Rows.Count > 0) DomHead[0]["cpersoncode"] = dt.Rows[0][0].ToString(); //DomHead[0]["iamount"] = "";//现存量 DomHead[0]["dnmaketime"] = DateTime.Now; DomHead[0]["ctvmemo"] = xn["MEMO"].InnerText; DomHead[0]["cinvname"] = xn["CINVNAME"].InnerText; //DomHead[0]["iavaquantity"] = "80"; 可用量 DomHead[0]["csource"] = "1"; //1 -- 库存 2 -- 零售 3 -- 预留 DomHead[0]["cmaker"] = User; DomHead[0]["csource"] = "1"; DomHead[0]["itransflag"] = "正向"; DomHead[0]["vt_id"] = 89; DomHead[0]["dnmaketime"] = DateTime.Now.ToLongDateString(); //DomHead[0]["ufts"] = " 275.5169"; DomHead[0]["btransflag"] = false; BusinessObject domBody = broker.GetBoParam("domBody"); domBody.RowCount = 1; //domBody[0]["autoid"] = "2"; //主关键字段,int类型 domBody[0]["cinvcode"] = xn["CINVCODE"].InnerText;//存货编码,string类型 domBody[0]["cinvname"] = xn["CINVNAME"].InnerText; //domBody[0]["cinvstd"] = ""; domBody[0]["itvquantity"] =getDouble(xn["QTY"].InnerText); //数量,double类型 DataTable dt3 = getSqlData("select cComUnitCode from inventory where cinvcode='" + xn["CINVCODE"].InnerText + "'"); //domBody[0]["itvnum"] = 0.1; domBody[0]["ctvbatch"] = ""; if (dt3.Rows.Count > 0) { domBody[0]["cinvm_unit"] = dt3.Rows[0][0].ToString(); //domBody[0]["cinva_unit"] = "4"; //domBody[0]["cassunit"] = "4"; } domBody[0]["iexpiratdatecalcu"] = 0; domBody[0]["issotype"] = 0; domBody[0]["idsotype"] = 0; domBody[0]["isoseq"] = ""; domBody[0]["idsoseq"] = ""; domBody[0]["issodid"] = ""; domBody[0]["idsodid"] = ""; domBody[0]["cinvaddcode"] = ""; domBody[0]["corufts"] = " "; domBody[0]["cdsocode"] = ""; domBody[0]["csocode"] = ""; domBody[0]["bcosting"] = "1"; domBody[0]["cposition"] = ""; //domBody[0]["iinvexchrate"] = 100; domBody[0]["ctvcode"] = VOUCHID; domBody[0]["fsalecost"] = getDouble(xn["UNITPRICE"].InnerText) * getDouble(xn["QTY"].InnerText); domBody[0]["fsaleprice"] = getDouble(xn["UNITPRICE"].InnerText); //domBody[0]["itvpcost"] = getDouble(xn["itvpcost"].InnerText); ; domBody[0]["itvaprice"] = 0; domBody[0]["itvpprice"] = 0; domBody[0]["itvacost"] = 0; //domBody[0]["igrossweight"] = "3"; //domBody[0]["inetweight"] = "1"; domBody[0]["editprop"] = "A"; retstr += "读取XML完成"; } broker.AssignNormalValue("domPosition", null); broker.AssignNormalValue("errMsg", ""); broker.AssignNormalValue("cnnFrom", null); broker.AssignNormalValue("VouchId", ""); broker.AssignNormalValue("domMsg", domMsg); broker.AssignNormalValue("bCheck", false); broker.AssignNormalValue("bBeforCheckStock", false); broker.AssignNormalValue("bIsRedVouch", false); broker.AssignNormalValue("sAddedState", ""); broker.AssignNormalValue("bReMote", false); } if (method.Equals("OutboundOrderAdd")) { broker.AssignNormalValue("sVouchType", "32");//新增0 修改1 broker.AssignNormalValue("vNewID", ""); } if (method.Equals("OutboundOrderDone"))//出库单审核 { DataTable dt = getSqlData("select CONVERT(money,ufts) as ufts from rdrecord32 where cCode='" + content + "'"); double ufts = 0; if (dt.Rows.Count > 0) ufts = double.Parse(dt.Rows[0][0].ToString()); else return "找不到此销售出库单号:" + content; broker.AssignNormalValue("sVouchType", "32"); broker.AssignNormalValue("VouchId", content);//单据号 broker.AssignNormalValue("errMsg", ""); broker.AssignNormalValue("cnnFrom", null); broker.AssignNormalValue("TimeStamp", String.Format("{0,30}", String.Format("{0:0.0000}", ufts)));// " 275.5210" broker.AssignNormalValue("domMsg", domMsg);//new MSXML2.DOMDocument() broker.AssignNormalValue("bCheck", false); broker.AssignNormalValue("bBeforCheckStock", false); broker.AssignNormalValue("bList", false); //删除单据不需要下面三个参数 //broker.AssignNormalValue("MakeWheres", null); //broker.AssignNormalValue("sWebXml", ""); //broker.AssignNormalValue("oGenVouchIds", null); } if (method.Equals("audit"))//调拨单审核,未解决 { DataTable dt = getSqlData("select CONVERT(money,ufts) as ufts from transvouch where cTVCode='" + content + "'"); double ufts = 0; //string ts = ""; if (dt.Rows.Count > 0) { //DataTable dt2 = getSqlData("select convert(timestamp,CONVERT(money," + String.Format("{0,30}", String.Format("{0:0.0000}", ufts)) + ")) as ufts "); ufts = double.Parse(dt.Rows[0][0].ToString()); //ts = dt2.Rows[0][0].ToString(); } else return "找不到此调拨单号:"+content; broker.AssignNormalValue("sVouchType", "12"); broker.AssignNormalValue("VouchId", content);//单据号 broker.AssignNormalValue("errMsg", ""); broker.AssignNormalValue("cnnFrom", null); broker.AssignNormalValue("TimeStamp", String.Format("{0,30}", String.Format("{0:0.0000}", ufts)));// " 275.5210" broker.AssignNormalValue("domMsg", domMsg);//new MSXML2.DOMDocument() broker.AssignNormalValue("bCheck", false); broker.AssignNormalValue("bBeforCheckStock", false); broker.AssignNormalValue("bList", false); //broker.AssignNormalValue("MakeWheres", null); //broker.AssignNormalValue("sWebXml", ""); //broker.AssignNormalValue("oGenVouchIds", null); } if (method.Equals("load"))//deprecated. not in use { broker.AssignNormalValue("sVouchType", "62"); broker.AssignNormalValue("sWhere", " VouchId='0000000001'"); broker.AssignNormalValue("bGetBlank", false); broker.AssignNormalValue("sBodyWhere_Order", "cInvcode"); broker.AssignNormalValue("errMsg", ""); broker.AssignNormalValue("domPos", domMsg); BusinessObject obj = broker.GetBoParam("domHead"); BusinessObject obj1 = broker.GetBoParam("domBody"); } retstr += "开始调用"; if (!broker.Invoke()) { retstr += "调用失败:"; //错误处理 Exception apiEx = broker.GetException(); if (apiEx != null) { if (apiEx is MomSysException) { MomSysException sysEx = apiEx as MomSysException; //Console.WriteLine("系统异常:" + sysEx.Message); retstr = sysEx.Message + "[MomSysException]"; //todo:异常处理 } else if (apiEx is MomBizException) { MomBizException bizEx = apiEx as MomBizException; //Console.WriteLine("API异常:" + bizEx.Message); retstr = bizEx.Message + "[MomBizException]"; //todo:异常处理 } } //结束本次调用,释放API资源 broker.Release(); //return; } else { retstr += "调用成功:"; if (method.Equals("load")) { System.String result = broker.GetReturnValue() as System.String; if (string.IsNullOrEmpty(result)) { retstr += "加载调拨申请单成功!"; //Console.WriteLine("加载销售订单成功!"); //获取out/inout参数值 //MSXML2.XMLDocument xmlResult = broker.GetResult("domHead") as MSXML2.XMLDocument; MSXML2.DOMDocumentClass xmlHead = broker.GetResult("DomHead") as MSXML2.DOMDocumentClass; xmlHead.save("TransRequestVouchHead.xml"); //out参数domBody为BO对象(表体),此BO对象的业务类型为销售订单。BO参数均按引用传递,具体请参考服务接口定义 //如果要取原始的XMLDOM对象结果,请使用GetResult() MSXML2.DOMDocumentClass xmlBody = broker.GetResult("domBody") as MSXML2.DOMDocumentClass; xmlBody.save("TransRequestVouchBody.xml"); } else { retstr += "加载调拨申请单失败!"; //Console.WriteLine("加载销售订单失败!"); } } else { DOMDocument doc = (DOMDocument)broker.GetResult("domMsg"); if (doc != null) retstr += doc.text + "|"; retstr += broker.GetResult("errMsg") + "|" + broker.GetResult("retval").ToString(); } } } catch (Exception e) { retstr += "异常:" + e.Message+"\n"+e.StackTrace; return retstr; //throw; } return retstr; }