using BLL; 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.CLGL { public partial class InPlanMasterEdit : PageBase { public string Id { get { return (string)ViewState["Id"]; } set { ViewState["Id"] = value; } } protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Id = Request.QueryString["Id"]; if (!string.IsNullOrEmpty(Id)) { var model = TwInOutplanmasterService.GetById(Id); txtCusBillCode.Text = model.CusBillCode; txtWarehouseCode.Text = model.WarehouseCode; txtCreateDate.Text = string.Format("{0:yyyy-MM-dd}", model.CreateDate); txtCreateMan.Text = Person_PersonsService.GetPersonsNameById(model.CreateMan); txtReqUnitName.Text = UnitService.GetUnitNameByUnitId(model.ReqUnitId); var queryModel = new Model.Tw_InOutDetailOutput() { InOutPlanMasterId = Id }; var detailList = TwInOutplandetailService.GetByModle(queryModel).ToList(); foreach (var item in detailList) { item.ActNum = item.PlanNum; } Grid1.DataSource = detailList; Grid1.DataBind(); } } } /// /// 保存明细项 /// private List SaveDetail(string InOutPlanMasterId) { //根据列表中的明细项添加 List detailLists = new List(); JArray teamGroupData = Grid1.GetMergedData(); foreach (JObject teamGroupRow in teamGroupData) { JObject values = teamGroupRow.Value("values"); int rowIndex = teamGroupRow.Value("index"); Model.Tw_InputDetail newDetail = new Model.Tw_InputDetail { Id = SQLHelper.GetNewID(), InputMasterId = InOutPlanMasterId, //ProNoticeCId= values.Value("ProNoticeCId"), MaterialCode = values.Value("MaterialCode"), PlanNum = values.Value("PlanNum"), ActNum = values.Value("ActNum"), }; detailLists.Add(newDetail); } return detailLists; } protected void btnEditProcess_Click(object sender, EventArgs e) { throw new NotImplementedException(); } protected void btnSave_Click(object sender, EventArgs e) { TwInputmasterService.GenInMasterByPlanId(Id, SaveDetail(Id)); ShowNotify("保存成功!", MessageBoxIcon.Success); PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference()); } protected void btnAgree_Click(object sender, EventArgs e) { throw new NotImplementedException(); } protected void btnDisgree_Click(object sender, EventArgs e) { throw new NotImplementedException(); } } }