提交代码
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
using BLL;
|
||||
using Model;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Org.BouncyCastle.Asn1.Ocsp;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Linq;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
@@ -78,7 +80,7 @@ namespace FineUIPro.Web.ZHGL.Environmental
|
||||
if (report != null)
|
||||
{
|
||||
//this.btnCopy.Hidden = true;
|
||||
//if (this.CurrUser.PersonId == BLL.Const.sysglyId || this.CurrUser.PersonId == BLL.Const.hfnbdId)
|
||||
//if (this.CurrUser.UserId == BLL.Const.sysglyId || this.CurrUser.UserId == BLL.Const.hfnbdId)
|
||||
//{
|
||||
// this.btnSave.Hidden = false;
|
||||
//}
|
||||
@@ -113,11 +115,11 @@ namespace FineUIPro.Web.ZHGL.Environmental
|
||||
}
|
||||
else
|
||||
{
|
||||
string arg = GetRequestEventArgument(); // 此函数所在文件:PageBase.cs
|
||||
if (arg == "UPDATE_SUMMARY")
|
||||
{
|
||||
SaveData();
|
||||
}
|
||||
//string arg = GetRequestEventArgument(); // 此函数所在文件:PageBase.cs
|
||||
//if (arg == "UPDATE_SUMMARY")
|
||||
//{
|
||||
// SaveData();
|
||||
//}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -129,7 +131,8 @@ namespace FineUIPro.Web.ZHGL.Environmental
|
||||
{
|
||||
JObject values = mergedRow.Value<JObject>("values");
|
||||
string sortIndex = values.Value<string>("SortIndex");
|
||||
var newItem = items.FirstOrDefault(x => x.SortIndex == sortIndex);
|
||||
var SortUnit = values.Value<int>("SortUnit");
|
||||
var newItem = items.FirstOrDefault(x => x.SortIndex == sortIndex && x.SortUnit == SortUnit);
|
||||
if (newItem != null)
|
||||
{
|
||||
newItem.EnergyReportItemId = SQLHelper.GetNewID();
|
||||
@@ -137,17 +140,17 @@ namespace FineUIPro.Web.ZHGL.Environmental
|
||||
newItem.SortIndex = values.Value<string>("SortIndex");
|
||||
newItem.BusinessCategory = values.Value<string>("BusinessCategory");
|
||||
newItem.Throughput_BasePeriod = Funs.GetNewDecimalOrZero(values.Value<string>("Throughput_BasePeriod")).ToString();
|
||||
newItem.Throughput_LastPeriod = Funs.GetNewDecimalOrZero(values.Value<string>("Throughput_LastPeriod")).ToString();
|
||||
newItem.Throughput_ThisPeriod = Funs.GetNewDecimalOrZero(values.Value<string>("Throughput_ThisPeriod")).ToString();
|
||||
newItem.Throughput_LastPeriod = Funs.GetNewDecimalOrZero(values.Value<string>("Throughput_LastPeriod")).ToString();
|
||||
newItem.Throughput_ThisPeriod = Funs.GetNewDecimalOrZero(values.Value<string>("Throughput_ThisPeriod")).ToString();
|
||||
newItem.Throughput_UnitOfMeasurement = values.Value<string>("Throughput_UnitOfMeasurement");
|
||||
newItem.Yield_BasePeriod = Funs.GetNewDecimalOrZero(values.Value<string>("Yield_BasePeriod")).ToString();
|
||||
newItem.Yield_LastPeriod = Funs.GetNewDecimalOrZero(values.Value<string>("Yield_LastPeriod")).ToString();
|
||||
newItem.Yield_ThisPeriod = Funs.GetNewDecimalOrZero(values.Value<string>("Yield_ThisPeriod")).ToString();
|
||||
newItem.Yield_BasePeriod = Funs.GetNewDecimalOrZero(values.Value<string>("Yield_BasePeriod")).ToString();
|
||||
newItem.Yield_LastPeriod = Funs.GetNewDecimalOrZero(values.Value<string>("Yield_LastPeriod")).ToString();
|
||||
newItem.Yield_ThisPeriod = Funs.GetNewDecimalOrZero(values.Value<string>("Yield_ThisPeriod")).ToString();
|
||||
newItem.Yield_UnitOfMeasurement = values.Value<string>("Yield_UnitOfMeasurement");
|
||||
newItem.OutputValue_BasePeriod = Funs.GetNewDecimalOrZero(values.Value<string>("OutputValue_BasePeriod")).ToString();
|
||||
newItem.OutputValue_LastYear = Funs.GetNewDecimalOrZero(values.Value<string>("OutputValue_LastYear")).ToString();
|
||||
newItem.OutputValue_ThisYear = Funs.GetNewDecimalOrZero(values.Value<string>("OutputValue_ThisYear")).ToString();
|
||||
newItem.OperationScale_BasePeriod = Funs.GetNewDecimalOrZero(values.Value<string>("OperationScale_BasePeriod")).ToString();
|
||||
newItem.OutputValue_BasePeriod = Funs.GetNewDecimalOrZero(values.Value<string>("OutputValue_BasePeriod")).ToString();
|
||||
newItem.OutputValue_LastYear = Funs.GetNewDecimalOrZero(values.Value<string>("OutputValue_LastYear")).ToString();
|
||||
newItem.OutputValue_ThisYear = Funs.GetNewDecimalOrZero(values.Value<string>("OutputValue_ThisYear")).ToString();
|
||||
newItem.OperationScale_BasePeriod = Funs.GetNewDecimalOrZero(values.Value<string>("OperationScale_BasePeriod")).ToString();
|
||||
newItem.OperationScale_LastYear = Funs.GetNewDecimalOrZero(values.Value<string>("OperationScale_LastYear")).ToString();
|
||||
newItem.OperationScale_ThisYear = Funs.GetNewDecimalOrZero(values.Value<string>("OperationScale_ThisYear")).ToString();
|
||||
newItem.OperationScale_UnitOfMeasurement = values.Value<string>("OperationScale_UnitOfMeasurement");
|
||||
@@ -203,18 +206,27 @@ namespace FineUIPro.Web.ZHGL.Environmental
|
||||
|
||||
protected void Grid1_RowDataBound(object sender, GridRowEventArgs e)
|
||||
{
|
||||
Model.Environmental_EnergyReportItem a = (Model.Environmental_EnergyReportItem)e.DataItem;
|
||||
Model.Environmental_EnergyReportItem a = (Model.Environmental_EnergyReportItem)e.DataItem;
|
||||
e.DataItem.ToString();
|
||||
|
||||
//string SortIndex = Convert.ToString(row["SortIndex"]);
|
||||
if (a.SortIndex == "01")
|
||||
{
|
||||
|
||||
|
||||
for (int i = 0; i < e.CellCssClasses.Count(); i++)
|
||||
{
|
||||
e.CellCssClasses[i] = "f-grid-cell-uneditable";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//合计行全部禁止输入
|
||||
if (a.SortUnit == 1)
|
||||
{
|
||||
for (int i = 0; i < e.CellCssClasses.Count(); i++)
|
||||
{
|
||||
e.CellCssClasses[i] = "f-grid-cell-uneditable";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -281,35 +293,14 @@ namespace FineUIPro.Web.ZHGL.Environmental
|
||||
EnergyReportId = report.EnergyReportId;
|
||||
BLL.EnergyreportItemService.DeleteEnergyReportItemByChemicalReportId(report.EnergyReportId);
|
||||
GetItems(report.EnergyReportId);
|
||||
List<Model.Environmental_EnergyReportItem> mReportItemList = new List<Environmental_EnergyReportItem>();
|
||||
foreach (var item in items)
|
||||
if (items.Count > 0)
|
||||
{
|
||||
Model.Environmental_EnergyReportItem newItem = new Environmental_EnergyReportItem();
|
||||
newItem.EnergyReportItemId = item.EnergyReportItemId;
|
||||
newItem.EnergyReportId = item.EnergyReportId;
|
||||
newItem.SortIndex = item.SortIndex;
|
||||
newItem.BusinessCategory = item.BusinessCategory;
|
||||
newItem.Throughput_BasePeriod = item.Throughput_BasePeriod;
|
||||
newItem.Throughput_LastPeriod = item.Throughput_LastPeriod;
|
||||
newItem.Throughput_ThisPeriod = item.Throughput_ThisPeriod;
|
||||
newItem.Throughput_UnitOfMeasurement = item.Throughput_UnitOfMeasurement;
|
||||
newItem.Yield_BasePeriod = item.Yield_BasePeriod;
|
||||
newItem.Yield_LastPeriod = item.Yield_LastPeriod;
|
||||
newItem.Yield_ThisPeriod = item.Yield_ThisPeriod;
|
||||
newItem.Yield_UnitOfMeasurement = item.Yield_UnitOfMeasurement;
|
||||
newItem.OutputValue_BasePeriod = item.OutputValue_BasePeriod;
|
||||
newItem.OutputValue_LastYear = item.OutputValue_LastYear;
|
||||
newItem.OutputValue_ThisYear = item.OutputValue_ThisYear;
|
||||
newItem.OperationScale_BasePeriod = item.OperationScale_BasePeriod;
|
||||
newItem.OperationScale_LastYear = item.OperationScale_LastYear;
|
||||
newItem.OperationScale_ThisYear = item.OperationScale_ThisYear;
|
||||
newItem.OperationScale_UnitOfMeasurement = item.OperationScale_UnitOfMeasurement;
|
||||
newItem.ServiceOperatingIncome_BasePeriod = item.ServiceOperatingIncome_BasePeriod;
|
||||
newItem.ServiceOperatingIncome_LastYear = item.ServiceOperatingIncome_LastYear;
|
||||
newItem.ServiceOperatingIncome_ThisYear = item.ServiceOperatingIncome_ThisYear;
|
||||
EnergyreportItemService.AddEnvironmental_EnergyReportItem(newItem);
|
||||
mReportItemList.Add(newItem);
|
||||
Funs.DB.Environmental_EnergyReportItem.InsertAllOnSubmit(items);
|
||||
Funs.DB.SubmitChanges();
|
||||
////计算合计
|
||||
//UpdateEnvironmental_EnergyReportItem(EnergyReportId);
|
||||
}
|
||||
|
||||
if (type == "updata") //数据同步
|
||||
{
|
||||
if (report.UpState == BLL.Const.UpState_2)
|
||||
@@ -321,6 +312,10 @@ namespace FineUIPro.Web.ZHGL.Environmental
|
||||
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
||||
return;
|
||||
}
|
||||
else if (code == "3")
|
||||
{
|
||||
Alert.ShowInParent("集团当前季度数据已锁定,无法上传!", MessageBoxIcon.Error);
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert.ShowInParent("同步异常,请退出后重试!", MessageBoxIcon.Error);
|
||||
@@ -361,7 +356,8 @@ namespace FineUIPro.Web.ZHGL.Environmental
|
||||
{
|
||||
JObject values = mergedRow.Value<JObject>("values");
|
||||
string sortIndex = values.Value<string>("SortIndex");
|
||||
var newItem = items.FirstOrDefault(x => x.SortIndex == sortIndex);
|
||||
var SortUnit = values.Value<int>("SortUnit");
|
||||
var newItem = items.FirstOrDefault(x => x.SortIndex == sortIndex && x.SortUnit == SortUnit);
|
||||
if (newItem != null)
|
||||
{
|
||||
newItem.EnergyReportItemId = SQLHelper.GetNewID();
|
||||
@@ -390,11 +386,63 @@ namespace FineUIPro.Web.ZHGL.Environmental
|
||||
}
|
||||
}
|
||||
items = newItemLists;
|
||||
//计算合计
|
||||
getAllSum();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 保存明细之前计算合计
|
||||
private void getAllSum()
|
||||
{
|
||||
items.ForEach(x =>
|
||||
{
|
||||
//需要合计的时候
|
||||
if (x.SortUnit == 1)
|
||||
{
|
||||
if (x.BusinessCategory == "合计")
|
||||
{
|
||||
x.Throughput_BasePeriod = items.Where(y => y.SortUnit != 1).Sum(y => Funs.GetNewDecimalOrZero(y.Throughput_BasePeriod)).ToString();
|
||||
x.Throughput_LastPeriod = items.Where(y => y.SortUnit != 1).Sum(y => Funs.GetNewDecimalOrZero(y.Throughput_LastPeriod)).ToString();
|
||||
x.Throughput_ThisPeriod = items.Where(y => y.SortUnit != 1).Sum(y => Funs.GetNewDecimalOrZero(y.Throughput_ThisPeriod)).ToString();
|
||||
x.Yield_BasePeriod = items.Where(y => y.SortUnit != 1).Sum(y => Funs.GetNewDecimalOrZero(y.Yield_BasePeriod)).ToString();
|
||||
x.Yield_LastPeriod = items.Where(y => y.SortUnit != 1).Sum(y => Funs.GetNewDecimalOrZero(y.Yield_LastPeriod)).ToString();
|
||||
x.Yield_ThisPeriod = items.Where(y => y.SortUnit != 1).Sum(y => Funs.GetNewDecimalOrZero(y.Yield_ThisPeriod)).ToString();
|
||||
x.OutputValue_BasePeriod = items.Where(y => y.SortUnit != 1).Sum(y => Funs.GetNewDecimalOrZero(y.OutputValue_BasePeriod)).ToString();
|
||||
x.OutputValue_LastYear = items.Where(y => y.SortUnit != 1).Sum(y => Funs.GetNewDecimalOrZero(y.OutputValue_LastYear)).ToString();
|
||||
x.OutputValue_ThisYear = items.Where(y => y.SortUnit != 1).Sum(y => Funs.GetNewDecimalOrZero(y.OutputValue_ThisYear)).ToString();
|
||||
x.OperationScale_BasePeriod = items.Where(y => y.SortUnit != 1).Sum(y => Funs.GetNewDecimalOrZero(y.OperationScale_BasePeriod)).ToString();
|
||||
x.OperationScale_LastYear = items.Where(y => y.SortUnit != 1).Sum(y => Funs.GetNewDecimalOrZero(y.OperationScale_LastYear)).ToString();
|
||||
x.OperationScale_ThisYear = items.Where(y => y.SortUnit != 1).Sum(y => Funs.GetNewDecimalOrZero(y.OperationScale_ThisYear)).ToString();
|
||||
x.ServiceOperatingIncome_BasePeriod = items.Where(y => y.SortUnit != 1).Sum(y => Funs.GetNewDecimalOrZero(y.ServiceOperatingIncome_BasePeriod)).ToString();
|
||||
x.ServiceOperatingIncome_LastYear = items.Where(y => y.SortUnit != 1).Sum(y => Funs.GetNewDecimalOrZero(y.ServiceOperatingIncome_LastYear)).ToString();
|
||||
x.ServiceOperatingIncome_ThisYear = items.Where(y => y.SortUnit != 1).Sum(y => Funs.GetNewDecimalOrZero(y.ServiceOperatingIncome_ThisYear)).ToString();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
x.Throughput_BasePeriod = items.Where(y => y.SortUnit != 1 && y.SortIndex == x.SortIndex).Sum(y => Funs.GetNewDecimalOrZero(y.Throughput_BasePeriod)).ToString();
|
||||
x.Throughput_LastPeriod = items.Where(y => y.SortUnit != 1 && y.SortIndex == x.SortIndex).Sum(y => Funs.GetNewDecimalOrZero(y.Throughput_LastPeriod)).ToString();
|
||||
x.Throughput_ThisPeriod = items.Where(y => y.SortUnit != 1 && y.SortIndex == x.SortIndex).Sum(y => Funs.GetNewDecimalOrZero(y.Throughput_ThisPeriod)).ToString();
|
||||
x.Yield_BasePeriod = items.Where(y => y.SortUnit != 1 && y.SortIndex == x.SortIndex).Sum(y => Funs.GetNewDecimalOrZero(y.Yield_BasePeriod)).ToString();
|
||||
x.Yield_LastPeriod = items.Where(y => y.SortUnit != 1 && y.SortIndex == x.SortIndex).Sum(y => Funs.GetNewDecimalOrZero(y.Yield_LastPeriod)).ToString();
|
||||
x.Yield_ThisPeriod = items.Where(y => y.SortUnit != 1 && y.SortIndex == x.SortIndex).Sum(y => Funs.GetNewDecimalOrZero(y.Yield_ThisPeriod)).ToString();
|
||||
x.OutputValue_BasePeriod = items.Where(y => y.SortUnit != 1 && y.SortIndex == x.SortIndex).Sum(y => Funs.GetNewDecimalOrZero(y.OutputValue_BasePeriod)).ToString();
|
||||
x.OutputValue_LastYear = items.Where(y => y.SortUnit != 1 && y.SortIndex == x.SortIndex).Sum(y => Funs.GetNewDecimalOrZero(y.OutputValue_LastYear)).ToString();
|
||||
x.OutputValue_ThisYear = items.Where(y => y.SortUnit != 1 && y.SortIndex == x.SortIndex).Sum(y => Funs.GetNewDecimalOrZero(y.OutputValue_ThisYear)).ToString();
|
||||
x.OperationScale_BasePeriod = items.Where(y => y.SortUnit != 1 && y.SortIndex == x.SortIndex).Sum(y => Funs.GetNewDecimalOrZero(y.OperationScale_BasePeriod)).ToString();
|
||||
x.OperationScale_LastYear = items.Where(y => y.SortUnit != 1 && y.SortIndex == x.SortIndex).Sum(y => Funs.GetNewDecimalOrZero(y.OperationScale_LastYear)).ToString();
|
||||
x.OperationScale_ThisYear = items.Where(y => y.SortUnit != 1 && y.SortIndex == x.SortIndex).Sum(y => Funs.GetNewDecimalOrZero(y.OperationScale_ThisYear)).ToString();
|
||||
x.ServiceOperatingIncome_BasePeriod = items.Where(y => y.SortUnit != 1 && y.SortIndex == x.SortIndex).Sum(y => Funs.GetNewDecimalOrZero(y.ServiceOperatingIncome_BasePeriod)).ToString();
|
||||
x.ServiceOperatingIncome_LastYear = items.Where(y => y.SortUnit != 1 && y.SortIndex == x.SortIndex).Sum(y => Funs.GetNewDecimalOrZero(y.ServiceOperatingIncome_LastYear)).ToString();
|
||||
x.ServiceOperatingIncome_ThisYear = items.Where(y => y.SortUnit != 1 && y.SortIndex == x.SortIndex).Sum(y => Funs.GetNewDecimalOrZero(y.ServiceOperatingIncome_ThisYear)).ToString();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 获取明细
|
||||
private void GetNewItems(int year, int Quarters)
|
||||
private void GetNewItems(int year, int Quarters)
|
||||
{
|
||||
var indexNames = EnergyreportItemService.GetItems("Template");
|
||||
foreach (var indexName in indexNames)
|
||||
@@ -405,11 +453,48 @@ namespace FineUIPro.Web.ZHGL.Environmental
|
||||
EnergyReportItemId = SQLHelper.GetNewID(typeof(Model.Environmental_EnergyReportItem)),
|
||||
BusinessCategory = indexName.BusinessCategory,
|
||||
SortIndex = indexName.SortIndex,
|
||||
SortUnit = indexName.SortUnit
|
||||
};
|
||||
|
||||
items.Add(item);
|
||||
|
||||
//修改2024-10-23 14:15:06
|
||||
#region 循环再次增加各分单位
|
||||
if (item.BusinessCategory != "合计")
|
||||
{
|
||||
//第一个本单位
|
||||
var isthisUnit = CommonService.GetIsThisUnit();
|
||||
|
||||
var model = new Environmental_EnergyReportItem
|
||||
{
|
||||
EnergyReportItemId = SQLHelper.GetNewID(typeof(Model.Environmental_EnergyReportItem)),
|
||||
BusinessCategory = getLenthSpace(indexName.SortIndex) +isthisUnit.UnitName,
|
||||
SortIndex = item.SortIndex,
|
||||
SortUnit = 2,
|
||||
};
|
||||
items.Add(model);
|
||||
//加载分单位
|
||||
var unitList = Funs.DB.Base_Unit.Where(x => x.IsBranch == true).ToList();
|
||||
var j = 3;
|
||||
foreach (var unitItem in unitList)
|
||||
{
|
||||
model = new Environmental_EnergyReportItem
|
||||
{
|
||||
EnergyReportItemId = SQLHelper.GetNewID(typeof(Model.Environmental_EnergyReportItem)),
|
||||
BusinessCategory = getLenthSpace(indexName.SortIndex) +unitItem.UnitName,
|
||||
SortIndex = item.SortIndex,
|
||||
SortUnit = j,
|
||||
};
|
||||
items.Add(model);
|
||||
j++;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
}
|
||||
var ListProjectEnergyItemReport= ProjectEnergyreportItemService.GetItemsByDate(year, Quarters);
|
||||
|
||||
var ListProjectEnergyItemReport = ProjectEnergyreportItemService.GetItemsByDate(year, Quarters);
|
||||
var q = from x in ListProjectEnergyItemReport
|
||||
group x by x.SortIndex into g
|
||||
select new
|
||||
@@ -516,9 +601,9 @@ namespace FineUIPro.Web.ZHGL.Environmental
|
||||
// newChemicalReport.UnitId = this.drpUnit.SelectedValue;
|
||||
// newChemicalReport.Year = Convert.ToInt32(this.drpYear.SelectedValue);
|
||||
// newChemicalReport.Month = Convert.ToInt32(this.drpMonth.SelectedValue);
|
||||
// newChemicalReport.FillingMan = this.CurrUser.PersonName;
|
||||
// newChemicalReport.FillingMan = this.CurrUser.UserName;
|
||||
// newChemicalReport.FillingDate = DateTime.Now;
|
||||
// newChemicalReport.DutyPerson = this.CurrUser.PersonName;
|
||||
// newChemicalReport.DutyPerson = this.CurrUser.UserName;
|
||||
// newChemicalReport.UpState = BLL.Const.UpState_2;
|
||||
// BLL.EnergyReportService.ad(newChemicalReport);
|
||||
|
||||
@@ -567,5 +652,20 @@ namespace FineUIPro.Web.ZHGL.Environmental
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 取具体数量的空格
|
||||
private string getLenthSpace(string SortIndex) {
|
||||
string returnVal = "";
|
||||
if (SortIndex == "02" || SortIndex == "16" || SortIndex == "44")
|
||||
{
|
||||
returnVal += "A";
|
||||
}
|
||||
else {
|
||||
returnVal += "B";
|
||||
}
|
||||
|
||||
return returnVal;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user