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/WMSDeliver/WMSDeliverIndex.js

622 lines
22 KiB
JavaScript

3 years ago
Ext.namespace('Shipping');
Shipping.WMSDeliverIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.WMSDeliverIndex.superclass.constructor.call(this);
};
Ext.extend(Shipping.WMSDeliverIndex, Ext.Panel, {
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
EditRecord: null, //用于从主界面获取
BsNo: '',
OPLBNAME: "",
initUIComponents: function () {
var mainform = window.parent._this; // Ext.getCmp('OpSeaiEdit');
this.formname = 'WMSDeliverList';
//定义数据集
this.storeList = Ext.create('Ext.data.Store', {
model: 'WMSDeliverListModel',
pageSize: this.PageSize,
// autoLoad: { start: 0, limit: 30 },
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/WMSDeliver/GetDataList',
reader: {
id: 'BSNO',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//定义Grid
this.DeliverCB = Ext.create('Ext.selection.CheckboxModel', { checkOnly: true });
this.columns = [{
sortable: true,
dataIndex: 'BSNO',
header: 'BSNO',
hidden: true,
width: 120
}, {
sortable: false,
dataIndex: 'CUSTOMERNAME',
header: '贸易公司',
width: 80
}, {
sortable: true,
dataIndex: 'BUYCONTRACT',
header: '购货合同号',
width: 120
}, {
sortable: true,
dataIndex: 'DELIVERNO',
header: '送货单号',
width: 120
}, {
sortable: true,
dataIndex: 'BSSTATUS',
header: '送货状态',
width: 80
}, {
sortable: true,
dataIndex: 'GOODSNAMETT',
header: '品名详细',
width: 120
}, {
sortable: true,
dataIndex: 'DELIVERDATE',
header: '送货日期',
width: 120
}, {
sortable: true,
dataIndex: 'DRIVER',
header: '司机',
width: 120
}, {
sortable: true,
dataIndex: 'TRUCKNO',
header: '车号',
width: 120
}, {
sortable: true,
dataIndex: 'ENTERDATE',
header: '建单日期',
width: 120
}, {
sortable: true,
dataIndex: 'ENTEROPERATER',
header: '建单人',
width: 120
}];
this.girdcolums = this.columns;
this.girdcolums = DsTruck.GetGridPanel(USERID, this.formname, this.girdcolums, 1, true);
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'center',
selModel: this.DeliverCB,
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.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
this.SelectedRecord = record;
}, this);
//#region formSearch
Ext.regModel('BSStatus',
{
fields: [{ name: 'value' }, { name: 'text' }]
});
var cbStore1 = new Ext.data.Store({
model: 'BSStatus',
data: [{ 'value': '0', 'text': '新建' },
{ 'value': '1', 'text': '入库请求' },
{ 'value': '2', 'text': '接受入库请求' },
{ 'value': '3', 'text': '已入库' }
]
});
var cbStatus = Ext.create('Ext.form.ComboBox', {
name: 'cbStatus',
queryMode: 'local',
id: 'cbStatus',
triggerAction: 'all',
labelWidth: 90,
valueField: 'value',
displayField: 'text',
store: cbStore1,
fieldLabel: '状态',
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'keyup': {
fn: function (_field, e) {
if (e.getKey() == 13) {
this.onRefreshClick();
}
},
scope: this
}
}
});
//贸易公司
this.storeCustCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeCustCode.load();
this.comboxCustCode = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '贸易公司',
store: this.storeCustCode,
forceSelection: true,
name: 'CUSTOMERNAME',
valueField: 'CustName',
displayField: 'CodeAndName',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
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: [this.comboxCustCode,
{
fieldLabel: '购货合同号',
name: 'BuyContract',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
},
{
fieldLabel: '送货单号',
name: 'DeliverNo',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
},
{
fieldLabel: '托号',
name: 'TrayNo',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
},
{
fieldLabel: '品名',
name: 'GoodsName',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
},
{
fieldLabel: '车号',
name: 'TruckNo',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}
]},
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
cbStatus,
{
fieldLabel: '送货时间(从)',
name: 'DeliverDateFrom',
format: 'Y-m-d',
labelWidth: 90,
xtype: 'datefield',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
},
{
fieldLabel: '送货时间(到)',
name: 'DeliverDateTo',
format: 'Y-m-d',
labelWidth: 90,
xtype: 'datefield',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
},
{
xtype: 'hiddenfield'
},
{
xtype: 'hiddenfield'
},
{
xtype: 'hiddenfield'
}]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
//#endregion formSearch
//查询工具条
_this = this;
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: "btnReceive",
handler: function (button, event) {
this.onReceive(button, event);
},
scope: this
}, '-', {
text: "保存列表样式",
menu: [{ text: "保存",
handler: function (button, event) {
alert(GID);
_this.girdcolums = DsTruck.SaveGridPanel(GID, _this.formname, _this.gridList.columns, _this.girdcolums, 0, true); //使用者id表名中间column数组跳过一开始的几列
}
}, { text: "初始化",
handler: function (menu, event) {
_this.formWMSINBody.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: 100,
items: [this.formSearch, this.panelBtn]
});
Ext.apply(this, {
items: [this.panelTop, this.gridList]
});
this.InitData();
}, //end initUIComponents
//#region 加载事件
InitData: function () {
//#region 初始化只显示当前月
//var myDate = new Date();
//var mydatestr = Ext.util.Format.date(myDate, 'Y-m') + ('-01');
//this.sqlcontext = " DELIVERDATE >='" + mydatestr + "'";
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
//this.onRefreshClick();
}, //end InitData
//#endregion
onRefreshClick: function (button, event) {
var sql = this.getCondition();
this.sqlcontext = sql;
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
},
getCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var sql = '';
var CUSTOMERNAME = this.comboxCustCode.getValue();
if (CUSTOMERNAME != '' && CUSTOMERNAME != null) {
sql = sql + getAndConSql(sql, CustomerName, " CustomerName like '%" + CustomerName + "%'");
}
var BuyContract = form.findField('BuyContract').getValue();
if (BuyContract != '' && BuyContract != null) {
sql = sql + getAndConSql(sql, BuyContract, " BuyContract like '%" + BuyContract + "%'");
}
var DeliverNo = form.findField('DeliverNo').getValue();
if (DeliverNo != '' && DeliverNo != null) {
sql = sql + getAndConSql(sql, DeliverNo, " DeliverNo like '%" + DeliverNo + "%'");
}
var TrayNo = form.findField('TrayNo').getValue();
if (TrayNo != '' && TrayNo != null) {
sql = sql + getAndConSql(sql, TrayNo, " TrayNo like '%" + TrayNo + "%'");
}
var GoodsName = form.findField('GoodsName').getValue();
if (GoodsName != '' && GoodsName != null) {
sql = sql + getAndConSql(sql, GoodsName, " GoodsName like '%" + GoodsName + "%'");
}
var TruckNo = form.findField('TruckNo').getValue();
if (TruckNo != '' && TruckNo != null) {
sql = sql + getAndConSql(sql, TruckNo, " TruckNo like '%" + TruckNo + "%'");
}
var cbStatus = form.findField('cbStatus').getValue();
if (cbStatus != '' && cbStatus != null) {
sql = sql + getAndConSql(sql, cbStatus, " BSStatus like '%" + cbStatus + "%'");
}
var WMSDATE = form.findField('DeliverDateFrom').getRawValue();
if (WMSDATE != '' && WMSDATE != null) {
sql = sql + getAndConSql(sql, WMSDATE, " DeliverDate >= '" + WMSDATE + "'");
}
var WMSDATETO = form.findField('DeliverDateTo').getRawValue();
if (WMSDATETO != '' && WMSDATETO != null) {
sql = sql + getAndConSql(sql, WMSDATETO, " DeliverDate <= '" + WMSDATETO + "'");
}
return sql;
},
onClearSql: function () {
var form = this.formSearch.getForm();
form.reset();
//this.InitData();
},
onReceive: 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/WMSDeliver/Receive',
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);
this.onRefreshClick();
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
onPrintClick: function (button, event) {
var printType = 'WMSDeliver';
var uid = USERID;
var sql1 = "select * from EIP_Deliver ";
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.DeliverCB.selected.items;
if (selectedRecords.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择要打印的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var sBSNO = '';
for (var i = 0; i < selectedRecords.length; i++) {
var record = selectedRecords[i];
var bsno = "'" + record.get('BSNO') + "'";
if (sBSNO == '') {
sBSNO = bsno;
} else {
sBSNO = sBSNO + "," + bsno;
}
};
var printType = 'WMSDeliverSelect';
var sql1 = "select * from EIP_Deliver WHERE BSNO IN (" + sBSNO + ") order by DeliverDate DESC";
var sql2 = "";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6,"");
},
});