Exemplo n.º 1
0
        private void bnInsert_Click(object sender, EventArgs e)
        {
            if (null == _dt || null == _document)
            {
                return;
            }
            // Case
            DataCase dtCase = _dt as DataCase;

            if (null != dtCase)
            {
                _document.CreateNewCase(ToCase(dtCase));
            }

            DataBox dtBox = _dt as DataBox;

            if (null != dtBox)
            {
                _document.CreateNewBox(ToBox(dtBox));
            }

            DataCylinder dtCylinder = _dt as DataCylinder;

            if (null != dtCylinder)
            {
                _document.CreateNewCylinder(ToCylinder(dtCylinder));
            }

            DataPallet dtPallet = _dt as DataPallet;

            if (null != dtPallet)
            {
                _document.CreateNewPallet(ToPallet(dtPallet));
            }

            DataInterlayer dtInterlayer = _dt as DataInterlayer;

            if (null != dtInterlayer)
            {
                _document.CreateNewInterlayer(ToInterlayer(dtInterlayer));
            }

            DataPalletCap dtPalletCap = _dt as DataPalletCap;

            if (null != dtPalletCap)
            {
                _document.CreateNewPalletCap(ToPalletCap(dtPalletCap));
            }

            DataPalletFilm dtPalletFilm = _dt as DataPalletFilm;

            if (null != dtPalletFilm)
            {
                _document.CreateNewPalletFilm(ToPalletFilm(dtPalletFilm));
            }
        }
Exemplo n.º 2
0
        public void Draw(Graphics3DControl ctrl, Graphics3D graphics)
        {
            if (null == _dt)
            {
                return;
            }
            DataCase dtCase = _dt as DataCase;

            if (null != dtCase)
            {
                Box b = new Box(0, ToCase(dtCase));
                graphics.AddBox(b);
                graphics.AddDimensions(new DimensionCube(dtCase.OuterDimensions));
            }
            DataBox dtBox = _dt as DataBox;

            if (null != dtBox)
            {
                Box b = new Box(0, ToBox(dtBox));
                graphics.AddBox(b);
                graphics.AddDimensions(new DimensionCube(dtBox.Dimensions));
            }
            DataPallet dtPallet = _dt as DataPallet;

            if (null != dtPallet)
            {
                Pallet pallet = new Pallet(ToPallet(dtPallet));
                pallet.Draw(graphics, Sharp3D.Math.Core.Transform3D.Identity);
                graphics.AddDimensions(new DimensionCube(dtPallet.Dimensions));
            }
            DataInterlayer dtInterlayer = _dt as DataInterlayer;

            if (null != dtInterlayer)
            {
                graphics.AddBox(new Box(0, ToInterlayer(dtInterlayer)));
                graphics.AddDimensions(new DimensionCube(dtInterlayer.Dimensions));
            }

            DataPalletCap dtPalletCap = _dt as DataPalletCap;

            if (null != dtPalletCap)
            {
                PalletCap palletCap = new PalletCap(0, ToPalletCap(dtPalletCap), Sharp3D.Math.Core.Vector3D.Zero);
                palletCap.Draw(graphics);
                graphics.AddDimensions(new DimensionCube(dtPalletCap.Dimensions));
            }

            DataCylinder dtCylinder = _dt as DataCylinder;

            if (null != dtCylinder)
            {
                Cylinder cyl = new Cylinder(0, ToCylinder(dtCylinder));
                graphics.AddCylinder(cyl);
            }
        }
Exemplo n.º 3
0
        internal BoxProperties ToCase(DataCase dtCase)
        {
            BoxProperties boxProperties = new BoxProperties(null
                                                            , dtCase.OuterDimensions[0], dtCase.OuterDimensions[1], dtCase.OuterDimensions[2]
                                                            , dtCase.InnerDimensions[0], dtCase.InnerDimensions[1], dtCase.InnerDimensions[2]);

            Color[] colors = Enumerable.Repeat(Color.Chocolate, 6).ToArray();
            boxProperties.ID.SetNameDesc(dtCase.Name, dtCase.Description);
            boxProperties.SetAllColors(colors);
            boxProperties.TapeColor = Color.Beige;
            boxProperties.TapeWidth = new OptDouble(true, UnitsManager.ConvertLengthFrom(50, UnitsManager.UnitSystem.UNIT_METRIC1));
            boxProperties.SetWeight(dtCase.Weight);
            boxProperties.SetNetWeight(new OptDouble(dtCase.NetWeight > 0.0, dtCase.NetWeight));
            return(boxProperties);
        }
