示例#1
0
        public async Task<string> CheckOtherElecPlant_2015IsOk(string CustId, int YY, string Build)
        {
            var db = new EnergyNetEntities();
            IList<CKAirMsg> msg = new List<CKAirMsg>();

            var Builds = await db.BuildDesign.Where(x => x.CustID == CustId && x.YY == YY).Select(x => x.Build).ToListAsync();
            var items = await db.OtherElecPlant.Where(x => x.YY == YY && x.CustID == CustId && Builds.Contains(x.Build)).ToListAsync();
            foreach (var item in items)
            {

                if (item.PlantNameType == "4" && string.IsNullOrEmpty(item.IsInverter))
                {
                    //5.電梯系統”未填報“有無變頻控制”資料,請重新檢視並填報。
                    var m = new CKAirMsg()
                    {
                        Build = item.Build,
                        PlantName = item.PlantName.TrimEnd() + "-" + item.Brand.TrimEnd() + "-" + item.Style.TrimEnd(),
                        PlantNo = item.PlantNo,
                        MsgCode = 0
                    };
                    msg.Add(m);
                }

                if (item.PlantNameType == "4" && string.IsNullOrEmpty(item.IsRegenerative))
                {
                    //5.電梯系統”未填報“有無裝設電力回生裝置”資料,請重新檢視並填報。
                    var m = new CKAirMsg()
                    {
                        Build = item.Build,
                        PlantName = item.PlantName.TrimEnd() + "-" + item.Brand + "-" + item.Style,
                        PlantNo = item.PlantNo,
                        MsgCode = 1
                    };
                    msg.Add(m);
                }

                if (
                    (item.PlantNameType == "4" ||
                    item.PlantName.Contains("風機") ||
                    (item.PlantName.Contains("泵") && !item.PlantName.Contains("主機"))
                   )
                    &&
                    (item.MotorHorse == null ||
                    item.MotorPole == null ||
                    item.MotorEfficiency == null ||
                    item.PowerValue == null ||
                    string.IsNullOrEmpty(item.MotorEfficiencyStartard))
                    )
                {
                    //var m1 = String.Format("[建築:{0}][設備:{1}][編號:{2}] 此設備須填妥馬達相關資料。"
                    //    , item.Build, pname, item.PlantNo);

                    var m = new CKAirMsg()
                    {
                        Build = item.Build,
                        PlantName = item.PlantName.TrimEnd() + "-" + item.Brand + "-" + item.Style,
                        PlantNo = item.PlantNo,
                        MsgCode = 2
                    };

                    msg.Add(m);
                }
            }

            var md = new CKBuildAir();

            md.Builds = msg.Select(x => x.Build).Distinct();
            md.ckAirMsg = msg;

            return defJSONNull(md);
        }
示例#2
0
        public async Task<string> CheckAirConditioning_2015IsOk(string CustId, int YY, string Build)
        {
            var db = new EnergyNetEntities();
            IList<CKAirMsg> msg = new List<CKAirMsg>();

            var Builds = await db.BuildDesign.Where(x => x.CustID == CustId && x.YY == YY).Select(x => x.Build).ToListAsync();

            var items = await db.AirConditioning.Where(x => x.YY == YY && x.CustID == CustId && Builds.Contains(x.Build))
                .ToListAsync();

            string[] AirCode = new string[] { "08", "09", "10" };
            string[] MotCode = new string[] { "03", "04", "05", "20", "22", "23", "27", "29", "30", "32", "38", "39", "40", "41", "46", "06", "12", "13", "16", "21" };
            foreach (var item in items)
            {
                var pn = await db.AConditionPlantType.FindAsync(item.PlantName);
                var pname = pn == null ? "" : pn.PlantName;

                #region code
                if (AirCode.Contains(item.PlantName) && string.IsNullOrEmpty(item.IsSaveLogo))
                {

                    var m = new CKAirMsg()
                    {
                        Build = item.Build,
                        PlantName = pname.TrimEnd(),
                        PlantNo = item.PlantNo,
                        MsgCode = 0
                    };

                    msg.Add(m);

                    //var m1 = String.Format("[建築:{0}][設備:{1}][編號:{2}] 箱型冷氣機、窗型冷氣機或分離式冷氣機未填報“有無節能標章”。"
                    //    , item.Build, pname, item.PlantNo);
                }

                if (AirCode.Contains(item.PlantName) && string.IsNullOrEmpty(item.EfficiencyRank))
                {
                    //var m1 = String.Format("[建築:{0}][設備:{1}][編號:{2}] 箱型冷氣機、窗型冷氣機或分離式冷氣機未填報 “能源效率等級”。"
                    //    , item.Build, pname, item.PlantNo);

                    var m = new CKAirMsg()
                    {
                        Build = item.Build,
                        PlantName = pname.TrimEnd(),
                        PlantNo = item.PlantNo,
                        MsgCode = 1
                    };

                    msg.Add(m);

                }

                if (MotCode.Contains(item.PlantName) &&
                    (item.MotorHorse == null ||
                    item.MotorPole == null ||
                    item.MotorEfficiency == null ||
                    item.PowerValue == null ||
                    string.IsNullOrEmpty(item.MotorEfficiencyStartard))
                    )
                {
                    //var m1 = String.Format("[建築:{0}][設備:{1}][編號:{2}] 此設備須填妥馬達相關資料。"
                    //    , item.Build, pname, item.PlantNo);

                    var m = new CKAirMsg()
                    {
                        Build = item.Build,
                        PlantName = pname.TrimEnd(),
                        PlantNo = item.PlantNo,
                        MsgCode = 2
                    };

                    msg.Add(m);
                }
                #endregion
            }

            var md = new CKBuildAir();

            md.Builds = msg.Select(x => x.Build).Distinct();
            md.ckAirMsg = msg;

            return defJSONNull(md);
        }