diff --git a/DataBase/版本日志/SGGLDB_V2026-08-12-lpf.sql b/DataBase/版本日志/SGGLDB_V2026-08-12-lpf.sql
new file mode 100644
index 00000000..39334678
--- /dev/null
+++ b/DataBase/版本日志/SGGLDB_V2026-08-12-lpf.sql
@@ -0,0 +1,16 @@
+IF COL_LENGTH('dbo.Tw_InputDetailBarCode', 'Quantity') IS NULL
+BEGIN
+ ALTER TABLE dbo.Tw_InputDetailBarCode
+ ADD Quantity DECIMAL(18, 4) NULL;
+END;
+GO
+
+-- 历史非管材条码每个代表1件;按米计量的管材数量由扫码业务录入,保持为空。
+UPDATE barCode
+SET barCode.Quantity = 1
+FROM dbo.Tw_InputDetailBarCode AS barCode
+LEFT JOIN dbo.HJGL_MaterialCodeLib AS material
+ ON material.MaterialCode = barCode.MaterialCode
+WHERE barCode.Quantity IS NULL
+ AND ISNULL(LTRIM(RTRIM(material.MaterialUnit)), N'') <> N'米';
+GO
diff --git a/SGGL/BLL/API/APIBaseInfoService.cs b/SGGL/BLL/API/APIBaseInfoService.cs
index 1a965528..9c364864 100644
--- a/SGGL/BLL/API/APIBaseInfoService.cs
+++ b/SGGL/BLL/API/APIBaseInfoService.cs
@@ -166,7 +166,49 @@ namespace BLL
}
#endregion
- #region 焊接探伤类型,探伤比例
+ #region 焊接方法、焊缝类型、探伤类型、探伤比例
+ ///
+ /// 获取焊接方法
+ ///
+ ///
+ public static List GetWeldingMethod()
+ {
+ using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
+ {
+ var getDataLists = (from x in db.Base_WeldingMethod
+ orderby x.WeldingMethodCode
+ select new Model.BaseInfoItem
+ {
+ BaseInfoId = x.WeldingMethodId,
+ BaseInfoCode = x.WeldingMethodCode,
+ BaseInfoName = x.WeldingMethodName
+ }
+ ).ToList();
+ return getDataLists;
+ }
+ }
+
+ ///
+ /// 获取焊缝类型
+ ///
+ ///
+ public static List GetWeldType()
+ {
+ using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
+ {
+ var getDataLists = (from x in db.Base_WeldType
+ orderby x.WeldTypeCode
+ select new Model.BaseInfoItem
+ {
+ BaseInfoId = x.WeldTypeId,
+ BaseInfoCode = x.WeldTypeCode,
+ BaseInfoName = x.WeldTypeName
+ }
+ ).ToList();
+ return getDataLists;
+ }
+ }
+
///
/// 获取探伤类型
///
diff --git a/SGGL/BLL/CLGL/TwArrivalStatisticsService.cs b/SGGL/BLL/CLGL/TwArrivalStatisticsService.cs
index 55365b14..8f7d339f 100644
--- a/SGGL/BLL/CLGL/TwArrivalStatisticsService.cs
+++ b/SGGL/BLL/CLGL/TwArrivalStatisticsService.cs
@@ -497,6 +497,7 @@ namespace BLL
x.MaterialCode2,
x.Number,
w.WeldJointId,
+ w.WeldJointCode,
w.Size,
w.WeldingDailyId
}).ToList();
@@ -528,16 +529,22 @@ namespace BLL
var materialGroups = componentMaterialRows
.Select(x => new
{
+ WeldJointId = x.WeldJointId,
+ WeldJointCode = x.WeldJointCode,
+ WeldJointDin = x.Size ?? 0,
MaterialCode = GetExportMaterialCode(x.MaterialCode, x.MaterialCode2, materialCodeLibByMaterialCode),
Quantity = x.Number ?? 0
})
.Where(x => !string.IsNullOrEmpty(x.MaterialCode))
- .GroupBy(x => x.MaterialCode)
- .OrderBy(x => x.Key)
+ .GroupBy(x => new { x.MaterialCode, x.WeldJointId, x.WeldJointCode, x.WeldJointDin })
+ .OrderBy(x => x.Key.WeldJointCode)
+ .ThenBy(x => x.Key.MaterialCode)
.Select(x => new
{
- MaterialCode = x.Key,
- Quantity = x.Sum(y => y.Quantity)
+ MaterialCode = x.Key.MaterialCode,
+ Quantity = x.Sum(y => y.Quantity),
+ WeldJointCode = x.Key.WeldJointCode,
+ WeldJointDin = x.Key.WeldJointDin
})
.ToList();
return new Tw_PartialWeldedComponentOutput
@@ -555,6 +562,8 @@ namespace BLL
UnweldedDin = weldJoints
.Where(x => string.IsNullOrEmpty(x.WeldingDailyId))
.Sum(x => x.Size ?? 0),
+ WeldJointCode = string.Join("\n", materialGroups.Select(x => x.WeldJointCode)),
+ WeldJointDin = string.Join("\n", materialGroups.Select(x => x.WeldJointDin.ToString())),
MaterialCode = string.Join("\n", materialGroups.Select(x => x.MaterialCode)),
MaterialQuantity = string.Join("\n", materialGroups.Select(x => x.Quantity.ToString()))
};
diff --git a/SGGL/BLL/CLGL/TwInOutplanmasterService.cs b/SGGL/BLL/CLGL/TwInOutplanmasterService.cs
index 3c786b2b..b78e2985 100644
--- a/SGGL/BLL/CLGL/TwInOutplanmasterService.cs
+++ b/SGGL/BLL/CLGL/TwInOutplanmasterService.cs
@@ -174,8 +174,7 @@ namespace BLL
}
var result = q.Skip(grid1.PageSize * grid1.PageIndex).Take(grid1.PageSize).ToList();
// q = SortConditionHelper.SortingAndPaging(q, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize);
- return from x in result
-
+ return from x in result
select new Model.Tw_InOutMasterOutput
{
Id = x.Id,
diff --git a/SGGL/BLL/CLGL/TwInputdetailBarCodeService.cs b/SGGL/BLL/CLGL/TwInputdetailBarCodeService.cs
index 7d3bcee3..bc1bbae9 100644
--- a/SGGL/BLL/CLGL/TwInputdetailBarCodeService.cs
+++ b/SGGL/BLL/CLGL/TwInputdetailBarCodeService.cs
@@ -3,11 +3,14 @@ using Model;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
+using System;
namespace BLL
{
public static class TwInputdetailBarCodeService
{
+ private static readonly object BarCodeLock = new object();
+
public static int Count
{
get;
@@ -52,18 +55,23 @@ namespace BLL
MaterialDef = mat.MaterialDef,
MaterialSpec = mat.MaterialSpec,
MaterialUnit = mat.MaterialUnit,
- BarCode = x.MaterialCode
+ BarCode = x.BarCode,
+ Quantity = x.Quantity
};
return q.ToList();
}
public static List GetListData(string materialCode)
{
- var q = from mat in Funs.DB.HJGL_MaterialCodeLib
- where
- mat.MaterialCode == materialCode
+ var q = from detailBarCode in Funs.DB.Tw_InputDetailBarCode
+ join mat in Funs.DB.HJGL_MaterialCodeLib on detailBarCode.MaterialCode equals mat.MaterialCode
+ where detailBarCode.MaterialCode == materialCode
+ orderby detailBarCode.BarCode
select new Tw_InputDetailBarCodeOutput
{
+ Id = detailBarCode.Id,
+ InputDetailId = detailBarCode.InputDetailId,
+ InputMasterId = detailBarCode.InputMasterId,
MaterialCode = mat.MaterialCode,
Code = mat.Code,
HeatNo = mat.HeatNo,
@@ -72,7 +80,8 @@ namespace BLL
MaterialDef = mat.MaterialDef,
MaterialSpec = mat.MaterialSpec,
MaterialUnit = mat.MaterialUnit,
- BarCode = mat.MaterialCode
+ BarCode = detailBarCode.BarCode,
+ Quantity = detailBarCode.Quantity
};
return q.ToList();
@@ -88,17 +97,65 @@ namespace BLL
return;
}
- string id = SQLHelper.GetNewID();
- Tw_InputDetailBarCode table = new Tw_InputDetailBarCode
+ lock (BarCodeLock)
{
- Id = id,
- InputDetailId = inputDetail.Id,
- InputMasterId = inputMaster.Id,
- MaterialCode = inputDetail.MaterialCode,
- BarCode = BuildBarCode(inputMaster, inputDetail, id)
- };
- Funs.DB.Tw_InputDetailBarCode.InsertOnSubmit(table);
- Funs.DB.SubmitChanges();
+ if (IsExist(inputDetail.Id))
+ {
+ return;
+ }
+
+ string id = SQLHelper.GetNewID();
+ bool isMeter = IsMeterMaterial(inputDetail.MaterialCode);
+ Tw_InputDetailBarCode table = new Tw_InputDetailBarCode
+ {
+ Id = id,
+ InputDetailId = inputDetail.Id,
+ InputMasterId = inputMaster.Id,
+ MaterialCode = inputDetail.MaterialCode,
+ // 按米计量的管材由扫码后录入实际长度,其他材料每个条码固定代表1件。
+ Quantity = isMeter ? (decimal?)null : 1m,
+ BarCode = isMeter ? BuildNextBarCode(inputDetail.MaterialCode) : inputDetail.MaterialCode
+ };
+ Funs.DB.Tw_InputDetailBarCode.InsertOnSubmit(table);
+ Funs.DB.SubmitChanges();
+ }
+ }
+
+ ///
+ /// 为指定管材入库明细生成下一个流水条码。
+ ///
+ public static string AddNextByInputDetailId(string inputDetailId)
+ {
+ if (string.IsNullOrWhiteSpace(inputDetailId))
+ {
+ throw new ArgumentException("入库明细不能为空。");
+ }
+
+ lock (BarCodeLock)
+ {
+ var inputDetail = Funs.DB.Tw_InputDetail.FirstOrDefault(x => x.Id == inputDetailId);
+ if (inputDetail == null)
+ {
+ throw new InvalidOperationException("未找到入库明细。");
+ }
+ if (!IsMeterMaterial(inputDetail.MaterialCode))
+ {
+ throw new InvalidOperationException("只有单位为米的管材可以生成新条码。");
+ }
+
+ string barCode = BuildNextBarCode(inputDetail.MaterialCode);
+ Funs.DB.Tw_InputDetailBarCode.InsertOnSubmit(new Tw_InputDetailBarCode
+ {
+ Id = SQLHelper.GetNewID(),
+ InputDetailId = inputDetail.Id,
+ InputMasterId = inputDetail.InputMasterId,
+ MaterialCode = inputDetail.MaterialCode,
+ BarCode = barCode,
+ Quantity = null
+ });
+ Funs.DB.SubmitChanges();
+ return barCode;
+ }
}
public static void DeleteByInputMasterId(string inputMasterId)
@@ -140,7 +197,41 @@ namespace BLL
///
public static string BuildBarCode(Tw_InputMaster inputMaster, Tw_InputDetail inputDetail, string barCodeDetailId)
{
- return inputDetail == null ? string.Empty : inputDetail.MaterialCode;
+ if (inputDetail == null)
+ {
+ return string.Empty;
+ }
+ return IsMeterMaterial(inputDetail.MaterialCode)
+ ? BuildNextBarCode(inputDetail.MaterialCode)
+ : inputDetail.MaterialCode;
+ }
+
+ private static bool IsMeterMaterial(string materialCode)
+ {
+ string materialUnit = Funs.DB.HJGL_MaterialCodeLib
+ .Where(x => x.MaterialCode == materialCode)
+ .Select(x => x.MaterialUnit)
+ .FirstOrDefault();
+ return string.Equals((materialUnit ?? string.Empty).Trim(), "米", StringComparison.Ordinal);
+ }
+
+ private static string BuildNextBarCode(string materialCode)
+ {
+ string prefix = materialCode + "-";
+ int maxSequence = 0;
+ var barCodes = Funs.DB.Tw_InputDetailBarCode
+ .Where(x => x.MaterialCode == materialCode && x.BarCode.StartsWith(prefix))
+ .Select(x => x.BarCode)
+ .ToList();
+ foreach (string barCode in barCodes)
+ {
+ int sequence;
+ if (int.TryParse(barCode.Substring(prefix.Length), out sequence) && sequence > maxSequence)
+ {
+ maxSequence = sequence;
+ }
+ }
+ return prefix + (maxSequence + 1).ToString("D3");
}
}
}
diff --git a/SGGL/BLL/CLGL/TwInputdetailService.cs b/SGGL/BLL/CLGL/TwInputdetailService.cs
index 605c70d3..d7a416b3 100644
--- a/SGGL/BLL/CLGL/TwInputdetailService.cs
+++ b/SGGL/BLL/CLGL/TwInputdetailService.cs
@@ -48,6 +48,8 @@ namespace BLL
PipelineComponentCode = y.PipelineComponentCode,
MaterialName = mat.MaterialName,
MaterialDef = mat.MaterialDef,
+ MaterialUnit = mat.MaterialUnit,
+ BarCodeCount = Funs.DB.Tw_InputDetailBarCode.Count(barCode => barCode.InputDetailId == x.Id),
SortIndex = x.SortIndex
}
;
@@ -74,6 +76,16 @@ namespace BLL
return from x in q
select x;
}
+
+ ///
+ /// 获取按米计量的管材入库明细。
+ ///
+ public static List GetPipeListData(Model.Tw_InOutDetailOutput table)
+ {
+ return GetByModle(table)
+ .Where(x => x.MaterialUnit != null && x.MaterialUnit.Trim() == "米")
+ .ToList();
+ }
#endregion
public static Model.Tw_InputDetail GetById(string Id)
diff --git a/SGGL/BLL/CLGL/TwInputmasterService.cs b/SGGL/BLL/CLGL/TwInputmasterService.cs
index 3a01e23e..dac6fba3 100644
--- a/SGGL/BLL/CLGL/TwInputmasterService.cs
+++ b/SGGL/BLL/CLGL/TwInputmasterService.cs
@@ -33,6 +33,7 @@ namespace BLL
from unit in units.DefaultIfEmpty()
join warehouse in Funs.DB.Base_Warehouse on x.WarehouseId equals warehouse.WarehouseId into warehouses
from warehouse in warehouses.DefaultIfEmpty()
+ orderby x.CreateDate descending
where
(string.IsNullOrEmpty(table.Id) || x.Id.Contains(table.Id)) &&
(string.IsNullOrEmpty(table.InOutPlanMasterId) || x.InOutPlanMasterId.Contains(table.InOutPlanMasterId)) &&
diff --git a/SGGL/BLL/HJGL/BaseInfo/MaterialCodeLibService.cs b/SGGL/BLL/HJGL/BaseInfo/MaterialCodeLibService.cs
index 1886d8eb..7def0725 100644
--- a/SGGL/BLL/HJGL/BaseInfo/MaterialCodeLibService.cs
+++ b/SGGL/BLL/HJGL/BaseInfo/MaterialCodeLibService.cs
@@ -16,12 +16,13 @@
}
///
- /// 根据材料主编码获取条码扫码所需的材料信息。
+ /// 根据入库条码获取扫码所需的材料信息。
///
- public static Model.MaterialCodeLibBarCodeOutput GetBarCodeMaterialInfo(string materialCode)
+ public static Model.MaterialCodeLibBarCodeOutput GetBarCodeMaterialInfo(string barCode)
{
- return (from x in Funs.DB.HJGL_MaterialCodeLib
- where x.MaterialCode == materialCode
+ return (from detailBarCode in Funs.DB.Tw_InputDetailBarCode
+ join x in Funs.DB.HJGL_MaterialCodeLib on detailBarCode.MaterialCode equals x.MaterialCode
+ where detailBarCode.BarCode == barCode
select new Model.MaterialCodeLibBarCodeOutput
{
MaterialCode = x.MaterialCode,
@@ -31,10 +32,36 @@
MaterialName = x.MaterialName,
MaterialDef = x.MaterialDef,
MaterialSpec = x.MaterialSpec,
- MaterialUnit = x.MaterialUnit
+ MaterialUnit = x.MaterialUnit,
+ BarCode = detailBarCode.BarCode,
+ Quantity = detailBarCode.Quantity
}).FirstOrDefault();
}
+ ///
+ /// 保存指定入库条码的数量,并返回更新后的扫码信息。
+ ///
+ public static Model.MaterialCodeLibBarCodeOutput SaveBarCodeQuantity(string barCode, decimal quantity)
+ {
+ if (string.IsNullOrWhiteSpace(barCode))
+ {
+ throw new System.ArgumentException("条码不能为空。");
+ }
+ if (quantity <= 0m)
+ {
+ throw new System.ArgumentException("数量必须大于0。");
+ }
+
+ var detailBarCode = Funs.DB.Tw_InputDetailBarCode.FirstOrDefault(x => x.BarCode == barCode);
+ if (detailBarCode == null)
+ {
+ throw new System.InvalidOperationException("未找到对应的入库条码。");
+ }
+ detailBarCode.Quantity = quantity;
+ Funs.DB.SubmitChanges();
+ return GetBarCodeMaterialInfo(barCode);
+ }
+
public static List GetMaterialCodeLibList()
{
var q = (from x in Funs.DB.HJGL_MaterialCodeLib select x).ToList();
diff --git a/SGGL/FineUIPro.Web/CLGL/InputMaster.aspx b/SGGL/FineUIPro.Web/CLGL/InputMaster.aspx
index 420fb174..8785b8fb 100644
--- a/SGGL/FineUIPro.Web/CLGL/InputMaster.aspx
+++ b/SGGL/FineUIPro.Web/CLGL/InputMaster.aspx
@@ -129,7 +129,7 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -203,7 +258,7 @@
FieldType="String" HeaderText="材料名称" TextAlign="Left" HeaderTextAlign="Center">
+ FieldType="String" HeaderText="材料描述" TextAlign="Left" HeaderTextAlign="Center" Hidden="true">
@@ -214,6 +269,9 @@
+
+
diff --git a/SGGL/FineUIPro.Web/CLGL/InputMaster.aspx.cs b/SGGL/FineUIPro.Web/CLGL/InputMaster.aspx.cs
index 0fd9079c..15ad718c 100644
--- a/SGGL/FineUIPro.Web/CLGL/InputMaster.aspx.cs
+++ b/SGGL/FineUIPro.Web/CLGL/InputMaster.aspx.cs
@@ -66,6 +66,8 @@ namespace FineUIPro.Web.CLGL
Grid2.DataBind();
Grid3.DataSource = null;
Grid3.DataBind();
+ GridPipeDetail.DataSource = null;
+ GridPipeDetail.DataBind();
}
private void BindDetailGrid(string inputMasterId)
{
@@ -100,10 +102,22 @@ namespace FineUIPro.Web.CLGL
{
Model.Tw_InputDetailBarCodeOutput table = new Model.Tw_InputDetailBarCodeOutput();
table.InputMasterId = inputMasterId;
+ table.MaterialCode = txtBarCodeMaterialCode.Text.Trim();
var tb = BLL.TwInputdetailBarCodeService.GetListData(table, Grid3);
Grid3.DataSource = tb;
Grid3.DataBind();
}
+
+ private void BindPipeDetailGrid(string inputMasterId)
+ {
+ var table = new Model.Tw_InOutDetailOutput
+ {
+ InputMasterId = inputMasterId,
+ MaterialCode = txtPipeMaterialCode.Text.Trim()
+ };
+ GridPipeDetail.DataSource = BLL.TwInputdetailService.GetPipeListData(table);
+ GridPipeDetail.DataBind();
+ }
#endregion
#region GV 数据操作
@@ -146,6 +160,7 @@ namespace FineUIPro.Web.CLGL
string ID = Grid1.DataKeys[e.RowIndex][0].ToString();
BindDetailGrid(ID);
BindBarCodeGrid(ID);
+ BindPipeDetailGrid(ID);
}
}
///
@@ -350,6 +365,46 @@ namespace FineUIPro.Web.CLGL
}
}
+ protected void GridPipeDetail_RowCommand(object sender, GridCommandEventArgs e)
+ {
+ if (e.CommandName != "btnGenerateBarCode")
+ {
+ return;
+ }
+
+ try
+ {
+ string barCode = TwInputdetailBarCodeService.AddNextByInputDetailId(e.RowID);
+ BindPipeDetailGrid(Grid1.SelectedRowID);
+ BindBarCodeGrid(Grid1.SelectedRowID);
+ ShowNotify("新条码已生成:" + barCode, MessageBoxIcon.Success);
+ }
+ catch (Exception ex)
+ {
+ ShowNotify(ex.Message, MessageBoxIcon.Error);
+ }
+ }
+
+ protected void btnSearchPipeDetail_Click(object sender, EventArgs e)
+ {
+ if (string.IsNullOrEmpty(Grid1.SelectedRowID))
+ {
+ ShowNotify("请先选择一张入库单。", MessageBoxIcon.Warning);
+ return;
+ }
+ BindPipeDetailGrid(Grid1.SelectedRowID);
+ }
+
+ protected void btnSearchBarCodeDetail_Click(object sender, EventArgs e)
+ {
+ if (string.IsNullOrEmpty(Grid1.SelectedRowID))
+ {
+ ShowNotify("请先选择一张入库单。", MessageBoxIcon.Warning);
+ return;
+ }
+ BindBarCodeGrid(Grid1.SelectedRowID);
+ }
+
protected void TabStrip1_TabIndexChanged(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(Grid1.SelectedRowID))
@@ -359,6 +414,10 @@ namespace FineUIPro.Web.CLGL
BindDetailGrid(Grid1.SelectedRowID);
}
else if (TabStrip1.ActiveTabIndex == 1)
+ {
+ BindPipeDetailGrid(Grid1.SelectedRowID);
+ }
+ else if (TabStrip1.ActiveTabIndex == 2)
{
BindBarCodeGrid(Grid1.SelectedRowID);
}
diff --git a/SGGL/FineUIPro.Web/CLGL/InputMaster.aspx.designer.cs b/SGGL/FineUIPro.Web/CLGL/InputMaster.aspx.designer.cs
index 08d067ad..016fbb53 100644
--- a/SGGL/FineUIPro.Web/CLGL/InputMaster.aspx.designer.cs
+++ b/SGGL/FineUIPro.Web/CLGL/InputMaster.aspx.designer.cs
@@ -194,6 +194,36 @@ namespace FineUIPro.Web.CLGL
///
protected global::System.Web.UI.WebControls.Label Label1;
+ ///
+ /// TabPipeDetail 控件。
+ ///
+ protected global::FineUIPro.Tab TabPipeDetail;
+
+ ///
+ /// GridPipeDetail 控件。
+ ///
+ protected global::FineUIPro.Grid GridPipeDetail;
+
+ ///
+ /// ToolbarPipeDetail 控件。
+ ///
+ protected global::FineUIPro.Toolbar ToolbarPipeDetail;
+
+ ///
+ /// txtPipeMaterialCode 控件。
+ ///
+ protected global::FineUIPro.TextBox txtPipeMaterialCode;
+
+ ///
+ /// btnSearchPipeDetail 控件。
+ ///
+ protected global::FineUIPro.Button btnSearchPipeDetail;
+
+ ///
+ /// LabelPipeNumber 控件。
+ ///
+ protected global::System.Web.UI.WebControls.Label LabelPipeNumber;
+
///
/// TabInputDetailBarCode 控件。
///
@@ -203,6 +233,21 @@ namespace FineUIPro.Web.CLGL
///
protected global::FineUIPro.Tab TabInputDetailBarCode;
+ ///
+ /// ToolbarBarCodeDetail 控件。
+ ///
+ protected global::FineUIPro.Toolbar ToolbarBarCodeDetail;
+
+ ///
+ /// txtBarCodeMaterialCode 控件。
+ ///
+ protected global::FineUIPro.TextBox txtBarCodeMaterialCode;
+
+ ///
+ /// btnSearchBarCodeDetail 控件。
+ ///
+ protected global::FineUIPro.Button btnSearchBarCodeDetail;
+
///
/// Grid3 控件。
///
diff --git a/SGGL/FineUIPro.Web/File/Fastreport/无损检测委托单_附件6.frx b/SGGL/FineUIPro.Web/File/Fastreport/无损检测委托单_附件6.frx
index 868c0f75..ce7f1845 100644
--- a/SGGL/FineUIPro.Web/File/Fastreport/无损检测委托单_附件6.frx
+++ b/SGGL/FineUIPro.Web/File/Fastreport/无损检测委托单_附件6.frx
@@ -1,344 +1,62 @@
-
-
- using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Windows.Forms;
-using System.Drawing;
-using System.Data;
+using System;
using FastReport;
using FastReport.Data;
-using FastReport.Dialog;
-using FastReport.Barcode;
using FastReport.Table;
-using FastReport.Utils;
namespace FastReport
{
public class ReportScript
{
-
- private void Table4_ManualBuild(object sender, EventArgs e)
+ private void Detail6MainTable_ManualBuild(object sender, EventArgs e)
{
- DataSourceBase rowData = Report.GetDataSource("Table1");
- // init the data source
- rowData.Init();
-
- // print the first table row - it is a header
- Table4.PrintRow(0);
- // each PrintRow call must be followed by either PrintColumn or PrintColumns call
- // to print cells on the row
- Table4.PrintColumns();
-
- // now enumerate the data source and print the table body
-
- // print the table body
- Table4.PrintRow(1);
- Table4.PrintColumns();
- Table4.PrintRow(2);
- Table4.PrintColumns();
- Table4.PrintRow(3);
- Table4.PrintColumns();
- Table4.PrintRow(4);
- Table4.PrintColumns();
- Table4.PrintRow(5);
- Table4.PrintColumns();
-
- // go next data source row
- rowData.Next();
-
- }
-
- private void Table5_ManualBuild(object sender, EventArgs e)
- {
- Table5.PrintRow(0);
- Table5.PrintColumns();
- Table5.PrintRow(1);
- Table5.PrintColumns();
- }
-
-
- private int x;
- private void Tabel_Data_ManualBuild(object sender, EventArgs e)
- {
- DataSourceBase rowData = Report.GetDataSource("Data");
- // init the data source
- rowData.Init();
-
- // print the first table row - it is a header
- Tabel_Data.PrintRow(0);
- // each PrintRow call must be followed by either PrintColumn or PrintColumns call
- // to print cells on the row
- Tabel_Data.PrintColumns();
- x=0;
- // now enumerate the data source and print the table body
- while (rowData.HasMoreRows)
+ DataSourceBase data = Report.GetDataSource("Detail6Main");
+ data.Init();
+ Detail6MainTable.PrintRow(0);
+ Detail6MainTable.PrintColumns();
+ while (data.HasMoreRows)
{
- x++;
- // print the table body
- Tabel_Data.PrintRow(1);
- Tabel_Data.PrintColumns();
-
- // go next data source row
- rowData.Next();
+ Detail6MainTable.PrintRow(1);
+ Detail6MainTable.PrintColumns();
+ data.Next();
}
}
+
+ private void Detail6ExtraTable_ManualBuild(object sender, EventArgs e)
+ {
+ DataSourceBase data = Report.GetDataSource("Detail6Extra");
+ data.Init();
+ Detail6ExtraTable.PrintRow(0);
+ Detail6ExtraTable.PrintColumns();
+ while (data.HasMoreRows)
+ {
+ Detail6ExtraTable.PrintRow(1);
+ Detail6ExtraTable.PrintColumns();
+ data.Next();
+ }
+ }
+
}
}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
\ No newline at end of file
diff --git a/SGGL/FineUIPro.Web/File/Fastreport/管道焊口检测委托单_附件4.frx b/SGGL/FineUIPro.Web/File/Fastreport/管道焊口检测委托单_附件4.frx
index ee74b1e8..a958a1ef 100644
--- a/SGGL/FineUIPro.Web/File/Fastreport/管道焊口检测委托单_附件4.frx
+++ b/SGGL/FineUIPro.Web/File/Fastreport/管道焊口检测委托单_附件4.frx
@@ -1,360 +1,45 @@
-
-
- using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Windows.Forms;
-using System.Drawing;
-using System.Data;
+using System;
using FastReport;
using FastReport.Data;
-using FastReport.Dialog;
-using FastReport.Barcode;
using FastReport.Table;
-using FastReport.Utils;
namespace FastReport
{
public class ReportScript
{
-
- private void Table4_ManualBuild(object sender, EventArgs e)
+ private void Detail4Table_ManualBuild(object sender, EventArgs e)
{
- DataSourceBase rowData = Report.GetDataSource("Table1");
- // init the data source
- rowData.Init();
-
- // print the first table row - it is a header
- Table4.PrintRow(0);
- // each PrintRow call must be followed by either PrintColumn or PrintColumns call
- // to print cells on the row
- Table4.PrintColumns();
-
- // now enumerate the data source and print the table body
-
- // print the table body
- Table4.PrintRow(1);
- Table4.PrintColumns();
- Table4.PrintRow(2);
- Table4.PrintColumns();
- Table4.PrintRow(3);
- Table4.PrintColumns();
- Table4.PrintRow(4);
- Table4.PrintColumns();
- Table4.PrintRow(5);
- Table4.PrintColumns();
- Table4.PrintRow(6);
- Table4.PrintColumns();
- // go next data source row
- rowData.Next();
-
- }
-
- private void Table5_ManualBuild(object sender, EventArgs e)
- {
- Table5.PrintRow(0);
- Table5.PrintColumns();
- Table5.PrintRow(1);
- Table5.PrintColumns();
- }
-
-
- private int x;
- private void Tabel_Data_ManualBuild(object sender, EventArgs e)
- {
- DataSourceBase rowData = Report.GetDataSource("Data");
- // init the data source
- rowData.Init();
-
- // print the first table row - it is a header
- Tabel_Data.PrintRow(0);
- // each PrintRow call must be followed by either PrintColumn or PrintColumns call
- // to print cells on the row
- Tabel_Data.PrintColumns();
- x=0;
- // now enumerate the data source and print the table body
- while (rowData.HasMoreRows)
+ DataSourceBase data = Report.GetDataSource("Detail4");
+ data.Init();
+ Detail4Table.PrintRow(0);
+ Detail4Table.PrintColumns();
+ while (data.HasMoreRows)
{
- x++;
- // print the table body
- Tabel_Data.PrintRow(1);
- Tabel_Data.PrintColumns();
-
- // go next data source row
- rowData.Next();
+ Detail4Table.PrintRow(1);
+ Detail4Table.PrintColumns();
+ data.Next();
}
}
+
}
}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
\ No newline at end of file
diff --git a/SGGL/FineUIPro.Web/HJGL/PointTrust/TrustBatch.aspx.cs b/SGGL/FineUIPro.Web/HJGL/PointTrust/TrustBatch.aspx.cs
index 50a9818f..0315aa7b 100644
--- a/SGGL/FineUIPro.Web/HJGL/PointTrust/TrustBatch.aspx.cs
+++ b/SGGL/FineUIPro.Web/HJGL/PointTrust/TrustBatch.aspx.cs
@@ -631,6 +631,15 @@ namespace FineUIPro.Web.HJGL.PointTrust
dt.Columns.Add("CH_NDTMethod", typeof(String));
dt.Columns.Add("CH_SlopeType", typeof(String));
dt.Columns.Add("CH_NDTRate", typeof(String));
+ dt.Columns.Add("CH_DetectionType", typeof(String));
+ dt.Columns.Add("CH_WorkName", typeof(String));
+ dt.Columns.Add("CH_WorkType", typeof(String));
+ dt.Columns.Add("CH_Material", typeof(String));
+ dt.Columns.Add("CH_MediumGrade", typeof(String));
+ dt.Columns.Add("CH_DetectionTiming", typeof(String));
+ dt.Columns.Add("CH_ProjectPipelineCode", typeof(String));
+ dt.Columns.Add("CH_HeatTreatmentStatus", typeof(String));
+ dt.Columns.Add("CH_ExecutionStandard", typeof(String));
@@ -649,20 +658,39 @@ namespace FineUIPro.Web.HJGL.PointTrust
Alert.ShowInTop("请选择要打印的委托单!", MessageBoxIcon.Warning);
return;
}
- var CH_WeldMethod = (from batch in Funs.DB.View_Batch_BatchTrustItem
- join joint in Funs.DB.View_HJGL_WeldJoint on batch.WeldJointId equals joint.WeldJointId
- where batch.TrustBatchId == trust.TrustBatchId
- select joint.WeldingMethodCode).Distinct().ToList();
- var CH_SlopeType = (from batch in Funs.DB.View_Batch_BatchTrustItem
+ var printDetails = (from batch in Funs.DB.View_Batch_BatchTrustItem
join joint in Funs.DB.View_HJGL_WeldJoint on batch.WeldJointId equals joint.WeldJointId
where batch.TrustBatchId == trust.TrustBatchId
- select joint.GrooveTypeCode).Distinct().ToList();
+ orderby batch.PipelineCode, batch.WeldJointCode
+ select new
+ {
+ batch.PipelineCode,
+ batch.WeldJointCode,
+ batch.WelderCode,
+ joint.Specification,
+ joint.MaterialCode,
+ joint.Remark,
+ joint.WeldingMethodCode,
+ joint.GrooveTypeCode,
+ batch.PipingClassCode
+ }).ToList();
+ var CH_WeldMethod = printDetails.Select(x => x.WeldingMethodCode).Where(x => !string.IsNullOrEmpty(x)).Distinct().ToList();
+ var CH_SlopeType = printDetails.Select(x => x.GrooveTypeCode).Where(x => !string.IsNullOrEmpty(x)).Distinct().ToList();
if (trust != null)
{
string varValue = string.Empty;
var projectName = BLL.ProjectService.GetProjectNameByProjectId(this.CurrUser.LoginProjectId);
dr["ProjectName"] = projectName;
+ dr["CH_TrustUnit"] = BLL.UnitService.GetUnitNameByUnitId(this.CurrUser.UnitId);
+ dr["CH_DetectionType"] = "委托检测";
+ dr["CH_WorkName"] = "工艺管道";
+ dr["CH_WorkType"] = "对接焊缝";
+ dr["CH_DetectionTiming"] = "焊后";
+ dr["CH_HeatTreatmentStatus"] = "/";
+ dr["CH_ProjectPipelineCode"] = string.Join(",", printDetails.Select(x => x.PipelineCode).Where(x => !string.IsNullOrEmpty(x)).Distinct());
+ dr["CH_Material"] = string.Join("/", printDetails.Select(x => x.MaterialCode).Where(x => !string.IsNullOrEmpty(x)).Distinct());
+ dr["CH_MediumGrade"] = string.Join(",", printDetails.Select(x => x.PipingClassCode).Where(x => !string.IsNullOrEmpty(x)).Distinct());
if (!string.IsNullOrEmpty(trust.NDEUnit))
{
dr["CH_CheckUnit"] = BLL.UnitService.GetUnitNameByUnitId(trust.NDEUnit).ToString();
@@ -715,6 +743,54 @@ namespace FineUIPro.Web.HJGL.PointTrust
}
dt.Rows.Add(dr);
+ DataTable detailTable = new DataTable("Detail");
+ detailTable.Columns.Add("Sequence", typeof(int));
+ detailTable.Columns.Add("PipelineCode", typeof(string));
+ detailTable.Columns.Add("WeldJointCode", typeof(string));
+ detailTable.Columns.Add("Specification", typeof(string));
+ detailTable.Columns.Add("GrooveType", typeof(string));
+ detailTable.Columns.Add("WeldingMethod", typeof(string));
+ detailTable.Columns.Add("WelderCode", typeof(string));
+ detailTable.Columns.Add("MaterialCode", typeof(string));
+ detailTable.Columns.Add("Remark", typeof(string));
+
+ int sequence = 1;
+ foreach (var item in printDetails)
+ {
+ DataRow detailRow = detailTable.NewRow();
+ detailRow["Sequence"] = sequence++;
+ detailRow["PipelineCode"] = item.PipelineCode ?? string.Empty;
+ detailRow["WeldJointCode"] = item.WeldJointCode ?? string.Empty;
+ detailRow["Specification"] = item.Specification ?? string.Empty;
+ detailRow["GrooveType"] = item.GrooveTypeCode ?? string.Empty;
+ detailRow["WeldingMethod"] = item.WeldingMethodCode ?? string.Empty;
+ detailRow["WelderCode"] = item.WelderCode ?? string.Empty;
+ detailRow["MaterialCode"] = item.MaterialCode ?? string.Empty;
+ detailRow["Remark"] = item.Remark ?? string.Empty;
+ detailTable.Rows.Add(detailRow);
+ }
+
+ bool isAttachment6 = (ViewState["TrustPrintTemplate"] as string) == "附件6";
+ DataTable mainDetails = detailTable.Clone();
+ mainDetails.TableName = isAttachment6 ? "Detail6Main" : "Detail4";
+ int mainRowCount = isAttachment6 ? Math.Min(13, detailTable.Rows.Count) : detailTable.Rows.Count;
+ for (int i = 0; i < mainRowCount; i++)
+ {
+ mainDetails.ImportRow(detailTable.Rows[i]);
+ }
+ PadPrintDetailRows(mainDetails, 13);
+
+ DataTable extraDetails = detailTable.Clone();
+ extraDetails.TableName = "Detail6Extra";
+ if (isAttachment6)
+ {
+ for (int i = 13; i < detailTable.Rows.Count; i++)
+ {
+ extraDetails.ImportRow(detailTable.Rows[i]);
+ }
+ PadPrintDetailRows(extraDetails, 15);
+ }
+
Dictionary keyValuePairs = new Dictionary();
keyValuePairs.Add("TrustBatchId", trust.TrustBatchId);
keyValuePairs.Add("totalUnit", "赛鼎工程有限公司");
@@ -737,13 +813,18 @@ namespace FineUIPro.Web.HJGL.PointTrust
BLL.FastReportService.ResetData();
BLL.FastReportService.AddFastreportTable(dt);
+ BLL.FastReportService.AddFastreportTable(mainDetails);
+ if (isAttachment6)
+ {
+ BLL.FastReportService.AddFastreportTable(extraDetails);
+ }
BLL.FastReportService.AddFastreportParameter(keyValuePairs);
// Session["Table"] = dt;
// Session["CH_TrustID"] = reportId;
string initTemplatePath = "";
string rootPath = Server.MapPath("~/");
- initTemplatePath = (ViewState["TrustPrintTemplate"] as string) == "附件6"
+ initTemplatePath = isAttachment6
? "File\\Fastreport\\无损检测委托单_附件6.frx"
: "File\\Fastreport\\管道焊口检测委托单_附件4.frx";
@@ -1011,6 +1092,21 @@ namespace FineUIPro.Web.HJGL.PointTrust
}
}
+ ///
+ /// 按打印模板的固定行数补空行;附页超过一页时补齐到整页,确保页脚位置不随数据量漂移。
+ ///
+ private static void PadPrintDetailRows(DataTable table, int pageSize)
+ {
+ int targetRowCount = Math.Max(pageSize, ((table.Rows.Count + pageSize - 1) / pageSize) * pageSize);
+ while (table.Rows.Count < targetRowCount)
+ {
+ DataRow row = table.NewRow();
+ // FastReport 2017 会忽略所有字段均为 DBNull 的记录,设置隐藏序号保证空白表格行正常输出。
+ row["Sequence"] = 0;
+ table.Rows.Add(row);
+ }
+ }
+
#region 判断是否可删除
///
/// 判断是否可以删除
diff --git a/SGGL/FineUIPro.Web/HJGL/WeldingManage/JotTwoDesign.aspx.cs b/SGGL/FineUIPro.Web/HJGL/WeldingManage/JotTwoDesign.aspx.cs
index 231d90ca..236ecf78 100644
--- a/SGGL/FineUIPro.Web/HJGL/WeldingManage/JotTwoDesign.aspx.cs
+++ b/SGGL/FineUIPro.Web/HJGL/WeldingManage/JotTwoDesign.aspx.cs
@@ -51,16 +51,54 @@ namespace FineUIPro.Web.HJGL.WeldingManage
rootNode2.Expanded = true;
this.tvControlItem.Nodes.Add(rootNode2);
- var pUnits = (from x in Funs.DB.Project_ProjectUnit where x.ProjectId == this.CurrUser.LoginProjectId select x).ToList();
- // 获取当前用户所在单位
- var currUnit = pUnits.FirstOrDefault(x => x.UnitId == this.CurrUser.UnitId);
-
var unitWorkList = (from x in Funs.DB.WBS_UnitWork
where x.ProjectId == this.CurrUser.LoginProjectId
&& x.SuperUnitWork == null && x.UnitId != null && x.ProjectType != null
orderby x.UnitWorkCode
select x).ToList();
+ var unitWorkIds = unitWorkList.Select(x => x.UnitWorkId).ToList();
+ var testPackages = (from x in Funs.DB.PTP_TestPackage
+ where x.ProjectId == this.CurrUser.LoginProjectId
+ && unitWorkIds.Contains(x.UnitWorkId)
+ orderby x.TestPackageNo
+ select x).ToList();
+ var testPackageIds = testPackages.Select(x => x.PTP_ID).ToList();
+
+ // 试压包与管线、焊口存在跨表联动,必须批量统计,避免按单位工程和试压包逐条访问数据库。
+ var pipelineCountByTestPackage = new Dictionary();
+ if (testPackageIds.Count > 0)
+ {
+ var pipelineQuery = from x in Funs.DB.HJGL_Pipeline
+ join y in Funs.DB.PTP_PipelineList on x.PipelineId equals y.PipelineId
+ where testPackageIds.Contains(y.PTP_ID)
+ && x.ProjectId == this.CurrUser.LoginProjectId
+ && x.PipelineCode.Contains(this.txtPipelineCode.Text.Trim())
+ select new { y.PTP_ID, x.PipelineId };
+
+ if (!cbAllPipeline.Checked)
+ {
+ pipelineQuery = pipelineQuery.Where(x => Funs.DB.HJGL_WeldJoint.Any(y =>
+ y.PipelineId == x.PipelineId && y.IsTwoJoint == true));
+ }
+
+ pipelineCountByTestPackage = pipelineQuery.Distinct()
+ .ToList()
+ .GroupBy(x => x.PTP_ID)
+ .ToDictionary(x => x.Key, x => x.Count());
+ }
+
+ var unitIds = unitWorkList
+ .Where(x => !string.IsNullOrEmpty(x.UnitId))
+ .SelectMany(x => x.UnitId.Split(','))
+ .Where(x => !string.IsNullOrEmpty(x))
+ .Distinct()
+ .ToList();
+ var unitNameById = Funs.DB.Base_Unit
+ .Where(x => unitIds.Contains(x.UnitId))
+ .ToDictionary(x => x.UnitId, x => x.UnitName);
+ var testPackagesByUnitWork = testPackages.ToLookup(x => x.UnitWorkId);
+
List unitWork1 = null;
List unitWork2 = null;
@@ -84,16 +122,9 @@ namespace FineUIPro.Web.HJGL.WeldingManage
{
foreach (var q in unitWork1)
{
- int a = 0;
- if (cbAllPipeline.Checked)
- {
- a = GetUnitWorkTestPackagePipelineCount(q.UnitWorkId);
- }
- else
- {
- a = GetUnitWorkTestPackagePipelineCount(q.UnitWorkId);
- }
- var unitNamesUnitIds = BLL.UnitService.getUnitNamesUnitIds(q.UnitId);
+ var unitTestPackages = testPackagesByUnitWork[q.UnitWorkId].ToList();
+ int a = unitTestPackages.Sum(x => GetPipelineCount(pipelineCountByTestPackage, x.PTP_ID));
+ var unitNamesUnitIds = GetUnitNames(q.UnitId, unitNameById);
TreeNode tn1 = new TreeNode();
tn1.NodeID = q.UnitWorkId;
tn1.Text = q.UnitWorkName + "【" + a.ToString() + "】" + "管线";
@@ -104,7 +135,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
rootNode1.Nodes.Add(tn1);
if (a > 0)
{
- BindTestPackageNodes(tn1);
+ BindTestPackageNodes(tn1, unitTestPackages, pipelineCountByTestPackage);
}
}
}
@@ -112,16 +143,9 @@ namespace FineUIPro.Web.HJGL.WeldingManage
{
foreach (var q in unitWork2)
{
- int a = 0;
- if (cbAllPipeline.Checked)
- {
- a = GetUnitWorkTestPackagePipelineCount(q.UnitWorkId);
- }
- else
- {
- a = GetUnitWorkTestPackagePipelineCount(q.UnitWorkId);
- }
- var unitNamesUnitIds = BLL.UnitService.getUnitNamesUnitIds(q.UnitId);
+ var unitTestPackages = testPackagesByUnitWork[q.UnitWorkId].ToList();
+ int a = unitTestPackages.Sum(x => GetPipelineCount(pipelineCountByTestPackage, x.PTP_ID));
+ var unitNamesUnitIds = GetUnitNames(q.UnitId, unitNameById);
TreeNode tn2 = new TreeNode();
tn2.NodeID = q.UnitWorkId;
tn2.Text = q.UnitWorkName + "【" + a.ToString() + "】" + "管线";
@@ -136,11 +160,29 @@ namespace FineUIPro.Web.HJGL.WeldingManage
rootNode2.Nodes.Add(tn2);
if (a > 0)
{
- BindTestPackageNodes(tn2);
+ BindTestPackageNodes(tn2, unitTestPackages, pipelineCountByTestPackage);
}
}
}
}
+
+ private static int GetPipelineCount(IDictionary pipelineCountByTestPackage, string testPackageId)
+ {
+ int count;
+ return pipelineCountByTestPackage.TryGetValue(testPackageId, out count) ? count : 0;
+ }
+
+ private static string GetUnitNames(string unitIds, IDictionary unitNameById)
+ {
+ if (string.IsNullOrEmpty(unitIds))
+ {
+ return string.Empty;
+ }
+
+ return string.Join(",", unitIds.Split(',')
+ .Where(x => unitNameById.ContainsKey(x))
+ .Select(x => unitNameById[x]));
+ }
#endregion
private void BindNodes(TreeNode node)
{
@@ -214,27 +256,14 @@ namespace FineUIPro.Web.HJGL.WeldingManage
}
}
- private int GetUnitWorkTestPackagePipelineCount(string unitWorkId)
+ private void BindTestPackageNodes(
+ TreeNode unitWorkNode,
+ IEnumerable testPackages,
+ IDictionary pipelineCountByTestPackage)
{
- var testPackages = (from x in Funs.DB.PTP_TestPackage
- where x.ProjectId == this.CurrUser.LoginProjectId
- && x.UnitWorkId == unitWorkId
- select x.PTP_ID).ToList();
-
- return testPackages.Select(x => GetTestPackagePipelineList(x).Count()).Sum();
- }
-
- private void BindTestPackageNodes(TreeNode unitWorkNode)
- {
- var testPackages = (from x in Funs.DB.PTP_TestPackage
- where x.ProjectId == this.CurrUser.LoginProjectId
- && x.UnitWorkId == unitWorkNode.NodeID
- orderby x.TestPackageNo
- select x).ToList();
-
foreach (var item in testPackages)
{
- int pipelineCount = GetTestPackagePipelineList(item.PTP_ID).Count();
+ int pipelineCount = GetPipelineCount(pipelineCountByTestPackage, item.PTP_ID);
if (pipelineCount == 0)
{
continue;
@@ -257,20 +286,21 @@ namespace FineUIPro.Web.HJGL.WeldingManage
private List GetTestPackagePipelineList(string ptpId)
{
- var pipeline = (from x in Funs.DB.HJGL_Pipeline
- join y in Funs.DB.PTP_PipelineList on x.PipelineId equals y.PipelineId
- where y.PTP_ID == ptpId
- && x.ProjectId == this.CurrUser.LoginProjectId
- && x.PipelineCode.Contains(this.txtPipelineCode.Text.Trim())
- orderby x.PipelineCode
- select x).Distinct().ToList();
+ var pipelineQuery = (from x in Funs.DB.HJGL_Pipeline
+ join y in Funs.DB.PTP_PipelineList on x.PipelineId equals y.PipelineId
+ where y.PTP_ID == ptpId
+ && x.ProjectId == this.CurrUser.LoginProjectId
+ && x.PipelineCode.Contains(this.txtPipelineCode.Text.Trim())
+ orderby x.PipelineCode
+ select x).Distinct();
if (!cbAllPipeline.Checked)
{
- pipeline = pipeline.Where(x => (from y in Funs.DB.HJGL_WeldJoint where y.PipelineId == x.PipelineId && y.IsTwoJoint == true select y).Count() > 0).ToList();
+ pipelineQuery = pipelineQuery.Where(x => Funs.DB.HJGL_WeldJoint.Any(y =>
+ y.PipelineId == x.PipelineId && y.IsTwoJoint == true));
}
- return pipeline;
+ return pipelineQuery.ToList();
}
#region 点击TreeView
diff --git a/SGGL/FineUIPro.Web/HJGL/WeldingManage/SelectTaskWeldJoint.aspx.cs b/SGGL/FineUIPro.Web/HJGL/WeldingManage/SelectTaskWeldJoint.aspx.cs
index 2239f650..3a0e1572 100644
--- a/SGGL/FineUIPro.Web/HJGL/WeldingManage/SelectTaskWeldJoint.aspx.cs
+++ b/SGGL/FineUIPro.Web/HJGL/WeldingManage/SelectTaskWeldJoint.aspx.cs
@@ -213,12 +213,11 @@ namespace FineUIPro.Web.HJGL.WeldingManage
private void InitTreeMenu()
{
this.tvControlItem.Nodes.Clear();
- int a = (from x in Funs.DB.HJGL_Pipeline where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitWorkId == this.UnitWorkId && x.PipeArea == PipelineService.PipeArea_SHOP && x.PipelineCode.Contains(this.txtPipelineCode.Text.Trim()) select x).Count();
- int b = (from x in Funs.DB.HJGL_Pipeline where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitWorkId == this.UnitWorkId && x.PipeArea == PipelineService.PipeArea_FIELD && x.PipelineCode.Contains(this.txtPipelineCode.Text.Trim()) select x).Count();
+ int a = (from x in Funs.DB.HJGL_Pipeline where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitWorkId == this.UnitWorkId && x.PipelineCode.Contains(this.txtPipelineCode.Text.Trim()) select x).Count();
TreeNode rootNode1 = new TreeNode();
- rootNode1.NodeID = BLL.PipelineService.PipeArea_SHOP;
- rootNode1.Text = "工厂预制";
+ rootNode1.NodeID = "0";
+ rootNode1.Text = "管线";
rootNode1.CommandName = 1 + "|" + Funs.GetEndPageNumber(a, pageSize); //页码|总页
rootNode1.EnableClickEvent = true;
rootNode1.EnableExpandEvent = true;
@@ -229,29 +228,14 @@ namespace FineUIPro.Web.HJGL.WeldingManage
newNode.Text = "加载管线...";
newNode.NodeID = "加载管线...";
rootNode1.Nodes.Add(newNode);
- }
- TreeNode rootNode2 = new TreeNode();
- rootNode2.NodeID = BLL.PipelineService.PipeArea_FIELD;
- rootNode2.Text = "现场施工";
- rootNode2.CommandName = 1 + "|" + Funs.GetEndPageNumber(b, pageSize);
- rootNode2.EnableClickEvent = true;
- rootNode2.EnableExpandEvent = true;
- this.tvControlItem.Nodes.Add(rootNode2);
- if (b > 0)
- {
- TreeNode newNode = new TreeNode();
- newNode.Text = "加载管线...";
- newNode.NodeID = "加载管线...";
- rootNode2.Nodes.Add(newNode);
- }
+ }
}
- void AddTreeNode(string PipeArea, TreeNode node)
+ void AddTreeNode(TreeNode node)
{
var pipeline = (from x in Funs.DB.HJGL_Pipeline
where x.ProjectId == this.CurrUser.LoginProjectId
- && x.UnitWorkId == this.UnitWorkId
- && x.PipeArea == PipeArea
+ && x.UnitWorkId == this.UnitWorkId
&& x.PipelineCode.Contains(this.txtPipelineCode.Text.Trim())
orderby x.PipelineCode
select x).ToList();
@@ -289,8 +273,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
TreeNode newNode = new TreeNode();
newNode.Text = "加载";
newNode.NodeID = SQLHelper.GetNewID();
- newNode.Icon = Icon.ArrowDown;
- newNode.CommandName = PipeArea;
+ newNode.Icon = Icon.ArrowDown;
newNode.EnableClickEvent = true;
node.Nodes.Add(newNode);
}
@@ -303,16 +286,8 @@ namespace FineUIPro.Web.HJGL.WeldingManage
if (e.Node.Nodes[0].NodeID == "加载管线...")
{
e.Node.Nodes.Clear();
- if (e.Node.Text == "工厂预制")
- {
- AddTreeNode(BLL.PipelineService.PipeArea_SHOP, e.Node);
+ AddTreeNode(e.Node);
- }
- else if (e.Node.Text == "现场施工")
- {
- AddTreeNode(BLL.PipelineService.PipeArea_FIELD, e.Node);
-
- }
}
}
@@ -333,16 +308,8 @@ namespace FineUIPro.Web.HJGL.WeldingManage
TreeNode treeNode = e.Node.ParentNode;
treeNode.Nodes.Remove(e.Node);
- if (e.Node.CommandName == "1")
- {
- AddTreeNode(BLL.PipelineService.PipeArea_SHOP, e.Node.ParentNode);
+ AddTreeNode(e.Node.ParentNode);
- }
- else if (e.Node.CommandName == "2")
- {
- AddTreeNode(BLL.PipelineService.PipeArea_FIELD, e.Node.ParentNode);
-
- }
}
else
{
diff --git a/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldJointEdit.aspx b/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldJointEdit.aspx
index 685df171..326eb965 100644
--- a/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldJointEdit.aspx
+++ b/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldJointEdit.aspx
@@ -57,7 +57,9 @@
-
+
+
diff --git a/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldJointEdit.aspx.cs b/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldJointEdit.aspx.cs
index b96a32da..c54273e5 100644
--- a/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldJointEdit.aspx.cs
+++ b/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldJointEdit.aspx.cs
@@ -100,6 +100,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
{
this.txtWeldJointCode.Text = joint.WeldJointCode;
}
+ this.txtFlowingSection.Text = joint.FlowingSection;
if (!string.IsNullOrEmpty(joint.Material1Id))
{
this.drpMaterial1.SelectedValue = joint.Material1Id;
@@ -318,8 +319,17 @@ namespace FineUIPro.Web.HJGL.WeldingManage
Alert.ShowInTop("请完善必填项!", MessageBoxIcon.Warning);
return;
}
- Model.HJGL_WeldJoint joint = new Model.HJGL_WeldJoint();
string weldJointId = WeldJointId;
+ bool isUpdatingExistingJoint = !string.IsNullOrEmpty(weldJointId) && string.IsNullOrEmpty(Request.Params["Type"]);
+ Model.HJGL_WeldJoint joint = isUpdatingExistingJoint
+ ? BLL.WeldJointService.GetWeldJointByWeldJointId(weldJointId)
+ : new Model.HJGL_WeldJoint();
+ if (joint == null)
+ {
+ Alert.ShowInTop("焊口数据不存在或已被删除,请刷新后重试!", MessageBoxIcon.Warning);
+ return;
+ }
+
joint.PipelineId = this.PipelineId;
joint.PipelineCode = txtPipelineCode.Text.Trim();
joint.ProjectId = this.CurrUser.LoginProjectId;
@@ -418,6 +428,8 @@ namespace FineUIPro.Web.HJGL.WeldingManage
joint.IsHotProess = Convert.ToBoolean(drpIsHotProess.SelectedValue);
//joint.DesignIsHotProess = Convert.ToBoolean(drpDesignIsHotProess.SelectedValue);
joint.Remark = txtRemark.Text.Trim();
+ // 流水段属于焊口自身属性,编辑时直接回写焊口,避免只显示管线流水段而无法修正。
+ joint.FlowingSection = txtFlowingSection.Text.Trim();
joint.SubmitMan = CurrUser.PersonId;
if (this.txtWpqId.Text != "")
@@ -426,7 +438,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
}
if (!string.IsNullOrEmpty(weldJointId))
{
- if (string.IsNullOrEmpty(Request.Params["Type"])) //非插入焊口
+ if (isUpdatingExistingJoint) // 非插入焊口
{
joint.WeldJointId = weldJointId;
BLL.WeldJointService.UpdateWeldJoint(joint);
@@ -878,4 +890,4 @@ namespace FineUIPro.Web.HJGL.WeldingManage
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/WeldJoint&menuId={1}", WeldJointId, BLL.Const.HJGL_JotTwoDesignMenuId)));
}
}
-}
\ No newline at end of file
+}
diff --git a/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldJointEdit.aspx.designer.cs b/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldJointEdit.aspx.designer.cs
index fb4c5f4b..e9c304eb 100644
--- a/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldJointEdit.aspx.designer.cs
+++ b/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldJointEdit.aspx.designer.cs
@@ -149,6 +149,15 @@ namespace FineUIPro.Web.HJGL.WeldingManage
///
protected global::FineUIPro.TextBox txtWeldJointCode;
+ ///
+ /// txtFlowingSection 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.TextBox txtFlowingSection;
+
///
/// drpMaterial1 控件。
///
diff --git a/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldMatMatch.aspx.cs b/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldMatMatch.aspx.cs
index a16c0864..338e2148 100644
--- a/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldMatMatch.aspx.cs
+++ b/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldMatMatch.aspx.cs
@@ -757,7 +757,15 @@ namespace FineUIPro.Web.HJGL.WeldingManage
{
List materialCodes = SplitExportValues(x.MaterialCode);
List materialQuantities = SplitExportValues(x.MaterialQuantity);
- int materialRowCount = Math.Max(materialCodes.Count, materialQuantities.Count);
+ List weldJointCodes = SplitExportValues(x.WeldJointCode);
+ List weldJointDins = SplitExportValues(x.WeldJointDin);
+ int materialRowCount = new[]
+ {
+ materialCodes.Count,
+ materialQuantities.Count,
+ weldJointCodes.Count,
+ weldJointDins.Count
+ }.Max();
if (materialRowCount == 0)
{
materialRowCount = 1;
@@ -773,6 +781,8 @@ namespace FineUIPro.Web.HJGL.WeldingManage
已焊口数 = x.WeldedWeldJointCount,
未焊口数 = x.UnweldedWeldJointCount,
未焊达因量 = x.UnweldedDin ?? 0,
+ 焊口号 = index < weldJointCodes.Count ? weldJointCodes[index] : string.Empty,
+ 焊口达因 = index < weldJointDins.Count ? weldJointDins[index] : string.Empty,
材料编码 = index < materialCodes.Count ? materialCodes[index] : string.Empty,
数量 = index < materialQuantities.Count ? materialQuantities[index] : string.Empty,
组件匹配率 = x.ComponentMatchRateString,
@@ -814,7 +824,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
{
return string.IsNullOrEmpty(values)
? new List()
- : values.Split(new[] { "\r\n", "\n" }, StringSplitOptions.RemoveEmptyEntries)
+ : values.Split(new[] { "\r\n", "\n" }, StringSplitOptions.None)
.Select(x => x.Trim())
.ToList();
}
diff --git a/SGGL/Model/CLGL/Tw_InOutDetailOutput.cs b/SGGL/Model/CLGL/Tw_InOutDetailOutput.cs
index 838cefec..3d1c788e 100644
--- a/SGGL/Model/CLGL/Tw_InOutDetailOutput.cs
+++ b/SGGL/Model/CLGL/Tw_InOutDetailOutput.cs
@@ -27,7 +27,15 @@ namespace Model
///
/// 材料描述
///
- public string MaterialDef { get; set; }
+ public string MaterialDef { get; set; }
+ ///
+ /// 材料单位
+ ///
+ public string MaterialUnit { get; set; }
+ ///
+ /// 已生成条码数量
+ ///
+ public int BarCodeCount { get; set; }
public string InputMasterId { get; set; }
public string OutputMasterId { get; set; }
public string CusBillCode { get; set; }
diff --git a/SGGL/Model/CLGL/Tw_InputDetailBarCodeOutput.cs b/SGGL/Model/CLGL/Tw_InputDetailBarCodeOutput.cs
index b429880d..6f2ff714 100644
--- a/SGGL/Model/CLGL/Tw_InputDetailBarCodeOutput.cs
+++ b/SGGL/Model/CLGL/Tw_InputDetailBarCodeOutput.cs
@@ -15,5 +15,6 @@ namespace Model
public string MaterialSpec { get; set; }
public string MaterialUnit { get; set; }
public string BarCode { get; set; }
+ public decimal? Quantity { get; set; }
}
}
diff --git a/SGGL/Model/CLGL/Tw_PipeMatMatchOutput.cs b/SGGL/Model/CLGL/Tw_PipeMatMatchOutput.cs
index e7905f0b..cedf8495 100644
--- a/SGGL/Model/CLGL/Tw_PipeMatMatchOutput.cs
+++ b/SGGL/Model/CLGL/Tw_PipeMatMatchOutput.cs
@@ -68,6 +68,10 @@ namespace Model
public int UnweldedWeldJointCount { get; set; }
/// 未焊焊口的达因量。
public decimal? UnweldedDin { get; set; }
+ /// 组件材料对应的焊口号,多个焊口使用换行分隔。
+ public string WeldJointCode { get; set; }
+ /// 与焊口号按顺序对应的焊口达因,多个焊口使用换行分隔。
+ public string WeldJointDin { get; set; }
/// 组件材料编码,多个编码使用换行分隔。
public string MaterialCode { get; set; }
/// 与材料编码按顺序对应的组件材料数量。
diff --git a/SGGL/Model/HJGL/MaterialCodeLibBarCodeOutput.cs b/SGGL/Model/HJGL/MaterialCodeLibBarCodeOutput.cs
index f03c5adc..65ccb31f 100644
--- a/SGGL/Model/HJGL/MaterialCodeLibBarCodeOutput.cs
+++ b/SGGL/Model/HJGL/MaterialCodeLibBarCodeOutput.cs
@@ -10,5 +10,7 @@ namespace Model
public string MaterialDef { get; set; }
public string MaterialSpec { get; set; }
public string MaterialUnit { get; set; }
+ public string BarCode { get; set; }
+ public decimal? Quantity { get; set; }
}
}
diff --git a/SGGL/Model/Model.cs b/SGGL/Model/Model.cs
index 416ab46a..ac9f1a10 100644
--- a/SGGL/Model/Model.cs
+++ b/SGGL/Model/Model.cs
@@ -280322,6 +280322,8 @@ namespace Model
private string _MaterialCode;
private string _BarCode;
+
+ private System.Nullable _Quantity;
#region 可扩展性方法定义
partial void OnLoaded();
@@ -280337,6 +280339,8 @@ namespace Model
partial void OnMaterialCodeChanged();
partial void OnBarCodeChanging(string value);
partial void OnBarCodeChanged();
+ partial void OnQuantityChanging(System.Nullable value);
+ partial void OnQuantityChanged();
#endregion
public Tw_InputDetailBarCode()
@@ -280443,6 +280447,26 @@ namespace Model
}
}
}
+
+ [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Quantity", DbType="Decimal(18,4)")]
+ public System.Nullable Quantity
+ {
+ get
+ {
+ return this._Quantity;
+ }
+ set
+ {
+ if ((this._Quantity != value))
+ {
+ this.OnQuantityChanging(value);
+ this.SendPropertyChanging();
+ this._Quantity = value;
+ this.SendPropertyChanged("Quantity");
+ this.OnQuantityChanged();
+ }
+ }
+ }
public event PropertyChangingEventHandler PropertyChanging;
diff --git a/SGGL/WebAPI/Controllers/BaseInfoController.cs b/SGGL/WebAPI/Controllers/BaseInfoController.cs
index 435289f4..7de135d2 100644
--- a/SGGL/WebAPI/Controllers/BaseInfoController.cs
+++ b/SGGL/WebAPI/Controllers/BaseInfoController.cs
@@ -190,7 +190,7 @@ namespace WebAPI.Controllers
}
///
- /// 根据材料主编码获取材料信息
+ /// 根据入库条码获取材料信息
///
///
///
@@ -210,6 +210,65 @@ namespace WebAPI.Controllers
return responeData;
}
+ ///
+ /// 根据入库条码保存数量
+ ///
+ [HttpPost]
+ public Model.ResponeData SaveMaterialInfoByBarCode(string barCode, decimal quantity)
+ {
+ var responeData = new Model.ResponeData();
+ try
+ {
+ responeData.data = BLL.MaterialCodeLibService.SaveBarCodeQuantity(barCode, quantity);
+ }
+ catch (Exception ex)
+ {
+ responeData.code = 0;
+ responeData.message = ex.Message;
+ }
+ return responeData;
+ }
+
+ ///
+ /// 获取焊接方法
+ ///
+ ///
+ public Model.ResponeData GetWeldingMethod()
+ {
+ var responeData = new Model.ResponeData();
+ try
+ {
+ responeData.data = BLL.APIBaseInfoService.GetWeldingMethod();
+ }
+ catch (Exception ex)
+ {
+ responeData.code = 0;
+ responeData.message = ex.Message;
+ }
+
+ return responeData;
+ }
+
+ ///
+ /// 获取焊缝类型
+ ///
+ ///
+ public Model.ResponeData GetWeldType()
+ {
+ var responeData = new Model.ResponeData();
+ try
+ {
+ responeData.data = BLL.APIBaseInfoService.GetWeldType();
+ }
+ catch (Exception ex)
+ {
+ responeData.code = 0;
+ responeData.message = ex.Message;
+ }
+
+ return responeData;
+ }
+
///
/// 获取探伤类型
///