2022年12月12日 星期一

V20301 - 強迫更新 Source 資料 - Ctrl+F5 - Source

 目的: 當 Source(*.js) 有異動時,強迫更新 Source資料 - Ctrl+F5

處理說明: 1>Ctrl+F5 , 強迫更新 Source 資料







2022年12月11日 星期日

V80201A – OCI_ATTR_ACTION 大於32的允許長度上限 – 顯示子件畫面.挑選欄位值

 目的: V80201A顯示子件畫面.挑選欄位值 – 出現OCI_ATTR_ACTION 大於32的允許長度上限

處理說明:  1>呼叫[Controller+函式名稱] 不可>32字元
                                              Ex:    var win = EditPickx('專案配置', '../api/V80201AAPI/get_sub_PDM_CONFIGPick', ..);
                                    win.show();
                            V80201AAPI_get_sub_PDM_CONFIGPick




1>*.js

                {
                    xtype: "fieldcontainer", fieldLabel: "專案配置", labelWidth: 100, layout: "hbox", items: [
                        { id: "sub_PDM_CONFIG", name: "sub_PDM_CONFIG", xtype: "textfield", width: 100, padding: "0 4 0 0", readOnly: true, fieldCls: "readonly", },
                        {
                            xtype: "button", id: "btn_PDM_CONFIG", name: "btn_PDM_CONFIG", text: "...",
                            handler: function () {
                                var win = EditPickx('專案配置', '../api/V80201AAPI/get_sub_PDM_CONFIGPick', ['PDM_CONFIG'], ['sub_PDM_CONFIG'], J_pickstore_sub_PDM_CONFIG, J_pickcolumns_sub_PDM_CONFIG);
                                win.show();
                            }
                        },

-->
 呼叫[Controller+函式名稱] 不可>32字元
--> 
改成
                                var win = EditPickx('專案配置', '../api/V80201AAPI/get_sub_CONFIGPick', 
即可



2022年12月8日 星期四

V20301– 依欄位值,設定必填欄位 -若工單類型(DT04),則[件號]非必填欄位,否則[件號]為必填欄位

 目的: V20301 – 編輯畫面中, [工單類型]的欄位值,決定[件號]是否為必填欄位

            à 工單類型(DT04),[件號]非必填欄位

處理說明:1>change event 時設定欄位屬性,
                     不設定在 blur event , 因為DoubleClick挑選,不觸發blur event
                     Ext.getCmp("FRTP").on("change", function (me, newValue, oldValue, eOpts) {
                          if (Tmp_FRTP == "DT04") {  //若工單類別為 DT04,則件號/名稱/..允許空白
                             setFieldsCls('myform', ['WBSNO', 'FRTP', 'RQTYAF',], ['FMNO', 'FRTP_', 'MTEMPLYID_', 
                 2>按[編輯]鈕時, 依目前資料.欄位值設定編輯欄位屬性(必填,唯讀)
                  var cur_recs = Ext.getCmp('grid_Single').getSelectionModel().getSelection();
                  var cur_rec = cur_recs[0];
                  var Tmp_FRTP = cur_rec.data['FRTP'].toString();
                  if (Tmp_FRTP == "DT04") {  //若工單類別為 DT04,則件號/名稱/..允許空白
                        setFieldsCls('myform', ['WBSNO', 'FRTP', 'RQTYAF',], ['FMNO', 'FRTP_', 'MTEMPLYID_', 





1>*.js   V20301.js

1>> [工單類別]欄位 .onChange 時,依[工單類別]欄位值,設定必填欄位
    var Tmp_FRTP_Obj = Ext.getCmp("FRTP");
    if (!checkisnull(Tmp_FRTP_Obj)) {
        console.log("工單類別.Object");
        Ext.getCmp("FRTP").on("change", function (me, newValue, oldValue, eOpts) {
            console.log("工單類別.onchange");
            var Tmp_FRTP = Ext.getCmp("FRTP").getValue();
            if (Tmp_FRTP == "DT04") {  //若工單類別為 DT04,則件號/名稱/..允許空白
                console.log("工單類別=DT04");
                setFieldsCls('myform', ['WBSNO', 'FRTP', 'RQTYAF',], ['FMNO', 'FRTP_', 'MTEMPLYID_', 'FRNOAF', 'PAMMNO', 'DLEMPLYID_', 'CREMPLYID_', 'NEMPID_', 'MCODE_', 'ENGP_'], ['FMNO', 'WBSNO', 'FRTP', 'PN', 'C_NM', 'ES_NM', 'NSN', 'RQTYAF', 'SEQOAF', 'PROID', 'CDCODE', 'EONO', 'DTSOR', 'OSM', 'ISSN', 'EIAC_CUS', 'RBTHAF', 'FACWC', 'MTEMPLYID', 'FRNOAF', 'PAMMNO', 'SAPREMARK', 'REMARK', 'OGONOAF', 'RPNOAF', 'NGONOAF', 'MRPNOAF', 'PRNRAF', 'NRCLAF', 'CRNRAF', 'FREDTAF', 'PJDT', 'DLEMPLYID', 'CREMPLYID', 'QDRNO', 'BTDT', 'CSTNM', 'MDDT', 'NEMPID', 'LGROUP', 'CRNO', 'MCODE', 'ENGP']);
            }
            else
                setFieldsCls('myform', ['WBSNO', 'FRTP', 'PN', 'C_NM', 'RQTYAF', 'SEQOAF', 'EIAC_CUS', 'FACWC',], ['FMNO', 'FRTP_', 'MTEMPLYID_', 'FRNOAF', 'PAMMNO', 'DLEMPLYID_', 'CREMPLYID_', 'NEMPID_', 'MCODE_', 'ENGP_'], ['FMNO', 'WBSNO', 'FRTP', 'PN', 'C_NM', 'ES_NM', 'NSN', 'RQTYAF', 'SEQOAF', 'PROID', 'CDCODE', 'EONO', 'DTSOR', 'OSM', 'ISSN', 'EIAC_CUS', 'RBTHAF', 'FACWC', 'MTEMPLYID', 'FRNOAF', 'PAMMNO', 'SAPREMARK', 'REMARK', 'OGONOAF', 'RPNOAF', 'NGONOAF', 'MRPNOAF', 'PRNRAF', 'NRCLAF', 'CRNRAF', 'FREDTAF', 'PJDT', 'DLEMPLYID', 'CREMPLYID', 'QDRNO', 'BTDT', 'CSTNM', 'MDDT', 'NEMPID', 'LGROUP', 'CRNO', 'MCODE', 'ENGP']);
        })
    }

2>>按[編輯]鈕時,  依目前資料.[工單類別]欄位值,設定必填欄位
Ext.getCmp('btn_edit').on("click", function () {
        var cur_recs = Ext.getCmp('grid_Single').getSelectionModel().getSelection();
        if (cur_recs.length == 0) {
            mywarnalert("請先選擇要編輯的資料");
            return false;
        }
        else {
            var cur_rec = cur_recs[0];
            var Tmp_FRTP = cur_rec.data['FRTP'].toString();
            if (Tmp_FRTP == "DT04") {  //若工單類別為 DT04,則件號/名稱/..允許空白
                console.log("工單類別=DT04");
                setFieldsCls('myform', ['WBSNO', 'FRTP', 'RQTYAF',], ['FMNO', 'FRTP_', 'MTEMPLYID_', 'FRNOAF', 'PAMMNO', 'DLEMPLYID_', 'CREMPLYID_', 'NEMPID_', 'MCODE_', 'ENGP_'], ['FMNO', 'WBSNO', 'FRTP', 'PN', 'C_NM', 'ES_NM', 'NSN', 'RQTYAF', 'SEQOAF', 'PROID', 'CDCODE', 'EONO', 'DTSOR', 'OSM', 'ISSN', 'EIAC_CUS', 'RBTHAF', 'FACWC', 'MTEMPLYID', 'FRNOAF', 'PAMMNO', 'SAPREMARK', 'REMARK', 'OGONOAF', 'RPNOAF', 'NGONOAF', 'MRPNOAF', 'PRNRAF', 'NRCLAF', 'CRNRAF', 'FREDTAF', 'PJDT', 'DLEMPLYID', 'CREMPLYID', 'QDRNO', 'BTDT', 'CSTNM', 'MDDT', 'NEMPID', 'LGROUP', 'CRNO', 'MCODE', 'ENGP']);
            }
            else
                setFieldsCls('myform', ['WBSNO', 'FRTP', 'PN', 'C_NM', 'RQTYAF', 'SEQOAF', 'EIAC_CUS', 'FACWC',], ['FMNO', 'FRTP_', 'MTEMPLYID_', 'FRNOAF', 'PAMMNO', 'DLEMPLYID_', 'CREMPLYID_', 'NEMPID_', 'MCODE_', 'ENGP_'], ['FMNO', 'WBSNO', 'FRTP', 'PN', 'C_NM', 'ES_NM', 'NSN', 'RQTYAF', 'SEQOAF', 'PROID', 'CDCODE', 'EONO', 'DTSOR', 'OSM', 'ISSN', 'EIAC_CUS', 'RBTHAF', 'FACWC', 'MTEMPLYID', 'FRNOAF', 'PAMMNO', 'SAPREMARK', 'REMARK', 'OGONOAF', 'RPNOAF', 'NGONOAF', 'MRPNOAF', 'PRNRAF', 'NRCLAF', 'CRNRAF', 'FREDTAF', 'PJDT', 'DLEMPLYID', 'CREMPLYID', 'QDRNO', 'BTDT', 'CSTNM', 'MDDT', 'NEMPID', 'LGROUP', 'CRNO', 'MCODE', 'ENGP']);
        }        
    });





2022年12月7日 星期三

V120501– 顯示子畫面 - [新增領用登記] - Form - 子視窗

目的: V120501– 開啟子視窗 - [新增領用登記]  - Form

處理說明: 1>開啟子視窗 - 
                       var win = getMyWindow("新增領用登記", J_formFields_Sub1mySub1_Btns);        
                  2>定義子視窗_button
                      var mySub1_Btns = [
                         {
                            xtype: 'button', text: '確定', id: 'OkBtn_mySub1',
                           listeners: {
                               click: function () {  ..  }
                           
                  3>定義子視窗_欄位
                      var J_formFields_Sub1 = [
                  {
                           bodyStyle: "background-color:transparent;", border: false, layout: "vbox", padding: "5", items: [
                  {        



1>*.js

 //按鈕 : [新增領用登記] [掃描登記][查詢領用記錄]
    var BtnAry = [
        {
            xtype: 'button', text: '新增領用登記', id: 'UseRegBtn',
            listeners: {
                click: function () {
                    AddRegBtn_click();                    
                }
            }
        },

//新增 [新增領用登記]鈕    
    function AddRegBtn_click() {
        console.log(" 1 inside - AddRegBtn_Click 新增領用登記: ");
        //1>檢核資料是否正確 - 是否有選擇資料        
        var cur_recs = Ext.getCmp('grid_Single').getSelectionModel().getSelection(); //grid select指向選擇的第一筆        
        var cur_rec = cur_recs[0];
        console.log("cur_rec[raw][QTY]:", cur_rec["raw"]["QTY"]);
        var np1 = {};
        np1["CPNO"] = cur_rec["raw"]["CPNO"];
        np1["MATNR"] = cur_rec["raw"]["MATNR"];
        np1["WH"] = cur_rec["raw"]["WH"];
        np1["SP"] = cur_rec["raw"]["SP"];        
        np1["QTY"] = cur_rec["raw"]["QTY"];
        np1["RQTY"] = cur_rec["raw"]["RQTY"];
        np1["UNIT"] = cur_rec["raw"]["UNIT"];
        np1["CHARG"] = cur_rec["raw"]["CHARG"];        
        np1["NOTE"] = cur_rec["raw"]["NOTE"];
        np1["COMPER"] = loginInfo.id;        
        np1["PQTY"] = "";
        //2>顯示子畫面 - [新增領用登記]
        var mySub1_Btns = [
            {
                xtype: 'button', text: '確定', id: 'OkBtn_mySub1',
                listeners: {
                    click: function () {
                        //1>更新資料庫資料(AMM_COMPQTY)
                        var Tmp_Str = "";
                        if (checkisnull(Ext.getCmp("sub1_PQTY").getValue())){
                            Tmp_Str = "領用數量不可空白<br>"
                                            + " 敬請檢核 !!";
                            mywarnalert(Tmp_Str);
                            return;
                        }
                        if (Number(Ext.getCmp("sub1_PQTY").getValue()) > Number(Ext.getCmp("sub1_RQTY").getValue())) {
                            Tmp_Str = "領用數量(" + Ext.getCmp("sub1_PQTY").getValue() + ")不可大於剩餘數量(" + Ext.getCmp("sub1_RQTY").getValue() + ")<br>"
                                + " 敬請檢核 !!";
                            mywarnalert(Tmp_Str);
                            return;
                        }
                        np1["PQTY"] = Ext.getCmp("sub1_PQTY").getValue();
                        np1["SAPNO"] = Ext.getCmp("sub1_SAPNO").getValue();
                        np1["NOTE"] = Ext.getCmp("sub1_NOTE").getValue();
                        np1["COMPER"] = Ext.getCmp("sub1_COMPER").getValue();
                        np1["COMPDT"] = cnow();                      
                        Ext.Ajax.request({
                            method: 'POST',
                            params: np1,
                            async: false, //將非同步功能關閉
                            url: '../../api/V120501API/Add_AMMCOMPQTY_1',
                            success: function (response, opts) {
                                var obj = Ext.decode(response.responseText);
                                var Tmp_Str = obj["Rtn_Msg"];
                                var Tmp_success = obj["success"];
                                if (Tmp_success) {
                                    Tmp_Str = "[新增領用登記]成功 !!<br>"
                                                    + Tmp_Str;
                                    mysuccessalert(Tmp_Str);                                    
                                }
                                else {
                                    Tmp_Str = "[新增領用登記]失敗 !! <BR> "
                                                     + Tmp_Str;
                                    mywarnalert(Tmp_Str);                                    
                                }
                            },
                            failure: function (response, opts) {
                                var obj = Ext.decode(response.responseText);
                                var Tmp_Str = obj["Rtn_Msg"];
                                Tmp_Str = "[新增領用登記]失敗 !!<br>"                                    
                                                + Tmp_Str;
                                mywarnalert(Tmp_Str);                                
                                return;
                            }
                        });  // end of  Ext.Ajax.Request  for Email
                        //2> close windows
                        this.up("window").close();
                        this.up("window").destroy();
                        //3>重新更新 MDBGrid
                        Ext.getCmp("btn_Show").fireHandler();                        
                    }
                }
            },
            {
                xtype: 'button', text: '取消', id: 'CancelBtn_mySub1',
                listeners: {
                    click: function () {
                        this.up("window").close();
                        this.up("window").destroy();
                    }
                }
            },
        ];
        
        var win = getMyWindow("新增領用登記", J_formFields_Sub1, mySub1_Btns);        
        win.onshow = Sub1_onShow(np1);
        win.width = 600;
        win.height = 450;        
        win.show();
    };

2>V120201_json.js  -  子畫面欄位
// [新增領用登記]鈕  
var J_formFields_Sub1 = [
{
bodyStyle: "background-color:transparent;", border: false, layout: "vbox", padding: "5", items: [
{
xtype: "fieldcontainer", fieldLabel: "編號", labelWidth: 100, layout: "hbox", items: [
{ id: "sub1_CPNO", name: "sub1_CPNO", xtype: "textfield", width: 100, padding: "0 4 0 0", readOnly: true, fieldCls: "readonly", },
]
},  //end of 編號
{
xtype: "fieldcontainer", fieldLabel: "件號", labelWidth: 100, layout: "hbox", items: [
{ id: "sub1_MATNR", name: "sub1_MATNR", xtype: "textfield", width: 100, padding: "0 4 0 0", readOnly: true, fieldCls: "readonly", },
]
},   // end of 件號
{
xtype: "fieldcontainer", fieldLabel: "庫房", labelWidth: 100, layout: "hbox", items: [
{ id: "sub1_WH", name: "sub1_WH", xtype: "textfield", width: 100, padding: "0 4 0 0", readOnly: true, fieldCls: "readonly", },
]
}, // end of 庫房
{
xtype: "fieldcontainer", fieldLabel: "數量", labelWidth: 100, layout: "hbox", items: [
{ id: "sub1_QTY", name: "sub1_QTY", xtype: "textfield", width: 100, padding: "0 4 0 0", readOnly: true, fieldCls: "readonly",},
]
},  // end of 數量
{
xtype: "fieldcontainer", fieldLabel: "剩餘數量", labelWidth: 100, layout: "hbox", items: [
{ id: "sub1_RQTY", name: "sub1_RQTY", xtype: "textfield", width: 100, padding: "0 4 0 0", readOnly: true, fieldCls: "readonly", },
]
},  // end of 剩餘數量
{
xtype: "fieldcontainer", fieldLabel: "單位", labelWidth: 100, layout: "hbox", items: [
{ id: "sub1_UNIT", name: "sub1_UNIT", xtype: "textfield", width: 100, padding: "0 4 0 0", readOnly: true,fieldCls: "readonly", },
]
}, // end of 單位
{
xtype: "fieldcontainer", fieldLabel: "批次", labelWidth: 100, layout: "hbox", items: [
{ id: "sub1_CHARG", name: "sub1_CHARG", xtype: "textfield", width: 100, padding: "0 4 0 0", readOnly: true, fieldCls: "readonly", },
] // end of 批次.items
}, // end of 批次
{
xtype: "fieldcontainer", fieldLabel: "儲存位置", labelWidth: 100, layout: "hbox", items: [
{ id: "sub1_SP", name: "sub1_SP", xtype: "textfield", width: 100, padding: "0 4 0 0", readOnly: true, fieldCls: "readonly", },
]
}, // end of 儲存位置
{
xtype: "fieldcontainer", fieldLabel: "領用數量", labelWidth: 100, layout: "hbox", items: [
{ id: "sub1_PQTY", name: "sub1_PQTY", xtype: "textfield", width: 100, padding: "0 4 0 0", fieldCls: "required",  },
]
}, // end of 領用數量
{
xtype: "fieldcontainer", fieldLabel: "領用人員", labelWidth: 100, layout: "hbox", items: [
{ id: "sub1_COMPER", name: "sub1_COMPER", xtype: "textfield", width: 100, padding: "0 4 0 0", fieldCls: "required", },
{ id: "sub1_COMPER_", name: "sub1_COMPER_", xtype: "textfield", width: 100, padding: "0 4 0 0", fieldCls: "readonly", },
{
id: "btn_sub1_COMPER", name: "btn_sub1_COMPER", xtype: "button", text: "...",
//員工編號挑選 , TreeView 挑選    
handler: function () {
console.log(" btn_sub1_COMPER on click");
var treepanel = Ext.create('EmployeeTree', {
id: 'myEmployeeTree',
listeners: {
itemclick: function (view, record, item, index, e) {
if (record.raw.leaf) {
var info = record.raw.text;
var newStr = info.split(":");
Ext.getCmp('sub1_COMPER').setValue(newStr[0]);
Ext.getCmp('sub1_COMPER_').setValue(newStr[1]);
win_tree.close();
}
}
}
});
var win_tree = getWindow('領用人員挑選', treepanel);
win_tree.height = 400;
win_tree.show();
} // end of handler of  btn_sub1_comper
},
]
}, // end of 領用人員
{
xtype: "fieldcontainer", fieldLabel: "領用工號", labelWidth: 100, layout: "hbox", items: [
{ id: "sub1_SAPNO", name: "sub1_SAPNO", xtype: "textfield", width: 100, padding: "0 4 0 0",  },
]
}, // end of 領用工號
{
xtype: "fieldcontainer", fieldLabel: "備註(使用架次)", labelWidth: 100, layout: "hbox", items: [
{ id: "sub1_NOTE", name: "sub1_NOTE", xtype: "textarea", width: 200, padding: "0 4 0 0",  },
]
}, // end of 備註
] // end of   layout: "vbox", padding: "5", items: [
}  //end of  J_formFields_Sub1 , items[{
]      //end of  J_formFields_Sub1 , items[

V80201 – [編審狀態]異動時, 依目前編審狀態改變 radioGroup選項

目的: V80201 – [編審狀態]異動時, 依目前編審狀態改變 radioGroup選項

處理說明: 1>[編審狀態]欄位的 EditPick 的 isSuspendevent 必需設為 false,
                      當[編審狀態]欄位異動時, change event 才會觸發
                  2>設定 radio1.setCheck(true);



2>*.js
{xtype: "fieldcontainer", fieldLabel: "編審狀態", labelWidth: 70, layout: "hbox", flex: 2,
             items: [
          { xtype: "textfield", id: "s_STAT", name: "s_STAT", width: 30, padding: "0 4 0 0", value: "C" },
          { xtype: "textfield", id: "s_STAT_NM_", name: "s_STAT_NM_", width: 80, padding: "0 4 0 0", readOnly: true, fieldCls: "readonly", value: "已核准" },
          {
             xtype: "button", id: "s_btn_STAT", name: "s_btn_STAT", text: "...",
             handler: function () {
                  //isSupendevent=false; 才會觸發 event 
                      var win = EditPickx('編審狀態', '../api/V80201API/get_s_STATPick', ['STAT', 'DESCPT'], ['s_STAT', 's_STAT_NM_'], J_pickstore_s_STAT, J_pickcolumns_s_STAT,
                                                true, false);
                                            win.show();
                                        }
                                    },
                                ]
                            },// end of s_編審狀態                    



Ext.getCmp("s_STAT").on("change", function (me, newValue, oldValue, eopts) {
    //Ext.getCmp("s_STAT").on("blur", function () {
        console.log("狀態 s_STAT change !!");
        var Tmp_STAT = Ext.getCmp('s_STAT').getValue();
        if (Tmp_STAT == "C") {  //已核准 - 處理完成日期
            Ext.getCmp("s_radio1").setValue(true);
            Ext.getCmp("s_radio2").setValue(false);
        }
        else {  //未核准 - 預計編審完成日期
            Ext.getCmp("s_radio1").setValue(false);
            Ext.getCmp("s_radio2").setValue(true);
        }
    });

2022年12月6日 星期二

V80201 - WebService 定義呼叫 操作說明 & 顯示傳回資料說明 - 若資料空白,則顯示"無符合的資料!!" - 錯誤訊息: 找到多個合約端點組態

 目的: V80201 - WebService 呼叫 & 顯示傳回資料說明  - AMM_PDM04

處理說明: 呼叫 WebService的步驟
                  1>將 WebService 的網址加入 專案  
                       - 方案總管 --> 參考  --> 加入服務參考
                       Ex: http://enovia/AMM/Service.asmx Method: AMM_PDM04
                  2>完成後, 
                       - 方案總管 --> Connect Service  --> 多一 AMM_PDM04
                  3>web.config 移除重複 endpoint 
                       - web.config  --> 移除重複 endpoint of AMM_PDM04
                  4>呼叫 AMM_PDM04 函式  
                       AMM_PDM04.ServiceSoapClient PDM04 = new AMM_PDM04.ServiceSoapClient();
                       DataSet ds = PDM04.AMM_PDM04("10-43-0301-001", "","AJT", "A", "0011", 
                                                                                     "",  "C", "2000/01/01","2022/12/05","", 
                                                                                     "");
                   5>若無符合條件的資料,則顯示訊息
                         if (gridstore.data.getCount() == 0) {
                                    mywarnalert("無符合條件的資料!!");
                                }

                   6>WebService 傳回 ds.tables , 修改成 T1 & T1C


1>Visual Studio 2019 IDE 操作畫面

1.    方案總管 à 參考 à 按右鍵 à 加入服務參考

Ex:  http://enovia/AMM/Service.asmx

    Method: AMM_PDM04



 

 

 

 

 

 

 

 

 

2.於加入服務參考視窗設置參數如下圖

    Ex:    AMM_PDM01



3.確定後可至方案總管 à Connected Service查看


  

4.web.config à 將重複的endpoint 移除

  --> 否則執行時,會出現 以致出現錯誤訊息(xx找到多個該合約的端點組態xx)

  --> 將其中一個 AMM_PLM04 刪除即可

   <endpoint address="http://enovia/AMM/Service.asmx" binding="customBinding"

        bindingConfiguration="ServiceSoap122" contract="AMM_PDM01.ServiceSoap"

        name="ServiceSoap12" />





   

4.呼叫webservice所提供之function



 

程式範例

ZRFC_ZM66.ZRFC_ZM66SoapClient sap = new ZRFC_ZM66.ZRFC_ZM66SoapClient();

DataSet ds = sap.CALL_Z_RFC_ZM66("1", MATNR, null, null, null, null, null, null, null, null, null, null, null, null, null);

DataTable dt = ds.Tables[0];

 

 

Sample2:  *.cs





using TLSWEB_AMM.AMM_PDM04;

AMM_PDM04.ServiceSoapClient PDM04 = new AMM_PDM04.ServiceSoapClient();

            DataSet ds = PDM04.AMM_PDM04("10-43-0301-001", "","AJT", "A", "0011",

                     "",  "C", "2000/01/01","2022/12/05","",

                                         "");

             //將 WebService 取得的 ds , 改成 TMGrid的格式 T1 & T1C

            DataTable dt = ds.Tables[0];
            dt.TableName = "T1";
            DataTable dt1 = ds.Tables.Add("T1C");
            dt1.Columns.Add("TOTAL", typeof(Int32));
            DataRow dr = ds.Tables["T1C"].NewRow();
            dr["TOTAL"] = dt.Rows.Count;
            ds.Tables["T1C"].Rows.Add(dr);
            return ds;




實例: Web改版:  V80201 - 呼叫WebService AMM_PDM04






4>
{
                        xtype: 'button',
                        id: 'btn_Show',
                        flex: 2,
                        border: 1,
                        text: '資料顯示',
                        iconCls: 'icon-search',
                        handler: function () {
                            //檢核 [專案配置][生產工廠]不可均空白
                            var Tmp_PDM_CONFIG = Ext.getCmp('s_PDM_CONFIG').getValue();
                            var Tmp_FACWC = Ext.getCmp('s_FACWC').getValue();
                            var Tmp_Str = "";
                            if ((checkisnull(Tmp_PDM_CONFIG)) && (checkisnull(Tmp_FACWC))) {
                                Tmp_Str = "[專案配置][生產工廠]不可均空白, 敬請檢核";
                                mywarnalert(Tmp_Str);
                                return;
                            }
                         var np = s_JSON('s_form'); //TMFunction.js, 組合form上的查詢條件為json參數傳遞                            
                            np["s_STAT"] = Ext.getCmp('s_STAT').getValue();
                            console.log(" np[s_STAT]  : ", np["s_STAT"]);
                            gridstore.getProxy().url = '../api/V80201API/getWebService_M';
                            gridstore.getProxy().extraParams = np; //分頁OK,篩選條件OK                                                        
                            gridstore.on("load", function () {
                                console.log("gridstore.onload !!");
                                if (gridstore.data.getCount() == 0) {
                                    mywarnalert("無符合條件的資料!!");
                                }
                            });
                            gridstore.load();
                        }    //end of  顯示資料.handler                       
                    },  // end of 顯示資料

2022年12月4日 星期日

V80201 – 自訂挑選欄位值 – RunTime新增欄位值

目的: V80201 – 生工OSM查詢 自訂挑選欄位值 – RunTime新增欄位值

 處理說明: 1> DataSet ds = setupPickDs(n, Tmp_Sql, new string[] { "KEYCODE" });
                        var Tmp_STAT ,Tmp_DESCPT = "";
                        DataRow dr = ds.Tables["T1"].NewRow();
                        dr["STAT"] = "A";
                       dr["DESCPT"] = "未審核";
                       ds.Tables["T1"].Rows.Add(dr);
           


1>*.cs
//過濾欄位 [編審狀態(STAT)]挑選

        [HttpPost]
        public dynamic get_s_STATPick(string STAT = "", int isComplete = 0)
        {
            string Tmp_Sql = " SELECT  DISTINCT KEY_CODE AS STAT ,DESCPT  "
                                       + "  FROM   KEYCODE "
                                       + "  WHERE  1=2 "
                                       + "    AND      KEY_CODE IS NOT NULL "
                                       + " ORDER  BY  KEY_CODE ";
            string n = funId + "s_STAT";
            DataSet ds = setupPickDs(n, Tmp_Sql, new string[] { "KEYCODE" });
            var Tmp_STAT = "";
            var Tmp_DESCPT = "";
            DataRow dr = ds.Tables["T1"].NewRow();
            dr["STAT"] = "A";
            dr["DESCPT"] = "未審核";
            ds.Tables["T1"].Rows.Add(dr);
            dr = ds.Tables["T1"].NewRow();
            dr["STAT"] = "B";
            dr["DESCPT"] = "審核中";
            ds.Tables["T1"].Rows.Add(dr);
            dr = ds.Tables["T1"].NewRow();
            dr["STAT"] = "C";
            dr["DESCPT"] = "已審核";
            ds.Tables["T1"].Rows.Add(dr);
            if (STAT != null && !STAT.Equals(""))
            {
                if (isComplete == 1)
                {
                    ds = getPickDsbyCondi(n, "STAT='" + STAT + "'");
                }
                else
                {
                    ds = getPickDsbyCondi(n, "STAT  LIKE '%" + STAT + "%'");
                }
            }
            return ds;
        }  // end of  get_s_STATPick