PaiKu.js 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430
  1. var refreshGirdData;
  2. var bootstrap = function ($, learun) {
  3. "use strict";
  4. var selectRowsData;
  5. var psuid = "";
  6. var urls = [{ "url": "/FJManager/BillBomSet/DFM1509", "name": "DFM1509", "width": 744, "height": 690 },
  7. { "url": "/FJManager/BillBomSet/DOF2", "name": "DOF2", "width": 920, "height": 676 },
  8. { "url": "/FJManager/BillBomSet/DOF4", "name": "DOF4", "width": 920, "height": 676 },
  9. { "url": "/FJManager/BillBomSet/DFM6", "name": "DFM6", "width": 920, "height": 676 },
  10. { "url": "/FJManager/BillBomSet/DFM09", "name": "DFM9", "width": 940, "height": 676 },
  11. { "url": "/FJManager/BillBomSet/Exception", "name": "Exception", "width": 920, "height": 676 },
  12. { "url": "/FJManager/BillBomSet/DFMAll", "name": "DFMAll", "width": 920, "height": 676 },];
  13. var page = {
  14. init: function () {
  15. page.bind();
  16. page.initGird();
  17. },
  18. bind: function () {
  19. $('#multiple_condition_query').lrMultipleQuery(function (queryJson) {
  20. // 调用后台查询
  21. // queryJson 查询条件
  22. console.log(queryJson);
  23. queryJson["Code"] = $("#Code").val();
  24. queryJson["Name"] = $("#Name").val();
  25. queryJson["ShortCode"] = $("#ShortCode").val();
  26. queryJson["ProMaterCode"] = $("#ProMaterCode").val();
  27. queryJson["BomCode"] = $("#BomCode").val();
  28. if ($("#IsStop").is(":checked")) {
  29. queryJson["IsStop"] = '1';
  30. } else {
  31. queryJson["IsStop"] = '';
  32. }
  33. queryJson["StampType"] = stampType;
  34. page.search({ queryJson: JSON.stringify(queryJson) });
  35. }, 250);
  36. // 查询
  37. $('#btn_Search').on('click', function () {
  38. var keyword = $('#txt_Keyword').val();
  39. page.search({ queryJson: JSON.stringify({ keyword: $('#txt_Keyword').val(), StampType: stampType }) });
  40. });
  41. // 刷新
  42. $('#lr_refresh').on('click', function () {
  43. location.reload();
  44. });
  45. // 新增
  46. $('#lr_add').on('click', function () {
  47. learun.layerForm({
  48. id: 'form',
  49. title: '新增' + urls[parseInt(stampType) - 1].name,
  50. url: top.$.rootUrl + urls[parseInt(stampType) - 1].url,
  51. width: urls[parseInt(stampType) - 1].width,
  52. height: urls[parseInt(stampType) - 1].height,
  53. callBack: function (id) {
  54. return top[id].acceptClick(refreshGirdData);
  55. }
  56. });
  57. });
  58. // 编辑
  59. $('#lr_edit').on('click', function () {
  60. let editSelRows = $('#gridtable').jfGridGet("rowdata");
  61. if (editSelRows.length == 0) {
  62. learun.alert.error('未选择行!');
  63. return false;
  64. }
  65. if (editSelRows.length > 1) {
  66. learun.alert.error('选择了多行!');
  67. return false;
  68. }
  69. var keyValue = $('#gridtable').jfGridValue('Id');
  70. if (learun.checkrow(keyValue)) {
  71. learun.layerForm({
  72. id: 'form',
  73. title: '编辑' + urls[parseInt(stampType) - 1].name,
  74. url: top.$.rootUrl + urls[parseInt(stampType) - 1].url + '?keyValue=' + keyValue,
  75. width: urls[parseInt(stampType) - 1].width,
  76. height: urls[parseInt(stampType) - 1].height,
  77. callBack: function (id) {
  78. return top[id].acceptClick(refreshGirdData);
  79. }
  80. });
  81. }
  82. });
  83. $("#lr_search").on('click', function () {
  84. let editSelRows = $('#gridtable').jfGridGet("rowdata");
  85. if (editSelRows.length == 0) {
  86. learun.alert.error('未选择行!');
  87. return false;
  88. }
  89. if (editSelRows.length > 1) {
  90. learun.alert.error('选择了多行!');
  91. return false;
  92. }
  93. var keyValue = $('#gridtable').jfGridValue('Id');
  94. if (learun.checkrow(keyValue)) {
  95. learun.layerForm({
  96. id: 'form',
  97. title: '查看' + urls[parseInt(stampType) - 1].name,
  98. btn: ['关闭'],
  99. url: top.$.rootUrl + urls[parseInt(stampType) - 1].url + '?keyValue=' + keyValue,
  100. width: urls[parseInt(stampType) - 1].width,
  101. height: urls[parseInt(stampType) - 1].height,
  102. callBack: function (id) {
  103. return true;
  104. //return top[id].acceptClick(refreshGirdData);
  105. }
  106. });
  107. }
  108. });
  109. // 删除
  110. $('#lr_delete').on('click', function () {
  111. selectRowsData = $('#gridtable').jfGridGet("rowdata");
  112. if (selectRowsData.length == 0) {
  113. learun.alert.error('未选择行!');
  114. return false;
  115. }
  116. var keyValue = selectRowsData.map((item) => item.Id);
  117. //var keyValue = $('#gridtable').jfGridValue('Id');
  118. if (learun.checkrow(keyValue)) {
  119. learun.layerConfirm('是否确认删除该项!', function (res) {
  120. if (res) {
  121. learun.deleteForm(top.$.rootUrl + '/FJManager/BillBomSet/Deletes', { keyValue: keyValue }, function () {
  122. refreshGirdData();
  123. });
  124. }
  125. });
  126. }
  127. });
  128. // 启用
  129. $('#lr_enable').on('click', function () {
  130. var postData = $('#gridtable').jfGridGet("rowdata");
  131. if (postData.length == 0) {
  132. learun.alert.error('未选择行!');
  133. return false;
  134. }
  135. if (postData.length > 1) {
  136. learun.alert.error('启用只能选择一条数据!');
  137. return false;
  138. }
  139. learun.layerConfirm('是否确认启用该跺型!', function (res) {
  140. if (res) {
  141. learun.postForm(top.$.rootUrl + '/FJManager/BillBomSet/Enables', { ids: JSON.stringify(postData.map((item) => item.Id)) }, function () {
  142. refreshGirdData();
  143. });
  144. }
  145. });
  146. });
  147. // 禁用
  148. $('#lr_disable').on('click', function () {
  149. var postData = $('#gridtable').jfGridGet("rowdata");
  150. if (postData.length == 0) {
  151. learun.alert.error('未选择行!');
  152. return false;
  153. }
  154. learun.layerConfirm('是否确认禁用该跺型!', function (res) {
  155. if (res) {
  156. learun.postForm(top.$.rootUrl + '/FJManager/BillBomSet/Disables', { ids: JSON.stringify(postData.map((item) => item.Id)) }, function () {
  157. refreshGirdData();
  158. });
  159. }
  160. });
  161. });
  162. // 打印
  163. $('#lr_print').on('click', function () {
  164. $('#gridtable').jqprintTable();
  165. });
  166. },
  167. // 初始化列表
  168. initGird: function () {
  169. $('#gridtable').jfGrid({
  170. url: top.$.rootUrl + '/FJManager/BillBomSet/GetPaiKuList',
  171. headData: [
  172. { label: '垛型编码', name: 'Code', width: 160, align: 'left' },
  173. { label: '垛型名称', name: 'Name', width: 160, align: 'left' },
  174. { label: '短编号', name: 'ShortCode', width: 50, align: 'left' },
  175. { label: '帘线物料编码', name: 'ProMaterCode', width: 100, align: 'left' },
  176. { label: '投料物料编码', name: 'ProCode', width: 180, align: 'left' },
  177. { label: '实际物料编码', name: 'BomCode', width: 180, align: 'left' },
  178. //{
  179. // label: '投料物料名称', name: 'BomCode', width: 180, align: 'left', formatterAsync: function (callback, value, row) {
  180. // learun.httpAsync('GET', top.$.rootUrl + '/FJManager/BillBomInfo/GetList', { queryJson: JSON.stringify({ Code: value }) }, function (res) {
  181. // if (res.code > 0 && res.data.length > 0) {
  182. // callback(res.data[0].Name);
  183. // }
  184. // });
  185. // },
  186. //},
  187. { label: '工字轮个数', name: 'HWCountQty', width: 70, align: 'left' },
  188. {
  189. label: '托盘类型', name: 'TpTypeCode', width: 60, align: 'left', formatter: function (cellvalue) {
  190. if (cellvalue == '1') {
  191. return '<span class=\"label label-success\" >09</span>';
  192. } else if (cellvalue == '2') {
  193. return '<span class=\"label label-default\" >非09</span>';
  194. } else {
  195. return '<span class=\"label label-default\" >未知</span>';
  196. }
  197. }
  198. },
  199. { label: '层数', name: 'LayerCountQty', width: 40, align: 'left' },
  200. learun.jfFormatter.col_ISSTOP(),
  201. //{
  202. // label: '是否删除', name: 'IsDelete', width: 60, align: "center"
  203. // , formatter: function (cellvalue) {
  204. // if (cellvalue == 0) {
  205. // return '<span class=\"label label-success\" >正常</span>';
  206. // } else if (cellvalue == 1) {
  207. // return '<span class=\"label label-default\" >删除</span>';
  208. // } else {
  209. // return '<span class=\"label label-default\" >未知</span>';
  210. // }
  211. // }
  212. //},
  213. {
  214. label: '子类型', name: 'StampChildType', width: 120, align: 'left', formatter: function (cellvalue, item) {
  215. if (item.StampType == '2') {
  216. if (cellvalue == '1') {
  217. return '<span class=\"label label-default\" >DOF2-01</span>';
  218. } else if (cellvalue == '2') {
  219. return '<span class=\"label label-default\" >DOF2-02</span>';
  220. } else if (cellvalue == '3') {
  221. return '<span class=\"label label-default\" >DOF2-03</span>';
  222. } else if (cellvalue == '4') {
  223. return '<span class=\"label label-default\" >DOF2-04</span>';
  224. } else if (cellvalue == '5') {
  225. return '<span class=\"label label-default\" >DOF2-05</span>';
  226. }
  227. }
  228. if (item.StampType == '3') {
  229. if (cellvalue == '1') {
  230. return '<span class=\"label label-default\" >DOF4-01</span>';
  231. } else if (cellvalue == '2') {
  232. return '<span class=\"label label-default\" >DOF4-02</span>';
  233. } else if (cellvalue == '3') {
  234. return '<span class=\"label label-default\" >DOF4-03</span>';
  235. } else if (cellvalue == '4') {
  236. return '<span class=\"label label-default\" >DOF4-04</span>';
  237. } else if (cellvalue == '5') {
  238. return '<span class=\"label label-default\" >DOF4-05</span>';
  239. } else if (cellvalue == '6') {
  240. return '<span class=\"label label-default\" >DOF4-06</span>';
  241. } else if (cellvalue == '7') {
  242. return '<span class=\"label label-default\" >DOF4-07</span>';
  243. }
  244. }
  245. else if (item.StampType == '4') {
  246. if (cellvalue == '1') {
  247. return '<span class=\"label label-default\" >DFM6-01</span>';
  248. } else if (cellvalue == '2') {
  249. return '<span class=\"label label-default\" >DFM6-02</span>';
  250. } else if (cellvalue == '3') {
  251. return '<span class=\"label label-default\" >DFM6-03</span>';
  252. } else if (cellvalue == '4') {
  253. return '<span class=\"label label-default\" >DFM6-04</span>';
  254. } else if (cellvalue == '5') {
  255. return '<span class=\"label label-default\" >DFM6-05</span>';
  256. } else if (cellvalue == '6') {
  257. return '<span class=\"label label-default\" >DFM6-06</span>';
  258. } else if (cellvalue == '7') {
  259. return '<span class=\"label label-default\" >DFM6-07</span>';
  260. } else if (cellvalue == '8') {
  261. return '<span class=\"label label-default\" >DFM6-08</span>';
  262. } else if (cellvalue == '9') {
  263. return '<span class=\"label label-default\" >DFM6-09</span>';
  264. }
  265. } else if (item.StampType == '5') {
  266. if (cellvalue == '1') {
  267. return '<span class=\"label label-default\" >DFM9-01</span>';
  268. } else if (cellvalue == '2') {
  269. return '<span class=\"label label-default\" >DFM9-02</span>';
  270. } else if (cellvalue == '3') {
  271. return '<span class=\"label label-default\" >DFM9-03</span>';
  272. } else if (cellvalue == '4') {
  273. return '<span class=\"label label-default\" >DFM9-04</span>';
  274. } else if (cellvalue == '5') {
  275. return '<span class=\"label label-default\" >DFM9-05</span>';
  276. } else if (cellvalue == '6') {
  277. return '<span class=\"label label-default\" >DFM9-06</span>';
  278. } else if (cellvalue == '7') {
  279. return '<span class=\"label label-default\" >DFM9-07</span>';
  280. } else if (cellvalue == '8') {
  281. return '<span class=\"label label-default\" >DFM9-08</span>';
  282. } else if (cellvalue == '9') {
  283. return '<span class=\"label label-default\" >DFM9-09</span>';
  284. }
  285. }
  286. else if (item.StampType == '6') {
  287. if (cellvalue == '1') {
  288. return '<span class=\"label label-default\" >WS34芯股--异常</span>';
  289. } else if (cellvalue == '2') {
  290. return '<span class=\"label label-default\" >WS18--异常</span>';
  291. } else if (cellvalue == '3') {
  292. return '<span class=\"label label-default\" >WS50--异常</span>';
  293. } else if (cellvalue == '4') {
  294. return '<span class=\"label label-default\" >WS09--异常</span>';
  295. }
  296. }
  297. else {
  298. return '<span class=\"label label-default\" >无</span>';
  299. }
  300. }
  301. },
  302. {
  303. label: '是否桁架码垛', name: 'IsTruss', width: 80, align: 'left', formatter: function (cellvalue) {
  304. if (cellvalue == 1) {
  305. return '<span class=\"label label-success\" >是</span>';
  306. } else if (cellvalue === '') {
  307. return '<span class=\"label label-default\" >未知</span>';
  308. } else if (cellvalue === 0) {
  309. return '<span class=\"label label-info\" >否</span>';
  310. } else {
  311. return '<span class=\"label label-default\" >未知</span>';
  312. }
  313. }
  314. },
  315. learun.jfFormatter.col_AddWho(),
  316. learun.jfFormatter.col_AddTime(),
  317. learun.jfFormatter.col_EditWho(),
  318. learun.jfFormatter.col_EditTime(),
  319. learun.jfFormatter.col_MEMO()
  320. ],
  321. mainId: 'Code',
  322. isPage: true,
  323. isMultiselect: true,
  324. reloadSelected: true,
  325. sidx: 'Code',
  326. isSubGrid: true, // 是否有子表
  327. subGridExpanded: function (subid, rowdata) {
  328. psuid = subid;
  329. $('#' + subid).jfGrid({
  330. url: top.$.rootUrl + '/FJManager/BillBomSet/GetPaiKuList',
  331. headData: [
  332. { label: '编号', name: 'XYNo', width: 40, align: 'left' },
  333. { label: '行', name: 'Row', width: 40, align: 'left' },
  334. { label: '物料编码', name: 'MatCode', width: 200, align: 'left' },
  335. { label: '物料Id', name: 'MatId', width: 150, align: 'left' },
  336. {
  337. label: '有/无', name: 'IsEmpty', width: 60, align: 'left', formatter: function (cellvalue) {
  338. if (cellvalue == '0') {
  339. return '<span class=\"label label-success\" >有</span>';
  340. } else if (cellvalue == '1') {
  341. return '<span class=\"label label-default\" >无</span>';
  342. } else {
  343. return '<span class=\"label label-default\" >未知</span>';
  344. }
  345. }
  346. },
  347. {
  348. label: '正/反面', name: 'SideNum', width: 70, align: 'left', formatter: function (cellvalue) {
  349. if (cellvalue == '1') {
  350. return '<span class=\"label label-success\" >正面朝上</span>';
  351. } else if (cellvalue == '2') {
  352. return '<span class=\"label label-default\" >反面朝上</span>';
  353. } else {
  354. return '<span class=\"label label-default\" >未知</span>';
  355. }
  356. }
  357. },
  358. { label: '工字轮型号', name: 'SpoolType', width: 80, align: 'left' },
  359. {
  360. label: '单/双丝', name: 'SilkType', width: 80, align: 'left', formatter: function (cellvalue) {
  361. if (cellvalue == '1') {
  362. return '<span class=\"label label-success\" >单丝</span>';
  363. } else if (cellvalue == '2') {
  364. return '<span class=\"label label-default\" >双丝</span>';
  365. } else if (cellvalue == '3') {
  366. return '<span class=\"label label-default\" >三丝</span>';
  367. }
  368. else {
  369. return '<span class=\"label label-default\" >未知</span>';
  370. }
  371. }
  372. },
  373. { label: '钢丝直径上限', name: 'SilkDiam', width: 100, align: 'left' },
  374. /* { label: '钢丝直径上限', name: 'SilkDiamMaxCount', width: 100, align: 'left' },*/
  375. { label: '数量上限', name: 'QtyMaxCount', width: 100, align: 'left' },
  376. {
  377. label: '是否芯股', name: 'IsCore', width: 100, align: 'left', formatter: function (cellvalue) {
  378. if (cellvalue == '1') {
  379. return '<span class=\"label label-success\" >是</span>';
  380. } else if (cellvalue == '2') {
  381. return '<span class=\"label label-default\" >否</span>';
  382. }
  383. else {
  384. return '<span class=\"label label-default\" >未知</span>';
  385. }
  386. }
  387. },
  388. {
  389. label: '是混合行', name: 'IsMixRow', width: 100, align: 'left', formatter: function (cellvalue) {
  390. if (cellvalue == '1') {
  391. return '<span class=\"label label-success\" >是</span>';
  392. } else if (cellvalue == '0') {
  393. return '<span class=\"label label-default\" >否</span>';
  394. }
  395. else {
  396. return '<span class=\"label label-default\" >未知</span>';
  397. }
  398. }
  399. },
  400. { label: '混合料行编码', name: 'MixRowCode', width: 100, align: 'left' },
  401. learun.jfFormatter.col_ISSTOP(),
  402. ]
  403. });
  404. $('#' + subid).jfGridSet('reloadSon', { bomSetHdrId: rowdata.Id });
  405. },
  406. });
  407. page.search({ queryJson: JSON.stringify({ keyword: $('#txt_Keyword').val(), StampType: stampType }) });
  408. },
  409. search: function (param) {
  410. $('#gridtable').jfGridSet('reload', param);
  411. }
  412. };
  413. refreshGirdData = function () {
  414. $('#gridtable').jfGridSet('reload');
  415. };
  416. page.init();
  417. }