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/RptOpReceipt/RptOpReceiptIndex.js

1026 lines
36 KiB
JavaScript

2 years ago
Ext.namespace('Shipping');
Shipping.RptOpReceiptIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.RptOpReceiptIndex.superclass.constructor.call(this);
};
Ext.extend(Shipping.RptOpReceiptIndex, Ext.Panel, {
PageSize: 15, //每页的条数
SelectedRecord: null,
//页面加载
initUIComponents: function () {
this.formname = "formRptOpReceiptIndex"; //页面名称
this.ReceiptDrSerialNo = 0;
this.ReceiptDrBodyDel = [];
this.StoreDrOpRange = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsReceiptOP',
proxy: { url: '/MvcShipping/MsOpReceipt/GetReceiptOpRang' }
});
//定义数据集
this.storeList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'RptOpReceiptEntity',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/RptOpReceipt/GetDataList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//#region List列表显示信息
Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, {
width: 30
});
this.girdcolums = [{
sortable: true,
dataIndex: 'GID',
header: '惟一编号',
hidden: true,
width: 0
}, {
sortable: true,
dataIndex: 'BSNO',
header: '业务编号',
hidden: true,
width: 0
}, {
sortable: true,
dataIndex: 'RECEIPTTYPE',
header: '单据类型',
width: 80
}, {
sortable: true,
dataIndex: 'RECEIPTNO',
header: '单据编号',
width: 100
}, {
sortable: true,
dataIndex: 'RECEIVE_MAN',
header: '接单人',
width: 80
}, {
sortable: true,
dataIndex: 'RECEIVE_DATE',
header: '接单日期',
width: 80
}, {
sortable: true,
dataIndex: 'SEND_MAN',
header: '送单人',
width: 80
}, {
sortable: true,
dataIndex: 'SEND_DATE',
header: '送单日期',
width: 80
}, {
sortable: true,
dataIndex: 'TRANCER',
header: '送单快递公司',
width: 100
}, {
sortable: true,
dataIndex: 'TRANCNO',
header: '送单快递单号',
width: 100
}, {
sortable: true,
dataIndex: 'ISREPEAT',
header: '是否回单',
width: 60
}, {
sortable: true,
dataIndex: 'REPEAT_MAN',
header: '回单人',
width: 80
}, {
sortable: true,
dataIndex: 'REPEAT_DATE',
header: '回单日期',
width: 80
}, {
sortable: true,
dataIndex: 'ISRECEIVE',
header: '是否还单',
width: 60
}, {
sortable: true,
dataIndex: 'RETURN_MAN',
header: '还单人',
width: 80
}, {
sortable: true,
dataIndex: 'RETURN_DATE',
header: '还单日期',
width: 80
}, {
sortable: true,
dataIndex: 'RETURN_TRANCER',
header: '还单的快递公司',
width: 100
}, {
sortable: true,
dataIndex: 'RETURN_TRANCNO',
header: '还单的快递单号',
width: 100
}, {
sortable: true,
dataIndex: 'REMARK',
header: '备注',
width: 300
}, {
sortable: true,
dataIndex: 'OPLBNAME',
header: '业务类型',
width: 80
}, {
sortable: true,
dataIndex: 'BSSTATUS',
header: '业务锁定',
width: 60
}, {
sortable: true,
dataIndex: 'ACCDATE',
header: '会计期间',
width: 80
}, {
sortable: true,
dataIndex: 'CUSTOMERNAME',
header: '客户名称',
width: 120
}, {
sortable: true,
dataIndex: 'CUSTNO',
header: '委托编号',
width: 120
}, {
sortable: true,
dataIndex: 'MBLNO',
header: '主提单号',
width: 120
}, {
sortable: true,
dataIndex: 'HBLNO',
header: '分提单号',
width: 120
}, {
sortable: true,
dataIndex: 'OP',
header: '操作人',
width: 80
}, {
sortable: true,
dataIndex: 'SALE',
header: '揽货人',
width: 80
}, {
sortable: true,
dataIndex: 'ETD',
header: '业务日期',
width: 100
}, {
sortable: true,
dataIndex: 'VESSEL',
header: '船名',
width: 100
}, {
sortable: true,
dataIndex: 'VOYNO',
header: '航次',
width: 100
}, {
sortable: true,
dataIndex: 'PORTLOAD',
header: '装货港',
width: 100
}, {
sortable: true,
dataIndex: 'PORTDISCHARGE',
header: '卸货港',
width: 100
}, {
sortable: true,
dataIndex: 'CORPID_NAME',
header: '分公司',
hidden: true,
width: 100
}, {
sortable: true,
dataIndex: 'CREATEUSER_NAME',
header: '单据创建人',
width: 100
}, {
sortable: true,
dataIndex: 'CREATETIME',
header: '单据创建时间',
width: 120
}, {
sortable: true,
dataIndex: 'MODIFIEDUSER_NAME',
header: '单据最后更改人',
width: 100
}, {
sortable: true,
dataIndex: 'MODIFIEDTIME',
header: '单据最后更改时间',
width: 120
}];
this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
//定义Grid
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
selModel: this.GridCheckBoxModel,
viewConfig: {
enableTextSelection: true, //允许复制数据
autoFill: true
},
stripeRows: true,
stateful: false,
bbar: Ext.create('Ext.PagingToolbar', {
store: this.storeList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
}),
columns: this.girdcolums
});
/////////////以下部分为获取存储的gridpanel显示样式
this.girdcolums = DsTruck.GetGridPanel(USERID, this.formname, this.girdcolums);
//使用者id表名 中间column数组跳过一开始的几列
//this.girdcolums.unshift(new Ext.grid.RowNumberer());
this.gridList.reconfigure(this.storeList, this.girdcolums);
////////////////////////////
//#region formSearch
//人员信息加载
this.storeOpCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' }
});
this.storeOpCode.load();
//揽货人
this.comboxSALE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '揽货人',
store: this.storeOpCode,
forceSelection: true,
name: 'SALE',
valueField: 'UserName',
displayField: 'CodeAndName',
//value: SHOWNAME
});
//操 作
this.comboxOP = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '操 作',
store: this.storeOpCode,
forceSelection: true,
name: 'OP',
valueField: 'UserName',
displayField: 'CodeAndName',
//value: SHOWNAME
});
//委托单位
this.storeCustCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeCustCode.load({ params: { condition: "ISCONTROLLER='1'"} });
this.comboxCustCode = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '委托单位',
store: this.storeCustCode,
forceSelection: true,
name: 'CUSTOMERNAME',
valueField: 'CustName',
displayField: 'CodeAndName'
});
//键值维护表_贸易方式
this.storeCrmKeyCodeCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CrmKeyCodeModel',
proxy: { url: '/CommMng/BasicDataRef/GetCrmKeyCodeList' }
});
this.storeCrmKeyCodeCode.load({ params: { condition: " and KEYTYPE='单据类型'"} });
this.comboxRECEIPTTYPE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '单据类型',
store: this.storeCrmKeyCodeCode,
forceSelection: true,
name: 'RECEIPTTYPE',
valueField: 'KEYVALUE',
displayField: 'KEYVALUE'
});
//是否下拉框
Ext.define('IS_TYPE', {
extend: 'Ext.data.Model',
fields: [
//{ name: 'Value', type: 'string' },
{ name: 'Name', type: 'string' }
]
});
var dataISTYPE = [{ "Name": "全部" }, { "Name": "是" }, { "Name": "否"}];
var storeISTYPE = Ext.create('Ext.data.Store', {
model: 'IS_TYPE',
data: dataISTYPE
});
//是否回单
this.comboxISREPEAT = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '是否回单',
forceSelection: true,
store: storeISTYPE,
name: 'ISREPEAT',
valueField: 'Name',
displayField: 'Name'
});
//是否还单
this.comboxISRECEIVE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '是否还单',
forceSelection: true,
store: storeISTYPE,
name: 'ISRECEIVE',
valueField: 'Name',
displayField: 'Name'
});
//
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: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '主提单号',
name: 'MBLNO',
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'keyup': {
fn: function (_field, e) {
if (e.getKey() == 13) {
this.onRefreshClick();
}
},
scope: this
}
}
}, {
fieldLabel: '委托单号',
name: 'CUSTNO',
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'keyup': {
fn: function (_field, e) {
if (e.getKey() == 13) {
this.onRefreshClick();
}
},
scope: this
}
}
}, this.comboxCustCode, {
fieldLabel: '单据编号',
name: 'RECEIPTNO',
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'keyup': {
fn: function (_field, e) {
if (e.getKey() == 13) {
this.onRefreshClick();
}
},
scope: this
}
}
}, this.comboxRECEIPTTYPE]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '接单日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'RECEIVE_DATE'
}, {
fieldLabel: '至',
format: 'Y-m-d',
xtype: 'datefield',
name: 'RECEIVE_DATE2'
}, this.comboxISREPEAT, {
fieldLabel: '回单日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'REPEAT_DATE'
}, {
fieldLabel: '至',
format: 'Y-m-d',
xtype: 'datefield',
name: 'REPEAT_DATE2'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '送单日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'SEND_DATE'
}, {
fieldLabel: '至',
format: 'Y-m-d',
xtype: 'datefield',
name: 'SEND_DATE2'
}, {
fieldLabel: '送单快递公司',
name: 'TRANCER',
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'keyup': {
fn: function (_field, e) {
if (e.getKey() == 13) {
this.onRefreshClick();
}
},
scope: this
}
}
}, {
fieldLabel: '送单快递单号',
name: 'TRANCNO',
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'keyup': {
fn: function (_field, e) {
if (e.getKey() == 13) {
this.onRefreshClick();
}
},
scope: this
}
}
}, {
fieldLabel: '备注',
name: 'REMARK',
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'keyup': {
fn: function (_field, e) {
if (e.getKey() == 13) {
this.onRefreshClick();
}
},
scope: this
}
}
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxISRECEIVE, {
fieldLabel: '还单日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'RETURN_DATE'
}, {
fieldLabel: '至',
format: 'Y-m-d',
xtype: 'datefield',
name: 'RETURN_DATE2'
}, {
fieldLabel: '还单快递公司',
name: 'RETURN_TRANCER',
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'keyup': {
fn: function (_field, e) {
if (e.getKey() == 13) {
this.onRefreshClick();
}
},
scope: this
}
}
}, {
fieldLabel: '还单快递单号',
name: 'RETURN_TRANCNO',
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'keyup': {
fn: function (_field, e) {
if (e.getKey() == 13) {
this.onRefreshClick();
}
},
scope: this
}
}
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '会计期间',
format: 'Y-m',
xtype: 'datefield',
name: 'ACCDATE'
}, {
fieldLabel: '业务日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ETD'
}, {
fieldLabel: '至',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ETD2'
}, this.comboxOP, this.comboxSALE]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '装货港',
name: 'PORTLOAD',
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'keyup': {
fn: function (_field, e) {
if (e.getKey() == 13) {
this.onRefreshClick();
}
},
scope: this
}
}
}, {
fieldLabel: '卸货港',
name: 'PORTDISCHARGE',
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'keyup': {
fn: function (_field, e) {
if (e.getKey() == 13) {
this.onRefreshClick();
}
},
scope: this
}
}
}, {
fieldLabel: '船名',
name: 'VESSEL',
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'keyup': {
fn: function (_field, e) {
if (e.getKey() == 13) {
this.onRefreshClick();
}
},
scope: this
}
}
}, {
fieldLabel: '航次',
name: 'VOYNO',
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'keyup': {
fn: function (_field, e) {
if (e.getKey() == 13) {
this.onRefreshClick();
}
},
scope: this
}
}
}, { xtype: 'hiddenfield'}]
}]//end items(fieldset 1)
});
//#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
}, '-', {
text: "删除",
iconCls: "btndelete",
handler: function (button, event) {
this.onDeleteClick(button, event);
},
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
}, '-', {
text: "确认送单",
//iconCls: "btnreset",
handler: function (button, event) {
this.onSetRECEIPT("SEND");
},
scope: this
}, {
text: "确认回单",
//iconCls: "btnreset",
handler: function (button, event) {
this.onSetRECEIPT("REPEAT");
},
scope: this
}, {
text: "确认还单",
//iconCls: "btnreset",
handler: function (button, event) {
this.onSetRECEIPT("RETURN");
},
scope: this
}
]
});
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 200,
items: [this.formSearch, this.panelBtn]
});
Ext.apply(this, {
items: [this.panelTop, this.gridList]
});
this.storeList.on('beforeload', function (store) {
var sql = this.getCondition();
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
this.onRefreshClick();
}, //end initUIComponents
//查询
onRefreshClick: function (button, event) {
var sql = this.getCondition();
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
},
//删除
onDeleteClick: function (button, event) {
var selectedRecords = this.gridList.getSelectionModel().getSelection();
if (selectedRecords.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择单据!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
//
var ReceiptGIDSql = '';
var selectedRecords = this.gridList.selected.items;
var candelete = this.CheckOpReceiptDelete(selectedRecords);
if (candelete == false) {
return;
}
//
var strGIDs = "";
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (strGIDs == "") {
strGIDs = rec.get('GID');
}
else {
strGIDs = strGIDs + "," + rec.get('GID');
}
}
//
Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在删除数据...');
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/MvcShipping/RptOpReceipt/Delete_Main',
params: {
gids: strGIDs
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
this.storeList.remove(rec);
}
//
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 });
}
}
},
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 = "";
//主提单号
var MBLNO = form.findField('MBLNO').getValue();
sql = sql + getAndConSql(sql, MBLNO, "MBLNO like '%" + MBLNO + "%'");
//委托单号
var CUSTNO = form.findField('CUSTNO').getValue();
sql = sql + getAndConSql(sql, CUSTNO, "CUSTNO like '%" + CUSTNO + "%'");
//客户名称
var CUSTOMERNAME = form.findField('CUSTOMERNAME').getValue();
sql = sql + getAndConSql(sql, CUSTOMERNAME, "CUSTOMERNAME like '%" + CUSTOMERNAME + "%'");
//单据编号
var RECEIPTNO = form.findField('RECEIPTNO').getValue();
sql = sql + getAndConSql(sql, RECEIPTNO, "RECEIPTNO like '%" + RECEIPTNO + "%'");
//单据类型
var RECEIPTTYPE = form.findField('RECEIPTTYPE').getValue();
sql = sql + getAndConSql(sql, RECEIPTTYPE, "RECEIPTTYPE like '%" + RECEIPTTYPE + "%'");
//接单日期
var RECEIVE_DATE = form.findField('RECEIVE_DATE').getRawValue();
sql = sql + getAndConSql(sql, RECEIVE_DATE, "RECEIVE_DATE<='" + RECEIVE_DATE + "'");
//至
var RECEIVE_DATE2 = form.findField('RECEIVE_DATE2').getRawValue();
sql = sql + getAndConSql(sql, RECEIVE_DATE2, "RECEIVE_DATE>='" + RECEIVE_DATE2 + "'");
//是否回单
var ISREPEAT = form.findField('ISREPEAT').getValue();
if (ISREPEAT != null) {
if (ISREPEAT.toString() == "是") {
sql = sql + getAndConSql(sql, ISREPEAT, "ISREPEAT=1");
}
else if (ISREPEAT.toString() == "否") {
sql = sql + getAndConSql(sql, ISREPEAT, "ISREPEAT=0");
}
}
//回单日期
var REPEAT_DATE = form.findField('REPEAT_DATE').getRawValue();
sql = sql + getAndConSql(sql, REPEAT_DATE, "REPEAT_DATE<='" + REPEAT_DATE + "'");
//至
var REPEAT_DATE2 = form.findField('REPEAT_DATE2').getRawValue();
sql = sql + getAndConSql(sql, REPEAT_DATE2, "RECEIVE_DATE>='" + REPEAT_DATE2 + "'");
//送单日期
var SEND_DATE = form.findField('SEND_DATE').getRawValue();
sql = sql + getAndConSql(sql, SEND_DATE, "SEND_DATE<='" + SEND_DATE + "'");
//至
var SEND_DATE2 = form.findField('SEND_DATE2').getRawValue();
sql = sql + getAndConSql(sql, SEND_DATE2, "RECEIVE_DATE>='" + SEND_DATE2 + "'");
//送单快递公司
var TRANCER = form.findField('TRANCER').getValue();
sql = sql + getAndConSql(sql, TRANCER, "TRANCER like '%" + TRANCER + "%'");
//送单快递单号
var TRANCNO = form.findField('TRANCNO').getValue();
sql = sql + getAndConSql(sql, TRANCNO, "TRANCNO like '%" + TRANCNO + "%'");
//备注
var REMARK = form.findField('REMARK').getValue();
sql = sql + getAndConSql(sql, REMARK, "REMARK like '%" + REMARK + "%'");
//是否还单
var ISRECEIVE = form.findField('ISRECEIVE').getValue();
if (ISRECEIVE != null) {
if (ISRECEIVE.toString() == "是") {
sql = sql + getAndConSql(sql, ISRECEIVE, "ISRECEIVE=1");
}
else if (ISRECEIVE.toString() == "否") {
sql = sql + getAndConSql(sql, ISRECEIVE, "ISRECEIVE=0");
}
}
//还单日期
var RETURN_DATE = form.findField('RETURN_DATE').getRawValue();
sql = sql + getAndConSql(sql, RETURN_DATE, "RETURN_DATE<='" + RETURN_DATE + "'");
//至
var RETURN_DATE2 = form.findField('RETURN_DATE2').getRawValue();
sql = sql + getAndConSql(sql, RETURN_DATE2, "RETURN_DATE>='" + RETURN_DATE2 + "'");
//还单快递公司
var RETURN_TRANCER = form.findField('RETURN_TRANCER').getValue();
sql = sql + getAndConSql(sql, RETURN_TRANCER, "RETURN_TRANCER like '%" + RETURN_TRANCER + "%'");
//还单快递单号
var RETURN_TRANCNO = form.findField('RETURN_TRANCNO').getValue();
sql = sql + getAndConSql(sql, RETURN_TRANCNO, "RETURN_TRANCNO like '%" + RETURN_TRANCNO + "%'");
//会计期间
var ACCDATE = form.findField('ACCDATE').getRawValue();
sql = sql + getAndConSql(sql, ACCDATE, "ACCDATE = '" + ACCDATE + "'");
//业务日期
var ETD = form.findField('ETD').getRawValue();
sql = sql + getAndConSql(sql, ETD, "ETD<='" + ETD + "'");
//至
var ETD2 = form.findField('ETD2').getRawValue();
sql = sql + getAndConSql(sql, ETD2, "ETD>='" + ETD2 + "'");
//操作人
var OP = form.findField('OP').getValue();
sql = sql + getAndConSql(sql, OP, "OP like '%" + OP + "%'");
//揽货人
var SALE = form.findField('SALE').getValue();
sql = sql + getAndConSql(sql, SALE, "SALE like '%" + SALE + "%'");
//装货港
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 + "%'");
return sql;
},
//#region 单据确认
onSetRECEIPT: function (onSetType) {
var selectedRecords = this.gridList.getSelectionModel().getSelection();
if (selectedRecords.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择单据!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
//
var ReceiptGIDSql = '';
var selectedRecords = this.gridList.getSelectionModel().getSelection();
var candelete = this.CheckOpReceiptDelete(selectedRecords);
if (candelete == false) {
return;
}
//
Ext.MessageBox.confirm('提示', '确定要操作选中的数据吗?', function (btn) {
if (btn == 'yes') {
if (selectedRecords.length > 0) {
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (rec.data.BSNO == "*") {//如果是新增但没有保存的数据,没有必要提交到后台
this.gridList.remove(selectedRecords[i]);
} else {
var ReceiptGID = "'" + rec.data.GID + "'";
if (ReceiptGIDSql == '') {
ReceiptGIDSql = ReceiptGID;
} else {
ReceiptGIDSql = ReceiptGIDSql + "," + ReceiptGID;
}
}
}
}
_this = this;
Ext.Msg.wait('正在操作数据...');
if (ReceiptGIDSql != '') {
Ext.Ajax.request({
waitMsg: '正在操作数据...',
url: '/MvcShipping/MsOpReceipt/onSetRECEIPT',
params: {
BSNO: _this.strBSNO,
gids: ReceiptGIDSql,
onSetType: onSetType
},
callback: function (options, success, response) {
if (success) {
//Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
for (var i = 0; i < selectedRecords.length; i++) {
}
//this.gridList.reload();
this.onRefreshClick();
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 });
},
scope: this
}); //end Ext.Ajax.request
} else {
Ext.Msg.show({ title: '提示', msg: "操作成功!", icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
}
}, this);
},
//#endregion
onClearSql: function () {
var form = this.formSearch.getForm();
form.reset();
}, //onDeleteClick
//#region 操作权限判断
CheckOpReceiptDelete: function (records) {
for (var i = 0; i < records.length; i++) {
var rec = records[i];
var MODIFIEDUSER = rec.data.MODIFIEDUSER;
var recop = DsStoreQueryBy(this.StoreDrOpRange, 'OPID', MODIFIEDUSER);
if (recop.getCount() > 0) {
} else {
Ext.Msg.show({ title: '提示', msg: '你没有权限操作此信息!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
canDelete = false;
}
}
return true;
}
//#endregion
//
});