Esempio n. 1
0
        public override void Run(Context ctx, Schedule schedule)
        {
            SQLStatement = base.GetStatement(PayableSQLObject.Payable);
            opearteList  = GetOpearteList(PayableSQLObject.Payable);
            if (connectionToRemoteDatabase().Sucessd)
            {
                ExcuteDataBaseResult excuteDataBaseResult = base.remoteExcuteDataBase.excuteStatement(SQLStatement, connectionToRemoteDatabase().Sqlconn);
                payableSaveInfoObjList = handleData <PayableInfoSaveObject>(excuteDataBaseResult.Ds);
            }
            else
            {
                //打印
            }

            if (LoginAPI(model))
            {
                Dictionary <string, Result> statusMap = new Dictionary <string, Result>();


                foreach (PayableInfoSaveObject payableSaveInfoObject in payableSaveInfoObjList)
                {
                    InvokeReturnHandle <InvokeResult> callResult = InvokeAPI(opearteList, payableSaveInfoObject, InvokeCloudAPI.Login(model), ctx, formID, model);
                    statusMap.Add(payableSaveInfoObject.Model.FBillNo, callResult.CustomOpearteObject.Result);
                }
                List <string> getUpdateSQLStatements = new SQLStatement(model).getUpdateSQLStatement(model, statusMap);
                SqlConnection Sqlconn = connectionToRemoteDatabase().Sqlconn;
                foreach (string UpdateSQLStatement in getUpdateSQLStatements)
                {
                    updateMiddleDataBase(UpdateSQLStatement, model, "t_kf_payable", Sqlconn);
                }
            }
        }
Esempio n. 2
0
        public override void Run(Context ctx, Schedule schedule)
        {
            //1从中间表中获取当前需要调用的模块的SQL
            // 1.2.连接中间数据库
            // 1.3.获取数据
            //2.调用Kingdee登录API
            //3.调用客户API
            //4.反写中间数据库
            //5.关闭数据库连接
            SQLStatement = GetStatement(CustomerSQLObject.Customer);
            opearteList  = GetOpearteList(CustomerSQLObject.Customer);
            //修改的单独处理
            BussnessModify customerModify = new BussnessModify();

            customerModify.excuteSQL(model, connectionToRemoteDatabase(), ctx);
            if (connectionToRemoteDatabase().Sucessd)
            {
                ExcuteDataBaseResult excuteDataBaseResult = base.remoteExcuteDataBase.excuteStatement(SQLStatement, connectionToRemoteDatabase().Sqlconn);
                customSaveInfoObjList = handleData <CustomInfoSaveObject>(excuteDataBaseResult.Ds);
                if (!closeConnetction(connectionToRemoteDatabase().Sqlconn))
                {
                    //打印关闭连接
                    BussnessLog.WriteBussnessLog("", "数据库操作错误", model + "中间表取数后,关闭数据库连接失败! 请联系系统管理员!");
                    return;
                }
            }
            else
            {
                if (!closeConnetction(connectionToRemoteDatabase().Sqlconn))
                {
                    BussnessLog.WriteBussnessLog("", "数据库操作错误", model + "中间表取数前打开数据库连接失败! 请联系系统管理员!");
                    return;
                }
            }
            Dictionary <string, Result> statusMap = new Dictionary <string, Result>();

            if (LoginAPI(model))
            {
                foreach (CustomInfoSaveObject customSaveInfoObj in customSaveInfoObjList)
                {
                    InvokeReturnHandle <InvokeResult> callResult = InvokeAPI(opearteList, customSaveInfoObj, InvokeCloudAPI.Login(model), ctx, formID, model);
                    statusMap.Add(customSaveInfoObj.Model.Fnumber, callResult.CustomOpearteObject.Result);
                }
                List <string> getUpdateSQLStatements = new SQLStatement(model).getUpdateSQLStatement(model, statusMap);
                SqlConnection Sqlconn = connectionToRemoteDatabase().Sqlconn;
                foreach (string UpdateSQLStatement in getUpdateSQLStatements)
                {
                    updateMiddleDataBase(UpdateSQLStatement, model, "t_kf_customer", Sqlconn);
                }
                if (!closeConnetction(Sqlconn))
                {
                    BussnessLog.WriteBussnessLog("", "数据库操作错误", model + "中间表数据更新后,关闭数据库连接失败! 请联系系统管理员!");
                    return;
                }
            }
        }
