Пример #1
0
        /// <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);
            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);

            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();

            return(dr);
        }
Пример #2
0
 /// <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 = base.MakeAudit(bd, dt);
     return(dr);
 }
Пример #3
0
        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);
        }
Пример #4
0
        /// <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);
        }
Пример #5
0
        /// <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;
            BusinessObject   domHead = null;
            BusinessObject   domBody = null;

            string vouchid = GetCodeorID(dt.Cvoucherno, apidata, "id");

            if (string.IsNullOrEmpty(vouchid))
            {
                return(dr);
            }

            try
            {
                CancelAudit(apidata, dt);
            }
            catch (Exception ex)
            {
                Log.WriteWinLog("saleop_cancelaudit:" + ex.ToString());
                dr.ResultNum = -1;
                dr.ResultMsg = ex.Message;
                return(dr);
            }
            LoadVouch(apidata, dt, out domHead, out domBody);
            domHead.NeedFieldsCheck = false;
            domBody.NeedFieldsCheck = false;

            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("dombodyforlog", domBody);
            }
            catch { }
            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 (result != null)
            {
                dr.ResultNum = -1;
                dr.ResultMsg = result;
                throw new Exception(result);
            }

            return(dr);
        }
Пример #6
0
        /// <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);
        }
Пример #7
0
Файл: APIOp.cs Проект: sky-tc/U8
        /// <summary>
        /// 获取Login对象
        /// </summary>
        /// <param name="bd"></param>
        /// <param name="u8Login"></param>
        /// <returns></returns>
        public Model.DealResult GetU8Login_bak(Model.APIData bd, U8Login.clsLogin u8Login)
        {
            System.Diagnostics.Trace.WriteLine("  begin GetU8Login  ");

            Model.DealResult dr = new Model.DealResult();

            #region 一次登录
            //if (bd.TaskType != 1 && null != _login)
            //{
            //    u8Login = _login;
            //    return dr;
            //}

            #endregion


            System.Diagnostics.Trace.WriteLine("  before  GetU8Login 判断格式 ");
            #region 判断格式  登录
            string strErr = ",请在[账套档案注册]模块中更新!";
            if (string.IsNullOrEmpty(bd.ConnectInfo.UserId))
            {
                dr.ResultMsg = "默认操作员不能为空" + strErr;
                dr.ResultNum = -1;
                Marshal.FinalReleaseComObject(u8Login);
                throw new Exception(dr.ResultMsg);
            }
            if (string.IsNullOrEmpty(bd.ConnectInfo.Source))
            {
                dr.ResultMsg = "数据源不能为空" + strErr;
                dr.ResultNum = -1;
                Marshal.FinalReleaseComObject(u8Login);
                throw new Exception(dr.ResultMsg);
            }
            if (string.IsNullOrEmpty(bd.ConnectInfo.AccId))
            {
                dr.ResultMsg = "账套号不能为空" + strErr;
                dr.ResultNum = -1;
                Marshal.FinalReleaseComObject(u8Login);
                throw new Exception(dr.ResultMsg);
            }
            if (string.IsNullOrEmpty(bd.ConnectInfo.Srv))
            {
                dr.ResultMsg = "服务器地址不能为空" + strErr;
                dr.ResultNum = -1;
                Marshal.FinalReleaseComObject(u8Login);
                throw new Exception(dr.ResultMsg);
            }
            if (string.IsNullOrEmpty(bd.ConnectInfo.YearId))
            {
                dr.ResultMsg = "登陆年度不能为空" + strErr;
                dr.ResultNum = -1;
                Marshal.FinalReleaseComObject(u8Login);
                throw new Exception(dr.ResultMsg);
            }
            else
            {
                try { int.Parse(bd.ConnectInfo.YearId); }
                catch
                {
                    dr.ResultMsg = "登陆年度格式错误:" + bd.ConnectInfo.YearId + strErr;
                    dr.ResultNum = -1;
                    Marshal.FinalReleaseComObject(u8Login);
                    throw new Exception(dr.ResultMsg);
                }
            }
            DbHelperSQLP dsp    = new DbHelperSQLP(bd.ConnectInfo.Constring);
            string       strSql = "SELECT 1 FROM UFSystem.dbo.UA_AccountDatabase A JOIN UFSystem.dbo.UA_Account B ON A.cAcc_Id=B.cAcc_Id WHERE A.cAcc_Id='" + bd.ConnectInfo.AccId + "' ";
            if (!dsp.Exists(strSql))
            {
                dr.ResultMsg = "登陆失败,原因:账套 " + bd.ConnectInfo.AccId + " 在 " + bd.ConnectInfo.Srv + " 上不存在";
                dr.ResultNum = -1;
                Marshal.FinalReleaseComObject(u8Login);
                throw new Exception(dr.ResultMsg);
            }
            #endregion

            System.Diagnostics.Trace.WriteLine("  after  GetU8Login 判断格式 ");

            string subId    = U8.Interface.Bus.SysInfo.subId;
            string userId   = bd.ConnectInfo.UserId;
            string accId    = bd.ConnectInfo.Source + "@" + bd.ConnectInfo.AccId;
            string yearId   = bd.ConnectInfo.YearId;
            string password = bd.ConnectInfo.Password;
            string date     = bd.ConnectInfo.Date;
            string srv      = bd.ConnectInfo.sSrv;
            string serial   = bd.ConnectInfo.Serial;


            #region 20140814

            #endregion

            System.Diagnostics.Trace.WriteLine("  before  GetU8Login u8Login.Login   ");
            System.Diagnostics.Trace.WriteLine("  login parameter :  " + subId + "----" + accId + "----" + yearId + "----" + userId + "----" + password + "----" + date + "----" + srv + "----" + serial);

            try
            {
                if (!u8Login.Login(ref subId, ref accId, ref yearId, ref userId, ref password, ref date, ref srv, ref serial))
                {
                    System.Diagnostics.Trace.WriteLine("    GetU8Login  failed  ");
                    dr.ResultMsg = "登陆失败,原因:" + u8Login.ShareString;
                    if (u8Login.ShareString.IndexOf("年度") > 0 || u8Login.ShareString.IndexOf("日期") > 0)
                    {
                        dr.ResultMsg += " - " + date;
                    }
                    dr.ResultNum = -1;
                    Marshal.FinalReleaseComObject(u8Login);
                    throw new Exception(dr.ResultMsg);
                }
            }
            catch (Exception ee)
            {
                if (dr.ResultNum == -1)
                {
                    throw new Exception(dr.ResultMsg);
                }
                else
                {
                    System.Diagnostics.Trace.WriteLine("   GetU8Login u8Login.Login Error : " + ee.StackTrace);
                    dr.ResultNum = -1;
                    throw new Exception(ee.Message);
                }
            }


            System.Diagnostics.Trace.WriteLine("  end  GetU8Login u8Login.Login ");
            System.Diagnostics.Trace.WriteLine("  end GetU8Login  ");

            //_login = u8Login;
            return(dr);
        }
