Index.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. var refreshGirdData;
  2. var OneInTimebegin = '';
  3. var OneInTimeend = '';
  4. var ProductTimebegin = '';
  5. var ProductTimeend = '';
  6. var logbegin = '';
  7. var logend = '';
  8. var selectedRow;
  9. var selectRowsData;
  10. var refreshGirdData; // 更新数据
  11. var bootstrap = function ($, learun) {
  12. "use strict";
  13. const Directions = [{ id: "", text: "" }, { id: "L", text: "左手车" }, { id: "R", text: "右手车" }]; //左/右手车
  14. const WareDirects = [{ id: "", text: "" }, { id: "S", text: "南" }, { id: "N", text: "北" }]; //南北向
  15. var page = {
  16. init: function () {
  17. page.initGird();
  18. page.bind();
  19. },
  20. bind: function () {
  21. for (var j = 0; j < Directions.length; j++) {
  22. if (Directions[j].id == '') {
  23. $("#Direction").append($("<option value=''>请选择</option>"));
  24. }
  25. else {
  26. $("#Direction").append($("<option value='" + Directions[j].id + "'>" + Directions[j].text + "</option>"));
  27. }
  28. }
  29. for (var j = 0; j < WareDirects.length; j++) {
  30. if (WareDirects[j].id == '') {
  31. $("#WareDirect").append($("<option value=''>请选择</option>"));
  32. }
  33. else {
  34. $("#WareDirect").append($("<option value='" + WareDirects[j].id + "'>" + WareDirects[j].text + "</option>"));
  35. }
  36. }
  37. $('#multiple_condition_query').lrMultipleQuery(function (queryJson) {
  38. // 调用后台查询
  39. // queryJson 查询条件
  40. console.log(queryJson);
  41. queryJson["WarehouseId"] = $("#WarehouseId").lrselectGet();
  42. queryJson["Name"] = $("#Name").val();
  43. queryJson["MachNo"] = $("#MachNo").val();
  44. queryJson["Station"] = $("#Station").val();
  45. queryJson["GrpCode"] = $("#GrpCode").val();
  46. queryJson["Direction"] = $("#Direction").val();
  47. queryJson["WareDirect"] = $("#WareDirect").val();
  48. queryJson["BillCode"] = $("#BillCode").val();
  49. queryJson["WorkOrder"] = $("#WorkOrder").val();
  50. queryJson["SetGrpCode"] = $("#SetGrpCode").val();
  51. queryJson["ProSetGrpCode"] = $("#ProSetGrpCode").val();
  52. queryJson["ProBillCode"] = $("#ProBillCode").val();
  53. queryJson["ProWorkOrder"] = $("#ProWorkOrder").val();
  54. queryJson["MacTypeCode"] = $("#MacTypeCode").val();
  55. queryJson["MacTypeName"] = $("#MacTypeName").val();
  56. page.search({ queryJson: JSON.stringify(queryJson) });
  57. }, 250);
  58. // 查询
  59. $('#btn_Search').on('click', function () {
  60. var keyword = $('#txt_Keyword').val();
  61. page.search({ queryJson: JSON.stringify({ keyword: $('#txt_Keyword').val() }) });
  62. });
  63. // 刷新
  64. $('#lr_refresh').on('click', function () {
  65. location.reload();
  66. });
  67. $('#lr_import').on('click', function () {
  68. learun.layerForm({
  69. id: 'ImportForm',
  70. title: '导入Excel数据',
  71. url: top.$.rootUrl + '/Utility/ImportForm?ordertype=' + 100,
  72. width: 600,
  73. height: 400,
  74. maxmin: true,
  75. btn: null
  76. });
  77. });
  78. // 新增
  79. $('#lr_add').on('click', function () {
  80. var keyValue = {};
  81. selectedRow = {};
  82. learun.layerForm({
  83. id: 'form',
  84. title: '添加仓库',
  85. url: top.$.rootUrl + '/FJManager/BillMachInfo/Form',
  86. height: 400,
  87. width: 800,
  88. callBack: function (id) {
  89. return top[id].acceptClick(refreshGirdData);
  90. }
  91. });
  92. });
  93. // 编辑
  94. $('#lr_edit').on('click', function () {
  95. selectedRow = $('#gridtable').jfGridGet('rowdata');
  96. if (selectedRow.length == 0) {
  97. learun.alert.error('未选择行!');
  98. return false;
  99. }
  100. if (selectedRow.length > 1) {
  101. learun.alert.error('选择了多行!');
  102. return false;
  103. }
  104. var keyValue = selectedRow[0].Id;
  105. selectedRow = selectedRow[0];
  106. if (learun.checkrow(keyValue)) {
  107. learun.layerForm({
  108. id: 'form',
  109. title: '编辑机台信息',
  110. url: top.$.rootUrl + '/FJManager/BillMachInfo/Form?keyValue=' + keyValue,
  111. height: 400,
  112. width: 800,
  113. callBack: function (id) {
  114. return top[id].acceptClick(refreshGirdData);
  115. }
  116. });
  117. }
  118. });
  119. // 删除
  120. $('#lr_delete').on('click', function () {
  121. var keyValue = $('#gridtable').jfGridValue('Id');
  122. if (learun.checkrow(keyValue)) {
  123. learun.layerConfirm('是否确认删除该项!', function (res) {
  124. if (res) {
  125. learun.deleteForm(top.$.rootUrl + '/FJManager/BillMachInfo/Delete', { keyValue: keyValue }, function () {
  126. refreshGirdData();
  127. });
  128. }
  129. });
  130. }
  131. });
  132. // 批量修改南北向
  133. $('#lr_waredirectedit').on('click', function () {
  134. selectedRow = $('#gridtable').jfGridGet('rowdata');
  135. if (selectedRow.length == 0) {
  136. learun.alert.error('未选择行!');
  137. return false;
  138. }
  139. learun.layerForm({
  140. id: 'form',
  141. title: '批量修改南北向',
  142. url: top.$.rootUrl + '/FJManager/BillMachInfo/WareDirectForm',
  143. height: 400,
  144. width: 800,
  145. callBack: function (id) {
  146. return top[id].acceptClick(refreshGirdData);
  147. }
  148. });
  149. });
  150. $('#WarehouseId').lrselect({
  151. url: top.$.rootUrl + '/FJManager/BaseWarehouse/GetSelectWarehouseNameList',
  152. maxHeight: 180,
  153. allowSearch: false
  154. });
  155. },
  156. // 初始化列表
  157. initGird: function () {
  158. $('#gridtable').jfGrid({
  159. url: top.$.rootUrl + '/FJManager/BillMachInfo/GetPageList',
  160. headData: [
  161. { label: 'Id', name: 'Id', hidden: true },
  162. { label: '仓库', name: 'WarehouseName', width: 100, align: 'left' },
  163. {
  164. label: '南北向', name: 'WareDirect', width: 60, align: 'left', formatter: function (cellvalue) {
  165. if (cellvalue == "N" ) {
  166. return '<span class=\"label label-success\" >北</span>';
  167. } else if (cellvalue == "S") {
  168. return '<span class=\"label label-warning\" >南</span>';
  169. } else {
  170. return '<span class=\"label label-default\" >未知</span>';
  171. }
  172. } },
  173. { label: '机台号', name: 'MachNo', width: 100, align: 'left' },
  174. { label: '名称', name: 'Name', width: 100, align: 'left' },
  175. { label: '机台组', name: 'GrpCode', width: 100, align: 'left' },
  176. { label: 'AGV托盘位', name: 'Station', width: 100, align: 'left' },
  177. { label: '最近的仓库名称', name: 'NearestWarehouseName', width: 100, align: 'left' },
  178. {
  179. label: '左/右手车', name: 'Direction', width: 100, align: 'left', formatter: function (cellvalue) {
  180. if (cellvalue == "L") {
  181. return '<span class=\"label label-success\" >左手车</span>';
  182. } else if (cellvalue == "R") {
  183. return '<span class=\"label label-warning\" >右手车</span>';
  184. } else {
  185. return '<span class=\"label label-default\" >未知</span>';
  186. }
  187. } },
  188. { label: '帘线工序工单号', name: 'BillCode', width: 100, align: 'left' },
  189. { label: '生产订单号', name: 'WorkOrder', width: 100, align: 'left' },
  190. { label: '垛型编码', name: 'SetGrpCode', width: 100, align: 'left' },
  191. { label: '预排帘线工序工单号', name: 'ProBillCode', width: 100, align: 'left' },
  192. { label: '预排生产订单号', name: 'ProWorkOrder', width: 100, align: 'left' },
  193. { label: '预排垛型编码', name: 'ProSetGrpCode', width: 100, align: 'left' },
  194. { label: '机器类型编码', name: 'MacTypeCode', width: 100, align: 'left' },
  195. { label: '机器类型名称', name: 'MacTypeName', width: 100, align: 'left' },
  196. { label: 'Agv地标', name: 'AgvPoint', width: 100, align: 'left' },
  197. {
  198. label: "是否启用", name: "IsStop", width: 80, align: "left", formatter: function (cellvalue) {
  199. if (cellvalue == 0) {
  200. return '<span class=\"label label-success\" >是</span>';
  201. } else {
  202. return '<span class=\"label label-default\" >否</span>';
  203. }
  204. }
  205. },
  206. { label: '备注', name: 'Memo', width: 100, align: 'left' },
  207. { label: "创建时间", name: "AddTime", width: 130, align: "left" },
  208. { label: "更新时间", name: "EditTime", width: 130, align: "left" },
  209. { label: "创建用户", name: "AddWho", width: 110, align: "left" },
  210. { label: "更新用户", name: "EditWho", width: 110, align: "left" },
  211. ],
  212. mainId: 'Id',
  213. isPage: true,
  214. reloadSelected: true,
  215. autowWidth: true,
  216. sidx: 'AddTime',
  217. sord: 'DESC',
  218. isMultiselect: true,
  219. });
  220. page.search({ queryJson: JSON.stringify({ keyword: $('#txt_Keyword').val() }) });
  221. },
  222. search: function (param) {
  223. $('#gridtable').jfGridSet('reload', param);
  224. }
  225. };
  226. refreshGirdData = function () {
  227. $('#gridtable').jfGridSet('reload');
  228. };
  229. page.init();
  230. }