2023-01-02 焊接日报修改

This commit is contained in:
李鹏飞 2023-01-02 12:21:10 +08:00
parent e9196b94ce
commit dc31914fe7
5 changed files with 170 additions and 93 deletions

View File

@ -88,6 +88,11 @@
<Items>
<f:TextBox ID="txtPipelineCode" runat="server" Label="管线号" EmptyText="输入查询条件" LabelAlign="Right" AutoPostBack="true" OnTextChanged="txtTextBox_TextChanged"></f:TextBox>
<f:TextBox ID="txtWelderCode" runat="server" Label="焊工号" EmptyText="输入查询条件" LabelAlign="Right" AutoPostBack="true" OnTextChanged="txtTextBox_TextChanged"></f:TextBox>
<f:ToolbarFill ID="ToolbarFill1" runat="server">
</f:ToolbarFill>
<f:Button ID="btnOut" OnClick="btnOut_Click" runat="server" ToolTip="导出" Text="导出" Icon="FolderUp"
EnableAjax="false" DisableControlBeforePostBack="false">
</f:Button>
</Items>
</f:Toolbar>
</Toolbars>

View File

@ -493,5 +493,18 @@ namespace FineUIPro.Web.HJGL.WeldingManage
BindGrid();
}
#endregion
protected void btnOut_Click(object sender, EventArgs e)
{
Response.ClearContent();
string filename = txtWeldingDate.Text;
Response.AddHeader("content-disposition", "attachment; filename=" + System.Web.HttpUtility.UrlEncode("焊接日报" + filename, System.Text.Encoding.UTF8) + ".xls");
Response.ContentType = "application/excel";
Response.ContentEncoding = System.Text.Encoding.UTF8;
//this.Grid1.PageSize = this.;
BindGrid();
Response.Write(GetGridTableHtml(Grid1));
Response.End();
}
}
}

View File

