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/MsOpSeai/MsOpSeae2SeaiIndex.js

601 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: '已引入',
width: 60,
renderer: function (value, cellmeta) {
if (value == '1' || value == 'True') {
return "是";
} else return "";
}
},
{
sortable: true,
id: '',
dataIndex: 'INPUTBYREF',
header: '提交人',
width: 80
},
{
sortable: true,
id: '',
dataIndex: 'INPUTTIME',
header: '提交时间',
width: 120
}, {
sortable: true,
id: '',
dataIndex: 'SEAICUSTNO',
header: '现委托编号',
width: 120
}, {
sortable: true,
id: '',
dataIndex: 'BSNO',
header: '业务编号',
width: 0
}, {
sortable: true,
id: '',
dataIndex: 'CUSTNO',
header: '委托编号',
width: 120
},
{
sortable: true,
id: '',
dataIndex: 'ETD',
header: '开船日期',
width: 80
},
{
sortable: true,
id: '',
dataIndex: 'MBLNO',
header: '主提单号',
width: 120,
filter: {
type: 'string'
// specify disabled to disable the filter menu
//, disabled: true
}
},
{
sortable: true,
id: '',
dataIndex: 'CUSTOMERNAME',
header: '委托单位',
width: 120
},
{
sortable: true,
id: '',
dataIndex: 'ETA',
header: '预抵日期',
width: 80
},
{
sortable: true,
id: '',
dataIndex: 'GOODSNAME',
header: '品名',
width: 120
},
{
sortable: true,
id: '',
dataIndex: 'PKGS',
header: '件数',
width: 80
},
{
sortable: true,
id: '',
dataIndex: 'KGS',
header: '毛重',
width: 80
},
{
sortable: true,
id: '',
dataIndex: 'CBM',
header: '尺码',
width: 80
},
{
sortable: true,
id: '',
dataIndex: 'CNTRTOTAL',
header: '集装箱',
width: 80
},
{
sortable: true,
id: '',
dataIndex: 'HBLNO',
header: '分提单号',
width: 120
},
{
sortable: true,
id: '',
dataIndex: 'VESSEL',
header: '船名',
width: 100
},
{
sortable: true,
id: '',
dataIndex: 'VOYNO',
header: '航次',
width: 60
},
{
sortable: true,
id: '',
dataIndex: 'PORTLOAD',
header: '装货港',
width: 100
},
{
sortable: true,
id: '',
dataIndex: 'PORTDISCHARGE',
header: '卸货港',
width: 100
},
{
sortable: true,
id: '',
dataIndex: 'DESTINATION',
header: '目的地',
width: 100
},
{
sortable: true,
id: '',
dataIndex: 'KINDPKGS',
header: '件数包装',
width: 60
},
{
sortable: true,
id: '',
dataIndex: 'PORTDISCHARGEID',
header: '卸港代码',
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: '签单方式',
width: 100
}, {
dataIndex: 'BLFRT',
header: '付费方式',
width: 120
}];
this.girdcolums = this.initgirdcolums;
this.gridListCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
this.CheckStatus = new Ext.form.Checkbox({
fieldLabel: '复制业务状态', //'货代提单',
labelAlign: 'right',
width:220,
checked: false
});
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
selModel: this.gridListCheckBoxModel,
viewConfig: {
autoFill: true,
enableTextSelection: true
},
tbar: [this.CheckStatus,{
text: '确定引入',
tooltip: '确定引入',
iconCls: "btnadd",
id:'btnadd',
handler: function (button, event) {
this.onAddListClick(button, event);
},
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
}],
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);
//#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: '委托单位',
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: '编号',
name: 'MblNo',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, this.comboxCustCode, {
fieldLabel: '从开船日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'CustDate_Min',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '至开船日期',
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: "执行查询",
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+"'";
this.sqlcontext = sql;
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
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: "正在查询数据...",
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: '提示', msg: '请先选择业务!', 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('提示', '提单号:' + rec.data.MBLNO + '已引入系统,确认要覆盖以前业务吗?', 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('正在保存数据...');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
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.load({
params: { start: 0, limit: _this.PageSize, sort: '', condition: _this.sqlcontext },
waitMsg: "正在查询数据...",
scope: this
});
btnadd.enable();
parentWin.onDsQuery();
Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
else {
btnadd.enable();
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
},
getCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var sql = " SEAIOP='" + USERID + "'";
//客户名称
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;
}
});