This commit is contained in:
2024-09-27 18:17:21 +08:00
parent be070f85e2
commit 064a849b97
73 changed files with 3248 additions and 589 deletions
+132 -67
View File
@@ -2,11 +2,15 @@
using BLL;
using FineUIPro.Web.HSSE.EduTrain;
using FineUIPro.Web.ProjectData;
using Model;
using Newtonsoft.Json.Linq;
using NPOI.SS.Formula.Functions;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
@@ -98,11 +102,25 @@ namespace FineUIPro.Web.CLGL
}
private void BindDetailRelationGrid(string inOutPlanMasterId)
{
Model.Tw_InOutPlanDetail_Relation table = new Model.Tw_InOutPlanDetail_Relation();
/* Model.Tw_InOutPlanDetail_Relation table = new Model.Tw_InOutPlanDetail_Relation();
table.InOutPlanMasterId = inOutPlanMasterId;
var tb = BLL.TwInoutplandetailRelationService.GetListData(table, Grid3);
Grid3.DataSource = tb;
Grid3.DataBind();
*/
var tb = BLL.TwArrivalStatisticsService.GetMatMatchByOutPlanMasterId(inOutPlanMasterId);
Grid3.DataSource = tb;
Grid3.DataBind();
string Rate = Math.Round((decimal)tb.Average(item => item.MatchRate) * 100, 2).ToString() + "%";
JObject summary = new JObject();
//summary.Add("Major", "全部合计");
summary.Add("MatchRateString", Rate);
Grid3.SummaryData = summary;
}
#endregion
@@ -220,6 +238,119 @@ namespace FineUIPro.Web.CLGL
#endregion
#region
protected void Grid1_RowCommand(object sender, GridCommandEventArgs e)
{
if (e.CommandName == "btnInPlanMasterPrint")
{
Print(e.RowID);
}
}
private void Print(string Id)
{
BLL.FastReportService.ResetData();
if (string.IsNullOrEmpty(Id))
{
ShowNotify("请选择要打印的项", MessageBoxIcon.Warning);
return;
}
Tw_InOutMasterOutput queryModel = new Tw_InOutMasterOutput()
{
Id = Id
};
var result = TwInOutplanmasterService.GetListData(queryModel).FirstOrDefault();
List<Model.Tw_PrintMaster> tw_PrintMasters = new List<Model.Tw_PrintMaster>();
List<Model.Tw_PrintDetail> tw_PrintDetails = new List<Model.Tw_PrintDetail>();
Model.Tw_PrintMaster printMaster = new Model.Tw_PrintMaster
{
ReqUnitName = result.ReqUnitName,
CusBillCode = result.CusBillCode,
CreateDate = result.CreateDate.Value.ToString("yyyy-MM-dd"),
ProjectName = ProjectService.GetProjectNameByProjectId(result.ProjectId),
CategoryString = result.CategoryString,
BillName = TwConst.PlanPrintMap.Where(x => x.Value == result.TypeInt).Select(x => x.Key).FirstOrDefault(),
};
tw_PrintMasters.Add(printMaster);
DataTable Table1 = LINQToDataTable(tw_PrintMasters);
if (Table1 != null)
{
Table1.TableName = "Table1";
}
Tw_InOutPlanDetail_Relation queryModel2 = new Tw_InOutPlanDetail_Relation()
{
InOutPlanMasterId = Id
};
var ListDetailRelation = TwInoutplandetailRelationService.GetTw_InOutPlanDetail_RelationByModle(queryModel2).ToList();
int SortIndex = 1;
int SortIndex2 = 1;
var tw_PrintDetailRelation = (from x in ListDetailRelation
join y in Funs.DB.HJGL_MaterialCodeLib on x.MaterialCode equals y.MaterialCode
join z in Funs.DB.HJGL_Pipeline on x.PipelineId equals z.PipelineId
join m in Funs.DB.WBS_UnitWork on z.UnitWorkId equals m.UnitWorkId
select new Model.Tw_PrintDetail
{
SortIndex = SortIndex++,
PipelineCode = z.PipelineCode,
PipelineComponentCode = x.PrefabricatedComponents,
MaterialCode = y.MaterialCode,
MaterialDef = y.MaterialDef,
MaterialSpec = y.MaterialSpec,
MaterialUnit = y.MaterialUnit,
PlanNum = (x.Number ??0).ToString(),
UnitWorkName = m.UnitWorkName,
}).ToList();
var UnitWorkName = tw_PrintDetailRelation.FirstOrDefault()?.UnitWorkName;
Tw_PrintDetail tw_PrintDetailRelation2 = new Tw_PrintDetail
{
MaterialDef = "材料编码合计"
};
var tw_PrintDetail = (from x in Funs.DB.Tw_InOutPlanDetail
join y in Funs.DB.HJGL_MaterialCodeLib on x.MaterialCode equals y.MaterialCode
where x.InOutPlanMasterId == Id
select new Model.Tw_PrintDetail
{
SortIndex = 0,
PipelineCode = "-",
PipelineComponentCode = "-",
MaterialCode = y.MaterialCode,
MaterialDef = y.MaterialDef,
MaterialSpec = y.MaterialSpec,
MaterialUnit = y.MaterialUnit,
PlanNum = (x.PlanNum ?? 0).ToString(),
ActNum = (x.ActNum ?? 0).ToString(),
UnitWorkName = UnitWorkName,
}).ToList();
foreach (var item in tw_PrintDetail)
{
item.SortIndex = SortIndex2++;
}
if (result.TypeInt == (int)TwConst.TypeInt.)
{
tw_PrintDetails.AddRange(tw_PrintDetailRelation);
}
tw_PrintDetails.Add(tw_PrintDetailRelation2);
tw_PrintDetails.AddRange(tw_PrintDetail);
DataTable Data = LINQToDataTable(tw_PrintDetails);
if (Data != null)
{
Data.TableName = "Data";
}
BLL.FastReportService.ResetData();
BLL.FastReportService.AddFastreportTable(Table1);
BLL.FastReportService.AddFastreportTable(Data);
string initTemplatePath = "";
string rootPath = Server.MapPath("~/");
initTemplatePath = "File\\Fastreport\\材料出库计划单.frx";
if (File.Exists(rootPath + initTemplatePath))
{
PageContext.RegisterStartupScript(Window3.GetShowReference(String.Format("~/Controls/Fastreport.aspx?ReportPath={0}", rootPath + initTemplatePath)));
}
}
protected void Grid1_RowClick(object sender, GridRowClickEventArgs e)
{
if (e.RowIndex >= 0)
@@ -415,71 +546,6 @@ namespace FineUIPro.Web.CLGL
#endregion
#region
/// <summary>
/// 报表打印
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnPrint_Click(object sender, EventArgs e)
{
string pipelineId = this.tvControlItem.SelectedNodeID;
var q = BLL.PipelineService.GetPipelineByPipelineId(pipelineId);
if (q != null)
{
var jotCount = (from x in Funs.DB.HJGL_WeldJoint where x.PipelineId == pipelineId select x).Count();
var weldJotCount = (from x in Funs.DB.HJGL_WeldJoint where x.PipelineId == pipelineId && x.WeldingDailyId != null select x).Count();
if (jotCount == weldJotCount)
{
string varValue = string.Empty;
var project = BLL.ProjectService.GetProjectByProjectId(this.CurrUser.LoginProjectId);
if (project != null)
{
varValue = project.ProjectName;
var unitWork = BLL.UnitWorkService.GetUnitWorkByUnitWorkId(q.UnitWorkId);
if (unitWork != null)
{
varValue = varValue + "|" + unitWork.UnitWorkName;
}
}
List<SqlParameter> listStr = new List<SqlParameter>();
listStr.Add(new SqlParameter("@IsoId", pipelineId));
listStr.Add(new SqlParameter("@Flag", "0"));
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = BLL.SQLHelper.GetDataTableRunProc("HJGL_spJointWorkRecordNew", parameter);
string page = Funs.GetPagesCountByPageSize(11, 16, tb.Rows.Count).ToString();
varValue = varValue + "|" + page;
if (!string.IsNullOrEmpty(varValue))
{
varValue = HttpUtility.UrlEncodeUnicode(varValue);
}
if (tb.Rows.Count <= 11)
{
PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("../../ReportPrint/ExReportPrint.aspx?ispop=1&reportId={0}&replaceParameter={1}&varValue={2}&projectId={3}", BLL.Const.HJGL_JointInfoReport1Id, pipelineId, varValue, this.CurrUser.LoginProjectId)));
}
else
{
PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("../../ReportPrint/ExReportPrint.aspx?ispop=1&reportId={0}&replaceParameter={1}&varValue={2}&projectId={3}", BLL.Const.HJGL_JointInfoReport1Id, pipelineId, varValue, this.CurrUser.LoginProjectId)));
}
}
else
{
ShowNotify("请选择焊接完成管线!", MessageBoxIcon.Warning);
return;
}
}
else
{
ShowNotify("请选择管线!", MessageBoxIcon.Warning);
return;
}
}
#endregion
#region
/// <summary>
@@ -585,7 +651,6 @@ namespace FineUIPro.Web.CLGL
{
this.btnGenInOutMaster.Hidden = false;
this.btnRevokeGenInOutMaster.Hidden = false;
this.btnPrint.Hidden = false;
// this.btnMenuInOutPlanMasterEdit.Hidden = false;
}
if (buttonList.Contains(BLL.Const.BtnDelete))