2025年12月16日 星期二

SAP系統HANA昇級的時程 -

一. 目的: SAP系統HANA昇級的時程  - 

二.時程:
     目前AIDC和 SAP系統沒有簽維護合約
     2026/02/28 : SAP Table 倒出至AIDC.ERPI資料庫 , Zxxxx的Table 直接開在 ERPI資料庫,
                          不再存在 SAP  Table
     2026/06/30:  AMM系統子功能調整至 ERPI 資料庫
     2030: SAP系統不再支援現行版本(Oracle)


三.修調備註:
      1> J欄標題改為[落差影響不可接受理由]
           K欄:[可接受,調整方式]
      2>Web子功能開啟時成畫面一直線  
           Chrome: 清榮
           Edge: 公司要求


2025年12月14日 星期日

V20201AA – 簡單子畫面- Radiobox - 互斥

 目的: V20201AA – 簡單子畫面- Radiobox

處理說明: 1> var cmp_sub_lbl_AA1 = get_cmp_lbl0("拆檢案專案日期選項:",200);
         var cmp_sub_rd1 = get_cmp_rd1("工廠實際接收日期+2個月", "sub_rd1", 150, true, "0 5 0 20"); 
         cmp_sub_rd1.checked = true;




1>*.js
function CALL_V20201AA() {
    console.log(" 1 inside - Call_V20201AA 加入排程: ");
    //panel11 - 拆檢案專案日期選項
    var cmp_sub_lbl_AA1 = get_cmp_lbl0("拆檢案專案日期選項:",200);
    var cmp_sub_rd1 = get_cmp_rd1("工廠實際接收日期+2個月", "sub_rd1", 150, true, "0 5 0 20");
    cmp_sub_rd1.checked = true;
    var cmp_sub_rd2_panel = get_cmp_panel1(200);
    var cmp_sub_rd2 = get_cmp_rd1("自行輸入", "sub_rd2", 50, false, "0 5 0 20");
    var cmp_sub_rd2_PROJDT = get_cmp_dt0('sub_rd2_PROJDT', 100);

    cmp_sub_rd2_panel.items.push(cmp_sub_rd2, cmp_sub_rd2_PROJDT);
    var cmp_sub_lbl_SPARE = get_cmp_lbl0(":");
       
    var sub_V20201AA_Flds = [
        {
            type: 'panel', bodyStyle: "background-color:transparent;", border: 5, padding: "1",
            layout: 'border',
            items: [
                {
                    xtype: 'panel', id: 'sub_panelAA1', region: 'center', 
                    height: 100,
                    //layout: { type: 'vbox', align: 'stretch' },
                    layout: { type: 'vbox',},
                    items: [
                        cmp_sub_lbl_AA1,
                        cmp_sub_rd1,
                        cmp_sub_rd2_panel,
                        cmp_sub_lbl_SPARE
                    ],
                },               
            ]
        }
    ];

2>互斥
Ext.getCmp("sub_rd1").on('change', function (me, newValue, oldValue, eOpts) {
        if (newValue == true) {
            Ext.getCmp("sub_rd2").setValue(false);
        }
    }
    );  // end of  cmp_sub_rd1.on("change"

    Ext.getCmp("sub_rd2").on('change', function (me, newValue, oldValue, eOpts) {
        if (newValue == true) {
            Ext.getCmp("sub_rd1").setValue(false);
        }
    }
    );  // end of  cmp_sub_rd1.on("change"



2025年12月11日 星期四

V20201A – 排程資料匯入-子畫面 – [全部選取][全部取消] - LoadMask - 顯示稍候訊息,Async不可設為false

 目的: V20201A – 排程資料匯入-子畫面 – [全部選取][全部取消] - LoadMask
處理說明: 1>LoadMask 顯示資料 --> Async 不可設為 false

                  2>子畫面.[全部選取][全部取消
                       2.1>[分頁] : par_paging=true;
                              Ext.getCmp('sub_Grid1').store.getProxy().url = '../../api/V20201AAPI/get_sub_data1?par_paging=true';
                         2.1>[不分頁] : par_paging=false;
                              Ext.getCmp('sub_Grid1').store.getProxy().url = '../../api/V20201AAPI/get_sub_data1?par_paging=false';



1>*.js
 var sub_V20201A_Btns = [
        { //2023/07/14 microed , 將 V120201 改成 雅嵐版本 - 分頁勾選
            xtype: 'button', text: '全部選取', id: 'sub_SelAllBtn', iconCls: 'icon-check',
            listeners: {
                click: function () {
                    var Tmp_Proc_Msg = "[全部選取]資料處理中..,請稍候!!";
                    var Proc_Msg = new Ext.LoadMask(Ext.getBody(),
                        { msg: Tmp_Proc_Msg, }
                    );
                    Proc_Msg.show();                    
                    Ext.getCmp('sub_Grid1').store.each(function (rec) {
                        rec.set('CHECK', true);
                    });
                    //將 所有資料.PK 加入 CHK_PK_OBJ.PK_LIST
                    Ext.Ajax.request({
                        url: '../api/V20201AAPI/get_sub_Data1?par_paging=false',
                        method: 'POST',
                        params: { all: 1 },
                        //async: false, //--> 會導致訊息 " 請稍候 ", 無法顯示訊息 & 等候訊息顯示/隱藏
                        failure: function (response, opts) {
                            Proc_Msg.hide();
                        },
                        success: function (response, opts) {
                            CHK_PK_OBJ1.PK_LIST = [];
                            var obj = Ext.decode(response.responseText);
                            obj.T1.forEach(function (item, i) {
                                var Tmp_PK = item['FMNO'] + "&" + item['AMMNO'];
                                CHK_PK_OBJ1.PK_LIST.push(Tmp_PK);
                                CHK_PK_OBJ1.ALL_LIST.push(item);
                            });
                            Proc_Msg.hide();
                        }
                    });
                } //end of click of 全部選取
            }
        }, //end of 全部選取
        {
            xtype: 'button', text: '全部取消', id: 'sub_unSelAllBtn', iconCls: 'icon-check',
            listeners: {
                click: function () {
                    //unSelAllBtn_click();                    
                    Ext.getCmp('sub_Grid1').store.each(function (rec) {
                        rec.set('CHECK', false);
                    });
                    CHK_PK_OBJ1.PK_LIST = [];
                    CHK_PK_OBJ1.ALL_LIST = [];
                }
            }
        }, //end of 全部取消

   

2025年12月8日 星期一

V20201A-排程資料匯入 1> checkbox:互斥 [v]已發工 [ ]未發工 2> 新增CaluField - dr - DataRow

 目的: V20201A-排程資料匯入 1> checkbox:互斥 [v]已發工  [ ]未發工    2> 新增CaluField

處理說明: 1> checkbox:互斥 
                        [v]已發工  [ ]未發工
   Ext.getCmp("sub_chk_AMMSTS1").on('change', function (me, newValue, oldValue, eOpts) {
        if (newValue==true) {
            Ext.getCmp("sub_chk_AMMSTS2").setValue(false);

        }
    }
    );  // end of  cmp_chk_AMMSTS.items[0].on("change"

                  2> CaluField : 發工人員姓名(SAPMAN_)
ds.Tables["T1"].Columns.Add("CREMPLYID_", typeof(object)); //管制人員姓名 
 int Tmp_cnt1 = ds.Tables["T1"].Rows.Count;
 for (int i = 0; i < Tmp_cnt1; i++)
                {
                    DataRow dr1 = ds.Tables["T1"].Rows[i];
                    Tmp_TYPEAF = dr1["TYPEAF"].ToString();

 


1>*.js

var cmp_sub_chk_AMMSTS1 = get_cmp_chk1('已發工', 'sub_chk_AMMSTS1', 80, "false", "0 10 0 50");
var cmp_sub_chk_AMMSTS2 = get_cmp_chk1('未發工', 'sub_chk_AMMSTS2', 80, "false", "0 10 0 50");

     // [V]已發工[]未未工 : 互斥 true / false 控制
    Ext.getCmp("sub_chk_AMMSTS1").on('change', function (me, newValue, oldValue, eOpts) {
        if (newValue==true) {
            Ext.getCmp("sub_chk_AMMSTS2").setValue(false);

        }
    }
    );  // end of  cmp_chk_AMMSTS.items[0].on("change"
    Ext.getCmp("sub_chk_AMMSTS2").on('change', function (me, newValue, oldValue, eOpts) {
        if (newValue==true) {
            Ext.getCmp("sub_chk_AMMSTS1").setValue(false);
        }
    }
    );  // end of  cmp_chk_AMMSTS.items[0].on("change"





2>*.cs
ds.Tables["T1"].Columns.Add("PROJDT_", typeof(object)); //約別 TYPEAF_
ds.Tables["T1"].Columns.Add("CREMPLYID_", typeof(object)); //管制人員姓名 ds.Tables["T1"].Columns.Add("SAPMAN_", typeof(object)); //發工人員姓名

  string Tmp_CREMPLYID_, Tmp_SAPMAN_;
                int Tmp_cnt1 = ds.Tables["T1"].Rows.Count;
                for (int i = 0; i < Tmp_cnt1; i++)
                {
                    DataRow dr1 = ds.Tables["T1"].Rows[i];
                    Tmp_TYPEAF = dr1["TYPEAF"].ToString();
                    Tmp_CREMPLYID = dr1["CREMPLYID"].ToString();
                    Tmp_SAPMAN = dr1["SAPMAN"].ToString();
                    Tmp_Sql = " SELECT  EMPLYNM "
                                   + "  FROM   HR_EMPLYM "
                                   + "  WHERE  EMPLYID=" + myfunc.AA(Tmp_CREMPLYID);
                    Tmp_CREMPLYID_ = myfunc.SqlValue(Tmp_Sql);
                    Tmp_Sql = " SELECT  EMPLYNM "
                                   + "  FROM   HR_EMPLYM "
                                   + "  WHERE  EMPLYID=" + myfunc.AA(Tmp_SAPMAN);
                    Tmp_SAPMAN_ = myfunc.SqlValue(Tmp_Sql);
                    //case  when B.TYPEAF=3 then B.CRNRAF  
                    //when B.TYPEAF = 4 then B.CMNRAF end 'PROJDT'
                    if (Tmp_TYPEAF=="3")
                    {
                        Tmp_PROJDT_= ds.Tables["T1"].Rows[i]["CRNRAF"].ToString();
                    }
                    if (Tmp_TYPEAF == "3")
                    {
                        Tmp_PROJDT_ = ds.Tables["T1"].Rows[i]["CMNRAF"].ToString();
                    }
                    dr1["PROJDT_"] = Tmp_PROJDT_;
                    dr1["CREMPLYID_"] = Tmp_CREMPLYID_;
                    dr1["SAPMAN_"] = Tmp_SAPMAN_;
                }

2025年12月1日 星期一

Google Blogger : 操作說明 - title:子畫面,Grid - sort:published

 目的: Google Blogger : 操作說明  - title:子畫面,Grid    - sort:published

處理說明: 1>title: 子畫面,Grid    - 在title 有子畫面 & Grid的文章
                  2>sort: published         - 依最近的文章先顯示







2025年11月20日 星期四

V20201B- Grid 加外框 – 藍色 - style - css - new -勾選[V]處理 - 子畫面

目的: V20201B- Grid 加外框 – 藍色 - style - css
                          -勾選[V]處理

 
處理說明: 1> 直接設定 : style , 不用 css檔案

                        style: 'border: 4px solid #0066cc; border-radius: 6px;'
                  2> 間接設定: cls , 利用 *.css 檔案
                        // *.js   href   *.css
                        var Tmp_Str = "<link type='text/css' rel='stylesheet' href='../JsFunction/mycss.css'  >";
                        $('head').append(Tmp_Str);

                        cls: 'edit_BC',
                        cls: 'my_Grid',
                  3>*.css
<style type="text/css" >
.my_Grid { border: 4px solid #0066cc; border-radius: 6px;}

.my_bigfont{    font-size:  30px;        color: yellow;}
.my_redcolor {    background: red; }
.my_lightgreen {    background: #CCFF00;}
 </style >

                  4>子畫面[V] 勾選處理




1>*.js  -style - Grid
  //子件明細 sub_Grid2 - AMM_EMPD
    var sub_Grid2 = Ext.create('TMGrid', {
        grid_id: 'sub_Grid2',
        columns: sub_Columns_V20201B_2,        
        flex: 10,
        store: Ext.create('gridstore', { model: sub_model_V20201B_2 }),
        //style: 'border: 4px solid #0066cc; border-radius: 6px;'
    });

    //子件明細 sub_Grid3 - AMM_DEVD
    var sub_Grid3 = Ext.create('TMGrid', {
        grid_id: 'sub_Grid3',
        columns: sub_Columns_V20201B_3,
        flex: 20,
        store: Ext.create('gridstore', { model: sub_model_V20201B_3 }),
        //style: 'border: 4px solid #0066cc; border-radius: 6px;'
    });




2>*.js - style - panel
   var cmp_sub_panel_Grid2 = get_cmp_panel1(200,10);
    cmp_sub_panel_Grid2.id = "sub_panel_Grid2";    
    cmp_sub_panel_Grid2.style = "border: 2px solid #0066cc;";
    cmp_sub_panel_Grid2.items.push(sub_Grid2);
    var cmp_sub_panel_Grid3 = get_cmp_panel1(200, 20);
    cmp_sub_panel_Grid3.id = "sub_panel_Grid3";
    cmp_sub_panel_Grid3.style = "border: 2px solid #0066cc; ";
    cmp_sub_panel_Grid3.items.push(sub_Grid3);

 {
                    xtype: 'panel',
                    id: 'sub_panel3',
                    region: 'south',
                    layout: { type: "hbox", align: 'stretch' },
                    flex: 10,
                    border: 1,
                    //items: [sub_Grid2, sub_Grid3,]    //圖1
                    items: [cmp_sub_panel_Grid2, cmp_sub_panel_Grid3],   //圖2
                },


3>*.js  - [V]勾選 - 子畫面勾選處理
Ext.define('CHK_PK_OBJ1', {
PK_LIST: [], //儲存選項's的  PK欄位值
ALL_LIST: [], //儲存選項's的 所有欄位值
});
var CHK_PK_OBJ1 = Ext.create('CHK_PK_OBJ1');

var sub_Columns_V20201B_1 = [
    { header: "", xtype: "rownumberer", width: 40, align: "center", sortable: false },
{
//2023/07/14 microed , 將 V120201 改成 雅嵐版本 - 分頁勾選
header: "勾選",
dataIndex: "CHECK", width: 40, xtype: 'checkcolumn', menuDisabled: true, sortable: false,
//rec : 目前資料欄位值
renderer: function (value, metadata, rec, rowIndex, colIndex, store) {
//var item = rec.get('AMMNO') + '&' + rec.get('WC') + '&' + rec.get('ITM');
var Tmp_PK = rec.get('AMMNO') + '&' + rec.get('WC') + '&' + rec.get('WITM');
var chkd = '';
if (rec.get('CHECK') === true) {
if (CHK_PK_OBJ1.PK_LIST.indexOf(Tmp_PK) == -1) {
CHK_PK_OBJ1.PK_LIST.push(Tmp_PK);
CHK_PK_OBJ1.ALL_LIST.push(rec.data);
}
chkd = 'checked';
rec.set('CHECK', true);
}
else if (rec.get('CHECK') === false) {
rec.set('CHECK', false);
//將本Tmp_PK ,由 Array 中移除 , 所以不會有 空字串, 空 Object
       CHK_PK_OBJ1.PK_LIST = jQuery.grep(CHK_PK_OBJ1.PK_LIST, function (item) {
var Tmp_cur_PK = item.AMMNO + "&" + item.WC + "&" + item.WITM;
return Tmp_cur_PK != Tmp_PK;
});
CHK_PK_OBJ1.ALL_LIST = jQuery.grep(CHK_PK_OBJ1.ALL_LIST, function (item) {
var Tmp_cur_PK = item.AMMNO + "&" + item.WC + "&" + item.WITM;
return Tmp_cur_PK != Tmp_PK;
});
CHK_PK_OBJ1.ALL_LIST);
}
else if (typeof rec.get('CHECK') === "undefined") { //往上或下一頁
if (CHK_PK_OBJ1.PK_LIST.indexOf(Tmp_PK) > -1) {
chkd = 'checked';
if (CHK_PK_OBJ1.PK_LIST.indexOf(Tmp_PK) == -1) {
CHK_PK_OBJ1.PK_LIST.push(Tmp_PK);
CHK_PK_OBJ1.ALL_LIST.push(rec.data);
console.log("undefined checked CHK_PK_OBJ1.PK_LIST:", CHK_PK_OBJ1.PK_LIST);
console.log("undefined checked CHK_PK_OBJ1.ALL_LIST:", CHK_PK_OBJ1.ALL_LIST);
}
rec.set('CHECK', true);
} else {
rec.set('CHECK', false);
}
}
var cbx = "<input  type='checkbox'  "
+ chkd + " > ";
return cbx;
},
},
{ header: "AMM單號", dataIndex: "AMMNO", width: 120, sortable: false, TMType: "string" },
{ header: "工作中心", dataIndex: "WC", width: 70, sortable: false, TMType: "string" },
{header: "工作步序", dataIndex: "WITM", width: 70, sortable: false, TMType: "string" },
{ header: "步序說明", dataIndex: "STP", width: 120, sortable: false, TMType: "string" },
{ header: "所需人數", dataIndex: "AQTY", width: 70, sortable: false },
{ header: "熟手人數", dataIndex: "PQTY", width: 70, sortable: false },
{ header: "工時", dataIndex: "WHR", width: 60, sortable: false, align: "right", TMType: "float", renderer: Ext.util.Format.numberRenderer('000,000.00') },
{ header: "步序工作中心", dataIndex: "DWC", width: 80, sortable: false, TMType: "string" },
{ header: "是否排程", dataIndex: "STATUS", width: 80, sortable: false, TMType: "string" },
{ header: "工作編號", dataIndex: "MITM", width: 120, sortable: false, TMType: "string" },
];


4>*.js - 子畫面[V]勾選 - 送至後端處理

function V20201B_OK() {
        //1>目前挑選資料 傳送至後端
        var cur_rec;
        let Tmp_DataAry1 = [];
        var Tmp_EMPLYID, Tmp_AMMNO;
        var Tmp_Str;
        for (var i = 0; i < CHK_PK_OBJ1.PK_LIST.length; i++) {
            cur_rec = CHK_PK_OBJ1.ALL_LIST[i];
            //Tmp_PK = cur_rec.AMMNO.toString()+"&"+cur_rec.WC.toString()+"&"+cur_rec.ITM.toString();
            if (!(JSON.stringify(cur_rec) === '{}')) {
                Tmp_DataAry1.push(cur_rec);
            }
        }
        //主畫面勾選資料
        let Tmp_DataString1 = JSON.stringify(Tmp_DataAry1);
        var np = {};
        np["DataString1"] = Tmp_DataString1;

        //新增 AMM_TLSAR & AMM_AR
        //STEP2: 若 AMM_TLSAR & AMM_AR of FMNO 不存在, 則新增該檔案資料(AMM_TLSAR, AMM_AR)
        Tmp_url = '../../api/V20201BAPI/UPDATE_AMM_SCHSTP';
        Tmp_RtnStr = getUrlStr(Tmp_url, np, "[細部資料維護]鈕-更新(AMM_SCHSTP.STATUS)=Y/N");
        if (!checkRtnOK(Tmp_RtnStr)) {
            mywarnalert(Tmp_RtnStr);
            return;
        }
        else {
            mysuccessalert(Tmp_RtnStr);
            //Ext.getCmp("sub_Grid").store.reload();
            Ext.getCmp("sub_btn_V20201B_cancel").fireEvent('click', Ext.getCmp("sub_btn_V20201B_cancel"));
        }
            
    

2025年11月17日 星期一

V20201K – 排程資料匯出 – 套表 - 全部匯出(含CaluField) - New

 目的: V20201K – 排程資料匯出 套表 - 全部匯出(CaluField)

處理說明:  1>*.js  匯出所有的資料
                         Ext.Ajax.request({
                            url: '../api/V20201API/getGridData_M?par_paging=false',
                            method: 'POST',
                            params: { all: 1 },
                            async: false, //將非同步功能關閉
                            failure: function (response, opts) {},
                            success: function (response, opts) {
                                  let Tmp_DataAry1 = [];
                                  var obj = Ext.decode(response.responseText);
                                  obj.T1.forEach(function (item, i) {
                                           Tmp_DataAry1.push(item);
                                  });
                                CALL_V20201K(Tmp_DataAry1); //排程資料匯出
                        }
                        });

                  2>*.cs  - 套表
public void XLSOUT()
        {           
            // 1>將 SS_FILES.FBOLD 存成 Local檔案
            //取得目前子畫面的欄位值
            string Tmp_DataString1 = nvc["DataString1"];    //Tmp_DataString:  將目前子畫面的資料. 

            //將 table 字串轉成 DataTable
            DataTable dt1 = myfunc.JSON2dt(Tmp_DataString1);
            int Tmp_cnt1 = dt1.Rows.Count;
          
            string Tmp_FName = "V20201_排程資料匯出格式.xlsx";      //套表的檔案名稱 , 
            //documentPath = c:\\inetpub\wwwroot\TLS5\TLSWEB_AMM5\document\
            string documentPath = HttpContext.Current.Server.MapPath("~") + "document\\"; 
            string Tmp_pFName = documentPath + Tmp_FName;
            //需要擷取大量資料時,DataReader 是很好的選擇,因為資料不會快取至記憶體。
            //OracleDataReader reader;
            FileStream fs = null;
            Workbook wk = null;

              string Tmp_FName1 = "V20305_物料清單匯出_" + DateTime.Now.ToString("yyyyMMdd") + ".xlsx";
            string Tmp_pFName1 = documentPath + Tmp_FName1;
            MemoryStream mstream = new MemoryStream();
            HttpCookie MyCookie;
            int row = 0;            
            try
            {
                // 取得 Template SS_FILES 
                fs = myfunc.get_SS_FILES(Tmp_FName);
                wk = new Workbook();
                wk.LoadFromStream(fs);

},



1>*.js
{
xtype: 'button', text: '排程資料匯出', id: 'btn_V202K',
iconCls: 'icon-article',
disabled: false,
listeners: {
click: function () {
//將 所有資料.PK 加入 CHK_PK_OBJ.PK_LIST
Ext.Ajax.request({
url: '../api/V20201API/getGridData_M?par_paging=false',

method: 'POST',
params: { all: 1 },
async: false, //將非同步功能關閉
failure: function (response, opts) {
},
success: function (response, opts) {
let Tmp_DataAry1 = [];
var obj = Ext.decode(response.responseText);
obj.T1.forEach(function (item, i) {
Tmp_DataAry1.push(item);
});

CALL_V20201K(Tmp_DataAry1); //排程資料匯出
}
});
},
},
},


function CALL_V20201K(par_DataAry1) {
var Tmp_Grid = Ext.getCmp('grid_M');
var cur_recs, cur_rec;
var Tmp_SAPNO, Tmp_PN, Tmp_QTY, Tmp_EOCND, Tmp_RMK;
var Tmp_data_JSON = ""; //將store資料轉成 JSON 的字串
var Tmp_sub_np = {};
let Tmp_DataAry1 = [];
Tmp_DataAry1 = par_DataAry1;
var Tmp_Str = "";
//將目前子畫面的資料(Table)轉成 JSON字串
let Tmp_DataString1 = JSON.stringify(Tmp_DataAry1);
//因為[備註]欄位 有/n .. 等特殊字元 , JSON.stringify 會 Error
var np = {};
np = {
      DataString1: Tmp_DataString1,
};
Ext.getCmp('s_form').submit({
url: '../../api/V20201KAPI/XLSOUT',
method: 'POST',
async: false,
standardSubmit: true, //若要傳送檔案至前端, standardSubmit必需設為 true
params: np,
});

//顯示結果訊息..
var mask = new Ext.LoadMask(Ext.getBody(), {
      msg: '處理中,請稍待...'
});

mask.show();
//使用 mask 需手動呼叫show() 方法下
//每1秒檢核一次,是否已完成, 若已完成,則不再檢核
var timer = setInterval(function () {
var r = r_cookies('Rtn_Msg');
if (!checkisnull(r)) {
mysuccessalert(r);
clearInterval(timer);
mask.hide();
timer = null;
}
}, 1000); //1000ms = 1sec