目的: V20107 – Master[存檔]完成,自動新增 4 筆Detail資料並重新顯示 Detail資料
處理說明: 1>fireEvent("eventName", event_param1,event_param2,event_param3,...);
Ex: selectionchange( this, selected, eOpts )
傳入參數如下:
this : Ext.selection.Model
selected : Ext.data.Model[] , The selected records
eOpts : Object
--> fireEvent("selectionchange",this,selected,eOpts);0
Ex: Ext.getCmp('grid_M').fireEvent("selectionchange", Ext.getCmp("grid_M").getSelectionModel(),cur_recs);
1>*.js
//先執行 Template 的 onClick , 再執行 V20107 的 onClick
Ext.getCmp('btn_save').on('click', function () {
//若 checkFormValue 有問題,則 is_Keepgoing=false , 不往下執行
if (is_keepgoing==false)
return ;
console.log('step 1 click_btn_save of V20107');
if (!check_AMM_WKSTPD_isnull()) {
console.log("if !check_AMM_WKSTPD_isnull() , return ");
return ; // AMM_WKSTPD 已有資料,不新增 4筆資料
}
//若 AMM_WKSTPD 為空值,則詢問是否為系統件維修,
//若是,則 INSERT_AMM_WKSTPD4 ,寫入 4筆資料
console.log("3 詢問是否為系統件維修嗎?");
var Tmp_Msg = "本交修件為系統件維修嗎 ?";
Ext.Msg.confirm('確認', Tmp_Msg, callBackFunc);
function callBackFunc(id) {
console.log("1 callBackFunc : 本交修件為系統件維修嗎 ?");
if (id == 'no')
return;
//insert 四筆資料 AMM_WKSTPD
var np = {};
np["MITM"] = Ext.getCmp("MITM").getValue();
np["PN"] = Ext.getCmp("PN").getValue();
np["DEPID"] = Ext.getCmp("DEPID").getValue();
np["WC"] = Ext.getCmp("WC").getValue();
var is_Ok = true;
Ext.Ajax.request({
method: "POST",
url: '../../api/V20107API/DO_Ins_AMM_WKSTPD4',
params: np,
async: false,
success: function (response, opts) {
console.log("0 response.responseText=", response.responseText);
var Tmp_Obj = Ext.decode(response.responseText);
console.log("1 Tmp_Obj=", Tmp_Obj);
if (Tmp_Obj["success"] == true) {
var Tmp_Rtn_Msg = "自動新增4筆工作步序說明資料(AMM_WKSTPD)<br>"
+ "- 進廠檢測,拆檢,組裝,完工測試<br>";
+ Tmp_Obj["Rtn_Msg"];
mysuccessalert(Tmp_Rtn_Msg);
is_Ok = true;
console.log(" 5 Ext.getCmp('grid_M').fireEvent(selectionchange) ");
//Ext.getCmp('grid_M').fireEvent("selectionchange",);
//("selectionchange", function (view, selections, options) {
var cur_recs = Ext.getCmp("grid_M").getSelectionModel().getSelection();
Ext.getCmp('grid_M').fireEvent("selectionchange", Ext.getCmp("grid_M").getSelectionModel(),cur_recs);
}
else {
var Tmp_Rtn_Msg = "自動新增4筆工作步序說明資料(AMM_WKSTPD)失敗<br>"
+ "- 進廠檢測,拆檢,組裝,完工測試<br>"
+ "請檢核!! <br>"
+ Tmp_Obj["Rtn_Msg"];
mywarnalert(Tmp_Rtn_Msg);
is_Ok= false;
}
}, //end of success
failure: function (response, opts) {
var Tmp_Obj = Ext.decode(response.responseText);
var Tmp_Rtn_Msg = "新增4筆工作步序說明資料(AMM_WKSTPD)失敗<br>"
+ "請檢核<br>"
+ Tmp_Obj["Rtn_Msg"];
mywarnalert(Tmp_Rtn_Msg);
is_Ok= false;
}
}) //end of Ext.Ajax.Request
return is_OK;
}; // end of callBackFunc(id)
}) //Ext.getCmp('btn_save').on('click', function () {
沒有留言:
張貼留言