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.

1210 lines
38 KiB
JavaScript

Ext.namespace('Shipping');
Shipping.MsOpSeaeHPFenAdd = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsOpSeaeHPFenAdd.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsOpSeaeHPFenAdd, Ext.Panel, {
ParentWin: null,
OpStatus: 'add',
StoreList: null,
EditRecord: null,
addstore: false,
PageSize: 30,
FenBsNo:'',
initUIComponents: function () {
this.serialNo = 0;
this.workSerialNo = 0;
this.bodyDel = [];
this.FeeSql = '';
this.BsNo = '*';
this.DuiBillSql = '';
this.IsDebit = '0';
//#region 编辑form
//枚举参照相关(编辑form)
//表参照相关(编辑form)
//#region 明细表
//明细表表格相关
this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
//明细表-数据集
this.storeBodyList = Ext.create('Ext.data.Store', {
model: 'MsOpSeaeModel',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsOpSeae/GetFenList',
reader: {
id: 'BSNO',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//明细表表格
_thisfenadd=this;
this.gridList = new Ext.grid.GridPanel({
store: this.storeBodyList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
selModel: this.GridCheckBoxModel,
tbar: [{
text: '添加至主票',
tooltip: '添加至主票',
iconCls: "btnadddetail",
id: "btnadddetail",
handler: function (button, event) {
this.onAddClick(button, event);
},
scope: this
}],
columns: [{
sortable: true,
dataIndex: 'MASTERNO',
header: '主编号',
hidden: true,
width: 0
}, {
sortable: true,
dataIndex: 'BSNO',
header: '业务编号',
hidden: true,
width: 0
}, {
dataIndex: 'MBLNO',
header: '主提单号',
width: 130
}, {
dataIndex: 'HBLNO',
header: '分提单号',
width: 130
}, {
dataIndex: 'CUSTOMERNAME',
header: '委托单位',
width: 120
}, {
dataIndex: 'SALE',
header: '销售',
width: 70
}, {
sortable: true,
dataIndex: 'PKGS',
header: '件数',
width: 80
}, {
dataIndex: 'KINDPKGS',
header: '包装',
width: 100
}, {
dataIndex: 'KGS',
header: '重量',
width: 80
}, {
dataIndex: 'CBM',
header: '尺码',
width: 80
}, {
dataIndex: 'BLFRT',
header: '付费方式',
width: 120
}, {
dataIndex: 'DESTINATION',
header: '目的地',
width: 140
}, {
dataIndex: 'PLACEDELIVERY',
header: '交货地',
width: 140
}, {
dataIndex: 'REMARK',
header: '备注',
width: 150
}
]
});
//#region 添加业务列表
this.storeBodyAddList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'MsOpSeaeModel',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsOpSeae/GetFenList',
reader: {
id: 'BSNO',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.AddGridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
this.gridAddList = new Ext.grid.GridPanel({
store: this.storeBodyAddList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
columns: [{
sortable: true,
dataIndex: 'BSNO',
header: 'BSNO',
hidden: true,
width: 100
}, {
sortable: true,
dataIndex: 'MBLNO',
header: '主提单号',
width: 120
}, {
dataIndex: 'VESSEL',
header: '船名',
width: 160
}, {
dataIndex: 'VOYNO',
header: '航次',
width: 60
}, {
dataIndex: 'ETD',
header: '开船日期',
width: 80
}, {
dataIndex: 'PORTDISCHARGE',
header: '卸货港',
width: 140
}, {
dataIndex: 'PORTLOAD',
header: '装货港',
width: 140
}, {
sortable: true,
dataIndex: 'CUSTNO',
header: '委托编号',
width: 108
}, {
sortable: true,
dataIndex: 'PKGS',
header: '件数',
width: 80
}, {
dataIndex: 'KINDPKGS',
header: '包装',
width: 100
}, {
dataIndex: 'KGS',
header: '重量',
width: 80
}, {
dataIndex: 'CBM',
header: '尺码',
width: 80
}, {
dataIndex: 'BLFRT',
header: '付费方式',
width: 120
}, {
dataIndex: 'REMARK',
header: '备注',
width: 150
}
]
});
_this = this;
//#endregion
//#region 添加费用列表
this.storeAddFenList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'MsOpSeaeModel',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsOpSeae/GetFenList',
reader: {
id: 'BSNO',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.AddFenGridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
this.gridAddFenList = new Ext.grid.GridPanel({
store: this.storeAddFenList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
selModel: this.AddFenGridCheckBoxModel,
tbar: [{
text: '取消合票',
tooltip: '取消合票',
id: 'btndeldetail',
iconCls: "btndeletedetail",
handler: function (button, event) {
this.onDeleteClick(button, event);
},
scope: this
}],
columns: [{
sortable: true,
dataIndex: 'MASTERNO',
header: '主编号',
hidden: true,
width: 0
}, {
sortable: true,
dataIndex: 'BSNO',
header: '业务编号',
hidden: true,
width: 0
}, {
dataIndex: 'MBLNO',
header: '主提单号',
width: 130
}, {
dataIndex: 'HBLNO',
header: '分提单号',
width: 130
}, {
dataIndex: 'CUSTOMERNAME',
header: '委托单位',
width: 120
}, {
dataIndex: 'SALE',
header: '销售',
width: 70
}, {
sortable: true,
dataIndex: 'PKGS',
header: '件数',
width: 80
}, {
dataIndex: 'KINDPKGS',
header: '包装',
width: 100
}, {
dataIndex: 'KGS',
header: '重量',
width: 80
}, {
dataIndex: 'CBM',
header: '尺码',
width: 80
}, {
dataIndex: 'BLFRT',
header: '付费方式',
width: 120
}, {
dataIndex: 'DESTINATION',
header: '目的地',
width: 140
}, {
dataIndex: 'PLACEDELIVERY',
header: '交货地',
width: 140
}, {
dataIndex: 'REMARK',
header: '备注',
width: 150
}
]
});
this.gridAddFenList.on('edit', function (editor, e, eOpts) {
this.gridAddFenListAfterEdit(editor, e, eOpts);
}, this);
//#endregion
_this = this;
this.storeVoyVeg = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.VesselModel',
proxy: { url: '/CommMng/BasicDataRef/GetVesselList' }
});
this.storeVoyVeg.load({ params: { condition: ""} });
this.comboxVoyVeg = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '船 名',
store: this.storeVoyVeg,
name: 'VESSEL',
valueField: 'VESSEL',
flex: 1,
displayField: 'VESSEL',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_thisfenadd.onRefreshClick();
}
}
}
});
this.comboxVoyVeg2 = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '船 名',
store: this.storeVoyVeg,
name: 'VESSEL2',
valueField: 'VESSEL',
flex: 1,
displayField: 'VESSEL',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_thisfenadd.onRefresh2Click();
}
}
}
});
this.formSearch = Ext.widget('form', {
frame: true,
region: 'north',
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) {
_thisfenadd.onRefreshClick();
}
}
}
}, this.comboxVoyVeg, {
fieldLabel: '航次',
name: 'VOYNO',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_thisfenadd.onRefreshClick();
}
}
}
}, {
fieldLabel: '从开船日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ExpDateBgn',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_thisfenadd.onRefreshClick();
}
}
}
}, {
fieldLabel: '到开船日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ExpDateEnd',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_thisfenadd.onRefreshClick();
}
}
}
}, {
xtype: 'button',
width: 90,
text: "查询分票",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
},
scope: this
}, {
xtype: 'button',
width: 90,
text: "重置条件",
iconCls: "btnreset",
handler: function (button, event) {
this.onClearSql(button, event);
},
scope: this
}
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
this.formSearch2 = Ext.widget('form', {
frame: true,
region: 'north',
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: 'MBLNO2',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_thisfenadd.onRefresh2Click();
}
}
}
}, this.comboxVoyVeg2, {
fieldLabel: '航次',
name: 'VOYNO2',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_thisfenadd.onRefresh2Click();
}
}
}
}, {
fieldLabel: '从开船日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ExpDateBgn2',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_thisfenadd.onRefresh2Click();
}
}
}
}, {
fieldLabel: '到开船日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ExpDateEnd2',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_thisfenadd.onRefresh2Click();
}
}
}
}, {
xtype: 'button',
width: 90,
text: "查询主票",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefresh2Click(button, event);
},
scope: this
}, {
xtype: 'button',
width: 90,
text: "重置条件",
iconCls: "btnreset",
handler: function (button, event) {
this.onClearSql2(button, event);
},
scope: this
}
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
this.panelService = new Ext.Panel({
layout: "border",
region: 'center',
margin: '2 2',
items: [this.gridList]
});
this.paneldetail = new Ext.Panel({
title: '未配箱拼箱分票',
layout: "border",
region: "center",
split: true,
items: [
this.formSearch,
this.panelService
]
});
//#region 集装箱-数据集
this.storeBodyListCtn = Ext.create('Ext.data.Store', {
model: 'MsOpSeaeDetail',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsOpSeae/GetBodyList',
reader: {
id: 'BsNo,CTNCODE,CTN_ID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.gridListCtnCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
this.gridListCtn = new Ext.grid.GridPanel({
store: this.storeBodyListCtn,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
selModel: this.gridListCtnCheckBoxModel,
selType: 'cellmodel',
columns: [{
sortable: true,
dataIndex: 'CTN_ID',
header: '编号',
hidden: true,
width: 0
}, {
sortable: true,
dataIndex: 'BSNO',
header: '业务编号',
hidden: true,
width: 0
}, {
sortable: true,
dataIndex: 'CTNCODE',
header: '序号',
width: 30
}, {
dataIndex: 'CTNALL',
header: '箱型',
width: 48
}, {
dataIndex: 'CTNNUM',
header: '箱量',
width: 30
}, {
dataIndex: 'CNTRNO',
header: '箱号',
width: 100
}, {
dataIndex: 'SEALNO',
header: '封号',
width: 65
}, {
sortable: true,
dataIndex: 'PKGS',
header: '件数',
width: 60
}, {
dataIndex: 'KINDPKGS',
header: '包装',
width: 70
}, {
dataIndex: 'KGS',
header: '重量',
width: 60
}, {
dataIndex: 'CBM',
header: '尺码',
width: 60
}, {
dataIndex: 'TAREWEIGHT',
header: '箱皮重',
width: 60
}, {
dataIndex: 'REMARK',
header: '备注',
width: 150
}]
});
//#endregion
this.panelBodyCtn = new Ext.Panel({
title: '主票集装箱信息',
layout: "border",
height: 120,
region: 'south',
//margin: '5 10',
frame: true,
items: [this.gridListCtn]
});
//#region 分票集装箱明细
//#endregion
//#region 合计列表
this.SumField = [
{ name: 'NOBILL', type: 'number' },
{ name: 'KGS', type: 'number' },
{ name: 'PKGS', type: 'number' },
{ name: 'CBM', type: 'number' }
];
this.storeSumList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
fields: this.SumField,
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsOpSeae/GetDataListSum',
reader: {
id: '',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.girdcolumsSum = [{
sortable: true,
dataIndex: 'NOBILL',
header: '票数',
align: 'right',
width: 60
}, {
sortable: true,
dataIndex: 'PKGS',
header: '件数',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>'; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right',
width: 80
}, {
sortable: true,
dataIndex: 'KGS',
header: '毛重',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>'; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right',
width: 80
}, {
sortable: true,
dataIndex: 'CBM',
header: '尺码',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>'; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right',
width: 60
}
];
this.gridListSum = new Ext.grid.GridPanel({
store: this.storeSumList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
columns: this.girdcolumsSum
});
this.panelSum = new Ext.Panel({
title: '分票合计',
layout: "border",
height: 120,
region: 'south',
margin: '0 0',
frame: true,
items: [this.gridListSum]
});
//#endregion
//this.panelBodysouth = new Ext.Panel({
// layout: "border",
// height: 160,
// region: 'south',
// //margin: '5 10',
// frame: true,
// items: [this.panelSum]
//});
this.panelAddService = new Ext.Panel({
layout: "border",
region: 'west',
title: '合票主票',
width: 550,
margin: '2 2',
items: [this.gridAddList, this.panelBodyCtn]
});
this.panelAddfen = new Ext.Panel({
layout: "border",
region: 'center',
title: '已合票分票',
split: true,
margin: '2 2',
items: [this.gridAddFenList, this.panelSum ]
});
this.paneladddetail = new Ext.Panel({
layout: "border",
region: 'center',
// height: 400,
items: [this.panelAddService, this.panelAddfen
]
});
this.paneladd = new Ext.Panel({
layout: "border",
height: 500,
region: "north",
items: [
this.formSearch2, this.paneladddetail
]
});
//#endregion 明细表
//#region 布局
//控件布局
Ext.apply(this, {
items: [this.paneladd, this.paneldetail]
});
//#endregion
//绑定查询窗体
this.ParentWin = window.parent.opener;
//初始化数据
this.InitData();
//绑定事件
this.storeBodyList.on('beforeload', function (store) {
var sql = this.getCondition();
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
this.storeBodyList.on('load', function (store, records) {
if (store.getCount() > 0) {
this.gridList.getSelectionModel().select(0);
}
}, this);
this.storeBodyAddList.on('beforeload', function (store) {
var sql = this.getCondition2();
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
this.storeBodyAddList.on('load', function (store, records) {
if (store.getCount() > 0) {
this.gridAddList.getSelectionModel().select(0);
} else {
this.storeAddFenList.removeAll();
_thisfenadd.BsNo = '*';
}
}, this);
this.gridAddList.getSelectionModel().on('select', function (model, record, index) {
_thisfenadd.BsNo = record.data.BSNO;
var sql = "";
sql = " MASTERNO='" + _thisfenadd.BsNo + "' AND BSNO<>MASTERNO";
this.storeAddFenList.load({ params: { condition: sql} });
this.storeSumList.load({ params: { condition: sql} });
this.storeBodyListCtn.load({ params: { condition: " BSNO='" + _thisfenadd.BsNo + "'"} });
}, this);
this.storeAddFenList.on('beforeload', function (store) {
var sql = "";
sql = " MASTERNO='" + _thisfenadd.BsNo + "' AND BSNO<>MASTERNO";
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
}, //end initUIComponents
InitData: function () {
this.onRefreshClick();
this.onRefresh2Click();
}, //end InitData
onAddClick: function (button, event) {
this.addBill();
},
onDeleteClick: function (button, event) {
this.deleteBill();
}, //end onAddDetailClick
addBill: function () {
if (_thisfenadd.BsNo=='*') {
Ext.Msg.show({ title: '提示', msg: '请选择要添加分票的主票!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
var selectedRecords = this.gridList.selModel.getSelection();
if (selectedRecords.length == 0) {
Ext.Msg.show({ title: '提示', msg: '没有选择要添加的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
var bodyAddDatas = [];
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
bodyAddDatas.push(rec);
}
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
_thisfenadd = this;
Ext.Ajax.request({
waitMsg: '正在添加数据...',
url: '/MvcShipping/MsOpSeae/HPFenAdd',
params: {
bsno: _thisfenadd.BsNo,
data: jsonbodyAddDatas
},
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;
} else {
_thisfenadd.onRefreshClick();
var sql = " MASTERNO='" + _thisfenadd.BsNo + "' AND BSNO<>MASTERNO";
this.storeAddFenList.load({ params: { condition: sql} });
this.storeSumList.load({ params: { condition: sql } });
this.storeBodyListCtn.reload();
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
},
deleteBill: function () {
if (_thisfenadd.BsNo == '*') {
Ext.Msg.show({ title: '提示', msg: '请选择要添加取消的主票!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
var selectedRecords = this.gridAddFenList.selModel.getSelection();
if (selectedRecords.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请选择要取消合票的分票!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
var bodyAddDatas = [];
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
bodyAddDatas.push(rec);
}
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
var sql = this.BillSql;
_thisfenadd = this;
Ext.Ajax.request({
waitMsg: '正在处理数据...',
url: '/MvcShipping/MsOpSeae/CancelHPFen',
params: {
bsno: _thisfenadd.BsNo,
data: jsonbodyAddDatas
},
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;
} else {
_thisfenadd.onRefreshClick();
var sql = " MASTERNO='" + _thisfenadd.BsNo + "' AND BSNO<>MASTERNO";
this.storeAddFenList.load({ params: { condition: sql} });
this.storeSumList.load({ params: { condition: sql } });
this.storeBodyListCtn.reload();
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
},
//#region 分票集装箱操作
//#endregion
onRefreshClick: function (button, event) {
var sql = this.getCondition();
this.storeBodyList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql} });
},
onRefresh2Click: function (button, event) {
var sql = this.getCondition2();
this.storeBodyAddList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql} });
this.storeSumList.load({ params: { condition: sql} });
},
onClearSql: function () {
var form = this.formSearch.getForm();
form.reset();
},
onClearSql2: function () {
var form = this.formSearch2.getForm();
form.reset();
},
getCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var sql = " B.BLTYPE='合票分票' AND BSNO=MASTERNO ";
var customNo = form.findField('MBLNO').getValue();
sql = sql + getAndConSql(sql, customNo, " (B.CUSTNO like '%" + customNo + "%' or B.MBLNO like '%" + customNo + "%' or B.HBLNO like '%" + customNo + "%' )");
var expDateBgn = form.findField('ExpDateBgn').getRawValue();
sql = sql + getAndConSql(sql, expDateBgn, "B.ETD >='" + expDateBgn + "'");
var expDateEnd = form.findField('ExpDateEnd').getRawValue();
sql = sql + getAndConSql(sql, expDateEnd, "B.ETD <='" + expDateEnd + "'");
//船名
var VESSEL = form.findField('VESSEL').getValue();
sql = sql + getAndConSql(sql, VESSEL, "B.VESSEL like '%" + VESSEL + "%'");
//航次
var VOYNO = form.findField('VOYNO').getValue();
sql = sql + getAndConSql(sql, VOYNO, "B.VOYNO like '%" + VOYNO + "%'");
return sql;
},
getCondition2: function () {
var form = this.formSearch2.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var sql = " B.BLTYPE='合票主票' AND B.BSSTATUS<>1 ";
var customNo = form.findField('MBLNO2').getValue();
sql = sql + getAndConSql(sql, customNo, " (B.CUSTNO like '%" + customNo + "%' or B.MBLNO like '%" + customNo + "%' or B.HBLNO like '%" + customNo + "%' )");
var expDateBgn = form.findField('ExpDateBgn2').getRawValue();
sql = sql + getAndConSql(sql, expDateBgn, "B.ETD >='" + expDateBgn + "'");
var expDateEnd = form.findField('ExpDateEnd2').getRawValue();
sql = sql + getAndConSql(sql, expDateEnd, "B.ETD <='" + expDateEnd + "'");
//船名
var VESSEL = form.findField('VESSEL2').getValue();
sql = sql + getAndConSql(sql, VESSEL, "B.VESSEL like '%" + VESSEL + "%'");
//航次
var VOYNO = form.findField('VOYNO2').getValue();
sql = sql + getAndConSql(sql, VOYNO, "B.VOYNO like '%" + VOYNO + "%'");
return sql;
},
// #region 根据权限和状态判断是否允许修改
GetEditStatus: function () {
var canedit = false;
this.formEdit.getForm().findField('BILLSTATUS').setDisabled(false);
var bsStatus = this.formEdit.getForm().findField('BILLSTATUS').getValue();
var op = this.formEdit.getForm().findField('APPLICANTNAME').getValue();
this.formEdit.getForm().findField('BILLSTATUS').setDisabled(true);
_thisfenadd = this;
this.StoreOpRange.load({ params: { optype: "modPaySettleAppList" },
callback: function (r, options, success) {
if (success) {
if (r.length != 0) {
var records = DsStoreQueryBy(_thisfenadd.StoreOpRange, 'OPID', op);
if ((bsStatus != 1) && (bsStatus != 6)) {
this.setSaveBtnStatus(false);
} else {
_thisfenadd.setSaveBtnStatus(canedit);
}
}
}
}
});
},
setSaveBtnStatus: function (enable) {
var btnESave = Ext.getCmp('btnESave');
var btnESaveAndClose = Ext.getCmp('btnESaveAndClose');
var btnESaveAndNew = Ext.getCmp('btnESaveAndNew');
var btnEAddDetail = Ext.getCmp('btnadddetail');
var btnEDeleteDetail = Ext.getCmp('btndeldetail');
if (enable) {
btnESave.enable();
btnESaveAndClose.enable();
btnESaveAndNew.enable();
btnEAddDetail.enable();
btnEDeleteDetail.enable();
} else {
btnESave.disable();
btnESaveAndClose.disable();
btnESaveAndNew.disable();
btnEAddDetail.disable();
btnEDeleteDetail.disable();
}
}
});