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/MsOpCtnr/MsOpCtnrSellIndex.js

720 lines
25 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.MsOpCtnrSellIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsOpCtnrSellIndex.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsOpCtnrSellIndex, Ext.Panel, {
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
EditRecord: null, //用于从主界面获取
BSNo: '',
PageSize: 50,
initUIComponents: function () {
this.formname = 'MsOpCtnrList';
//定义数据集
this.storeList = Ext.create('Ext.data.Store', {
model: 'MsOpCtnrList',
pageSize: this.PageSize,
// autoLoad: { start: 0, limit: 30 },
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsOpCtnr/GetDataList',
reader: {
id: 'BSNO',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//定义Grid
this.CntrCB = Ext.create('Ext.selection.CheckboxModel');
this.columns = [{
sortable: true,
dataIndex: 'BSNO',
header: 'BSNO',
hidden: true,
width: 80
}, {
sortable: true,
dataIndex: 'BILLNO',
header: '单据编号',
width: 120
},
{
sortable: true,
id: '',
dataIndex: 'BSSTATUSREF',
header: '业务锁定',
align: 'center',
width: 60,
renderer: function (value, cellmeta) {
if (value == '锁定') {
return "<img src='../../../../TruckMng/Content/Images/Lock.png' />";
}
}
},
{
sortable: true,
id: '',
dataIndex: 'FEESTATUSREF',
header: '费用锁定',
align: 'center',
width: 60,
renderer: function (value, cellmeta) {
if (value == '锁定') {
return "<img src='../../../../TruckMng/Content/Images/Lock.png' />";
}
}
},
{
sortable: true,
id: '',
dataIndex: 'DRFEESTATUS',
header: '应收费用',
align: 'center',
width: 60,
renderer: function (value, meta) {
if (value == '审核通过') {
meta.tdCls = 'feestatus_pass';
} else if (value == '录入状态') {
} else if (value == '提交审核') {
meta.tdCls = 'feestatus_refer';
} else if (value == '部分结算') {
meta.tdCls = 'feestatus_refer';
} else if (value == '结算完毕') {
meta.tdCls = 'feestatus_settle';
} else if (value == '未录入') {
} else if (value == '部分结算') {
meta.tdCls = 'feestatus_settle';
} else if (value == '部分审核') {
meta.tdCls = 'feestatus_pass';
} else if (value == '部分提交') {
meta.tdCls = 'feestatus_refer';
}
return value;
}
},
{
sortable: true,
id: '',
dataIndex: 'CRFEESTATUS',
header: '应付费用',
align: 'center',
width: 60,
renderer: function (value, meta) {
if (value == '审核通过') {
meta.tdCls = 'feestatus_pass';
} else if (value == '录入状态') {
} else if (value == '提交审核') {
meta.tdCls = 'feestatus_refer';
} else if (value == '部分结算') {
meta.tdCls = 'feestatus_refer';
} else if (value == '结算完毕') {
meta.tdCls = 'feestatus_settle';
} else if (value == '未录入') {
} else if (value == '部分结算') {
meta.tdCls = 'feestatus_settle';
} else if (value == '部分审核') {
meta.tdCls = 'feestatus_pass';
} else if (value == '部分提交') {
meta.tdCls = 'feestatus_refer';
}
return value;
}
}, {
sortable: true,
dataIndex: 'BLTYPE',
header: '业务类型',
width: 80
},{
sortable: true,
dataIndex: 'CUSTOMERNAME',
header: '客户名称',
width: 120
}, {
sortable: false,
dataIndex: 'CNTRSOURCE',
header: '箱源',
width: 120
}, {
sortable: true,
dataIndex: 'CUSTNO',
header: '委托编号',
hidden:true,
width: 80
}, {
sortable: true,
dataIndex: 'FEESTATUS',
header: '业务锁定',
hidden:true,
width: 80
}, {
sortable: true,
dataIndex: 'BSDATE',
header: '业务日期',
width: 120
}, {
sortable: true,
dataIndex: 'ACCDATE',
header: '会计期间',
width: 120
}, {
sortable: true,
dataIndex: 'PORT',
header: '地点',
width: 120
}, {
sortable: true,
dataIndex: 'YARD',
header: '场站',
width: 120
}, {
sortable: true,
dataIndex: 'OP',
header: '操作',
width: 80
}, {
sortable: true,
dataIndex: 'CNTRTOTAL',
header: '箱型箱量',
width: 120
}, {
sortable: true,
dataIndex: 'ISCREATEFEEREF',
header: '生成费用',
width: 80
}, {
sortable: true,
dataIndex: 'CREATEUSER',
header: '创建人',
width: 80
}, {
sortable: true,
dataIndex: 'CREATETIME',
header: '创建时间',
width: 100
},{
sortable: true,
dataIndex: 'MODIFIEDUSER',
header: '修改人',
width: 80
}, {
sortable: true,
dataIndex: 'MODIFIEDTIME',
header: '修改时间',
width: 100
}, {
sortable: true,
dataIndex: 'REMARK',
header: '备注',
width: 100
}];
this.girdcolums = this.columns;
this.Pagenum = Ext.create('Ext.form.field.Number', {
name: 'bottles',
fieldLabel: '每页记录数',//每页记录数
labelAlign: 'right',
value: this.PageSize,
maxValue: 100000,
width: 180,
minValue: 0,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.girdcolums = DsTruck.GetGridPanel(USERID, this.formname, this.girdcolums, 1, true);
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'center',
columnLines: true,
selModel: this.CntrCB,
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
features: [{
ftype: 'summary'//Ext.grid.feature.Summary表格汇总特性
}],
columns: this.girdcolums,
bbar:[ Ext.create('Ext.PagingToolbar', {
store: this.storeList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
}), this.Pagenum]
});
this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
this.SelectedRecord = record;
this.OprationStatus = 'edit';
DsOpenEditWin("/MvcShipping/MsOpCtnr/SellEdit", "", "650", "1250");
}, this);
//#region formSearch
//租买类型
Ext.define('BLTypemb', {
extend: 'Ext.data.Model',
fields: [
{ name: 'BLType', type: 'string' }
]
});
var BLTypeData = [
{ "BLType": "卖箱" }, { "BLType": "退租" }, { "BLType": "租出" }, { "BLType": "返箱" }];
this.storeBLType = Ext.create('Ext.data.Store', {
model: 'BLTypemb',
data: BLTypeData
});
this.comboxBuyType = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '业务类型',
forceSelection: true,
store: this.storeBLType,
name: 'BLTYPE',
allowBlank: true,
valueField: 'BLType',
displayField: 'BLType',
value:''
});
this.storeCodeLoadport = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodeLoadportModel',
proxy: { url: '/CommMng/BasicDataRef/GetCodeLoadportList' }
});
this.storeCodeLoadport.load();
this.comboxPORT = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '当前港口',
store: this.storeCodeLoadport,
//forceSelection: true,
id: 'PORT',
name: 'PORT',
valueField: 'PORT',
displayField: 'CodeAndName',
matchFieldWidth: false //下拉款自适应宽度
});
this.formSearch = Ext.widget('form', {
frame: true,
region: 'center',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 70,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
flex: 1,
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '单据编号',
name: 'BILLNO',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '提单号',
name: 'MBLNO',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '箱号',
name: 'CNTRNO',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, this.comboxBuyType, this.comboxPORT,{
fieldLabel: '业务日期(从)',
name: 'BSDATE',
format: 'Y-m-d',
labelWidth: 90,
xtype: 'datefield',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '业务日期(到)',
labelWidth: 90,
name: 'BSDATETO',
format: 'Y-m-d',
xtype: 'datefield',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
//#endregion formSearch
//查询工具条
_this = this;
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [{
text: '新建',
iconCls: "btnadd",
handler: function (menu, event) {
_this.OprationStatus = 'add';
DsOpenEditWin("/MvcShipping/MsOpCtnr/SellEdit", "", "650", "1250");
},
scope: this
}, '-',
{
text: "删除",
iconCls: "btndelete",
handler: function (button, event) {
this.onDeleteClick(button, event);
},
scope: this
},
'-',
{
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
}, '-', {
text: "高级查询",
iconCls: "btnmore",
handler: function (button, event) {
var sql = this.getCondition();
var winAccess = new Shipping.DsQuery({
});
winAccess.StoreList = this.storeList;
winAccess.formname = this.formname;
winAccess.condition = sql;
winAccess.show();
},
scope: this
},
'-', {
text: "保存列表样式",
menu: [{ text: "保存",
handler: function (button, event) {
_this.girdcolums = DsTruck.SaveGridPanel(GID, _this.formname, _this.gridList.columns, _this.girdcolums, 0, true); //使用者id表名中间column数组跳过一开始的几列
}
}, { text: "初始化",
handler: function (menu, event) {
_this.gridList.reconfigure(_this.storeList, _this.columns);
_this.girdcolums = DsTruck.SaveGridPanel(GID, _this.formname, _this.gridList.columns, _this.columns, 0, true); //使用者id表名中间column数组跳过一开始的几列
}
}],
scope: this
}, {
text: "打印", //"打印",
iconCls: 'btnprint',
menu: [
{ text: "全部", //"全部",
handler: function (menu, event) {
_this.onPrintClick();
}
}, { text: "选择打印", //"选择打印",
handler: function (menu, event) {
_this.PrintSelect();
}
}],
scope: this
}
]
});
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 80,
items: [this.formSearch, this.panelBtn]
});
Ext.apply(this, {
items: [this.panelTop, this.gridList]
});
this.InitData();
}, //end initUIComponents
//#region 加载事件
InitData: function () {
this.sqlcontext = " (BLTYPE='卖箱' OR BLTYPE='租出' OR BLTYPE='退租' OR BLTYPE='返箱') ";
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: this.sqlcontext },
waitMsg:"正在查询数据...",
scope: this
});
this.storeList.on('beforeload', function (store) {
Ext.apply(store.proxy.extraParams, { condition: this.sqlcontext });
}, this);
//#endregion
}, //end InitData
//#endregion
onRefreshClick: function (button, event) {
var sql = this.getCondition();
this.PageSize = this.Pagenum.getValue();
this.storeList.pageSize = this.PageSize;
this.sqlcontext = sql;
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
},
onDsQuery: function (button, event) {
var sql = this.sqlcontext;
this.PageSize = this.Pagenum.getValue();
this.storeList.pageSize = this.PageSize;
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
},
onDeleteClick: function (button, event) {
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择记录!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var selectedRecords = [];
selectedRecords = this.gridList.selModel.getSelection();
var selectStores = [];
for (var i = 0; i < selectedRecords.length; i++) {
selectStores.push(selectedRecords[i].data);
}
Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在删除数据...');
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/MvcShipping/MsOpCtnr/DeleteSell',
params: {
data: Ext.JSON.encode(selectStores),
USERID: USERID
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.storeList.remove(selections);
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
}
}, this);
}, //onDeleteClick
getCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var sql = " (BLTYPE='卖箱' OR BLTYPE='租出' OR BLTYPE='退租' OR BLTYPE='返箱') ";
var BILLNO = form.findField('BILLNO').getValue();
if (BILLNO != '' && BILLNO != null) {
sql = " BILLNO like '%" + BILLNO + "%'";
}
var PORT = form.findField('PORT').getValue();
if (PORT != '' && PORT != null) {
sql = sql + " AND PORT like '%" + PORT + "%'";
}
var CNTRNO = form.findField('CNTRNO').getValue();
if (CNTRNO != '' && CNTRNO != null) {
sql = sql + " AND BSNO IN (SELECT P.BSNO FROM OP_CTNMNG_DETAIL P LEFT JOIN OP_CTNMNG_CTNDETAIL C ON (C.CTNGID=P.CTNGID) WHERE CNTRNO like '%" + CNTRNO + "%')";
}
var MBLNO = form.findField('MBLNO').getValue();
if (MBLNO != '' && MBLNO != null) {
sql = sql + " AND MBLNO like '%" + MBLNO + "%'";
}
var BLTYPE = form.findField('BLTYPE').getValue();
sql = sql + getAndConSql(sql, BLTYPE, "BLTYPE= '" + BLTYPE + "'");
var BSDATE = form.findField('BSDATE').getRawValue();
sql = sql + getAndConSql(sql, BSDATE, " BSDATE >= '" + BSDATE + "'");
var BSDATETO = form.findField('BSDATETO').getRawValue();
if (BSDATETO != '' && BSDATETO != null) {
sql = sql + getAndConSql(sql, BSDATETO, " BSDATE <= '" + BSDATETO + "'");
}
return sql;
},
onClearSql: function () {
var form = this.formSearch.getForm();
form.reset();
//this.InitData();
},
OprationSwap: function () {
var ret = new Array();
ret[0] = this.OprationStatus;
ret[1] = this.storeList;
ret[2] = this.SelectedRecord;
ret[3] = this.EditRecord;
ret[4] = this.OPLBNAME;
return ret;
},
onPrintClick: function (button, event) {
var printType = 'MsOpCtnrSellList';
var uid = USERID;
var sql1 = "select * from op_ctnmng ";
var wherestr = this.getCondition();
if (wherestr != '') {
sql1 += "where 1=1 and " + wherestr;
}
PrintComm(printType, sql1);
},
PrintSelect: function () {
_this = this;
if (this.storeList.getCount() == 0) {
return;
}
var selectedRecords = [];
var storeadd = null;
selectedRecords = this.CntrCB.selected.items;
if (selectedRecords.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择要打印的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var feeGidSql = '';
for (var i = 0; i < selectedRecords.length; i++) {
var record = selectedRecords[i];
var feeGId = "'" + record.get('BSNO') + "'";
if (feeGidSql == '') {
feeGidSql = feeGId;
} else {
feeGidSql = feeGidSql + "," + feeGId;
}
};
var bsno = '11111';
var mblno = '';
var printType = 'MsOpCtnrSellListSelect';
var sql1 = "select * from op_ctnmng WHERE BSNO IN (" + feeGidSql + ") order by BSDATE DESC";
var sql2 = "";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6,"");
}
});