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.

1002 lines
40 KiB
JavaScript

12 months ago

String.prototype.trim = function () { return this.replace(/(^\s*)|(\s*$)/g, ""); }
//集运管理-路单查询
Ext.namespace('DsTruck');
DsTruck.RptVwWmsStocktakeIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.DsTruck.RptVwWmsStocktakeIndex.superclass.constructor.call(this);
};
Ext.extend(DsTruck.RptVwWmsStocktakeIndex, Ext.Panel, {
PageSize: 50, //每页的条数
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
VISIBLERANGE: 0,
OPERATERANGE: 0,
BeginDate: null,
EndDate: null,
initUIComponents: function () {
this.formname = "formVwWmsStocktake"; //页面名称
//#region List列表加载信息定义数据集
this.storeList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
idProperty: 'GID',
fields: [
{ name: 'WMSDATE', type: 'string' },
{ name: 'CUSTOMERNAME', type: 'string' },
{ name: 'BLNO', type: 'string' },
{ name: 'STORAGENAME', type: 'string' },
{ name: 'GOODSNAME', type: 'string' },
{ name: 'GOODSMODEL', type: 'string' },
{ name: 'hj_GOODSRKSL', type: 'string' },
{ name: 'hj_GOODSPFSL_OUT', type: 'string' },
{ name: 'hj_GOODSPFSL_MONTH', type: 'string' },
{ name: 'hj_GOODSSTOCK', type: 'string' },
{ name: 'hj_GOODSPACK', type: 'string' },
{ name: 'hj_GOODSPACKPFSL', type: 'string' },
{ name: 'hj_GOODSPACKPFSL_MONTH', type: 'string' },
{ name: 'hj_GOODSPACKSTOCK', type: 'string' },
{ name: 'GID', type: 'string' },
{ name: 'ASSOCIATEDNO', type: 'string' },
{ name: 'CONTRACTNO', type: 'string' },
{ name: 'CHARGEUNIT', type: 'string' },
{ name: 'CUSTOMNO', type: 'string' },
{ name: 'GOODSGRADE', type: 'string' },
{ name: 'GOODSSLICE', type: 'string' },
{ name: 'GOODSSTANDARD', type: 'string' },
{ name: 'REMARK', type: 'string' },
{ name: 'hj_GOODSPACKACTUAL', type: 'string' },
{ name: 'hj_GOODSRKSLACTUAL', type: 'string' },
{ name: 'AREANAME', type: 'string' }
],
remoteSort: true,
proxy: {
type: 'ajax',
url: '/OA/RptWms/GetDataList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
Ext.define('Tradermb', {
extend: 'Ext.data.Model',
idProperty: 'gid',
fields: [
{ name: 'gid', type: 'string' },
{ name: 'name', type: 'string' },
{ name: 'codename', type: 'string' }
]
});
//#endregion
//#region List合计列表加载信息定义数据集
this.storeListSum = Ext.create('Ext.data.Store', {
idProperty: 'GID',
fields: [
{ name: 'hj_GOODSRKSL', type: 'string' },
{ name: 'hj_GOODSRKSLACTUAL', type: 'string' },
{ name: 'hj_GOODSPFSL_OUT', type: 'string' },
{ name: 'hj_GOODSPFSL_MONTH', type: 'string' },
{ name: 'hj_GOODSSTOCK', type: 'string' },
{ name: 'hj_GOODSPACK', type: 'string' },
{ name: 'hj_GOODSPACKACTUAL', type: 'string' },
{ name: 'hj_GOODSPACKPFSL', type: 'string' },
{ name: 'hj_GOODSPACKPFSL_MONTH', type: 'string' },
{ name: 'hj_GOODSPACKSTOCK', type: 'string' },
{ name: 'GID', type: 'string' }
],
proxy: {
type: 'ajax',
url: '/OA/RptWms/GetDataListSum',
reader: {
id: 'GID',
root: 'data'
}
}
});
//#endregion
//#region 查询条件的加载信息
this.storeCustomer = Ext.create('DsExt.ux.RefTableStore', {
model: 'Tradermb',
proxy: { url: '/CommMng/BasicDataRef/GetTrader' }
});
this.storeCustomer.load({ params: { condition: " 1=1 "} });
this.comboxCustomer = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '委托单位',
store: this.storeCustomer,
name: 'Customer',
valueField: 'name',
displayField: 'codename', flex: 1
});
this.comboxFEECustomer = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '费用应收客户',
store: this.storeCustomer,
name: 'FEECustomer',
valueField: 'name',
displayField: 'codename', flex: 1
});
//
this.storeStock = Ext.create('DsExt.ux.RefTableStore', {
model: 'Tradermb',
proxy: { url: '/CommMng/BasicDataRef/GetTrader' }
});
this.storeStock.load({ params: { condition: " ISWAREHOUSE=1 "} });
this.comboxStock = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '仓库',
store: this.storeStock,
name: 'STORAGENAME',
valueField: 'name',
displayField: 'codename', flex: 1
});
//
// this.storeUser = Ext.create('DsExt.ux.RefTableStore', {
// model: 'DsTruckMng.ux.UserRefModel',
// proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' }
// });
// this.storeUser.load({ params: { condition: ""} });
// this.comboxOP = Ext.create('DsExt.ux.RefTableCombox', {
// fieldLabel: '操作人',
// forceSelection: true,
// store: this.storeUser,
// name: 'OP',
// valueField: 'UserName',
// displayField: 'CodeAndName'
// });
//
Ext.define('CHARGEUNIT', {
extend: 'Ext.data.Model',
fields: [
{ name: 'Name', type: 'string' }
]
});
var CHARGEUNITData = [{ "Name": "吨" }, { "Name": "千克" }, { "Name": "立方" }, { "Name": "CBM" }, { "Name": ""}];
var storeCHARGEUNIT = Ext.create('Ext.data.Store', {
model: 'CHARGEUNIT',
data: CHARGEUNITData
});
this.comboxCHARGEUNIT = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '计费单位',
forceSelection: true,
store: storeCHARGEUNIT,
name: 'CHARGEUNIT',
valueField: 'Name',
displayField: 'Name'
});
//
Ext.define('STOCKTYPE', {
extend: 'Ext.data.Model',
fields: [
{ name: 'Name', type: 'string' }
]
});
var STOCKTYPEData = [{ "Name": "有货" }, { "Name": "清库" }, { "Name": ""}];
var storeSTOCKTYPE = Ext.create('Ext.data.Store', {
model: 'STOCKTYPE',
data: STOCKTYPEData
});
this.comboxSTOCKTYPE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '库存状态',
forceSelection: true,
store: storeSTOCKTYPE,
name: 'STOCKTYPE',
valueField: 'Name',
displayField: 'Name'
});
//#endregion
//#region List列表显示信息
Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, {
width: 30
});
this.column = [ {
sortable: true,
dataIndex: 'WMSDATE',
header: '入库日期',
width: 80
},
{
sortable: true,
dataIndex: 'CUSTOMERNAME',
header: '货主',
width: 80
},
{
sortable: true,
dataIndex: 'BLNO',
header: '提单号',
width: 80
},
{
sortable: true,
dataIndex: 'STORAGENAME',
header: '仓库',
width: 80
},
{
sortable: true,
dataIndex: 'GOODSNAME',
header: '品名',
width: 80
},
{
sortable: true,
dataIndex: 'GOODSMODEL',
header: '型号',
width: 80
},
{
sortable: true,
dataIndex: 'hj_GOODSRKSL',
header: '入库数量',
width: 80
},
{
sortable: true,
dataIndex: 'hj_GOODSPFSL_OUT',
header: '出库数量',
width: 80
},
{
sortable: true,
dataIndex: 'hj_GOODSPFSL_MONTH',
header: '时间段出库数量',
width: 100
},
{
sortable: true,
dataIndex: 'hj_GOODSSTOCK',
header: '库存数量',
width: 80
},
{
sortable: true,
dataIndex: 'hj_GOODSPACK',
header: '入库件数',
width: 80
},
{
sortable: true,
dataIndex: 'hj_GOODSPACKPFSL',
header: '出库件数',
width: 80
},
{
sortable: true,
dataIndex: 'hj_GOODSPACKPFSL_MONTH',
header: '时间段出库件数',
width: 100
},
{
sortable: true,
dataIndex: 'hj_GOODSPACKSTOCK',
header: '库存件数',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'GID',
header: 'GID',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'ASSOCIATEDNO',
header: 'BSNO',
width: 80
},
{
sortable: true,
dataIndex: 'CONTRACTNO',
header: '合同号',
width: 80
},
{
sortable: true,
dataIndex: 'CHARGEUNIT',
header: '计算单位',
width: 80
},
{
sortable: true,
dataIndex: 'CUSTOMNO',
header: '备案清单号',
width: 80
},
{
sortable: true,
dataIndex: 'GOODSGRADE',
header: '等级',
width: 80
},
{
sortable: true,
dataIndex: 'GOODSSLICE',
header: '片数/件',
width: 80
},
{
sortable: true,
dataIndex: 'GOODSSTANDARD',
header: '规格',
width: 80
},
{
sortable: true,
dataIndex: 'REMARK',
header: '备注',
width: 80
},
{
sortable: true,
dataIndex: 'hj_GOODSPACKACTUAL',
header: '实际件数',
width: 80
},
{
sortable: true,
dataIndex: 'hj_GOODSRKSLACTUAL',
header: '实际数量',
width: 80
},
{
sortable: true,
dataIndex: 'AREANAME',
header: '库位',
width: 80
}];
//#endregion
//#region List列表显示合计信息
this.columnSum = [{
sortable: true,
dataIndex: 'hj_GOODSRKSL',
header: '入库数量',
width: 80
}, {
sortable: true,
dataIndex: 'hj_GOODSRKSLACTUAL',
header: '实际数量',
width: 80
}, {
sortable: true,
dataIndex: 'hj_GOODSPFSL_OUT',
header: '出库数量',
width: 80
}, {
sortable: true,
dataIndex: 'hj_GOODSPFSL_MONTH',
header: '时间段出库数量',
width: 100
}, {
sortable: true,
dataIndex: 'hj_GOODSSTOCK',
header: '库存数量',
width: 80
}, {
sortable: true,
dataIndex: 'hj_GOODSPACK',
header: '入库件数',
width: 80
}, {
sortable: true,
dataIndex: 'hj_GOODSPACKACTUAL',
header: '实际件数',
width: 80
}, {
sortable: true,
dataIndex: 'hj_GOODSPACKPFSL',
header: '出库件数',
width: 80
}, {
sortable: true,
dataIndex: 'hj_GOODSPACKPFSL_MONTH',
header: '时间段出库件数',
width: 100
}, {
sortable: true,
dataIndex: 'hj_GOODSPACKSTOCK',
header: '库存件数',
width: 80
}];
//#endregion
this.KCCBModel = Ext.create('Ext.selection.CheckboxModel', { checkOnly: true });
//#region 定义Grid
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
stripeRows: true,
viewConfig: {
enableTextSelection: true,
autoFill: true
},
stateful: false,
selModel: this.KCCBModel,
columns: [new Ext.grid.RowNumberer()],
// paging bar on the bottom
bbar: Ext.create('Ext.PagingToolbar', {
store: this.storeList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
})
});
/////////////以下部分为获取存储的gridpanel显示样式
this.column = DsTruck.GetGridPanel(USERID, this.formname, this.column, 1);
//使用者id表名 中间column数组跳过一开始的几列
this.column.unshift(new Ext.grid.RowNumberer());
this.gridList.reconfigure(this.storeList, this.column);
////////////////////////////
this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
this.SelectedRecord = record;
this.OprationStatus = 'edit';
DsOpenEditWin('/OA/RptWms/RptVwWmsStocktakeEdit', "", "650", "1000");
}, this);
//#endregion
//#region 定义Grid_List合计
this.gridListSum = new Ext.grid.GridPanel({
store: this.storeListSum,
columns: this.columnSum,
region: 'south',
height: 45,
enableHdMenu: false, //在列的header是否要有下拉菜单
trackMouseOver: true, //当鼠标移过行时行是否要highlight
stripeRows: true, //让grid相邻两行背景色不同
disableSelection: false, //值为TRUE,表示禁止选择行
loadMask: { msg: "数据加载中,请稍等..." },
viewConfig: {
enableTextSelection: true, //允许复制数据
autoFill: true
},
stateful: false
});
//#endregion
//#region formSearch枚举参照相关 查询显示信息
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: [
{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
this.comboxCustomer,
{
fieldLabel: '编号',
name: 'BLNO', flex: 1
}, this.comboxSTOCKTYPE, this.comboxCHARGEUNIT
]
}]//end items(fieldset 1)
}, //end fieldset 1
{//fieldset 2
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxStock, {
fieldLabel: '库存日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'WMSDATE_min'
}, {
fieldLabel: '...到',
format: 'Y-m-d',
xtype: 'datefield',
name: 'WMSDATE_max'
}, this.comboxFEECustomer
]
}]//end items(fieldset 2)
}, //end fieldset 2
{//fieldset 2
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '品名',
name: 'GOODSNAME', flex: 1
}, {
fieldLabel: '型号',
name: 'GOODSMODEL', flex: 1
}, {
fieldLabel: '规格',
name: 'GOODSSTANDARD', flex: 1
}, {
fieldLabel: '等级',
name: 'GOODSGRADE', flex: 1
}]
}]//end items(fieldset 2)
}, //end fieldset 2
{//fieldset 2
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: []
}]//end items(fieldset 2)
}//end fieldset 2
]//end root items
});
//#endregion formSearch
//#region 打印
var menu1 = new Ext.menu.Menu({
id: 'basicMenu',
items: [{
text: '库存单',
handler: clickHandler_List
}]
});
function clickHandler_List() {
panelTest.Print_List();
};
//#endregion
//#region 工具条
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: "导出Excel",
id: "btnExportExcel",
iconCls: 'btnexportexcel',
handler: function (button, event) {
this.onExportClick(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: "打印报表", menu: menu1, scope: this
}]
});
//#endregion
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 120,
items: [this.formSearch, this.panelBtn]
});
Ext.apply(this, {
items: [this.panelTop, this.gridList, this.gridListSum]
});
this.InitData(); //权限调用
this.storeList.on('beforeload', function (store) {
if (!this.checkSearchCondition())
return;
var sql = this.getCondition();
var sql2 = this.getCondition2();
var sql3 = this.getCondition3();
var sql4 = this.getCondition4();
Ext.apply(store.proxy.extraParams, { condition: sql, condition2: sql2, condition3: sql3, condition4: sql4 });
}, this);
}, //end initUIComponents
OprationSwap: function () {
var ret = new Array();
ret[0] = this.OprationStatus;
ret[1] = this.storeList;
ret[2] = this.SelectedRecord;
return ret;
},
//执行查询
onRefreshClick: function (button, event) {
if (!this.checkSearchCondition())
return;
var sql = this.getCondition();
var sql2 = this.getCondition2();
var sql3 = this.getCondition3();
var sql4 = this.getCondition4();
if (sql != "" || sql2 != "" || sql3 != "" || sql4 != "") {
this.storeList.load({
params: { start: 0, limit: this.PageSize, condition: sql, condition2: sql2, condition3: sql3, condition4: sql4 },
waitMsg: "正在查询数据...",
scope: this
});
//合计
this.storeListSum.load({
params: { start: 0, limit: this.PageSize, condition: sql, condition2: sql2, condition3: sql3, condition4: sql4 },
waitMsg: "正在查询数据...",
scope: this
});
}
},
onClearSql: function () {
var form = this.formSearch.getForm();
form.reset();
}, //onDeleteClick
//查询条件提取
getCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var sql = '';
var CustomerName = form.findField('Customer').getValue();
sql = sql + getAndConSql(sql, CustomerName, "CUSTOMERNAME = '" + CustomerName + "'");
var FEECustomer = form.findField('FEECustomer').getValue();
sql = sql + getAndConSql(sql, FEECustomer, "associatedno in (select distinct bsno from ch_fee where feetype=1 and customername='" + FEECustomer + "')");
// var WMSDATE_min = form.findField('WMSDATE_min').getRawValue();
// sql = sql + getAndConSql(sql, WMSDATE_min, "CONVERT(char(10), WMSDATE, 120) >= '" + WMSDATE_min + "'");
var WMSDATE_max = form.findField('WMSDATE_max').getRawValue();
sql = sql + getAndConSql(sql, WMSDATE_max, "CONVERT(char(10), WMSDATE, 120) <= '" + WMSDATE_max + "'");
return sql;
},
//查询条件提取2
getCondition2: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var sql = '';
var WMSDATE_min = form.findField('WMSDATE_min').getRawValue();
sql = sql + getAndConSql(sql, WMSDATE_min, "CONVERT(char(10), DODATE, 120) >= '" + WMSDATE_min + "'");
var WMSDATE_max = form.findField('WMSDATE_max').getRawValue();
sql = sql + getAndConSql(sql, WMSDATE_max, "CONVERT(char(10), DODATE, 120) <= '" + WMSDATE_max + "'");
this.BeginDate = WMSDATE_min;
this.EndDate = WMSDATE_max;
return sql;
},
//查询条件提取4
getCondition4: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var sql = '';
var WMSDATE_max = form.findField('WMSDATE_max').getRawValue();
sql = sql + getAndConSql(sql, WMSDATE_max, "CONVERT(char(10), DODATE, 120) <= '" + WMSDATE_max + "'");
return sql;
},
//查询条件提取3
getCondition3: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var sql = '';
//权限范围
if (this.VISIBLERANGE == '0')//查看权限 全部
{
sql = '';
}
else if (this.VISIBLERANGE == '1')//分公司
{
sql = " CORPID='" + COMPANYID + "'";
}
else {
sql = " 1<0";
}
//查询条件
var BLNO = form.findField('BLNO').getValue();
sql = sql + getAndConSql(sql, BLNO, "(BLNO like '%" + BLNO + "%' or CUSTOMNO like '%" + BLNO + "%' or CONTRACTNO like '%" + BLNO + "%')");
var STORAGENAME = form.findField('STORAGENAME').getValue();
sql = sql + getAndConSql(sql, STORAGENAME, "STORAGENAME = '" + STORAGENAME + "'");
var GOODSNAME = form.findField('GOODSNAME').getValue();
sql = sql + getAndConSql(sql, GOODSNAME, "GOODSNAME like '%" + GOODSNAME + "%'");
var GOODSMODEL = form.findField('GOODSMODEL').getValue();
sql = sql + getAndConSql(sql, GOODSMODEL, "GOODSMODEL like '%" + GOODSMODEL + "%'");
var GOODSSTANDARD = form.findField('GOODSSTANDARD').getValue();
sql = sql + getAndConSql(sql, GOODSSTANDARD, "GOODSSTANDARD like '%" + GOODSSTANDARD + "%'");
var GOODSGRADE = form.findField('GOODSGRADE').getValue();
sql = sql + getAndConSql(sql, GOODSGRADE, "GOODSGRADE like '%" + GOODSGRADE + "%'");
var CHARGEUNIT = form.findField('CHARGEUNIT').getValue();
sql = sql + getAndConSql(sql, CHARGEUNIT, "CHARGEUNIT = '" + CHARGEUNIT + "'");
var STOCKTYPE = form.findField('STOCKTYPE').getValue();
if (STOCKTYPE != null) {
if (STOCKTYPE.toString().trim() == "有货") {
sql = sql + getAndConSql(sql, STOCKTYPE, "ISNULL((ISNULL(GOODSRKSL, 0)-ISNULL(GOODSPFSL, 0)),0)<>0");
}
else if (STOCKTYPE.toString().trim() == "清库") {
sql = sql + getAndConSql(sql, STOCKTYPE, "ISNULL((ISNULL(GOODSRKSL, 0)-ISNULL(GOODSPFSL, 0)),0)=0");
}
}
return sql;
},
//查询条件赋值检查
checkSearchCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return false;
}
return true;
},
//导出Excel
onExportClick: function (button, event) {
//GridExportExcelPage(this.gridList);
//
var selectedRecords = this.gridList.selModel.getSelection();
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');
}
}
//
var sql = escape(this.getCondition());
var sql2 = escape(this.getCondition2());
var sql3 = escape(this.getCondition3());
var sql4 = escape(this.getCondition4());
if (sql != "" || sql2 != "" || sql3 != "" || sql4 != "") {
var openSet = "height=1, width=400, toolbar=no, menubar=no,scrollbars=no, resizable=no,location=no, status=no,Top=" + (screen.height - 200) / 2 + ",Left=" + (screen.width - 400) / 2;
var openType = "_blank";
var openUrl = "../../Reports/RptExport.aspx?handle=RptVwWmsStocktakeIndex&formname=" + this.formname + "&condition1=" + sql + "&condition2=" + sql2 + "&condition3=" + sql3 + "&condition4=" + sql4 + "&gids=" + strGIDs;
window.open(openUrl, openType, openSet);
}
},
InitData: function () {
Ext.Ajax.request({
waitMsg: '正在查询用户权限...',
url: '/CommMng/BasicDataRef/GetAuthorityRange',
params: {
modName: "modRptVwWmsStocktakeIndex",
USERID: USERID
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
rec = result.data;
//可操作为0则全都可见3为可提交/驳回,2为可审核/驳回1为只能看
this.VISIBLERANGE = rec.VISIBLERANGE;
this.OPERATERANGE = rec.OPERATERANGE;
if (this.OPERATERANGE == '0') {
//Ext.getCmp("Submit").enable();
} else
if (this.OPERATERANGE == '1') {
//Ext.getCmp("Submit").disable();
} else
if (this.OPERATERANGE == '2') {
//Ext.getCmp("Submit").disable();
} else {
//Ext.getCmp("Submit").enable();
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
}); //request over
}, //end InitData
Print_List: function () {
//
var selectedRecords = this.gridList.selModel.getSelection();
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');
}
}
//
var strCondition = this.getCondition();
var strCondition2 = this.getCondition2();
var strCondition3 = this.getCondition3();
var strCondition4 = this.getCondition4();
if (strCondition != "" || strCondition2 != "" || strCondition3 != "" || strCondition4 != "" || strGIDs != "") {
var printType = 'modRptVwWmsStocktakeIndex'; //库存分段盘点列表
//
if (strCondition != "") {
strCondition = " and " + strCondition;
}
if (strCondition2 != "") {
strCondition2 = " and " + strCondition2;
}
if (strCondition3 != "") {
strCondition3 = " and " + strCondition3;
}
if (strCondition4 != "") {
strCondition4 = " and " + strCondition4;
}
if (strGIDs != "") {
strGIDs = " and GID in ('" + strGIDs.trim().replace(/,/g, "','") + "')";
}
//
var ls = "";
if (this.BeginDate != "") {
ls += ",'" + this.BeginDate + "' as 查询开始日期"
}
if (this.EndDate != "") {
ls += ",'" + this.EndDate + "' as 查询结束日期"
}
//#region sql语句
var sSql1 = "select GID, WMSDATE as 入库日期, CUSTOMERNAME as 货主,(select top 1 DESCRIPTION from info_client where SHORTNAME=B.CUSTOMERNAME) as 货主全称, BLNO as 提单号, STORAGENAME as 仓库,(select top 1 DESCRIPTION from info_client where SHORTNAME=B.STORAGENAME) as 仓库全称, AREANAME as 库位, GOODSNAME as 品名, GOODSMODEL as 型号, ASSOCIATEDNO as BSNO, (SELECT CONTRACTNO FROM op_seai WHERE BSNO = ASSOCIATEDNO) as 合同号, CHARGEUNIT as 计算单位, CUSTOMNO as 备案清单号, GOODSGRADE as 等级, GOODSSLICE as [片数/件], GOODSSTANDARD as 规格, REMARK as 备份,hj_GOODSRKSL as 入库量,hj_GOODSPFSL_OUT as 出库量,hj_GOODSPFSL_MONTH as 时间段出库量,hj_GOODSSTOCK as 库存量,hj_GOODSPACK as 入库件数,hj_GOODSPACKPFSL as 出库件数,hj_GOODSPACKPFSL_MONTH as 时间段出库件数,hj_GOODSPACKSTOCK as 剩余件数,hj_GOODSPACKACTUAL as 实际件数,hj_GOODSRKSLACTUAL as 实际数量" + ls
+ " from ("
+ "select GID, WMSDATE, CUSTOMERNAME, BLNO, STORAGENAME, AREANAME, GOODSNAME, GOODSMODEL, ASSOCIATEDNO, CONTRACTNO, CHARGEUNIT, CUSTOMNO, GOODSGRADE, ISNULL(GOODSSLICE, 0) AS GOODSSLICE, GOODSSTANDARD, '' AS REMARK"
+ ", ISNULL(sum(GOODSRKSL), 0) AS hj_GOODSRKSL"//入库量
+ ", ISNULL(SUM(GOODSPFSL), 0) AS hj_GOODSPFSL_OUT"//出库量
+ ", ISNULL(SUM(GOODSPFSL_MONTH), 0) AS hj_GOODSPFSL_MONTH"//出库量_区间
+ ", ISNULL((ISNULL(sum(GOODSRKSL), 0)-ISNULL(SUM(GOODSPFSL), 0)),0) AS hj_GOODSSTOCK"//入库量-出库量=库存量
+ ", ISNULL(sum(GOODSPACK), 0) AS hj_GOODSPACK"//入库件数
+ ", ISNULL(SUM(GOODSPACKPFSL), 0) AS hj_GOODSPACKPFSL"//出库件数
+ ", ISNULL(SUM(GOODSPACKPFSL_MONTH), 0) AS hj_GOODSPACKPFSL_MONTH"//出库件数_区间
+ ", ISNULL((ISNULL(sum(GOODSPACK), 0)-ISNULL(SUM(GOODSPACKPFSL), 0)),0) AS hj_GOODSPACKSTOCK"//入库件数-出库件数=剩余件数
+ ", ISNULL(sum(GOODSPACKACTUAL), 0) AS hj_GOODSPACKACTUAL"//实际件数
+ ", ISNULL(sum(GOODSRKSLACTUAL), 0) AS hj_GOODSRKSLACTUAL"//实际数量
+ " from ("
+ "SELECT GID, CONVERT(char(10), WMSDATE, 120) AS WMSDATE, CUSTOMERNAME, BLNO, STORAGENAME, AREANAME, GOODSNAME, GOODSMODEL, ASSOCIATEDNO, CONTRACTNO, CHARGEUNIT, CUSTOMNO, GOODSSTANDARD, '' AS REMARK, '' as GOODSGRADE, 0 as GOODSSLICE"
+ ", GOODSRKSL"
+ ", isnull((select sum(GOODSPFSL) as GOODSPFSL from wms_out_detail where INBSNO=wms.GID " + strCondition4 + "),0) as GOODSPFSL"
+ ", isnull((select sum(GOODSPFSL) as GOODSPFSL from wms_out_detail where INBSNO=wms.GID " + strCondition2 + "),0) as GOODSPFSL_MONTH"
+ ", GOODSPACK"
+ ", isnull((select sum(GOODSPACKPFSL) as GOODSPACKPFSL from wms_out_detail where INBSNO=wms.GID " + strCondition4 + "),0) as GOODSPACKPFSL"
+ ", isnull((select sum(GOODSPACKPFSL) as GOODSPACKPFSL from wms_out_detail where INBSNO=wms.GID " + strCondition2 + "),0) as GOODSPACKPFSL_MONTH"
+ ", GOODSPACKACTUAL, GOODSRKSLACTUAL, CORPID "
+ " FROM wms WHERE CHARGEUNIT <> 'CBM' AND ISDELETE = 0 " + strCondition
+ ") as A where 1=1 " + strCondition3
+ " GROUP BY GID,CUSTOMERNAME, STORAGENAME, AREANAME, BLNO, GOODSNAME, GOODSMODEL, ASSOCIATEDNO, CONTRACTNO, CHARGEUNIT, CUSTOMNO, GOODSGRADE, GOODSSLICE, GOODSSTANDARD, GOODSRKSL, GOODSPACK, GOODSPACKACTUAL, GOODSRKSLACTUAL, WMSDATE"
+ " UNION ALL "
+ "select GID, WMSDATE, CUSTOMERNAME, BLNO, STORAGENAME, AREANAME, GOODSNAME, GOODSMODEL, ASSOCIATEDNO, CONTRACTNO, CHARGEUNIT, CUSTOMNO, GOODSGRADE, ISNULL(GOODSSLICE, 0) AS GOODSSLICE, GOODSSTANDARD, '' AS REMARK"
+ ", ISNULL(sum(GOODSRKSL), 0) AS hj_GOODSRKSL"//入库量
+ ", ISNULL(SUM(GOODSPFSL), 0) AS hj_GOODSPFSL_OUT"//出库量
+ ", ISNULL(SUM(GOODSPFSL_MONTH), 0) AS hj_GOODSPFSL_MONTH"//出库量_区间
+ ", ISNULL((ISNULL(sum(GOODSRKSL), 0)-ISNULL(SUM(GOODSPFSL), 0)),0) AS hj_GOODSSTOCK"//入库量-出库量=库存量
+ ", ISNULL(sum(GOODSPACK), 0) AS hj_GOODSPACK"//入库件数
+ ", ISNULL(SUM(GOODSPACKPFSL), 0) AS hj_GOODSPACKPFSL"//出库件数
+ ", ISNULL(SUM(GOODSPACKPFSL_MONTH), 0) AS hj_GOODSPACKPFSL_MONTH"//出库件数_区间
+ ", ISNULL((ISNULL(sum(GOODSPACK), 0)-ISNULL(SUM(GOODSPACKPFSL), 0)),0) AS hj_GOODSPACKSTOCK"//入库件数-出库件数=剩余件数
+ ", ISNULL(sum(GOODSPACKACTUAL), 0) AS hj_GOODSPACKACTUAL"//实际件数
+ ", ISNULL(sum(GOODSRKSLACTUAL), 0) AS hj_GOODSRKSLACTUAL"//实际数量
+ " from ("
+ "SELECT i.GID, CONVERT(char(10), w.WMSDATE, 120) AS WMSDATE"
+ ", w.CUSTOMERNAME, w.BLNO, w.STORAGENAME, w.AREANAME, w.GOODSNAME, i.GOODSMODEL, w.ASSOCIATEDNO, w.CONTRACTNO, w.CHARGEUNIT, w.CUSTOMNO, i.GOODSGRADE, i.GOODSSLICE, i.GOODSSTANDARD, '' as REMARK"
+ ", i.GOODSRKSL"
+ ", isnull((select sum(GOODSPFSL) as GOODSPFSL from wms_out_detail where INBSNO=i.GID " + strCondition4 + "),0) as GOODSPFSL"
+ ", isnull((select sum(GOODSPFSL) as GOODSPFSL from wms_out_detail where INBSNO=i.GID " + strCondition2 + "),0) as GOODSPFSL_MONTH"
+ ", i.GOODSPACK"
+ ", isnull((select sum(GOODSPACKPFSL) as GOODSPACKPFSL from wms_out_detail where INBSNO=i.GID " + strCondition4 + "),0) as GOODSPACKPFSL"
+ ", isnull((select sum(GOODSPACKPFSL) as GOODSPACKPFSL from wms_out_detail where INBSNO=i.GID " + strCondition2 + "),0) as GOODSPACKPFSL_MONTH"
+ ", i.GOODSPACKACTUAL, i.GOODSRKSLACTUAL, w.CORPID "
+ " FROM wms_in AS i LEFT OUTER JOIN wms AS w ON i.ASSOCIATEDNO = w.GID WHERE i.CHARGEUNIT = 'CBM' AND i.ISDELETE = 0 " + strCondition
+ ") as A where 1=1 " + strCondition3
+ " GROUP BY GID,CUSTOMERNAME, STORAGENAME, AREANAME, BLNO, GOODSNAME, GOODSMODEL, ASSOCIATEDNO, CONTRACTNO, CHARGEUNIT, CUSTOMNO, GOODSGRADE, GOODSSLICE, GOODSSTANDARD, GOODSRKSL, GOODSPACK, GOODSPACKACTUAL, GOODSRKSLACTUAL, WMSDATE"
+ ") as B where 1=1 " + strGIDs
+ " order by CUSTOMERNAME,STORAGENAME, AREANAME, GOODSNAME, GOODSMODEL, WMSDATE, BLNO";
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var STORAGENAME = form.findField('STORAGENAME').getValue();
//sql = sql + getAndConSql(sql, STORAGENAME, "STORAGENAME = '" + STORAGENAME + "'");
var sSql2 = "select '" + STORAGENAME + "' 仓库名称 ";
var sSql3 = "";
var sSql4 = "";
var sSql5 = "SELECT u.GID as 惟一编号,u.USERNAME as 英文名,u.PASSWORD as 登录密码,u.CODENAME as 用户代码名,u.SHOWNAME as 显示用户名,u.ENROLLTIME as 注册时间,(SELECT TOP (1) SHOWNAME FROM [user] WHERE GID = u.CREATEUSER) as 操作人,(SELECT TOP (1) SHOWNAME FROM [user] WHERE GID = u.MODIFIEDUSER) as 更改操作人,u.MODIFIEDTIME as 更改操作时间,u.ISDELETED as 账户删除状态标志,u.ISDISABLE as 账户禁用状态标志,b.COMPANYNAME as 公司简称,b.DEPTNAME as 部门名称,b.QQ as QQ,b.MSN as MSN,(CASE b.OFFICEPHONE WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE b.OFFICEPHONE END) as 办公电话号码,(CASE b.HOMEPHONE WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE b.HOMEPHONE END) as 家庭电话号码,b.MOBILE as 手机号码,(CASE b.FAX WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE b.FAX END) as 传真号码,b.EMAIL1 as 主电子邮件地址,b.EMAIL2 as 次电子邮件地址,b.HOMEADDRESS as 家庭地址,b.REMARK as 备注信息,(SELECT TOP (1) SHOWNAME FROM [user] WHERE GID = b.CREATEUSER) as 创建人,b.CREATETIME as 创建时间,(SELECT TOP (1) SHOWNAME FROM [user] WHERE GID = b.MODIFIEDUSER) as 最后一次操作人,b.MODIFIEDTIME as 最后一次操作时间,b.EMERGUSER as 紧急联系人,(CASE b.EMERGPHONE WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE b.EMERGPHONE END) as 紧急联系人联系电话,b.EMERGEMAIL as 紧急联系人邮箱,b.POSTCODE as 邮政编码,b.SIGNATURE as 签名图片,b.FINANCESOFTCODE as 财务软件代码,b.IMAGEURL as 头像url,b.SIGNATUREURL as 签名Url FROM [user] as u INNER JOIN user_baseinfo as b ON u.GID = b.USERID where u.GID='" + USERID + "'";
var sSql6 = "SELECT GID as 惟一编号,CODENAME as 公司代码名,NAME as 公司简称,FULLNAME as 公司全称,ENNAME as 公司英文名称,ADDRESS as 公司联络地址,ENADDRESS as 公司英文地址,POSTCODE as 邮政编码,(CASE OFFICEPHONE WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE OFFICEPHONE END) AS 公司办公电话,(CASE FAX WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE FAX END) AS 传真号码,EMAIL as 电子邮箱,WEBSITEURL as 公司网址,LICENSECODE as 工商登记号,TAXCODE as 税务登记号,LOGO as 徽标,BillRises as 发票抬头,ChequePayable as 支票抬头,PRTHEADXML1 as 打印抬头1,PRTHEADXML2 as 打印抬头2,PRTHEADXML3 as 打印抬头3,PRTHEADXML4 as 打印抬头4,PRTHEADXML5 as 打印抬头5,CREATEUSER as 创建人gid,CREATETIME as 创建时间,MODIFIEDUSER as 更新人gid,MODIFIEDTIME as 更新时间,ISDELETED as 是否删除,ISDISABLE as 是否被禁用,PARENTID as 父公司GID,BANKSHEAD as 票号头字符 FROM [company] WHERE GID = '" + COMPANYID + "'";
//#endregion
PrintComm(printType, sSql1, sSql2, sSql3, sSql4, sSql5, sSql6);
}
},
getStrValue: function (list) {
var _list = [];
for (var _i = 0; _i < list.length; _i++) {
_list.push("'" + list[_i] + "'");
}
return _list;
}
});