123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265 |
- define(function (require) {
- return function () {
- var $grid1, $grid2, $form;
- var widgets = {
- // 搜索企业
- selectCorpWidget: {
- url: '/app/wms/widget/selectOrgCorp.js',
- bind: {
- corpId: 'corpId',
- corpName: 'corpName'
- },
- widgetPrompt: "供应商名称"
- },
- };
- function enterQueryGrid1(e) {
- if (e.keyCode === 13) {
- var tmp = $(this).val();
- $form.formSet({queryProperties: tmp});
- queryGrid1();
- }
- }
- // 查询列表
- function queryGrid1() {
- var queryUrl = '/wms/wmsIn/selectAbnormalList';// 自行替换此参数
- $grid1.jqGrid("clearGridData");
- var queryForm = $form.formGet();
- $grid1.reload({
- mtype: 'POST',
- url: api(queryUrl),
- queryParams: queryForm
- }, true);
- if ($grid2 != undefined) {
- $grid2.jqGrid("clearGridData");
- }
- }
- function queryGrid2(rowid) {
- var row = $grid1.rowData(rowid);
- if (!row) {
- $.yvan.msg('请先选择一行数据');
- return;
- }
- var queryUrl = '/wms/wmsIn/selectAbnormalMatList';// 自行替换此参数
- var queryData = {inId: row.inId};// 多个参数自行新增
- $grid2.reload({
- mtype: 'POST',
- url: api(queryUrl),
- queryParams: queryData
- });
- }
- // 搜索按钮
- 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: 'textbox',
- label: '检索条件',
- name: 'queryProperties',
- prompt: queryFormPrompt,
- labelWidth: 'auto',
- events: {keydown: enterQueryGrid1},
- },
- {
- xtype: 'yvselect', label: '入库类型', name: 'inType', labelWidth: 'auto', width: 180, value: '',
- data: $.yvan.sysDict('inType').combowithAll(),
- onChange: function () {
- queryGrid1();
- }
- },
- {xtype: 'hidden', name: 'corpId'},
- {
- xtype: 'searchbox', label: '供应商', name: 'corpName', labelWidth: 'auto', width: 280, prompt: '供应商名称',
- widget: widgets.selectCorpWidget,
- onChange: function (data) {
- queryGrid1();
- }
- },
- {
- xtype: 'datebox', label: '收货日期', name: 'pubTimeStart', labelWidth: 'auto', width: 220,
- onChange: function () {
- var pubTimeStart = $form.formGet().pubTimeStart;
- var pubTimeEnd = $form.formGet().pubTimeEnd;
- var pubTimeStart = new Date(pubTimeStart.replace("-", "/"));
- var pubTimeEnd = new Date(pubTimeEnd.replace("-", "/"));
- if (pubTimeStart > pubTimeEnd) {
- $.yvan.msg('起始日期必须小于起止日期');
- return;
- }
- queryGrid1();
- }
- }, {
- xtype: 'datebox', label: '-', name: 'pubTimeEnd', labelWidth: 'auto', width: 180,
- onChange: function (data) {
- var pubTimeStart = $form.formGet().pubTimeStart;
- var pubTimeEnd = $form.formGet().pubTimeEnd;
- var pubTimeStart = new Date(pubTimeStart.replace("-", "/"));
- var pubTimeEnd = new Date(pubTimeEnd.replace("-", "/"));
- if (pubTimeStart > pubTimeEnd) {
- $.yvan.msg('起止日期必须大于起始日期');
- return;
- }
- queryGrid1();
- }
- },
- ]]
- };
- // 列表1增删改查按钮
- var gridToolbarTitle1 = '异常收货单列表';// 自行替换此参数
- var gridToolbar1 = {
- xtype: 'toolbar',
- title: gridToolbarTitle1,
- items: []
- };
- // 列表2增删改查按钮
- var gridToolbarTitle2 = '物资列表';// 自行替换此参数
- var gridToolbar2 = {
- xtype: 'toolbar',
- title: gridToolbarTitle2,
- };
- return {
- north: {
- height: 90,
- split: true,
- border: false,
- items: [
- queryToolbar,
- queryForm
- ]
- },
- center: {
- width: "55%",
- split: true,
- items: {
- onRender: function () {
- $grid1 = $(this);
- queryGrid1();
- },
- xtype: 'grid',
- toolbar: gridToolbar1,
- idField: 'inapId',
- columns: [[
- {title: '对应收货单ID', field: 'inId', hidden: true},
- {title: '到货单ID', field: 'inapId', hidden: true},
- {title: '收货单', field: 'billCode', align: "center"},
- {title: '到货单', field: 'billCodeInApply', align: "center"},
- {title: '入库类型', field: 'inType', hidden: true},
- {
- title: '入库类型', field: 'inTypeCN', align: "center", formatter: function (value, data) {
- return $.fn.fmatter.inTypeSrc(data.rowData.inType);
- }
- },
- {title: '异常物资项', field: 'matNum', align: "right"},
- {title: '计划金额', field: 'planMoney', formatter: $.fn.fmatter.formatCurrency, align: 'right'},
- {title: '到货时间', field: 'arrivalTime', formatter: $.fn.fmatter.tsymd, hidden: true},
- {title: '收货时间', field: 'receiveTime', formatter: $.fn.fmatter.tsymd},
- {title: '收货人', field: 'receiveUserName'},
- {title: '供应商', field: 'corpName'},
- {title: '供应商单号', field: 'corpOrder'},
- {title: '供应商物流单号', field: 'corpTrackNo'},
- ]],
- onSelectRow: function (rowid) {
- queryGrid2(rowid);
- },
- loadComplete: function () {
- if ($grid1) {
- var num = $grid1.records(); //获取当前数据量
- if (num <= 0) {
- if ($grid2) {
- //清空表格数据
- $grid2.clearData();
- }
- }
- }
- },
- }
- },
- south: {
- height: '45%',
- border: false,
- items: {
- onRender: function () {
- $grid2 = $(this);
- },
- xtype: 'grid',
- toolbar: gridToolbar2,
- idField: 'billmatId',
- columns: [[
- {title: '单据明细据流水', field: 'billmatId', hidden: true},
- {title: '物资ID', field: 'matId', hidden: true},
- {title: '物资编码', field: 'matBar', width: 140},
- {title: '物资名称', field: 'matName', width: 100},
- {title: '图号/型号', field: 'matCode', width: 140},
- {title: '物资分类', field: 'matType', align: 'center', formatter: $.fn.fmatter.matType, width: 80},
- {title: '计划价(元)', field: 'planPrice', formatter: $.fn.fmatter.formatCurrency, align: 'right'},
- {title: '计划金额', field: 'planMoney', formatter: $.fn.fmatter.formatCurrency, align: 'right'},
- {title: '物资状态', field: 'matQc', formatter: $.fn.fmatter.matQc, align: 'center'},
- {
- title: '采购数量', field: 'cgAmount', align: 'right', formatter: $.fn.fmatter.formatNumberBigDecimal,
- formatter: function (value) {
- if (value == undefined || value == null) {
- return value = 0;
- } else {
- return parseFloat(value);
- }
- }
- },
- {title: '采购单位', field: 'planUnitName', align: 'center'},// 需要在format.js文件中设置此方法
- {
- title: '收货数量', field: 'corpAmount', align: 'right', formatter: $.fn.fmatter.formatNumberBigDecimal,
- formatter: function (value) {
- if (value == undefined || value == null) {
- return value = 0;
- } else {
- return parseFloat(value);
- }
- }
- },
- {title: '收货单位', field: 'corpUnitName', align: 'center'},// 需要在format.js文件中设置此方法
- {
- title: '单位换算后收货数量',
- field: 'matAmount',
- align: 'right',
- formatter: $.fn.fmatter.formatNumberBigDecimal,
- hidden: true
- },
- {title: '收货说明', field: 'remark'},
- ]]
- }
- }
- };
- };
- });
|