protected void ASPxCallbackPanel5_Callback(object sender, CallbackEventArgsBase e) { string[] s = e.Parameter.Split('|'); string flag = s[0]; string value = s[1]; ASPxCallbackPanel5.JSProperties.Clear(); if (ASPxGridView1.Selection.Count == 0) { ASPxCallbackPanel5.JSProperties.Add("cpCallbackName", "Fail"); ASPxCallbackPanel5.JSProperties.Add("cpCallbackRet", "请选择计划!"); return; } string pline = ASPxGridView1.GetSelectedFieldValues("PLINE_CODE")[0].ToString(); string planCode = ASPxGridView1.GetSelectedFieldValues("PLAN_CODE")[0].ToString(); string planQty = ASPxGridView1.GetSelectedFieldValues("PLAN_QTY")[0].ToString(); string remark = ASPxGridView1.GetSelectedFieldValues("REMARK")[0].ToString(); string planSo = ASPxGridView1.GetSelectedFieldValues("PLAN_SO")[0].ToString(); string planType = ASPxGridView1.GetSelectedFieldValues("PLAN_TYPE")[0].ToString(); string ISBOM1 = ASPxGridView1.GetSelectedFieldValues("IS_BOM")[0].ToString(); switch (flag) { case "add": if (string.IsNullOrEmpty(value)) return; //判断是否存在上线记录 string sql = "select * from data_product where sn='" + value + "' "; dc.setTheSql(sql); if (dc.GetTable().Rows.Count == 0) { ASPxCallbackPanel5.JSProperties.Add("cpCallbackName", "Fail"); ASPxCallbackPanel5.JSProperties.Add("cpCallbackRet", "该发动机未在DCEC上线,不能改制/返修!"); break; } //判断是否已回冲 生成回冲清单 sql = "select * from qad_bkfl where lsh='" + value + "'"; dc.setTheSql(sql); if (dc.GetTable().Rows.Count == 0) { sql = "select * from qad_bkflrecord where lsh1='" + value + "'"; dc.setTheSql(sql); if (dc.GetTable().Rows.Count == 0) { ASPxCallbackPanel5.JSProperties.Add("cpCallbackName", "Fail"); ASPxCallbackPanel5.JSProperties.Add("cpCallbackRet", "该发动机没有生成回冲清单,不能改制/返修!"); break; } } //改制计划判断是否改制出库 if (planType == "C") { sql = "select * from dp_rckwcb where rc='出库' and rklx='改制出库' and ghtm='" + value + "' and gzrq=(select max(gzrq) from dp_rckwcb where ghtm='" + value + "')"; dc.setTheSql(sql); if (dc.GetTable().Rows.Count == 0) { ASPxCallbackPanel5.JSProperties.Add("cpCallbackName", "Fail"); ASPxCallbackPanel5.JSProperties.Add("cpCallbackRet", "该发动机没有改制出库到ATPU,无法改制!"); break; } } //返修计划判断返修SO是否一致 if (planType == "D") { sql = "select plan_so from data_product where sn='" + value + "' and rownum=1"; dc.setTheSql(sql); if (dc.GetValue() != planSo) { ASPxCallbackPanel5.JSProperties.Add("cpCallbackName", "Fail"); ASPxCallbackPanel5.JSProperties.Add("cpCallbackRet", "该发动机原SO与当前SO不一致!"); break; } } string insert_sql = "insert into DATA_PLAN_SN select SEQ_RMES_ID.Nextval,'{0}','{1}','{2}','{3}','N',sysdate from dual"; insert_sql = string.Format(insert_sql, theCompanyCode, pline, planCode, value); dc.ExeSql(insert_sql); insert_sql = "select count(1) from DATA_PLAN_SN where plan_code='" + planCode + "'"; dc.setTheSql(insert_sql); if (dc.GetValue().ToString() == planQty) { string sql1 = "update data_plan set sn_flag='Y' where plan_code='" + planCode + "'"; dc.ExeSql(sql1); } break; case "del": if (string.IsNullOrEmpty(value)) return; ASPxCallbackPanel5.JSProperties.Clear(); string del_pline = ASPxGridView1.GetSelectedFieldValues("PLINE_CODE")[0].ToString(); string del_planCode = ASPxGridView1.GetSelectedFieldValues("PLAN_CODE")[0].ToString(); //判断是否存在上线记录 sql = "select * from DATA_PRODUCT where sn='" + value + "' and plan_code='" + del_planCode + "' "; dc.setTheSql(sql); if (dc.GetTable().Rows.Count > 0) { ASPxCallbackPanel5.JSProperties.Add("cpCallbackName", "Fail"); ASPxCallbackPanel5.JSProperties.Add("cpCallbackRet", "该发动机已上线,不能删除!"); break; } string del_sql = "delete from DATA_PLAN_SN where sn = '" + value + "'"; dc.ExeSql(del_sql); string update_sql = "select count(1) from DATA_PLAN_SN where plan_code='" + planCode + "'"; dc.setTheSql(update_sql); if (dc.GetValue().ToString() != planQty) { string sql1 = "update data_plan set sn_flag='N' where plan_code='" + planCode + "'"; dc.ExeSql(sql1); } break; default: ASPxCallbackPanel5.JSProperties.Clear(); break; } string usedsql = "select t.* from DATA_PLAN_SN t where t.pline_code='" + pline + "' and t.plan_code='" + planCode + "' order by sn"; DataTable useddt = dc.GetTable(usedsql); ASPxListBoxUsed.DataSource = useddt; ASPxListBoxUsed.DataBind(); lblYqty.Text = useddt.Rows.Count.ToString(); YLH.Text = ""; //YLHsl.Text = "1"; }
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(); }