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.

341 lines
14 KiB

3 days ago
  1. <#import "../master.ftl" as master>
  2. <@master.layout>
  3. <style>
  4. #fm label {
  5. width: 100px;
  6. }
  7. </style>
  8. <div class="page-header">
  9. <h3>Box Management</h3>
  10. </div>
  11. <table id="dg" class="easyui-datagrid" style="width:100%;height:460px;display: none;"
  12. data-options="pagination: true, showFooter: true, singleSelect:true, fitColumns:true , url:'/boxManage/getBoxList',method:'get',pageSize:20,toolbar:'#tb'">
  13. <thead>
  14. <tr>
  15. <th data-options="field:'boxNo',width:100,editor:'textbox'">Box No</th>
  16. <th data-options="field:'receiveNo',width:100,editor:'textbox'">Receiving No</th>
  17. <th data-options="field:'status',width:100,editor:'textbox'">Status</th>
  18. <th data-options="field:'partNo',width:100,editor:'textbox'">Part No</th>
  19. <th data-options="field:'locationNo',width:100,editor:'textbox'">Location No</th>
  20. <th data-options="field:'rollQty',width:80,editor:'textbox'">Roll Qty</th>
  21. <th data-options="field:'productDate',width:80,formatter:formatDate">Production Date</th>
  22. <th data-options="field:'createDate',width:80,formatter:formatDate">Receive Date</th>
  23. <th data-options="field:'id',width:150,align:'center',formatter:formatAction">Actions</th>
  24. </tr>
  25. </thead>
  26. </table>
  27. <div id="tb" style="padding:10px 5px;display: none;">
  28. <div>
  29. 箱号: <input class="easyui-textbox" id="boxNo" style="width:110px">
  30. 入库单号:<input class="easyui-textbox" id="receiveNo" style="width:110px">
  31. Status:<select class="easyui-combobox" panelHeight="auto" id="status" style="width:100px">
  32. <option value="">All</option>
  33. <option value="Received">Received</option>
  34. <option value="Unpacked">Unpacked</option>
  35. <option value="Packed">Packed</option>
  36. <option value="Frozen">Frozen</option>
  37. <option value="Delivered">Delivered</option>
  38. </select>
  39. 物料编码:<input class="easyui-textbox" id="partNo" style="width:110px">
  40. 库位:<input class="easyui-textbox" id="locationNo" style="width:110px">
  41. <#-- 卷数:<input class="easyui-textbox" id="rollQty" type="number" style="width:110px">-->
  42. 类型:<select class="easyui-combobox" panelHeight="auto" id="qtyType" style="width:100px">
  43. <option value="">All</option>
  44. <option value="Standard Box">Standard Box</option>
  45. <option value="Remainder Box">Remainder Box</option>
  46. </select>
  47. <a href="#nowhere" id="queryLink" class="easyui-linkbutton" iconCls="icon-search">Search</a>
  48. &nbsp;&nbsp;&nbsp;<a class="easyui-linkbutton" iconCls="icon-add" onclick="downBoxDataExcel()">Export to Excel</a>
  49. <#-- <a href="javascript:void(0)" id="tbAdd" class="easyui-linkbutton" iconCls="icon-add" onclick="newReceive()">New Box</a>-->
  50. </div>
  51. </div>
  52. <div id="dlgRollDtls" class="easyui-dialog" style="width:500px;display: none;"
  53. closed="true" data-options="modal:true,toolbar:'#dlgRollDtlstb'" >
  54. <table id="dgRollDtls" class="easyui-datagrid" style="width:100%;height:400px;display: none;"
  55. data-options="pagination: false, showFooter: true, singleSelect:true, fitColumns:true , method:'get'">
  56. <thead>
  57. <tr>
  58. <th data-options="field:'finalRollNo',width:100">FG roll number</th>
  59. <th data-options="field:'id',width:40,formatter:formatBoxRollAction">Actions</th>
  60. </tr>
  61. </thead>
  62. </table>
  63. </div>
  64. <div id="dlgRollDtlstb" style="padding:10px 5px;display: none;">
  65. <div>
  66. 扫卷入库:&nbsp;&nbsp;&nbsp;<input id="finalRollNo" name="finalRollNo" class="easyui-textbox" style="width: 120px;text-transform:uppercase;" placeholder="FG roll no" />
  67. &nbsp;&nbsp;&nbsp;
  68. <#-- <a href="javascript:void(0)" id="forceClosed" class="easyui-linkbutton" onclick="warehouse()">Receive</a>-->
  69. <a href="javascript:void(0)" id="boxingButton" class="easyui-linkbutton" onclick="doBoxing(nowBoxNo)">Pack</a>
  70. <#-- <a href="javascript:void(0)" id="tbAdd" class="easyui-linkbutton" iconCls="icon-add" onclick="newReceive()">New Box</a>-->
  71. </div>
  72. </div>
  73. <script>
  74. var boxStatus='';
  75. var nowBoxNo='';
  76. var boxReceiveNo='';
  77. $(window).resize(function () {
  78. $("#dg").datagrid({"height": $(window).height() - $(".datagrid").offset().top - 20});
  79. });
  80. $(function () {
  81. $(window).resize();
  82. });
  83. // $("#finalRollNo").on("keydown", function(event){
  84. // console.log("回车拉")
  85. // var finalRollNo = $(this).val();
  86. // if(event.keyCode == 13){
  87. // $.post("/receive/scan/add", {receiveId: 0, receiveNo: boxReceiveNo,boxNo: nowBoxNo, finalRollNo: finalRollNo, type: "Passed"} , function(data){
  88. // if (data.success){
  89. // $("#dgRollDtls").datagrid({url: "/receive/box/"+nowBoxNo+"/rolls"});
  90. // $.messager.alert("Info","Received","Info",);
  91. // $("#finalRollNo").textbox('setValue',"").focus();
  92. // }else{
  93. // $.messager.alert('Error',finalRollNo+":"+data.errorMsg, 'error');
  94. // $("#finalRollNo").textbox('setValue',"").focus();
  95. // }
  96. // });
  97. // }
  98. // }).on("blur", function() {
  99. // $(this).textbox('setValue',$(this).val().trim().toUpperCase());
  100. // })
  101. $("#finalRollNo").textbox({
  102. inputEvents: $.extend({}, $.fn.textbox.defaults.inputEvents,{
  103. keyup:function(event){
  104. if(event.keyCode == 13){
  105. console.log("回车");
  106. let finalRollNo=$("#finalRollNo").val();
  107. $.post("/receive/scan/add", {receiveId: 0, receiveNo: boxReceiveNo,boxNo: nowBoxNo, finalRollNo: finalRollNo, type: "Passed"} , function(data){
  108. if (data.success){
  109. $("#dgRollDtls").datagrid({url: "/receive/box/"+nowBoxNo+"/rolls"});
  110. // $.messager.alert("Info","Received","Info",);
  111. $("#finalRollNo").textbox('setValue',"").focus();
  112. }else{
  113. $.messager.alert('Error',finalRollNo+":"+data.errorMsg, 'error');
  114. $("#finalRollNo").textbox('setValue',"").focus();
  115. }
  116. });
  117. }
  118. }
  119. })
  120. })
  121. function formatDateTime(value,row){
  122. if (value && value > 0){
  123. var d = new Date(value);
  124. var MM = d.getMonth() <= 9 ? '0'+(d.getMonth()+1) : d.getMonth() + 1;
  125. var hh = d.getHours() <= 9 ? '0'+d.getHours() : d.getHours();
  126. var mm = d.getMinutes() <= 9 ? '0'+d.getMinutes() : d.getMinutes();
  127. var ss = d.getSeconds() <= 9 ? '0'+d.getSeconds() : d.getSeconds();
  128. var dd = d.getDate() <= 9 ? '0'+d.getDate() : d.getDate();
  129. var datestring = d.getFullYear() + "-" + MM + "-" + dd + " " + hh + ":" + mm + ":" + ss;
  130. return datestring;
  131. }
  132. return "";
  133. }
  134. function formatDate(value,row){
  135. if (value && value > 0){
  136. var d = new Date(value);
  137. var MM = d.getMonth() < 9 ? '0'+(d.getMonth()+1) : d.getMonth() + 1;
  138. var dd = d.getDate() <= 9 ? '0'+d.getDate() : d.getDate();
  139. var datestring = d.getFullYear() + "-" + MM + "-" + dd;
  140. return datestring;
  141. }
  142. return "";
  143. }
  144. function warehouse(){
  145. var finalRollNo = $("#finalRollNo").val();
  146. $.post("/receive/scan/add", {receiveId: 0, receiveNo: boxReceiveNo,boxNo: nowBoxNo, finalRollNo: finalRollNo, type: "Passed"} , function(data){
  147. if (data.success){
  148. $("#dgRollDtls").datagrid({url: "/receive/box/"+nowBoxNo+"/rolls"});
  149. $("#finalRollNo").textbox('setValue',"").focus();
  150. $.messager.alert("Info","Received","Info",);
  151. }else{
  152. $("#finalRollNo").textbox('setValue',"").focus();
  153. $.messager.alert('Error',finalRollNo+":"+data.errorMsg, 'error');
  154. }
  155. });
  156. }
  157. function formatAction(value, row){
  158. var action="<a href='javascript:viewBoxRolls(\"" + row.boxNo + "\",\"" + row.status+ "\",\"" + row.receiveNo + "\");'>Received Rolls</a>" ;
  159. if (row.status=='Packed'){
  160. action += "&nbsp;&nbsp;|&nbsp;&nbsp;<a href='javascript:doUnBoxing(\""+row.boxNo+"\")'>Unfrozen</a>";
  161. }
  162. if (row.status=='Received'){
  163. action += "&nbsp;&nbsp;|&nbsp;&nbsp;<a href='javascript:freezeBox(\""+row.boxNo+"\")'>Frozen</a>";
  164. }
  165. if (row.status=='Frozen'){
  166. action += "&nbsp;&nbsp;|&nbsp;&nbsp;<a href='javascript:thawBox(\""+row.boxNo+"\")'>Unblocked</a>";
  167. }
  168. if (row.status == "Unpacked"){
  169. action += "&nbsp;&nbsp;|&nbsp;&nbsp;<a href='javascript:doBoxing(\""+row.boxNo+"\")'>Pack</a>";
  170. action += "&nbsp;|&nbsp;<a href='javascript:delBox(\"" + row.boxNo + "\");'>Delete</a>";
  171. }
  172. return action;
  173. }
  174. function freezeBox(boxNo){
  175. $.messager.confirm("Confirm","Submit", function(cr){
  176. if (cr){
  177. $.post("/receive/boxes/freezeBox", {boxNo: boxNo}, function(ret){
  178. if (ret.success){
  179. $('#dg').datagrid('reload');
  180. }else{
  181. $.messager.alert("Error", ret.errorMsg, "error");
  182. }
  183. })
  184. }
  185. })
  186. }
  187. function thawBox(boxNo){
  188. $.messager.confirm("Confirm","Submit", function(cr){
  189. if (cr){
  190. $.post("/receive/boxes/thawBox", {boxNo: boxNo}, function(ret){
  191. if (ret.success){
  192. $('#dg').datagrid('reload');
  193. }else{
  194. $.messager.alert("Error", ret.errorMsg, "error");
  195. }
  196. })
  197. }
  198. })
  199. }
  200. function doBoxing(boxNo){
  201. $.messager.confirm("Confirm","Submit", function(cr){
  202. if (cr){
  203. $.post("/receive/boxes/finish", {boxNo: boxNo}, function(ret){
  204. if (ret.success){
  205. $("#ifmforprint").attr('src', "/print/receiveBox/" + ret.box.boxNo + "/");
  206. $('#dg').datagrid('reload');
  207. $('#dlgRollDtls').dialog('close')
  208. }else{
  209. $.messager.alert("Error", ret.errorMsg, "error");
  210. }
  211. })
  212. }
  213. })
  214. }
  215. function doUnBoxing(boxNo){
  216. $.messager.confirm("Confirm","Submit", function(cr){
  217. if (cr){
  218. $.post("/receive/boxes/unBoxing", {boxNo: boxNo}, function(ret){
  219. if (ret.success){
  220. $('#dg').datagrid('reload');
  221. }else{
  222. $.messager.alert("Error", ret.errorMsg, "error");
  223. }
  224. })
  225. }
  226. })
  227. }
  228. //删除出库下的箱子
  229. function delBox(boxNo){
  230. $.messager.confirm('Confirm','Are you sure to delete the data ?',function(status){
  231. if (status){
  232. $.ajax({
  233. url : "/receive/delBox",
  234. type : "POST",
  235. data : {boxNo: boxNo},
  236. dataType : "json",
  237. success : function(data) {
  238. var code = data.code;
  239. if(code=='0'){
  240. $('#dg').datagrid('reload');
  241. $.messager.alert("Info",data.msg,"Info",);
  242. }else{
  243. $.messager.alert('Error',data.msg, 'error');
  244. }
  245. },
  246. error : function(data) {
  247. $.messager.alert('Error',data.msg, 'error');
  248. }
  249. });
  250. }
  251. });
  252. }
  253. //查看
  254. function viewBoxRolls(boxNo,status,receiveNo){
  255. //设置当前的数据
  256. boxStatus=status;
  257. nowBoxNo=boxNo;
  258. boxReceiveNo=receiveNo;
  259. if(status=='Unpacked'){
  260. $("#finalRollNo").textbox({disabled:false});
  261. // enableEl("#boxingButton",true);
  262. $("#boxingButton").linkbutton({"disabled": false});
  263. }else {
  264. $("#finalRollNo").textbox({disabled:true});
  265. // enableEl("#boxingButton",false);
  266. $("#boxingButton").linkbutton({"disabled": true});
  267. }
  268. $('#dlgRollDtls').dialog('open').dialog('center').dialog('setTitle',boxNo+' SFG roll');
  269. $("#dgRollDtls").datagrid({url: "/receive/box/"+boxNo+"/rolls"});
  270. }
  271. //查看页面
  272. function formatBoxRollAction(value, row){
  273. var action = "";
  274. if(boxStatus=="Unpacked"){
  275. action += "<a href='javascript:delBoxRoll(\"" + row.id + "\");'>Delete</a>";
  276. }
  277. return action;
  278. }
  279. function delBoxRoll(boxRollId){
  280. $.messager.confirm('Confirm','Are you sure to delete the data ?',function(r){
  281. if (r){
  282. $.post('/receive/boxroll/'+boxRollId+'/del',{},function(result){
  283. if (result.success){
  284. $('#dgRollDtls').datagrid('reload');
  285. } else {
  286. $.messager.alert('Error',result.errorMsg, 'error');
  287. }
  288. },'json');
  289. }
  290. });
  291. }
  292. $("#queryLink").click(function(){
  293. var dg = $('#dg').datagrid({
  294. queryParams: {
  295. boxNo: $("#boxNo").val(),
  296. receiveNo: $("#receiveNo").val(),
  297. status: $("#status").val(),
  298. partNo: $("#partNo").val()
  299. ,qtyType: $("#qtyType").val()
  300. ,locationNo: $("#locationNo").val()
  301. }
  302. });
  303. });
  304. //下载Excel数据
  305. function downBoxDataExcel(){
  306. let boxNo = $("#boxNo").val();
  307. let receiveNo = $("#receiveNo").val();
  308. let status = $("#status").val();
  309. let partNo = $("#partNo").val();
  310. let qtyType = $("#qtyType").val();
  311. let locationNo = $("#locationNo").val();
  312. let print_url = '/export/inventory/downBoxDataExcel?boxNo='+boxNo+'&receiveNo='+receiveNo+'&statusDesc='+status+'&partNo='+partNo+'&qtyType='+qtyType+'&locationNo='+locationNo;
  313. $("#ifmforprint").attr('src', print_url);
  314. }
  315. </script>
  316. </@master.layout>