2024年7月17日 星期三

V20304D1 –執行成功後,顯示執行完成訊息, 按[確定]後,才重新顯示資料 – mysucessalert(Tmp_str,func);

 目的:V20304D1 –執行成功後,顯示執行完成訊息, [確定],才重新顯示資料 
            – mysucessalert(Tmp_str,func);

處理說明:  1> mysuccessalert(Tmp_Str, function () {
                              Ext.getCmp("btn_Show").fireHandler();
                     })






1>*.js
 Ext.Ajax.request({
        method: 'POST',
        params: np,
        async: false, //將非同步功能關閉
        url: '../../api/V20304D1API/sendmail6',
        success: function (response, opts) {
            Tmp_Str = "已Email 通知相關品保人員<br>"
                             +"執行品保工時維護( V2030A) !!";
            mysuccessalert(Tmp_Str, function () {
                Ext.getCmp("btn_Show").fireHandler();
            })
            //var id = confirm(Tmp_Str);
            //if (id) {
            //    Ext.getCmp("btn_Show").fireHandler();
            //}
            
            //關閉視窗
            Ext.getCmp("sub_ShowEmail_OkBtn").up("window").close();
            Ext.getCmp("sub_ShowEmail_OkBtn").up("window").destroy();            
        },
        failure: function (response, opts) {
            mywarnalert('Email  通知相關人員失敗, 請檢查:' + response.status);
        }
    });  // end of  Ext.Ajax.Request  for Email

2024年7月15日 星期一

C# AND OR 用法 - && || - 不可直接寫 AND OR

 目的: C#   AND  OR 用法  - &&   ||   - 不可直接寫 AND   OR 

處理說明:  1> C#   AND   - &&   
                                OR   =  ||


  if ((Tmp_IRESAK == "3") || (Tmp_IRESAK == "4"))
                    {
                        Tmp_RDRNAL = "VR-RDR";
                        Tmp_NEXT_RJCN = get_NEXT_RJCN();
                        Tmp_Sql = " INSERT   INTO   CSM_RDR  "
                                       + "(  RDRNAL,RJCN,"
                                          + " RPNOAF,DAYRDR,RPN,RNSN,RSN,RBTHAF,"
                                          + " RQTY,C_UNIT,CAGE ) "
                                       + " VALUES  "
                                       + "(" + myfunc.AA(Tmp_RDRNAL) + "," + myfunc.AA(Tmp_NEXT_RJCN.ToString()) + ","
                                              + myfunc.AA(Tmp_RPNOAF) + "," + myfunc.AA("180") + "," + myfunc.AA(Tmp_PN) + "," + myfunc.AA(Tmp_NSN) + "," + myfunc.AA(Tmp_SEQOAF) + "," + myfunc.AA(Tmp_RBTHAF) + ","
                                              + myfunc.AA("1") + "," + myfunc.AA("EA") + "," + myfunc.AA(Tmp_CAGE) + ")";
                        myfunc.SqlExec(Tmp_Sql);
                    }  //end of     if ((Tmp_IRESAK=="3") OR(Tmp_IRESAK == "4")){

2024年7月12日 星期五

V20304D – 確認轉TLS – 將所勾選的資料,存入StringList , 再轉成字串 -List

 目的: V20304D – 確認轉TLS – 將所勾選的資料,存入StringList , 再轉成字串

