OutInPationIndex.js 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. var refreshGirdData;
  2. var OneInTimebegin = '';
  3. var OneInTimeend = '';
  4. var ProductTimebegin = '';
  5. var ProductTimeend = '';
  6. var logbegin = '';
  7. var logend = '';
  8. var bootstrap = function ($, learun) {
  9. "use strict";
  10. var page = {
  11. init: function () {
  12. page.initGird();
  13. page.bind();
  14. },
  15. bind: function () {
  16. $('#multiple_condition_query').lrMultipleQuery(function (queryJson) {
  17. // 调用后台查询
  18. // queryJson 查询条件
  19. queryJson["Pation"] = $("#Pation").val();
  20. page.search({ queryJson: JSON.stringify(queryJson) });
  21. }, 250);
  22. // 查询
  23. $('#btn_Search').on('click', function () {
  24. var keyword = $('#txt_Keyword').val();
  25. page.search({ queryJson: JSON.stringify({ keyword: $('#txt_Keyword').val() }) });
  26. });
  27. // 刷新
  28. $('#lr_refresh').on('click', function () {
  29. location.reload();
  30. });
  31. // 写信号
  32. $('#lr_write').on('click', function () {
  33. var keyValue = $('#gridtable').jfGridValue('Code');
  34. var postData = $('#gridtable').jfGridGet('rowdata');
  35. if (learun.checkrow(keyValue)) {
  36. learun.layerConfirm('是否确认写该站台信号!', function (res) {
  37. if (res) {
  38. var url = WCSWebUrl + "api/Wcs/Write?deviceType=2&devCode=" + postData.Code + "&protocol=1&propName=1&value=1";
  39. $.ajax({
  40. type: 'post',
  41. dataType: 'json',
  42. contentType: "application/json;charset=utf-8",
  43. url: url,
  44. success: function (response) {
  45. //resCode 200 resMsg "成功"
  46. refreshGirdData();
  47. top.layer.close(top.layer.index);
  48. learun.alert.info(response.resMsg);
  49. }
  50. });
  51. }
  52. });
  53. }
  54. });
  55. // 清除信号
  56. $('#lr_clear').on('click', function () {
  57. var keyValue = $('#gridtable').jfGridValue('Code');
  58. var postData = $('#gridtable').jfGridGet('rowdata');
  59. if (learun.checkrow(keyValue)) {
  60. learun.layerConfirm('是否确认清除该站台信号!', function (res) {
  61. if (res) {
  62. var url = WCSWebUrl + "api/Wcs/Write?deviceType=2&devCode=" + postData.Code + "&protocol=1&propName=1&value=clear";
  63. $.ajax({
  64. type: 'post',
  65. dataType: 'json',
  66. contentType: "application/json;charset=utf-8",
  67. url: url,
  68. success: function (response) {
  69. //resCode 200 resMsg "成功"
  70. refreshGirdData();
  71. top.layer.close(top.layer.index);
  72. learun.alert.info(response.resMsg);
  73. }
  74. });
  75. }
  76. });
  77. }
  78. });
  79. },
  80. // 初始化列表
  81. initGird: function () {
  82. $('#gridtable').jfGrid({
  83. url: top.$.rootUrl + '/PTManager/DeviceInfo/GetInOutStationStatus',
  84. headData: [
  85. { label: "仓库", name: "WareHouseName", width: 80, align: "left" },
  86. { label: "站台", name: "Code", width: 80, align: "left" },
  87. { label: "名称", name: "Name", width: 80, align: "left" },
  88. {
  89. label: "有无货架", name: "StatusName", width: 150, align: "left", formatter: function (cellvalue) {
  90. if (cellvalue == '0') {
  91. return '<span class=\"label label-default\" >无货架</span>';
  92. } else {
  93. return '<span class=\"label label-success\" >有空货架</span>';
  94. }
  95. }
  96. },
  97. { label: "设备状态", name: "PHStatusName", width: 80, align: "left" },
  98. ],
  99. mainId: 'WareHouseName',
  100. isPage: false,
  101. reloadSelected: true,
  102. autowWidth: true,
  103. sidx: 'Code',
  104. sord: 'DESC',
  105. isMultiselect: false,
  106. });
  107. page.search({ queryJson: JSON.stringify({ keyword: $('#txt_Keyword').val() }) });
  108. },
  109. search: function (param) {
  110. param = param || { queryJson: JSON.stringify({ InvStateCode: 3 }) };
  111. $('#gridtable').jfGridSet('reload', param);
  112. }
  113. };
  114. refreshGirdData = function () {
  115. page.search();
  116. };
  117. page.init();
  118. }