材料管理修改
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using BLL;
|
||||
using Model;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
@@ -14,6 +15,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
//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 string PipeArea
|
||||
{
|
||||
get
|
||||
@@ -54,6 +56,10 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
{
|
||||
tw_PipeMatMatchOutputs=new List<Model.Tw_PipeMatMatchOutput>();
|
||||
PipeArea = Request.Params["PipeArea"];
|
||||
if (PipeArea == "2")
|
||||
{
|
||||
WarehouseCode = "现场安装";
|
||||
}
|
||||
HJGL_MaterialService.materialStockItems_FIELD = new List<Model.MaterialStockItem>();
|
||||
HJGL_MaterialService.materialStockItems_SHOP = new List<Model.MaterialStockItem>();
|
||||
dicSeclectPipeLine=new Dictionary<string, string>();
|
||||
@@ -168,18 +174,30 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
}
|
||||
private void BindNodes(TreeNode node)
|
||||
{
|
||||
var NowComPipelineCode = PipelineService.GetNoComPipelinesByUnitWordId(node.NodeID);
|
||||
if (!node.Text.Contains("|"))
|
||||
{
|
||||
node.Text += "|" + NowComPipelineCode.Count();
|
||||
//var NowComPipelineCode = PipelineService.GetNoComPipelinesByUnitWordId(node.NodeID);
|
||||
//if (!node.Text.Contains("|"))
|
||||
//{
|
||||
// node.Text += "|" + NowComPipelineCode.Count();
|
||||
|
||||
//}
|
||||
var CompleteInOutPlanDetail_RelationList = from x in Funs.DB.Tw_InOutPlanDetail_Relation
|
||||
join y in Funs.DB.Tw_InOutPlanMaster on x.InOutPlanMasterId equals y.Id
|
||||
where y.State==(int)TwConst.State.已完成 && y.WarehouseCode == WarehouseCode
|
||||
select x;
|
||||
|
||||
}
|
||||
var pipeline = (from x in Funs.DB.HJGL_Pipeline
|
||||
where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitWorkId == node.NodeID
|
||||
join y in CompleteInOutPlanDetail_RelationList on x.PipelineId equals y.PipelineId into temp
|
||||
from y in temp.DefaultIfEmpty()
|
||||
where y == null && x.ProjectId == this.CurrUser.LoginProjectId && x.UnitWorkId == node.NodeID
|
||||
&& x.PipelineCode.Contains(this.txtPipelineCode.Text.Trim())
|
||||
orderby x.PipelineCode
|
||||
select x).ToList();
|
||||
pipeline= pipeline.Where(x => NowComPipelineCode.Contains(x.PipelineCode)).ToList();
|
||||
//pipeline= pipeline.Where(x => NowComPipelineCode.Contains(x.PipelineCode)).ToList();
|
||||
if (!node.Text.Contains("|"))
|
||||
{
|
||||
node.Text += "|" + pipeline.Count();
|
||||
|
||||
}
|
||||
int pageindex = int.Parse(node.CommandName.Split('|')[0]);
|
||||
int pageCount = int.Parse(node.CommandName.Split('|')[1]);
|
||||
if (pageindex <= pageCount)
|
||||
@@ -274,11 +292,12 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
void BindGrid2()
|
||||
{
|
||||
var result = tw_PipeMatMatchOutputs
|
||||
.GroupBy(item => new { item.PipelineId, item.PipelineCode }) // 按 PipelineId 和 PipelineCode 分组
|
||||
.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
|
||||
@@ -287,14 +306,34 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
List<Tw_PipeMatMatchOutput> output = result.Select(r => new Tw_PipeMatMatchOutput
|
||||
{
|
||||
PipelineId = r.PipelineId,
|
||||
PipelineCode = r.PipelineCode,
|
||||
PipelineCode = r.PipelineCode,
|
||||
UnitWorkName = r.UnitWorkName,
|
||||
MatchRate = r.AverageMatchRate,
|
||||
MatchRateString = Math.Round((decimal)r.AverageMatchRate * 100, 2).ToString() + "%"
|
||||
}).ToList();
|
||||
Grid2.DataSource = output;
|
||||
Grid2.DataBind();
|
||||
Rate = Math.Round((decimal)output.Average(item => item.MatchRate) * 100, 2);
|
||||
lbRate.Text = "匹配率:" + Rate.ToString() + "%";
|
||||
if (output.Any())
|
||||
{
|
||||
Rate = Math.Round((decimal)output.Average(item => item.MatchRate) * 100, 2);
|
||||
lbRate.Text = "匹配率:" + Rate.ToString() + "%";
|
||||
}
|
||||
for (int i = 0; i < Grid2.Rows.Count; i++)
|
||||
{
|
||||
var model = Grid2.Rows[i].DataItem as Tw_PipeMatMatchOutput;
|
||||
|
||||
|
||||
|
||||
if (model.MatchRate >=1)
|
||||
{
|
||||
Grid2.Rows[i].RowCssClass = "green";
|
||||
}
|
||||
else
|
||||
{
|
||||
Grid2.Rows[i].RowCssClass = "red";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void BindGrid3()
|
||||
@@ -302,6 +341,19 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
|
||||
Grid3.DataSource = dicSeclectPipeLine;
|
||||
Grid3.DataBind();
|
||||
for (int i = 0; i < Grid3.Rows.Count; i++)
|
||||
{
|
||||
var model = Grid3.Rows[i].DataItem ;
|
||||
var model2= JsonConvert.DeserializeObject<Dictionary<string, string>>(JsonConvert.SerializeObject(model));
|
||||
string pipeid= model2.First().Value;
|
||||
|
||||
var relationModle=TwInoutplandetailRelationService.GetByPipelineId(pipeid,WarehouseCode);
|
||||
if (relationModle!= null)
|
||||
{
|
||||
Grid3.Rows[i].RowCssClass = "yellow";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -371,10 +423,6 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
#endregion
|
||||
|
||||
#region 按钮事件
|
||||
protected void btnNew_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected void btnrefresh_Click(object sender, EventArgs e)
|
||||
{
|
||||
@@ -459,7 +507,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
if (dicSeclectPipeLine.Where(x => x.Key == this.tvControlItem.SelectedNodeID).Count() == 0)
|
||||
{
|
||||
dicSeclectPipeLine.Add(this.tvControlItem.SelectedNodeID, this.tvControlItem.SelectedNode.Text);
|
||||
tw_PipeMatMatchOutputs = TwArrivalStatisticsService.GetPipeMatMatch(this.CurrUser.LoginProjectId, dicSeclectPipeLine.Keys.ToList(), "工厂预制");
|
||||
tw_PipeMatMatchOutputs = TwArrivalStatisticsService.GetPipeMatMatch(this.CurrUser.LoginProjectId, dicSeclectPipeLine.Keys.ToList(), WarehouseCode);
|
||||
|
||||
BindGrid3();
|
||||
BindGrid2();
|
||||
@@ -472,31 +520,35 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
if (Grid3.SelectedRowID != "")
|
||||
{
|
||||
dicSeclectPipeLine.Remove(Grid3.SelectedRowID);
|
||||
tw_PipeMatMatchOutputs = TwArrivalStatisticsService.GetPipeMatMatch(this.CurrUser.LoginProjectId, dicSeclectPipeLine.Keys.ToList(), "工厂预制");
|
||||
tw_PipeMatMatchOutputs = TwArrivalStatisticsService.GetPipeMatMatch(this.CurrUser.LoginProjectId, dicSeclectPipeLine.Keys.ToList(), WarehouseCode);
|
||||
|
||||
BindGrid3();
|
||||
BindGrid2();
|
||||
}
|
||||
}
|
||||
protected void btnGenTask_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (Rate<(decimal)85)
|
||||
{ if (Grid2.SelectedRowIDArray.Count() > 0)
|
||||
{
|
||||
ShowNotify(" 匹配率小于85%,请重新匹配!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
SaveTask();
|
||||
Response.Redirect(Request.Url.ToString());
|
||||
ShowNotify("生成任务单成功!", MessageBoxIcon.Warning);
|
||||
|
||||
}
|
||||
SaveTask();
|
||||
Response.Redirect(Request.Url.ToString());
|
||||
else
|
||||
{
|
||||
ShowNotify("请先选择需要发起任单的管线!", MessageBoxIcon.Warning);
|
||||
}
|
||||
|
||||
}
|
||||
private void SaveTask()
|
||||
{
|
||||
var weldingRods = from x in Funs.DB.Base_Consumables where x.ConsumablesType == "2" select x;
|
||||
var weldingWires = from x in Funs.DB.Base_Consumables where x.ConsumablesType == "1" select x;
|
||||
var toDoMatterList = (from x in Funs.DB.View_HJGL_NoWeldJointFind
|
||||
where dicSeclectPipeLine.Keys.ToList().Contains(x.PipelineId) && x.WeldingDailyId == null && x.WeldTaskId == null
|
||||
where Grid2.SelectedRowIDArray.ToList().Contains(x.PipelineId) && x.WeldingDailyId == null && x.WeldTaskId == null
|
||||
select x).ToList();
|
||||
var selectRowId = (from x in Funs.DB.View_HJGL_NoWeldJointFind
|
||||
where dicSeclectPipeLine.Keys.ToList().Contains(x.PipelineId) && x.WeldingDailyId == null && x.WeldTaskId == null
|
||||
where Grid2.SelectedRowIDArray.ToList().Contains(x.PipelineId) && x.WeldingDailyId == null && x.WeldTaskId == null
|
||||
select x).ToList();
|
||||
foreach (var weldjoint in selectRowId)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user