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.

852 lines
29 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.WMSDetailIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.WMSDetailIndex.superclass.constructor.call(this);
};
Ext.extend(Shipping.WMSDetailIndex, Ext.Panel, {
PageSize: 500,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
initUIComponents: function () {
this.formname = "WMSDetailForm";
Ext.define('WMSDetailmb', {
extend: 'Ext.data.Model',
idProperty: '',
fields: [
{ name: 'NID', 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: 'date' },
{ name: 'DODATE_OUT', type: 'date' },
{ name: 'GOODSRKSL', type: 'string' },
{ name: 'GOODSRKSLACTUAL', type: 'string' },
{ name: 'GOODSPFSL_OUT', type: 'string' },
{ name: 'GOODSSTOCK', type: 'string' },
{ name: 'CHARGEUNIT', type: 'string' },
{ name: 'GOODSOUTFEE_OUT', type: 'string' },
{ name: 'GOODSOUTFEEAP_OUT', type: 'string' },
{ name: 'ARFEE', type: 'string' },
{ name: 'APFEE', type: 'string' },
{ name: 'ARFEE_OUT', type: 'string' },
{ name: 'APFEE_OUT', type: 'string' },
{ name: 'FREESTORAGEPERIOD', type: 'string' },
{ name: 'CONTRACTNO', type: 'string' },
{ name: 'GOODSPACK', type: 'string' },
{ 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' }
]
});
Ext.define('Tradermb', {
extend: 'Ext.data.Model',
idProperty: 'gid',
fields: [
{ name: 'gid', type: 'string' },
{ name: 'name', type: 'string' },
{ name: 'codename', type: 'string' }
]
});
//定义数据集
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'
});
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.storeCustWmsCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeCustWmsCode.load({ params: { condition: "ISWAREHOUSE='1'" } });
this.comboxCustWmsCode = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '仓 库',
store: this.storeCustWmsCode,
forceSelection: true,
id: 'STORAGENAME',
name: 'STORAGENAME',
valueField: 'CustName',
displayField: 'CodeAndName',
allowBlank: false,
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
for (var j = 0; j < _this.storeWMSIN.getCount(); j += 1) {
var memberbody = _this.storeWMSIN.getAt(j);
memberbody.set("STORAGENAME", combo.value);
};
}
}
}
});
/////////////////////////////////////////
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/WMSDetail/GetDataList',
//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,
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: 'GOODSNAME',
header: '品名',
width: 80
},
{
sortable: true,
dataIndex: 'GOODSSTANDARD',
header: '型号/牌号',
width: 80
},
{
sortable: true,
dataIndex: 'GOODSMODEL',
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
},
{
sortable: true,
dataIndex: 'GOODSRKSLACTUAL',
header: '实际入库量',
width: 80
},
{
sortable: true,
dataIndex: 'GOODSPFSL_OUT',
header: '出库量',
width: 80
},
{
sortable: true,
dataIndex: 'GOODSSTOCK',
header: '库存量',
width: 80
},
{
sortable: true,
dataIndex: 'CHARGEUNIT',
header: '计费单位',
width: 80
},
{
sortable: true,
dataIndex: 'GOODSOUTFEE_OUT',
header: '应收仓储费',
width: 80
},
{
sortable: true,
dataIndex: 'GOODSOUTFEEAP_OUT',
header: '应付仓储费',
width: 80
},
{
sortable: true,
dataIndex: 'ARFEE',
header: '入库应收装卸费',
width: 80
},
{
sortable: true,
dataIndex: 'APFEE',
header: '入库应付装卸费',
width: 80
},
{
sortable: true,
dataIndex: 'ARFEE_OUT',
header: '出库应收装卸费',
width: 80
},
{
sortable: true,
dataIndex: 'APFEE_OUT',
header: '出库应付装卸费',
width: 80
},
{
sortable: true,
dataIndex: 'FREESTORAGEPERIOD',
header: '免仓储期',
width: 80
},
{
sortable: true,
dataIndex: 'CONTRACTNO',
header: '合同号',
width: 80
},
{
sortable: true,
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
}
];
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: 'grouping',
groupHeaderTpl: '{name}',
hideGroupedHeader: false,
enableGroupingMenu: true
}],
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);
//使用者id表名 中间column数组
this.column.unshift(new Ext.grid.RowNumberer());
this.gridList.reconfigure(this.storeList, this.column);
////////////////////////////
//////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////
//#region formSearch
//#region formSearch枚举参照相关
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'
});
//#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'
}, {
fieldLabel: '货物名称',
name: 'GOODSNAME'
}, {
fieldLabel: '规格/牌号',
name: 'GOODSMODEL'
}, {
fieldLabel: '合同号',
name: 'CONTRACTNO'
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
this.comboxISCHANGE,
{
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: 'DODATEOUT_min'
}, {
fieldLabel: '到..出库日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'DODATEOUT_max'
}
//, { xtype: 'hiddenfield', flex: 1 }
]
}
]//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
}, {
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",
text: '费用入账',
tooltip: '锁定入库信息',
iconCls: "btnconfirm",
handler: function (button, event) {
this.LockWMS("1");
},
scope: this
}, '-', {
id: "btnUnLock",
text: '取消费用入账',
tooltip: '入库信息解除锁定',
iconCls: "btnrefuse",
handler: function (button, event) {
this.LockWMS("0");
},
scope: this
}
//,this.CB_EditMode
]
});
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 105,
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;
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 ) "} });
},
onRefreshClick: function (button, event) {
if (!this.checkSearchCondition())
return;
var sql = this.getCondition();
this.storeList.load({
params: { start: 0, limit: this.PageSize, 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 ISCHANGE = form.findField('ISCHANGE').getValue();
if (ISCHANGE == '全部') { }
if (ISCHANGE == '不含货转') { sql = sql + getAndConSql(sql, ISCHANGE, "v.ISCHANGE = " + 0 + ""); }
if (ISCHANGE == '只包括货转') { sql = sql + getAndConSql(sql, ISCHANGE, "v.ISCHANGE = " + 1 + ""); }
return sql;
},
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: "modImportSales",
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
}
,
LockWMS: function (Value) {
if (this.editRecord == null) {
alert("请先保存记录");
return;
}
if (this.editRecord.get('ISLOCK') == "True" && Value == "1") {
alert("已经入账,不能重复操作");
return;
}
if (this.editRecord.get('ISLOCK') == "False" && Value == "0") {
alert("目前没有入账,不能重复操作");
return;
}
var LockWMS = [];
Ext.MessageBox.confirm('提示', '确定要操作该入库信息吗?', function (btn) {
if (btn == 'yes') {
LockWMS.push(this.editRecord);
var LockWMSJSNO = ConvertRecordsToJsonAll(LockWMS);
var _this = this;
Ext.Ajax.request({//
waitMsg: '正在处理数据...',
url: '/MvcShipping/WMS/Lock',
params: {
data: LockWMSJSNO,
LOCK: Value
},
callback: function (options, success, response) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
alert(jsonresult.Message);
if (Value == "1") {
_this.editRecord.set("ISLOCK", "True");
var data = this.formEdit.getForm().getValues();
data.ISLOCK = "True";
this.formEdit.getForm().setValues(data);
} else {
_this.editRecord.set("ISLOCK", "False");
var data = this.formEdit.getForm().getValues();
data.ISLOCK = "False";
this.formEdit.getForm().setValues(data);
}
_this.editRecord.commit();
} else {
alert("操作失败" + jsonresult.Message);
}
},
scope: this
}); //request over
}
}, this);
} //onDeleteClick
});