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/MsOpSubSeaOrder/MsOpSubSeaOrderImportAudit.js

731 lines
23 KiB
JavaScript

3 years ago
Ext.namespace('Shipping');
Shipping.MsOpSubSeaeOrderImportAudit = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsOpSubSeaeOrderImportAudit.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsOpSubSeaeOrderImportAudit, Ext.Panel, {
PageSize: 20,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
isShowAdvancedQuery: 0, //是否显示高级查询面板
IsAudit: true,
accdate: null,
seaeop: "",
seaecustservice: "",
BillType: 2,
OrType: 2,
initUIComponents: function () {
this.formname = "formMsOpSubSeaeOrderAudit"; //页面名称
//定义数据集
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: 'MsSubSeaOrderModel',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsOpSubSeaOrder/GetAuditDataList',
reader: {
id: 'BSNO',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//#region List列表显示信息
Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, {
width: 30
});
this.girdcolums = [{
sortable: true,
dataIndex: 'BSNO',
header: '业务编号',
width: 0
}, {
sortable: true,
dataIndex: 'ORDNO',
header: '订舱编号',
width: 120
},
{
sortable: true,
dataIndex: 'ORSTATUSREF',
header: '状态',
width: 60
},
{
sortable: true,
dataIndex: 'BSDATE',
header: '接单日期',
width: 80
},
{
sortable: true,
dataIndex: 'ETD',
header: '开船日期',
width: 80
},
{
sortable: true,
dataIndex: 'CARGOID',
header: '货物标识',
width: 60
},
{
sortable: true,
dataIndex: 'MBLNO',
header: '主提单号',
width: 120
},
{
sortable: true,
dataIndex: 'CNTRTOTAL',
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: 'COMPANY',
header: '订舱代理',
width: 100
},
{
sortable: true,
dataIndex: 'AGENT',
header: '卸货代理',
width: 100
},
{
sortable: true,
dataIndex: 'BLTYPE',
header: '装运方式',
width: 60
},
{
sortable: true,
dataIndex: 'BLFRT',
header: '付费方式',
width: 60
},
{
sortable: true,
dataIndex: 'PKGS',
header: '件数',
width: 80
},
{
sortable: true,
dataIndex: 'KGS',
header: '毛重',
width: 80
},
{
sortable: true,
dataIndex: 'KINDPKGS',
header: '件数包装',
width: 60
},
{
sortable: true,
dataIndex: 'INPUTBY',
header: '录入人',
width: 80
}];
this.CheckBoxModel = 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.CheckBoxModel,
disableSelection: false,
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.column = 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/MsOpSubSeaOrder/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.storeCodeDisport = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodeDisportModel',
proxy: { url: '/CommMng/BasicDataRef/GetCodeDisportList' }
});
this.storeCodeDisport.load();
this.comboxPORTLOAD = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '装货港',
store: this.storeCodeDisport,
forceSelection: true,
name: 'PORTLOAD',
valueField: 'PORT',
displayField: 'PORT'
});
//国内港口(出口装货港、进口卸货港)
this.storeCodeLoadport = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodeDisportModel',
proxy: { url: '/CommMng/BasicDataRef/GetCodeDisportList' }
});
this.storeCodeLoadport.load();
this.comboxPORTDISCHARGE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '卸货港',
store: this.storeCodeLoadport,
forceSelection: true,
name: 'PORTDISCHARGE',
valueField: 'PORT',
displayField: 'PORT'
});
this.StoreStatus = Ext.create('Ext.data.Store', {
fields: ['ID', 'STATUS']
});
this.StoreStatus.add({ "ID": "9", "STATUS": "录入" });
this.StoreStatus.add({ "ID": "1", "STATUS": "提交" });
this.StoreStatus.add({ "ID": "0", "STATUS": "引入" });
this.comboxStatus = Ext.create('DsExt.ux.RefTableCombox', {
store: this.StoreStatus,
fieldLabel: '状态',
forceSelection: true,
name: 'ORSTATUS',
valueField: 'ID',
displayField: 'STATUS'
});
this.storeCompany = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsOtCompany',
proxy: { url: '/MvcShipping/MsBaseInfo/GetCompanyEN' }
});
this.storeCompany.load();
this.comboxCompany = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '订舱代理',
store: this.storeCompany,
forceSelection: true,
name: 'COMPANYID',
valueField: 'GID',
displayField: 'NAME'
});
this.storeAgent = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsOtCompany',
proxy: { url: '/MvcShipping/MsBaseInfo/GetCompanyEN' }
});
this.storeAgent.load();
this.comboxAgent = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '卸货代理',
store: this.storeAgent,
forceSelection: true,
name: 'AGENTID',
valueField: 'GID',
displayField: 'NAME'
});
//#endregion
//#region formSearch 查询面板
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: [this.comboxStatus, {
fieldLabel: '主提单号',
name: 'MblNo'
}, {
fieldLabel: '开船日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ETDbgn'
}, {
fieldLabel: '到',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ETDend'
}, this.comboxCompany]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxPORTLOAD, this.comboxPORTDISCHARGE, {
fieldLabel: '船名',
name: 'VESSEL'
}, {
fieldLabel: '航次',
name: 'VOYNO'
}, this.comboxAgent]
}]//end items(fieldset 1)
}]//end root items
});
//#endregion formSearch
//按钮工具条
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [{
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
}, '-', {
id: 'btnAudit',
text: '引入',
tooltip: '引入',
handler: function (button, event) {
this.onAddSeaClick();
},
scope: this
}, '-', {
text: "保存列表样式",
id: "btntest",
handler: function (button, event) {
this.column = DsTruck.SaveGridPanel(USERID, this.formname, this.gridList.columns, this.column, 1, true);
},
scope: this
}]
});
//#region 引入数据
this.storeUser = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' }
});
this.storeUser.load({ params: { condition: ""} });
this.comboxSeaeOp = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '操作',
store: this.storeUser,
name: 'OP',
valueField: 'UserCode',
displayField: 'CodeAndName'
});
this.comboxSeaeCustService = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '客服',
store: this.storeUser,
name: 'CUSTSERVICE',
valueField: 'UserCode',
displayField: 'CodeAndName'
});
this.formAudit = 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: '会计期间',
xtype: 'monthfield',
name: 'ACCDATE'
}, this.comboxSeaeOp
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxSeaeCustService
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
me = this;
this.winAuditShow = 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.formAudit],
buttons: [{
text: "确认接受",
minWidth: 70,
handler: function () {
var form = me.formAudit.getForm();
var ACCDATE = form.findField('ACCDATE').getRawValue();
if (ACCDATE == '' || ACCDATE == null || ACCDATE == undefined) {
Ext.Msg.show({ title: '提示', msg: '会计期间为必填!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
me.accdate = ACCDATE;
var User = me.comboxSeaeOp.getValue();
if (User == '' || User == null || User == undefined) {
Ext.Msg.show({ title: '提示', msg: '操作员为必填!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
me.seaeop = User;
me.seaecustservice = me.comboxSeaeCustService.getValue();
me.onAuditPassClick();
}
}, {
text: "关闭",
minWidth: 70,
handler: function () {
me.winAuditShow.close();
}
}]
});
//#endregion
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 100,
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);
}, //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 },
waitMsg: "正在查询数据...",
scope: this
});
},
onAddSeaClick: function () {
var form = this.formAudit.getForm();
var VoucherDate = form.findField('ACCDATE');
var thisday = this.getToMonth();
VoucherDate.setRawValue(thisday)
this.winAuditShow.show();
},
onAuditPassClick: function (button, event, type) {
var GidStr = '';
var records = this.CheckBoxModel.selected.items;
if (records.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择要引入的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var bodyAddDatas = [];
var j = 0;
for (var i = 0; i < records.length; i++) {
var rec = records[i];
var ORSTATUS = rec.data.ORSTATUS;
if (ORSTATUS == 9) {
Ext.Msg.show({ title: '提示', msg: '业务未提交不允许引入!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
} else {
bodyAddDatas.push(rec);
j = j + 1;
}
}
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
_this = this;
if (j == 0) {
Ext.Msg.show({ title: '提示', msg: '没有要引入的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
} else {
Ext.Ajax.request({
waitMsg: '正在添加数据...',
url: '/MvcShipping/MsOpSubSeaOrder/AddSeai',
params: {
data: jsonbodyAddDatas,
accdate: _this.accdate,
op: _this.seaeop,
custservice: _this.seaecustservice
},
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 {
_this.onRefreshClick();
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}
},
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 = '';
//#region formSearch 查询面板
//编号包括(主提单号)
var MblNo = form.findField('MblNo').getValue();
sql = sql + getAndConSql(sql, MblNo, "(MBLNO like '%" + MblNo + "%' )");
//状态
var ORSTATUS = form.findField('ORSTATUS').getValue();
sql = sql + getAndConSql(sql, ORSTATUS, "ORSTATUS='" + ORSTATUS + "'");
//到港日期
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 COMPANYID = form.findField('COMPANYID').getValue();
sql = sql + getAndConSql(sql, COMPANYID, "COMPANYID='" + COMPANYID + "'");
//装货港
var PORTLOAD = form.findField('PORTLOAD').getValue();
sql = sql + getAndConSql(sql, PORTLOAD, "PORTLOAD like '%" + PORTLOAD + "%'");
//卸货港
var PORTDISCHARGE = form.findField('PORTDISCHARGE').getValue();
sql = sql + getAndConSql(sql, PORTDISCHARGE, "PORTDISCHARGE like '%" + PORTDISCHARGE + "%'");
//船名
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 + "%'");
//公司
var AGENTID = form.findField('AGENTID').getValue();
sql = sql + getAndConSql(sql, AGENTID, "AGENTID='" + AGENTID + "'");
return sql;
},
getToMonth: function () {
var now = new Date();
var year = now.getFullYear(); //年
var month = now.getMonth() + 1; //月
var clock = year + "-";
if (month < 10)
clock = clock + "0" + month;
else
clock = clock + month;
return (clock);
},
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;
}
});