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/Import/Viewsjs/ImportWMSRpt/ImportWMSRptIndex.js

2078 lines
83 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.ImportWMSRptIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.ImportWMSRptIndex.superclass.constructor.call(this);
};
//201403060002
//13号
Ext.extend(Shipping.ImportWMSRptIndex, Ext.Panel, {
PageSize: 500,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
VISIBLERANGE: 0,
OPERATERANGE: 0,
sqlcontext: '',
initUIComponents: function () {
//定义数据集
_this = this;
this.sqlcontext = "";
this.storeList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
fields: [
{ name: 'WMSDATE', type: 'string' },
{ name: 'CUSTOMERNAME', type: 'string' },
{ name: 'MBLNO', type: 'string' },
{ name: 'CUSTNO', type: 'string' },
{ name: 'STORAGENAME', type: 'string' },
{ name: 'GOODSNAME', type: 'string' },
{ name: 'GOODSMODEL', type: 'string' },
{ name: 'hj_GOODSRKSL', type: 'number' },
{ name: 'hj_GOODSPFSL_OUT', type: 'number' },
{ name: 'hj_GOODSSTOCK', type: 'number' },
{ name: 'hj_GOODSPACK', type: 'number' },
{ name: 'hj_GOODSPACKPFSL', type: 'number' },
{ name: 'hj_GOODSPACKSTOCK', type: 'number' },
{ 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: 'number' },
{ name: 'hj_GOODSRKSLACTUAL', type: 'number' },
{ name: 'COMPANYNAME', type: 'string' },
{ name: 'COUNTRY', type: 'string' },
{ name: 'FACTORYNO', type: 'string' },
{ name: 'CONTAINERNO', type: 'string' },
{ name: 'COSTPRICE', type: 'number' },
{ name: 'STOCKCOST', type: 'number' },
{ name: 'WMSINCOST', type: 'number' },
{ name: 'Productiondate_min', type: 'string' },
{ name: 'Productiondate_max', type: 'string' },
{ name: 'ExpirationDate', type: 'string' },
{ name: 'StoreDays', type: 'string' },
{ name: 'CargoDays', type: 'string' },
{ name: 'SALEINFO', type: 'string' },
{ name: 'CargoType', type: 'string' },
{ name: 'PAYCOMPANY', type: 'string' },
{ name: 'remark_6', type: 'string' },
{ name: 'Inspection_Storage', type: 'string' },
{ name: 'Unsealdate', type: 'string' },
{ name: 'sale_weight', type: 'number' },
{ name: 'sale_boxcount', type: 'number' },
{ name: 'PUTINTYPE', type: 'string' },
{ name: 'ExpirationDates', type: 'string' },
{ name: 'WMSNO', type: 'string' },
{ name: 'seller', type: 'string' },
{ name: 'Ename', type: 'string' },
{ name: 'KINDPKGS', type: 'string' },
{ name: 'Buy_OP', type: 'string' },
{ name: 'OP', type: 'string' },
{ name: 'Agent', type: 'string' },
{ name: 'price', type: 'string' },
{ name: 'currid', type: 'string' }
],
remoteSort: true,
proxy: {
type: 'ajax',
url: '/Import/ImportWMSRpt/GetDataList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.storeCustomerList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
idProperty: 'CUSTOMERNAME',
fields: [
{ name: 'CUSTOMERNAME', type: 'string' },
{ name: 'GOODSNAME', type: 'string' },
{ name: 'CHARGEUNIT', type: 'string' },
{ name: 'hj_GOODSRKSL', type: 'number' },
{ name: 'hj_GOODSPFSL_OUT', type: 'number' },
{ name: 'hj_GOODSSTOCK', type: 'number' },
{ name: 'hj_GOODSPACK', type: 'number' },
{ name: 'hj_GOODSPACKPFSL', type: 'number' },
{ name: 'hj_GOODSPACKSTOCK', type: 'number' },
{ name: 'hj_GOODSPACKPFSL', type: 'number' },
{ name: 'hj_GOODSPACKSTOCK', type: 'number' },
{ name: 'COSTPRICE', type: 'number' },
{ name: 'STOCKCOST', type: 'number' }
],
remoteSort: false,
proxy: {
type: 'ajax',
url: '/Import/ImportWMSRpt/GetGroupList',
reader: {
id: 'CUSTOMERNAME',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.storeCompanyList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
idProperty: 'COMPANYNAME',
fields: [
{ name: 'COMPANYNAME', type: 'string' },
{ name: 'GOODSNAME', type: 'string' },
{ name: 'CHARGEUNIT', type: 'string' },
{ name: 'hj_GOODSRKSL', type: 'number' },
{ name: 'hj_GOODSPFSL_OUT', type: 'number' },
{ name: 'hj_GOODSSTOCK', type: 'number' },
{ name: 'hj_GOODSPACK', type: 'number' },
{ name: 'hj_GOODSPACKPFSL', type: 'number' },
{ name: 'hj_GOODSPACKSTOCK', type: 'number' }
],
remoteSort: false,
proxy: {
type: 'ajax',
url: '/OA/Wms_StockTake/GetGroupList',
reader: {
id: 'COMPANYNAME',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.Pagenum = Ext.create('Ext.form.field.Number', {
name: 'bottles',
fieldLabel: '每页记录数',
labelAlign: 'right',
value: this.PageSize,
maxValue: 100000,
width: 180,
minValue: 0,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.PageSize = field.lastValue;
_this.onRefreshClick();
}
}
}
});
//#region 枚举类型定义
Ext.define('Tradermb', {
extend: 'Ext.data.Model',
idProperty: 'gid',
fields: [
{ name: 'gid', type: 'string' },
{ name: 'name', type: 'string' },
{ name: 'codename', type: 'string' }
]
});
Ext.define('ConutryRef', {
extend: 'Ext.data.Model',
fields: [
{ name: 'countryid', type: 'string' },
{ name: 'country', type: 'string' },
{ name: 'country_idandname', type: 'string' }
]
});
this.formname = "ImportWMSRpt";
//入库类型
Ext.regModel('PUTINTYPE', {
fields: [{ name: 'value' }, { name: 'text'}]
})
this.comboxPUTINTYPE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '入库类型',
store: new Ext.data.Store({
model: 'PUTINTYPE',
data: [
{'value':'','text':'全部'},
{ 'value': '入库', 'text': '入库' },
{ 'value': '倒柜', 'text': '倒柜' },
{ 'value': '直入客户名下', 'text': '直入客户名下' }]
}),
id: 'PUTINTYPE',
forceSelection: true,
name: 'PUTINTYPE',
valueField: 'value',
displayField: 'text'
});
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,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
//供应商
this.storeSeller = Ext.create('DsExt.ux.RefTableStore', {
model: 'Tradermb',
proxy: { url: '/CommMng/BasicDataRef/GetTrader' }
});
this.storeSeller.load({ params: { condition: " 1=1 "} });
this.comboxSeller = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '供应商',
store: this.storeCustomer,
name: 'seller',
valueField: 'name',
displayField: 'codename', flex: 1,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.comboxFEECustomer = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '应收客户',
store: this.storeCustomer,
name: 'FEECustomer',
valueField: 'name',
displayField: 'codename', flex: 1,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
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,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.storeOP = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' }
});
this.storeOP.load();
this.comboxOP = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '操作',
store: this.storeOP,
forceSelection: true,
name: 'OP',
valueField: 'UserName',
displayField: 'CodeAndName'
});
this.storeSALE = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' }
});
this.storeSALE.load();
this.comboxSALE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '销售员',
store: this.storeSALE,
forceSelection: true,
name: 'SALE',
valueField: 'UserName',
displayField: 'CodeAndName',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
Ext.define('JZCmb', {
extend: 'Ext.data.Model',
fields: [
{ name: 'Name', type: 'string' }
]
});
var JZCData = [{ "Name": "千克" },
{ "Name": "立方" },
{ "Name": "吨" },
{ "Name": "CBM"}];
var storeJZC = Ext.create('Ext.data.Store', {
model: 'JZCmb',
data: JZCData
});
this.comboxJZC = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '计算单位', hidden: true,
forceSelection: true,
store: storeJZC,
name: 'JZC',
valueField: 'Name',
displayField: 'Name',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
Ext.define('IOmb', {
extend: 'Ext.data.Model',
fields: [
{ name: 'Name', type: 'string' }
]
});
var IOData = [{ "Name": "全部" },
{ "Name": "出库" },
{ "Name": "入库"}];
var storeIO = Ext.create('Ext.data.Store', {
model: 'IOmb',
data: IOData
});
this.comboxIO = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '出入方向',
forceSelection: true,
store: storeIO,
name: 'IO',
valueField: 'Name',
displayField: 'Name',
values: '全部',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
Ext.define('ISCHANGEmb', {
extend: 'Ext.data.Model',
fields: [
{ name: 'Name', type: 'string' }
]
});
var ISCHANGEData = [{ "Name": "全部" },
{ "Name": "不含货转" },
{ "Name": "只包括货转"}];
var storeISCHANGE = Ext.create('Ext.data.Store', {
model: 'ISCHANGEmb',
data: ISCHANGEData
});
this.comboxISCHANGE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '是否包括货转',
forceSelection: true,
store: storeISCHANGE,
name: 'ISCHANGE',
valueField: 'Name',
displayField: 'Name',
values: '全部',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.storeCompany = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsTruckMng.ux.CompanyModel',
proxy: { url: '/CommMng/BasicDataRef/GetcompanyList' }
});
this.storeCompany.load({ params: { condition: ""} });
this.comboxCompany = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '业务所属分公司',
store: this.storeCompany,
name: 'company',
valueField: 'gid',
displayField: 'name',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.storeCountry = Ext.create('DsExt.ux.RefTableStore', {
model: 'ConutryRef',
proxy: { url: '/CommMng/BasicDataRef/GetCountryRefList' }
});
this.storeCountry.load({ params: { condition: ""} });
this.comboxCountry = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '进口国',
store: this.storeCountry,
name: 'countryid',
valueField: 'countryid',
displayField: 'country_idandname',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.storeSALE_CUSTOMERNAME = Ext.create('DsExt.ux.RefTableStore', {
model: 'Tradermb',
proxy: { url: '/CommMng/BasicDataRef/GetTrader' }
});
this.storeSALE_CUSTOMERNAME.load({ params: { condition: " 1=1 "} });
this.comboxSALE_CUSTOMERNAME = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '销售对象',
store: this.storeSALE_CUSTOMERNAME,
name: 'SALE_CUSTOMERNAME',
valueField: 'name',
displayField: 'codename', flex: 1,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.storeCargoType = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeCargoType.load({ params: { enumTypeId: 30} });
this.comboxCargoType = Ext.create('DsExt.ux.RefEnumCombox', {
store: this.storeCargoType,
fieldLabel: '商品类型',
forceSelection: true,
name: 'CargoType',
valueField: 'EnumValueName',
displayField: 'EnumValueName',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
Ext.define('ISKCCLEARmb', {
extend: 'Ext.data.Model',
fields: [
{ name: 'Name', type: 'string' }
]
});
var ISKCCLEARmb = [{ "Name": "全部" },
{ "Name": "只显示有库存的货物(库存件数大于0)" },
{ "Name": "只显示无库存的货物(库存件数小于等于0)"}];
var storeISKCCLEARmb = Ext.create('Ext.data.Store', {
model: 'ISKCCLEARmb',
data: ISKCCLEARmb
});
this.comboxISKCCLEAR = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '是否含已出清',
forceSelection: true,
store: storeISKCCLEARmb,
name: 'ISKCCLEAR',
valueField: 'Name',
displayField: 'Name',
values: '全部',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
//#endregion
this.column = [
{
sortable: true,
dataIndex: 'WMSDATE',
header: '入库日期',
width: 80
},
{
sortable: true,
dataIndex: 'CUSTOMERNAME',
header: '货主',
width: 80
},
{
sortable: true,
dataIndex: 'SALEINFO',
header: '销售摘要',
width: 240
},
{
sortable: true,
dataIndex: 'seller',
header: '供应商',
width: 80
},
{
sortable: true,
dataIndex: 'Ename',
header: '产品描述(英)',
width: 80
},
{
sortable: true,
dataIndex: 'KINDPKGS',
header: '包装',
width: 80
},
{
sortable: true,
dataIndex: 'CUSTNO',
header: '合同号(委托编号)',
width: 110,
summaryType: 'sum',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
var _count = getStoreFieldCount(_this.storeList, 'CUSTNO');
return _count;
}
},
{
sortable: true,
dataIndex: 'CONTAINERNO',
header: '箱号',
width: 110
},
{
sortable: true,
dataIndex: 'STORAGENAME',
header: '仓库',
width: 80
},
{
sortable: true,
dataIndex: 'PUTINTYPE',
header: '入库类型'
},
{
sortable: true,
dataIndex: 'GOODSNAME',
header: '品名',
width: 80
},
{
sortable: true,
dataIndex: 'CargoType',
header: '商品类型',
width: 60
},
{
sortable: true,
dataIndex: 'GOODSMODEL',
header: '牌号',
width: 80
}, {
sortable: true,
dataIndex: 'COUNTRY',
header: '国家',
width: 80
},
{
sortable: true,
dataIndex: 'FACTORYNO',
header: '厂号',
width: 80
},
{
sortable: true,
dataIndex: 'COSTPRICE',
header: '成本价(货款税金代理费)',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>'; } } else { return value; } } catch (e) { return value; } return value; },
width: 135, align: 'right',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 6, '', true);
return value;
}
},
{
sortable: true,
dataIndex: 'WMSINCOST',
header: '入库时总成本',
summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00'),
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>'; } } else { return value; } } catch (e) { return value; } return value; },
width: 120, align: 'right',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
sortable: true,
dataIndex: 'STOCKCOST',
header: '当前库存总成本',
summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00'),
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>'; } } else { return value; } } catch (e) { return value; } return value; },
width: 120, align: 'right',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
}, {
sortable: true,
dataIndex: 'Productiondate_min',
header: '生产日期_起',
width: 80
}, {
sortable: true,
dataIndex: 'Productiondate_max',
header: '生产日期_止',
width: 80
},
{
sortable: true,
dataIndex: 'ExpirationDate',
header: '保质期',
width: 80
},{
sortable: true,
dataIndex: 'ExpirationDates',
header: '保质天数',
width: 80
},
{
sortable: true,
dataIndex: 'StoreDays',
header: '库龄天数',
width: 80
},
{
sortable: true,
dataIndex: 'CargoDays',
header: '货龄天数',
width: 80
},
{
sortable: true,
summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00000'),
dataIndex: 'hj_GOODSRKSL',
header: '入库数量',
width: 80, align: 'right',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 5, '', true);
return value;
}
},
{
sortable: true, summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00000'),
dataIndex: 'hj_GOODSPFSL_OUT',
header: '出库数量',
width: 80, align: 'right',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 5, '', true);
return value;
}
},
{
sortable: true, summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00000'),
dataIndex: 'hj_GOODSSTOCK',
header: '库存数量',
width: 80, align: 'right',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 5, '', true);
return value;
}
},
{
sortable: true, summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00'),
dataIndex: 'hj_GOODSPACK',
header: '入库件数',
width: 80, align: 'right',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
sortable: true, summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00'),
dataIndex: 'hj_GOODSPACKPFSL',
header: '出库件数',
width: 80, align: 'right',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
},
summaryRenderer: function (value, summaryData, dataIndex) {
var dataArr = _this.storeList.data.items;
var temp = 0.00;
var existBlno = '';
for (var i = 0; i < dataArr.length; i++) {
if (existBlno.indexOf(dataArr[i].data.WMSNO) >= 0) {
continue;
} else {
existBlno += dataArr[i].data.WMSNO + ',';
temp += parseFloat(dataArr[i].data.hj_GOODSPACKPFSL);
}
}
return temp;
}
},
{
sortable: true, summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00'),
dataIndex: 'hj_GOODSPACKSTOCK',
header: '库存件数',
width: 80, align: 'right',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
sortable: true, summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00'),
dataIndex: 'sale_weight',
header: '销售重量',
width: 80, align: 'right',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
sortable: true, summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00'),
dataIndex: 'sale_boxcount',
header: '销售件数',
width: 80, align: 'right',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
sortable: true, hidden: true,
dataIndex: 'GID',
header: 'GID',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'ASSOCIATEDNO',
header: 'BSNO',
width: 80
},
{
sortable: true,
dataIndex: 'MBLNO',
header: '提单号',
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: 'remark_6',
header: '跟单_备注5',
width: 200
},
{
sortable: true, align: 'left',
dataIndex: 'PAYCOMPANY',
header: '付款公司',
width: 100
},
{
sortable: true, summaryType: 'sum', hidden: true,
summaryRenderer: Ext.util.Format.numberRenderer('00.00'),
dataIndex: 'hj_GOODSPACKACTUAL',
header: '实际件数',
width: 80
},
{
sortable: true, summaryType: 'sum', hidden: true,
summaryRenderer: Ext.util.Format.numberRenderer('00.00000'),
dataIndex: 'hj_GOODSRKSLACTUAL',
header: '实际数量',
width: 80,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 5, '', true);
return value;
}
},
{
sortable: true, align: 'left',
dataIndex: 'Inspection_Storage',
header: '是否商检慢检',
width: 110,
renderer: function (value, cellmeta) {
if (value == "1") {
return "<a><font color='#FF0000'>是</font></a>";
}
if (value == "0") {
return "";
}
}
},
{
sortable: true, align: 'left',
dataIndex: 'Unsealdate',
header: '商检放行日',
width: 110
} ,
{
sortable: true,
dataIndex: 'Buy_OP',
header: '采购员',
width: 80
},
{
sortable: true,
dataIndex: 'OP',
header: '操作',
width: 80
},
{
sortable: true,
dataIndex: 'Agent',
header: '代理公司',
width: 80
},
{
sortable: true,
dataIndex: 'price',
header: '单价',
width: 80,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 6, '', true);
return value;
},
},
{
sortable: true,
dataIndex: 'currid',
header: '币别',
width: 80
}];
this.column_Customer = [
{
sortable: true,
dataIndex: 'CUSTOMERNAME',
header: '货主',
width: 80
},
{
sortable: true,
dataIndex: 'GOODSNAME',
header: '品名',
width: 80
},
{
sortable: true,
dataIndex: 'CHARGEUNIT',
header: '计算单位',
width: 80
},
{
sortable: true, summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00000'),
dataIndex: 'hj_GOODSRKSL',
header: '入库数量',
width: 80, align: 'right',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 5, '', true);
return value;
}
},
{
sortable: true, summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00000'),
dataIndex: 'hj_GOODSPFSL_OUT',
header: '出库数量',
width: 80, align: 'right',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 5, '', true);
return value;
}
},
{
sortable: true, summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00000'),
dataIndex: 'hj_GOODSSTOCK',
header: '库存数量',
width: 80, align: 'right',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 5, '', true);
return value;
}
},
{
sortable: true, summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00'),
dataIndex: 'hj_GOODSPACK',
header: '入库件数',
width: 80, align: 'right',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
sortable: true, summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00'),
dataIndex: 'hj_GOODSPACKPFSL',
header: '出库件数',
width: 80, align: 'right',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
},
summaryRenderer: function (value, summaryData, dataIndex) {
var dataArr = _this.storeList.data.items;
var temp = 0.00;
var existBlno = '';
for (var i = 0; i < dataArr.length; i++) {
if (existBlno.indexOf(dataArr[i].data.WMSNO) >= 0) {
continue;
} else {
existBlno += dataArr[i].data.WMSNO + ',';
temp += parseFloat(dataArr[i].data.hj_GOODSPACKPFSL);
}
}
return temp;
}
},
{
sortable: true, summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00'),
dataIndex: 'hj_GOODSPACKSTOCK',
header: '库存件数',
width: 80, align: 'right',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
sortable: true, summaryType: 'sum', hidden: true,
summaryRenderer: Ext.util.Format.numberRenderer('00.00'),
dataIndex: 'hj_GOODSPACKACTUAL',
header: '实际件数',
width: 80
},
{
sortable: true, summaryType: 'sum', hidden: true,
summaryRenderer: Ext.util.Format.numberRenderer('00.00000'),
dataIndex: 'hj_GOODSRKSLACTUAL',
header: '实际数量',
width: 80,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 5, '', true);
return value;
}
}, {
sortable: true,
dataIndex: 'COSTPRICE',
header: '平均成本价(货款税金代理费)',
width: 135, align: 'right',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
sortable: true, summaryType: 'sum',
dataIndex: 'STOCKCOST',
header: '总成本',
width: 120, align: 'right',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
}];
this.column_Company = [
{
sortable: true,
dataIndex: 'COMPANYNAME',
header: '货主',
width: 80
},
{
sortable: true,
dataIndex: 'GOODSNAME',
header: '品名',
width: 80
},
{
sortable: true,
dataIndex: 'CHARGEUNIT',
header: '计算单位',
width: 80
},
{
sortable: true, summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00000'),
dataIndex: 'hj_GOODSRKSL',
header: '入库数量',
width: 80,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 5, '', true);
return value;
}
}, {
sortable: true, summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00000'),
dataIndex: 'hj_GOODSPFSL_OUT',
header: '出库数量',
width: 80,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 5, '', true);
return value;
}
}, {
sortable: true, summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00000'),
dataIndex: 'hj_GOODSSTOCK',
header: '库存数量',
width: 80,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 5, '', true);
return value;
}
}, {
sortable: true, summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00'),
dataIndex: 'hj_GOODSPACK',
header: '入库件数',
width: 80
}, {
sortable: true, summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00'),
dataIndex: 'hj_GOODSPACKPFSL',
header: '出库件数',
width: 80
}, {
sortable: true, summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00'),
dataIndex: 'hj_GOODSPACKSTOCK',
header: '库存件数',
width: 80
}, {
sortable: true, summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00'),
dataIndex: 'hj_GOODSPACKACTUAL',
header: '实际件数',
width: 80
}, {
sortable: true, summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00000'),
dataIndex: 'hj_GOODSRKSLACTUAL',
header: '实际数量',
width: 80,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 5, '', true);
return value;
}
}];
this.KCCBModel = Ext.create('Ext.selection.CheckboxModel', { checkOnly: true });
Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, {
width: 40
});
//定义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()],
features: [{
ftype: 'summary'//Ext.grid.feature.Summary表格汇总特性
}],
bbar: [Ext.create('Ext.PagingToolbar', {
id: "bbar",
store: this.storeList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
}), this.Pagenum]
});
this.gridList_Customer = new Ext.grid.GridPanel({
store: this.storeCustomerList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
stripeRows: true,
viewConfig: {
enableTextSelection: true,
autoFill: true
},
stateful: false,
columns: this.column_Customer,
features: [{
ftype: 'summary'//Ext.grid.feature.Summary表格汇总特性
}],
bbar: Ext.create('Ext.PagingToolbar', {
store: this.storeCustomerList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
})
});
this.gridList_Company = new Ext.grid.GridPanel({
store: this.storeCompanyList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
stripeRows: true,
viewConfig: {
enableTextSelection: true,
autoFill: true
},
stateful: false,
columns: this.column_Company,
features: [{
ftype: 'summary'//Ext.grid.feature.Summary表格汇总特性
}],
bbar: Ext.create('Ext.PagingToolbar', {
store: this.storeCompanyList,
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/Wms_StockTake/Edit', "", "650", "1000");
}, this);
//#region formSearch
//#region formSearch枚举参照相关
//#endregion
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, this.comboxFEECustomer,
{
fieldLabel: '提单号',
name: 'MBLNO', flex: 1,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
},
{
fieldLabel: '委托编号(合同号)', labelWidth: 120,
name: 'CUSTNO', flex: 1,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
},
{
fieldLabel: '箱号',
name: 'CNTRNO', flex: 1,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}
]
}
]//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: '品名',
name: 'GOODSNAME', flex: 1,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}
, this.comboxCountry
, {
fieldLabel: '厂号',
name: 'FACTORYNO', flex: 1,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}
, {
fieldLabel: '规格', hidden: true,
name: 'GOODSSTANDARD', flex: 1,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}
, this.comboxJZC
, this.comboxOP
]
}
]//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: '从..入库日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'WMSDATE_min'
}, {
fieldLabel: '到..入库日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'WMSDATE_max'
},
{
fieldLabel: '从..到港日',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ArrivalDate_min'
}, {
fieldLabel: '到..到港日',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ArrivalDate_max'
},
this.comboxISCHANGE
//, { xtype: 'hiddenfield', flex: 1 }
]
}
]//end items(fieldset 2)
}//end fieldset 2
, {//fieldset 3
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
this.comboxISKCCLEAR
, this.comboxCompany
, this.comboxSALE
, this.comboxSALE_CUSTOMERNAME
, this.comboxCargoType
//, { xtype: 'hiddenfield', flex: 1 }
]
}
]//end items(fieldset 3)
},//end fieldset 3
{ xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '60%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
this.comboxPUTINTYPE,
{
fieldLabel: '保质天数',
name: 'ExpirationDates', flex: 1,
},this.comboxSeller]
}
]
}
]//end root items
});
//#endregion formSearch
var menu1 = new Ext.menu.Menu({
id: 'basicMenu',
items: [{
text: '对仓库对账模板',
handler: clickPrint_Import_KCDZ
}, {
text: '库存统计(按客户)',
handler: clickPrint_Import_KC_Cust
}, {
text: '库存统计(按销售员)',
handler: clickPrint_Import_KC_Saler
}]
});
_this = this;
function clickPrint_Import_KCDZ() {
_this.Print_Import_KCDZ();
};
function clickPrint_Import_KC_Cust() {
_this.Print_Import_KC_Cust();
};
function clickPrint_Import_KC_Saler() {
_this.Print_Import_KC_Saler();
};
//查询工具条
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [
{
text: "执行查询",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
},
scope: this
}, {
xtype: 'button',
width: 90,
text: "高级查询",
iconCls: "btnmore",
handler: function (button, event) {
var sql = this.getCondition();
if (this.winAccess == '' || typeof (this.winAccess) == "undefined") {
this.winAccess = new Shipping.DsQuery({});
} else {
this.winAccess.destroy();
this.winAccess = new Shipping.DsQuery({});
}
this.winAccess.StoreList = this.storeList;
this.winAccess.formname = this.formname;
this.winAccess.condition = sql;
this.winAccess.LoadQueryData_self(this.formname);
this.winAccess.show();
return;
},
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);
var tempcolumns = this.gridList.columns;
DsTruck.SaveGridPanel(USERID, this.formname, tempcolumns, this.column, 0, true);
},
scope: this
},
{ text: "打印报表", menu: menu1, scope: this }
]
});
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 180,
items: [this.formSearch, this.panelBtn]
});
this.page_1 = new Ext.Panel({
id: "page_1",
layout: "border",
region: "center",
title: "每入库单一行",
items: [this.gridList
]
});
this.page_2 = new Ext.Panel({
id: "page_2",
layout: "border",
region: "center",
title: "按客户、品名聚合",
items: [this.gridList_Customer
]
});
this.page_3 = new Ext.Panel({
id: "page_3",
layout: "border",
region: "center",
title: "按分公司",
items: [//this.gridList_Company
]
});
this.MainTab = new Ext.tab.Panel({
layout: "border",
region: "center",
items: [this.page_1, this.page_2
//, this.page_3
]
})
Ext.apply(this, {
items: [this.panelTop, this.MainTab]
});
this.storeList.on('beforeload', function (store) {
if (!this.checkSearchCondition())
return;
this.PageSize = this.Pagenum.getValue();
this.storeList.pageSize = this.PageSize;
var sql = this.sqlcontext;
Ext.apply(store.proxy.extraParams, { condition: sql });
}, 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;
this.PageSize = this.Pagenum.getValue();
var sql = this.getCondition();
this.sqlcontext = sql;
var _p = this.MainTab.getActiveTab().id;
if (_p == "page_1") {
this.storeList.load({
params: { start: 0, limit: this.PageSize, condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
}
if (_p == "page_2") {
this.storeCustomerList.load({
params: { start: 0, limit: this.PageSize, condition: sql, GROUPBY: "Customer" },
waitMsg: "正在查询数据...",
scope: this
});
}
if (_p == "page_3") {
this.storeCompanyList.load({
params: { start: 0, limit: this.PageSize, condition: sql, GROUPBY: "Company" },
waitMsg: "正在查询数据...",
scope: this
});
}
},
onDsQuery: function () {
//var girdcolums = this.gridList.getColumnMode();
this.PageSize = this.Pagenum.getValue();
var sql = this.sqlcontext;
var _p = this.MainTab.getActiveTab().id;
if (_p == "page_1") {
this.storeList.load({
params: { start: 0, limit: this.PageSize, condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
}
if (_p == "page_2") {
this.storeCustomerList.load({
params: { start: 0, limit: this.PageSize, condition: sql, GROUPBY: "Customer" },
waitMsg: "正在查询数据...",
scope: this
});
}
if (_p == "page_3") {
this.storeCompanyList.load({
params: { start: 0, limit: this.PageSize, condition: sql, GROUPBY: "Company" },
waitMsg: "正在查询数据...",
scope: this
});
}
},
getCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var sql = ' isnull(w.ISDELETE,0)=0 ';
var CustomerName = form.findField('Customer').getValue();
sql = sql + getAndConSql(sql, CustomerName, "vws.CustomerName = '" + CustomerName + "'");
var MBLNO = form.findField('MBLNO').getValue();
sql = sql + getAndConSql(sql, MBLNO, "vs.MBLNO like '%" + MBLNO + "%'");
var CUSTNO = form.findField('CUSTNO').getValue();
sql = sql + getAndConSql(sql, CUSTNO, "vs.CUSTNO like '%" + CUSTNO + "%'");
var CNTRNO = form.findField('CNTRNO').getValue();
sql = sql + getAndConSql(sql, CNTRNO, " vws.nid in (select ASSOCIATEDNO from wms_in where cntrno like '" + CNTRNO + "') ");
var OP = form.findField('OP').getValue();
sql = sql + getAndConSql(sql, OP, " vs.OP like '%" + OP + "%'");
var FEECustomer = form.findField('FEECustomer').getValue();
sql = sql + getAndConSql(sql, FEECustomer, "vws.associatedno in (select distinct bsno from ch_fee where feetype=1 and customername='" + FEECustomer + "')");
var GOODSNAME = form.findField('GOODSNAME').getValue();
sql = sql + getAndConSql(sql, GOODSNAME, "vws.GOODSNAME like '%" + GOODSNAME + "%'");
var GOODSSTANDARD = form.findField('GOODSSTANDARD').getValue();
sql = sql + getAndConSql(sql, GOODSSTANDARD, "vws.GOODSSTANDARD like '%" + GOODSSTANDARD + "%'");
var STORAGENAME = form.findField('STORAGENAME').getValue();
sql = sql + getAndConSql(sql, STORAGENAME, "vws.STORAGENAME = '" + STORAGENAME + "'");
var ISCHANGE = form.findField('ISCHANGE').getValue();
if (ISCHANGE == '全部') { }
if (ISCHANGE == '不含货转') { sql = sql + getAndConSql(sql, ISCHANGE, "vws.ISCHANGE = " + 0 + ""); }
if (ISCHANGE == '只包括货转') { sql = sql + getAndConSql(sql, ISCHANGE, "vws.ISCHANGE = " + 1 + ""); }
var ISKCCLEAR = form.findField('ISKCCLEAR').getValue();
if (ISKCCLEAR == '全部') { }
if (ISKCCLEAR == '只显示有库存的货物(库存件数大于0)') { sql = sql + getAndConSql(sql, ISKCCLEAR, "vws.hj_GOODSSTOCK > " + 0 + ""); }
if (ISKCCLEAR == '只显示无库存的货物(库存件数小于等于0)') { sql = sql + getAndConSql(sql, ISKCCLEAR, "vws.hj_GOODSSTOCK <= " + 0 + ""); }
var ArrivalDate_min = form.findField('ArrivalDate_min').getRawValue();
sql = sql + getAndConSql(sql, ArrivalDate_min, "vs.ETD >= '" + ArrivalDate_min + "'");
var ArrivalDate_max = form.findField('ArrivalDate_max').getRawValue();
sql = sql + getAndConSql(sql, ArrivalDate_max, "vs.ETD <= '" + ArrivalDate_max + " 23:59:59'");
var WMSDATE_min = form.findField('WMSDATE_min').getRawValue();
sql = sql + getAndConSql(sql, WMSDATE_min, "vws.WMSDATE >= '" + WMSDATE_min + "'");
var WMSDATE_max = form.findField('WMSDATE_max').getRawValue();
sql = sql + getAndConSql(sql, WMSDATE_max, "vws.WMSDATE <= '" + WMSDATE_max + " 23:59:59'");
var company = form.findField('company').getValue();
sql = sql + getAndConSql(sql, company, "vws.corpid = '" + company + "'");
var countryid = form.findField('countryid').getValue();
sql = sql + getAndConSql(sql, countryid, "VS.BSNO in (select Contractno from import_main where countryid='" + countryid + "') ");
var FACTORYNO = form.findField('FACTORYNO').getValue();
sql = sql + getAndConSql(sql, FACTORYNO, "tc.FACTORYNO like '%" + FACTORYNO + "%'");
var SALE = form.findField('SALE').getValue();
sql = sql + getAndConSql(sql, SALE, " dbo.F_ImportTrade_sealinfo(c.GID) like '%" + SALE + "%' ");
var SALE_CUSTOMERNAME = form.findField('SALE_CUSTOMERNAME').getValue();
sql = sql + getAndConSql(sql, SALE_CUSTOMERNAME, " dbo.F_ImportTrade_sealinfo(c.GID) like '%" + SALE_CUSTOMERNAME + "%'");
var CargoType = form.findField('CargoType').getValue();
sql = sql + getAndConSql(sql, CargoType, " c.CargoType like '%" + CargoType + "%'");
var PutInType = form.findField('PUTINTYPE').getValue();
sql = sql + getAndConSql(sql, PutInType, " vws.putintype like '%" + PutInType + "%'");
var ExpirationDates = form.findField('ExpirationDates').getValue();
sql = sql + getAndConSql(sql, ExpirationDates, " c.ExpirationDates = " + ExpirationDates + "");
var seller = form.findField('seller').getValue();
sql = sql + getAndConSql(sql, seller, "m.seller = '" + seller + "'");
return sql;
},
getCondition_RPT: 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, "vws.CustomerName = '" + CustomerName + "'");
var MBLNO = form.findField('MBLNO').getValue();
sql = sql + getAndConSql(sql, MBLNO, "vs.MBLNO like '%" + MBLNO + "%'");
var CUSTNO = form.findField('CUSTNO').getValue();
sql = sql + getAndConSql(sql, CUSTNO, "vs.CUSTNO like '%" + CUSTNO + "%'");
var CNTRNO = form.findField('CNTRNO').getValue();
sql = sql + getAndConSql(sql, CNTRNO, " vws.nid in (select ASSOCIATEDNO from wms_in where cntrno like '" + CNTRNO + "') ");
var OP = form.findField('OP').getValue();
sql = sql + getAndConSql(sql, OP, " vs.OP like '%" + OP + "%'");
var SALE = form.findField('SALE').getValue();
sql = sql + getAndConSql(sql, SALE, " w.Cargo_gid in( select CARGO_GID from Import_Saledetail where SALESNO in(select salesno from import_sales where SALER='" + SALE + "') ) ");
var FEECustomer = form.findField('FEECustomer').getValue();
sql = sql + getAndConSql(sql, FEECustomer, "vws.associatedno in (select distinct bsno from ch_fee where feetype=1 and customername='" + FEECustomer + "')");
var GOODSNAME = form.findField('GOODSNAME').getValue();
sql = sql + getAndConSql(sql, GOODSNAME, "vws.GOODSNAME like '%" + GOODSNAME + "%'");
var GOODSSTANDARD = form.findField('GOODSSTANDARD').getValue();
sql = sql + getAndConSql(sql, GOODSSTANDARD, "vws.GOODSSTANDARD like '%" + GOODSSTANDARD + "%'");
var STORAGENAME = form.findField('STORAGENAME').getValue();
sql = sql + getAndConSql(sql, STORAGENAME, "vws.STORAGENAME = '" + STORAGENAME + "'");
var ISCHANGE = form.findField('ISCHANGE').getValue();
if (ISCHANGE == '全部') { }
if (ISCHANGE == '不含货转') { sql = sql + getAndConSql(sql, ISCHANGE, "vws.ISCHANGE = " + 0 + ""); }
if (ISCHANGE == '只包括货转') { sql = sql + getAndConSql(sql, ISCHANGE, "vws.ISCHANGE = " + 1 + ""); }
var ISKCCLEAR = form.findField('ISKCCLEAR').getValue();
if (ISKCCLEAR == '全部') { }
if (ISKCCLEAR == '只显示有库存的货物(库存件数大于0)') { sql = sql + getAndConSql(sql, ISKCCLEAR, "vws.hj_GOODSSTOCK > " + 0 + ""); }
if (ISKCCLEAR == '只显示无库存的货物(库存件数小于等于0)') { sql = sql + getAndConSql(sql, ISKCCLEAR, "vws.hj_GOODSSTOCK <= " + 0 + ""); }
var ArrivalDate_min = form.findField('ArrivalDate_min').getRawValue();
sql = sql + getAndConSql(sql, ArrivalDate_min, "vs.ETD >= '" + ArrivalDate_min + "'");
var ArrivalDate_max = form.findField('ArrivalDate_max').getRawValue();
sql = sql + getAndConSql(sql, ArrivalDate_max, "vs.ETD <= '" + ArrivalDate_max + " 23:59:59'");
var company = form.findField('company').getValue();
sql = sql + getAndConSql(sql, company, "vws.corpid = '" + company + "'");
var countryid = form.findField('countryid').getValue();
sql = sql + getAndConSql(sql, countryid, "VS.BSNO in (select Contractno from import_main where countryid='" + countryid + "') ");
var FACTORYNO = form.findField('FACTORYNO').getValue();
sql = sql + getAndConSql(sql, FACTORYNO, "tc.FACTORYNO like '%" + FACTORYNO + "%'");
return sql;
},
checkSearchCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return false;
}
return true;
},
onExportClick: function (button, event) {
GridExportExcelPage(this.gridList);
},
getStrValue: function (list) {
var _list = [];
for (var _i = 0; _i < list.length; _i++) {
_list.push("'" + list[_i] + "'");
}
return _list;
},
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.VISIBLERANGE == '0') {
//Ext.getCmp("Submit").enable();
} else
if (this.VISIBLERANGE == '1') {
//Ext.getCmp("Submit").disable();
} else
if (this.VISIBLERANGE == '2') {
//Ext.getCmp("Submit").disable();
} else {
//Ext.getCmp("Submit").enable();
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
}); //request over
} //end InitData
,
Print_Import_KCDZ: function () {
//库存对账
/*
var MainList = "";
var selectedRecords = this.gridList.selModel.getSelection();
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (MainList == "") { MainList = "'"+rec.get('GID')+"'"; }
else {
MainList = MainList + ",'" + rec.get('GID') + "'";
}
}
if (MainList == "") {
Ext.Msg.show({ title: '错误', msg: '选中至少一条入库', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}*/
var printType = 'Print_Import_KCDZ'; //进口贸易业务,库存对账
var form = this.formSearch.getForm();
var WMSDATE_min = form.findField('WMSDATE_min').getRawValue();
var WMSDATE_max = form.findField('WMSDATE_max').getRawValue();
if (WMSDATE_min == "" || WMSDATE_max == "") {
alert("请在入库日期内填写要获取的时间段!");
return;
}
var _T = "";
_T = this.getCondition_RPT();
/* DECLARE @DateBgn datetime,@DateEnd datetime ";
sql1 = sql1 + " set @DateBgn='" + WMSDATE_min + "' ";
sql1 = sql1 + " set @DateEnd='" + WMSDATE_max + "' */
var sql1 = "";
sql1 = sql1 + " select M.hth,m.containerno,c.name,tt.* ";
sql1 = sql1 + " ,case tt.wmstype when '转' then DATEDIFF(day,datebgn,nextdate)+1 else DATEDIFF(day,datebgn,nextdate) end 天数 ";
sql1 = sql1 + " from ( ";
sql1 = sql1 + " select case when WMSDATE<'" + WMSDATE_min + "' then '转' else '入' end wmstype,w.Cargo_gid,w.wmsdate,case when WMSDATE<'" + WMSDATE_min + "' then '" + WMSDATE_min + "' else WMSDATE end as DateBgn ";
sql1 = sql1 + " ,case when isnull((select min(dodate) from wms_out_detail where INBSNO=w.gid),'')='' then '" + WMSDATE_max + "' ELSE ";
sql1 = sql1 + " (select min(dodate) from wms_out_detail where INBSNO=w.gid) end nextdate ";
sql1 = sql1 + " ,w.GOODSSTOCK+isnull((select sum(GOODSPFSL) from wms_out_detail ";
sql1 = sql1 + " where INBSNO=w.GID and dodate >='" + WMSDATE_min + "' ),0) 入库重量 ";
sql1 = sql1 + " ,w.GOODSPACKSTOCK+isnull((select sum(GOODSPACKPFSL) from wms_out_detail ";
sql1 = sql1 + " where INBSNO=w.GID and dodate >='" + WMSDATE_min + "' ),0) 入库件数 ";
sql1 = sql1 + " ,0 出库重量,0 出库件数,w.GOODSSTOCK+isnull((select sum(GOODSPFSL) from wms_out_detail ";
sql1 = sql1 + " where INBSNO=w.GID and dodate >='" + WMSDATE_min + "' ),0) 库存重量 ";
sql1 = sql1 + " ,w.GOODSPACKSTOCK+isnull((select sum(GOODSPACKPFSL) from wms_out_detail ";
sql1 = sql1 + " where INBSNO=w.GID and dodate >='" + WMSDATE_min + "' ),0) 库存件数 ";
sql1 = sql1 + " from wms w ";
if (_T != "") {
sql1 = sql1 + " where " + _T;
}
sql1 = sql1 + " left join ImportTrade_Cargo tc on tc.GID=w.Cargo_gid ";
sql1 = sql1 + " left join v_op_bs vs on vs.BSNO=tc.ContractNo ";
sql1 = sql1 + " union all ";
sql1 = sql1 + " select '出' wmstype,w.Cargo_gid,w.wmsdate,od.DODATE ";
sql1 = sql1 + " ,case when isnull((select min(dodate) from wms_out_detail where INBSNO=w.gid and DODATE>od.DODATE),'')='' then '" + WMSDATE_max + "' ELSE ";
sql1 = sql1 + " (select min(dodate) from wms_out_detail where INBSNO=w.gid) end nextdate ";
sql1 = sql1 + " ,0,0,od.GOODSPFSL,od.GOODSPACKPFSL ";
sql1 = sql1 + " ,w.GOODSSTOCK+isnull((select sum(GOODSPFSL) from wms_out_detail ";
sql1 = sql1 + " where INBSNO=w.GID and dodate < od.DODATE ),0) ";
sql1 = sql1 + " ,w.GOODSPACKSTOCK+isnull((select sum(GOODSPACKPFSL) from wms_out_detail ";
sql1 = sql1 + " where INBSNO=w.GID and dodate < od.DODATE ),0) ";
sql1 = sql1 + " from wms w ";
if (_T != "") {
sql1 = sql1 + " where " + _T;
}
sql1 = sql1 + " left join wms_out_detail od on od.INBSNO=w.GID ";
sql1 = sql1 + " left join ImportTrade_Cargo tc on tc.GID=w.Cargo_gid ";
sql1 = sql1 + " left join v_op_bs vs on vs.BSNO=tc.ContractNo ";
sql1 = sql1 + " where od.DODATE >='" + WMSDATE_min + "' and od.DODATE <='" + WMSDATE_max + "' ";
sql1 = sql1 + " )tt left join import_cargo c on c.gid=tt.Cargo_gid ";
sql1 = sql1 + " left join import_main m on m.contractno=c.contractno where 库存重量>0 ";
function GetDateStr(AddDayCount) {
var dd = new Date();
dd.setDate(dd.getDate() + AddDayCount); //获取AddDayCount天后的日期
var y = dd.getFullYear();
var m = dd.getMonth() + 1; //获取当前月份的日期
var d = dd.getDate();
return y + "-" + m + "-" + d;
}
//alert(GetDateStr(+5));
var printdate = GetDateStr(0);
var sql2 = "select '" + SHOWNAME + "' showname,'" + printdate + "' printdate,'" + WMSDATE_min + " " + WMSDATE_max + "' dates";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
}
,
Print_Import_KC_Cust: function () {
var printType = 'Print_Import_KC_Cust'; //进口贸易业务,库存对账
var form = this.formSearch.getForm();
var _T = "";
_T = this.getCondition();
if (_T != "") {
_T = " where " + _T;
}
var sql1 = "select vws.storagename,vws.hj_GOODSRKSL,vws.hj_GOODSPACK,vws.hj_GOODSPFSL_OUT,vws.hj_GOODSPACKPFSL,vws.hj_GOODSSTOCK,vws.hj_GOODSPACKSTOCK ";
sql1 = sql1 + " ,vws.GOODSNAME,vws.GOODSMODEL,vws.STORAGENAME,w.WMSDATE ";
sql1 = sql1 + " ,(select name from company where gid=vws.corpid) COMPANYNAME ,vs.ETD ";
sql1 = sql1 + " ,vs.mblno,vs.custno,(select substring(country,0,(charindex('(',country)) ) from code_country where countryid=m.countryid) country ";
sql1 = sql1 + " ,c.FactoryNo,m.containerno,( select top 1 costprice_ex from ImportTrade_Cargo where GID=w.Cargo_gid ) costprice_ex ";
sql1 = sql1 + " ,convert(numeric(20,6) , ( select top 1 costprice from ImportTrade_Cargo where GID=w.Cargo_gid ) )costprice ";
sql1 = sql1 + " ,(select top 1 costCargo from ImportTrade_Cargo where gid=c.gid)*w.GOODSRKSL/(case (select sum(GOODSRKSL) from wms where cargo_gid=c.GID) when 0 then 1 else (select sum(GOODSRKSL) from wms where cargo_gid=c.GID) end) WmsInCost ";
sql1 = sql1 + " ,(select top 1 costCargo from ImportTrade_Cargo where gid=c.gid)*w.GOODSRKSL/(case (select sum(GOODSRKSL) from wms where cargo_gid=c.GID) when 0 then 1 else (select sum(GOODSRKSL) from wms where cargo_gid=c.GID) end)*w.GOODSSTOCK/(case w.GOODSRKSL when 0 then 1 else w.GOODSRKSL end) stockCost ";
sql1 = sql1 + " ,dbo.trimdate(c.productiondate_min) productiondate_min,dbo.trimdate(c.productiondate_max) productiondate_max,dbo.trimdate(c.ExpirationDate) ExpirationDate ";
sql1 = sql1 + " ,( select top 1 StoreDays from ImportTrade_Cargo where GID=w.Cargo_gid ) StoreDays ";
sql1 = sql1 + " ,( select top 1 cargoDays from ImportTrade_Cargo where GID=w.Cargo_gid ) cargoDays ,dbo.F_ImportTrade_sealinfo(c.GID) SALEINFO,C.CargoType ";
sql1 = sql1 + " ,dbo.F_PAYCOMPANY(m.contractno) PAYCOMPANY,m.remark_6,m.Inspection_Storage,dbo.trimdate(m.Unsealdate) Unsealdate ";
sql1 = sql1 + " ,s.customername,s.SALER,s.SALESNO ,sd.WEIGHT,sd.BOXCOUNT ";
sql1 = sql1 + " from vw_wms_stocktake vws ";
sql1 = sql1 + " left join v_op_bs vs on vs.BSNO=vws.ASSOCIATEDNO left join wms w on w.gid=vws.NID ";
sql1 = sql1 + " left join import_cargo c on c.gid=w.Cargo_gid ";
sql1 = sql1 + " left join import_main m on m.contractno=vs.BSNO ";
sql1 = sql1 + " left join Import_Saledetail sd on sd.CARGO_GID=w.Cargo_gid left join import_sales S on S.SALESNO =sd.SALESNO ";
sql1 = sql1 + _T;
sql1 = sql1 + " order by S.Customername,S.Saler ";
function GetDateStr(AddDayCount) {
var dd = new Date();
dd.setDate(dd.getDate() + AddDayCount); //获取AddDayCount天后的日期
var y = dd.getFullYear();
var m = dd.getMonth() + 1; //获取当前月份的日期
var d = dd.getDate();
return y + "-" + m + "-" + d;
}
//alert(GetDateStr(+5));
var printdate = GetDateStr(0);
var sql2 = "";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
}
,
Print_Import_KC_Saler: function () {
var printType = 'Print_Import_KC_Saler'; //进口贸易业务,库存对账
var form = this.formSearch.getForm();
var _T = "";
_T = this.getCondition();
if (_T != "") {
_T = " where " + _T;
}
var sql1 = "select vws.storagename,vws.hj_GOODSRKSL,vws.hj_GOODSPACK,vws.hj_GOODSPFSL_OUT,vws.hj_GOODSPACKPFSL,vws.hj_GOODSSTOCK,vws.hj_GOODSPACKSTOCK ";
sql1 = sql1 + " ,vws.GOODSNAME,vws.GOODSMODEL,vws.STORAGENAME,w.WMSDATE ";
sql1 = sql1 + " ,(select name from company where gid=vws.corpid) COMPANYNAME ,vs.ETD ";
sql1 = sql1 + " ,vs.mblno,vs.custno,(select substring(country,0,(charindex('(',country)) ) from code_country where countryid=m.countryid) country ";
sql1 = sql1 + " ,c.FactoryNo,m.containerno,( select top 1 costprice_ex from ImportTrade_Cargo where GID=w.Cargo_gid ) costprice_ex ";
sql1 = sql1 + " ,convert(numeric(20,6) , ( select top 1 costprice from ImportTrade_Cargo where GID=w.Cargo_gid ) )costprice ";
sql1 = sql1 + " ,(select top 1 costCargo from ImportTrade_Cargo where gid=c.gid)*w.GOODSRKSL/(case (select sum(GOODSRKSL) from wms where cargo_gid=c.GID) when 0 then 1 else (select sum(GOODSRKSL) from wms where cargo_gid=c.GID) end) WmsInCost ";
sql1 = sql1 + " ,(select top 1 costCargo from ImportTrade_Cargo where gid=c.gid)*w.GOODSRKSL/(case (select sum(GOODSRKSL) from wms where cargo_gid=c.GID) when 0 then 1 else (select sum(GOODSRKSL) from wms where cargo_gid=c.GID) end)*w.GOODSSTOCK/(case w.GOODSRKSL when 0 then 1 else w.GOODSRKSL end) stockCost ";
sql1 = sql1 + " ,dbo.trimdate(c.productiondate_min) productiondate_min,dbo.trimdate(c.productiondate_max) productiondate_max,dbo.trimdate(c.ExpirationDate) ExpirationDate ";
sql1 = sql1 + " ,( select top 1 StoreDays from ImportTrade_Cargo where GID=w.Cargo_gid ) StoreDays ";
sql1 = sql1 + " ,( select top 1 cargoDays from ImportTrade_Cargo where GID=w.Cargo_gid ) cargoDays ,dbo.F_ImportTrade_sealinfo(c.GID) SALEINFO,C.CargoType ";
sql1 = sql1 + " ,dbo.F_PAYCOMPANY(m.contractno) PAYCOMPANY,m.remark_6,m.Inspection_Storage,dbo.trimdate(m.Unsealdate) Unsealdate ";
sql1 = sql1 + " ,s.customername,s.SALER,s.SALESNO ,sd.WEIGHT,sd.BOXCOUNT ";
sql1 = sql1 + " from vw_wms_stocktake vws ";
sql1 = sql1 + " left join v_op_bs vs on vs.BSNO=vws.ASSOCIATEDNO left join wms w on w.gid=vws.NID ";
sql1 = sql1 + " left join import_cargo c on c.gid=w.Cargo_gid ";
sql1 = sql1 + " left join import_main m on m.contractno=vs.BSNO ";
sql1 = sql1 + " left join Import_Saledetail sd on sd.CARGO_GID=w.Cargo_gid left join import_sales S on S.SALESNO =sd.SALESNO ";
sql1 = sql1 + _T;
sql1 = sql1 + " order by S.Saler,S.Customername ";
function GetDateStr(AddDayCount) {
var dd = new Date();
dd.setDate(dd.getDate() + AddDayCount); //获取AddDayCount天后的日期
var y = dd.getFullYear();
var m = dd.getMonth() + 1; //获取当前月份的日期
var d = dd.getDate();
return y + "-" + m + "-" + d;
}
//alert(GetDateStr(+5));
var printdate = GetDateStr(0);
var sql2 = "";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
}
});