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.

597 lines
18 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.OpSeaeToSeaiIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.OpSeaeToSeaiIndex.superclass.constructor.call(this);
};
Ext.extend(Shipping.OpSeaeToSeaiIndex, Ext.Panel, {
PageSize: 30,
ParentWin: null,
feeType: 0,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
StoreFee: null,
StoreFeeUnit: null,
StoreFeeCust: null,
EditRecord: null,
sqlcontext: '',
initUIComponents: function () {
//定义数据集
this.storeList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'MsOpSeae2SeaiModel',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsOpSeai/GetImpDataList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//#region 主grid
this.initgirdcolums = [{
sortable: true,
id: '',
dataIndex: '',
header: '',
width: 0
}, {
sortable: true,
id: '',
dataIndex: 'GID',
header: 'GID',
width: 0
}, {
sortable: true,
id: '',
dataIndex: 'ISIMP',
header: Zi.LAN.ISIMP,
width: 60,
renderer: function (value, cellmeta) {
if (value == '1' || value == 'True') {
return "是";
} else return "";
}
},
{
sortable: true,
id: '',
dataIndex: 'INPUTBYREF',
header: Zi.LAN.INPUTBYREF ,
width: 80
},
{
sortable: true,
id: '',
dataIndex: 'INPUTTIME',
header: Zi.LAN.INPUTTIME,
width: 120
}, {
sortable: true,
id: '',
dataIndex: 'SEAICUSTNO',
header: Zi.LAN.SEAICUSTNO,
width: 120
}, {
sortable: true,
id: '',
dataIndex: 'BSNO',
header: '业务编号',
width: 0
}, {
sortable: true,
id: '',
dataIndex: 'CUSTNO',
header: Zi.LAN.CUSTNO,
width: 120
},
{
sortable: true,
id: '',
dataIndex: 'ETD',
header: Zi.LAN.ETA ,
width: 80
},
{
sortable: true,
id: '',
dataIndex: 'MBLNO',
header: Zi.LAN.MBLNO,
width: 120,
filter: {
type: 'string'
// specify disabled to disable the filter menu
//, disabled: true
}
},
{
sortable: true,
id: '',
dataIndex: 'CUSTOMERNAME',
header: Zi.LAN.CUSTOMERNAME,
width: 120
},
{
sortable: true,
id: '',
dataIndex: 'ETA',
header: Zi.LAN.ETD ,
width: 80
},
{
sortable: true,
id: '',
dataIndex: 'GOODSNAME',
header: Zi.LAN.GOODSNAME,
width: 120
},
{
sortable: true,
id: '',
dataIndex: 'PKGS',
header: Zi.LAN.PKGS,
width: 80
},
{
sortable: true,
id: '',
dataIndex: 'KGS',
header: Zi.LAN.KGS,
width: 80
},
{
sortable: true,
id: '',
dataIndex: 'CBM',
header: Zi.LAN.CBM ,
width: 80
},
{
sortable: true,
id: '',
dataIndex: 'CNTRTOTAL',
header: Zi.LAN.CNTRTOTAL2,
width: 80
},
{
sortable: true,
id: '',
dataIndex: 'HBLNO',
header: Zi.LAN.HBLNO,
width: 120
},
{
sortable: true,
id: '',
dataIndex: 'VESSEL',
header: Zi.LAN.VESSEL,
width: 100
},
{
sortable: true,
id: '',
dataIndex: 'VOYNO',
header: Zi.LAN.VOYNO,
width: 60
},
{
sortable: true,
id: '',
dataIndex: 'PORTLOAD',
header: Zi.LAN.PORTLOAD,
width: 100
},
{
sortable: true,
id: '',
dataIndex: 'PORTDISCHARGE',
header: Zi.LAN.PORTDISCHARGE ,
width: 100
},
{
sortable: true,
id: '',
dataIndex: 'DESTINATION',
header: Zi.LAN.DESTINATION ,
width: 100
},
{
sortable: true,
id: '',
dataIndex: 'KINDPKGS',
header: Zi.LAN.KINDPKGS ,
width: 60
},
{
sortable: true,
id: '',
dataIndex: 'PORTDISCHARGEID',
header: Zi.LAN.PORTDISCHARGEID,
width: 100
},
{
sortable: true,
id: '',
dataIndex: 'SHIPPER',
header: 'SHIPPER',
width: 100
},
{
sortable: true,
id: '',
dataIndex: 'CONSIGNEE',
header: 'CONSIGNEE',
width: 100
},
{
sortable: true,
id: '',
dataIndex: 'NOTIFYPARTY',
header: 'NOTIFYPARTY',
width: 100
},
{
sortable: true,
id: '',
dataIndex: 'ISSUETYPE',
header: Zi.LAN.ISSUETYPE,
width: 100
}, {
dataIndex: 'BLFRT',
header: Zi.LAN.BLFRT,
width: 120
}];
this.girdcolums = this.initgirdcolums;
this.gridListCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
this.CheckStatus = new Ext.form.Checkbox({
fieldLabel: Zi.LAN.COPYSTATUS, //'货代提单',
labelAlign: 'right',
width:220,
checked: false
});
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: Zi.LAN.ShuJuJiaZaiZhongQingShaoDeng},
trackMouseOver: true,
disableSelection: false,
selModel: this.gridListCheckBoxModel,
viewConfig: {
autoFill: true,
enableTextSelection: true
},
tbar: [this.CheckStatus,{
text: Zi.LAN.ENTERISIMP,
tooltip: Zi.LAN.ENTERISIMP,
iconCls: "btnadd",
id:'btnadd',
handler: function (button, event) {
this.onAddListClick(button, event);
},
scope: this
}, '-', {
text: Zi.LAN.btntest ,
id: "btntest",
menu: [
{
text: Zi.LAN.SaveGridPanel ,
handler: function (button, event) {
this.girdcolums = DsTruck.SaveGridPanel(USERID, _this.formname, _this.gridList.columns, _this.girdcolums, 1, true);
}
}, {
text: Zi.LAN.SaveGridPanel2 ,
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
}],
columns: this.girdcolums,
// paging bar on the bottom
bbar: Ext.create('Ext.PagingToolbar', {
store: this.storeList,
displayInfo: true,
displayMsg: Zi.LAN.displayMsg,
emptyMsg: Zi.LAN.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);
//#endregion
//#region 固定费用明细表
//#region formSearch
//#region formSearch枚举参照相关
//客户加载_委托单位
this.storeCustCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeCustCode.load({ params: { condition: "ISCONTROLLER='1'"} });
//委托单位
_this = this;
this.comboxCustCode = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: Zi.LAN.CUSTOMERNAME,
store: this.storeCustCode,
forceSelection: true,
name: 'CUSTOMERNAME',
valueField: 'CustName',
displayField: 'CodeAndName',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
//#endregion
_this = this;
this.formSearch = 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: [{
fieldLabel: Zi.LAN.MblNo2,
name: 'MblNo',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, this.comboxCustCode, {
fieldLabel: Zi.LAN.FRETA,
format: 'Y-m-d',
xtype: 'datefield',
name: 'CustDate_Min',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: Zi.LAN.TOETA,
format: 'Y-m-d',
xtype: 'datefield',
name: 'CustDate_Max',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
xtype: 'button',
width: 90,
text: Zi.LAN.btnrefresh,
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
},
scope: this
}
]
}]
}]
});
//#endregion formSearch
//#region 按钮ToolBar
//#endregion
//#region 布局
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 55,
items: [this.formSearch]
});
Ext.apply(this, {
items: [this.panelTop, this.gridList]
});
//#endregion
parentWin = window.parent.opener.panelIndex;
//#region 事件绑定
this.storeList.on('beforeload', function (store) {
var sql = this.getCondition();
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
this.storeList.on('load', function (store, records) {
if (store.getCount() > 0) {
this.gridList.getSelectionModel().select(0);
//this.gridListCheckBoxModel.selectAll();
}
}, this);
//#endregion
//#region 自动刷新(已经提交但是尚未审核的业务,哪怕一票货中有一笔费用没审核也显示)
this.onAutoRefresh();
//#endregion
// this.SetBtnRight();
}, //end initUIComponents
onAutoRefresh: function () {
var sql = " ISIMP=0 and (SEAIOP='" + USERID + "' OR SEAIOP='" + SHOWNAME +"')";
this.sqlcontext = sql;
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: Zi.LAN.ZhengZaiChaXunShuJu,
scope: this
});
},
onRefreshClick: function (button, event) {
var sql = this.getCondition();
this.sqlcontext = sql;
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: Zi.LAN.ZhengZaiChaXunShuJu,
scope: this
});
},
onAddListClick: function (button, event) {
var btnadd = Ext.getCmp('btnadd');
btnadd.disable();
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;
}
_this = this;
var bodyAddDatas = [];
for (var i = 0; i < selections.length; i++) {
var rec = selections[i];
var isinsert = true;
if ((rec.data.ISIMP == '1')||(rec.data.ISIMP == 'True')) {
Ext.MessageBox.confirm(Zi.LAN.TiShi, Zi.LAN.MBLNO + '' + rec.data.MBLNO + Zi.LAN.YYRXT, function (btn) {
if (btn == 'yes') isinsert = true; else isinsert = false;
}, this
)
}
if (isinsert) bodyAddDatas.push(rec);
}
var iscopystatus ="0";
if (this.CheckStatus.checked) iscopystatus = "1";
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
Ext.Msg.wait(Zi.LAN.ZhengZaiCaoZuoShuJu);
Ext.Ajax.request({
waitMsg: Zi.LAN.ZhengZaiCaoZuoShuJu,
url: '/MvcShipping/MsOpSeae/SeaeSaveSeai',
params: {
data: jsonbodyAddDatas,
copystatus: iscopystatus
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
_this.storeList.reload();
btnadd.enable();
parentWin.onDsQuery();
Ext.Msg.show({ title: Zi.LAN.TiShi, msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
else {
btnadd.enable();
Ext.Msg.show({ title: Zi.LAN.ChuoWu, msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
}
},
failure: function (response, options) {
Ext.Msg.show({ title: Zi.LAN.ChuoWu, msg: Zi.LAN.FuWuQiXiangYingChuCuo, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
},
success: function (response, options) { },
scope: this
}); //end Ext.Ajax.request
},
getCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert(Zi.LAN.TiShi, 'erro');
return '';
}
var sql = " (SEAIOP='" + USERID + "' OR SEAIOP='" + SHOWNAME + "') ";
//客户名称
var CUSTOMERNAME = form.findField('CUSTOMERNAME').getValue();
sql = sql + getAndConSql(sql, CUSTOMERNAME, "S.CUSTOMERNAME='" + CUSTOMERNAME + "'");
var mblNo = form.findField('MblNo').getValue();
sql = sql + getAndConSql(sql, mblNo, " (S.MBLNO like '%" + mblNo + "%' or S.HBLNO like '%" + mblNo + "%') ");
var custDate_Min = form.findField('CustDate_Min').getRawValue();
sql = sql + getAndConSql(sql, custDate_Min, "S.ETD >= '" + custDate_Min + "'");
var custDate_Max = form.findField('CustDate_Max').getRawValue();
sql = sql + getAndConSql(sql, custDate_Max, "S.ETD<= '" + custDate_Max + " 23:59:59'");
return sql;
}
});