20250603 排产计划
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -23,22 +23,17 @@ namespace BLL
|
||||
return Funs.DB.HJGL_ProductionSchedulingPlan.FirstOrDefault(e => e.ProductionSchedulingPlanId == productionSchedulingPlanId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据管线Id获取排产计划
|
||||
/// </summary>
|
||||
/// <param name="projectId"></param>
|
||||
/// <param name="pipelineId"></param>
|
||||
/// <returns></returns>
|
||||
public static Model.HJGL_ProductionSchedulingPlan GetProductionSchedulingPlanByPipelineId(string projectId, string pipelineId)
|
||||
|
||||
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 == projectId && e.PipelineId == pipelineId);
|
||||
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)
|
||||
/// <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();
|
||||
@@ -83,7 +78,7 @@ namespace BLL
|
||||
newPlan.PlanStartDate = plan.PlanStartDate;
|
||||
newPlan.PlanEndDate = plan.PlanEndDate;
|
||||
newPlan.Days = plan.Days;
|
||||
newPlan.AvgDailyWorkload = plan.Days;
|
||||
newPlan.AvgDailyWorkload = plan.AvgDailyWorkload;
|
||||
try
|
||||
{
|
||||
db.SubmitChanges(System.Data.Linq.ConflictMode.ContinueOnConflict);
|
||||
@@ -120,5 +115,6 @@ namespace BLL
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
@@ -53,7 +53,7 @@
|
||||
</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" Hidden="true">
|
||||
Icon="TableGo" EnableAjax="false" EnablePostBack="true" >
|
||||
</f:Button>
|
||||
</Items>
|
||||
</f:Toolbar>
|
||||
@@ -103,45 +103,41 @@
|
||||
DataField="PriorityTotalDyne" SortField="PriorityTotalDyne" FieldType="Float" HeaderTextAlign="Center" TextAlign="Left"
|
||||
Width="120px">
|
||||
<Editor>
|
||||
<f:NumberBox ID="txtPriorityTotalDyne" runat="server"></f:NumberBox>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<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" NoDecimal="true" ></f:NumberBox>
|
||||
<f:NumberBox ID="txtAvgDailyWorkload" runat="server" NoNegative="true"></f:NumberBox>
|
||||
</Editor>
|
||||
</f:RenderField>
|
||||
<%--<f:RenderField HeaderText="主键" ColumnID="ProductionSchedulingPlanId"
|
||||
DataField="ProductionSchedulingPlanId" SortField="ProductionSchedulingPlanId" FieldType="String" HeaderTextAlign="Center" TextAlign="Left"
|
||||
Width="120px">
|
||||
<Editor>
|
||||
<f:TextBox ID="NumberBox1" runat="server"></f:TextBox>
|
||||
</Editor>
|
||||
</f:RenderField>--%>
|
||||
</Columns>
|
||||
<Listeners>
|
||||
<f:Listener Event="dataload" Handler="onGridDataLoad" />
|
||||
</Listeners>
|
||||
<PageItems>
|
||||
<f:ToolbarSeparator ID="ToolbarSeparator1" runat="server">
|
||||
</f:ToolbarSeparator>
|
||||
@@ -166,6 +162,10 @@
|
||||
function reloadGrid() {
|
||||
__doPostBack(null, 'reloadGrid');
|
||||
}
|
||||
|
||||
function onGridDataLoad(event) {
|
||||
this.mergeColumns(['FlowNum', 'MainItemName', 'Material', 'TotalDyne']);
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -26,17 +26,6 @@ namespace FineUIPro.Web.HJGL.PreDesign
|
||||
{
|
||||
this.ddlPageSize.SelectedValue = this.Grid1.PageSize.ToString();
|
||||
this.InitTreeMenu();//加载树
|
||||
//HJGL_PipelineComponentService.InitMainItemDownList(drpState, true);
|
||||
//HJGL_PipelineComponentService.InitMainItemDownProductionStateList(drpProductionState, true);
|
||||
|
||||
//var pipeline = (from x in Funs.DB.HJGL_Pipeline
|
||||
// where x.ProjectId == this.CurrUser.LoginProjectId
|
||||
// select x.FlowingSection).Distinct().ToList();
|
||||
//this.drpFlowingSection.DataTextField = "Value";
|
||||
//this.drpFlowingSection.DataValueField = "Value";
|
||||
//this.drpFlowingSection.DataSource = pipeline;
|
||||
//this.drpFlowingSection.DataBind();
|
||||
//Funs.FineUIPleaseSelect(drpFlowingSection);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,11 +112,12 @@ namespace FineUIPro.Web.HJGL.PreDesign
|
||||
{
|
||||
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).Count();
|
||||
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 + "【" + a.ToString() + "】" + "管线";
|
||||
tn2.Text = q.UnitWorkName;
|
||||
if (q.UnitWorkId == this.hdUnitWorkId.Text)
|
||||
{
|
||||
tn2.Expanded = true;
|
||||
@@ -155,42 +145,42 @@ namespace FineUIPro.Web.HJGL.PreDesign
|
||||
|
||||
private void BindNodes(TreeNode node)
|
||||
{
|
||||
List<Model.HJGL_Pipeline> pipeline = new List<Model.HJGL_Pipeline>();
|
||||
var pipelines = from x in Funs.DB.HJGL_Pipeline where x.ProjectId == this.CurrUser.LoginProjectId && x.PipeArea == "1" select x;
|
||||
pipeline = (from x in pipelines
|
||||
where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitWorkId == node.NodeID && x.PipelineCode.Contains(this.txtPipelineCode.Text.Trim())
|
||||
orderby x.PipelineCode
|
||||
select x).ToList();
|
||||
int pageindex = int.Parse(node.CommandName.Split('|')[0]);
|
||||
int pageCount = int.Parse(node.CommandName.Split('|')[1]);
|
||||
if (pageindex <= pageCount)
|
||||
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)
|
||||
{
|
||||
pipeline = pipeline.Skip(pageSize * (pageindex - 1)).Take(pageSize).ToList();
|
||||
foreach (var item in pipeline)
|
||||
{
|
||||
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.ToolTip = "管线号【组件数】";
|
||||
newNode.CommandName = "管线";
|
||||
newNode.NodeID = item.PipelineId;
|
||||
newNode.EnableClickEvent = true;
|
||||
node.Nodes.Add(newNode);
|
||||
}
|
||||
if (pageindex < pageCount)
|
||||
{
|
||||
TreeNode newNode = new TreeNode();
|
||||
newNode.Text = "加载";
|
||||
newNode.NodeID = SQLHelper.GetNewID();
|
||||
newNode.CommandName = "加载";
|
||||
newNode.Icon = Icon.ArrowDown;
|
||||
newNode.EnableClickEvent = true;
|
||||
node.Nodes.Add(newNode);
|
||||
}
|
||||
//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)
|
||||
{
|
||||
@@ -209,13 +199,9 @@ namespace FineUIPro.Web.HJGL.PreDesign
|
||||
/// <param name="e"></param>
|
||||
protected void tvControlItem_NodeCommand(object sender, TreeCommandEventArgs e)
|
||||
{
|
||||
if (e.CommandName.Split('|').Length == 2)
|
||||
if (e.CommandName == "流水段")
|
||||
{
|
||||
this.hdUnitWorkId.Text = this.tvControlItem.SelectedNodeID;
|
||||
}
|
||||
else if (e.CommandName == "管线")
|
||||
{
|
||||
Model.HJGL_Pipeline pipeline = BLL.PipelineService.GetPipelineByPipelineId(this.tvControlItem.SelectedNodeID);
|
||||
Model.HJGL_Pipeline pipeline = BLL.PipelineService.GetPipelineByFlowingSection(this.tvControlItem.SelectedNode.Text);
|
||||
this.hdUnitWorkId.Text = string.Empty;
|
||||
if (pipeline != null)
|
||||
{
|
||||
@@ -223,14 +209,6 @@ namespace FineUIPro.Web.HJGL.PreDesign
|
||||
SaveProductionSchedulingPlan();
|
||||
}
|
||||
}
|
||||
else if (e.CommandName == "加载")
|
||||
{
|
||||
string CommandName = e.Node.ParentNode.CommandName;
|
||||
e.Node.ParentNode.CommandName = (int.Parse(CommandName.Split('|')[0]) + 1) + "|" + int.Parse(CommandName.Split('|')[1]);
|
||||
TreeNode treeNode = e.Node.ParentNode;
|
||||
treeNode.Nodes.Remove(e.Node);
|
||||
BindNodes(e.Node.ParentNode);
|
||||
}
|
||||
this.BindGrid();
|
||||
}
|
||||
|
||||
@@ -242,27 +220,24 @@ namespace FineUIPro.Web.HJGL.PreDesign
|
||||
{
|
||||
if (!string.IsNullOrEmpty(this.tvControlItem.SelectedNodeID))
|
||||
{
|
||||
var schedulingPlan = BLL.ProductionSchedulingPlanService.GetProductionSchedulingPlanByPipelineId(this.CurrUser.LoginProjectId, this.tvControlItem.SelectedNodeID);
|
||||
if (schedulingPlan == null)
|
||||
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)
|
||||
{
|
||||
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;
|
||||
var pipeline = BLL.PipelineService.GetPipelineByPipelineId(this.tvControlItem.SelectedNodeID);
|
||||
if (pipeline!=null)
|
||||
var plan = BLL.ProductionSchedulingPlanService.GetProductionSchedulingPlan(this.CurrUser.LoginProjectId, item.FlowingSection, item.UnitWorkName, item.Material, item.Caliber);
|
||||
if (plan == null)
|
||||
{
|
||||
newPlan.FlowNum = pipeline.FlowingSection;
|
||||
if (!string.IsNullOrEmpty(pipeline.UnitWorkId))
|
||||
{
|
||||
newPlan.MainItemName = BLL.UnitWorkService.getUnitWorkByUnitWorkId(pipeline.UnitWorkId).UnitWorkName;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(pipeline.PipingClassId))
|
||||
{
|
||||
newPlan.Material = BLL.Base_PipingClassService.GetPipingClassByPipingClassId(pipeline.PipingClassId).SteelType;
|
||||
}
|
||||
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);
|
||||
}
|
||||
BLL.ProductionSchedulingPlanService.AddProductionSchedulingPlan(newPlan);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -289,23 +264,21 @@ namespace FineUIPro.Web.HJGL.PreDesign
|
||||
p.PlanStartDate,
|
||||
p.PlanEndDate,
|
||||
p.Days,
|
||||
p.AvgDailyWorkload,
|
||||
pipeline.UnitWorkId
|
||||
p.AvgDailyWorkload
|
||||
FROM HJGL_ProductionSchedulingPlan p
|
||||
left join HJGL_Pipeline as pipeline on pipeline.PipelineId = p.PipelineId
|
||||
WHERE 1=1 ";
|
||||
List<SqlParameter> listStr = new List<SqlParameter>();
|
||||
|
||||
if (tvControlItem.SelectedNode.CommandName.Split('|').Length == 2)
|
||||
{
|
||||
strSql += " and pipeline.UnitWorkId =@UnitWorkId";
|
||||
listStr.Add(new SqlParameter("@UnitWorkId", this.tvControlItem.SelectedNodeID));
|
||||
strSql += " and p.MainItemName =@UnitWorkId";
|
||||
listStr.Add(new SqlParameter("@UnitWorkId", this.tvControlItem.SelectedNode.Text));
|
||||
|
||||
}
|
||||
else if (tvControlItem.SelectedNode.CommandName == "管线")
|
||||
else if (tvControlItem.SelectedNode.CommandName == "流水段")
|
||||
{
|
||||
strSql += " and p.PipelineId = @PipelineId ";
|
||||
listStr.Add(new SqlParameter("@PipelineId", this.tvControlItem.SelectedNodeID));
|
||||
strSql += " and p.FlowNum = @FlowNum ";
|
||||
listStr.Add(new SqlParameter("@FlowNum", this.tvControlItem.SelectedNode.Text));
|
||||
|
||||
}
|
||||
SqlParameter[] parameter = listStr.ToArray();
|
||||
@@ -419,8 +392,134 @@ namespace FineUIPro.Web.HJGL.PreDesign
|
||||
#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
|
||||
}
|
||||
|
||||
+162
-1
@@ -6857,6 +6857,14 @@ namespace Model
|
||||
}
|
||||
}
|
||||
|
||||
public System.Data.Linq.Table<View_HJGL_ProductionSchedulingPlanStatistics> View_HJGL_ProductionSchedulingPlanStatistics
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.GetTable<View_HJGL_ProductionSchedulingPlanStatistics>();
|
||||
}
|
||||
}
|
||||
|
||||
public System.Data.Linq.Table<View_HJGL_WeldingTask> View_HJGL_WeldingTask
|
||||
{
|
||||
get
|
||||
@@ -100308,7 +100316,7 @@ namespace Model
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_TotalPriority", DbType="NVarChar(50) NOT NULL", CanBeNull=false)]
|
||||
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_TotalPriority", DbType="NVarChar(50)")]
|
||||
public string TotalPriority
|
||||
{
|
||||
get
|
||||
@@ -286333,6 +286341,159 @@ namespace Model
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.View_HJGL_ProductionSchedulingPlanStatistics")]
|
||||
public partial class View_HJGL_ProductionSchedulingPlanStatistics
|
||||
{
|
||||
|
||||
private string _UnitWorkId;
|
||||
|
||||
private string _UnitWorkCode;
|
||||
|
||||
private string _UnitWorkName;
|
||||
|
||||
private string _ProjectId;
|
||||
|
||||
private string _FlowingSection;
|
||||
|
||||
private string _Material;
|
||||
|
||||
private string _Caliber;
|
||||
|
||||
private decimal _Dia;
|
||||
|
||||
public View_HJGL_ProductionSchedulingPlanStatistics()
|
||||
{
|
||||
}
|
||||
|
||||
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_UnitWorkId", DbType="NVarChar(50) NOT NULL", CanBeNull=false)]
|
||||
public string UnitWorkId
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._UnitWorkId;
|
||||
}
|
||||
set
|
||||
{
|
||||
if ((this._UnitWorkId != value))
|
||||
{
|
||||
this._UnitWorkId = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_UnitWorkCode", DbType="NVarChar(10)")]
|
||||
public string UnitWorkCode
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._UnitWorkCode;
|
||||
}
|
||||
set
|
||||
{
|
||||
if ((this._UnitWorkCode != value))
|
||||
{
|
||||
this._UnitWorkCode = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_UnitWorkName", DbType="NVarChar(30)")]
|
||||
public string UnitWorkName
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._UnitWorkName;
|
||||
}
|
||||
set
|
||||
{
|
||||
if ((this._UnitWorkName != value))
|
||||
{
|
||||
this._UnitWorkName = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ProjectId", DbType="NVarChar(50)")]
|
||||
public string ProjectId
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._ProjectId;
|
||||
}
|
||||
set
|
||||
{
|
||||
if ((this._ProjectId != value))
|
||||
{
|
||||
this._ProjectId = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_FlowingSection", DbType="NVarChar(200)")]
|
||||
public string FlowingSection
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._FlowingSection;
|
||||
}
|
||||
set
|
||||
{
|
||||
if ((this._FlowingSection != value))
|
||||
{
|
||||
this._FlowingSection = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Material", DbType="VarChar(8)")]
|
||||
public string Material
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._Material;
|
||||
}
|
||||
set
|
||||
{
|
||||
if ((this._Material != value))
|
||||
{
|
||||
this._Material = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Caliber", DbType="VarChar(5) NOT NULL", CanBeNull=false)]
|
||||
public string Caliber
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._Caliber;
|
||||
}
|
||||
set
|
||||
{
|
||||
if ((this._Caliber != value))
|
||||
{
|
||||
this._Caliber = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Dia", DbType="Decimal(38,3) NOT NULL")]
|
||||
public decimal Dia
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._Dia;
|
||||
}
|
||||
set
|
||||
{
|
||||
if ((this._Dia != value))
|
||||
{
|
||||
this._Dia = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.View_HJGL_WeldingTask")]
|
||||
public partial class View_HJGL_WeldingTask
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user