You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DS7/DSWeb/Areas/MvcShipping/Viewsjs/MsOpSeaePre/MsOpSeaePreModifyEdit.js

1009 lines
40 KiB
JavaScript

3 years ago
Ext.namespace('Shipping');
Shipping.MsOpSeaePreModifyEdit = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsOpSeaePreModifyEdit.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsOpSeaePreModifyEdit, Ext.Panel, {
ParentWin: null,
OpStatus: 'add',
OpType: 'bs',
StoreList: null,
editRecord: null,
Editdata: null,
stroplb: '预订舱',
initUIComponents: function () {
this.bodyDel = [];
this.itemindex = 1;
this.myDate = new Date();
this.accdatesameetd = 0;
this.MsPeriod = null;
this.SALEORDERDEPTBYOP = 0;
this.storecodeservice = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsCodeOpService',
proxy: { url: '/MvcShipping/MsCodeOpService/GetDataCtnList' }
});
//人员信息加载
this.storeOpCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' }
});
this.storeOpCode.load();
//操 作
this.comboxOP = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '操 作',
store: this.storeOpCode,
forceSelection: true,
name: 'OP',
valueField: 'UserName',
displayField: 'CodeAndName'
});
//委托单位
this.storeCustCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeCustCode.load({ params: { condition: "ISCONTROLLER='1'"} });
this.comboxCustCode = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '委托单位',
store: this.storeCustCode,
forceSelection: true,
name: 'CUSTOMERNAME',
valueField: 'CustName',
displayField: 'CodeAndName'
});
//客户加载_船公司
this.storeCARRIER = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListCARRIER' }
});
this.storeCARRIER.load();
//船公司
this.comboxCARRIER = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '船公司', //'船公司',
store: this.storeCARRIER,
forceSelection: true,
queryMode: 'remote',
minChars: 0,
queryParam: 'CODENAME',
name: 'CARRIER',
valueField: 'CustName',
displayField: 'CodeAndName'
});
//客户加载_订舱代理
this.storeFORWARDER = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListFORWARDER' }
});
this.storeFORWARDER.load();
//船公司
this.comboxFORWARDER = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '订舱代理', //'订舱代理',
store: this.storeFORWARDER,
forceSelection: true,
queryMode: 'remote',
minChars: 0,
queryParam: 'CODENAME',
name: 'FORWARDER',
valueField: 'CustName',
displayField: 'CodeAndName'
});
//权限范围
this.StoreOpRange = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsOP',
proxy: { url: '/MvcShipping/MsBaseInfo/GetOpRang' }
});
this.storeCodeLoadport = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodeLoadportModel',
proxy: { url: '/CommMng/BasicDataRef/GetCodeLoadportListRm' }
});
this.comboxPORTLOAD = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '装货港', //'装货港',
store: this.storeCodeLoadport,
name: 'PORTLOAD',
valueField: 'PORT',
displayField: 'CodeAndName',
queryMode: 'remote',
minChars: 2,
queryParam: 'PORT',
matchFieldWidth: false
});
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,
name: 'PORTDISCHARGE',
matchFieldWidth: false,
valueField: 'PORT',
queryMode: 'remote',
minChars: 2,
queryParam: 'PORT',
displayField: 'CodeAndName',
listeners: {
scope: this,
blur: function (field, The, eOpts) {
field.setRawValue(field.value);
},
'select': function (combo, records, eOpts) {
if (records.length > 0) {
this.formHead.getForm().findField('LANE').setValue(records[0].data.LANE);
}
}
}
});
//箱型_集装箱列表中的下拉框加载
this.storeLANE = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.Lane',
proxy: { url: '/CommMng/BasicDataRef/GetCodeLaneList' }
});
this.storeLANE.load();
this.comboxLANE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '航线', //'航线',
store: this.storeLANE,
forceSelection: true,
name: 'LANE',
valueField: 'LANE',
displayField: 'LANE'
});
this.storeVoyVeg = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.VesselModel',
proxy: { url: '/CommMng/BasicDataRef/GetVesselList' }
});
this.storeVoyVeg.load();
this.comboxVoyVeg = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '船 名', //'船 名',
store: this.storeVoyVeg,
name: 'VESSEL',
valueField: 'VESSEL',
displayField: 'VESSEL',
listeners: {
scope: this,
blur: function (field, The, eOpts) {
_this.formEdit.getForm().findField('VESSEL').setValue(field.rawValue.toUpperCase());
}
}
});
this.storeVoyNo = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.VoyNoModel',
proxy: { url: '/CommMng/BasicDataRef/GetVoyNoList' }
});
this.comboxVoyNo = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '航次', //'航次',
store: this.storeVoyNo,
name: 'VOYNO',
valueField: 'VOYNO',
forceSelection: false,
displayField: 'VOYNO',
listeners: {
scope: this,
'focus': function (combo, The, eOpts) {
var VESSEL = this.formEdit.getForm().findField('VESSEL').getValue();
var conditionstr = " VSID IN (SELECT VSID from code_vessel where VESSEL='" + VESSEL + "') ";
_this.storeVoyNo.load({ params: { condition: conditionstr } });
},
'select': function (combo, records, eOpts) {
if (records.length > 0) {
if (records[0].data.ETD != '')
this.formEdit.getForm().findField('ETD').setValue(records[0].data.ETD);
if (records[0].data.CLOSINGDATE != '')
this.formEdit.getForm().findField('CLOSINGDATE').setValue(records[0].data.CLOSINGDATE);
}
},
blur: function (field, The, eOpts) {
_this.formEdit.getForm().findField('VOYNO').setValue(field.rawValue.toUpperCase());
}
}
});
this.storeBSSTATUS = Ext.create('Ext.data.Store', {
fields: ['FSTATUS', 'NAME']
});
this.storeBSSTATUS.add({ "FSTATUS": "船公司处理中" });
this.storeBSSTATUS.add({ "FSTATUS": "船公司已放舱未使用" });
this.storeBSSTATUS.add({ "FSTATUS": "已分配操作使用" });
this.storeBSSTATUS.add({ "FSTATUS": "订舱修改中" });
this.storeBSSTATUS.add({ "FSTATUS": "已退舱" });
this.comboxBSSTATUS = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '业务状态',
store: this.storeBSSTATUS,
valueField: 'FSTATUS',
displayField: 'FSTATUS',
forceSelection: true,
name: 'BSSTATUS',
value: '',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.formHead = Ext.widget('form', {
region: 'north',
frame: true,
title:'原始数据',
collapsed: false,
collapsible: true,
height:260,
trackResetOnLoad: true,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 70,
msgTarget: 'qtip'
},
items: [{
xtype: 'fieldset',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '业务编号',
name: 'BSNO', hidden: true
}, {
fieldLabel: '船公司',
readOnly:true,
name: 'CARRIER'
}, {
fieldLabel: '约号',
readOnly: true,
name: 'CONTRACTNO'
}, {
fieldLabel: '订舱代理',
readOnly: true,
name: 'FORWARDER'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '装货港',
readOnly: true,
name: 'PORTLOAD'
}, {
fieldLabel: '卸货港',
readOnly: true,
name: 'PORTDISCHARGE'
}, {
fieldLabel: '航线',
readOnly: true,
name: 'LANE'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '主提单号',
readOnly: true,
name: 'MBLNO'
//allowBlank: false
}, {
fieldLabel: '船名',
readOnly: true,
name: 'VESSEL'
//allowBlank: false
}, {
fieldLabel: '航次',
readOnly: true,
name: 'VOYNO'
//allowBlank: false
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel:'开船日期', //'ETD',
readOnly: true,
format: 'Y-m-d',
flex: 1,
xtype: 'datefield',
name: 'ETD'
}, {
fieldLabel: '截港日期', //'截港日期',
readOnly: true,
format: 'Y-m-d',
flex: 1,
xtype: 'datetimefield',
name: 'CLOSINGDATE'
}, {
fieldLabel: '截单日期', //'截单日期',
readOnly: true,
format: 'Y-m-d',
flex: 1,
xtype: 'datetimefield',
name: 'CLOSEDOCDATE'
}]
},{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '箱型1',
readOnly: true,
name: 'CNTR1', hidden: true
}, {
fieldLabel: '箱型2',
readOnly: true,
name: 'CNTR2', hidden: true
}, {
fieldLabel: '箱型3',
readOnly: true,
name: 'CNTR3', hidden: true
}, {
fieldLabel: '箱型4',
readOnly: true,
name: 'CNTR4', hidden: true
}, {
fieldLabel: '箱型5',
readOnly: true,
name: 'CNTR5', hidden: true
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [ {
fieldLabel: '箱型6',
readOnly: true,
name: 'CNTR6', hidden: true
}, {
fieldLabel: '箱型7',
readOnly: true,
name: 'CNTR7', hidden: true
}, {
fieldLabel: '箱型8',
readOnly: true,
name: 'CNTR8', hidden: true
}, {
fieldLabel: '箱型9',
readOnly: true,
name: 'CNTR9', hidden: true
}, {
fieldLabel: '箱型10',
readOnly: true,
name: 'CNTR10', hidden: true
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '业务状态',
readOnly: true,
name: 'BSSTATUS'
//allowBlank: false
}, {
fieldLabel: '委托单位',
readOnly: true,
name: 'CUSTOMERNAME'
//allowBlank: false
}, {
fieldLabel: '操作',
readOnly: true,
name: 'OP'
//allowBlank: false
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
xtype: 'textareafield',
grow: true,
readOnly: true,
flex: 2,
fieldLabel: '备注', //'备注',
height: 60,
name: 'REMARK',
anchor: '100%'
}]
}]//end items(fieldset 1)
}]//end root items
}); //end this.formHead
this.formEdit = Ext.widget('form', {
region: 'north',
frame: true,
title: '新数据',
collapsed: false,
collapsible: true,
height: 260,
trackResetOnLoad: true,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 70,
msgTarget: 'qtip'
},
items: [{
xtype: 'fieldset',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '业务编号',
name: 'BSNO', hidden: true
}, this.comboxCARRIER, {
fieldLabel: '约号',
name: 'CONTRACTNO'
}, this.comboxFORWARDER]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxPORTLOAD, this.comboxPORTDISCHARGE, this.comboxLANE]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '主提单号',
name: 'MBLNO',
listeners: {
scope: this,
blur: function (field, The, eOpts) {
_this.formHead.getForm().findField('MBLNO').setValue(field.value.toUpperCase().trim());
}
}
//allowBlank: false
}, this.comboxVoyVeg, this.comboxVoyNo]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '开船日期', //'ETD',
format: 'Y-m-d',
flex: 1,
xtype: 'datefield',
name: 'ETD'
}, {
fieldLabel: '截港日期', //'截港日期',
format: 'Y-m-d',
flex: 1,
xtype: 'datetimefield',
name: 'CLOSINGDATE',
listeners: {
scope: this,
'select': function (combo, mdate) {
var mydate = new Date(mdate);
var mydatestr = Ext.util.Format.date(mydate, 'Y-m-d 12:00:00');
combo.setValue(mydatestr);
}
}
}, {
fieldLabel: '截单日期', //'截单日期',
format: 'Y-m-d',
flex: 1,
xtype: 'datetimefield',
name: 'CLOSEDOCDATE',
listeners: {
scope: this,
'select': function (combo, mdate) {
var mydate = new Date(mdate);
var mydatestr = Ext.util.Format.date(mydate, 'Y-m-d 12:00:00');
combo.setValue(mydatestr);
}
}
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '箱型1',
name: 'CNTR1', hidden: true
}, {
fieldLabel: '箱型2',
name: 'CNTR2', hidden: true
}, {
fieldLabel: '箱型3',
name: 'CNTR3', hidden: true
}, {
fieldLabel: '箱型4',
name: 'CNTR4', hidden: true
}, {
fieldLabel: '箱型5',
name: 'CNTR5', hidden: true
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '箱型6',
name: 'CNTR6', hidden: true
}, {
fieldLabel: '箱型7',
name: 'CNTR7', hidden: true
}, {
fieldLabel: '箱型8',
name: 'CNTR8', hidden: true
}, {
fieldLabel: '箱型9',
name: 'CNTR9', hidden: true
}, {
fieldLabel: '箱型10',
name: 'CNTR10', hidden: true
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxBSSTATUS, this.comboxCustCode, this.comboxOP]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
xtype: 'textareafield',
grow: true,
flex: 2,
fieldLabel: '备注', //'备注',
height: 60,
name: 'REMARK',
anchor: '100%'
}]
}]//end items(fieldset 1)
}]//end root items
}); //end this.formHead
//按钮Toolbar
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [{
id: 'btnESave',
text: "保存",
iconCls: "btnsave",
handler: function (button, event) {
this.Save('0');
},
scope: this
}, {
id: 'btnESaveAndClose',
text: "保存并关闭",
handler: function (button, event) {
this.Save('1');
},
scope: this
}, '-', {
text: "关闭",
handler: function (button, event) {
window.close();
},
scope: this
}, '-', {
text: "打印",
iconCls: "btnprint",
handler: function (button, event) {
this.Print();
},
scope: this
}]
}); //end 按钮Toolbar
Ext.apply(this, {
items: [this.panelBtn, this.formHead, this.formEdit]
});
parentWin = window.parent.opener;
this.InitData();
}, //end initUIComponents
InitData: function () {
this.opStatus = 'add';
var condition = '';
_this = this;
if (parentWin) {
var ret = parentWin.OprationSwap();
this.opStatus = ret[0];
this.StoreList = ret[1];
this.editRecord = ret[2];
}
this.LoadCtn();
this.opStatus == 'edit';
condition = " BSNO='" + this.editRecord.get('BSNO') + "'";
this.LoadData(this.opStatus, condition);
}, //end InitData
LoadData: function (opstatus, condition) {
this.bodyDel = [];
this.opStatus = opstatus;
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/MvcShipping/MsOpSeaePre/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;
}
data = result.data;
this.formHead.getForm().reset();
this.formHead.getForm().setValues(data);
this.formEdit.getForm().reset();
this.formEdit.getForm().setValues(data);
//this.GetEditStatus(this.OpType);
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
},
LoadCtn: function () {
this.storecodeservice.load({
params: { condition: "OPTYPE='1'" },
callback: function (r, options, success) {
if (success) {
if (r.length != 0) {
for (i = 0; i < this.storecodeservice.getCount(); i += 1) {
var itemindex = i + 1;
var memberyf = this.storecodeservice.getAt(i);
var headfield = this.formHead.getForm().findField(memberyf.data.OPField);
if (headfield != NaN && headfield != null) {
headfield.setVisible(true);
headfield.setFieldLabel(memberyf.data.SERVICENAME);
}
var headfield = this.formEdit.getForm().findField(memberyf.data.OPField);
if (headfield != NaN && headfield != null) {
headfield.setVisible(true);
headfield.setFieldLabel(memberyf.data.SERVICENAME);
}
}
this.formHead.doLayout();
this.formEdit.doLayout();
}
}
},
scope: this
});
},
// end LoadDate
Save: function (type) {
var basicForm2 = this.formEdit.getForm();
if (!basicForm2.isValid()) {
return;
}
this.formHead.getForm().findField('BSNO').setDisabled(false);
if (this.formHead.getForm().findField('CNTR10').getValue() == '') this.formHead.getForm().findField('CNTR10').setValue('0');
if (this.formHead.getForm().findField('CNTR1').getValue() == '') this.formHead.getForm().findField('CNTR1').setValue('0');
if (this.formHead.getForm().findField('CNTR2').getValue() == '') this.formHead.getForm().findField('CNTR2').setValue('0');
if (this.formHead.getForm().findField('CNTR3').getValue() == '') this.formHead.getForm().findField('CNTR3').setValue('0');
if (this.formHead.getForm().findField('CNTR4').getValue() == '') this.formHead.getForm().findField('CNTR4').setValue('0');
if (this.formHead.getForm().findField('CNTR5').getValue() == '') this.formHead.getForm().findField('CNTR5').setValue('0');
if (this.formHead.getForm().findField('CNTR6').getValue() == '') this.formHead.getForm().findField('CNTR6').setValue('0');
if (this.formHead.getForm().findField('CNTR7').getValue() == '') this.formHead.getForm().findField('CNTR7').setValue('0');
if (this.formHead.getForm().findField('CNTR8').getValue() == '') this.formHead.getForm().findField('CNTR8').setValue('0');
if (this.formHead.getForm().findField('CNTR9').getValue() == '') this.formHead.getForm().findField('CNTR9').setValue('0');
var olddata = this.formHead.getForm().getValues(false, false, false);
this.formHead.getForm().findField('BSNO').setDisabled(true);
this.formEdit.getForm().findField('BSNO').setDisabled(false);
if (this.formEdit.getForm().findField('CNTR10').getValue() == '') this.formEdit.getForm().findField('CNTR10').setValue('0');
if (this.formEdit.getForm().findField('CNTR1').getValue() == '') this.formEdit.getForm().findField('CNTR1').setValue('0');
if (this.formEdit.getForm().findField('CNTR2').getValue() == '') this.formEdit.getForm().findField('CNTR2').setValue('0');
if (this.formEdit.getForm().findField('CNTR3').getValue() == '') this.formEdit.getForm().findField('CNTR3').setValue('0');
if (this.formEdit.getForm().findField('CNTR4').getValue() == '') this.formEdit.getForm().findField('CNTR4').setValue('0');
if (this.formEdit.getForm().findField('CNTR5').getValue() == '') this.formEdit.getForm().findField('CNTR5').setValue('0');
if (this.formEdit.getForm().findField('CNTR6').getValue() == '') this.formEdit.getForm().findField('CNTR6').setValue('0');
if (this.formEdit.getForm().findField('CNTR7').getValue() == '') this.formEdit.getForm().findField('CNTR7').setValue('0');
if (this.formEdit.getForm().findField('CNTR8').getValue() == '') this.formEdit.getForm().findField('CNTR8').setValue('0');
if (this.formEdit.getForm().findField('CNTR9').getValue() == '') this.formEdit.getForm().findField('CNTR9').setValue('0');
var newdata = this.formEdit.getForm().getValues(false, false, false);
this.formEdit.getForm().findField('BSNO').setDisabled(true);
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/MvcShipping/MsOpSeaePre/shenmodify',
scope: this,
params: {
olddata: Ext.JSON.encode(olddata),
newdata: Ext.JSON.encode(newdata)
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var returnData = jsonresult.Data;
var editp = Ext.create('MsOpSeaePre', 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();
this.opStatus = 'edit';
window.close();
} 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
GetEditStatus: function (optype) {
//var btnESaveAndNew = Ext.getCmp('btnESaveAndNew');
//var btnECopyNew = Ext.getCmp('btnECopyNew');
//var btnENew = Ext.getCmp('btnENew');
//if (optype == 'op') {
// btnESaveAndNew.disable();
// btnECopyNew.disable();
// btnENew.disable();
// this.formHead.getForm().findField('CARRIER').setDisabled(true);
// this.formHead.getForm().findField('MBLNO').setDisabled(true);
// this.formHead.getForm().findField('CONTRACTNO').setDisabled(true);
// this.formHead.getForm().findField('VESSEL').setDisabled(true);
// this.formHead.getForm().findField('VOYNO').setDisabled(true);
// this.formHead.getForm().findField('ETD').setDisabled(true);
// this.formHead.getForm().findField('CLOSINGDATE').setDisabled(true);
// this.formHead.getForm().findField('CLOSEDOCDATE').setDisabled(true);
// this.formHead.getForm().findField('PORTLOAD').setDisabled(true);
// this.formHead.getForm().findField('PORTDISCHARGE').setDisabled(true);
// this.formHead.getForm().findField('LANE').setDisabled(true);
// this.formHead.getForm().findField('FORWARDER').setDisabled(true);
// this.formHead.getForm().findField('CNTR1').setDisabled(true);
// this.formHead.getForm().findField('CNTR2').setDisabled(true);
// this.formHead.getForm().findField('CNTR3').setDisabled(true);
// this.formHead.getForm().findField('CNTR4').setDisabled(true);
// this.formHead.getForm().findField('CNTR5').setDisabled(true);
// this.formHead.getForm().findField('CNTR6').setDisabled(true);
// this.formHead.getForm().findField('CNTR7').setDisabled(true);
// this.formHead.getForm().findField('CNTR8').setDisabled(true);
// this.formHead.getForm().findField('CNTR9').setDisabled(true);
// this.formHead.getForm().findField('CNTR10').setDisabled(true);
// this.formHead.getForm().findField('CUSTOMERNAME').setVisible(true);
// this.formHead.getForm().findField('BSSTATUS').setVisible(true);
// this.formHead.getForm().findField('OP').setVisible(true);
// this.formHead.getForm().findField('REMARK').setVisible(true);
// var OPFIELD = this.formHead.getForm().findField('OP');
// if (OPFIELD.getValue() == '') OPFIELD.setValue(SHOWNAME);
//} else {
// btnESaveAndNew.enable();
// btnECopyNew.enable();
// btnENew.enable();
// this.formHead.getForm().findField('CUSTOMERNAME').setVisible(false);
// this.formHead.getForm().findField('BSSTATUS').setVisible(false);
// this.formHead.getForm().findField('OP').setVisible(false);
// this.formHead.getForm().findField('REMARK').setVisible(false);
//}
},
LoadDefValue: function () {
this.storeDefValue.load({ params: { condition: "BSTYPE='预订舱'" },
callback: function (r, options, success) {
if (success) {
if (this.storeDefValue.getCount() > 0) {
for (var j = 0; j < this.storeDefValue.getCount(); j += 1) {
var member = this.storeDefValue.getAt(j);
var headfield = this.formHead.getForm().findField(member.data.FIELDNAME);
if (headfield != NaN && headfield != null)
headfield.setValue(member.data.DEFVALUE);
};
} else {
}
}
},
scope: this
});
this.GetEditStatus();
},
LoadMustBe: function () {
this.storeMustBe.load({ params: { condition: "BSTYPE='预订舱'" },
callback: function (r, options, success) {
if (success) {
if (this.storeMustBe.getCount() > 0) {
for (var j = 0; j < this.storeMustBe.getCount(); j += 1) {
var member = this.storeMustBe.getAt(j);
var headfield = this.formHead.getForm().findField(member.data.FIELDNAME);
if (headfield != NaN && headfield != null) {
if (member.data.ISMUST == "1")
headfield.allowBlank = false;
if (member.data.ISCOLOR == "1")
headfield.setFieldStyle({ background: '#ffc' });
if (member.data.ISREADONLY == "1")
headfield.setReadOnly(true);
}
};
} else {
}
}
},
scope: this
});
},
setSaveBtnStatus: function (enable) {
var btnESave = Ext.getCmp('btnESave');
var btnESaveAndClose = Ext.getCmp('btnESaveAndClose');
var btnESaveAndNew = Ext.getCmp('btnESaveAndNew');
if (enable) {
btnESave.enable();
btnESaveAndClose.enable();
btnESaveAndNew.enable();
} else {
btnESave.disable();
btnESaveAndClose.disable();
btnESaveAndNew.disable();
}
},
//#region 上一票,下一票
PrevRecord: function () {
var j = this.StoreList.indexOf(this.editRecord);
if (j == 0) {
Ext.Msg.show({ title:'警告', msg:'已经是最前一票', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); //'警告', '已是最前一票'
return;
}
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, this.OpType);
},
NextRecord: function () {
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;
}
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, this.OpType);
},
//#endregion
Print: function () {
var basicForm = this.formHead.getForm();
var billNo = basicForm.findField('BSNO').value;
if (billNo == '*' || billNo == '') {
Ext.Msg.show({ title: '错误', msg: '单据还没有保存,请保存后再打印', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
var printType = 'MSOPSEAEPRE';
var sql1 = "SET LANGUAGE 'us_english' SELECT * FROM op_seae_pre WHERE BSNO = '" + billNo + "'";
var sql2 = "";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
},
getIsModify: function () {
if (this.formHead.getForm().isDirty() == true) {
return '业务信息';
}
else return '';
}
});