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.

525 lines
18 KiB
JavaScript

10 months ago
//集运管理-路单查询
Ext.namespace('DsImportRpt');
DsImportRpt.RptImportKcIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.DsImportRpt.RptImportKcIndex.superclass.constructor.call(this);
};
Ext.extend(DsImportRpt.RptImportKcIndex, Ext.Panel, {
PageSize: 500,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
initUIComponents: function () {
//定义数据集
this.storeList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
fields: [
{ name: 'Billno', type: 'string' },
{ name: 'ContractNo', type: 'string' },
{ name: 'HTH', type: 'string' },
{ name: 'CZRf', type: 'string' },
{ name: 'KFRf', type: 'string' },
{ name: 'CZdate', type: 'string' },
{ name: 'text', type: 'string' },
{ name: 'seller', type: 'string' },
{ name: 'buyer', type: 'string' },
{ name: 'Vessel', type: 'string' },
{ name: 'Voyage', type: 'string' },
{ name: 'Sailingdate', type: 'string' },
{ name: 'ArrivalDate', type: 'string' },
{ name: 'ContainerNo', type: 'string' },
{ name: 'SealNo', type: 'string' },
{ name: 'goodname', type: 'string' },
{ name: 'cargoinfoRf', type: 'string' },
{ name: 'cargociqRf', type: 'string' },
{ name: 'InNum', type: 'number' },
{ name: 'OutNum', type: 'number' },
{ name: 'FactoryNo', type: 'string' },
{ name: 'Weight', type: 'number' },
{ name: 'Weight_Out', type: 'number' },
{ name: 'CompanyName', type: 'string' },
{ name: 'PLEDGE', type: 'string' }
],
remoteSort: false,
proxy: {
type: 'ajax',
url: '/Import/RptImportKc/GetDataList',
reader: {
id: '',
root: 'data',
totalProperty: 'totalCount'
}
}
});
Ext.define('companymb', {
extend: 'Ext.data.Model',
fields: [
{ name: 'gid', type: 'string' },
{ name: 'name', type: 'string' }
]
});
this.formname = "RptImportKC";
this.storeport = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeport.load({ params: { enumTypeId: 10} });
this.comboxport = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '目的港',
store: this.storeport,
name: 'port'
});
this.storeBuyer = Ext.create('DsExt.ux.RefTableStore', {
model: 'Tradermb',
proxy: { url: '/CommMng/BasicDataRef/GetTrader' }
});
this.storeBuyer.load({ params: { condition: " isagentcn=1 "} });
this.comboxBuyer = Ext.create('Ext.ux.form.field.BoxSelect', {
fieldLabel: '客户',
name:'buyer',
autosize: true,
bodyPadding: 7,
flex: 1,
labelWidth: 90,
store: this.storeBuyer,
queryMode: 'local',
triggerOnClick: false,
valueField: 'name',
displayField: 'codename'
});
this.storeKF = Ext.create('DsExt.ux.RefTableStore', {
model: 'Tradermb',
proxy: { url: '/CommMng/BasicDataRef/GetTrader' }
});
this.storeKF.load({ params: { condition: " ISWAREHOUSE=1 "} });
this.comboxKF = Ext.create('Ext.ux.form.field.BoxSelect', {
fieldLabel: '仓库',
name: 'KFstate',
autosize: true,
bodyPadding: 7,
flex: 1,
labelWidth: 90,
store: this.storeKF,
queryMode: 'local',
triggerOnClick: false,
valueField: 'name',
displayField: 'codename'
});
this.storeCZState = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeCZState.load({ params: { enumTypeId: 8} });
this.comboxCZState = Ext.create('Ext.ux.form.field.BoxSelect', {
fieldLabel: '操作状态',
name: 'CZState',
autosize: true,
bodyPadding: 7,
flex: 3,
labelWidth: 90,
store: this.storeCZState,
queryMode: 'local',
triggerOnClick: false,
valueField: 'EnumValueId',
displayField: 'EnumValueName'
});
this.storeCompany = Ext.create('DsExt.ux.RefTableStore', {
model: 'companymb',
proxy: { url: '/CommMng/BasicDataRef/GetcompanyList' }
});
this.storeCompany.load({ params: { condition: ""} });
this.comboxCompany = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '用证公司',
store: this.storeCompany,
name: 'company',
valueField: 'gid',
displayField: 'name'
});
this.storePLEDGE = Ext.create('DsExt.ux.RefTableStore', {
model: 'Tradermb',
proxy: { url: '/CommMng/BasicDataRef/GetTrader' }
});
this.storePLEDGE.load({ params: { condition: " 1=1 "} });
this.comboxPLEDGE = Ext.create('DsExt.ux.RefTableCombox', {
//fieldLabel: '质押权',
forceSelection: true,
store: this.storePLEDGE,
name: 'PLEDGE',
valueField: 'name',
displayField: 'codename',
flex: 2
});
//定义Grid
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
features: [{
ftype: 'summary'//Ext.grid.feature.Summary表格汇总特性
}],
columns: [{
sortable: true,
dataIndex: 'Billno',
header: '提单号',
width: 130
}, {
sortable: true,
dataIndex: 'ContractNo',
header: '合同序列号',
width: 65, hidden: true
}, {
sortable: true,
dataIndex: 'HTH',
header: '合同号',
width: 100
}, {
sortable: true, id: '',
dataIndex: 'CompanyName',
header: '用证公司',
width: 80
}, {
sortable: true,
dataIndex: 'buyer',
header: '客户名称',
width: 65
}, {
sortable: true,
dataIndex: 'ArrivalDate',
header: '到港日期',
width: 70
}, {
sortable: true,
dataIndex: 'goodname',
header: '商品名称',
width: 65
}, {
sortable: true,
dataIndex: 'FactoryNo',
header: '厂号',
width: 90
}, {
sortable: true,
dataIndex: 'InNum',
header: '入库数量',
summaryType: 'sum',
width: 76
}, {
sortable: true,
dataIndex: 'OutNum',
header: '出库数量',
summaryType: 'sum',
width: 60
}, {
sortable: true,
dataIndex: 'Weight',
header: '入库数量(吨)',
summaryType: 'sum',
width: 60
}, {
sortable: true,
dataIndex: 'Weight_Out',
header: '出库数量(吨)',
summaryType: 'sum',
width: 60
}, {
sortable: true,
dataIndex: 'CZRf',
header: '库存状态',
width: 60
}, {
sortable: true,
dataIndex: 'KFRf',
header: '库房',
width: 60
}, {
sortable: true,
dataIndex: 'CZdate',
header: '操作日期',
width: 60
}, {
sortable: true,
dataIndex: 'Vessel',
header: '船名',
width: 60
}, {
sortable: true,
dataIndex: 'Voyage',
header: '航次',
width: 60
}, {
sortable: true,
dataIndex: 'ContainerNo',
header: '箱号',
width: 80
}, {
sortable: true,
dataIndex: 'SealNo',
header: '封号',
width: 80
}, {
sortable: true,
dataIndex: 'cargoinfoRf',
header: 'HS编码',
width: 80
}, {
sortable: true,
dataIndex: 'cargociqRf',
header: 'CIQ编码',
width: 80
}, {
sortable: true,
dataIndex: 'text',
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('itemdblclick', function (dataview, record, item, index, e, b) {
// alert('0....' + dataview.toString() + ',' + record.toString() + ',' + item.toString() + ',' + index.toString() + ',' + e.toString() + ',' + b.toString());
this.SelectedRecord = record;
this.OprationStatus = 'edit';
DsOpenEditWin('/Import/XXH_single/Edit', '', 650, 1150);
}, 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: [this.comboxport,this.comboxCompany, {
fieldLabel: '从..到港日',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ExpDateBgn'
}, {
fieldLabel: '到..到港日',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ExpDateEnd'
}, {
fieldLabel: '从..操作日',
format: 'Y-m-d',
xtype: 'datefield',
name: 'CZDateBgn'
}, {
fieldLabel: '到..操作日',
format: 'Y-m-d',
xtype: 'datefield',
name: 'CZDateEnd'
}
]
}, {//fieldset 2
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxBuyer,this.comboxKF]
}]
}, {//fieldset 3
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxCZState,this.comboxPLEDGE, {
fieldLabel: '库存清空',
xtype: 'checkbox',
name: 'KCClear', flex: 1
}]
}]
} //end items(fieldset 3)
]
}
]//end root items
});
//#endregion formSearch
//查询工具条
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [
{
text: "执行查询",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
},
scope: this
}, {
text: "导出Excel",
id: "btnExportExcel",
iconCls: 'btnexportexcel',
handler: function (button, event) {
this.onExportClick(button, event);
},
scope: this
}
]
});
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 125,
items: [this.formSearch, this.panelBtn]
});
Ext.apply(this, {
items: [this.panelTop, this.gridList]
});
this.storeList.on('beforeload', function (store) {
if (!this.checkSearchCondition())
return;
var sql = this.getCondition();
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
}, //end initUIComponents
onRefreshClick: function (button, event) {
if (!this.checkSearchCondition())
return;
var sql = this.getCondition();
this.storeList.load({
params: { start: 0, limit: this.PageSize, condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
},
getStrValue: function (list) {
var _list = [];
for (var _i = 0; _i < list.length; _i++) {
_list.push("'" + list[_i] + "'");
}
return _list;
},
getCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var sql = ' M.ISDELETE=0 ';
var port = form.findField('port').getValue();
sql = sql + getAndConSql(sql, port, "m.port = " + port + "");
var custDate_Min = form.findField('ExpDateBgn').getRawValue();
sql = sql + getAndConSql(sql, custDate_Min, "m.ArrivalDate >= '" + custDate_Min + "'");
var custDate_Max = form.findField('ExpDateEnd').getRawValue();
sql = sql + getAndConSql(sql, custDate_Max, "m.ArrivalDate <= '" + custDate_Max + " 23:59:59'");
var CZDate_Min = form.findField('CZDateBgn').getRawValue();
sql = sql + getAndConSql(sql, CZDate_Min, "k.czdate >= '" + CZDate_Min + "'");
var CZDate_Max = form.findField('CZDateEnd').getRawValue();
sql = sql + getAndConSql(sql, CZDate_Max, "k.czdate <= '" + CZDate_Max + " 23:59:59'");
var buyer = this.getStrValue(this.comboxBuyer.getValue());
sql = sql + getAndConSql(sql, buyer, "M.buyer in (" + buyer + ")");
var KF = this.getStrValue(this.comboxKF.getValue());
sql = sql + getAndConSql(sql, KF, "k.KFstate in (" + KF + ")");
var CZState = this.getStrValue(this.comboxCZState.getValue());
sql = sql + getAndConSql(sql, CZState, "K.CZState in (" + CZState + ")");
var KCClear = form.findField("KCClear").getValue();
if (KCClear)
{ sql = sql + getAndConSql(sql, KCClear, " m.KCClear = 1 "); }
else { sql = sql + getAndConSql(sql, "True", " m.KCClear = 0 "); }
var company = form.findField('company').getValue();
sql = sql + getAndConSql(sql, company, "M.company = '" + company + "'");
var PLEDGE = form.findField('PLEDGE').getValue();
sql = sql + getAndConSql(sql, PLEDGE, "k.PLEDGE = '" + PLEDGE + "'");
return sql;
},
checkSearchCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return false;
}
return true;
},
onExportClick: function (button, event) {
GridExportExcelPage(this.gridList);
},
OprationSwap: function () {
var ret = new Array();
ret[0] = this.OprationStatus;
ret[1] = this.storeList;
ret[2] = this.SelectedRecord;
return ret;
}
});
function OprationSwap() {
return DsImportRpt.RptImportKcIndex.OprationSwap();
}