Fix无损检测委托号前缀并统一录入明细显示
This commit is contained in:
parent
a694ab1183
commit
4a7dec7a03
|
|
@ -434,7 +434,7 @@ namespace BLL
|
||||||
Model.HJGL_Batch_BatchTrust newBatchTrust = new Model.HJGL_Batch_BatchTrust
|
Model.HJGL_Batch_BatchTrust newBatchTrust = new Model.HJGL_Batch_BatchTrust
|
||||||
{
|
{
|
||||||
TrustBatchId = trustBatchId,
|
TrustBatchId = trustBatchId,
|
||||||
TrustBatchCode = batch.PointBatchCode.Replace("-DK-", "-WT-"),
|
TrustBatchCode = BLL.Batch_BatchTrustService.BuildTrustBatchCode(batch.PointBatchCode, DateTime.Now),
|
||||||
TrustDate = DateTime.Now,
|
TrustDate = DateTime.Now,
|
||||||
ProjectId = batch.ProjectId,
|
ProjectId = batch.ProjectId,
|
||||||
PointBatchId = pointBatchId,
|
PointBatchId = pointBatchId,
|
||||||
|
|
@ -534,7 +534,7 @@ namespace BLL
|
||||||
var rate = BLL.Base_DetectionRateService.GetDetectionRateByDetectionRateId(trust.DetectionRateId);
|
var rate = BLL.Base_DetectionRateService.GetDetectionRateByDetectionRateId(trust.DetectionRateId);
|
||||||
|
|
||||||
string perfix = string.Empty;
|
string perfix = string.Empty;
|
||||||
perfix = unit.UnitCode + "-" + ndt.DetectionTypeCode + "-" + rate.DetectionRateValue.ToString() + "%-";
|
perfix = BLL.Batch_BatchTrustService.BuildTrustBatchCodePrefix(unit.UnitCode, ndt.DetectionTypeCode, rate.DetectionRateValue.ToString(), DateTime.Now);
|
||||||
string trustBatchId = SQLHelper.GetNewID(typeof(Model.HJGL_Batch_BatchTrust));
|
string trustBatchId = SQLHelper.GetNewID(typeof(Model.HJGL_Batch_BatchTrust));
|
||||||
|
|
||||||
// 生成委托条件对比
|
// 生成委托条件对比
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,47 @@ namespace BLL
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static class Batch_BatchTrustService
|
public static class Batch_BatchTrustService
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 根据点口批编号生成委托单号,在流水号前追加日期段。
|
||||||
|
/// </summary>
|
||||||
|
public static string BuildTrustBatchCode(string pointBatchCode, System.DateTime trustDate)
|
||||||
|
{
|
||||||
|
string trustBatchCode = (pointBatchCode ?? string.Empty).Replace("-DK-", "-WT-");
|
||||||
|
return InsertDateBeforeSerial(trustBatchCode, trustDate);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 生成委托单号前缀,在流水号前追加日期段。
|
||||||
|
/// </summary>
|
||||||
|
public static string BuildTrustBatchCodePrefix(string unitCode, string detectionTypeCode, string detectionRateValue, System.DateTime trustDate)
|
||||||
|
{
|
||||||
|
return unitCode + "-" + detectionTypeCode + "-" + detectionRateValue + "%-" + trustDate.ToString("yyyyMMdd") + "-";
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string InsertDateBeforeSerial(string code, System.DateTime date)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(code))
|
||||||
|
{
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
string dateText = date.ToString("yyyyMMdd");
|
||||||
|
int lastIndex = code.LastIndexOf('-');
|
||||||
|
if (lastIndex < 0)
|
||||||
|
{
|
||||||
|
return code + "-" + dateText;
|
||||||
|
}
|
||||||
|
|
||||||
|
string prefix = code.Substring(0, lastIndex);
|
||||||
|
string serial = code.Substring(lastIndex + 1);
|
||||||
|
if (prefix.EndsWith("-" + dateText, System.StringComparison.Ordinal))
|
||||||
|
{
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
return prefix + "-" + dateText + "-" + serial;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 根据主键获取无损委托
|
/// 根据主键获取无损委托
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
|
|
@ -130,6 +130,8 @@
|
||||||
AllowPaging="true" IsDatabasePaging="true" PageSize="10" OnPageIndexChange="Grid1_PageIndexChange"
|
AllowPaging="true" IsDatabasePaging="true" PageSize="10" OnPageIndexChange="Grid1_PageIndexChange"
|
||||||
EnableTextSelection="True">
|
EnableTextSelection="True">
|
||||||
<Columns>
|
<Columns>
|
||||||
|
<f:CheckBoxField ColumnID="ckbIsSelected" Width="50px" RenderAsStaticField="true"
|
||||||
|
HeaderText="选择" HeaderTextAlign="Center" />
|
||||||
<f:RowNumberField EnablePagingNumber="true" HeaderText="序号"
|
<f:RowNumberField EnablePagingNumber="true" HeaderText="序号"
|
||||||
Width="50px" HeaderTextAlign="Center" TextAlign="Center" />
|
Width="50px" HeaderTextAlign="Center" TextAlign="Center" />
|
||||||
<f:RenderField HeaderText="管线号" ColumnID="PipelineCode"
|
<f:RenderField HeaderText="管线号" ColumnID="PipelineCode"
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Data.SqlClient;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace FineUIPro.Web.HJGL.NDT
|
namespace FineUIPro.Web.HJGL.NDT
|
||||||
|
|
@ -312,26 +311,18 @@ namespace FineUIPro.Web.HJGL.NDT
|
||||||
foreach (var trust in trusts)
|
foreach (var trust in trusts)
|
||||||
{
|
{
|
||||||
TreeNode newNode = new TreeNode();
|
TreeNode newNode = new TreeNode();
|
||||||
string code = string.Empty;
|
string code = trust.TrustBatchCode;
|
||||||
if (trust.TrustType == "R")
|
|
||||||
{
|
|
||||||
code = "FXWT-" + trust.TrustBatchCode.Substring(trust.TrustBatchCode.Length - 4);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
code = "WT-" + trust.TrustBatchCode.Substring(trust.TrustBatchCode.Length - 4);
|
|
||||||
}
|
|
||||||
// 未检测委托红色显示
|
// 未检测委托红色显示
|
||||||
if (BLL.Batch_NDEService.GetNDEViewByTrustBatchId(trust.TrustBatchId) == null)
|
if (BLL.Batch_NDEService.GetNDEViewByTrustBatchId(trust.TrustBatchId) == null)
|
||||||
{
|
{
|
||||||
Model.HJGL_Batch_PointBatch batch = BLL.PointBatchService.GetPointBatchById(trust.PointBatchId);
|
Model.HJGL_Batch_PointBatch batch = BLL.PointBatchService.GetPointBatchById(trust.PointBatchId);
|
||||||
if (batch != null && batch.IsClosed == true)
|
if (batch != null && batch.IsClosed == true)
|
||||||
{
|
{
|
||||||
newNode.Text = code + "【" + BLL.UnitService.GetUnitNameByUnitId(trust.UnitId) + "】";
|
newNode.Text = code;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
newNode.Text = "<font color='#EE0000'>" + code + "【" + BLL.UnitService.GetUnitNameByUnitId(trust.UnitId) + "】" + "</font>";
|
newNode.Text = "<font color='#EE0000'>" + code + "</font>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -425,44 +416,65 @@ namespace FineUIPro.Web.HJGL.NDT
|
||||||
{
|
{
|
||||||
this.SetTextTemp();
|
this.SetTextTemp();
|
||||||
this.PageInfoLoad(); ///页面输入提交信息
|
this.PageInfoLoad(); ///页面输入提交信息
|
||||||
var check = Funs.DB.View_Batch_NDE.FirstOrDefault(x => x.TrustBatchId == this.TrustBatchId);
|
List<Model.View_Batch_NDEItem> ndeItems = this.GetDisplayNDEItems();
|
||||||
if (check != null)
|
this.BindGrid(ndeItems);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取检测单录入展示明细,保持与编辑界面一致。
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
private List<Model.View_Batch_NDEItem> GetDisplayNDEItems()
|
||||||
|
{
|
||||||
|
List<Model.View_Batch_NDEItem> ndeItems = new List<Model.View_Batch_NDEItem>();
|
||||||
|
var batchTrustItems = BLL.Batch_BatchTrustItemService.GetViewBatchTrustItem(this.TrustBatchId);
|
||||||
|
var check = Funs.DB.View_Batch_NDE.FirstOrDefault(x => x.TrustBatchId == this.TrustBatchId);
|
||||||
|
if (check != null)
|
||||||
|
{
|
||||||
|
ndeItems = BLL.Batch_NDEItemService.GetViewNDEItem(check.NDEID);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<string> trustBatchItemIds = ndeItems.Select(x => x.TrustBatchItemId).ToList();
|
||||||
|
foreach (var batchTrustItem in batchTrustItems)
|
||||||
|
{
|
||||||
|
if (!trustBatchItemIds.Contains(batchTrustItem.TrustBatchItemId))
|
||||||
{
|
{
|
||||||
string strSql = @"SELECT * FROM dbo.View_Batch_NDEItem d WHERE NDEID=@NDEID ";
|
Model.View_Batch_NDEItem item = new Model.View_Batch_NDEItem();
|
||||||
List<SqlParameter> listStr = new List<SqlParameter>
|
item.NDEItemID = BLL.SQLHelper.GetNewID(typeof(Model.HJGL_Batch_NDEItem));
|
||||||
{
|
item.PipelineCode = batchTrustItem.PipelineCode;
|
||||||
|
item.WeldJointCode = batchTrustItem.WeldJointCode;
|
||||||
};
|
item.UnitWorkCode = batchTrustItem.UnitWorkCode;
|
||||||
listStr.Add(new SqlParameter("@NDEID", check.NDEID));
|
item.WelderCode = batchTrustItem.WelderCode;
|
||||||
SqlParameter[] parameter = listStr.ToArray();
|
item.NDEReportNo = batchTrustItem.TrustBatchCode;
|
||||||
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
item.TrustBatchItemId = batchTrustItem.TrustBatchItemId;
|
||||||
|
ndeItems.Add(item);
|
||||||
// 2.获取当前分页数据
|
|
||||||
//var table = this.GetPagedDataTable(Grid1, tb1);
|
|
||||||
Grid1.RecordCount = tb.Rows.Count;
|
|
||||||
tb = GetFilteredTable(Grid1.FilteredData, tb);
|
|
||||||
var table = this.GetPagedDataTable(Grid1, tb);
|
|
||||||
Grid1.DataSource = table;
|
|
||||||
Grid1.DataBind();
|
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
|
|
||||||
|
return ndeItems;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 绑定检测单录入展示明细。
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ndeItems"></param>
|
||||||
|
private void BindGrid(List<Model.View_Batch_NDEItem> ndeItems)
|
||||||
|
{
|
||||||
|
DataTable tb = this.LINQToDataTable(ndeItems);
|
||||||
|
Grid1.RecordCount = tb.Rows.Count;
|
||||||
|
tb = GetFilteredTable(Grid1.FilteredData, tb);
|
||||||
|
var table = this.GetPagedDataTable(Grid1, tb);
|
||||||
|
Grid1.DataSource = table;
|
||||||
|
Grid1.DataBind();
|
||||||
|
|
||||||
|
CheckBoxField ckbIsSelected = (CheckBoxField)Grid1.FindColumn("ckbIsSelected");
|
||||||
|
for (int i = 0; i < this.Grid1.Rows.Count; i++)
|
||||||
|
{
|
||||||
|
string ndeItemId = Grid1.DataKeys[i][1] == null ? string.Empty : Grid1.DataKeys[i][1].ToString();
|
||||||
|
if (BLL.Batch_NDEItemService.GetNDEItemById(ndeItemId) != null)
|
||||||
{
|
{
|
||||||
string strSql = @"SELECT * FROM dbo.View_Batch_BatchTrustItem d WHERE TrustBatchId=@TrustBatchId ";
|
ckbIsSelected.SetCheckedState(i, true);
|
||||||
List<SqlParameter> listStr = new List<SqlParameter>
|
|
||||||
{
|
|
||||||
|
|
||||||
};
|
|
||||||
listStr.Add(new SqlParameter("@TrustBatchId", this.TrustBatchId));
|
|
||||||
SqlParameter[] parameter = listStr.ToArray();
|
|
||||||
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
|
||||||
|
|
||||||
// 2.获取当前分页数据
|
|
||||||
//var table = this.GetPagedDataTable(Grid1, tb1);
|
|
||||||
Grid1.RecordCount = tb.Rows.Count;
|
|
||||||
tb = GetFilteredTable(Grid1.FilteredData, tb);
|
|
||||||
var table = this.GetPagedDataTable(Grid1, tb);
|
|
||||||
Grid1.DataSource = table;
|
|
||||||
Grid1.DataBind();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -972,12 +984,22 @@ namespace FineUIPro.Web.HJGL.NDT
|
||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
protected void Grid1_RowCommand(object sender, GridCommandEventArgs e)
|
protected void Grid1_RowCommand(object sender, GridCommandEventArgs e)
|
||||||
{
|
{
|
||||||
string id = Grid1.DataKeys[e.RowIndex][0].ToString();
|
string id = Grid1.DataKeys[e.RowIndex][1] == null ? string.Empty : Grid1.DataKeys[e.RowIndex][1].ToString();
|
||||||
if (e.CommandName == "CancelAudit")
|
if (e.CommandName == "CancelAudit")
|
||||||
{
|
{
|
||||||
if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.PersonId, Const.HJGL_NDTBatchMenuId, Const.BtnCancelAuditing))
|
if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.PersonId, Const.HJGL_NDTBatchMenuId, Const.BtnCancelAuditing))
|
||||||
{
|
{
|
||||||
|
if (string.IsNullOrEmpty(id))
|
||||||
|
{
|
||||||
|
ShowNotify("请选择已录入的检测项!", MessageBoxIcon.Warning);
|
||||||
|
return;
|
||||||
|
}
|
||||||
Model.HJGL_Batch_NDEItem item = BLL.Batch_NDEItemService.GetNDEItemById(id);
|
Model.HJGL_Batch_NDEItem item = BLL.Batch_NDEItemService.GetNDEItemById(id);
|
||||||
|
if (item == null)
|
||||||
|
{
|
||||||
|
ShowNotify("请选择已录入的检测项!", MessageBoxIcon.Warning);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (item.SubmitDate == null)
|
if (item.SubmitDate == null)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
@ -1047,4 +1069,4 @@ namespace FineUIPro.Web.HJGL.NDT
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -169,7 +169,7 @@ namespace FineUIPro.Web.HJGL.PointTrust
|
||||||
var rate = BLL.Base_DetectionRateService.GetDetectionRateByDetectionRateId(batch.DetectionRateId);
|
var rate = BLL.Base_DetectionRateService.GetDetectionRateByDetectionRateId(batch.DetectionRateId);
|
||||||
|
|
||||||
string perfix = string.Empty;
|
string perfix = string.Empty;
|
||||||
perfix = unit.UnitCode + "-" + ndt.DetectionTypeCode + "-" + rate.DetectionRateValue.ToString() + "%-";
|
perfix = BLL.Batch_BatchTrustService.BuildTrustBatchCodePrefix(unit.UnitCode, ndt.DetectionTypeCode, rate.DetectionRateValue.ToString(), DateTime.Now);
|
||||||
newBatchTrust.TrustBatchCode = BLL.SQLHelper.RunProcNewId("SpGetNewCode5ByProjectId", "dbo.HJGL_Batch_BatchTrust", "TrustBatchCode", project.ProjectId, perfix);
|
newBatchTrust.TrustBatchCode = BLL.SQLHelper.RunProcNewId("SpGetNewCode5ByProjectId", "dbo.HJGL_Batch_BatchTrust", "TrustBatchCode", project.ProjectId, perfix);
|
||||||
|
|
||||||
string trustBatchId = SQLHelper.GetNewID(typeof(Model.HJGL_Batch_BatchTrust));
|
string trustBatchId = SQLHelper.GetNewID(typeof(Model.HJGL_Batch_BatchTrust));
|
||||||
|
|
@ -239,4 +239,4 @@ namespace FineUIPro.Web.HJGL.PointTrust
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ namespace FineUIPro.Web.HJGL.PointTrust
|
||||||
var unitWork = BLL.UnitWorkService.GetUnitWorkByUnitWorkId(batch.UnitWorkId);
|
var unitWork = BLL.UnitWorkService.GetUnitWorkByUnitWorkId(batch.UnitWorkId);
|
||||||
var ndt = BLL.Base_DetectionTypeService.GetDetectionTypeByDetectionTypeId(batch.DetectionTypeId);
|
var ndt = BLL.Base_DetectionTypeService.GetDetectionTypeByDetectionTypeId(batch.DetectionTypeId);
|
||||||
var rate = BLL.Base_DetectionRateService.GetDetectionRateByDetectionRateId(batch.DetectionRateId);
|
var rate = BLL.Base_DetectionRateService.GetDetectionRateByDetectionRateId(batch.DetectionRateId);
|
||||||
this.txtTrustBatchCode.Text = batch.PointBatchCode.Replace("-DK-", "-WT-");
|
this.txtTrustBatchCode.Text = BLL.Batch_BatchTrustService.BuildTrustBatchCode(batch.PointBatchCode, DateTime.Now);
|
||||||
if (unit != null)
|
if (unit != null)
|
||||||
{
|
{
|
||||||
this.txtUnit.Text = unit.UnitName;
|
this.txtUnit.Text = unit.UnitName;
|
||||||
|
|
@ -240,4 +240,4 @@ namespace FineUIPro.Web.HJGL.PointTrust
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue