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/WMSImport/WMSImportDetailIndex.js

1290 lines
46 KiB
JavaScript

2 years ago
//进口贸易出入库明细查询
Ext.namespace('Shipping');
Shipping.WMSImportDetailIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.WMSImportDetailIndex.superclass.constructor.call(this);
};
Ext.extend(Shipping.WMSImportDetailIndex, Ext.Panel, {
PageSize: 500,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
sqlcontext: '',
initUIComponents: function () {
this.sqlcontext = "";
this.formname = "WMSImportDetailForm";
Ext.define('WMSDetailmb', {
extend: 'Ext.data.Model',
idProperty: '',
fields: [
{ name: 'NID', type: 'string' },
{ name: 'GID', type: 'string' },
{ name: 'BLNO', type: 'string' },
{ name: 'CUSTOMNO', type: 'string' },
{ name: 'CUSTOMERNAME', type: 'string' },
{ name: 'STORAGENAME', type: 'string' },
{ name: 'GOODSNAME', type: 'string' },
{ name: 'GOODSSTANDARD', type: 'string' },
{ name: 'GOODSMODEL', type: 'string' },
{ name: 'WMSNO', type: 'string' },
{ name: 'OUTBSNO_OUT', type: 'string' },
{ name: 'BSNO_OUT', type: 'string' },
{ name: 'WMSDATE', type: 'string' },
{ name: 'DODATE_OUT', type: 'string' },
{ name: 'GOODSRKSL', type: 'number' },
{ name: 'GOODSRKSLACTUAL', type: 'number' },
{ name: 'GOODSPFSL_OUT', type: 'number' },
{ name: 'GOODSSTOCK', type: 'number' },
{ name: 'CHARGEUNIT', type: 'string' },
{ name: 'GOODSOUTFEE_OUT', type: 'number' },
{ name: 'GOODSOUTFEEAP_OUT', type: 'number' },
{ name: 'ARFEE', type: 'number' },
{ name: 'APFEE', type: 'number' },
{ name: 'ARFEE_OUT', type: 'number' },
{ name: 'APFEE_OUT', type: 'number' },
{ name: 'FREESTORAGEPERIOD', type: 'string' },
{ name: 'CONTRACTNO', type: 'string' },
{ name: 'GOODSPACK', type: 'number' },
{ name: 'TRUCKNO_OUT', type: 'string' },
{ name: 'REMARK_OUT', type: 'string' },
{ name: 'MODIFIEDUSER', type: 'string' },
{ name: 'MODIFIEDTIME', type: 'string' },
{ name: 'CREATEUSER_OUT', type: 'string' },
{ name: 'CREATETIME_OUT', type: 'string' },
{ name: 'CNTRNO', type: 'string' },
{ name: 'ISLOCK', type: 'string' },
{ name: 'COSTPRICE', type: 'string' },
{ name: 'COSTPRICE_EX', type: 'string' },
{ name: 'COSTCARGO', type: 'number' },
{ name: 'LOCKTIME', type: 'string' },
{ name: 'LOCKUSER', type: 'string' },
{ name: 'Inspection_Storage', type: 'string' },
{ name: 'inspection_date', type: 'string' },
{ name: 'Unsealdate', type: 'string' },
{ name: 'Agent', type: 'string' },
{ name: 'SALEINFO', type: 'string' },
{ name: 'Country_Ref', type: 'string' },
{ name: 'MainStateRef', type: 'string' },
{ name: 'CargoType', type: 'string' },
{ name: 'PAYCOMPANY', type: 'string' },
{ name: 'MOREORLESS', type: 'string' },
{ name: 'MOREORLESSCOUNT', type: 'number' },
{ name: 'PUTINTYPE', type: 'string' }
]
});
Ext.define('Tradermb', {
extend: 'Ext.data.Model',
idProperty: 'gid',
fields: [
{ name: 'gid', type: 'string' },
{ name: 'name', type: 'string' },
{ name: 'codename', type: 'string' }
]
});
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.onRefreshClick();
}
}
}
});
//定义数据集
this.storeCustomerName = Ext.create('DsExt.ux.RefTableStore', {
model: 'Tradermb',
proxy: { url: '/CommMng/BasicDataRef/GetTrader' }
});
this.storeCustomerName.load({ params: { condition: ""} });
this.comboxCustomerName = Ext.create('DsExt.ux.RefTableCombox', {
//fieldLabel: '客户',
id: "CustomerName", //hidden: true,
forceSelection: true,
store: this.storeCustomerName,
name: 'CUSTOMERNAME',
valueField: 'name',
displayField: 'codename'
});
/////////////////////////////////////////
this.storeList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'WMSDetailmb',
remoteSort: true,
//groupField: 'CUSTOMERNAME',
proxy: {
type: 'ajax',
//url: '/TruckMng/MsRptPcHeadOperate/QryData_ADL',
url: '/MvcShipping/WMSImportDetail/GetDataList_Import',
//this.storeList.proxy.url = '/TruckMng/MsRptPcHeadOperate/QryData_ADL';
reader: {
id: '',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.column = [
{
sortable: true, hidden: true,
dataIndex: 'NID',
header: 'NID',
width: 80
}, {
sortable: true, hidden: true,
dataIndex: 'GID',
header: 'GID',
width: 80
}, {
dataIndex: 'ISLOCK',
header: '已锁定',
width: 60,
renderer: function (value, cellmeta) {
if (value == "1") {
return "<img src='../../../../TruckMng/Content/Images/Lock.png' />";
}
if (value == "2") {
return "<img src='../../../../TruckMng/Content/Images/yes.png' />";
}
if (value == "6") {
return "<img src='../../../../TruckMng/Content/Images/no.png' />";
}
}
},
{
sortable: true,
dataIndex: 'BLNO',
header: '提单号',
width: 80
}, {
sortable: true,
dataIndex: 'CNTRNO',
header: '箱号',
width: 80
},
{
sortable: true,
dataIndex: 'CUSTOMNO',
header: '备案清单号',
width: 80
},
{
sortable: true,
dataIndex: 'CONTRACTNO',
header: '合同号',
width: 80
},
{
sortable: true,
dataIndex: 'CUSTOMERNAME',
header: '货主',
width: 80
},
{
sortable: true,
dataIndex: 'STORAGENAME',
header: '仓库名称',
width: 80
},
{
sortable: true,
dataIndex: 'PUTINTYPE',
header: '入库类型',
width: 80
},
{
sortable: true,
dataIndex: 'GOODSNAME',
header: '品名',
width: 80
},
{
sortable: true,
dataIndex: 'GOODSSTANDARD',
header: '型号/牌号',
width: 80
},
{
sortable: true,
dataIndex: 'GOODSMODEL',
header: '规格/牌号',
width: 80
},
{
sortable: true, align: 'right',
dataIndex: 'COSTPRICE_EX',
header: '预计价格',
width: 80
},
{
sortable: true, align: 'right',
dataIndex: 'COSTPRICE',
header: '实际入库价格',
width: 80
},
{
sortable: true, align: 'right', summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00'),
dataIndex: 'COSTCARGO',
header: '总成本',
width: 80
},
{
sortable: true,
dataIndex: 'WMSNO',
header: '入库单号',
width: 80
},
{
sortable: true,
dataIndex: 'OUTBSNO_OUT',
header: '出库单号',
width: 80
},
{
sortable: true,
dataIndex: 'BSNO_OUT',
header: '出库明细单号',
width: 80
},
{
sortable: true,
dataIndex: 'WMSDATE',
header: '入库日期',
width: 80
},
{
sortable: true,
dataIndex: 'DODATE_OUT',
header: '出库日期',
width: 80
},
{
sortable: true,
dataIndex: 'GOODSRKSL',
header: '入库量',
width: 80, summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00000'),
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 5, '', true);
return value;
}
},
/*{
sortable: true,
dataIndex: 'GOODSRKSLACTUAL',
header: '实际入库量',
width: 80, summaryType: 'sum',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 5, '', true);
return value;
}
},*/
{
sortable: true,
dataIndex: 'GOODSPFSL_OUT',
header: '出库量',
width: 80, summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00000'),
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 5, '', true);
return value;
}
},
{
sortable: true,
dataIndex: 'GOODSSTOCK',
header: '库存量',
width: 80, summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00000'),
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 5, '', true);
return value;
}
},
{
sortable: true,
dataIndex: 'CHARGEUNIT',
header: '计费单位',
width: 80
},
{
sortable: true, summaryType: 'sum',
dataIndex: 'GOODSOUTFEE_OUT',
header: '应收仓储费',
width: 80
},
{
sortable: true, summaryType: 'sum',
dataIndex: 'GOODSOUTFEEAP_OUT',
header: '应付仓储费',
width: 80
},
{
sortable: true, summaryType: 'sum',
dataIndex: 'ARFEE',
header: '入库应收装卸费',
width: 80
},
{
sortable: true, summaryType: 'sum',
dataIndex: 'APFEE',
header: '入库应付装卸费',
width: 80
},
{
sortable: true, summaryType: 'sum',
dataIndex: 'ARFEE_OUT',
header: '出库应收装卸费',
width: 80
},
{
sortable: true, summaryType: 'sum',
dataIndex: 'APFEE_OUT',
header: '出库应付装卸费',
width: 80
},
{
sortable: true,
dataIndex: 'FREESTORAGEPERIOD',
header: '免仓储期',
width: 80
},
/*{
sortable: true,
dataIndex: 'CONTRACTNO',
header: '合同号',
width: 80
},*/
{
sortable: true, summaryType: 'sum',
dataIndex: 'GOODSPACK',
header: '件数',
width: 80
},
{
sortable: true,
dataIndex: 'TRUCKNO_OUT',
header: '车号',
width: 80
},
{
sortable: true,
dataIndex: 'REMARK_OUT',
header: '出库备注',
width: 80
},
{
sortable: true,
dataIndex: 'MODIFIEDUSER',
header: '入库操作人',
width: 80
},
{
sortable: true,
dataIndex: 'MODIFIEDTIME',
header: '入库操作时间',
width: 80
},
{
sortable: true,
dataIndex: 'CREATEUSER_OUT',
header: '出库操作人',
width: 80
},
{
sortable: true,
dataIndex: 'CREATETIME_OUT',
header: '出库操作时间',
width: 80
},
{
sortable: true,
dataIndex: 'LOCKUSER',
header: '锁定人',
width: 80
},
{
sortable: true,
dataIndex: 'LOCKTIME',
header: '锁定时间',
width: 80
}, {
sortable: true,
dataIndex: 'Inspection_Storage',
header: '是否商检慢检',
width: 80,
renderer: function (value, cellmeta) {
if (value == "1") {
return "是";
}
if (value == "0") {
return "";
}
}
},
{
sortable: true,
dataIndex: 'inspection_date',
header: '商检验货日',
width: 80
},
{
sortable: true,
dataIndex: 'Unsealdate',
header: '商检放行日',
width: 80
},
{
sortable: true,
dataIndex: 'Agent',
header: '代理公司',
width: 80
},
{
sortable: true,
dataIndex: 'SALEINFO',
header: '销售信息',
width: 200
},
{
sortable: true,
dataIndex: 'Country_Ref',
header: '国家',
width: 80
},
{
sortable: true,
dataIndex: 'MainStateRef',
header: '合同状态',
width: 80
},
{
sortable: true,
dataIndex: 'CargoType',
header: '商品类型',
width: 80
},
{
sortable: true, align: 'left',
dataIndex: 'PAYCOMPANY',
header: '付款公司',
width: 100
},
{
sortable: true, align: 'right',
dataIndex: 'MOREORLESS',
header: '短装重量',
width: 100
},
{
sortable: true, align: 'right', summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00'),
dataIndex: 'MOREORLESSCOUNT',
header: '短装件数',
width: 100
}
];
this.cellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.MainCB = Ext.create('Ext.selection.CheckboxModel', { checkOnly: true });
Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, {
width: 40
});
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
selModel: this.MainCB,
columns: this.column,
plugins: [this.cellEditing],
features: [{
//id: 'group',
ftype: 'summary'//,
//groupHeaderTpl: '{name}',
//hideGroupedHeader: false,
//enableGroupingMenu: true
}],
bbar: [Ext.create('Ext.PagingToolbar', {
id: "bbar",
store: this.storeList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
}), this.Pagenum]
});
/////////////以下部分为获取存储的gridpanel显示样式
this.column = DsTruck.GetGridPanel(USERID, this.formname, this.column);
//使用者id表名 中间column数组
this.column.unshift(new Ext.grid.RowNumberer());
this.gridList.reconfigure(this.storeList, this.column);
////////////////////////////
//////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////
//#region formSearch
//#region formSearch枚举参照相关
_this = this;
//入库类型
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': '直入客户名下'}]
}),
forceSelection: true,
id: 'PUTINTYPE',
name: 'PUTINTYPE',
valueField: 'value',
displayField: 'text',
value: ''
});
this.storeCustCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsTruckMng.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeCustCode.load({ params: { condition: ""} });
this.comboxCustCode = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '客户名称',
typeAhead: true,
store: this.storeCustCode,
name: 'CUSTOMERNAME',
valueField: 'CustName',
displayField: 'CodeAndName',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.storeWMSStatus = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeWMSStatus.load({ params: { enumTypeId: 37} });
this.comboxWMSStatus = Ext.create('Ext.ux.form.field.BoxSelect', {
fieldLabel: '入库状态',
autosize: true,
bodyPadding: 1,
flex: 2,
width: 80,
labelWidth: 90,
store: this.storeWMSStatus,
queryMode: 'local',
triggerOnClick: false,
valueField: 'EnumValueId',
displayField: 'EnumValueName',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
//,value: ['TX', 'CA']
});
Ext.define('CargoTypemb', {
extend: 'Ext.data.Model',
fields: [
{ name: 'Type', type: 'string' }
]
});
var CargoTypeData = [{ "Type": "牛" },
{ "Type": "羊" },
{ "Type": "猪" },
{ "Type": "鸡"}];
this.storeCargoType = Ext.create('Ext.data.Store', {
model: 'CargoTypemb',
data: CargoTypeData
});
this.comboxCargoType = Ext.create('Ext.ux.form.field.BoxSelect', {
fieldLabel: '货物类型',
autosize: true,
bodyPadding: 5,
flex: 2,
//width: 500,
//labelWidth: 90,
store: this.storeCargoType,
queryMode: 'local',
triggerOnClick: false,
valueField: 'Type',
displayField: 'Type',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
//#endregion
this.formSearch = Ext.widget('form', {
frame: true,
region: 'center',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 85,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: []
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
this.comboxCustCode
, {
fieldLabel: '箱号',
name: 'CNTRNO',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '货物名称',
name: 'GOODSNAME',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '规格/牌号',
name: 'GOODSMODEL',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '合同号',
name: 'CONTRACTNO',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '从..入库日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'WMSDATE_min',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '到..入库日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'WMSDATE_max',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '从..出库日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'DODATEOUT_min',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '到..出库日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'DODATEOUT_max',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}
, { xtype: 'hiddenfield', flex: 1 }
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
this.comboxWMSStatus
, this.comboxCargoType,
this.comboxPUTINTYPE
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
//#endregion formSearch
var menu1 = new Ext.menu.Menu({
id: 'basicMenu',
items: [{
text: '批量设为完成',
handler: clickEnd
}, {
text: '批量设为未完成',
handler: clickNotEnd
}]
});
function clickEnd() {
panelTest.SetEnd("1");
};
function clickNotEnd() {
panelTest.SetEnd("0");
};
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [
{
text: "新建", id: "btnadd", hidden: true,
iconCls: "btnadd",
handler: function (button, event) {
//this.OprationStatus = 'add';
//DsOpenEditWin("/TruckMng/MsWlPc/Edit_ADL", "", "700", "1000");
this.onAddPCClick();
},
scope: this
}, {
text: "删除", id: "btndelete", hidden: true,
iconCls: "btndelete",
handler: function (button, event) {
this.onDeleteClick(button, event);
},
scope: this
}, '-',
{
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
}, '-', /*{
id: "btnFeeAuditReject",
text: '驳回提交费用业务',
tooltip: '驳回提交费用业务',
iconCls: "btnrefuse",
handler: function (button, event) {
this.onAuditRefuseClick(button, event);
},
scope: this
},
{text: "批量设置完成", menu: menu1, scope: this },*/
{
text: "保存列表样式",
id: "btntest",
handler: function (button, event) {
var formname = this.formname;
var tempcolumns = this.gridList.columns;
DsTruck.SaveGridPanel(USERID, formname, tempcolumns, this.column, 0, false);
},
scope: this
}, {
text: "保存修改", id: "SaveBtn", hidden: true,
iconCls: "btnsave",
handler: function (button, event) {
this.onSaveClick(button, event);
},
scope: this
}, '-', {
id: "btnLock", //hidden:true,
text: '确认费用入账',
tooltip: '对已经提交的入库信息进行锁定',
iconCls: "btnconfirm",
handler: function (button, event) {
this.WMSLock(button, event);
},
scope: this
}, '-', {
id: "btnUnLock", //hidden: true,
text: '取消费用入账',
tooltip: '入库信息解除锁定',
iconCls: "btnrefuse",
handler: function (button, event) {
this.WMSUnLock(button, event);
},
scope: this
}
//,this.CB_EditMode
]
});
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 125,
items: [this.formSearch, this.panelBtn]
});
Ext.apply(this, {
items: [this.panelTop, this.gridList, this.gridList_edit]
});
///以下集中绑定事件
this.storeList.on('beforeload', function (store) {
if (!this.checkSearchCondition())
return;
this.PageSize = this.Pagenum.getValue();
var sql = this.getCondition();
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
this.gridList.on('edit', function (editor, e, eOpts) {
this.PCAfterEdit(editor, e, eOpts);
}, this);
this.cellEditing.on('beforeedit', function (editor, e) {
return this.PCBeforeEdit(editor, e);
}, this);
this.LoadInitData();
}, //end initUIComponents
LoadInitData: function () {
//this.storeTruckNo.load({ params: { condition: " A.truckno not in (select DISTINCT truckno from tMsWlPcHead where isnull(isend,0)=0 ) "} });
this.SetBtnState();
},
onRefreshClick: function (button, event) {
if (!this.checkSearchCondition())
return;
this.PageSize = this.Pagenum.getValue();
var sql = this.getCondition();
this.sqlcontext = sql;
this.storeList.load({
params: { start: 0, limit: this.PageSize, condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
//}
},
onDsQuery: function () {
//var girdcolums = this.gridList.getColumnMode();
this.PageSize = this.Pagenum.getValue();
var sql = this.sqlcontext;
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
},
getCondition: function () {
var form = this.formSearch.getForm();
var sql = '';
//客户名称
var CUSTOMERNAME = form.findField('CUSTOMERNAME').getValue();
sql = sql + getAndConSql(sql, CUSTOMERNAME, " V.CUSTOMERNAME='" + CUSTOMERNAME + "'");
//CNTRNO
var CNTRNO = form.findField('CNTRNO').getValue();
sql = sql + getAndConSql(sql, CNTRNO, " v.gid in(select ASSOCIATEDNO from wms_in where CNTRNO like '%" + CNTRNO + "%') ");
//GOODSNAME
var GOODSNAME = form.findField('GOODSNAME').getValue();
sql = sql + getAndConSql(sql, GOODSNAME, " V.GOODSNAME like '%" + GOODSNAME + "%' ");
//GOODSMODEL
var GOODSMODEL = form.findField('GOODSMODEL').getValue();
sql = sql + getAndConSql(sql, GOODSMODEL, " V.GOODSMODEL like '%" + GOODSMODEL + "%' ");
//CONTRACTNO
var CONTRACTNO = form.findField('CONTRACTNO').getValue();
sql = sql + getAndConSql(sql, CONTRACTNO, " V.CONTRACTNO like '%" + CONTRACTNO + "%' ");
var WMSDATE_min = form.findField('WMSDATE_min').getRawValue();
sql = sql + getAndConSql(sql, WMSDATE_min, " v.WMSDATE>='" + WMSDATE_min + "'");
var WMSDATE_max = form.findField('WMSDATE_max').getRawValue();
sql = sql + getAndConSql(sql, WMSDATE_max, " v.WMSDATE<='" + WMSDATE_max + " 23:59:59'");
var DODATEOUT_min = form.findField('DODATEOUT_min').getRawValue();
sql = sql + getAndConSql(sql, DODATEOUT_min, " v.DODATE_OUT>='" + DODATEOUT_min + "'");
var DODATEOUT_max = form.findField('DODATEOUT_max').getRawValue();
sql = sql + getAndConSql(sql, DODATEOUT_max, " v.DODATE_OUT<='" + DODATEOUT_max + " 23:59:59'");
var WMSSTATUS = this.comboxWMSStatus.getValue();
if (WMSSTATUS != "") {
sql = sql + getAndConSql(sql, WMSSTATUS, " v.ISLOCK in( " + WMSSTATUS + ")");
}
var CargoType = this.getStrValue(this.comboxCargoType.getValue());
sql = sql + getAndConSql(sql, CargoType, " (select cargotype from Import_cargo where gid=v.Cargo_gid) in (" + CargoType + ")");
var PutInType = this.getStrValue(this.comboxPUTINTYPE.getValue());
var pit = PutInType.toString();
pit = pit.replace(/,/g, "");
pit = pit.replace(/'/g, "");
sql = sql + getAndConSql(sql, pit, " putintype like '%" + pit + "%'");
return sql;
},
getStrValue: function (list) {
var _list = [];
for (var _i = 0; _i < list.length; _i++) {
_list.push("'" + list[_i] + "'");
}
return _list;
},
checkSearchCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return false;
}
return true;
},
OprationSwap: function () {
var ret = new Array();
ret[0] = this.OprationStatus;
ret[1] = this.storeList;
ret[2] = this.SelectedRecord;
if (this.OprationStatus == "add") {
ret[3] = "";
} else {
ret[3] = this.SelectedRecord.data.REFBILLNO;
}
ret[4] = "MsRptPcHeadQryIndex";
ret[5] = formtype;
return ret;
},
onExportClick: function (button, event) {
GridExportExcelPage(this.gridList);
},
SetBtnState: function () {
var me = this;
//此处用于北京二商项目的财务部门 在此处入账、解除入账出入库信息
Ext.Ajax.request({
waitMsg: '正在查询用户权限...',
url: '/CommMng/BasicDataRef/GetAuthorityRange',
params: {
modName: "modWMSLOCKAudit",
USERID: USERID
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
rec = result.data;
//alert(rec.VISIBLERANGE);
//alert(rec.OPERATERANGE);
//可视范围无限制。
//可操作为0则全都可见
//4为所有按钮均不可见只能查询
//3为特殊账户可以编辑不可添加预收可以加销售单审销售单
//2为业务只能新增删除销售单不能操作预收
//1为财务可以新建删除预收审批销售出库不可操作销售单
this.VISIBLERANGE = rec.VISIBLERANGE;
this.OPERATERANGE = rec.OPERATERANGE;
if (this.OPERATERANGE == '1' || this.OPERATERANGE == '0') {
Ext.getCmp("btnLock").enable();
Ext.getCmp("btnUnLock").enable();
} else {
Ext.getCmp("btnLock").disable();
Ext.getCmp("btnUnLock").disable();
}
}
else
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
},
scope: this
}); //request over
}
, WMSLock: function (button, event) { //生成入库信息
//20160707 修改
//如无对应销售信息,货主为操作者的“本公司”
//如有对应销售信息,则首先判断销售重量是否大于等于实际入库重量。
//如剩余重量小于等于1kg则全部按销售重量和销售客户按比例生成。
//如剩余重量大于1kg则剩余部分按货主为操作者的“本公司”处理。
/*
var selectedRecords = this.gridList.selModel.getSelection();
var WMSGIDList = "";
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (rec.data.ISLOCK == "1") {
alert("注意,已经锁定的货物信息不可重复锁定");
} else
if (WMSGIDList == "") {
WMSGIDList = "" + rec.data.GID + "";
} else {
WMSGIDList = WMSGIDList + "," + rec.data.GID + "";
}
}
if (WMSGIDList == "") {
return;
}*/
var LockWMS = [];
Ext.MessageBox.confirm('提示', '确定要操作选中的入库信息吗?', function (btn) {
if (btn == 'yes') {
var selectedRecords = this.gridList.selModel.getSelection();
if (selectedRecords.length > 0) {
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (rec.data.ISLOCK == "2") //没有保存的数据无法锁定
{
LockWMS.push(rec);
}
}
}
if (LockWMS.length == 0) {
return;
}
var LockWMSJSNO = ConvertRecordsToJsonAll(LockWMS);
_this = this;
Ext.Ajax.request({//
waitMsg: '正在处理数据...',
url: '/MvcShipping/WMS/Audit',
params: {
WMSList: LockWMSJSNO
},
callback: function (options, success, response) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
alert(jsonresult.Message);
} else {
alert("操作失败" + jsonresult.Message);
}
var sql = this.getCondition();
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
},
scope: this
}); //request over
}
}, this);
}
, WMSUnLock: function (button, event) {
//如果相关库存信息已经“费用入账”
//则不允许进行解锁操作
var selectedRecords = this.gridList.getSelectionModel().getSelection();
if (selectedRecords.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择商品!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var LockWMS = [];
var WMSGIDList = "";
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (rec.data.ISLOCK == "1") {
Ext.Ajax.request({
waitMsg: '正在查询数据...',
url: '/MvcShipping/WMS/GetCargoOut',
scope: this,
async: false,
params: { WMSGID: rec.data.GID },
waitMsg: "正在查询数据...",
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
var returnData = jsonresult.data;
//alert(returnData.Count);
this.ChfeeCount = parseInt(returnData.Count);
if (returnData > 0) {
alert("<" + record.data.name + ">的库存已经产生出库,不能进行解锁。");
return;
} else {
LockWMS.push(rec);
}
} else {
Ext.Msg.show({ title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
return;
}
}
});
}
}
if (LockWMS == []) {
return;
}
var LockWMSJSNO = ConvertRecordsToJsonAll(LockWMS);
var _L = selectedRecords.length;
Ext.MessageBox.confirm('提示', '确定解锁这' + _L + '条记录吗?', function (btn) {
if (btn == 'yes') {
_this = this;
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/MvcShipping/WMS/AuditBack',
scope: this,
params: {
WMSList: LockWMSJSNO
},
callback: function (options, success, response) {
if (success) {
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
GID = rec.data.GID;
for (var j = 0; j < this.storeList.getCount(); j += 1) {
if (this.storeCargo.getAt(i).get("GID") == GID) {
this.storeCargo.getAt(i).set("ISLOCK", "6");
}
}
}
} else {
Ext.Msg.show({ title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
//alert('03');
}
});
};
Ext.Msg.show({ title: '提示', msg: "数据处理结束", icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
this.onRefreshClick(button, event);
}, this);
}
});