985 lines
40 KiB
C#
985 lines
40 KiB
C#
using BLL;
|
|
using Newtonsoft.Json;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Data.SqlClient;
|
|
using System.Linq;
|
|
|
|
namespace FineUIPro.Web
|
|
{
|
|
public partial class mainMenu_HJGL : PageBase
|
|
{
|
|
#region 定义集合
|
|
/// <summary>
|
|
/// 项目单位集合
|
|
/// </summary>
|
|
protected static List<Model.Project_ProjectUnit> getProjectUnitList = new List<Model.Project_ProjectUnit>();
|
|
/// <summary>
|
|
/// 所有焊口集合
|
|
/// </summary>
|
|
protected static List<Model.HJGL_WeldJoint> getAllJotList = new List<Model.HJGL_WeldJoint>();
|
|
/// <summary>
|
|
/// 所有管线集合
|
|
/// </summary>
|
|
protected static List<Model.HJGL_Pipeline> getAllJIsoInfoList = new List<Model.HJGL_Pipeline>();
|
|
/// <summary>
|
|
/// 所有焊接焊口集合
|
|
/// </summary>
|
|
protected static List<Model.HJGL_WeldJoint> getFinishedJotList = new List<Model.HJGL_WeldJoint>();
|
|
/// <summary>
|
|
/// 当日焊接焊口集合
|
|
/// </summary>
|
|
protected static List<Model.HJGL_WeldJoint> getNowJotList = new List<Model.HJGL_WeldJoint>();
|
|
/// <summary>
|
|
/// 焊接检测单明细集合
|
|
/// </summary>
|
|
protected static List<Model.sp_index_HJGLItem> getCH_CheckItemList = new List<Model.sp_index_HJGLItem>();
|
|
/// <summary>
|
|
/// 所有焊工集合
|
|
/// </summary>
|
|
protected static IQueryable<Model.SitePerson_Person> getAllWelderList;
|
|
/// <summary>
|
|
/// 项目ID
|
|
/// </summary>
|
|
public string ProjectId
|
|
{
|
|
get
|
|
{
|
|
return (string)ViewState["ProjectId"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["ProjectId"] = value;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 工厂预制进度
|
|
public decimal GCRate1
|
|
{
|
|
get
|
|
{
|
|
return (decimal)ViewState["GCRate"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["GCRate"] = value;
|
|
}
|
|
}
|
|
public decimal GCRate2
|
|
{
|
|
get
|
|
{
|
|
return (decimal)ViewState["GCRate2"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["GCRate2"] = value;
|
|
}
|
|
}
|
|
#endregion
|
|
#region 现场安装进度
|
|
public decimal XCRate1
|
|
{
|
|
get
|
|
{
|
|
return (decimal)ViewState["XCRate1"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["XCRate1"] = value;
|
|
}
|
|
}
|
|
public decimal XCRate2
|
|
{
|
|
get
|
|
{
|
|
return (decimal)ViewState["XCRate2"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["XCRate2"] = value;
|
|
}
|
|
}
|
|
#endregion
|
|
#region 管道实时预制率
|
|
|
|
public decimal PipeRate1
|
|
{
|
|
get
|
|
{
|
|
return BLL.HJGL_WeldingReportService.GetPipeRate_finished(this.CurrUser.LoginProjectId);
|
|
}
|
|
|
|
}
|
|
public decimal PipeRate2
|
|
{
|
|
get
|
|
{
|
|
return BLL.HJGL_WeldingReportService.GetPipeRate_unfinished(this.CurrUser.LoginProjectId);
|
|
}
|
|
|
|
}
|
|
#endregion
|
|
#region 项目焊接工程量统计
|
|
public decimal Dy1
|
|
{
|
|
get
|
|
{
|
|
return (decimal)ViewState["Dy1"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["Dy1"] = value;
|
|
}
|
|
}
|
|
public decimal Dy2
|
|
{
|
|
get
|
|
{
|
|
return (decimal)ViewState["Dy2"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["Dy2"] = value;
|
|
}
|
|
}
|
|
public int HK1
|
|
{
|
|
get
|
|
{
|
|
return (int)ViewState["HK1"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["HK1"] = value;
|
|
}
|
|
}
|
|
public int HK2
|
|
{
|
|
get
|
|
{
|
|
return (int)ViewState["HK2"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["HK2"] = value;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
this.ProjectId = this.CurrUser.LoginProjectId;
|
|
string unitId = this.CurrUser.UnitId;
|
|
var getWeldReportMain = from x in Funs.DB.HJGL_WeldingDaily
|
|
where x.ProjectId == this.ProjectId
|
|
select x;
|
|
getProjectUnitList = (from x in Funs.DB.Project_ProjectUnit
|
|
where x.ProjectId == this.ProjectId && (x.UnitType == Const.ProjectUnitType_1 || x.UnitType == Const.ProjectUnitType_2)
|
|
select x).ToList();
|
|
////管线集合
|
|
getAllJIsoInfoList = (from x in Funs.DB.HJGL_Pipeline
|
|
where x.ProjectId == this.ProjectId
|
|
select x).ToList();
|
|
////总焊口
|
|
getAllJotList = (from x in Funs.DB.HJGL_WeldJoint
|
|
where x.ProjectId == this.ProjectId
|
|
select x).ToList();
|
|
////完成焊口
|
|
getFinishedJotList = (from x in getAllJotList
|
|
where x.WeldingDailyId != null
|
|
select x).ToList();
|
|
////当日焊接
|
|
getNowJotList = (from x in getFinishedJotList
|
|
join y in getWeldReportMain on x.WeldingDailyId equals y.WeldingDailyId
|
|
where y.WeldingDate.Value.Year== DateTime.Now.Year && y.WeldingDate.Value.Month == DateTime.Now.Month && y.WeldingDate.Value.Day == DateTime.Now.Day
|
|
select x).ToList();
|
|
|
|
////焊接检测单明细
|
|
getCH_CheckItemList = (from x in Funs.DB.HJGL_Batch_NDEItem
|
|
join y in Funs.DB.HJGL_Batch_BatchTrustItem on x.TrustBatchItemId equals y.TrustBatchItemId
|
|
join z in Funs.DB.View_HJGL_WeldJoint on y.WeldJointId equals z.WeldJointId
|
|
join line in Funs.DB.HJGL_Pipeline on z.PipelineId equals line.PipelineId
|
|
where z.ProjectId == this.ProjectId
|
|
select new Model.sp_index_HJGLItem
|
|
{
|
|
ProjectId = line.ProjectId,
|
|
ID = x.NDEItemID,
|
|
UnitId = line.UnitId, ///重定义单位
|
|
UnitName=z.UnitName,
|
|
WorkAreaId = line.UnitId, /// 重定义区域
|
|
MaterialId = line.UnitWorkId, ///重定义材质
|
|
CHT_TotalFilm = x.TotalFilm,
|
|
CHT_PassFilm = x.PassFilm,
|
|
Specification = z.Specification,
|
|
WeldTypeCode=z.WeldTypeCode,
|
|
JointAttribute=z.JointAttribute,
|
|
UnitWorkName=z.UnitWorkName,
|
|
MaterialCode=z.MaterialCode
|
|
}).ToList();
|
|
////总焊工
|
|
getAllWelderList = from x in Funs.DB.SitePerson_Person
|
|
where x.ProjectId == this.ProjectId && x.WorkPostId=="19B8F2A9-28D3-4F20-867A-1B2237C2E228"
|
|
select x;
|
|
|
|
this.getrate(this.ProjectId, unitId);
|
|
this.getWeld(this.ProjectId, unitId);
|
|
this.SetWorkNum(this.ProjectId, unitId);
|
|
getecharts04();
|
|
getecharts05();
|
|
getecharts06();
|
|
this.divWelderEfficacyNum.InnerText = BLL.HJGL_WeldingReportService.GetWelderEfficacy(this.CurrUser .LoginProjectId).ToString() ;
|
|
this.echarts02Value.InnerText = Math.Floor(Math.Round(decimal.Parse((PipeRate1 / (PipeRate1+ PipeRate2)).ToString("0.000")), 2) * 100).ToString();
|
|
|
|
|
|
}
|
|
|
|
private void getrate(string projectId, string unitId)
|
|
{
|
|
this.GCRate1 = 0;
|
|
this.GCRate2 = 0;
|
|
this.XCRate1 = 0;
|
|
this.XCRate2 = 0;
|
|
|
|
decimal allGC = 0;
|
|
decimal allXC = 0;
|
|
var getWelds = Funs.DB.HJGL_WeldJoint.Where(x => x.ProjectId == projectId);
|
|
if (!string.IsNullOrEmpty(this.CurrUser.UnitId) )
|
|
{
|
|
//getWelds = from x in getWelds
|
|
// join y in Funs.DB.HJGL_Pipeline on x.PipelineId equals y.PipelineId
|
|
// where y.UnitId == unitId
|
|
// select x;
|
|
}
|
|
if (getWelds.Count() > 0)
|
|
{
|
|
decimal allDy = getWelds.Sum(x => x.Size ?? 0); //项目总达因数
|
|
|
|
if (getWelds.Where(x => x.JointAttribute == "预制口").Count()>0)
|
|
{
|
|
allGC = getWelds.Where(x => x.JointAttribute == "预制口").Sum(x => x.Size ?? 0);
|
|
}
|
|
if (getWelds.Where(x => x.JointAttribute == "安装口") .Count() > 0)
|
|
{
|
|
allXC = getWelds.Where(x => x.JointAttribute == "安装口").Sum(x => x.Size ?? 0);
|
|
}
|
|
var getWeldsOk = getWelds.Where(x => x.WeldingDailyId != null);
|
|
if (getWeldsOk.Count()>0)
|
|
{
|
|
var GCModel = getWeldsOk.Where(x => x.JointAttribute == "预制口");
|
|
if (GCModel.Count() > 0)
|
|
{
|
|
GCRate1 = GCModel.Sum(x => x.Size ?? 0);
|
|
// PipeRate1 = GCRate1;
|
|
|
|
}
|
|
var XCModel = getWeldsOk.Where(x => x.JointAttribute == "安装口");
|
|
if (XCModel.Count() > 0)
|
|
{
|
|
XCRate1 = XCModel.Sum(x => x.Size ?? 0);
|
|
|
|
}
|
|
}
|
|
GCRate2 = allGC - GCRate1;
|
|
XCRate2 = allXC - XCRate1;
|
|
// PipeRate2 = allDy - PipeRate1;
|
|
|
|
}
|
|
|
|
}
|
|
#region 焊工现场统计
|
|
/// <summary>
|
|
/// 焊工现场统计
|
|
/// </summary>
|
|
private void getWeld(string projectId, string unitId)
|
|
{
|
|
var getWelders = from x in Funs.DB.SitePerson_Person
|
|
where x.ProjectId == projectId
|
|
&& x.WorkPostId == Const.WorkPost_Welder
|
|
select x;
|
|
if (!string.IsNullOrEmpty(this.CurrUser.UnitId) && unitId != Const.UnitId_SEDIN)
|
|
{
|
|
getWelders = getWelders.Where(x => x.UnitId == unitId);
|
|
}
|
|
this.divWelderNum.InnerText = getWelders.Count().ToString();
|
|
string strSql = @"SELECT SUM(TotalFilm) AS TotalFilm, SUM(PassFilm) AS PassFilm
|
|
from HJGL_Batch_NDEItem item
|
|
left join HJGL_Batch_NDE nde on nde.NDEID = item.NDEID
|
|
where ProjectId = @ProjectId";
|
|
List<SqlParameter> listStr = new List<SqlParameter>
|
|
{
|
|
new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId)
|
|
};
|
|
if (!string.IsNullOrEmpty(this.CurrUser.UnitId) && unitId != Const.UnitId_SEDIN)
|
|
{
|
|
strSql += " AND UnitId=@unitId";
|
|
listStr.Add(new SqlParameter("@unitId", unitId));
|
|
}
|
|
SqlParameter[] parameter = listStr.ToArray();
|
|
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
|
if (tb != null && tb.Rows.Count > 0)
|
|
{
|
|
try
|
|
{
|
|
var rate = 100 * double.Parse(tb.Rows[0]["PassFilm"].ToString()) / double.Parse(tb.Rows[0]["TotalFilm"].ToString());
|
|
this.divPassRate.InnerText = "" + ((int)rate) + "%";
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
this.divPassRate.InnerText = "0%";
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 项目焊接工程量统计
|
|
private void SetWorkNum(string projectId, string unitId)
|
|
{
|
|
this.Dy1 = 0;
|
|
this.Dy2 = 0;
|
|
this.HK1 = 0;
|
|
this.HK2 = 0;
|
|
var getWelds = Funs.DB.HJGL_WeldJoint.Where(x => x.ProjectId == projectId);
|
|
if (!string.IsNullOrEmpty(this.CurrUser.UnitId) && unitId != Const.UnitId_SEDIN)
|
|
{
|
|
getWelds = from x in getWelds
|
|
join y in Funs.DB.HJGL_Pipeline on x.PipelineId equals y.PipelineId
|
|
where y.UnitId == unitId
|
|
select x;
|
|
}
|
|
if (getWelds.Count() > 0)
|
|
{
|
|
decimal allDy = getWelds.Sum(x => x.Size ?? 0);
|
|
int allHk = getWelds.Count();
|
|
|
|
var getWeldsOk = getWelds.Where(x => x.WeldingDailyId != null);
|
|
HK1 = getWeldsOk.Count();
|
|
HK2 = allHk - HK1;
|
|
if (HK1 > 0)
|
|
{
|
|
Dy1 = getWeldsOk.Sum(x => x.Size ?? 0);
|
|
}
|
|
Dy2 = allDy - Dy1;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 焊接一次合格率
|
|
protected string E04_Type01;
|
|
protected string E04_Values01;
|
|
protected string E04_Type02;
|
|
protected string E04_Values02;
|
|
protected string E04_Type03;
|
|
protected string E04_Values03;
|
|
protected string E04_Type04;
|
|
protected string E04_Values04;
|
|
protected string E04_Type05;
|
|
protected string E04_Values05;
|
|
protected string E04_Type06;
|
|
protected string E04_Values06;
|
|
/// <summary>
|
|
/// 焊接一次合格率
|
|
/// </summary>
|
|
//protected void getecharts04()
|
|
//{
|
|
// E08_Type01 = "[]";
|
|
// E08_Values01 = "[]";
|
|
|
|
// E08_Type02 = "[]";
|
|
// E08_Values02 = "[]";
|
|
|
|
// E08_Type03 = "[]";
|
|
// E08_Values03 = "[]";
|
|
// double PassRate = 0;
|
|
// int current_pass_film = 0;
|
|
// int cht_totalfilm = 0;
|
|
// //// 按单位
|
|
// List<string> type01List = new List<string>();
|
|
// List<double> count011List = new List<double>();
|
|
// foreach (var itemUnit in getProjectUnitList)
|
|
// {
|
|
// string unitName = UnitService.GetUnitNameByUnitId(itemUnit.UnitId);
|
|
// type01List.Add(unitName);
|
|
// var getUJots = from x in getCH_CheckItemList
|
|
// where x.UnitId == itemUnit.UnitId
|
|
// select x;
|
|
// PassRate = 0;
|
|
// current_pass_film = getUJots.Sum(x => x.CHT_PassFilm) ?? 0;
|
|
// cht_totalfilm = getUJots.Sum(x => x.CHT_TotalFilm) ?? 0;
|
|
// if (cht_totalfilm > 0)
|
|
// {
|
|
// PassRate = Math.Round((100 * current_pass_film * 1.0) / cht_totalfilm, 1);
|
|
// }
|
|
// count011List.Add(PassRate);
|
|
// }
|
|
// if (type01List.Count() > 0)
|
|
// {
|
|
// E08_Type01 = JsonConvert.SerializeObject(type01List);
|
|
// E08_Values01 = JsonConvert.SerializeObject(count011List);
|
|
// }
|
|
// ///按单位工程
|
|
// List<string> type02List = new List<string>();
|
|
// List<double> count021List = new List<double>();
|
|
// var getWorkAreas = from x in Funs.DB.WBS_UnitWork
|
|
// where x.ProjectId == this.ProjectId
|
|
// select x;
|
|
// foreach (var itemWorkArea in getWorkAreas)
|
|
// {
|
|
// type02List.Add(itemWorkArea.UnitWorkName);
|
|
// var getWJots = from x in getCH_CheckItemList
|
|
// where x.WorkAreaId == itemWorkArea.UnitWorkId
|
|
// select x;
|
|
|
|
// PassRate = 0;
|
|
// current_pass_film = getWJots.Sum(x => x.CHT_PassFilm) ?? 0;
|
|
// cht_totalfilm = getWJots.Sum(x => x.CHT_TotalFilm) ?? 0;
|
|
// if (cht_totalfilm > 0)
|
|
// {
|
|
// PassRate = Math.Round((100 * current_pass_film * 1.0) / cht_totalfilm, 1);
|
|
// }
|
|
// count021List.Add(PassRate);
|
|
// }
|
|
// if (type02List.Count() > 0)
|
|
// {
|
|
// E08_Type02 = JsonConvert.SerializeObject(type02List);
|
|
// E08_Values02 = JsonConvert.SerializeObject(count021List);
|
|
// }
|
|
|
|
// ///按材质类别
|
|
// List<string> type03List = new List<string>();
|
|
// List<double> count031List = new List<double>();
|
|
// var getMaterials = from x in Funs.DB.Base_Material
|
|
// join y in Funs.DB.HJGL_Pipeline on x.MaterialId equals y.MaterialId
|
|
// where y.ProjectId == this.ProjectId
|
|
// select x;
|
|
// foreach (var itemMaterial in getMaterials)
|
|
// {
|
|
// string code = itemMaterial.MaterialCode;
|
|
// type03List.Add(code);
|
|
// var getMJots = from x in getCH_CheckItemList
|
|
// where x.MaterialId == itemMaterial.MaterialId
|
|
// select x;
|
|
|
|
// PassRate = 0;
|
|
// current_pass_film = getMJots.Sum(x => x.CHT_PassFilm) ?? 0;
|
|
// cht_totalfilm = getMJots.Sum(x => x.CHT_TotalFilm) ?? 0;
|
|
// if (cht_totalfilm > 0)
|
|
// {
|
|
// PassRate = Math.Round((100 * current_pass_film * 1.0) / cht_totalfilm, 1);
|
|
// }
|
|
// count031List.Add(PassRate);
|
|
// }
|
|
// if (type03List.Count() > 0)
|
|
// {
|
|
// E08_Type03 = JsonConvert.SerializeObject(type03List);
|
|
// E08_Values03 = JsonConvert.SerializeObject(count031List);
|
|
// }
|
|
//}
|
|
protected void getecharts04()
|
|
{
|
|
E04_Type01 = "[]";
|
|
E04_Values01 = "[]";
|
|
E04_Type02 = "[]";
|
|
E04_Values02 = "[]";
|
|
E04_Type03 = "[]";
|
|
E04_Values03 = "[]";
|
|
E04_Type04 = "[]";
|
|
E04_Values04 = "[]";
|
|
|
|
E04_Type05 = "[]";
|
|
E04_Values05 = "[]";
|
|
|
|
E04_Type06 = "[]";
|
|
E04_Values06 = "[]";
|
|
|
|
double PassRate = 0;
|
|
int current_pass_film = 0;
|
|
int cht_totalfilm = 0;
|
|
//// 按单位
|
|
List<string> type01List = new List<string>();
|
|
List<double> count011List = new List<double>();
|
|
var tb_type01 = getCH_CheckItemList.GroupBy(x => x.UnitName).Select(x => new {
|
|
UnitName=x.Key,
|
|
Current_pass_film=x.Sum(m => m.CHT_PassFilm) ??0,
|
|
Cht_totalfilm = x.Sum(m => m.CHT_TotalFilm) ?? 0
|
|
});
|
|
foreach (var item in tb_type01)
|
|
{
|
|
type01List.Add(item.UnitName);
|
|
PassRate = 0;
|
|
current_pass_film = item.Current_pass_film;
|
|
cht_totalfilm = item.Cht_totalfilm;
|
|
if (cht_totalfilm > 0)
|
|
{
|
|
PassRate = Math.Round((100 * current_pass_film * 1.0) / cht_totalfilm, 1);
|
|
}
|
|
count011List.Add(PassRate);
|
|
}
|
|
if (type01List.Count() > 0)
|
|
{
|
|
E04_Type01 = JsonConvert.SerializeObject(type01List);
|
|
E04_Values01 = JsonConvert.SerializeObject(count011List);
|
|
}
|
|
|
|
///按单位工程
|
|
List<string> type02List = new List<string>();
|
|
List<double> count021List = new List<double>();
|
|
var tb_type02 = getCH_CheckItemList.GroupBy(x => x.UnitWorkName).Select(x => new {
|
|
UnitWorkName = x.Key,
|
|
Current_pass_film = x.Sum(m => m.CHT_PassFilm) ?? 0,
|
|
Cht_totalfilm = x.Sum(m => m.CHT_TotalFilm) ?? 0
|
|
});
|
|
foreach (var item in tb_type02)
|
|
{
|
|
type02List.Add(item.UnitWorkName);
|
|
PassRate = 0;
|
|
current_pass_film = item.Current_pass_film;
|
|
cht_totalfilm = item.Cht_totalfilm;
|
|
if (cht_totalfilm > 0)
|
|
{
|
|
PassRate = Math.Round((100 * current_pass_film * 1.0) / cht_totalfilm, 1);
|
|
}
|
|
count021List.Add(PassRate);
|
|
}
|
|
if (type02List.Count() > 0)
|
|
{
|
|
E04_Type02 = JsonConvert.SerializeObject(type02List);
|
|
E04_Values02 = JsonConvert.SerializeObject(count021List);
|
|
}
|
|
|
|
|
|
///按材质类别
|
|
List<string> type03List = new List<string>();
|
|
List<double> count031List = new List<double>();
|
|
var tb_type03 = getCH_CheckItemList.GroupBy(x => x.MaterialCode).Select(x => new {
|
|
MaterialCode = x.Key,
|
|
Current_pass_film = x.Sum(m => m.CHT_PassFilm) ?? 0,
|
|
Cht_totalfilm = x.Sum(m => m.CHT_TotalFilm) ?? 0
|
|
});
|
|
foreach (var item in tb_type03)
|
|
{
|
|
type03List.Add(item.MaterialCode);
|
|
PassRate = 0;
|
|
current_pass_film = item.Current_pass_film;
|
|
cht_totalfilm = item.Cht_totalfilm;
|
|
if (cht_totalfilm > 0)
|
|
{
|
|
PassRate = Math.Round((100 * current_pass_film * 1.0) / cht_totalfilm, 1);
|
|
}
|
|
count031List.Add(PassRate);
|
|
}
|
|
if (type03List.Count() > 0)
|
|
{
|
|
E04_Type03 = JsonConvert.SerializeObject(type03List);
|
|
E04_Values03 = JsonConvert.SerializeObject(count031List);
|
|
}
|
|
//焊缝规格
|
|
List<string> type04List = new List<string>();
|
|
List<double> count041List = new List<double>();
|
|
var tb_type04 = getCH_CheckItemList.GroupBy(x => x.Specification).Select(x => new {
|
|
Specification = x.Key,
|
|
Current_pass_film = x.Sum(m => m.CHT_PassFilm) ?? 0,
|
|
Cht_totalfilm = x.Sum(m => m.CHT_TotalFilm) ?? 0
|
|
});
|
|
foreach (var item in tb_type04)
|
|
{
|
|
type04List.Add(item.Specification);
|
|
PassRate = 0;
|
|
current_pass_film = item.Current_pass_film;
|
|
cht_totalfilm = item.Cht_totalfilm;
|
|
if (cht_totalfilm > 0)
|
|
{
|
|
PassRate = Math.Round((100 * current_pass_film * 1.0) / cht_totalfilm, 1);
|
|
}
|
|
count041List.Add(PassRate);
|
|
}
|
|
if (type04List.Count() > 0)
|
|
{
|
|
E04_Type04 = JsonConvert.SerializeObject(type04List);
|
|
E04_Values04 = JsonConvert.SerializeObject(count041List);
|
|
}
|
|
//焊缝类型
|
|
List<string> type05List = new List<string>();
|
|
List<double> count051List = new List<double>();
|
|
var tb_type05 = getCH_CheckItemList.GroupBy(x => x.WeldTypeCode).Select(x => new {
|
|
WeldTypeCode = x.Key,
|
|
Current_pass_film = x.Sum(m => m.CHT_PassFilm) ?? 0,
|
|
Cht_totalfilm = x.Sum(m => m.CHT_TotalFilm) ?? 0
|
|
});
|
|
foreach (var item in tb_type05)
|
|
{
|
|
type05List.Add(item.WeldTypeCode);
|
|
PassRate = 0;
|
|
current_pass_film = item.Current_pass_film;
|
|
cht_totalfilm = item.Cht_totalfilm;
|
|
if (cht_totalfilm > 0)
|
|
{
|
|
PassRate = Math.Round((100 * current_pass_film * 1.0) / cht_totalfilm, 1);
|
|
}
|
|
count051List.Add(PassRate);
|
|
}
|
|
if (type05List.Count() > 0)
|
|
{
|
|
E04_Type05 = JsonConvert.SerializeObject(type05List);
|
|
E04_Values05 = JsonConvert.SerializeObject(count051List);
|
|
}
|
|
//焊缝属性
|
|
List<string> type06List = new List<string>();
|
|
List<double> count061List = new List<double>();
|
|
var tb_type06 = getCH_CheckItemList.GroupBy(x => x.JointAttribute).Select(x => new {
|
|
JointAttribute = x.Key,
|
|
Current_pass_film = x.Sum(m => m.CHT_PassFilm) ?? 0,
|
|
Cht_totalfilm = x.Sum(m => m.CHT_TotalFilm) ?? 0
|
|
});
|
|
foreach (var item in tb_type06)
|
|
{
|
|
type06List.Add(item.JointAttribute);
|
|
PassRate = 0;
|
|
current_pass_film = item.Current_pass_film;
|
|
cht_totalfilm = item.Cht_totalfilm;
|
|
if (cht_totalfilm > 0)
|
|
{
|
|
PassRate = Math.Round((100 * current_pass_film * 1.0) / cht_totalfilm, 1);
|
|
}
|
|
count061List.Add(PassRate);
|
|
}
|
|
if (type06List.Count() > 0)
|
|
{
|
|
E04_Type06 = JsonConvert.SerializeObject(type06List);
|
|
E04_Values06 = JsonConvert.SerializeObject(count061List);
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 焊接缺陷分析
|
|
protected string E05_Type01;
|
|
protected string E05_Values01;
|
|
protected string E05_Type02;
|
|
protected string E05_Values02;
|
|
protected string E05_Type03;
|
|
protected string E05_Values03;
|
|
protected string E05_Type04;
|
|
protected string E05_Values04;
|
|
|
|
|
|
/// <summary>
|
|
/// 焊接进度分析
|
|
/// </summary>
|
|
//protected void getecharts05()
|
|
//{
|
|
// E05_Type01 = "[]";
|
|
// E05_Values01_1 = "[]";
|
|
// E05_Values01_2 = "[]";
|
|
// E05_Type02 = "[]";
|
|
// E05_Values02_1 = "[]";
|
|
// E05_Values02_2 = "[]";
|
|
|
|
// E05_Type03 = "[]";
|
|
// E05_Values03_1 = "[]";
|
|
// E05_Values03_2 = "[]";
|
|
|
|
// //// 按单位
|
|
// List<string> type01List = new List<string>();
|
|
// List<int> count011List = new List<int>();
|
|
// List<int> count012List = new List<int>();
|
|
// foreach (var itemUnit in getProjectUnitList)
|
|
// {
|
|
// string unitName = UnitService.GetUnitNameByUnitId(itemUnit.UnitId);
|
|
// type01List.Add(unitName);
|
|
// var getUJots = from x in getAllJotList
|
|
// join y in getAllJIsoInfoList on x.PipelineId equals y.PipelineId
|
|
// where y.UnitId == itemUnit.UnitId
|
|
// select x;
|
|
// count011List.Add(getUJots.Count());
|
|
// var getUCJots = from x in getFinishedJotList
|
|
// join y in getAllJIsoInfoList on x.PipelineId equals y.PipelineId
|
|
// where y.UnitId == itemUnit.UnitId
|
|
// select x;
|
|
// count012List.Add(getUCJots.Count());
|
|
// }
|
|
// if (type01List.Count() > 0)
|
|
// {
|
|
// E05_Type01 = JsonConvert.SerializeObject(type01List);
|
|
// E05_Values01_1 = JsonConvert.SerializeObject(count011List);
|
|
// E05_Values01_2 = JsonConvert.SerializeObject(count012List);
|
|
// }
|
|
// ///按单位工程
|
|
// List<string> type02List = new List<string>();
|
|
// List<int> count021List = new List<int>();
|
|
// List<int> count022List = new List<int>();
|
|
// var getWorkAreas = from x in Funs.DB.WBS_UnitWork
|
|
// where x.ProjectId == this.ProjectId
|
|
// select x;
|
|
// foreach (var itemWorkArea in getWorkAreas)
|
|
// {
|
|
// type02List.Add(itemWorkArea.UnitWorkName);
|
|
// var getWJots = from x in getAllJotList
|
|
// join y in getAllJIsoInfoList on x.PipelineId equals y.PipelineId
|
|
// where y.UnitWorkId == itemWorkArea.UnitWorkId
|
|
// select x;
|
|
// count021List.Add(getWJots.Count());
|
|
// var getWCJots = from x in getFinishedJotList
|
|
// join y in getAllJIsoInfoList on x.PipelineId equals y.PipelineId
|
|
// where y.UnitWorkId == itemWorkArea.UnitWorkId
|
|
// select x;
|
|
// count022List.Add(getWCJots.Count());
|
|
// }
|
|
// if (type02List.Count() > 0)
|
|
// {
|
|
// E05_Type02 = JsonConvert.SerializeObject(type02List);
|
|
// E05_Values02_1 = JsonConvert.SerializeObject(count021List);
|
|
// E05_Values02_2 = JsonConvert.SerializeObject(count022List);
|
|
// }
|
|
|
|
// ///按材质类别
|
|
// List<string> type03List = new List<string>();
|
|
// List<int> count031List = new List<int>();
|
|
// List<int> count032List = new List<int>();
|
|
// var getMaterials = (from x in Funs.DB.Base_Material
|
|
// join y in Funs.DB.HJGL_Pipeline on x.MaterialId equals y.MaterialId
|
|
// where y.ProjectId == this.ProjectId
|
|
// select x).ToList().Distinct();
|
|
// foreach (var itemMaterial in getMaterials)
|
|
// {
|
|
// string code = itemMaterial.MaterialCode;
|
|
// type03List.Add(code);
|
|
// var getWJots = from x in getAllJotList
|
|
// join y in getAllJIsoInfoList on x.PipelineId equals y.PipelineId
|
|
// where y.MaterialId == itemMaterial.MaterialId
|
|
// select x;
|
|
// count031List.Add(getWJots.Count());
|
|
// var getWCJots = from x in getFinishedJotList
|
|
// join y in getAllJIsoInfoList on x.PipelineId equals y.PipelineId
|
|
// where y.MaterialId == itemMaterial.MaterialId
|
|
// select x;
|
|
// count032List.Add(getWCJots.Count());
|
|
// }
|
|
// if (type03List.Count() > 0)
|
|
// {
|
|
// E05_Type03 = JsonConvert.SerializeObject(type03List);
|
|
// E05_Values03_1 = JsonConvert.SerializeObject(count031List);
|
|
// E05_Values03_2 = JsonConvert.SerializeObject(count032List);
|
|
// }
|
|
//}
|
|
|
|
|
|
protected void getecharts05()
|
|
{
|
|
E05_Type01="[]";
|
|
E05_Values01="[]";
|
|
E05_Type02 = "[]";
|
|
E05_Values02 = "[]";
|
|
E05_Type03 = "[]";
|
|
E05_Values03 = "[]";
|
|
E05_Type04 = "[]";
|
|
E05_Values04 = "[]";
|
|
|
|
var alllist = from x in Funs.DB.HJGL_Batch_NDEItem
|
|
join y in Funs.DB.HJGL_Batch_NDE on x.NDEID equals y.NDEID
|
|
join z in Funs.DB.View_Batch_NDEItem on x.NDEID equals z.NDEID
|
|
join m in Funs.DB.View_HJGL_Pipeline on z.PipelineCode equals m.PipelineCode
|
|
join n in Funs.DB.View_HJGL_WeldJoint on z.WeldJointId equals n.WeldJointId
|
|
where x.CheckDefects != null && x.CheckDefects != "" && y.ProjectId == this.CurrUser.LoginProjectId
|
|
select new
|
|
{
|
|
x.CheckDefects,
|
|
m.MaterialCode,
|
|
n.Specification,
|
|
n.WeldTypeCode,
|
|
n.JointAttribute,
|
|
};
|
|
///按材质类别
|
|
List<string> type01List = new List<string>();
|
|
List<decimal> count011List = new List<decimal>();
|
|
var tb_type01 = alllist.GroupBy(x => x.MaterialCode).Select(x => new
|
|
{
|
|
MaterialCode = x.Key,
|
|
Defect = x.Count()
|
|
});
|
|
foreach (var item in tb_type01)
|
|
{
|
|
type01List.Add(item.MaterialCode);
|
|
count011List.Add(item.Defect);
|
|
}
|
|
if (type01List.Count() > 0)
|
|
{
|
|
E05_Type01 = JsonConvert.SerializeObject(type01List);
|
|
E05_Values01 = JsonConvert.SerializeObject(count011List);
|
|
}
|
|
//焊缝规格
|
|
List<string> type02List = new List<string>();
|
|
List<decimal> count021List = new List<decimal>();
|
|
var tb_type02 = alllist.GroupBy(x => x.Specification).Select(x => new
|
|
{
|
|
Specification = x.Key,
|
|
Defect = x.Count()
|
|
});
|
|
foreach (var item in tb_type02)
|
|
{
|
|
type02List.Add(item.Specification);
|
|
count021List.Add(item.Defect);
|
|
}
|
|
if (type02List.Count() > 0)
|
|
{
|
|
E05_Type02 = JsonConvert.SerializeObject(type02List);
|
|
E05_Values02 = JsonConvert.SerializeObject(count021List);
|
|
}
|
|
//焊缝类型
|
|
List<string> type03List = new List<string>();
|
|
List<decimal> count031List = new List<decimal>();
|
|
var tb_type03 = alllist.GroupBy(x => x.WeldTypeCode).Select(x => new
|
|
{
|
|
WeldTypeCode = x.Key,
|
|
Defect = x.Count()
|
|
});
|
|
foreach (var item in tb_type03)
|
|
{
|
|
type03List.Add(item.WeldTypeCode);
|
|
count031List.Add(item.Defect);
|
|
}
|
|
if (type03List.Count() > 0)
|
|
{
|
|
E05_Type03 = JsonConvert.SerializeObject(type03List);
|
|
E05_Values03 = JsonConvert.SerializeObject(count031List);
|
|
}
|
|
//焊缝属性
|
|
List<string> type04List = new List<string>();
|
|
List<decimal> count041List = new List<decimal>();
|
|
var tb_type04 = alllist.GroupBy(x => x.JointAttribute).Select(x => new
|
|
{
|
|
JointAttribute = x.Key,
|
|
Defect = x.Count()
|
|
});
|
|
foreach (var item in tb_type04)
|
|
{
|
|
type04List.Add(item.JointAttribute);
|
|
count041List.Add(item.Defect);
|
|
}
|
|
if (type04List.Count() > 0)
|
|
{
|
|
E05_Type04 = JsonConvert.SerializeObject(type04List);
|
|
E05_Values04 = JsonConvert.SerializeObject(count041List);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 焊工业绩分析
|
|
protected string E06_Type01;
|
|
protected string E06_Values01;
|
|
protected string E06_Type02;
|
|
protected string E06_Values02;
|
|
protected string E06_Type03;
|
|
protected string E06_Values03;
|
|
/// <summary>
|
|
/// 焊工业绩分析
|
|
/// </summary>
|
|
protected void getecharts06()
|
|
{
|
|
E06_Type01 = "[]";
|
|
E06_Values01 = "[]";
|
|
E06_Type02 = "[]";
|
|
E06_Values02 = "[]";
|
|
E06_Type03 = "[]";
|
|
E06_Values03 = "[]";
|
|
decimal TotalDin=0;
|
|
var allwelderEfficacy= from x in Funs.DB.SitePerson_Person
|
|
join y in Funs.DB.HJGL_WeldJoint on x.PersonId equals y.CoverWelderId
|
|
join z in Funs.DB.HJGL_WeldingDaily on y.WeldingDailyId equals z.WeldingDailyId
|
|
join m in Funs.DB.HJGL_Pipeline on y.PipelineId equals m.PipelineId
|
|
where x.WorkPostId == "19B8F2A9-28D3-4F20-867A-1B2237C2E228"
|
|
group new { x,y,z,m} by new {x.UnitId,z.UnitWorkId,m.MaterialId ,y.Size} into tt
|
|
select new
|
|
{
|
|
Size =(tt.Sum(x=>x.y.Size)==null)?0: tt.Sum(x => x.y.Size),
|
|
UnitId = tt.Key.UnitId,
|
|
MaterialId = tt.Key.MaterialId,
|
|
UnitWorkId=tt.Key.UnitWorkId,
|
|
};
|
|
|
|
//// 按单位
|
|
List<string> type01List = new List<string>();
|
|
List<decimal> count011List = new List<decimal>();
|
|
foreach (var itemUnit in getProjectUnitList)
|
|
{
|
|
string unitName = UnitService.GetUnitNameByUnitId(itemUnit.UnitId);
|
|
type01List.Add(unitName);
|
|
var getUJots = from x in allwelderEfficacy
|
|
where x.UnitId == itemUnit.UnitId
|
|
select x;
|
|
TotalDin = getUJots.Sum(x => x.Size) ?? 0;
|
|
|
|
count011List.Add(TotalDin);
|
|
}
|
|
if (type01List.Count() > 0)
|
|
{
|
|
E06_Type01 = JsonConvert.SerializeObject(type01List);
|
|
E06_Values01 = JsonConvert.SerializeObject(count011List);
|
|
}
|
|
///按单位工程
|
|
List<string> type02List = new List<string>();
|
|
List<decimal> count021List = new List<decimal>();
|
|
var getWorkAreas = from x in Funs.DB.WBS_UnitWork
|
|
where x.ProjectId == this.ProjectId
|
|
select x;
|
|
foreach (var itemWorkArea in getWorkAreas)
|
|
{
|
|
type02List.Add(itemWorkArea.UnitWorkName);
|
|
var getUJots = from x in allwelderEfficacy
|
|
where x.UnitWorkId == itemWorkArea.UnitWorkId
|
|
select x;
|
|
TotalDin = getUJots.Sum(x => x.Size) ?? 0;
|
|
|
|
count021List.Add(TotalDin);
|
|
}
|
|
if (type02List.Count() > 0)
|
|
{
|
|
E06_Type02 = JsonConvert.SerializeObject(type02List);
|
|
E06_Values02 = JsonConvert.SerializeObject(count021List);
|
|
}
|
|
|
|
///按材质类别
|
|
List<string> type03List = new List<string>();
|
|
List<decimal> count031List = new List<decimal>();
|
|
var getMaterials =( from x in Funs.DB.Base_Material
|
|
join y in Funs.DB.HJGL_Pipeline on x.MaterialId equals y.MaterialId
|
|
where y.ProjectId == this.ProjectId
|
|
select x).ToList().Distinct();
|
|
var q = (from x in getMaterials
|
|
join y in allwelderEfficacy on x.MaterialId equals y.MaterialId
|
|
group new { x, y } by new { x.MaterialCode, y.Size } into g
|
|
select new
|
|
{
|
|
MaterialCode = g.Key.MaterialCode,
|
|
TotalDin = g.Sum(x => x.y.Size)
|
|
|
|
}).GroupBy(x => x.MaterialCode).Select(x =>
|
|
new
|
|
{
|
|
MaterialCode = x.Key,
|
|
TotalDin=x.Sum(m=>m.TotalDin)
|
|
}) ;
|
|
foreach (var itemMaterial in q)
|
|
{
|
|
string code = itemMaterial.MaterialCode;
|
|
|
|
type03List.Add(code);
|
|
count031List.Add((decimal)itemMaterial.TotalDin);
|
|
}
|
|
if (type03List.Count() > 0)
|
|
{
|
|
E06_Type03 = JsonConvert.SerializeObject(type03List);
|
|
E06_Values03 = JsonConvert.SerializeObject(count031List);
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
} |