Esempio n. 1
0
        public override string Validation(string workflowId, string itemCode, WfResult wfResult)
        {
            StringBuilder sb = new StringBuilder();

            DataTable dtKy = new BusiItemManage_KY().QueryData(itemCode);

            AppendErrorMessage(sb, dtOperation.RowNullCheck(dtKy, "可研基本信息", NotNullFormat));
            condition.Clear();
            condition.Add("ITEMNAME", "项目名称");
            condition.Add("XMLX", "项目类型");
            condition.Add("ZJND", "新增费使用年度");
            condition.Add("JSGQ", "建设工期");
            AppendErrorMessage(sb, dtOperation.ColumnNullCheck(dtKy, condition, NotNullFormat));

            DataTable dtGis = new BusiItemManage_Gis().QueryData(itemCode, (int)ItemStage.KeYan, 1);

            AppendErrorMessage(sb, dtOperation.RowNullCheck(dtGis, "Gis基本信息", NotNullFormat));

            condition.Clear();
            condition.Add("ADDRESS", "项目区行政位置");
            condition.Add("QSJD", "大地坐标-起始经度");
            condition.Add("JZJD", "大地坐标-截止经度");
            condition.Add("QSWD", "大地坐标-起始纬度");
            condition.Add("JZWD", "大地坐标-截止纬度");
            condition.Add("GM", "项目建设规模");
            condition.Add("XZGDMJ", "新增耕地面积");
            condition.Add("MONEY", "资金估算");


            condition.Add("TFTBH", "图幅号(图斑号)");
            condition.Add("DLMJ", "地类");
            condition.Add("QSXZMJ", "权属情况");

            AppendErrorMessage(sb, dtOperation.ColumnNullCheck(dtGis, condition, NotNullFormat));


            DataTable dtKydw = new BusiItemManage().QueryXmdw(itemCode, ItemCompanyType.KY);

            AppendErrorMessage(sb, dtOperation.RowNullCheck(dtKydw, "可研编制单位", NotNullFormat));
            condition.Clear();
            condition.Add("NAME", "可研编制单位-单位名称");
            condition.Add("CODE", "可研编制单位-机构代码");
            condition.Add("LINKPHONE", "可研编制单位-联系电话");
            condition.Add("LINKMAN", "可研编制单位-联系人员");
            AppendErrorMessage(sb, dtOperation.ColumnNullCheck(dtKydw, condition, NotNullFormat));

            AppendErrorMessage(sb, FileValidation(workflowId, itemCode, WorkFlowNode.KY, null));
            return(sb.ToString());
        }
Esempio n. 2
0
        public override string Validation(string workflowId, string itemCode, WfResult wfResult)
        {
            StringBuilder sb = new StringBuilder();

            DataTable dtSb = new BusiItemManage_SB().QueryData(itemCode);

            condition.Clear();
            condition.Add("ITEMNAME", "项目名称");
            condition.Add("XMLX", "项目类型");
            condition.Add("SHENG", "项目所在地-省");
            condition.Add("SHI", "项目所在地-市");
            condition.Add("XIAN", "项目所在地-县");
            condition.Add("ZJND", "新增费使用年度");
            AppendErrorMessage(sb, dtOperation.ColumnNullCheck(dtSb, condition, NotNullFormat));

            DataTable dtGis = new BusiItemManage_Gis().QueryData(itemCode, (int)ItemStage.ShenBo, 1);

            AppendErrorMessage(sb, dtOperation.RowNullCheck(dtGis, "Gis基本信息", NotNullFormat));

            condition.Clear();
            condition.Add("ADDRESS", "项目区行政位置");
            condition.Add("QSJD", "大地坐标-起始经度");
            condition.Add("JZJD", "大地坐标-截止经度");
            condition.Add("QSWD", "大地坐标-起始纬度");
            condition.Add("JZWD", "大地坐标-截止纬度");
            condition.Add("GM", "项目建设规模");
            condition.Add("XZGDMJ", "新增耕地面积");
            condition.Add("MONEY", "资金概算");


            condition.Add("TFTBH", "图幅号(图斑号)");
            condition.Add("DLMJ", "地类");
            condition.Add("QSXZMJ", "权属情况");

            AppendErrorMessage(sb, dtOperation.ColumnNullCheck(dtGis, condition, NotNullFormat));


            //验证需要的文件是否都已经上传。
            AppendErrorMessage(sb, FileValidation(workflowId, itemCode, WorkFlowNode.TB, null));

            return(sb.ToString());
        }
