赛鼎焊接修改

This commit is contained in:
2025-06-04 22:46:21 +08:00
parent d99ff19b09
commit b603b27f0b
40 changed files with 3265 additions and 118 deletions
Binary file not shown.
@@ -67,6 +67,10 @@
"$type": "Bookmark",
"Name": "ST:0:0:{5726b0e3-1012-5233-81f9-d1fad48e7a56}"
},
{
"$type": "Bookmark",
"Name": "ST:2:0:{b9f91511-5ca5-40ec-9726-f3e3a7e534e2}"
},
{
"$type": "Bookmark",
"Name": "ST:0:0:{aa2115a1-9712-457b-9047-dbb71ca2cdd2}"
@@ -67,9 +67,17 @@
"$type": "Bookmark",
"Name": "ST:0:0:{5726b0e3-1012-5233-81f9-d1fad48e7a56}"
},
{
"$type": "Bookmark",
"Name": "ST:2:0:{b9f91511-5ca5-40ec-9726-f3e3a7e534e2}"
},
{
"$type": "Bookmark",
"Name": "ST:0:0:{aa2115a1-9712-457b-9047-dbb71ca2cdd2}"
},
{
"$type": "Bookmark",
"Name": "ST:0:0:{1c4feeaa-4718-4aa9-859d-94ce25d182ba}"
}
]
}
@@ -0,0 +1,94 @@
insert into Sys_Menu(MenuId,MenuName,Url,SortIndex,SuperMenu,MenuType,IsOffice,IsEnd,IsUsed)
values('53948077-B51D-4FF3-BFB0-AB4E27C42875','排产计划','HJGL/PreDesign/ProductionSchedulingPlan.aspx',70,'1E36EA73-D536-4215-BFB9-A8771937BD89','Menu_HJGL',0,1,1)
go
insert into Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex)
values('824DDB94-628F-4A4D-9977-E38F039578AA','53948077-B51D-4FF3-BFB0-AB4E27C42875','增加',1)
insert into Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex)
values('5491A74E-F3EC-4C1D-AA5D-BB0283C7E36D','53948077-B51D-4FF3-BFB0-AB4E27C42875','修改',2)
insert into Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex)
values('9B72FF93-6E2F-41DF-8BA9-3A1C82923B3B','53948077-B51D-4FF3-BFB0-AB4E27C42875','删除',3)
insert into Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex)
values('8AD82894-12DA-47E8-8382-3E27633750E0','53948077-B51D-4FF3-BFB0-AB4E27C42875','保存',4)
go
CREATE TABLE [dbo].[HJGL_ProductionSchedulingPlan](
[ProductionSchedulingPlanId] [nvarchar](50) NOT NULL,
[ProjectId] [nvarchar](50) NULL,
[PipelineId] [nvarchar](50) NULL,
[FlowNum] [nvarchar](50) NULL,
[MainItemName] [nvarchar](50) NULL,
[Material] [nvarchar](50) NULL,
[Caliber] [nvarchar](50) NULL,
[Dain] [decimal](18, 2) NULL,
[TotalDyne] [decimal](18, 2) NULL,
[TotalPriority] [nvarchar](50) NULL,
[PriorityTotalDyne] [decimal](18, 2) NULL,
[PlanStartDate] [datetime] NULL,
[PlanEndDate] [datetime] NULL,
[Days] [int] NULL,
[AvgDailyWorkload] [numeric](18, 2) NULL,
CONSTRAINT [PK_HJGL_ProductionSchedulingPlan] PRIMARY KEY CLUSTERED
(
[ProductionSchedulingPlanId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[HJGL_ProductionSchedulingPlan] WITH CHECK ADD CONSTRAINT [FK_HJGL_ProductionSchedulingPlan_Base_Project] FOREIGN KEY([ProjectId])
REFERENCES [dbo].[Base_Project] ([ProjectId])
GO
ALTER TABLE [dbo].[HJGL_ProductionSchedulingPlan] CHECK CONSTRAINT [FK_HJGL_ProductionSchedulingPlan_Base_Project]
GO
ALTER TABLE [dbo].[HJGL_ProductionSchedulingPlan] WITH CHECK ADD CONSTRAINT [FK_HJGL_ProductionSchedulingPlan_HJGL_Pipeline] FOREIGN KEY([PipelineId])
REFERENCES [dbo].[HJGL_Pipeline] ([PipelineId])
GO
ALTER TABLE [dbo].[HJGL_ProductionSchedulingPlan] CHECK CONSTRAINT [FK_HJGL_ProductionSchedulingPlan_HJGL_Pipeline]
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'管线Id' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HJGL_ProductionSchedulingPlan', @level2type=N'COLUMN',@level2name=N'PipelineId'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'流水段号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HJGL_ProductionSchedulingPlan', @level2type=N'COLUMN',@level2name=N'FlowNum'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'主项名称' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HJGL_ProductionSchedulingPlan', @level2type=N'COLUMN',@level2name=N'MainItemName'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'材质' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HJGL_ProductionSchedulingPlan', @level2type=N'COLUMN',@level2name=N'Material'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'口径' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HJGL_ProductionSchedulingPlan', @level2type=N'COLUMN',@level2name=N'Caliber'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'达因数' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HJGL_ProductionSchedulingPlan', @level2type=N'COLUMN',@level2name=N'Dain'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'总达因' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HJGL_ProductionSchedulingPlan', @level2type=N'COLUMN',@level2name=N'TotalDyne'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'总优先级' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HJGL_ProductionSchedulingPlan', @level2type=N'COLUMN',@level2name=N'TotalPriority'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'优先级总达因' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HJGL_ProductionSchedulingPlan', @level2type=N'COLUMN',@level2name=N'PriorityTotalDyne'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'计划开始时间' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HJGL_ProductionSchedulingPlan', @level2type=N'COLUMN',@level2name=N'PlanStartDate'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'计划结束时间' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HJGL_ProductionSchedulingPlan', @level2type=N'COLUMN',@level2name=N'PlanEndDate'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'天数' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HJGL_ProductionSchedulingPlan', @level2type=N'COLUMN',@level2name=N'Days'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'平均每天工作量' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HJGL_ProductionSchedulingPlan', @level2type=N'COLUMN',@level2name=N'AvgDailyWorkload'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'排产计划' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HJGL_ProductionSchedulingPlan'
GO
@@ -0,0 +1,57 @@
CREATE VIEW [dbo].[View_HJGL_ProductionSchedulingPlanStatistics]
as
/************排产计划统计**********/
SELECT distinct unitWork.UnitWorkId,
unitWork.UnitWorkCode,
unitWork.UnitWorkName,
unitWork.ProjectId,
pipeline.FlowingSection,
(case p.SteelType when '1' then '碳钢' when '2' then '不锈钢' when '3' then '铬钼钢' when '4' then '低合金钢' when '5' then '镍合金钢' when '6' then '钛合金钢' when '7' then '其他' end) as Material,
'<100' as Caliber,
isnull(weldJoint.Dia,0) as Dia
FROM WBS_UnitWork AS unitWork
LEFT JOIN (select FlowingSection,UnitWorkId from HJGL_Pipeline where PipeArea='1') as pipeline on pipeline.UnitWorkId = unitWork.UnitWorkId
LEFT JOIN (select distinct Base_Material.SteelType,UnitWorkId from HJGL_WeldJoint
left join HJGL_Pipeline on HJGL_Pipeline.PipelineId = HJGL_WeldJoint.PipelineId
left join Base_Material on Base_Material.MaterialId = HJGL_WeldJoint.Material1Id
where PipeArea='1' and HJGL_WeldJoint.JointAttribute='预制口') as p on p.UnitWorkId = unitWork.UnitWorkId
--达因
LEFT JOIN (select sum(Dia) as Dia,HJGL_Pipeline.UnitWorkId,HJGL_Pipeline.FlowingSection,Base_Material.SteelType,HJGL_WeldJoint.DNDia from HJGL_WeldJoint
left join HJGL_Pipeline on HJGL_Pipeline.PipelineId = HJGL_WeldJoint.PipelineId
left join Base_Material on Base_Material.MaterialId = HJGL_WeldJoint.Material1Id
where HJGL_Pipeline.PipeArea='1' and HJGL_WeldJoint.JointAttribute='预制口'
and cast(SUBSTRING(HJGL_WeldJoint.DNDia,CHARINDEX('N',HJGL_WeldJoint.DNDia)+1,len(HJGL_WeldJoint.DNDia)-charindex('N',HJGL_WeldJoint.DNDia)) as int)<100
group by HJGL_Pipeline.UnitWorkId,HJGL_Pipeline.FlowingSection,Base_Material.SteelType,HJGL_WeldJoint.DNDia) as weldJoint on weldJoint.UnitWorkId =unitWork.UnitWorkId
and weldJoint.FlowingSection = pipeline.FlowingSection
union
SELECT distinct unitWork.UnitWorkId,
unitWork.UnitWorkCode,
unitWork.UnitWorkName,
unitWork.ProjectId,
pipeline.FlowingSection,
(case p.SteelType when '1' then '碳钢' when '2' then '不锈钢' when '3' then '铬钼钢' when '4' then '低合金钢' when '5' then '镍合金钢' when '6' then '钛合金钢' when '7' then '其他' end) as Material,
'≥100' as Caliber,
isnull(weldJoint.Dia,0) as Dia
FROM WBS_UnitWork AS unitWork
LEFT JOIN (select FlowingSection,UnitWorkId from HJGL_Pipeline where PipeArea='1') as pipeline on pipeline.UnitWorkId = unitWork.UnitWorkId
LEFT JOIN (select distinct Base_Material.SteelType,UnitWorkId from HJGL_WeldJoint
left join HJGL_Pipeline on HJGL_Pipeline.PipelineId = HJGL_WeldJoint.PipelineId
left join Base_Material on Base_Material.MaterialId = HJGL_WeldJoint.Material1Id
where PipeArea='1' and HJGL_WeldJoint.JointAttribute='预制口') as p on p.UnitWorkId = unitWork.UnitWorkId
LEFT JOIN (select sum(Dia) as Dia,HJGL_Pipeline.UnitWorkId,HJGL_Pipeline.FlowingSection,Base_Material.SteelType,HJGL_WeldJoint.DNDia from HJGL_WeldJoint
left join HJGL_Pipeline on HJGL_Pipeline.PipelineId = HJGL_WeldJoint.PipelineId
left join Base_Material on Base_Material.MaterialId = HJGL_WeldJoint.Material1Id
where HJGL_Pipeline.PipeArea='1' and HJGL_WeldJoint.JointAttribute='预制口'
and cast(SUBSTRING(HJGL_WeldJoint.DNDia,CHARINDEX('N',HJGL_WeldJoint.DNDia)+1,len(HJGL_WeldJoint.DNDia)-charindex('N',HJGL_WeldJoint.DNDia)) as int)>=100
group by HJGL_Pipeline.UnitWorkId,HJGL_Pipeline.FlowingSection,Base_Material.SteelType,HJGL_WeldJoint.DNDia) as weldJoint on weldJoint.UnitWorkId =unitWork.UnitWorkId
and weldJoint.FlowingSection = pipeline.FlowingSection
GO
@@ -130,9 +130,29 @@ namespace BLL
}
table.PipelineComponentId = string.Join(",", set);
}
}
BLL.HJGL_PackagingmanageService.UpdateHJGL_PackagingManage(table);
var newDetailList = new List<Model.HJGL_PackagingManageDetail>();
foreach (var item in table.PipelineComponentId.Split(','))
{
var ComponentModel = BLL.HJGL_PipelineComponentService.GetPipelineComponentById(item);
if (ComponentModel != null)
{
var model = new Model.HJGL_PackagingManageDetail()
{
Id = SQLHelper.GetNewID(),
PackagingManageId = table.PackagingManageId,
PipelineId = ComponentModel.PipelineId,
PipelineComponentId = item,
CreateTime = DateTime.Now,
};
newDetailList.Add(model);
}
}
HJGLPackagingmanagedetailService.DeleteByPackagingManageId(table.PackagingManageId);
HJGLPackagingmanagedetailService.AddBulk(newDetailList);
}
}
+1
View File
@@ -407,6 +407,7 @@
<Compile Include="HJGL\PreDesign\HJGL_MaterialService.cs" />
<Compile Include="HJGL\PreDesign\HJGLPackagingmanagedetailService.cs" />
<Compile Include="HJGL\PreDesign\PackagingManageService .cs" />
<Compile Include="HJGL\PreDesign\ProductionSchedulingPlanService.cs" />
<Compile Include="HJGL\PreDesign\TrainNumberManageService.cs" />
<Compile Include="HJGL\PreDesign\YardPlanningService.cs" />
<Compile Include="HJGL\PurgingCleaning\PC_ItemEndCheckService.cs" />
+5
View File
@@ -4801,6 +4801,11 @@ namespace BLL
/// </summary>
public const string Pipeline_ComponentPath = "File\\Excel\\DataIn\\组件管理二维码信息导入.xlsx";
/// <summary>
/// 排产计划导出模板
/// </summary>
public const string HJGL_ProductionSchedulingPlanPath = "File\\Excel\\DataOut\\排产计划导出模板.xlsx";
#region
/// <summary>
@@ -231,6 +231,23 @@ namespace BLL
}
}
public static void DeleteByPackagingManageId(string packagingManageId)
{
var list = Funs.DB.HJGL_PackagingManageDetail.Where(x => x.PackagingManageId == packagingManageId).ToList();
if (list.Count>0)
{
Funs.DB.HJGL_PackagingManageDetail.DeleteAllOnSubmit(list);
Funs.DB.SubmitChanges();
}
}
public static void AddBulk(List<Model.HJGL_PackagingManageDetail> newtables)
{
Funs.DB.HJGL_PackagingManageDetail.InsertAllOnSubmit(newtables);
Funs.DB.SubmitChanges();
}
}
}
@@ -0,0 +1,120 @@
using Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
namespace BLL
{
/// <summary>
/// 排产计划
/// </summary>
public class ProductionSchedulingPlanService
{
/// <summary>
/// 根据主键获取排产计划
/// </summary>
/// <param name="productionSchedulingPlanId"></param>
/// <returns></returns>
public static Model.HJGL_ProductionSchedulingPlan GetProductionSchedulingPlanById(string productionSchedulingPlanId)
{
return Funs.DB.HJGL_ProductionSchedulingPlan.FirstOrDefault(e => e.ProductionSchedulingPlanId == productionSchedulingPlanId);
}
public static Model.HJGL_ProductionSchedulingPlan GetProductionSchedulingPlan(string loginProjectId, string flowingSection, string unitWorkName, string material, string caliber)
{
return Funs.DB.HJGL_ProductionSchedulingPlan.FirstOrDefault(e => e.ProjectId == loginProjectId && e.FlowNum == flowingSection && e.MainItemName == unitWorkName && e.Caliber == caliber);
}
/// <summary>
/// 增加排产计划
/// </summary>
/// <param name="plan"></param>
public static void AddProductionSchedulingPlan(Model.HJGL_ProductionSchedulingPlan plan)
{
SGGLDB db = Funs.DB;
Model.HJGL_ProductionSchedulingPlan newPlan = new HJGL_ProductionSchedulingPlan();
newPlan.ProductionSchedulingPlanId = plan.ProductionSchedulingPlanId;
newPlan.ProjectId = plan.ProjectId;
newPlan.PipelineId = plan.PipelineId;
newPlan.FlowNum = plan.FlowNum;
newPlan.MainItemName = plan.MainItemName;
newPlan.Material = plan.Material;
newPlan.Caliber = plan.Caliber;
newPlan.Dain = plan.Dain;
newPlan.TotalDyne = plan.TotalDyne;
newPlan.TotalPriority = plan.TotalPriority;
newPlan.PriorityTotalDyne = plan.PriorityTotalDyne;
newPlan.PlanStartDate = plan.PlanStartDate;
newPlan.PlanEndDate = plan.PlanEndDate;
newPlan.Days = plan.Days;
newPlan.AvgDailyWorkload = plan.Days;
db.HJGL_ProductionSchedulingPlan.InsertOnSubmit(newPlan);
db.SubmitChanges();
}
/// <summary>
/// 修改排产计划
/// </summary>
/// <param name="plan"></param>
public static void UpdateProductionSchedulingPlan(Model.HJGL_ProductionSchedulingPlan plan)
{
Model.SGGLDB db = Funs.DB;
Model.HJGL_ProductionSchedulingPlan newPlan = db.HJGL_ProductionSchedulingPlan.FirstOrDefault(e => e.ProductionSchedulingPlanId == plan.ProductionSchedulingPlanId);
if (newPlan != null)
{
newPlan.PipelineId = plan.PipelineId;
newPlan.FlowNum = plan.FlowNum;
newPlan.MainItemName = plan.MainItemName;
newPlan.Material = plan.Material;
newPlan.Caliber = plan.Caliber;
newPlan.Dain = plan.Dain;
newPlan.TotalDyne = plan.TotalDyne;
newPlan.TotalPriority = plan.TotalPriority;
newPlan.PriorityTotalDyne = plan.PriorityTotalDyne;
newPlan.PlanStartDate = plan.PlanStartDate;
newPlan.PlanEndDate = plan.PlanEndDate;
newPlan.Days = plan.Days;
newPlan.AvgDailyWorkload = plan.AvgDailyWorkload;
try
{
db.SubmitChanges(System.Data.Linq.ConflictMode.ContinueOnConflict);
}
catch (System.Data.Linq.ChangeConflictException ex)
{
foreach (System.Data.Linq.ObjectChangeConflict occ in db.ChangeConflicts)
{
//以下是解决冲突的三种方法,选一种即可
// 使用当前数据库中的值,覆盖Linq缓存中实体对象的值
occ.Resolve(System.Data.Linq.RefreshMode.OverwriteCurrentValues);
// 使用Linq缓存中实体对象的值,覆盖当前数据库中的值
occ.Resolve(System.Data.Linq.RefreshMode.KeepCurrentValues);
// 只更新实体对象中改变的字段的值,其他的保留不变
occ.Resolve(System.Data.Linq.RefreshMode.KeepChanges);
}
// 这个地方要注意,Catch方法中,我们前面只是指明了怎样来解决冲突,这个地方还需要再次提交更新,这样的话,值 //才会提交到数据库。
db.SubmitChanges();
}
}
}
/// <summary>
/// 根据主键删除排产计划
/// </summary>
/// <param name="productionSchedulingPlanId"></param>
public static void DeleteProductionSchedulingPlanById(string productionSchedulingPlanId)
{
SGGLDB db = Funs.DB;
Model.HJGL_ProductionSchedulingPlan plan = db.HJGL_ProductionSchedulingPlan.FirstOrDefault(e => e.ProductionSchedulingPlanId == productionSchedulingPlanId);
if (plan != null)
{
db.HJGL_ProductionSchedulingPlan.DeleteOnSubmit(plan);
db.SubmitChanges();
}
}
}
}
@@ -466,6 +466,8 @@ namespace BLL
baseQuery = baseQuery.Where(x => x.PipelineCode.Contains(model.PipelineCode));
if (!string.IsNullOrEmpty(model.WeldJointCode))
baseQuery = baseQuery.Where(x => x.WeldJointCode.Contains(model.WeldJointCode));
//构建排序
baseQuery = baseQuery.OrderBy(x => x.PipelineId).ThenBy(x => x.WeldJointCode);
return baseQuery.ToList();
}
@@ -503,7 +505,7 @@ namespace BLL
baseQuery = baseQuery.Where(x => x.WeldJointCode.Contains( model.WeldJointCode));
// 阶段三:排序与分页控制(索引优化关键)
var orderedQuery = baseQuery.OrderBy(x => x.WeldJointCode);
var orderedQuery = baseQuery.OrderBy(x=>x.PipelineId).ThenBy(x => x.WeldJointCode);
// 阶段四:分页执行(数据库层面分页)
var pagedData = orderedQuery
+113 -7
View File
@@ -1,8 +1,12 @@
using Model;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using NPOI.SS.UserModel;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
namespace BLL
{
@@ -29,7 +33,7 @@ namespace BLL
/// <param name="ProjectId"></param>
/// <param name="UnitId"></param>
/// <returns></returns>
public static decimal GetSumHSECost(string ProjectId, string UnitId, string costManageId )
public static decimal GetSumHSECost(string ProjectId, string UnitId, string costManageId)
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
@@ -70,7 +74,7 @@ namespace BLL
States = costManage.States,
CompileMan = costManage.CompileMan,
CompileDate = costManage.CompileDate,
NextManId= costManage.NextManId,
NextManId = costManage.NextManId,
};
db.CostGoods_CostManage.InsertOnSubmit(newCostManage);
@@ -190,10 +194,10 @@ namespace BLL
/// </summary>
/// <param name="costManageId"></param>
/// <returns></returns>
public static Model.CostGoods_CostManageFlowOperate getNextCostManageFlowOperateList(string costManageId,string operaterId)
public static Model.CostGoods_CostManageFlowOperate getNextCostManageFlowOperateList(string costManageId, string operaterId)
{
int minSortIndex = 1;
var getAllNoClose = Funs.DB.CostGoods_CostManageFlowOperate.Where(x => x.CostManageId == costManageId && (x.IsClosed == null || x.IsClosed == false));
var getAllNoClose = Funs.DB.CostGoods_CostManageFlowOperate.Where(x => x.CostManageId == costManageId && (x.IsClosed == null || x.IsClosed == false));
if (getAllNoClose.Count() > 0)
{
var getFlowOperate = getAllNoClose.Where(x => x.OperaterId == operaterId);
@@ -342,10 +346,10 @@ namespace BLL
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
var getDatas = db.CostGoods_CostManageFlowOperate.Where(x => x.CostManageId == costManageId && x.IsClosed==true);
foreach ( var item in getDatas)
var getDatas = db.CostGoods_CostManageFlowOperate.Where(x => x.CostManageId == costManageId && x.IsClosed == true);
foreach (var item in getDatas)
{
item.IsClosed= false;
item.IsClosed = false;
db.SubmitChanges();
}
}
@@ -367,5 +371,107 @@ namespace BLL
}
}
}
/// 推送数据到HSE系统
/// </summary>
public static string PushDataToHSE(string projectId, string contractNum)
{
try
{
string message = "";
// 查询当前合同所有审核通过的数据
var costData = from x in Funs.DB.CostGoods_CostManage
where x.ProjectId == projectId && x.ContractNum == contractNum && x.States == Const.State_2
orderby x.CostManageDate descending
select x;
if (costData.Any())
{
// 获取所有附件文件
var files = new List<object>();
decimal totalAmount = 0;
foreach (var item in costData)
{
var fileDetails = GetBase64FilesWithDetails(item.CostManageId);
if (fileDetails != null && fileDetails.Count > 0)
{
files.AddRange(fileDetails);
totalAmount += item.SumMoney ?? 0;
}
}
// 构建请求体
var requestBody = new
{
projectId = projectId,
contractNo = contractNum,
amountHSE = totalAmount.ToString(),
files = files
};
var jsonBody = JsonConvert.SerializeObject(requestBody);
// 调用HSE接口推送数据
// TODO: 实现实际的HSE接口调用逻辑
var url="http://172.29.60.33:8080";
var requestGetTokenUrl = url + "/api/Token/GetToken";
string requestGetTokenBody = "{\r\n\r\n\"username\": \"coadmin\",\r\n\r\n\"password\": \"coadminPu@2025\"\r\n\r\n}";
var response = Funs.RequestPost(requestGetTokenUrl, "", requestGetTokenBody);
var responseStr = JsonConvert.DeserializeObject<JObject>(response);
if (responseStr == null || responseStr["data"].ToString() != "200")
{
message = "获取Pu系统Token失败";
}
string accessToken = responseStr["data"]["token"].ToString();
var requestUrl = url + "/api/PuPayCraftAmount/AddPuPayCraftAmount";
var responseHSE = Funs.RequestPost(requestUrl, accessToken, jsonBody);
var responseHSEStr = JsonConvert.DeserializeObject<JObject>(responseHSE);
if (responseHSEStr == null || responseHSEStr["data"].ToString()!= "200")
{
message = "推送数据到HSE系统失败";
}
}
return message;
}
catch (Exception ex)
{
// 记录错误日志
ErrLogInfo.WriteLog(ex.Message, ex.StackTrace);
return "推送数据失败"+ex.Message;
}
}
/// <summary>
/// 获取Base64编码的附件文件
/// </summary>
public static List<object> GetBase64FilesWithDetails(string costManageId)
{
var result = new List<object>();
// 获取费用管理信息
var costManage = GetCostManageById(costManageId);
// 获取附件文件
var attachments = AttachFileService.getFileUrl(costManageId);
if (!string.IsNullOrEmpty(attachments))
{
string filePath=Funs.RootPath+attachments.Split(',')[0];
FileInfo file = new FileInfo(filePath);
byte[] fileBytes = File.ReadAllBytes(filePath);
string base64Content = Convert.ToBase64String(fileBytes);
result.Add(new Model.PuPayCraftAmountFileInput
{
name = file.Name,
content = base64Content,
thisamount = costManage?.SumMoney?.ToString() ?? "0",
date = costManage?.CostManageDate?.ToString("yyyy-MM-dd") ?? DateTime.Now.ToString("yyyy-MM-dd")
});
}
return result;
}
}
}
@@ -12,6 +12,7 @@ namespace BLL
/// </summary>
public static class EnvironmentalCheckService
{
#region
/// <summary>
@@ -20,8 +21,8 @@ namespace BLL
/// <returns></returns>
public static ReturnData PushEnvironmentalCheckData()
{
var db1 = Funs.DB;
var items = (from x in db1.EnvironmentalCheck where x.IsPushed == false select x).ToList();
var db = Funs.DB;
var items = (from x in db.EnvironmentalCheck where x.IsPushed == false select x).ToList();
Model.ReturnData responeData = new Model.ReturnData();
if (items.Count() > 0)
{
@@ -34,11 +35,11 @@ namespace BLL
{//推送成功后,修改数据状态
foreach (var item in items)
{
Model.EnvironmentalCheck envModel = db1.EnvironmentalCheck.FirstOrDefault(e => e.Id == item.Id);
Model.EnvironmentalCheck envModel = db.EnvironmentalCheck.FirstOrDefault(e => e.Id == item.Id);
if (envModel != null)
{
envModel.IsPushed = true;
db1.SubmitChanges();
db.SubmitChanges();
}
}
}
@@ -44,8 +44,22 @@ namespace BLL
select y).ToList();
return list;
}
/// <summary>
/// 获取审批完成的主合同
/// </summary>
/// <param name="ProjectId"></param>
/// <returns></returns>
public static List<Model.PHTGL_Contract> GetCompletedContracts(string ProjectId)
{
var q= from x in Funs.DB.PHTGL_Contract
join y in Funs.DB.PHTGL_ContractReview on x.ContractId equals y.ContractId
where
y.State== Const.ContractReview_Complete &&
x.ContractAttribute==0 &&
x.ProjectId==ProjectId
select x;
return q.ToList();
}
public static void InitAllProjectCodeDropDownList(FineUIPro.DropDownList dropName, bool isShowPlease)
{
dropName.DataValueField = "ProjectId";
@@ -62,7 +76,14 @@ namespace BLL
Funs.FineUIPleaseSelect(dropName);
}
}
public static void InitCompletedContractsDropDownList(string projectId, FineUIPro.DropDownList dropName)
{
dropName.DataValueField = "ContractNum";
dropName.DataTextField = "ContractNum";
var CompletedContractslist = GetCompletedContracts(projectId);
dropName.DataSource = CompletedContractslist;
dropName.DataBind();
}
/// <summary>
/// 增加合同基本信息
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Report ScriptLanguage="CSharp" ReportInfo.Created="12/29/2021 10:56:08" ReportInfo.Modified="12/17/2024 19:27:14" ReportInfo.CreatorVersion="2017.1.16.0">
<Report ScriptLanguage="CSharp" ReportInfo.Created="12/29/2021 10:56:08" ReportInfo.Modified="05/22/2025 14:28:48" ReportInfo.CreatorVersion="2017.1.16.0">
<ScriptText>using System;
using System.Collections;
using System.Collections.Generic;
@@ -45,7 +45,8 @@ namespace FastReport
Table4.PrintColumns();
Table4.PrintRow(5);
Table4.PrintColumns();
Table4.PrintRow(6);
Table4.PrintColumns();
// go next data source row
rowData.Next();
@@ -89,7 +90,7 @@ namespace FastReport
}
</ScriptText>
<Dictionary>
<MsSqlDataConnection Name="Connection" ConnectionString="rijcmlqvJIqZbrmqGn7L0P56UFhaUHihKXxbhpqie4wmZgM2ymDKry7UxzO5md9ybQlkfKpN2rHYbp9GtH1LDQPa7z2vVu/kEnNnTKeHt9obmaC7TQDh0IvsUBSuzhGZdfAIK7YyBqykCgeZm5rvA6K5b7zHGdA+7pUpJ/9ZLpp1NuxWREru9g6JqYbbf0PYErYyKgC">
<MsSqlDataConnection Name="Connection" ConnectionString="rijcmlqvJIqZbrmqGn7L0P56UFhaUHihKXxbhpqie4wmZgM2ymDKry7UxzO5md9ybQlkfKpN2rHYbp9GtH1LDQPa7z2vVu/kEnNnTKeHt9obmaC7TQDh0IvsUBSuzhGZdfAIK7YyBqykCgeZm5rvA6K5b7zHGdA+7pUpJ/9ZLpp1NuxWRFKSkSpVqWLPMnhcSXZfZi3">
<TableDataSource Name="Table1" Alias="Head" DataType="System.Int32" Enabled="true" SelectCommand="select * from CH_Trust where CH_TrustID=@CH_TrustID">
<Column Name="CH_TrustID" DataType="System.String"/>
<Column Name="CH_TrustCode" DataType="System.String"/>
@@ -169,8 +170,8 @@ namespace FastReport
<Parameter Name="TrustBatchId" DataType="System.String"/>
</Dictionary>
<ReportPage Name="Page1" RawPaperSize="9" Guides="75.6">
<PageHeaderBand Name="PageHeader1" Width="718.2" Height="283.5">
<TableObject Name="Table4" Left="18.9" Top="37.8" Width="699.25" Height="246.02" ManualBuildEvent="Table4_ManualBuild">
<PageHeaderBand Name="PageHeader1" Width="718.2" Height="318.22">
<TableObject Name="Table4" Left="18.9" Top="37.8" Width="699.25" Height="280.42" ManualBuildEvent="Table4_ManualBuild">
<TableColumn Name="Column13" Width="94.73"/>
<TableColumn Name="Column14" Width="94.73"/>
<TableColumn Name="Column15" Width="75.83"/>
@@ -239,9 +240,24 @@ namespace FastReport
<TableCell Name="Cell66" Border.Lines="All" Text="[Table1.CH_NDTRate]" HorzAlign="Center" VertAlign="Center" Font="宋体, 10pt" ColSpan="2"/>
<TableCell Name="Cell71" Border.Lines="All" HorzAlign="Center" VertAlign="Center" Font="宋体, 10pt"/>
</TableRow>
<TableRow Name="Row31" Height="34.4">
<TableCell Name="Cell237" Border.Lines="All" Text="检测时机" HorzAlign="Center" VertAlign="Center" Font="宋体, 10pt"/>
<TableCell Name="Cell238" Border.Lines="All" AllowExpressions="false" ColSpan="7">
<CheckBoxObject Name="CheckBox1" Left="94.5" Top="15.12" Width="9.45" Height="9.45" Border.Lines="All" Cursor="IBeam" Checked="false"/>
<CheckBoxObject Name="CheckBox2" Left="321.3" Top="15.12" Width="9.45" Height="9.45" Border.Lines="All" Cursor="IBeam" Checked="false"/>
<TextObject Name="Text1" Left="113.4" Top="9.45" Width="94.5" Height="18.9" Text="工厂化预制焊口" HorzAlign="Center" VertAlign="Center" Font="宋体, 8pt"/>
<TextObject Name="Text2" Left="340.2" Top="9.45" Width="94.5" Height="18.9" Text="安装施工焊口" HorzAlign="Center" VertAlign="Center" Font="宋体, 8pt"/>
</TableCell>
<TableCell Name="Cell239" Border.Lines="All"/>
<TableCell Name="Cell240" Border.Lines="All"/>
<TableCell Name="Cell241" Border.Lines="All"/>
<TableCell Name="Cell242" Border.Lines="All"/>
<TableCell Name="Cell243" Border.Lines="All"/>
<TableCell Name="Cell244" Border.Lines="All"/>
</TableRow>
</TableObject>
</PageHeaderBand>
<DataBand Name="Data1" Top="287.54" Width="718.2" Height="71.82">
<DataBand Name="Data1" Top="321.35" Width="718.2" Height="71.82">
<TableObject Name="Tabel_Data" Left="18.9" Width="699.18" Height="71.82" Border.Lines="Top" ManualBuildEvent="Tabel_Data_ManualBuild">
<TableColumn Name="Column21" Width="69.91"/>
<TableColumn Name="Column22" Width="117.16"/>
@@ -272,8 +288,8 @@ namespace FastReport
<TableCell Name="Cell144" Border.Lines="All" Text="[Data.Remark]" HorzAlign="Center" VertAlign="Center"/>
</TableRow>
</TableObject>
<DataFooterBand Name="DataFooter1" Top="416.58" Width="718.2">
<ChildBand Name="Child2" Top="363.4" Width="718.2" Height="49.14" FillUnusedSpace="true">
<DataFooterBand Name="DataFooter1" Top="448.55" Width="718.2">
<ChildBand Name="Child2" Top="396.29" Width="718.2" Height="49.14" FillUnusedSpace="true">
<TableObject Name="Table6" Left="18.9" Width="699.18" Height="49.14" Border.Lines="Top">
<TableColumn Name="Column53" Width="69.91"/>
<TableColumn Name="Column54" Width="117.16"/>
@@ -297,7 +313,7 @@ namespace FastReport
</ChildBand>
</DataFooterBand>
</DataBand>
<PageFooterBand Name="PageFooter1" Top="420.62" Width="718.2" Height="181.43">
<PageFooterBand Name="PageFooter1" Top="451.68" Width="718.2" Height="181.43">
<TableObject Name="Table5" Left="18.9" Width="699.21" Height="135.6" Border.Lines="All" RepeatHeaders="false">
<TableColumn Name="Column37" Width="99.45"/>
<TableColumn Name="Column38" Width="90"/>
@@ -338,7 +354,7 @@ namespace FastReport
<TableCell Name="Cell192" Border.Lines="All"/>
</TableRow>
</TableObject>
<ChildBand Name="Child1" Top="606.09" Width="718.2" Height="17.77" PrintOnBottom="true"/>
<ChildBand Name="Child1" Top="636.23" Width="718.2" Height="32.13" PrintOnBottom="true"/>
</PageFooterBand>
</ReportPage>
</Report>
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Report ScriptLanguage="CSharp" ReportInfo.Created="03/13/2022 11:00:20" ReportInfo.Modified="11/01/2022 16:58:33" ReportInfo.CreatorVersion="2017.1.16.0">
<Report ScriptLanguage="CSharp" ReportInfo.Created="03/13/2022 11:00:20" ReportInfo.Modified="05/13/2025 10:35:40" ReportInfo.CreatorVersion="2017.1.16.0">
<ScriptText>using System;
using System.Collections;
using System.Collections.Generic;
@@ -42,7 +42,7 @@ namespace FastReport
}
</ScriptText>
<Dictionary>
<MsSqlDataConnection Name="Connection" ConnectionString="rijcmlqvJIqZbrmqGn7L0P56UFhaUHihKXxbhpqie4wmZgM2ymDKry7UxzO5md9ybQlkfKpN2rHYbp9GtH1LDQPa7z2vVu/kEnNnTKeHt9obmaC7TQDh0IvsUBSuzhGZdfAIK7YyBqykCgeZm5rvA6K5b7zHGdA+7pUpJ/9ZLpp1NuxWRFfNnlsPZ6nuhwpLtU3gTu4"/>
<MsSqlDataConnection Name="Connection" ConnectionString="rijcmlqvJIqZbrmqGn7L0P56UFhaUHihKXxbhpqie4wmZgM2ymDKry7UxzO5md9ybQlkfKpN2rHYbp9GtH1LDQPa7z2vVu/kEnNnTKeHt9obmaC7TQDh0IvsUBSuzhGZdfAIK7YyBqykCgeZm5rvA6K5b7zHGdA+7pUpJ/9ZLpp1NuxWRFk8mQo03zVTethv81G+TDI"/>
<TableDataSource Name="Data" ReferenceName="Data" DataType="System.Int32" Enabled="true">
<Column Name="PipelineComponentId" DataType="System.String"/>
<Column Name="PipelineComponentCode" DataType="System.String"/>
+8
View File
@@ -1558,6 +1558,7 @@
<Content Include="HJGL\PreDesign\PackagingManageView.aspx" />
<Content Include="HJGL\PreDesign\InstallList.aspx" />
<Content Include="HJGL\PreDesign\PrePipelineQRCodeIn.aspx" />
<Content Include="HJGL\PreDesign\ProductionSchedulingPlan.aspx" />
<Content Include="HJGL\PreDesign\TrainNumberManager.aspx" />
<Content Include="HJGL\PreDesign\TrainNumberManageEdit.aspx" />
<Content Include="HJGL\PreDesign\TrainNumberManagerView.aspx" />
@@ -10585,6 +10586,13 @@
<Compile Include="HJGL\PreDesign\PrePipelineQRCodeIn.aspx.designer.cs">
<DependentUpon>PrePipelineQRCodeIn.aspx</DependentUpon>
</Compile>
<Compile Include="HJGL\PreDesign\ProductionSchedulingPlan.aspx.cs">
<DependentUpon>ProductionSchedulingPlan.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="HJGL\PreDesign\ProductionSchedulingPlan.aspx.designer.cs">
<DependentUpon>ProductionSchedulingPlan.aspx</DependentUpon>
</Compile>
<Compile Include="HJGL\PreDesign\TrainNumberManager.aspx.cs">
<DependentUpon>TrainNumberManager.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
@@ -487,14 +487,18 @@ namespace FineUIPro.Web.HJGL.InfoQuery
/// <param name="e"></param>
protected void btnOut_Click(object sender, EventArgs e)
{
string fileName = "";
if (this.tvControlItem.SelectedNode.CommandName.Split('|').Count() == 2) //单位工程
{
Model.View_HJGL_WeldJoint model = new Model.View_HJGL_WeldJoint();
model.UnitWorkId = this.tvControlItem.SelectedNodeID;
var list = BLL.WeldJointService.GetViewWeldJointsBymodel(model);
View_HJGL_WeldJoint = list;
/* PrintByUnitWork(this.tvControlItem.SelectedNodeID);
return;*/
fileName = UnitWorkService.GetNameById(model.UnitWorkId);
}
else if (this.tvControlItem.SelectedNode.CommandName == "管线")
{
fileName = PipelineService.GetPipelineByPipelineId(this.tvControlItem.SelectedNodeID)?.PipelineCode;
}
string path = Funs.RootPath + @"File\Excel\Temp\JointQuery.xlsx";
@@ -537,7 +541,7 @@ namespace FineUIPro.Web.HJGL.InfoQuery
}).ToList();
MiniExcel.SaveAs(path, q);
string fileName = "焊口信息总览.xlsx";
fileName = fileName+ "-焊口信息总览.xlsx";
FileInfo info = new FileInfo(path);
long fileSize = info.Length;
System.Web.HttpContext.Current.Response.Clear();
@@ -1084,8 +1084,6 @@ namespace FineUIPro.Web.HJGL.PointTrust
//}
#endregion
#region
#endregion
@@ -989,6 +989,9 @@ namespace FineUIPro.Web.HJGL.PointTrust
}
}
protected void btnBack_Click(object sender, EventArgs e)
{
}
#region
/// <summary>
/// 判断是否可以删除
@@ -7,10 +7,12 @@
// </自动生成>
//------------------------------------------------------------------------------
namespace FineUIPro.Web.HJGL.PointTrust {
namespace FineUIPro.Web.HJGL.PointTrust
{
public partial class TrustBatch {
public partial class TrustBatch
{
/// <summary>
/// form1 控件。
@@ -229,36 +229,36 @@ namespace FineUIPro.Web.HJGL.PreDesign
private DataTable BindData()
{
string strSql = @"WITH cte as (select pipeline.PipelineCode as PipelineCode,
comonent.PipelineComponentCode as PipelineComponentCode,
'' as matdef,
packdetail.Number as Number,
pack.PackagingCode as PackagingCode,
trainnumber.TrainNumber as TrainNumber,
pipeline.FlowingSection as FlowingSection,
pipeline.UnitWorkId as UnitWorkId
from HJGL_Pipeline pipeline
left join HJGL_PackagingManageDetail packdetail on pipeline.PipelineId = packdetail.PipelineId
left join HJGL_Pipeline_Component comonent
on packdetail.PipelineComponentId = comonent.PipelineComponentId
left join HJGL_PackagingManage pack on packdetail.PackagingManageId = pack.PackagingManageId
left join HJGL_TrainNumberManage trainnumber on pack.TrainNumberId = TrainNumber.Id
where (packdetail.PipelineComponentId is not null or packdetail.PipelineComponentId != '')
union all
select pipeline.PipelineCode as PipelineCode,
packdetail.MaterialCode as PipelineComponentCode,
matlib.MaterialDef as matdef,
packdetail.Number as Number,
pack.PackagingCode as PackagingCode,
trainnumber.TrainNumber as TrainNumber,
pipeline.FlowingSection as FlowingSection,
pipeline.UnitWorkId as UnitWorkId
from HJGL_Pipeline pipeline
left join HJGL_PackagingManageDetail packdetail on pipeline.PipelineId = packdetail.PipelineId
left join HJGL_MaterialCodeLib matlib on packdetail.MaterialCode = matlib.MaterialCode
left join HJGL_PackagingManage pack on packdetail.PackagingManageId = pack.PackagingManageId
left join HJGL_TrainNumberManage trainnumber on pack.TrainNumberId = TrainNumber.Id
where (packdetail.PipelineComponentId is null or packdetail.PipelineComponentId = ''))
SELECT * FROM cte WHERE 1=1 ";
comonent.PipelineComponentCode as PipelineComponentCode,
'' as matdef,
packdetail.Number as Number,
pack.PackagingCode as PackagingCode,
trainnumber.TrainNumber as TrainNumber,
pipeline.FlowingSection as FlowingSection,
pipeline.UnitWorkId as UnitWorkId
from HJGL_Pipeline pipeline
left join HJGL_PackagingManageDetail packdetail on pipeline.PipelineId = packdetail.PipelineId
left join HJGL_Pipeline_Component comonent
on packdetail.PipelineComponentId = comonent.PipelineComponentId
left join HJGL_PackagingManage pack on packdetail.PackagingManageId = pack.PackagingManageId
left join HJGL_TrainNumberManage trainnumber on pack.TrainNumberId = TrainNumber.Id
where (packdetail.PipelineComponentId is not null or packdetail.PipelineComponentId != '')
union all
select pipeline.PipelineCode as PipelineCode,
packdetail.MaterialCode as PipelineComponentCode,
matlib.MaterialDef as matdef,
packdetail.Number as Number,
pack.PackagingCode as PackagingCode,
trainnumber.TrainNumber as TrainNumber,
pipeline.FlowingSection as FlowingSection,
pipeline.UnitWorkId as UnitWorkId
from HJGL_Pipeline pipeline
left join HJGL_PackagingManageDetail packdetail on pipeline.PipelineId = packdetail.PipelineId
left join HJGL_MaterialCodeLib matlib on packdetail.MaterialCode = matlib.MaterialCode
left join HJGL_PackagingManage pack on packdetail.PackagingManageId = pack.PackagingManageId
left join HJGL_TrainNumberManage trainnumber on pack.TrainNumberId = TrainNumber.Id
where (packdetail.PipelineComponentId is null or packdetail.PipelineComponentId = ''))
SELECT * FROM cte WHERE 1=1 ";
List<SqlParameter> listStr = new List<SqlParameter>();
if (tvControlItem.SelectedNode.CommandName.Split('|').Length == 2)
@@ -390,7 +390,7 @@ SELECT * FROM cte WHERE 1=1 ";
线 = x.Field<string>("PipelineCode"),
= x.Field<string>("PipelineComponentCode"),
= !string.IsNullOrWhiteSpace(x.Field<string>("matdef")) ? x.Field<string>("matdef") : "-",
= x.Field<string>("Number"),
= x.Field<decimal?>("Number"),
= x.Field<string>("PackagingCode"),
= x.Field<string>("TrainNumber"),
= x.Field<string>("FlowingSection")
@@ -1,4 +1,5 @@
using BLL;
using Model;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
@@ -122,6 +123,27 @@ namespace FineUIPro.Web.HJGL.PreDesign
{
table.PipelineComponentId = string.Join(",", dropPipelineComponentCode.Values);
var newDetailList= new List<Model.HJGL_PackagingManageDetail>();
foreach (var item in dropPipelineComponentCode.Values)
{
var ComponentModel = BLL.HJGL_PipelineComponentService.GetPipelineComponentById(item);
if (ComponentModel != null)
{
var model = new Model.HJGL_PackagingManageDetail()
{
Id = SQLHelper.GetNewID(),
PackagingManageId = this.PackagingManageId,
PipelineId = ComponentModel.PipelineId,
PipelineComponentId = item,
CreateTime = DateTime.Now,
CreateUser = this.CurrUser.PersonId,
};
newDetailList.Add(model);
}
}
HJGLPackagingmanagedetailService.DeleteByPackagingManageId(this.PackagingManageId);
HJGLPackagingmanagedetailService.AddBulk(newDetailList);
}
}
BLL.HJGL_PackagingmanageService.UpdateHJGL_PackagingManage(table);
@@ -0,0 +1,171 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ProductionSchedulingPlan.aspx.cs" Inherits="FineUIPro.Web.HJGL.PreDesign.ProductionSchedulingPlan" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>排产计划</title>
<link href="../../res/css/common.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="form1" runat="server">
<f:PageManager ID="PageManager1" AutoSizePanelID="Panel1" runat="server" />
<f:Panel ID="Panel1" runat="server" ShowBorder="false" ShowHeader="false" Layout="Region">
<Items>
<f:Panel runat="server" ID="panelLeftRegion" RegionPosition="Left" RegionSplit="true"
EnableCollapse="true" Width="300px" Title="WBS目录"
ShowBorder="true" Layout="VBox" ShowHeader="true" AutoScroll="true" BodyPadding="5px"
IconFont="ArrowCircleLeft">
<Toolbars>
<f:Toolbar ID="Toolbar1" Position="Top" runat="server" ToolbarAlign="Left">
<Items>
<f:TextBox ID="txtPipelineCode" runat="server" Label="管线"
EmptyText="输入查询条件" Width="280px" LabelWidth="60px">
</f:TextBox>
<f:HiddenField runat="server" ID="hdUnitWorkId"></f:HiddenField>
</Items>
</f:Toolbar>
<f:Toolbar runat="server" ToolbarAlign="Right">
<Items>
<f:ToolbarFill runat="server"></f:ToolbarFill>
<f:Button ID="btnTreeFind" ToolTip="查询" Icon="SystemSearch"
EnablePostBack="true" OnClick="btnTreeFind_Click" runat="server">
</f:Button>
</Items>
</f:Toolbar>
</Toolbars>
<Items>
<f:Tree ID="tvControlItem" ShowHeader="false" Height="560px" Title="单位工程"
OnNodeCommand="tvControlItem_NodeCommand" runat="server" ShowBorder="false" EnableCollapse="true"
EnableSingleClickExpand="false" AutoLeafIdentification="true" OnNodeExpand="tvControlItem_TreeNodeExpanded"
EnableTextSelection="true">
</f:Tree>
</Items>
</f:Panel>
<f:Panel runat="server" ID="panelCenterRegion" RegionPosition="Center" ShowBorder="true"
Layout="VBox" ShowHeader="false" BodyPadding="5px" IconFont="PlusCircle" Title="排产计划"
TitleToolTip="排产计划" AutoScroll="true">
<Toolbars>
<f:Toolbar ID="Toolbar3" Position="Top" runat="server" ToolbarAlign="Left">
<Items>
<f:ToolbarFill ID="ToolbarFill1" runat="server">
</f:ToolbarFill>
<f:Button ID="btnSave" runat="server" OnClick="btnSave_Click" Text="保存" Icon="SystemSave"></f:Button>
<f:Button ID="btnOut" OnClick="btnOut_Click" runat="server" Text="导出"
Icon="TableGo" EnableAjax="false" EnablePostBack="true" >
</f:Button>
</Items>
</f:Toolbar>
</Toolbars>
<Items>
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" Title="排产计划" ForceFit="false"
EnableCollapse="true" runat="server" BoxFlex="1" DataKeyNames="ProductionSchedulingPlanId" AllowCellEditing="true"
AllowColumnLocking="true" EnableColumnLines="true" ClicksToEdit="1" DataIDField="ProductionSchedulingPlanId"
AllowSorting="true" SortField="FlowNum" SortDirection="ASC" OnSort="Grid1_Sort"
AllowPaging="true" IsDatabasePaging="true" PageSize="15" OnPageIndexChange="Grid1_PageIndexChange"
EnableTextSelection="True">
<Columns>
<f:RowNumberField EnablePagingNumber="true" HeaderText="序号"
Width="60px" HeaderTextAlign="Center" TextAlign="Center" />
<f:RenderField HeaderText="流水段号" ColumnID="FlowNum"
DataField="FlowNum" SortField="FlowNum" FieldType="String" HeaderTextAlign="Center" TextAlign="Left"
Width="120px">
</f:RenderField>
<f:RenderField HeaderText="主项名称" ColumnID="MainItemName"
DataField="MainItemName" SortField="MainItemName" FieldType="String" HeaderTextAlign="Center" TextAlign="Left"
Width="120px">
</f:RenderField>
<f:RenderField HeaderText="材质" ColumnID="Material"
DataField="Material" SortField="Material" FieldType="String" HeaderTextAlign="Center" TextAlign="Left"
Width="100px">
</f:RenderField>
<f:RenderField HeaderText="口径" ColumnID="Caliber"
DataField="Caliber" SortField="Caliber" FieldType="String" HeaderTextAlign="Center" TextAlign="Left"
Width="100px">
</f:RenderField>
<f:RenderField HeaderText="达因数" ColumnID="Dain"
DataField="Dain" SortField="Dain" FieldType="Float" HeaderTextAlign="Center" TextAlign="Left"
Width="90px">
</f:RenderField>
<f:RenderField HeaderText="总达因" ColumnID="TotalDyne"
DataField="TotalDyne" SortField="TotalDyne" FieldType="Float" HeaderTextAlign="Center" TextAlign="Left"
Width="90px">
</f:RenderField>
<f:RenderField HeaderText="总优先级" ColumnID="TotalPriority"
DataField="TotalPriority" SortField="TotalPriority" FieldType="String" HeaderTextAlign="Center" TextAlign="Left"
Width="100px">
<Editor>
<f:TextBox ID="txtTotalPriority" runat="server"></f:TextBox>
</Editor>
</f:RenderField>
<f:RenderField HeaderText="优先级总达因" ColumnID="PriorityTotalDyne"
DataField="PriorityTotalDyne" SortField="PriorityTotalDyne" FieldType="Float" HeaderTextAlign="Center" TextAlign="Left"
Width="120px">
<Editor>
<f:NumberBox ID="txtPriorityTotalDyne" runat="server"></f:NumberBox>
</Editor>
</f:RenderField>
<f:RenderField HeaderText="计划开始时间" ColumnID="PlanStartDate"
DataField="PlanStartDate" SortField="PlanStartDate" FieldType="Date" Renderer="Date" RendererArgument="yyyy-MM-dd" HeaderTextAlign="Center" TextAlign="Left"
Width="120px">
<Editor>
<f:DatePicker ID="txtPlanStartDate" runat="server"></f:DatePicker>
</Editor>
</f:RenderField>
<f:RenderField HeaderText="计划结束时间" ColumnID="PlanEndDate"
DataField="PlanEndDate" SortField="PlanEndDate" FieldType="Date" Renderer="Date" RendererArgument="yyyy-MM-dd" HeaderTextAlign="Center" TextAlign="Left"
Width="120px">
<Editor>
<f:DatePicker ID="txtPlanEndDate" runat="server"></f:DatePicker>
</Editor>
</f:RenderField>
<f:RenderField HeaderText="天数" ColumnID="Days"
DataField="Days" SortField="Days" FieldType="Int" HeaderTextAlign="Center" TextAlign="Left"
Width="90px">
<Editor>
<f:NumberBox ID="txtDays" runat="server" NoDecimal="true" NoNegative="true"></f:NumberBox>
</Editor>
</f:RenderField>
<f:RenderField HeaderText="平均每天工作量" ColumnID="AvgDailyWorkload"
DataField="AvgDailyWorkload" SortField="AvgDailyWorkload" FieldType="Float" HeaderTextAlign="Center" TextAlign="Left"
Width="120px">
<Editor>
<f:NumberBox ID="txtAvgDailyWorkload" runat="server" NoNegative="true"></f:NumberBox>
</Editor>
</f:RenderField>
</Columns>
<Listeners>
<f:Listener Event="dataload" Handler="onGridDataLoad" />
</Listeners>
<PageItems>
<f:ToolbarSeparator ID="ToolbarSeparator1" runat="server">
</f:ToolbarSeparator>
<f:ToolbarText ID="ToolbarText1" runat="server" Text="每页记录数:">
</f:ToolbarText>
<f:DropDownList runat="server" ID="ddlPageSize" Width="80px" AutoPostBack="true"
OnSelectedIndexChanged="ddlPageSize_SelectedIndexChanged">
<f:ListItem Text="10" Value="10" />
<f:ListItem Text="15" Value="15" />
<f:ListItem Text="20" Value="20" />
<f:ListItem Text="25" Value="25" />
<f:ListItem Text="所有行" Value="10000" />
</f:DropDownList>
</PageItems>
</f:Grid>
</Items>
</f:Panel>
</Items>
</f:Panel>
</form>
<script type="text/javascript">
function reloadGrid() {
__doPostBack(null, 'reloadGrid');
}
function onGridDataLoad(event) {
this.mergeColumns(['FlowNum', 'MainItemName', 'Material', 'TotalDyne']);
}
</script>
</body>
</html>
@@ -0,0 +1,526 @@
using BLL;
using MiniExcelLibs;
using Model;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Data.SqlTypes;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Web;
using System.Web.WebSockets;
namespace FineUIPro.Web.HJGL.PreDesign
{
public partial class ProductionSchedulingPlan : PageBase
{
public int pageSize = 20;
public static DataTable GridDataTable = new DataTable();
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.ddlPageSize.SelectedValue = this.Grid1.PageSize.ToString();
this.InitTreeMenu();//加载树
}
}
#region --
/// <summary>
/// 加载树
/// </summary>
private void InitTreeMenu()
{
this.tvControlItem.Nodes.Clear();
TreeNode rootNode1 = new TreeNode();
rootNode1.NodeID = "1";
rootNode1.Text = "建筑工程";
rootNode1.CommandName = "建筑工程";
rootNode1.Selectable = false;
this.tvControlItem.Nodes.Add(rootNode1);
TreeNode rootNode2 = new TreeNode();
rootNode2.NodeID = "2";
rootNode2.Text = "安装工程";
rootNode2.CommandName = "安装工程";
rootNode2.Expanded = true;
this.tvControlItem.Nodes.Add(rootNode2);
var pUnits = (from x in Funs.DB.Project_ProjectUnit where x.ProjectId == this.CurrUser.LoginProjectId select x).ToList();
// 获取当前用户所在单位
var currUnit = pUnits.FirstOrDefault(x => x.UnitId == this.CurrUser.UnitId);
var unitWorkList = (from x in Funs.DB.WBS_UnitWork
where x.ProjectId == this.CurrUser.LoginProjectId
&& x.SuperUnitWork == null && x.UnitId != null && x.ProjectType != null
select x).ToList();
List<Model.WBS_UnitWork> unitWork1 = null;
List<Model.WBS_UnitWork> unitWork2 = null;
//// 当前为施工单位,只能操作本单位的数据
//if (currUnit != null && currUnit.UnitType == Const.ProjectUnitType_2)
//{
// unitWork1 = (from x in unitWorkList
// where x.UnitId == this.CurrUser.UnitId && x.ProjectType == "1"
// select x).ToList();
// unitWork2 = (from x in unitWorkList
// where x.UnitId == this.CurrUser.UnitId && x.ProjectType == "2"
// select x).ToList();
//}
//else
//{
unitWork1 = (from x in unitWorkList where x.ProjectType == "1" select x).ToList();
unitWork2 = (from x in unitWorkList where x.ProjectType == "2" select x).ToList();
//}
if (unitWork1.Count() > 0)
{
foreach (var q in unitWork1)
{
int a = (from x in Funs.DB.HJGL_Pipeline where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitWorkId == q.UnitWorkId && x.PipeArea == "1" && x.PipelineCode.Contains(txtPipelineCode.Text.Trim()) select x.FlowingSection).Distinct().Count();
var unitNamesUnitIds = BLL.UnitService.getUnitNamesUnitIds(q.UnitId);
TreeNode tn1 = new TreeNode();
tn1.NodeID = q.UnitWorkId;
//tn1.Text = q.UnitWorkName + "【" + a.ToString() + "】" + "管线";
tn1.Text = q.UnitWorkName;
tn1.ToolTip = "施工单位:" + unitNamesUnitIds;
tn1.CommandName = 1 + "|" + Funs.GetEndPageNumber(a, pageSize);
tn1.EnableClickEvent = true;
tn1.EnableExpandEvent = true;
rootNode1.Nodes.Add(tn1);
if (a > 0)
{
// BindNodes(tn1);
TreeNode newNode = new TreeNode();
newNode.Text = "加载流水段...";
newNode.NodeID = "加载流水段...";
tn1.Nodes.Add(newNode);
}
//if (a > 0)
//{
// BindNodes(tn1);
//}
}
}
if (unitWork2.Count() > 0)
{
foreach (var q in unitWork2)
{
int a = (from x in Funs.DB.HJGL_Pipeline where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitWorkId == q.UnitWorkId && x.PipeArea == "1" && x.PipelineCode.Contains(txtPipelineCode.Text.Trim()) select x.FlowingSection).Distinct().Count();
var unitNamesUnitIds = BLL.UnitService.getUnitNamesUnitIds(q.UnitId);
TreeNode tn2 = new TreeNode();
tn2.NodeID = q.UnitWorkId;
//tn2.Text = q.UnitWorkName + "【" + a.ToString() + "】" + "管线";
tn2.Text = q.UnitWorkName;
if (q.UnitWorkId == this.hdUnitWorkId.Text)
{
tn2.Expanded = true;
}
tn2.ToolTip = "施工单位:" + unitNamesUnitIds;
tn2.CommandName = 1 + "|" + Funs.GetEndPageNumber(a, pageSize);
tn2.EnableClickEvent = true;
tn2.EnableExpandEvent = true;
rootNode2.Nodes.Add(tn2);
if (a > 0)
{
// BindNodes(tn1);
TreeNode newNode = new TreeNode();
newNode.Text = "加载流水段...";
newNode.NodeID = "加载流水段...";
tn2.Nodes.Add(newNode);
}
//if (a > 0)
//{
// BindNodes(tn2);
//}
}
}
}
private void BindNodes(TreeNode node)
{
List<string> flowingSection = new List<string>();
//List<Model.HJGL_Pipeline> pipeline = new List<Model.HJGL_Pipeline>();
var list = (from x in Funs.DB.HJGL_Pipeline where x.ProjectId == this.CurrUser.LoginProjectId && x.PipeArea == "1" && x.UnitWorkId == node.NodeID && x.PipelineCode.Contains(this.txtPipelineCode.Text.Trim()) select x.FlowingSection).ToList();
flowingSection = list.Where(x => !string.IsNullOrWhiteSpace(x) == true).Distinct().OrderBy(x => x).ToList();
//int pageindex = int.Parse(node.CommandName.Split('|')[0]);
//int pageCount = int.Parse(node.CommandName.Split('|')[1]);
//if (pageindex <= pageCount)
//{
// flowingSection = flowingSection.Skip(pageSize * (pageindex - 1)).Take(pageSize).ToList();
foreach (var item in flowingSection)
{
//var comCount = (from x in Funs.DB.HJGL_Pipeline_Component where x.PipelineId == item.PipelineId select x).Count();
TreeNode newNode = new TreeNode();
//newNode.Text = item.PipelineCode + "【" + comCount.ToString() + " " + "组件" + "】";
newNode.Text = item;
newNode.ToolTip = "流水段";
newNode.CommandName = "流水段";
newNode.NodeID = SQLHelper.GetNewID();
newNode.EnableClickEvent = true;
node.Nodes.Add(newNode);
}
// if (pageindex < pageCount)
// {
// TreeNode newNode = new TreeNode();
// newNode.Text = "加载";
// newNode.NodeID = "加载";
// //newNode.NodeID = SQLHelper.GetNewID();
// newNode.CommandName = "加载";
// newNode.Icon = Icon.ArrowDown;
// newNode.EnableClickEvent = true;
// node.Nodes.Add(newNode);
// }
//}
}
#endregion
protected void tvControlItem_TreeNodeExpanded(object sender, TreeNodeEventArgs e)
{
if (e.Node.Nodes[0].NodeID == "加载流水段...")
{
e.Node.Nodes.Clear();
BindNodes(e.Node);
}
}
#region TreeView
/// <summary>
/// 点击TreeView
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void tvControlItem_NodeCommand(object sender, TreeCommandEventArgs e)
{
if (e.CommandName == "流水段")
{
Model.HJGL_Pipeline pipeline = BLL.PipelineService.GetPipelineByFlowingSection(this.tvControlItem.SelectedNode.Text);
this.hdUnitWorkId.Text = string.Empty;
if (pipeline != null)
{
this.hdUnitWorkId.Text = this.tvControlItem.SelectedNode.ParentNode.NodeID;
SaveProductionSchedulingPlan();
}
}
this.BindGrid();
}
/// <summary>
/// 保存数据
/// </summary>
/// <exception cref="NotImplementedException"></exception>
private void SaveProductionSchedulingPlan()
{
if (!string.IsNullOrEmpty(this.tvControlItem.SelectedNodeID))
{
List<Model.View_HJGL_ProductionSchedulingPlanStatistics> lists = (from x in Funs.DB.View_HJGL_ProductionSchedulingPlanStatistics.Where(x => x.ProjectId == this.CurrUser.LoginProjectId && x.FlowingSection == this.tvControlItem.SelectedNode.Text) select x).ToList();
foreach (var item in lists)
{
var plan = BLL.ProductionSchedulingPlanService.GetProductionSchedulingPlan(this.CurrUser.LoginProjectId, item.FlowingSection, item.UnitWorkName, item.Material, item.Caliber);
if (plan == null)
{
Model.HJGL_ProductionSchedulingPlan newPlan = new HJGL_ProductionSchedulingPlan();
newPlan.ProductionSchedulingPlanId = SQLHelper.GetNewID(typeof(Model.HJGL_ProductionSchedulingPlan));
newPlan.ProjectId = this.CurrUser.LoginProjectId;
//newPlan.PipelineId = this.tvControlItem.SelectedNodeID;
newPlan.FlowNum = item.FlowingSection;
newPlan.MainItemName = item.UnitWorkName;
newPlan.Material = item.Material;
newPlan.Caliber = item.Caliber;
newPlan.Dain = item.Dia;
newPlan.TotalDyne = lists.Sum(x => x.Dia);
BLL.ProductionSchedulingPlanService.AddProductionSchedulingPlan(newPlan);
}
}
}
}
#endregion
#region
/// <summary>
/// 数据绑定
/// </summary>
private void BindGrid()
{
if (tvControlItem.SelectedNode == null) return;
string strSql = @"SELECT p.ProductionSchedulingPlanId,
p.ProjectId,
p.PipelineId,
p.FlowNum,
p.MainItemName,
p.Material,
p.Caliber,
p.Dain,
p.TotalDyne,
p.TotalPriority,
p.PriorityTotalDyne,
p.PlanStartDate,
p.PlanEndDate,
p.Days,
p.AvgDailyWorkload
FROM HJGL_ProductionSchedulingPlan p
WHERE 1=1 ";
List<SqlParameter> listStr = new List<SqlParameter>();
if (tvControlItem.SelectedNode.CommandName.Split('|').Length == 2)
{
strSql += " and p.MainItemName =@UnitWorkId";
listStr.Add(new SqlParameter("@UnitWorkId", this.tvControlItem.SelectedNode.Text));
}
else if (tvControlItem.SelectedNode.CommandName == "流水段")
{
strSql += " and p.FlowNum = @FlowNum ";
listStr.Add(new SqlParameter("@FlowNum", this.tvControlItem.SelectedNode.Text));
}
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
GridDataTable = tb;
// 2.获取当前分页数据
Grid1.RecordCount = tb.Rows.Count;
var table = this.GetPagedDataTable(Grid1, tb);
Grid1.DataSource = table;
Grid1.DataBind();
}
#endregion
#region
#region
/// <summary>
/// 页索引改变事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
{
BindGrid();
}
#endregion
#region
/// <summary>
/// 排序
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_Sort(object sender, GridSortEventArgs e)
{
BindGrid();
}
#endregion
#region
/// <summary>
/// 分页选择下拉改变事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
{
Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue);
BindGrid();
}
#endregion
#endregion
#region
protected void btnSearch_Click(object sender, EventArgs e)
{
BindGrid();
}
#endregion
#region
/// <summary>
/// 查询
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void TextBox_TextChanged(object sender, EventArgs e)
{
this.BindGrid();
}
protected void btnTreeFind_Click(object sender, EventArgs e)
{
this.InitTreeMenu();
}
#endregion
#region
/// <summary>
/// 保存
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnSave_Click(object sender, EventArgs e)
{
if (this.Grid1.Rows.Count > 0)
{
foreach (JObject mergedRow in Grid1.GetMergedData())
{
JObject values = mergedRow.Value<JObject>("values");
int i = mergedRow.Value<int>("index");
string rowId = Grid1.Rows[i].RowID;
var newPlan = BLL.ProductionSchedulingPlanService.GetProductionSchedulingPlanById(rowId);
if (newPlan != null)
{
newPlan.TotalPriority = values.Value<string>("TotalPriority");
newPlan.PriorityTotalDyne = Funs.GetNewDecimal(values.Value<string>("PriorityTotalDyne"));
newPlan.PlanStartDate = Funs.GetNewDateTime(values.Value<string>("PlanStartDate"));
newPlan.PlanEndDate = Funs.GetNewDateTime(values.Value<string>("PlanEndDate"));
newPlan.Days = Funs.GetNewInt(values.Value<string>("Days"));
newPlan.AvgDailyWorkload = Funs.GetNewDecimal(values.Value<string>("AvgDailyWorkload"));
BLL.ProductionSchedulingPlanService.UpdateProductionSchedulingPlan(newPlan);
}
}
ShowNotify("保存成功!", MessageBoxIcon.Success);
BindGrid();
}
}
#endregion
#region
protected void btnOut_Click(object sender, EventArgs e)
{
string rootPath = Server.MapPath("~/");
string initTemplatePath = Const.HJGL_ProductionSchedulingPlanPath;
string uploadfilepath = string.Empty;
string newUrl = string.Empty;
uploadfilepath = rootPath + initTemplatePath;
var lists = (from x in Funs.DB.HJGL_ProductionSchedulingPlan
where x.ProjectId == this.CurrUser.LoginProjectId
select x);
if (tvControlItem.SelectedNode.CommandName.Split('|').Length == 2)
{
lists = lists.Where(x => x.MainItemName == this.tvControlItem.SelectedNode.Text);
}
else if (tvControlItem.SelectedNode.CommandName == "流水段")
{
lists = lists.Where(x => x.FlowNum == this.tvControlItem.SelectedNode.Text);
}
if (lists != null)
{
newUrl = uploadfilepath.Replace("排产计划导出模板", "排产计划(" + DateTime.Now.ToString("yyyyMMdd") + ")");
if (File.Exists(newUrl))
{
File.Delete(newUrl);
}
File.Copy(uploadfilepath, newUrl);
// 第一步:读取文件流
NPOI.SS.UserModel.IWorkbook workbook;
using (FileStream stream = new FileStream(newUrl, FileMode.Open, FileAccess.Read))
{
workbook = new NPOI.XSSF.UserModel.XSSFWorkbook(stream);
//workbook = new NPOI.HSSF.UserModel.HSSFWorkbook(stream);
}
// 创建单元格样式
NPOI.SS.UserModel.ICellStyle cellStyle = workbook.CreateCellStyle();
cellStyle.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
cellStyle.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
cellStyle.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
cellStyle.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
cellStyle.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Center;
cellStyle.VerticalAlignment = NPOI.SS.UserModel.VerticalAlignment.Center;
cellStyle.WrapText = true;//自动换行
var font = workbook.CreateFont();
font.FontHeightInPoints = 11;
cellStyle.SetFont(font);
// 第二步:创建新数据行
NPOI.SS.UserModel.ISheet sheet = workbook.GetSheetAt(0);
NPOI.SS.UserModel.IRow row = sheet.GetRow(0);
NPOI.SS.UserModel.ICell cell;
int i = 1;
foreach (var item in lists)
{
// 第二步:创建新数据行
row = sheet.CreateRow(i);
// 添加数据
cell = row.CreateCell(0);
cell.CellStyle = cellStyle;
cell.SetCellValue(item.FlowNum);//流水段号
cell = row.CreateCell(1);
cell.CellStyle = cellStyle;
cell.SetCellValue(item.MainItemName);//主项名称
cell = row.CreateCell(2);
cell.CellStyle = cellStyle;
cell.SetCellValue(item.Material);//材质
cell = row.CreateCell(3);
cell.CellStyle = cellStyle;
cell.SetCellValue(item.Caliber);//口径
cell = row.CreateCell(4);
cell.CellStyle = cellStyle;
cell.SetCellValue(item.Dain.HasValue ? item.Dain.ToString() : "");//达因数
cell = row.CreateCell(5);
cell.CellStyle = cellStyle;
cell.SetCellValue(item.TotalDyne.HasValue?item.TotalDyne.ToString():"");//总达因数
cell = row.CreateCell(6);
cell.CellStyle = cellStyle;
cell.SetCellValue(item.TotalPriority);//总优先级
cell = row.CreateCell(7);
cell.CellStyle = cellStyle;
cell.SetCellValue(item.PriorityTotalDyne.HasValue ? item.PriorityTotalDyne.ToString() : "");//优先级总达因
cell = row.CreateCell(8);
cell.CellStyle = cellStyle;
cell.SetCellValue(item.PlanStartDate.HasValue ? string.Format("{0:yyyy-MM-dd}", item.PlanStartDate) : "");//计划开始时间
cell = row.CreateCell(9);
cell.CellStyle = cellStyle;
cell.SetCellValue(item.PlanEndDate.HasValue ? string.Format("{0:yyyy-MM-dd}", item.PlanEndDate) : "");//计划结束时间
cell = row.CreateCell(10);
cell.CellStyle = cellStyle;
cell.SetCellValue(item.Days.HasValue?item.Days.ToString():"");//天数
cell = row.CreateCell(11);
cell.CellStyle = cellStyle;
cell.SetCellValue(item.AvgDailyWorkload.HasValue ? item.AvgDailyWorkload.ToString():"");//平均每天工作量
i++;
}
// 第三步:写入文件流
using (FileStream stream = new FileStream(newUrl, FileMode.Create, FileAccess.Write))
{
workbook.Write(stream);
workbook.Close();
}
string fileName = Path.GetFileName(newUrl);
FileInfo info = new FileInfo(newUrl);
long fileSize = info.Length;
Response.Clear();
Response.ContentType = "application/x-zip-compressed";
Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
Response.AddHeader("Content-Length", fileSize.ToString());
Response.TransmitFile(newUrl, 0, fileSize);
Response.Flush();
Response.Close();
File.Delete(newUrl);
}
else
{
Alert.ShowInTop("当前无记录,无法导出!", MessageBoxIcon.Warning);
}
}
#endregion
}
}
@@ -0,0 +1,233 @@
//------------------------------------------------------------------------------
// <自动生成>
// 此代码由工具生成。
//
// 对此文件的更改可能导致不正确的行为,如果
// 重新生成代码,则所做更改将丢失。
// </自动生成>
//------------------------------------------------------------------------------
namespace FineUIPro.Web.HJGL.PreDesign
{
public partial class ProductionSchedulingPlan
{
/// <summary>
/// form1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
/// <summary>
/// PageManager1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.PageManager PageManager1;
/// <summary>
/// Panel1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Panel Panel1;
/// <summary>
/// panelLeftRegion 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Panel panelLeftRegion;
/// <summary>
/// Toolbar1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Toolbar Toolbar1;
/// <summary>
/// txtPipelineCode 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtPipelineCode;
/// <summary>
/// hdUnitWorkId 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.HiddenField hdUnitWorkId;
/// <summary>
/// btnTreeFind 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnTreeFind;
/// <summary>
/// tvControlItem 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Tree tvControlItem;
/// <summary>
/// panelCenterRegion 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Panel panelCenterRegion;
/// <summary>
/// Toolbar3 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Toolbar Toolbar3;
/// <summary>
/// ToolbarFill1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.ToolbarFill ToolbarFill1;
/// <summary>
/// btnSave 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnSave;
/// <summary>
/// btnOut 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnOut;
/// <summary>
/// Grid1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Grid Grid1;
/// <summary>
/// txtTotalPriority 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtTotalPriority;
/// <summary>
/// txtPriorityTotalDyne 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.NumberBox txtPriorityTotalDyne;
/// <summary>
/// txtPlanStartDate 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DatePicker txtPlanStartDate;
/// <summary>
/// txtPlanEndDate 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DatePicker txtPlanEndDate;
/// <summary>
/// txtDays 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.NumberBox txtDays;
/// <summary>
/// txtAvgDailyWorkload 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.NumberBox txtAvgDailyWorkload;
/// <summary>
/// ToolbarSeparator1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.ToolbarSeparator ToolbarSeparator1;
/// <summary>
/// ToolbarText1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.ToolbarText ToolbarText1;
/// <summary>
/// ddlPageSize 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DropDownList ddlPageSize;
}
}
@@ -32,6 +32,8 @@
<f:Button ID="btnNew" Text="新增" Icon="Add" EnablePostBack="false" Hidden="true"
runat="server">
</f:Button>
<f:Button ID="Button1" Text="推送" Icon="Add" runat="server" OnClick="Button1_Click">
</f:Button>
<f:Button ID="btnOut" OnClick="btnOut_Click" runat="server" Text="导出" Icon="FolderUp"
EnableAjax="false" DisableControlBeforePostBack="false">
</f:Button>
@@ -329,5 +329,35 @@ namespace FineUIPro.Web.HSSE.CostGoods
PrinterDocService.PrinterDocMethod(Const.ProjectCostManageMenuId, Grid1.SelectedRowID, "HSSE费用管理");
}
protected void Button1_Click(object sender, EventArgs e)
{
if (Grid1.SelectedRowIndexArray.Length == 0)
{
Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
return;
}
string costManageId = Grid1.SelectedRowID;
var costManage = CostManageService.GetCostManageById(costManageId);
if (costManage != null && costManage.States == Const.State_2)
{
if (string.IsNullOrEmpty(costManage.ContractNum))
{
Alert.ShowInTop("未关联合同,无法推送!", MessageBoxIcon.Warning);
}
else
{
string messaage = CostManageService.PushDataToHSE(this.CurrUser.LoginProjectId, costManage.ContractNum);
}
}
else
{
Alert.ShowInTop("未审核完成无法推送!", MessageBoxIcon.Warning);
}
}
}
}
@@ -86,6 +86,15 @@ namespace FineUIPro.Web.HSSE.CostGoods
/// </remarks>
protected global::FineUIPro.Button btnNew;
/// <summary>
/// Button1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button Button1;
/// <summary>
/// btnOut 控件。
/// </summary>
@@ -29,8 +29,10 @@
</f:FormRow>
<f:FormRow>
<Items>
<f:TextBox ID="txtContractNum" runat="server" Label="合同号" MaxLength="50" FocusOnPageLoad="true">
</f:TextBox>
<%--<f:TextBox ID="txtContractNum" runat="server" Label="合同号" MaxLength="50" FocusOnPageLoad="true">
</f:TextBox>--%>
<f:DropDownList ID="drpContractNum" runat="server" Label="合同号" Required="true" ShowRedStar="true" EmptyText="-请选择-">
</f:DropDownList>
<f:DatePicker ID="txtCostManageDate" runat="server" Label="日期" EnableEdit="false">
</f:DatePicker>
</Items>
@@ -39,8 +41,9 @@
<Items>
<f:TextBox ID="txtHseCost" runat="server" Label="HSE费用总金额(元)" LabelWidth="180px" Readonly="true">
</f:TextBox>
<f:TextBox ID="txtGetCost" runat="server" Label="已支付的HSE费用(元)" LabelWidth="180px" Readonly="true">
<f:TextBox ID="txtGetCost" runat="server" Label="已支付的HSE费用(元)" LabelWidth="180px" Readonly="true">
</f:TextBox>
<f:NumberBox ID="txtSumMoney" runat="server" Label="本次申请费用(元)" LabelWidth="180px" MinValue="0" NoDecimal="false" NoNegative="true" DecimalPrecision="2" Required="true" ShowRedStar="true" Increment="0.01"></f:NumberBox>
</Items>
</f:FormRow>
<f:FormRow>
@@ -52,7 +52,7 @@ namespace FineUIPro.Web.HSSE.CostGoods
{
this.btnClose.OnClientClick = ActiveWindow.GetHideRefreshReference();
this.ProjectId = this.CurrUser.LoginProjectId;
BLL.ContractService.InitCompletedContractsDropDownList(this.ProjectId,this.drpContractNum);
BLL.UnitService.InitUnitDropDownList(this.drpUnit, this.ProjectId, false);
this.CostManageId = Request.Params["CostManageId"] ?? SQLHelper.GetNewID();
var costManage = BLL.CostManageService.GetCostManageById(this.CostManageId);
@@ -68,7 +68,7 @@ namespace FineUIPro.Web.HSSE.CostGoods
{
this.drpUnit.SelectedValue = costManage.UnitId;
}
this.txtContractNum.Text = costManage.ContractNum;
this.drpContractNum.SelectedValue = costManage.ContractNum;
this.txtCostManageDate.Text = string.Format("{0:yyyy-MM-dd}", costManage.CostManageDate);
}
@@ -303,13 +303,17 @@ namespace FineUIPro.Web.HSSE.CostGoods
{
ProjectId = this.ProjectId,
UnitId = this.drpUnit.SelectedValue == Const._Null ? null : this.drpUnit.SelectedValue,
ContractNum = this.txtContractNum.Text.Trim(),
ContractNum = this.drpContractNum.SelectedValue,
CostManageDate = Funs.GetNewDateTime(this.txtCostManageDate.Text.Trim()),
States = BLL.Const.State_0,
CompileMan = this.CurrUser.PersonId,
CompileDate = DateTime.Now,
};
var costManageItems = CostManageItemService.GetCostManageItemByCostManageId(this.CostManageId);
if (costManageItems.Count ==0)
{
costManage.SumMoney = decimal.Parse(txtHseCost.Text.Trim());
}
if (type == Const.BtnSubmit)
{
costManage.States = BLL.Const.State_1;
@@ -60,13 +60,13 @@ namespace FineUIPro.Web.HSSE.CostGoods
protected global::FineUIPro.DropDownList drpUnit;
/// <summary>
/// txtContractNum 控件。
/// drpContractNum 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtContractNum;
protected global::FineUIPro.DropDownList drpContractNum;
/// <summary>
/// txtCostManageDate 控件。
@@ -95,6 +95,15 @@ namespace FineUIPro.Web.HSSE.CostGoods
/// </remarks>
protected global::FineUIPro.TextBox txtGetCost;
/// <summary>
/// txtSumMoney 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.NumberBox txtSumMoney;
/// <summary>
/// Grid1 控件。
/// </summary>
+1
View File
@@ -17,6 +17,7 @@
<TreeNode id="25DED954-10C9-47CC-99F2-C44FDE9E0A81" Text="包装管理" NavigateUrl="HJGL/PreDesign/PackagingManage.aspx"></TreeNode>
<TreeNode id="EEC0D060-C15E-4D25-B015-C2B91F735DAC" Text="车次管理" NavigateUrl="HJGL/PreDesign/TrainNumberManager.aspx"></TreeNode>
<TreeNode id="BD9C587E-17C2-49F1-82AE-A05117E41D89" Text="安装清单" NavigateUrl="HJGL/PreDesign/InstallList.aspx"></TreeNode>
<TreeNode id="53948077-B51D-4FF3-BFB0-AB4E27C42875" Text="排产计划" NavigateUrl="HJGL/PreDesign/ProductionSchedulingPlan.aspx"></TreeNode>
</TreeNode>
<TreeNode id="9B828E92-733B-4AF9-9DD0-55ECD8B64AB8" Text="材料管理" NavigateUrl=""><TreeNode id="E29C1839-3530-45EC-A752-B26A0027E2CD" Text="入库管理" NavigateUrl=""><TreeNode id="324C72AF-447A-4308-AFB7-ABF788C58240" Text="入库申请" NavigateUrl="CLGL/InPlanMaster.aspx"></TreeNode>
<TreeNode id="4A55351A-2440-4A2D-8509-3FFEE5FC8861" Text="入库单管理" NavigateUrl="CLGL/InputMaster.aspx"></TreeNode>
+29
View File
@@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Model
{
/// <summary>
/// pu推送安全费用模型
/// </summary>
public class PuPayCraftAmountInput
{
public string projectId { get; set; }
public string contractNo { get; set; }
public string amountHSE { get; set; }
public PuPayCraftAmountFileInput[] files { get; set; }
}
/// <summary>
/// pu推送安全费用文件模型
/// </summary>
public class PuPayCraftAmountFileInput
{
public string name { get; set; }
public string content { get; set; }
public string thisamount { get; set; }
public string date { get; set; }
}
}
+1620
View File
File diff suppressed because it is too large Load Diff
+1
View File
@@ -236,6 +236,7 @@
<Compile Include="HJGL\sp_index_HJGLItem.cs" />
<Compile Include="HSSE\DigDataHSEDataCollectItem.cs" />
<Compile Include="HSSE\PageDataPersonInOutItem.cs" />
<Compile Include="HSSE\PuPayCraftAmountInput.cs" />
<Compile Include="HSSE\WorkPostStatisticItem.cs" />
<Compile Include="HSSE\HSSE_HazardTemplate.cs" />
<Compile Include="Model.cs" />