PrintPickingList.html 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>打印拣货清单</title>
  5. <link rel="stylesheet" href="../commons/css/font/iconfont.css"/>
  6. <link rel="stylesheet" href="../commons/css/awsui.css"/>
  7. <style>
  8. .listTable {
  9. width: 100%;
  10. border-collapse: collapse;
  11. }
  12. .listTable th, .listTable td {
  13. padding: 5px;
  14. text-align: center;
  15. border: 1px solid #ddd;
  16. }
  17. .listTable th {
  18. background-color: darkgrey;
  19. }
  20. .listTable tr:nth-child(even) {
  21. background-color: #f2f2f2;
  22. }
  23. .ButtonContainer ul {
  24. list-style-type: none;
  25. padding: 0;
  26. }
  27. .ButtonContainer li {
  28. display: inline-block;
  29. margin-right: 10px;
  30. cursor: pointer;
  31. }
  32. .ButtonContainer span.Text {
  33. vertical-align: middle;
  34. }
  35. @media print {
  36. .noprint {
  37. display: none;
  38. }
  39. @page {
  40. size: auto;
  41. margin: 0mm;
  42. }
  43. }
  44. </style>
  45. </head>
  46. <body>
  47. <div>
  48. <div class="TitleBar noprint">
  49. <div class="Title" style=" color: white; background-color: #346a95; font-size: 15pt; margin: 5px;">
  50. <span>打印拣货清单</span>
  51. </div>
  52. </div>
  53. <div class="ButtonContainer header-title noprint" style="margin-left: 10px;">
  54. <button id="ViewPdfButton" type="button" class="awsui-btn awsui-btn-blue">打印</button>
  55. <button type="button" class="awsui-btn" onclick="closeDialog()">关闭</button>
  56. </div>
  57. <div class="DivSection" style="padding-left: 20px; width: 700px;">
  58. <div class="noprint" style="margin-top: 10px;">
  59. <select id="accountId" name="accountId" onchange="accountChange()" style="width: 450px;">
  60. </select>
  61. </div>
  62. <div id="quoteTemplateDiv" style="margin-top: 20px;">
  63. <div style="width: 100%; height: 50px;">
  64. <div style="float: right;">
  65. <span id="time_label"></span>
  66. <br/>
  67. <span style="font-weight: bold; font-size: larger;">拣货清单</span>
  68. </div>
  69. </div>
  70. <div style="width: 50%; height: 50px; border: 1px solid; padding: 5px;">
  71. <div>销售目标地址:<span id="SALES_ADDRESS"></span></div>
  72. <div>配送地址:<span id="SHIP_TO_ADDRESS"></span></div>
  73. </div>
  74. <div style="width: 100%; height: 150px; border: 1px solid; padding: 5px; margin-top: 20px;">
  75. <div style="width: 48%; float: left; height: 100px;" id="accountInfo">
  76. </div>
  77. <div style="width: 48%; float: left; height: 100px;" id="otherInfo">
  78. </div>
  79. </div>
  80. <div id="dataTable" style="margin-top: 20px; width: 100%;">
  81. <table class="listTable">
  82. <thead>
  83. <tr>
  84. <th>产品</th>
  85. <th>参考号</th>
  86. <th>仓库</th>
  87. <th>仓位</th>
  88. <th>拣货数量</th>
  89. <th>实际拣货数量</th>
  90. </tr>
  91. </thead>
  92. <tbody id="dataTbody">
  93. <tr>
  94. </tr>
  95. </tbody>
  96. </table>
  97. </div>
  98. </div>
  99. </div>
  100. </div>
  101. </body>
  102. <script language="JavaScript" src="../commons/js/jquery/scripts/jquery.js"></script>
  103. <script language="JavaScript" src="../commons/js/awsui.js"></script>
  104. <script type="text/javascript">
  105. const uid = "<#uid>";
  106. const sid = "<#sid>";
  107. const costPdtIds = "<#costPdtIds>";
  108. const accountListData = '<#accountList>';
  109. $(function () {
  110. //初始化
  111. $("#accountId").append("<option value='0'>请选择</option>");
  112. let accountList = JSON.parse(accountListData);
  113. for (let i = 0; i < accountList.length; i++) {
  114. $("#accountId").append("<option value='" + accountList[i].ACCOUNT_ID + "'>" + accountList[i].ACCOUNT_NAME + "</option>");
  115. }
  116. $("#accountId").val(accountList[0].ACCOUNT_ID);
  117. accountChange();
  118. // 更新时间函数
  119. function updateTime() {
  120. const date = new Date();
  121. const year = date.getFullYear();
  122. const month = String(date.getMonth() + 1).padStart(2, '0');
  123. const day = String(date.getDate()).padStart(2, '0');
  124. const hour = date.getHours();
  125. const minute = String(date.getMinutes()).padStart(2, '0');
  126. const second = String(date.getSeconds()).padStart(2, '0');
  127. const period = hour < 12 ? '上午' : '下午';
  128. $('#time_label').text(`${year}-${month}-${day} ${period} ${hour}:${minute}:${second}`);
  129. }
  130. // 页面加载时先执行一次
  131. updateTime();
  132. // 每隔 60 秒更新一次时间
  133. setInterval(updateTime, 500); // 60 * 1000 毫秒
  134. });
  135. //切换客户
  136. function accountChange() {
  137. let accountId = $("#accountId").val();
  138. $("#accountInfo").html("");
  139. $("#accountInfo").html($("#accountId").find("option:selected").text());
  140. $("#otherInfo").html("");
  141. awsui.ajax.request({
  142. type: "POST", async: false, dataType: "json",
  143. url: "./jd?cmd=com.awspaas.user.apps.donenow_ivt.getCostProductPickList",
  144. data: "sid=" + sid + "&accountId=" + accountId + "&costPdtIds=" + costPdtIds,
  145. success: function (res) {
  146. console.log("产品列表");
  147. console.log(res);
  148. if (res.result == "ok") {
  149. var data = res.data;
  150. var packings = data.PICKINGS;
  151. for (var j = 0; j < packings.length; j++) {
  152. var packing = packings[j];
  153. $("#dataTbody").append("<tr><td>" + getValue(packing.PRODUCTNAME) + "</td><td>" + getValue(packing.REFERENCENUMBER) + "</td><td>" + getValue(packing.WAREHOUSE) + "</td><td>" + getValue(packing.LOCATION) + "</td><td>" + packing.QUANTITY + "</td><td></td></tr>")
  154. }
  155. $("#otherInfo").append(getValue(data.CONTRACT_INFO) + "<br/>");
  156. $("#SHIP_TO_ADDRESS").html(getValue(data.SHIP_TO_ADDRESS));
  157. $("#SALES_ADDRESS").html(getValue(data.SALES_ADDRESS));
  158. }
  159. }
  160. });
  161. }
  162. $("#ViewPdfButton").on("click", function () {
  163. window.print();
  164. });
  165. function closeDialog() {
  166. parent.document.querySelector(".el-overlay>.el-overlay-dialog[aria-label='拣货清单']>div.full-center-dialog>.show-close>.el-dialog__headerbtn").click();
  167. }
  168. //undefined null 都转成 空字符
  169. function getValue(value) {
  170. if (value == undefined || value == null || typeof (value) == "undefined") {
  171. return "";
  172. } else {
  173. return value;
  174. }
  175. }
  176. </script>
  177. </html>