ZHJA_HJGL/HJGL_ZH/FineUIPro.Web/Welder/WelderOKRateEdit.aspx.cs

124 lines
6.3 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.Welder
{
public partial class WelderOKRateEdit : PageBase
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.btnClose.OnClientClick = ActiveWindow.GetHideReference();
string rateId = Request.Params["RateId"];
if (!string.IsNullOrEmpty(rateId))
{
var rate = BLL.WelderOKRateService.GetWelderOKRate(rateId);
if (rate != null)
{
Model.HJGL_BS_Welder welder = BLL.HJGL_PersonManageService.GetWelderByWenId(rate.WED_ID);
var project = BLL.Base_ProjectService.GetProjectByProjectId(rate.ProjectId);
if (welder != null)
{
this.lbWedlerName.Text = welder.WED_Name;
this.lbWedlerCode.Text = welder.WED_Code;
}
if (project != null)
{
lbProjectCode.Text = project.ProjectCode;
lbProjectName.Text = project.ProjectName;
}
numTotalFilmNum.Text = rate.TotalFilmNum.HasValue ? rate.TotalFilmNum.Value.ToString() : "";
numOneToatalFilmNum.Text = rate.OneToatalFilmNum.HasValue ? rate.OneToatalFilmNum.Value.ToString() : "";
numOneToatalJointNum.Text = rate.OneToatalJointNum.HasValue ? rate.OneToatalJointNum.Value.ToString() : "";
numOnePassJointNum.Text = rate.OnePassJointNum.HasValue ? rate.OnePassJointNum.Value.ToString() : "";
numOneRepairFilmNum.Text = rate.OneRepairFilmNum.HasValue ? rate.OneRepairFilmNum.Value.ToString() : "";
numOnePassFilmNum.Text = rate.OnePassFilmNum.HasValue ? rate.OnePassFilmNum.Value.ToString() : "";
numTwoRepairFilmNum.Text = rate.TwoRepairFilmNum.HasValue ? rate.TwoRepairFilmNum.Value.ToString() : "";
numThreeRepairFilmNum.Text = rate.ThreeRepairFilmNum.HasValue ? rate.ThreeRepairFilmNum.Value.ToString() : "";
numCRepairFilmNum.Text = rate.CRepairFilmNum.HasValue ? rate.CRepairFilmNum.Value.ToString() : "";
numNoRepairFilmNum.Text = rate.NoRepairFilmNum.HasValue ? rate.NoRepairFilmNum.Value.ToString() : "";
numKPassFilmNum.Text = rate.KPassFilmNum.HasValue ? rate.KPassFilmNum.Value.ToString() : "";
numRMaterialFilmNum.Text = rate.RMaterialFilmNum.HasValue ? rate.RMaterialFilmNum.Value.ToString() : "";
numOKRate.Text = rate.OKRate.HasValue ? rate.OKRate.Value.ToString() : "";
numOKJointRate.Text = rate.OKJointRate.HasValue ? rate.OKJointRate.Value.ToString() : "";
txtRemark.Text = rate.Remark;
}
}
}
}
protected void btnSave_Click(object sender, EventArgs e)
{
//if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.Welder_QualifiedProjectMenuId, BLL.Const.BtnSave))
//{
Model.Sp_WelderOKRate rate = new Model.Sp_WelderOKRate();
rate.TotalFilmNum = BLL.Funs.GetNewInt(numTotalFilmNum.Text);
rate.OneToatalFilmNum = BLL.Funs.GetNewInt(numOneToatalFilmNum.Text);
rate.OneToatalJointNum = BLL.Funs.GetNewInt(numOneToatalJointNum.Text);
rate.OnePassJointNum = BLL.Funs.GetNewInt(numOnePassJointNum.Text);
rate.OnePassFilmNum = BLL.Funs.GetNewInt(numOnePassFilmNum.Text);
rate.OneRepairFilmNum = BLL.Funs.GetNewInt(numOneRepairFilmNum.Text);
rate.TwoRepairFilmNum = BLL.Funs.GetNewInt(numTwoRepairFilmNum.Text);
rate.ThreeRepairFilmNum = BLL.Funs.GetNewInt(numThreeRepairFilmNum.Text);
rate.CRepairFilmNum = BLL.Funs.GetNewInt(numCRepairFilmNum.Text);
rate.NoRepairFilmNum = BLL.Funs.GetNewInt(numNoRepairFilmNum.Text);
rate.KPassFilmNum = BLL.Funs.GetNewInt(numKPassFilmNum.Text);
rate.RMaterialFilmNum = BLL.Funs.GetNewInt(numRMaterialFilmNum.Text);
rate.OKRate = BLL.Funs.GetNewDecimal(numOKRate.Text);
rate.OKJointRate = BLL.Funs.GetNewDecimal(numOKJointRate.Text);
rate.Remark = txtRemark.Text.Trim();
rate.RateId = Request.Params["RateId"];
BLL.WelderOKRateService.UpdateWelderOKRate(rate);
BLL.Sys_LogService.AddLog(Const.System_6, this.CurrUser.LoginProjectId, this.CurrUser.UserId, "修改持证焊工焊接合格率月信息");
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
//}
//else
//{
// ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
//}
}
protected void OnBlur_Click(object sender, EventArgs e)
{
int? total = BLL.Funs.GetNewInt(numOneToatalFilmNum.Text);
int? pass = BLL.Funs.GetNewInt(numOnePassFilmNum.Text);
if (total != null && pass != null)
{
if (total != 0)
{
double? rate = (pass * 100.0 / total);
numOKRate.Text = (Math.Round(rate.Value, 2)).ToString();
}
else
{
numOKRate.Text = "0";
}
}
}
protected void OnBlur2_Click(object sender, EventArgs e)
{
int? total = BLL.Funs.GetNewInt(numOneToatalJointNum.Text);
int? pass = BLL.Funs.GetNewInt(numOnePassJointNum.Text);
if (total != null && pass != null)
{
if (total != 0)
{
double? rate = (pass * 100.0 / total);
numOKJointRate.Text = (Math.Round(rate.Value, 2)).ToString();
}
else
{
numOKJointRate.Text = "0";
}
}
}
}
}