Index.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. /*
  2. * 描 述:物料管理
  3. */
  4. var selectedRow;
  5. var refreshGirdData;
  6. var typnum = 1;
  7. var matnum = request('matnum');
  8. var matgrpId = "";
  9. var bootstrap = function ($, learun) {
  10. "use strict";
  11. var page = {
  12. init: function () {
  13. page.initGird();
  14. page.bind();
  15. },
  16. bind: function () {
  17. // 查询
  18. $('#btn_Search').on('click', function () {
  19. var keyword = $('#txt_Keyword').val();
  20. page.search({ keyword: keyword });
  21. });
  22. // 刷新
  23. $('#lr_refresh').on('click', function () {
  24. location.reload();
  25. });
  26. // 新增
  27. $('#lr_add').on('click', function () {
  28. selectedRow = null;
  29. learun.layerForm({
  30. id: 'form',
  31. title: '物料新增',
  32. url: top.$.rootUrl + '/BaseManager/BaseMatItem/Form?matgrpId=' + matgrpId,
  33. width: 800,
  34. height: 650,
  35. callBack: function (id) {
  36. return top[id].acceptClick(refreshGirdData);
  37. }
  38. });
  39. });
  40. // 编辑
  41. $('#lr_edit').on('click', function () {
  42. var keyValue = $('#gridtable').jfGridValue('F_NO');
  43. selectedRow = $('#gridtable').jfGridGet('rowdata');
  44. if (learun.checkrow(keyValue)) {
  45. learun.layerForm({
  46. id: 'form',
  47. title: '物料编辑',
  48. url: top.$.rootUrl + '/BaseManager/BaseMatItem/Form?keyValue=' + keyValue,
  49. width: 800,
  50. height: 650,
  51. callBack: function (id) {
  52. return top[id].acceptClick(refreshGirdData);
  53. }
  54. });
  55. }
  56. });
  57. // 删除
  58. $('#lr_delete').on('click', function () {
  59. var keyValue = $('#gridtable').jfGridValue('F_NO');
  60. if (learun.checkrow(keyValue)) {
  61. learun.layerConfirm('是否确认删除该项!', function (res) {
  62. if (res) {
  63. learun.deleteForm(top.$.rootUrl + '/BaseManager/BaseMatItem/DeleteForm', { keyValue: keyValue }, function () {
  64. refreshGirdData();
  65. });
  66. }
  67. });
  68. }
  69. });
  70. // 单位编辑
  71. $('#lr_unitedit').on('click', function () {
  72. var keyValue = $('#gridtable').jfGridValue('F_NO');
  73. matnum = $('#gridtable').jfGridValue('F_BASEUNITNO');
  74. selectedRow = $('#gridtable').jfGridGet('rowdata');
  75. if (learun.checkrow(keyValue)) {
  76. var msg = '物料[' + keyValue + ']单位转换关系';
  77. learun.layerForm({
  78. id: 'form',
  79. title: msg,
  80. url: top.$.rootUrl + '/BaseManager/BaseMatItem/InStockForm?keyValue=' + keyValue + "&matnum=" + matnum,
  81. width: 1600,
  82. height: 800,
  83. btn: ['关闭']
  84. //callBack: function (id) {
  85. // return top[id].acceptClick(refreshGirdData);
  86. //}
  87. });
  88. }
  89. });
  90. $('#lr_import').on('click', function () {
  91. learun.layerForm({
  92. id: 'ImportForm',
  93. title: '导入Excel数据',
  94. url: top.$.rootUrl + '/Utility/ImportForm?ordertype=1000',
  95. width: 600,
  96. height: 400,
  97. maxmin: true,
  98. btn: null
  99. });
  100. });
  101. $('#lr_importSap').on('click', function () {
  102. learun.layerForm({
  103. id: 'ImportForm',
  104. title: '导入SAP货位数据',
  105. url: top.$.rootUrl + '/Utility/ImportForm?ordertype=1002',
  106. width: 600,
  107. height: 400,
  108. maxmin: true,
  109. btn: null
  110. });
  111. });
  112. $('#lr_importzj').on('click', function () {
  113. learun.layerForm({
  114. id: 'ImportForm',
  115. title: '导入质检Excel数据',
  116. url: top.$.rootUrl + '/Utility/ImportForm?ordertype=1001' ,
  117. width: 600,
  118. height: 400,
  119. maxmin: true,
  120. btn: null
  121. });
  122. });
  123. $('#lr_exportnow').on('click', function () {
  124. learun.layerForm({
  125. id: "ExcelExportForm",
  126. title: '导出Excel数据',
  127. url: top.$.rootUrl + '/Utility/ExcelExportForm?gridId=' + $('#gridtable').attr('id') + '&filename=' + encodeURI(encodeURI("物料信息列表")),
  128. width: 600,
  129. height: 580,
  130. callBack: function (id) {
  131. return top[id].acceptClick();
  132. },
  133. btn: ['导出Excel', '关闭']
  134. });
  135. });
  136. },
  137. //inittree: function () {
  138. // $('#MatGrpTree').lrtree({
  139. // url: top.$.rootUrl + '/BaseManager/BaseMatItem/GetTree',
  140. // param: { parentId: '0' },
  141. // nodeClick: page.treeNodeClick
  142. // });
  143. // $('#MatGrpTree').lrtreeSet('setValue', '53298b7a-404c-4337-aa7f-80b2a4ca6681');
  144. //},
  145. //treeNodeClick: function (item) {
  146. // if (item.parentId == 0) {
  147. // matgrpId = "";
  148. // } else {
  149. // matgrpId = item.id;
  150. // }
  151. // $('#titleinfo').text(item.text);
  152. // page.search();
  153. //},
  154. initGird: function () {
  155. $('#gridtable').jfGrid({
  156. url: top.$.rootUrl + '/BaseManager/BaseMatitem/GetPageList',
  157. headData: [
  158. learun.jfFormatter.col_F_NO("物料编码"),
  159. learun.jfFormatter.col_F_NAME("物料名称"),
  160. learun.jfFormatter.col_F_ISSTOP(),
  161. //{ label: "物料组编号", name: 'F_MATGRPNO', width: 120, align: "left" },
  162. { label: "基本单位", name: 'F_BASEUNITNO', width: 100, align: "left" },
  163. { label: "单位转换率", name: 'F_FACTOR', width: 90, align: "left" },
  164. { label: "最小包装单位", name: 'F_DEFINE04', width: 100, align: "left" },
  165. //{
  166. // label: "默认仓库", name: 'F_WAREHOUSENO', width: 100, align: "left",
  167. // formatterAsync: function (callback, value, row) {
  168. // learun.clientdata.getAsync('warehouse', {
  169. // key: value,
  170. // callback: function (item) {
  171. // callback(item.F_NAME);
  172. // }
  173. // });
  174. // }
  175. //},
  176. //{
  177. // label: "默认区域", name: 'F_OFFWAREA', width: 100, align: "left",
  178. // formatterAsync: function (callback, value, row) {
  179. // learun.clientdata.getAsync('warea', {
  180. // key: value,
  181. // callback: function (item) {
  182. // callback(item.F_NAME);
  183. // }
  184. // });
  185. // }
  186. //},
  187. //{ label: "ABC分类", name: 'F_ABCTYPE', width: 100, align: "left" },
  188. //{
  189. // label: "质检类型", name: 'F_QCTYPECODE', width: 100, align: "left",
  190. // formatterAsync: function (callback, value, row) {
  191. // learun.clientdata.getAsync('dataItem', {
  192. // Rowkey: value,
  193. // GrpCode: 'EQCTYPECODE',
  194. // getType: 'Num',
  195. // callback: function (item) {
  196. // callback(item.F_NAME);
  197. // }
  198. // });
  199. // }
  200. // },
  201. //{ label: "质检数值", name: 'F_QCQTY', width: 100, align: "left" },
  202. //{ label: "质检地址", name: 'F_QCADDR', width: 100, align: "left" },
  203. /* { label: "默认存储仓位", name: 'F_BASELOCATION', width: 120, align: "left" },*/
  204. { label: "单托盘载量", name: 'F_PALLETQTY', width: 60, align: "left" },
  205. { label: "单料箱载量", name: 'F_BOXQTY', width: 60, align: "left" },
  206. { label: "过期时间(分)", name: 'F_EXPTIME', width: 60, align: "left" },
  207. //{ label: "最高库存", name: 'F_MAXQTY', width: 60, align: "left" },
  208. //{ label: "最低库存", name: 'F_MINQTY', width: 60, align: "left" },
  209. { label: "规格", name: 'F_MATSPEC', width: 120, align: "left" },
  210. { label: "图号", name: 'F_FIGURENUM', width: 120, align: "left" },
  211. { label: "商品体积", name: 'F_VOLUME', width: 120, align: "left" },
  212. { label: "体积单位", name: 'F_VOLUMEUNIT', width: 120, align: "left" },
  213. { label: "体积等级", name: 'F_VOLUMELEVEL', width: 120, align: "left" },
  214. { label: "长", name: 'F_LENGTH', width: 60, align: "left" },
  215. { label: "宽", name: 'F_WIDTH', width: 60, align: "left" },
  216. { label: "高", name: 'F_HEIGHT', width: 60, align: "left" },
  217. { label: "毛重", name: 'F_WEIGHT', width: 60, align: "left" },
  218. { label: "重量单位", name: 'F_WEIGHTUNIT', width: 60, align: "left" },
  219. learun.jfFormatter.col_F_ADDUSERNO(),
  220. learun.jfFormatter.col_F_ADDTIME(),
  221. learun.jfFormatter.col_F_EDITUSERNO(),
  222. learun.jfFormatter.col_F_EDITTIME(),
  223. learun.jfFormatter.col_F_MEMO()
  224. ],
  225. mainId: 'F_NO',
  226. reloadSelected: true,
  227. isPage: true,
  228. sidx:'F_NO'
  229. });
  230. page.search();
  231. },
  232. search: function (param) {
  233. param = param || {};
  234. //param.matgrpId = matgrpId;
  235. $('#gridtable').jfGridSet('reload', param);
  236. }
  237. };
  238. refreshGirdData = function () {
  239. page.search();
  240. };
  241. page.init();
  242. }