replenishmentDetailMaxPortal.jsp 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <%@ page contentType="text/html;charset=UTF-8"%>
  2. <%@ include file="/WEB-INF/include/taglibs.jsp"%>
  3. <table align="center" style="width:100%;height:30px">
  4. <tr>
  5. <td class="title">未完成:</td><td><span id="replenishmentNewCountsMax"/></td>
  6. <td class="title">补货中:</td><td><span id="replenishmentInhandCountsMax"/></td>
  7. <td class="title">已完成补货:</td><td><span id="replenishementFinishedCountsMax"/></td>
  8. <td>&nbsp;</td>
  9. </tr>
  10. </table>
  11. <table id="replenishmentPortalgridMax" class="easyui-datagrid" data-options="border:false,fitColumns:true">
  12. <thead>
  13. <tr>
  14. <th data-options="field:'id',hidden:true">主键</th>
  15. <th data-options="field:'itemName',align:'center'">商品</th>
  16. <th data-options="field:'itemCode',align:'center',width:100">商品编码</th>
  17. <th data-options="field:'status',align:'center',width:100,formatter:replenishmentStatusFormat">补货状态</th>
  18. <th data-options="field:'needQuantity',align:'center',width:100">补货数量</th>
  19. <th data-options="field:'toLocationName',align:'center',width:100">储位</th>
  20. <th data-options="field:'creationTime',align:'center',width:100">制单时间</th>
  21. </tr>
  22. </thead>
  23. </table>
  24. <script type="text/javascript">
  25. function replenishmentStatusFormat(value, row, index) {
  26. if(value == '5300') {
  27. return "新纪录";
  28. } else if(value == '5301') {
  29. return "任务中";
  30. } else if(value == '5302') {
  31. return "已完成";
  32. } else if(value == '5303') {
  33. return "已取消";
  34. }
  35. }
  36. $(function(){
  37. var $portalgrid = $("#replenishmentPortalgridMax");
  38. var portalgridData = [];
  39. var pageSize = 15;
  40. var beginIndex = 0;
  41. var endIndex = 0;
  42. var totalCounts = 0;
  43. var totalPages = 0;
  44. loadPortalData();
  45. // intervalIdForReplenishmentDetailLoadData= setInterval(loadPortalData, 1000 * 60 * 5);
  46. function loadPortalData() {
  47. // if(intervalIdForReplenishmentDetailScrollUp) {
  48. // clearInterval(intervalIdForReplenishmentDetailScrollUp);
  49. // }
  50. $.ajax({
  51. url : "${pageContext.request.contextPath}/ReplenishmentDetail/loadPortalData.action",
  52. type : 'post',
  53. dataType : 'json',
  54. success : function(resp) {
  55. if(resp.replenishmentDetails) {
  56. portalgridData = resp.replenishmentDetails;
  57. if(portalgridData.length) {
  58. totalCounts = portalgridData.length;
  59. totalPages = totalCounts % pageSize == 0 ? totalCounts / pageSize : totalCounts / pageSize + 1;
  60. if(totalPages.toFixed(0) > 1) {
  61. beginIndex = 0;
  62. endIndex = pageSize;
  63. scrollup();
  64. // intervalIdForReplenishmentDetailScrollUp = setInterval(scrollup, 1000 * 5);
  65. } else {
  66. $portalgrid.datagrid("loadData", portalgridData);
  67. }
  68. }
  69. }
  70. $("#replenishmentNewCountsMax").text(resp.newCounts ? resp.newCounts : 0);
  71. $("#replenishmentInhandCountsMax").text(resp.inhandCounts ? resp.inhandCounts : 0);
  72. $("#replenishementFinishedCountsMax").text(resp.finishedCounts ? resp.finishedCounts : 0);
  73. }
  74. });
  75. }
  76. function scrollup() {
  77. var _portalgridData = [];
  78. for(var i = beginIndex; i < endIndex; i++) {
  79. _portalgridData.push(portalgridData[i]);
  80. $portalgrid.datagrid("loadData", _portalgridData);
  81. }
  82. beginIndex = beginIndex + pageSize;
  83. beginIndex = beginIndex > totalCounts ? 0 : beginIndex;
  84. endIndex = beginIndex + pageSize > totalCounts ? totalCounts : beginIndex + pageSize;
  85. }
  86. });
  87. </script>