define(function (require) { return function () { var $grid1, $form; var widgets = { // 派工号 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 obj = $form.formGet(); var startTime = new Date(obj.startTime.replace("-", "/")); var endTime = new Date(obj.endTime.replace("-", "/")); if (startTime > endTime) { $.yvan.msg('起止日期必须大于起始日期'); return; } var queryUrl = '/wms/wmsOutWpfExcel/query';// 自行替换此参数 $grid1.jqGrid("clearGridData"); var queryForm1 = $form.formGet(); $grid1.reload({ mtype: 'post', url: api(queryUrl), queryParams: queryForm1 }, true); } //获取库区 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: '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: 'pkgId', labelWidth: 'auto', width: 180, value: '', data: $.yvan.sysDict('pkgId').combowithAll(), onChange: function () { queryGrid1(); } }, { xtype: 'yvselect', label: '需求库区', name: 'farmId', labelWidth: 'auto', width: 200, value: '', data: getFarmList(), onChange: function () { queryGrid1(); } }, { xtype: 'yvselect', label: '允许混批', name: 'batchMix', labelWidth: 'auto', width: 180, value: '', data: $.yvan.sysDict('batchMix').combowithAll(), 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: 450, events: {keydown: enterQueryGrid1} }, { name: 'startTime', label: '报表新增时间', prompt: '开始时间', xtype: 'datebox', labelWidth: 'auto', width: 230, onChange: function () { queryGrid1(); } }, { name: 'endTime', label: '至', prompt: '结束时间', xtype: 'datebox', labelWidth: 'auto', width: 170, onChange: function () { queryGrid1(); } }, ] ] }; // 列表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().pkgId != "") { para = (para == "") ? "" : para + "&"; para += "pkgId=" + $form.formGet().pkgId; } if ($form.formGet().roomId != "") { para = (para == "") ? "" : para + "&"; para += "roomId=" + $form.formGet().roomId; } 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().batchMix != "") { para = (para == "") ? "" : para + "&"; para += "batchMix=" + $form.formGet().batchMix; } if ($form.formGet().matType != "") { para = (para == "") ? "" : para + "&"; para += "matType=" + $form.formGet().matType; } if ($form.formGet().queryProperties != "") { para = (para == "") ? "" : para + "&"; para += "queryProperties=" + $form.formGet().queryProperties; } if ($form.formGet().startTime != "") { para = (para == "") ? "" : para + "&"; para += "startTime=" + $form.formGet().startTime; } if ($form.formGet().endTime != "") { para = (para == "") ? "" : para + "&"; para += "endTime=" + $form.formGet().endTime; } para = (para == "") ? "/wms/wmsOutWpfExcel/exportWmsOutWpfExcel" : "/wms/wmsOutWpfExcel/exportWmsOutWpfExcel?" + para; $.yvan.download({ method: 'get', url: api(para), fileName: "未配发项统计表" + $.yvan.getMoment().format('YYYY-MM-DD HH:mm:ss') + '.xlsx' }); } }, { text: '同步数据', iconCls: 'fa fa-arrow-circle-up', onClick: function () { $.yvan.confirm('确定同步数据吗?', { yes: function (index) { $.yvan.ajax({ method: 'post', url: api('/wms/wmsOutWpf/insert'), success: function (data) { $.yvan.msg('操作成功'); $grid1.reload(); } }); } }); } }, ] }; return { north: { height: 140, split: true, border: false, items: [ queryToolbar, queryForm, ] }, center: { height: '100%', split: true, items: { onRender: function () { $grid1 = $(this); queryGrid1(); }, xtype: 'grid', toolbar: gridToolbar1, columns: [[ {title: '需求单号', field: 'billCode'}, {title: '派工号', field: 'pghCode'}, { title: '成套类型', field: 'pkgId', align: 'center', formatter: function (value, row) { if (value == 0) { return " " } else { return $.fn.fmatter.pkgId(value) } } }, {title: '需求阶段', field: 'outapType', align: 'center', formatter: $.fn.fmatter.outapType}, {title: '需求车间', field: 'roomName'}, {title: '库区', field: 'farmName'}, {title: '取货方式', field: 'shipType', align: 'center', formatter: $.fn.fmatter.shipType}, {title: '物资清册', field: 'matQingce', align: 'center', formatter: $.fn.fmatter.matQingce}, {title: '物资类型', field: 'matType', align: 'center', formatter: $.fn.fmatter.matType}, {title: '允许混批', field: 'batchMix', align: 'center', formatter: $.fn.fmatter.batchMix}, {title: '物资编码', field: 'matBar'}, {title: '图号/型号', field: 'matCode'}, {title: '物资名称', field: 'matName'}, {title: '物资编码属性', field: 'matAttrCode'}, { title: '未配发数量', field: 'wpfAmount', align: 'right', formatter: $.fn.fmatter.formatNumberBigDecimal, }, { title: '收货间待检验数量', field: 'djyAmount', align: 'right', formatter: $.fn.fmatter.formatNumberBigDecimal, }, { title: '收货间检验不合格数量', field: 'jybhgAmount', align: 'right', formatter: $.fn.fmatter.formatNumberBigDecimal, }, { title: '待上架数量', field: 'dsjAmount', align: 'right', formatter: $.fn.fmatter.formatNumberBigDecimal, }, { title: '架上合格数量', field: 'jshgAmount', align: 'right', formatter: $.fn.fmatter.formatNumberBigDecimal, }, { title: '架上超期数量', field: 'jsbhgAmount', align: 'right', formatter: $.fn.fmatter.formatNumberBigDecimal, }, { title: '三期业务中数量', field: 'sqAmount', align: 'right', formatter: $.fn.fmatter.formatNumberBigDecimal, }, { title: '已配发未领用数量', field: 'ypfwlyAmount', align: 'right', formatter: $.fn.fmatter.formatNumberBigDecimal, }, { title: '需求数量', field: 'xqAmount', align: 'right', formatter: $.fn.fmatter.formatNumberBigDecimal, }, {title: '计量单位', field: 'unitName'}, {title: '计划价', field: 'planPrice', align: 'right', formatter: $.fn.fmatter.formatCurrency}, {title: '计划金额', field: 'planMoney', align: 'right', formatter: $.fn.fmatter.formatCurrency}, {title: '安装部位', field: 'usePart'}, {title: '安装数量', field: 'useAmount', formatter: $.fn.fmatter.formatNumberBigDecimal,}, {title: '工艺规程', field: 'techName'}, {title: '工卡', field: 'cardTechId'}, {title: '需求班组', field: 'teamName'}, {title: '工作者', field: 'userWorkName'}, {title: '技术员', field: 'userTechName'}, {title: '需求截止时间', field: 'stockDateEnd', align: 'center'}, {title: '需求通过审核时间', field: 'stockDateStart', align: 'center'}, {title: '报表新增时间', field: 'timeCreate', align: 'center'}, ]] } } }; }; });