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.
DS7/DSWeb/Areas/MvcContainer/Viewsjs/MsOpCtnr/MsRptCtnrIndex.js

561 lines
18 KiB
JavaScript

2 years ago
Ext.namespace('Shipping');
Shipping.MsRptCtnrIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsRptCtnrIndex.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsRptCtnrIndex, Ext.Panel, {
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
EditRecord: null, //用于从主界面获取
BSNo: '',
initUIComponents: function () {
this.formname = 'MsRptCtnrIndex';
//定义数据集
this.SumField = [
{ name: 'PORT', type: 'string' },
{ name: 'YARD', type: 'string' },
{ name: 'CTNSTATUS', type: 'string' }
];
_this = this;
this.storeList = Ext.create('Ext.data.Store', {
fields: this.SumField,
pageSize: this.PageSize,
// autoLoad: { start: 0, limit: 30 },
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcContainer/MsOpCtnr/GetCtnSum',
reader: {
id: 'BSNO',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//定义Grid
this.CntrCB = Ext.create('Ext.selection.CheckboxModel');
this.columns = [{
sortable: true,
dataIndex: 'BSNO',
header: 'BSNO',
hidden: true,
width: 80
}, {
sortable: true,
dataIndex: 'PORT',
header: '地点',
width: 120
}, {
sortable: true,
dataIndex: 'YARD',
header: '场站',
width: 80
},{
sortable: true,
dataIndex: 'CTNSTATUS',
header: '箱动态',
width: 120
}];
this.girdcolums = this.columns;
this.girdcolums = DsTruck.GetGridPanel(USERID, this.formname, this.girdcolums, 1, true);
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'center',
columnLines: true,
selModel: this.CntrCB,
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
viewConfig: {
enableTextSelection: true
},
features: [{
ftype: 'summary'//Ext.grid.feature.Summary表格汇总特性
}],
columns: this.girdcolums,
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) {
this.SelectedRecord = record;
var openSet = "height=700, width=1024, toolbar=no, menubar=no,scrollbars=1, resizable=1,location=no, status=no,Top= " + (screen.height - 750) / 2 + ",Left= " + (screen.width - 1100) / 2
var openType = "_blank";
var isstop=this.formSearch.getForm().findField('ISSTOP').getValue()
2 years ago
var openUrl = "/MvcContainer/MsOpCtnr/CodeIndex?handle=check&ctnport=" + record.data.PORT + "&ctnyard=" + record.data.YARD + "&ctnstatus=" + record.data.CTNSTATUS + "&ctnisstop=" + isstop;
2 years ago
window.open(openUrl, openType, openSet);
}, this);
//#region formSearch
//租买类型
Ext.define('BLTypemb', {
extend: 'Ext.data.Model',
fields: [
{ name: 'BLType', type: 'string' }
]
});
//var BLTypeData = [
// { "BLType": "买箱" }, { "BLType": "卖箱" }, { "BLType": "租出" }, { "BLType": "返回" }];
//this.storeBLType = Ext.create('Ext.data.Store', {
// model: 'BLTypemb',
// data: BLTypeData
//});
//this.comboxBuyType = Ext.create('DsExt.ux.RefEnumCombox', {
// fieldLabel: '租买类型',
// forceSelection: true,
// store: this.storeBLType,
// name: 'BLTYPE',
// allowBlank: true,
// valueField: 'BLType',
// displayField: 'BLType'
//});
this.storeCodeLoadport = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodeLoadportModel',
proxy: { url: '/CommMng/BasicDataRef/GetCodeLoadportList' }
});
this.storeCodeLoadport.load();
this.comboxPORT = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '当前地点',
store: this.storeCodeLoadport,
//forceSelection: true,
id: 'PORT',
name: 'PORT',
valueField: 'PORT',
displayField: 'CodeAndName',
matchFieldWidth: false //下拉款自适应宽度
});
//是否生成凭证
this.storeISSTOP = Ext.create('Ext.data.Store', {
fields: ['ISSTOP', 'NAME']
});
this.storeISSTOP.add({ "ISSTOP": "", "NAME": "全部" });
this.storeISSTOP.add({ "ISSTOP": "0", "NAME": "可用" });
this.storeISSTOP.add({ "ISSTOP": "1", "NAME": "不可用" });
this.comboxISSTOP = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '是否可用',
store: this.storeISSTOP,
valueField: 'ISSTOP',
displayField: 'NAME',
forceSelection: true,
name: 'ISSTOP',
value: '0',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.formSearch = Ext.widget('form', {
frame: true,
region: 'center',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 70,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
flex: 1,
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '买箱单号',
name: 'BILLNO',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, this.comboxPORT,{
fieldLabel: '买箱时间(从)',
name: 'BSDATE',
format: 'Y-m-d',
labelWidth: 90,
xtype: 'datefield',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '买箱时间(到)',
labelWidth: 90,
name: 'BSDATETO',
format: 'Y-m-d',
xtype: 'datefield',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, this.comboxISSTOP
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
//#endregion formSearch
//查询工具条
_this = this;
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [
{
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: "保存列表样式",
menu: [{ text: "保存",
handler: function (button, event) {
_this.girdcolums = DsTruck.SaveGridPanel(GID, _this.formname, _this.gridList.columns, _this.girdcolums, 0, true); //使用者id表名中间column数组跳过一开始的几列
}
}, { text: "初始化",
handler: function (menu, event) {
_this.gridList.reconfigure(_this.storeList, _this.columns);
_this.girdcolums = DsTruck.SaveGridPanel(GID, _this.formname, _this.gridList.columns, _this.columns, 0, true); //使用者id表名中间column数组跳过一开始的几列
}
}],
scope: this
}, {
text: "打印", //"打印",
iconCls: 'btnprint',
menu: [
{ text: "全部", //"全部",
handler: function (menu, event) {
_this.onPrintClick();
}
}, { text: "选择打印", //"选择打印",
handler: function (menu, event) {
_this.PrintSelect();
}
}],
scope: this
}
]
});
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 80,
items: [this.formSearch, this.panelBtn]
});
Ext.apply(this, {
items: [this.panelTop, this.gridList]
});
this.storeCtnList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
fields: [
{ name: 'CTNALL', type: 'string' }
],
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcContainer/MsOpCtnr/GetCtnList',
reader: {
id: '',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.InitData();
}, //end initUIComponents
//#region 加载事件
InitData: function () {
this.onRefreshClick();
this.storeList.on('beforeload', function (store) {
Ext.apply(store.proxy.extraParams, { condition: this.sqlcontext });
}, this);
//#endregion
}, //end InitData
//#endregion
onRefreshClick: function (button, event) {
var sql = this.getCondition();
this.sqlcontext = sql;
this.SumField = [
{ name: 'PORT', type: 'string' },
{ name: 'YARD', type: 'string' },
{ name: 'CTNSTATUS', type: 'string' }
];
this.columns = [{
sortable: true,
dataIndex: 'BSNO',
header: 'BSNO',
hidden: true,
width: 80
}, {
sortable: true,
dataIndex: 'PORT',
header: '地点',
width: 120
}, {
sortable: true,
dataIndex: 'YARD',
header: '场站',
width: 80
}, {
sortable: true,
dataIndex: 'CTNSTATUS',
header: '箱动态',
width: 120
}
];
_this = this;
this.storeCtnList.load({
params: { condition: sql },
callback: function (r, options, success) {
if (success) {
if (r.length != 0) {
for (i = 0; i < _this.storeCtnList.getCount(); i += 1) {
var itemindex = i + 1;
var memberyf = _this.storeCtnList.getAt(i);
_this.SumField.push({ name: 'C' + memberyf.data.CTNALL, type: 'number' });
_this.columns.push({
sortable: true,
dataIndex: 'C' + memberyf.data.CTNALL,
header: memberyf.data.CTNALL,
summaryType: 'sum',
width: 80
});
};
}
_this.storeList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
fields: _this.SumField,
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcContainer/MsOpCtnr/GetCtnSum',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
_this.gridList.reconfigure(_this.storeList, _this.columns);
_this.storeList.load({
params: { condition: sql },
waitMsg: "正在查询数据...", //"正在查询数据...",
scope: this
});
}
}
});
},
getCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var sql = " 1=1 ";
var ISSTOP = form.findField('ISSTOP').getValue();
if (ISSTOP != '' && ISSTOP != null) {
sql = sql + " AND ISNULL(ISSTOP,0)=" + ISSTOP+" ";
}
var billsql = "";
var PORT = form.findField('PORT').getValue();
if (PORT != '' && PORT != null) {
sql = sql + " AND PORT like '%" + PORT + "%'";
}
var BILLNO = form.findField('BILLNO').getValue();
if (BILLNO != '' && BILLNO != null) {
billsql = " BILLNO like '%" + BILLNO + "%'";
}
var BSDATE = form.findField('BSDATE').getRawValue();
billsql = billsql + getAndConSql(billsql, BSDATE, " BSDATE >= '" + BSDATE + "'");
var BSDATETO = form.findField('BSDATETO').getRawValue();
if (BSDATETO != '' && BSDATETO != null) {
billsql = billsql + getAndConSql(billsql, BSDATETO, " BSDATE <= '" + BSDATETO + "'");
}
if (billsql != '') {
sql=sql + ' and CTNGID IN (SELECT CTNGID FROM op_ctnmng_detail WHERE BSNO IN (SELECT BSNO FROM op_ctnmng WHERE ' + billsql + '))'
}
return sql;
},
onClearSql: function () {
var form = this.formSearch.getForm();
form.reset();
//this.InitData();
},
OprationSwap: function () {
var ret = new Array();
ret[0] = this.OprationStatus;
ret[1] = this.storeList;
ret[2] = this.SelectedRecord;
ret[3] = this.EditRecord;
ret[4] = this.OPLBNAME;
return ret;
},
onPrintClick: function (button, event) {
var printType = 'MsOpCtnrList';
var uid = USERID;
var sql1 = "select * from op_ctnmng";
var wherestr = this.getCondition();
if (wherestr != '') {
sql1 += "where 1=1 and " + wherestr;
}
PrintComm(printType, sql1);
},
PrintSelect: function () {
_this = this;
if (this.storeList.getCount() == 0) {
return;
}
var selectedRecords = [];
var storeadd = null;
selectedRecords = this.CtnrCB.selected.items;
if (selectedRecords.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择要打印的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var feeGidSql = '';
for (var i = 0; i < selectedRecords.length; i++) {
var record = selectedRecords[i];
var feeGId = "'" + record.get('GID') + "'";
if (feeGidSql == '') {
feeGidSql = feeGId;
} else {
feeGidSql = feeGidSql + "," + feeGId;
}
};
var bsno = '11111';
var mblno = '';
var printType = 'MsOpCtnrListSelect';
var sql1 = "select * from op_ctnmng WHERE GID BSNO (" + feeGidSql + ") order by BSDATE DESC";
var sql2 = "";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6,"");
}
});