using log4net; using System; using System.Collections.Generic; using ADODB; using MSXML2; using UFIDA.U8.Framework.Api.ControlObject.Common; using UFIDA.U8.Framework.Api.ControlObject.Models; using UFIDA.U8.Framework.Api.ControlObject.U8M; // ReSharper disable IdentifierTypo // ReSharper disable InconsistentNaming // ReSharper disable StringLiteralTypo namespace UFIDA.U8.Framework.Api.ControlObject.AP { public class UFAPBO { protected readonly ILog logInfo = LogManager.GetLogger("logInfo"); public BaseResult CloseBillSave(BaseLogin baseLogin,Dictionary dictionary,string cSubId,bool isAdd=true, bool bFirst=false,string bodyKey="body") { try { var m_Login = baseLogin._vbLogin; var domHead = dictionary.ToDocument2(); IXMLDOMDocument2 domBody = new DOMDocument(); if (dictionary[bodyKey] is List> bodyList && bodyList.Count > 0) { domBody = bodyList.ToDocument2(domBody); } var bo = "UFAPBO.clsCloseBill".GetComObject(); var m_conn = new Connection(); m_conn.Open(m_Login.UfDbName); bo.Init(m_Login, m_conn, null,cSubId); bo.First = bFirst; var errorMessage = ""; var checkFlag = bo.VouchCheck(domHead, domBody, ref errorMessage, isAdd); if (!checkFlag) throw new Exception(errorMessage); errorMessage = ""; var saveFlag = bo.SaveVouch(domHead, domBody, ref errorMessage, isAdd); if (!saveFlag) throw new Exception(errorMessage); return new BaseResult { bSuccess = true, message = "保存成功", result = "保存成功" }; } catch (Exception ex) { logInfo.Error(ex.Message, ex); return new BaseResult { bSuccess = false, message = "保存失败", result = ex.Message }; } } } }