using FineUIPro; using iWareCommon.Common.Entity; using iWareDataCore.BASE.Service; using iWareDataCore.Check.Entity; using iWareDataCore.Check.EnumType; using iWareDataCore.Check.Service; using iWareWms; using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace iWareWms.View.CHECK.Plan { public partial class PlanDetail : PageBase { protected override void Update(out string msg) { var plan = GetPlan(); plan.Id = Convert.ToInt32(Request.QueryString["Id"]); PlanMaterialPlaceService.GetInstance().UpdatePlan(plan, out msg); } private PlanMaterialPlaceEntity GetPlan() { string msg; var materialId = MaterialService.GetInstance().QueryByParam(new QueryParam { }, out msg); var placeId = PlaceService.GetInstance().QueryByParam(new QueryParam { }, out msg); string chackmaterial=tbCheckMaterialCode.Text.Trim(); string chackplacecoe = tbCheckPlaceCode.Text.Trim(); string spcode = tbPlaceCode.Text.Trim(); string smcode = tbMaterialCode.Text.Trim(); var smaterialid = materialId.FirstOrDefault(x => x.Code == smcode); var splaceid = placeId.FirstOrDefault(x => x.Code == spcode); int plid = 0; int mid = 0; if (!string.IsNullOrEmpty(chackmaterial)) { var materialid = materialId.FirstOrDefault(x => x.Code == chackmaterial); if (materialid != null) { mid = materialid.Id; } } if (!string.IsNullOrEmpty(chackplacecoe)) { var placeid = placeId.FirstOrDefault(x => x.Code == chackplacecoe); if (placeid != null) { plid = placeid.Id; } } return new PlanMaterialPlaceEntity { PlaceId = splaceid.Id, MaterialId = smaterialid.Id, CheckPlaceId = plid, CheckMaterialId = mid, Quantity = 1 }; } protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string msg; if (!string.IsNullOrEmpty(Request.QueryString["IsEdit"])) { var planViews = PlanViewService.GetInstance().QueryByParam(new QueryParam { Filter = new Dictionary { { "Id", Request.QueryString["Id"] } } }, out msg); if (!string.IsNullOrEmpty(msg)) { return; } tbPlanNo.Text = planViews.Count > 0 ? planViews[0].PlanNo : ""; tbMaterialCode.Text = planViews.Count > 0 ? planViews[0].MaterialCode : ""; tbPlaceCode.Text = planViews.Count > 0 ? planViews[0].PlaceCode : ""; foreach (var status in Enum.GetValues(typeof(EPlanStatus))) { ddlPlanStatus.Items.Add(status.ToString(), ((int)status).ToString()); } } } } } }