目的: V120501– 開啟子視窗 - [新增領用登記] - Form
var win = getMyWindow("新增領用登記", J_formFields_Sub1, mySub1_Btns);
{
xtype: 'button', text: '確定', id: 'OkBtn_mySub1',
listeners: {
click: function () { .. }
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();
};