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 Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -125,9 +126,7 @@ namespace BLL
{
var twPipeMatMatchOutputs = new List<Tw_PipeMatMatchOutput>();
var pipelineModel = PipelineService.GetPipelineByPipelineId(pipelineId);
string warehouseCode = PipelineService
.GetPipeArea().FirstOrDefault(x => x.Value == pipelineModel.PipeArea.ToString())
?.Text;
string warehouseCode = BLL.Base_WarehouseService.GetWarehouseByWarehouseId(PipelineService.GetPipelineByPipelineId(pipelineModel.PipelineId).WarehouseId).WarehouseName;
// 获取所需材料列表
var requiredMaterials = (from x in db.HJGL_PipeLineMat
join y in db.HJGL_MaterialCodeLib on x.MaterialCode equals y.MaterialCode
@@ -152,7 +151,9 @@ namespace BLL
).ToList();
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;
}
}
+2 -2
View File
@@ -750,7 +750,7 @@ namespace BLL
ProjectId = weldTask.ProjectId,
// 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.),
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,
InOutType = (int)TwConst.InOutType.,
TypeInt = (int)TwConst.TypeInt.,
@@ -789,7 +789,7 @@ namespace BLL
Id = Guid.NewGuid().ToString(),
ProjectId = weldTask.ProjectId,
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,
InOutType = (int)TwConst.InOutType.,
TypeInt = (int)TwConst.TypeInt.,
+88
View File
@@ -502,5 +502,93 @@ namespace BLL
return value.ToString();
}
#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
, 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))
{
getDataList = getDataList.Where(e => e.ProjectId == projectId);
@@ -101,7 +104,7 @@ namespace BLL
return null;
}
getDataList = SortConditionHelper.SortingAndPaging(getDataList, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize);
return from x in getDataList
return (from x in getDataList
select new
{
x.HazardRegisterId,
@@ -122,7 +125,7 @@ namespace BLL
x.CheckManName,
x.RegisterDate,
x.StatesStr,
};
}).ToList();
}
#endregion
@@ -19,12 +19,8 @@ namespace BLL
{
get;
set;
}
/// <summary>
/// 定义变量
/// </summary>
private static IQueryable<Model.SitePerson_PersonInOut> getDataLists = from x in Funs.DB.SitePerson_PersonInOut select x;
}
/// <summary>
/// 获取分页列表
@@ -38,7 +34,8 @@ namespace BLL
/// <returns></returns>
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)
{
getDataList = getDataList.Where(e => e.UnitId == unitId);
@@ -17,11 +17,6 @@ namespace BLL
set;
}
/// <summary>
/// 定义变量
/// </summary>
private static IQueryable<Model.SitePerson_PersonItem> getDataLists = from x in Funs.DB.SitePerson_PersonItem select x;
/// <summary>
/// 获取分页列表
/// </summary>
@@ -36,6 +31,8 @@ namespace BLL
/// <returns></returns>
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);
if (!string.IsNullOrEmpty(projectId) && projectId != Const._Null)
{
+4 -1
View File
@@ -30,6 +30,9 @@ namespace BLL
/// <returns></returns>
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);
count = getDataList.Count();
if (count == 0)
@@ -46,7 +49,7 @@ namespace BLL
x.CompilePersonId,
x.CompileTime,
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.ApproveTime,
x.State,