| 
									
										
										
										
											2023-03-25 14:46:00 +08:00
										 |  |  |  | using BLL; | 
					
						
							|  |  |  |  | using System; | 
					
						
							|  |  |  |  | using System.Collections.Generic; | 
					
						
							|  |  |  |  | using System.Data; | 
					
						
							|  |  |  |  | using System.Data.SqlClient; | 
					
						
							|  |  |  |  | using System.Linq; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | namespace FineUIPro.Web.DataShow | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     public partial class HJGLWelding : PageBase | 
					
						
							|  |  |  |  |     { | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         #region 加载页面 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 加载页面 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="sender"></param> | 
					
						
							|  |  |  |  |         /// <param name="e"></param> | 
					
						
							|  |  |  |  |         protected void Page_Load(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             if (!IsPostBack) | 
					
						
							|  |  |  |  |             { | 
					
						
							| 
									
										
										
										
											2023-06-09 18:17:40 +08:00
										 |  |  |  |                 Funs.DropDownPageSize(this.ddlPageSize); | 
					
						
							| 
									
										
										
										
											2023-03-25 14:46:00 +08:00
										 |  |  |  |                 ddlPageSize.SelectedValue = Grid1.PageSize.ToString(); | 
					
						
							|  |  |  |  |                 BLL.ProjectService.InitProjectDropDownList(this.drpProject, true); | 
					
						
							|  |  |  |  |                 // 绑定表格t | 
					
						
							|  |  |  |  |                 BindGrid(); | 
					
						
							| 
									
										
										
										
											2023-06-07 18:55:33 +08:00
										 |  |  |  |                 this.Panel1.Title = "焊接数据(" + BLL.UnitService.GetUnitNameByUnitId(BLL.Const.UnitId_CWCEC) + ")"; | 
					
						
							| 
									
										
										
										
											2023-03-25 14:46:00 +08:00
										 |  |  |  |             } | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-06-09 18:17:40 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-25 14:46:00 +08:00
										 |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 绑定数据 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         private void BindGrid() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             string strSql = @"select ProjectId,ProjectCode, ProjectName from Base_Project where ProjectState =1"; | 
					
						
							|  |  |  |  |             List<SqlParameter> listStr = new List<SqlParameter>(); | 
					
						
							|  |  |  |  |             string cpara = string.Empty; | 
					
						
							|  |  |  |  |             if (this.drpProject.SelectedValue != Const._Null) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 strSql += " AND projectId = @projectId";  ///状态为已完成 | 
					
						
							|  |  |  |  |                 listStr.Add(new SqlParameter("@projectId", this.drpProject.SelectedValue)); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             //if (!string.IsNullOrEmpty(this.txtStartTime.Text)) | 
					
						
							|  |  |  |  |             //{ | 
					
						
							|  |  |  |  |             //    strSql += " AND h.RegisterDate >=@StartTime"; | 
					
						
							|  |  |  |  |             //    listStr.Add(new SqlParameter("@StartTime", this.txtStartTime.Text)); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             //    cpara += " AND c.RegisterDate >=" + this.txtStartTime.Text; | 
					
						
							|  |  |  |  |             //} | 
					
						
							|  |  |  |  |             //if (!string.IsNullOrEmpty(this.txtEndTime.Text)) | 
					
						
							|  |  |  |  |             //{ | 
					
						
							|  |  |  |  |             //    strSql += " AND h.RegisterDate <=@EndTime"; | 
					
						
							|  |  |  |  |             //    listStr.Add(new SqlParameter("@EndTime", this.txtEndTime.Text)); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             //    cpara += " AND c.RegisterDate <=" + this.txtEndTime.Text; | 
					
						
							|  |  |  |  |             //} | 
					
						
							| 
									
										
										
										
											2023-06-09 18:17:40 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-25 14:46:00 +08:00
										 |  |  |  |             SqlParameter[] parameter = listStr.ToArray(); | 
					
						
							|  |  |  |  |             DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); | 
					
						
							|  |  |  |  |             Grid1.RecordCount = tb.Rows.Count; | 
					
						
							|  |  |  |  |             var table = this.GetPagedDataTable(Grid1, tb); | 
					
						
							|  |  |  |  |             Grid1.DataSource = table; | 
					
						
							|  |  |  |  |             Grid1.DataBind(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         #endregion | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         #region 查询 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 查询 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="sender"></param> | 
					
						
							|  |  |  |  |         /// <param name="e"></param> | 
					
						
							|  |  |  |  |         protected void TextBox_TextChanged(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             this.BindGrid(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         #endregion | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         #region 表排序、分页、关闭窗口 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 分页 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="sender"></param> | 
					
						
							|  |  |  |  |         /// <param name="e"></param> | 
					
						
							|  |  |  |  |         protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             BindGrid(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 排序 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="sender"></param> | 
					
						
							|  |  |  |  |         /// <param name="e"></param> | 
					
						
							|  |  |  |  |         protected void Grid1_Sort(object sender, GridSortEventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             BindGrid(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 分页显示条数下拉框 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="sender"></param> | 
					
						
							|  |  |  |  |         /// <param name="e"></param> | 
					
						
							|  |  |  |  |         protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue); | 
					
						
							|  |  |  |  |             BindGrid(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 关闭弹出窗 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="sender"></param> | 
					
						
							|  |  |  |  |         /// <param name="e"></param> | 
					
						
							|  |  |  |  |         protected void Window1_Close(object sender, WindowCloseEventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             BindGrid(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         #endregion | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         #region Grid双击事件 编辑 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// Grid行双击事件 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="sender"></param> | 
					
						
							|  |  |  |  |         /// <param name="e"></param> | 
					
						
							|  |  |  |  |         protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             EditData(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         ///  | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         private void EditData() | 
					
						
							|  |  |  |  |         { | 
					
						
							| 
									
										
										
										
											2023-03-28 16:44:12 +08:00
										 |  |  |  |             //if (Grid1.SelectedRowIndexArray.Length == 0) | 
					
						
							|  |  |  |  |             //{ | 
					
						
							|  |  |  |  |             //    Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning); | 
					
						
							|  |  |  |  |             //    return; | 
					
						
							|  |  |  |  |             //} | 
					
						
							| 
									
										
										
										
											2023-03-25 14:46:00 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-28 16:44:12 +08:00
										 |  |  |  |             //PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("HJGLWeldingItem.aspx?projectId={0}", Grid1.SelectedRowID, "查看 - "))); | 
					
						
							| 
									
										
										
										
											2023-03-25 14:46:00 +08:00
										 |  |  |  |         } | 
					
						
							|  |  |  |  |         #endregion         | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         protected void btnView_Click(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             EditData(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 总工时数 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="state"></param> | 
					
						
							|  |  |  |  |         /// <returns></returns> | 
					
						
							|  |  |  |  |         protected decimal Count1(object projectId) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             decimal cout1 = 0; | 
					
						
							|  |  |  |  |             if (projectId != null) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 var getD1 = from x in Funs.DB.HJGL_FL_TotalQuantity | 
					
						
							|  |  |  |  |                             where x.ProjectId == projectId.ToString() | 
					
						
							|  |  |  |  |                             select x; | 
					
						
							|  |  |  |  |                 if (getD1.Count() > 0) | 
					
						
							|  |  |  |  |                 { | 
					
						
							| 
									
										
										
										
											2023-03-28 16:44:12 +08:00
										 |  |  |  |                     foreach (var item in getD1) | 
					
						
							|  |  |  |  |                     { | 
					
						
							| 
									
										
										
										
											2023-06-07 18:55:33 +08:00
										 |  |  |  |                         cout1 += Funs.GetNewDecimalOrZero(item.TotalWeldQuantity); | 
					
						
							| 
									
										
										
										
											2023-03-28 16:44:12 +08:00
										 |  |  |  |                     } | 
					
						
							| 
									
										
										
										
											2023-03-25 14:46:00 +08:00
										 |  |  |  |                 } | 
					
						
							| 
									
										
										
										
											2023-06-09 18:17:40 +08:00
										 |  |  |  |                 else | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     var getD2 = (from x in Funs.DB.HJGL_FL_Data | 
					
						
							|  |  |  |  |                                  where x.ProjectId == projectId.ToString() | 
					
						
							|  |  |  |  |                                  orderby x.CompileDate descending | 
					
						
							|  |  |  |  |                                  select x).FirstOrDefault(); | 
					
						
							|  |  |  |  |                     if (getD2 != null) | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         cout1 = Funs.GetNewDecimalOrZero(getD2.TotalWeldQuantity); | 
					
						
							|  |  |  |  |                     } | 
					
						
							|  |  |  |  |                 } | 
					
						
							| 
									
										
										
										
											2023-03-25 14:46:00 +08:00
										 |  |  |  |             } | 
					
						
							|  |  |  |  |             return cout1; | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 损失工时数 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="state"></param> | 
					
						
							|  |  |  |  |         /// <returns></returns> | 
					
						
							|  |  |  |  |         protected decimal Count2(object projectId) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             decimal cout1 = 0; | 
					
						
							|  |  |  |  |             if (projectId != null) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 var datetime1 = Funs.GetNewDateTime(this.txtStartTime.Text); | 
					
						
							|  |  |  |  |                 var datetime2 = Funs.GetNewDateTime(this.txtStartTime.Text); | 
					
						
							| 
									
										
										
										
											2023-03-28 16:44:12 +08:00
										 |  |  |  |                 var getD1 = from x in Funs.DB.HJGL_FL_TotalQuantity | 
					
						
							|  |  |  |  |                             where x.ProjectId == projectId.ToString() | 
					
						
							|  |  |  |  |                             select x; | 
					
						
							| 
									
										
										
										
											2023-03-25 14:46:00 +08:00
										 |  |  |  |                 if (getD1.Count() > 0) | 
					
						
							|  |  |  |  |                 { | 
					
						
							| 
									
										
										
										
											2023-03-28 16:44:12 +08:00
										 |  |  |  |                     foreach (var item in getD1) | 
					
						
							|  |  |  |  |                     { | 
					
						
							| 
									
										
										
										
											2023-06-07 18:55:33 +08:00
										 |  |  |  |                         cout1 += Funs.GetNewDecimalOrZero(item.TotalCompleted); | 
					
						
							| 
									
										
										
										
											2023-03-28 16:44:12 +08:00
										 |  |  |  |                     } | 
					
						
							| 
									
										
										
										
											2023-03-25 14:46:00 +08:00
										 |  |  |  |                 } | 
					
						
							| 
									
										
										
										
											2023-06-09 18:17:40 +08:00
										 |  |  |  |                 else | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     var getD2 = (from x in Funs.DB.HJGL_FL_Data | 
					
						
							|  |  |  |  |                                  where x.ProjectId == projectId.ToString() | 
					
						
							|  |  |  |  |                                  orderby x.CompileDate descending | 
					
						
							|  |  |  |  |                                  select x).FirstOrDefault(); | 
					
						
							|  |  |  |  |                     if (getD2 != null) | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         cout1 = Funs.GetNewDecimalOrZero(getD2.TotalCompleted); | 
					
						
							|  |  |  |  |                     } | 
					
						
							|  |  |  |  |                 } | 
					
						
							| 
									
										
										
										
											2023-03-25 14:46:00 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             return cout1; | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 焊接数据数 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="state"></param> | 
					
						
							|  |  |  |  |         /// <returns></returns> | 
					
						
							|  |  |  |  |         protected decimal Count3(object projectId) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             decimal cout1 = 0; | 
					
						
							|  |  |  |  |             if (projectId != null) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 var datetime1 = Funs.GetNewDateTime(this.txtStartTime.Text); | 
					
						
							|  |  |  |  |                 var datetime2 = Funs.GetNewDateTime(this.txtStartTime.Text); | 
					
						
							|  |  |  |  |                 var getD1 = from x in Funs.DB.HJGL_FL_NdtList | 
					
						
							|  |  |  |  |                             where x.ProjectId == projectId.ToString() | 
					
						
							|  |  |  |  |                             select x; | 
					
						
							|  |  |  |  |                 if (getD1.Count() > 0) | 
					
						
							|  |  |  |  |                 { | 
					
						
							| 
									
										
										
										
											2023-03-28 16:44:12 +08:00
										 |  |  |  |                     foreach (var item in getD1) | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         cout1 += Funs.GetNewIntOrZero(item.OneTimeFilmAmount); | 
					
						
							|  |  |  |  |                     } | 
					
						
							| 
									
										
										
										
											2023-03-25 14:46:00 +08:00
										 |  |  |  |                 } | 
					
						
							| 
									
										
										
										
											2023-06-09 18:17:40 +08:00
										 |  |  |  |                 else | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     var getD2 = (from x in Funs.DB.HJGL_FL_Data | 
					
						
							|  |  |  |  |                                  where x.ProjectId == projectId.ToString() | 
					
						
							|  |  |  |  |                                  orderby x.CompileDate descending | 
					
						
							|  |  |  |  |                                  select x).FirstOrDefault(); | 
					
						
							|  |  |  |  |                     if (getD2 != null) | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         cout1 = Funs.GetNewDecimalOrZero(getD2.OneTimeFilmAmount); | 
					
						
							|  |  |  |  |                     } | 
					
						
							|  |  |  |  |                 } | 
					
						
							| 
									
										
										
										
											2023-03-25 14:46:00 +08:00
										 |  |  |  |             } | 
					
						
							|  |  |  |  |             return cout1; | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 焊接数据数 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="state"></param> | 
					
						
							|  |  |  |  |         /// <returns></returns> | 
					
						
							|  |  |  |  |         protected decimal Count4(object projectId) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             decimal cout1 = 0; | 
					
						
							|  |  |  |  |             if (projectId != null) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 var datetime1 = Funs.GetNewDateTime(this.txtStartTime.Text); | 
					
						
							|  |  |  |  |                 var datetime2 = Funs.GetNewDateTime(this.txtStartTime.Text); | 
					
						
							|  |  |  |  |                 var getD1 = from x in Funs.DB.HJGL_FL_NdtList | 
					
						
							|  |  |  |  |                             where x.ProjectId == projectId.ToString() | 
					
						
							|  |  |  |  |                             select x; | 
					
						
							|  |  |  |  |                 if (getD1.Count() > 0) | 
					
						
							|  |  |  |  |                 { | 
					
						
							| 
									
										
										
										
											2023-03-28 16:44:12 +08:00
										 |  |  |  |                     foreach (var item in getD1) | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         cout1 += Funs.GetNewIntOrZero(item.OneTimeFilmQualifiedAmount); | 
					
						
							|  |  |  |  |                     } | 
					
						
							| 
									
										
										
										
											2023-03-25 14:46:00 +08:00
										 |  |  |  |                 } | 
					
						
							| 
									
										
										
										
											2023-06-09 18:17:40 +08:00
										 |  |  |  |                 else | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     var getD2 = (from x in Funs.DB.HJGL_FL_Data | 
					
						
							|  |  |  |  |                                  where x.ProjectId == projectId.ToString() | 
					
						
							|  |  |  |  |                                  orderby x.CompileDate descending | 
					
						
							|  |  |  |  |                                  select x).FirstOrDefault(); | 
					
						
							|  |  |  |  |                     if (getD2 != null) | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         cout1 = Funs.GetNewDecimalOrZero(getD2.OneTimeFilmQualifiedAmount); | 
					
						
							|  |  |  |  |                     } | 
					
						
							|  |  |  |  |                 } | 
					
						
							| 
									
										
										
										
											2023-03-25 14:46:00 +08:00
										 |  |  |  |             } | 
					
						
							|  |  |  |  |             return cout1; | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  | } |