Пример #8
0
        /// <summary>
        /// 测试U8登录
        ///  source = "(default)"
        /// </summary>
        /// <returns></returns>
        public static int TestU8Login(string sqlconnection, string ServerName, string source, string accid, string userid, string pwd,
                                      string yearid, string date,
                                      out string errmsg)
        {
            Model.DealResult dr = new Model.DealResult();

            U8Login.clsLogin u8Login = new U8Login.clsLogin();

            #region 判断格式  登录

            string strErr = ",请在[账套档案注册]模块中更新!";
            if (string.IsNullOrEmpty(userid))
            {
                dr.ResultMsg = "默认操作员不能为空" + strErr;
                dr.ResultNum = -1;
                Marshal.FinalReleaseComObject(u8Login);
                throw new Exception(dr.ResultMsg);
            }
            if (string.IsNullOrEmpty(source))
            {
                dr.ResultMsg = "数据源不能为空" + strErr;
                dr.ResultNum = -1;
                Marshal.FinalReleaseComObject(u8Login);
                throw new Exception(dr.ResultMsg);
            }
            if (string.IsNullOrEmpty(accid))
            {
                dr.ResultMsg = "账套号不能为空" + strErr;
                dr.ResultNum = -1;
                Marshal.FinalReleaseComObject(u8Login);
                throw new Exception(dr.ResultMsg);
            }
            if (string.IsNullOrEmpty(ServerName))
            {
                dr.ResultMsg = "服务器地址不能为空" + strErr;
                dr.ResultNum = -1;
                Marshal.FinalReleaseComObject(u8Login);
                throw new Exception(dr.ResultMsg);
            }
            if (string.IsNullOrEmpty(yearid))
            {
                dr.ResultMsg = "登陆年度不能为空" + strErr;
                dr.ResultNum = -1;
                Marshal.FinalReleaseComObject(u8Login);
                throw new Exception(dr.ResultMsg);
            }
            else
            {
                try { int.Parse(yearid); }
                catch
                {
                    dr.ResultMsg = "登陆年度格式错误:" + yearid + strErr;
                    dr.ResultNum = -1;
                    Marshal.FinalReleaseComObject(u8Login);
                    throw new Exception(dr.ResultMsg);
                }
            }

            if (!string.IsNullOrEmpty(sqlconnection))
            {
                DbHelperSQLP dsp    = new DbHelperSQLP(sqlconnection);
                string       strSql = "SELECT 1 FROM UFSystem.dbo.UA_AccountDatabase A JOIN UFSystem.dbo.UA_Account B ON A.cAcc_Id=B.cAcc_Id WHERE A.cAcc_Id='" + accid + "' ";
                if (!dsp.Exists(strSql))
                {
                    dr.ResultMsg = "登陆失败,原因:账套 " + accid + " 在 " + ServerName + " 上不存在";
                    dr.ResultNum = -1;
                    Marshal.FinalReleaseComObject(u8Login);
                    errmsg = dr.ResultMsg;
                    return(-1);
                }
            }
            #endregion

            string subId  = U8.Interface.Bus.SysInfo.subId;
            string userId = userid;
            string accId  = source + "@" + accid;

            string yearId   = yearid; // DateTime.Now.ToString("yyyy"); // yearid;
            string password = pwd;
            string _date    = date;   // DateTime.Now.ToString("yyyy-MM-dd");  //bd.ConnectInfo.Date;
            string srv      = ServerName;
            string serial   = BLL.Common.GetSerial();


            #region 20140814

            #endregion

            if (!u8Login.Login(ref subId, ref accId, ref yearId, ref userId, ref password, ref _date, ref srv, ref serial))
            {
                dr.ResultMsg = "登陆失败,原因:" + u8Login.ShareString;
                if (u8Login.ShareString.IndexOf("年度") > 0 || u8Login.ShareString.IndexOf("日期") > 0)
                {
                    dr.ResultMsg += " - " + _date;
                }
                dr.ResultNum = -1;
                Marshal.FinalReleaseComObject(u8Login);
                errmsg = dr.ResultMsg;
                return(-1);
            }

            //清除站点
            if (!string.IsNullOrEmpty(sqlconnection))
            {
                DbHelperSQLP dsp = new DbHelperSQLP(sqlconnection);
                string       sql = string.Format("DELETE UFSystem..ua_Task WHERE cStation='{0}' AND cUser_Id='{1}' AND cAcc_Id='{2}' ", ServerName, userId, accId);
                dsp.ExecuteSql(sql);
            }

            errmsg = null;
            return(1);
        }
