//仓库批次管理参照批次信息页面 //物资信息查询页面 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} }, // 搜索供应商检索 selectCorpWidget: { url: '/app/mat/widget/selectCorp.js', bind: { corpId: 'corpId', corpName: 'corpName' }, queryParams: {corpType: CORP_TYPE_供应商} } }; function enterQueryGrid1(e) { if (e.keyCode === 13) { var tmp = $(this).val(); $form.formSet({queryProperties: tmp}); queryGrid1(); } } function queryGrid1() { var queryUrl = '/mat/matBatch/queryBatchRoomView';// 自行替换此参数 $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 queryUrl = '/stock/stockCell/queryByStockId';// 自行替换此参数 var obj = $form.formGet(); obj.matId = row.matId; obj.batchId = row.batchId; $grid2.reload({ mtype: 'POST', url: api(queryUrl), queryParams: obj }); } // 搜索按钮 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: 'searchbox', label: '检验分类', name: 'matcName', labelWidth: 'auto', widget: widgets.selectCatalogWidget, onChange: function (value) { if (!isNotNullOrEmpty(value)) { $form.formSet({ matcId: '' }) } queryGrid1(); } }, { xtype: 'searchbox', label: '供应商', name: 'corpName', labelWidth: 'auto', widget: widgets.selectCorpWidget, onChange: function (value) { if (!isNotNullOrEmpty(value)) { $form.formSet({ corpId: '' }) } 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: 350, events: {keydown: enterQueryGrid1}, }, // { // xtype: 'yvselect', label: '库存状态', name: 'hasStock', data: [ // {id: '', text: '全部'}, // {id: '1', text: '有库存'}, // {id: '0', text: '无库存'} // ], // labelWidth: 'auto', width: 180, // onChange: function (value) { // queryGrid1(); // } // }, // { // xtype: 'yvselect', label: '批次状态', name: 'matQc', // data: $.yvan.sysDict('matQc').combowithAll(), // labelWidth: 'auto', width: 180, // onChange: function (value) { // queryGrid1(); // } // }, ], ] }; // 列表1增删改查按钮 var gridToolbarTitle1 = '批次列表';// 自行替换此参数 var gridToolbar1 = { xtype: 'toolbar', title: gridToolbarTitle1, items: [ { text: '打印包装单', iconCls: 'fa fa-cloud-upload', onClick: function () { var row = $grid1.rowData(); if (!row) { $.yvan.msg('请先选择一行数据'); return; } $.yvan.showDialog(this, require('/app/view/dialogWarnShow.js')({ batchId: row.batchId, }) ); } }, // { // text: '打印包装单100*80', // iconCls: 'fa fa-cloud-upload', // onClick: function () { // var row = $grid1.rowData(); // if (!row) { // $.yvan.msg('请先选择一行数据'); // return; // } // $.yvan.showDialog(this, // require('/app/view/dialogWarnShow80.js')({ // batchId: row.batchId, // }) // ); // } // }, // { // text: '打印包装单(105打印机)', // iconCls: 'fa fa-cloud-upload', // onClick: function () { // var row = $grid1.rowData(); // if (!row) { // $.yvan.msg('请先选择一行数据'); // return; // } // $.yvan.showDialog(this, // require('/app/view/dialogWarnShow105.js')({ // batchId: row.batchId, // }) // ); // } // }, ] }; return { north: { height: 135, split: true, border: false, items: [ queryToolbar, queryForm ] }, center: { height: '70%', split: true, items: { onRender: function () { $grid1 = $(this); queryGrid1(); }, xtype: 'grid', toolbar: gridToolbar1, autoSizeColumns: true, columns: [[ {title: '批次ID', field: 'batchId', hidden: true}, {title: '物资ID', field: 'matId', hidden: true}, {title: '批次条码', field: 'batchBar', hidden: true}, {title: '批次号', field: 'batchCode', width: 200}, {title: '物资编码', field: 'matBar', width: 200}, {title: '图号/型号', field: 'matCode', width: 200}, {title: '物资名称', field: 'matName', width: 200}, {title: '物资编码属性', field: 'matAttrCode'}, {title: '物资分类', field: 'matType', formatter: $.fn.fmatter.matType, width: 80}, {title: '检验分类', field: 'matcName', width: 200}, {title: '供应商', field: 'corpName'}, {title: '购买单位', field: 'corpUnit'}, {title: '购买数', field: 'corpAmount', align: 'right', formatter: $.fn.fmatter.formatNumberBigDecimal}, {title: '库存数', field: 'stockAmount', align: 'right', formatter: $.fn.fmatter.formatNumberBigDecimal}, {title: '生产日期', field: 'dateMade', width: 140, align: 'center', formatter: $.fn.fmatter.tsymd}, {title: '入库日期', field: 'dateArrival', width: 140, align: 'center', formatter: $.fn.fmatter.tsymd}, {title: '检验员', field: 'name'}, ]], onSelectRow: function (rowid) { queryGrid2(); } } }, south: { height: '30%', border: false, items: { xtype: 'tabs', items: [ { title: '批次位置信息', lazy: true, items: { onRender: function () { $grid2 = $(this); }, xtype: 'grid', autoSizeColumns: true, pagination: true, columns: [ [ {title: '编码属性ID', field: 'celldetId', hidden: true}, {title: '货位ID', field: 'cellId', hidden: true}, {title: '库存ID', field: 'stockId', hidden: true}, {title: '单据ID', field: 'billId', hidden: true}, {title: '库区', field: 'farmName', width: 140}, {title: '仓库', field: 'roomName', width: 140}, {title: '区域', field: 'workArea', width: 200, formatter: $.fn.fmatter.workArea,}, {title: '货组', field: 'rowName', width: 200, align: "center"}, {title: '货位类型', field: 'cellMatQc', width: 200, align: "center", formatter: $.fn.fmatter.matQc,}, {title: '货位号', field: 'cellBar', width: 200, align: "center"}, { title: '数量', field: 'matAmount', width: 350, align: "right", formatter: $.fn.fmatter.formatNumberBigDecimal }, ] ] } }, ] } } }; }; });