Exemplo n.º 4
0
        public static int IsValidProject(List <ProviderServiceRef.DataProject> list, DataCase data)
        {
            int projectId = -1;
            //原始数据
            string projectName = "";

            if (data.ProjectName.Length >= 3)
            {
                projectName = data.ProjectName.Substring(0, 3);
            }
            else
            {
                projectName = data.ProjectName;
            }

            string tmp_projectName      = DataConv.Library.Chinese2Spell.Convert(projectName);            //ShenZhen
            string projectNamePinyinAll = tmp_projectName.ToUpper();                                      //SHENZHEN
            string projectNamePinyin    = DataConv.Library.Chinese2Spell.getFirstLetter(tmp_projectName); //SZ

            foreach (ProviderServiceRef.DataProject dp_item in list)
            {
                logger.Debug(dp_item.ProjectName + "\t" + projectName);
                //先比较拼音首字母是否等于
                logger.Debug(dp_item.PinYin + "\t" + projectNamePinyin);
                if (dp_item.PinYin.Contains(projectNamePinyin))
                {
                    logger.Debug(dp_item.PinYinAll + "\t" + projectNamePinyinAll);
                    if (dp_item.PinYinAll.Contains(projectNamePinyinAll))
                    {
                        projectId = dp_item.ProjectId;
                        break;
                    }
                }
                else if (!string.IsNullOrEmpty(dp_item.OtherName))
                {
                    if (dp_item.OtherPinyin.Contains(projectNamePinyin))
                    {
                        logger.Debug(dp_item.OtherPinyin + "\t" + projectNamePinyinAll);
                        if (dp_item.OtherPinyinAll.Contains(projectNamePinyinAll))
                        {
                            projectId = dp_item.ProjectId;
                            break;
                        }
                    }
                }
            }
            return(projectId);
        }
Exemplo n.º 5
0
        internal BoxProperties ToCase(DataCase dtCase)
        {
            BoxProperties boxProperties = new BoxProperties(null
                                                            , dtCase.OuterDimensions[0], dtCase.OuterDimensions[1], dtCase.OuterDimensions[2]
                                                            , dtCase.InnerDimensions[0], dtCase.InnerDimensions[1], dtCase.InnerDimensions[2]);

            Color[] colors = new Color[6];
            for (int i = 0; i < 6; ++i)
            {
                colors[i] = Color.Chocolate;
            }
            boxProperties.ID.SetNameDesc(dtCase.Name, dtCase.Description);
            boxProperties.SetAllColors(colors);
            boxProperties.ShowTape  = true;
            boxProperties.TapeColor = Color.Beige;
            boxProperties.TapeWidth = UnitsManager.ConvertLengthFrom(50, UnitsManager.UnitSystem.UNIT_METRIC1);
            boxProperties.SetWeight(dtCase.Weight);
            boxProperties.SetNetWeight(new OptDouble(dtCase.NetWeight > 0.0, dtCase.NetWeight));
            return(boxProperties);
        }
