| 
									
										
										
										
											2022-06-06 11:23:24 +08:00
										 |  |  |  | using BLL; | 
					
						
							|  |  |  |  | using Newtonsoft.Json.Linq; | 
					
						
							|  |  |  |  | using System; | 
					
						
							|  |  |  |  | using System.Collections.Generic; | 
					
						
							|  |  |  |  | using System.Data; | 
					
						
							|  |  |  |  | using System.Data.SqlClient; | 
					
						
							|  |  |  |  | using System.Linq; | 
					
						
							|  |  |  |  | using System.Web; | 
					
						
							|  |  |  |  | using System.Web.UI; | 
					
						
							|  |  |  |  | using System.Web.UI.WebControls; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | namespace FineUIPro.Web.HJGL.FL | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     public partial class Quantity : PageBase | 
					
						
							|  |  |  |  |     { | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 加载页面 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="sender"></param> | 
					
						
							|  |  |  |  |         /// <param name="e"></param> | 
					
						
							|  |  |  |  |         protected void Page_Load(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             if (!IsPostBack) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 this.ddlPageSize.SelectedValue = Grid1.PageSize.ToString(); | 
					
						
							|  |  |  |  |                 // 绑定表格 | 
					
						
							|  |  |  |  |                 this.BindGrid(); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							| 
									
										
										
										
											2022-09-14 16:38:27 +08:00
										 |  |  |  |         /// 内网进入软件 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="sender"></param> | 
					
						
							|  |  |  |  |         /// <param name="e"></param> | 
					
						
							|  |  |  |  |         protected void btnUrlN_Click(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							| 
									
										
										
										
											2024-04-08 09:51:43 +08:00
										 |  |  |  |             PageContext.RegisterStartupScript(String.Format("window.open('https://4dgd.cwcec.com/');")); | 
					
						
							| 
									
										
										
										
											2022-09-14 16:38:27 +08:00
										 |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							| 
									
										
										
										
											2022-06-06 11:23:24 +08:00
										 |  |  |  |         /// 获取 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="sender"></param> | 
					
						
							|  |  |  |  |         /// <param name="e"></param> | 
					
						
							|  |  |  |  |         protected void btnGet_Click(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             Model.SGGLDB db = Funs.DB; | 
					
						
							|  |  |  |  |             var HJGL_FL_Quantitys = from x in db.HJGL_FL_Quantity where x.ProjectId == this.CurrUser.LoginProjectId select x; | 
					
						
							|  |  |  |  |             if (HJGL_FL_Quantitys.Count() > 0) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 db.HJGL_FL_Quantity.DeleteAllOnSubmit(HJGL_FL_Quantitys); | 
					
						
							|  |  |  |  |                 db.SubmitChanges(); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             var project = db.Base_Project.FirstOrDefault(x => x.ProjectId == this.CurrUser.LoginProjectId); | 
					
						
							|  |  |  |  |             if (project != null && !string.IsNullOrEmpty(project.HJProjectCode)) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 //项目焊接工程量 | 
					
						
							|  |  |  |  |                 DateTime yesterday = DateTime.Now.Date.AddDays(-1); | 
					
						
							|  |  |  |  |                 DateTime lastday = yesterday.AddDays(-7); | 
					
						
							|  |  |  |  |                 if (!string.IsNullOrEmpty(this.txtStartTime.Text.Trim())) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     lastday = Convert.ToDateTime(this.txtStartTime.Text.Trim()); | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |                 if (!string.IsNullOrEmpty(this.txtEndTime.Text.Trim())) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     yesterday = Convert.ToDateTime(this.txtEndTime.Text.Trim()); | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |                 string yesterdayStr = string.Format("{0:yyyy-MM-dd}", yesterday); | 
					
						
							|  |  |  |  |                 string lastdayStr = string.Format("{0:yyyy-MM-dd}", lastday); | 
					
						
							| 
									
										
										
										
											2025-01-16 11:24:15 +08:00
										 |  |  |  |                 var str3 = APIGetHttpService.Http("https://4dgd.cwcec.com:443/csm/third/getWeldingEngineeringList/" + project.HJProjectCode + "/date/" + yesterdayStr + "/" + lastdayStr + "/" + yesterdayStr, "GET"); | 
					
						
							| 
									
										
										
										
											2022-06-06 11:23:24 +08:00
										 |  |  |  |                 if (!string.IsNullOrEmpty(str3)) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     JArray arr1 = JArray.Parse(str3); | 
					
						
							|  |  |  |  |                     foreach (var item1 in arr1) | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         Model.HJGL_FL_Quantity tq = new Model.HJGL_FL_Quantity(); | 
					
						
							|  |  |  |  |                         tq.QuantityId = SQLHelper.GetNewID(); | 
					
						
							|  |  |  |  |                         tq.ProjectId = project.ProjectId; | 
					
						
							|  |  |  |  |                         tq.DeviceName = item1["deviceName"].ToString(); | 
					
						
							|  |  |  |  |                         tq.DeviceNumber = item1["deviceNumber"].ToString(); | 
					
						
							|  |  |  |  |                         tq.UnitName = item1["unitName"].ToString(); | 
					
						
							|  |  |  |  |                         tq.ZoneNumber = item1["zoneNumber"].ToString(); | 
					
						
							|  |  |  |  |                         tq.InchesDiameterTotal = item1["inchesDiameterTotal"].ToString(); | 
					
						
							|  |  |  |  |                         tq.InchesDiameterFinish = item1["inchesDiameterFinish"].ToString(); | 
					
						
							|  |  |  |  |                         tq.YesterdayFinish = item1["yesterdayFinish"].ToString(); | 
					
						
							|  |  |  |  |                         tq.WeekInchesDiameterPlan = item1["weekInchesDiameterPlan"].ToString(); | 
					
						
							|  |  |  |  |                         tq.WeekInchesDiameterFinish = item1["weekInchesDiameterFinish"].ToString(); | 
					
						
							|  |  |  |  |                         db.HJGL_FL_Quantity.InsertOnSubmit(tq); | 
					
						
							|  |  |  |  |                         db.SubmitChanges(); | 
					
						
							|  |  |  |  |                         ShowNotify("获取成功!", MessageBoxIcon.Success); | 
					
						
							|  |  |  |  |                     } | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             else | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 ShowNotify("请确认项目已使用4D系统,并已在项目信息中设置了对应的焊接软件项目编号!", MessageBoxIcon.Warning); | 
					
						
							|  |  |  |  |                 return; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             this.BindGrid(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 绑定数据 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         private void BindGrid() | 
					
						
							|  |  |  |  |         { | 
					
						
							| 
									
										
										
										
											2022-09-19 09:35:49 +08:00
										 |  |  |  |             string strSql = @"select *,
 | 
					
						
							|  |  |  |  |                             (select top 1 TotalWeldQuantity from HJGL_FL_TotalQuantity q where q.ProjectId=@ProjectId and q.DeviceCode=c.ZoneNumber) as TotalWeldQuantity, | 
					
						
							|  |  |  |  |                             cast((case when c.WeekInchesDiameterPlan='0' or c.WeekInchesDiameterPlan='' then 0 when c.WeekInchesDiameterFinish='0' or c.WeekInchesDiameterFinish='' then 0 else 100.0 * cast(c.WeekInchesDiameterFinish as DECIMAL(9,2))/(1.0 * cast(c.WeekInchesDiameterPlan as DECIMAL(9,2))) end) AS DECIMAL(9,2)) as WeekRate, | 
					
						
							|  |  |  |  |                             cast((case when (select top 1 TotalWeldQuantity from HJGL_FL_TotalQuantity q where q.ProjectId=@ProjectId and q.DeviceCode=c.ZoneNumber)='0' or (select top 1 TotalWeldQuantity from HJGL_FL_TotalQuantity q where q.ProjectId=@ProjectId and q.DeviceCode=c.ZoneNumber)='' then 0 when c.InchesDiameterFinish='0' or c.InchesDiameterFinish='' then 0 else 100.0 * cast(c.InchesDiameterFinish as DECIMAL(9,2))/(1.0 * cast((select top 1 TotalWeldQuantity from HJGL_FL_TotalQuantity q where q.ProjectId=@ProjectId and q.DeviceCode=c.ZoneNumber) as DECIMAL(9,2))) end) AS DECIMAL(9,2)) as Rate | 
					
						
							| 
									
										
										
										
											2022-06-06 11:23:24 +08:00
										 |  |  |  |                             from dbo.HJGL_FL_Quantity c  | 
					
						
							|  |  |  |  |                             where c.ProjectId=@ProjectId order by c.DeviceName,DeviceNumber,ZoneNumber ";
 | 
					
						
							|  |  |  |  |             List<SqlParameter> listStr = new List<SqlParameter>(); | 
					
						
							|  |  |  |  |             listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId)); | 
					
						
							|  |  |  |  |             SqlParameter[] parameter = listStr.ToArray(); | 
					
						
							|  |  |  |  |             DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); | 
					
						
							|  |  |  |  |             Grid1.RecordCount = tb.Rows.Count; | 
					
						
							|  |  |  |  |             //tb = GetFilteredTable(Grid1.FilteredData, tb); | 
					
						
							|  |  |  |  |             var table = this.GetPagedDataTable(Grid1, tb); | 
					
						
							|  |  |  |  |             Grid1.DataSource = table; | 
					
						
							|  |  |  |  |             Grid1.DataBind(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         #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 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 Grid1_Sort(object sender, FineUIPro.GridSortEventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             BindGrid(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         #endregion | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  | } |