/// <summary>
 /// 检查a+b是否为c
 /// </summary>
 /// <param name="table"></param>
 /// <param name="id"></param>
 /// <param name="valueA"></param>
 /// <param name="desA"></param>
 /// <param name="valueB"></param>
 /// <param name="desB"></param>
 /// <param name="valueC"></param>
 /// <param name="desC"></param>
 private void CheckAnd(String table, String id, String valueA, String desA, String valueB, String desB, String valueC, String desC)
 {
     if (!RuleHelper.IsAnd(valueA, valueB, valueC))
     {
         ErrorMsg.Add(table + "表中," + id + "的" + desA + "与" + desB + "之和不等于" + desC);
     }
 }
        /// <summary>
        /// 查封信息质检
        /// </summary>
        public void CheckSequestration()
        {
            if (Project.Sequestrations == null || Project.Sequestrations.Count == 0)
            {
                return;
            }
            String table = "查封信息";

            foreach (var Sequestration in Project.Sequestrations)
            {
                string id = "户标识码为【" + Sequestration.HBSM + "】";
                CheckNull(table, id, Sequestration.HBSM, "户标识码");
                CheckNull(table, id, Sequestration.CFLX, "查封类型");
                CheckNull(table, id, Sequestration.DBR, "登簿人");
                CheckNull(table, id, Sequestration.CFSJ.ToString(), "查封时间");

                // 表间检查
                int count = Project.Sequestrations.Count(s => Sequestration.HBSM.Equals(s.HBSM));
                if (count < 1)
                {
                    ErrorMsg.Add("查封信息表中,户标识码【" + Sequestration.HBSM + "】没有对应的户");
                }

                // 报告进度
                index++;
                TaskMessage.Progress = index / TotalCount * 100;
            }
        }
 /// <summary>
 /// 空值检查
 /// </summary>
 /// <param name="table">表名</param>
 /// <param name="id">主键</param>
 /// <param name="value">字段值</param>
 /// <param name="name">字段名</param>
 private void CheckNull(String table, String id, String value, String name)
 {
     if (!RuleHelper.IsNotEmpty(value))
     {
         //ErrorMsg.Add(table + "表中,第" + rownum + "行的" + name + "为空");
         ErrorMsg.Add(table + "表中," + id + "的" + name + "为空");
     }
 }
        /// <summary>
        /// 自然幢质检
        /// </summary>
        public void CheckNaturalBuilding()
        {
            if (Project.NaturalBuildings == null)
            {
                return;
            }
            String           table   = "自然幢";
            HashSet <String> ZRZHSet = new HashSet <string>();
            HashSet <String> BSMSet  = new HashSet <string>();

            foreach (var NaturalBuilding in Project.NaturalBuildings)
            {
                // 重复检查
                if (!ZRZHSet.Add(NaturalBuilding.ZRZH))
                {
                    ErrorMsg.Add("自然幢表中,自然幢号【" + NaturalBuilding.ZRZH + "】重复存在");
                }
                if (!BSMSet.Add(NaturalBuilding.BSM))
                {
                    ErrorMsg.Add("自然幢表中,标识码【" + NaturalBuilding.BSM + "】重复存在");
                }
                // 表内检查
                string id = "自然幢号为【" + NaturalBuilding.ZRZH + "】";
                // 特殊字段检查
                CheckBDCDYH(table, id, NaturalBuilding.BDCDYH, "不动产单元号");
                CheckZDDM(table, id, NaturalBuilding.ZDDM, "宗地代码");
                // 非空检查
                CheckNull(table, id, NaturalBuilding.BSM, "标识码");
                CheckNull(table, id, NaturalBuilding.YSDM, "要素代码");
                CheckNull(table, id, NaturalBuilding.ZRZH, "自然幢号");
                CheckNull(table, id, NaturalBuilding.GHYT, "规划用途");
                CheckNull(table, id, NaturalBuilding.FWJG, "房屋结构");
                CheckNull(table, id, NaturalBuilding.ZT, "状态");
                // 非空和数字检查
                CheckNUllAndNumic(table, id, NaturalBuilding.ZYDMJ, "幢用地面积");
                CheckNUllAndNumic(table, id, NaturalBuilding.ZZDMJ, "幢占地面积");
                // 非空和整数检查
                CheckNUllAndInt(table, id, NaturalBuilding.DSCS, "地上层数");
                CheckNUllAndInt(table, id, NaturalBuilding.ZCS, "总层数");
                CheckNUllAndInt(table, id, NaturalBuilding.DXCS, "地下层数");
                CheckNUllAndInt(table, id, NaturalBuilding.ZTS, "总套数");
                // 数字检查
                CheckNumic(table, id, NaturalBuilding.JZWGD, "建筑物高度");

                if (ProjectMappingType == EMappingType.PredictiveMapping) // 若是预测绘项目
                {
                    CheckNUllAndNumic(table, id, NaturalBuilding.YCJZMJ, "预测建筑面积");
                }
                else if (ProjectMappingType == EMappingType.SurveyingMapping) // 若是实测绘项目
                {
                    CheckNUllAndNumic(table, id, NaturalBuilding.SCJZMJ, "实测建筑面积");
                }

                // 报告进度
                index++;
                TaskMessage.Progress = index / TotalCount * 100;
            }
        }
        /// <summary>
        /// 质检
        /// </summary>
        /// <returns></returns>
        public ObservableCollection <string> Check()
        {
            TotalCount = 0;
            index      = 0.0;

            // 获取总共的条数
            if (Project.NaturalBuildings != null)
            {
                TotalCount += Project.NaturalBuildings.Count;
            }
            if (Project.LogicalBuildings != null)
            {
                TotalCount += Project.LogicalBuildings.Count;
            }
            if (Project.Floors != null)
            {
                TotalCount += Project.Floors.Count;
            }
            if (Project.Households != null)
            {
                TotalCount += Project.Households.Count;
            }
            if (Project.Obligees != null)
            {
                TotalCount += Project.Obligees.Count;
            }
            if (Project.Mortgages != null)
            {
                TotalCount += Project.Mortgages.Count;
            }
            if (Project.Sequestrations != null)
            {
                TotalCount += Project.Sequestrations.Count;
            }
            if (TotalCount == 0)
            {
                ErrorMsg.Add("该项目无数据");
                return(ErrorMsg);
            }

            ProjectMappingType   = (EMappingType)int.Parse(Project.MappingType);
            ProjectOwnershipType = (EOwnershipType)int.Parse(Project.OwnershipType);

            CheckNaturalBuilding();
            CheckLogicalBuilding();
            CheckFloor();
            CheckHousehold();
            CheckObligee();

            if (ProjectOwnershipType == EOwnershipType.OwnershipMakeup)
            {
                CheckMortgage();
                CheckSequestration();
            }

            return(ErrorMsg);
        }
