diff --git a/SGGL/BLL/CLGL/TwArrivalStatisticsService.cs b/SGGL/BLL/CLGL/TwArrivalStatisticsService.cs
index d0831ae5..15542c32 100644
--- a/SGGL/BLL/CLGL/TwArrivalStatisticsService.cs
+++ b/SGGL/BLL/CLGL/TwArrivalStatisticsService.cs
@@ -240,7 +240,7 @@ var stockList = TwMaterialstockService.GetTw_MaterialStockByModle(twMaterialStoc
///
///
///
- public static List GetPipeMatMatch(string projectId, List pipelineIds, string warehouseCode)
+ public static List GetPipeMatMatch(string projectId, List pipelineIds, string warehouseCode, Dictionary> priorityComponents = null)
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
@@ -271,7 +271,20 @@ var stockList = TwMaterialstockService.GetTw_MaterialStockByModle(twMaterialStoc
var newRequiredMaterials = new List();
foreach (string id in pipelineIds)
{
- newRequiredMaterials.AddRange(requiredMaterials.Where(x => x.PipelineId == id));
+ var pipelineMaterials = requiredMaterials.Where(x => x.PipelineId == id).ToList();
+ if (priorityComponents != null && priorityComponents.ContainsKey(id) && priorityComponents[id] != null && priorityComponents[id].Any())
+ {
+ var components = priorityComponents[id];
+ newRequiredMaterials.AddRange(pipelineMaterials
+ .Where(x => components.Contains(x.PrefabricatedComponents))
+ .OrderBy(x => components.IndexOf(x.PrefabricatedComponents)));
+ newRequiredMaterials.AddRange(pipelineMaterials
+ .Where(x => !components.Contains(x.PrefabricatedComponents)));
+ }
+ else
+ {
+ newRequiredMaterials.AddRange(pipelineMaterials);
+ }
}
results = GetMatMatchOutput(newRequiredMaterials, warehouseCode, projectId);
return results;
diff --git a/SGGL/BLL/CLGL/TwInOutplanmasterService.cs b/SGGL/BLL/CLGL/TwInOutplanmasterService.cs
index 00a63c23..c7a4032d 100644
--- a/SGGL/BLL/CLGL/TwInOutplanmasterService.cs
+++ b/SGGL/BLL/CLGL/TwInOutplanmasterService.cs
@@ -720,18 +720,41 @@ namespace BLL
return;
}
var pipelineList = db.View_HJGL_WeldingTask.Where(e => e.UnitWorkId == unitworkid && e.UnitId == unitid && e.TaskDate.Value.Date == date.Date && e.SerialNumber == serialNumber).OrderBy(x => x.PipeLineSortIndex).Select(x => x.PipelineId).Distinct().ToList();
+ var taskWeldJointIds = db.View_HJGL_WeldingTask
+ .Where(e => e.UnitWorkId == unitworkid && e.UnitId == unitid && e.TaskDate.Value.Date == date.Date && e.SerialNumber == serialNumber && e.WeldJointId != null)
+ .Select(e => e.WeldJointId)
+ .Distinct()
+ .ToList();
+ var taskComponents = (from relation in db.HJGL_Pipeline_ComponentJoint
+ join component in db.HJGL_Pipeline_Component on relation.PipelineComponentId equals component.PipelineComponentId into componentJoin
+ from componentItem in componentJoin.DefaultIfEmpty()
+ join weldJointItem in db.HJGL_WeldJoint on relation.WeldJointId equals weldJointItem.WeldJointId
+ where taskWeldJointIds.Contains(relation.WeldJointId)
+ && weldJointItem.PipelineId != null
+ && (relation.PipelineComponentCode != null || (componentItem != null && componentItem.PipelineComponentCode != null))
+ select new
+ {
+ PipelineId = weldJointItem.PipelineId,
+ PipelineComponentCode = componentItem != null && componentItem.PipelineComponentCode != null ? componentItem.PipelineComponentCode : relation.PipelineComponentCode
+ }).Distinct().ToList();
//领料出库需要排除散件材料
- var MaterDatial = from x in db.HJGL_PipeLineMat
- join y in db.HJGL_MaterialCodeLib on x.MaterialCode equals y.MaterialCode
- where pipelineList.Contains(x.PipelineId) && x.PrefabricatedComponents != null
- select new
- {
- x.PipelineId,
- x.PrefabricatedComponents,
- x.MaterialCode,
- x.Number,
- y.MaterialUnit,
- };
+ var allMaterDatial = (from x in db.HJGL_PipeLineMat
+ join y in db.HJGL_MaterialCodeLib on x.MaterialCode equals y.MaterialCode
+ where pipelineList.Contains(x.PipelineId) && x.PrefabricatedComponents != null
+ select new
+ {
+ x.PipelineId,
+ x.PrefabricatedComponents,
+ x.MaterialCode,
+ x.Number,
+ y.MaterialUnit,
+ }).ToList();
+ var componentPipelineIds = taskComponents.Select(x => x.PipelineId).Distinct().ToList();
+ var MaterDatial = taskComponents.Any()
+ ? allMaterDatial.Where(mat => !componentPipelineIds.Contains(mat.PipelineId)
+ || taskComponents.Any(component => component.PipelineId == mat.PipelineId
+ && component.PipelineComponentCode == mat.PrefabricatedComponents)).ToList()
+ : allMaterDatial;
//var outMateriaList = from x in db.HJGL_PipeLineMat
// join y in db.HJGL_MaterialCodeLib on x.MaterialCode equals y.MaterialCode
// where pipelineList.Contains(x.PipelineId)
@@ -787,7 +810,7 @@ namespace BLL
};
TwInOutplandetailService.Add(detail);
}
- var twinoutplandetailRelationList = MaterDatial.ToList().Select(x => new Tw_InOutPlanDetail_Relation
+ var twinoutplandetailRelationList = MaterDatial.Select(x => new Tw_InOutPlanDetail_Relation
{
PipelineId = x.PipelineId,
MaterialCode = x.MaterialCode,
@@ -826,7 +849,7 @@ namespace BLL
};
TwInOutplandetailService.Add(detail);
}
- var twinoutplandetailRelationList = MaterDatial.ToList().Select(x => new Tw_InOutPlanDetail_Relation
+ var twinoutplandetailRelationList = MaterDatial.Select(x => new Tw_InOutPlanDetail_Relation
{
PipelineId = x.PipelineId,
MaterialCode = x.MaterialCode,
@@ -841,4 +864,4 @@ namespace BLL
}
-}
\ No newline at end of file
+}
diff --git a/SGGL/FineUIPro.Web/File/Fastreport/组件打印.frx b/SGGL/FineUIPro.Web/File/Fastreport/组件打印.frx
index 6892e540..8bdea399 100644
--- a/SGGL/FineUIPro.Web/File/Fastreport/组件打印.frx
+++ b/SGGL/FineUIPro.Web/File/Fastreport/组件打印.frx
@@ -1,5 +1,5 @@
-
+
using System;
using System.Collections;
using System.Collections.Generic;
@@ -99,7 +99,7 @@ namespace FastReport
}
-
+
diff --git a/SGGL/FineUIPro.Web/FineUIPro.Web.csproj b/SGGL/FineUIPro.Web/FineUIPro.Web.csproj
index 8bc11dec..d70cb478 100644
--- a/SGGL/FineUIPro.Web/FineUIPro.Web.csproj
+++ b/SGGL/FineUIPro.Web/FineUIPro.Web.csproj
@@ -1595,6 +1595,7 @@
+
@@ -10891,6 +10892,13 @@
PrePipelineQRCodeIn.aspx
+
+ PrePipelineComponentJointIn.aspx
+ ASPXCodeBehind
+
+
+ PrePipelineComponentJointIn.aspx
+
ProductionSchedulingPlan.aspx
ASPXCodeBehind
diff --git a/SGGL/FineUIPro.Web/HJGL/PreDesign/PrePipeline.aspx b/SGGL/FineUIPro.Web/HJGL/PreDesign/PrePipeline.aspx
index e3aa99d9..27e2552c 100644
--- a/SGGL/FineUIPro.Web/HJGL/PreDesign/PrePipeline.aspx
+++ b/SGGL/FineUIPro.Web/HJGL/PreDesign/PrePipeline.aspx
@@ -88,6 +88,8 @@
+
+
diff --git a/SGGL/FineUIPro.Web/HJGL/PreDesign/PrePipeline.aspx.cs b/SGGL/FineUIPro.Web/HJGL/PreDesign/PrePipeline.aspx.cs
index 219cbb56..c672b73c 100644
--- a/SGGL/FineUIPro.Web/HJGL/PreDesign/PrePipeline.aspx.cs
+++ b/SGGL/FineUIPro.Web/HJGL/PreDesign/PrePipeline.aspx.cs
@@ -653,6 +653,12 @@ if (!string.IsNullOrEmpty(drpFlowingSection.SelectedValue) && drpFlowingSection.
{
PageContext.RegisterStartupScript(Window3.GetShowReference(String.Format("PrePipelineQRCodeIn.aspx?", "导入 - ")));
+ }
+
+ protected void btnImportComponentJoint_Click(object sender, EventArgs e)
+ {
+ PageContext.RegisterStartupScript(Window3.GetShowReference(String.Format("PrePipelineComponentJointIn.aspx?", "导入 - ")));
+
}
protected void btnSinglePreview_Click(object sender, EventArgs e)
{
diff --git a/SGGL/FineUIPro.Web/HJGL/PreDesign/PrePipeline.aspx.designer.cs b/SGGL/FineUIPro.Web/HJGL/PreDesign/PrePipeline.aspx.designer.cs
index a464984d..60a019fc 100644
--- a/SGGL/FineUIPro.Web/HJGL/PreDesign/PrePipeline.aspx.designer.cs
+++ b/SGGL/FineUIPro.Web/HJGL/PreDesign/PrePipeline.aspx.designer.cs
@@ -239,6 +239,15 @@ namespace FineUIPro.Web.HJGL.PreDesign
///
protected global::FineUIPro.Button btnImportQRCode;
+ ///
+ /// btnImportComponentJoint 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.Button btnImportComponentJoint;
+
///
/// btnBatchAdd 控件。
///
diff --git a/SGGL/FineUIPro.Web/HJGL/PreDesign/PrePipelineComponentJointIn.aspx b/SGGL/FineUIPro.Web/HJGL/PreDesign/PrePipelineComponentJointIn.aspx
new file mode 100644
index 00000000..e139b05c
--- /dev/null
+++ b/SGGL/FineUIPro.Web/HJGL/PreDesign/PrePipelineComponentJointIn.aspx
@@ -0,0 +1,89 @@
+<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PrePipelineComponentJointIn.aspx.cs" Inherits="FineUIPro.Web.HJGL.PreDesign.PrePipelineComponentJointIn" %>
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/SGGL/FineUIPro.Web/HJGL/PreDesign/PrePipelineComponentJointIn.aspx.cs b/SGGL/FineUIPro.Web/HJGL/PreDesign/PrePipelineComponentJointIn.aspx.cs
new file mode 100644
index 00000000..e02ce59f
--- /dev/null
+++ b/SGGL/FineUIPro.Web/HJGL/PreDesign/PrePipelineComponentJointIn.aspx.cs
@@ -0,0 +1,336 @@
+using BLL;
+using MiniExcelLibs;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.IO;
+using System.Linq;
+
+namespace FineUIPro.Web.HJGL.PreDesign
+{
+ public partial class PrePipelineComponentJointIn : PageBase
+ {
+ private string initPath = Const.ExcelUrl;
+
+ public static List ComponentJointList = new List();
+
+ public static string errorInfos = string.Empty;
+
+ protected void Page_Load(object sender, EventArgs e)
+ {
+ if (!IsPostBack)
+ {
+ this.hdFileName.Text = string.Empty;
+ if (ComponentJointList != null)
+ {
+ ComponentJointList.Clear();
+ }
+ errorInfos = string.Empty;
+ }
+ }
+
+ protected void btnAudit_Click(object sender, EventArgs e)
+ {
+ try
+ {
+ if (this.fuAttachUrl.HasFile == false)
+ {
+ ShowNotify("请您选择Excel文件!", MessageBoxIcon.Warning);
+ return;
+ }
+ string isXls = Path.GetExtension(this.fuAttachUrl.FileName).ToString().Trim().ToLower();
+ if (isXls != ".xlsx")
+ {
+ ShowNotify("只可以选择Excel文件!", MessageBoxIcon.Warning);
+ return;
+ }
+ ComponentJointList.Clear();
+ errorInfos = string.Empty;
+
+ string rootPath = Server.MapPath("~/");
+ string initFullPath = rootPath + initPath;
+ if (!Directory.Exists(initFullPath))
+ {
+ Directory.CreateDirectory(initFullPath);
+ }
+
+ this.hdFileName.Text = BLL.Funs.GetNewFileName() + isXls;
+ string filePath = initFullPath + this.hdFileName.Text;
+ this.fuAttachUrl.PostedFile.SaveAs(filePath);
+ ImportXlsToData(filePath);
+ }
+ catch (Exception ex)
+ {
+ Alert alert = new Alert
+ {
+ Message = "'" + ex.Message + "'",
+ Target = Target.Self
+ };
+ alert.Show();
+ }
+ }
+
+ private void ImportXlsToData(string fileName)
+ {
+ var rows = MiniExcel.QueryAsDataTable(fileName, useHeaderRow: true);
+ Model.ResponeData responeData = AddDatasetToSQL(rows, 3);
+ if (responeData.code == 1)
+ {
+ ShowNotify("审核完成,请点击导入!", MessageBoxIcon.Success);
+ }
+ else
+ {
+ Alert alert = new Alert
+ {
+ Message = responeData.message,
+ Target = Target.Self
+ };
+ alert.Show();
+ }
+ }
+
+ private Model.ResponeData AddDatasetToSQL(DataTable pds, int cols)
+ {
+ Model.ResponeData responeData = new Model.ResponeData();
+ List result = new List();
+ if (pds == null)
+ {
+ responeData.code = 0;
+ responeData.message = "导入数据为空!";
+ return responeData;
+ }
+
+ int ic = pds.Columns.Count;
+ int ir = pds.Rows.Count;
+ if (ic < cols || !pds.Columns.Contains("管线号") || !pds.Columns.Contains("预制组件") || !pds.Columns.Contains("焊口号"))
+ {
+ responeData.code = 0;
+ responeData.message = "导入Excel格式错误!模板列必须包含:管线号、预制组件、焊口号";
+ return responeData;
+ }
+ if (ir == 0)
+ {
+ responeData.code = 0;
+ responeData.message = "导入数据为空!";
+ return responeData;
+ }
+
+ var getPipeline = from x in Funs.DB.HJGL_Pipeline where x.ProjectId == this.CurrUser.LoginProjectId select x;
+ List importItems = new List();
+
+ for (int i = 0; i < ir; i++)
+ {
+ string pipelineCode = GetCellValue(pds.Rows[i], "管线号");
+ string pipelineComponentCode = GetCellValue(pds.Rows[i], "预制组件");
+ string weldJointCode = GetCellValue(pds.Rows[i], "焊口号");
+
+ if (string.IsNullOrEmpty(pipelineCode) && string.IsNullOrEmpty(pipelineComponentCode) && string.IsNullOrEmpty(weldJointCode))
+ {
+ continue;
+ }
+
+ if (string.IsNullOrEmpty(pipelineCode))
+ {
+ result.Add("第" + (i + 2).ToString() + "行,管线号,此项为必填项!");
+ continue;
+ }
+ if (string.IsNullOrEmpty(pipelineComponentCode))
+ {
+ result.Add("第" + (i + 2).ToString() + "行,预制组件,此项为必填项!");
+ continue;
+ }
+ if (string.IsNullOrEmpty(weldJointCode))
+ {
+ result.Add("第" + (i + 2).ToString() + "行,焊口号,此项为必填项!");
+ continue;
+ }
+
+ var pipeline = getPipeline.FirstOrDefault(x => x.PipelineCode == pipelineCode);
+ if (pipeline == null)
+ {
+ result.Add("第" + (i + 2).ToString() + "行,不存在此管线号-" + pipelineCode);
+ continue;
+ }
+
+ var pipelineComponent = HJGL_PipelineComponentService.GetPipelineComponentByCodeandpipelineId(pipelineComponentCode, pipeline.PipelineId);
+ if (pipelineComponent == null)
+ {
+ result.Add("第" + (i + 2).ToString() + "行,不存在此预制组件-" + pipelineComponentCode);
+ continue;
+ }
+
+ var weldJoint = WeldJointService.GetWeldJointsByWeldJointCode(pipeline.PipelineId, weldJointCode);
+ if (weldJoint == null)
+ {
+ result.Add("第" + (i + 2).ToString() + "行,不存在此焊口号-" + weldJointCode);
+ continue;
+ }
+
+ importItems.Add(new ComponentJointImportItem
+ {
+ PipelineId = pipeline.PipelineId,
+ PipelineCode = pipeline.PipelineCode,
+ PipelineComponentId = pipelineComponent.PipelineComponentId,
+ PipelineComponentCode = pipelineComponent.PipelineComponentCode,
+ WeldJointId = weldJoint.WeldJointId,
+ WeldJointCode = weldJoint.WeldJointCode
+ });
+ }
+
+ var conflictWeldJoints = importItems
+ .GroupBy(x => x.WeldJointId)
+ .Where(x => x.Select(y => y.PipelineComponentId).Distinct().Count() > 1)
+ .Select(x => x.First().PipelineCode + "-" + x.First().WeldJointCode)
+ .ToList();
+ if (conflictWeldJoints.Count > 0)
+ {
+ result.Add("同一焊口不能导入到多个组件:" + string.Join("、", conflictWeldJoints));
+ }
+
+ if (result.Count > 0)
+ {
+ ComponentJointList.Clear();
+ errorInfos = string.Join("|", result.Distinct());
+ responeData.code = 0;
+ responeData.message = errorInfos;
+ return responeData;
+ }
+
+ ComponentJointList = importItems
+ .GroupBy(x => new { x.PipelineComponentId, x.WeldJointId })
+ .Select(x => x.First())
+ .ToList();
+ errorInfos = string.Empty;
+ responeData.code = ComponentJointList.Count > 0 ? 1 : 0;
+ responeData.message = ComponentJointList.Count > 0 ? string.Empty : "导入数据为空!";
+ return responeData;
+ }
+
+ protected void btnImport_Click(object sender, EventArgs e)
+ {
+ if (string.IsNullOrEmpty(errorInfos))
+ {
+ if (!string.IsNullOrEmpty(this.hdFileName.Text))
+ {
+ if (ComponentJointList.Count > 0)
+ {
+ this.Grid1.Hidden = false;
+ this.Grid1.DataIDField = "WeldJointId";
+ this.Grid1.DataSource = ComponentJointList;
+ this.Grid1.DataBind();
+ Grid1.RecordCount = ComponentJointList.Count;
+ }
+ }
+ else
+ {
+ ShowNotify("请先审核要导入的文件!", MessageBoxIcon.Warning);
+ }
+ }
+ else
+ {
+ ShowNotify("请先将错误数据修正,再重新导入提交!", MessageBoxIcon.Warning);
+ }
+ }
+
+ protected void btnSave_Click(object sender, EventArgs e)
+ {
+ if (!string.IsNullOrEmpty(errorInfos))
+ {
+ ShowNotify("请先将错误数据修正,再重新导入提交!", MessageBoxIcon.Warning);
+ return;
+ }
+
+ if (ComponentJointList.Count > 0)
+ {
+ foreach (var item in ComponentJointList)
+ {
+ var componentJoint = BLL.HJGL_PipelineComponentjointService.GetHJGL_Pipeline_ComponentJointByWeldJointId(item.WeldJointId);
+ if (componentJoint != null)
+ {
+ componentJoint.PipelineComponentCode = item.PipelineComponentCode;
+ componentJoint.PipelineComponentId = item.PipelineComponentId;
+ componentJoint.WeldJointCode = item.WeldJointCode;
+ componentJoint.WeldJointId = item.WeldJointId;
+ HJGL_PipelineComponentjointService.UpdateHJGL_Pipeline_ComponentJoint(componentJoint);
+ }
+ else
+ {
+ Model.HJGL_Pipeline_ComponentJoint newComponentJoint = new Model.HJGL_Pipeline_ComponentJoint();
+ newComponentJoint.Id = SQLHelper.GetNewID();
+ newComponentJoint.PipelineComponentCode = item.PipelineComponentCode;
+ newComponentJoint.PipelineComponentId = item.PipelineComponentId;
+ newComponentJoint.WeldJointCode = item.WeldJointCode;
+ newComponentJoint.WeldJointId = item.WeldJointId;
+ newComponentJoint.State = 0;
+ HJGL_PipelineComponentjointService.AddHJGL_Pipeline_ComponentJoint(newComponentJoint);
+ }
+ }
+ }
+
+ string rootPath = Server.MapPath("~/");
+ string filePath = rootPath + initPath + this.hdFileName.Text;
+ if (filePath != string.Empty && System.IO.File.Exists(filePath))
+ {
+ System.IO.File.Delete(filePath);
+ }
+ ShowNotify("导入成功!", MessageBoxIcon.Success);
+ PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
+ }
+
+ protected void btnDownLoad_Click(object sender, EventArgs e)
+ {
+ string rootPath = Server.MapPath("~/");
+ string tempDirectory = rootPath + @"File\Excel\Temp\";
+ if (!Directory.Exists(tempDirectory))
+ {
+ Directory.CreateDirectory(tempDirectory);
+ }
+ string tempPath = tempDirectory + "组件焊口信息导入模板" + string.Format("{0:yyyyMMddHHmmss}", DateTime.Now) + ".xlsx";
+ DataTable template = new DataTable();
+ template.Columns.Add("管线号");
+ template.Columns.Add("预制组件");
+ template.Columns.Add("焊口号");
+ MiniExcel.SaveAs(tempPath, template);
+
+ FileInfo info = new FileInfo(tempPath);
+ long fileSize = info.Length;
+ Response.ClearContent();
+ Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode("组件焊口信息导入模板.xlsx", System.Text.Encoding.UTF8));
+ Response.ContentType = "excel/plain";
+ Response.ContentEncoding = System.Text.Encoding.UTF8;
+ Response.AddHeader("Content-Length", fileSize.ToString().Trim());
+ Response.TransmitFile(tempPath, 0, fileSize);
+ Response.Flush();
+ Response.Close();
+ File.Delete(tempPath);
+ }
+
+ protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue);
+ this.Grid1.DataSource = ComponentJointList;
+ this.Grid1.DataBind();
+ Grid1.RecordCount = ComponentJointList.Count;
+ }
+
+ private string GetCellValue(DataRow row, string columnName)
+ {
+ return Convert.ToString(row[columnName]).Replace("\n", "").Replace(" ", "").Replace("\t", "").Replace("\r", "").Trim();
+ }
+
+ public class ComponentJointImportItem
+ {
+ public string PipelineId { get; set; }
+
+ public string PipelineCode { get; set; }
+
+ public string PipelineComponentId { get; set; }
+
+ public string PipelineComponentCode { get; set; }
+
+ public string WeldJointId { get; set; }
+
+ public string WeldJointCode { get; set; }
+ }
+ }
+}
diff --git a/SGGL/FineUIPro.Web/HJGL/PreDesign/PrePipelineComponentJointIn.aspx.designer.cs b/SGGL/FineUIPro.Web/HJGL/PreDesign/PrePipelineComponentJointIn.aspx.designer.cs
new file mode 100644
index 00000000..f94bc931
--- /dev/null
+++ b/SGGL/FineUIPro.Web/HJGL/PreDesign/PrePipelineComponentJointIn.aspx.designer.cs
@@ -0,0 +1,143 @@
+//------------------------------------------------------------------------------
+// <自动生成>
+// 此代码由工具生成。
+//
+// 对此文件的更改可能导致不正确的行为,如果
+// 重新生成代码,则所做更改将丢失。
+// 自动生成>
+//------------------------------------------------------------------------------
+
+namespace FineUIPro.Web.HJGL.PreDesign
+{
+
+
+ public partial class PrePipelineComponentJointIn
+ {
+
+ ///
+ /// form1 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::System.Web.UI.HtmlControls.HtmlForm form1;
+
+ ///
+ /// PageManager1 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.PageManager PageManager1;
+
+ ///
+ /// SimpleForm1 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.Form SimpleForm1;
+
+ ///
+ /// Toolbar2 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.Toolbar Toolbar2;
+
+ ///
+ /// hdFileName 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.HiddenField hdFileName;
+
+ ///
+ /// btnDownLoad 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.Button btnDownLoad;
+
+ ///
+ /// btnAudit 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.Button btnAudit;
+
+ ///
+ /// btnImport 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.Button btnImport;
+
+ ///
+ /// btnSave 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.Button btnSave;
+
+ ///
+ /// fuAttachUrl 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.FileUpload fuAttachUrl;
+
+ ///
+ /// Grid1 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.Grid Grid1;
+
+ ///
+ /// ToolbarSeparator1 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.ToolbarSeparator ToolbarSeparator1;
+
+ ///
+ /// ToolbarText1 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.ToolbarText ToolbarText1;
+
+ ///
+ /// ddlPageSize 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.DropDownList ddlPageSize;
+ }
+}
diff --git a/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldMatMatch.aspx b/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldMatMatch.aspx
index 08f8d3d3..e49f353f 100644
--- a/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldMatMatch.aspx
+++ b/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldMatMatch.aspx
@@ -34,6 +34,11 @@
background-color: green;
}
+ .f-grid-row.priority {
+ background-color: #1e88e5;
+ color: #fff;
+ }
+
.f-grid-row {
font-size: smaller;
}
@@ -138,7 +143,9 @@
-
+
+
+
@@ -174,9 +181,9 @@
+ SortField="Id" SortDirection="ASC" OnSort="Grid1_Sort" EnableCheckBoxSelect="true">
> priorityComponents
+ {
+ get
+ {
+ var value = ViewState["priorityComponents"] as Dictionary>;
+ if (value == null)
+ {
+ value = new Dictionary>();
+ ViewState["priorityComponents"] = value;
+ }
+ return value;
+ }
+ set
+ {
+ ViewState["priorityComponents"] = value;
+ }
+ }
+
protected void Page_Load(object sender, EventArgs e)
{
@@ -86,6 +104,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
; HJGL_MaterialService.materialStockItems_FIELD = new List();
HJGL_MaterialService.materialStockItems_SHOP = new List();
dicSeclectPipeLine = new Dictionary();
+ priorityComponents = new Dictionary>();
var pipeline = (from x in Funs.DB.HJGL_Pipeline
where x.ProjectId == this.CurrUser.LoginProjectId
select x.FlowingSection).Distinct().ToList();
@@ -464,23 +483,66 @@ namespace FineUIPro.Web.HJGL.WeldingManage
}*/
}
- protected void Grid2_RowClick(object sender, GridRowClickEventArgs e)
+
+ private void BindMaterialDetail(string pipelineId)
{
- var tb = tw_PipeMatMatchOutputs.Where(x => x.PipelineId == Grid2.SelectedRowID).ToList();
+ var tb = tw_PipeMatMatchOutputs.Where(x => x.PipelineId == pipelineId).ToList();
Grid1.DataSource = tb;
Grid1.DataBind();
+
+ var selectList = new List();
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)
+ if (model == null)
{
- Grid1.Rows[i].RowCssClass = "red";
-
+ continue;
}
+ if (IsPriorityComponent(model.PipelineId, model.PrefabricatedComponents))
+ {
+ Grid1.Rows[i].RowCssClass = "priority";
+ selectList.Add(model.Id);
+ }
+ else if (model.MatchRate < 1 || model.MatchRate == null)
+ {
+ Grid1.Rows[i].RowCssClass = "red";
+ }
}
+ Grid1.SelectedRowIDArray = selectList.ToArray();
+ }
+
+ private bool IsPriorityComponent(string pipelineId, string prefabricatedComponents)
+ {
+ return !string.IsNullOrEmpty(pipelineId)
+ && !string.IsNullOrEmpty(prefabricatedComponents)
+ && priorityComponents.ContainsKey(pipelineId)
+ && priorityComponents[pipelineId].Contains(prefabricatedComponents);
+ }
+
+ private Dictionary> GetPriorityComponentList()
+ {
+ return priorityComponents
+ .Where(x => x.Value != null && x.Value.Any())
+ .ToDictionary(x => x.Key, x => x.Value.ToList());
+ }
+
+ private void RefreshMatchResult()
+ {
+ tw_PipeMatMatchOutputs = TwArrivalStatisticsService.GetPipeMatMatch(
+ this.CurrUser.LoginProjectId,
+ dicSeclectPipeLine.Keys.ToList(),
+ drpWarehouse.SelectedValue,
+ GetPriorityComponentList());
+ BindGrid3();
+ BindGrid2();
+ }
+
+ protected void Grid2_RowClick(object sender, GridRowClickEventArgs e)
+ {
+ BindMaterialDetail(Grid2.SelectedRowID);
+
}
protected void Grid1_RowClick(object sender, GridRowClickEventArgs e)
{
@@ -520,7 +582,14 @@ namespace FineUIPro.Web.HJGL.WeldingManage
{
Grid1.SortDirection = e.SortDirection;
Grid1.SortField = e.SortField;
- BindGrid();
+ if (!string.IsNullOrEmpty(Grid2.SelectedRowID) && tw_PipeMatMatchOutputs != null && tw_PipeMatMatchOutputs.Any())
+ {
+ BindMaterialDetail(Grid2.SelectedRowID);
+ }
+ else
+ {
+ BindGrid();
+ }
}
#endregion
@@ -613,10 +682,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
dicSeclectPipeLine.Add(node.NodeID, node.Text);
}
}
- tw_PipeMatMatchOutputs = TwArrivalStatisticsService.GetPipeMatMatch(this.CurrUser.LoginProjectId, dicSeclectPipeLine.Keys.ToList(), drpWarehouse.SelectedValue);
-
- BindGrid3();
- BindGrid2();
+ RefreshMatchResult();
}
protected void btnDeletePipelineMatchMat_Click(object sender, EventArgs e)
@@ -626,6 +692,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
foreach (string rowId in Grid3.SelectedRowIDArray)
{
dicSeclectPipeLine.Remove(rowId);
+ priorityComponents.Remove(rowId);
var node = tvControlItem.FindNode(rowId);
if (node != null)
{
@@ -633,25 +700,63 @@ namespace FineUIPro.Web.HJGL.WeldingManage
}
}
- tw_PipeMatMatchOutputs = TwArrivalStatisticsService.GetPipeMatMatch(this.CurrUser.LoginProjectId, dicSeclectPipeLine.Keys.ToList(), drpWarehouse.SelectedValue);
-
- BindGrid3();
- BindGrid2();
+ RefreshMatchResult();
}
}
+
+ protected void btnPriorityComponents_Click(object sender, EventArgs e)
+ {
+ string selectedPipelineId = Grid2.SelectedRowID;
+ if (string.IsNullOrEmpty(selectedPipelineId))
+ {
+ ShowNotify("请先在材料匹配列表选择管线!", MessageBoxIcon.Warning);
+ return;
+ }
+
+ var selectedComponents = new HashSet();
+ foreach (int rowIndex in Grid1.SelectedRowIndexArray)
+ {
+ if (Grid1.DataKeys[rowIndex].Length < 3)
+ {
+ continue;
+ }
+
+ string pipelineId = Grid1.DataKeys[rowIndex][1]?.ToString();
+ string componentCode = Grid1.DataKeys[rowIndex][2]?.ToString();
+ if (pipelineId == selectedPipelineId && !string.IsNullOrEmpty(componentCode))
+ {
+ selectedComponents.Add(componentCode);
+ }
+ }
+
+ if (selectedComponents.Any())
+ {
+ priorityComponents[selectedPipelineId] = selectedComponents;
+ }
+ else
+ {
+ priorityComponents.Remove(selectedPipelineId);
+ }
+
+ RefreshMatchResult();
+ BindMaterialDetail(selectedPipelineId);
+ }
+
protected void btnGenTask_Click(object sender, EventArgs e)
{
if (Grid2.SelectedRowIDArray.Count() > 0)
{
- SaveTask();
- ShowNotify("生成任务单成功!", MessageBoxIcon.Warning);
- // Alert.Show("生成任务单成功!", MessageBoxIcon.Warning);
- Grid1.DataSource = null;
- Grid1.DataBind();
- Grid2.DataSource = null;
- Grid2.DataBind();
- Grid3.DataSource = null;
- Grid3.DataBind();
+ if (SaveTask())
+ {
+ ShowNotify("生成任务单成功!", MessageBoxIcon.Warning);
+ // Alert.Show("生成任务单成功!", MessageBoxIcon.Warning);
+ Grid1.DataSource = null;
+ Grid1.DataBind();
+ Grid2.DataSource = null;
+ Grid2.DataBind();
+ Grid3.DataSource = null;
+ Grid3.DataBind();
+ }
}
else
{
@@ -659,7 +764,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
}
}
- private void SaveTask()
+ private bool 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;
@@ -679,6 +784,21 @@ namespace FineUIPro.Web.HJGL.WeldingManage
{
selectRowId = selectRowId.Where(x => x.JointAttribute == "预制口").ToList();
}
+ var priorityWeldJointIds = GetPriorityWeldJointIds(Grid2.SelectedRowIDArray.ToList());
+ if (priorityWeldJointIds.Any())
+ {
+ if (priorityWeldJointIds.Any(x => !x.Value.Any()))
+ {
+ ShowNotify("选中组件未找到关联焊口,无法按组件生成任务单!", MessageBoxIcon.Warning);
+ return false;
+ }
+ selectRowId = selectRowId.Where(x => !priorityWeldJointIds.ContainsKey(x.PipelineId) || priorityWeldJointIds[x.PipelineId].Contains(x.WeldJointId)).ToList();
+ }
+ if (!selectRowId.Any())
+ {
+ ShowNotify("未找到可生成任务单的焊口!", MessageBoxIcon.Warning);
+ return false;
+ }
foreach (var weldjoint in selectRowId)
{
string canWeldingRodName = string.Empty;
@@ -713,7 +833,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
if (oldWeldTask != null)
{
ShowNotify("所选焊口已存在任务单,无法保存!", MessageBoxIcon.Warning);
- return;
+ return false;
}
Model.HJGL_WeldJoint weldJoint = BLL.WeldJointService.GetWeldJointByWeldJointId(NewTask.WeldJointId);
if (weldJoint != null)
@@ -786,7 +906,36 @@ namespace FineUIPro.Web.HJGL.WeldingManage
BLL.WeldTaskService.AddWeldTask(NewTask);
}
+ return true;
}
+
+ private Dictionary> GetPriorityWeldJointIds(List selectedPipelineIds)
+ {
+ var result = new Dictionary>();
+ var selectedPriority = priorityComponents
+ .Where(x => selectedPipelineIds.Contains(x.Key) && x.Value != null && x.Value.Any())
+ .ToList();
+
+ foreach (var item in selectedPriority)
+ {
+ string pipelineId = item.Key;
+ var componentCodes = item.Value.ToList();
+ var weldJointIds = (from joint in Funs.DB.HJGL_Pipeline_ComponentJoint
+ join weldJoint in Funs.DB.HJGL_WeldJoint on joint.WeldJointId equals weldJoint.WeldJointId
+ join component in Funs.DB.HJGL_Pipeline_Component on joint.PipelineComponentId equals component.PipelineComponentId into componentJoin
+ from componentItem in componentJoin.DefaultIfEmpty()
+ where joint.WeldJointId != null
+ && weldJoint.PipelineId == pipelineId
+ && ((componentItem != null && componentCodes.Contains(componentItem.PipelineComponentCode))
+ || componentCodes.Contains(joint.PipelineComponentCode))
+ select joint.WeldJointId).Distinct().ToList();
+
+ result[pipelineId] = new HashSet(weldJointIds);
+ }
+
+ return result;
+ }
+
private bool IsCoverClass(string wpsClass, string matClass)
{
bool isCover = false;
diff --git a/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldMatMatch.aspx.designer.cs b/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldMatMatch.aspx.designer.cs
index 943a5341..1095bf1c 100644
--- a/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldMatMatch.aspx.designer.cs
+++ b/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldMatMatch.aspx.designer.cs
@@ -257,6 +257,15 @@ namespace FineUIPro.Web.HJGL.WeldingManage
///
protected global::FineUIPro.Label lbNote;
+ ///
+ /// btnPriorityComponents 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.Button btnPriorityComponents;
+
///
/// btnGenTask 控件。
///