2023-10-27

This commit is contained in:
2023-10-27 14:02:52 +08:00
parent bc4d37f37f
commit e46a7ad179
9 changed files with 486 additions and 421 deletions
@@ -140,6 +140,7 @@ namespace BLL
var project = BLL.ProjectService.GetProjectByProjectId(pipeline.ProjectId);
var unitWork = BLL.UnitWorkService.GetUnitWorkByUnitWorkId(pipeline.UnitWorkId);
var unit = BLL.UnitService.GetUnitByUnitId(pipeline.UnitId);
var WeldingDaily = BLL.WeldingDailyService.GetPipeline_WeldingDailyByWeldingDailyId(newWeldJoint.WeldingDailyId);
var ndt = BLL.Base_DetectionTypeService.GetDetectionTypeByDetectionTypeId(pipeline.DetectionType);
var ndtr = BLL.Base_DetectionRateService.GetDetectionRateByDetectionRateId(pipeline.DetectionRateId);
@@ -241,7 +242,7 @@ namespace BLL
batch.ProjectId = project.ProjectId;
batch.UnitWorkId = pipeline.UnitWorkId;
batch.BatchCondition = batchCondition;
batch.UnitId = pipeline.UnitId;
batch.UnitId = WeldingDaily.UnitId;
batch.DetectionTypeId = pipeline.DetectionType;
batch.DetectionRateId = pipeline.DetectionRateId;
if (condition.Contains("5"))
@@ -295,6 +295,56 @@ namespace BLL
db.SubmitChanges();
}
}
/// <summary>
/// 日报明细删除
/// </summary>
/// <param name="weldJointId"></param>
/// <returns></returns>
public static string DeleteWeldingDailyItemByweldJointId(string weldJointId)
{
string errlog = string.Empty;
var newWeldJoint = BLL.WeldJointService.GetWeldJointByWeldJointId(weldJointId);
var pipeline = BLL.PipelineService.GetPipelineByPipelineId(newWeldJoint.PipelineId);
if (newWeldJoint != null && !string.IsNullOrEmpty(newWeldJoint.WeldingDailyId))
{
var isTrust = from x in Funs.DB.HJGL_Batch_BatchTrustItem
where x.WeldJointId == weldJointId
select x; ;
if (isTrust.Count() == 0)
{
var updateWeldJoint = BLL.WeldJointService.GetWeldJointByWeldJointId(weldJointId);
if (updateWeldJoint != null)
{
updateWeldJoint.WeldingDailyId = null;
updateWeldJoint.WeldingDailyCode = null;
updateWeldJoint.CoverWelderId = null;
updateWeldJoint.BackingWelderId = null;
BLL.WeldJointService.UpdateWeldJoint(updateWeldJoint);
var pointBatchItems = from x in Funs.DB.HJGL_Batch_PointBatchItem where x.WeldJointId == weldJointId select x;
string pointBatchId = pointBatchItems.FirstOrDefault().PointBatchId;
// 删除焊口所在批明细信息
BLL.PointBatchDetailService.DeleteBatchDetail(weldJointId);
// 删除批信息
var batch = from x in Funs.DB.HJGL_Batch_PointBatchItem where x.PointBatchId == pointBatchId select x;
if (pointBatchId != null && batch.Count() == 0)
{
BLL.PointBatchService.DeleteBatch(pointBatchId);
}
}
}
else
{
errlog += "焊口【" + newWeldJoint.WeldJointCode + "】已进委托单了,不能删除。";
}
}
return errlog;
}
/// <summary>
/// 按类型获取焊接日报项
@@ -71,7 +71,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
if (flag == "2")
{
GroupPanel2.Hidden = false;
IsReadOnly(true);
IsReadOnly(false);
}
else
{
@@ -161,8 +161,14 @@
<f:RenderField HeaderText="焊条" ColumnID="WeldingRodCode" DataField="WeldingRodCode"
FieldType="String" HeaderTextAlign="Center" TextAlign="Center" Width="150px">
</f:RenderField>
<f:RenderField HeaderText="焊口属性" ColumnID="JointAttribute"
DataField="JointAttribute" SortField="JointAttribute" FieldType="String" HeaderTextAlign="Center"
TextAlign="Left" Width="100px">
</f:RenderField>
</Columns>
<Listeners>
<f:Listener Event="beforerowcontextmenu" Handler="onRowContextMenu" />
</Listeners>
<PageItems>
<f:ToolbarSeparator ID="ToolbarSeparator1" runat="server">
</f:ToolbarSeparator>
@@ -203,16 +209,25 @@
runat="server" Text="删除">
</f:MenuButton>
</f:Menu>
<f:Menu ID="Menu2" runat="server">
<f:MenuButton ID="btnMenuDeleteDetail"
EnablePostBack="true" Icon="Delete" ConfirmText="删除选中行?" ConfirmTarget="Top" runat="server" Text="删除" OnClick="btnMenuDeleteDetail_Click">
</f:MenuButton>
</f:Menu>
</form>
<script type="text/javascript">
var menuID = '<%= Menu1.ClientID %>';
var menuID2 = '<%= Menu2.ClientID %>';
// 返回false,来阻止浏览器右键菜单
function onTreeNodeContextMenu(event, rowId) {
F(menuID).show(); //showAt(event.pageX, event.pageY);
return false;
}
function onRowContextMenu(event, rowId) {
F(menuID2).show(); //showAt(event.pageX, event.pageY);
return false;
}
function reloadGrid() {
__doPostBack(null, 'reloadGrid');
}
@@ -1,5 +1,6 @@
using BLL;
using MiniExcelLibs;
using NPOI.SS.Formula.Functions;
using System;
using System.Collections.Generic;
using System.Data;
@@ -123,7 +124,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
foreach (var item in p)
{
TreeNode newNode = new TreeNode();
newNode.Text = item.WeldingDailyCode;
newNode.Text = item.WeldingDailyCode+"("+BLL.UnitService.getUnitNamesUnitIds(item.UnitId)+")";
newNode.NodeID = item.WeldingDailyId;
newNode.EnableClickEvent = true;
newNode.CommandName = "WeldingDaily";
@@ -191,7 +192,8 @@ namespace FineUIPro.Web.HJGL.WeldingManage
string strSql = @"SELECT WeldingDailyId,WeldJointId,PipelineCode,WeldJointCode,
BackingWelderCode,CoverWelderCode,Material1Code,Material2Code,
Dia,DNDia,Thickness,WeldTypeCode,WeldingMethodCode,WeldingWireCode,WeldingMode,
WeldingRodCode,Size
WeldingRodCode,Size,JointAttribute
FROM dbo.View_HJGL_WeldJoint
WHERE WeldingDailyId=@WeldingDailyId";
List<SqlParameter> listStr = new List<SqlParameter>();
@@ -542,5 +544,24 @@ namespace FineUIPro.Web.HJGL.WeldingManage
}
}
protected void btnMenuDeleteDetail_Click(object sender, EventArgs e)
{
if (!string .IsNullOrEmpty(Grid1.SelectedRowID))
{
string errlog= BLL.WeldingDailyService.DeleteWeldingDailyItemByweldJointId(Grid1.SelectedRowID);
if (string.IsNullOrEmpty(errlog) )
{
BindGrid();
ShowNotify("删除明细成功",MessageBoxIcon.Success);
}
else
{
ShowNotify(errlog, MessageBoxIcon.Error);
}
}
}
}
}
@@ -292,5 +292,23 @@ namespace FineUIPro.Web.HJGL.WeldingManage
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.MenuButton btnMenuDelete;
/// <summary>
/// Menu2 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Menu Menu2;
/// <summary>
/// btnMenuDeleteDetail 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.MenuButton btnMenuDeleteDetail;
}
}
@@ -145,7 +145,7 @@
DataField="BackingWelderCode" FieldType="String"
HeaderTextAlign="Center" TextAlign="Left" Width="110px">
</f:RenderField>--%>
<f:RenderField HeaderText="焊口属性" ColumnID="JointAttribute" Hidden="true"
<f:RenderField HeaderText="焊口属性" ColumnID="JointAttribute"
DataField="JointAttribute" SortField="JointAttribute" FieldType="String" HeaderTextAlign="Center"
TextAlign="Left" Width="100px">
</f:RenderField>
@@ -1,5 +1,6 @@
using BLL;
using FineUIPro.Web.HJGL.WeldingManage;
using Microsoft.Office.Interop.Word;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
@@ -195,7 +196,6 @@ namespace FineUIPro.Web.WeldingProcess.WeldingManage
/// </summary>
private void BindGrid(List<Model.SpWeldingDailyItem> weldingDailyItem)
{
var aw = this.Grid1.SelectedRowIDArray;
var task = new List<Model.View_HJGL_WeldingTask>();
var list = from x in Funs.DB.View_HJGL_WeldingTask where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitWorkId == this.UnitWorkId select x;
@@ -203,7 +203,7 @@ namespace FineUIPro.Web.WeldingProcess.WeldingManage
{
var weldJointIds = (from x in list
where (x.TaskDate.Value.Date <= Convert.ToDateTime(txtWeldingDate.Text)
&& x.WeldingDailyId == null /*&& x.CoverWelderId != null && x.BackingWelderId != null*/) || x.WeldingDailyId == this.WeldingDailyId
&& x.WeldingDailyId == null/*|| x.WeldingDailyId == this.WeldingDailyId*/)
select x).ToList();
weldJointIds= weldJointIds.GroupBy(x => x.WeldJointId, (key, group) => group.OrderByDescending(x=>x.TaskDate).First()).ToList();
@@ -253,13 +253,8 @@ namespace FineUIPro.Web.WeldingProcess.WeldingManage
}
//dt = this.LINQToDataTable(task);
}
// 2.获取当前分页数据
//var table = this.GetPagedDataTable(GridNewDynamic, tb1);
// Grid1.RecordCount = dt.Rows.Count;
// tb = GetFilteredTable(Grid1.FilteredData, tb);
//var table = this.GetPagedDataTable(Grid1, dt);
Grid1.RecordCount = task.Count;
// var table = task.Skip(Grid1.PageSize * (Grid1.PageIndex)).Take(Grid1.PageSize).ToList();
Grid1.RecordCount = task.Count;
Grid1.DataSource = task;
Grid1.DataBind();
@@ -276,23 +271,23 @@ namespace FineUIPro.Web.WeldingProcess.WeldingManage
// // Grid1.Rows[i].RowSelectable = false;
// }
//}
if (weldingDailyItem != null)
{
var Dailytask = (from x in Funs.DB.View_HJGL_WeldingTask
where x.WeldingDailyId == this.WeldingDailyId
select new
{
x.PipelineCode,
x.WeldTaskId
}).Distinct().ToList();
if (!string.IsNullOrEmpty(this.txtPipelineCode.Text.Trim()))
{
Dailytask = Dailytask.Where(x => x.PipelineCode.Contains(this.txtPipelineCode.Text.Trim())).ToList();
}
var weldTaskIds = Dailytask.Select(x => x.WeldTaskId).ToArray();
this.Grid1.SelectedRowIDArray = weldTaskIds;
var a = this.Grid1.SelectedRowIDArray;
}
//if (weldingDailyItem != null)
//{
// var Dailytask = (from x in Funs.DB.View_HJGL_WeldingTask
// where x.WeldingDailyId == this.WeldingDailyId
// select new
// {
// x.PipelineCode,
// x.WeldTaskId
// }).Distinct().ToList();
// if (!string.IsNullOrEmpty(this.txtPipelineCode.Text.Trim()))
// {
// Dailytask = Dailytask.Where(x => x.PipelineCode.Contains(this.txtPipelineCode.Text.Trim())).ToList();
// }
// var weldTaskIds = Dailytask.Select(x => x.WeldTaskId).ToArray();
// this.Grid1.SelectedRowIDArray = weldTaskIds;
// var a = this.Grid1.SelectedRowIDArray;
//}
}
#endregion
@@ -334,339 +329,346 @@ namespace FineUIPro.Web.WeldingProcess.WeldingManage
/// <param name="e"></param>
protected void btnSave_Click(object sender, EventArgs e)
{
if (CommonService.GetAllButtonPowerList(CurrUser.LoginProjectId, this.CurrUser.PersonId, Const.HJGL_WeldTaskMenuId, Const.BtnSave))
{
if (BLL.WeldingDailyService.IsExistWeldingDailyCode(this.txtWeldingDailyCode.Text, !string.IsNullOrEmpty(this.WeldingDailyId) ? this.WeldingDailyId : "", CurrUser.LoginProjectId))
{
ShowNotify("日报编号已存在,请重新录入", MessageBoxIcon.Warning);
return;
}
if (string.IsNullOrEmpty(this.txtWeldingDate.Text) || string.IsNullOrEmpty(this.txtWeldingDailyCode.Text.Trim()))
{
ShowNotify("日报告号、焊接日期不能为空", MessageBoxIcon.Warning);
return;
}
Model.HJGL_WeldingDaily newWeldingDaily = new Model.HJGL_WeldingDaily();
newWeldingDaily.WeldingDailyCode = this.txtWeldingDailyCode.Text.Trim();
newWeldingDaily.ProjectId = CurrUser.LoginProjectId;
newWeldingDaily.UnitWorkId = this.UnitWorkId;
if (this.drpUnitWork.SelectedValue != BLL.Const._Null)
{
newWeldingDaily.UnitWorkId = this.drpUnitWork.SelectedValue;
}
newWeldingDaily.UnitId = this.drpUnit.SelectedValue;
DateTime? weldDate = Funs.GetNewDateTime(this.txtWeldingDate.Text);
if (weldDate.HasValue)
{
newWeldingDaily.WeldingDate = weldDate.Value;
}
else
{
newWeldingDaily.WeldingDate = System.DateTime.Now;
}
newWeldingDaily.Tabler = this.hdTablerId.Text;
newWeldingDaily.TableDate = Funs.GetNewDateTime(this.txtTableDate.Text);
newWeldingDaily.Remark = this.txtRemark.Text.Trim();
//List<Model.SpWeldingDailyItem> GetWeldingDailyItem = this.CollectGridJointInfo();
string errlog = string.Empty;
var weldJointView = (from x in BLL.Funs.DB.View_HJGL_WeldJoint where x.WeldingDailyId == this.WeldingDailyId orderby x.PipelineCode, x.WeldJointCode select x).ToList();
string eventArg = string.Empty;
#region
//foreach (var item in GetWeldingDailyItem)
//{
// bool canSave = false;
// var jot = BLL.WeldJointService.GetWeldJointByWeldJointId(item.WeldJointId);
// var joty = BLL.Base_WeldTypeService.GetWeldTypeByWeldTypeId(jot.WeldTypeId);
// string weldType = string.Empty;
// if (joty != null && joty.WeldTypeCode.Contains("B"))
// {
// weldType = "对接焊缝";
// }
// else
// {
// weldType = "角焊缝";
// }
// string floorWelder = item.BackingWelderId;
// string cellWelder = item.CoverWelderId;
// decimal? dia = item.Dia;
// decimal? sch = Funs.GetNewDecimal(item.Thickness.HasValue ? item.Thickness.Value.ToString() : "");
// string wmeCode = string.Empty;
// var wm = BLL.Base_WeldingMethodService.GetWeldingMethodByWeldingMethodId(jot.WeldingMethodId);
// if (wm != null)
// {
// wmeCode = wm.WeldingMethodCode;
// }
// string[] wmeCodes = wmeCode.Split('+');
// //string location = item.JOT_Location;
// string ste = jot.Material1Id;
// string jointAttribute = jot.JointAttribute;
// List<Model.Welder_WelderQualify> floorWelderQualifys = (from x in Funs.DB.Welder_WelderQualify
// where x.WelderId == floorWelder && x.WeldingMethod != null
// && x.MaterialType != null && x.WeldType != null
// && x.ThicknessMax != null && x.SizesMin != null
// select x).ToList();
// List<Model.Welder_WelderQualify> cellWelderQualifys = (from x in Funs.DB.Welder_WelderQualify
// where x.WelderId == cellWelder && x.WeldingMethod != null
// && x.MaterialType != null && x.WeldType != null
// && x.ThicknessMax != null && x.SizesMin != null
// select x).ToList();
// // 打底和盖面同一焊工
// if (floorWelder == cellWelder)
// {
// if (floorWelderQualifys != null && floorWelderQualifys.Count() > 0)
// {
// if (wmeCodes.Count() <= 1) // 一种焊接方法
// {
// canSave = OneWmeIsOK(floorWelderQualifys, wmeCode, jointAttribute, weldType, ste, dia, sch);
// }
// else // 大于一种焊接方法,如氩电联焊
// {
// canSave = TwoWmeIsOK(floorWelderQualifys, cellWelderQualifys, wmeCodes[0], wmeCodes[1], jointAttribute, weldType, ste, dia, sch);
// }
// }
// }
// // 打底和盖面焊工不同
// else
// {
// bool isok1 = false;
// bool isok2 = false;
// if (wmeCodes.Count() <= 1) // 一种焊接方法
// {
// if (floorWelderQualifys != null && floorWelderQualifys.Count() > 0)
// {
// isok1 = OneWmeIsOK(floorWelderQualifys, wmeCode, jointAttribute, weldType, ste, dia, sch);
// }
// if (cellWelderQualifys != null && cellWelderQualifys.Count() > 0)
// {
// isok2 = OneWmeIsOK(cellWelderQualifys, wmeCode, jointAttribute, weldType, ste, dia, sch);
// }
// if (isok1 && isok2)
// {
// canSave = true;
// }
// }
// else
// {
// canSave = TwoWmeIsOK(floorWelderQualifys, cellWelderQualifys, wmeCodes[0], wmeCodes[1], jointAttribute, weldType, ste, dia, sch);
// }
// }
// if (canSave == false)
// {
// eventArg = eventArg + jot.WeldJointCode + ",";
// }
//}
#endregion
if (eventArg == string.Empty) //焊工焊接的所有焊口资质都符合要求)
{
if (!string.IsNullOrEmpty(this.WeldingDailyId))
{
newWeldingDaily.WeldingDailyId = this.WeldingDailyId;
BLL.WeldingDailyService.UpdateWeldingDaily(newWeldingDaily);
//BLL.Sys_LogService.AddLog(BLL.Const.System_6, this.CurrUser.LoginProjectId, this.CurrUser.PersonId, Const.HJGL_WeldReportMenuId, Const.BtnModify, this.WeldingDailyId);
}
else
{
this.WeldingDailyId = SQLHelper.GetNewID(typeof(Model.HJGL_WeldingDaily));
newWeldingDaily.WeldingDailyId = this.WeldingDailyId;
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);
if (batchC != null)
{
string batchCondition = batchC.SetValue;
// 新建日报
if (weldJointView.Count() == 0)
{
foreach (string row in Grid1.SelectedRowIDArray)
{
var t = BLL.WeldTaskService.GetWeldTaskById(row);
errlog += InsertWeldingDailyItem(t.WeldJointId, t.CoverWelderId, t.BackingWelderId, t.JointAttribute, newWeldingDaily.WeldingDate, batchCondition, true);
}
}
else
{
for (int i = 0; i < Grid1.Rows.Count; i++)
{
if (Grid1.SelectedRowIDArray.Contains(Grid1.Rows[i].RowID))
{
var t = BLL.WeldTaskService.GetWeldTaskById(Grid1.Rows[i].RowID);
errlog += InsertWeldingDailyItem(t.WeldJointId, t.CoverWelderId, t.BackingWelderId, t.JointAttribute, newWeldingDaily.WeldingDate, batchCondition, true);
}
else
{
var t = BLL.WeldTaskService.GetWeldTaskById(Grid1.Rows[i].RowID);
errlog += DeleteWeldingDailyItem(t.WeldJointId);
}
}
}
// 日报已存在的情况 暂时
//else
//{
// var weldJoints = from x in weldJointView select x.WeldJointId;
// foreach (var item in GetWeldingDailyItem)
// {
// // 如日报明细存在则只更新焊口信息,如进批条件改变,则只有删除后再重新增加
// if (weldJoints.Contains(item.WeldJointId))
// {
// var newWeldJoint = BLL.WeldJointService.GetWeldJointByWeldJointId(item.WeldJointId);
// newWeldJoint.WeldingDailyId = this.WeldingDailyId;
// newWeldJoint.WeldingDailyCode = this.txtWeldingDailyCode.Text.Trim();
// newWeldJoint.CoverWelderId = item.CoverWelderId;
// newWeldJoint.BackingWelderId = item.BackingWelderId;
// if (!string.IsNullOrEmpty(item.JointAttribute))
// {
// newWeldJoint.JointAttribute = item.JointAttribute;
// }
// BLL.WeldJointService.UpdateWeldJoint(newWeldJoint);
// //更新焊口号 修改固定焊口号后 +G
// BLL.WeldJointService.UpdateWeldJointAddG(newWeldJoint.WeldJointId, newWeldJoint.JointAttribute, Const.BtnAdd);
// }
// else
// {
// errlog += InsertWeldingDailyItem(item, newWeldingDaily.WeldingDate, batchCondition, true);
// }
// }
//}
}
else
{
errlog += "请设置项目的组批条件";
}
#region 60
// 焊工每天超过60达因的提示(暂不用)
//foreach (var item in GetWeldingDailyItem)
//{
// if (!string.IsNullOrEmpty(item.CoverWelderId) && !string.IsNullOrEmpty(item.BackingWelderId))
// {
// bool cWelder = BLL.Pipeline_WeldJointService.GetWelderLimitDN(this.ProjectId, item.CoverWelderId, newWeldingDaily.WeldingDate.Value);
// bool bWelder = cWelder;
// if (item.CoverWelderId != item.BackingWelderId)
// {
// bWelder = BLL.Pipeline_WeldJointService.GetWelderLimitDN(this.ProjectId, item.BackingWelderId, newWeldingDaily.WeldingDate.Value);
// }
// if (cWelder || bWelder)
// {
// if (cWelder)
// {
// var coverWelder = BLL.SitePerson_PersonService.GetSitePersonById(item.CoverWelderId);
// if (coverWelder != null)
// {
// string txt = Resources.Lan.WelderCode + coverWelder.WelderCode + Resources.Lan.WeldingDiameter;
// if (!errlog.Contains(txt))
// {
// errlog += txt;
// }
// }
// }
// if (bWelder)
// {
// var backingWelder = BLL.SitePerson_PersonService.GetSitePersonById(item.BackingWelderId);
// if (backingWelder != null)
// {
// string txt = Resources.Lan.WelderCode + backingWelder.WelderCode + Resources.Lan.WeldingDiameter;
// if (!errlog.Contains(txt))
// {
// errlog += txt;
// }
// }
// }
// }
// }
//}
#endregion
ChanggeState();//更新焊口属性
//更新焊口属性
if (string.IsNullOrEmpty(errlog))
{
ShowNotify("保存成功!", MessageBoxIcon.Success);
drpJointAttribute_SelectedIndexChanged(null, null);
//PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
}
else
{
// string okj = ActiveWindow.GetWriteBackValueReference(newWeldReportMain.WeldingDailyId) + ActiveWindow.GetHidePostBackReference();
Alert.ShowInTop("保存成功!" + "焊接明细中" + errlog, "提交结果", MessageBoxIcon.Warning);
drpJointAttribute_SelectedIndexChanged(null, null);
// ShowAlert("焊接明细中" + errlog, MessageBoxIcon.Warning);
}
}
else
{
Alert.ShowInTop("焊工无资质焊接的焊口:" + eventArg, "提交结果", MessageBoxIcon.Warning);
}
}
else
if (!CommonService.GetAllButtonPowerList(CurrUser.LoginProjectId, this.CurrUser.PersonId,
Const.HJGL_WeldTaskMenuId, Const.BtnSave))
{
ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
return;
}
if (BLL.WeldingDailyService.IsExistWeldingDailyCode(this.txtWeldingDailyCode.Text,
!string.IsNullOrEmpty(this.WeldingDailyId) ? this.WeldingDailyId : "", CurrUser.LoginProjectId))
{
ShowNotify("日报编号已存在,请重新录入", MessageBoxIcon.Warning);
return;
}
if (string.IsNullOrEmpty(this.txtWeldingDate.Text) ||
string.IsNullOrEmpty(this.txtWeldingDailyCode.Text.Trim()))
{
ShowNotify("日报告号、焊接日期不能为空", MessageBoxIcon.Warning);
return;
}
Model.HJGL_WeldingDaily newWeldingDaily = new Model.HJGL_WeldingDaily
{
WeldingDailyCode = this.txtWeldingDailyCode.Text.Trim(),
ProjectId = CurrUser.LoginProjectId,
UnitWorkId = this.UnitWorkId,
WeldingDate = Funs.GetNewDateTime(this.txtWeldingDate.Text) ?? DateTime.Now,
Tabler = this.hdTablerId.Text,
TableDate = Funs.GetNewDateTime(this.txtTableDate.Text),
Remark = this.txtRemark.Text.Trim(),
UnitId = this.drpUnit.SelectedValue
};
if (this.drpUnitWork.SelectedValue != BLL.Const._Null)
{
newWeldingDaily.UnitWorkId = this.drpUnitWork.SelectedValue;
}
//List<Model.SpWeldingDailyItem> GetWeldingDailyItem = this.CollectGridJointInfo();
string errlog = string.Empty;
var weldJointView = (from x in BLL.Funs.DB.View_HJGL_WeldJoint where x.WeldingDailyId == this.WeldingDailyId orderby x.PipelineCode, x.WeldJointCode
select x).ToList();
string eventArg = string.Empty;
#region
//foreach (var item in GetWeldingDailyItem)
//{
// bool canSave = false;
// var jot = BLL.WeldJointService.GetWeldJointByWeldJointId(item.WeldJointId);
// var joty = BLL.Base_WeldTypeService.GetWeldTypeByWeldTypeId(jot.WeldTypeId);
// string weldType = string.Empty;
// if (joty != null && joty.WeldTypeCode.Contains("B"))
// {
// weldType = "对接焊缝";
// }
// else
// {
// weldType = "角焊缝";
// }
// string floorWelder = item.BackingWelderId;
// string cellWelder = item.CoverWelderId;
// decimal? dia = item.Dia;
// decimal? sch = Funs.GetNewDecimal(item.Thickness.HasValue ? item.Thickness.Value.ToString() : "");
// string wmeCode = string.Empty;
// var wm = BLL.Base_WeldingMethodService.GetWeldingMethodByWeldingMethodId(jot.WeldingMethodId);
// if (wm != null)
// {
// wmeCode = wm.WeldingMethodCode;
// }
// string[] wmeCodes = wmeCode.Split('+');
// //string location = item.JOT_Location;
// string ste = jot.Material1Id;
// string jointAttribute = jot.JointAttribute;
// List<Model.Welder_WelderQualify> floorWelderQualifys = (from x in Funs.DB.Welder_WelderQualify
// where x.WelderId == floorWelder && x.WeldingMethod != null
// && x.MaterialType != null && x.WeldType != null
// && x.ThicknessMax != null && x.SizesMin != null
// select x).ToList();
// List<Model.Welder_WelderQualify> cellWelderQualifys = (from x in Funs.DB.Welder_WelderQualify
// where x.WelderId == cellWelder && x.WeldingMethod != null
// && x.MaterialType != null && x.WeldType != null
// && x.ThicknessMax != null && x.SizesMin != null
// select x).ToList();
// // 打底和盖面同一焊工
// if (floorWelder == cellWelder)
// {
// if (floorWelderQualifys != null && floorWelderQualifys.Count() > 0)
// {
// if (wmeCodes.Count() <= 1) // 一种焊接方法
// {
// canSave = OneWmeIsOK(floorWelderQualifys, wmeCode, jointAttribute, weldType, ste, dia, sch);
// }
// else // 大于一种焊接方法,如氩电联焊
// {
// canSave = TwoWmeIsOK(floorWelderQualifys, cellWelderQualifys, wmeCodes[0], wmeCodes[1], jointAttribute, weldType, ste, dia, sch);
// }
// }
// }
// // 打底和盖面焊工不同
// else
// {
// bool isok1 = false;
// bool isok2 = false;
// if (wmeCodes.Count() <= 1) // 一种焊接方法
// {
// if (floorWelderQualifys != null && floorWelderQualifys.Count() > 0)
// {
// isok1 = OneWmeIsOK(floorWelderQualifys, wmeCode, jointAttribute, weldType, ste, dia, sch);
// }
// if (cellWelderQualifys != null && cellWelderQualifys.Count() > 0)
// {
// isok2 = OneWmeIsOK(cellWelderQualifys, wmeCode, jointAttribute, weldType, ste, dia, sch);
// }
// if (isok1 && isok2)
// {
// canSave = true;
// }
// }
// else
// {
// canSave = TwoWmeIsOK(floorWelderQualifys, cellWelderQualifys, wmeCodes[0], wmeCodes[1], jointAttribute, weldType, ste, dia, sch);
// }
// }
// if (canSave == false)
// {
// eventArg = eventArg + jot.WeldJointCode + ",";
// }
//}
#endregion
if (eventArg == string.Empty) //焊工焊接的所有焊口资质都符合要求)
{
if (!string.IsNullOrEmpty(this.WeldingDailyId))
{
newWeldingDaily.WeldingDailyId = this.WeldingDailyId;
BLL.WeldingDailyService.UpdateWeldingDaily(newWeldingDaily);
//BLL.Sys_LogService.AddLog(BLL.Const.System_6, this.CurrUser.LoginProjectId, this.CurrUser.PersonId, Const.HJGL_WeldReportMenuId, Const.BtnModify, this.WeldingDailyId);
}
else
{
this.WeldingDailyId = SQLHelper.GetNewID(typeof(Model.HJGL_WeldingDaily));
newWeldingDaily.WeldingDailyId = this.WeldingDailyId;
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);
if (batchC != null)
{
string batchCondition = batchC.SetValue;
// 新建日报
if (weldJointView.Count() == 0)
{
foreach (string row in Grid1.SelectedRowIDArray)
{
var t = BLL.WeldTaskService.GetWeldTaskById(row);
errlog += InsertWeldingDailyItem(t.WeldJointId, t.CoverWelderId, t.BackingWelderId,
t.JointAttribute, newWeldingDaily.WeldingDate, batchCondition, true);
}
}
else
{
for (int i = 0; i < Grid1.Rows.Count; i++)
{
if (Grid1.SelectedRowIDArray.Contains(Grid1.Rows[i].RowID))
{
var t = BLL.WeldTaskService.GetWeldTaskById(Grid1.Rows[i].RowID);
errlog += InsertWeldingDailyItem(t.WeldJointId, t.CoverWelderId, t.BackingWelderId,
t.JointAttribute, newWeldingDaily.WeldingDate, batchCondition, true);
}
else
{
var t = BLL.WeldTaskService.GetWeldTaskById(Grid1.Rows[i].RowID);
errlog += BLL.WeldingDailyService
.DeleteWeldingDailyItemByweldJointId(t.WeldJointId);
}
}
}
// 日报已存在的情况 暂时
//else
//{
// var weldJoints = from x in weldJointView select x.WeldJointId;
// foreach (var item in GetWeldingDailyItem)
// {
// // 如日报明细存在则只更新焊口信息,如进批条件改变,则只有删除后再重新增加
// if (weldJoints.Contains(item.WeldJointId))
// {
// var newWeldJoint = BLL.WeldJointService.GetWeldJointByWeldJointId(item.WeldJointId);
// newWeldJoint.WeldingDailyId = this.WeldingDailyId;
// newWeldJoint.WeldingDailyCode = this.txtWeldingDailyCode.Text.Trim();
// newWeldJoint.CoverWelderId = item.CoverWelderId;
// newWeldJoint.BackingWelderId = item.BackingWelderId;
// if (!string.IsNullOrEmpty(item.JointAttribute))
// {
// newWeldJoint.JointAttribute = item.JointAttribute;
// }
// BLL.WeldJointService.UpdateWeldJoint(newWeldJoint);
// //更新焊口号 修改固定焊口号后 +G
// BLL.WeldJointService.UpdateWeldJointAddG(newWeldJoint.WeldJointId, newWeldJoint.JointAttribute, Const.BtnAdd);
// }
// else
// {
// errlog += InsertWeldingDailyItem(item, newWeldingDaily.WeldingDate, batchCondition, true);
// }
// }
//}
}
else
{
errlog += "请设置项目的组批条件";
}
#region 60
// 焊工每天超过60达因的提示(暂不用)
//foreach (var item in GetWeldingDailyItem)
//{
// if (!string.IsNullOrEmpty(item.CoverWelderId) && !string.IsNullOrEmpty(item.BackingWelderId))
// {
// bool cWelder = BLL.Pipeline_WeldJointService.GetWelderLimitDN(this.ProjectId, item.CoverWelderId, newWeldingDaily.WeldingDate.Value);
// bool bWelder = cWelder;
// if (item.CoverWelderId != item.BackingWelderId)
// {
// bWelder = BLL.Pipeline_WeldJointService.GetWelderLimitDN(this.ProjectId, item.BackingWelderId, newWeldingDaily.WeldingDate.Value);
// }
// if (cWelder || bWelder)
// {
// if (cWelder)
// {
// var coverWelder = BLL.SitePerson_PersonService.GetSitePersonById(item.CoverWelderId);
// if (coverWelder != null)
// {
// string txt = Resources.Lan.WelderCode + coverWelder.WelderCode + Resources.Lan.WeldingDiameter;
// if (!errlog.Contains(txt))
// {
// errlog += txt;
// }
// }
// }
// if (bWelder)
// {
// var backingWelder = BLL.SitePerson_PersonService.GetSitePersonById(item.BackingWelderId);
// if (backingWelder != null)
// {
// string txt = Resources.Lan.WelderCode + backingWelder.WelderCode + Resources.Lan.WeldingDiameter;
// if (!errlog.Contains(txt))
// {
// errlog += txt;
// }
// }
// }
// }
// }
//}
#endregion
ChanggeState(); //更新焊口属性
//更新焊口属性
if (string.IsNullOrEmpty(errlog))
{
ShowNotify("保存成功!", MessageBoxIcon.Success);
drpJointAttribute_SelectedIndexChanged(null, null);
BindGrid(null);
//PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
}
else
{
// string okj = ActiveWindow.GetWriteBackValueReference(newWeldReportMain.WeldingDailyId) + ActiveWindow.GetHidePostBackReference();
Alert.ShowInTop("保存成功!" + "焊接明细中" + errlog, "提交结果", MessageBoxIcon.Warning);
drpJointAttribute_SelectedIndexChanged(null, null);
BindGrid(null);
// ShowAlert("焊接明细中" + errlog, MessageBoxIcon.Warning);
}
}
else
{
Alert.ShowInTop("焊工无资质焊接的焊口:" + eventArg, "提交结果", MessageBoxIcon.Warning);
}
}
protected void btnAccept_Click(object sender, EventArgs e)
@@ -859,59 +861,6 @@ namespace FineUIPro.Web.WeldingProcess.WeldingManage
}
#endregion
#region
/// <summary>
/// 日报明细删除(更新焊口信息),组批等
/// </summary>
/// <param name="item"></param>
/// <param name="weldingDailyId"></param>
///
/// <returns></returns>
private string DeleteWeldingDailyItem(string weldJointId)
{
string errlog = string.Empty;
var newWeldJoint = BLL.WeldJointService.GetWeldJointByWeldJointId(weldJointId);
var pipeline = BLL.PipelineService.GetPipelineByPipelineId(newWeldJoint.PipelineId);
if (newWeldJoint != null && !string.IsNullOrEmpty(newWeldJoint.WeldingDailyId))
{
var isTrust = from x in Funs.DB.HJGL_Batch_BatchTrustItem
where x.WeldJointId == weldJointId
select x; ;
if (isTrust.Count() == 0)
{
var updateWeldJoint = BLL.WeldJointService.GetWeldJointByWeldJointId(weldJointId);
if (updateWeldJoint != null)
{
updateWeldJoint.WeldingDailyId = null;
updateWeldJoint.WeldingDailyCode = null;
updateWeldJoint.CoverWelderId = null;
updateWeldJoint.BackingWelderId = null;
BLL.WeldJointService.UpdateWeldJoint(updateWeldJoint);
var pointBatchItems = from x in Funs.DB.HJGL_Batch_PointBatchItem where x.WeldJointId == weldJointId select x;
string pointBatchId = pointBatchItems.FirstOrDefault().PointBatchId;
// 删除焊口所在批明细信息
BLL.PointBatchDetailService.DeleteBatchDetail(weldJointId);
// 删除批信息
var batch = from x in Funs.DB.HJGL_Batch_PointBatchItem where x.PointBatchId == pointBatchId select x;
if (pointBatchId != null && batch.Count() == 0)
{
BLL.PointBatchService.DeleteBatch(pointBatchId);
}
}
}
else
{
errlog += "焊口【" + newWeldJoint.WeldJointCode + "】已进委托单了,不能删除。";
}
}
return errlog;
}
#endregion
#region Grid页面信息
/// <summary>
@@ -1087,16 +1036,27 @@ namespace FineUIPro.Web.WeldingProcess.WeldingManage
}
private void ChanggeState()
{
if (!string.IsNullOrEmpty(this.WeldingDailyId))
if (!string.IsNullOrEmpty(this.WeldingDailyId) && Grid1.SelectedRowIDArray.Length > 0)
{
List<Model.SpWeldingDailyItem> GetWeldingDailyItem = BLL.WeldingDailyService.GetWeldingDailyItem(this.WeldingDailyId);
foreach (var rowId in Grid1.SelectedRowIDArray)
{
var t = BLL.WeldTaskService.GetWeldTaskById(rowId);
var newWeldJoint = BLL.WeldJointService.GetWeldJointByWeldJointId(t.WeldJointId);
var daily = BLL.WeldingDailyService.GetPipeline_WeldingDailyByWeldingDailyId(WeldingDailyId);
BLL.HJGL_PipelineComponentjointService.UpdateStateByWeldJointId(newWeldJoint.WeldJointId, (DateTime)daily.WeldingDate);//更改预制口实际时间和状态
PipelineService.UpdataDateByWeldJointId(newWeldJoint.WeldJointId);//更改安装口时间和状态
}
/*List<Model.SpWeldingDailyItem> GetWeldingDailyItem = BLL.WeldingDailyService.GetWeldingDailyItem(this.WeldingDailyId);
foreach (var item in GetWeldingDailyItem)
{
var daily = BLL.WeldingDailyService.GetPipeline_WeldingDailyByWeldingDailyId(WeldingDailyId);
BLL.HJGL_PipelineComponentjointService.UpdateStateByWeldJointId(item.WeldJointId, (DateTime)daily.WeldingDate);//更改预制口实际时间和状态
PipelineService.UpdataDateByWeldJointId(item.WeldJointId);//更改安装口时间和状态
}
}*/
}
}
@@ -190,15 +190,15 @@ namespace FineUIPro.Web.HJGL.WeldingManage
where x.UnitWorkId == node.NodeID
&& x.TaskDate < Convert.ToDateTime(this.txtTaskDateMonth.Text.Trim() + "-01").AddMonths(1)
&& x.TaskDate >= Convert.ToDateTime(this.txtTaskDateMonth.Text.Trim() + "-01")
select x.TaskDate.Value.Date).Distinct();
select new { x.TaskDate.Value.Date ,x.UnitId}).Distinct();
if (p.Count() > 0)
{
foreach (var item in p)
{
TreeNode newNode = new TreeNode();
newNode.CommandName = "Date";
newNode.Text = string.Format("{0:yyyy-MM-dd}", item);
newNode.NodeID = node.NodeID + "|" + string.Format("{0:yyyy-MM-dd}", item);
newNode.Text = string.Format("{0:yyyy-MM-dd}", item.Date)+"("+BLL.UnitService.getUnitNamesUnitIds(item.UnitId)+")";
newNode.NodeID = node.NodeID + "|" + string.Format("{0:yyyy-MM-dd}", item.Date);
newNode.EnableClickEvent = true;
node.Nodes.Add(newNode);
}