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

747 lines
24 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.OpSeaeToSeaiCtnIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.OpSeaeToSeaiCtnIndex.superclass.constructor.call(this);
};
Ext.extend(Shipping.OpSeaeToSeaiCtnIndex, Ext.Panel, {
PageSize: 30,
ParentWin: null,
feeType: 0,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
StoreFee: null,
StoreFeeUnit: null,
StoreFeeCust: null,
MainEditRecord: {},
EditRecord: null,
sqlcontext: '',
initUIComponents: function () {
this.BsNo = "";
this.OPTYPE = getUrlParam('OPTYPE');
//定义数据集
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.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'north',
height:280,
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
selModel: this.gridListCheckBoxModel,
viewConfig: {
autoFill: true,
enableTextSelection: true
},
tbar: ['-', {
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);
this.gridList.getSelectionModel().on('select', function (model, record, index) {
//alert(record.data.BillNo);
var BSNO = record.data.BSNO;
var condition = '';
condition = "BSNO='" + BSNO + "' AND EXISTS (SELECT 1 FROM OP_SEAETOSEAI_CTN C WHERE C.CTN_ID=OP_CTN.CTN_ID AND ISNULL(C.ISIMP,0)=0) "
this.storeListCtn.load({ params: { condition: condition } });
}, this);
//#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]
});
this.storeListCtn = Ext.create('Ext.data.Store', {
model: 'MsOpSeaiDetail',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsOpSeae/GetBodyList',
reader: {
id: 'BsNo,CTNCODE,CTN_ID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.girdCtncolums = [{
sortable: true,
dataIndex: 'CTN_ID',
header: '编号',
hidden: true,
width: 0
}, {
sortable: true,
dataIndex: 'BSNO',
header: '业务编号',
hidden: true,
width: 0
}, {
sortable: true,
dataIndex: 'CTNCODE',
header: '序号',
width: 35
}, {
dataIndex: 'CTNALL',
header: '箱型',
width: 70
}, {
dataIndex: 'CTNNUM',
header: '箱量',
width: 50
}, {
dataIndex: 'CNTRNO',
header: '箱号',
width: 100
}, {
dataIndex: 'SEALNO',
header: '封号',
width: 80
}, {
sortable: true,
dataIndex: 'PKGS',
header: '件数',
width: 80,
align: 'right',
summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer()
}, {
dataIndex: 'KINDPKGS',
header: '件数包装',
width: 120
}, {
dataIndex: 'KGS',
header: '重量',
width: 100,
align: 'right',
summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.0000'),
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 4, '', true);
return value;
}
}, {
dataIndex: 'CBM',
header: '尺码',
width: 100,
align: 'right',
summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.0000'),
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 4, '', true);
return value;
}
}, {
dataIndex: 'TAREWEIGHT',
header: '箱皮重',
width: 100,
align: 'right',
summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.0000'),
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 4, '', true);
return value;
}
}, {
dataIndex: 'REMARK',
header: '备注',
width: 150
}];
this.ctnGridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
//定义Grid
this.gridListCtn = new Ext.grid.GridPanel({
store: this.storeListCtn,
enableHdMenu: false,
region: 'center',
frame: true,
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
columns: this.girdCtncolums,
selModel: this.ctnGridCheckBoxModel,
features: [{
ftype: 'summary'//Ext.grid.feature.Summary表格汇总特性
}],
tbar: [{
text: '确定引入',
tooltip: '确定引入',
iconCls: "btnadd",
handler: function (button, event) {
this.onAddCtnListClick(button, event);
},
scope: this
}
]
});
this.panelBodyChFee = new Ext.Panel({
title: '集装箱明细',
layout: "border",
region: 'center',
margin: '5 10',
items: [this.gridListCtn]
});
Ext.apply(this, {
items: [this.panelTop, this.gridList, this.panelBodyChFee]
});
//#endregion
parentWin = window.parent.opener.panelIndex;
//#region 事件绑定
this.storeList.on('beforeload', function (store) {
var sql = this.getCondition();
var optype = this.OPTYPE;
Ext.apply(store.proxy.extraParams, { condition: sql, optype: optype });
}, this);
this.storeList.on('load', function (store, records) {
if (store.getCount() > 0) {
this.gridList.getSelectionModel().select(0);
//this.gridListCheckBoxModel.selectAll();
}
}, this);
this.parentWin = window.parent.opener.panelEdit;
if (this.parentWin) {
//this.MainEditRecord = new Object();
this.MainEditRecord = this.parentWin.editRecord;
this.BsNo = this.MainEditRecord.get("BSNO");
//this.MainEditRecord=mainform.Editdata;
//this.BsNo = this.MainEditRecord.BSNO;
}
//#endregion
//#region 自动刷新(已经提交但是尚未审核的业务,哪怕一票货中有一笔费用没审核也显示)
this.onAutoRefresh();
//#endregion
// this.SetBtnRight();
}, //end initUIComponents
onAutoRefresh: function () {
var sql = " EXISTS (select 1 from OP_SEAETOSEAI_CTN WHERE T.BSNO=OP_SEAETOSEAI_CTN.BSNO AND OP_SEAETOSEAI_CTN.ISIMP=0) and (SEAIOP='" + USERID + "' OR SEAIOP='" + SHOWNAME + "')";
if (this.OPTYPE != undefined) {
sql = sql + " AND OPTYPE='" + this.OPTYPE + "'";
}
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
});
},
onAddCtnListClick: function (button, event) {
var selections = this.gridListCtn.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";
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
var reg = new RegExp("<", "g"); //创建正则RegExp对象
var stringObj = "";
stringObj = jsonbodyAddDatas.toString();
var jsonbodyAddDatas = stringObj.replace(reg, "❥");
Ext.Msg.wait('正在保存数据...');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/MvcShipping/MsOpSeae/SeaeSaveSeaiCtn',
params: {
data: jsonbodyAddDatas,
bsno: _this.BsNo,
optype: _this.OPTYPE
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
//_this.storeListCtn.reload();
_this.parentWin.storeBodyList.reload();
_this.parentWin.LoadData("edit", "BSNO='" + _this.BsNo +"'");
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
},
getCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var sql = " EXISTS (select 1 from OP_SEAETOSEAI_CTN WHERE T.BSNO=OP_SEAETOSEAI_CTN.BSNO AND OP_SEAETOSEAI_CTN.ISIMP=0) and SEAIOP='" + USERID + "'";
if (this.OPTYPE != undefined) {
sql = sql + " AND OPTYPE='" + this.OPTYPE + "'";
}
//客户名称
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;
}
});