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.

862 lines
28 KiB

1 week ago
  1. <#import "../master.ftl" as master>
  2. <@master.layout>
  3. <style>
  4. #fm label {
  5. width: 150px;
  6. }
  7. .page-header {
  8. margin: 20px 0 -10px;
  9. }
  10. .customer-label .textbox-label{
  11. width: 120px;
  12. }
  13. </style>
  14. <div class="page-header">
  15. <h3>Packing&Receive</h3>
  16. </div>
  17. <!-- 页面表单 -->
  18. <table id="dg" class="easyui-datagrid" style="width:100%; height:400px;display: none;"
  19. data-options="pagination: true, pageSize: 20, singleSelect:true, showFooter: true, fitColumns:true,
  20. onSelect:onTableRowSelect, url:'/so/fqc/getPackSoOrderList', method:'POST', queryParams:{'status': 'Generated'},
  21. toolbar:'#tb'">
  22. <thead>
  23. <tr>
  24. <th data-options="field:'orderNo',width:80,editor:'textbox'">SO No</th>
  25. <th data-options="field:'partNo',width:80,editor:'textbox'">Part No</th>
  26. <th data-options="field:'partDesc',width:140,editor:'textbox'">Part Description</th>
  27. <th data-options="field:'revNo',width:50">Rev No</th>
  28. <th data-options="field:'lotSize',width:60,editor:'textbox'">Lot Size</th>
  29. <th data-options="field:'stockedQty',width:60,editor:'textbox'">Received Qty</th>
  30. <th data-options="field:'packageQty',width:60,editor:'textbox'">Standard Roll Qty</th>
  31. <th data-options="field:'boxQty',width:60,editor:'textbox'">Standard Box Qty</th>
  32. <th data-options="field:'id',width:250,editor:'textbox', formatter: formatOrderAction">Actions</th>
  33. </tr>
  34. </thead>
  35. </table>
  36. <!-- 页面的查询框 -->
  37. <div id="tb" style="padding:10px 5px;display: none;">
  38. <div>
  39. SO No: <input class="easyui-textbox" id="orderNo" style="width:110px">
  40. Create Date: <input class="easyui-datebox" id="createdDateFrom" style="width:100px">
  41. to: <input class="easyui-datebox" id="createdDateTo" style="width:100px">
  42. <a href="#nowhere" id="queryLink" class="easyui-linkbutton" iconCls="icon-search">Query</a>
  43. <a style="text-decoration:none;" class="easyui-linkbutton" onclick="stockBoxModal()">Receive Scanning</a>
  44. </div>
  45. </div>
  46. <!-- 入库箱的列表 -->
  47. <div id="box_modal" class="easyui-dialog" style="width: 550px; top: -80px; display: none;"
  48. closed="true" data-options="modal:true, onSelect:onTableRowSelectBox" >
  49. <table id="box_modal_table" class="easyui-datagrid" style="width:100%;height:300px;display: none;"
  50. data-options="pagination: false, showFooter: true, singleSelect:true, fitColumns:true ,
  51. method:'POST', pageSize:50, toolbar:'#tbBoxDtls'">
  52. <thead>
  53. <tr>
  54. <th data-options="field:'boxNo',width:100">Box No</th>
  55. <th data-options="field:'boxQty',width:60, editor:'textbox'">Qty</th>
  56. <th data-options="field:'status',width:60, formatter:formatBoxStatus">Status</th>
  57. <th data-options="field:'id',width:220, formatter:formatBoxFunction">Actions</th>
  58. </tr>
  59. </thead>
  60. </table>
  61. </div>
  62. <div id="tbBoxDtls" style="padding:10px 5px;display: none;">
  63. <div id="btn_box_excel">
  64. <a href="javascript:void(0)" id="add_box" class="easyui-linkbutton" iconCls="icon-add" onclick="addBoxData()">New Box</a>
  65. </div>
  66. </div>
  67. <!-- 扫描卷modal -->
  68. <div id="scan_roll_modal" class="easyui-dialog" style="width: 405px; display: none;" closed="true" data-options="modal: true, onClose: function(){
  69. $('#box_modal_table').datagrid('reload')},">
  70. <form id="scan_roll_fm" method="post" novalidate style="margin:0; padding: 20px 20px">
  71. <div style="margin-bottom:10px">
  72. <label id="current_box_no">Box No:</label>
  73. </div>
  74. <div style="margin-bottom:10px">
  75. <label>Roll no:</label>
  76. <input id="scan_roll_no" name="rollNo" style="width: 75%; margin-left: 10px;">
  77. </div>
  78. </form>
  79. <table id="scan_rolls" class="easyui-datagrid" style="width:100%;height: 300px;">
  80. <thead>
  81. <tr>
  82. <th data-options="field:'sortNo',width:60, formatter:formatRollSort">Item No</th>
  83. <th data-options="field:'rollNo',width:120,editor:'textbox'">Roll No</th>
  84. <th data-options="field:'rollQty',width:80,editor:'textbox'">Qty</th>
  85. <th data-options="field:'id',width:98, formatter: formatRollFunction">Actions</th>
  86. </tr>
  87. </thead>
  88. </table>
  89. </div>
  90. <!-- 整箱扫描 -->
  91. <div id="stock_box_modal" class="easyui-dialog" buttons='#tbStockBox' style="width: 400px; display: none;" closed="true" buttons="#scan-box-buttons"
  92. data-options="modal:true, " >
  93. <div id="stock_box_fm" style="margin-left: 20px; margin-top: 20px; margin-bottom: 20px">
  94. <div style="margin-bottom:10px">
  95. <label>Box No:</label>
  96. <input id="scan_box_no" name="boxNo" style="height:26px; margin-left: 12%; width:67%">
  97. </div>
  98. <div style="margin-bottom:10px">
  99. <label>Location No:</label>
  100. <input id="scan_location_no" name="locationNo" style="height:26px; margin-left: 12%; width:67%">
  101. </div>
  102. </div>
  103. <table id="stock_box_table" class="easyui-datagrid" style="width:100%;height: 300px;">
  104. <thead>
  105. <tr>
  106. <th data-options="field:'sortNo',width:60, formatter: formatStockBoxSort">Item No</th>
  107. <th data-options="field:'boxNo',width:120,editor:'textbox'">New Box No</th>
  108. <th data-options="field:'boxQty',width:90,editor:'textbox'">Box Qty</th>
  109. <th data-options="field:'id',width:98, formatter: formatStockBoxFunction">Actions</th>
  110. </tr>
  111. </thead>
  112. </table>
  113. </div>
  114. <div id="tbStockBox" style="padding:10px 5px; display: none; text-align: center;">
  115. <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-add" onclick="batchToStock()">Batch Receive</a>
  116. <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#stock_box_modal').dialog('close')" style="width:90px">Cancel</a>
  117. </div>
  118. <!-- 箱管理 -->
  119. <div id="box_manage_modal" class="easyui-dialog" style="width: 650px; display: none;" closed="true" data-options="modal:true, " >
  120. <table id="manage_boxs" class="easyui-datagrid" style="width:100%;height: 300px;">
  121. <thead>
  122. <tr>
  123. <th data-options="field:'sortNo',width:60, formatter: formatManageBoxSort">Item No</th>
  124. <th data-options="field:'boxNo',width:120,editor:'textbox'">New Box No</th>
  125. <th data-options="field:'boxQty',width:90,editor:'textbox'">Box Qty</th>
  126. <th data-options="field:'locationNo',width:100,editor:'textbox'">Location No</th>
  127. <th data-options="field:'id',width:220, formatter: formatManageBoxFunction">Actions</th>
  128. </tr>
  129. </thead>
  130. </table>
  131. </div>
  132. <!-- 扫描返工 -->
  133. <div id="rework_box_modal" class="easyui-dialog" style="width: 400px; display: none;" closed="true"
  134. data-options="modal:true, " >
  135. <div id="rework_box_fm" style="margin-left: 20px; margin-top: 20px; margin-bottom: 20px">
  136. <div style="margin-bottom:10px">
  137. <label>Box No:</label>
  138. <input id="rework_box_no" name="boxNo" style="height:26px; margin-left: 12%; width:67%">
  139. </div>
  140. </div>
  141. </div>
  142. <!-- 扫描取消返工 -->
  143. <div id="cancel_rework_modal" class="easyui-dialog" style="width: 400px; display: none;" closed="true"
  144. data-options="modal:true, " >
  145. <div id="cancel_rework_fm" style="margin-left: 20px; margin-top: 20px; margin-bottom: 20px">
  146. <div style="margin-bottom:10px">
  147. <label>Roll No:</label>
  148. <input id="rework_roll_no" name="rollNo" style="height:26px; margin-left: 12%; width:67%">
  149. </div>
  150. </div>
  151. </div>
  152. <script>
  153. //临时参数
  154. let site = $('#current_site').val();
  155. let username = $('#current_username').val();
  156. var currentRow;//当前行
  157. var currentBoxRow;//当前的箱
  158. //控制页面的高度
  159. $(window).resize(function () {
  160. $("#dg").datagrid({"height": $(window).height() - $(".datagrid").offset().top - 30});
  161. });
  162. //初始化页面的高度
  163. $(function () {
  164. $(window).resize();
  165. });
  166. //处理菜单的功能
  167. function onTableRowSelect(index, row) {
  168. currentRow = row;
  169. }
  170. //自动选定箱
  171. function onTableRowSelectBox(index, row) {
  172. currentBoxRow = row;
  173. }
  174. //查询功能
  175. $("#queryLink").click(function(){
  176. var dg = $('#dg').datagrid({
  177. queryParams: {
  178. orderNo: $("#orderNo").val(),
  179. createdDateFrom: $("#createdDateFrom").val(),
  180. createdDateTo: $("#createdDateTo").val(),
  181. 'status': 'Generated'
  182. }
  183. });
  184. });
  185. //格式化工单的功能
  186. function formatOrderAction(value, row){
  187. let tags = '';
  188. tags += '<a style="text-decoration:none;" onclick="boxManagerModal()">Scanning Box</a>'+' | ';
  189. tags += '<a style="text-decoration:none;" onclick="boxManageModal(\''+row.orderNo+'\')">Box Management</a>'+' | ';
  190. tags += '<a style="text-decoration:none;" onclick="reworkBoxModal(\''+row.orderNo+'\')">Rework</a>'+' | ';
  191. tags += '<a style="text-decoration:none;" onclick="cancelReworkModal(\''+row.orderNo+'\')">Cancel Rework</a>';
  192. return tags;
  193. }
  194. //格式化箱状态
  195. function formatBoxStatus(value, row){
  196. if ('Created' == value) {
  197. return "Created";
  198. }else if('Boxing' == value){
  199. return 'Packing';
  200. }else if('Boxed' == value){
  201. return 'Packed';
  202. }else if('Delivered' == value){
  203. return 'Shipped';
  204. }else if('Stocked' == value){
  205. return 'Received';
  206. }
  207. }
  208. //中包的功能菜单
  209. function formatBoxFunction(value, row){
  210. let status = row.status;
  211. let tags = '';
  212. if('Created' == status){
  213. tags += '<a style="text-decoration:none;" onclick="boxingPackModal(\'box\')">Scanning Box</a> | ';
  214. tags += '<a style="text-decoration:none;" onclick="deleteSoOrderBox(\''+row.boxNo+'\')">Delete</a>';
  215. }else if('Boxing' == status){
  216. tags += '<a style="text-decoration:none;" onclick="boxingPackModal(\'box\')">Scanning Box</a> | ';
  217. tags += '<a style="text-decoration:none;" onclick="deleteSoOrderBox(\''+row.boxNo+'\')">Delete</a> | ';
  218. tags += '<a style="text-decoration:none;" onclick="sealingBox(\''+row.boxNo+'\')">Packed</a>';
  219. }else if('Boxed' == status){
  220. tags += '<a style="text-decoration:none;" onclick="openBoxedRollModal()">List of Rolls</a> | ';
  221. tags += '<a style="text-decoration:none;" onclick="preUnsealBox(\''+row.boxNo+'\')">UnPack</a>';
  222. tags += ' | <a style="text-decoration:none;" onclick="printBoxLabelThird(\''+row.boxNo+'\')">Print Box Label</a>';
  223. }else if('Stocked' == status){
  224. tags += '<a style="text-decoration:none;" onclick="openBoxedRollModal()">List of Rolls</a> ';
  225. tags += ' | <a style="text-decoration:none;" onclick="printBoxLabelThird(\''+row.boxNo+'\')">Print Box Label</a>';
  226. }else {
  227. tags += '<a style="text-decoration:none;" onclick="openBoxedRollModal()">List of Rolls</a> ';
  228. }
  229. return tags;
  230. }
  231. function printBoxLabelThird( boxNo){
  232. $("#ifmforprint").attr('src', "/aoi/receiveBox/" + boxNo );
  233. }
  234. //查询当前箱数据
  235. function boxManagerModal(){
  236. delay(function(){
  237. let row = $('#dg').datagrid('getSelected');
  238. //设置当前的行
  239. currentRow = row;
  240. let reworkType = row.reworkType;
  241. $("#add_box").linkbutton({"disabled": false});
  242. $('#box_modal').dialog('open').dialog('center').dialog('setTitle', currentRow.orderNo+'Box Management');
  243. var opts = $('#box_modal_table').datagrid('options');
  244. opts.queryParams = {'orderNo': currentRow.orderNo};
  245. $("#box_modal_table").datagrid({url: "/so/fqc/getPackSoOrderBoxs",
  246. onLoadSuccess: function(data) {
  247. }
  248. });
  249. }, 500);
  250. }
  251. //新增工单箱
  252. function addBoxData(){
  253. //设置参数
  254. let postData = {'site': site, 'orderNo': currentRow.orderNo, 'boxQty': 0, 'createdBy': $('#current_username').val(),
  255. 'status': 'Created', 'statusCode': 1};
  256. //序列化
  257. postData = JSON.stringify(postData);
  258. //post请求类型修改
  259. $.ajaxSetup({
  260. contentType: "application/json;charset=utf-8"});
  261. //提交请求
  262. $.post('/so/fqc/addSoOrderBoxData', postData, function(result){
  263. if(result.success){
  264. currentBoxRow = result.row;
  265. //打开箱扫描卷的页面
  266. boxingPackModal();
  267. //刷新箱号的列表
  268. $('#box_modal_table').datagrid('reload')
  269. }else{
  270. $.messager.alert('Error',ret.msg, 'error');
  271. }
  272. }, 'json');
  273. $.ajaxSetup({
  274. contentType: "application/x-www-form-urlencoded"});
  275. }
  276. //延时操作
  277. var delay = (function(){
  278. var timer = 0;
  279. return function(callback, ms){
  280. clearTimeout (timer);
  281. timer = setTimeout(callback, ms);
  282. };
  283. })();
  284. //扫描Roll的modal
  285. function boxingPackModal(entryMark){
  286. delay(function(){
  287. //判断是否扫描进来的
  288. if(entryMark){
  289. currentBoxRow = $('#box_modal_table').datagrid('getSelected');
  290. }
  291. //显示form
  292. $('#scan_roll_fm').show();
  293. //设置当前的行
  294. $('#scan_roll_modal').dialog('open').dialog('center').dialog('setTitle', "Box No:"+currentBoxRow.boxNo);
  295. //设置参数
  296. $("#current_box_no").html("Box No: "+currentBoxRow.boxNo)
  297. $('#scan_roll_no').focus();
  298. //加sn的数据
  299. var opts = $('#scan_rolls').datagrid('options');
  300. opts.queryParams = {'orderNo': currentRow.orderNo, "boxNo": currentBoxRow.boxNo};
  301. $("#scan_rolls").datagrid({url: "/so/fqc/getPackSoOrderBoxRolls",
  302. onLoadSuccess: function(data) {
  303. }
  304. });
  305. }, 500);
  306. }
  307. //roll表格序号
  308. function formatRollSort(value, row, index){
  309. let rows = $("#scan_rolls").datagrid("getData").rows;
  310. let total = rows.length;
  311. return total - index;
  312. }
  313. //sn列表的功能
  314. function formatRollFunction(value, row){
  315. let status = currentBoxRow.status;
  316. let tags = '';
  317. //没有封包的时候才可以删除
  318. if('Created' == status || 'Boxing' == status){
  319. tags += '<a style="text-decoration:none;" onclick="deleteSoOrderRoll(\''+row.rollNo+'\')">Delete</a>';
  320. }
  321. return tags;
  322. }
  323. //页面打开关闭选中的箱
  324. $("#scan_roll_modal").dialog({
  325. onOpen: function () {
  326. //获取焦点
  327. $('#scan_roll_no').focus();
  328. }
  329. });
  330. //绑定的enter事件
  331. $('#scan_roll_no').bind("keydown", function (e) {
  332. if (e.keyCode == 13) {
  333. let rollNo = $.trim($("#scan_roll_no").val());
  334. if(null == rollNo || '' == rollNo){
  335. $.messager.alert('error', 'Please scan the roll no!', 'error', function(){
  336. //自动获取焦点
  337. $('#scan_roll_no').val('');
  338. $("#scan_roll_no").focus();
  339. });
  340. return false;
  341. }else{
  342. scanRollNo(rollNo);
  343. return false;
  344. }
  345. }
  346. });
  347. //扫描卷
  348. function scanRollNo(rollNo){
  349. let postData = {'site': site, 'orderNo': currentBoxRow.orderNo, 'boxNo': currentBoxRow.boxNo,
  350. 'rollNo': rollNo, "createdBy": username, "status": "Boxed", "statusCode": 3};
  351. //转json字符串
  352. postData = JSON.stringify(postData);
  353. //设置请求的类型
  354. $.ajaxSetup({
  355. contentType: "application/json;charset=utf-8"});
  356. $.post('/so/fqc/scanRollNo', postData,
  357. function(result){
  358. if (result.success){
  359. //判断是否自动封包
  360. if(result.sealFlag){
  361. //执行封箱的操作
  362. sealingBox(currentBoxRow.boxNo);
  363. }
  364. //获取当前的行数
  365. $('#scan_rolls').datagrid('reload');
  366. $('#scan_roll_no').val('');
  367. $("#scan_roll_no").focus();
  368. } else {
  369. $.messager.alert('error',result.msg, 'error', function(){
  370. //自动获取焦点
  371. $('#scan_roll_no').val('');
  372. $("#scan_roll_no").focus();
  373. });
  374. }
  375. },'json');
  376. //设置请求的类型
  377. $.ajaxSetup({
  378. contentType: "application/x-www-form-urlencoded"});
  379. }
  380. //删除卷的数据
  381. function deleteSoOrderRoll(rollNo){
  382. //判断操作
  383. $.messager.confirm('Confirm','Are you sure to delete the roll<b>'+rollNo+'</b>?', function(r){
  384. if(r){
  385. //判断是否存在当前的当前的箱
  386. let boxRow = $('#box_modal_table').datagrid('getSelected');
  387. if(boxRow){
  388. currentBoxRow = boxRow;
  389. }
  390. let postData = {'site': site, 'orderNo': currentBoxRow.orderNo, 'boxNo': currentBoxRow.boxNo, 'rollNo': rollNo, 'createdBy': username};
  391. //序列化
  392. postData = JSON.stringify(postData);
  393. //post请求类型修改
  394. $.ajaxSetup({
  395. contentType: "application/json;charset=utf-8"});
  396. //提交请求
  397. $.post('/so/fqc/cancelScanRollNo', postData, function(result){
  398. if(result.success){
  399. $('#scan_rolls').datagrid('reload');
  400. }else{
  401. $.messager.alert('Error',result.msg, 'error');
  402. }
  403. }, 'json');
  404. $.ajaxSetup({
  405. contentType: "application/x-www-form-urlencoded"});
  406. }
  407. });
  408. }
  409. //自动封箱
  410. function sealingBox(boxNo){
  411. delay(function(){
  412. //重置封箱的行
  413. if(!currentBoxRow){
  414. currentBoxRow = $('#box_modal_table').datagrid('getSelected');
  415. }
  416. //设置参数
  417. let postData = {'site': site, 'orderNo': currentBoxRow.orderNo, 'boxNo': boxNo,
  418. 'updatedBy': username, 'status': 'Boxed', 'statusCode': 3};
  419. //序列化
  420. postData = JSON.stringify(postData);
  421. //post请求类型修改
  422. $.ajaxSetup({
  423. contentType: "application/json;charset=utf-8"});
  424. //提交请求
  425. $.post('/so/fqc/sealingBox', postData, function(result){
  426. if(result.success){
  427. //关闭当前扫描窗口页面
  428. $("#scan_roll_modal").dialog("close");
  429. //打印箱标签
  430. printBoxLabelThird( boxNo);
  431. //刷新箱号的列表
  432. $('#box_modal_table').datagrid('reload');
  433. }else{
  434. $.messager.alert('Error',result.msg, 'error');
  435. }
  436. }, 'json');
  437. $.ajaxSetup({
  438. contentType: "application/x-www-form-urlencoded"});
  439. }, 500);
  440. }
  441. //拆封 确认
  442. function preUnsealBox(boxNo){
  443. delay(function(){
  444. currentBoxRow = $('#box_modal_table').datagrid('getSelected');
  445. //重置缓存行
  446. $.messager.confirm('Confirm','Are you sure to unpack the box:'+boxNo+'?', function(r){
  447. if (r){
  448. unsealBox(boxNo);
  449. }
  450. });
  451. }, 500);
  452. }
  453. //自动封箱
  454. function unsealBox(boxNo){
  455. delay(function(){
  456. //设置参数
  457. let postData = {'site': site, 'orderNo': currentBoxRow.orderNo, 'boxNo': boxNo,
  458. 'updatedBy': username, 'status': 'Boxing', 'statusCode': 2};
  459. //序列化
  460. postData = JSON.stringify(postData);
  461. //post请求类型修改
  462. $.ajaxSetup({
  463. contentType: "application/json;charset=utf-8"});
  464. //提交请求
  465. $.post('/so/fqc/unsealBox', postData, function(result){
  466. if(result.success){
  467. //关闭当前扫描窗口页面
  468. $("#scan_roll_modal").dialog("close");
  469. //打印箱标签
  470. //printBoxLabelThird(orderNo, boxNo);
  471. //刷新箱号的列表
  472. $('#box_modal_table').datagrid('reload');
  473. }else{
  474. $.messager.alert('Error',result.msg, 'error');
  475. }
  476. }, 'json');
  477. $.ajaxSetup({
  478. contentType: "application/x-www-form-urlencoded"});
  479. }, 500);
  480. }
  481. //显示入库箱的中包列表
  482. function openBoxedRollModal(){
  483. //显示form
  484. $('#scan_roll_fm').hide();
  485. delay(function(){
  486. //设置中包的参数
  487. currentBoxRow = $('#box_modal_table').datagrid('getSelected');
  488. $('#scan_roll_modal').dialog('open').dialog('center').dialog('setTitle', ""+currentBoxRow.boxNo+' List of Box');
  489. //设置查询的参数
  490. var opts = $('#scan_rolls').datagrid('options');
  491. opts.queryParams = {'orderNo': currentBoxRow.orderNo, 'boxNo': currentBoxRow.boxNo};
  492. $("#scan_rolls").datagrid({url: "/so/fqc/getPackSoOrderBoxRolls",
  493. onLoadSuccess: function(data) {
  494. }
  495. });
  496. }, 500);
  497. }
  498. //删除工单箱
  499. function deleteSoOrderBox(boxNo){
  500. $.messager.confirm('Confirm','Are you sure to delete the box<b>'+boxNo+'</b>?', function(r){
  501. if(r){
  502. //提交请求
  503. $.post('/so/fqc/deleteSoOrderBox', {'orderNo': currentRow.orderNo, 'boxNo': boxNo}, function(result){
  504. if(result.success){
  505. //刷新箱的列表
  506. $('#box_modal_table').datagrid('reload');
  507. }else{
  508. $.messager.alert('Error', result.msg, 'error');
  509. }
  510. }, 'json');
  511. }
  512. });
  513. }
  514. //roll表格序号
  515. function formatStockBoxSort(value, row, index){
  516. let rows = $("#stock_box_table").datagrid("getData").rows;
  517. let total = rows.length;
  518. return total - index;
  519. }
  520. //入库箱的操作
  521. function formatStockBoxFunction(value, row){
  522. let tags = '';
  523. tags += '<a style="text-decoration:none;" onclick="cancelScanSoOrderBox(\''+row.boxNo+'\')">Delete</a>';
  524. return tags;
  525. }
  526. //查询当前箱数据
  527. function stockBoxModal(){
  528. delay(function(){
  529. //let row = $('#dg').datagrid('getSelected');
  530. //设置当前的行
  531. //currentRow = row;
  532. //清空参数
  533. $('#scan_box_no').val('');
  534. $('#scan_location_no').val('');
  535. $('#stock_box_modal').dialog('open').dialog('center').dialog('setTitle', "Receive Scanning");
  536. var opts = $('#stock_box_table').datagrid('options');
  537. opts.queryParams = {'username': username};
  538. $("#stock_box_table").datagrid({url: "/so/fqc/getNotStockSoOrderBoxs",
  539. onLoadSuccess: function(data) {
  540. }
  541. });
  542. }, 500);
  543. }
  544. //页面打开关闭选中的箱
  545. $("#stock_box_modal").dialog({
  546. onOpen: function () {
  547. //获取焦点
  548. $('#scan_box_no').focus();
  549. }
  550. });
  551. //绑定的enter事件
  552. $('#scan_box_no').bind("keydown", function (e) {
  553. if (e.keyCode == 13) {
  554. let boxNo = $.trim($("#scan_box_no").val());
  555. if(null == boxNo || '' == boxNo){
  556. $.messager.alert('error', 'Please scan the box no!', 'error', function(){
  557. //自动获取焦点
  558. $('#scan_box_no').val('');
  559. $("#scan_box_no").focus();
  560. });
  561. return false;
  562. }else{
  563. scanBoxNo(boxNo);
  564. return false;
  565. }
  566. }
  567. });
  568. //扫描箱
  569. function scanBoxNo(boxNo){
  570. let postData = {'site': site, 'boxNo': boxNo, "createdBy": username, "status": "Boxed", "statusCode": 3};
  571. //转json字符串
  572. postData = JSON.stringify(postData);
  573. //设置请求的类型
  574. $.ajaxSetup({
  575. contentType: "application/json;charset=utf-8"});
  576. $.post('/so/fqc/scanSoOrderBoxNo', postData,
  577. function(result){
  578. if (result.success){
  579. //获取当前的行数
  580. $('#stock_box_table').datagrid('reload');
  581. $('#scan_box_no').val('');
  582. $("#scan_box_no").focus();
  583. } else {
  584. $.messager.alert('error',result.msg, 'error', function(){
  585. //自动获取焦点
  586. $('#scan_box_no').val('');
  587. $("#scan_box_no").focus();
  588. });
  589. }
  590. },'json');
  591. //设置请求的类型
  592. $.ajaxSetup({
  593. contentType: "application/x-www-form-urlencoded"});
  594. }
  595. //取消扫描的箱信息
  596. function cancelScanSoOrderBox(boxNo){
  597. let postData = {'site': site, 'boxNo': boxNo, "createdBy": username};
  598. //转json字符串
  599. postData = JSON.stringify(postData);
  600. //设置请求的类型
  601. $.ajaxSetup({
  602. contentType: "application/json;charset=utf-8"});
  603. $.post('/so/fqc/cancelScanSoOrderBoxNo', postData,
  604. function(result){
  605. if (result.success){
  606. //获取当前的行数
  607. $('#stock_box_table').datagrid('reload');
  608. $('#scan_box_no').val('');
  609. $("#scan_box_no").focus();
  610. } else {
  611. $.messager.alert('error',result.msg, 'error', function(){
  612. //自动获取焦点
  613. $('#scan_box_no').val('');
  614. $("#scan_box_no").focus();
  615. });
  616. }
  617. },'json');
  618. //设置请求的类型
  619. $.ajaxSetup({
  620. contentType: "application/x-www-form-urlencoded"});
  621. }
  622. //批量入库
  623. function batchToStock(){
  624. let locationNo = $('#scan_location_no').val();
  625. //判断是否存在空值
  626. if(null == locationNo || '' == locationNo){
  627. $.messager.alert('error', 'Please scan the location no!', 'error', function(){
  628. //自动获取焦点
  629. $('#scan_location_no').val('');
  630. $("#scan_location_no").focus();
  631. });
  632. return false;
  633. }
  634. let postData = {'site': site, "username": username, "locationNo": locationNo};
  635. $.post('/so/fqc/boxBatchToStocked', postData,
  636. function(result){
  637. if (result.success){
  638. //获取当前的行数
  639. $('#stock_box_table').datagrid('reload');
  640. $('#scan_box_no').val('');
  641. $("#scan_box_no").focus();
  642. } else {
  643. $.messager.alert('error',result.msg, 'error', function(){
  644. //自动获取焦点
  645. $('#scan_box_no').val('');
  646. $("#scan_box_no").focus();
  647. });
  648. }
  649. },'json');
  650. }
  651. //装箱管理的modal
  652. function boxManageModal(orderNo){
  653. delay(function(){
  654. //判断是否扫描进来的
  655. currentRow = $('#dg').datagrid('getSelected');
  656. //设置当前的行
  657. $('#box_manage_modal').dialog('open').dialog('center').dialog('setTitle', ""+orderNo+'List of Boxes');
  658. //加sn的数据
  659. var opts = $('#manage_boxs').datagrid('options');
  660. opts.queryParams = {'orderNo': orderNo};
  661. $("#manage_boxs").datagrid({url: "/so/fqc/getSoOrderManageBoxs",
  662. onLoadSuccess: function(data) {
  663. }
  664. });
  665. }, 500);
  666. }
  667. //箱管理序号
  668. function formatManageBoxSort(value, row, index){
  669. let rows = $("#manage_boxs").datagrid("getData").rows;
  670. let total = rows.length;
  671. return total - index;
  672. }
  673. //处理操作按钮
  674. function formatManageBoxFunction(value, row, index){
  675. let tags = '';
  676. if('Stocked' == row.status){
  677. tags += '<a style="text-decoration:none;" onclick="cacelStockedBox(\''+row.orderNo+'\',\''+row.boxNo+'\')">UnReceive</a>';
  678. }
  679. return tags;
  680. }
  681. //取消入库的操作
  682. function cacelStockedBox(orderNo, boxNo){
  683. let postData = {'orderNo': orderNo, "boxNo": boxNo};
  684. $.post('/so/fqc/cacelStockedBox', postData,
  685. function(result){
  686. if (result.success){
  687. //获取当前的行数
  688. $('#manage_boxs').datagrid('reload');
  689. } else {
  690. $.messager.alert('error',result.msg, 'error', function(){
  691. //自动获取焦点
  692. });
  693. }
  694. },'json');
  695. }
  696. /* 按箱返工 */
  697. function reworkBoxModal(){
  698. delay(function(){
  699. //设置中包的参数
  700. currentRow = $('#dg').datagrid('getSelected');
  701. $('#rework_box_modal').dialog('open').dialog('center').dialog('setTitle', ""+currentRow.orderNo+'Rework');
  702. }, 500);
  703. }
  704. //页面打开关闭选中的箱
  705. $("#rework_box_modal").dialog({
  706. onOpen: function () {
  707. //获取焦点
  708. $('#rework_box_no').focus();
  709. }
  710. });
  711. //绑定的enter事件
  712. $('#rework_box_no').bind("keydown", function (e) {
  713. if (e.keyCode == 13) {
  714. let boxNo = $.trim($("#rework_box_no").val());
  715. if(null == boxNo || '' == boxNo){
  716. $.messager.alert('error', 'Please Input box no!', 'error', function(){
  717. //自动获取焦点
  718. $('#rework_box_no').val('');
  719. $("#rework_box_no").focus();
  720. });
  721. return false;
  722. }else{
  723. scanBoxToRework(boxNo);
  724. return false;
  725. }
  726. }
  727. });
  728. //取消扫描返工
  729. function scanBoxToRework(boxNo){
  730. let postData = {'orderNo': currentRow.orderNo, "username": username, "boxNo": boxNo};
  731. $.post('/so/fqc/scanBoxToRework', postData,
  732. function(result){
  733. if (result.success){
  734. //获取当前的行数
  735. $.messager.alert('info', result.msg, 'info');
  736. $('#rework_box_no').val('');
  737. $("#rework_box_no").focus();
  738. } else {
  739. $.messager.alert('error',result.msg, 'error', function(){
  740. //自动获取焦点
  741. $('#rework_box_no').val('');
  742. $("#rework_box_no").focus();
  743. });
  744. }
  745. },'json');
  746. }
  747. /* 按卷取消返工 */
  748. function cancelReworkModal(){
  749. delay(function(){
  750. //设置中包的参数
  751. currentRow = $('#dg').datagrid('getSelected');
  752. $('#cancel_rework_modal').dialog('open').dialog('center').dialog('setTitle', currentRow.orderNo+'Cancel Rework');
  753. }, 500);
  754. }
  755. //页面打开关闭选中的箱
  756. $("#cancel_rework_modal").dialog({
  757. onOpen: function () {
  758. //获取焦点
  759. $('#rework_roll_no').focus();
  760. }
  761. });
  762. //绑定的enter事件
  763. $('#cancel_rework_modal').bind("keydown", function (e) {
  764. if (e.keyCode == 13) {
  765. let rollNo = $.trim($("#rework_roll_no").val());
  766. if(null == rollNo || '' == rollNo){
  767. $.messager.alert('error', 'Please scan the roll no!', 'error', function(){
  768. //自动获取焦点
  769. $('#rework_roll_no').val('');
  770. $("#rework_roll_no").focus();
  771. });
  772. return false;
  773. }else{
  774. scanRollToCancelRework(rollNo);
  775. return false;
  776. }
  777. }
  778. });
  779. //扫卷取消返工
  780. function scanRollToCancelRework(rollNo){
  781. let postData = {'orderNo': currentRow.orderNo, "rollNo": rollNo};
  782. $.post('/so/fqc/scanRollToCancelRework', postData,
  783. function(result){
  784. if (result.success){
  785. //获取当前的行数
  786. $.messager.alert('info', result.msg, 'info', function(){
  787. $('#rework_roll_no').val('');
  788. $("#rework_roll_no").focus();
  789. });
  790. } else {
  791. $.messager.alert('error',result.msg, 'error', function(){
  792. //自动获取焦点
  793. $('#rework_roll_no').val('');
  794. $("#rework_roll_no").focus();
  795. });
  796. }
  797. },'json');
  798. }
  799. </script>
  800. </@master.layout>