焊接管理导入修改
This commit is contained in:
@@ -0,0 +1,103 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ALTER VIEW [dbo].[View_HJGL_InstallData]
|
||||||
|
AS
|
||||||
|
WITH TwOutPutData as (select distinct twRelation.PipelineId,
|
||||||
|
outdetail.Id as TwOutputDetailId,
|
||||||
|
twRelation.MaterialCode,
|
||||||
|
master.Id as OutputMasterId,
|
||||||
|
LEFT(planmaster.WeldTaskId, CHARINDEX('|', planmaster.WeldTaskId + '|') - 1) AS unitworkid
|
||||||
|
from Tw_OutputMaster master
|
||||||
|
join Tw_OutputDetail outdetail on outdetail.OutputMasterId = master.Id
|
||||||
|
join Tw_InOutPlanMaster planmaster on planmaster.Id = master.InOutPlanMasterId
|
||||||
|
join Tw_InOutPlanDetail_Relation twRelation
|
||||||
|
on twRelation.InOutPlanMasterId = planmaster.Id and
|
||||||
|
outdetail.MaterialCode = twRelation.MaterialCode
|
||||||
|
where master.TypeInt=70),
|
||||||
|
packdetailDate as (
|
||||||
|
select
|
||||||
|
packdetail.Id,
|
||||||
|
packdetail.PipelineComponentId,
|
||||||
|
pack.TrainNumberId,
|
||||||
|
pack.PackagingCode,
|
||||||
|
pack.StackingPosition,
|
||||||
|
pack.ProjectId,
|
||||||
|
packdetail.MaterialCode,
|
||||||
|
packdetail.Number,
|
||||||
|
packdetail.TwOutputDetailId
|
||||||
|
from HJGL_PackagingManageDetail packdetail
|
||||||
|
join HJGL_PackagingManage pack ON packdetail.PackagingManageId = pack.PackagingManageId
|
||||||
|
),
|
||||||
|
PrefabricatedData AS (SELECT pipe.PrefabricatedComponents as Id,
|
||||||
|
line.PipelineCode,
|
||||||
|
pipe.PrefabricatedComponents as Code,
|
||||||
|
'预制组件' as TypeStr,
|
||||||
|
'' as Matdef,
|
||||||
|
CAST(NULL AS DECIMAL(18, 2)) as Number, -- 明确指定数据类型
|
||||||
|
CAST(NULL AS DECIMAL(18, 2)) as ActNumber, -- 实到数量
|
||||||
|
pack.PackagingCode,
|
||||||
|
trainnumber.TrainNumber,
|
||||||
|
line.FlowingSection,
|
||||||
|
line.UnitWorkId,
|
||||||
|
line.ProjectId,
|
||||||
|
pack.StackingPosition
|
||||||
|
FROM dbo.HJGL_PipeLineMat pipe
|
||||||
|
INNER JOIN dbo.HJGL_Pipeline line -- 改为INNER JOIN,如果管道必须存在
|
||||||
|
ON pipe.PipelineId = line.PipelineId
|
||||||
|
LEFT JOIN dbo.HJGL_MaterialCodeLib lib
|
||||||
|
ON lib.MaterialCode = pipe.MaterialCode
|
||||||
|
LEFT JOIN HJGL_Pipeline_Component comonent
|
||||||
|
ON comonent.PipelineComponentCode = pipe.PrefabricatedComponents
|
||||||
|
LEFT JOIN HJGL_PackagingManageDetail packdetail
|
||||||
|
ON packdetail.PipelineComponentId = comonent.PipelineComponentId
|
||||||
|
LEFT JOIN HJGL_PackagingManage pack
|
||||||
|
ON packdetail.PackagingManageId = pack.PackagingManageId
|
||||||
|
AND pack.ProjectId = line.ProjectId -- 添加项目关联条件
|
||||||
|
LEFT JOIN HJGL_TrainNumberManage trainnumber
|
||||||
|
ON pack.TrainNumberId = trainnumber.Id
|
||||||
|
WHERE line.PipeArea = '1'
|
||||||
|
and (pipe.PrefabricatedComponents != ''
|
||||||
|
AND pipe.PrefabricatedComponents IS NOT NULL and pipe.PrefabricatedComponents not in('裕-量'))),
|
||||||
|
LooseComponentsData AS (SELECT distinct pipe.PipeLineMatId as Id,
|
||||||
|
line.PipelineCode,
|
||||||
|
pipe.MaterialCode as Code,
|
||||||
|
'预制散件' as TypeStr,
|
||||||
|
lib.MaterialDef as Matdef,
|
||||||
|
cast( packdetail.Number as DECIMAL(18, 2)) as Number,
|
||||||
|
cast( packdetail.Number as DECIMAL(18, 2)) as ActNumber,
|
||||||
|
packdetail.PackagingCode,
|
||||||
|
trainnumber.TrainNumber,
|
||||||
|
line.FlowingSection,
|
||||||
|
line.UnitWorkId,
|
||||||
|
line.ProjectId,
|
||||||
|
packdetail.StackingPosition
|
||||||
|
FROM dbo.HJGL_PipeLineMat pipe
|
||||||
|
INNER JOIN HJGL_Pipeline line -- 改为INNER JOIN
|
||||||
|
ON pipe.PipelineId = line.PipelineId
|
||||||
|
LEFT JOIN dbo.HJGL_MaterialCodeLib lib
|
||||||
|
ON lib.MaterialCode = pipe.MaterialCode
|
||||||
|
LEFT JOIN TwOutPutData twOutPutData
|
||||||
|
ON twOutPutData.PipelineId = pipe.PipelineId and
|
||||||
|
twOutPutData.MaterialCode = pipe.MaterialCode and
|
||||||
|
twOutPutData.unitworkid =line.UnitWorkId
|
||||||
|
LEFT JOIN packdetailDate packdetail
|
||||||
|
ON packdetail.TwOutputDetailId = twOutPutData.TwOutputDetailId and packdetail.ProjectId= line.ProjectId
|
||||||
|
LEFT JOIN HJGL_TrainNumberManage trainnumber
|
||||||
|
ON packdetail.TrainNumberId = trainnumber.Id
|
||||||
|
where line.PipeArea = '1'
|
||||||
|
and (pipe.PrefabricatedComponents is null or pipe.PrefabricatedComponents = '') )
|
||||||
|
|
||||||
|
-- 合并结果
|
||||||
|
SELECT distinct *
|
||||||
|
FROM PrefabricatedData
|
||||||
|
UNION ALL
|
||||||
|
SELECT distinct *
|
||||||
|
FROM LooseComponentsData
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
GO
|
||||||
|
|
||||||
|
|
||||||
@@ -287,8 +287,8 @@ namespace BLL
|
|||||||
{
|
{
|
||||||
// 从子表HJGL_PackagingManageDetail中获取关联的组件ID
|
// 从子表HJGL_PackagingManageDetail中获取关联的组件ID
|
||||||
var PipelineComponentIdList = (from x in Funs.DB.HJGL_PackagingManageDetail
|
var PipelineComponentIdList = (from x in Funs.DB.HJGL_PackagingManageDetail
|
||||||
where x.PackagingManageId == PackagingManageId
|
where x.PackagingManageId == PackagingManageId
|
||||||
select x.PipelineComponentId).ToList();
|
select x.PipelineComponentId).ToList();
|
||||||
if (PipelineComponentIdList == null || PipelineComponentIdList.Count == 0)
|
if (PipelineComponentIdList == null || PipelineComponentIdList.Count == 0)
|
||||||
return new List<Model.PackagingManagePrintOutput>();
|
return new List<Model.PackagingManagePrintOutput>();
|
||||||
|
|
||||||
@@ -322,7 +322,7 @@ namespace BLL
|
|||||||
PipelineComponentCode = x.MaterialCode,
|
PipelineComponentCode = x.MaterialCode,
|
||||||
num = x.Number.ToString(),
|
num = x.Number.ToString(),
|
||||||
CU = x.MaterialUnit,
|
CU = x.MaterialUnit,
|
||||||
UnitWorkName = UnitWorkService.GetNameById( TwOutputdetailService.GetInOutMasterById(x.TwOutputDetailId)?.UnitWorkId ),
|
UnitWorkName = UnitWorkService.GetNameById(TwOutputdetailService.GetInOutMasterById(x.TwOutputDetailId)?.UnitWorkId),
|
||||||
FlowingSection = model.StackingPosition,
|
FlowingSection = model.StackingPosition,
|
||||||
};
|
};
|
||||||
result = detailList.ToList();
|
result = detailList.ToList();
|
||||||
@@ -421,54 +421,85 @@ namespace BLL
|
|||||||
return q;
|
return q;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static (List<PackagingManageOutput> Data, int Total) GetPackagingManageList(string projectId, string PackagingCode, int pageIndex = 0, int pageSize = 20)
|
public static (List<PackagingManageOutput> Data, int Total) GetPackagingManageList(string projectId, string PackagingCode, int pageIndex = 0, int pageSize = 20)
|
||||||
{
|
{
|
||||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||||
{
|
{
|
||||||
var baseQuery = (from x in db.HJGL_PackagingManage
|
var filteredQuery = from x in db.HJGL_PackagingManage
|
||||||
join n in db.Base_Project on x.ProjectId equals n.ProjectId
|
join p in db.Person_Persons
|
||||||
join m in db.Person_Persons on x.ReceiveMan equals m.PersonId into tt
|
on x.CompileMan equals p.PersonId into personGroup
|
||||||
from t in tt.DefaultIfEmpty()
|
from p in personGroup.DefaultIfEmpty()
|
||||||
join train in db.HJGL_TrainNumberManage on x.TrainNumberId equals train.Id into trains
|
join u in db.Base_Unit
|
||||||
|
on p.UnitId equals u.UnitId into unitGroup
|
||||||
|
from u in unitGroup.DefaultIfEmpty()
|
||||||
|
where x.ProjectId == projectId
|
||||||
|
&& (string.IsNullOrEmpty(PackagingCode) || x.PackagingCode.Contains(PackagingCode))
|
||||||
|
select new { x, u };
|
||||||
|
|
||||||
|
// 获取总记录数(延迟计数优化)
|
||||||
|
var totalCount = filteredQuery.Count();
|
||||||
|
var pagedData = (from z in filteredQuery
|
||||||
|
join n in db.Base_Project on z.x.ProjectId equals n.ProjectId
|
||||||
|
join train in db.HJGL_TrainNumberManage on z.x.TrainNumberId equals train.Id into trains
|
||||||
from train in trains.DefaultIfEmpty()
|
from train in trains.DefaultIfEmpty()
|
||||||
where x.ProjectId == projectId
|
orderby z.x.PackagingCode descending
|
||||||
&& (string.IsNullOrEmpty(PackagingCode) || x.PackagingCode.Contains(PackagingCode))
|
|
||||||
select new PackagingManageOutput
|
select new PackagingManageOutput
|
||||||
{
|
{
|
||||||
PackagingManageId = x.PackagingManageId,
|
PackagingManageId = z.x.PackagingManageId,
|
||||||
PackagingCode = x.PackagingCode,
|
PackagingCode = z.x.PackagingCode,
|
||||||
ProjectName = n.ProjectName,
|
ProjectName = n.ProjectName,
|
||||||
ContactName = train.ContactName,
|
ContactName = train.ContactName,
|
||||||
ContactPhone = train.ContactPhone,
|
ContactPhone = train.ContactPhone,
|
||||||
DriverName = train.DriverName,
|
DriverName = train.DriverName,
|
||||||
DriverPhone = train.DriverPhone,
|
DriverPhone = train.DriverPhone,
|
||||||
LicensePlateNumber = train.LicensePlateNumber,
|
LicensePlateNumber = train.LicensePlateNumber,
|
||||||
StackingPosition = x.StackingPosition,
|
StackingPosition = z.x.StackingPosition,
|
||||||
State = x.State,
|
State = z.x.State,
|
||||||
TypeInt = x.TypeInt,
|
TypeInt = z.x.TypeInt,
|
||||||
CategoryInt = x.CategoryInt,
|
CategoryInt = z.x.CategoryInt,
|
||||||
TypeString = GetTypeString(x.TypeInt),
|
TypeString = GetTypeString(z.x.TypeInt),
|
||||||
CategoryString = GetCategoryString(x.CategoryInt),
|
CategoryString = GetCategoryString(z.x.CategoryInt),
|
||||||
ReceiveMan = train.ContactName,//t.PersonName,
|
ReceiveMan = train.ContactName,
|
||||||
ReceiveDate = x.ReceiveDate.HasValue ? string.Format("{0:g}", x.ReceiveDate) : "",
|
ReceiveDate = z.x.ReceiveDate.HasValue ? string.Format("{0:g}", z.x.ReceiveDate) : "",
|
||||||
PlanStartDate = GetMinPlanStartDate(x.PackagingManageId),
|
TrainNumberOld = z.x.TrainNumber,
|
||||||
TrainNumberOld = x.TrainNumber,
|
|
||||||
TrainNumber = train.TrainNumber,
|
TrainNumber = train.TrainNumber,
|
||||||
Code = x.PackagingCode.Substring(0, x.PackagingCode.LastIndexOf("-")).Substring(x.PackagingCode.Substring(0, x.PackagingCode.LastIndexOf("-")).LastIndexOf("-") + 1),
|
})
|
||||||
}).Distinct();
|
.Skip(pageIndex * pageSize)
|
||||||
|
.Take(pageSize)
|
||||||
|
.ToList();
|
||||||
|
|
||||||
var pagedData = baseQuery
|
foreach (var item in pagedData)
|
||||||
.OrderByDescending(x => x.Code)
|
{
|
||||||
.Skip((pageIndex) * pageSize)
|
item.Code = GetPackagingCodeSortPart(item.PackagingCode);
|
||||||
.Take(pageSize)
|
}
|
||||||
.ToList();
|
|
||||||
|
|
||||||
// 获取总记录数(延迟计数优化)
|
|
||||||
var totalCount = baseQuery.Count();
|
|
||||||
return (pagedData, totalCount);
|
return (pagedData, totalCount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static string GetPackagingCodeSortPart(string packagingCode)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(packagingCode))
|
||||||
|
{
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
var lastIndex = packagingCode.LastIndexOf("-");
|
||||||
|
if (lastIndex <= 0)
|
||||||
|
{
|
||||||
|
return packagingCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
var beforeLast = packagingCode.Substring(0, lastIndex);
|
||||||
|
var secondLastIndex = beforeLast.LastIndexOf("-");
|
||||||
|
if (secondLastIndex < 0 || secondLastIndex >= beforeLast.Length - 1)
|
||||||
|
{
|
||||||
|
return beforeLast;
|
||||||
|
}
|
||||||
|
|
||||||
|
return beforeLast.Substring(secondLastIndex + 1);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取包装管理列表(带过滤条件)
|
/// 获取包装管理列表(带过滤条件)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -486,9 +517,15 @@ namespace BLL
|
|||||||
join n in db.Base_Project on x.ProjectId equals n.ProjectId
|
join n in db.Base_Project on x.ProjectId equals n.ProjectId
|
||||||
join m in db.Person_Persons on x.ReceiveMan equals m.PersonId into tt
|
join m in db.Person_Persons on x.ReceiveMan equals m.PersonId into tt
|
||||||
from t in tt.DefaultIfEmpty()
|
from t in tt.DefaultIfEmpty()
|
||||||
join train in db.HJGL_TrainNumberManage on x.TrainNumberId equals train.Id into trains
|
join p in db.Person_Persons
|
||||||
from train in trains.DefaultIfEmpty()
|
on x.CompileMan equals p.PersonId into personGroup
|
||||||
select new { x, n, t , train };
|
from p in personGroup.DefaultIfEmpty() // 实现 Left Join
|
||||||
|
join u in db.Base_Unit
|
||||||
|
on p.UnitId equals u.UnitId into unitGroup
|
||||||
|
from u in unitGroup.DefaultIfEmpty() // 实现 Left Join
|
||||||
|
join train in db.HJGL_TrainNumberManage on x.TrainNumberId equals train.Id into trains
|
||||||
|
from train in trains.DefaultIfEmpty()
|
||||||
|
select new { x, n, t, u.UnitId, u.UnitName, train };
|
||||||
|
|
||||||
if (filter != null)
|
if (filter != null)
|
||||||
{
|
{
|
||||||
@@ -499,7 +536,7 @@ namespace BLL
|
|||||||
if (!string.IsNullOrEmpty(filter.PackagingCode))
|
if (!string.IsNullOrEmpty(filter.PackagingCode))
|
||||||
{
|
{
|
||||||
baseQuery = baseQuery.Where(z => z.x.PackagingCode.Contains(filter.PackagingCode));
|
baseQuery = baseQuery.Where(z => z.x.PackagingCode.Contains(filter.PackagingCode));
|
||||||
}
|
}
|
||||||
if (!string.IsNullOrEmpty(filter.ProjectId))
|
if (!string.IsNullOrEmpty(filter.ProjectId))
|
||||||
{
|
{
|
||||||
baseQuery = baseQuery.Where(z => z.x.ProjectId == filter.ProjectId);
|
baseQuery = baseQuery.Where(z => z.x.ProjectId == filter.ProjectId);
|
||||||
@@ -574,7 +611,7 @@ namespace BLL
|
|||||||
ReceiveDate = string.Format("{0:g}", z.x.ReceiveDate),
|
ReceiveDate = string.Format("{0:g}", z.x.ReceiveDate),
|
||||||
TrainNumber = z.train.TrainNumber,
|
TrainNumber = z.train.TrainNumber,
|
||||||
ComponentCount = db.HJGL_PackagingManageDetail.Count(d => d.PackagingManageId == z.x.PackagingManageId),
|
ComponentCount = db.HJGL_PackagingManageDetail.Count(d => d.PackagingManageId == z.x.PackagingManageId),
|
||||||
CategoryInt = z.x.CategoryInt,
|
CategoryInt = z.x.CategoryInt,
|
||||||
CategoryString = z.x.CategoryInt == 10 ? "打捆" : (z.x.CategoryInt == 20 ? "装箱" : (z.x.CategoryInt == 30 ? "散装" : ""))
|
CategoryString = z.x.CategoryInt == 10 ? "打捆" : (z.x.CategoryInt == 20 ? "装箱" : (z.x.CategoryInt == 30 ? "散装" : ""))
|
||||||
}).Distinct();
|
}).Distinct();
|
||||||
|
|
||||||
@@ -626,8 +663,8 @@ namespace BLL
|
|||||||
{
|
{
|
||||||
// 获取现有的组件ID列表
|
// 获取现有的组件ID列表
|
||||||
var existingComponentIds = (from x in db.HJGL_PackagingManageDetail
|
var existingComponentIds = (from x in db.HJGL_PackagingManageDetail
|
||||||
where x.PackagingManageId == packagingManageId
|
where x.PackagingManageId == packagingManageId
|
||||||
select x.PipelineComponentId).ToList();
|
select x.PipelineComponentId).ToList();
|
||||||
|
|
||||||
// 合并新旧组件ID(去重)
|
// 合并新旧组件ID(去重)
|
||||||
HashSet<string> allComponentIds = new HashSet<string>(existingComponentIds);
|
HashSet<string> allComponentIds = new HashSet<string>(existingComponentIds);
|
||||||
@@ -696,7 +733,7 @@ namespace BLL
|
|||||||
}
|
}
|
||||||
|
|
||||||
var existDetail = (from detail in Funs.DB.HJGL_PackagingManageDetail
|
var existDetail = (from detail in Funs.DB.HJGL_PackagingManageDetail
|
||||||
join pack in Funs.DB.HJGL_PackagingManage on detail.PackagingManageId equals pack.PackagingManageId
|
join pack in Funs.DB.HJGL_PackagingManage on detail.PackagingManageId equals pack.PackagingManageId
|
||||||
where detail.PipelineComponentId == pipelineComponentId
|
where detail.PipelineComponentId == pipelineComponentId
|
||||||
select new
|
select new
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -111,7 +111,11 @@
|
|||||||
TextAlign="Left">
|
TextAlign="Left">
|
||||||
</f:RenderField>
|
</f:RenderField>
|
||||||
<f:RenderField Width="80px" ColumnID="Number" DataField="Number"
|
<f:RenderField Width="80px" ColumnID="Number" DataField="Number"
|
||||||
FieldType="String" HeaderText="数量" HeaderTextAlign="Center"
|
FieldType="String" HeaderText="所需数量" HeaderTextAlign="Center"
|
||||||
|
TextAlign="Left">
|
||||||
|
</f:RenderField>
|
||||||
|
<f:RenderField Width="80px" ColumnID="ActNumber" DataField="ActNumber"
|
||||||
|
FieldType="String" HeaderText="实到数量" HeaderTextAlign="Center"
|
||||||
TextAlign="Left">
|
TextAlign="Left">
|
||||||
</f:RenderField>
|
</f:RenderField>
|
||||||
<f:RenderField Width="150px" ColumnID="PackagingCode" DataField="PackagingCode"
|
<f:RenderField Width="150px" ColumnID="PackagingCode" DataField="PackagingCode"
|
||||||
@@ -153,9 +157,9 @@
|
|||||||
</form>
|
</form>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
function reloadGrid() {
|
function reloadGrid() {
|
||||||
__doPostBack(null, 'reloadGrid');
|
__doPostBack(null, 'reloadGrid');
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -213,8 +213,8 @@ namespace FineUIPro.Web.HJGL.PreDesign
|
|||||||
private void BindGrid()
|
private void BindGrid()
|
||||||
{
|
{
|
||||||
if (tvControlItem.SelectedNode == null) return;
|
if (tvControlItem.SelectedNode == null) return;
|
||||||
var view_HJGL_InstallDatas = BindData(Grid1.PageIndex+1, Grid1.PageSize,out int totalCount, out int componentCount, out int partCount);
|
var view_HJGL_InstallDatas = BindData(Grid1.PageIndex + 1, Grid1.PageSize, out int totalCount, out int componentCount, out int partCount);
|
||||||
// 2.获取当前分页数据
|
// 2.获取当前分页数据
|
||||||
Grid1.RecordCount = totalCount;
|
Grid1.RecordCount = totalCount;
|
||||||
var table = view_HJGL_InstallDatas;
|
var table = view_HJGL_InstallDatas;
|
||||||
Grid1.DataSource = table;
|
Grid1.DataSource = table;
|
||||||
@@ -247,33 +247,34 @@ namespace FineUIPro.Web.HJGL.PreDesign
|
|||||||
/// 查询数据
|
/// 查询数据
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private List<View_HJGL_InstallData> BindData(int pageIndex, int pageSize, out int totalCount, out int componentCount, out int partCount)
|
private List<View_HJGL_InstallData> BindData(int pageIndex, int pageSize, out int totalCount, out int componentCount, out int partCount)
|
||||||
{
|
{
|
||||||
var baseQuery = GetIQueryableInstallDatas();
|
var baseQuery = GetIQueryableInstallDatas();
|
||||||
|
|
||||||
// 一次性统计所有需要的数据(使用 GroupBy 优化)
|
// 一次性统计所有需要的数据(使用 GroupBy 优化)
|
||||||
var stats = baseQuery
|
var stats = baseQuery
|
||||||
.GroupBy(x => x.TypeStr)
|
.GroupBy(x => x.TypeStr)
|
||||||
.Select(g => new { TypeStr = g.Key, Count = g.Count() })
|
.Select(g => new { TypeStr = g.Key, Count = g.Count() })
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
// 从统计结果中提取数据
|
// 从统计结果中提取数据
|
||||||
totalCount = stats.Sum(s => s.Count);
|
totalCount = stats.Sum(s => s.Count);
|
||||||
componentCount = stats.FirstOrDefault(s => s.TypeStr == "预制组件")?.Count ?? 0;
|
componentCount = stats.FirstOrDefault(s => s.TypeStr == "预制组件")?.Count ?? 0;
|
||||||
partCount = stats.FirstOrDefault(s => s.TypeStr == "预制散件")?.Count ?? 0;
|
partCount = stats.FirstOrDefault(s => s.TypeStr == "预制散件")?.Count ?? 0;
|
||||||
|
|
||||||
// 分页保护
|
// 分页保护
|
||||||
if (pageIndex <= 0) pageIndex = 1;
|
if (pageIndex <= 0) pageIndex = 1;
|
||||||
if (pageSize <= 0) pageSize = 10;
|
if (pageSize <= 0) pageSize = 10;
|
||||||
|
|
||||||
var query = baseQuery.Skip((pageIndex - 1) * pageSize).Take(pageSize).ToList();
|
var query = baseQuery.Skip((pageIndex - 1) * pageSize).Take(pageSize).ToList();
|
||||||
|
|
||||||
// 预制组件数量显示为1,预制散件保持原始数量
|
// 预制组件数量显示为1,预制散件保持原始数量
|
||||||
foreach (var item in query)
|
foreach (var item in query)
|
||||||
{
|
{
|
||||||
if (item.TypeStr == "预制组件")
|
if (item.TypeStr == "预制组件")
|
||||||
{
|
{
|
||||||
item.Number = 1;
|
item.Number = 1;
|
||||||
|
item.ActNumber = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return query;
|
return query;
|
||||||
@@ -281,9 +282,9 @@ namespace FineUIPro.Web.HJGL.PreDesign
|
|||||||
|
|
||||||
|
|
||||||
private IQueryable<View_HJGL_InstallData> GetIQueryableInstallDatas()
|
private IQueryable<View_HJGL_InstallData> GetIQueryableInstallDatas()
|
||||||
{
|
{
|
||||||
var baseQuery = from x in Funs.DB.View_HJGL_InstallData
|
var baseQuery = from x in Funs.DB.View_HJGL_InstallData
|
||||||
select x;
|
select x;
|
||||||
if (tvControlItem.SelectedNode.CommandName.Split('|').Length == 2)
|
if (tvControlItem.SelectedNode.CommandName.Split('|').Length == 2)
|
||||||
{
|
{
|
||||||
baseQuery = baseQuery.Where(x => x.UnitWorkId == tvControlItem.SelectedNode.NodeID);
|
baseQuery = baseQuery.Where(x => x.UnitWorkId == tvControlItem.SelectedNode.NodeID);
|
||||||
@@ -315,7 +316,7 @@ namespace FineUIPro.Web.HJGL.PreDesign
|
|||||||
{
|
{
|
||||||
baseQuery = baseQuery.Where(x => x.PipelineCode.Contains(txtPipelineCode.Text.Trim()));
|
baseQuery = baseQuery.Where(x => x.PipelineCode.Contains(txtPipelineCode.Text.Trim()));
|
||||||
|
|
||||||
}
|
}
|
||||||
baseQuery = baseQuery.OrderBy(x => x.PipelineCode).ThenBy(x => x.Code);
|
baseQuery = baseQuery.OrderBy(x => x.PipelineCode).ThenBy(x => x.Code);
|
||||||
|
|
||||||
return baseQuery;
|
return baseQuery;
|
||||||
@@ -410,38 +411,39 @@ namespace FineUIPro.Web.HJGL.PreDesign
|
|||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
protected void btnOut_Click(object sender, EventArgs e)
|
protected void btnOut_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
|
||||||
var baseQuery = GetIQueryableInstallDatas();
|
|
||||||
|
|
||||||
var q = (from x in baseQuery
|
var baseQuery = GetIQueryableInstallDatas();
|
||||||
select new
|
|
||||||
{
|
|
||||||
管线号 = x.PipelineCode,
|
|
||||||
类型 = x.TypeStr,
|
|
||||||
编号 = x.Code,
|
|
||||||
预制散件材料描述 = (x.Matdef=="" || x.Matdef==null)?"-":x.Matdef,
|
|
||||||
数量 = x.TypeStr == "预制组件" ? 1 : (x.Number ?? 1),
|
|
||||||
所在包装编号 = x.PackagingCode,
|
|
||||||
车次 = x.TrainNumber,
|
|
||||||
流水段 = x.FlowingSection
|
|
||||||
});
|
|
||||||
string path = Funs.RootPath + @"File\Excel\Temp\PrePipelineInstallList.xlsx";
|
|
||||||
path = path.Replace(".xlsx", string.Format("{0:yyyy-MM-dd}", DateTime.Now) + ".xlsx");
|
|
||||||
|
|
||||||
MiniExcel.SaveAs(path, q, overwriteFile: true);
|
var q = (from x in baseQuery
|
||||||
|
select new
|
||||||
|
{
|
||||||
|
管线号 = x.PipelineCode,
|
||||||
|
类型 = x.TypeStr,
|
||||||
|
编号 = x.Code,
|
||||||
|
预制散件材料描述 = (x.Matdef == "" || x.Matdef == null) ? "-" : x.Matdef,
|
||||||
|
所需数量 = x.TypeStr == "预制组件" ? 1 : (x.Number ?? 1),
|
||||||
|
实到数量 = x.TypeStr == "预制组件" ? 1 : (x.ActNumber ?? 1),
|
||||||
|
所在包装编号 = x.PackagingCode,
|
||||||
|
车次 = x.TrainNumber,
|
||||||
|
流水段 = x.FlowingSection
|
||||||
|
});
|
||||||
|
string path = Funs.RootPath + @"File\Excel\Temp\PrePipelineInstallList.xlsx";
|
||||||
|
path = path.Replace(".xlsx", string.Format("{0:yyyy-MM-dd}", DateTime.Now) + ".xlsx");
|
||||||
|
|
||||||
|
MiniExcel.SaveAs(path, q, overwriteFile: true);
|
||||||
|
|
||||||
|
string fileName = $"安装清单-" + this.tvControlItem.SelectedNode.Text + "-" + string.Format("{0:yyyy-MM-dd}", DateTime.Now) + ".xlsx";
|
||||||
|
FileInfo info = new FileInfo(path);
|
||||||
|
long fileSize = info.Length;
|
||||||
|
System.Web.HttpContext.Current.Response.Clear();
|
||||||
|
System.Web.HttpContext.Current.Response.ContentType = "application/x-zip-compressed";
|
||||||
|
System.Web.HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
|
||||||
|
System.Web.HttpContext.Current.Response.AddHeader("Content-Length", fileSize.ToString());
|
||||||
|
System.Web.HttpContext.Current.Response.TransmitFile(path, 0, fileSize);
|
||||||
|
System.Web.HttpContext.Current.Response.Flush();
|
||||||
|
System.Web.HttpContext.Current.Response.Close();
|
||||||
|
File.Delete(path);
|
||||||
|
|
||||||
string fileName = $"安装清单-" + this.tvControlItem.SelectedNode.Text + "-" + string.Format("{0:yyyy-MM-dd}", DateTime.Now) + ".xlsx";
|
|
||||||
FileInfo info = new FileInfo(path);
|
|
||||||
long fileSize = info.Length;
|
|
||||||
System.Web.HttpContext.Current.Response.Clear();
|
|
||||||
System.Web.HttpContext.Current.Response.ContentType = "application/x-zip-compressed";
|
|
||||||
System.Web.HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
|
|
||||||
System.Web.HttpContext.Current.Response.AddHeader("Content-Length", fileSize.ToString());
|
|
||||||
System.Web.HttpContext.Current.Response.TransmitFile(path, 0, fileSize);
|
|
||||||
System.Web.HttpContext.Current.Response.Flush();
|
|
||||||
System.Web.HttpContext.Current.Response.Close();
|
|
||||||
File.Delete(path);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -238,7 +238,93 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
|||||||
pipeline.UnitId = unitWork.UnitId;
|
pipeline.UnitId = unitWork.UnitId;
|
||||||
}
|
}
|
||||||
|
|
||||||
string col0 = pds[i].A;
|
string col0 = Convert.ToString(pds[i].A);
|
||||||
|
string col1 = Convert.ToString(pds[i].B);
|
||||||
|
string col2 = Convert.ToString(pds[i].C);
|
||||||
|
string col3 = Convert.ToString(pds[i].D);
|
||||||
|
string col4 = Convert.ToString(pds[i].E);
|
||||||
|
string col5 = Convert.ToString(pds[i].F);
|
||||||
|
string col6 = Convert.ToString(pds[i].G);
|
||||||
|
string col19 = Convert.ToString(pds[i].U);
|
||||||
|
string col20 = Convert.ToString(pds[i].V);
|
||||||
|
string col21 = Convert.ToString(pds[i].W);
|
||||||
|
string col22 = Convert.ToString(pds[i].X);
|
||||||
|
string col23 = Convert.ToString(pds[i].Y);
|
||||||
|
string col24 = Convert.ToString(pds[i].Z);
|
||||||
|
string col25 = Convert.ToString(pds[i].AA);
|
||||||
|
string col26 = Convert.ToString(pds[i].AB);
|
||||||
|
string col27 = Convert.ToString(pds[i].AC);
|
||||||
|
bool hasRequiredError = false;
|
||||||
|
Action<string> addRequiredError = colName =>
|
||||||
|
{
|
||||||
|
result.Add("第" + (i + 1).ToString() + "行," + colName + "," + "此项为必填项!" + "|");
|
||||||
|
hasRequiredError = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(col0))
|
||||||
|
{
|
||||||
|
addRequiredError("管线号");
|
||||||
|
}
|
||||||
|
if (string.IsNullOrEmpty(col3))
|
||||||
|
{
|
||||||
|
addRequiredError("介质代号");
|
||||||
|
}
|
||||||
|
if (string.IsNullOrEmpty(col4))
|
||||||
|
{
|
||||||
|
addRequiredError("管道等级");
|
||||||
|
}
|
||||||
|
if (string.IsNullOrEmpty(col5))
|
||||||
|
{
|
||||||
|
addRequiredError("探伤比例");
|
||||||
|
}
|
||||||
|
if (string.IsNullOrEmpty(col6))
|
||||||
|
{
|
||||||
|
addRequiredError("探伤类型");
|
||||||
|
}
|
||||||
|
if (string.IsNullOrEmpty(col19))
|
||||||
|
{
|
||||||
|
addRequiredError("焊口号");
|
||||||
|
}
|
||||||
|
if (string.IsNullOrEmpty(col20))
|
||||||
|
{
|
||||||
|
addRequiredError("材质1");
|
||||||
|
}
|
||||||
|
if (string.IsNullOrEmpty(col21))
|
||||||
|
{
|
||||||
|
addRequiredError("材质2");
|
||||||
|
}
|
||||||
|
if (rbDiaType.SelectedValue == "1")
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(col27))
|
||||||
|
{
|
||||||
|
addRequiredError("外径");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (string.IsNullOrEmpty(col22))
|
||||||
|
{
|
||||||
|
addRequiredError("DN公称直径");
|
||||||
|
}
|
||||||
|
if (string.IsNullOrEmpty(col23))
|
||||||
|
{
|
||||||
|
addRequiredError("达因");
|
||||||
|
}
|
||||||
|
if (string.IsNullOrEmpty(col24))
|
||||||
|
{
|
||||||
|
addRequiredError("壁厚");
|
||||||
|
}
|
||||||
|
if (string.IsNullOrEmpty(col25))
|
||||||
|
{
|
||||||
|
addRequiredError("焊缝类型");
|
||||||
|
}
|
||||||
|
if (string.IsNullOrEmpty(col26))
|
||||||
|
{
|
||||||
|
addRequiredError("焊口属性");
|
||||||
|
}
|
||||||
|
if (hasRequiredError)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
string pipeLineId = string.Empty;
|
string pipeLineId = string.Empty;
|
||||||
if (string.IsNullOrEmpty(col0))
|
if (string.IsNullOrEmpty(col0))
|
||||||
{
|
{
|
||||||
@@ -249,10 +335,9 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
|||||||
pipeline.PipelineCode = col0;
|
pipeline.PipelineCode = col0;
|
||||||
}
|
}
|
||||||
|
|
||||||
pipeline.SingleNumber = pds[i].B;
|
pipeline.SingleNumber = col1;
|
||||||
pipeline.SingleName = pds[i].C;
|
pipeline.SingleName = col2;
|
||||||
|
|
||||||
string col3 = pds[i].D;
|
|
||||||
if (string.IsNullOrEmpty(col3))
|
if (string.IsNullOrEmpty(col3))
|
||||||
{
|
{
|
||||||
result.Add("第" + (i + 1).ToString() + "行," + "介质代号" + "," + "此项为必填项!" + "|");
|
result.Add("第" + (i + 1).ToString() + "行," + "介质代号" + "," + "此项为必填项!" + "|");
|
||||||
@@ -271,7 +356,6 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
|||||||
pipeline.MediumName = col3;
|
pipeline.MediumName = col3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
string col4 = pds[i].E;
|
|
||||||
if (string.IsNullOrEmpty(col4))
|
if (string.IsNullOrEmpty(col4))
|
||||||
{
|
{
|
||||||
result.Add("第" + (i + 1).ToString() + "行," + "管道等级" + "," + "此项为必填项!" + "|");
|
result.Add("第" + (i + 1).ToString() + "行," + "管道等级" + "," + "此项为必填项!" + "|");
|
||||||
@@ -290,7 +374,6 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
|||||||
pipeline.PipingClassCode = col4;
|
pipeline.PipingClassCode = col4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
string col5 = pds[i].F;
|
|
||||||
if (!string.IsNullOrEmpty(col5))
|
if (!string.IsNullOrEmpty(col5))
|
||||||
{
|
{
|
||||||
var DetectionRate = getDetectionRate.FirstOrDefault(x => x.DetectionRateValue.ToString() == col5.Replace("%", "") || x.DetectionRateCode == col5);
|
var DetectionRate = getDetectionRate.FirstOrDefault(x => x.DetectionRateValue.ToString() == col5.Replace("%", "") || x.DetectionRateCode == col5);
|
||||||
@@ -310,7 +393,6 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
|||||||
result.Add("第" + (i + 1).ToString() + "行," + "探伤比例" + "," + "此项为必填项!" + "|");
|
result.Add("第" + (i + 1).ToString() + "行," + "探伤比例" + "," + "此项为必填项!" + "|");
|
||||||
}
|
}
|
||||||
|
|
||||||
string col6 = pds[i].G;
|
|
||||||
if (!string.IsNullOrEmpty(col6))
|
if (!string.IsNullOrEmpty(col6))
|
||||||
{
|
{
|
||||||
string typeStr = col6.ToString();
|
string typeStr = col6.ToString();
|
||||||
@@ -449,7 +531,6 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
|||||||
pipeline.Remark = Convert.ToString(pds[i].T);
|
pipeline.Remark = Convert.ToString(pds[i].T);
|
||||||
|
|
||||||
// 以下是焊口信息
|
// 以下是焊口信息
|
||||||
string col19 = Convert.ToString(pds[i].U);
|
|
||||||
if (string.IsNullOrEmpty(col19))
|
if (string.IsNullOrEmpty(col19))
|
||||||
{
|
{
|
||||||
result.Add("第" + (i + 1).ToString() + "行," + "焊口号" + "," + "此项为必填项!" + "|");
|
result.Add("第" + (i + 1).ToString() + "行," + "焊口号" + "," + "此项为必填项!" + "|");
|
||||||
@@ -468,12 +549,6 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
|||||||
pipeline.WeldJointCode = col19;
|
pipeline.WeldJointCode = col19;
|
||||||
}
|
}
|
||||||
|
|
||||||
string col20 = "";
|
|
||||||
if (pds[i].V != null)
|
|
||||||
{
|
|
||||||
col20 = pds[i].V.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(col20))
|
if (!string.IsNullOrEmpty(col20))
|
||||||
{
|
{
|
||||||
var material = getMaterial.FirstOrDefault(x => x.MaterialCode == col20);
|
var material = getMaterial.FirstOrDefault(x => x.MaterialCode == col20);
|
||||||
@@ -493,12 +568,6 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
|||||||
result.Add("第" + (i + 1).ToString() + "行," + "材质1" + "," + "此项为必填项!" + "|");
|
result.Add("第" + (i + 1).ToString() + "行," + "材质1" + "," + "此项为必填项!" + "|");
|
||||||
}
|
}
|
||||||
|
|
||||||
string col21 = "";
|
|
||||||
if (pds[i].W != null)
|
|
||||||
{
|
|
||||||
col21 = pds[i].W.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(col21))
|
if (!string.IsNullOrEmpty(col21))
|
||||||
{
|
{
|
||||||
var material = getMaterial.FirstOrDefault(x => x.MaterialCode == col21);
|
var material = getMaterial.FirstOrDefault(x => x.MaterialCode == col21);
|
||||||
@@ -518,12 +587,6 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
|||||||
result.Add("第" + (i + 1).ToString() + "行," + "材质2" + "," + "此项为必填项!" + "|");
|
result.Add("第" + (i + 1).ToString() + "行," + "材质2" + "," + "此项为必填项!" + "|");
|
||||||
}
|
}
|
||||||
|
|
||||||
string col22 = Convert.ToString(pds[i].X);
|
|
||||||
string col27 = "";
|
|
||||||
if (pds[i].AC != null)
|
|
||||||
{
|
|
||||||
col27 = pds[i].AC.ToString();
|
|
||||||
}
|
|
||||||
if (rbDiaType.SelectedValue == "1")
|
if (rbDiaType.SelectedValue == "1")
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(col27))
|
if (!string.IsNullOrEmpty(col27))
|
||||||
@@ -564,7 +627,6 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var col23 = Convert.ToString(pds[i].Y);
|
|
||||||
if (col23 != null)
|
if (col23 != null)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -582,7 +644,6 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
|||||||
result.Add("第" + (i + 1).ToString() + "行," + "达因" + "," + "此项为必填项!" + "|");
|
result.Add("第" + (i + 1).ToString() + "行," + "达因" + "," + "此项为必填项!" + "|");
|
||||||
}
|
}
|
||||||
|
|
||||||
var col24 = Convert.ToString(pds[i].Z);
|
|
||||||
if (col24 != null)
|
if (col24 != null)
|
||||||
{
|
{
|
||||||
// var Thickness = Convert.ToDecimal(col24);
|
// var Thickness = Convert.ToDecimal(col24);
|
||||||
@@ -641,7 +702,6 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
string col25 = Convert.ToString(pds[i].AA);
|
|
||||||
if (!string.IsNullOrEmpty(col25))
|
if (!string.IsNullOrEmpty(col25))
|
||||||
{
|
{
|
||||||
var weldType = getWeldType.FirstOrDefault(x => x.WeldTypeCode == col25);
|
var weldType = getWeldType.FirstOrDefault(x => x.WeldTypeCode == col25);
|
||||||
@@ -699,7 +759,6 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
|||||||
{
|
{
|
||||||
result.Add("第" + (i + 1).ToString() + "行," + "焊缝类型" + "," + "此项为必填项!" + "|");
|
result.Add("第" + (i + 1).ToString() + "行," + "焊缝类型" + "," + "此项为必填项!" + "|");
|
||||||
}
|
}
|
||||||
string col26 = Convert.ToString(pds[i].AB);
|
|
||||||
if (!string.IsNullOrEmpty(col26))
|
if (!string.IsNullOrEmpty(col26))
|
||||||
{
|
{
|
||||||
var JointAttribute = BLL.DropListService.HJGL_JointAttribute();
|
var JointAttribute = BLL.DropListService.HJGL_JointAttribute();
|
||||||
@@ -1324,4 +1383,4 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+803
-279
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user