提交代码
This commit is contained in:
@@ -1,10 +1,8 @@
|
||||
using BLL;
|
||||
using Microsoft.Office.Interop.Excel;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
namespace FineUIPro.Web.ZHGL.Environmental
|
||||
@@ -65,8 +63,10 @@ namespace FineUIPro.Web.ZHGL.Environmental
|
||||
this.btnSave.Hidden = false;
|
||||
this.btnUpdata.Hidden = true;
|
||||
}
|
||||
|
||||
ddlUnitId.SelectedValue = BLL.Const.UnitId_SEDIN;
|
||||
BindGrid(year, quarter, unitId);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,53 +92,59 @@ namespace FineUIPro.Web.ZHGL.Environmental
|
||||
{
|
||||
this.txtCompileMan.Text = operationReport.FillingMan.ToString();
|
||||
}
|
||||
if (!string.IsNullOrWhiteSpace(operationReport.UnitLevel))
|
||||
{
|
||||
this.txtUnitLevel.Text = operationReport.UnitLevel;
|
||||
}
|
||||
if (!string.IsNullOrWhiteSpace(operationReport.Place))
|
||||
{
|
||||
this.txtPlace.Text = operationReport.Place;
|
||||
}
|
||||
//if (!string.IsNullOrWhiteSpace(operationReport.UnitLevel))
|
||||
//{
|
||||
// this.txtUnitLevel.Text = operationReport.UnitLevel;
|
||||
//}
|
||||
//if (!string.IsNullOrWhiteSpace(operationReport.Place))
|
||||
//{
|
||||
// this.txtPlace.Text = operationReport.Place;
|
||||
//}
|
||||
if (operationReport.FillingDate != null)
|
||||
{
|
||||
this.txtFillingDate.Text = operationReport.FillingDate.Value.ToString("yyyy-MM-dd");
|
||||
}
|
||||
if (operationReport.CreateDate != null)
|
||||
{
|
||||
this.txtCreateDate.Text = operationReport.CreateDate.Value.ToString("yyyy-MM-dd");
|
||||
}
|
||||
if (!string.IsNullOrWhiteSpace(operationReport.Code))
|
||||
{
|
||||
this.txtCode.Text = operationReport.Code;
|
||||
}
|
||||
if (operationReport.PersonNum != null)
|
||||
{
|
||||
this.txtPersonNum.Text = operationReport.PersonNum.ToString();
|
||||
}
|
||||
if (operationReport.TotalAssets != null)
|
||||
{
|
||||
this.txtTotalAssets.Text = operationReport.TotalAssets.ToString();
|
||||
}
|
||||
if (operationReport.TotalValue != null)
|
||||
{
|
||||
this.txtTotalValue.Text = operationReport.TotalValue.ToString();
|
||||
}
|
||||
if (operationReport.NewInvestment != null)
|
||||
{
|
||||
this.txtNewInvestment.Text = operationReport.NewInvestment.ToString();
|
||||
}
|
||||
//if (operationReport.CreateDate != null)
|
||||
//{
|
||||
// this.txtCreateDate.Text = operationReport.CreateDate.Value.ToString("yyyy-MM-dd");
|
||||
//}
|
||||
//if (!string.IsNullOrWhiteSpace(operationReport.Code))
|
||||
//{
|
||||
// this.txtCode.Text = operationReport.Code;
|
||||
//}
|
||||
//if (operationReport.PersonNum != null)
|
||||
//{
|
||||
// this.txtPersonNum.Text = operationReport.PersonNum.ToString();
|
||||
//}
|
||||
//if (operationReport.TotalAssets != null)
|
||||
//{
|
||||
// this.txtTotalAssets.Text = operationReport.TotalAssets.ToString();
|
||||
//}
|
||||
//if (operationReport.TotalValue != null)
|
||||
//{
|
||||
// this.txtTotalValue.Text = operationReport.TotalValue.ToString();
|
||||
//}
|
||||
//if (operationReport.NewInvestment != null)
|
||||
//{
|
||||
// this.txtNewInvestment.Text = operationReport.NewInvestment.ToString();
|
||||
//}
|
||||
this.txtStatisticsDutyPerson.Text = operationReport.StatisticsDutyPerson;
|
||||
this.txtUnitDutyPerson.Text = operationReport.UnitDutyPerson;
|
||||
this.txtRemark.Text = operationReport.Remark;
|
||||
|
||||
//根据主表id加载子表
|
||||
var reportItem = Funs.DB.Environmental_OperationReportItem.Where(x => x.BusinessReportId == operationReport.BusinessReportId)
|
||||
.OrderBy(x => x.SortIndex).ToList();
|
||||
|
||||
Grid1.DataSource = reportItem;
|
||||
Grid1.DataBind();
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
#region 不存在则根据项目统计生成
|
||||
this.ddlUnitId.SelectedValue = unitId;
|
||||
//this.ddlUnitId.SelectedValue = unitId;
|
||||
this.drpYear.SelectedValue = year;
|
||||
this.ddlQuarter.SelectedValue = quarter;
|
||||
this.txtFillingDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
|
||||
@@ -151,15 +157,57 @@ namespace FineUIPro.Web.ZHGL.Environmental
|
||||
|
||||
if (items.Any())
|
||||
{
|
||||
this.txtPersonNum.Text = items.Sum(s => s.PersonNum ?? 0).ToString();
|
||||
this.txtTotalAssets.Text = items.Sum(s => s.TotalAssets ?? 0).ToString();
|
||||
this.txtTotalValue.Text = items.Sum(s => s.TotalValue ?? 0).ToString();
|
||||
this.txtNewInvestment.Text = items.Sum(s => s.NewInvestment ?? 0).ToString();
|
||||
//this.txtPersonNum.Text = items.Sum(s => s.PersonNum ?? 0).ToString();
|
||||
//this.txtTotalAssets.Text = items.Sum(s => s.TotalAssets ?? 0).ToString();
|
||||
//this.txtTotalValue.Text = items.Sum(s => s.TotalValue ?? 0).ToString();
|
||||
//this.txtNewInvestment.Text = items.Sum(s => s.NewInvestment ?? 0).ToString();
|
||||
}
|
||||
this.txtCompileMan.Text = this.CurrUser.PersonName;
|
||||
this.txtStatisticsDutyPerson.Text = this.CurrUser.PersonName;
|
||||
this.txtUnitDutyPerson.Text = this.CurrUser.PersonName;
|
||||
|
||||
//加载子表
|
||||
var reportItemlist = new List<Model.Environmental_OperationReportItem>();
|
||||
//第一个本单位
|
||||
var isthisUnit = CommonService.GetIsThisUnit();
|
||||
var reportItemModel = new Model.Environmental_OperationReportItem() {
|
||||
BusinessReportItemId = Guid.NewGuid().ToString(),
|
||||
SortIndex = 1,
|
||||
UnitName = isthisUnit.UnitName,
|
||||
SortUnitName= isthisUnit.UnitName,
|
||||
Code = isthisUnit.UnitCode,
|
||||
UnitLevel = "",
|
||||
CreateDate=null,
|
||||
Place= isthisUnit.Address,
|
||||
PersonNum=0,
|
||||
TotalAssets=0,
|
||||
TotalValue=0,
|
||||
NewInvestment=0,
|
||||
};
|
||||
reportItemlist.Add(reportItemModel);
|
||||
//加载分单位
|
||||
var unitList = Funs.DB.Base_Unit.Where(x => x.IsBranch == true).ToList();
|
||||
foreach (var item in unitList)
|
||||
{
|
||||
var reportItemModelb = new Model.Environmental_OperationReportItem()
|
||||
{
|
||||
BusinessReportItemId = Guid.NewGuid().ToString(),
|
||||
SortIndex = 1,
|
||||
UnitName = item.UnitName,
|
||||
SortUnitName = isthisUnit.UnitName,
|
||||
Code = item.UnitCode,
|
||||
UnitLevel = "",
|
||||
CreateDate = null,
|
||||
Place = item.Address,
|
||||
PersonNum = 0,
|
||||
TotalAssets = 0,
|
||||
TotalValue = 0,
|
||||
NewInvestment = 0,
|
||||
};
|
||||
reportItemlist.Add(reportItemModelb);
|
||||
}
|
||||
Grid1.DataSource = reportItemlist;
|
||||
Grid1.DataBind();
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -220,14 +268,14 @@ namespace FineUIPro.Web.ZHGL.Environmental
|
||||
operationReport.StatisticsDutyPerson = this.txtStatisticsDutyPerson.Text.Trim();
|
||||
operationReport.UnitDutyPerson = this.txtUnitDutyPerson.Text.Trim();
|
||||
operationReport.FillingDate = Funs.GetNewDateTime(this.txtFillingDate.Text);
|
||||
operationReport.Code = this.txtCode.Text.Trim();
|
||||
operationReport.PersonNum = Funs.GetNewInt(this.txtPersonNum.Text.Trim());
|
||||
operationReport.TotalAssets = Funs.GetNewDecimalOrZero(this.txtTotalAssets.Text.Trim());
|
||||
operationReport.TotalValue = Funs.GetNewDecimalOrZero(this.txtTotalValue.Text.Trim());
|
||||
operationReport.NewInvestment = Funs.GetNewDecimalOrZero(this.txtNewInvestment.Text.Trim());
|
||||
operationReport.UnitLevel = this.txtUnitLevel.Text.Trim();
|
||||
operationReport.CreateDate = Funs.GetNewDateTime(this.txtCreateDate.Text);
|
||||
operationReport.Place = this.txtPlace.Text.Trim();
|
||||
//operationReport.Code = this.txtCode.Text.Trim();
|
||||
//operationReport.PersonNum = Funs.GetNewInt(this.txtPersonNum.Text.Trim());
|
||||
//operationReport.TotalAssets = Funs.GetNewDecimalOrZero(this.txtTotalAssets.Text.Trim());
|
||||
//operationReport.TotalValue = Funs.GetNewDecimalOrZero(this.txtTotalValue.Text.Trim());
|
||||
//operationReport.NewInvestment = Funs.GetNewDecimalOrZero(this.txtNewInvestment.Text.Trim());
|
||||
//operationReport.UnitLevel = this.txtUnitLevel.Text.Trim();
|
||||
//operationReport.CreateDate = Funs.GetNewDateTime(this.txtCreateDate.Text);
|
||||
//operationReport.Place = this.txtPlace.Text.Trim();
|
||||
operationReport.Remark = this.txtRemark.Text.Trim();
|
||||
|
||||
if (!string.IsNullOrEmpty(this.BusinessReportId))
|
||||
@@ -235,17 +283,17 @@ namespace FineUIPro.Web.ZHGL.Environmental
|
||||
var model = Funs.DB.Environmental_OperationReport.FirstOrDefault(s => s.BusinessReportId == this.BusinessReportId);
|
||||
if (model != null)
|
||||
{
|
||||
model.Code = operationReport.Code;
|
||||
model.PersonNum = operationReport.PersonNum;
|
||||
model.TotalAssets = operationReport.TotalAssets;
|
||||
model.TotalValue = operationReport.TotalValue;
|
||||
model.NewInvestment = operationReport.NewInvestment;
|
||||
//model.Code = operationReport.Code;
|
||||
//model.PersonNum = operationReport.PersonNum;
|
||||
//model.TotalAssets = operationReport.TotalAssets;
|
||||
//model.TotalValue = operationReport.TotalValue;
|
||||
//model.NewInvestment = operationReport.NewInvestment;
|
||||
model.Quarters = operationReport.Quarters;
|
||||
model.Year = operationReport.Year;
|
||||
model.FillingMan = operationReport.FillingMan;
|
||||
model.FillingDate = operationReport.FillingDate;
|
||||
model.CreateDate = operationReport.CreateDate;
|
||||
model.Place = operationReport.Place;
|
||||
//model.CreateDate = operationReport.CreateDate;
|
||||
//model.Place = operationReport.Place;
|
||||
model.Remark = operationReport.Remark;
|
||||
model.StatisticsDutyPerson = operationReport.StatisticsDutyPerson;
|
||||
model.UnitDutyPerson = operationReport.UnitDutyPerson;
|
||||
@@ -255,6 +303,7 @@ namespace FineUIPro.Web.ZHGL.Environmental
|
||||
|
||||
BLL.LogService.AddSys_Log(this.CurrUser, operationReport.Year.ToString() + "-" + operationReport.Quarters.ToString(), operationReport.BusinessReportId, BLL.Const.OperationReportMenuId, BLL.Const.BtnModify);
|
||||
Funs.DB.SubmitChanges();
|
||||
saveReportItem(operationReport.BusinessReportId);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -274,6 +323,7 @@ namespace FineUIPro.Web.ZHGL.Environmental
|
||||
BLL.Const.OperationReportMenuId, BLL.Const.BtnAdd);
|
||||
|
||||
Funs.DB.SubmitChanges();
|
||||
saveReportItem(operationReport.BusinessReportId);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -293,6 +343,10 @@ namespace FineUIPro.Web.ZHGL.Environmental
|
||||
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
||||
return;
|
||||
}
|
||||
else if (code == "3")
|
||||
{
|
||||
Alert.ShowInParent("集团当前季度数据已锁定,无法上传!", MessageBoxIcon.Error);
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert.ShowInParent("同步异常,请退出后重试!", MessageBoxIcon.Error);
|
||||
@@ -308,6 +362,49 @@ namespace FineUIPro.Web.ZHGL.Environmental
|
||||
|
||||
#endregion
|
||||
|
||||
#region 保存子表
|
||||
private void saveReportItem(string BusinessReportId) {
|
||||
var list = Funs.DB.Environmental_OperationReportItem.Where(x => x.BusinessReportId == BusinessReportId).ToList();
|
||||
//先删除
|
||||
if (list.Count>0)
|
||||
{
|
||||
Funs.DB.Environmental_OperationReportItem.DeleteAllOnSubmit(list);
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
//再保存
|
||||
JArray mergedData = Grid1.GetMergedData();
|
||||
var reportItemlist = new List<Model.Environmental_OperationReportItem>();
|
||||
var isthisUnit = CommonService.GetIsThisUnit();
|
||||
foreach (var item in mergedData)
|
||||
{
|
||||
JObject values = item.Value<JObject>("values");
|
||||
int i = item.Value<int>("index");
|
||||
var model = new Model.Environmental_OperationReportItem() {
|
||||
BusinessReportItemId= Grid1.Rows[i].DataKeys[0].ToString(),
|
||||
BusinessReportId= BusinessReportId,
|
||||
SortIndex= i+1,
|
||||
UnitName = values.Value<string>("UnitName").ToString(),
|
||||
SortUnitName= isthisUnit.UnitName,
|
||||
Code= values.Value<string>("Code").ToString(),
|
||||
UnitLevel= values.Value<string>("UnitLevel").ToString(),
|
||||
Place= values.Value<string>("Place").ToString(),
|
||||
PersonNum= values.Value<int>("PersonNum"),
|
||||
TotalAssets= values.Value<decimal>("TotalAssets"),
|
||||
TotalValue = values.Value<decimal>("TotalValue"),
|
||||
NewInvestment = values.Value<decimal>("NewInvestment"),
|
||||
|
||||
};
|
||||
if (!string.IsNullOrEmpty(values.Value<string>("CreateDate").ToString()))
|
||||
{
|
||||
model.CreateDate = Convert.ToDateTime(values.Value<string>("CreateDate").ToString());
|
||||
}
|
||||
reportItemlist.Add(model);
|
||||
}
|
||||
Funs.DB.Environmental_OperationReportItem.InsertAllOnSubmit(reportItemlist);
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 年季度变化事件
|
||||
/// <summary>
|
||||
/// 年季度变化事件
|
||||
|
||||
Reference in New Issue
Block a user