處理說明:    1>>宣告 List<string> 儲存 string List
                                                  List<String> List_OGONOAF = new List<string>();
                    2>加入 string List 
                          for (var i = 0; i < dt1.Rows.Count; i++)
                         {
                               if (List_OGONOAF.IndexOf(Tmp_OGONOAF) == -1)
                                 {  List_OGONOAF.Add(Tmp_OGONOAF); }
                     3> StringList 轉成字串
           //將勾選的[提領編號][件號][交修件號存入 cookie V20304D_content6
            string Tmp_List_OGONOAF= String.Join(", ", List_OGONOAF.ToArray());


1>*.cs

//1>>宣告 List<string> 儲存 string List
    List<String> List_OGONOAF = new List<string>();
    List<String> List_PN = new List<string>();
    List<String> List_RPNOAF = new List<string>();
 
//2>加入 string List 
for (var i = 0; i < dt1.Rows.Count; i++)
    {
  if (List_OGONOAF.IndexOf(Tmp_OGONOAF) == -1)
      {  List_OGONOAF.Add(Tmp_OGONOAF); }
      if (List_RPNOAF.IndexOf(Tmp_RPNOAF) == -1)
      {  List_RPNOAF.Add(Tmp_RPNOAF); }
      if (List_PN.IndexOf(Tmp_PN) == -1)
      {  List_PN.Add(Tmp_PN); }
}
     //3> StringList 轉成字串
//將勾選的[提領編號][件號][交修件號存入 cookie V20304D_content6
      string Tmp_List_OGONOAF= String.Join(", ", List_OGONOAF.ToArray());
      string Tmp_List_PN = String.Join(", ", List_PN.ToArray());
      string Tmp_List_RPNOAF = String.Join(",", List_RPNOAF.ToArray());
      string Tmp_V20304D_content6 = "提領編號:" + Tmp_List_OGONOAF + "\r\n"
                                + "維修件號:" + Tmp_List_PN + "\r\n"
                                + "交修單號:" + Tmp_List_RPNOAF + "\r\n";
      MyCookie1 = new HttpCookie("V20304D_content6", HttpUtility.UrlEncode(Tmp_V20304D_content6));
      HttpContext.Current.Response.Cookies.Add(MyCookie1);
      HttpContext.Current.ApplicationInstance.CompleteRequest();

2024年7月7日 星期日

V20304A – 1>將空字串維持空字串, 小數的位數維持2位小數 – 即 model 的數值不轉換(convert) - renderer時若為小數,則格式化

目的: V20304A – 1>將空字串維持空字串, 小數的位數維持2位小數
                                  – 即 model 的數值不轉換(convert)
                             2>將空字串變成 0.00,小數的位數維持2位小數 – 即 model的數值,需轉換
                             3>輸出的數量,小數的格式(0000.00) – 即columns的 renderer的數值,需格式化

處理說明: 1>將空字串維持空字串,  - model
                         {  name: "RQHR",
                            //convert: function (value, record) { return Ext.util.Format.round(value, 2); }
                           },
                     2>小數欄位輸出的格式 : 0000.00
                        {
        header: "需求工時", dataIndex: "RQHR", width: 70, sortable: false, align: "right", TMType: "float",
        renderer: Ext.util.Format.numberRenderer('0,000.00'),
        editor: { xtype: 'textfield', allowBlank: true }, //允許空白
    },


1>V20304A_JSON.js
var sub_model = [
    { name: "FMNO" },
    { name: "AMINO" },
    { name: "ITM" },
    { name: "ITMNO" },
    { name: "WKDESC" },
    {
        name: "STDHR",
        convert: function (value, record) { return Ext.util.Format.round(value, 2); }
    },
    {
        name: "RQHR",
        //convert: function (value, record) { return Ext.util.Format.round(value, 2); }
    },
    { name: "REMARK" },
    { name: "PNSHTNO" }
];

var sub_Columns = [
    { header: "", xtype: "rownumberer", width: 40, align: "center", sortable: false },
    //{ header: "系統件單號", dataIndex: "FMNO", width: 130, sortable: false, TMType: "string" },
    { header: "AMM項次", dataIndex: "AMINO", width: 80, sortable: false, TMType: "string" },
    //{ header: "流水序號", dataIndex: "ITM", width: 50, sortable: false, TMType: "string" },
    { header: "項次", dataIndex: "ITMNO", width: 70, sortable: false, TMType: "string" },
    { header: "工作項目", dataIndex: "WKDESC", width: 150, sortable: false, TMType: "string" },
    { header: "標準工時", dataIndex: "STDHR", width: 70, sortable: false, align: "right", TMType: "float", renderer: Ext.util.Format.numberRenderer('0,000.00') },
    {
        header: "需求工時", dataIndex: "RQHR", width: 70, sortable: false, align: "right", TMType: "float",
        renderer: Ext.util.Format.numberRenderer('0,000.00'),
        editor: { xtype: 'textfield', allowBlank: true }, //允許空白
        //editor: 'textfield',
    },
    {
        header: "備註", dataIndex: "REMARK", width: 250, sortable: false, TMType: "string",
        editor: { xtype: 'textfield', allowBlank: true }, //允許空白
        },
    //{ header: "件號專用表單編號", dataIndex: "PNSHTNO", width: 500, sortable: false, TMType: "string" }
];

V20304 – 拆檢結果登錄 – Detail 顯示 Memo欄位值

 目的: V20304 – 拆檢結果登錄 – Detail 顯示 Memo欄位值
處理說明: 1>Detail_Panel 加入Memo欄位靠右
                       var cmp_panel_NOTEAR = get_cmp_panel1(300);
                       cmp_panel_NOTEAR.title = '檢測結果說明';
                       cmp_panel_NOTEAR.dock = 'right';
                       cmp_panel_NOTEAR.layout = 'fit';    
                       var cmp_textarea_NOTEAR = get_cmp_txtarea0("memo_NOTEAR", 300);
                        cmp_textarea_NOTEAR.readOnly = true;
                        cmp_panel_NOTEAR.items.push(cmp_textarea_NOTEAR);
                       Ext.getCmp('grid_D').addDocked(cmp_panel_NOTEAR);
                 2>設定Memo欄位值 
                      Ext.getCmp("grid_D").on('selectionchange', function (me, eOpts) {
                      var cur_recs = Ext.getCmp('grid_D').getSelectionModel().getSelection();
                      if (cur_recs.length > 0) {
                           var cur_rec = cur_recs[0];
                           var Tmp_NOTEAR = cur_rec.data['NOTEAR'].toString();
                           console.log("cmp_textarea_NOTEAR 1:", cmp_textarea_NOTEAR);
                          Ext.getCmp("memo_NOTEAR").setValue(Tmp_NOTEAR);
                          //自行宣告的Object    cmp_panel_NOTEAR 並沒有  Ext.的函式 , Ex: .setValue();
                          //cmp_textarea_NOTEAR .setValue(Tmp_NOTEAR);
                       }
                         else {
                                   Ext.getCmp("memo_NOTEAR").setValue("");
                                 }
                    });  //end of Ext.getCmp("grid_D").on('selectionchange'




2024年7月4日 星期四

V20304 - 檢測結果登錄 – 如何在Detail Tab – Grid右邊 加入Memo欄位[檢測結果]欄位

 目的: V20304 - 檢測結果登錄 如何在Detail Tab – Grid右邊 加入Memo欄位[檢測結果]欄位

處理說明:




V20304A - 工時提列 - Grid的 Columns 不對 - 相同變數名稱被覆蓋

 目的: V20304A - 工時提列 - Grid的 Columns 不對 - 相同變數名稱被覆蓋

處理說明:  1>JavaScript 的相同變數宣告, 相同變數名稱, 會被最新的變數覆蓋
                       V20304A_JSON.js 定義  sub_Columns
                       V20304D1_JSON.js 也定義  sub_Columns
                   2>因V20304D1_JSON.js 最後載進來
                       所 sub_Columns 會覆蓋 V20304A_JSON.js 的 sub_Columns
                   3>若同時載進來的子程式(V20304*.js )
                       其全域的變數名稱(*_JSON.js)不可重覆, 以免彼此互相覆蓋
                   4>全域變數名稱取不同名稱, 即可解決該問題
                       V20304A_JSON.js 定義  sub_Columns_V20304A
                       V20304D1_JSON.js 也定義  sub_Columns_V20304D1




1>*.js
Ext.Loader.loadScript({
    url: '../JsFunction/V20304_JSON.js',
    onLoad: function(){
       Ext.syncRequire('TM.TMMDViewEdit');
    }
});

//將載入 V20304A/B/C/D/D1/E/F/H.js , 並載入V20304A_JSON.js  V20304D1_JSON.js
Ext.Loader.loadScript({ url: '../JsFunction/myfunc.js' });
Ext.Loader.loadScript({ url: '../JsFunction/V20304A.js' });  //工時提列
Ext.Loader.loadScript({ url: '../JsFunction/V20304B.js' }); //單筆匯出
Ext.Loader.loadScript({ url: '../JsFunction/V20304C.js' }); //單筆匯入
Ext.Loader.loadScript({ url: '../JsFunction/V20304D.js' }); //確認轉TLS
Ext.Loader.loadScript({ url: '../JsFunction/V20304E.js' });  //批次匯出
Ext.Loader.loadScript({ url: '../JsFunction/V20304F.js' });   //批次匯入
Ext.Loader.loadScript({ url: '../JsFunction/V20304H.js' });   //維修附檔

1>>V20304A.js
Ext.Loader.loadScript({ url: '../JsFunction/myfunc.js', });
Ext.Loader.loadScript({ url: '../GUITemplate/EmployeeTree.js' });
Ext.Loader.loadScript({ url: '../JsFunction/V20304A_JSON.js',});

2>>V20304A_JSON.js  - 宣告的變數為 全域變數
// [工時提列]鈕  - Grid子畫面欄位 - AMM_AR
var sub_model = [
    { name: "FMNO" },
    { name: "AMINO" },
    { name: "ITM" },
    { name: "ITMNO" },
    { name: "WKDESC" },
    {
        name: "STDHR",
        convert: function (value, record) { return Ext.util.Format.round(value, 2); }
    },
    {
        name: "RQHR",
        convert: function (value, record) { return Ext.util.Format.round(value, 2); }
    },
    { name: "REMARK" },
    { name: "PNSHTNO" }
];

var sub_Columns = [
    { header: "", xtype: "rownumberer", width: 40, align: "center", sortable: false },
    //{ header: "系統件單號", dataIndex: "FMNO", width: 130, sortable: false, TMType: "string" },
    { header: "AMM項次", dataIndex: "AMINO", width: 80, sortable: false, TMType: "string" },
    //{ header: "流水序號", dataIndex: "ITM", width: 50, sortable: false, TMType: "string" },
    { header: "項次", dataIndex: "ITMNO", width: 70, sortable: false, TMType: "string" },
    { header: "工作項目", dataIndex: "WKDESC", width: 150, sortable: false, TMType: "string" },
    { header: "標準工時", dataIndex: "STDHR", width: 70, sortable: false, align: "right", TMType: "float", renderer: Ext.util.Format.numberRenderer('0,000.00') },
    {
        header: "需求工時", dataIndex: "RQHR", width: 70, sortable: false, align: "right", TMType: "float", renderer: Ext.util.Format.numberRenderer('0,000.00'),
        editor: { xtype: 'textfield', allowBlank: true }, //允許空白
        //editor: 'textfield',
    },
    {
        header: "備註", dataIndex: "REMARK", width: 250, sortable: false, TMType: "string",
        editor: { xtype: 'textfield', allowBlank: true }, //允許空白
        },
    //{ header: "件號專用表單編號", dataIndex: "PNSHTNO", width: 500, sortable: false, TMType: "string" }
];


3>>V20304D.js
Ext.Loader.loadScript({ url: '../JsFunction/myfunc.js' });
Ext.Loader.loadScript({ url: '../JsFunction/V20304D1.js' });

4>>V20304D1.js
Ext.Loader.loadScript({ url: '../GUITemplate/EmployeeTree.js' });
Ext.Loader.loadScript({ url: '../JsFunction/V20304D1_JSON.js',});

5>V20304D1_JSON.js
// JavaScript source code
var sub_Fields = [
{ name: "EMPLYNM" },
{ name: "NOTES_MAIL" },
];
var sub_Columns = [
{ header: "姓名", dataIndex: "EMPLYNM", width: 80, TMType: "string" },
{ header: "Email", dataIndex: "NOTES_MAIL", width: 130, TMType: "string" },
];