材料管理修改(打印修改,出库单已审核已完成不计算匹配率)材料匹配修改,焊接任务单修改

This commit is contained in:
2024-12-06 22:17:50 +08:00
parent 77fbdb946d
commit f4f7f93835
24 changed files with 850 additions and 323 deletions
@@ -13,9 +13,19 @@ namespace FineUIPro.Web.HJGL.WeldingManage
{
public int pageSize = PipelineService.pageSize;
//public Dictionary<string, string> dicSeclectPipeLine = new Dictionary<string, string>();
public static List<Model.Tw_PipeMatMatchOutput> tw_PipeMatMatchOutputs ;
public static decimal Rate = 0;
public static string WarehouseCode = "工厂预制";
//public static List<Model.Tw_PipeMatMatchOutput> tw_PipeMatMatchOutputs ;
public static decimal Rate = 0;
public string WarehouseCode
{
get
{
return (string)ViewState["WarehouseCode"];
}
set
{
ViewState["WarehouseCode"] = value;
}
}
public string PipeArea
{
get
@@ -49,6 +59,19 @@ namespace FineUIPro.Web.HJGL.WeldingManage
ViewState["dicSeclectPipeLine"] = value;
}
}
public List<Model.Tw_PipeMatMatchOutput> tw_PipeMatMatchOutputs
{
get
{
return (List<Model.Tw_PipeMatMatchOutput>)ViewState["tw_PipeMatMatchOutputs"];
}
set
{
ViewState["tw_PipeMatMatchOutputs"] = value;
}
}
protected void Page_Load(object sender, EventArgs e)
{
//ctlAuditFlow.Url = BLL.Project_SysSetService.GetAvevaNetUrl(this.CurrUser.LoginProjectId);
@@ -60,6 +83,10 @@ namespace FineUIPro.Web.HJGL.WeldingManage
{
WarehouseCode = "现场安装";
}
else
{
WarehouseCode = "工厂预制";
}
HJGL_MaterialService.materialStockItems_FIELD = new List<Model.MaterialStockItem>();
HJGL_MaterialService.materialStockItems_SHOP = new List<Model.MaterialStockItem>();
dicSeclectPipeLine=new Dictionary<string, string>();
@@ -88,6 +115,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
rootNode1.Text = "建筑工程";
rootNode1.CommandName = "建筑工程";
rootNode1.Selectable = false;
rootNode1.EnableCheckBox = false;
this.tvControlItem.Nodes.Add(rootNode1);
TreeNode rootNode2 = new TreeNode();
@@ -95,6 +123,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
rootNode2.Text = "安装工程";
rootNode2.CommandName = "安装工程";
rootNode2.Expanded = true;
rootNode2.EnableCheckBox = false;
this.tvControlItem.Nodes.Add(rootNode2);
var pUnits = (from x in Funs.DB.Project_ProjectUnit where x.ProjectId == this.CurrUser.LoginProjectId select x).ToList();
@@ -168,6 +197,8 @@ namespace FineUIPro.Web.HJGL.WeldingManage
tn2.CommandName = 1 + "|" + Funs.GetEndPageNumber(a, pageSize);
tn2.EnableExpandEvent = true;
tn2.EnableClickEvent= true;
tn2.EnableCheckBox = false;
rootNode2.Nodes.Add(tn2);
if (a > 0)
{
@@ -225,7 +256,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
newNode.Text = item.PipelineCode ;
newNode.NodeID = item.PipelineId;
newNode.CommandName = "管线";
newNode.EnableClickEvent = true;
newNode.EnableClickEvent = true;
node.Nodes.Add(newNode);
}
if (pageindex < pageCount)
@@ -303,40 +334,39 @@ namespace FineUIPro.Web.HJGL.WeldingManage
}
void BindGrid2()
{
var result = tw_PipeMatMatchOutputs
.GroupBy(item => new { item.PipelineId, item.PipelineCode,item.UnitWorkName }) // 按 PipelineId 和 PipelineCode 分组
.Select(group => new
{
PipelineId = group.Key.PipelineId, // 当前组的 PipelineId
PipelineCode = group.Key.PipelineCode, // 当前组的 PipelineCode
UnitWorkName = group.Key.UnitWorkName, // 当前组的 UnitWorkName
AverageMatchRate = group.Average(item => item.MatchRate) // 计算平均 MatchRate
})
.ToList(); // 转换为 List
//var result = tw_PipeMatMatchOutputs
// .GroupBy(item => new { item.PipelineId, item.PipelineCode,item.UnitWorkName }) // 按 PipelineId 和 PipelineCode 分组
// .Select(group => new
// {
// PipelineId = group.Key.PipelineId, // 当前组的 PipelineId
// PipelineCode = group.Key.PipelineCode, // 当前组的 PipelineCode
// UnitWorkName = group.Key.UnitWorkName, // 当前组的 UnitWorkName
// AverageMatchRate = group.Average(item => item.MatchRate) // 计算平均 MatchRate
// })
// .ToList(); // 转换为 List
// 如果需要将结果转换为自定义类型,可以这样做
List<Tw_PipeMatMatchOutput> output = result.Select(r => new Tw_PipeMatMatchOutput
{
PipelineId = r.PipelineId,
PipelineCode = r.PipelineCode,
UnitWorkName = r.UnitWorkName,
MatchRate = r.AverageMatchRate,
MatchRateString = Math.Round((decimal)r.AverageMatchRate * 100, 2).ToString() + "%"
}).ToList();
//// 如果需要将结果转换为自定义类型,可以这样做
//List<Tw_PipeMatMatchOutput> output = result.Select(r => new Tw_PipeMatMatchOutput
//{
// PipelineId = r.PipelineId,
// PipelineCode = r.PipelineCode,
// UnitWorkName = r.UnitWorkName,
// MatchRate = r.AverageMatchRate,
// MatchRateString = Math.Round((decimal)r.AverageMatchRate * 100, 2).ToString() + "%"
//}).ToList();
var output = TwArrivalStatisticsService.GetPipeMatch(tw_PipeMatMatchOutputs);
Grid2.DataSource = output;
Grid2.DataBind();
if (output.Any())
/*if (output.Any())
{
Rate = Math.Round((decimal)output.Average(item => item.MatchRate) * 100, 2);
lbRate.Text = "匹配率:" + Rate.ToString() + "%";
}
}*/
var selectList = new List<string>() ;
for (int i = 0; i < Grid2.Rows.Count; i++)
{
var model = Grid2.Rows[i].DataItem as Tw_PipeMatMatchOutput;
var model = Grid2.Rows[i].DataItem as Tw_PipeMatchOutput;
if (model.MatchRate >=1)
{
Grid2.Rows[i].RowCssClass = "green";
@@ -370,7 +400,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
if (relationModle!= null)
{
Grid3.Rows[i].RowCssClass = "yellow";
}
}
}
}
@@ -396,6 +426,17 @@ namespace FineUIPro.Web.HJGL.WeldingManage
var tb = tw_PipeMatMatchOutputs.Where(x => x.PipelineId == Grid2.SelectedRowID).ToList();
Grid1.DataSource = tb;
Grid1.DataBind();
for (int i = 0; i < Grid1.Rows.Count; i++)
{
var model = Grid1.Rows[i].DataItem as Tw_PipeMatMatchOutput;
if (model?.MatchRate < 1 || model?.MatchRate==null)
{
Grid1.Rows[i].RowCssClass = "red";
}
}
}
protected void Grid1_RowClick(object sender, GridRowClickEventArgs e)
@@ -521,17 +562,18 @@ namespace FineUIPro.Web.HJGL.WeldingManage
protected void btnAddPipelineMatchMat_Click(object sender, EventArgs e)
{
if (this.tvControlItem.SelectedNode.CommandName == "管线")
{
if (dicSeclectPipeLine.Where(x => x.Key == this.tvControlItem.SelectedNodeID).Count() == 0)
var selectNodes= tvControlItem.GetCheckedNodes();
foreach (var node in selectNodes)
{
if (dicSeclectPipeLine.Where(x => x.Key == node.NodeID).Count() == 0 && node.CommandName== "管线")
{
dicSeclectPipeLine.Add(this.tvControlItem.SelectedNodeID, this.tvControlItem.SelectedNode.Text);
tw_PipeMatMatchOutputs = TwArrivalStatisticsService.GetPipeMatMatch(this.CurrUser.LoginProjectId, dicSeclectPipeLine.Keys.ToList(), WarehouseCode);
BindGrid3();
BindGrid2();
dicSeclectPipeLine.Add(node.NodeID, node.Text);
}
}
tw_PipeMatMatchOutputs = TwArrivalStatisticsService.GetPipeMatMatch(this.CurrUser.LoginProjectId, dicSeclectPipeLine.Keys.ToList(), WarehouseCode);
BindGrid3();
BindGrid2();
}
protected void btnDeletePipelineMatchMat_Click(object sender, EventArgs e)
@@ -539,6 +581,12 @@ namespace FineUIPro.Web.HJGL.WeldingManage
if (Grid3.SelectedRowID != "")
{
dicSeclectPipeLine.Remove(Grid3.SelectedRowID);
var node = tvControlItem.FindNode(Grid3.SelectedRowID);
if (node != null)
{
node.Checked = false;
}
tw_PipeMatMatchOutputs = TwArrivalStatisticsService.GetPipeMatMatch(this.CurrUser.LoginProjectId, dicSeclectPipeLine.Keys.ToList(), WarehouseCode);
BindGrid3();
@@ -572,6 +620,10 @@ namespace FineUIPro.Web.HJGL.WeldingManage
where Grid2.SelectedRowIDArray.ToList().Contains(x.PipelineId) && x.WeldingDailyId == null &&
x.WeldTaskId == null && x.WeldingMethodCode != null
select x).ToList();
if (PipeArea=="1") //工厂预制的管线,则只选择预制口
{
selectRowId = selectRowId.Where(x => x.JointAttribute == "预制口").ToList();
}
foreach (var weldjoint in selectRowId)
{
string canWeldingRodName = string.Empty;
@@ -583,7 +635,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
NewTask.TaskCode = BLL.WeldTaskService.GetTaskCodeByDate(this.CurrUser.LoginProjectId, DateTime.Now.Date.ToString("yyyy-MM-dd"), NewTask.UnitWorkId, this.CurrUser.UnitId);
NewTask.WeldTaskId = SQLHelper.GetNewID();
NewTask.WeldJointId = weldjoint.WeldJointId;
NewTask.WeldJointId = weldjoint.WeldJointId;
var oldWeldTask = BLL.WeldTaskService.GetWeldTaskByWeldJointId(NewTask.WeldJointId);
if (oldWeldTask != null)
{