Esempio n. 6
0
        public void Ongo()
        {
            try
            {
                TaskInfoDialog = TaskInfoDialogViewModel.getInstance();
                TaskMessage taskMessage = new TaskMessage();
                taskMessage.Title    = "导出项目:" + Project.ProjectName;
                taskMessage.Progress = 0.0;
                TaskInfoDialog.Messages.Insert(0, taskMessage);


                Task task = new Task(() =>
                {
                    try
                    {
                        exportRegistration.TaskMessage  = taskMessage;
                        exportRegistration.SaveFileName = SaveFileName;
                        exportRegistration.Project      = Project;
                        exportRegistration.write();
                    }
                    catch (Exception ex)
                    {
                        ErrorMsg.Add(ex.Message);
                    }
                    ErrorMsg.AddRange(exportRegistration.ErrorMsg);
                });
                task.Start();
                task.ContinueWith(t =>
                {
                    ThreadPool.QueueUserWorkItem(delegate
                    {
                        SynchronizationContext.SetSynchronizationContext(new
                                                                         System.Windows.Threading.DispatcherSynchronizationContext(System.Windows.Application.Current.Dispatcher));
                        SynchronizationContext.Current.Post(pl =>
                        {
                            foreach (var error in ErrorMsg)
                            {
                                taskMessage.DetailMessages.Add(error);
                            }
                            if (ErrorMsg != null && ErrorMsg.Count > 0)
                            {
                                taskMessage.DetailMessages.Add("导出失败");
                            }
                            else
                            {
                                taskMessage.Progress = 100.00;
                                taskMessage.DetailMessages.Add("导出成功");
                            }
                        }, null);
                    });
                });
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        /// <summary>
        /// 权利人质检
        /// </summary>
        public void CheckObligee()
        {
            if (Project.Obligees == null || Project.Obligees.Count == 0)
            {
                return;
            }
            String           table  = "权利人";
            HashSet <String> ZJHSet = new HashSet <string>();

            foreach (var Obligee in Project.Obligees)
            {
                if (!ZJHSet.Add(Obligee.ZJH))
                {
                    ErrorMsg.Add("权利人表中,证件号【" + Obligee.ZJH + "】重复存在");
                }
                string id = "证件号为【" + Obligee.ZJH + "】";
                CheckNull(table, id, Obligee.HBSM, "户标识码");
                CheckNull(table, id, Obligee.QLRMC, "权利人名称");
                CheckNull(table, id, Obligee.ZJZL, "证件种类");
                CheckNull(table, id, Obligee.ZJH, "证件号");
                CheckNull(table, id, Obligee.GJ, "国家地区");
                CheckNull(table, id, Obligee.XB, "性别");
                CheckNull(table, id, Obligee.QLRLX, "权利人类型");
                CheckNull(table, id, Obligee.QLLX, "权利类型");
                CheckNull(table, id, Obligee.GYFS, "共有方式");

                CheckNumic(table, id, Obligee.QLMJ, "权利面积");

                // 证件类型和证件号检查
                CheckId(table, id, Obligee.ZJZL, Obligee.ZJH, "权利人");

                if (!string.IsNullOrWhiteSpace(Obligee.FRXM)) // 若法人姓名不为空
                {
                    CheckNull(table, id, Obligee.FRZJLX, "法人证件类型");
                    CheckNull(table, id, Obligee.FRZJH, "法人证件号");
                    CheckId(table, id, Obligee.FRZJLX, Obligee.FRZJH, "法人");
                }
                if (!string.IsNullOrWhiteSpace(Obligee.DLRXM)) // 若代理人姓名不为空
                {
                    CheckNull(table, id, Obligee.DLRZJLX, "代理人证件类型");
                    CheckNull(table, id, Obligee.DLRZJH, "代理人证件号");
                    CheckId(table, id, Obligee.DLRZJLX, Obligee.DLRZJH, "代理人");
                }

                // 表间检查
                int count = Project.Households.Count(h => Obligee.HBSM.Equals(h.HBSM));
                if (count < 1)
                {
                    ErrorMsg.Add("权利人表中,户标识码【" + Obligee.HBSM + "】没有对应的户");
                }

                // 报告进度
                index++;
                TaskMessage.Progress = index / TotalCount * 100;
            }
        }
 /// <summary>
 /// 检查是否是数字
 /// </summary>
 /// <param name="table"></param>
 /// <param name="id"></param>
 /// <param name="value"></param>
 /// <param name="name"></param>
 private void CheckNumic(String table, String id, String value, String name)
 {
     if (RuleHelper.IsNotEmpty(value))
     {
         if (!RuleHelper.IsNumberic(value))
         {
             ErrorMsg.Add(table + "表中," + id + "的" + name + "格式错误,应是数字");
         }
     }
 }
 private void CheckInt(String table, String id, String value, String name)
 {
     if (RuleHelper.IsNotEmpty(value))
     {
         if (!RuleHelper.IsInteger(value))
         {
             ErrorMsg.Add(table + "表中," + id + "的" + name + "格式错误,应是整数");
         }
     }
 }
 private void CheckNUllAndNumic(String table, String id, String value, String name)
 {
     if (!RuleHelper.IsNotEmpty(value))
     {
         //ErrorMsg.Add(table + "表中,第" + rownum + "行的" + name + "为空");
         ErrorMsg.Add(table + "表中," + id + "的" + name + "为空");
         return;
     }
     if (!RuleHelper.IsNumberic(value))
     {
         ErrorMsg.Add(table + "表中," + id + "的" + name + "格式错误,应是数字");
         //ErrorMsg.Add(table + "表中,第" + rownum + "行的" + name + "格式错误,应是数字");
     }
 }
Esempio n. 11
0
        public void write()
        {
            try
            {
                // 封装信息
                RegistrationResult registrationResult = new RegistrationResult
                {
                    Xmmc    = Project.ProjectName,
                    Kfsmc   = Project.DeveloperName,
                    CaseNum = Project.Transfer.ContractNum,
                    Sqrs    = Project.Applicants.ToList()
                };


                // 导出属性信息文件
                RegistrationResultToFile(registrationResult);

                TaskMessage.Progress = 30.00;
            }
            catch (Exception ex)
            {
                ErrorMsg.Add("导出属性信息文件异常:" + ex.Message);
                return;
            }
            try
            {
                // 导出附件
                ExportFile();
                TaskMessage.Progress = 60.00;
            }
            catch (Exception ex)
            {
                ErrorMsg.Add("导出附件异常:" + ex.Message);
                return;
            }

            try
            {
                // 压缩成报盘文件
                ZipHelper zipHelper = new ZipHelper();
                zipHelper.ZipFileFromDirectory(SaveFileName, SaveFileName + ".bpf", 5);
                // 删除目录及其下所有文件
                DelectDir(SaveFileName);
            }
            catch (Exception ex)
            {
                ErrorMsg.Add("压缩文件异常:" + ex.Message);
                return;
            }
        }
Esempio n. 12
0
 public bool ReadInformation()
 {
     try
     {
         var NaturalBuildingbool = ReadNaturalBuildingInformation();
         var LogicalBuildingbool = ReadLogicalBuildingInformation();
         var cbool       = ReadFloorInformation();
         var hbool       = ReadHouseholdInformation();
         var Obligeebool = ReadObligeeInformation();
         return(NaturalBuildingbool && LogicalBuildingbool && cbool && hbool && Obligeebool);
     }
     catch (Exception ex)
     {
         ErrorMsg.Add(ex.Message);
         return(false);
     }
 }
Esempio n. 13
0
        public bool CheckParameterValid(int count)
        {
            if (count == 1 && Parameter.Trim() == "")
            {
                return(false);
            }

            var paraArray = Parameter.Split(" ");

            if (paraArray.Length != count)
            {
                ErrorMsg.Add("Parameter error.");
                Logger.WriteError("{0} command parameter is invalid.", Category);
                return(false);
            }
            return(true);
        }
 /// <summary>
 /// 检查不动产单元号
 /// </summary>
 /// <param name="table"></param>
 /// <param name="rownum"></param>
 /// <param name="value"></param>
 /// <param name="name"></param>
 private void CheckBDCDYH(String table, String id, String value, String name)
 {
     if (RuleHelper.IsNotEmpty(value)) // 可以为空
     {
         if (!RuleHelper.IsNumberAndWord(value))
         {
             ErrorMsg.Add(table + "表中," + id + "的" + name + "格式错误,应是数字或字母");
             //ErrorMsg.Add(table + "表中,第" + rownum + "行的" + name + "格式错误,应是数字或字母");
             return;
         }
         if (!RuleHelper.IsRequiredLength(value, 28))
         {
             ErrorMsg.Add(table + "表中," + id + "的" + name + "格式错误,长度应是28位");
             //ErrorMsg.Add(table + "表中,第" + rownum + "行的" + name + "格式错误,长度应是28位");
             return;
         }
     }
 }
        /// <summary>
        /// 抵押信息质检
        /// </summary>
        public void CheckMortgage()
        {
            if (Project.Mortgages == null || Project.Mortgages.Count == 0)
            {
                return;
            }
            String table = "抵押信息";

            foreach (var Mortgage in Project.Mortgages)
            {
                string id = "证件号为【" + Mortgage.ZJH + "】";
                CheckNull(table, id, Mortgage.HBSM, "户标识码");
                CheckNull(table, id, Mortgage.QLRMC, "权利人名称");
                CheckNull(table, id, Mortgage.ZJLX, "证件类型");
                CheckNull(table, id, Mortgage.ZJH, "证件号");
                CheckNull(table, id, Mortgage.DYFS, "抵押方式");
                CheckNull(table, id, Mortgage.DYR, "抵押人");
                CheckNull(table, id, Mortgage.DYRZJLX, "抵押人证件类型");
                CheckNull(table, id, Mortgage.DYRZJH, "抵押人证件号");
                CheckNull(table, id, Mortgage.DYBDCLX, "抵押不动产类型");
                CheckNull(table, id, Mortgage.CZFS, "持证方式");
                CheckNull(table, id, Mortgage.ZWR, "债务人");
                CheckNull(table, id, Mortgage.DBR, "登簿人");

                if (!string.IsNullOrWhiteSpace(Mortgage.FRXM)) // 若法人姓名不为空
                {
                    CheckNull(table, id, Mortgage.FRZJLX, "法人证件类型");
                    CheckNull(table, id, Mortgage.FRZJH, "法人证件号");
                }

                // 表间检查
                int count = Project.Mortgages.Count(m => Mortgage.HBSM.Equals(m.HBSM));
                if (count < 1)
                {
                    ErrorMsg.Add("抵押信息表中,户标识码【" + Mortgage.HBSM + "】没有对应的户");
                }

                // 报告进度
                index++;
                TaskMessage.Progress = index / TotalCount * 100;
            }
        }
        /// <summary>
        /// 逻辑幢质检
        /// </summary>
        public void CheckLogicalBuilding()
        {
            if (Project.LogicalBuildings == null || Project.LogicalBuildings.Count == 0)
            {
                return;
            }
            String           table   = "逻辑幢";
            HashSet <String> LJZHSet = new HashSet <string>();

            foreach (var LogicalBuilding in Project.LogicalBuildings)
            {
                // 重复检查
                //if (!LJZHSet.Add(LogicalBuilding.LJZH))
                //{
                //    ErrorMsg.Add("逻辑幢表中,逻辑幢号【" + LogicalBuilding.LJZH + "】重复存在");
                //}
                // 表内检查
                string id = "逻辑幢号为【" + LogicalBuilding.LJZH + "】";
                CheckNull(table, id, LogicalBuilding.LJZH, "逻辑幢号");
                CheckNull(table, id, LogicalBuilding.YSDM, "要素代码");
                CheckNull(table, id, LogicalBuilding.ZRZH, "自然幢号");
                CheckNumic(table, id, LogicalBuilding.YCJZMJ, "预测建筑面积");
                CheckNumic(table, id, LogicalBuilding.YCDXMJ, "预测地下面积");
                CheckNumic(table, id, LogicalBuilding.YCQTMJ, "预测其它面积");
                CheckNumic(table, id, LogicalBuilding.SCJZMJ, "实测建筑面积");
                CheckNumic(table, id, LogicalBuilding.SCDXMJ, "实测地下面积");
                CheckNumic(table, id, LogicalBuilding.SCQTMJ, "实测其它面积");
                CheckInt(table, id, LogicalBuilding.ZCS, "总层数");
                CheckInt(table, id, LogicalBuilding.DSCS, "地上层数");
                CheckInt(table, id, LogicalBuilding.DXCS, "地下层数");
                // 表间检查
                int count = Project.NaturalBuildings.Count(n => LogicalBuilding.ZRZH.Equals(n.ZRZH));
                if (count < 1)
                {
                    ErrorMsg.Add("逻辑幢表中,自然幢号【" + LogicalBuilding.ZRZH + "】没有对应的自然幢");
                }

                // 报告进度
                index++;
                TaskMessage.Progress = index / TotalCount * 100;
            }
        }
Esempio n. 17
0
        /// <summary>
        /// 读取权利人数据
        /// </summary>
        private bool ReadObligeeInformation()
        {
            SetSheetIndex(4);
            string information = "";

            object[,] allItem = GetAllRangeValue();//获取所有使用域值
            if (allItem == null)
            {
                information = tableName + "表中无数据!";
                ErrorMsg.Add(information);
                return(false);
            }
            colCount = GetRangeColumnCount();
            int  columnCount = GetColumnValue("AA");
            bool canContinue = colCount >= columnCount;

            if (!canContinue)
            {
                allItem = null;
                GC.Collect();
                information = tableName + "中" + GetWorkSheetName(4) + "工作表格式不正确!";
                ErrorMsg.Add(information);
                return(false);
            }
            rowCount = GetRangeRowCount();
            int calIndex = 1;

            for (int index = calIndex; index < rowCount; index++)
            {
                string rowValue = GetString(allItem[index, 0]);//编号栏数据
                if (string.IsNullOrWhiteSpace(rowValue) || rowValue.Trim() == "合计" || rowValue.Trim() == "总计" || rowValue.Trim() == "共计")
                {
                    break;
                }
                var Obligee = InitalizebligeeBValue(index, allItem);
                Obligees.Add(Obligee);
            }
            allItem = null;
            GC.Collect();
            return(true);
        }
        /// <summary>
        /// 判断户标识嘛是否唯一
        /// </summary>
        /// <param name="households"></param>
        /// <returns></returns>
        private bool IsHouseholdUnique(List <Household> households)
        {
            bool isUnique = true;

            if (households == null || households.Count == 0)
            {
                //ErrorList.Add("户数据为空");
                return(true);
            }
            var hbsmList = households.GroupBy(x => x.HBSM).Where(x => x.Count() > 1).ToList();

            if (hbsmList != null && hbsmList.Count > 0)
            {
                foreach (var hbsm in hbsmList)
                {
                    ErrorMsg.Add(string.Format("户标识码为:{0}的数据重复", hbsm));
                }
                isUnique = false;
            }
            return(isUnique);
        }
        /// <summary>
        /// 判断自然幢号是否唯一
        /// </summary>
        /// <param name="naturalBuildings"></param>
        /// <returns></returns>
        private bool IsNaturalBuildingUnique(List <NaturalBuilding> naturalBuildings)
        {
            bool isUnique = true;

            if (naturalBuildings == null || naturalBuildings.Count == 0)
            {
                //ErrorList.Add("自然幢为空");
                return(true);
            }
            var zrzh = naturalBuildings.GroupBy(x => x.ZRZH).Where(x => x.Count() > 1).ToList();

            if (zrzh != null && zrzh.Count > 0)
            {
                foreach (var item in zrzh)
                {
                    ErrorMsg.Add(string.Format("自然幢号为:{0}的数据重复", item));
                }
                isUnique = false;
            }
            return(isUnique);
        }
        /// <summary>
        /// 层质检
        /// </summary>
        public void CheckFloor()
        {
            if (Project.Floors == null || Project.Floors.Count == 0)
            {
                return;
            }
            String           table = "层";
            HashSet <String> CHSet = new HashSet <string>();

            foreach (var Floor in Project.Floors)
            {
                //if (!CHSet.Add(Floor.CH))
                //{
                //    ErrorMsg.Add("层表中,层号【" + Floor.CH + "】重复存在");
                //}
                string id = "层号为【" + Floor.CH + "】";
                CheckNull(table, id, Floor.CH, "层号");
                CheckNull(table, id, Floor.YSDM, "要素代码");
                CheckNull(table, id, Floor.ZRZH, "自然幢号");
                CheckNumic(table, id, Floor.CJZMJ, "层建筑面积");
                CheckNumic(table, id, Floor.CTNJZMJ, "层套内建筑面积");
                CheckNumic(table, id, Floor.CYTMJ, "层阳台面积");
                CheckNumic(table, id, Floor.CGYJZMJ, "层共有建筑面积");
                CheckNumic(table, id, Floor.CFTJZMJ, "层分摊建筑面积");
                CheckNumic(table, id, Floor.CBQMJ, "层半墙面积");
                CheckNumic(table, id, Floor.CG, "层高");
                CheckNumic(table, id, Floor.SPTYMJ, "水平投影面积");
                // 表间检查
                int count = Project.NaturalBuildings.Count(n => Floor.ZRZH.Equals(n.ZRZH));
                if (count < 1)
                {
                    ErrorMsg.Add("层表中,自然幢号【" + Floor.ZRZH + "】没有对应的自然幢");
                }

                // 报告进度
                index++;
                TaskMessage.Progress = index / TotalCount * 100;
            }
        }
        /// <summary>
        /// 户质检
        /// </summary>
        public void CheckHousehold()
        {
            if (Project.Households == null || Project.Households.Count == 0)
            {
                return;
            }
            String           table   = "户";
            HashSet <String> HBSMSet = new HashSet <string>();
            HashSet <String> FHSet   = new HashSet <string>();

            foreach (var Household in Project.Households)
            {
                if (!HBSMSet.Add(Household.HBSM))
                {
                    ErrorMsg.Add("户表中,户标识码【" + Household.HBSM + "】重复存在");
                }
                if (!FHSet.Add(Household.FH))
                {
                    ErrorMsg.Add("户表中,房号【" + Household.FH + "】重复存在");
                }
                string id = "户标识码为【" + Household.HBSM + "】";
                // 特殊检查
                CheckBDCDYH(table, id, Household.BDCDYH, "不动产单元号");
                // 非空检查
                CheckNull(table, id, Household.HBSM, "户标识码");
                CheckNull(table, id, Household.FWBM, "房屋编码");
                CheckNull(table, id, Household.YSDM, "要素代码");
                CheckNull(table, id, Household.ZL, "坐落");
                CheckNull(table, id, Household.MJDW, "面积单位");
                CheckNull(table, id, Household.SHBW, "室号部位");
                CheckNull(table, id, Household.SZC, "所在层");
                CheckNull(table, id, Household.QSC, "起始层");
                CheckNull(table, id, Household.ZZC, "终止层");
                CheckNull(table, id, Household.ZT, "状态");

                // 数字检查
                CheckNumic(table, id, Household.FTTDMJ, "分摊土地面积");
                CheckNumic(table, id, Household.DYTDMJ, "独用土地面积");
                CheckNumic(table, id, Household.GYTDMJ, "共有土地面积");

                if (ProjectMappingType == EMappingType.PredictiveMapping) // 若是预测绘项目
                {
                    CheckNUllAndNumic(table, id, Household.YCTNJZMJ, "预测套内建筑面积");
                    CheckNUllAndNumic(table, id, Household.YCFTJZMJ, "预测分摊建筑面积");
                    CheckNUllAndNumic(table, id, Household.YCJZMJ, "预测建筑面积");
                    CheckNUllAndNumic(table, id, Household.YCQTJZMJ, "预测其它建筑面积");
                    CheckNUllAndNumic(table, id, Household.YCDXBFJZMJ, "预测地下部分建筑面积");

                    CheckAnd(table, id, Household.YCTNJZMJ, "预测套内建筑面积", Household.YCFTJZMJ, "预测分摊建筑面积", Household.YCJZMJ, "预测建筑面积");

                    CheckNumic(table, id, Household.YCFTXS, "预测分摊系数");
                }
                else if (ProjectMappingType == EMappingType.SurveyingMapping) // 若是实测绘项目
                {
                    CheckNUllAndNumic(table, id, Household.SCTNJZMJ, "实测套内建筑面积");
                    CheckNUllAndNumic(table, id, Household.SCFTJZMJ, "实测分摊建筑面积");
                    CheckNUllAndNumic(table, id, Household.SCJZMJ, "实测建筑面积");
                    CheckNUllAndNumic(table, id, Household.SCQTJZMJ, "实测其它建筑面积");
                    CheckNUllAndNumic(table, id, Household.SCDXBFJZMJ, "实测地下部分建筑面积");

                    CheckAnd(table, id, Household.SCTNJZMJ, "实测套内建筑面积", Household.SCFTJZMJ, "实测分摊建筑面积", Household.SCJZMJ, "实测建筑面积");

                    CheckNumic(table, id, Household.SCFTXS, "实测分摊系数");
                }

                // 表间检查
                int count = 0;
                if (Household.ZRZH != null)
                {
                    count = Project.NaturalBuildings.Count(n => Household.ZRZH.Equals(n.ZRZH));
                    if (count < 1)
                    {
                        ErrorMsg.Add("户表中,户标识码为【" + Household.HBSM + "】的自然幢号【" + Household.ZRZH + "】没有对应的自然幢");
                    }
                }

                if (ProjectOwnershipType == EOwnershipType.OwnershipSurvey) // 若是权籍调查
                {
                }
                else if (ProjectOwnershipType == EOwnershipType.OwnershipMakeup) // 若是权籍补录
                {
                    count = Project.Obligees.Count(o => Household.HBSM.Equals(o.HBSM));
                    if (count < 1)
                    {
                        ErrorMsg.Add("户表中,户标识码【" + Household.HBSM + "】没有对应的权利人");
                    }
                }

                // 报告进度
                index++;
                TaskMessage.Progress = index / TotalCount * 100;
            }
        }
        public override void Write()
        {
            TotalCount = 0;
            index      = 0.0;

            // 获取总共的条数
            if (NaturalBuildings != null)
            {
                TotalCount += NaturalBuildings.Count;
            }
            if (LogicalBuildings != null)
            {
                TotalCount += LogicalBuildings.Count;
            }
            if (Floors != null)
            {
                TotalCount += Floors.Count;
            }
            if (Households != null)
            {
                TotalCount += Households.Count;
            }
            if (Obligees != null)
            {
                TotalCount += Obligees.Count;
            }
            if ("2".Equals(Project.OwnershipType))
            {
                if (Mortgages != null)
                {
                    TotalCount += Mortgages.Count;
                }
                if (Sequestrations != null)
                {
                    TotalCount += Sequestrations.Count;
                }
            }


            if (TotalCount == 0)
            {
                ErrorMsg.Add("该项目无数据");
                return;
            }


            try
            {
                WriteNaturalBuilding();
                WriteLogicalBuilding();
                WriteFloor();
                WriteHouse();
                WriteObligee();
                if ("2".Equals(Project.OwnershipType))
                {
                    WriteMortgage();
                    WriteSequestration();
                }
            }
            catch (Exception ex)
            {
                ErrorMsg.Add(ex.Message + ex.StackTrace);
            }
        }
        private void CheckId(String table, String id, String zjlx, String zjh, String name)
        {
            bool IsSuccess = true;

            switch ((EIdType)int.Parse(zjlx))
            {
            case EIdType.SFZ:
                if (!RuleHelper.IsID(EIdType.SFZ, zjh))
                {
                    IsSuccess = false;
                }
                break;

            case EIdType.GATSFZ:
                if (!RuleHelper.IsID(EIdType.GATSFZ, zjh))
                {
                    IsSuccess = false;
                }
                break;

            case EIdType.HZ:
                if (!RuleHelper.IsID(EIdType.HZ, zjh))
                {
                    IsSuccess = false;
                }
                break;

            case EIdType.HKB:
                if (!RuleHelper.IsID(EIdType.HKB, zjh))
                {
                    IsSuccess = false;
                }
                break;

            case EIdType.JGZ:
                if (!RuleHelper.IsID(EIdType.JGZ, zjh))
                {
                    IsSuccess = false;
                }
                break;

            case EIdType.ZZJGDM:
                if (!RuleHelper.IsID(EIdType.ZZJGDM, zjh))
                {
                    IsSuccess = false;
                }
                break;

            case EIdType.YYZZ:
                if (!RuleHelper.IsID(EIdType.YYZZ, zjh))
                {
                    IsSuccess = false;
                }
                break;

            case EIdType.QT:
                if (!RuleHelper.IsID(EIdType.QT, zjh))
                {
                    IsSuccess = false;
                }
                break;

            default:
                break;
            }

            if (!IsSuccess)
            {
                ErrorMsg.Add(table + "表中," + id + "的" + name + "证件类型与证件号格式错误");
            }
        }
        public void Ongo()
        {
            try
            {
                TaskInfoDialog = TaskInfoDialogViewModel.getInstance();
                String FileName = Path.GetFileName(FullPath);
                //TaskInfoDialog.Messages.Add("开始导入:" + FileName);
                TaskMessage taskMessage = new TaskMessage();
                taskMessage.Title    = "导入项目:" + FileName;
                taskMessage.Progress = 0.0;
                TaskInfoDialog.Messages.Insert(0, taskMessage);
                Task task = new Task(() =>
                {
                    ImportRealEstateBook import = new ImportRealEstateBook();
                    import.FileName             = FullPath;
                    import.Read();

                    bool canContinue = import.ReadInformation();

                    if (canContinue)
                    {
                        taskMessage.Progress = 50.00;
                        //var naturalEffective = NaturalEffective(import.ZRZList);
                        var isNaturalBuildingUnique = IsNaturalBuildingUnique(import.NaturalBuildings);
                        var isHouseholdUnique       = IsHouseholdUnique(import.Households);
                        if (isNaturalBuildingUnique && isHouseholdUnique)
                        {
                            Project project       = InitialProject();
                            ProjectDal projectDal = new ProjectDal();
                            NaturalBuildingDal naturalBuildingDal = new NaturalBuildingDal();
                            LogicalBuildingDal logicalBuildingDal = new LogicalBuildingDal();
                            FloorDal floorDal         = new FloorDal();
                            HouseholdDal householdDal = new HouseholdDal();
                            ObligeeDal obligeeDal     = new ObligeeDal();
                            try
                            {
                                foreach (var naturalBuilding in import.NaturalBuildings)
                                {
                                    naturalBuilding.ID         = Guid.NewGuid();
                                    naturalBuilding.ProjectID  = project.ID;
                                    naturalBuilding.UpdateTime = DateTime.Now;
                                    naturalBuildingDal.Add(naturalBuilding);
                                }
                            }
                            catch (Exception ex)
                            {
                                ErrorMsg.Add("自然幢数据异常:" + ex.Message);
                            }
                            try
                            {
                                foreach (var logicalBuilding in import.LogicalBuildings)
                                {
                                    logicalBuilding.ID         = Guid.NewGuid();
                                    logicalBuilding.ProjectID  = project.ID;
                                    logicalBuilding.UpdateTime = DateTime.Now;
                                    logicalBuildingDal.Add(logicalBuilding);
                                }
                            }
                            catch (Exception ex)
                            {
                                ErrorMsg.Add("逻辑幢数据异常:" + ex.Message);
                            }
                            try
                            {
                                foreach (var floor in import.Floors)
                                {
                                    floor.ID         = Guid.NewGuid();
                                    floor.ProjectID  = project.ID;
                                    floor.UpdateTime = DateTime.Now;
                                    floorDal.Add(floor);
                                }
                            }
                            catch (Exception ex)
                            {
                                ErrorMsg.Add("层数据异常:" + ex.Message);
                            }
                            try
                            {
                                foreach (var household in import.Households)
                                {
                                    household.ID         = Guid.NewGuid();
                                    household.ProjectID  = project.ID;
                                    household.UpdateTime = DateTime.Now;
                                    householdDal.Add(household);
                                }
                            }
                            catch (Exception ex)
                            {
                                ErrorMsg.Add("户数据异常:" + ex.Message);
                            }
                            try
                            {
                                foreach (var obligee in import.Obligees)
                                {
                                    obligee.ID         = Guid.NewGuid();
                                    obligee.ProjectID  = project.ID;
                                    obligee.UpdateTime = DateTime.Now;
                                    obligeeDal.Add(obligee);
                                }
                            }
                            catch (Exception ex)
                            {
                                ErrorMsg.Add("权利人数据异常:" + ex.Message);
                            }
                            try
                            {
                                projectDal.Add(project);
                            }
                            catch (Exception ex)
                            {
                                ErrorMsg.Add("项目数据异常:" + ex.Message);
                            }
                        }
                    }
                    ErrorMsg.AddRange(import.ErrorMsg);
                });
                task.Start();
                task.ContinueWith(t =>
                {
                    ThreadPool.QueueUserWorkItem(delegate
                    {
                        SynchronizationContext.SetSynchronizationContext(new
                                                                         System.Windows.Threading.DispatcherSynchronizationContext(System.Windows.Application.Current.Dispatcher));
                        SynchronizationContext.Current.Post(pl =>
                        {
                            foreach (var error in ErrorMsg)
                            {
                                taskMessage.DetailMessages.Add(error);
                            }
                            if (ErrorMsg != null && ErrorMsg.Count > 0)
                            {
                                taskMessage.DetailMessages.Add("导入失败");
                            }
                            else
                            {
                                taskMessage.Progress = 100.00;
                                taskMessage.DetailMessages.Add("导入成功");
                                // 刷新项目列表
                            }
                        }, null);
                    });
                });
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public void Ongo()
        {
            try
            {
                TaskInfoDialog = TaskInfoDialogViewModel.getInstance();
                TaskMessage taskMessage = new TaskMessage();
                taskMessage.Title    = "导出项目:" + Project.ProjectName;
                taskMessage.Progress = 0.0;
                TaskInfoDialog.Messages.Insert(0, taskMessage);

                NaturalBuildingDal naturalBuildingDal = new NaturalBuildingDal();
                LogicalBuildingDal logicalBuildingDal = new LogicalBuildingDal();
                FloorDal           floorDal           = new FloorDal();
                HouseholdDal       householdDal       = new HouseholdDal();
                ObligeeDal         obligeeDal         = new ObligeeDal();
                MortgageDal        mortgageDal        = new MortgageDal();
                SequestrationDal   sequestrationDal   = new SequestrationDal();

                Task task = new Task(() =>
                {
                    try
                    {
                        book.Project          = Project;
                        book.TaskMessage      = taskMessage;
                        book.NaturalBuildings = naturalBuildingDal.GetListBy(t => t.ProjectID == Project.ID);
                        book.LogicalBuildings = logicalBuildingDal.GetListBy(t => t.ProjectID == Project.ID);
                        book.Floors           = floorDal.GetListBy(t => t.ProjectID == Project.ID);
                        book.Households       = householdDal.GetListBy(t => t.ProjectID == Project.ID);
                        book.Obligees         = obligeeDal.GetListBy(t => t.ProjectID == Project.ID);
                        if ("2".Equals(Project.OwnershipType))
                        {
                            book.Mortgages      = mortgageDal.GetListBy(t => t.ProjectID == Project.ID);
                            book.Sequestrations = sequestrationDal.GetListBy(t => t.ProjectID == Project.ID);
                        }

                        book.Open(TemplateFileName);
                        book.Write();
                        //book.SaveAsExcel(SaveFileName);
                    }
                    catch (Exception ex)
                    {
                        ErrorMsg.Add(ex.Message);
                    }
                    ErrorMsg.AddRange(book.ErrorMsg);
                });
                task.Start();
                task.ContinueWith(t =>
                {
                    ThreadPool.QueueUserWorkItem(delegate
                    {
                        SynchronizationContext.SetSynchronizationContext(new
                                                                         System.Windows.Threading.DispatcherSynchronizationContext(System.Windows.Application.Current.Dispatcher));
                        SynchronizationContext.Current.Post(pl =>
                        {
                            foreach (var error in ErrorMsg)
                            {
                                taskMessage.DetailMessages.Add(error);
                            }
                            if (ErrorMsg != null && ErrorMsg.Count > 0)
                            {
                                taskMessage.DetailMessages.Add("导出失败");
                            }
                            else
                            {
                                string bufferPath = System.AppDomain.CurrentDomain.BaseDirectory + @"Buffer\" + Path.GetFileName(SaveFileName);
                                try
                                {
                                    book.SaveAsExcel(bufferPath);

                                    //// 压缩成报盘
                                    //ZipHelper zipHelper = new ZipHelper();
                                    //zipHelper.ZipFile(SaveFileName.Replace(".bpf", ".xls"), SaveFileName, 5, 500);
                                    //// 删除excel
                                    //File.Delete(SaveFileName.Replace(".bpf", ".xls"));

                                    if (Path.GetExtension(bufferPath) == ".xls")
                                    {
                                        File.Copy(bufferPath, SaveFileName, true);
                                        File.Delete(bufferPath);
                                    }
                                    else if (Path.GetExtension(bufferPath) == ".bpf")
                                    {
                                        File.Copy(bufferPath.Replace(".xls", ".bpf"), SaveFileName.Replace(".xls", ".bpf"), true);
                                        File.Delete(bufferPath.Replace(".xls", ".bpf"));
                                    }

                                    taskMessage.Progress = 100.00;
                                    taskMessage.DetailMessages.Add("导出成功");
                                }
                                catch (Exception ex)
                                {
                                    taskMessage.DetailMessages.Add(ex.Message + ex.StackTrace);
                                }
                            }
                        }, null);
                    });
                });
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 26
0
        public IEnumerable <Token> Scan()
        {
            char peek;

            if (!chars.MoveNext())
            {
                yield break;
            }
            do
            {
                peek      = chars.Current;
                dont_move = false;
                if (peek == '\n')
                {
                    ++Row;
                    Col = 0;
                    continue;
                }
                else if (char.IsWhiteSpace(peek))
                {
                    continue;
                }
                else if (peek == ',')
                {
                    yield return(new Token(TokenType.COMMA, ',', Row, Col));
                }
                else if ("+-/*".IndexOf(peek) != -1)
                {
                    yield return(new Token(TokenType.OP, peek, Row, Col));
                }
                else if ("()".IndexOf(peek) != -1)
                {
                    yield return(new Token(TokenType.BRACKET, peek, Row, Col));
                }
                else if (Char.IsDigit(peek))
                {
                    int row = Row, col = Col;
                    yield return(new Token(TokenType.NUM, GetSubstringByCond(peek, Char.IsDigit), row, col));
                }
                else if (Char.IsLetter(peek))
                {
                    int row = Row, col = Col;
                    yield return(new Token(TokenType.ID, GetSubstringByCond(peek, Char.IsLetterOrDigit), row, col));
                }
                else if (peek == '=')
                {
                    yield return(new Token(TokenType.OP, peek, Row, Col));
                }
                else if (peek == ';')
                {
                    yield return(new Token(TokenType.SEMICOLON, peek, Row, Col));
                }
                else if (peek == ':')
                {
                    if (MoveNext() && chars.Current == '=')
                    {
                        yield return(new Token(TokenType.ASSIGN, ":=", Row, Col - 1));
                    }
                    else
                    {
                        ErrorMsg.Add("Missing '=' after ':' ", Row, Col); // Or:   dontmove = true; Ignore this mistake
                    }
                }
                else if (peek == '<')
                {
                    if (MoveNext())
                    {
                        if (chars.Current == '=')
                        {
                            yield return(new Token(TokenType.OP, "<=", Row, Col - 1));
                        }
                        else if (chars.Current == '>')
                        {
                            yield return(new Token(TokenType.OP, "<>", Row, Col - 1));
                        }
                        else
                        {
                            dont_move = true;
                            yield return(new Token(TokenType.OP, '<', Row, Col));
                        }
                    }
                    else
                    {
                        yield return(new Token(TokenType.OP, '<', Row, Col));
                    }
                }
                else if (peek == '>')
                {
                    if (MoveNext())
                    {
                        if (chars.Current == '=')
                        {
                            yield return(new Token(TokenType.OP, ">=", Row, Col - 1));
                        }
                        else
                        {
                            dont_move = true;
                            yield return(new Token(TokenType.OP, '>', Row, Col));
                        }
                    }
                    else
                    {
                        yield return(new Token(TokenType.OP, '>', Row, Col));
                    }
                }
                else if (peek == '.')
                {
                    yield return(new Token(TokenType.PERIOD, '.', Row, Col));
                }
                else
                {
                    string tmp = "";
                    int    row = Row, col = Col;
                    while (!char.IsWhiteSpace(peek))
                    {
                        tmp += peek;
                        if (!MoveNext())
                        {
                            break;
                        }
                        peek = chars.Current;
                    }
                    ErrorMsg.Add($"Unknown Token '{tmp}'", row, col);
                }

                //else if ("\"\'".IndexOf(peek) != -1) yield return new Token(TokenType.STRING, (object)TODO, Line); //PL0 doesn't have string
            }while (dont_move || MoveNext()); //'dont_move' can avoid too much MoveNext()
        }
        public void Ongo()
        {
            try
            {
                TaskInfoDialog = TaskInfoDialogViewModel.getInstance();
                //TaskInfoDialog.Messages.Add("开始质检项目:" + Project.ProjectName);
                TaskMessage taskMessage = new TaskMessage();
                taskMessage.Title    = "质检项目:" + Project.ProjectName;
                taskMessage.Progress = 0.0;
                TaskInfoDialog.Messages.Insert(0, taskMessage);
                Task task = new Task(() =>
                {
                    //Thread.Sleep(2000);

                    QualityControl qualityControl = new QualityControl();
                    qualityControl.Project        = ProjectDal.InitialRealEstateProject(Project);
                    qualityControl.TaskMessage    = taskMessage;
                    try
                    {
                        ErrorMsg.AddRange(qualityControl.Check());
                    }
                    catch (Exception ex)
                    {
                        ErrorMsg.Add(ex.Message);
                    }
                });
                task.Start();
                task.ContinueWith(t =>
                {
                    ThreadPool.QueueUserWorkItem(delegate
                    {
                        SynchronizationContext.SetSynchronizationContext(new
                                                                         System.Windows.Threading.DispatcherSynchronizationContext(System.Windows.Application.Current.Dispatcher));
                        SynchronizationContext.Current.Post(pl =>
                        {
                            foreach (var error in ErrorMsg)
                            {
                                taskMessage.DetailMessages.Add(error);
                            }
                            if (ErrorMsg != null && ErrorMsg.Count > 0)
                            {
                                taskMessage.DetailMessages.Add("质检不通过");
                                Project.State      = "0";
                                Project.UptateTime = DateTime.Now;
                                ProjectDal.Modify(Project);
                            }
                            else
                            {
                                taskMessage.DetailMessages.Add("质检合格");
                                Project.State      = "1";
                                Project.UptateTime = DateTime.Now;
                                ProjectDal.Modify(Project);
                            }
                        }, null);
                    });
                });
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 28
0
        private static void Getres(object entityObject)
        {
            if (entityObject == null)
            {
                return;
            }
            Type type = entityObject.GetType();

            if (type.IsGenericType && type.Name.Contains("List"))
            {
                IEnumerable <object> d = entityObject as IEnumerable <object>;
                if (d != null)
                {
                    foreach (var item in d)
                    {
                        Getres(item);
                    }
                }
            }
            else
            {
                PropertyInfo[] properties = type.GetProperties();
                foreach (PropertyInfo property in properties)
                {
                    //获取属性的值
                    object value = property.GetValue(entityObject, null);
                    if (value != null && !value.GetType().IsValueType&& value.GetType() != typeof(string))
                    {
                        Getres(value);
                    }
                    else
                    {
                        //获取验证特性
                        object[] validateContent = property.GetCustomAttributes(typeof(ValidateAttribute), true);
                        if (validateContent != null)
                        {
                            string resErrorVali = string.Empty;
                            string resVali      = string.Empty;
                            foreach (ValidateAttribute validateAttribute in validateContent)
                            {
                                if (!validateAttribute.ToValidate(value))
                                {
                                    if ((ErrorCode & Convert.ToInt32(validateAttribute.ErrorType)) <= 0)
                                    {
                                        ErrorCode = ErrorCode | Convert.ToInt32(validateAttribute.ErrorType);
                                    }
                                    var msg = validateAttribute.ErrorMessage;
                                    if (validateAttribute.Mode == EnumValidateMode.NotPass)
                                    {
                                        IsValidate = false;
                                        if (!string.IsNullOrEmpty(msg))
                                        {
                                            resErrorVali += msg;
                                        }
                                    }
                                    else if (validateAttribute.Mode == EnumValidateMode.Pass)
                                    {
                                        if (!string.IsNullOrEmpty(msg))
                                        {
                                            resVali += msg;
                                        }
                                    }
                                }
                            }
                            if (!string.IsNullOrEmpty(resErrorVali))
                            {
                                ErrorMsg.Add(type.Name + "-字段:" + property.Name + "," + resErrorVali);
                            }
                            if (!string.IsNullOrEmpty(resVali))
                            {
                                Msg.Add(resVali);
                            }
                        }
                    }
                }
            }
        }