310 lines
13 KiB
C#
310 lines
13 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
using BLL;
|
|
|
|
namespace FineUIPro.Web.ZHGL.DataSync.ProjectDataSync
|
|
{
|
|
public partial class Project_CQMSData_CQMSEdit : PageBase
|
|
{
|
|
#region
|
|
/// <summary>
|
|
/// 主键
|
|
/// </summary>
|
|
public string Id
|
|
{
|
|
get
|
|
{
|
|
return (string)ViewState["Id"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["Id"] = value;
|
|
}
|
|
}
|
|
public string UnitId
|
|
{
|
|
get
|
|
{
|
|
return (string)ViewState["UnitId"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["UnitId"] = value;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
this.btnClose.OnClientClick = ActiveWindow.GetHideReference();
|
|
////权限按钮方法
|
|
this.GetButtonPower();
|
|
this.Id = Request.Params["Id"];
|
|
if (!string.IsNullOrEmpty(this.Id))
|
|
{
|
|
Model.Project_CQMSData_CQMS model = BLL.Project_CQMSDataService.GetProject_CQMSData_CQMSById(this.Id);
|
|
if (model != null)
|
|
{
|
|
//this.txtUnitId.Text = model.UnitId;
|
|
this.txtCollCropCode.Text = model.CollCropCode;
|
|
this.txtUnitName.Text = model.UnitName;
|
|
if (model.ReportDate != null)
|
|
{
|
|
this.txtReportDate.SelectedDate = model.ReportDate;
|
|
}
|
|
if (model.TrainPersonNum.HasValue)
|
|
{
|
|
this.txtTrainPersonNum.Text = model.TrainPersonNum.Value.ToString();
|
|
}
|
|
if (model.TechnicalDisclosePersonNum.HasValue)
|
|
{
|
|
this.txtTechnicalDisclosePersonNum.Text = model.TechnicalDisclosePersonNum.Value.ToString();
|
|
}
|
|
if (model.UseNum.HasValue)
|
|
{
|
|
this.txtUseNum.Text = model.UseNum.Value.ToString();
|
|
}
|
|
if (model.OKNum.HasValue)
|
|
{
|
|
this.txtOKNum.Text = model.OKNum.Value.ToString();
|
|
}
|
|
if (model.CompanyPersonNum.HasValue)
|
|
{
|
|
this.txtCompanyPersonNum.Text = model.CompanyPersonNum.Value.ToString();
|
|
}
|
|
if (model.BranchPersonNum.HasValue)
|
|
{
|
|
this.txtBranchPersonNum.Text = model.BranchPersonNum.Value.ToString();
|
|
}
|
|
if (model.ProjectPersonNum.HasValue)
|
|
{
|
|
this.txtProjectPersonNum.Text = model.ProjectPersonNum.Value.ToString();
|
|
}
|
|
if (model.ProblemNum.HasValue)
|
|
{
|
|
this.txtProblemNum.Text = model.ProblemNum.Value.ToString();
|
|
}
|
|
if (model.ProblemCompletedNum.HasValue)
|
|
{
|
|
this.txtProblemCompletedNum.Text = model.ProblemCompletedNum.Value.ToString();
|
|
}
|
|
if (model.ProblemNotCompletedNum.HasValue)
|
|
{
|
|
this.txtProblemNotCompletedNum.Text = model.ProblemNotCompletedNum.Value.ToString();
|
|
}
|
|
if (model.SNum.HasValue)
|
|
{
|
|
this.txtSNum.Text = model.SNum.Value.ToString();
|
|
}
|
|
if (model.ANum.HasValue)
|
|
{
|
|
this.txtANum.Text = model.ANum.Value.ToString();
|
|
}
|
|
if (model.BNum.HasValue)
|
|
{
|
|
this.txtBNum.Text = model.BNum.Value.ToString();
|
|
}
|
|
if (model.CNum.HasValue)
|
|
{
|
|
this.txtCNum.Text = model.CNum.Value.ToString();
|
|
}
|
|
if (model.KeyProcessNum.HasValue)
|
|
{
|
|
this.txtKeyProcessNum.Text = model.KeyProcessNum.Value.ToString();
|
|
}
|
|
if (model.KeyProcessOKNum.HasValue)
|
|
{
|
|
this.txtKeyProcessOKNum.Text = model.KeyProcessOKNum.Value.ToString();
|
|
}
|
|
if (model.SpecialProcessNum.HasValue)
|
|
{
|
|
this.txtSpecialProcessNum.Text = model.SpecialProcessNum.Value.ToString();
|
|
}
|
|
if (model.SpecialProcessOKNum.HasValue)
|
|
{
|
|
this.txtSpecialProcessOKNum.Text = model.SpecialProcessOKNum.Value.ToString();
|
|
}
|
|
if (model.ConcealedWorksNum.HasValue)
|
|
{
|
|
this.txtConcealedWorksNum.Text = model.ConcealedWorksNum.Value.ToString();
|
|
}
|
|
if (model.ConcealedWorksOKNum.HasValue)
|
|
{
|
|
this.txtConcealedWorksOKNum.Text = model.ConcealedWorksOKNum.Value.ToString();
|
|
}
|
|
if (model.UnitProjectOnesNum.HasValue)
|
|
{
|
|
this.txtUnitProjectOnesNum.Text = model.UnitProjectOnesNum.Value.ToString();
|
|
}
|
|
if (model.UnitProjectOnesOKNum.HasValue)
|
|
{
|
|
this.txtUnitProjectOnesOKNum.Text = model.UnitProjectOnesOKNum.Value.ToString();
|
|
}
|
|
if (model.MaterialInRecheckNum.HasValue)
|
|
{
|
|
this.txtMaterialInRecheckNum.Text = model.MaterialInRecheckNum.Value.ToString();
|
|
}
|
|
if (model.MaterialInRecheckOKNum.HasValue)
|
|
{
|
|
this.txtMaterialInRecheckOKNum.Text = model.MaterialInRecheckOKNum.Value.ToString();
|
|
}
|
|
if (model.SingleProjectNum.HasValue)
|
|
{
|
|
this.txtSingleProjectNum.Text = model.SingleProjectNum.Value.ToString();
|
|
}
|
|
if (model.UnitProjectNum.HasValue)
|
|
{
|
|
this.txtUnitProjectNum.Text = model.UnitProjectNum.Value.ToString();
|
|
}
|
|
if (model.SubProjectNum.HasValue)
|
|
{
|
|
this.txtSubProjectNum.Text = model.SubProjectNum.Value.ToString();
|
|
}
|
|
if (model.SubdivisionalWorksNum.HasValue)
|
|
{
|
|
this.txtSubdivisionalWorksNum.Text = model.SubdivisionalWorksNum.Value.ToString();
|
|
}
|
|
if (model.InspectionLotNum.HasValue)
|
|
{
|
|
this.txtInspectionLotNum.Text = model.InspectionLotNum.Value.ToString();
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
else
|
|
{
|
|
var base_Unit = BLL.UnitService.GetUnitByUnitId(BLL.Const.UnitId_CD);
|
|
txtUnitName.Text = base_Unit.UnitName;
|
|
txtCollCropCode.Text = base_Unit.CollCropCode;
|
|
txtReportDate.SelectedDate = DateTime.Now;
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 保存按钮
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnSave_Click(object sender, EventArgs e)
|
|
{
|
|
if (txtReportDate.SelectedDate == null)
|
|
{
|
|
|
|
ShowNotify("请选择上报日期!");
|
|
return;
|
|
|
|
}
|
|
Model.Project_CQMSData_CQMS table = new Model.Project_CQMSData_CQMS();
|
|
table.UnitId = BLL.Const.UnitId_CD;
|
|
table.ProjectId = this.CurrUser.LoginProjectId;
|
|
table.CollCropCode = this.txtCollCropCode.Text;
|
|
table.UnitName = this.txtUnitName.Text;
|
|
table.ReportDate = this.txtReportDate.SelectedDate;
|
|
table.TrainPersonNum = Funs.GetNewInt(this.txtTrainPersonNum.Text);
|
|
table.TechnicalDisclosePersonNum = Funs.GetNewInt(this.txtTechnicalDisclosePersonNum.Text);
|
|
table.UseNum = Funs.GetNewInt(this.txtUseNum.Text);
|
|
table.OKNum = Funs.GetNewInt(this.txtOKNum.Text);
|
|
table.CompanyPersonNum = Funs.GetNewInt(this.txtCompanyPersonNum.Text);
|
|
table.BranchPersonNum = Funs.GetNewInt(this.txtBranchPersonNum.Text);
|
|
table.ProjectPersonNum = Funs.GetNewInt(this.txtProjectPersonNum.Text);
|
|
table.ProblemNum = Funs.GetNewInt(this.txtProblemNum.Text);
|
|
table.ProblemCompletedNum = Funs.GetNewInt(this.txtProblemCompletedNum.Text);
|
|
table.ProblemNotCompletedNum = Funs.GetNewInt(this.txtProblemNotCompletedNum.Text);
|
|
table.SNum = Funs.GetNewInt(this.txtSNum.Text);
|
|
table.ANum = Funs.GetNewInt(this.txtANum.Text);
|
|
table.BNum = Funs.GetNewInt(this.txtBNum.Text);
|
|
table.CNum = Funs.GetNewInt(this.txtCNum.Text);
|
|
table.KeyProcessNum = Funs.GetNewInt(this.txtKeyProcessNum.Text);
|
|
table.KeyProcessOKNum = Funs.GetNewInt(this.txtKeyProcessOKNum.Text);
|
|
table.SpecialProcessNum = Funs.GetNewInt(this.txtSpecialProcessNum.Text);
|
|
table.SpecialProcessOKNum = Funs.GetNewInt(this.txtSpecialProcessOKNum.Text);
|
|
table.ConcealedWorksNum = Funs.GetNewInt(this.txtConcealedWorksNum.Text);
|
|
table.ConcealedWorksOKNum = Funs.GetNewInt(this.txtConcealedWorksOKNum.Text);
|
|
table.UnitProjectOnesNum = Funs.GetNewInt(this.txtUnitProjectOnesNum.Text);
|
|
table.UnitProjectOnesOKNum = Funs.GetNewInt(this.txtUnitProjectOnesOKNum.Text);
|
|
table.MaterialInRecheckNum = Funs.GetNewInt(this.txtMaterialInRecheckNum.Text);
|
|
table.MaterialInRecheckOKNum = Funs.GetNewInt(this.txtMaterialInRecheckOKNum.Text);
|
|
table.SingleProjectNum = Funs.GetNewInt(this.txtSingleProjectNum.Text);
|
|
table.UnitProjectNum = Funs.GetNewInt(this.txtUnitProjectNum.Text);
|
|
table.SubProjectNum = Funs.GetNewInt(this.txtSubProjectNum.Text);
|
|
table.SubdivisionalWorksNum = Funs.GetNewInt(this.txtSubdivisionalWorksNum.Text);
|
|
table.InspectionLotNum = Funs.GetNewInt(this.txtInspectionLotNum.Text);
|
|
if (string.IsNullOrEmpty(this.Id))
|
|
{
|
|
table.Id = SQLHelper.GetNewID(typeof(Model.Project_CQMSData_CQMS));
|
|
BLL.Project_CQMSDataService.AddProject_CQMSData_CQMS(table);
|
|
|
|
}
|
|
else
|
|
{
|
|
table.Id = this.Id;
|
|
BLL.Project_CQMSDataService.UpdateProject_CQMSData_CQMS(table);
|
|
}
|
|
PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
|
|
}
|
|
|
|
#region 获取按钮权限
|
|
/// <summary>
|
|
/// 获取按钮权限
|
|
/// </summary>
|
|
/// <param name="button"></param>
|
|
/// <returns></returns>
|
|
private void GetButtonPower()
|
|
{
|
|
var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.Project_CQMSData_CQMSMenuId);
|
|
if (buttonList.Count() > 0)
|
|
{
|
|
if (buttonList.Contains(BLL.Const.BtnSave))
|
|
{
|
|
this.btnSave.Hidden = false;
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
protected void txtReportDate_DateSelect(object sender, EventArgs e)
|
|
{
|
|
if (txtReportDate.SelectedDate != null)
|
|
{
|
|
DateTime dt = (DateTime)txtReportDate.SelectedDate;
|
|
if (BLL.Project_CQMSDataService.IsReportByDate(dt,this.CurrUser.LoginProjectId))
|
|
{
|
|
txtReportDate.SelectedDate = null;
|
|
ShowNotify("该日期已上报!");
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
//protected void btnSyn_Click(object sender, EventArgs e)
|
|
//{
|
|
// if (!string.IsNullOrEmpty(this.Id))
|
|
// {
|
|
// var responedata= Project_CQMSDataService.PushCNCEC(Id);
|
|
// if (responedata.code==1)
|
|
// {
|
|
// ShowNotify("上报成功!");
|
|
// PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
|
|
|
|
// }
|
|
// else
|
|
// {
|
|
// ShowNotify(responedata.message);
|
|
// // PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
|
|
// }
|
|
|
|
// }
|
|
|
|
|
|
//}
|
|
}
|
|
} |