目的: 挑選欄位值 - 依目前畫面[交修單號]欄位值 ,來過濾挑選資料 -url= xxx ?RPNOAF=xxxx
處理說明: 1>由 url - xxxx?RPNOAF=xxxx 傳入目前的參數值
2>後端由 QueryString 取得傳入 url 的 ? 參數
string Tmp_RPNOAF = c.Request.QueryString["RPNOAF"];
2>後端由 QueryString 取得傳入 url 的 ? 參數
string Tmp_RPNOAF = c.Request.QueryString["RPNOAF"];
1>*.js
{
xtype:"fieldcontainer",fieldLabel:"LRU件號",labelWidth:160,layout:"hbox",items:[
{id:"PN",name:"PN",xtype:"textfield",width:200,padding:"0 4 0 0",maxLength:32},
{
id: "btn_PN", name: "btn_PN", xtype: "button", text: "...",
handler: function () {
var Tmp_RPNOAF = Ext.getCmp("RPNOAF").getValue();
var win = EditPickx('LRU件號', '../api/V20306API/get_F_PNPick?RPNOAF='+Tmp_RPNOAF, ['PN'], ['PN'], J_pickstore_F_PN, J_pickcolumns_F_PN);
win.show();
} }
xtype:"fieldcontainer",fieldLabel:"LRU件號",labelWidth:160,layout:"hbox",items:[
{id:"PN",name:"PN",xtype:"textfield",width:200,padding:"0 4 0 0",maxLength:32},
{
id: "btn_PN", name: "btn_PN", xtype: "button", text: "...",
handler: function () {
var Tmp_RPNOAF = Ext.getCmp("RPNOAF").getValue();
var win = EditPickx('LRU件號', '../api/V20306API/get_F_PNPick?RPNOAF='+Tmp_RPNOAF, ['PN'], ['PN'], J_pickstore_F_PN, J_pickcolumns_F_PN);
win.show();
} }
2>*.cs - c#
//過濾條件 [LRUPN]挑選
//url = ?RPNOAF=xxxxx --> 可由傳入的參數 or Request.QueryString 取得
[HttpPost]
public dynamic get_F_PNPick(string RPNOAF="", string PN = "",int isComplete = 0)
{
var c = HttpContext.Current;
NameValueCollection nvc = c.Request.Form;
//string Tmp_RPNOAF = nvc["RPNOAF"];
string Tmp_RPNOAF = c.Request.QueryString["RPNOAF"];
Tmp_RPNOAF=RPNOAF; //也可
string Tmp_Sql = " SELECT DISTINCT PN "
+ " FROM AMM_FM "
+ " WHERE 1 = 1 "
+ " AND PN IS NOT NULL ";
if (!myfunc.checkisnull(Tmp_RPNOAF))
Tmp_Sql = Tmp_Sql + " AND RPNOAF = " + myfunc.AA(Tmp_RPNOAF);
string n = funId + "F_PN"; //同一欄位的挑選, 但畫面挑選的n命名需和過濾條件不同
//即時抓SQL , 每次均重取, 不由現有的緩衝資料取行
//public DataSet setupPickDs(string pickKey, string sql, string[] tables, bool paging = true, bool realTime = false)
DataSet ds = setupPickDs(n, Tmp_Sql, new string[] { "AMM_FM" },true,true);
if (PN != null && !PN.Equals(""))
{
if (isComplete == 1)
{
ds = getPickDsbyCondi(n, "PN='" + PN + "'");
}
else
{
ds = getPickDsbyCondi(n, "PN LIKE '%" + PN + "%'");
}
}
return ds;
} // end of get_F_PNPick