//物资信息查询页面 define(function (require) { return function () { var $grid1, $grid2, $form; // 弹框的方式 var widgets = { // 搜索分类检索 selectCatalogWidget: { url: '/app/mat/widget/selectCatalog.js', bind: { matcId: 'matcId', matcName: 'matcName' }, queryParams: {matcBusi: MATC_BUSI_检验, status: 1} }, // 派工号 selectPmgPghWidget: { url: '/app/wms/widget/selectPmsPgh.js', bind: { pghId: 'pghId', pghCode: 'pghCode' }, widgetPrompt: "派工号编号" }, }; function enterQueryGrid1(e) { if (e.keyCode === 13) { var tmp = $(this).val(); $form.formSet({queryProperties: tmp}); queryGrid1(); } } function queryGrid1() { var queryUrl = '/wms/wmsOutPoolmat/queryStockMatMiss';// 自行替换此参数 $grid1.jqGrid("clearGridData"); var queryForm = $form.formGet(); $grid1.reload({ mtype: 'POST', url: api(queryUrl), queryParams: queryForm }, true); if ($grid2 != undefined && $grid2 != null) { $grid2.jqGrid("clearGridData"); } } function queryGrid2() { if ($grid2 == undefined || $grid2 == null) return; var row = $grid1.rowData(); if (!row) { $.yvan.msg('请先选择一行数据'); return; } var queryForm = $form.formGet(); queryForm.matId = row.matId; var queryUrl = '/wms/wmsOutPoolmat/queryStockMatMissBill';// 自行替换此参数 $grid2.reload({ mtype: 'POST', url: api(queryUrl), queryParams: queryForm }); } //获取库区 function getFarmList() { var _datas = []; _datas.push({ "id": '', "text": '全部' }) $.yvan.ajax({ url: api('/wms/whFarm/queryAll'), data: {}, method: 'post', async: false, success: function (data) { if (data.data != null && data.data != undefined) { for (var i = 0; i < data.data.length; i++) { _datas.push({ "id": data.data[i].farmId, "text": data.data[i].farmName }) } } } }); return _datas; } //获取车间信息 function getRoomList() { var _datas = [{"id": '', "text": '全部'}]; $.yvan.ajax({ url: api('/wms/wmsOutPoolmat/queryRoomByMiss'), method: 'post', async: false, success: function (data) { if (data.data != null && data.data != undefined) { for (var i = 0; i < data.data.length; i++) { _datas.push({ "id": data.data[i].roomId, "text": data.data[i].roomName }) } } } }); return _datas; } // 搜索按钮 var queryToolbarTitle = '库存缺件查询';// 自行替换此参数 var queryToolbar = { xtype: 'toolbar', title: queryToolbarTitle, items: [ { text: '查询', iconCls: 'fa fa-search', onClick: function () { queryGrid1(); } }, { text: '重置', iconCls: 'fa fa-refresh', onClick: function () { $form.formClear(); queryGrid1(); } }, { text: '关闭', iconCls: 'fa fa-times-circle', onClick: function () { App.closeMe(this); } } ] }; // 搜索条件 var queryFormPrompt = '物资编码/图号型号/物资名称';// 自行替换此参数 var queryForm = { onRender: function () { $form = $(this); }, xtype: 'form', items: [ [ {xtype: 'hidden', name: 'matcId'}, {xtype: 'hidden', name: 'corpId'}, {xtype: 'hidden', name: 'pghId'}, { xtype: 'searchbox', label: '派工号', name: 'pghCode', labelWidth: 'auto', width: 250, prompt: '派工号编号', widget: widgets.selectPmgPghWidget, onChange: function (data) { queryGrid1(); } }, { xtype: 'yvselect', label: '需求车间', name: 'roomId', labelWidth: 'auto', width: 240, data: getRoomList(), onChange: function () { queryGrid1(); } }, { xtype: 'yvselect', label: '需求阶段', name: 'outapType', labelWidth: 'auto', width: 180, value: '', data: $.yvan.sysDict('outapType').combowithAll(), onChange: function () { queryGrid1(); } }, { xtype: 'yvselect', label: '需求库区', name: 'farmId', labelWidth: 'auto', width: 200, value: '', data: getFarmList(), onChange: function () { queryGrid1(); } }, ], [ { xtype: 'yvselect', label: '物资分类', name: 'matType', labelWidth: 'auto', width: 180, data: $.yvan.sysDict('matType').combowithAll(), value: '', onChange: function () { queryGrid1(); } }, { xtype: 'textbox', label: '检索条件', name: 'queryProperties', prompt: queryFormPrompt, labelWidth: 'auto', width: 320, events: {keydown: enterQueryGrid1}, }, ], ] }; // 列表1增删改查按钮 var gridToolbarTitle1 = '缺件物资列表';// 自行替换此参数 var gridToolbar1 = { xtype: 'toolbar', title: gridToolbarTitle1, items: [ { text: '导出数据', iconCls: 'fa fa-cloud-upload', onClick: function () { var para = ""; if ($form.formGet().pghId != "") { para = (para == "") ? "" : para + "&"; para += "pghId=" + $form.formGet().pghId; } if ($form.formGet().outapType != "") { para = (para == "") ? "" : para + "&"; para += "outapType=" + $form.formGet().outapType; } if ($form.formGet().farmId != "") { para = (para == "") ? "" : para + "&"; para += "farmId=" + $form.formGet().farmId; } if ($form.formGet().roomId != "") { para = (para == "") ? "" : para + "&"; para += "roomId=" + $form.formGet().roomId; } if ($form.formGet().matType != "") { para = (para == "") ? "" : para + "&"; para += "matType=" + $form.formGet().matType; } if ($form.formGet().queryProperties != "") { para = (para == "") ? "" : para + "&"; para += "queryProperties=" + $form.formGet().queryProperties; } para = (para == "") ? "/wms/wmsOutPoolmat/exportStockMatMissExcel" : "/wms/wmsOutPoolmat/exportStockMatMissExcel?" + para; $.yvan.download({ method: 'get', url: api(para), fileName: "库存物资缺件统计表" + $.yvan.getMoment().format('YYYY-MM-DD HH:mm:ss') + '.xlsx' }); } }, ] }; return { north: { height: 135, split: true, border: false, items: [ queryToolbar, queryForm ] }, center: { height: '60%', split: true, items: { onRender: function () { $grid1 = $(this); queryGrid1(); }, xtype: 'grid', toolbar: gridToolbar1, autoSizeColumns: true, columns: [[ {title: '物资ID', field: 'matId', hidden: true}, {title: '物资分类', field: 'matType', formatter: $.fn.fmatter.matType, width: 80}, {title: '物资编码', field: 'matBar', width: 200}, {title: '图号/型号', field: 'matCode', width: 200}, {title: '物资名称', field: 'matName', width: 200}, {title: '物资编码属性', field: 'matAttrCode'}, {title: '计量单位', field: 'unitName'}, {title: '待发数', field: 'dfAmount', align: 'right', formatter: $.fn.fmatter.formatNumberBigDecimal}, {title: '库存数', field: 'stockAmount', align: 'right', formatter: $.fn.fmatter.formatNumberBigDecimal}, {title: '缺件数', field: 'missAmount', align: 'right', formatter: $.fn.fmatter.formatNumberBigDecimal}, //{title: '需求单据数', field: 'billAmount', align: 'right', formatter: $.fn.fmatter.formatNumberBigDecimal}, ]], onSelectRow: function (rowid) { queryGrid2(); } } }, south: { height: '40%', border: false, items: { xtype: 'tabs', items: [ { title: '需求单据列表', lazy: true, items: { onRender: function () { $grid2 = $(this); }, xtype: 'grid', autoSizeColumns: true, pagination: true, columns: [ [ {title: '需求单号', field: 'billCode', width: 140}, {title: '需求类型', field: 'outapType', align: 'center', formatter: $.fn.fmatter.outapType}, {title: '待发数', field: 'dfAmount', align: 'right', formatter: $.fn.fmatter.formatNumberBigDecimal}, {title: '缺件数', field: 'missAmount', align: 'right', formatter: $.fn.fmatter.formatNumberBigDecimal}, {title: '派工号', field: 'pghCode', width: 140}, {title: '需求库区', field: 'farmName', width: 200}, {title: '需求车间', field: 'roomName', width: 200}, {title: '申请人', field: 'takeUser'}, {title: '需求日期', field: 'dateUse', align: 'center', formatter: $.fn.fmatter.tsymd} ] ] } }, ] } } }; }; });