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/MsOpSeaeEdi/MsOpSeaeEdiIndex.js

1700 lines
54 KiB
JavaScript

2 years ago
Ext.namespace('Shipping');
Shipping.MsOpSeaeEdiIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsOpSeaeEdiIndex.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsOpSeaeEdiIndex, Ext.Panel, {
PageSize: 20,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
isShowAdvancedQuery: 0, //是否显示高级查询面板
IsAudit: false,
BillType: 1,
OrType: 2,
initUIComponents: function () {
this.EFCODE = '';
_this = this;
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/MvcShipping/MsCodeFtpSet/GetData',
params: {
handle: 'edit',
condition: "EDINAME='EFAMS'"
},
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;
}
var data = result.data;
_this.EFCODE = data.CARRIERID;
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
this.formname = "formMsOpSeaeEdiIndex"; //页面名称
//定义数据集
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: 'MsSeaeEdiModel',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsOpSeaeEdi/GetDataList',
reader: {
id: 'MFNO',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//#region List列表显示信息
Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, {
width: 30
});
this.initgirdcolums = [{
sortable: true,
id: '',
dataIndex: '',
header: '',
width: 0
}, {
sortable: true,
dataIndex: 'BSNO',
header: '业务编号',
width: 0
}, {
sortable: true,
dataIndex: 'MFNO',
header: '业务编号',
width: 0
}, {
sortable: true,
dataIndex: 'CUSTNO',
header: '委托编号',
width: 120
},
{
sortable: true,
dataIndex: 'FILETYPE',
header: '文件类型',
width: 60
},
{
sortable: true,
dataIndex: 'EDITYPE',
header: 'EDI类型',
width: 80
},
{
sortable: true,
dataIndex: 'EDISTATUS',
header: 'EDI状态',
width: 80
},
{
sortable: true,
dataIndex: 'MANIFESTSTATUS',
header: '舱单状态',
width: 80
},
{
sortable: true,
dataIndex: 'MBLNO',
header: '主提单号',
width: 120
},
{
sortable: true,
dataIndex: 'HBLNO',
header: '分提单号',
width: 120
},
{
sortable: true,
dataIndex: 'ORDERNO',
header: '订舱编号',
width: 100
},
{
sortable: true,
dataIndex: 'VESSEL',
header: '船名',
width: 120
},
{
sortable: true,
dataIndex: 'VOYNO',
header: '航次',
width: 60
},
{
sortable: true,
dataIndex: 'ETD',
header: '开船日期',
width: 100
},
{
sortable: true,
dataIndex: 'PORTLOAD',
header: '装货港',
width: 100
},
{
sortable: true,
dataIndex: 'PORTDISCHARGE',
header: '卸货港',
width: 100
},
{
sortable: true,
dataIndex: 'PKGS',
header: '件数',
width: 80
},
{
sortable: true,
dataIndex: 'KGS',
header: '毛重',
width: 80
},
{
sortable: true,
dataIndex: 'CBM',
header: '尺码',
width: 60
},
{
sortable: true,
dataIndex: 'INPUTBY',
header: '录入人',
width: 80
},
{
sortable: true,
dataIndex: 'INPUTDATE',
header: '录入日期',
width: 80
}];
this.girdcolums = this.initgirdcolums;
this.GridCheckBoxModel = 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.GridCheckBoxModel,
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.girdcolums = 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.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
this.SelectedRecord = record;
this.OprationStatus = 'edit';
DsOpenEditWin('/MvcShipping/MsOpSeaeEdi/Edit');
// window.open('/MvcShipping/MsOpSubSeaOrder/Edit', "ORDER EDIT", 'width=1200,height=' + (window.screen.availHeight - 55) + ',top=0,left=0,resizable=yes,status=yes,menubar=no,scrollbars=yes');
}, this);
//录入人
this.comboxINPUTBY = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '录入人',
store: this.storeOpCode,
forceSelection: true,
name: 'INPUTBY',
valueField: 'UserName',
displayField: 'CodeAndName'
});
this.StoreEdiType = Ext.create('Ext.data.Store', {
fields: ['TYPE']
});
this.StoreEdiType.add({ "TYPE": "AFR" });
this.StoreEdiType.add({ "TYPE": "AMR" });
this.StoreEdiType.add({ "TYPE": "AMS" });
this.StoreEdiType.add({ "TYPE": "ISF" });
this.StoreEdiType.add({ "TYPE": "ACI" });
this.comboxEdiType = Ext.create('DsExt.ux.RefTableCombox', {
store: this.StoreEdiType,
fieldLabel: 'EDI类型',
forceSelection: true,
name: 'EDITYPE',
valueField: 'TYPE',
displayField: 'TYPE'
});
this.StoreStatus = Ext.create('Ext.data.Store', {
fields: ['STATUS']
});
this.StoreStatus.add({ "STATUS": "未发送" });
this.StoreStatus.add({ "STATUS": "已保存文件" });
this.StoreStatus.add({ "STATUS": "已发送" });
this.comboxStatus = Ext.create('DsExt.ux.RefTableCombox', {
store: this.StoreStatus,
fieldLabel: 'EDI状态',
forceSelection: true,
name: 'EDISTATUS',
valueField: 'STATUS',
displayField: 'STATUS'
});
//#endregion
//#region formSearch 查询面板
this.storeVoyVeg = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.VesselModel',
proxy: { url: '/CommMng/BasicDataRef/GetVesselList' }
});
this.storeVoyVeg.load({ params: { condition: ""} });
this.comboxVoyVeg = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '船 名',
store: this.storeVoyVeg,
name: 'VESSEL',
valueField: 'VESSEL',
flex: 1,
displayField: 'VESSEL'
});
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: 'MblNo'
}, {
fieldLabel: '分提单号',
name: 'HblNo'
}, this.comboxEdiType, this.comboxStatus]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '录入日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'INPUTbgn'
}, {
fieldLabel: '到',
format: 'Y-m-d',
xtype: 'datefield',
name: 'INPUTend'
}, {
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.comboxVoyVeg, {
fieldLabel: '航次',
name: 'VOYNO'
}, {
fieldLabel: '箱号',
name: 'CTNNO'
}, { xtype: 'hiddenfield'}]
}]//end items(fieldset 1)
}]//end root items
});
//#endregion formSearch
_this = this;
//按钮工具条
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [{
text: "删除",
iconCls: "btndelete",
handler: function (button, event) {
this.onDeleteClick(button, event);
},
scope: this
}, '-', {
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: 'FTP上传(启泰)报文',
tooltip: 'FTP上传',
handler: function (button, event) {
this.onFtpUpClick();
},
scope: this
}, '-', {
text: '保存(启泰)报文',
tooltip: '保存(启泰)报文',
handler: function (button, event) {
this.onSaveAfrFileClick();
},
scope: this
}, '-', {
text: "E-FREIGHT",
menu: [
{ text: "AFR FTP上传",
handler: function (menu, event) {
_this.onFtpEFUpClick();
}
}, { text: "保存AFR文件",
handler: function (menu, event) {
_this.onSaveEFAfrFileClick();
}
}, { text: "AMS FTP上传",
handler: function (menu, event) {
_this.onFtpEFAMSUpClick();
}
}, { text: "AMS WEB上传",
handler: function (menu, event) {
_this.onWEBEFAMSUpClick();
}
}, { text: "保存AMS文件",
handler: function (menu, event) {
_this.onSaveEFAMSFileClick();
}
}, { text: "查看AMS状态",
handler: function (menu, event) {
_this.onGETEFSTATUSClick();
}
}, {
text: "ISF FTP上传",
handler: function (menu, event) {
_this.onFtpEFISFUpClick();
}
}, {
text: "保存ISF文件",
handler: function (menu, event) {
_this.onSaveEFISFFileClick();
}
}],
scope: this
}, '-', {
text: '保存列表样式', //"保存列表样式",
id: "btntest",
menu: [
{ text:'保存', //"保存",
handler: function (button, event) {
_this.girdcolums = DsTruck.SaveGridPanel(USERID, _this.formname, _this.gridList.columns, _this.girdcolums, 1, true);
}
}, { text:'初始化', //"初始化",
handler: function (menu, event) {
_this.gridList.reconfigure(_this.storeList, _this.initgirdcolums);
_this.girdcolums = DsTruck.SaveGridPanel(USERID, _this.formname, _this.gridList.columns, _this.initgirdcolums, 1, true);
}
}],
scope: this
}]
});
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 125,
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, billtype: this.BillType, ortype: this.OrType });
}, this);
this.formDownloadShow = 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',
id: 'downloadfile',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'label',
html: '',
width: 120,
text: ''
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
me = this;
this.winDownloadShow = Ext.create('Ext.window.Window', {
title: "下载文件",
width: 450,
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.formDownloadShow],
buttons: [{
text: "关闭",
minWidth: 70,
handler: function () {
me.winDownloadShow.close();
}
}]
});
}, //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, ortype: this.OrType },
waitMsg: "正在查询数据...",
scope: this
});
},
onDeleteClick: function (button, event) {
var selectedRecords = this.gridList.getSelectionModel().getSelection();
if (selectedRecords.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var bsnos = '';
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (rec.data.EDISTATUS == '已发送') {
Ext.Msg.show({ title: '警告', msg: rec.data.MBLNO + ',此业务已发送,不允许删除!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
} else {
var bsno = rec.data.MFNO;
if (bsnos == '') {
bsnos = bsno;
} else {
bsnos = bsnos + "," + bsno;
}
}
}
Ext.MessageBox.confirm('提示', '确定删除选中记录吗?', function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在删除数据...');
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/MvcShipping/MsOpSeaeEdi/DeletePiLiang',
params: {
bsnos: bsnos
},
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);
},
onFtpUpClick: 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 insert;
var bodyAddDatas = [];
var j = 0;
var Mblno = '';
for (var i = 0; i < records.length; i++) {
var rec = records[i];
var EDISTATUS = rec.data.EDISTATUS;
if (EDISTATUS == "已发送") {
j = j + 1;
}
Mblno = rec.data.MBLNO;
bodyAddDatas.push(rec);
}
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
var msg = '';
if (j > 0) {
msg = j + '票业务已经发送,确认要重新发送吗?';
} else {
msg = '确定FTP上传吗';
}
_this = this;
Ext.MessageBox.confirm('提示', msg, function (btn) {
if (btn == 'yes') {
Ext.Ajax.request({
waitMsg: 'Changing...',
url: '/MvcShipping/MsOpSeaeEdi/AFRSend',
params: {
headData: jsonbodyAddDatas,
mblno: Mblno
},
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('The Server Response Error, Please Try Again', response.responseText);
}
},
scope: this
});
}
}, this);
},
onFtpEFUpClick: 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 insert;
var bodyAddDatas = [];
var j = 0;
var Mblno = '';
for (var i = 0; i < records.length; i++) {
var rec = records[i];
var EDISTATUS = rec.data.EDISTATUS;
if (EDISTATUS == "已发送") {
j = j + 1;
}
Mblno = rec.data.MBLNO;
if (rec.data.PACKINGTYPE != 'LCL')
bodyAddDatas.push(rec);
}
if (bodyAddDatas.length == 0) {
Ext.Msg.show({ title: '提示', msg: '没有要生成AFR的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
var msg = '';
if (j > 0) {
msg = j + '票业务已经发送,确认要重新发送吗?';
} else {
msg = '确定FTP上传吗';
}
_this = this;
Ext.MessageBox.confirm('提示', msg, function (btn) {
if (btn == 'yes') {
Ext.Ajax.request({
waitMsg: 'Changing...',
url: '/MvcShipping/MsOpSeaeEdi/AFREFSend',
params: {
headData: jsonbodyAddDatas,
mblno: Mblno
},
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('The Server Response Error, Please Try Again', response.responseText);
}
},
scope: this
});
}
}, this);
},
onFtpEFAMSUpClick: 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 insert;
var bodyAddDatas = [];
var j = 0;
var Mblno = '';
for (var i = 0; i < records.length; i++) {
var rec = records[i];
var EDISTATUS = rec.data.EDISTATUS;
if (EDISTATUS == "已发送") {
j = j + 1;
}
Mblno = rec.data.MBLNO;
bodyAddDatas.push(rec);
}
if (bodyAddDatas.length == 0) {
Ext.Msg.show({ title: '提示', msg: '没有要生成AFR的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
var msg = '';
if (j > 0) {
msg = j + '票业务已经发送,确认要重新发送吗?';
} else {
msg = '确定FTP上传吗';
}
_this = this;
Ext.MessageBox.confirm('提示', msg, function (btn) {
if (btn == 'yes') {
Ext.Ajax.request({
waitMsg: 'Changing...',
url: '/MvcShipping/MsOpSeaeEdi/AMSEFSend',
params: {
headData: jsonbodyAddDatas,
mblno: Mblno
},
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('The Server Response Error, Please Try Again', response.responseText);
}
},
scope: this
});
}
}, this);
},
onFtpEFISFUpClick: 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 insert;
var bodyAddDatas = [];
var j = 0;
var Mblno = '';
for (var i = 0; i < records.length; i++) {
var rec = records[i];
var EDISTATUS = rec.data.EDISTATUS;
if (EDISTATUS == "已发送") {
j = j + 1;
}
Mblno = rec.data.MBLNO;
bodyAddDatas.push(rec);
}
if (bodyAddDatas.length == 0) {
Ext.Msg.show({ title: '提示', msg: '没有要生成ISF的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
var msg = '';
if (j > 0) {
msg = j + '票业务已经发送,确认要重新发送吗?';
} else {
msg = '确定FTP上传吗';
}
_this = this;
Ext.MessageBox.confirm('提示', msg, function (btn) {
if (btn == 'yes') {
Ext.Ajax.request({
waitMsg: 'Changing...',
url: '/MvcShipping/MsOpSeaeEdi/EFISFSend',
params: {
headData: jsonbodyAddDatas,
mblno: Mblno
},
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('The Server Response Error, Please Try Again', response.responseText);
}
},
scope: this
});
}
}, this);
},
onWEBEFAMSUpClick: 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 insert;
var bodyAddDatas = [];
var j = 0;
var Mblno = '';
for (var i = 0; i < records.length; i++) {
var rec = records[i];
var EDISTATUS = rec.data.EDISTATUS;
if (EDISTATUS == "已发送") {
j = j + 1;
}
Mblno = rec.data.MBLNO;
bodyAddDatas.push(rec);
}
if (bodyAddDatas.length == 0) {
Ext.Msg.show({ title: '提示', msg: '没有要生成AFR的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
var msg = '';
if (j > 0) {
msg = j + '票业务已经发送,确认要重新发送吗?';
} else {
msg = '确定WEB上传吗';
}
_this = this;
Ext.MessageBox.confirm('提示', msg, function (btn) {
if (btn == 'yes') {
Ext.Ajax.request({
waitMsg: 'Changing...',
url: '/MvcShipping/MsOpSeaeEdi/AMSEFWEBSend',
params: {
headData: jsonbodyAddDatas,
mblno: Mblno
},
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.Data,
icon: Ext.Msg.INFO,
buttons: Ext.Msg.OK
});
_this.onRefreshClick();
}
} else {
Ext.MessageBox.alert('The Server Response Error, Please Try Again', response.responseText);
}
},
scope: this
});
}
}, this);
},
onSaveAfrFileClick: 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 insert;
var bodyAddDatas = [];
var j = 0;
var Mblno = '';
for (var i = 0; i < records.length; i++) {
var rec = records[i];
var EDISTATUS = rec.data.EDISTATUS;
if (EDISTATUS == "已发送") {
j = j + 1;
}
Mblno = rec.data.MBLNO;
bodyAddDatas.push(rec);
}
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
var msg = '';
msg = '确定要保存EDI文件吗';
var strlo = window.location.host;
_this = this;
Ext.Ajax.request({
waitMsg: 'Changing...',
url: '/MvcShipping/MsOpSeaeEdi/AFRSaveFile',
params: {
headData: jsonbodyAddDatas,
mblno: Mblno
},
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 {
var downloadfile = Ext.getCmp('downloadfile');
var children = downloadfile.items;
if (children) {
for (var i = 0, len = children.length; i < len; i++) {
downloadfile.remove(children.items[i], true);
}
}
var downloadfiles = '<a href="' + result.Data + '" style=' + '"text-decoration:none"' + '>' + result.Message + '</a>';
var htmla = Ext.widget('label', {
html: downloadfiles,
width: 120,
text: ''
});
downloadfile.items.add(htmla);
this.winDownloadShow.show();
}
} else {
Ext.MessageBox.alert('The Server Response Error, Please Try Again', response.responseText);
}
},
scope: this
});
},
onSaveEFAfrFileClick: 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 insert;
var bodyAddDatas = [];
var j = 0;
var Mblno = '';
for (var i = 0; i < records.length; i++) {
var rec = records[i];
var EDISTATUS = rec.data.EDISTATUS;
if (EDISTATUS == "已发送") {
j = j + 1;
}
Mblno = rec.data.MBLNO;
if (rec.data.PACKINGTYPE != 'LCL')
bodyAddDatas.push(rec);
if (rec.data.PACKINGTYPE == 'LCL') {
}
}
if (bodyAddDatas.length == 0) {
Ext.Msg.show({ title: '提示', msg: '没有要生成AFR的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
var msg = '';
msg = '确定要保存EDI文件吗';
var strlo = window.location.host;
_this = this;
Ext.Ajax.request({
waitMsg: 'Changing...',
url: '/MvcShipping/MsOpSeaeEdi/AFREFSaveFile',
params: {
headData: jsonbodyAddDatas,
mblno: Mblno
},
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 {
var downloadfile = Ext.getCmp('downloadfile');
var children = downloadfile.items;
if (children) {
for (var i = 0, len = children.length; i < len; i++) {
downloadfile.remove(children.items[i], true);
}
}
var downloadfiles = '<a href="' + result.Data + '" style=' + '"text-decoration:none"' + '>' + result.Message + '</a>';
var htmla = Ext.widget('label', {
html: downloadfiles,
width: 120,
text: ''
});
downloadfile.items.add(htmla);
this.winDownloadShow.show();
}
} else {
Ext.MessageBox.alert('The Server Response Error, Please Try Again', response.responseText);
}
},
scope: this
});
},
onSaveEFAMSFileClick: 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 insert;
var bodyAddDatas = [];
var j = 0;
var Mblno = '';
for (var i = 0; i < records.length; i++) {
var rec = records[i];
var EDISTATUS = rec.data.EDISTATUS;
if (EDISTATUS == "已发送") {
j = j + 1;
}
Mblno = rec.data.MBLNO;
bodyAddDatas.push(rec);
}
if (bodyAddDatas.length == 0) {
Ext.Msg.show({ title: '提示', msg: '没有要生成AFR的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
var msg = '';
msg = '确定要保存EDI文件吗';
var strlo = window.location.host;
_this = this;
Ext.Ajax.request({
waitMsg: 'Changing...',
url: '/MvcShipping/MsOpSeaeEdi/AMSEFSaveFile',
params: {
headData: jsonbodyAddDatas,
mblno: Mblno
},
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 {
var downloadfile = Ext.getCmp('downloadfile');
var children = downloadfile.items;
if (children) {
for (var i = 0, len = children.length; i < len; i++) {
downloadfile.remove(children.items[i], true);
}
}
var downloadfiles = '<a href="' + result.Data + '" style=' + '"text-decoration:none"' + '>' + result.Message + '</a>';
var htmla = Ext.widget('label', {
html: downloadfiles,
width: 120,
text: ''
});
downloadfile.items.add(htmla);
this.winDownloadShow.show();
}
} else {
Ext.MessageBox.alert('The Server Response Error, Please Try Again', response.responseText);
}
},
scope: this
});
},
onSaveEFISFFileClick: 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 insert;
var bodyAddDatas = [];
var j = 0;
var Mblno = '';
for (var i = 0; i < records.length; i++) {
var rec = records[i];
var EDISTATUS = rec.data.EDISTATUS;
if (EDISTATUS == "已发送") {
j = j + 1;
}
Mblno = rec.data.MBLNO;
bodyAddDatas.push(rec);
}
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
var msg = '';
msg = '确定要保存EDI文件吗';
var strlo = window.location.host;
_this = this;
Ext.Ajax.request({
waitMsg: 'Changing...',
url: '/MvcShipping/MsOpSeaeEdi/EFISFSaveFile',
params: {
headData: jsonbodyAddDatas,
mblno: Mblno
},
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 {
var downloadfile = Ext.getCmp('downloadfile');
var children = downloadfile.items;
if (children) {
for (var i = 0, len = children.length; i < len; i++) {
downloadfile.remove(children.items[i], true);
}
}
var downloadfiles = '<a href="' + result.Data + '" style=' + '"text-decoration:none"' + '>' + result.Message + '</a>';
var htmla = Ext.widget('label', {
html: downloadfiles,
width: 120,
text: ''
});
downloadfile.items.add(htmla);
this.winDownloadShow.show();
}
} else {
Ext.MessageBox.alert('The Server Response Error, Please Try Again', response.responseText);
}
},
scope: this
});
},
//#region AMS查询
onGETEFSTATUSClick: 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];
var MBLNO = record.data.HBLNO;
var url = 'http://www.eftams.com/ams.aspx?scac=' + this.EFCODE + '&hbl=' + MBLNO;
formCustomDataShow = Ext.widget('form', {
region: 'center',
autoScroll: true, height: 460,
// border: false,
bodyPadding: 0,
html: ' <iframe scrolling="auto" frameborder="0" width="100%" height="100%" src="' + url + '"> </iframe>'
});
me = this;
winCustomDataShow = Ext.create('Ext.window.Window', {
title: "",
// closeAction: 'hide',
width: 1100,
height: 500,
layout: 'fit',
resizable: true,
modal: true,
closeAction: 'close',
closable: true,
items: [formCustomDataShow],
buttons: [{
text: "关闭",
minWidth: 70,
handler: function () {
winCustomDataShow.close();
}
}]
});
winCustomDataShow.show();
// if (MBLNO == "") {
// Ext.Msg.show({ title: '提示', msg: '提单号不能为空!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
// return;
// } else {
// Ext.Msg.wait('正在提取数据...');
// Ext.Ajax.request({
// waitMsg: '正在提取数据...',
// url: '/MvcShipping/MsOpSeae/GetAmsStatus',
// params: {
// mblno: MBLNO,
// isweb: true
// },
// callback: function (options, success, response) {
// if (success) {
// var jsonresult = Ext.JSON.decode(response.responseText);
// if (jsonresult.Success) {
// var statusdata = jsonresult.data;
// var boxitems = "";
// formCustomDataShow = Ext.widget('form', {
// region: 'center',
// autoScroll: true, height: 460,
// // border: false,
// bodyPadding: 0,
// html: jsonresult.data
// });
// me = this;
// winCustomDataShow = Ext.create('Ext.window.Window', {
// title: "",
// // closeAction: 'hide',
// width: 1100,
// height: 500,
// layout: 'fit',
// resizable: true,
// modal: true,
// closeAction: 'close',
// closable: true,
// items: [formCustomDataShow],
// buttons: [{
// text: "关闭",
// minWidth: 70,
// handler: function () {
// winCustomDataShow.close();
// }
// }]
// });
// winCustomDataShow.show();
// Ext.Msg.hide();
// }
// 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
// }
},
//#endregion
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 = " (EDITYPE='AFR' OR EDITYPE='AMR' OR EDITYPE='AMS' OR EDITYPE='ACI' OR EDITYPE='EMANIFEST' OR EDITYPE='ISF' ) ";
//#region formSearch 查询面板
//编号包括(主提单号)
var MblNo = form.findField('MblNo').getValue();
sql = sql + getAndConSql(sql, MblNo, "(MBLNO like '%" + MblNo + "%' )");
var HblNo = form.findField('HblNo').getValue();
sql = sql + getAndConSql(sql, HblNo, "(HBLNO like '%" + HblNo + "%' )");
var CTNNO = form.findField('CTNNO').getValue();
sql = sql + getAndConSql(sql, CTNNO, " MFNO IN (SELECT MFNO FROM OP_SEAE_EDI_CTN WHERE CTNNO like '%" + CTNNO + "%' )");
//状态
var ORSTATUS = form.findField('EDISTATUS').getValue();
sql = sql + getAndConSql(sql, ORSTATUS, "EDISTATUS='" + ORSTATUS + "'");
var EDITYPE = form.findField('EDITYPE').getValue();
sql = sql + getAndConSql(sql, EDITYPE, "EDITYPE='" + EDITYPE + "'");
//到港日期
var ETDbgn = form.findField('ETDbgn').getRawValue();
sql = sql + getAndConSql(sql, ETDbgn, "ETD >='" + ETDbgn + "'");
var ETDend = form.findField('ETDend').getRawValue();
sql = sql + getAndConSql(sql, ETDend, "ETD <='" + ETDend + "'");
var INPUTbgn = form.findField('INPUTbgn').getRawValue();
sql = sql + getAndConSql(sql, INPUTbgn, "INPUTDATE>='" + INPUTbgn + "'");
var INPUTend = form.findField('INPUTend').getRawValue();
sql = sql + getAndConSql(sql, INPUTend, "INPUTDATE<='" + INPUTend + "'");
//船名
var VESSEL = form.findField('VESSEL').getValue();
sql = sql + getAndConSql(sql, VESSEL, "VESSEL like '%" + VESSEL + "%'");
//航次
var VOYNO = form.findField('VOYNO').getValue();
sql = sql + getAndConSql(sql, VOYNO, "VOYNO like '%" + VOYNO + "%'");
return sql;
},
setIsShowAdvancedQuery: function () {
if (this.isShowAdvancedQuery == 0) {
this.panelSearch.show();
this.isShowAdvancedQuery = 1;
} else {
this.panelSearch.hide();
this.isShowAdvancedQuery = 0;
}
},
OprationSwap: function () {
var ret = new Array();
ret[0] = this.OprationStatus;
ret[1] = this.storeList;
ret[2] = this.SelectedRecord;
ret[3] = this.IsAudit;
ret[4] = this.BillType;
ret[5] = this.OrType;
return ret;
}
});