Esempio n. 3
0
        public InvokeReturnHandle <InvokeResult> InvokeAPI <T>(string[] opearteList, T t, Invoke.LoginResult loginResult, Context ctx, string formID, string model)
        {
            InvokeResult invokeResult = null;
            string       input        = null;
            string       outopt       = "";

            foreach (string opearte in opearteList)
            {
                BussnessLog.WriteBussnessLog(default(T), model, "操作=" + opearte);
                if (Save.Equals(opearte))
                {
                    BussnessLog.WriteBussnessLog(default(T), model, "input json=" + JsonExtension.ToJSON(t));
                    invokeResult = InvokeCloudAPI.InvokeFunction(JsonExtension.ToJSON(t), loginResult.client, formID, Save, model);
                }
                else
                {
                    input = JsonExtension.ToJSON(handleReturnMessage <InfoexceptAllocate>(invokeResult, opearte, model, ctx).CustomOpearteObject);
                    BussnessLog.WriteBussnessLog(default(T), model, "input json=" + input);
                    invokeResult = InvokeCloudAPI.InvokeFunction(input, loginResult.client, formID, opearte, model);
                }
                if (model.Equals("voucher") || model.Equals("payable") || model.Equals("receivable") || model.Equals("otherpayable") || model.Equals("otherrecable"))
                {
                    InvokeReturnHandle <InvokeResult> result = handleReturnMessage <InvokeResult>(invokeResult, opearte, model, ctx);
                    if (result.CustomOpearteObject.Result.ResponseStatus.IsSuccess)
                    {
                        BussnessLog.WriteBussnessLog(default(T), model, "操作=" + opearte + "成功!");
                    }
                    else
                    {
                        BussnessLog.WriteBussnessLog(default(T), model, "操作=" + opearte + "失败!");
                    }
                    return(result);
                }

                if (!handleReturnMessage <InfoexceptAllocate>(invokeResult, opearte, model, ctx).ReturnResult)
                {
                    outopt = opearte;
                    BussnessLog.WriteBussnessLog(default(T), model, "操作=" + opearte + "失败!");
                    InvokeReturnHandle <InvokeResult> aresult = new InvokeReturnHandle <InvokeResult>();
                    aresult.ReturnResult        = false;
                    aresult.CustomOpearteObject = invokeResult;
                    return(aresult);
                }
                else
                {
                    BussnessLog.WriteBussnessLog(default(T), model, "操作=" + opearte + "成功!");
                }
            }
            InvokeReturnHandle <InvokeResult> a = new InvokeReturnHandle <InvokeResult>();

            a.ReturnResult        = true;
            a.CustomOpearteObject = invokeResult;
            return(a);

            throw new NotImplementedException();
        }
Esempio n. 4
0
        public override void Run(Context ctx, Schedule schedule)
        {
            //VoucherNumbers.Add("记", "PRE001");
            //VoucherNumbers.Add("现收", "PRE002");
            //VoucherNumbers.Add("现付", "PRE003");
            //VoucherNumbers.Add("转", "PRE004");
            //VoucherNumbers.Add("银收", "PZZ1");
            //VoucherNumbers.Add("银付", "PZZ2");

            SQLStatement = base.GetStatement(VouchSQLObject.Voucher);
            opearteList  = GetOpearteList(VouchSQLObject.Voucher);
            if (connectionToRemoteDatabase().Sucessd)
            {
                ExcuteDataBaseResult excuteDataBaseResult = base.remoteExcuteDataBase.excuteStatement(SQLStatement, connectionToRemoteDatabase().Sqlconn);
                voucherSaveInfoObjList = handleData <VoucherInfoSaveObject>(excuteDataBaseResult.Ds);
                if (!closeConnetction(connectionToRemoteDatabase().Sqlconn))
                {
                    //打印关闭连接
                    BussnessLog.WriteBussnessLog("", "数据库操作错误", model + "中间表取数后,关闭数据库连接失败! 请联系系统管理员!");
                    return;
                }
            }
            else
            {
                if (!closeConnetction(connectionToRemoteDatabase().Sqlconn))
                {
                    //打印关闭连接
                    BussnessLog.WriteBussnessLog("", "数据库操作错误", model + "中间表取数前打开数据库连接失败! 请联系系统管理员!");
                    return;
                }
            }

            if (LoginAPI(model))
            {
                Dictionary <string, Result> statusMap = new Dictionary <string, Result>();


                foreach (VoucherInfoSaveObject voucherSaveInfoObj in voucherSaveInfoObjList)
                {
                    InvokeReturnHandle <InvokeResult> callResult = InvokeAPI(opearteList, voucherSaveInfoObj, InvokeCloudAPI.Login(model), ctx, formID, model);
                    statusMap.Add(voucherSaveInfoObj.Model.FVOUCHERGROUPNO, callResult.CustomOpearteObject.Result);
                }
                List <string> getUpdateSQLStatements = new SQLStatement(model).getUpdateSQLStatement(model, statusMap);
                SqlConnection Sqlconn = connectionToRemoteDatabase().Sqlconn;
                foreach (string UpdateSQLStatement in getUpdateSQLStatements)
                {
                    updateMiddleDataBase(UpdateSQLStatement, model, "t_kf_voucher", Sqlconn);
                }
                if (!closeConnetction(Sqlconn))
                {
                    BussnessLog.WriteBussnessLog("", "数据库操作错误", model + "中间表数据更新后,关闭数据库连接失败! 请联系系统管理员!");
                    return;
                }
            }
        }
