|
|
Ext.namespace('Shipping');
|
|
|
|
|
|
Shipping.MsOpSocCtnDetailEdit = function (config) {
|
|
|
Ext.applyIf(this, config);
|
|
|
this.initUIComponents();
|
|
|
window.Shipping.MsOpSocCtnDetailEdit.superclass.constructor.call(this);
|
|
|
};
|
|
|
|
|
|
Ext.extend(Shipping.MsOpSocCtnDetailEdit, Ext.Panel, {
|
|
|
|
|
|
ParentWin: null,
|
|
|
OpStatus: 'add',
|
|
|
StoreList: null,
|
|
|
editRecord: null,
|
|
|
|
|
|
|
|
|
initUIComponents: function () {
|
|
|
this.serialNo = 0;
|
|
|
this.workSerialNo = 0;
|
|
|
this.bodyDel = [];
|
|
|
|
|
|
//#region 编辑form
|
|
|
|
|
|
//枚举参照相关(编辑form)
|
|
|
|
|
|
|
|
|
//权限范围
|
|
|
|
|
|
|
|
|
|
|
|
this.storeCodeDisport = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'DsShipping.ux.CodeDisportModel',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetCodeDisportListRm' }
|
|
|
});
|
|
|
|
|
|
|
|
|
this.comboxPORTDISCHARGE = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '目的港',
|
|
|
store: this.storeCodeDisport,
|
|
|
matchFieldWidth: false,
|
|
|
name: 'PORTDISCHARGE',
|
|
|
queryMode: 'remote',
|
|
|
minChars: 2,
|
|
|
queryParam: 'PORT',
|
|
|
allowBlank: true,
|
|
|
valueField: 'PORT',
|
|
|
displayField: 'PORT'
|
|
|
});
|
|
|
|
|
|
this.storeCodeDisport2 = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'DsShipping.ux.CodeDisportModel',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetCodeDisportListRm' }
|
|
|
});
|
|
|
|
|
|
this.comboxPORTLOAD = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '起运港',
|
|
|
store: this.storeCodeDisport2,
|
|
|
matchFieldWidth: false,
|
|
|
allowBlank: true,
|
|
|
queryMode: 'remote',
|
|
|
minChars: 2,
|
|
|
queryParam: 'PORT',
|
|
|
name: 'PORTLOAD',
|
|
|
valueField: 'PORT',
|
|
|
displayField: 'PORT'
|
|
|
});
|
|
|
|
|
|
_this = this;
|
|
|
|
|
|
//客户加载_委托单位
|
|
|
this.storeCustCode = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'DsShipping.ux.CustomRefModel',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListRm' }
|
|
|
});
|
|
|
this.storeCustCode.load();
|
|
|
//委托单位
|
|
|
this.comboxCustCode = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '箱东',
|
|
|
store: this.storeCustCode,
|
|
|
forceSelection: true,
|
|
|
queryMode: 'remote',
|
|
|
minChars: 1,
|
|
|
queryParam: 'CODENAME',
|
|
|
name: 'CUSTOMERNAME',
|
|
|
valueField: 'CustName',
|
|
|
displayField: 'CodeAndName',
|
|
|
enableKeyEvents: true,
|
|
|
allowBlank: false,
|
|
|
listeners: {
|
|
|
scope: this,
|
|
|
'select': function (combo, records, eOpts) {
|
|
|
if (records.length > 0) {
|
|
|
var s = " ISOPERATOR=1 and LINKID in (select gid from [info_client] where SHORTNAME='" + combo.value + "')";
|
|
|
this.storeInfoClientContact.load({
|
|
|
params: { condition: s },
|
|
|
callback: function (r, options, success) {
|
|
|
if (success) {
|
|
|
if (this.storeInfoClientContact.getCount() > 0) {
|
|
|
var member = this.storeInfoClientContact.getAt(0);
|
|
|
this.comboxInfoClientContact.setValue(member.data.SHOWNAME);
|
|
|
this.formHead.getForm().findField('CUSTOMERTEL').setValue(member.data.TEL);
|
|
|
} else {
|
|
|
this.comboxInfoClientContact.setValue('');
|
|
|
this.formHead.getForm().findField('CUSTOMERTEL').setValue('');
|
|
|
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
});
|
|
|
|
|
|
|
|
|
this.storeCtn = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'DsShipping.ux.CodeCtnModel',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetCodeCtnList' }
|
|
|
});
|
|
|
this.storeCtn.load();
|
|
|
//箱型
|
|
|
this.comboxCTN = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
store: this.storeCtn,
|
|
|
forceSelection: true,
|
|
|
fieldLabel: '箱型',
|
|
|
allowBlank: true,
|
|
|
name: 'CTNALL',
|
|
|
valueField: 'CTN',
|
|
|
displayField: 'CTN'
|
|
|
});
|
|
|
|
|
|
//委托单位_联系人
|
|
|
this.storeInfoClientContact = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'DsShipping.ux.InfoClientContactModel',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetInfoClientContactList' }
|
|
|
});
|
|
|
|
|
|
//this.storeInfoClientContact.load();
|
|
|
this.comboxInfoClientContact = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel:'箱东联系人', //'客户操作',
|
|
|
store: this.storeInfoClientContact,
|
|
|
allowBlank: true,
|
|
|
name: 'CUSTOMERATTN',
|
|
|
valueField: 'SHOWNAME',
|
|
|
displayField: 'SHOWNAME',
|
|
|
listeners: {
|
|
|
scope: this,
|
|
|
'select': function (combo, records, eOpts) {
|
|
|
if (records.length > 0) {
|
|
|
|
|
|
var Cargoinforecords = DsStoreQueryBy(this.storeInfoClientContact, 'GID', records[0].data.GID);
|
|
|
if (Cargoinforecords.getCount() > 0) {
|
|
|
var Cargoinfodata = Cargoinforecords.getAt(0).data;
|
|
|
// this.formHead.getForm().findField('OPERATOREMAIL').setValue(Cargoinfodata.EMAIL);
|
|
|
this.formHead.getForm().findField('OPERATORTEL').setValue(Cargoinfodata.TEL);
|
|
|
// this.formHead.getForm().findField('OPERATORFAX').setValue(Cargoinfodata.FAX);
|
|
|
} else {
|
|
|
// this.formHead.getForm().findField('OPERATOREMAIL').setValue('');
|
|
|
this.formHead.getForm().findField('OPERATORTEL').setValue('');
|
|
|
// this.formHead.getForm().findField('OPERATORFAX').setValue('');
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
|
|
|
//表参照相关(编辑form)
|
|
|
|
|
|
|
|
|
|
|
|
//编辑form
|
|
|
this.formEdit = Ext.widget('form', {
|
|
|
region: 'north',
|
|
|
frame: true,
|
|
|
bodyPadding: 5,
|
|
|
// autoScroll: true,
|
|
|
trackResetOnLoad: true,
|
|
|
fieldDefaults: {
|
|
|
margins: '2 2 2 2',
|
|
|
labelAlign: 'right',
|
|
|
flex: 1,
|
|
|
labelWidth:70,
|
|
|
msgTarget: 'qtip'
|
|
|
},
|
|
|
|
|
|
items: [
|
|
|
{//fieldset 1
|
|
|
xtype: 'container',
|
|
|
defaultType: 'textfield',
|
|
|
layout: 'anchor',
|
|
|
defaults: {
|
|
|
anchor: '100%'
|
|
|
},
|
|
|
items: [{
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [{
|
|
|
fieldLabel: 'BSNO',
|
|
|
name: 'BSNO', flex: 0, hidden: true, margins: '0'
|
|
|
}, {
|
|
|
fieldLabel: 'CORPID',
|
|
|
name: 'CORPID', flex: 0, hidden: true, margins: '0'
|
|
|
}, {
|
|
|
fieldLabel: 'INPUTBY',
|
|
|
name: 'INPUTBY', flex: 0, hidden: true, margins: '0'
|
|
|
}, {
|
|
|
fieldLabel: '合同号',
|
|
|
labelWidth: 70,
|
|
|
allowBlank: true,
|
|
|
//readOnly: true,
|
|
|
allowBlank: true,
|
|
|
name: 'CONTRACTNO'
|
|
|
}, {
|
|
|
fieldLabel: '合同日期',
|
|
|
format: 'Y-m-d',
|
|
|
allowBlank: true,
|
|
|
flex: 1,
|
|
|
xtype: 'datefield',
|
|
|
name: 'CONTRACTDATE'
|
|
|
}, {
|
|
|
fieldLabel: '付款日期',
|
|
|
format: 'Y-m-d',
|
|
|
allowBlank: true,
|
|
|
flex: 1,
|
|
|
xtype: 'datefield',
|
|
|
name: 'CLOSEFEEDATE'
|
|
|
}, {
|
|
|
fieldLabel: '合同完成日期',
|
|
|
format: 'Y-m-d',
|
|
|
labelWidth: 90,
|
|
|
allowBlank: true,
|
|
|
flex: 1,
|
|
|
xtype: 'datefield',
|
|
|
name: 'CLOSEDOCDATE'
|
|
|
}, {
|
|
|
fieldLabel: '合同状态',
|
|
|
readOnly: true,
|
|
|
name: 'BSSTATUS'
|
|
|
}]
|
|
|
|
|
|
}, {
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [this.comboxCustCode, this.comboxInfoClientContact, {
|
|
|
fieldLabel: '箱东联系方式',
|
|
|
labelWidth: 90,
|
|
|
name: 'CUSTOMERTEL'
|
|
|
}, this.comboxPORTLOAD, this.comboxPORTDISCHARGE
|
|
|
]
|
|
|
|
|
|
}, {
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [{
|
|
|
fieldLabel: '箱型箱量',
|
|
|
readOnly: true,
|
|
|
flex: 2,
|
|
|
name: 'CNTRTOTAL'
|
|
|
}, {
|
|
|
fieldLabel: '押金',
|
|
|
allowBlank: true,
|
|
|
name: 'RENT'
|
|
|
}, {
|
|
|
fieldLabel: '押金返还日期',
|
|
|
format: 'Y-m-d',
|
|
|
labelWidth: 90,
|
|
|
|
|
|
allowBlank: true,
|
|
|
flex: 1,
|
|
|
xtype: 'datefield',
|
|
|
name: 'RETURNDEPOSITDATE'
|
|
|
}, {
|
|
|
fieldLabel: '租金合计',
|
|
|
readOnly: true,
|
|
|
name: 'DEPOSIT'
|
|
|
}]
|
|
|
|
|
|
}, {
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [{
|
|
|
fieldLabel: '备注',
|
|
|
flex: 3,
|
|
|
name: 'REMARKS'
|
|
|
},{
|
|
|
fieldLabel: '录入人',
|
|
|
readOnly: true,
|
|
|
disabled: true,
|
|
|
name: 'CREATEUSERREF'
|
|
|
}, {
|
|
|
fieldLabel: '录入日期',
|
|
|
readOnly: true,
|
|
|
disabled: true,
|
|
|
name: 'CREATETIME'
|
|
|
}]
|
|
|
|
|
|
}
|
|
|
]//end items(fieldset 1)
|
|
|
}//end fieldset 1
|
|
|
]//end root items
|
|
|
}); //end this.formEdit
|
|
|
|
|
|
//#endregion
|
|
|
|
|
|
//#region 按钮Toolbar
|
|
|
this.panelBtn = new Ext.Panel({
|
|
|
region: "north",
|
|
|
tbar: [{
|
|
|
id: 'btnEPrev',
|
|
|
text: "上一票",
|
|
|
// iconCls: "btnsave",
|
|
|
handler: function (button, event) {
|
|
|
this.PrevRecord();
|
|
|
},
|
|
|
scope: this
|
|
|
}, {
|
|
|
id: 'btnENext',
|
|
|
text: "下一票",
|
|
|
// iconCls: "btnsave",
|
|
|
handler: function (button, event) {
|
|
|
this.NextRecord();
|
|
|
},
|
|
|
scope: this
|
|
|
},
|
|
|
{
|
|
|
text: "保存",
|
|
|
iconCls: "btnsave",
|
|
|
id: 'btnsave',
|
|
|
handler: function (button, event) {
|
|
|
this.Save('0');
|
|
|
},
|
|
|
scope: this
|
|
|
},
|
|
|
{
|
|
|
text: "保存并关闭",
|
|
|
id: 'btnsaveandclose',
|
|
|
handler: function (button, event) {
|
|
|
this.Save('1');
|
|
|
},
|
|
|
scope: this
|
|
|
},
|
|
|
'-',
|
|
|
{
|
|
|
text: "保存并新建",
|
|
|
id: 'btnsaveandnew',
|
|
|
handler: function (button, event) {
|
|
|
this.Save('2');
|
|
|
},
|
|
|
scope: this
|
|
|
},
|
|
|
'-',
|
|
|
{
|
|
|
text: "复制并新建",
|
|
|
id: 'btncopyandsave',
|
|
|
handler: function (button, event) {
|
|
|
var basicForm = this.formEdit.getForm();
|
|
|
this.opStatus = 'add';
|
|
|
basicForm.findField('BSNO').setDisabled(false);
|
|
|
var field = basicForm.findField('BSNO');
|
|
|
var BSNO = NewGuid();
|
|
|
field.setValue(BSNO);
|
|
|
basicForm.findField('BSNO').setValue('')
|
|
|
basicForm.findField('BSNO').setDisabled(true);
|
|
|
for (var j = 0; j < this.storeBodyList.getCount(); j += 1) {
|
|
|
var memberbody = this.storeBodyList.getAt(j);
|
|
|
memberbody.set("BSNO", '*');
|
|
|
memberbody.set("CTN_ID", NewGuid());
|
|
|
};
|
|
|
this.storeBodyCtnList.removeAll();
|
|
|
|
|
|
this.formEdit.getForm().findField('BSSTATUS').setValue('新建');
|
|
|
this.formEdit.getForm().findField('CREATEUSERREF').setValue(SHOWNAME);
|
|
|
},
|
|
|
scope: this
|
|
|
}
|
|
|
]
|
|
|
}); //end 按钮Toolbar
|
|
|
|
|
|
//#endregion
|
|
|
|
|
|
|
|
|
//#region 明细
|
|
|
this.storeBodyList = Ext.create('Ext.data.Store', {
|
|
|
model: 'MsOpSocCtnCtn',
|
|
|
remoteSort: true,
|
|
|
proxy: {
|
|
|
type: 'ajax',
|
|
|
url: '/MvcShipping/MsOpSocCtn/GetOpSocCtnCtnList',
|
|
|
reader: {
|
|
|
id: 'GID',
|
|
|
root: 'data',
|
|
|
totalProperty: 'totalCount'
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
this.storeCodeCtn = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'DsShipping.ux.CodeCtnModel',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetCodeCtnList' }
|
|
|
});
|
|
|
this.storeCodeCtn.load();
|
|
|
this.comboxCTNALL = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
store: this.storeCodeCtn,
|
|
|
forceSelection: true,
|
|
|
name: 'CTNALL',
|
|
|
valueField: 'CTN',
|
|
|
displayField: 'CTN',
|
|
|
enableKeyEvents: true
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
//明细表表格
|
|
|
this.gridListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
|
|
|
clicksToEdit: 1
|
|
|
});
|
|
|
|
|
|
this.gridListBody = new Ext.grid.GridPanel({
|
|
|
store: this.storeBodyList,
|
|
|
enableHdMenu: false,
|
|
|
region: 'center',
|
|
|
loadMask: { msg: "数据加载中,请稍等..." },
|
|
|
trackMouseOver: true,
|
|
|
disableSelection: false,
|
|
|
plugins: [this.gridListCellEditing],
|
|
|
selType: 'cellmodel',
|
|
|
|
|
|
tbar: [{
|
|
|
text: '增加明细',
|
|
|
tooltip: '增加明细',
|
|
|
id: "btnadddetail",
|
|
|
iconCls: "btnadddetail",
|
|
|
handler: function (button, event) {
|
|
|
this.addDetail();
|
|
|
},
|
|
|
scope: this
|
|
|
}, '-', {
|
|
|
text: '删除明细',
|
|
|
tooltip: '删除明细',
|
|
|
id: "btndeldetail",
|
|
|
iconCls: "btndeletedetail",
|
|
|
handler: function (button, event) {
|
|
|
this.onDeleteDetailClick();
|
|
|
},
|
|
|
scope: this
|
|
|
}],
|
|
|
|
|
|
columns: [{
|
|
|
sortable: true,
|
|
|
dataIndex: 'CTN_ID',
|
|
|
header:'CTN_ID', //'编号',
|
|
|
hidden: true,
|
|
|
width: 0
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'BSNO',
|
|
|
header:'BSNO', //'业务编号',
|
|
|
hidden: true,
|
|
|
width: 0
|
|
|
}, {
|
|
|
dataIndex: 'CTNALL',
|
|
|
header: '箱型', //'箱型',
|
|
|
width: 65,
|
|
|
editor: this.comboxCTNALL
|
|
|
}, {
|
|
|
dataIndex: 'CTNNUM',
|
|
|
header: '箱量', //'箱量',
|
|
|
width: 60,
|
|
|
editor: {
|
|
|
xtype: 'numberfield',
|
|
|
allowBlank: false,
|
|
|
selectOnFocus: true
|
|
|
}
|
|
|
}, {
|
|
|
dataIndex: 'DEPOSITPRICE',
|
|
|
header: '单箱租金', //'箱量',
|
|
|
width: 100,
|
|
|
editor: {
|
|
|
xtype: 'numberfield',
|
|
|
allowBlank: false,
|
|
|
selectOnFocus: true
|
|
|
}
|
|
|
}, {
|
|
|
dataIndex: 'DEPOSIT',
|
|
|
header: '租金', //'箱量',
|
|
|
width: 120
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'REMARKS',
|
|
|
header: '备注',
|
|
|
editor: {
|
|
|
xtype: 'textfield',
|
|
|
selectOnFocus: true,
|
|
|
enableKeyEvents: true
|
|
|
|
|
|
},
|
|
|
width: 250
|
|
|
}]
|
|
|
});
|
|
|
|
|
|
this.gridListBody.on('edit', function (editor, e, eOpts) {
|
|
|
this.gridListAfterEdit(editor, e, eOpts);
|
|
|
}, this);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.panelBodygz = new Ext.Panel({
|
|
|
title: '集装箱信息',
|
|
|
layout: "border",
|
|
|
region: 'north',
|
|
|
height:280,
|
|
|
animate: true,
|
|
|
minHeight: 150,
|
|
|
// autoScroll: true,
|
|
|
// containerScroll: true,
|
|
|
frame: false,
|
|
|
items: [this.gridListBody]
|
|
|
});
|
|
|
|
|
|
|
|
|
//#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//#region 集装箱明细信息
|
|
|
this.storeBodyCtnList = Ext.create('Ext.data.Store', {
|
|
|
model: 'MsOpSocCtnCtnDetail',
|
|
|
remoteSort: true,
|
|
|
proxy: {
|
|
|
type: 'ajax',
|
|
|
url: '/MvcShipping/MsOpSocCtn/GetOpSocCtnCtnDetailList',
|
|
|
reader: {
|
|
|
id: 'GID',
|
|
|
root: 'data',
|
|
|
totalProperty: 'totalCount'
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
//明细表表格
|
|
|
|
|
|
this.gridListCtnBody = new Ext.grid.GridPanel({
|
|
|
store: this.storeBodyCtnList,
|
|
|
enableHdMenu: false,
|
|
|
region: 'center',
|
|
|
loadMask: { msg: "数据加载中,请稍等..." },
|
|
|
trackMouseOver: true,
|
|
|
disableSelection: false,
|
|
|
columns: [{
|
|
|
sortable: true,
|
|
|
dataIndex: 'CTNGID',
|
|
|
header: '编号',
|
|
|
hidden: true,
|
|
|
width: 0
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'CTN_ID',
|
|
|
header: '编号2',
|
|
|
hidden: true,
|
|
|
width: 0
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'BSNO',
|
|
|
header: '业务编号',
|
|
|
hidden: true,
|
|
|
width: 0
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'CTNSTATUS',
|
|
|
header: '状态',
|
|
|
width: 80
|
|
|
},{
|
|
|
sortable: true,
|
|
|
dataIndex: 'CTNNO',
|
|
|
header: '箱号',
|
|
|
width: 140
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'CTNALL',
|
|
|
header: '箱型',
|
|
|
width: 100
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'INPUTYARDDATE',
|
|
|
header: '进场时间',
|
|
|
width: 100
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'OUTYARDDATE',
|
|
|
header: '出场时间',
|
|
|
width: 100
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'PORTDISCHARGE',
|
|
|
header: '目的港',
|
|
|
width: 100
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'RTCTNDATE',
|
|
|
header: '还箱日期',
|
|
|
width: 100
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'RTCTNYARD',
|
|
|
header: '还箱场站',
|
|
|
width: 100
|
|
|
}]
|
|
|
});
|
|
|
|
|
|
// this.gridListCtnBody.on('edit', function (editor, e, eOpts) {
|
|
|
// this.gridListAfterEdit(editor, e, eOpts);
|
|
|
// }, this);
|
|
|
|
|
|
this.gridListCtnBody.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
|
|
|
|
|
|
|
|
|
var openSet = "height=700, width=1224, toolbar=no, menubar=no,scrollbars=1, resizable=1,location=no, status=no,Top= " + (screen.height - 750) / 2 + ",Left= " + (screen.width - 1100) / 2
|
|
|
var openType = "_blank";
|
|
|
var openUrl = "";
|
|
|
openUrl = "../MsCodeCtnTk/CtnView?handle=check&ctnno=" + record.data.CTNNO;
|
|
|
window.open(openUrl, openType, openSet);
|
|
|
|
|
|
}, this);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.panelCtnBody = new Ext.Panel({
|
|
|
title: '集装箱明细',
|
|
|
layout: "border",
|
|
|
region: 'center',
|
|
|
// height: 320,
|
|
|
animate: true,
|
|
|
minHeight: 250,
|
|
|
// autoScroll: true,
|
|
|
// containerScroll: true,
|
|
|
frame: false,
|
|
|
items: [this.gridListCtnBody]
|
|
|
});
|
|
|
|
|
|
|
|
|
//#endregion
|
|
|
|
|
|
|
|
|
|
|
|
//#region 布局
|
|
|
//控件布局
|
|
|
this.panelTop = new Ext.Panel({
|
|
|
layout: "border",
|
|
|
region: "north",
|
|
|
height: 28,
|
|
|
items: [this.panelBtn]
|
|
|
});
|
|
|
|
|
|
this.panelBodyAll = new Ext.Panel({
|
|
|
layout: "border",
|
|
|
region: 'center',
|
|
|
animate: true,
|
|
|
autoScroll: true,
|
|
|
containerScroll: true,
|
|
|
frame: false,
|
|
|
items: [this.formEdit, this.panelBodygz , this.panelCtnBody]
|
|
|
});
|
|
|
|
|
|
|
|
|
Ext.apply(this, {
|
|
|
items: [this.panelTop, this.panelBodyAll]
|
|
|
});
|
|
|
|
|
|
//#endregion
|
|
|
|
|
|
//绑定查询窗体
|
|
|
|
|
|
this.storeBodyList.on('beforeload', function (store) {
|
|
|
var acondition = " BSNO='" + this.editRecord.get('BSNO') + "'";
|
|
|
Ext.apply(store.proxy.extraParams, { condition: acondition });
|
|
|
}, this);
|
|
|
|
|
|
this.storeBodyCtnList.on('beforeload', function (store) {
|
|
|
var acondition = " BSNO='" + this.editRecord.get('BSNO') + "'";
|
|
|
Ext.apply(store.proxy.extraParams, { condition: acondition });
|
|
|
}, this);
|
|
|
|
|
|
this.ParentWin = window.parent.opener;
|
|
|
|
|
|
//初始化数据
|
|
|
this.InitData();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//绑定事件
|
|
|
|
|
|
}, //end initUIComponents
|
|
|
|
|
|
InitData: function () {
|
|
|
this.opStatus = 'add';
|
|
|
var condition = '';
|
|
|
if (this.ParentWin) {
|
|
|
var ret = this.ParentWin.OprationSwap();
|
|
|
this.opStatus = ret[0];
|
|
|
this.StoreList = ret[1];
|
|
|
this.editRecord = ret[2];
|
|
|
}
|
|
|
|
|
|
if (this.opStatus == 'edit')
|
|
|
condition = " BSNO='" + this.editRecord.get('BSNO') + "'";
|
|
|
|
|
|
this.LoadData(this.opStatus, condition);
|
|
|
|
|
|
}, //end InitData
|
|
|
|
|
|
LoadData: function (opstatus, condition) {
|
|
|
this.serialNo = 0;
|
|
|
this.workSerialNo = 0;
|
|
|
this.bodyDel = [];
|
|
|
|
|
|
this.opStatus = opstatus;
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在查询主表数据...',
|
|
|
url: '/MvcShipping/MsOpSocCtn/GetData',
|
|
|
params: {
|
|
|
handle: opstatus,
|
|
|
condition: condition
|
|
|
},
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
var result = Ext.JSON.decode(response.responseText);
|
|
|
if (!result.Success) {
|
|
|
Ext.Msg.show({
|
|
|
title: '提示',
|
|
|
msg: result.Message,
|
|
|
icon: Ext.MessageBox.ERROR,
|
|
|
buttons: Ext.Msg.OK
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
var data = result.data;
|
|
|
this.formEdit.getForm().reset();
|
|
|
this.formEdit.getForm().setValues(data);
|
|
|
var acondition = "";
|
|
|
if (this.opStatus == 'edit') {
|
|
|
var acondition = " BSNO='" + this.editRecord.get('BSNO') + "'";
|
|
|
}
|
|
|
else
|
|
|
acondition = " BSNO='11111'";
|
|
|
this.storeBodyList.load({ params: { condition: acondition} });
|
|
|
this.storeBodyCtnList.load({ params: { condition: acondition} });
|
|
|
|
|
|
this.GetEditStatus();
|
|
|
} else {
|
|
|
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
|
|
|
|
|
|
}, // end LoadDate
|
|
|
|
|
|
|
|
|
|
|
|
Save: function (type) {
|
|
|
var basicForm = this.formEdit.getForm();
|
|
|
|
|
|
if (!basicForm.isValid()) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
basicForm.findField('BSNO').setDisabled(false);
|
|
|
var data = basicForm.getValues();
|
|
|
basicForm.findField('BSNO').setDisabled(true);
|
|
|
if (this.opStatus == 'add') {
|
|
|
data.BSNO = NewGuid();
|
|
|
}
|
|
|
var j = 0;
|
|
|
var bodydatas = [];
|
|
|
for (var i = 0; i < this.storeBodyList.getCount(); i += 1) {
|
|
|
var member = this.storeBodyList.getAt(i);
|
|
|
j = j + 1;
|
|
|
bodydatas.push(member);
|
|
|
}
|
|
|
// if (j == 0) {
|
|
|
// Ext.Msg.show({ title: '提示', msg: '改装要求不能为空,请先录入改装要求!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
|
// return;
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
var jsonBody = ConvertRecordsToJsonAll(bodydatas);
|
|
|
|
|
|
Ext.Msg.wait('正在保存数据, 请稍侯..');
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在保存数据...',
|
|
|
url: '/MvcShipping/MsOpSocCtn/Save',
|
|
|
scope: this,
|
|
|
params: {
|
|
|
opstatus: this.opStatus,
|
|
|
data: Ext.JSON.encode(data),
|
|
|
body: jsonBody
|
|
|
},
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
Ext.MessageBox.hide();
|
|
|
var jsonresult = Ext.JSON.decode(response.responseText);
|
|
|
if (jsonresult.Success) {
|
|
|
var returnData = jsonresult.Data;
|
|
|
this.formEdit.getForm().setValues(returnData);
|
|
|
|
|
|
if (this.opStatus == 'add') {
|
|
|
var arrNewRecords = this.StoreList.add(returnData);
|
|
|
this.editRecord = arrNewRecords[0];
|
|
|
}
|
|
|
else if (this.opStatus == 'edit') {
|
|
|
var editp = Ext.create('MsOpSocCtnContract', returnData);
|
|
|
this.editRecord.fields.each(function (field) {
|
|
|
if (field.persist) {
|
|
|
name = field.name;
|
|
|
if (name != 'id')
|
|
|
this.editRecord.set(name, editp.get(name));
|
|
|
}
|
|
|
}, this);
|
|
|
this.editRecord.commit();
|
|
|
}
|
|
|
if (type == '0') {
|
|
|
this.opStatus = 'edit';
|
|
|
|
|
|
basicForm.findField('BSNO').setDisabled(true);
|
|
|
for (var j = 0; j < this.storeBodyList.getCount(); j += 1) {
|
|
|
var memberbody = this.storeBodyList.getAt(j);
|
|
|
memberbody.set("BSNO", this.editRecord.get('BSNO'));
|
|
|
memberbody.commit();
|
|
|
};
|
|
|
|
|
|
|
|
|
} else if (type == '1') {
|
|
|
this.opStatus = 'edit';
|
|
|
|
|
|
basicForm.findField('BSNO').setDisabled(true);
|
|
|
for (var j = 0; j < this.storeBodyList.getCount(); j += 1) {
|
|
|
var memberbody = this.storeBodyList.getAt(j);
|
|
|
memberbody.set("BSNO", this.editRecord.get('BSNO'));
|
|
|
memberbody.commit();
|
|
|
};
|
|
|
window.close();
|
|
|
} else {
|
|
|
this.LoadData('add', '');
|
|
|
basicForm.findField('BSNO').setDisabled(false);
|
|
|
}
|
|
|
} else {
|
|
|
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
|
|
|
}
|
|
|
} else {
|
|
|
Ext.Msg.show({ title: '请重试',
|
|
|
msg: '服务器响应出错',
|
|
|
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
}, //end save
|
|
|
|
|
|
|
|
|
addDetail: function () {
|
|
|
var record = Ext.create('MsOpSocCtnCtn', {
|
|
|
CTN_ID: NewGuid(),
|
|
|
BSNO: '*',
|
|
|
REMARKS: ''
|
|
|
});
|
|
|
this.storeBodyList.add(record);
|
|
|
var n = this.storeBodyList.getCount();
|
|
|
this.gridListCellEditing.startEditByPosition({ row: n - 1, column: 1 });
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
gridListAfterEdit: function (editor, e, eOpts) {
|
|
|
if (e.value == e.originalValue) return;
|
|
|
if (e.field == 'CTNNUM' || e.field == 'DEPOSITPRICE') {
|
|
|
var CTNNUM = e.record.data['CTNNUM'];
|
|
|
var DEPOSITPRICE = e.record.data['DEPOSITPRICE'];
|
|
|
var DEPOSIT = Mul(CTNNUM, DEPOSITPRICE);
|
|
|
e.record.set('DEPOSIT', DEPOSIT);
|
|
|
|
|
|
}
|
|
|
},
|
|
|
|
|
|
onDeletDetailClick: function () {
|
|
|
var selections = this.gridListBody.getSelectionModel().getSelection();
|
|
|
if (selections.length == 0) {
|
|
|
Ext.Msg.show({ title: '提示', msg: '请先选择要删除的集装箱信息!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
var record = selections[0];
|
|
|
Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) {
|
|
|
if (btn == 'yes') {
|
|
|
|
|
|
var bodyAddDatas = [];
|
|
|
for (var i = 0; i < selections.length; i++) {
|
|
|
var rec = selections[i];
|
|
|
bodyAddDatas.push(rec);
|
|
|
}
|
|
|
|
|
|
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
|
|
|
|
|
|
Ext.Msg.wait('正在删除数据...');
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在删除数据...',
|
|
|
url: '/MvcShipping/MsOpSocCtn/DeleteOpSocCtnCtn',
|
|
|
params: {
|
|
|
data: jsonbodyAddDatas
|
|
|
},
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
var jsonresult = Ext.JSON.decode(response.responseText);
|
|
|
if (jsonresult.Success) {
|
|
|
var acondition = " BSNO='" + this.editRecord.get('BSNO') + "'";
|
|
|
this.storeBodyList.load({ params: { condition: acondition} });
|
|
|
Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
|
}
|
|
|
else {
|
|
|
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
failure: function (response, options) {
|
|
|
Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
|
},
|
|
|
success: function (response, options) {
|
|
|
},
|
|
|
scope: this
|
|
|
}); //end Ext.Ajax.request
|
|
|
}
|
|
|
}, this);
|
|
|
},
|
|
|
|
|
|
//#endregion
|
|
|
|
|
|
PrevRecord: function () {
|
|
|
|
|
|
var modifystr = this.getIsModify();
|
|
|
if (modifystr != "") {
|
|
|
Ext.Msg.show({ title: '警告', msg: modifystr + '未保存,如果离开此页,将丢失未保存的更改 !!!', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
|
|
|
return;
|
|
|
}
|
|
|
var j = this.StoreList.indexOf(this.editRecord);
|
|
|
if (j == 0) {
|
|
|
Ext.Msg.show({ title: '警告', msg: '已是最前一票', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
|
|
|
|
|
|
return;
|
|
|
}
|
|
|
if (j == this.StoreList.count) {
|
|
|
Ext.Msg.show({ title: '警告', msg: '已是最后一票', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
var condition = '';
|
|
|
|
|
|
j = j - 1;
|
|
|
this.editRecord = this.StoreList.getAt(j);
|
|
|
if (this.opStatus == 'edit') {
|
|
|
condition = "BSNO='" + this.editRecord.get('BSNO') + "'";
|
|
|
//this.storeBodyList.load({ params: { condition: condition} });
|
|
|
}
|
|
|
this.LoadData(this.opStatus, condition);
|
|
|
},
|
|
|
// #region 编辑时按钮等的状态
|
|
|
GetEditStatus: function () {
|
|
|
var canedit = false;
|
|
|
var op = this.formEdit.getForm().findField('CREATEUSER').getValue();
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
setSaveBtnStatus: function (enable) {
|
|
|
var btnESave = Ext.getCmp('btnsave');
|
|
|
var btnESaveAndClose = Ext.getCmp('btnsaveandclose');
|
|
|
var btnESaveAndNew = Ext.getCmp('btnsaveandnew');
|
|
|
var btnECopyAndNew = Ext.getCmp('btncopyandsave');
|
|
|
|
|
|
|
|
|
if (enable) {
|
|
|
btnESave.enable();
|
|
|
btnESaveAndClose.enable();
|
|
|
btnESaveAndNew.enable();
|
|
|
|
|
|
|
|
|
} else {
|
|
|
btnESave.disable();
|
|
|
btnESaveAndClose.disable();
|
|
|
btnESaveAndNew.disable();
|
|
|
|
|
|
}
|
|
|
},
|
|
|
//#endregion
|
|
|
|
|
|
NextRecord: function () {
|
|
|
|
|
|
var modifystr = this.getIsModify();
|
|
|
if (modifystr != "") {
|
|
|
Ext.Msg.show({ title: '警告', msg: modifystr + '未保存,如果离开此页,将丢失未保存的更改 !!!', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
var j = this.StoreList.indexOf(this.editRecord);
|
|
|
|
|
|
if (j == (this.StoreList.data.length - 1)) {
|
|
|
Ext.Msg.show({ title: '警告', msg: '已是最后一票', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
var condition = '';
|
|
|
|
|
|
j = j + 1;
|
|
|
this.editRecord = this.StoreList.getAt(j);
|
|
|
if (this.opStatus == 'edit') {
|
|
|
condition = "BSNO='" + this.editRecord.get('BSNO') + "'";
|
|
|
//this.storeBodyList.load({ params: { condition: condition} });
|
|
|
}
|
|
|
this.LoadData(this.opStatus, condition);
|
|
|
},
|
|
|
getIsModify: function () {
|
|
|
|
|
|
var drmodify = this.storeBodyList.getModifiedRecords();
|
|
|
if (drmodify.length != 0)
|
|
|
return '改装要求';
|
|
|
|
|
|
|
|
|
if (panelEdit.formEdit.getForm().isDirty() == true)
|
|
|
return '申请信息';
|
|
|
|
|
|
else return '';
|
|
|
} //
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|