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/MsOpSeaeFenIndex.js

1370 lines
51 KiB
JavaScript

2 years ago
Ext.namespace('Shipping');
Shipping.MsOpSeaeFenIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsOpSeaeFenIndex.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsOpSeaeFenIndex, Ext.Panel, {
PageSize: 20,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
EditRecord: null,
BsNo: '',
sortfield: '',
sortdire: '',
mainWin:'',
initUIComponents: function () {
var mainform = window.panelEdit;
this.EditRecord = mainform.editRecord;
this.BsNo = this.EditRecord.get('BSNO');
this.mainWin = getMainForm(window.parent.opener);
this.formname = "formMsOpSeaeFenIndex"; //页面名称
//定义数据集
this.storectndisp = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CtnDispModel',
proxy: { url: '/CommMng/BasicDataRef/GetCtnDisp' }
});
this.StoreOpRange = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsOP',
proxy: { url: '/MvcShipping/MsBaseInfo/GetOpRang' }
});
this.StoreOpRange.load({ params: { optype: "modOrderManagement"} });
this.storeList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'MsOpSeaeModel',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsOpSeae/GetFenList',
reader: {
id: 'BSNO',
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: 'CUSTNO',
header: '委托编号',
width: 120
},
{
sortable: true,
dataIndex: 'BSSTATUSREF',
header: '业务状态',
width: 60
},
{
sortable: true,
dataIndex: 'FEESTATUSREF',
header: '费用状态',
width: 60
},
{
sortable: true,
dataIndex: 'BLTYPE',
header: '装运方式',
width: 60
},
{
sortable: true,
dataIndex: 'ETD',
header: '开船日期',
width: 80
},
{
sortable: true,
dataIndex: 'MBLNO',
header: '主提单号',
width: 120
},
{
sortable: true,
dataIndex: 'CUSTOMERNAME',
header: '委托单位',
width: 120
},
{
sortable: true,
dataIndex: 'BSDATE',
header: '接单日期',
width: 80
},
{
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: 'HBLNO',
header: '分提单号',
width: 120
},
{
sortable: true,
dataIndex: 'ACCDATE',
header: '会计期间',
width: 60
},
{
sortable: true,
dataIndex: 'BSSOURCE',
header: '业务来源',
width: 80
},
{
sortable: true,
dataIndex: 'BSSOURCEDETAIL',
header: '来源明细',
width: 80
},
{
sortable: true,
dataIndex: 'INPUTBY',
header: '录入人',
width: 80
},
{
sortable: true,
dataIndex: 'CREATETIME',
header: '创建时间',
width: 120
},
{
sortable: true,
dataIndex: 'OP',
header: '操作员',
width: 80
},
{
sortable: true,
dataIndex: 'SALE',
header: '揽货人',
width: 80
},
{
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: 'CUSTOMSER',
header: '报关行',
width: 80
},
{
sortable: true,
dataIndex: 'KINDPKGS',
header: '件数包装',
width: 60
},
{
sortable: true,
dataIndex: 'CBM',
header: '立方/尺码',
width: 60
},
{
sortable: true,
dataIndex: 'CARRIER',
header: '船公司',
width: 100
},
{
sortable: true,
dataIndex: 'TRUCKER',
header: '承运车队',
width: 100
},
{
sortable: true,
dataIndex: 'VOUNO',
header: '凭证号',
width: 60
}];
this.Pagenum = Ext.create('Ext.form.field.Number', {
name: 'bottles',
fieldLabel: '每页记录数', //'每页记录数',
labelAlign: 'right',
value: this.PageSize,
maxValue: 100000,
width: 180,
minValue: 0,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_thisfenlist.onRefreshClick();
}
}
}
});
this.girdcolums=this.initgirdcolums;
this.GridCheckBoxFenModel = Ext.create('Ext.selection.CheckboxModel');
//定义Grid
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
selModel: this.GridCheckBoxFenModel,
disableSelection: false,
columns: this.girdcolums,
bbar: [Ext.create('Ext.PagingToolbar', {
store: this.storeList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录', //'当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"//'没有数据'
}), this.Pagenum]
});
/////////////以下部分为获取存储的gridpanel显示样式
// this.column = DsTruck.GetGridPanel(USERID, this.formname, this.girdcolums, 1); //使用者id表名中间column数组跳过一开始的几列
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/MsOpSeae/Edit', "分票信息");
}, this);
this.gridList.addListener('sortchange', function (ct, column, direction, eOpts) {
this.sortfield = column.dataIndex;
this.sortdire = direction;
}, this);
_thisfenlist = this;
//按钮工具条
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [{
text: "新建",
iconCls: "btnadd",
handler: function (button, event) {
if (this.EditRecord.get('BSSTATUSREF') == '锁定') {
Ext.Msg.show({ title: '提示', msg: '主票已业务锁定,不允许添加分票!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
this.OprationStatus = 'add';
DsOpenEditWin('/MvcShipping/MsOpSeae/Edit', "分票信息");
},
scope: this
}, '-', {
text: Zi.LAN.copyadd, //"国外舱单",
iconCls: "btnadd",
handler: function (button, event) {
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.QingXianXuanZeYeWu, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var record = selections[0];
this.SelectedRecord = record;
this.OprationStatus = 'copyadd';
DsOpenEditWin('/MvcShipping/MsOpSeae/Edit', "分票信息");
},
scope: this
}, {
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: Zi.LAN.btntest, //"保存列表样式",
id: "btntest",
menu: [
{ text: Zi.LAN.SaveGridPanel, //"保存",
handler: function (button, event) {
_thisfenlist.girdcolums = DsTruck.SaveGridPanel(USERID, _thisfenlist.formname, _thisfenlist.gridList.columns, _thisfenlist.girdcolums, 1, true);
}
}, { text: Zi.LAN.SaveGridPanel2, //"初始化",
handler: function (menu, event) {
_thisfenlist.gridList.reconfigure(_thisfenlist.storeList, _thisfenlist.initgirdcolums);
_thisfenlist.girdcolums = DsTruck.SaveGridPanel(USERID, _thisfenlist.formname, _thisfenlist.gridList.columns, _thisfenlist.initgirdcolums, 1, true);
}
}],
scope: this
}, '-', {
text: Zi.LAN.EdiExport, //"EDI报文导出",
menu: [{
text: Zi.LAN.CargoSmartEDI, //"Cargo Smart",
handler: function (menu, event) {
_this.onCreateCargoSmartEDIClick(menu, event);
}
}
],
scope: this
}, '-', {
text: Zi.LAN.GuoWaiCangDan, //"国外舱单",
menu: [
{ text: Zi.LAN.JapanAFR, //"日本AFR",
handler: function (menu, event) {
_thisfenlist.onCreateAfrClick(menu, event, 1);
}
}, { text: Zi.LAN.JapanAMR, //"日本AMR",
handler: function (menu, event) {
_thisfenlist.onCreateAfrClick(menu, event, 2);
}
}, { text: Zi.LAN.AMS, //"AMS",
handler: function (menu, event) {
_thisfenlist.onCreateAfrClick(menu, event, 3);
}
}, { text: Zi.LAN.JapanAFRZF, //"直发日本AFR",
handler: function (menu, event) {
_thisfenlist.onCreateAfrZFClick(menu, event, 1);
}
}, { text: Zi.LAN.JapanAMRZF, //"直发日本AMR",
handler: function (menu, event) {
_thisfenlist.onCreateAfrZFClick(menu, event, 2);
}
}, { text: Zi.LAN.AMSZF, //"直发AMS",
handler: function (menu, event) {
_thisfenlist.onCreateAfrZFClick(menu, event, 3);
}
}, { text: Zi.LAN.JapanAFRZF + "(CargoSmart)", //"直发日本AFR",
handler: function (menu, event) {
_this.onCreateAfrCSZFClick(menu, event, 'CGAFR');
}
}],
scope: this
}, '-',
{
text: Zi.LAN.btnprint, //"打印",
iconCls: 'btnprint',
menu: [
{ text: Zi.LAN.Print, //"全部",
handler: function (menu, event) {
_thisfenlist.Print();
}
}, { text: Zi.LAN.PrintSelect, //"选择打印",
handler: function (menu, event) {
_thisfenlist.PrintSelect();
}
}],
scope: this
}]
});
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 30,
items: [this.panelBtn]
});
Ext.apply(this, {
items: [this.panelTop, this.gridList]
});
this.onRefreshClick();
this.storeList.on('beforeload', function (store) {
var sql = "BSNO<>'" + this.BsNo + "' and MASTERNO='" + this.BsNo + "'";
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
//#region Cargo Smart 中远(客户乾景)
this.CheckBillCargoSmartEDI = new Ext.form.Checkbox({
fieldLabel: Zi.LAN.isHuoDaiTiDan, //'货代提单',
checked: false
});
this.formCargoSmartEDIShow = Ext.widget('form', {
frame: true,
region: 'center',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 90,
msgTarget: 'qtip'
},
items: [{
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: { anchor: '100%' },
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
xtype: 'radiogroup',
fieldLabel: Zi.LAN.rFILETYPE, //'报文类型',
id: 'CargoSmartFILETYPE',
defaults: { flex: 1 },
layout: 'hbox',
items: [{
boxLabel: Zi.LAN.FILETYPE_B, //'订舱',
name: 'FILETYPE',
checked: true,
inputValue: 'B'
}
, {
boxLabel: Zi.LAN.FILETYPE_E, //'确认',
name: 'FILETYPE',
inputValue: 'E'
}
]
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.CheckBillCargoSmartEDI, {
fieldLabel: '销售代码', //'发票号',
id: 'CargoSmartSALEID',
name: 'SALEID'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
xtype: 'radiogroup',
fieldLabel: Zi.LAN.rFILEROLE, //'文件功能',
id: 'CargoSmartFILEROLE',
defaults: { flex: 1 },
layout: 'hbox',
items: [{
boxLabel: Zi.LAN.FILEROLE_YS, //'原始',
name: 'FILEROLE',
inputValue: 'NEW',
checked: true
}, {
boxLabel: Zi.LAN.FILEROLE_GX, //'更新',
name: 'FILEROLE',
inputValue: 'UPD'
}, {
boxLabel: Zi.LAN.FILEROLE_SC, //'删除',
name: 'FILEROLE',
inputValue: 'CAN'
}]
}]
}
, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
xtype: 'radiogroup',
fieldLabel: Zi.LAN.CARRIER, //'船公司',
columns: 2,
vertical: true,
id: 'CargoSmartCARRIER',
items: [{
boxLabel: Zi.LAN.CARRIER_COSU, //'中远COSCO',
name: 'CARRIER',
inputValue: 'COSU',
checked: true
}]
}]
}
]//end items(fieldset 1)
}]//end root items
});
mefen = this;
this.winCargoSmartEDIShow = Ext.create('Ext.window.Window', {
title: Zi.LAN.winCargoSmartEDIShow, //"生成Cargo Smart报文",
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.formCargoSmartEDIShow],
buttons: [{
text: Zi.LAN.ShangChuanEdi, //"上传EDI",
minWidth: 70,
handler: function () {
var cgFILETYPE = Ext.getCmp('CargoSmartFILETYPE');
var FILETYPE = cgFILETYPE.getValue();
var cgFILEROLE = Ext.getCmp('CargoSmartFILEROLE');
var FILEROLE = cgFILEROLE.getValue();
var CARRIER = Ext.getCmp('CargoSmartCARRIER').getValue();
var SALEID = Ext.getCmp('CargoSmartSALEID').getValue();
var IsBill = 0;
if (mefen.CheckBillCargoSmartEDI.checked)
IsBill = 1;
mefen.onSendCargoSmartEDI(FILETYPE.FILETYPE, FILEROLE.FILEROLE, IsBill, CARRIER.CARRIER, SALEID);
saveQuerySetting(mefen.formname + 'CargoSmartEDI', mefen.formCargoSmartEDIShow, false, true);
}
}, {
text: Zi.LAN.BaoCunEdiWenJian, //"保存EDI文件",
minWidth: 70,
handler: function () {
var cgFILETYPE = Ext.getCmp('CargoSmartFILETYPE');
var FILETYPE = cgFILETYPE.getValue();
var cgFILEROLE = Ext.getCmp('CargoSmartFILEROLE');
var FILEROLE = cgFILEROLE.getValue();
var CARRIER = Ext.getCmp('CargoSmartCARRIER').getValue();
var SALEID = Ext.getCmp('CargoSmartSALEID').getValue();
var IsBill = 0;
if (mefen.CheckBillCargoSmartEDI.checked)
IsBill = 1;
mefen.onSaveCargoSmartEDI(FILETYPE.FILETYPE, FILEROLE.FILEROLE, IsBill, CARRIER.CARRIER, SALEID);
saveQuerySetting(mefen.formname + 'CargoSmartEDI', mefen.formCargoSmartEDIShow, false, true);
}
}, {
text: Zi.LAN.GuanBi, //"关闭",
minWidth: 70,
handler: function () {
mefen.winCargoSmartEDIShow.close();
}
}]
});
//#endregion
}, //end initUIComponents
onRefreshClick: function (button, event) {
//var girdcolums = this.gridList.getColumnMode();
var sql = "BSNO<>'" + this.BsNo + "' and MASTERNO='" + this.BsNo + "'";
this.PageSize = this.Pagenum.getValue();
this.storeList.pageSize = this.PageSize;
this.storeList.currentPage = 1;
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];
if (record.data.BSSTATUS == 'true') {
Ext.Msg.show({ title: '警告', msg: '业务已锁定,不允许删除!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
}
if (record.data.FEESTATUS == 'true') {
Ext.Msg.show({ title: '警告', msg: '费用已锁定,不允许删除!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
}
if (this.StoreOpRange.getCount() == 0) {
Ext.Msg.show({ title: '警告', msg: '权限不足,不允许删除!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
} else {
var op = record.data.OP;
var inputby = record.data.INPUTBY;
var records = DsStoreQueryBy(this.StoreOpRange, 'OPID', op);
if (records.getCount() > 0) {
} else {
var recordins = DsStoreQueryBy(this.StoreOpRange, 'OPID', inputby);
if (recordins.getCount() > 0) {
} else {
canedit = false;
Ext.Msg.show({ title: '警告', msg: '权限不足,不允许删除!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
}
}
}
Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在删除数据...');
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/MvcShipping/MsOpSeae/Delete',
params: {
data: Ext.JSON.encode(record.data)
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.storeList.remove(record);
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);
},
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.mainWin;
return ret;
},
//#region 舱单 AFR
onCreateAfrClick: function (menu, event, type) {
var GidStr = '';
var selections = this.GridCheckBoxFenModel.selected.items;
if (selections.length == 0) {
Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.QingXianXuanZeYeWu, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); //请先选择要生成的业务!
return;
}
var BSNOStr = '';
for (var i = 0; i < selections.length; i++) {
var rec = selections[i];
var BSNO = rec.data.BSNO;
if (BSNOStr == '')
BSNOStr = BSNO;
else {
BSNOStr = BSNOStr + ',' + BSNO;
}
}
if (BSNOStr == '') {
Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.MeiYouYaoCaoZuoDeYeWu, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
} else {
Ext.Ajax.request({
waitMsg: Zi.LAN.ZhengZaiCaoZuoShuJu,
url: '/MvcShipping/MsOpSeae/CreateAfrList',
params: {
BSNOS: BSNOStr,
type: type
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: Zi.LAN.TiShi,
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
} else {
Ext.Msg.show({ title: Zi.LAN.TiShi, msg: result.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}
},
onCreateAfrZFClick: function (menu, event, type) {
var GidStr = '';
var selections = this.GridCheckBoxFenModel.selected.items;
if (selections.length == 0) {
Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.QingXianXuanZeYeWu, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); //请先选择要生成的业务!
return;
}
var BSNOStr = '';
for (var i = 0; i < selections.length; i++) {
var rec = selections[i];
var BSNO = rec.data.BSNO;
if (BSNOStr == '')
BSNOStr = BSNO;
else {
BSNOStr = BSNOStr + ',' + BSNO;
}
}
if (BSNOStr == '') {
Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.MeiYouYaoCaoZuoDeYeWu, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
} else {
Ext.Ajax.request({
waitMsg: Zi.LAN.ZhengZaiCaoZuoShuJu,
url: '/MvcShipping/MsOpSeaeEdi/AFREditSend',
params: {
BSNOS: BSNOStr,
type: type
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: Zi.LAN.TiShi,
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
} else {
Ext.Msg.show({ title: Zi.LAN.TiShi, msg: result.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}
},
onCreateAfrCSZFClick: function (menu, event, type) {
var GidStr = '';
var selections = this.GridCheckBoxFenModel.selected.items;
if (selections.length == 0) {
Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.QingXianXuanZeYeWu, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); //请先选择要生成的业务!
return;
}
var BSNOStr = '';
for (var i = 0; i < selections.length; i++) {
var rec = selections[i];
var BSNO = rec.data.BSNO;
if (BSNOStr == '')
BSNOStr = BSNO;
else {
BSNOStr = BSNOStr + ',' + BSNO;
}
}
if (BSNOStr == '') {
Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.MeiYouYaoCaoZuoDeYeWu, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
} else {
var formCargosmartAFRShow = 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',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
xtype: 'radiogroup',
fieldLabel: Zi.LAN.rFILEROLE, //'文件功能',
id: 'cmAFRFILEROLE',
defaults: {
flex: 1
},
layout: 'hbox',
items: [
{
boxLabel: Zi.LAN.FILEROLE_YS, //'原始',
name: 'FILEROLE',
inputValue: '9',
checked: true
//,id: 'radio3'
}, {
boxLabel: Zi.LAN.FILEROLE_GX, //'更新',
name: 'FILEROLE',
inputValue: '4'
//,id: 'radio6'
}
]
}
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
var winCargosmartAFREDIShow = Ext.create('Ext.window.Window', {
title: Zi.LAN.winEDIShow, //"生成EDI",
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: [formCargosmartAFRShow],
buttons: [{
text: Zi.LAN.ShangChuanEdi, //"上传EDI",
minWidth: 70,
handler: function () {
var cmAFRFILEROLE = Ext.getCmp('cmAFRFILEROLE');
var FILEROLE = cmAFRFILEROLE.getValue();
Ext.Ajax.request({
waitMsg: Zi.LAN.ZhengZaiCaoZuoShuJu,
url: '/MvcShipping/MsOpSeaeEdi/AFREditSend',
params: {
BSNOS: BSNOStr,
type: type,
filerole: FILEROLE
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: Zi.LAN.TiShi,
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
} else {
Ext.Msg.show({ title: Zi.LAN.TiShi, msg: result.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}
}, {
text: Zi.LAN.BaoCunEdiWenJian, //"保存EDI文件",
minWidth: 70,
handler: function () {
var cmAFRFILEROLE = Ext.getCmp('cmAFRFILEROLE');
var FILEROLE = cmAFRFILEROLE.getValue();
Ext.Ajax.request({
waitMsg: Zi.LAN.ZhengZaiCaoZuoShuJu,
url: '/MvcShipping/MsOpSeaeEdi/AFREditSaveFile',
params: {
BSNOS: BSNOStr,
type: type,
filerole: FILEROLE
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: Zi.LAN.TiShi,
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);
}
}
// downloadfile.doLayout();
// // var downloadfile = Ext.getCmp('downloadfile');
// var filehtml = '<a href="' + result.Data + '" style=' + '"text-decoration:none"' + '>' + result.Message + '</a>'
// downloadfile.html = filehtml;
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('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}
}, {
text: Zi.LAN.GuanBi, //"关闭",
minWidth: 70,
handler: function () {
winCargosmartAFREDIShow.close();
}
}]
});
winCargosmartAFREDIShow.show();
}
},
onCreateCustomClick: function (menu, event, type) {
var GidStr = '';
var selections = this.GridCheckBoxFenModel.selected.items;
if (selections.length == 0) {
Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.QingXianXuanZeYeWu, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); //请先选择要生成的业务!
return;
}
var BSNOStr = '';
for (var i = 0; i < selections.length; i++) {
var rec = selections[i];
var BSNO = rec.data.BSNO;
if (BSNOStr == '')
BSNOStr = BSNO;
else {
BSNOStr = BSNOStr + ',' + BSNO;
}
}
if (BSNOStr == '') {
Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.MeiYouYaoCaoZuoDeYeWu, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
} else {
Ext.Ajax.request({
waitMsg: Zi.LAN.ZhengZaiCaoZuoShuJu,
url: '/MvcShipping/MsOpSeae/CreateCustomList',
params: {
BSNOS: BSNOStr,
type: type
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: Zi.LAN.TiShi,
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
} else {
Ext.Msg.show({ title: Zi.LAN.TiShi, msg: result.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}
},
//#endregion
//#region Cargo Smart 中远(客户乾景)
onCreateCargoSmartEDIClick: function (menu, event) {
this.winCargoSmartEDIShow.show();
},
onSendCargoSmartEDI: function (filetype, filerole, isbill, carrier, saleid) {
var GidStr = '';
var selections = this.GridCheckBoxFenModel.selected.items;
if (selections.length == 0) {
Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.QingXianXuanZeYeWu, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var BSNOStr = '';
var j = 0;
var Mblno = '';
for (var i = 0; i < selections.length; i++) {
var rec = selections[i];
Mblno = rec.data.MBLNO;
var BSNO = rec.data.BSNO;
if (BSNOStr == '')
BSNOStr = BSNO;
else {
BSNOStr = BSNOStr + ',' + BSNO;
}
}
if (BSNOStr == '') {
Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.MeiYouYaoCaoZuoDeYeWu, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
} else {
Ext.Msg.wait(Zi.LAN.ZhengZaiCaoZuoShuJu);
Ext.Ajax.request({
waitMsg: Zi.LAN.ZhengZaiCaoZuoShuJu,
url: '/MvcShipping/MsOpSeae/CreateCargoSmartEDIList',
params: {
bsnos: BSNOStr,
mblno: Mblno,
filetype: filetype,
filerole: filerole,
isbill: isbill,
carrier: carrier,
saleid: saleid
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({ title: Zi.LAN.TiShi, msg: result.Message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK });
return;
} else {
Ext.Msg.show({ title: Zi.LAN.TiShi, msg: result.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}
},
onSaveCargoSmartEDI: function (filetype, filerole, isbill, carrier, saleid) {
var GidStr = '';
var selections = this.GridCheckBoxFenModel.selected.items;
if (selections.length == 0) {
Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.QingXianXuanZeYeWu, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var BSNOStr = '';
var j = 0;
var Mblno = '';
for (var i = 0; i < selections.length; i++) {
var rec = selections[i];
Mblno = rec.data.MBLNO;
var BSNO = rec.data.BSNO;
if (BSNOStr == '')
BSNOStr = BSNO;
else {
BSNOStr = BSNOStr + ',' + BSNO;
}
}
if (BSNOStr == '') {
Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.MeiYouYaoCaoZuoDeYeWu, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
} else {
Ext.Ajax.request({
waitMsg: Zi.LAN.Changing,
url: '/MvcShipping/MsOpSeae/SaveCargoSmartEDIList',
params: {
bsnos: BSNOStr,
mblno: Mblno,
filetype: filetype,
filerole: filerole,
isbill: isbill,
carrier: carrier,
saleid: saleid
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({ title: Zi.LAN.TiShi, 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
});
}
},
//#endregion
//#region 打印
Print: function () {
_thisfenlist = this;
if (this.storeList.getCount() == 0) {
return;
}
var sql = "BSNO<>'" + this.BsNo + "' and MASTERNO='" + this.BsNo + "'";
var bsno = '11111';
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length != 0) {
var record = selections[0];
bsno = record.data.BSNO;
}
var sortstr = 'ETD,MBLNO ';
if (this.sortfield != '' && this.sortdire != '') {
sortstr = this.sortfield + ' ' + this.sortdire;
}
Ext.Msg.wait(Zi.LAN.ZhengZaiCaoZuoShuJu);
Ext.Ajax.request({
waitMsg: Zi.LAN.ZhengZaiCaoZuoShuJu,
url: '/MvcShipping/MsOpSeae/GetFenListStr',
scope: this,
params: {
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 = sql;
if (condition != '') condition = ' where ' + condition;
var printType = 'MSOPSEAELIST';
var sql1 = returnstr;
var sql2 = "select * from op_seae where BSNO='" + bsno + "'";
var sql3 = "select CUSTOMERNAME,COUNT(BSNO) BLCOUNT,SUM(TEU) TEU from op_seae B " + condition + " group by CUSTOMERNAME";
var sql4 = "select CARRIER,COUNT(BSNO) BLCOUNT,SUM(TEU) TEU from op_seae B " + condition + " group by CARRIER";
var sql5 = "select OP,COUNT(BSNO) BLCOUNT,SUM(TEU) TEU from op_seae B " + condition + " group by OP";
var sql6 = "select COUNT(BSNO) BLCOUNT,SUM(TEU) TEU from op_seae B " + condition;
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
} else {
Ext.Msg.show({ title: Zi.LAN.ChuoWu, msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
} else {
Ext.Msg.show({ title: Zi.LAN.JingGao, msg: Zi.LAN.FuWuQiXiangYingChuCuo, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
}
});
},
PrintSelect: function () {
_thisfenlist = this;
if (this.storeList.getCount() == 0) {
return;
}
var selectedRecords = [];
var storeadd = null;
selectedRecords = this.GridCheckBoxFenModel.selected.items;
if (selectedRecords.length == 0) {
Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.QingXianXuanZeYeWu, 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 = 'MSOPSEAELISTSELECT';
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 BSNO IN (" + feeGidSql + ") order by " + sortstr;
var sql2 = "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 BSNO='" + bsno + "'";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6, mblno);
}
//#endregion
});