This commit is contained in:
2026-04-04 19:41:27 +08:00
14 changed files with 200 additions and 90 deletions
+5 -4
View File
@@ -1,5 +1,6 @@
using Model; using Model;
using Newtonsoft.Json;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@@ -125,9 +126,7 @@ namespace BLL
{ {
var twPipeMatMatchOutputs = new List<Tw_PipeMatMatchOutput>(); var twPipeMatMatchOutputs = new List<Tw_PipeMatMatchOutput>();
var pipelineModel = PipelineService.GetPipelineByPipelineId(pipelineId); var pipelineModel = PipelineService.GetPipelineByPipelineId(pipelineId);
string warehouseCode = PipelineService string warehouseCode = BLL.Base_WarehouseService.GetWarehouseByWarehouseId(PipelineService.GetPipelineByPipelineId(pipelineModel.PipelineId).WarehouseId).WarehouseName;
.GetPipeArea().FirstOrDefault(x => x.Value == pipelineModel.PipeArea.ToString())
?.Text;
// 获取所需材料列表 // 获取所需材料列表
var requiredMaterials = (from x in db.HJGL_PipeLineMat var requiredMaterials = (from x in db.HJGL_PipeLineMat
join y in db.HJGL_MaterialCodeLib on x.MaterialCode equals y.MaterialCode join y in db.HJGL_MaterialCodeLib on x.MaterialCode equals y.MaterialCode
@@ -152,7 +151,9 @@ namespace BLL
).ToList(); ).ToList();
twPipeMatMatchOutputs = GetMatMatchOutput(requiredMaterials, warehouseCode, pipelineModel.ProjectId); twPipeMatMatchOutputs = GetMatMatchOutput(requiredMaterials, warehouseCode, pipelineModel.ProjectId);
var result = twPipeMatMatchOutputs.Count == 0 ? 0 : twPipeMatMatchOutputs.Sum(x => x.MatchRate) / twPipeMatMatchOutputs.Count; var result = twPipeMatMatchOutputs.Any()
? twPipeMatMatchOutputs.Average(x => x.MatchRate)
: 0;
return result; return result;
} }
} }
+2 -2
View File
@@ -750,7 +750,7 @@ namespace BLL
ProjectId = weldTask.ProjectId, ProjectId = weldTask.ProjectId,
// CusBillCode = string.Format("{0:yyyyMMdd}", DateTime.Now) + UnitService.GetUnitCodeByUnitId(weldTask.UnitId) + "-" + UnitWorkService.getUnitWorkByUnitWorkId(weldTask.UnitWorkId)?.UnitWorkCode + "AP-PF01", // CusBillCode = string.Format("{0:yyyyMMdd}", DateTime.Now) + UnitService.GetUnitCodeByUnitId(weldTask.UnitId) + "-" + UnitWorkService.getUnitWorkByUnitWorkId(weldTask.UnitWorkId)?.UnitWorkCode + "AP-PF01",
CusBillCode = TwInOutplanmasterService.GetCusBillCodeByTaskCode(weldTaskCode, TwConst.TypeInt., TwConst.Category.), CusBillCode = TwInOutplanmasterService.GetCusBillCodeByTaskCode(weldTaskCode, TwConst.TypeInt., TwConst.Category.),
WarehouseCode = PipelineService.GetPipeArea().Where(x => x.Value == PipelineService.GetPipelineByPipelineId(weldTask.PipelineId).PipeArea).Select(x => x.Text).FirstOrDefault(), WarehouseCode = BLL.Base_WarehouseService.GetWarehouseByWarehouseId(PipelineService.GetPipelineByPipelineId(weldTask.PipelineId).WarehouseId).WarehouseName,
Source = 1, Source = 1,
InOutType = (int)TwConst.InOutType., InOutType = (int)TwConst.InOutType.,
TypeInt = (int)TwConst.TypeInt., TypeInt = (int)TwConst.TypeInt.,
@@ -789,7 +789,7 @@ namespace BLL
Id = Guid.NewGuid().ToString(), Id = Guid.NewGuid().ToString(),
ProjectId = weldTask.ProjectId, ProjectId = weldTask.ProjectId,
CusBillCode = TwInOutplanmasterService.GetCusBillCodeByTaskCode(weldTaskCode, TwConst.TypeInt., TwConst.Category.), CusBillCode = TwInOutplanmasterService.GetCusBillCodeByTaskCode(weldTaskCode, TwConst.TypeInt., TwConst.Category.),
WarehouseCode = PipelineService.GetPipeArea().Where(x => x.Value == PipelineService.GetPipelineByPipelineId(weldTask.PipelineId).PipeArea).Select(x => x.Text).FirstOrDefault(), WarehouseCode = BLL.Base_WarehouseService.GetWarehouseByWarehouseId(PipelineService.GetPipelineByPipelineId(weldTask.PipelineId).WarehouseId).WarehouseName,
Source = 1, Source = 1,
InOutType = (int)TwConst.InOutType., InOutType = (int)TwConst.InOutType.,
TypeInt = (int)TwConst.TypeInt., TypeInt = (int)TwConst.TypeInt.,
+88
View File
@@ -502,5 +502,93 @@ namespace BLL
return value.ToString(); return value.ToString();
} }
#endregion #endregion
public static DataTable ExcelToDataTable1(string filePath)
{
var dt = new DataTable();
using (var file = new FileStream(filePath, FileMode.Open, FileAccess.Read))
{
var hssfworkbook = new HSSFWorkbook(file);
var sheet = hssfworkbook.GetSheetAt(0);
var rows = sheet.GetRowEnumerator();
rows.MoveNext();
var row = (HSSFRow)rows.Current;
for (var j = 0; j < row.LastCellNum; j++)
{
var cell = row.GetCell(j);
if (cell != null)
{
dt.Columns.Add(cell.StringCellValue);
}
else
{
dt.Columns.Add("collum" + j);
}
}
while (rows.MoveNext())
{
row = (HSSFRow)rows.Current;
var dr = dt.NewRow();
for (var i = 0; i < row.LastCellNum; i++)
{
var cell = row.GetCell(i);
if (cell == null)
{
dr[i] = null;
}
else
{
try
{
switch (cell.CellType)
{
case CellType.Blank:
//dr[i] = "[null]";
break;
case CellType.Boolean:
dr[i] = cell.BooleanCellValue;
break;
case CellType.Numeric:
dr[i] = cell.ToString();
break;
case CellType.String:
dr[i] = cell.StringCellValue;
break;
case CellType.Error:
dr[i] = cell.ErrorCellValue;
break;
case CellType.Formula:
try
{
dr[i] = cell.NumericCellValue;
}
catch
{
try
{
dr[i] = cell.StringCellValue;
}
catch
{
dr[i] = null;
}
}
break;
default:
dr[i] = "=" + cell.CellFormula;
break;
}
}
catch (Exception ex)
{
}
}
}
dt.Rows.Add(dr);
}
}
return dt;
}
} }
} }
@@ -45,7 +45,10 @@ namespace BLL
public static IEnumerable getListData(string projectId, string checkMan, string type, string workAreaName, string responsibilityUnitName, DateTime? startTime, DateTime? endTime, DateTime? startRectificationTime, DateTime? endRectificationTime public static IEnumerable getListData(string projectId, string checkMan, string type, string workAreaName, string responsibilityUnitName, DateTime? startTime, DateTime? endTime, DateTime? startRectificationTime, DateTime? endRectificationTime
, string states, string personId, string unitId, Grid Grid1) , string states, string personId, string unitId, Grid Grid1)
{ {
IQueryable<Model.View_Hazard_HazardRegisterList> getDataList = getDataLists; var db= Funs.DB;
IQueryable<Model.View_Hazard_HazardRegisterList> getDataList = from x in db.View_Hazard_HazardRegisterList
where x.ProblemTypes == "1"
select x;
if (!string.IsNullOrEmpty(projectId)) if (!string.IsNullOrEmpty(projectId))
{ {
getDataList = getDataList.Where(e => e.ProjectId == projectId); getDataList = getDataList.Where(e => e.ProjectId == projectId);
@@ -101,7 +104,7 @@ namespace BLL
return null; return null;
} }
getDataList = SortConditionHelper.SortingAndPaging(getDataList, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize); getDataList = SortConditionHelper.SortingAndPaging(getDataList, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize);
return from x in getDataList return (from x in getDataList
select new select new
{ {
x.HazardRegisterId, x.HazardRegisterId,
@@ -122,7 +125,7 @@ namespace BLL
x.CheckManName, x.CheckManName,
x.RegisterDate, x.RegisterDate,
x.StatesStr, x.StatesStr,
}; }).ToList();
} }
#endregion #endregion
@@ -21,10 +21,6 @@ namespace BLL
set; set;
} }
/// <summary>
/// 定义变量
/// </summary>
private static IQueryable<Model.SitePerson_PersonInOut> getDataLists = from x in Funs.DB.SitePerson_PersonInOut select x;
/// <summary> /// <summary>
/// 获取分页列表 /// 获取分页列表
@@ -38,7 +34,8 @@ namespace BLL
/// <returns></returns> /// <returns></returns>
public static IEnumerable getListData(string projectId, string unitId, string name, string idCard, string inOutWay, DateTime? startDate, DateTime? endDate, Grid Grid1) public static IEnumerable getListData(string projectId, string unitId, string name, string idCard, string inOutWay, DateTime? startDate, DateTime? endDate, Grid Grid1)
{ {
IQueryable<Model.SitePerson_PersonInOut> getDataList = getDataLists.Where(x => x.ProjectId == projectId && (inOutWay == "0" || x.InOutWay == inOutWay)); IQueryable<Model.SitePerson_PersonInOut> getDataList = from x in Funs.DB.SitePerson_PersonInOut select x;
getDataList = getDataList.Where(x => x.ProjectId == projectId && (inOutWay == "0" || x.InOutWay == inOutWay));
if (!string.IsNullOrEmpty(unitId) && unitId != Const._Null) if (!string.IsNullOrEmpty(unitId) && unitId != Const._Null)
{ {
getDataList = getDataList.Where(e => e.UnitId == unitId); getDataList = getDataList.Where(e => e.UnitId == unitId);
@@ -17,11 +17,6 @@ namespace BLL
set; set;
} }
/// <summary>
/// 定义变量
/// </summary>
private static IQueryable<Model.SitePerson_PersonItem> getDataLists = from x in Funs.DB.SitePerson_PersonItem select x;
/// <summary> /// <summary>
/// 获取分页列表 /// 获取分页列表
/// </summary> /// </summary>
@@ -36,6 +31,8 @@ namespace BLL
/// <returns></returns> /// <returns></returns>
public static IEnumerable getListData(string projectId, string unitId, string personId, string name, string idCard, DateTime? startDate, DateTime? endDate, Grid Grid1) public static IEnumerable getListData(string projectId, string unitId, string personId, string name, string idCard, DateTime? startDate, DateTime? endDate, Grid Grid1)
{ {
Model.SGGLDB db = Funs.DB;
var getDataLists = from x in db.SitePerson_PersonItem select x;
IQueryable<Model.SitePerson_PersonItem> getDataList = getDataLists.Where(e => e.PersonId == personId); IQueryable<Model.SitePerson_PersonItem> getDataList = getDataLists.Where(e => e.PersonId == personId);
if (!string.IsNullOrEmpty(projectId) && projectId != Const._Null) if (!string.IsNullOrEmpty(projectId) && projectId != Const._Null)
{ {
+4 -1
View File
@@ -30,6 +30,9 @@ namespace BLL
/// <returns></returns> /// <returns></returns>
public static IEnumerable getListData(string personId, Grid Grid1) public static IEnumerable getListData(string personId, Grid Grid1)
{ {
Model.SGGLDB db = Funs.DB;
var getDataLists = from x in db.Person_Duty
select x;
IQueryable<Model.Person_Duty> getDataList = getDataLists.Where(x => x.DutyPersonId == personId); IQueryable<Model.Person_Duty> getDataList = getDataLists.Where(x => x.DutyPersonId == personId);
count = getDataList.Count(); count = getDataList.Count();
if (count == 0) if (count == 0)
@@ -46,7 +49,7 @@ namespace BLL
x.CompilePersonId, x.CompilePersonId,
x.CompileTime, x.CompileTime,
x.WorkPostId, x.WorkPostId,
WorkPostName = Funs.DB.Base_WorkPost.First(U => U.WorkPostId == x.WorkPostId).WorkPostName, WorkPostName = db.Base_WorkPost.First(U => U.WorkPostId == x.WorkPostId).WorkPostName,
x.ApprovePersonId, x.ApprovePersonId,
x.ApproveTime, x.ApproveTime,
x.State, x.State,
+20 -9
View File
@@ -280,16 +280,27 @@ namespace FineUIPro.Web.CLGL
} }
string planId = Grid1.SelectedRowID; string planId = Grid1.SelectedRowID;
var planMaster = BLL.TwInOutplanmasterService.GetById(planId); var planMaster = BLL.TwInOutplanmasterService.GetById(planId);
if (planMaster.State != (int)TwConst.State.) switch (planMaster.State)
{ {
Alert.ShowInTop("请选择有效的计划!", MessageBoxIcon.Warning); case (int)TwConst.State.:
return; planMaster.State= (int)TwConst.State.;
} planMaster.AuditMan = null;
else planMaster.AuditDate = null;
{ TwInOutplanmasterService.Update(planMaster);
TwInputmasterService.RevokeGenInMasterByPlanId(planId); BindGrid();
BindGrid(); ShowNotify("撤销审核成功!", MessageBoxIcon.Success);
ShowNotify("撤销入库单成功!", MessageBoxIcon.Success);
break;
case (int)TwConst.State.:
TwInputmasterService.RevokeGenInMasterByPlanId(planId);
BindGrid();
ShowNotify("撤销入库单成功!", MessageBoxIcon.Success);
break;
default:
Alert.ShowInTop("请选择有效的计划!", MessageBoxIcon.Warning);
break;
} }
} }
+4
View File
@@ -17017,7 +17017,11 @@
</COMReference> </COMReference>
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<<<<<<< HEAD
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v17.0\WebApplications\Microsoft.WebApplication.targets" /> <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v17.0\WebApplications\Microsoft.WebApplication.targets" />
=======
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v18.0\WebApplications\Microsoft.WebApplication.targets" />
>>>>>>> 15b3c87ac1c4cf4a496def63cba87a1de5c899b2
<ProjectExtensions> <ProjectExtensions>
<VisualStudio> <VisualStudio>
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}"> <FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
@@ -1316,8 +1316,6 @@ namespace FineUIPro.Web.HJGL.WeldingManage
} }
} }
protected void btnPrintJoint_Click(object sender, EventArgs e) protected void btnPrintJoint_Click(object sender, EventArgs e)
{ {
var rows = Grid1.SelectedRowIndexArray; var rows = Grid1.SelectedRowIndexArray;
@@ -69,6 +69,7 @@
</f:ToolbarFill> </f:ToolbarFill>
<f:HiddenField runat="server" ID="hdRemark"> <f:HiddenField runat="server" ID="hdRemark">
</f:HiddenField> </f:HiddenField>
<%--<f:Button ID="btnPull" runat="server" OnClick="btnPull_Click" ToolTip="获取" Text="获取" > <%--<f:Button ID="btnPull" runat="server" OnClick="btnPull_Click" ToolTip="获取" Text="获取" >
</f:Button>--%> </f:Button>--%>
<f:Button ID="btnNew" Icon="Add" runat="server" OnClick="btnNew_Click" ToolTip="编制" Hidden="true"> <f:Button ID="btnNew" Icon="Add" runat="server" OnClick="btnNew_Click" ToolTip="编制" Hidden="true">
@@ -64,7 +64,7 @@ namespace FineUIPro.Web.HSSE.License
/// </summary> /// </summary>
private void BindGrid() private void BindGrid()
{ {
string strSql = "SELECT LicenseManager.LicenseManagerId,LicenseManager.ProjectId,LicenseManager.LicenseTypeId,CodeRecords.Code AS LicenseManagerCode,LicenseManager.LicenseManageName,LicenseManager.UnitId,LicenseManager.LicenseManageContents,LicenseManager.CompileMan,LicenseManager.CompileDate,LicenseManager.States,LicenseManager.ProjectCode,LicenseManager.ProjectName,LicenseManager.LicenseTypeName,LicenseManager.UnitName,LicenseManager.PersonName,LicenseManager.WorkAreaName,LicenseManager.StartDate,LicenseManager.EndDate" string strSql = "SELECT LicenseManager.LicenseManagerId,LicenseManager.ProjectId,LicenseManager.LicenseTypeId,CodeRecords.Code AS LicenseManagerCode,LicenseManager.LicenseManageName,LicenseManager.UnitId,LicenseManager.LicenseManageContents,LicenseManager.CompileMan,LicenseManager.CompileDate,LicenseManager.States,LicenseManager.ProjectCode,LicenseManager.ProjectName,LicenseManager.LicenseTypeName,LicenseManager.UnitName,LicenseManager.UserName,LicenseManager.WorkAreaName,LicenseManager.StartDate,LicenseManager.EndDate"
+ @" ,(CASE WHEN LicenseManager.States = " + BLL.Const.State_0 + " OR LicenseManager.States IS NULL THEN '待['+OperatePerson.PersonName+']提交' WHEN LicenseManager.States = " + BLL.Const.State_2 + " THEN '审核/审批完成' ELSE '待['+OperatePerson.PersonName+']办理' END) AS FlowOperateName,LicenseManager.SourceDes" + @" ,(CASE WHEN LicenseManager.States = " + BLL.Const.State_0 + " OR LicenseManager.States IS NULL THEN '待['+OperatePerson.PersonName+']提交' WHEN LicenseManager.States = " + BLL.Const.State_2 + " THEN '审核/审批完成' ELSE '待['+OperatePerson.PersonName+']办理' END) AS FlowOperateName,LicenseManager.SourceDes"
+ @" FROM View_License_LicenseManager AS LicenseManager " + @" FROM View_License_LicenseManager AS LicenseManager "
+ @" LEFT JOIN Sys_CodeRecords AS CodeRecords ON LicenseManager.LicenseManagerId=CodeRecords.DataId " + @" LEFT JOIN Sys_CodeRecords AS CodeRecords ON LicenseManager.LicenseManagerId=CodeRecords.DataId "
@@ -120,35 +120,38 @@ namespace FineUIPro.Web.HSSE.SitePerson
{ {
try try
{ {
string oleDBConnString = String.Empty; //string oleDBConnString = String.Empty;
oleDBConnString = "Provider=Microsoft.Jet.OLEDB.4.0;"; //oleDBConnString = "Provider=Microsoft.Jet.OLEDB.4.0;";
oleDBConnString += "Data Source="; //oleDBConnString += "Data Source=";
oleDBConnString += fileName; //oleDBConnString += fileName;
oleDBConnString += ";Extended Properties=Excel 8.0;"; //oleDBConnString += ";Extended Properties=Excel 8.0;";
OleDbConnection oleDBConn = null; //OleDbConnection oleDBConn = null;
OleDbDataAdapter oleAdMaster = null; //OleDbDataAdapter oleAdMaster = null;
DataTable m_tableName = new DataTable(); //DataTable m_tableName = new DataTable();
DataSet ds = new DataSet(); //DataSet ds = new DataSet();
oleDBConn = new OleDbConnection(oleDBConnString); //oleDBConn = new OleDbConnection(oleDBConnString);
oleDBConn.Open(); //oleDBConn.Open();
m_tableName = oleDBConn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null); //m_tableName = oleDBConn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);
if (m_tableName != null && m_tableName.Rows.Count > 0) //if (m_tableName != null && m_tableName.Rows.Count > 0)
{ //{
m_tableName.TableName = m_tableName.Rows[0]["TABLE_NAME"].ToString().Trim(); // m_tableName.TableName = m_tableName.Rows[0]["TABLE_NAME"].ToString().Trim();
} //}
string sqlMaster; //string sqlMaster;
sqlMaster = " SELECT * FROM [" + m_tableName.TableName + "]"; //sqlMaster = " SELECT * FROM [" + m_tableName.TableName + "]";
oleAdMaster = new OleDbDataAdapter(sqlMaster, oleDBConn); //oleAdMaster = new OleDbDataAdapter(sqlMaster, oleDBConn);
oleAdMaster.Fill(ds, "m_tableName"); //oleAdMaster.Fill(ds, "m_tableName");
oleAdMaster.Dispose(); //oleAdMaster.Dispose();
oleDBConn.Close(); //oleDBConn.Close();
oleDBConn.Dispose(); //oleDBConn.Dispose();
AddDatasetToSQL(ds.Tables[0]); //AddDatasetToSQL(ds.Tables[0]);
DataTable dt = NPOIHelper.ExcelToDataTable1(fileName);
this.AddDatasetToSQL(dt);
} }
catch (Exception ex) catch (Exception ex)
{ {
@@ -304,33 +307,35 @@ namespace FineUIPro.Web.HSSE.SitePerson
{ {
try try
{ {
string oleDBConnString = String.Empty; //string oleDBConnString = String.Empty;
oleDBConnString = "Provider=Microsoft.Jet.OLEDB.4.0;"; //oleDBConnString = "Provider=Microsoft.Jet.OLEDB.4.0;";
oleDBConnString += "Data Source="; //oleDBConnString += "Data Source=";
oleDBConnString += fileName; //oleDBConnString += fileName;
oleDBConnString += ";Extended Properties=Excel 8.0;"; //oleDBConnString += ";Extended Properties=Excel 8.0;";
OleDbConnection oleDBConn = null; //OleDbConnection oleDBConn = null;
OleDbDataAdapter oleAdMaster = null; //OleDbDataAdapter oleAdMaster = null;
DataTable m_tableName = new DataTable(); //DataTable m_tableName = new DataTable();
DataSet ds = new DataSet(); //DataSet ds = new DataSet();
oleDBConn = new OleDbConnection(oleDBConnString); //oleDBConn = new OleDbConnection(oleDBConnString);
oleDBConn.Open(); //oleDBConn.Open();
m_tableName = oleDBConn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null); //m_tableName = oleDBConn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);
if (m_tableName != null && m_tableName.Rows.Count > 0) //if (m_tableName != null && m_tableName.Rows.Count > 0)
{ //{
m_tableName.TableName = m_tableName.Rows[0]["TABLE_NAME"].ToString().Trim(); // m_tableName.TableName = m_tableName.Rows[0]["TABLE_NAME"].ToString().Trim();
} //}
string sqlMaster = " SELECT * FROM [" + m_tableName.TableName + "]"; //string sqlMaster = " SELECT * FROM [" + m_tableName.TableName + "]";
oleAdMaster = new OleDbDataAdapter(sqlMaster, oleDBConn); //oleAdMaster = new OleDbDataAdapter(sqlMaster, oleDBConn);
oleAdMaster.Fill(ds, "m_tableName"); //oleAdMaster.Fill(ds, "m_tableName");
oleAdMaster.Dispose(); //oleAdMaster.Dispose();
oleDBConn.Close(); //oleDBConn.Close();
oleDBConn.Dispose(); //oleDBConn.Dispose();
AddDatasetToSQL2(ds.Tables[0]); DataTable dt = NPOIHelper.ExcelToDataTable1(fileName);
this.AddDatasetToSQL2(dt);
} }
catch (Exception ex) catch (Exception ex)
{ {
@@ -51,11 +51,11 @@ namespace FineUIPro.Web.common
this.tvControlItem.Nodes.Add(rootNode2); this.tvControlItem.Nodes.Add(rootNode2);
// 优化:一次性获取所有管线统计数据,避免 N+1 查询 // 优化:一次性获取所有管线统计数据,避免 N+1 查询
var pipelineCountByUnitWork = (from x in Funs.DB.HJGL_Pipeline var pipelineCountByUnitWork = (from x in Funs.DB.View_HJGL_Pipeline
where x.ProjectId == this.CurrUser.LoginProjectId where x.ProjectId == this.CurrUser.LoginProjectId
group x by x.UnitWorkId into g group x by x.UnitWorkId into g
select new { UnitWorkId = g.Key, Count = g.Count() }) select new { UnitWorkId = g.Key, Count = g.Count(), TotalDin = g.Sum(x => x.TotalDin) })
.ToDictionary(x => x.UnitWorkId, x => x.Count); .ToDictionary(x => x.UnitWorkId, x => new { x.Count, x.TotalDin });
var pUnits = (from x in Funs.DB.Project_ProjectUnit where x.ProjectId == this.CurrUser.LoginProjectId select x).ToList(); var pUnits = (from x in Funs.DB.Project_ProjectUnit where x.ProjectId == this.CurrUser.LoginProjectId select x).ToList();
// 获取当前用户所在单位 // 获取当前用户所在单位
@@ -77,11 +77,11 @@ namespace FineUIPro.Web.common
foreach (var q in unitWork1) foreach (var q in unitWork1)
{ {
// 优化:从内存字典中获取管线数量,避免数据库查询 // 优化:从内存字典中获取管线数量,避免数据库查询
int a = pipelineCountByUnitWork.ContainsKey(q.UnitWorkId) ? pipelineCountByUnitWork[q.UnitWorkId] : 0; int a = pipelineCountByUnitWork.ContainsKey(q.UnitWorkId) ? pipelineCountByUnitWork[q.UnitWorkId].Count : 0;
var unitNamesUnitIds = BLL.UnitService.getUnitNamesUnitIds(q.UnitId); var unitNamesUnitIds = BLL.UnitService.getUnitNamesUnitIds(q.UnitId);
TreeNode tn1 = new TreeNode(); TreeNode tn1 = new TreeNode();
tn1.NodeID = q.UnitWorkId; tn1.NodeID = q.UnitWorkId;
tn1.Text = q.UnitWorkName + "【" + a.ToString() + "】" + "管线"; tn1.Text = q.UnitWorkName + "【" + a.ToString() + "】" + "管线" ;
tn1.ToolTip = "施工单位:" + unitNamesUnitIds; tn1.ToolTip = "施工单位:" + unitNamesUnitIds;
tn1.EnableClickEvent = true; tn1.EnableClickEvent = true;
rootNode1.Nodes.Add(tn1); rootNode1.Nodes.Add(tn1);
@@ -92,11 +92,11 @@ namespace FineUIPro.Web.common
foreach (var q in unitWork2) foreach (var q in unitWork2)
{ {
// 优化:从内存字典中获取管线数量,避免数据库查询 // 优化:从内存字典中获取管线数量,避免数据库查询
int a = pipelineCountByUnitWork.ContainsKey(q.UnitWorkId) ? pipelineCountByUnitWork[q.UnitWorkId] : 0; int a = pipelineCountByUnitWork.ContainsKey(q.UnitWorkId) ? pipelineCountByUnitWork[q.UnitWorkId].Count : 0;
var unitNamesUnitIds = BLL.UnitService.getUnitNamesUnitIds(q.UnitId); var unitNamesUnitIds = BLL.UnitService.getUnitNamesUnitIds(q.UnitId);
TreeNode tn2 = new TreeNode(); TreeNode tn2 = new TreeNode();
tn2.NodeID = q.UnitWorkId; tn2.NodeID = q.UnitWorkId;
tn2.Text = q.UnitWorkName + "【" + a.ToString() + "】" + "管线"; tn2.Text = q.UnitWorkName + "【" + a.ToString() + "】" + "管线" ;
tn2.ToolTip = "施工单位:" + unitNamesUnitIds; tn2.ToolTip = "施工单位:" + unitNamesUnitIds;
tn2.EnableClickEvent = true; tn2.EnableClickEvent = true;
rootNode2.Nodes.Add(tn2); rootNode2.Nodes.Add(tn2);
@@ -257,6 +257,7 @@ JointData AS (
j.Size, j.Size,
j.WeldingDailyId, j.WeldingDailyId,
j.JointAttribute, j.JointAttribute,
j.PipelineId,
p.PipeArea, p.PipeArea,
p.UnitWorkId p.UnitWorkId
FROM dbo.HJGL_WeldJoint j FROM dbo.HJGL_WeldJoint j
@@ -323,6 +324,7 @@ JointData AS (
j.Size, j.Size,
j.WeldingDailyId, j.WeldingDailyId,
j.JointAttribute, j.JointAttribute,
j.PipelineId,
p.PipeArea, p.PipeArea,
p.UnitWorkId p.UnitWorkId
FROM dbo.HJGL_WeldJoint j FROM dbo.HJGL_WeldJoint j