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.

1140 lines
45 KiB
JavaScript

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

Ext.namespace('Shipping');
Shipping.MsOpSeaePreModifyHisEdit = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsOpSeaePreModifyHisEdit.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsOpSeaePreModifyHisEdit, Ext.Panel, {
ParentWin: null,
OpStatus: 'add',
PageSize: 30,
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.PageSize = 30;
this.storecodeservice = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsCodeOpService',
proxy: { url: '/MvcShipping/MsCodeOpService/GetDataCtnList' }
});
this.storeHisList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'MsOpSeaePre',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsOpSeaePre/GetHisDataList',
reader: {
id: 'BSNO',
root: 'data',
totalProperty: 'totalCount'
}
}
});
Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, {
width: 50
});
_this = this;
this.Pagenum = Ext.create('Ext.form.field.Number', {
name: 'bottles',
fieldLabel: '每页记录数',
labelAlign: 'right',
value: this.PageSize,
maxValue: 100000,
width: 180,
minValue: 0,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.initgirdcolums = [{
sortable: true,
dataIndex: 'BSNO',
header: '业务编号',
hidden: true,
width: 80
}, {
sortable: true,
dataIndex: 'BSSTATUS',
header: '业务状态',
width: 80
}, {
sortable: true,
dataIndex: 'OP',
header: '操作员',
width: 80
}, {
sortable: true,
dataIndex: 'CUSTOMERNAME',
header: '委托单位',
width: 80
}, {
sortable: true,
dataIndex: 'REMARK',
header: '备注',
width: 200
}, {
sortable: true,
dataIndex: 'CARRIER',
header: '船公司',
width: 80
}, {
sortable: true,
dataIndex: 'CONTRACTNO',
header: '约号',
width: 80
}, {
sortable: true,
dataIndex: 'FORWARDER',
header: '订舱代理',
width: 80
}, {
sortable: true,
dataIndex: 'MBLNO',
header: '主提单号',
width: 80
}, {
sortable: true,
dataIndex: 'VESSEL',
header: '船名',
width: 100
}, {
sortable: true,
dataIndex: 'VOYNO',
header: '航次',
width: 80
}, {
sortable: true,
dataIndex: 'ETD',
header: '开船日期',
width: 80
}, {
sortable: true,
dataIndex: 'CLOSINGDATE',
header: '截港时间',
width: 100
}, {
sortable: true,
dataIndex: 'CLOSEDOCDATE',
header: '截单时间',
width: 100
}, {
sortable: true,
dataIndex: 'PORTLOAD',
header: '装货港',
width: 80
}, {
sortable: true,
dataIndex: 'PORTDISCHARGE',
header: '卸货港',
width: 80
}, {
sortable: true,
dataIndex: 'LANE',
header: '航线',
width: 80
}, {
sortable: true,
dataIndex: 'CNTRTOTAL',
header: '箱型箱量',
width: 120
}, {
sortable: true,
dataIndex: 'CREATEUSER',
header: '创建人',
width: 80
}, {
sortable: true,
dataIndex: 'CREATETIME',
header: '创建日期',
width: 80
}, {
sortable: true,
dataIndex: 'MODIFIEDUSER',
header: '修改人',
width: 80
}, {
sortable: true,
dataIndex: 'MODIFIEDTIME',
header: '修改日期',
width: 80
}];
this.girdcolums = this.initgirdcolums;
//定义Grid
this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
_this = this;
this.gridList = new Ext.grid.GridPanel({
store: this.storeHisList,
enableHdMenu: false,
region: 'north',
height:160,
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
selModel: this.GridCheckBoxModel,
columns: this.girdcolums,
// paging bar on the bottom
bbar: [Ext.create('Ext.PagingToolbar', {
store: this.storeHisList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
}), this.Pagenum]
});
/////////////以下部分为获取存储的gridpanel显示样式
this.girdcolums = DsTruck.GetGridPanel(USERID, this.formname, this.girdcolums, 1); //使用者id表名中间column数组跳过一开始的几列
this.gridList.reconfigure(this.storeHisList, this.girdcolums);
this.gridList.columns[0] = new Ext.grid.RowNumberer();
////////////////////////////
//this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
// this.SelectedRecord = record;
// this.LoadNewData("LOSTNO='" + record.data.BSNO + "' AND TYPE='2'");
// this.LoadOldData("LOSTNO='" + record.data.BSNO + "' AND TYPE='1'");
//}, this);
this.gridList.getSelectionModel().on('select', function (model, record, index) {
this.LoadNewData("LOSTNO='" + record.data.BSNO + "' AND TYPE='2'", record);
this.LoadOldData("LOSTNO='" + record.data.BSNO + "' AND TYPE='1'");
}, this);
this.storeHisList.on('beforeload', function (store) {
var sql = " MASTERNO='" + this.editRecord.get('BSNO') + "' and TYPE='1' ";
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
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
}, {
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
//按钮Toolbar
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [{
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.gridList, 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 = " MASTERNO='" + this.editRecord.get('BSNO') + "' and TYPE='1' ";
this.LoadData(this.opStatus, condition);
}, //end InitData
LoadData: function (opstatus, condition) {
this.bodyDel = [];
this.opStatus = opstatus;
var sql = condition;
this.sqlcontext = sql;
this.PageSize = this.Pagenum.getValue();
this.storeHisList.pageSize = this.PageSize;
this.storeHisList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
},
LoadNewData: function (condition,record) {
this.bodyDel = [];
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/MvcShipping/MsOpSeaePre/GetHisData',
params: {
handle: 'edit',
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.formEdit.getForm().reset();
this.formEdit.getForm().setValues(data);
if (record.data.CARRIER != data.CARRIER)
this.formEdit.getForm().findField('CARRIER').setFieldStyle({ background: '#FF4500' });
else
this.formEdit.getForm().findField('CARRIER').setFieldStyle({ background: '#FFFFFF' });
if (record.data.CONTRACTNO != data.CONTRACTNO)
this.formEdit.getForm().findField('CONTRACTNO').setFieldStyle({ background: '#FF4500' });
else
this.formEdit.getForm().findField('CONTRACTNO').setFieldStyle({ background: '#FFFFFF' });
if (record.data.FORWARDER != data.FORWARDER)
this.formEdit.getForm().findField('FORWARDER').setFieldStyle({ background: '#FF4500' });
else
this.formEdit.getForm().findField('FORWARDER').setFieldStyle({ background: '#FFFFFF' });
if (record.data.PORTLOAD != data.PORTLOAD)
this.formEdit.getForm().findField('PORTLOAD').setFieldStyle({ background: '#FF4500' });
else
this.formEdit.getForm().findField('PORTLOAD').setFieldStyle({ background: '#FFFFFF' });
if (record.data.PORTDISCHARGE != data.PORTDISCHARGE)
this.formEdit.getForm().findField('PORTDISCHARGE').setFieldStyle({ background: '#FF4500' });
else
this.formEdit.getForm().findField('PORTDISCHARGE').setFieldStyle({ background: '#FFFFFF' });
if (record.data.LANE != data.LANE)
this.formEdit.getForm().findField('LANE').setFieldStyle({ background: '#FF4500' });
else
this.formEdit.getForm().findField('LANE').setFieldStyle({ background: '#FFFFFF' });
if (record.data.MBLNO != data.MBLNO)
this.formEdit.getForm().findField('MBLNO').setFieldStyle({ background: '#FF4500' });
else
this.formEdit.getForm().findField('MBLNO').setFieldStyle({ background: '#FFFFFF' });
if (record.data.VESSEL != data.VESSEL)
this.formEdit.getForm().findField('VESSEL').setFieldStyle({ background: '#FF4500' });
else
this.formEdit.getForm().findField('VESSEL').setFieldStyle({ background: '#FFFFFF' });
if (record.data.VOYNO != data.VOYNO)
this.formEdit.getForm().findField('VOYNO').setFieldStyle({ background: '#FF4500' });
else
this.formEdit.getForm().findField('VOYNO').setFieldStyle({ background: '#FFFFFF' });
if (record.data.ETD != data.ETD)
this.formEdit.getForm().findField('ETD').setFieldStyle({ background: '#FF4500' });
else
this.formEdit.getForm().findField('ETD').setFieldStyle({ background: '#FFFFFF' });
if (record.data.CLOSINGDATE != data.CLOSINGDATE)
this.formEdit.getForm().findField('CLOSINGDATE').setFieldStyle({ background: '#FF4500' });
else
this.formEdit.getForm().findField('CLOSINGDATE').setFieldStyle({ background: '#FFFFFF' });
if (record.data.CLOSEDOCDATE != data.CLOSEDOCDATE)
this.formEdit.getForm().findField('CLOSEDOCDATE').setFieldStyle({ background: '#FF4500' });
else
this.formEdit.getForm().findField('CLOSEDOCDATE').setFieldStyle({ background: '#FFFFFF' });
if (record.data.CNTR1 != data.CNTR1)
this.formEdit.getForm().findField('CNTR1').setFieldStyle({ background: '#FF4500' });
else
this.formEdit.getForm().findField('CNTR1').setFieldStyle({ background: '#FFFFFF' });
if (record.data.CNTR2 != data.CNTR2)
this.formEdit.getForm().findField('CNTR2').setFieldStyle({ background: '#FF4500' });
else
this.formEdit.getForm().findField('CNTR2').setFieldStyle({ background: '#FFFFFF' });
if (record.data.CNTR3 != data.CNTR3)
this.formEdit.getForm().findField('CNTR3').setFieldStyle({ background: '#FF4500' });
else
this.formEdit.getForm().findField('CNTR3').setFieldStyle({ background: '#FFFFFF' });
if (record.data.CNTR4 != data.CNTR4)
this.formEdit.getForm().findField('CNTR4').setFieldStyle({ background: '#FF4500' });
else
this.formEdit.getForm().findField('CNTR4').setFieldStyle({ background: '#FFFFFF' });
if (record.data.CNTR5 != data.CNTR5)
this.formEdit.getForm().findField('CNTR5').setFieldStyle({ background: '#FF4500' });
else
this.formEdit.getForm().findField('CNTR5').setFieldStyle({ background: '#FFFFFF' });
if (record.data.CNTR6 != data.CNTR6)
this.formEdit.getForm().findField('CNTR6').setFieldStyle({ background: '#FF4500' });
else
this.formEdit.getForm().findField('CNTR6').setFieldStyle({ background: '#FFFFFF' });
if (record.data.CNTR7 != data.CNTR7)
this.formEdit.getForm().findField('CNTR7').setFieldStyle({ background: '#FF4500' });
else
this.formEdit.getForm().findField('CNTR7').setFieldStyle({ background: '#FFFFFF' });
if (record.data.CNTR8 != data.CNTR8)
this.formEdit.getForm().findField('CNTR8').setFieldStyle({ background: '#FF4500' });
else
this.formEdit.getForm().findField('CNTR8').setFieldStyle({ background: '#FFFFFF' });
if (record.data.CNTR9 != data.CNTR9)
this.formEdit.getForm().findField('CNTR9').setFieldStyle({ background: '#FF4500' });
else
this.formEdit.getForm().findField('CNTR9').setFieldStyle({ background: '#FFFFFF' });
if (record.data.CNTR10 != data.CNTR10)
this.formEdit.getForm().findField('CNTR10').setFieldStyle({ background: '#FF4500' });
else
this.formEdit.getForm().findField('CNTR10').setFieldStyle({ background: '#FFFFFF' });
if (record.data.BSSTATUS != data.BSSTATUS)
this.formEdit.getForm().findField('BSSTATUS').setFieldStyle({ background: '#FF4500' });
else
this.formEdit.getForm().findField('BSSTATUS').setFieldStyle({ background: '#FFFFFF' });
if (record.data.CUSTOMERNAME != data.CUSTOMERNAME)
this.formEdit.getForm().findField('CUSTOMERNAME').setFieldStyle({ background: '#FF4500' });
else
this.formEdit.getForm().findField('CUSTOMERNAME').setFieldStyle({ background: '#FFFFFF' });
if (record.data.OP != data.OP)
this.formEdit.getForm().findField('OP').setFieldStyle({ background: '#FF4500' });
else
this.formEdit.getForm().findField('OP').setFieldStyle({ background: '#FFFFFF' });
if (record.data.REMARK != data.REMARK)
this.formEdit.getForm().findField('REMARK').setFieldStyle({ background: '#FF4500' });
else
this.formEdit.getForm().findField('REMARK').setFieldStyle({ background: '#FFFFFF' });
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
},
LoadOldData: function (condition) {
this.bodyDel = [];
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/MvcShipping/MsOpSeaePre/GetHisData',
params: {
handle:'edit',
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.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);
var olddata = this.formHead.getForm().getValues(false, false, false);
this.formHead.getForm().findField('BSNO').setDisabled(true);
this.formEdit.getForm().findField('BSNO').setDisabled(false);
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 billNo2 = this.formEdit.getForm().findField('BSNO').value;
var printType = 'MSOPOHTER';
var sql1 = "SET LANGUAGE 'us_english' SELECT * FROM op_seae_pre_his WHERE BSNO = '" + billNo + "'";
var sql2 = "SET LANGUAGE 'us_english' SELECT * FROM op_seae_pre_his WHERE BSNO = '" + billNo2 + "'";
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 '';
}
});