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.

1259 lines
43 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.BillCheckOutIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.BillCheckOutIndex.superclass.constructor.call(this);
};
Ext.extend(Shipping.BillCheckOutIndex, Ext.Panel, {
PageSize: 50,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
sqlcontext: '',
selectbsno: '',
sortfield: '',
sortdire: '',
saoma:false,
initUIComponents: function () {
this.formname = "formBillCheckOut"; //页面名称
//定义数据集
//#region
this.storeCompany = Ext.create('DsExt.ux.RefTableStore', {
model: 'companymb', proxy: { url: '/CommMng/BasicDataRef/GetcompanyList' }
});
this.storeCompany.load({
params: { condition: "" },
//callback: function (options, success, response) {
// if (success) {
// this.storeCompany({});
// }
//}
});
this.comboxCompany = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '分公司',
//allowBlank: false,
forceSelection: true,
store: this.storeCompany,
name: 'COMPANYID',
valueField: 'gid',
displayField: 'name',
listeners: {
scope: this,
//blur: function (field, The, eOpts) {
// //field.setRawValue(field.value);
//}
//,
//beforequery: function (e) {
// //return FilterCombox(e, 2);//在beforequery使用此方法
//},
specialkey: function (field, e) {
//if (e.getKey() == e.ENTER) {
// e.keyCode = 9;
//}
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
//#endregion
this.storeList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'BillCheckOutModel',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/BillCheckOut/GetDataList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, {
width: 50
});
_this = this;
this.Pagenum = Ext.create('Ext.form.field.Number', {
name: 'bottles',
fieldLabel: '每页记录数',
labelAlign: 'right',
value: this.PageSize,
maxValue: 1000,
width: 180,
minValue: 0,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.initgirdcolums = [
{
sortable: true,
dataIndex: 'GID',
header: 'GID',
width: 0,hidden:true
},
{
sortable: true,
dataIndex: 'CHECKOUTNO',
header: '签单条编号',
width: 80
},
{
sortable: true,
dataIndex: 'CUSTOMERNAME',
header: '客户名称',
width: 80
},
{
sortable: true,
dataIndex: 'CORPID',
header: '分公司',
width: 80,
renderer: function (value, cellmeta, record, rowIndex) {
if (value) {
var companyname = _this.GetCompanyInfo(value);
if (companyname)
//cellmeta.style = "background-color:" + statusrecord.COLOR;
return companyname;
}
}
},
{
sortable: true,
dataIndex: 'SENDED',
header: '已发邮件',
width: 80,
renderer: function (value, cellmeta) {
if (value == 'true') {
return "<img src='../../../../TruckMng/Content/Images/check.gif' />";
} else {
return "";
}
}
},
{
sortable: true,
dataIndex: 'SENDER',
header: '发送人',
width: 80
},
{
sortable: true,
dataIndex: 'SENDTIME',
header: '发出日期',
width: 80
},
{
sortable: true,
dataIndex: 'SENDEREMAIL',
header: '发送人邮箱',
width: 120
},
{
sortable: true,
dataIndex: 'RECEIVEEMAIL',
header: '客户收件邮箱',
width: 120
},
{
sortable: true,
dataIndex: 'ISCHECKOUT',
header: '已签出',
width: 80,
renderer: function (value, cellmeta) {
if (value == 'true') {
return "<img src='../../../../TruckMng/Content/Images/check.gif' />";
} else {
return "";
}
}
},
{
sortable: true,
dataIndex: 'CHECKOUTUSER',
header: '签出人',
width: 80
},
{
sortable: true,
dataIndex: 'CHECKOUTTIME',
header: '签出日期',
width: 80
},
{
sortable: true,
dataIndex: 'INPUTBY',
header: '录入日期',
width: 80
},
{
sortable: true,
dataIndex: 'CREATETIME',
header: '录入日期',
width: 80
}];
this.girdcolums = this.initgirdcolums;
//定义Grid
this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
_this = this;
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'center',
id: 'gridlist',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
selModel: this.GridCheckBoxModel,
columns: this.girdcolums,
plugins: [],
viewConfig: {
enableTextSelection: true, //允许复制数据
autoFill: true
},
// paging bar on the bottom
bbar: [Ext.create('Ext.PagingToolbar', {
store: this.storeList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
}), this.Pagenum]
});
/////////////以下部分为获取存储的gridpanel显示样式
this.girdcolums = 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/BillCheckOut/Edit', record.data.GID);
}, this);
this.gridList.addListener('sortchange', function (ct, column, direction, eOpts) {
this.sortfield = column.dataIndex;
this.sortdire = direction;
}, this);
//#region formSearch 查询条件
_this = this;
this.StoreOpRange = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsOP',
proxy: { url: '/MvcShipping/MsBaseInfo/GetOpRang' }
});
this.StoreOpRange.load({ params: { optype: "modBillCheckOut"} });
//状态_业务状态
this.storeFEEUP = Ext.create('Ext.data.Store', {
fields: ['FSTATUS', 'NAME']
});
this.storeFEEUP.add({ "FSTATUS": "", "NAME": "" });
this.storeFEEUP.add({ "FSTATUS": "false", "NAME": "否" });
this.storeFEEUP.add({ "FSTATUS": "true", "NAME": "是" });
//已发邮件
this.comboxSENDED = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '已发邮件',
forceSelection: true,
store: this.storeFEEUP,
name: 'SENDED',
valueField: 'FSTATUS',
displayField: 'NAME'
});
//已签出
this.comboxIsCheckOut = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '已签出',
forceSelection: true,
store: this.storeFEEUP,
name: 'ISCHECKOUT',
valueField: 'FSTATUS',
displayField: 'NAME'
});
//人员信息加载
this.storeOpCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' }
});
this.storeOpCode.load();
//操 作
this.comboxInputby = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '录入人',
store: this.storeOpCode,
forceSelection: true,
name: 'INPUTBY',
valueField: 'UserName',
displayField: 'CodeAndName',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
//客户加载_委托单位
this.storeCustCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListController' }
});
// this.storeCustCode.load({ params: { condition: "ISCONTROLLER='1'"} });
//委托单位
this.comboxCustCode = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '委托单位', //'委托单位',
store: this.storeCustCode,
queryMode: 'remote',
matchFieldWidth: false,
minChars: 1,
queryParam: 'CODENAME',
name: 'CUSTOMERNAME',
valueField: 'CustName',
displayField: 'CodeAndName',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
//,
//'beforequery': function (e) {
// return FilterCombox(e,2);//在beforequery使用此方法
//}
, specialkey: function (field, e) {
//if (e.getKey() == e.ENTER) {
// e.keyCode = 9;
//}
if (e.keyCode == 9) {
if (field.value == null) {
_rec = _this.storeCustCode.getAt(0);
_this.formSearch.getForm().findField('CUSTOMERNAME').setValue(_rec.data.CustName);
}
}
}
}
});
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',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '签单条编号',
name: 'CHECKOUTNO',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
},
change: function () {
var basicForm = _this.formSearch.getForm();
var _CHECKOUTNO = basicForm.findField('CHECKOUTNO').getValue();
if (_CHECKOUTNO.length >= 10) {
_this.onRefreshClick();
_this.saoma = true;
}
}
}
}, {
fieldLabel: '提单号',
name: 'MBLNO',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, this.comboxCustCode,
this.comboxIsCheckOut,
this.comboxOP,
this.comboxCompany,
{
xtype: 'button',
width: 90,
text: "查询",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
},
scope: this
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '从发出日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'SENDDATEBgn',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '到发出日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'SENDDATEEnd',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '从业务日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ETDBgn',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '到业务日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ETDEnd',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
},
this.comboxSENDED,
{
text: "重置",
xtype: 'button',
width: 90,
iconCls: "btnreset",
handler: function (button, event) {
this.onClearSql(button, event);
},
scope: this
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxInputby
, { xtype: 'hiddenfield' }
, { xtype: 'hiddenfield' }
, { xtype: 'hiddenfield' }
, { xtype: 'hiddenfield' }
, {
xtype: 'button',
width: 90,
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();
return;
},
scope: this
}]
}]
}]
});
//#endregion formSearch
this.CheckSaveQuery = new Ext.form.Checkbox({
fieldLabel: "记忆查询条件",
checked: true,
width: 120
});
//查询工具条
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [{
text: "新建",
iconCls: "btnadd",
handler: function (button, event) {
this.OprationStatus = 'add';
DsOpenEditWin('/MvcShipping/BillCheckOut/Edit');
},
scope: this
}, {
text: "删除",
iconCls: "btndelete",
handler: function (button, event) {
this.onDeleteClick(button, event);
},
scope: this
}, '-', {
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.InitGrid(_this.initgirdcolums);
_this.girdcolums = DsTruck.SaveGridPanel(USERID, _this.formname, _this.gridList.columns, _this.initgirdcolums, 1, true);
}
}],
scope: this
}, '-',
{
text: "打印",
iconCls: 'btnprint',
menu: [
{ text: "全部",
handler: function (menu, event) {
_this.Print();
}
}, { text: "选择打印",
handler: function (menu, event) {
_this.PrintSelect();
}
}],
scope: this
}, '-' ,{
text:'导出EXCEL', //"EXCEL模板导出",
iconCls: "btnexportexcel",
handler: function (button, event) {
GridExportExcelPage(_this.gridList);
},
scope: this
}, '-',
this.CheckSaveQuery
]
});
//#region 合计列表
//this.SumField = [
// { name: 'NOBILL', type: 'number' },
// { name: 'TEU', type: 'number' }
// ];
//this.storeSumList = Ext.create('Ext.data.Store', {
// pageSize: this.PageSize,
// fields: this.SumField,
// remoteSort: true,
// proxy: {
// type: 'ajax',
// url: '/MvcShipping/MsOpApply/GetDataListSum',
// reader: {
// id: '',
// root: 'data',
// totalProperty: 'totalCount'
// }
// }
//});
//this.girdcolumsSum = [{
// sortable: true,
// dataIndex: 'NOBILL',
// header: '票数',
// align: 'right',
// width: 80
//}, {
// sortable: true,
// dataIndex: 'TEU',
// header: 'TEU',
// align: 'right',
// width: 80
// }
// ];
//this.gridListSum = new Ext.grid.GridPanel({
// store: this.storeSumList,
// enableHdMenu: false,
// region: 'center',
// loadMask: { msg: "数据加载中,请稍等..." },
// trackMouseOver: true,
// disableSelection: false,
// columns: this.girdcolumsSum
//});
//this.panelSum = new Ext.Panel({
// // title: '合 计',
// layout: "border",
// height: 70,
// region: 'south',
// margin: '0 0',
// frame: true,
// items: [this.gridListSum]
//});
//#endregion
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 126,
items: [this.formSearch, this.panelBtn]
});
Ext.apply(this, {
items: [this.panelTop, this.gridList
//, this.panelSum
]
});
this.InitGrid(this.girdcolums);
var myDate = new Date();
var mydatestr = Ext.util.Format.date(myDate, 'Y-m-d');
this.sqlcontext = " CREATETIME > dateadd(day,-4,getdate()) ";
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);
}, //end initUIComponents
InitGrid: function (grid) {
var agirdcolums = grid;
},
onRefreshClick: function (button, event) {
var sql = this.getCondition();
this.sqlcontext = sql;
this.PageSize = this.Pagenum.getValue();
var issavevalue = false;
if (this.CheckSaveQuery.checked)
issavevalue = true
saveQuerySetting(this.formname + 'Search', this.formSearch, false, issavevalue);
this.storeList.pageSize = this.PageSize;
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
callback: function (options, success, response) {
if (success) {
if (_this.saoma == true && _this.storeList.data.length == 1) {
_this.saoma = false;
var record = _this.storeList.getAt(0);
this.SelectedRecord = record;
this.OprationStatus = 'edit';
DsOpenEditWin('/MvcShipping/BillCheckOut/Edit', record.data.GID);
}
}
},
scope: this
});
},
onDsQuery: function () {
//var girdcolums = this.gridList.getColumnMode();
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 record = selections[0];
if (record.data.BSSTATUS == '1') {
Ext.Msg.show({ title: '警告', msg: '业务已锁定,不允许删除!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
}
if (record.data.FEESTATUS == '1') {
Ext.Msg.show({ title: '警告', msg: '费用已锁定,不允许删除!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
}
if (this.StoreOpRange.getCount() == 0) {
Ext.Msg.show({ title: '警告', msg: '权限不足,不允许删除!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
} else {
var CREATEUSER = record.data.INPUTBY;
var records = DsStoreQueryBy(this.StoreOpRange, 'OPID', CREATEUSER);
if (records.getCount() > 0) {
} else {
canedit = false;
Ext.Msg.show({ title: '警告', msg: '权限不足,不允许删除!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
}
}
//
Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) {
if (btn == 'yes') {
GID = record.data.GID;
Ext.Msg.wait('正在删除数据...');
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/MvcShipping/BillCheckOut/DelHead',
params: {
GID: GID
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.storeList.remove(record);
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);
},
onClearSql: function () {
var form = this.formSearch.getForm();
form.reset();
}, //onDeleteClick
onUpOpStatusClick: function (menu, event, type) {
var selections = this.GridCheckBoxModel.selected.items;
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择要更新的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var BSNOStr = '';
for (var i = 0; i < selections.length; i++) {
var rec = selections[i];
var BSNO = "'" + rec.data.BSNO + "'";
if (BSNOStr == '')
BSNOStr = BSNO;
else {
BSNOStr = BSNOStr + ',' + BSNO;
}
}
if (BSNOStr == '') {
Ext.Msg.show({ title: '提示', msg: '没有要更新的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
} else {
this.selectbsno = " BSNO IN (" + BSNOStr + ")";
window.open('/MvcShipping/MsOpStatus/PiLiang', "PILIANGOPSTATUS", 'width=1200,height=600,top=0,left=0,resizable=yes,status=yes,menubar=no,scrollbars=yes');
}
},
onPiLiangSubmitClick: function (menu, event, type) {
var selections = this.GridCheckBoxModel.selected.items;
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择要更新的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var BSNOStr = '';
for (var i = 0; i < selections.length; i++) {
var rec = selections[i];
var BSNO = "'" + rec.data.BSNO + "'";
if (BSNOStr == '')
BSNOStr = BSNO;
else {
BSNOStr = BSNOStr + ',' + BSNO;
}
}
this.storePLList.removeAll();
for (var i = 0; i < selections.length; i++) {
var rec = selections[i];
this.storePLList.add(rec.data);
}
if (BSNOStr == '') {
Ext.Msg.show({ title: '提示', msg: '没有要更新的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
} else {
this.selectbsno = " BSNO IN (" + BSNOStr + ")";
window.open('/Account/Chfee_Audit/PiLiangSubmit', "PILIANGSUBMIT", 'width=1200,height=600,top=0,left=0,resizable=yes,status=yes,menubar=no,scrollbars=yes');
}
},
//#region EXCEL导入
onImportBillClick: function (button, event) {
var BSNO = "";
me = this;
var imgform = new Ext.FormPanel({
region: 'center',
labelWidth: 20,
frame: true,
autoScroll: false,
border: false,
fileUpload: true,
items: [{
xtype: 'fileuploadfield',
id: 'LoadExcel',
name: 'LoadExcel',
emptyText: '请选择EXCEL文件', //'请选择EXCEL文件',
fieldLabel: 'EXCEL', //'EXCEL',
buttonText: '选择文件', //'选择文件',
allowBlank: false,
width: 200,
buttonCfg:
{
iconCls: 'uploaddialog'
},
anchor: '98%'
}],
buttons: [{
text: '上传', //'上传',
type: 'submit',
handler: function () {
var UserFilePath = Ext.getCmp('LoadExcel').getValue();
if (!CheckFileExt(UserFilePath, /.xls|.xlsx/i)) {
Ext.Msg.show({ title: '错误', msg: '请确认你上传的文件为EXCEL文件!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); //'请确认你上传的文件为EXCEL文件!'
return;
}
if (!imgform.form.isValid()) { return; }
imgform.form.submit({
url: '/MvcShipping/MsOp_SuperVision_Truck/ImportBl',
waitMsg: '正在操作数据',
method: 'POST',
success: function (form, action) {
win.close(this);
var result = action.result;
_this.storeList.reload();
},
failure: function (form, action) {
form.reset();
if (action.failureType == Ext.form.Action.SERVER_INVALID)
Ext.MessageBox.alert('警告', action.result.errors.msg);
}
});
}
}, {
text: '关闭', //'关闭',
type: 'submit',
handler: function () {
win.close(this);
}
}]
});
var win = new Ext.Window({
title: "上传EXCEL", //"上传EXCEL",
width: 380,
height: 120,
modal: true,
resizable: false,
border: false,
items: imgform
});
win.show();
return;
},
onImportBill2Click: function (button, event) {
var BSNO = "";
me = this;
var imgform = new Ext.FormPanel({
region: 'center',
labelWidth: 20,
frame: true,
autoScroll: false,
border: false,
fileUpload: true,
items: [{
xtype: 'fileuploadfield',
id: 'LoadExcel',
name: 'LoadExcel',
emptyText: '请选择EXCEL文件', //'请选择EXCEL文件',
fieldLabel: 'EXCEL', //'EXCEL',
buttonText: '选择文件', //'选择文件',
allowBlank: false,
width: 200,
buttonCfg:
{
iconCls: 'uploaddialog'
},
anchor: '98%'
}],
buttons: [{
text: '上传', //'上传',
type: 'submit',
handler: function () {
var UserFilePath = Ext.getCmp('LoadExcel').getValue();
if (!CheckFileExt(UserFilePath, /.xls|.xlsx/i)) {
Ext.Msg.show({ title: '错误', msg: '请确认你上传的文件为EXCEL文件!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); //'请确认你上传的文件为EXCEL文件!'
return;
}
if (!imgform.form.isValid()) { return; }
imgform.form.submit({
url: '/MvcShipping/MsOp_SuperVision_Truck/ImportBlZh',
waitMsg: '正在操作数据',
method: 'POST',
success: function (form, action) {
win.close(this);
var result = action.result;
_this.storeList.reload();
},
failure: function (form, action) {
form.reset();
if (action.failureType == Ext.form.Action.SERVER_INVALID)
Ext.MessageBox.alert('警告', action.result.Message);
}
});
}
}, {
text: '关闭', //'关闭',
type: 'submit',
handler: function () {
win.close(this);
}
}]
});
var win = new Ext.Window({
title: "上传EXCEL", //"上传EXCEL",
width: 380,
height: 120,
modal: true,
resizable: false,
border: false,
items: imgform
});
win.show();
return;
},
//#endregion
getCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var sql = "";
var CHECKOUTNO = form.findField('CHECKOUTNO').getValue();
sql = sql + getAndConSql(sql, CHECKOUTNO, "CHECKOUTNO like '%" + CHECKOUTNO + "'");
var MBLNO = form.findField('MBLNO').getValue();
sql = sql + getAndConSql(sql, MBLNO, "exists(select 1 from BillCheckOut_Detail where LINKGID=BillCheckOut.GID and exists (select 1 from v_op_bs where bsno=BillCheckOut_Detail.BSNO and mblno like '%" + MBLNO + "%'))");
var CUSTOMERNAME = form.findField('CUSTOMERNAME').getValue();
sql = sql + getAndConSql(sql, CUSTOMERNAME, "CUSTOMERNAME= '" + CUSTOMERNAME + "'");
var INPUTBY = form.findField('INPUTBY').getValue();
sql = sql + getAndConSql(sql, INPUTBY, "INPUTBY= '" + INPUTBY + "'");
//var ETDBgn = form.findField('ETDBgn').getRawValue();
//sql = sql + getAndConSql(sql, ETDBgn, "CONVERT(char(10), ETD, 20) >='" + ETDBgn + "'");
//var ETDEnd = form.findField('ETDEnd').getRawValue();
//sql = sql + getAndConSql(sql, ETDEnd, "CONVERT(char(10), ETD, 20) <='" + ETDEnd + "'");
var SENDDATEBgn = form.findField('SENDDATEBgn').getRawValue();
sql = sql + getAndConSql(sql, SENDDATEBgn, " SENDDATE >='" + SENDDATEBgn + "'");
var SENDDATEEnd = form.findField('SENDDATEEnd').getRawValue();
sql = sql + getAndConSql(sql, SENDDATEEnd, " SENDDATE <='" + SENDDATEEnd + "'");
//业务状态
var SENDED = form.findField('SENDED').getValue();
if(SENDED != null) {
if (SENDED.toString().trim() == "true") {
sql = sql + getAndConSql(sql, SENDED, " SENDED=1 ");
}
else if (SENDED.toString().trim() == "false") {
sql = sql + getAndConSql(sql, SENDED, " SENDED=0 ");
}
}
return sql;
},
OprationSwap: function () {
var ret = new Array();
ret[0] = this.OprationStatus;
ret[1] = this.storeList;
ret[2] = this.SelectedRecord;
ret[3] = this.selectbsno;
ret[4] = 'BillCheckOut';
ret[5] = this.storePLList;
return ret;
},
Print: function () {
_this = this;
if (this.storeList.getCount() == 0) {
return;
}
Ext.Msg.wait('正在组织数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在组织数据...',
url: '/MvcShipping/BillCheckOut/GetDataListStr',
scope: this,
params: {
condition: _this.sqlcontext,
printstr: 'true'
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var returnstr = jsonresult.data;
var printType = 'MSBILLCHECKOUT';
var sql1 = returnstr;
var sql2 = "";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
} 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
});
}
}
});
},
PrintSelect: function () {
_this = this;
if (this.storeList.getCount() == 0) {
return;
}
var selectedRecords = [];
var storeadd = null;
selectedRecords = this.GridCheckBoxModel.selected.items;
if (selectedRecords.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择要打印的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var sortstr = '';
if (this.sortfield != '' && this.sortdire != '') {
sortstr = this.sortfield + ' ' + this.sortdire;
}
if (sortstr == "") sortstr = "BSDATE desc"
var feeGidSql = '';
for (var i = 0; i < selectedRecords.length; i++) {
var record = selectedRecords[i];
var feeGId = "'" + record.get('GID') + "'";
if (feeGidSql == '') {
feeGidSql = feeGId;
} else {
feeGidSql = feeGidSql + "," + feeGId;
}
};
var bsno = '11111';
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length != 0) {
var record = selections[0];
bsno = record.data.BSNO;
}
var printType = 'MSBILLCHECKOUTSELECT';
var sql1 = "select *,(SELECT TOP 1 STATUS FROM OP_STATUS WHERE BSNO=op_supervision_truck.BSNO ORDER BY COMPTIME DESC,INPUTTIME DESC) as OPSTATUS from op_supervision_truck WHERE BSNO IN (" + feeGidSql + ") order by " + sortstr;
var sql2 = "select *,(SELECT TOP 1 STATUS FROM OP_STATUS WHERE BSNO=op_supervision_truck.BSNO ORDER BY COMPTIME DESC,INPUTTIME DESC) as OPSTATUS from op_supervision_truck where BSNO='" + bsno + "'";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
},
GetCompanyInfo: function (CORPID) {
var company = getStoreRecordsByFieldValue(this.storeCompany, "gid", CORPID)
if (company.length > 0) {
return company[0].get("name");
} else {
return "";
}
}
//, GetDeptInfo: function (DEPTGID) {
// var dept = getStoreRecordsByFieldValue(this.storeDept, "GID", DEPTGID)
// if (dept.length > 0) {
// return dept[0].get("DeptName");
// } else {
// return "";
// }
//}
});