Esempio n. 3
0
        public override void Sync()
        {
            LogOperation.WriteTitle(sbLog, "-------------------------------------同步项目信息开始-------------------------------------");

            LogOperation.WriteTitle(sbLog, string.Format("同步数据方式:{0}", syncConfig.SyncType.Equals(1) ? "增量同步" : "全部同步"));

            Action <DataRow, DataRow> checkTbzt = (drA, drB) =>
            {
                ChangeTbzt(drA);
                if (ChangeTbzt(drB))
                {
                    LogOperation.Append(sbLog, "标记成已同步项目:" + drB["ITEMCODE"].ToString() + "");
                }
            };

            //在目标数据库中查询需要同步的项目信息。
            string strWhere = string.Empty;

            if (syncConfig.SyncType == 1)
            {
                strWhere = "and TBZT != 1";
            }

            string    queryTargetUnSyncXmxx = string.Format("select * from xm_xmxx where 1=1 {0} order by itemCode", strWhere);
            DataTable dtXmxxTarget          = targetDb.ExecuteDataTable(queryTargetUnSyncXmxx, "xm_xmxx", null);

            int rowCount = dtXmxxTarget.Rows.Count;

            if (rowCount > 0)
            {
                string[] itemCodes         = new string[rowCount];
                string[] conditonItemCodes = new string[rowCount];
                for (int i = 0; i < rowCount; i++)
                {
                    string itemCode = dtXmxxTarget.Rows[i]["ITEMCODE"].ToString();
                    conditonItemCodes[i] = "'" + itemCode + "'";
                    itemCodes[i]         = itemCode;
                }
                string itemCodeConditionString = " itemcode in (" + string.Join(",", conditonItemCodes) + ")";

                #region  步项目信息

                LogOperation.WriteSyncTableTitle(sbLog, "xm_xmxx", SyncType.Comparer, itemCodeConditionString);
                SyncByComparer("xm_xmxx", itemCodeConditionString, new List <string>()
                {
                    "ITEMCODE"
                }, true,
                               (dr) =>
                {
                    LogOperation.Append(sbLog, "添加 项目编号:" + dr["ITEMCODE"]);
                },
                               (dr) =>
                {
                    LogOperation.Append(sbLog, "删除 项目编号:" + dr["ITEMCODE"]);
                },
                               (drTarget, drLocal) =>
                {
                    LogOperation.Append(sbLog, "更新 项目编号:" + drTarget["ITEMCODE"]);
                }, checkTbzt);

                #endregion

                #region  步项目相关信息

                List <string> dkxxIds = new List <string>();
                SyncByAddAfterDelete("gis_data", itemCodeConditionString, deleteAction,
                                     (dr) => { dkxxIds.Add("'" + dr["GisId"] + "'"); }, totalAction);

                if (dkxxIds.Count > 0)
                {
                    string dkjzdConditionString = " GisId in (" + string.Join(",", dkxxIds.ToArray()) + ")";

                    SyncByAddAfterDelete("gis_dk", dkjzdConditionString, deleteAction, null, totalAction);

                    SyncByAddAfterDelete("gis_jzd", dkjzdConditionString, deleteAction, null, totalAction);

                    SyncByAddAfterDelete("gis_dltb", dkjzdConditionString, deleteAction, null, totalAction);

                    SyncByAddAfterDelete("gis_xzdw", dkjzdConditionString, deleteAction, null, totalAction);
                }

                string xzfConditionString = "XZDM = " + targetCode;

                SyncByAddAfterDelete("xm_xzf", xzfConditionString, deleteAction, null, totalAction);

                //SyncByAddAfterDelete("xm_xmxx", itemCodeConditionString, deleteAction, null, totalAction);

                SyncByAddAfterDelete("xm_sb_jbxx", itemCodeConditionString, deleteAction, null, totalAction);

                SyncByAddAfterDelete("xm_ky_jbxx", itemCodeConditionString, deleteAction, null, totalAction);

                SyncByAddAfterDelete("xm_ghsjysxx", itemCodeConditionString, deleteAction, null, totalAction);

                SyncByAddAfterDelete("xm_gcxx", itemCodeConditionString, deleteAction, null, totalAction);

                SyncByAddAfterDelete("xm_gdxx", itemCodeConditionString, deleteAction, null, totalAction);

                SyncByAddAfterDelete("xm_jsxx", itemCodeConditionString, deleteAction, null, totalAction);

                SyncByAddAfterDelete("xm_ss_bgxx", itemCodeConditionString, deleteAction, null, totalAction);

                SyncByAddAfterDelete("xm_ss_gcjl_jlht", itemCodeConditionString, deleteAction, null, totalAction);

                SyncByAddAfterDelete("xm_ss_gcjl_jlry", itemCodeConditionString, deleteAction, null, totalAction);

                SyncByAddAfterDelete("xm_ss_jdgz_xmbb", itemCodeConditionString, deleteAction, null, totalAction);

                SyncByAddAfterDelete("xm_ss_zjbf", itemCodeConditionString, deleteAction, null, totalAction);

                SyncByAddAfterDelete("xm_ss_ztb_jbxx", itemCodeConditionString, deleteAction, null, totalAction);

                SyncByAddAfterDelete("xm_ss_ztb_sght", itemCodeConditionString, deleteAction, null, totalAction);

                SyncByAddAfterDelete("xm_ss_ztb_zbqk", itemCodeConditionString, deleteAction, null, totalAction);

                SyncByAddAfterDelete("xm_xmdw", itemCodeConditionString, deleteAction, null, totalAction);

                SyncByAddAfterDelete("xm_xmzj", itemCodeConditionString, deleteAction, null, totalAction);

                SyncByAddAfterDelete("xm_ysxx", itemCodeConditionString, deleteAction, null, totalAction);

                SyncByAddAfterDelete("wf_instance", itemCodeConditionString, deleteAction, null, totalAction);

                SyncByAddAfterDelete("item_file", itemCodeConditionString, deleteAction, null, totalAction);

                //清除垃圾文件。
                LogOperation.WriteTitle(sbLog, "--------开始检查项目垃圾文件--------");
                foreach (var itemCode in itemCodes)
                {
                    string    filePath          = CommonManage.GetFtpUploadPath(targetCode) + itemCode;
                    string    itemFileTableName = "item_file";
                    string    queryFileSql      = "select * from " + itemFileTableName + " where itemcode = '" + itemCode + "'";
                    DataTable dtItemFile        = targetDb.ExecuteDataTable(queryFileSql, itemFileTableName, null);
                    if (dtItemFile.Rows.Count > 0)
                    {
                        List <string> exceptions = (from DataRow dr in dtItemFile.Rows select dr["FILENAME"].ToString()).ToList();
                        targetFtp.ClearDirectory(itemCode, filePath, exceptions, deleteFileAction);
                    }
                }
                LogOperation.WriteTitle(sbLog, "--------结束检查项目垃圾文件--------");

                //LogOperation.WriteSyncTableTitle(sbLog, "item_file", SyncType.AddAfterDelete, itemCodeConditionString);


                LogOperation.WriteTitle(sbLog, "--------开始同步项目文件(FTP)--------");

                foreach (var itemCode in itemCodes)
                {
                    string filePath = CommonManage.GetFtpUploadPath(targetCode);
                    try
                    {
                        targetFtp.CopyDirectory(filePath, itemCode, localFtp, filePath, itemCode, ftpCopyAction);
                    }
                    catch (Exception ex)
                    {
                        LogOperation.Append(sbLog, string.Format("异常  项目编号:{0}; 原因:{1}", itemCode, ex.Message));
                        continue;
                    }
                    //string gisPath = CommonManage.GetFtpGisQueryPath() + itemCode + ".xml";
                    //targetFtpOperation.CopyFile(gisPath, localFtpOperation, gisPath);
                }

                LogOperation.WriteTitle(sbLog, "--------结束同步项目文件(FTP)--------");

                #endregion
                ////同步GIS数据
                if (this.syncConfig.SyncGisData)
                {
                    LogOperation.WriteTitle(sbLog, "--------开始调用GIS服务--------");

                    foreach (var itemCode in itemCodes)
                    {
                        ////得到连接字符串
                        Gis_Data <Gis_Dk> gisdata = new BusiItemManage_Gis().GetNewGisInfo(itemCode, targetDb.ConnectionStr, false);

                        IGBXM <GBDK> gisEntity = new BusiItemManage_Gis().Conversion(gisdata);
                        gisEntity.Ccode = itemCode.Substring(0, 6);

                        string   wsUrl  = this.syncConfig.ServiceUrl;
                        string   method = this.syncConfig.ServiceMethod;
                        object[] args   = new object[1];
                        args[0] = JsonConvert.SerializeObject(gisEntity);
                        try
                        {
                            bool succ = (bool)WebServiceHelper.InvokeWebService(wsUrl, method, args);
                            if (!succ)
                            {
                                LogOperation.Append(sbLog, "服务返回失败:" + itemCode);
                            }
                        }
                        catch (Exception ex)
                        {
                            LogOperation.Append(sbLog, string.Format("异常  项目编号:{0}; 原因:{1}", itemCode, ex.Message));
                            continue;
                        }
                    }

                    LogOperation.WriteTitle(sbLog, "--------结束调用GIS服务--------");
                }
            }

            LogOperation.WriteTitle(sbLog, "-------------------------------------同步项目信息结束-------------------------------------");
        }