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/WMSStock/WMSStockIndex.js

695 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.WMSStockIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.WMSStockIndex.superclass.constructor.call(this);
};
Ext.extend(Shipping.WMSStockIndex, Ext.Panel, {
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
EditRecord: null, //用于从主界面获取
BsNo: '',
OPLBNAME: "",
initUIComponents: function () {
var mainform = window.parent._this; // Ext.getCmp('OpSeaiEdit');
this.formname = 'WMSStockList';
//定义数据集
this.storeList = Ext.create('Ext.data.Store', {
model: 'WMSStockListModel',
pageSize: this.PageSize,
// autoLoad: { start: 0, limit: 30 },
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/WMSStock/GetDataList',
reader: {
id: 'BSNO',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//定义Grid
this.StockCB = Ext.create('Ext.selection.CheckboxModel', { checkOnly: true });
this.columns = [{
sortable: true,
dataIndex: 'BSNO',
header: 'BSNO',
hidden: true,
width: 120
}, {
sortable: false,
dataIndex: 'STOCKUPNO',
header: '备货单号',
width: 150
}, {
sortable: true,
dataIndex: 'SALECONTRACT',
header: '外销合同号',
width: 120
}, {
sortable: true,
dataIndex: 'BSSTATUS',
header: '备货单状态',
width: 120
}, {
sortable: true,
dataIndex: 'GOODSNAMETT',
header: '品名详细',
width: 120
}, {
sortable: true,
dataIndex: 'CNTRNO',
header: '箱号',
width: 120
}, {
sortable: true,
dataIndex: 'STOCKUPDATE',
header: '备货日期',
width: 120
}, {
sortable: true,
dataIndex: 'EXPORTNO',
header: '出口备货单号',
width: 120
}, {
sortable: true,
dataIndex: 'STOCKUPDATE',
header: '备注',
width: 120
},{
sortable: true,
dataIndex: 'ENTEROPERATER',
header: '录入人',
width: 120
}, {
sortable: true,
dataIndex: 'ENTERDATE',
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.StockCB,
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': '已备货' },
{ 'value': '4', 'text': '已装箱' },
{ 'value': '5', '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: 'StockNo',
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: 'SaleContract',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}
]},
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
cbStatus,
{
fieldLabel: '箱号',
name: 'CntrNo',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
},
{
fieldLabel: '出库日期(从)',
name: 'OutDateFrom',
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: 'OutDateTo',
format: 'Y-m-d',
xtype: 'datefield',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
},
{
fieldLabel: '备货日期(从)',
name: 'StockDateFrom',
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: 'StockDateTo',
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: "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 = " STOCKUPDATE >='" + 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('StockNo').getValue();
if (DeliverNo != '' && DeliverNo != null) {
sql = sql + getAndConSql(sql, StockUpNo, " StockUpNo like '%" + StockUpNo + "%'");
}
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, " GoodsNameTT like '%" + GoodsName + "%'");
}
var SaleContract = form.findField('SaleContract').getValue();
if (SaleContract != '' && SaleContract != null) {
sql = sql + getAndConSql(sql, SaleContract, " SaleContract like '%" + SaleContract + "%'");
}
var cbStatus = form.findField('cbStatus').getValue();
if (cbStatus != '' && cbStatus != null) {
sql = sql + getAndConSql(sql, cbStatus, " BSStatus like '%" + cbStatus + "%'");
}
var CntrNo = form.findField('CntrNo').getValue();
if (CntrNo != '' && CntrNo != null) {
sql = sql + getAndConSql(sql, SaleContract, " CntrNo like '%" + CntrNo + "%'");
}
var STOCKDATE = form.findField('StockDateFrom').getRawValue();
sql = sql + getAndConSql(sql, STOCKDATE, " StockDate >= '" + STOCKDATE + "'");
var STOCKDATETO = form.findField('StockDateTo').getRawValue();
if (STOCKDATETO != '' && STOCKDATETO != null) {
sql = sql + getAndConSql(sql, STOCKDATETO, " StockDate <= '" + STOCKDATETO + "'");
}
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;
}
if (selections.length == 1) {
if (selections[0].data.BSSTATUS != '已备货') {
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/WMSStock/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 });
//DsOpenEditWin('/MvcShipping/WMSOUT_GuiGe/Edit', "明细出库");
}
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);
},
OprationSwap: function () {
var ret = new Array();
ret[0] = 'edit';
ret[1] = this.SelectedRecord;
ret[2] = Ext.getCmp('btnRefresh');
ret[3] = 'StockOutDetail';;//整体出库 StockOut,明细出库 StockOutDetail
ret[4] = '0';//是否货权转移 10
ret[5] = true;
return ret;
},
onPrintClick: function (button, event) {
var printType = 'WMSStock';
var uid = USERID;
var sql1 = "select * from EIP_StockUp ";
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.StockCB.selected.items;
if (selectedRecords.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择要打印的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var sql2str = "";
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;
}
if (sql2str != "") sql2str += " union all ";
sql2str += " select " + bsno + " bsno";
};
var bsno = '11111';
var mblno = '';
var printType = 'WMSStockSelect';
var sql1 = "select * from EIP_StockUp WHERE BSNO IN (" + sBSNO + ") order by StockUpDate DESC";
var sql2 = sql2str;
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6,"");
}
});