Esempio n. 5
0
        public override void Run(Context ctx, Schedule schedule)
        {
            SQLStatement = base.GetStatement(SupplierSQLObject.Supplier);
            opearteList  = GetOpearteList(SupplierSQLObject.Supplier);
            //修改的单独处理
            BussnessModify customerModify = new BussnessModify();

            customerModify.excuteSQL(model, connectionToRemoteDatabase(), ctx);
            if (connectionToRemoteDatabase().Sucessd)
            {
                ExcuteDataBaseResult excuteDataBaseResult = base.remoteExcuteDataBase.excuteStatement(SQLStatement, connectionToRemoteDatabase().Sqlconn);
                supplierSaveInfoObjList = handleData <SupplierInfoSaveObject>(excuteDataBaseResult.Ds);
                if (!closeConnetction(connectionToRemoteDatabase().Sqlconn))
                {
                    //打印关闭连接
                    BussnessLog.WriteBussnessLog("", "数据库操作错误", model + "中间表取数后,关闭数据库连接失败! 请联系系统管理员!");
                    return;
                }
            }
            else
            {
                BussnessLog.WriteBussnessLog("", "数据库操作错误", model + "中间表取数前打开数据库连接失败! 请联系系统管理员!");
                return;
            }

            if (LoginAPI(model))
            {
                Dictionary <string, Result> statusMap = new Dictionary <string, Result>();
                foreach (SupplierInfoSaveObject supplierSaveInfoObj in supplierSaveInfoObjList)
                {
                    InvokeReturnHandle <InvokeResult> callResult = (InvokeReturnHandle <InvokeResult>)(object) InvokeAPI(opearteList, supplierSaveInfoObj, InvokeCloudAPI.Login(model), ctx, formID, model);
                    statusMap.Add(supplierSaveInfoObj.Model.Fnumber, callResult.CustomOpearteObject.Result);
                }
                List <string> getUpdateSQLStatements = new SQLStatement(model).getUpdateSQLStatement(model, statusMap);

                //  ExcuteDataBaseResult excuteDataBaseResult = remoteExcuteDataBase.excuteStatement(updateSQLStatement, connectionToRemoteDatabase().Sqlconn);
                SqlConnection Sqlconn = connectionToRemoteDatabase().Sqlconn;
                foreach (string UpdateSQLStatement in getUpdateSQLStatements)
                {
                    updateMiddleDataBase(UpdateSQLStatement, model, "t_kf_supplier", Sqlconn);
                }
                if (!closeConnetction(Sqlconn))
                {
                    //打印关闭连接信息
                    BussnessLog.WriteBussnessLog("", "数据库操作错误", model + "中间表数据更新后,关闭数据库连接失败! 请联系系统管理员!");
                    return;
                }
            }
        }
