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/MvcShipping/Viewsjs/MsOpSubSeaOrder/MsOpOrderCtnStatusIndex.js

617 lines
18 KiB
JavaScript

3 years ago
Ext.namespace('Shipping');
Shipping.MsOpOrderCtnStatusIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsOpOrderCtnStatusIndex.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsOpOrderCtnStatusIndex, Ext.Panel, {
PageSize: 100,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
isShowAdvancedQuery: 0, //是否显示高级查询面板
IsAudit: false,
BillType: 1,
initUIComponents: function () {
this.formname = "formMsOpOrderCtnStatusIndex"; //页面名称
//定义数据集
this.storectndisp = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CtnDispModel',
proxy: { url: '/CommMng/BasicDataRef/GetCtnDisp' }
});
this.storeList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'MsOrderCtnStatus',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsOpSubSeaOrder/GetCtnStatusList',
reader: {
id: 'CTN_ID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//#region List列表显示信息
Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, {
width: 30
});
this.girdcolums = [{
sortable: true,
dataIndex: 'BSNO',
hidden: true,
header: '业务编号',
width: 0
},
{
sortable: true,
dataIndex: 'ORSTATUS',
hidden: true,
header: '状态',
width: 60
}, {
dataIndex: 'CTNALL',
header: '箱型',
width: 70
}, {
dataIndex: 'CNTRNO',
header: '箱号',
width: 120
}, {
dataIndex: 'CTNSTATUS',
header: '箱动态',
autoShow: true,
width: 220
},
{
sortable: true,
dataIndex: 'ETD',
header: '开船日期',
width: 80
},
{
sortable: true,
dataIndex: 'MBLNO',
header: '主提单号',
width: 120
},
{
sortable: true,
dataIndex: 'VESSEL',
header: '船名',
width: 100
},
{
sortable: true,
dataIndex: 'VOYNO',
header: '航次',
width: 60
},
{
sortable: true,
dataIndex: 'PORTLOAD',
header: '装货港',
width: 100
},
{
sortable: true,
dataIndex: 'PORTDISCHARGE',
header: '卸货港',
width: 100
},
{
sortable: true,
dataIndex: 'GOODSNAME',
header: '品名',
width: 120
},
{
sortable: true,
dataIndex: 'PKGS',
header: '件数',
width: 80
},
{
sortable: true,
dataIndex: 'KGS',
header: '毛重',
width: 80
},
{
sortable: true,
dataIndex: 'CNTRTOTAL',
header: '集装箱',
width: 80
},
{
sortable: true,
dataIndex: 'KINDPKGS',
header: '件数包装',
width: 60
},
{
sortable: true,
dataIndex: 'BLFRT',
header: '付费方式',
width: 60
},
{
sortable: true,
dataIndex: 'CARGOID',
header: '货物标识',
width: 60
}, {
dataIndex: 'SEALNO',
header: '封号',
width: 100
},
{
sortable: true,
dataIndex: 'BSDATE',
header: '接单日期',
width: 80
}];
this.CheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
//定义Grid
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
selModel: this.CheckBoxModel,
listeners: {
cellclick: function (thisTab, record, item, index, e, eOpts) {
if (index == 10) {//设置按钮列
// alert('用户编号=' + this.getStore().getAt(rowIndex).data.usercode);
}
}
},
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.storeCodeDisport = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodeDisportModel',
proxy: { url: '/CommMng/BasicDataRef/GetCodeDisportList' }
});
this.storeCodeDisport.load();
this.comboxPORTLOAD = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '装货港',
store: this.storeCodeDisport,
forceSelection: true,
name: 'PORTLOAD',
valueField: 'CNAME',
displayField: 'CodeAndName'
});
//国内港口(出口装货港、进口卸货港)
this.storeCodeLoadport = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodeLoadportModel',
proxy: { url: '/CommMng/BasicDataRef/GetCodeLoadportList' }
});
this.storeCodeLoadport.load();
this.comboxPORTDISCHARGE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '卸货港',
store: this.storeCodeLoadport,
forceSelection: true,
name: 'PORTDISCHARGE',
valueField: 'CNAME',
displayField: 'CodeAndName'
});
//#endregion
//#region formSearch 查询面板
this.formSearch = Ext.widget('form', {
frame: true,
region: 'center',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 60,
msgTarget: 'qtip'
},
items: [{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '箱号',
name: 'CtnNo'
}, {
fieldLabel: '主提单号',
name: 'MblNo'
}, {
fieldLabel: '开船日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ETDbgn'
}, {
fieldLabel: '到',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ETDend'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxPORTLOAD, this.comboxPORTDISCHARGE, {
fieldLabel: '船名',
name: 'VESSEL'
}, {
fieldLabel: '航次',
name: 'VOYNO'
}]
}]//end items(fieldset 1)
}]//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: "重置条件",
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.panelBtnStatus = new Ext.Panel({
region: "north",
tbar: [{
text: "发货人背箱",
height: 80,
iconCls: "Ctn4",
scale: 'large',
iconAlign: 'top',
width: 80,
handler: function (button, event) {
this.onLeavePortClick(button, event, 1);
},
scope: this
}, '-', {
text: "场站收货",
height: 80,
iconCls: "Ctn3",
scale: 'large',
iconAlign: 'top',
width: 80,
handler: function (button, event) {
this.onLeavePortClick(button, event, 2);
},
scope: this
}, '-', {
text: "上船",
height: 80,
iconCls: "Ctn1",
scale: 'large',
iconAlign: 'top',
width: 80,
handler: function (button, event) {
this.onLeavePortClick(button, event, 3);
},
scope: this
}, '-', {
text: "离港",
height: 80,
iconCls: "Ctn5",
scale: 'large',
iconAlign: 'top',
width: 80,
handler: function (button, event) {
this.onLeavePortClick(button, event, 4);
},
scope: this
}, '-',
{ fieldLabel: '完成时间',
format: 'Y-m-d',
id: 'dtOverTime',
xtype: 'datetimefield',
name: 'OVERTIME'
}
]
});
this.panelBtnStatus = new Ext.Panel({
title: '箱动态维护',
layout: "border",
region: 'south',
height: 150,
animate: true,
autoScroll: true,
frame: false,
items: [this.panelBtnStatus]
});
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 100,
items: [this.panelBtn, this.formSearch]
});
Ext.apply(this, {
items: [this.panelTop, this.gridList, this.panelBtnStatus]
});
this.onRefreshClick();
var dtOverTime = Ext.getCmp('dtOverTime');
var currenttime = this.CurentTime();
dtOverTime.setValue(currenttime);
this.storeList.on('beforeload', function (store) {
var sql = this.getCondition();
Ext.apply(store.proxy.extraParams, { condition: sql, billtype: this.BillType });
}, this);
}, //end initUIComponents
onRefreshClick: function (button, event) {
//var girdcolums = this.gridList.getColumnMode();
var sql = this.getCondition();
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql, billtype: this.BillType },
waitMsg: "正在查询数据...",
scope: this
});
},
onLeavePortClick: function (button, event, type) {
var GidStr = '';
var records = this.CheckBoxModel.selected.items;
if (records.length == 0) {
Ext.Msg.show({ title: 'Prompt', msg: '请先选择要动态维护的集装箱!!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var dtOverTime = Ext.getCmp('dtOverTime');
var OpDateTime = dtOverTime.getValue();
if (OpDateTime == '' || OpDateTime == null) {
Ext.Msg.show({ title: 'Prompt', msg: "完成时间不能为空!", icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var insert;
var bodyAddDatas = [];
var j = 0;
for (var i = 0; i < records.length; i++) {
var rec = records[i];
var ORSTATUS = rec.data.ORSTATUS;
if (ORSTATUS == 9) {
Ext.Msg.show({ title: 'Prompt', msg: '业务未提交不允许更改集装箱动态!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
} else {
bodyAddDatas.push(rec);
j = j + 1;
}
}
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
_this = this;
if (j == 0) {
Ext.Msg.show({ title: 'Prompt', msg: '请先选择要动态维护的集装箱!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
} else {
Ext.Ajax.request({
waitMsg: 'Changing...',
url: '/MvcShipping/MsOpSubSeaOrder/CtnOpStatus',
params: {
data: jsonbodyAddDatas,
type: type,
opdatetime: OpDateTime
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: 'Prompt',
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
} else {
_this.onRefreshClick();
}
} else {
Ext.MessageBox.alert('The Server Response Error, Please Try Again', response.responseText);
}
},
scope: this
});
}
},
onClearSql: function () {
var form = this.formSearch.getForm();
form.reset();
}, //onDeleteClick
getCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var sql = '';
//#region formSearch 查询面板
//编号包括(主提单号)
var MblNo = form.findField('MblNo').getValue();
sql = sql + getAndConSql(sql, MblNo, "(b.MBLNO like '%" + MblNo + "%' )");
//箱号
var CtnNo = form.findField('CtnNo').getValue();
sql = sql + getAndConSql(sql, CtnNo, "c.CNTRNO='" + CtnNo + "'");
//到港日期
var ETDbgn = form.findField('ETDbgn').getRawValue();
sql = sql + getAndConSql(sql, ETDbgn, "b.ETD >='" + ETDbgn + "'");
var ETDend = form.findField('ETDend').getRawValue();
sql = sql + getAndConSql(sql, ETDend, "b.ETD <='" + ETDend + "'");
//装货港
var PORTLOAD = form.findField('PORTLOAD').getValue();
sql = sql + getAndConSql(sql, PORTLOAD, "b.PORTLOAD like '%" + PORTLOAD + "%'");
//卸货港
var PORTDISCHARGE = form.findField('PORTDISCHARGE').getValue();
sql = sql + getAndConSql(sql, PORTDISCHARGE, "b.PORTDISCHARGE like '%" + PORTDISCHARGE + "%'");
//船名
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;
},
CurentTime: function () {
var now = new Date();
var year = now.getFullYear(); //年
var month = now.getMonth() + 1; //月
var day = now.getDate(); //日
var hh = now.getHours(); //时
var mm = now.getMinutes(); //分
var clock = year + "-";
if (month < 10)
clock += "0";
clock += month + "-";
if (day < 10)
clock += "0";
clock += day + " ";
if (hh < 10)
clock += "0";
clock += hh + ":";
if (mm < 10) clock += '0';
clock += mm;
clock = clock + ':00';
return (clock);
},
OprationSwap: function () {
var ret = new Array();
ret[0] = this.OprationStatus;
ret[1] = this.storeList;
ret[2] = this.SelectedRecord;
ret[3] = this.IsAudit;
return ret;
}
});