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.

1214 lines
41 KiB
JavaScript

This file contains ambiguous Unicode 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.MsRptCtnStatusDetail = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsRptCtnStatusDetail.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsRptCtnStatusDetail, Ext.Panel, {
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
sqlcontext: '',
psqlcontext: '',
PageSize: 500,
sortfield: '',
sortdire: '',
AccDate: null,
initUIComponents: function () {
this.formname = "MsRptCtnStatusDetail"; //页面名称
//定义数据集
this.storeList = Ext.create('Ext.data.Store', {
model: 'MsOpCtnBsCard',
pageSize: this.PageSize,
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcContainer/MsOpCtnBsCard/GetRptCtnStatusList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, {
width: 30
});
this.initgirdcolums = [{
sortable: true,
id: '',
dataIndex: '',
header: '',
width: 0
}, {
sortable: true,
dataIndex: 'GID',
header: 'GID',
hidden: true,
width: 120
}, {
sortable: true,
dataIndex: 'COMPANYID',
header: 'COMPANYID',
hidden: true,
width: 120
}, {
sortable: true,
dataIndex: 'CTNNO',
header: '箱号',
width: 200
}, {
sortable: true,
dataIndex: 'CTNPROP',
header: '箱属',
width: 200
}, {
sortable: true,
dataIndex: 'BSNO',
header: '业务编号',
width: 200
}, {
sortable: true,
dataIndex: 'ISCLOSE',
header: '锁定',
width: 100,
renderer: function (value, cellmeta) {
if (value == 'true') {
return "<img src='../../../../TruckMng/Content/Images/Lock.png' />";
}
}
}, {
sortable: true,
dataIndex: 'IS_PUTCTN',
header: '放箱通知发送',
width: 100,
renderer: function (value, cellmeta) {
if (value == 'true') {
return "是";
}
}
}, {
sortable: true,
dataIndex: 'PUTCTNDATE',
header: '放箱通知发送时间',
width: 100
}, {
sortable: true,
dataIndex: 'CUSTOMERNAME',
header: '委托单位',
width: 200
}, {
sortable: true,
dataIndex: 'GOODSNAME',
header: '货物名称',
width: 100
}, {
sortable: true,
dataIndex: 'PREGOODSNAME',
header: '前装货品名',
width: 100
}, {
sortable: true,
dataIndex: 'ETD',
header: '开船日期',
width: 100
}, {
sortable: true,
dataIndex: 'ETA',
header: '到港日期',
width: 100
}, {
sortable: true,
dataIndex: 'AGENTNAME',
header: '目的港代理',
width: 100
}, {
sortable: true,
dataIndex: 'CUR_PORT',
header: '当前位置',
width: 100
}, {
sortable: true,
dataIndex: 'CUR_DATE',
header: '当前时间',
width: 100
}, {
sortable: true,
dataIndex: 'CYCLE_DAY',
header: '周期',
width: 100
}, {
sortable: true,
dataIndex: 'CUSTNO',
header: '委托编号',
width: 200
}, {
sortable: true,
dataIndex: 'OP',
header: '操作',
width: 200
}, {
sortable: true,
dataIndex: 'MBLNO',
header: '主提单号',
width: 200
}, {
sortable: true,
dataIndex: 'CARRIER',
header: '船公司',
width: 200
}, {
sortable: true,
dataIndex: 'PORTLOAD_STATOIN',
header: '起运港场站',
width: 200
}, {
sortable: true,
dataIndex: 'PORTLOAD_CNT_TIME',
header: '起运港提箱日期',
width: 200
}, {
sortable: true,
dataIndex: 'LOADFACTORY',
header: '装货工厂',
width: 200
}, {
sortable: true,
dataIndex: 'PORTLOAD',
header: '起运港',
width: 200
}, {
sortable: true,
dataIndex: 'DESTPORT',
header: '目的港',
width: 100
}, {
sortable: true,
dataIndex: 'DEST_CNT_TIME',
header: '目的港提箱日期',
width: 200
}, {
sortable: true,
dataIndex: 'DEST_RTCNT_TIME',
header: '目的港还箱日期',
width: 200
}, {
sortable: true,
dataIndex: 'DESTPORT_STATOIN',
header: '目的港场站',
width: 200
}, {
sortable: true,
dataIndex: 'DETAIN_CTN_DAYS',
header: '滞箱天数',
width: 200
}, {
sortable: true,
dataIndex: 'PRE_CNT_TIME',
header: '预计提箱日期',
width: 200
}, {
sortable: true,
dataIndex: 'IS_RETURE_EMPTY',
header: '是否返空',
width: 100
}, {
sortable: true,
dataIndex: 'ISRETURNDOMESTIC',
header: '空返国内',
width: 100
}, {
sortable: true,
dataIndex: 'IS_POD_CLEAN',
header: '否目的港清洗',
width: 100
}, {
sortable: true,
dataIndex: 'IS_BOOKING',
header: '是否订舱',
width: 200
}, {
sortable: true,
dataIndex: 'I_CUSTNO',
header: '空返委托编号',
width: 100
}, {
sortable: true,
dataIndex: 'I_ETD',
header: '空返开船日期',
width: 100
}, {
sortable: true,
dataIndex: 'I_ETA',
header: '空返进口日期',
width: 100
}, {
sortable: true,
dataIndex: 'PREI_ETA',
header: '空返预抵日期',
width: 100
}, {
sortable: true,
dataIndex: 'I_MBLNO',
header: '空返提单号',
width: 120
}, {
sortable: true,
dataIndex: 'I_CARRIER',
header: '空返船公司',
width: 100
}, {
sortable: true,
dataIndex: 'I_CONTRACT',
header: '运费约价',
width: 100
}, {
sortable: true,
dataIndex: 'I_PORTLOAD_CNT_TIME',
header: '起运港提箱日期',
width: 100
}, {
sortable: true,
dataIndex: 'I_PORTLOAD',
header: '空返起运港',
width: 100
}, {
sortable: true,
dataIndex: 'I_DESTPORT',
header: '空返目的港',
width: 100
}, {
sortable: true,
dataIndex: 'I_DESTPORT_STATOIN',
header: '空返目的港场站',
width: 100
}, {
sortable: true,
dataIndex: 'I_DEST_CNT_TIME',
header: '空返目的港提箱日期',
width: 100
}, {
sortable: true,
dataIndex: 'I_DEST_RTCNT_TIME',
header: '空返目的港还箱日期',
width: 100
}, {
sortable: true,
dataIndex: 'PORTLOAD_FREE_DAYS',
header: '起运港免箱使天数',
width: 100
}, {
sortable: true,
dataIndex: 'PORTLOAD_OVER_DAYS',
header: '起运港超期天数',
width: 100
}, {
sortable: true,
dataIndex: 'PORTLOAD_OVER_DAYS_FEE',
header: '起运港箱使费/天',
width: 100
}, {
sortable: true,
dataIndex: 'PORTLOAD_OVER_DAYS_AMT',
header: '起运港箱使费',
width: 100
}, {
sortable: true,
dataIndex: 'DESTPORT_FREE_DAYS',
header: '目的港免箱使天数',
width: 100
}, {
sortable: true,
dataIndex: 'DESTPORT_OVER_DAYS',
header: '目的港超期天数',
width: 100
}, {
sortable: true,
dataIndex: 'DESTPORT_OVER_DAYS_FEE',
header: '目的港箱使费/天',
width: 100
}, {
sortable: true,
dataIndex: 'DESTPORT_OVER_DAYS_AMT',
header: '目的港箱使费',
width: 100
}, {
sortable: true,
dataIndex: 'BOOKGOODNAME',
header: '订舱品名',
width: 100
}, {
sortable: true,
dataIndex: 'CUSTOMGOODNAME',
header: '报关品名',
width: 100
}, {
sortable: true,
dataIndex: 'TANKVOLUMN',
header: '罐箱容积',
width: 100
}, {
sortable: true,
dataIndex: 'TAREWEIGHT',
header: '罐皮重',
width: 100
}, {
sortable: true,
dataIndex: 'TRUCKNAME',
header: '录车队',
width: 100
}, {
sortable: true,
dataIndex: 'INPUTBYREF',
header: '录入人',
width: 100
}, {
sortable: true,
dataIndex: 'INPUTTIME',
header: '录入时间',
width: 100
}
];
this.girdcolums = this.initgirdcolums;
this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
_this = this;
//定义Grid
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
selModel: this.GridCheckBoxModel,
columns: this.girdcolums
,
// paging bar on the bottom
bbar: Ext.create('Ext.PagingToolbar', {
store: this.storeList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
})
});
this.girdcolums = DsTruck.GetGridPanel(USERID, this.formname, this.girdcolums, 1); //使用者id表名中间column数组跳过一开始的几列
this.girdcolums.unshift(new Ext.grid.RowNumberer());
this.gridList.reconfigure(this.storeList, this.girdcolums);
this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
this.SelectedRecord = record;
this.OprationStatus = 'edit';
if (BSCARDTYPE == '1')
DsOpenEditWin('/MvcContainer/MsOpCtnBsCard/Edit', record.data.GID);
else
DsOpenEditWin('/MvcContainer/MsOpCtnBsCard/CtnStatusEdit', record.data.GID);
}, this);
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [ {
text: "保存列表样式",
id: "btntest",
menu: [
{ text: "保存列表",
handler: function (button, event) {
_this.onSaveGridClick(button, event);
}
}, { text: "刷新列表",
handler: function (button, event) {
_this.oninitGridClick(button, event);
}
}],
scope: this
}, {
text: "导出Excel",
id: "btnExportExcel",
iconCls: 'btnexportexcel',
handler: function (button, event) {
this.onExportClick(button, event);
},
scope: this
}
]
});
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',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '编号',
name: 'BSNO',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '开船日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ETDbgn',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '到',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ETDend',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
xtype: 'button',
width: 90,
text: "执行查询",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
},
scope: this
}, {
xtype: 'button',
width: 90,
text: "高级查询",
iconCls: "btnmore",
handler: function (button, event) {
var sql = this.getCondition();
var winAccess = new Shipping.DsQuery({
});
winAccess.StoreList = this.storeList;
winAccess.formname = this.formname;
winAccess.condition = sql;
winAccess.show();
return;
},
scope: this
}]
}
]//end items(fieldset 1)
}]//end root items
});
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 90,
items: [this.panelBtn,this.formSearch]
});
Ext.apply(this, {
items: [this.panelTop,this.gridList]
});
this.sqlcontext = '';
this.psqlcontext = '';
this.ParentWin = window.parent.opener._this;
if (this.ParentWin) {
if (this.ParentWin.sqlcontext!='')
this.psqlcontext = this.ParentWin.sqlcontext + ' AND ' + this.ParentWin.sqlselect;
else
this.psqlcontext = this.ParentWin.sqlselect;
this.sqlcontext = this.psqlcontext;
}
this.storeList.on('beforeload', function (store) {
Ext.apply(store.proxy.extraParams, { condition: _this.sqlcontext });
}, this);
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: this.sqlcontext },
waitMsg: "正在查询数据...",
scope: this
});
this.formAccMonthShow = Ext.widget('form', {
frame: true,
region: 'center',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 85,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '放箱通知时间',
format: 'Y-m-d',
xtype: 'datefield',
name: 'AccDate'
}
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
me = this;
this.winFeeCloseShow = Ext.create('Ext.window.Window', {
title: "发送放箱通知",
width: 420,
//height : 120,
//plain : true,
iconCls: "addicon",
resizable: false,
// 是否可以拖动
// draggable:false,
collapsible: true, // 允许缩放条
closeAction: 'close',
closable: true,
modal: 'true',
buttonAlign: "center",
bodyStyle: "padding:0 0 0 0",
items: [this.formAccMonthShow],
buttons: [{
text: "确认发送",
minWidth: 70,
handler: function () {
var form = me.formAccMonthShow.getForm();
me.AccDate = form.findField('AccDate').getRawValue();
if (me.AccDate == '' || me.AccDate == null || me.AccDate == undefined) {
Ext.Msg.show({ title: '提示', msg: '必须有放箱通知发送时间!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
_this.onSelPutCtnClick()
}
}, {
text: "关闭",
minWidth: 70,
handler: function () {
me.winFeeCloseShow.close();
}
}]
});
}, //end initUIComponents
InitGrid: function (grid) {
var agirdcolums = grid;
this.gridList.reconfigure(this.storeList, agirdcolums);
},
onRefreshClick: function (button, event) {
var sql = this.getCondition();
if (sql!='')
this.sqlcontext = this.psqlcontext + ' and ' + sql;
else
this.sqlcontext = this.psqlcontext;
sql = this.sqlcontext;
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
},
onDsQuery: function () {
var sql = this.sqlcontext;
if (sql != '')
this.sqlcontext = this.psqlcontext + ' and ' + sql;
else
this.sqlcontext = this.psqlcontext;
sql = this.sqlcontext;
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
},
onDeleteClick: function (button, event) {
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择单据!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var record = selections[0];
Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) {
if (btn == 'yes') {
var bodyAddDatas = [];
for (var i = 0; i < selections.length; i++) {
var rec = selections[i];
bodyAddDatas.push(rec);
}
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
Ext.Msg.wait('正在删除数据...');
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/MvcContainer/MsOpCtnBsCard/Delete',
params: {
data: jsonbodyAddDatas
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.onRefreshClick();
Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
}
},
failure: function (response, options) {
Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
},
success: function (response, options) {
},
scope: this
}); //end Ext.Ajax.request
}
}, this);
}, //onDeleteClick
onSelPutCtnClick: function () {
var GidStr = '';
var records = this.GridCheckBoxModel.selected.items;
if (records.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择要发送放箱通知的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var bodyAddDatas = [];
for (var i = 0; i < records.length; i++) {
var rec = records[i];
var Gid = rec.data.BSNO;
var status = rec.data.IS_PUTCTN
if (status != 'true') {
bodyAddDatas.push(rec);
}
}
_this = this;
if (bodyAddDatas.length == 0) {
Ext.Msg.show({ title: '提示', msg: '没有要发送放箱通知的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
} else {
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
Ext.Ajax.request({
waitMsg: '正在锁定...',
url: '/MvcContainer/MsOpCtnBsCard/PutCtn',
params: {
data: jsonbodyAddDatas,
PutDate: _this.AccDate
},
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 {
Ext.Msg.show({ title: '提示', msg: result.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
_this.onRefreshClick();
_this.winFeeCloseShow.close();
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}
},
onSaveGridClick: function (button, event) {
this.girdcolums = DsTruck.SaveGridPanel(USERID, this.formname, this.gridList.columns, this.girdcolums, 1, true);
},
oninitGridClick: function (button, event) {
this.gridList.reconfigure(this.storeList, this.initgirdcolums);
this.girdcolums = DsTruck.SaveGridPanel(USERID, this.formname, this.gridList.columns, this.initgirdcolums, 1, true);
},
onSelLockClick: function () {
var GidStr = '';
var records = this.GridCheckBoxModel.selected.items;
if (records.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择要锁定的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var bodyAddDatas = [];
for (var i = 0; i < records.length; i++) {
var rec = records[i];
var Gid = rec.data.BSNO;
var status = rec.data.ISCLOSE
if (status != 'true') {
bodyAddDatas.push(rec);
}
}
_this = this;
if (bodyAddDatas.length == 0) {
Ext.Msg.show({ title: '提示', msg: '没有要锁定的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
} else {
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
Ext.Ajax.request({
waitMsg: '正在锁定...',
url: '/MvcContainer/MsOpCtnBsCard/LockBs',
params: {
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 {
Ext.Msg.show({ title: '提示', msg: result.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
_this.onRefreshClick();
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}
},
onCancelSelLockClick: function () {
var GidStr = '';
var records = this.GridCheckBoxModel.selected.items;
if (records.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择要取消锁定的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var bodyAddDatas = [];
for (var i = 0; i < records.length; i++) {
var rec = records[i];
var Gid = rec.data.BSNO;
var status = rec.data.ISCLOSE
if (status == 'true') {
bodyAddDatas.push(rec);
}
}
_this = this;
if (bodyAddDatas.length == 0) {
Ext.Msg.show({ title: '提示', msg: '没有要取消锁定的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
} else {
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
Ext.Ajax.request({
waitMsg: '正在锁定...',
url: '/MvcContainer/MsOpCtnBsCard/CancelLockBs',
params: {
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 {
Ext.Msg.show({ title: '提示', msg: result.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
_this.onRefreshClick();
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}
},
onExportClick: function () {
_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.GID;
}
var sortstr = '';
if (this.sortfield != '' && this.sortdire != '') {
sortstr = this.sortfield + ' ' + this.sortdire;
}
Ext.Msg.wait('正在组织数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在组织数据...',
url: '/MvcContainer/MsOpCtnBsCard/GetRptCtnStatusListStr',
scope: this,
params: {
condition: _this.sqlcontext,
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 printType = 'MSOPCTNBSCARD';
var sql1 = returnstr;
sql1 = sql1.replace(/\+/g, "@@@")
sql1 = sql1.replace(/\>/g, "&&&")
sql1 = sql1.replace(/\</g, "%%%")
if (sql1 != '') {
GridExportBySql(sql1, this.formname, '罐箱情况表列表.xls');
}
} 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
});
}
}
});
},
getCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var sql = '';
var BSNO = form.findField('BSNO').getValue();
sql = sql + getAndConSql(sql, BSNO, " (BSNO like '%" + BSNO + "%' or CUSTNO like '%" + BSNO + "%' or I_CUSTNO like '%" + BSNO + "%' or MBLNO like '%" + BSNO + "%' ) ");
var CTNNO = form.findField('CTNNO').getValue();
sql = sql + getAndConSql(sql, CTNNO, "CTNNO like '%" + CTNNO + "%'");
var expDateBgn = form.findField('ETDbgn').getRawValue();
sql = sql + getAndConSql(sql, expDateBgn, "ETD>='" + expDateBgn + "'");
var expDateEnd = form.findField('ETDend').getRawValue();
sql = sql + getAndConSql(sql, expDateEnd, "ETD<='" + expDateEnd + " 23:59:59'");
return sql;
},
OprationSwap: function () {
var ret = new Array();
ret[0] = this.OprationStatus;
ret[1] = this.storeList;
ret[2] = this.SelectedRecord;
return ret;
},
Print: function () {
_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.GID;
}
var sortstr = '';
if (this.sortfield != '' && this.sortdire != '') {
sortstr = this.sortfield + ' ' + this.sortdire;
}
Ext.Msg.wait('正在组织数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在组织数据...',
url: '/MvcContainer/MsOpCtnBsCard/GetRptCtnStatusListStr',
scope: this,
params: {
condition: _this.sqlcontext,
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 printType = 'RptCtnStatusList';
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
});
}
}
});
},
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 = 'CTNNO';
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('GID') + "'";
if (feeGidSql == '') {
feeGidSql = feeGId;
} else {
feeGidSql = feeGidSql + "," + feeGId;
}
};
var bsno = '11111';
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length != 0) {
var record = selections[0];
bsno = record.data.GID;
}
var printType = 'MSOPCTNBSCARDSELECT';
var sql1 = "Select op_ctnbscard.GID 编号";
sql1 = sql1 + ",BSNO 业务编号 , CTNNO 箱号, CUR_PORT 当期位置, GOODSNAME 货物名称 ";
sql1 = sql1 + " , MBLNO 主提单号, CUSTNO 委托编号, CUSTOMERNAME 委托单位, PORTLOAD_STATOIN 起运港场站, GOODSNAME 货物名称";
sql1 = sql1 + " ,PORTLOAD_CNT_TIME 提箱日期 , LOADFACTORY 装货工厂";
sql1 = sql1 + ", PORTLOAD 起运港, ETD 开船日期 ,DESTPORT 目的港 , ETA 到港日期 , AGENTNAME 目的港代理";
sql1 = sql1 + " , DEST_CNT_TIME 目的港提箱日期 ,DEST_RTCNT_TIME 目的港还箱日期 ,DESTPORT_STATOIN 目的港堆存场站 ";
sql1 = sql1 + " , DESTPORT_FREE_DAYS 免费箱使天数, DESTPORT_OVER_DAYS 超期天数,DESTPORT_OVER_DAYS_FEE 箱使费天, DESTPORT_OVER_DAYS_AMT 超期箱使费 ,DETAIN_CTN_DAYS 滞箱天数,TRUCKNAME 车队,TRUCKLINKNAME 车队联系人 ";
sql1 = sql1 + " ,I_MBLNO 进口主提单号, I_CUSTNO 进口委托编号,I_PORTLOAD 进口堆存场站 ";
sql1 = sql1 + " ,I_PORTLOAD_CNT_TIME 进口提箱日期 ";
sql1 = sql1 + " ,I_PORTLOAD 进口起运港 ,I_ETD 进口开船日期,i_DESTPORT 进口目的港,I_ETA 进口到港日期 ";
sql1 = sql1 + " , I_DEST_CNT_TIME 进口目的港提箱日期 ,I_DEST_RTCNT_TIME 进口目的港还箱日期 ,I_DESTPORT_STATOIN 进口目的港堆存场站 ";
sql1 = sql1 + " , ClientSTATOIN.Tel 场站电话 ,ClientSTATOIN.CHIEF 场站联系人,ClientSTATOIN.ADDR 场站地址 ";
sql1 = sql1 + " from op_ctnbscard "
sql1 = sql1 + " Left join info_client ClientSTATOIN on ClientSTATOIN.SHORTNAME=op_ctnbscard.PORTLOAD_STATOIN ";
sql1 = sql1 + " Left join op_ctnrepair on op_ctnrepair.LINKGID=op_ctnbscard.GID ";
sql1 = sql1 + "WHERE op_ctnbscard.GID IN (" + feeGidSql + ") order by CTNNO ";
var sql2 = "select * from op_ctnbscard where GID='" + bsno + "'";
var sql3 = "SELECT [CTNNO] 罐号,[CTNPROP] 箱属,[NAMEPLATE] 铭牌信息 ,[OWNERCTN] 罐东 ,[MADEDATE] 制造年限";
sql3 = sql3 + ",(select ShowName from [user] where GID=code_ctntk.INPUTBY) as 录入人";
sql3 = sql3 + ",(select TOP 1 GOODSNAME FROM op_ctnbscard WHERE CTNNO=code_ctntk.CTNNO";
sql3 = sql3 + " ORDER BY PORTLOAD_CNT_TIME DESC) as 所装货";
// sql3 = sql3 + ",(select TOP 1 CUR_PORT FROM op_ctnbscard WHERE CTNNO=code_ctntk.CTNNO ";
// sql3 = sql3 + " ORDER BY PORTLOAD_CNT_TIME DESC) as 当前位置";
sql3 = sql3 + ",(select TOP 1 当前位置 FROM v_tk_cutdate WHERE CTNNO=code_ctntk.CTNNO ";
sql3 = sql3 + " ORDER BY 当前日期 DESC) as 当前位置 ";
sql3 = sql3 + ",(select TOP 1 当前日期 FROM v_tk_cutdate WHERE CTNNO=code_ctntk.CTNNO ";
sql3 = sql3 + " ORDER BY 当前日期 DESC) as 当前日期 ";
sql3 = sql3 + ",(select TOP 1 下一日期 FROM v_tk_cutdate WHERE CTNNO=code_ctntk.CTNNO ";
sql3 = sql3 + " ORDER BY 下一日期 DESC) as 下一日期 ";
sql3 = sql3 + ",(select TOP 1 前装货 FROM v_tk_preGoodsName WHERE CTNNO=code_ctntk.CTNNO ";
sql3 = sql3 + " order by PORTLOAD_CNT_TIME desc ) as 前装货 ";
sql3 = sql3 + " from code_ctntk";
sql3 = sql3 + " where CTNPROP in ('租赁箱','自有箱')";
sql3 = sql3 + " ORDER BY CTNNO ";
var sql4 = "Select op_ctnbscard.GID 编号";
sql4 = sql4 + ", op_ctnbscard.CTNNO 箱号,[dbo].F_GetRepairItems(op_ctnbscard.GID) 改装列表";
sql4 = sql4 + " from op_ctnbscard ";
sql4 = sql4 + "WHERE op_ctnbscard.GID IN (" + feeGidSql + ") order by op_ctnbscard.CTNNO ";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
}
});