@ -7,10 +7,12 @@
// </自动生成>
//------------------------------------------------------------------------------
namespace FineUIPro.Web.HJGL.WeldingManage {
namespace FineUIPro.Web.HJGL.WeldingManage
{
public partial class WeldReport {
public partial class WeldReport
{
/// <summary>
/// form1 控件。
@ -192,6 +194,24 @@ namespace FineUIPro.Web.HJGL.WeldingManage {
/// </remarks>
protected global::FineUIPro.TextBox txtWelderCode;
/// <summary>
/// ToolbarFill1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.ToolbarFill ToolbarFill1;
/// <summary>
/// btnOut 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnOut;
/// <summary>
/// ToolbarSeparator1 控件。
/// </summary>

View File

@ -90,9 +90,9 @@
<Items>
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" Title="焊接日报"
EnableCollapse="true" runat="server" BoxFlex="1" DataKeyNames="WeldTaskId,WeldJointId" EnableColumnLines="true" ForceFit="true"
AllowCellEditing="true" ClicksToEdit="1" DataIDField="WeldTaskId" AllowSorting="true" KeepCurrentSelection="true"
SortField="WeldJointNum" SortDirection="ASC" OnSort="Grid1_Sort" EnableCheckBoxSelect="true"
AllowPaging="false" IsDatabasePaging="true" PageSize="10000" EnableTextSelection="True">
AllowCellEditing="true" ClicksToEdit="1" DataIDField="WeldTaskId" AllowSorting="true" KeepCurrentSelection="true" AllowColumnLocking="true"
SortField="WeldJointNum" SortDirection="ASC" OnSort="Grid1_Sort" EnableCheckBoxSelect="true" CheckBoxSelectOnly="true"
AllowPaging="false" IsDatabasePaging="true" PageSize="10000" EnableTextSelection="True" DisableUnselectableRows="true">
<Columns>
<f:RenderField HeaderText="焊口序号" ColumnID="WeldJointNum"

View File

@ -193,7 +193,7 @@ namespace FineUIPro.Web.WeldingProcess.WeldingManage
/// </summary>
private void BindGrid(List<Model.SpWeldingDailyItem> weldingDailyItem)
{
var aw = this.Grid1.SelectedRowIDArray;
DataTable dt = null;
var list = from x in Funs.DB.View_HJGL_WeldingTask where x.ProjectId == this.CurrUser.LoginProjectId select x;
if (weldingDailyItem != null)
@ -247,26 +247,32 @@ namespace FineUIPro.Web.WeldingProcess.WeldingManage
Grid1.DataSource = table;
Grid1.DataBind();
//for (int i = 0; i < this.Grid1.Rows.Count; i++)
//{
// var hotProesssItem = Funs.DB.HJGL_HotProess_TrustItem.FirstOrDefault(x => x.WeldJointId == this.Grid1.Rows[i].DataKeys[1].ToString());
// if (hotProesssItem != null) //已生成热处理委托,不能编辑或删除
// {
// // Grid1.Rows[i].RowSelectable = false;
// }
// var pointBatchItem = Funs.DB.HJGL_Batch_PointBatchItem.FirstOrDefault(x => x.WeldJointId == this.Grid1.Rows[i].DataKeys[1].ToString() && x.PointState != null);
// if (pointBatchItem != null) //已生成委托,不能编辑或删除
// {
// // Grid1.Rows[i].RowSelectable = false;
// }
//}
if (weldingDailyItem != null)
{
var task = from x in Funs.DB.View_HJGL_WeldingTask
var task = (from x in Funs.DB.View_HJGL_WeldingTask
where x.WeldingDailyId == this.WeldingDailyId
select x;
select x).ToList();
if (!string.IsNullOrEmpty(this.txtPipelineCode.Text.Trim()))
{
task = task.Where(x => x.PipelineCode.Contains(this.txtPipelineCode.Text.Trim())).ToList();
}
var weldTaskIds = task.Select(x => x.WeldTaskId).ToArray();
this.Grid1.SelectedRowIDArray = weldTaskIds;
}
for (int i = 0; i < this.Grid1.Rows.Count; i++)
{
var hotProesssItem = Funs.DB.HJGL_HotProess_TrustItem.FirstOrDefault(x => x.WeldJointId == this.Grid1.Rows[i].DataKeys[1].ToString());
if (hotProesssItem != null) //已生成热处理委托,不能编辑或删除
{
Grid1.Rows[i].RowSelectable = false;
}
var pointBatchItem = Funs.DB.HJGL_Batch_PointBatchItem.FirstOrDefault(x => x.WeldJointId == this.Grid1.Rows[i].DataKeys[1].ToString() && x.PointState != null);
if (pointBatchItem != null) //已生成委托,不能编辑或删除
{
Grid1.Rows[i].RowSelectable = false;
}
var a = this.Grid1.SelectedRowIDArray;
}
}
#endregion
@ -456,6 +462,47 @@ namespace FineUIPro.Web.WeldingProcess.WeldingManage
BLL.WeldingDailyService.AddWeldingDaily(newWeldingDaily);
//BLL.Sys_LogService.AddLog(BLL.Const.System_6, this.CurrUser.LoginProjectId, this.CurrUser.PersonId, Const.HJGL_WeldReportMenuId, Const.BtnAdd, this.WeldingDailyId);
}
foreach (JObject mergedRow in Grid1.GetMergedData())
{
JObject values = mergedRow.Value<JObject>("values");
int i = mergedRow.Value<int>("index");
string rowId = Grid1.Rows[i].RowID;
if (this.Grid1.SelectedRowIDArray.Contains(rowId))
{
var t = BLL.WeldTaskService.GetWeldTaskById(rowId);
var newWeldJoint = BLL.WeldJointService.GetWeldJointByWeldJointId(t.WeldJointId);
if (newWeldJoint != null)
{
var coverWelderCode = (from x in Funs.DB.SitePerson_Person
where x.ProjectId == CurrUser.LoginProjectId && x.WelderCode == values.Value<string>("CoverWelderCode")
select x).FirstOrDefault();
if (coverWelderCode != null)
{
t.CoverWelderId = coverWelderCode.PersonId;
newWeldJoint.CoverWelderId = coverWelderCode.PersonId;
}
var backingWelderCode = (from x in Funs.DB.SitePerson_Person
where x.ProjectId == CurrUser.LoginProjectId && x.WelderCode == values.Value<string>("BackingWelderCode")
select x).FirstOrDefault();
if (backingWelderCode != null)
{
t.BackingWelderId = backingWelderCode.PersonId;
newWeldJoint.BackingWelderId = backingWelderCode.PersonId;
}
WeldTaskService.UpdateWeldTask(t);
WeldJointService.UpdateWeldJoint(newWeldJoint);
//if (!string.IsNullOrEmpty(values.Value<string>("JointAttribute").ToString()))
//{
// newWeldJoint.JointAttribute = values.Value<string>("JointAttribute").ToString();
//}
//BLL.WeldJointService.UpdateWeldJoint(newWeldJoint);
BLL.WeldJointService.UpdateWeldJointAddG(newWeldJoint.WeldJointId, newWeldJoint.JointAttribute, Const.BtnAdd);
}
}
}
// 获取组批条件
var batchC = BLL.Project_SysSetService.GetSysSetBySetId("5", CurrUser.LoginProjectId);
@ -573,47 +620,6 @@ namespace FineUIPro.Web.WeldingProcess.WeldingManage
#endregion
//更新焊口属性
foreach (JObject mergedRow in Grid1.GetMergedData())
{
JObject values = mergedRow.Value<JObject>("values");
int i = mergedRow.Value<int>("index");
string rowId = Grid1.Rows[i].RowID;
if (this.Grid1.SelectedRowIDArray.Contains(rowId))
{
var t = BLL.WeldTaskService.GetWeldTaskById(rowId);
var newWeldJoint = BLL.WeldJointService.GetWeldJointByWeldJointId(t.WeldJointId);
if (newWeldJoint != null)
{
var coverWelderCode = (from x in Funs.DB.SitePerson_Person
where x.ProjectId == CurrUser.LoginProjectId && x.WelderCode == values.Value<string>("CoverWelderCode")
select x).FirstOrDefault();
if (coverWelderCode != null)
{
t.CoverWelderId = coverWelderCode.PersonId;
newWeldJoint.CoverWelderId = coverWelderCode.PersonId;
}
var backingWelderCode = (from x in Funs.DB.SitePerson_Person
where x.ProjectId == CurrUser.LoginProjectId && x.WelderCode == values.Value<string>("BackingWelderCode")
select x).FirstOrDefault();
if (backingWelderCode != null)
{
t.BackingWelderId = backingWelderCode.PersonId;
newWeldJoint.BackingWelderId = backingWelderCode.PersonId;
}
WeldTaskService.UpdateWeldTask(t);
WeldJointService.UpdateWeldJoint(newWeldJoint);
//if (!string.IsNullOrEmpty(values.Value<string>("JointAttribute").ToString()))
//{
// newWeldJoint.JointAttribute = values.Value<string>("JointAttribute").ToString();
//}
//BLL.WeldJointService.UpdateWeldJoint(newWeldJoint);
BLL.WeldJointService.UpdateWeldJointAddG(newWeldJoint.WeldJointId, newWeldJoint.JointAttribute, Const.BtnAdd);
}
}
}
if (string.IsNullOrEmpty(errlog))
{
ShowNotify("保存成功!", MessageBoxIcon.Success);
@ -1240,5 +1246,38 @@ namespace FineUIPro.Web.WeldingProcess.WeldingManage
}
}
protected void Grid1_RowDataBound(object sender, GridRowEventArgs e)
{
DataRowView row = e.DataItem as DataRowView;
var id= row["WeldJointId"].ToString();
var hotProesssItem = Funs.DB.HJGL_HotProess_TrustItem.FirstOrDefault(x => x.WeldJointId == id);
if (hotProesssItem != null) //已生成热处理委托,不能编辑或删除
{
e.RowSelectable = false;
// Grid1.DeleteRow(e.RowID);
// Grid1.DeleteRow(e.RowID);
}
var pointBatchItem = Funs.DB.HJGL_Batch_PointBatchItem.FirstOrDefault(x => x.WeldJointId == id && x.PointState != null);
if (pointBatchItem != null) //已生成委托,不能编辑或删除
{
e.RowSelectable = false;
// Grid1.DeleteRow(e.RowID);
// Grid1.DeleteRow(e.RowID);
}
//for (int i = 0; i < this.Grid1.Rows.Count; i++)
//{
// var hotProesssItem = Funs.DB.HJGL_HotProess_TrustItem.FirstOrDefault(x => x.WeldJointId == this.Grid1.Rows[i].DataKeys[1].ToString());
// if (hotProesssItem != null) //已生成热处理委托,不能编辑或删除
// {
// Grid1.Rows[i].RowSelectable = false;
// }
// var pointBatchItem = Funs.DB.HJGL_Batch_PointBatchItem.FirstOrDefault(x => x.WeldJointId == this.Grid1.Rows[i].DataKeys[1].ToString() && x.PointState != null);
// if (pointBatchItem != null) //已生成委托,不能编辑或删除
// {
// Grid1.Rows[i].RowSelectable = false;
// }
//}
}
}
}