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/MsOpSeae/MsOpSeaeCtnListIndex.js

890 lines
29 KiB
JavaScript

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

Ext.namespace('Shipping');
Shipping.MsOpSeaeCtnListIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsOpSeaeCtnListIndex.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsOpSeaeCtnListIndex, Ext.Panel, {
PageSize: 100,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
isShowAdvancedQuery: 0, //是否显示高级查询面板
IsAudit: false,
BillType: 1,
time:null,
remarks:null,
initUIComponents: function () {
this.formname = "formMsOpSeaeCtnListIndex"; //页面名称
//定义数据集
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,
fields: [
{ name: 'CTN_ID', type: 'string' },
{ name: 'BSNO', type: 'string' },
{ name: 'CTNCODE', type: 'string' },
{ name: 'CTNALL', type: 'string' },
{ name: 'CNTRNO', type: 'string' },
{ name: 'SEALNO', type: 'string' },
{ name: 'STATUS', type: 'string' },
{ name: 'PKGS', type: 'int' },
{ name: 'KGS', type: 'decimal' },
{ name: 'CBM', type: 'decimal' },
{ name: 'REMARK', type: 'string' },
{ name: 'ORSTATUS', type: 'string' },
{ name: 'BSDATE', type: 'string' },
{ name: 'MBLNO', type: 'string' },
{ name: 'VESSEL', type: 'string' },
{ name: 'VOYNO', type: 'string' },
{ name: 'ETD', type: 'string' },
{ name: 'ETA', type: 'string' },
{ name: 'PORTLOADID', type: 'string' },
{ name: 'PORTLOAD', type: 'string' },
{ name: 'PORTDISCHARGEID', type: 'string' },
{ name: 'PORTDISCHARGE', type: 'string' },
{ name: 'PLACERECEIPT', type: 'string' },
{ name: 'PLACEDELIVERYID', type: 'string' },
{ name: 'PLACEDELIVERY', type: 'string' },
{ name: 'DESTINATIONID', type: 'string' },
{ name: 'DESTINATION', type: 'string' },
{ name: 'SERVICE', type: 'string' },
{ name: 'CARGOID', type: 'string' },
],
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsOpSeae/GetOpCtnList',
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
},
{
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: 'ETA',
header: '到港日期',
width: 80
},
{
sortable: true,
dataIndex: 'PKGS',
header: '件数',
width: 80
},
{
sortable: true,
dataIndex: 'KGS',
header: '毛重',
width: 80
},
{
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();
////////////////////////////////////////////////
//国际港口(进口装货港、出口卸货港)
Ext.define('DsShipping.ux.PortRefModel', {
extend: 'Ext.data.Model',
fields: [
{ name: 'PORTID', type: 'string' },
{ name: 'PORT', type: 'string' },
{ name: 'CNAME', type: 'string' },
{ name: 'PORTANDNAME', type: 'string' }
]
});
this.storeCodeDisport = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.PortRefModel',
proxy: { url: '/MvcShipping/MsBaseInfo/GetPortRefList' }
});
this.storeCodeDisport.load();
this.comboxPORTLOAD = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '装货港',
store: this.storeCodeDisport,
forceSelection: true,
name: 'PORTLOAD',
valueField: 'PORT',
displayField: 'PORT'
});
//国内港口(出口装货港、进口卸货港)
this.storeCodeLoadport = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.PortRefModel',
proxy: { url: '/MvcShipping/MsBaseInfo/GetPortRefList' }
});
this.storeCodeLoadport.load();
this.comboxPORTDISCHARGE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '卸货港',
store: this.storeCodeLoadport,
forceSelection: true,
name: 'PORTDISCHARGE',
valueField: 'PORT',
displayField: 'PORT'
});
_tt=this;
//#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
// 装船动态
var kc = Ext.create('Ext.form.Panel', {
width: 260,
bodyPadding: 10,
style: 'padding-top: 10px',
bodyStyle: 'background-color:#FFFFFF',
defaultType: 'textfield',//默认的表单选项
fieldDefaults: {
labelAlign: 'right',
msgTarget: 'side',
labelWidth: 120
},
items: [
{
fieldLabel: '装船日期',
format: 'Y-m-d',
xtype: 'datefield',
flex: 1,
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
name: 'etd',
id:'etd',
labelWidth: 80,
allowBlank: false,
},
{
xtype: 'textarea',
name: 'Remarks',
id:'Remarks',
fieldLabel: '装船备注',
labelWidth: 80,
width: 230
}
],
buttons: [{
text: '提交更新',
handler: function () {
var etd =  Ext.getCmp('etd').getValue();
var Remarks =  Ext.getCmp('Remarks').getValue();
var type=1;
if (etd==""||etd==null) {
Ext.Msg.alert('提示', '请输入装船日期');
return false;
}
var closewin=win;
_tt.plgx(etd,Remarks,type,closewin);
}
},{
text: '取消更新',
handler: function () {
win.close();
}
}],
});
//创建弹出窗口
_yy=this;
var win = new Ext.window.Window({
layout: 'fit',
width: 340,
closeAction: 'hide',
height: 200,
resizable: false,
shadow: true,
modal: true,
closable: true,
items: kc
});
_this = this;
//卸船动态
var xc = Ext.create('Ext.form.Panel', {
width: 260,
bodyPadding: 10,
style: 'padding-top: 10px',
bodyStyle: 'background-color:#FFFFFF',
defaultType: 'textfield',//默认的表单选项
fieldDefaults: {
labelAlign: 'right',
msgTarget: 'side',
labelWidth: 120
},
items: [
{
fieldLabel: '卸船日期',
format: 'Y-m-d',
xtype: 'datefield',
flex: 1,
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
name: 'etdxc',
id:'etdxc',
labelWidth: 80,
allowBlank: false,
},
{
xtype: 'textarea',
name: 'Remarksxc',
id:'Remarksxc',
fieldLabel: '卸船备注',
labelWidth: 80,
width: 230
}
],
buttons: [{
text: '提交更新',
handler: function () {
var etd =  Ext.getCmp('etdxc').getValue();
var Remarks =  Ext.getCmp('Remarksxc').getValue();
var type=2;
if (etd==""||etd==null) {
Ext.Msg.alert('提示', '请输入卸船日期');
return false;
}
var closewin=winxc;
_tt.plgx(etd,Remarks,type,closewin);
}
},{
text: '取消更新',
handler: function () {
winxc.close();
}
}],
});
//创建弹出窗口
var winxc = new Ext.window.Window({
layout: 'fit',
width: 340,
closeAction: 'hide',
height: 200,
resizable: false,
shadow: true,
modal: true,
closable: true,
items: xc
});
//按钮工具条
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: "plgxzc",
handler: function (button, event) {
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;
}
kc.form.reset();
win.setTitle("批量更新装船动态");
win.show();
},
scope: this
}, '-', {
text: "批量更新卸船动态",
id: "plgxxc",
handler: function (button, event) {
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;
}
xc.form.reset();
winxc.setTitle("批量更新卸船动态");
winxc.show();
},
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
}, '-',
{
text: '打印', //"打印",
iconCls: 'btnprint',
menu: [
{ text: '全部', //"全部",
handler: function (menu, event) {
_this.Print();
}
}, { text: '选择打印', //"选择打印",
handler: function (menu, event) {
_this.PrintSelect();
}
}],
scope: this
}]
});
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.onRefreshClick();
this.storeList.on('beforeload', function (store) {
var sql = this.getCondition();
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
this.onRefreshClick();
}, //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 },
waitMsg: "正在查询数据...",
scope: this
});
},
onUpdateCtnStatusClick: 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 bodyAddDatas = [];
var j = 0;
for (var i = 0; i < records.length; i++) {
var rec = records[i];
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/UpdateCtnStatus',
params: {
data: jsonbodyAddDatas,
type: type
},
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 {
Ext.Msg.alert('提示', '更新完成。');
}
} 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
//#region 打印
Print: function () {
var sql = this.getCondition();
_this = this;
if (this.storeList.getCount() == 0) {
return;
}
var bsno = '11111';
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length != 0) {
var record = selections[0];
bsno = record.data.BSNO;
}
var sortstr = '';
// if (this.sortfield != '' && this.sortdire != '') {
// sortstr = this.sortfield + ' ' + this.sortdire;
// }
Ext.Msg.wait('正在操作数据');
Ext.Ajax.request({
waitMsg: '正在操作数据',
url: '/MvcShipping/MsOpSeae/GetOpCtnList',
scope: this,
params: {
start: 0, limit: this.PageSize,
condition: sql,
printstr: 'true',
sort: sortstr
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var returnstr = jsonresult.Data;
var condition = jsonresult.Message;
if (condition != '') condition = ' where ' + condition;
var printType = 'MSOPSEAECTNLIST';
var sql1 = returnstr;
var sql2 = "";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
} else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
} else {
Ext.Msg.show({ title: '警告', msg: '服务器响应出错!', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
}
});
},
plgx:function(etd,Remarks,type,closewin){
var records = _tt.CheckBoxModel.selected.items;
var bodyAddDatas = [];
var j = 0;
for (var i = 0; i < records.length; i++) {
var rec = records[i];
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.Msg.wait('正在更新数据...');
Ext.Ajax.request({
waitMsg: '正在更新...',
url: '/MvcShipping/MsOpSubSeaOrder/UpdateCtnStatus',
params: {
data: jsonbodyAddDatas,
time:etd,
remarks:Remarks,
type:type
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: '提示',
msg: result.Message,
buttons: Ext.Msg.OK
});
return;
} else {
Ext.Msg.alert('提示', result.Message);
closewin.close();
}
} else {
Ext.MessageBox.alert('The Server Response Error, Please Try Again', response.responseText);
}
},
scope: this
});
}
},
PrintSelect: function () {
_this = this;
if (this.storeList.getCount() == 0) {
return;
}
var selectedRecords = [];
var storeadd = null;
selectedRecords = this.GridCheckBoxModel.selected.items;
if (selectedRecords.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请选择业务', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var sortstr = 'MBLNO desc';
if (this.sortfield != '' && this.sortdire != '') {
sortstr = this.sortfield + ' ' + this.sortdire;
}
var feeGidSql = '';
for (var i = 0; i < selectedRecords.length; i++) {
var record = selectedRecords[i];
var feeGId = "'" + record.get('BSNO') + "'";
if (feeGidSql == '') {
feeGidSql = feeGId;
} else {
feeGidSql = feeGidSql + "," + feeGId;
}
};
var bsno = '11111';
var mblno = '';
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length != 0) {
var record = selections[0];
bsno = record.data.BSNO;
mblno = record.data.MBLNO;
}
var printType = 'MSOPSEAECTNLISTSELECT';
var sql1 = "select *,(SELECT TOP 1 STATUS FROM OP_STATUS WHERE BSNO=op_seae.BSNO ORDER BY COMPTIME DESC,INPUTTIME DESC) as OPSTATUS from op_seae WHERE MASTERNO IN (" + feeGidSql + ") order by " + sortstr;
var sql2 = "";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6, mblno);
},
//#endregion
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;
ret[4]='1';
return ret;
}
});