Пример #9
0
Файл: APIOp.cs Проект: sky-tc/U8
        /// <summary>
        /// 获取 vb login 和 .net login
        /// 可绕过login验证
        /// </summary>
        /// <param name="bd"></param>
        /// <param name="oSysLogin"></param>
        /// <param name="u8Login"></param>
        /// <returns></returns>
        private Model.DealResult GetU8LoginNew(Model.APIData bd, UFSoft.U8.Framework.Login.UI.clsLogin oSysLogin, U8Login.clsLogin u8Login)
        {
            Model.DealResult dr = new Model.DealResult();

            System.Diagnostics.Trace.WriteLine("  before  GetU8Login 判断格式 ");
            #region 判断格式  登录
            string strErr = ",请在[账套档案注册]模块中更新!";
            if (string.IsNullOrEmpty(bd.ConnectInfo.UserId))
            {
                dr.ResultMsg = "默认操作员不能为空" + strErr;
                dr.ResultNum = -1;
                Marshal.FinalReleaseComObject(u8Login);
                throw new Exception(dr.ResultMsg);
            }
            if (string.IsNullOrEmpty(bd.ConnectInfo.Source))
            {
                dr.ResultMsg = "数据源不能为空" + strErr;
                dr.ResultNum = -1;
                Marshal.FinalReleaseComObject(u8Login);
                throw new Exception(dr.ResultMsg);
            }
            if (string.IsNullOrEmpty(bd.ConnectInfo.AccId))
            {
                dr.ResultMsg = "账套号不能为空" + strErr;
                dr.ResultNum = -1;
                Marshal.FinalReleaseComObject(u8Login);
                throw new Exception(dr.ResultMsg);
            }
            if (string.IsNullOrEmpty(bd.ConnectInfo.Srv))
            {
                dr.ResultMsg = "服务器地址不能为空" + strErr;
                dr.ResultNum = -1;
                Marshal.FinalReleaseComObject(u8Login);
                throw new Exception(dr.ResultMsg);
            }
            if (string.IsNullOrEmpty(bd.ConnectInfo.YearId))
            {
                dr.ResultMsg = "登陆年度不能为空" + strErr;
                dr.ResultNum = -1;
                Marshal.FinalReleaseComObject(u8Login);
                throw new Exception(dr.ResultMsg);
            }
            else
            {
                try { int.Parse(bd.ConnectInfo.YearId); }
                catch
                {
                    dr.ResultMsg = "登陆年度格式错误:" + bd.ConnectInfo.YearId + strErr;
                    dr.ResultNum = -1;
                    Marshal.FinalReleaseComObject(u8Login);
                    throw new Exception(dr.ResultMsg);
                }
            }
            DbHelperSQLP dsp    = new DbHelperSQLP(bd.ConnectInfo.Constring);
            string       strSql = "SELECT 1 FROM UFSystem.dbo.UA_AccountDatabase A JOIN UFSystem.dbo.UA_Account B ON A.cAcc_Id=B.cAcc_Id WHERE A.cAcc_Id='" + bd.ConnectInfo.AccId + "' ";
            if (!dsp.Exists(strSql))
            {
                dr.ResultMsg = "登陆失败,原因:账套 " + bd.ConnectInfo.AccId + " 在 " + bd.ConnectInfo.Srv + " 上不存在";
                dr.ResultNum = -1;
                Marshal.FinalReleaseComObject(u8Login);
                throw new Exception(dr.ResultMsg);
            }
            #endregion

            System.Diagnostics.Trace.WriteLine("  after  GetU8Login 判断格式 ");


            bool   bLogined;
            string beginDate;

            oSysLogin = new UFSoft.U8.Framework.Login.UI.clsLogin();

            beginDate            = "";      //GetMonthBegindate(acc_ID, iYear, "12")  //用12期间构造login,12期间必有
            oSysLogin.LanguageID = "zh-CN"; // GetAccountLoginLocaleID(modUtility.GetDbName(acc_ID, iYear))

            string subId    = U8.Interface.Bus.SysInfo.subId;
            string userId   = bd.ConnectInfo.UserId;
            string accId    = bd.ConnectInfo.Source + "@" + bd.ConnectInfo.AccId;
            string yearId   = bd.ConnectInfo.YearId;
            string password = bd.ConnectInfo.Password;
            string date     = bd.ConnectInfo.Date;
            string srv      = bd.ConnectInfo.sSrv;
            string serial   = bd.ConnectInfo.Serial;

            bLogined = oSysLogin.login(subId, userId, password, srv, date, accId, serial);

            if (!bLogined)
            {
                strErr = oSysLogin.ErrDescript; //& g_fmtr.GetString("String.U8.AA.Admin.4671", g_args)
                //'strErr = oSysLogin.ErrDescript & "内置用户密码不正确!"
                //'Call WriteTransferLog(g_ologin.cAcc_ID, g_ologin.cAccName, g_ologin.cIyear, "", "准备年结环境时出现错误,错误描述:" & oSyslogin.ErrDescript & "内置用户密码不正确!")
                dr.ResultMsg = "登陆失败,原因:" + strErr;
                dr.ResultNum = -1;
                Marshal.FinalReleaseComObject(u8Login);
                throw new Exception(dr.ResultMsg);
            }

            UFSoft.U8.Framework.LoginContext.ProductContext oLoginContext;
            oLoginContext = new UFSoft.U8.Framework.LoginContext.ProductContext();
            oLoginContext = oSysLogin.SubLogin(U8.Interface.Bus.SysInfo.subId);

            if (null == oLoginContext)
            {
                strErr = oSysLogin.ErrDescript;
                //'MsgBox oSyslogin.ErrDescript
                //'Call WriteTransferLog(g_ologin.cAcc_ID, g_ologin.cAccName, g_ologin.cIyear, "", "准备年结环境时出现错误,错误描述:" & oSyslogin.ErrDescript)
                dr.ResultMsg = "登陆失败,原因:" + strErr;
                dr.ResultNum = -1;
                Marshal.FinalReleaseComObject(u8Login);
                throw new Exception(dr.ResultMsg);
            }

            //u8Login = new U8Login.clsLogin();

            if (!u8Login.ConstructLogin(oSysLogin.userToken))
            {
                strErr = u8Login.ShareString;
                //'Call WriteTransferLog(g_ologin.cAcc_ID, g_ologin.cAccName, g_ologin.cIyear, "", "准备年结环境时出现错误,错误描述:" & oLogin.ShareString)
                dr.ResultMsg = "登陆失败,原因:" + strErr;
                dr.ResultNum = -1;
                Marshal.FinalReleaseComObject(u8Login);
                throw new Exception(dr.ResultMsg);
            }

            if (!u8Login.Login(ref subId, ref accId, ref yearId, ref userId, ref password, ref date, ref srv, ref serial))
            {
                System.Diagnostics.Trace.WriteLine("    GetU8Login  failed  ");
                dr.ResultMsg = "登陆失败,原因:" + u8Login.ShareString;
                if (u8Login.ShareString.IndexOf("年度") > 0 || u8Login.ShareString.IndexOf("日期") > 0)
                {
                    dr.ResultMsg += " - " + date;
                }
                dr.ResultNum = -1;
                Marshal.FinalReleaseComObject(u8Login);
                throw new Exception(dr.ResultMsg);
            }


            return(dr);
        }
