private void setCondition() { string sql = "select * from VW_DATA_PLAN where plan_type='B' and begin_date>=to_date('" + ASPxDateEdit1.Date.ToString("yyyy-MM-dd") + "','yyyy-mm-dd') and begin_date<=to_date('" + ASPxDateEdit2.Date.ToString("yyyy-MM-dd") + "','yyyy-mm-dd') and pline_code in(select pline_code from vw_user_role_program where user_id='" + theUserId + "' and program_code='" + theProgramCode + "' and company_code='" + theCompanyCode + "' ) order by begin_date,plan_seq "; DataTable dt = dc.GetTable(sql); for (int i = 0; i < dt.Rows.Count; i++) { string remark1 = dt.Rows[i]["REMARK"].ToString(); sql = "select FUNC_GET_REMARK('" + dt.Rows[i]["PLAN_CODE"].ToString() + "','" + remark1 + "') from dual "; dc.setTheSql(sql); dt.Rows[i]["REMARK"] = dc.GetValue();; } ASPxGridView1.DataSource = dt; ASPxGridView1.DataBind(); string sql1 = "select t.rmes_id,t.ghtm,t.so from DP_KCB t where lq_flag='Y' and t.ghtm not in (select ghtm from ATPUJHSN where ghtm is not null) and t.ghtm not in (select ghtm from ATPUJHSN_tmp where ghtm is not null) order by so,ghtm "; DataTable ghtm = dc.GetTable(sql1); ASPxGridView12.DataSource = ghtm; ASPxGridView12.DataBind(); }
protected void ASPxCallbackPanel5_Callback(object sender, CallbackEventArgsBase e) { string[] s = e.Parameter.Split('|'); string flag = s[0]; string value = s[1]; switch (flag) { case "add": ASPxGridView atl1 = (ASPxGridView)sender; int count1 = atl1.Selection.Count; List <object> aa = atl1.GetSelectedFieldValues("RMES_ID"); List <object> ghtm = atl1.GetSelectedFieldValues("GHTM"); if (count1 < 1) { return; } string ids = "'"; for (int j = 0; j < aa.Count; j++) { ids += aa[j] + "','"; } if (ids.EndsWith(",'")) { ids = ids.Substring(0, ids.Length - 2); } string insert_sql = "insert into atpujhsn_tmp select rmes_id,ghtm from DP_KCB t where t.RMES_ID in ({0})"; insert_sql = string.Format(insert_sql, ids); dc.ExeSql(insert_sql); //if (string.IsNullOrEmpty(value)) return; //string value1 = s[2]; //string[] _ids = value.Split(','); //string ids = "'"; //for (int i = 0; i < _ids.Length; i++) //{ // ids += _ids[i] + "','"; //} //if (ids.EndsWith(",'")) // ids = ids.Substring(0, ids.Length - 2); //string[] _ids1 = value1.Split(','); //string ids1 = "'"; //for (int i = 0; i < _ids1.Length; i++) //{ // ids1 += _ids1[i] + "','"; //} //if (ids1.EndsWith(",'")) // ids1 = ids1.Substring(0, ids1.Length - 2); ////判断流水号是否重复 //ASPxCallbackPanel5.JSProperties.Clear(); //string sql12 = "select count(1) from data_plan_sn where sn in ({0}) "; //sql12 = string.Format(sql12, ids1); //dc.setTheSql(sql12); //if (dc.GetValue() != "0") //{ // //提示重复 // ASPxCallbackPanel5.JSProperties.Add("cpCallbackName", "Fail"); // ASPxCallbackPanel5.JSProperties.Add("cpCallbackRet", "流水号已使用!"); // break; //} //string insert_sql = "insert into atpujhsn_tmp select rmes_id,ghtm from DP_KCB t where t.RMES_ID in ({0})"; //insert_sql = string.Format(insert_sql,ids); //dc.ExeSql(insert_sql); //for (int i = 0; i < _ids1.Length; i++) //{ // ASPxListBoxUsed.Items.Add(_ids[i], _ids1[i]); //} //ASPxListBoxUnused.Items.Remove(ASPxListBoxUnused.SelectedItem); break; case "del": if (string.IsNullOrEmpty(value)) { return; } string del_value1 = s[2]; ASPxCallbackPanel5.JSProperties.Clear(); string[] del__ids = value.Split(','); string del_ids = "'"; for (int i = 0; i < del__ids.Length; i++) { del_ids += del__ids[i] + "','"; } if (del_ids.EndsWith(",'")) { del_ids = del_ids.Substring(0, del_ids.Length - 2); } string[] del__ids1 = del_value1.Split(','); string del_ids1 = "'"; for (int i = 0; i < del__ids1.Length; i++) { del_ids1 += del__ids1[i] + "','"; } if (del_ids1.EndsWith(",'")) { del_ids1 = del_ids1.Substring(0, del_ids1.Length - 2); } string del_sql = "delete from atpujhsn_tmp where RMES_ID in (" + del_ids + ")"; dc.ExeSql(del_sql); //for (int i = 0; i < del_ids1.Length; i++) //{ // ASPxListBoxUnused.Items.Add(del__ids[i], del__ids1[i]); //} //ASPxListBoxUsed.Items.Remove(ASPxListBoxUnused.SelectedItem); break; case "js": ASPxListBoxUsed.Items.Clear(); //ASPxListBoxUnused.Items.Clear(); string sql = "delete from atpujhsn_tmp "; //清空临时表 dc.ExeSql(sql); break; default: ASPxCallbackPanel5.JSProperties.Clear(); break; } string usedsql = "select rmes_id,ghtm from ATPUJHSN_tmp t order by ghtm"; DataTable useddt = dc.GetTable(usedsql); ASPxListBoxUsed.DataSource = useddt; ASPxListBoxUsed.DataBind(); //ASPxListBoxUsed.SelectAll(); string sql1 = "select t.rmes_id,t.ghtm,t.so from DP_KCB t where lq_flag='Y' and t.ghtm not in (select ghtm from ATPUJHSN where ghtm is not null) and t.ghtm not in (select ghtm from ATPUJHSN_tmp where ghtm is not null) order by so,ghtm "; DataTable ghtm1 = dc.GetTable(sql1); //ASPxListBoxUnused.DataSource = ghtm; //ASPxListBoxUnused.DataBind(); ASPxGridView12.DataSource = ghtm1; ASPxGridView12.DataBind(); ASPxGridView12.Selection.UnselectAll(); lblYqty.Text = useddt.Rows.Count.ToString(); }