protected void Page_Load(object sender, EventArgs e) { user = Session["theUserManager"] as userManager; if (user == null) { Response.End(); } userManager theUserManager = (userManager)Session["theUserManager"]; string theCompanyCode = theUserManager.getCompanyCode(); string theUserId = theUserManager.getUserId(); List <WorkShopEntity> workShop = WorkShopFactory.GetUserWorkShops(theUserId); //ASPxGridView1.CustomColumnDisplayText += new DevExpress.Web.ASPxGridView.ASPxGridViewColumnDisplayTextEventHandler(ASPxGridView1_CustomColumnDisplayText); GridViewDataComboBoxColumn column1 = (ASPxGridView1.Columns["LLXZZZ"] as GridViewDataComboBoxColumn); { column1.PropertiesComboBox.DataSource = UserFactory.GetAll(); column1.PropertiesComboBox.ValueField = "USER_CODE"; column1.PropertiesComboBox.TextField = "USER_NAME"; } GridViewDataComboBoxColumn column2 = (ASPxGridView1.Columns["LLZPXZ"] as GridViewDataComboBoxColumn); { column2.PropertiesComboBox.DataSource = TeamFactory.GetByWorkShopID("CK_WS01"); column2.PropertiesComboBox.ValueField = "RMES_ID"; column2.PropertiesComboBox.TextField = "TEAM_NAME"; } GridViewDataComboBoxColumn column3 = (ASPxGridView1.Columns["LLBS"] as GridViewDataComboBoxColumn); { System.Data.DataTable dt = new System.Data.DataTable(); dt.Columns.Add("value"); dt.Columns.Add("text"); dt.Rows.Add("W", "新建"); dt.Rows.Add("N", "已发库房"); dt.Rows.Add("Y", "已领料"); dt.Rows.Add("E", "无价格"); column3.PropertiesComboBox.DataSource = dt; column3.PropertiesComboBox.ValueField = "value"; column3.PropertiesComboBox.TextField = "text"; } List <InterIssueEntity> allEntity = InterIssueFactory.GetByWorkShopCode("8101-B1"); GridViewDataComboBoxColumn colGZH = (ASPxGridView1.Columns["LLGZH"] as GridViewDataComboBoxColumn); var a = ((from s in allEntity where !string.IsNullOrWhiteSpace(s.LLGZH) select s.LLGZH).Distinct()).ToList <string>(); colGZH.PropertiesComboBox.DataSource = a; GridViewDataComboBoxColumn colGCH = (ASPxGridView1.Columns["LLGCH"] as GridViewDataComboBoxColumn); var b = (from s in allEntity select s.LLGCH).Distinct().ToList <string>();; colGCH.PropertiesComboBox.DataSource = b; GridViewDataComboBoxColumn colZJDH = (ASPxGridView1.Columns["LLZJDH"] as GridViewDataComboBoxColumn); var c = (from s in allEntity select s.LLZJDH).Distinct().ToList <string>(); for (int i = 0; i < c.Count; i++) { if (c[i] == null) { c[i] = ""; } } colZJDH.PropertiesComboBox.DataSource = c; DataTable d = new DataTable(); d.Columns.Add("LLGCH"); d.Columns.Add("LLGZH"); d.Columns.Add("LLZJDH"); d.Columns.Add("LLXMDH"); d.Columns.Add("LLXMMC"); d.Columns.Add("LLSL"); d.Columns.Add("YSSL"); d.Columns.Add("LLRQ"); d.Columns.Add("LLCJRQ"); d.Columns.Add("LLZPXZ"); d.Columns.Add("LLXZZZ"); d.Columns.Add("PLAN_CODE"); d.Columns.Add("LLBS"); d.Columns.Add("TMBH"); foreach (InterIssueEntity i in allEntity) { List <IssueReceivedEntity> rs = IssueReceivedFactory.GetByDetailCode(i.TMBH); float sum = 0; foreach (IssueReceivedEntity r in rs) { sum += (int)r.ITEM_QTY; } d.Rows.Add(i.LLGCH, i.LLGZH, i.LLZJDH, i.LLXMDH, i.LLXMMC, i.LLSL, sum, i.LLRQ, i.LLCJRQ, i.LLZPXZ, i.LLXZZZ, i.PLAN_CODE, i.LLBS, i.TMBH); } ASPxGridView1.DataSource = d; ASPxGridView1.DataBind(); //用后台的配置开关,设置是否允许手动添加要料单,在code_config_system中 if (DB.ReadConfigServer("INV2300_ALLOW_MANUAL_ADD").Equals("FALSE")) { btnNewBill.Visible = false; } else { btnNewBill.Visible = true; ASPxComboBox cbGCH = ASPxPopupControl1.FindControl("LLGCH") as ASPxComboBox; if (cbGCH != null) { List <WorkShopEntity> workshops = WorkShopFactory.GetUserWorkShops(user.getUserId()); List <ProjectEntity> projects = new List <ProjectEntity>(); foreach (WorkShopEntity w in workshops) { projects.AddRange(ProjectFactory.GetByWorkShop(w.RMES_ID)); } foreach (ProjectEntity p in projects) { cbGCH.Items.Add(p.PROJECT_CODE + " | " + p.PROJECT_NAME, p.PROJECT_CODE); } cbGCH.ClientSideEvents.SelectedIndexChanged = "function(s,e){ initWorkCode(s.GetValue().toString());}"; ASPxComboBox cbGZH = ASPxPopupControl1.FindControl("LLGZH") as ASPxComboBox; if (cbGZH != null) { cbGZH.Callback += new DevExpress.Web.ASPxClasses.CallbackEventHandlerBase(cbGZH_Callback); } cbGCH.SelectedIndexChanged += new EventHandler(cbGCH_SelectedIndexChanged); } ASPxComboBox cbTeam = ASPxPopupControl1.FindControl("LLZPXZ") as ASPxComboBox; if (cbTeam != null) { List <TeamEntity> teams = TeamFactory.GetByUserID(user.getUserId()); foreach (TeamEntity t in teams) { cbTeam.Items.Add(t.TEAM_NAME, t.TEAM_CODE); } } } }