Ext.namespace('Shipping');
Shipping.MsOpAirnFenIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsOpAirnFenIndex.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsOpAirnFenIndex, Ext.Panel, {
PageSize: 20,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
EditRecord: null,
BsNo: '',
initUIComponents: function () {
var mainform = window.panelEdit;
this.EditRecord = mainform.editRecord;
this.BsNo = this.EditRecord.get('BSNO');
this.formname = "formMsOpAirnFenIndex"; //页面名称
//定义数据集
this.storectndisp = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CtnDispModel',
proxy: { url: '/CommMng/BasicDataRef/GetCtnDisp' }
});
this.StoreOpRange = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsOP',
proxy: { url: '/MvcShipping/MsBaseInfo/GetOpRang' }
});
this.StoreOpRange.load({ params: { optype: "modOrderManagement"} });
this.storeList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'MsOpAirnModel',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsOpAirn/GetFenList',
reader: {
id: 'BSNO',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//#region List列表显示信息
Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, {
width: 30
});
this.girdcolums = [{
sortable: true,
id: '',
dataIndex: '',
header: '',
width: 0
}, {
sortable: true,
id: '',
dataIndex: 'BSNO',
header: '业务编号',
width: 0
}, {
sortable: true,
id: '',
dataIndex: 'CUSTNO',
header: '委托编号',
width: 120
}, {
sortable: true,
id: '',
dataIndex: 'ORDERNO',
header: '订舱编号',
width: 120
}, {
sortable: true,
id: '',
dataIndex: 'ORDERTYPE',
header: '订舱方式',
width: 120
},
{
sortable: true,
id: '',
dataIndex: 'BSSTATUSREF',
header: '业务锁定',
align: 'center',
width: 60,
renderer: function (value, cellmeta) {
if (value == '锁定') {
return "";
}
}
},
{
sortable: true,
id: '',
dataIndex: 'FEESTATUSREF',
header: '费用锁定',
align: 'center',
width: 60,
renderer: function (value, cellmeta) {
if (value == '锁定') {
return "";
}
}
}
,
{
sortable: true,
id: '',
dataIndex: 'OPSTATUS',
header: '业务状态',
width: 60
},
{
sortable: true,
id: '',
dataIndex: 'BLTYPE',
header: '装运方式',
width: 60
},
{
sortable: true,
id: '',
dataIndex: 'ETD',
header: '开航日期',
width: 80
},
{
sortable: true,
id: '',
dataIndex: 'MBLNO',
header: '主提单号',
width: 120
},
{
sortable: true,
id: '',
dataIndex: 'CUSTOMERNAME',
header: '委托单位',
width: 120
},
{
sortable: true,
id: '',
dataIndex: 'BSDATE',
header: '接单日期',
width: 80
},
{
sortable: true,
id: '',
dataIndex: 'GOODSNAME',
header: '品名',
width: 120
},
{
sortable: true,
id: '',
dataIndex: 'PKGS',
header: '件数',
width: 80
},
{
sortable: true,
id: '',
dataIndex: 'KGS',
header: '毛重',
width: 80
},
{
sortable: true,
id: '',
dataIndex: 'CBM',
header: '尺码',
width: 80
},
{
sortable: true,
id: '',
dataIndex: 'HBLNO',
header: '分提单号',
width: 120
},
{
sortable: true,
id: '',
dataIndex: 'ACCDATE',
header: '会计期间',
width: 60
},
{
sortable: true,
id: '',
dataIndex: 'BSSOURCE',
header: '业务来源',
width: 80
},
{
sortable: true,
id: '',
dataIndex: 'BSSOURCEDETAIL',
header: '来源明细',
width: 80
},
{
sortable: true,
id: '',
dataIndex: 'INPUTBY',
header: '录入人',
width: 80
},
{
sortable: true,
id: '',
dataIndex: 'CREATETIME',
header: '创建时间',
width: 120
},
{
sortable: true,
id: '',
dataIndex: 'OP',
header: '操作员',
width: 80
},
{
sortable: true,
id: '',
dataIndex: 'SALE',
header: '揽货人',
width: 80
},
{
sortable: true,
id: '',
dataIndex: 'VESSEL',
header: '航班',
width: 100
},
{
sortable: true,
id: '',
dataIndex: 'PORTLOAD',
header: '始发港',
width: 100
},
{
sortable: true,
id: '',
dataIndex: 'PORTDISCHARGE',
header: '目的港',
width: 100
},
{
sortable: true,
id: '',
dataIndex: 'CUSTOMSER',
header: '报关行',
width: 80
},
{
sortable: true,
id: '',
dataIndex: 'KINDPKGS',
header: '件数包装',
width: 60
},
{
sortable: true,
id: '',
dataIndex: 'AIRLINES',
header: '航空公司',
width: 100
},
{
sortable: true,
id: '',
dataIndex: 'TRUCKER',
header: '承运车队',
width: 100
},
{
sortable: true,
id: '',
dataIndex: 'AGENTID',
header: '代理',
width: 100
},
{
sortable: true,
id: '',
dataIndex: 'FORWARDER',
header: '订舱代理',
width: 100
},
{
sortable: true,
id: '',
dataIndex: 'FEEKGS',
header: '计费重量',
width: 60
},
{
sortable: true,
id: '',
dataIndex: 'VOUNO',
header: '凭证号',
width: 60
}];
//定义Grid
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
columns: this.girdcolums,
// paging bar on the bottom
bbar: Ext.create('Ext.PagingToolbar', {
store: this.storeList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
})
});
/////////////以下部分为获取存储的gridpanel显示样式
// this.column = DsTruck.GetGridPanel(USERID, this.formname, this.girdcolums, 1); //使用者id,表名,中间column数组,跳过一开始的几列
this.gridList.reconfigure(this.storeList, 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.OprationStatus = 'edit';
DsOpenEditWin('/MvcShipping/MsOpAirn/Edit', "分票信息");
}, this);
_thisfenlist = this;
//按钮工具条
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [{
text: "新建",
iconCls: "btnadd",
handler: function (button, event) {
this.OprationStatus = 'add';
DsOpenEditWin('/MvcShipping/MsOpAirn/Edit', "分票信息");
},
scope: this
}, {
text: "删除",
iconCls: "btndelete",
handler: function (button, event) {
this.onDeleteClick(button, event);
},
scope: this
}, '-', {
text: "执行查询",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
},
scope: this
}, {
text: "重置条件",
iconCls: "btnreset",
handler: function (button, event) {
this.onClearSql(button, event);
},
scope: this
}, '-', {
text: "保存列表样式",
id: "btntest",
handler: function (button, event) {
this.column = DsTruck.SaveGridPanel(USERID, this.formname, this.gridList.columns, this.column, 1, true);
},
scope: this
}]
});
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 30,
items: [this.panelBtn]
});
Ext.apply(this, {
items: [this.panelTop, this.gridList]
});
//#region 打开时载入当天业务
var myDate = new Date();
var mydatestr = Ext.util.Format.date(myDate, 'Y-m-d');
this.sqlcontext = " BLTYPE='国内分单' and dbo.trimdate(B.BSDATE)='" + mydatestr + "'";
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: _this.sqlcontext, load: 'true' },
waitMsg: "正在查询数据...",
scope: this
});
//#endregion
}, //end initUIComponents
onRefreshClick: function (button, event) {
//var girdcolums = this.gridList.getColumnMode();
var sql = "BSNO<>'" + this.BsNo + "' and MASTERNO='" + this.BsNo + "'";
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
},
onDeleteClick: function (button, event) {
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var record = selections[0];
if (record.data.BSSTATUS == 'true') {
Ext.Msg.show({ title: '警告', msg: '业务已锁定,不允许删除!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
}
if (record.data.FEESTATUS == 'true') {
Ext.Msg.show({ title: '警告', msg: '费用已锁定,不允许删除!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
}
if (this.StoreOpRange.getCount() == 0) {
Ext.Msg.show({ title: '警告', msg: '权限不足,不允许删除!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
} else {
var op = record.data.OP;
var inputby = record.data.INPUTBY;
var records = DsStoreQueryBy(this.StoreOpRange, 'OPID', op);
if (records.getCount() > 0) {
} else {
var recordins = DsStoreQueryBy(this.StoreOpRange, 'OPID', inputby);
if (recordins.getCount() > 0) {
} else {
canedit = false;
Ext.Msg.show({ title: '警告', msg: '权限不足,不允许删除!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
}
}
}
Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在删除数据...');
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/MvcShipping/MsOpAirn/Delete',
params: {
data: Ext.JSON.encode(record.data)
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.storeList.remove(record);
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);
},
OprationSwap: function () {
var ret = new Array();
ret[0] = this.OprationStatus;
ret[1] = this.storeList;
ret[2] = this.SelectedRecord;
ret[3] = this.EditRecord;
return ret;
},
//#region 打印
Print: function () {
var basicForm = this.formHead.getForm();
var MASTERNO = this.BsNo;
var printType = 'MsOpAirnFENLIST';
var sql1 = "SET LANGUAGE 'us_english' SELECT * FROM op_Airn WHERE BSNO = '" + MASTERNO + "'";
var sql1 = "SET LANGUAGE 'us_english' SELECT * FROM op_Airn WHERE MASTERNO = '" + MASTERNO + "'";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
}
//#endregion
});