151 lines
6.2 KiB
C#
151 lines
6.2 KiB
C#
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 TotalQuantity : 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>
|
||
/// 内网进入软件
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void btnUrlN_Click(object sender, EventArgs e)
|
||
{
|
||
PageContext.RegisterStartupScript(String.Format("window.open('http://192.168.30.40:8102/pcms/');"));
|
||
}
|
||
|
||
/// <summary>
|
||
/// 外网进入软件
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void btnUrlW_Click(object sender, EventArgs e)
|
||
{
|
||
PageContext.RegisterStartupScript(String.Format("window.open('http://221.232.143.174:8102/pcms');"));
|
||
}
|
||
|
||
/// <summary>
|
||
/// 获取
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void btnGet_Click(object sender, EventArgs e)
|
||
{
|
||
var HJGL_FL_TotalQuantitys = from x in Funs.DB.HJGL_FL_TotalQuantity where x.ProjectId == this.CurrUser.LoginProjectId select x;
|
||
if (HJGL_FL_TotalQuantitys.Count() > 0)
|
||
{
|
||
Funs.DB.HJGL_FL_TotalQuantity.DeleteAllOnSubmit(HJGL_FL_TotalQuantitys);
|
||
Funs.DB.SubmitChanges();
|
||
}
|
||
var project = Funs.DB.Base_Project.FirstOrDefault(x => x.ProjectId == this.CurrUser.LoginProjectId);
|
||
if (project != null && !string.IsNullOrEmpty(project.HJProjectCode))
|
||
{
|
||
//项目管道焊接工程量
|
||
var str1 = APIGetHttpService.Http("http://192.168.30.40:8102/csm/third/getPipelineWeldingQuantities/" + project.HJProjectCode, "GET");
|
||
if (!string.IsNullOrEmpty(str1))
|
||
{
|
||
JArray arr1 = JArray.Parse(str1);
|
||
foreach (var item1 in arr1)
|
||
{
|
||
Model.HJGL_FL_TotalQuantity tq = new Model.HJGL_FL_TotalQuantity();
|
||
tq.TotalQuantityId = SQLHelper.GetNewID();
|
||
tq.ProjectId = project.ProjectId;
|
||
tq.DeviceName = item1["deviceName"].ToString();
|
||
tq.DeviceCode = item1["zoneCode"].ToString();
|
||
tq.Unit = item1["unitName"].ToString();
|
||
tq.TotalWeldQuantity = item1["totalWeldingAmount"].ToString();
|
||
tq.TotalCompleted = item1["finishedAmount"].ToString();
|
||
Funs.DB.HJGL_FL_TotalQuantity.InsertOnSubmit(tq);
|
||
Funs.DB.SubmitChanges();
|
||
}
|
||
ShowNotify("获取成功!", MessageBoxIcon.Success);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
ShowNotify("请确认项目已使用4D系统,并已在项目信息中设置了对应的焊接软件项目编号!", MessageBoxIcon.Warning);
|
||
return;
|
||
}
|
||
this.BindGrid();
|
||
}
|
||
|
||
/// <summary>
|
||
/// 绑定数据
|
||
/// </summary>
|
||
private void BindGrid()
|
||
{
|
||
string strSql = @"select TotalQuantityId,ProjectId,DeviceName,DeviceCode,Unit,(case when c.TotalWeldQuantity='0' or c.TotalWeldQuantity='' then 0 else cast(c.TotalWeldQuantity as DECIMAL(9,2)) end) as TotalWeldQuantity,
|
||
(case when c.TotalCompleted='0' or c.TotalCompleted='' then 0 else cast(c.TotalCompleted as DECIMAL(9,2)) end) as TotalCompleted,
|
||
cast((case when c.TotalWeldQuantity='0' or c.TotalWeldQuantity='' then 0 when c.TotalCompleted='0' or c.TotalCompleted='' then 0 else 100.0 * cast(c.TotalCompleted as DECIMAL(9,2))/(1.0 * cast(c.TotalWeldQuantity as DECIMAL(9,2))) end) AS DECIMAL(9,2)) as Rate,
|
||
(select top 1 DeviceNumber from HJGL_FL_Quantity q where q.ProjectId=@ProjectId and q.ZoneNumber=c.DeviceCode) as DeviceNo
|
||
from dbo.HJGL_FL_TotalQuantity c
|
||
where c.ProjectId=@ProjectId order by c.DeviceName,DeviceCode ";
|
||
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
|
||
}
|
||
} |