Пример #10
0
Файл: SfcOp.cs Проект: sky-tc/U8
        /// <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);
        }
Пример #11
0
Файл: SfcOp.cs Проект: sky-tc/U8
        /// <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);
        }
Пример #12
0
Файл: SfcOp.cs Проект: sky-tc/U8
 /// <summary>
 ///
 /// </summary>
 /// <param name="apidata"></param>
 /// <param name="broker"></param>
 /// <returns></returns>
 public virtual Model.DealResult AssignNormalValues(Model.APIData apidata, UFIDA.U8.U8APIFramework.U8ApiBroker broker)
 {
     Model.DealResult dr = new Model.DealResult();
     return(dr);
 }
Пример #13
0
Файл: SfcOp.cs Проект: sky-tc/U8
        /// <summary>
        /// 设置表体
        /// </summary>
        /// <param name="apidata"></param>
        /// <param name="broker"></param>
        /// <returns></returns>
        public Model.DealResult SetDomBody(Model.APIData apidata, U8ApiBroker broker)
        {
            Model.DealResult dr = new Model.DealResult();

            #region //第二层
            if (apidata.SfcBodyData.Count == 0)
            {
                return(dr);
            }
            if (string.IsNullOrEmpty(SubEntityName))
            {
                return(dr);
            }

            ExtensionBusinessEntity SubEntity = broker.GetExtBoEntity("extbo")[0].SubEntity[SubEntityName];

            SubEntity.ItemCount = apidata.SfcBodyData.Count;
            int i = 0;
            foreach (BodyRow bodyRow in apidata.SfcBodyData)
            {
                SetUNV(i, bodyRow.BodyCols, SubEntity, apidata, apidata.Synergismlogdt.Cvouchertype);
                //SetUNV(bodyRow.BodyCols, SubEntity, apidata, "FC32");

                #region 待删除
                //foreach (Model.U8NameValue unv in lunv)
                //{
                //    //string fieldName = unv.U8FieldName.ToLower();
                //    string fieldName = unv.U8FieldName.ToLower();

                //    if (unv.U8FieldName.ToLower() == "bgsp")
                //    {
                //        if (unv.U8FieldValue.ToString() == "是")
                //        {
                //            WorkhrNoteOpSum[i][unv.U8FieldName] = "1";
                //        }
                //        else if (unv.U8FieldValue.ToString() == "否")
                //        {
                //            WorkhrNoteOpSum[i][unv.U8FieldName] = "0";
                //        }
                //        else
                //        {
                //            WorkhrNoteOpSum[i][unv.U8FieldName] = unv.U8FieldValue;
                //        }
                //    }

                //    else
                //    {
                //        int iFieldType = DAL.Common.GetFieldType(apidata.ConnectInfo.Constring, unv.U8FieldName, "FC32");
                //        if (iFieldType == 5 && !string.IsNullOrEmpty(unv.U8FieldValue))
                //        {
                //            WorkhrNoteOpSum[i][unv.U8FieldName] = Convert.ToDateTime(unv.U8FieldValue).ToString("yyyy-MM-dd");
                //        }
                //        else
                //        {
                //            WorkhrNoteOpSum[i][unv.U8FieldName] = unv.U8FieldValue;
                //        }
                //    }
                //}
                #endregion

                #endregion

                #region  第三层
                if (bodyRow.ChildData.Count == 0)
                {
                    return(dr);
                }
                if (string.IsNullOrEmpty(SubChildEntityName))
                {
                    return(dr);
                }

                ExtensionBusinessEntity SubChildEntity = SubEntity[i].SubEntity[SubChildEntityName];
                int iChildRow = 0;
                foreach (List <Model.U8NameValue> lunvc in bodyRow.ChildData)
                {
                    SetUNV(iChildRow, lunvc, SubChildEntity, apidata, apidata.Synergismlogdt.Cvouchertype);
                    iChildRow++;
                }
                #endregion


                i++;
            }

            return(dr);
        }