Exemplo n.º 6
0
        public int AddExceptionData(DataCase dc)
        {
            string insert_sql = @"
INSERT INTO [FxtData_Case].[dbo].[住宅案例_出售_异常案例]
(       [楼盘]             ,[行政区]             ,[楼栋]           ,[楼层]    ,[房号] ,[总楼层]      ,[案例时间]                                    ,[用途]              ,[面积]                   ,[单价]               ,[总价]              ,[案例类型]              ,[朝向]             ,[建筑类型]                    ,[户型]                  ,[户型结构]            ,[建筑年代]                                  ,[装修]              ,[使用面积],[剩余年限]       ,[成新率]             ,[币种]                    ,[附属房屋],[配套]          ,[来源]             ,[电话],               [备注]          ,[链接]             ,[标题] ,[地址],[城市]    ,[城市ID],[案例统计周])
values ('" + dc.ProjectName + @"','" + dc.AreaName + @"',NULL,'" + dc.FloorNumber + @"',NULL,'" + dc.TotalFloor + @"','" + dc.CaseDate.ToString("yyyy-MM-dd") + @"','" + dc.PurposeName + @"','" + dc.BuildingArea + @"','" + dc.UnitPrice + @"','" + dc.TotalPrice + @"','" + dc.CaseTypeName + @"','" + dc.FrontName + @"','" + dc.BuildingTypeName + @"','" + dc.HouseTypeName + @"','" + dc.StructureName + @"','" + dc.BuildingDate + @"','" + dc.ZhuangXiu + @"',NULL,'" + dc.RemainYear + @"','" + dc.Depreciation + @"','" + dc.MoneyUnitName + @"',NULL,'" + dc.PeiTao + @"','" + dc.SourceName + @"','" + dc.SourcePhone + @"','" + dc.Remark + @"','" + dc.SourceLink + @"',NULL,NULL,NULL,'" + dc.CityID + @"','" + dc.RecordWeek + @"')

";

            logger.DebugFormat("AddExceptionData SQL={0}", insert_sql);
            int rows = 0;

            try
            {
                rows = DBUtils.InsertData(CaseUrl, insert_sql);
            }
            catch (Exception e)
            {
                logger.Error(e);
            }
            return(rows);
        }
Exemplo n.º 7
0
        public static bool IsValidData(City item,
                                       DataCase data,
                                       int[] arrays,
                                       Dictionary <string, int> PurposeMap,
                                       Dictionary <string, int> FrontMap,
                                       Dictionary <string, int> BuildingTypeMap,
                                       Dictionary <string, int> HouseTypeMap,
                                       Dictionary <string, int> StructureMap,
                                       Dictionary <string, int> MoneyUnitInfoMap)
        {
            //添加验证数据合法性校验
            bool isValid = true;

            //案例时间
            if (data.CaseDate == null)
            {
                isValid = false;
            }
            // 建筑面积 般删除面积在15(不含)平米以下的案例, (北京,上海,广州,深圳)
            foreach (int item1 in arrays)
            {
                if (data.CityID == item1 &&
                    data.BuildingArea < 15)
                {
                    isValid = false;
                    break;
                }
            }
            //单价
            if (data.UnitPrice <= 0 && data.TotalPrice <= 0)
            {
                isValid = false;
            }
            // 总价
            if (isValid)
            {
                if (data.UnitPrice > 0)
                {
                    data.TotalPrice = data.UnitPrice * data.BuildingArea;
                }
                else
                {
                    data.UnitPrice = data.TotalPrice / data.BuildingArea;
                }
            }
            // 案例类型 默认填充为“买卖报盘“
            //if (string.IsNullOrEmpty(data.CaseTypeName))
            //{
            //    isValid = false;
            //}
            //else
            //{
            data.CaseTypeCode = 3001001;
            //}
            //用途
            if (string.IsNullOrEmpty(data.PurposeName))
            {
                isValid = false;
            }
            else
            {
                foreach (KeyValuePair <string, int> map in PurposeMap)
                {
                    if (map.Key == data.PurposeName)
                    {
                        data.PurposeCode = map.Value;
                        break;
                    }
                }
                if (data.PurposeCode <= 0)
                {
                    isValid = false;
                }
            }

            //行政区
            foreach (KeyValuePair <string, int> map in item.AreaMap)
            {
                if (!string.IsNullOrEmpty(data.AreaName) &&
                    map.Key.StartsWith(data.AreaName))
                {
                    data.AreaId   = map.Value;
                    data.AreaName = map.Key;
                    break;
                }
            }
            //楼层
            foreach (int d in arrays)
            {
                if ((data.CityID == d && data.FloorNumber > 80) ||
                    (data.CityID != d && data.FloorNumber > 60))
                {
                    data.FloorNumber = null;
                }
            }
            //总楼层
            foreach (int d in arrays)
            {
                if ((data.CityID == d && data.TotalFloor > 80) ||
                    (data.CityID != d && data.TotalFloor > 60))
                {
                    data.TotalFloor = null;
                }
            }

            if (data.TotalFloor < data.FloorNumber ||
                data.TotalFloor <= 0)
            {
                data.TotalFloor = null;
            }
            //朝向列
            foreach (KeyValuePair <string, int> map in FrontMap)
            {
                data.FrontCode = 0;
                if (!string.IsNullOrEmpty(data.FrontName) &&
                    map.Key == data.FrontName)
                {
                    data.FrontCode = map.Value;
                    break;
                }
            }
            //建筑类型
            if (!string.IsNullOrEmpty(data.PeiTao) &&
                data.FloorNumber == 8 &&
                data.PeiTao.Contains("电梯"))
            {
                data.BuildingTypeName = "小高层";
            }
            foreach (KeyValuePair <string, int> map in BuildingTypeMap)
            {
                if (!string.IsNullOrEmpty(data.BuildingTypeName) &&
                    (map.Key.StartsWith(data.BuildingTypeName) || map.Key.Contains(data.BuildingTypeName)))
                {
                    data.BuildingTypeCode = map.Value;
                    break;
                }
            }
            //户型
            foreach (KeyValuePair <string, int> map in HouseTypeMap)
            {
                if (!string.IsNullOrEmpty(data.HouseTypeName) &&
                    (map.Key.StartsWith(data.HouseTypeName) || map.Key.Contains(data.HouseTypeName)))
                {
                    data.HouseTypeCode = map.Value;
                    break;
                }
            }
            //户型结构
            if (!string.IsNullOrEmpty(data.StructureName))
            {
                foreach (KeyValuePair <string, int> map in StructureMap)
                {
                    if (map.Key.StartsWith(data.StructureName) ||
                        map.Key.Contains(data.StructureName))
                    {
                        data.StructureCode = map.Value;
                        break;
                    }
                }
            }
            //币种
            if (string.IsNullOrEmpty(data.MoneyUnitName))
            {
                data.MoneyUnitName = "人民币";
            }
            foreach (KeyValuePair <string, int> map in MoneyUnitInfoMap)
            {
                if (map.Key.Equals(data.MoneyUnitName) ||
                    map.Key.StartsWith(data.MoneyUnitName) ||
                    map.Key.Contains(data.MoneyUnitName))
                {
                    data.MoneyUnitCode = map.Value;
                    break;
                }
            }
            return(isValid);
        }
