diff --git a/SGGL/BLL/HJGL/WeldingManage/PipelineService.cs b/SGGL/BLL/HJGL/WeldingManage/PipelineService.cs index f21e343c..338ddfbd 100644 --- a/SGGL/BLL/HJGL/WeldingManage/PipelineService.cs +++ b/SGGL/BLL/HJGL/WeldingManage/PipelineService.cs @@ -1,4 +1,6 @@ -using MiniExcelLibs; +using Microsoft.Office.Interop.Word; +using Microsoft.SqlServer.Dts.Runtime; +using MiniExcelLibs; using Model; using System; using System.Collections.Generic; @@ -6,7 +8,9 @@ using System.Data; using System.Data.SqlClient; using System.IO; using System.Linq; +using System.Web.UI.DataVisualization.Charting; using System.Web.UI.WebControls; +using static BLL.PipelineService; namespace BLL { @@ -20,6 +24,29 @@ namespace BLL /// 现场安装 /// public const string PipeArea_FIELD = "2"; + + /// + /// 实际日期类型 + /// + public enum ActDateType + { + /// + /// 实际开始日期(预制) + /// + ActDateStart_Shop, + /// + /// 实际完成日期(预制) + /// + ActDateEnd_Shop , + /// + /// 实际开始日期(安装) + /// + ActDateStart_FIELD , + /// + /// 实际完成日期(安装) + /// + ActDateEnd_FIELD , + } public static ListItem[] GetPipeArea() { ListItem[] list = new ListItem[2]; @@ -37,6 +64,99 @@ namespace BLL { return Funs.DB.HJGL_Pipeline.FirstOrDefault(e => e.PipelineId == pipelineId); } + public static void GetStateByPipelineId(string pipelineId) + {//< f:ListItem Value = "0" Text = "未开始" /> + // < f:ListItem Value = "1" Text = "未开始且延误" /> + // < f:ListItem Value = "2" Text = "开始" /> + // < f:ListItem Value = "3" Text = "已开始且延误" /> + // < f:ListItem Value = "4" Text = "完成" /> + var mdoel = GetPipelineByPipelineId(pipelineId); + var PlanStartDate = mdoel.PlanStartDate; + var PlanEndDate = mdoel.PlanEndDate; + var ActStartDate = new DateTime?(); + var ActEndDate = new DateTime?(); + if (!string .IsNullOrEmpty(GetDateByPipelineId(pipelineId, ActDateType.ActDateStart_FIELD))) + { + ActStartDate = Convert.ToDateTime(GetDateByPipelineId(pipelineId, ActDateType.ActDateStart_FIELD)); + } + if (!string.IsNullOrEmpty(GetDateByPipelineId(pipelineId, ActDateType.ActDateEnd_FIELD))) + { + ActEndDate = Convert.ToDateTime(GetDateByPipelineId(pipelineId, ActDateType.ActDateEnd_FIELD)); + } + if (ActStartDate==null&&DateTime.Compare(DateTime.Now,PlanStartDate.Value)<0) + { + mdoel.State = 0; + } + else if(ActStartDate == null && DateTime.Compare(DateTime.Now, PlanStartDate.Value) > 0) + { + mdoel.State = 1; + } + else if (ActStartDate!=null && DateTime.Compare(ActStartDate.Value, PlanStartDate.Value)<0 && ActEndDate==null) + { + mdoel.State = 2; + } + else if (ActStartDate != null && DateTime.Compare(ActStartDate.Value, PlanStartDate.Value) > 0 && ActEndDate == null) + { + mdoel.State = 3; + } + else if (ActEndDate != null) + { + mdoel.State = 4; + } + UpdatePipeline(mdoel); + } + + public static string GetDateByPipelineId(object pipelineId, ActDateType actDateType) + { + string result =""; + string _pipelineId = pipelineId.ToString(); + string ActDateStart_Shop = ""; + string ActDateEnd_Shop = ""; + string ActDateStart_FIELD = ""; + string ActDateEnd_FIELD = ""; + + var pipemodel = GetPipelineByPipelineId(_pipelineId); + var joints = BLL.WeldJointService.GetWeldJointsByPipelineId(_pipelineId); + int joint_Shop_count = joints.Where(x => x.JointAttribute == "预制口").Count(); + int joint_Field_count = joints.Where(x => x.JointAttribute == "安装口").Count(); + var TaskJoints = (from x in Funs.DB.View_HJGL_WeldingTask where x.ProjectId == pipemodel.ProjectId && x.PipelineCode == pipemodel.PipelineCode + select x).ToList(); + var TaskJoints_Shop = TaskJoints.Where(x => x.JointAttribute == "预制口").ToList(); + var TaskJoints_Field= TaskJoints.Where(x => x.JointAttribute == "安装口").ToList(); + if (TaskJoints_Shop.Count>0) + { + ActDateStart_Shop = TaskJoints_Shop.OrderBy(x => x.TaskDate).First().TaskDate.Value.ToShortDateString(); + } + if (joint_Shop_count== TaskJoints_Shop.Count&& joint_Shop_count>0) + { + ActDateEnd_Shop = TaskJoints_Shop.OrderByDescending(x => x.TaskDate).First().TaskDate.Value.Date.ToShortDateString(); + } + if (TaskJoints_Field.Count > 0) + { + ActDateStart_FIELD = TaskJoints_Field.OrderBy(x => x.TaskDate).First().TaskDate.Value.Date.ToShortDateString(); + } + if (joint_Field_count == TaskJoints_Field.Count && joint_Field_count > 0) + { + ActDateEnd_FIELD = TaskJoints_Field.OrderByDescending(x => x.TaskDate).First().TaskDate.Value.Date.ToShortDateString(); + } + switch (actDateType) + { + case ActDateType.ActDateStart_Shop: + result = ActDateStart_Shop; + break; + case ActDateType.ActDateEnd_Shop: + result = ActDateEnd_Shop; + break; + case ActDateType.ActDateStart_FIELD: + result = ActDateStart_FIELD; + break; + case ActDateType.ActDateEnd_FIELD: + result = ActDateEnd_FIELD; + break; + } + return result; + + } public static Model.HJGL_Pipeline GetPipelineByPipelineCode(string pipelineCode) { return Funs.DB.HJGL_Pipeline.FirstOrDefault(e => e.PipelineCode == pipelineCode); @@ -158,7 +278,7 @@ namespace BLL } SqlParameter[] parameter = listStr.ToArray(); - DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); + System.Data.DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); tb.TableName = "Data"; var value = new Dictionary() { @@ -225,7 +345,7 @@ namespace BLL } SqlParameter[] parameter = listStr.ToArray(); - DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); + System.Data.DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); tb.TableName = "Data"; var value = new Dictionary() { diff --git a/SGGL/BLL/HJGL/WeldingManage/WeldJointService.cs b/SGGL/BLL/HJGL/WeldingManage/WeldJointService.cs index 706648e9..d21a20c9 100644 --- a/SGGL/BLL/HJGL/WeldingManage/WeldJointService.cs +++ b/SGGL/BLL/HJGL/WeldingManage/WeldJointService.cs @@ -54,7 +54,11 @@ namespace BLL var q = (from x in Funs.DB.HJGL_WeldJoint where x.WeldingDailyId == weldingDailyId orderby x.PipelineId, x.WeldJointCode select x).ToList(); return q; } - + public static List GetWeldJointsByPipelineId(string PipelineId) + { + var q = (from x in Funs.DB.HJGL_WeldJoint where x.PipelineId == PipelineId select x).ToList(); + return q; + } /// /// 添加 /// diff --git a/SGGL/FineUIPro.Web/ErrLog.txt b/SGGL/FineUIPro.Web/ErrLog.txt index e69de29b..767e0d55 100644 --- a/SGGL/FineUIPro.Web/ErrLog.txt +++ b/SGGL/FineUIPro.Web/ErrLog.txt @@ -0,0 +1,40 @@ + +错误信息开始=====> +错误类型:NullReferenceException +错误信息:未将对象引用设置到对象的实例。 +错误堆栈: + 在 FineUIPro.Web.HJGL.WeldingManage.WeldingPlan.Page_Load(Object sender, EventArgs e) 位置 D:\诺必达\赛鼎\SGGL_SeDin\SGGL\FineUIPro.Web\HJGL\WeldingManage\WeldingPlan.aspx.cs:行号 18 + 在 System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) + 在 System.EventHandler.Invoke(Object sender, EventArgs e) + 在 System.Web.UI.Control.OnLoad(EventArgs e) + 在 System.Web.UI.Control.LoadRecursive() + 在 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +出错时间:11/16/2022 19:30:50 +出错文件:http://localhost:14901/HJGL/WeldingManage/WeldingPlan.aspx +IP地址:::1 + +出错时间:11/16/2022 19:30:50 + + + +错误信息开始=====> +错误类型:FormatException +错误信息:该字符串未被识别为有效的 DateTime。 +错误堆栈: + 在 System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi, DateTimeStyles styles) + 在 System.Convert.ToDateTime(String value) + 在 BLL.PipelineService.GetStateByPipelineId(String pipelineId) 位置 D:\诺必达\赛鼎\SGGL_SeDin\SGGL\BLL\HJGL\WeldingManage\PipelineService.cs:行号 75 + 在 FineUIPro.Web.HJGL.WeldingManage.WeldingPlan.btnUpDateState_Click(Object sender, EventArgs e) + 在 FineUIPro.Button.OnClick(EventArgs e) + 在 (Button , EventArgs ) + 在 FineUIPro.Button.RaisePostBackEvent(String eventArgument) + 在 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) + 在 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) + 在 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +出错时间:11/16/2022 19:35:57 +出错文件:http://localhost:14901/HJGL/WeldingManage/WeldingPlan.aspx +IP地址:::1 +操作人员:JT + +出错时间:11/16/2022 19:35:57 + diff --git a/SGGL/FineUIPro.Web/HJGL/BaseInfo/PipingClassIn.aspx.cs b/SGGL/FineUIPro.Web/HJGL/BaseInfo/PipingClassIn.aspx.cs index b29ad88b..3add6128 100644 --- a/SGGL/FineUIPro.Web/HJGL/BaseInfo/PipingClassIn.aspx.cs +++ b/SGGL/FineUIPro.Web/HJGL/BaseInfo/PipingClassIn.aspx.cs @@ -419,8 +419,8 @@ namespace FineUIPro.Web.HJGL.BaseInfo int a = PipingClassList.Count(); for (int i = 0; i < a; i++) { - var isExistPipingClassCode = Funs.DB.Base_PipingClass.FirstOrDefault(x => (x.PipingClassId != PipingClassList[i].PipingClassId || (PipingClassList[i].PipingClassId == null && x.PipingClassId != null)) && x.PipingClassCode == PipingClassList[i].PipingClassCode); - var isExistPipingClassName = Funs.DB.Base_PipingClass.FirstOrDefault(x => (x.PipingClassId != PipingClassList[i].PipingClassId || (PipingClassList[i].PipingClassId == null && x.PipingClassId != null)) && x.PipingClassName == PipingClassList[i].PipingClassName); + var isExistPipingClassCode = Funs.DB.Base_PipingClass.FirstOrDefault(x => (x.PipingClassId == PipingClassList[i].PipingClassId || (PipingClassList[i].PipingClassId == null && x.PipingClassId != null)) && x.PipingClassCode == PipingClassList[i].PipingClassCode); + var isExistPipingClassName = Funs.DB.Base_PipingClass.FirstOrDefault(x => (x.PipingClassId == PipingClassList[i].PipingClassId || (PipingClassList[i].PipingClassId == null && x.PipingClassId != null)) && x.PipingClassName == PipingClassList[i].PipingClassName); if (isExistPipingClassCode != null) { ShowNotify("存在相同批次的管道等级代号,请修正后重新提交!", MessageBoxIcon.Warning); diff --git a/SGGL/FineUIPro.Web/HJGL/WeldingManage/SelectTaskWeldJoint.aspx.cs b/SGGL/FineUIPro.Web/HJGL/WeldingManage/SelectTaskWeldJoint.aspx.cs index 7e752f22..1a992a7e 100644 --- a/SGGL/FineUIPro.Web/HJGL/WeldingManage/SelectTaskWeldJoint.aspx.cs +++ b/SGGL/FineUIPro.Web/HJGL/WeldingManage/SelectTaskWeldJoint.aspx.cs @@ -430,10 +430,10 @@ namespace FineUIPro.Web.HJGL.WeldingManage NewTask.TableDate = DateTime.Now; BLL.WeldTaskService.AddWeldTask(NewTask); } - string pipelineId = this.tvControlItem.SelectedNodeID; - var model = BLL.PipelineService.GetPipelineByPipelineId(pipelineId); - model.State = 1; - PipelineService.UpdatePipeline(model); + //string pipelineId = this.tvControlItem.SelectedNodeID; + //var model = BLL.PipelineService.GetPipelineByPipelineId(pipelineId); + //model.State = 1; + //PipelineService.UpdatePipeline(model); ShowNotify("保存成功!", MessageBoxIcon.Success); PageContext.RegisterStartupScript(ActiveWindow.GetWriteBackValueReference(txtTaskDate.Text) + ActiveWindow.GetHidePostBackReference()); //PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); diff --git a/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldJointList.aspx b/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldJointList.aspx index 5ae63ba1..c3e5d171 100644 --- a/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldJointList.aspx +++ b/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldJointList.aspx @@ -221,7 +221,7 @@ SortField="Size" FieldType="Double" HeaderTextAlign="Center" TextAlign="Left" Width="90px"> - diff --git a/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldingPlan.aspx b/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldingPlan.aspx index ec92f111..0f39664c 100644 --- a/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldingPlan.aspx +++ b/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldingPlan.aspx @@ -58,6 +58,8 @@ + + @@ -127,14 +129,26 @@ DataField="PlanEndDate_SHOP" SortField="PlanEndDate_SHOP" FieldType="Date" Renderer="Date" HeaderTextAlign="Center" TextAlign="Left" Width="150px"> - + + + + + + + + + + <%-- - + --%> @@ -143,18 +157,31 @@ DataField="PlanEndDate" SortField="PlanEndDate" FieldType="Date" Renderer="Date" HeaderTextAlign="Center" TextAlign="Left" Width="150px"> - + + + + + + + + + + <%-- - - --%> + + diff --git a/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldingPlan.aspx.cs b/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldingPlan.aspx.cs index 77c0552d..b71c1534 100644 --- a/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldingPlan.aspx.cs +++ b/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldingPlan.aspx.cs @@ -172,6 +172,12 @@ namespace FineUIPro.Web.HJGL.WeldingManage ,line.ActEndDate ,line.IsFinished ,line.FlowingSection + ,(case line.State + when 0 then '未开始' + when 1 then '未开始且延误' + when 2 then '开始' + when 3 then '已开始且延误' + when 4 then '完成' else '' end ) as State ,com.PipelineComponentId ,com.PreUnit ,com.PipelineComponentCode @@ -179,7 +185,6 @@ namespace FineUIPro.Web.HJGL.WeldingManage ,com.AssembleUnit ,com.PipeLineMatId ,com.QRCode - ,com.State ,com.PlanStartDate as PlanStartDate_SHOP ,com.PlanEndDate as PlanEndDate_SHOP ,com.ActStartDate as ActStartDate_SHOP @@ -459,8 +464,20 @@ namespace FineUIPro.Web.HJGL.WeldingManage ShowNotify("请先选择单位工程!", MessageBoxIcon.Warning); } } + #endregion + protected void btnUpDateState_Click(object sender, EventArgs e) + { + string unitworkid = this.tvControlItem.SelectedNodeID; + var pipeline=PipelineService.GetPipelinesByUnitWordId(unitworkid); + foreach (var item in pipeline) + { + BLL.PipelineService.GetStateByPipelineId(item.PipelineId); + } + BindGrid(); + } + } } diff --git a/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldingPlan.aspx.designer.cs b/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldingPlan.aspx.designer.cs index 0870fe01..ae2d8c46 100644 --- a/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldingPlan.aspx.designer.cs +++ b/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldingPlan.aspx.designer.cs @@ -140,6 +140,15 @@ namespace FineUIPro.Web.HJGL.WeldingManage /// protected global::FineUIPro.Button btnOut; + /// + /// btnUpDateState 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnUpDateState; + /// /// btnImportFIELD 控件。 /// @@ -184,7 +193,6 @@ namespace FineUIPro.Web.HJGL.WeldingManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.TextBox txtPipelineCode; - protected global::FineUIPro.TextBox txtFlowingSection; /// /// txtSingleName 控件。 @@ -213,6 +221,15 @@ namespace FineUIPro.Web.HJGL.WeldingManage /// protected global::FineUIPro.TextBox txtMaterialCode; + /// + /// txtFlowingSection 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtFlowingSection; + /// /// btnQuery 控件。 /// @@ -231,6 +248,42 @@ namespace FineUIPro.Web.HJGL.WeldingManage /// protected global::FineUIPro.Grid Grid1; + /// + /// Label1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label Label1; + + /// + /// Label2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label Label2; + + /// + /// Label3 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label Label3; + + /// + /// Label4 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label Label4; + /// /// ToolbarSeparator1 控件。 ///