You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

225 lines
6.8 KiB

3 days ago
  1. <#import "../master.ftl" as master>
  2. <@master.layout>
  3. <style>
  4. #fm label {
  5. width: 100px;
  6. }
  7. .page-header {
  8. margin: 20px 0 -10px;
  9. }
  10. </style>
  11. <div class="page-header">
  12. <h3>Blocked & unblocked</h3>
  13. </div>
  14. <table id="dg" class="easyui-datagrid" style="width:100%;height:460px;display: none;"
  15. data-options="pagination: true, showFooter: true, singleSelect:true, fitColumns:true,
  16. onSelect:onTableRowSelect, onLoadSuccess:onTableRowSelect,
  17. url:'/roll/getFreezeRolls',method:'POST',
  18. pageSize:20,toolbar:'#tb'">
  19. <thead>
  20. <tr>
  21. <th data-options="field:'finalRollNo',width:90,editor:'textbox'">Roll No</th>
  22. <th data-options="field:'rollQty',width:60,editor:'textbox'">Roll Qty</th>
  23. <th data-options="field:'orderNo',width:60,editor:'textbox'">SO No</th>
  24. <th data-options="field:'partNo',width:80,editor:'textbox'">Part No</th>
  25. <th data-options="field:'partDesc',width:120,editor:'textbox'">Part Description</th>
  26. <th data-options="field:'apn',width:80">APN</th>
  27. <th data-options="field:'customerPartNo',width:80">Customer Part No</th>
  28. <th data-options="field:'createdBy',width:60">Frozen By</th>
  29. <th data-options="field:'createdDate',width:100, formatter: formatStringTime">Frozen Time</th>
  30. <th data-options="field:'updatedBy',width:60">Unfrozen By</th>
  31. <th data-options="field:'updatedDate', width:100, formatter: formatStringTime">Unfrozen Time</th>
  32. <th data-options="field:'unFrozenFlag',width:60,editor:'textbox', formatter: formatFreezeStatus">Status</th>
  33. <th data-options="field:'id', width:60, formatter: formatFreezeAction">Actions</th>
  34. </tr>
  35. </thead>
  36. </table>
  37. <div id="tb" style="padding:10px 5px;display: none;">
  38. <div>
  39. &nbsp;Roll&nbsp;No:&nbsp;<input class="easyui-textbox" id="search_roll_no" style="width:100px;">
  40. &nbsp;Part&nbsp;No:&nbsp;<input class="easyui-textbox" id="search_part_no" style="width:100px">
  41. &nbsp;Order&nbsp;No:&nbsp;<input class="easyui-textbox" id="search_order_no" style="width:100px">
  42. &nbsp;是否解冻:&nbsp; <select id="status" class="easyui-combobox" style="width:100px;" data-options="required:true">
  43. <option value="">All</option>
  44. <option value="N">Blocked</option>
  45. <option value="Y">Unblocked</option>
  46. </select>
  47. <a id="queryLink" class="easyui-linkbutton" iconCls="icon-search">Search</a>
  48. <#if currentUser.isAdmin || currentUser.authorities?contains("freezeAndThaw")>
  49. <a href="javascript:void(0)" id="closedAllOrder" class="easyui-linkbutton" iconCls="icon-add" onclick="freezeRollModal()">
  50. 冻结卷</a>
  51. </#if>
  52. </div>
  53. </div>
  54. <div id="dlg" class="easyui-dialog for-scan" style="width:500px;display: none;"
  55. closed="true" buttons="#dlg-buttons">
  56. <form id="fm" method="post" novalidate style="margin:0;padding:20px 20px">
  57. <div id="serial_input_2nd" style="margin-bottom:10px">
  58. <input id="roll_no" name="rollNo" class="easyui-textbox" required="true" data-options="labelWidth:100" label="Roll No:" style="width:100%">
  59. </div>
  60. </form>
  61. </div>
  62. <div id="dlg-buttons" style="display: none; text-align: center;">
  63. <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" onclick="saveFreezeRoll()" style="width:90px">Save</a>
  64. <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dlg').dialog('close')" style="width:90px">Cancel</a>
  65. </div>
  66. <script>
  67. //公共参数
  68. let currentRow;
  69. let username = $('#current_username').val();
  70. //延时操作
  71. var delay = (function(){
  72. var timer = 0;
  73. return function(callback, ms){
  74. clearTimeout (timer);
  75. timer = setTimeout(callback, ms);
  76. };
  77. })();
  78. //设置自动的高度
  79. $(window).resize(function () {
  80. $("#dg").datagrid({"height": $(window).height() - $(".datagrid").offset().top - 30});
  81. });
  82. //重置页面的高度
  83. $(function () {
  84. $(window).resize();
  85. });
  86. //不同状态的功能
  87. function formatFreezeAction(value, row){
  88. let status = row.unfrozenFlag;
  89. let tags = '';
  90. if('N' == status){
  91. tags += '<a style="text-decoration:none;" onclick="preUnfrozenRoll(\''+row.finalRollNo+'\')">Unblocked roll</a>';
  92. }
  93. return tags;
  94. }
  95. function formatFreezeStatus(value, row){
  96. let status = row.unfrozenFlag;
  97. if('N' == status){
  98. return 'Frozen';
  99. }else{
  100. return 'Unblocked';
  101. }
  102. }
  103. //表格选中事件
  104. function onTableRowSelect(index, row) {
  105. }
  106. //查询功能
  107. $("#queryLink").click(function(){
  108. var dg = $('#dg').datagrid({
  109. queryParams: {
  110. orderNo: $.trim($("#search_order_no").val()),
  111. partNo: $.trim($("#search_part_no").val()),
  112. rollNo: $.trim($("#search_roll_no").val()),
  113. status: $("#status").val()
  114. }
  115. });
  116. });
  117. //新增冻结卷
  118. function freezeRollModal(){
  119. delay(function(){
  120. //初始化参数
  121. $('#roll_no').val('');
  122. $('#dlg').dialog('open').dialog('center').dialog('setTitle', 'New blocked roll');
  123. }, 500);
  124. }
  125. //modal打开关闭选中的箱
  126. $("#dlg").dialog({
  127. onClose: function () {
  128. //刷新订单的列表
  129. $('#dg').datagrid('reload');
  130. },
  131. onOpen: function(){
  132. //获取焦点
  133. //showEl("#dlg #input_roll", true);
  134. $('#roll_no').textbox('textbox').focus();
  135. }
  136. });
  137. //新增入库箱
  138. function saveFreezeRoll(){
  139. //参数
  140. let rollNo = $.trim($('#roll_no').val());
  141. //设置参数
  142. let postData = {'finalRollNo': rollNo, 'createdBy': username, 'updatedBy': username,
  143. 'unfrozenFlag': 'N'};
  144. //序列化
  145. postData = JSON.stringify(postData);
  146. //post请求类型修改
  147. $.ajaxSetup({
  148. contentType: "application/json;charset=utf-8"});
  149. //提交请求
  150. $.post('/roll/insertFreezeRoll', postData, function(ret){
  151. if(ret.success){
  152. //刷新箱号的列表
  153. $('#dlg').dialog('close');
  154. }else{
  155. $.messager.alert('Error',ret.msg, 'error');
  156. }
  157. }, 'json');
  158. $.ajaxSetup({
  159. contentType: "application/x-www-form-urlencoded"});
  160. }
  161. //解冻确认
  162. function preUnfrozenRoll(rollNo){
  163. $.messager.confirm('Confirm','Confirm unblocked roll: <b>'+rollNo+'</b> ?', function(r){
  164. if (r){
  165. unfrozenRoll(rollNo);
  166. }
  167. });
  168. }
  169. //删除销售交货单
  170. function unfrozenRoll(rollNo){
  171. //获取解冻的卷
  172. currentRow = $('#dg').datagrid('getSelected');
  173. let postData = {'id': currentRow.id, 'finalRollNo': rollNo, 'updatedBy': username, 'unfrozenFlag': 'Y'};
  174. //保存或修改数据
  175. //序列化
  176. postData = JSON.stringify(postData);
  177. //post请求类型修改
  178. $.ajaxSetup({
  179. contentType: "application/json;charset=utf-8"});
  180. $.post('/roll/updateFreezeRoll', postData, function(result){
  181. if (result.success){
  182. //刷新主表数据
  183. $('#dg').datagrid('reload');
  184. } else {
  185. $.messager.alert('error',result.msg, 'error');
  186. }
  187. },'json');
  188. $.ajaxSetup({
  189. contentType: " application/x-www-form-urlencoded"});
  190. }
  191. </script>
  192. </@master.layout>