2023年4月23日 星期日

V80204 – loadMask - 顯示等待訊息 - Ajas.async必需為 true

 目的: V80204 – WBS報工工時 [顯示資料], 去後端處理, 要顯示等待訊息

處理說明:  1> Ext.Ajax  的處理模式 :   必需  async: true,  - loadMask
                         // 1>> 異步模式  : false,    即會等後端執行完成,才會往下,所以不會顯示等待訊息
                                                                       async: false ,      
                 // 2>> 異步模式  : true,   即會不用等後端執行完成,前端仍會往下, 所以會顯示等待訊息
                                                                       async: true ,    (defaule)  


1>V80201.js
var myMask = new Ext.LoadMask(Ext.getBody(), {
msg: '資料處理中,請稍候...',
});

//顯示訊息
myMask.show();

//隱藏訊息
Ext.getCmp('sub_Grid').store.on("load", function (me, records, successful, eOpts) {
        if (successful) {

            console.log("successful");
            console.log("Ext.getCmp('sub_Grid').store.data", Ext.getCmp('sub_Grid').store.data);
            win1.show();
            //若已載入完成,則            
            myMask.hide();
        }
    }
    );






2023年4月20日 星期四

V80204 - css - 自定 style - 自定字型,顏色,背景顏色

 目的: V80204 - 自定 style  - css  - 自定字型,顏色,背景顏色

處理說明:  1>利用 labelstyle 及 fieldstyle 設定 字型,顏色
                        labelStyle: "font-size: 20pt; color: blue; background:  gray; ",
                        fieldStyle: "font-size: 20pt; background:  yellow; ",
                   2>利用外部 css 檔案, class 設定
                        var Tmp_Str = "<link type='text/css' rel='stylesheet' href='../JsFunction/mycss.css'  >";
                         $('head').append(Tmp_Str);
                   3>利用自定 class 來設定  字型,顏色                          
                         fieldCls: "my_redcolor  my_bigfont",
                   4>設定 panel 的 顏色 - 
                       bodyStyle: 'background:#ffc; ',
                   5>設定標題顏色 & 字型大小
                         var cmp_TITLE = get_cmp_lbl0("試車/飛(前中)登錄", 550);    
                         cmp_TITLE.style = "font-size: 14pt; color: blue;:text-align:center; ";



1>V80204.js
 //包含 mycss.css
 var Tmp_Str = "<link type='text/css' rel='stylesheet' href='../JsFunction/mycss.css'  >";
 $('head').append(Tmp_Str);

