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.

630 lines
21 KiB
JavaScript

Ext.namespace('Shipping');
Shipping.HistryYardIndex= function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.HistryYardIndex.superclass.constructor.call(this);
};
Ext.extend(Shipping.HistryYardIndex, Ext.Panel, {
PageSize: 30,
ParentWin: null,
feeType: 0,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
storeBodyList: null,
StoreFeeUnit: null,
StoreFeeCust: null,
EditRecord: null,
initUIComponents: function () {
//定义数据集
Ext.define('MsOpLetterYard', {
extend: 'Ext.data.Model',
idProperty: 'LE_ID',
fields: [
{ name: 'LE_ID', type: 'string' },
{ name: 'MBLNO', type: 'string' },
{ name: 'PORTDISCHARGE', type: 'string' },
{ name: 'VESSELVOYNO', type: 'string' },
{ name: 'ETD', type: 'string' },
{ name: 'PKC', type: 'string' },
{ name: 'CNTR', type: 'string' },
{ name: 'DESCRIPTION', type: 'string' },
{ name: 'YARD', type: 'string' },
{ name: 'Address', type: 'string' },
{ name: 'Tel', type: 'string' },
{ name: 'YARD2', type: 'string' },
{ name: 'Address2', type: 'string' },
{ name: 'Tel2', type: 'string' },
{ name: 'DRQ', type: 'string' },
{ name: 'CLOSINGDATE', type: 'string' },
{ name: 'CLOSEDOCDATE', type: 'string' },
{ name: 'ExportCustoms', type: 'string' },
{ name: 'CustomsCode', type: 'string' },
{ name: 'DeclarationCode', type: 'string' },
{ name: 'DOC', type: 'string' },
{ name: 'CHIEF', type: 'string' },
{ name: 'CHIEF2', type: 'string' },
{ name: 'DOCTEL', type: 'string' },
{ name: 'DOCFAX', type: 'string' },
{ name: 'DOCEMAIL', type: 'string' },
{ name: 'REMARK', type: 'string' },
{ name: 'HBLNO', type: 'string' },
{ name: 'VESSEL', type: 'string' },
{ name: 'VOYNO', type: 'string' },
{ name: 'CUSTOMERNAME', type: 'string' },
{ name: 'PORTLOAD', type: 'string' },
{ name: 'PORTDISCHARGE', type: 'string' },
{ name: 'SALE', type: 'string' },
{ name: 'CLOSEVGMDATE', type: 'string' }
]
});
this.storeList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'MsOpLetterYard',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsOpLetter/BsYardListData',
reader: {
id: 'GId',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//#region 主grid
this.gridListCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'west',
width:300,
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
selModel: this.gridListCheckBoxModel,
viewConfig: {
autoFill: true,
enableTextSelection: true
},
columns: [{
sortable: true,
dataIndex: 'MBLNO',
header: '主提单号',
width: 130
}, {
sortable: true,
dataIndex: 'HBLNO',
header: '分提单号',
width: 130
}, {
sortable: true,
dataIndex: 'VESSEL',
header: '船名',
width: 130
}, {
sortable: true,
dataIndex: 'VOYNO',
header: '航次',
width: 50
}, {
sortable: true,
dataIndex: 'ETD',
header: '开船日期',
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
width: 86
}, {
sortable: true,
dataIndex: 'PORTLOAD',
header: '装货港',
width: 130
}, {
sortable: true,
dataIndex: 'PORTDISCHARGE',
header: '卸货港',
width: 130
}, {
dataIndex: 'CUSTOMERNAME',
header: '委托单位',
width: 120
}, {
dataIndex: 'SALE',
header: '销售',
width: 70
}, {
sortable: true,
dataIndex: 'ACCDATE',
header: '会计期间',
width: 80
}, {
dataIndex: 'CARRIER',
header: '船公司',
width: 100
}, {
dataIndex: 'BSSOURCE',
header: '业务来源',
width: 80
}, {
dataIndex: 'YARD',
header: '提箱场站',
width: 80
}, {
dataIndex: 'YARD2',
header: '还箱场站',
width: 80
}, {
dataIndex: 'CNTR',
header: '集装箱',
width: 80
} ],
// paging bar on the bottom
bbar: Ext.create('Ext.PagingToolbar', {
store: this.storeList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
})
});
this.gridList.addListener('itemclick', function (dataview, record, item, index, e, b) {
_this.editRecord = record;
_this.OpStatus = 'edit';
_this.LoadData("edit", "LE_ID='" + record.data.LE_ID + "'");
}, this);
//#region 编辑formEdit 入货通知
this.formEdit = Ext.widget('form', {
region: 'north',
height: 460,
frame: true,
bodyPadding: 5,
trackResetOnLoad: true,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 70,
msgTarget: 'qtip'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: 'LE_ID',
hidden: true,
name: 'LE_ID'
}, {
fieldLabel: '单证',
name: 'DOC'
}, {
fieldLabel: '单证电话',
name: 'DOCTEL'
}, {
fieldLabel: '单证传真',
name: 'DOCFAX'
}, {
fieldLabel: '单证EMAIL',
name: 'DOCEMAIL'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '主提单号',
name: 'MBLNO'
}, {
fieldLabel: '卸货港',
name: 'PORTDISCHARGE'
}, {
fieldLabel: '船名航次',
name: 'VESSELVOYNO'
}, {
fieldLabel: '开船日期',
name: 'ETD'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '件重尺',
name: 'PKC'
}, {
xtype: 'textareafield',
flex: 3,
grow: true,
fieldLabel: '货物描述',
height: 50,
name: 'DESCRIPTION',
anchor: '100%'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '提箱场站',
name: 'YARD'
}, {
fieldLabel: '联系人',
name: 'CHIEF'
}, {
fieldLabel: '电话',
name: 'Tel'
}, {
fieldLabel: '集装箱',
name: 'CNTR'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '地址',
flex: 3,
name: 'Address'
}, {
fieldLabel: '提箱时间',
format: 'Y-m-d',
flex: 1,
xtype: 'datetimefield',
name: 'TiXiangTime'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '入货场站',
name: 'YARD2'
}, {
fieldLabel: '联系人',
name: 'CHIEF2'
}, {
fieldLabel: '电话',
name: 'Tel2'
}, { xtype: 'hiddenfield' }]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '地址',
flex: 3,
name: 'Address2'
}, {
fieldLabel: '入货时间',
format: 'Y-m-d',
flex: 1,
xtype: 'datetimefield',
name: 'RuHuoTime'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '截港日期',
format: 'Y-m-d',
flex: 1,
xtype: 'datetimefield',
name: 'CLOSINGDATE'
}, {
fieldLabel: '截单日期',
format: 'Y-m-d',
flex: 1,
xtype: 'datetimefield',
name: 'CLOSEDOCDATE'
}, {
fieldLabel: '截VGM日期',
format: 'Y-m-d',
flex: 1,
xtype: 'datetimefield',
name: 'CLOSEVGMDATE'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '出口海关',
name: 'ExportCustoms'
}, {
fieldLabel: '海关代码',
name: 'CustomsCode'
}, {
fieldLabel: '报关代码',
name: 'DeclarationCode'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
xtype: 'textareafield',
grow: true,
fieldLabel: '备注',
height: 210,
name: 'REMARK',
anchor: '100%'
}, {
xtype: 'button',
width: 90,
text: "确定引入",
iconCls: "btnrefresh",
handler: function (button, event) {
this.Import(button, event);
},
scope: this
}]
}]//end items(fieldset 1)
}); //end this.formEdit
//#endregion
this.panelpage = new Ext.Panel({
title: '入货通知详细信息',
layout: "border",
region: 'center',
animate: true,
autoScroll: true,
// containerScroll: true,
frame: false,
items: [this.formEdit]
});
//#endregion
//#region 固定费用明细表
//#region formSearch
//#region formSearch枚举参照相关
//#endregion
_this = this;
this.formSearch = Ext.widget('form', {
frame: true,
region: 'center',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 90,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '编号',
name: 'MblNo',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '从开船日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'CustDate_Min',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '至开船日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'CustDate_Max',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
xtype: 'button',
width: 90,
text: "执行查询",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
},
scope: this
}
]
}]
}]
});
//#endregion formSearch
//#region 按钮ToolBar
//#endregion
//#region 布局
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 55,
items: [this.formSearch]
});
Ext.apply(this, {
items: [this.panelTop, this.gridList, this.panelpage]
});
//#endregion
parentWin = window.parent.opener._this;
if (parentWin) {
this.storeBodyList = parentWin.storeBodyList;
this.EditRecord = parentWin.EditRecord;
}
//#region 事件绑定
this.storeList.on('beforeload', function (store) {
var sql = this.getCondition();
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
this.storeList.on('load', function (store, records) {
if (store.getCount() > 0) {
this.gridList.getSelectionModel().select(0);
//this.gridListCheckBoxModel.selectAll();
}
}, this);
//#endregion
//#region 自动刷新(已经提交但是尚未审核的业务,哪怕一票货中有一笔费用没审核也显示)
this.onAutoRefresh();
//#endregion
// this.SetBtnRight();
}, //end initUIComponents
LoadData: function (opstatus, condition) {
this.serialNo = 0;
//this.bodyDel = [];
this.opStatus = opstatus;
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/MvcShipping/MsOpLetter/GetYardData',
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.EditRecord = data;
this.formEdit.getForm().reset();
this.formEdit.getForm().setValues(data);
// this.GetEditStatus();
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}, // end LoadDate
onAutoRefresh: function () {
var sql = '';
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
},
onRefreshClick: function (button, event) {
var sql = this.getCondition();
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
},
Import: function (button, event) {
parentWin.formEdit.getForm().reset();
parentWin.formEdit.getForm().setValues(this.EditRecord);
//parentWin.opStatus = "add";
//parentWin.Save("0");
window.closeAction = 'destroy';
window.close();
},
getCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var sql = '';
var mblNo = form.findField('MblNo').getValue();
sql = sql + getAndConSql(sql, mblNo, " (B.MBLNO like '%" + mblNo + "%' or B.HBLNO like '%" + mblNo + "%') ");
var custDate_Min = form.findField('CustDate_Min').getRawValue();
sql = sql + getAndConSql(sql, custDate_Min, "B.ETD >= '" + custDate_Min + "'");
var custDate_Max = form.findField('CustDate_Max').getRawValue();
sql = sql + getAndConSql(sql, custDate_Max, "B.ETD<= '" + custDate_Max + " 23:59:59'");
return sql;
}
});