diff --git a/APT.MS.Domain/Enums/BS/BSEnums.cs b/APT.MS.Domain/Enums/BS/BSEnums.cs index 46f62b9..7c19f7d 100644 --- a/APT.MS.Domain/Enums/BS/BSEnums.cs +++ b/APT.MS.Domain/Enums/BS/BSEnums.cs @@ -103,17 +103,17 @@ namespace APT.MS.Domain.Enums [Description("全公司")] /*全局*/ All = 0, - /// - /// 选矿厂 - /// - [Description("选矿厂")] - MineChoose = 10, + ///// + ///// 选矿厂 + ///// + //[Description("选矿厂")] + //MineChoose = 10, - /// - /// 尾矿库 - /// - [Description("尾矿库")] - Minelast = 20, + ///// + ///// 尾矿库 + ///// + //[Description("尾矿库")] + //Minelast = 20, /// /// 露天矿 @@ -121,28 +121,28 @@ namespace APT.MS.Domain.Enums [Description("露天矿")] Mine = 30, - /// - /// 地下矿 - /// - [Description("地下矿")] - MineUnderground = 40, + ///// + ///// 地下矿 + ///// + //[Description("地下矿")] + //MineUnderground = 40, } /// /// 安全库类型(需同步修改FMProductionUnit) /// public enum BSMineTypeEditEnum { - /// - /// 选矿 - /// - [Description("选矿厂")] - MineChoose = 10, + ///// + ///// 选矿 + ///// + //[Description("选矿厂")] + //MineChoose = 10, - /// - /// 尾矿 - /// - [Description("尾矿库")] - Minelast = 20, + ///// + ///// 尾矿 + ///// + //[Description("尾矿库")] + //Minelast = 20, /// /// 矿山 @@ -150,11 +150,11 @@ namespace APT.MS.Domain.Enums [Description("露天矿")] Mine = 30, - /// - /// 地下矿 - /// - [Description("地下矿")] - MineUnderground = 40, + ///// + ///// 地下矿 + ///// + //[Description("地下矿")] + //MineUnderground = 40, } ///// diff --git a/APT.MS.Services/Services/SC/BI/BIBSSafeCheckService.cs b/APT.MS.Services/Services/SC/BI/BIBSSafeCheckService.cs index d4e133b..dbb4f3f 100644 --- a/APT.MS.Services/Services/SC/BI/BIBSSafeCheckService.cs +++ b/APT.MS.Services/Services/SC/BI/BIBSSafeCheckService.cs @@ -137,10 +137,10 @@ namespace APT.BaseData.Services.DomainServices } else { - listMineType.Add(BSMineTypeEditEnum.MineChoose); - listMineType.Add(BSMineTypeEditEnum.Minelast); + //listMineType.Add(BSMineTypeEditEnum.MineChoose); + //listMineType.Add(BSMineTypeEditEnum.Minelast); + //listMineType.Add(BSMineTypeEditEnum.MineUnderground); listMineType.Add(BSMineTypeEditEnum.Mine); - listMineType.Add(BSMineTypeEditEnum.MineUnderground); } #endregion diff --git a/APT.MicroApi/APT.SC.WebApi/Controllers/Api/BIController/BISafeYearController.cs b/APT.MicroApi/APT.SC.WebApi/Controllers/Api/BIController/BISafeYearController.cs index 6e39520..c3d7268 100644 --- a/APT.MicroApi/APT.SC.WebApi/Controllers/Api/BIController/BISafeYearController.cs +++ b/APT.MicroApi/APT.SC.WebApi/Controllers/Api/BIController/BISafeYearController.cs @@ -121,44 +121,44 @@ namespace APT.SC.WebApi.Controllers.Api.BI { BIDepartmentSafeYear result = new BIDepartmentSafeYear(); //BSMineTypeEnum MineType = BSMineTypeEnum.Mine; - List listMineType = new List(); + //List listMineType = new List(); - if (!string.IsNullOrEmpty(filter.Keyword)) - { - try - { - string types = filter.Keyword.Split("=")[1]; - if (types.Contains("_")) - { - var listTypes = types.Split("_"); - //listTypes.foreach ((e) => { listMineType.Add((BSMineTypeEnum)int.Parse(e))}) - foreach (var item in listTypes) - { - listMineType.Add((BSMineTypeEnum)int.Parse(item)); - } - } - else - { - listMineType.Add((BSMineTypeEnum)int.Parse(types)); - } - } - catch { } - } - else - { - listMineType.Add(BSMineTypeEnum.Mine); - } + //if (!string.IsNullOrEmpty(filter.Keyword)) + //{ + // try + // { + // string types = filter.Keyword.Split("=")[1]; + // if (types.Contains("_")) + // { + // var listTypes = types.Split("_"); + // //listTypes.foreach ((e) => { listMineType.Add((BSMineTypeEnum)int.Parse(e))}) + // foreach (var item in listTypes) + // { + // listMineType.Add((BSMineTypeEnum)int.Parse(item)); + // } + // } + // else + // { + // listMineType.Add((BSMineTypeEnum)int.Parse(types)); + // } + // } + // catch { } + //} + //else + //{ + // listMineType.Add(BSMineTypeEnum.Mine); + //} Expression> expression = e => e.YEAR == DateTime.Now.Year; //行洛坑 选矿部 = 选矿部 + 尾矿部 看传参 - if (listMineType.Count == 1) - { - expression = expression.And(e => e.MineType == listMineType[0]); - } - else - { - expression = expression.And(e => listMineType.Contains(e.MineType)); - } + //if (listMineType.Count == 1) + //{ + // expression = expression.And(e => e.MineType == listMineType[0]); + //} + //else + //{ + // expression = expression.And(e => listMineType.Contains(e.MineType)); + //} var listCheckLevel = GetEntities(expression, null, null); if (listCheckLevel != null && listCheckLevel.Any()) @@ -207,116 +207,116 @@ namespace APT.SC.WebApi.Controllers.Api.BI } } - //总结数据 - IEnumerable listSummery = GetEntities(e => listMineType.Contains((BSMineTypeEnum)e.MineType) && e.CODE == "BI052_BSSafeCheckYear", null, null).OrderBy(e => e.NUM).ThenBy(e => e.PART);//e.MineType == (BSMineTypeEditEnum)MineType + //总结数据 listMineType.Contains((BSMineTypeEnum)e.MineType) && + IEnumerable listSummery = GetEntities(e => e.CODE == "BI052_BSSafeCheckYear", null, null).OrderBy(e => e.NUM).ThenBy(e => e.PART);//e.MineType == (BSMineTypeEditEnum)MineType //前12月的数据 IEnumerable listCheckType = null; - if (listMineType.Count == 1) - { - if (DateTime.Now.Month == 12) - listCheckType = GetEntities(e => e.MineType == listMineType[0] && e.YEAR == DateTime.Now.Year, null, null); - else - listCheckType = GetEntities(e => e.MineType == listMineType[0] && (e.YEAR == DateTime.Now.Year || (e.YEAR == (DateTime.Now.Year - 1) && (e.MONTH > DateTime.Now.Month))), null, null); - } + //if (listMineType.Count == 1) + //{ + if (DateTime.Now.Month == 12) + listCheckType = GetEntities(e => e.YEAR == DateTime.Now.Year, null, null);//e.MineType == listMineType[0] && else - { - if (DateTime.Now.Month == 12) - listCheckType = GetEntities(e => listMineType.Contains(e.MineType) && e.YEAR == DateTime.Now.Year, null, null); - else - listCheckType = GetEntities(e => listMineType.Contains(e.MineType) && (e.YEAR == DateTime.Now.Year || (e.YEAR == (DateTime.Now.Year - 1) && (e.MONTH > DateTime.Now.Month))), null, null); - } + listCheckType = GetEntities(e => (e.YEAR == DateTime.Now.Year || (e.YEAR == (DateTime.Now.Year - 1) && (e.MONTH > DateTime.Now.Month))), null, null);//e.MineType == listMineType[0] && + //} + //else + //{ + // if (DateTime.Now.Month == 12) + // listCheckType = GetEntities(e => listMineType.Contains(e.MineType) && e.YEAR == DateTime.Now.Year, null, null); + // else + // listCheckType = GetEntities(e => listMineType.Contains(e.MineType) && (e.YEAR == DateTime.Now.Year || (e.YEAR == (DateTime.Now.Year - 1) && (e.MONTH > DateTime.Now.Month))), null, null); + //} listCheckType = listCheckType.OrderBy(e => e.YEAR).ThenBy(e => e.MONTH); if (listSummery != null && listSummery.Any()) { - if (listMineType.Count > 1) + //if (listMineType.Count > 1) + //{ + //PART 1 3 合并 + var temp = listSummery.ToList(); + for (int i = 1; i < temp.Count; i++) { - //PART 1 3 合并 - var temp = listSummery.ToList(); - for (int i = 1; i < temp.Count; i++) + if (temp[i].PART == 1 && temp[i].PART == temp[i - 1].PART) { - if (temp[i].PART == 1 && temp[i].PART == temp[i - 1].PART) + temp[i - 1].Count1 += temp[i].Count1; + temp[i - 1].Count2 += temp[i].Count2; + temp[i - 1].Count3 += temp[i].Count3; + temp[i - 1].Count4 += temp[i].Count4; + + if (temp[i - 1].Count2 + temp[i - 1].Count3 == 0 || temp[i - 1].Count1 == 0) { - temp[i - 1].Count1 += temp[i].Count1; - temp[i - 1].Count2 += temp[i].Count2; - temp[i - 1].Count3 += temp[i].Count3; - temp[i - 1].Count4 += temp[i].Count4; - - if (temp[i - 1].Count2 + temp[i - 1].Count3 == 0 || temp[i - 1].Count1 == 0) - { - temp[i - 1].Parameter7 = "0.00%"; - } - else - { - temp[i - 1].Parameter7 = Math.Round((100.00 * (temp[i - 1].Count2 + temp[i - 1].Count3) / temp[i - 1].Count1) / 100, 2) + "%";//完成率 - } - if (temp[i - 1].Count2 == 0 || temp[i - 1].Count1 == 0) - { - temp[i - 1].Parameter8 = "0.00%"; - } - else - { - temp[i - 1].Parameter8 = Math.Round((100.00 * temp[i - 1].Count2 / temp[i - 1].Count1) / 100, 2) + "%";//及时完成率 - } - temp.RemoveAt(i); - i--; + temp[i - 1].Parameter7 = "0.00%"; } - else if (temp[i].PART == 3 && temp[i].PART == temp[i - 1].PART) + else { - temp[i - 1].Count1 += temp[i].Count1; - temp[i - 1].Count2 += temp[i].Count2; - temp[i - 1].Count3 += temp[i].Count3; - - temp[i - 1].Parameter7 = Math.Round((100.00 * (temp[i - 1].Count2 + temp[i - 1].Count3) / temp[i - 1].Count1) / 100, 2) + "%";//整改率 - - temp.RemoveAt(i); - i--; + temp[i - 1].Parameter7 = Math.Round((100.00 * (temp[i - 1].Count2 + temp[i - 1].Count3) / temp[i - 1].Count1) / 100, 2) + "%";//完成率 } + if (temp[i - 1].Count2 == 0 || temp[i - 1].Count1 == 0) + { + temp[i - 1].Parameter8 = "0.00%"; + } + else + { + temp[i - 1].Parameter8 = Math.Round((100.00 * temp[i - 1].Count2 / temp[i - 1].Count1) / 100, 2) + "%";//及时完成率 + } + temp.RemoveAt(i); + i--; + } + else if (temp[i].PART == 3 && temp[i].PART == temp[i - 1].PART) + { + temp[i - 1].Count1 += temp[i].Count1; + temp[i - 1].Count2 += temp[i].Count2; + temp[i - 1].Count3 += temp[i].Count3; + + temp[i - 1].Parameter7 = Math.Round((100.00 * (temp[i - 1].Count2 + temp[i - 1].Count3) / temp[i - 1].Count1) / 100, 2) + "%";//整改率 + + temp.RemoveAt(i); + i--; } - result.listSummary = temp; - } - else - { - result.listSummary = listSummery.ToList(); } + result.listSummary = temp; + //} + //else + //{ + // result.listSummary = listSummery.ToList(); + //} } if (listCheckType != null && listCheckType.Any()) { - if (listMineType.Count > 0) + //if (listMineType.Count > 0) + //{ + var Temp = listCheckType.ToList(); + for (int i = 1; i < Temp.Count; i++) { - var Temp = listCheckType.ToList(); - for (int i = 1; i < Temp.Count; i++) + if (Temp[i].YEAR == Temp[i - 1].YEAR && Temp[i].MONTH == Temp[i - 1].MONTH) { - if (Temp[i].YEAR == Temp[i - 1].YEAR && Temp[i].MONTH == Temp[i - 1].MONTH) + Temp[i - 1].ALLCOUNT += Temp[i].ALLCOUNT; + Temp[i - 1].OUTTIMECOUNT += Temp[i].OUTTIMECOUNT; + Temp[i - 1].INTTIMECOUNT += Temp[i].INTTIMECOUNT; + Temp[i - 1].NOTFINISHCOUN += Temp[i].NOTFINISHCOUN; + if (Temp[i - 1].ALLCOUNT == 0) { - Temp[i - 1].ALLCOUNT += Temp[i].ALLCOUNT; - Temp[i - 1].OUTTIMECOUNT += Temp[i].OUTTIMECOUNT; - Temp[i - 1].INTTIMECOUNT += Temp[i].INTTIMECOUNT; - Temp[i - 1].NOTFINISHCOUN += Temp[i].NOTFINISHCOUN; - if (Temp[i - 1].ALLCOUNT == 0) - { - Temp[i - 1].FINISHPERCENT = 100; - } - else if (Temp[i - 1].OUTTIMECOUNT + Temp[i - 1].INTTIMECOUNT == 0) - { - Temp[i - 1].FINISHPERCENT = 0; - } - else - { - Temp[i - 1].FINISHPERCENT = (decimal)Math.Round((100.00 * (Temp[i - 1].OUTTIMECOUNT + Temp[i - 1].INTTIMECOUNT) / Temp[i - 1].ALLCOUNT), 2); - } - - Temp.RemoveAt(i); - i--; + Temp[i - 1].FINISHPERCENT = 100; } + else if (Temp[i - 1].OUTTIMECOUNT + Temp[i - 1].INTTIMECOUNT == 0) + { + Temp[i - 1].FINISHPERCENT = 0; + } + else + { + Temp[i - 1].FINISHPERCENT = (decimal)Math.Round((100.00 * (Temp[i - 1].OUTTIMECOUNT + Temp[i - 1].INTTIMECOUNT) / Temp[i - 1].ALLCOUNT), 2); + } + + Temp.RemoveAt(i); + i--; } - result.listCheckTypeYear = Temp; - } - else - { - result.listCheckTypeYear = listCheckType.ToList(); } + result.listCheckTypeYear = Temp; + //} + //else + //{ + // result.listCheckTypeYear = listCheckType.ToList(); + //} } if (result.listCheckTypeYear == null) {