Esempio n. 6
0
        public override void Run(Context ctx, Schedule schedule)
        {
            SQLStatement = base.GetStatement(ReceivableSQLObject.Receivable);
            opearteList  = GetOpearteList(ReceivableSQLObject.Receivable);
            if (connectionToRemoteDatabase().Sucessd)
            {
                ExcuteDataBaseResult excuteDataBaseResult = base.remoteExcuteDataBase.excuteStatement(SQLStatement, connectionToRemoteDatabase().Sqlconn);
                receivableSaveInfoObjList = handleData <ReceivableInfoSaveObject>(excuteDataBaseResult.Ds);
                if (!closeConnetction(connectionToRemoteDatabase().Sqlconn))
                {
                    //打印关闭连接
                    BussnessLog.WriteBussnessLog("", "数据库操作错误", model + "中间表取数后,关闭数据库连接失败! 请联系系统管理员!");
                    return;
                }
            }
            else
            {
                if (!closeConnetction(connectionToRemoteDatabase().Sqlconn))
                {
                    //打印关闭连接
                    BussnessLog.WriteBussnessLog("", "数据库操作错误", model + "中间表取数前打开数据库连接失败! 请联系系统管理员!");
                    return;
                }
            }

            if (LoginAPI(model))
            {
                Dictionary <string, Result> statusMap = new Dictionary <string, Result>();


                foreach (ReceivableInfoSaveObject receivableInfoSaveObject in receivableSaveInfoObjList)
                {
                    InvokeReturnHandle <InvokeResult> callResult = InvokeAPI(opearteList, receivableInfoSaveObject, InvokeCloudAPI.Login(model), ctx, formID, model);
                    statusMap.Add(receivableInfoSaveObject.Model.FBillNo, callResult.CustomOpearteObject.Result);
                }
                List <string> getUpdateSQLStatements = new SQLStatement(model).getUpdateSQLStatement(model, statusMap);
                SqlConnection Sqlconn = connectionToRemoteDatabase().Sqlconn;
                foreach (string UpdateSQLStatement in getUpdateSQLStatements)
                {
                    updateMiddleDataBase(UpdateSQLStatement, model, "t_kf_receivable", Sqlconn);
                }
                if (!closeConnetction(Sqlconn))
                {
                    BussnessLog.WriteBussnessLog("", "数据库操作错误", model + "中间表数据更新后,关闭数据库连接失败! 请联系系统管理员!");
                    return;
                }
            }
        }
Esempio n. 7
0
        public InvokeReturnHandle <T> handleReturnMessage <T>(InvokeResult invokeResult, string opearte, string model, Context ctx)
        {
            InvokeReturnHandle <T> invokeReturnHandle = new InvokeReturnHandle <T>();

            if (invokeResult == null)
            {
                BussnessLog.WriteBussnessLog(default(T), model, "调用模块=" + model + ",调用方法=" + opearte + ",返回为NULL");
            }
            if (model.Equals("voucher") || model.Equals("payable") || model.Equals("receivable") || model.Equals("otherpayable") || model.Equals("otherrecable"))
            {
                if (!invokeResult.Result.ResponseStatus.IsSuccess)
                {
                    BussnessLog.WriteBussnessLog(invokeResult, model, "");
                    invokeReturnHandle.ReturnResult = false;
                }
                else
                {
                    invokeReturnHandle.ReturnResult = true;
                }
                invokeReturnHandle.CustomOpearteObject = (T)(object)invokeResult;
                return(invokeReturnHandle);
            }

            if (!invokeResult.Result.ResponseStatus.IsSuccess)
            {
                invokeReturnHandle.ReturnResult = false;
                return(invokeReturnHandle);
            }

            List <SuccessEntitysItem> entries = invokeResult.Result.ResponseStatus.SuccessEntitys;

            InfoexceptAllocate infoexceptAllocateObject = new InfoexceptAllocate();
            List <string>      numbers = new List <string>();
            List <string>      pkids   = new List <string>();

            foreach (SuccessEntitysItem entry in entries)
            {
                numbers.Add(entry.Number.ToString());
                pkids.Add(entry.Id.ToString());
            }
            infoexceptAllocateObject.Numbers       = numbers.ToArray();
            invokeReturnHandle.CustomOpearteObject = (T)(object)infoexceptAllocateObject;
            invokeReturnHandle.ReturnResult        = true;
            return(invokeReturnHandle);

            throw new NotImplementedException();
        }