Exemplo n.º 8
0
        public static int IsValidProject(List <DataProject> list, List <SYS_ProjectMatch> networkNames, DataCase data, Dictionary <string, int> cacheDict)
        {
            int projectId = -1;

            if (string.IsNullOrWhiteSpace(data.ProjectName))
            {
                return(projectId);
            }
            //原始数据
            string projectName = "";

            if (data.ProjectName.Length >= 3)
            {
                projectName = data.ProjectName.Substring(0, 3);
            }
            else
            {
                projectName = data.ProjectName;
            }

            if (cacheDict.ContainsKey(projectName))
            {
                return(cacheDict[projectName]);
            }

            string tmp_projectName      = Chinese2Spell.Convert(projectName);            //ShenZhen
            string projectNamePinyinAll = tmp_projectName.ToUpper();                     //SHENZHEN
            string projectNamePinyin    = Chinese2Spell.getFirstLetter(tmp_projectName); //SZ

            foreach (DataProject dp_item in list)
            {
                logger.Debug(dp_item.ProjectName + "\t" + projectName);
                //先比较拼音首字母是否等于
                logger.Debug(dp_item.PinYin + "\t" + projectNamePinyin);
                if (dp_item.PinYin.Contains(projectNamePinyin))
                {
                    logger.Debug(dp_item.PinYinAll + "\t" + projectNamePinyinAll);
                    if (dp_item.PinYinAll.Contains(projectNamePinyinAll))
                    {
                        projectId = dp_item.ProjectId;
                        break;
                    }
                }
                else if (!string.IsNullOrEmpty(dp_item.OtherName))
                {
                    if (dp_item.OtherPinyin.Contains(projectNamePinyin))
                    {
                        logger.Debug(dp_item.OtherPinyin + "\t" + projectNamePinyinAll);
                        if (dp_item.OtherPinyinAll.Contains(projectNamePinyinAll))
                        {
                            projectId = dp_item.ProjectId;
                            break;
                        }
                    }
                }
            }
            //匹配网络名称
            if (projectId == -1 && !string.IsNullOrWhiteSpace(data.ProjectName) && networkNames != null && networkNames.Count() > 0)
            {
                var r = networkNames.FirstOrDefault(p => p.NetName == data.ProjectName);
                if (r != null)
                {
                    projectId = r.ProjectNameId;
                }
            }
            cacheDict[projectName] = projectId;
            return(projectId);
        }