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.

364 lines
11 KiB
JavaScript

Ext.namespace('Shipping');
Shipping.PiLiangSubmit = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.PiLiangSubmit.superclass.constructor.call(this);
};
Ext.extend(Shipping.PiLiangSubmit, Ext.Panel, {
PageSize: 15,
ParentWin: null,
OprationStatus: null, //仅当弹出界面时使用
EditRecord: null,
strbsno: '',
optype: '',
initUIComponents: function () {
//定义数据集
//人员信息加载
this.storeOpCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' }
});
this.storeOpCode.load();
//客服
this.comboxCUSTSERVICE = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeOpCode,
forceSelection: true,
name: 'COMPOP',
valueField: 'UserName',
displayField: 'CodeAndName'
});
this.storeBodyAddList = Ext.create('Ext.data.Store', {
model: 'MsOpBill',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsOpBill/GetBLListData',
reader: {
id: 'BSNO',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//明细表表格
this.gcolumn= [{
sortable: true,
dataIndex: 'BSNO',
header: 'BSNO',
hidden: true,
width: 100
}, {
sortable: true,
dataIndex: 'CUSTNO',
header: '委托编号',
width: 108
}, {
sortable: true,
dataIndex: 'MBLNO',
header: '主提单号',
width: 108
}, {
sortable: true,
dataIndex: 'CUSTOMERNAME',
header: '委托单位',
width: 100
}, {
sortable: true,
dataIndex: 'ETD',
header: '开船日期',
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
width: 100
}, {
sortable: true,
dataIndex: 'SALE',
header: '揽货人',
width: 80
}, {
sortable: true,
dataIndex: 'ACCDATE',
header: '会计期间',
width: 80
}, {
sortable: true,
dataIndex: 'OP',
header: '操作',
width: 80
}, {
sortable: true,
dataIndex: 'INPUTBY',
header: '录入人',
width: 80
}, {
sortable: true,
dataIndex: 'PORTLOAD',
header: '起运港',
width: 120
}, {
sortable: true,
dataIndex: 'PORTDISCHARGE',
header: '目的港',
width: 120
}, {
sortable: true,
dataIndex: 'VESSEL',
header: '船名',
width: 150
}, {
sortable: true,
dataIndex: 'VOYNO',
header: '航次',
width: 60
}
];
this.gridAddList = new Ext.grid.GridPanel({
store: this.storeBodyAddList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
columns: this.gcolumn
});
//#endregion
//#region 按钮ToolBar
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [
{
text: "全部提交",
iconCls: "btnsubmit",
handler: function (button, event) {
this.onPostDetailClick(button, event, 0);
},
scope: this
}, {
text: "应收费用提交",
iconCls: "btnsubmit",
handler: function (button, event) {
this.onPostDetailClick(button, event, 1);
},
scope: this
}, {
text: "应付费用提交",
iconCls: "btnsubmit",
handler: function (button, event) {
this.onPostDetailClick(button, event, 2);
},
scope: this
}
]
});
//#endregion
//#region 布局
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 30,
items: [this.panelBtn]
});
this.panelFee = new Ext.Panel({
layout: "border",
region: "center",
items: [
this.gridAddList
]
});
Ext.apply(this, {
items: [this.panelTop, this.panelFee]
});
//#endregion
parentWin = window.parent.opener._this;
this.InitData();
// this.SetBtnRight();
}, //end initUIComponents
InitData: function () {
var condition = '';
_this = this;
if (parentWin) {
var ret = parentWin.OprationSwap();
_this.strbsno = ret[3];
_this.optype = ret[4];
var AddList = ret[5];
for (var j = 0; j < AddList.getCount(); j += 1) {
var memberbody = AddList.getAt(j);
this.storeBodyAddList.add(memberbody);
};
// _this.storeBodyAddList.load({
// params: { start: 0, limit: 1000, sort: '', condition: _this.strbsno },
// waitMsg: "正在查询数据...",
// callback: function (r, options, success) {
// if (success) {
// }
// },
// scope: this
// });
Ext.Ajax.request({
waitMsg: '正在查询数据...',
url: '/Account/Chfee_Audit/GetErrorFeeMbl',
scope: this,
params: {
bsnos: this.strbsno,
optype: this.optype,
feetype: 0
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
} else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
} else {
Ext.Msg.show({ title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
}
});
}
},
onPostDetailClick: function (button, event, type) {
var bodyDrChFeeDatas = [];
var i;
var bodyBillDatas = [];
var bsno1 = '';
var bsno2 = '';
var bsno3 = '';
var bsno4 = '';
var bsno5 = '';
for (i = 0; i < this.storeBodyAddList.getCount(); i += 1) {
var memberyf = this.storeBodyAddList.getAt(i);
if (i < 20) {
var BSNO = "'" + memberyf.data.BSNO + "'";
if (bsno1 == '')
bsno1 = BSNO;
else {
bsno1 = bsno1 + ',' + BSNO;
}
} else if (i < 40) {
var BSNO = "'" + memberyf.data.BSNO + "'";
if (bsno2 == '')
bsno2 = BSNO;
else {
bsno2 = bsno2 + ',' + BSNO;
}
} else if (i < 60) {
var BSNO = "'" + memberyf.data.BSNO + "'";
if (bsno3 == '')
bsno3 = BSNO;
else {
bsno3 = bsno3 + ',' + BSNO;
}
} else if (i < 80) {
var BSNO = "'" + memberyf.data.BSNO + "'";
if (bsno4 == '')
bsno4 = BSNO;
else {
bsno4 = bsno4 + ',' + BSNO;
}
} else {
var BSNO = "'" + memberyf.data.BSNO + "'";
if (bsno5 == '')
bsno5 = BSNO;
else {
bsno5 = bsno5 + ',' + BSNO;
}
}
};
// for (i = 0; i < this.storeBodyAddList.getCount(); i += 1) {
// var memberyf = this.storeBodyAddList.getAt(i);
// bodyBillDatas.push(memberyf);
// };
// var jsonChFeeBody = ConvertFeeRecordsToJson(bodyDrChFeeDatas);
var jsonbodyBill = ConvertRecordsToJsonAll(bodyBillDatas);
_this = this;
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/Account/Chfee_Audit/PiliangSubmitAuditlist',
scope: this,
params: {
bsnos1: bsno1,
bsnos2: bsno2,
bsnos3: bsno3,
bsnos4: bsno4,
bsnos5: bsno5,
// bsnos: this.strbsno,
optype: this.optype,
feetype: type
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
Ext.Msg.show({ title: '提示', msg: '提交成功!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
} else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
} else {
Ext.Msg.show({ title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
}
});
}
});