/* * 描 述:物料管理 */ var selectedRow; var refreshGirdData; var typnum = 1; var matnum = request('matnum'); var matgrpId = ""; var bootstrap = function ($, learun) { "use strict"; var page = { init: function () { page.initGird(); page.bind(); }, bind: function () { // 查询 $('#btn_Search').on('click', function () { var keyword = $('#txt_Keyword').val(); page.search({ keyword: keyword }); }); // 刷新 $('#lr_refresh').on('click', function () { location.reload(); }); // 新增 $('#lr_add').on('click', function () { selectedRow = null; learun.layerForm({ id: 'form', title: '物料新增', url: top.$.rootUrl + '/BaseManager/BaseMatItem/Form?matgrpId=' + matgrpId, width: 800, height: 650, callBack: function (id) { return top[id].acceptClick(refreshGirdData); } }); }); // 编辑 $('#lr_edit').on('click', function () { var keyValue = $('#gridtable').jfGridValue('F_NO'); selectedRow = $('#gridtable').jfGridGet('rowdata'); if (learun.checkrow(keyValue)) { learun.layerForm({ id: 'form', title: '物料编辑', url: top.$.rootUrl + '/BaseManager/BaseMatItem/Form?keyValue=' + keyValue, width: 800, height: 650, callBack: function (id) { return top[id].acceptClick(refreshGirdData); } }); } }); // 删除 $('#lr_delete').on('click', function () { var keyValue = $('#gridtable').jfGridValue('F_NO'); if (learun.checkrow(keyValue)) { learun.layerConfirm('是否确认删除该项!', function (res) { if (res) { learun.deleteForm(top.$.rootUrl + '/BaseManager/BaseMatItem/DeleteForm', { keyValue: keyValue }, function () { refreshGirdData(); }); } }); } }); // 单位编辑 $('#lr_unitedit').on('click', function () { var keyValue = $('#gridtable').jfGridValue('F_NO'); matnum = $('#gridtable').jfGridValue('F_BASEUNITNO'); selectedRow = $('#gridtable').jfGridGet('rowdata'); if (learun.checkrow(keyValue)) { var msg = '物料[' + keyValue + ']单位转换关系'; learun.layerForm({ id: 'form', title: msg, url: top.$.rootUrl + '/BaseManager/BaseMatItem/InStockForm?keyValue=' + keyValue + "&matnum=" + matnum, width: 1600, height: 800, btn: ['关闭'] //callBack: function (id) { // return top[id].acceptClick(refreshGirdData); //} }); } }); $('#lr_import').on('click', function () { learun.layerForm({ id: 'ImportForm', title: '导入Excel数据', url: top.$.rootUrl + '/Utility/ImportForm?ordertype=1000', width: 600, height: 400, maxmin: true, btn: null }); }); $('#lr_importSap').on('click', function () { learun.layerForm({ id: 'ImportForm', title: '导入SAP货位数据', url: top.$.rootUrl + '/Utility/ImportForm?ordertype=1002', width: 600, height: 400, maxmin: true, btn: null }); }); $('#lr_importzj').on('click', function () { learun.layerForm({ id: 'ImportForm', title: '导入质检Excel数据', url: top.$.rootUrl + '/Utility/ImportForm?ordertype=1001' , width: 600, height: 400, maxmin: true, btn: null }); }); $('#lr_exportnow').on('click', function () { learun.layerForm({ id: "ExcelExportForm", title: '导出Excel数据', url: top.$.rootUrl + '/Utility/ExcelExportForm?gridId=' + $('#gridtable').attr('id') + '&filename=' + encodeURI(encodeURI("物料信息列表")), width: 600, height: 580, callBack: function (id) { return top[id].acceptClick(); }, btn: ['导出Excel', '关闭'] }); }); }, //inittree: function () { // $('#MatGrpTree').lrtree({ // url: top.$.rootUrl + '/BaseManager/BaseMatItem/GetTree', // param: { parentId: '0' }, // nodeClick: page.treeNodeClick // }); // $('#MatGrpTree').lrtreeSet('setValue', '53298b7a-404c-4337-aa7f-80b2a4ca6681'); //}, //treeNodeClick: function (item) { // if (item.parentId == 0) { // matgrpId = ""; // } else { // matgrpId = item.id; // } // $('#titleinfo').text(item.text); // page.search(); //}, initGird: function () { $('#gridtable').jfGrid({ url: top.$.rootUrl + '/BaseManager/BaseMatitem/GetPageList', headData: [ learun.jfFormatter.col_F_NO("物料编码"), learun.jfFormatter.col_F_NAME("物料名称"), learun.jfFormatter.col_F_ISSTOP(), //{ label: "物料组编号", name: 'F_MATGRPNO', width: 120, align: "left" }, { label: "基本单位", name: 'F_BASEUNITNO', width: 100, align: "left" }, { label: "单位转换率", name: 'F_FACTOR', width: 90, align: "left" }, { label: "最小包装单位", name: 'F_DEFINE04', width: 100, align: "left" }, //{ // label: "默认仓库", name: 'F_WAREHOUSENO', width: 100, align: "left", // formatterAsync: function (callback, value, row) { // learun.clientdata.getAsync('warehouse', { // key: value, // callback: function (item) { // callback(item.F_NAME); // } // }); // } //}, //{ // label: "默认区域", name: 'F_OFFWAREA', width: 100, align: "left", // formatterAsync: function (callback, value, row) { // learun.clientdata.getAsync('warea', { // key: value, // callback: function (item) { // callback(item.F_NAME); // } // }); // } //}, //{ label: "ABC分类", name: 'F_ABCTYPE', width: 100, align: "left" }, //{ // label: "质检类型", name: 'F_QCTYPECODE', width: 100, align: "left", // formatterAsync: function (callback, value, row) { // learun.clientdata.getAsync('dataItem', { // Rowkey: value, // GrpCode: 'EQCTYPECODE', // getType: 'Num', // callback: function (item) { // callback(item.F_NAME); // } // }); // } // }, //{ label: "质检数值", name: 'F_QCQTY', width: 100, align: "left" }, //{ label: "质检地址", name: 'F_QCADDR', width: 100, align: "left" }, /* { label: "默认存储仓位", name: 'F_BASELOCATION', width: 120, align: "left" },*/ { label: "单托盘载量", name: 'F_PALLETQTY', width: 60, align: "left" }, { label: "单料箱载量", name: 'F_BOXQTY', width: 60, align: "left" }, { label: "过期时间(分)", name: 'F_EXPTIME', width: 60, align: "left" }, //{ label: "最高库存", name: 'F_MAXQTY', width: 60, align: "left" }, //{ label: "最低库存", name: 'F_MINQTY', width: 60, align: "left" }, { label: "规格", name: 'F_MATSPEC', width: 120, align: "left" }, { label: "图号", name: 'F_FIGURENUM', width: 120, align: "left" }, { label: "商品体积", name: 'F_VOLUME', width: 120, align: "left" }, { label: "体积单位", name: 'F_VOLUMEUNIT', width: 120, align: "left" }, { label: "体积等级", name: 'F_VOLUMELEVEL', width: 120, align: "left" }, { label: "长", name: 'F_LENGTH', width: 60, align: "left" }, { label: "宽", name: 'F_WIDTH', width: 60, align: "left" }, { label: "高", name: 'F_HEIGHT', width: 60, align: "left" }, { label: "毛重", name: 'F_WEIGHT', width: 60, align: "left" }, { label: "重量单位", name: 'F_WEIGHTUNIT', width: 60, align: "left" }, learun.jfFormatter.col_F_ADDUSERNO(), learun.jfFormatter.col_F_ADDTIME(), learun.jfFormatter.col_F_EDITUSERNO(), learun.jfFormatter.col_F_EDITTIME(), learun.jfFormatter.col_F_MEMO() ], mainId: 'F_NO', reloadSelected: true, isPage: true, sidx:'F_NO' }); page.search(); }, search: function (param) { param = param || {}; //param.matgrpId = matgrpId; $('#gridtable').jfGridSet('reload', param); } }; refreshGirdData = function () { page.search(); }; page.init(); }