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; } } }
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; } } }