var Query1 = new Ext.FormPanel({
        id: 's1_form', flex:1,
        layout: { type: 'hbox', align: 'stretch' },
        fieldDefaults: { labelAlign: 'right' },
        defaults: { margin: { top: 3 } },
        height: 20,
        items: [
            {
                xtype: 'panel',
                id: 'panel1_1',
                layout: { type: 'hbox', align: 'stretch' },
                flex: 14,
                border: 0,
                items: [
                    {
                        xtype: 'panel',
                        id: 'panel1_11',
                        layout: { type: 'hbox', align: 'stretch' },
                        flex: 15,
                        border: 0,
                        items: [{
                            xtype: "fieldcontainer", fieldLabel: "WBS", labelWidth: 100, layout: "hbox", flex: 2,
                            labelStyle: "font-size: 20pt; color: blue; background:  gray; ",
                            items: [{
                                xtype: "textfield", id: "s1_WBS", name: "s1_WBS", width: 150,
                                padding: "0 4 0 0",                                
                                //Style: "font-size: 20pt; background-color:  red; ",
                                fieldStyle: "font-size: 20pt; background:  yellow; ",
                               //fieldCls: "required",
                                //fieldCls: "my_redcolor  my_bigfont",
                                //cls: "edit_BC",
                            },                            
                            {
                                xtype: "button", id: "s1_btn_WBS", name: "s1_btn_WBS", text: "...",
                                handler: function () {
                                    var win = EditPickx('WBS', '../api/V80204API/get_s_WBSPick', ['WBSNO'], ['s1_WBS'], J_pickstore_s_WBS, J_pickcolumns_s_WBS);
                                    win.show();
                                }
                            },
                            ]
                        }, // end of s1_WBS
                        {
                            xtype: "fieldcontainer", fieldLabel: "機種機號", labelWidth: 100, layout: "hbox", flex: 2,
                            items: [
                                { xtype: "textfield", id: "s1_ACNO", name: "s1_ACNO", width: 150, padding: "0 4 0 0" },
                            ]
                            },  // end of s_機種機號             
                            {  //顯示等候訊息
                                id: "s1_PROCMSG", name: "s1_PROCMSG", xtype: "panel", width: 150, height: 20, margin: "0 4 0 4",
                                hidden: false, border: 0, style: 'background-color:#FFFFFF;'
                            },
                        ]
                    },  // end of panel1
                ]
            },


2>mycss.css
<style type="text/css" >
#my_tbl {
    border-width: 9px;
    border-style: solid;    
}

.my_bigfont{
    font-size:  30px;
        color: yellow;
}

.my_redcolor {
    //background-color: red;
    background: red;
}


4>*.js

var DataPanel = Ext.create("Ext.panel.Panel", {
        flex: 4, layout: { type: 'hbox', align: 'stretch' },
        bodyStyle: 'background:#ffc; ',
        //bodyCls: 'my_lightgreen',
        fieldDefaults: { labelAlign: 'right' },  
        items: [
            //{ xtype: "panel", flex: 2, title: "", },
            {
     xtype: "fieldcontainer", fieldLabel: "WBS報工工時(小時)", labelWidth: 130, layout: "hbox", flex: 5,
                items: [{
                   xtype: "textfield", id: "s1_WBS_HR", name: "s1_WBS_HR", width: 150, 
                             padding: "0 4 0 0", fieldCls: "readonly",
                    // value: 'FM20120301001',
                },
                ]
            }], // end of s1_WBS_HR
    });  // end of DataPanel

Extjs 利用 query - 找詢元件的方法

目的: Extjs  利用 query - 找詢元件的方法

 https://ithelp.ithome.com.tw/articles/10134838

var cmp= Ext.ComponentQuery.query('gridpanel');      //找到 gridpanel xtype 的元件 
var cmp= Ext.ComponentQuery.query('.gridpanel');         //找到 class=.gridpanel 

var Tmp_form = Ext.ComponentQuery.query('#s_form');  //找到 id=#_form

var btnOk= Ext.ComponentQuery.query('button[iconCls]'); //找到按鈕含 iconCls 屬性

V80204 –MD檔 - Ext.TabPanel - 1>隱藏[編輯]頁 2>新增[WBS報工工時]頁 - TabSheet -MD

 目的: V80204 –– Ext.TabPanel   1>隱藏[編輯]頁  2>新增[WBS報工工時]頁  

處理說明: 1>隱藏[編輯]頁  & 隱藏 編輯按鈕
                      Ext.getCmp('MDViewEdit_M').setTabVisible(0, false);
                      TMMDViewEdit.setTemplateBtnVisible(false);

                  2>新增[WBS報工工時]頁  
                       Ext.getCmp('MDViewEdit_M').add(Tmp_FormObj);



2>新增[WBS報工工時]頁
var Tmp_FormObj = Ext.create("Ext.form.Panel", {
title: 'WBS報工工時', id: 'tabl3', cls: 'edit_BC', layout: { type: 'vbox', align: 'stretch' }, 
   items: [Query1, DataPanel],
});
Ext.getCmp('MDViewEdit_M').add(Tmp_FormObj);


2023年4月19日 星期三

GitLab 分支多次認可 , 最後一次才認可+推送 的處理流程

 目的: GitLab 分支多次認可 ,  最後一次才認可+推送 的處理流程


1>GitLabà create merge request , 會以最後一次異動的程式為準
2>保留前面認可的目的是本分支可以回復至前面的認可 (必需下指令, 由 VisualStudio有困難)



2023年4月16日 星期日

VS IDE 操作 - 標籤 - 設定標籤, 找上一標籤,找下一標籤 - 書籤

 目的: VS IDE 操作  - 標籤 - 設定標籤, 找上一標籤,找下一標籤

處理說明: 1>設定標籤 :  Ctrl+K , Ctrl+K
                   2>找上一標:  Ctrl_K , Ctrl+P
                   3>找下一標:  Ctrl_K , Ctrl+N




 

V80204 - 呼叫 WebService WS_ALS02_WBS - WebService 匯入及呼叫 - 1>參考 2>Connected Services - getWS_xxxx_

 目的: V80204  - 呼叫 WebService  WS_ALS02_WBS  - 取得 WBS+機號的報工工時

處理說明:  1>呼叫 WebSerivce 函式 = class.function
                       找出 WebService的  class 及 function
                   2>匯入 WebService 網址 - 找出 WS 的 class 及 function
                        [方案總管] --> [參考] -->[加入服務參考]
                        執行後 , [方案總管] --> [Connected Services]  --> 會新增一class
                   3>web.config 將重覆的 WebService名稱 remak ,
                       否則會有錯誤訊息  





1>*.cs
3>呼叫 WebService 函式的方法:  myfunc.getWS_ALS_WBSHR(string par_WBS, string par_ASN)
        //取得 WBS + ACNO.報工工時        
        //傳入參數:  par_WBS, par_ACNO , 若機號空白,則傳回該WBS的所有機號.工作小時
        //傳回參數:  工作小時
        //                     --> WS_ALS02 原本以分鐘傳回, 以小時為計算單位必需 /60 , 取小數2位        
        public static dynamic getWS_ALS_WBSHR(string par_WBS, string par_ASN)
        {
            string Tmp_hour = "0";
            string Tmp_Str = "";
            string Tmp_Str1 = "", Tmp_Str2 = "";
            double Tmp_double1 = 0;
            if (par_WBS != "")
            {
                ws_als_wbshour.ws_als_wbshourSoapClient wbshour_cls
                                       new ws_als_wbshour.ws_als_wbshourSoapClient();
                try
                {
                    Tmp_Str = wbshour_cls.wbshour(par_WBS, par_ASN);
                    //將 [分鐘]字串轉成[小時]字串
                    Tmp_Str1 = Min2Hr(Tmp_Str1);
                    Tmp_hour = Tmp_Str1;
                }
                catch (Exception ex)
                { }  //throw ex;  可能回傳 null
                finally
                { };
            }
            return Tmp_hour;
        }

2>*.js
{
                        xtype: 'button',
                        id: 'btn1_Show',
                        flex: 2,
                        border: 1,
                        text: '報工工時顯示',
                        iconCls: 'icon-search',
                        handler: function () {
                            //s1_form 的所有欄位均加入 np  - type=2
                   var np = s_JSON('s1_form', 2); //TMFunction.js, 組合form上的查詢條件為json參數傳遞
                            np['s1_WBS'] = Ext.getCmp('s1_WBS').getValue();
                            np['s1_ACNO'] = Ext.getCmp('s1_ACNO').getValue();
                            //因為 LoadMask 無作用,所以改用 label 來顯示訊息
                            //Ext.getCmp("waitlbl").setVisible(true);
                            //Ext.getCmp("waitlbl").update;
                            //Ext.getCmp("waitlbl").show();                            
                            var Proc_Msg;
                            try {
                                Proc_Msg = new Ext.LoadMask(Ext.getCmp("s1_PROCMSG"),
                                    { msg: 'WBS報工工時顯示處理中, 請稍候...', }
                                );
                                Proc_Msg.show();//使用 mask 需手動呼叫show() 方法下
                                //getGridData_M --> 轉工只有曾在於工作中心就會列入  , 後來改為  [目前工作中心]=xxxx , 才顯示
                                //gridstore.getProxy().url = '../api/V80205API/getGridData_M';

                                //2022/06/15 ..過濾條件若[目前工作中心]有值,則過濾 [目前工作中心]=xxxx, 其他 工作中心資料不顯示
                                // url 改為 getGridData_M_sub_WC --> 同 [過濾目前工作中心]鈕,的處理方法 ,                                 
                                //gridstore.getProxy().url = '../api/V120102API/getGridData_M';
                                //gridstore.getProxy().extraParams = np; //分頁OK,篩選條件OK
                                //console.log("1 reloadGridData - before");
                                //Ext.getCmp('grid_Single').reloadGridData();
                                //console.log("2 reloadGridData - after");
                                //取得  WBS+ACNO 的 WBS報工工時
                                Ext.Ajax.timeout = 600000; //如果有ajax timeout問題可以加上去       

                                Ext.Ajax.request({
                                    url: '../../api/V80204API/get_WBS_ALS_HR',  //myfunc.getWS_ALS_WBSHR
                                    method: 'POST',
                                    //async: false,
                                    async: true,
                                    timeout: 600000,
                                    //standardSubmit: true, // 非 Ajax 的方式  //若要傳送檔案至前端, standardSubmit必需設為 true 
                                    params: np,
                                    success: function (response, opts) {
                                        console.log('0 get_WBS_ALS_HR sucess!!');
                                        //console.log('0 opts:', opts);
                                        //console.log('0 response:', response);
                                        console.log("success response.responseText:", response.responseText);
                                        var obj = Ext.decode(response.responseText);
                                        var Tmp_WBSHR = "";
                                        //console.log("obj:", obj);
                                        if (obj["success"]) {
                                            Tmp_WBSHR = obj["WBSHR"];
                                            //mysuccessalert(Tmp_WBSHR);
                                            console.log("success=true , Tmp_WBSHR=", Tmp_WBSHR);
                                            Ext.getCmp("s1_WBS_HR").setValue(Tmp_WBSHR);
                                        }
                                        else {
                                            console.log(' 2 get_WBS_ALS_HR obj[sucess]  false !!');
                                            Tmp_Str = "[取得WBS報工工時]失敗 !! <br>"
                                                + obj["Rtn_Msg"];
                                            mysuccessalert(Tmp_Str);
                                        }
                                        Proc_Msg.hide();  //使用 mask 需手動呼叫hide() 方法下
                                        //Ext.getCmp("waitlbl").setVisible(false);                                        
                                    },
                                    failure: function (response, opts) {
                                        //console.log('uploadFileToDB failure !!');
                                        //console.log(" failure opts.response.responseText:", opts.response.responseText);
                                        console.log(' 3 get_WBS_ALS_HR failure !!');
                                        var obj = Ext.decode(response.responseText);
                                        console.log("obj:", obj);
                                        Tmp_Str = "[取得WBS報工工時]失敗!! <br>"
                                                         + obj["Rtn_Msg"];
                                        mywarnalert(Tmp_Str);
                                        //Ext.getCmp("waitlbl").setVisible(false);
                                        Proc_Msg.hide();  //使用 mask 需手動呼叫hide() 方法下
                                    } // end of failure 
                                });  // end of submit


                            }
                            finally {
                                //Proc_Msg.hide();  //使用 mask 需手動呼叫hide() 方法下
                            }

                        }
                    },  // end of 顯示資料



2>WebService 範例: WS_SAP12:  變更勾選工單之SAP工單狀態。

URLhttp://194.1.5.106/sapws/ZRFC_ZCO02.asmx  Method: PROCESS_TRANS_WEB_CO02



4>WebService – [加入服務參考]時 – 會將WebService 網址記錄在 web.config
--> AMM_PLM04可能會重覆 , 以致出現錯誤訊息(xx找到多個該合約的端點組態xx)
-->將其中一個 AMM_PLM04 刪除即可