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.

676 lines
25 KiB

3 days ago
  1. <#import "../master.ftl" as master>
  2. <@master.layout>
  3. <style>
  4. #fm label {
  5. width: 150px;
  6. }
  7. #importDlgFm label {
  8. width: 150px;
  9. }
  10. </style>
  11. <div class="page-header">
  12. <h2>Delivery</h2>
  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 , url:'/shipment/all',method:'get',pageSize:20,toolbar:'#tb'">
  16. <thead>
  17. <tr>
  18. <th data-options="field:'shipNo',width:60">Delivery No</th>
  19. <th data-options="field:'shippedBy',width:60,align:'left'">Created By</th>
  20. <th data-options="field:'shippedDate',width:130,align:'center',formatter:formatDateTime">Create Date</th>
  21. <th data-options="field:'customerConfirmedFlag',width:60,align:'center',formatter:formatConfirmedFlag">Customer Confirm Status</th>
  22. <th data-options="field:'ftpPath',width:160,editor:'textbox'">FTP Path</th>
  23. <th data-options="field:'ifsDeliveryNoteNo',width:60,editor:'text'">IFS Delivery Note No</th>
  24. <th data-options="field:'remark',width:60,editor:'textbox'">Remark</th>
  25. <th data-options="field:'id',width:200, formatter:formatAction">Actions</th>
  26. </tr>
  27. </thead>
  28. </table>
  29. <div id="tb" style="padding:10px 5px;display: none;">
  30. <div>
  31. Create Date: <input class="easyui-datebox" id="shippedDateFrom" style="width:100px">
  32. 到: <input class="easyui-datebox" id="shippedDateTo" style="width:100px">
  33. 客户确认:
  34. <select class="easyui-combobox" panelHeight="auto" id="confirmedFlag" style="width:100px">
  35. <option value="">All</option>
  36. <option value="0">To be Confirm</option>
  37. <option value="1">Confirmed</option>
  38. </select>
  39. <a href="#nowhere" id="queryLink" class="easyui-linkbutton" iconCls="icon-search">Search</a>
  40. &nbsp;&nbsp;&nbsp;
  41. <a href="javascript:void(0)" id="tbAdd" class="easyui-linkbutton" iconCls="icon-add" onclick="newShipment()">New Shipment</a>
  42. <a href="javascript:void(0)" id="tbAdd" class="easyui-linkbutton" onclick="doUpdateConfirmedFlag()">CS confirm</a>
  43. </div>
  44. </div>
  45. <div id="dlg" class="easyui-dialog" style="width:500px;display: none;"
  46. closed="true" buttons="#dlg-buttons">
  47. <form id="fm" method="post" novalidate style="margin:0;padding:20px 20px">
  48. <div style="margin-bottom:10px">
  49. <input name="ifsDeliveryNoteNo" class="easyui-textbox" required="true" label="IFS Delivery Note No:" style="width:100%">
  50. </div>
  51. </form>
  52. </div>
  53. <div id="dlgPlan" class="easyui-dialog" style="width:500px;display: none;"
  54. closed="true" buttons="#plan-buttons">
  55. <div style="margin-bottom:10px;padding:20px 20px">
  56. <input id="partNo" class="easyui-textbox" required="true" label="Part no:" style="width:100%">
  57. <br/><br>
  58. <input id="toShipQty" class="easyui-textbox" required="true" label="Quantity:" style="width:100%">
  59. </div>
  60. </div>
  61. <div id="dlgUPlan" class="easyui-dialog" style="width:500px;display: none;"
  62. closed="true" buttons="#uplan-buttons">
  63. <div style="margin-bottom:10px;padding:20px 20px">
  64. <input id="planId" type="hidden" value="">
  65. <input id="upartNo" class="easyui-textbox" required="true" label="Part no:" style="width:100%">
  66. <br/><br>
  67. <input id="utoShipQty" class="easyui-textbox" required="true" label="Quantity:" style="width:100%">
  68. </div>
  69. </div>
  70. <div id="dlg-buttons" style="display: none;">
  71. <a href="javascript:void(0)" class="easyui-linkbutton c6" iconCls="icon-ok" onclick="saveShipInfo()" style="width:90px">Save</a>
  72. <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dlg').dialog('close')" style="width:90px">Cancel</a>
  73. </div>
  74. <!-- 导入数据条件 -->
  75. <div id="importDlg" class="easyui-dialog" style="width:500px;display: none;"
  76. closed="true" buttons="#ImportDelivery-buttons">
  77. <form id="importDlgFm" method="post" novalidate style="margin:0;padding:20px 20px">
  78. <div style="margin-bottom:10px">
  79. <input id="ifsDNoteNo" name="ifsDeliveryNoteNo" class="easyui-textbox" required="true" label="IFS Delivery Note No:" style="width:100%">
  80. </div>
  81. </form>
  82. </div>
  83. <div id="ImportDelivery-buttons" style="display: none;">
  84. <a href="javascript:void(0)" class="easyui-linkbutton c6" iconCls="icon-ok" onclick="ImportDelivery()" style="width:90px">OK</a>
  85. <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#importDlg').dialog('close')" style="width:90px">Cancel</a>
  86. </div>
  87. <div id="plan-buttons" style="display: none;">
  88. <a href="javascript:void(0)" class="easyui-linkbutton c6" iconCls="icon-ok" onclick="saveDelivery()" style="width:90px">Save</a>
  89. <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dlgPlan').dialog('close')" style="width:90px">Cancel</a>
  90. </div>
  91. <div id="uplan-buttons" style="display: none;">
  92. <a href="javascript:void(0)" class="easyui-linkbutton c6" iconCls="icon-ok" onclick="updateDelivery()" style="width:90px">Save</a>
  93. <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dlgUPlan').dialog('close')" style="width:90px">Cancel</a>
  94. </div>
  95. <div id="dlgDtls" class="easyui-dialog" style="width:600px;display: none;"
  96. closed="true" data-options="modal:true" >
  97. <table id="dgDtls" class="easyui-datagrid" style="width:100%;height:300px;display: none;"
  98. data-options="pagination: false, showFooter: true, singleSelect:true, fitColumns:true , method:'get', pageSize:20,toolbar:'#tbDtls'">
  99. <thead>
  100. <tr>
  101. <th data-options="field:'boxNo',width:100,formatter:formatPrintBoxNo">Box No</th>
  102. <th data-options="field:'id',width:60,formatter:formatDtlAction">Actions</th>
  103. </tr>
  104. </thead>
  105. </table>
  106. </div>
  107. <!-- 发货计划 -->
  108. <div id="delivery" class="easyui-dialog" style="width:600px;display: none;"
  109. closed="true" data-options="modal:true" >
  110. <table id="deliverys" class="easyui-datagrid" style="width:100%;height:300px;display: none;"
  111. data-options="pagination: false, showFooter: true, singleSelect:true, fitColumns:true , method:'get', pageSize:20,toolbar:'#tdDelivery'">
  112. <thead>
  113. <tr>
  114. <th data-options="field:'partNo',width:60">Part No</th>
  115. <th data-options="field:'toShipQty',width:60">Qty to Ship</th>
  116. <th data-options="field:'rollActualQty',width:60">实际数量(按卷标)</th>
  117. <th data-options="field:'actualQty',width:60">Actual Qty Shipped</th>
  118. <th data-options="field:'id',width:60,formatter:planAction">Actions</th>
  119. </tr>
  120. </thead>
  121. </table>
  122. </div>
  123. <div id="tbDtls" style="padding:10px 5px;display: none;">
  124. <div>
  125. <a href="javascript:void(0)" id="tbAdd" class="easyui-linkbutton" iconCls="icon-add" onclick="newBox()">New Box</a>
  126. 扫箱出库:&nbsp;&nbsp;&nbsp;<input id="scanBoxNo" name="scanBoxNo" class="easyui-textbox" style="width: 120px;text-transform:uppercase;" placeholder="FG roll no" />
  127. &nbsp;&nbsp;&nbsp;
  128. <#-- <a href="javascript:void(0)" id="forceClosed" class="easyui-linkbutton" onclick="shipBox()">出库</a>-->
  129. </div>
  130. </div>
  131. <div id="tdDelivery" style="padding:10px 5px;display: none;">
  132. <div>
  133. <a href="javascript:void(0)" id="planAdd" class="easyui-linkbutton" iconCls="icon-add" onclick="newDelivery()">Create shipment plan</a>
  134. <a href="javascript:void(0)" id="planImport" class="easyui-linkbutton" iconCls="icon-add" onclick="importDlg()">Import Shipment Plan</a>
  135. </div>
  136. </div>
  137. <div id="dlgRollDtls" class="easyui-dialog" style="width:500px;display: none;"
  138. closed="true" data-options="modal:true" >
  139. <table id="dgRollDtls" class="easyui-datagrid" style="width:100%;height:400px;display: none;"
  140. data-options="pagination: false, showFooter: true, singleSelect:true, fitColumns:true , method:'get'">
  141. <thead>
  142. <tr>
  143. <th data-options="field:'finalRollNo',width:100">FG roll number</th>
  144. <th data-options="field:'id',width:40,formatter:formatBoxRollAction">Actions</th>
  145. </tr>
  146. </thead>
  147. </table>
  148. </div>
  149. <script>
  150. $(window).resize(function () {
  151. $("#dg").datagrid({"height": $(window).height() - $(".datagrid").offset().top - 20});
  152. });
  153. $(function () {
  154. $(window).resize();
  155. });
  156. $("#queryLink").click(function(){
  157. var dg = $('#dg').datagrid({
  158. queryParams: {
  159. confirmedFlag: $("#confirmedFlag").val(),
  160. shippedDateFrom: $("#shippedDateFrom").val(),
  161. shippedDateTo: $("#shippedDateTo").val()
  162. }
  163. });
  164. });
  165. function formatPrintBoxNo(value, row){
  166. if (row.status == "Packed") {
  167. return "<a target='forprint' href='/print/"+ "box" + "/" +value+"/'>"+value+"</a>";
  168. }else{
  169. return value;
  170. }
  171. }
  172. function formatConfirmedFlag(value,row) {
  173. return value == 1 ? "<font color='green'>Confirmed</font>" : "To be Confirm";
  174. }
  175. function formatAction(value, row){
  176. var str = "<a href='javascript:editInfo()'>Edit</a>" + "&nbsp;|&nbsp;<a href='javascript:delShip(\""+row.shipNo+"\")'>Delete</a>";
  177. str += "&nbsp;|&nbsp;<a href='javascript:viewBoxes(\""+row.shipNo+"\")'>Box View</a>"
  178. + "&nbsp;|&nbsp;<a href='javascript:downloadList(\""+row.shipNo+"\")'>Delivery List</a>"
  179. + "&nbsp;|&nbsp;<a href='javascript:uploadFTP(\""+row.shipNo+"\")'>Upload to FTP</a>"
  180. + "&nbsp;|&nbsp;<a href='javascript:deliveryPlan(\""+row.shipNo+"\")'>Shipment Plan</a>";
  181. return str;
  182. }
  183. function formatDtlAction(value, row){
  184. var action = "";
  185. if (row.status != "Packed"){
  186. // action = "<a href='/shipment/boxes/scan/" + value + "'>Scan and delivery</a>";
  187. action = "<a href='/shipment/boxes/scan/" + value + "'>扫描合箱出库</a>";
  188. // action += "&nbsp;|&nbsp;<a href='javascript:delBox(\"" + row.boxNo + "\");'>Delete</a>";
  189. } else {
  190. action = "Packed";
  191. // action += "&nbsp;|&nbsp;<a href='javascript:unPackBox(\"" + row.boxNo + "\");'>UnPack</a>";
  192. }
  193. action += "&nbsp;|&nbsp;<a href='javascript:viewBoxRolls(\"" + row.boxNo + "\");'>View</a>";
  194. return action;
  195. }
  196. //发话计划的操作
  197. function planAction(value, row){
  198. var action = "";
  199. if(row.id==0){
  200. action = "&nbsp;no shipment plan";
  201. }else{
  202. action = "&nbsp;<a href='javascript:delPlan(\"" + value + "\");'>Delete</a>"
  203. +"&nbsp;|&nbsp;<a href='javascript:uPlan(\"" + row.id + "\",\"" + row.partNo + "\",\"" + row.toShipQty + "\");'>Edit</a>";
  204. }
  205. return action;
  206. }
  207. //数量不对警告
  208. $('#deliverys').datagrid({
  209. rowStyler:function(index,row){
  210. if (Number(row.rollActualQty)!=Number(row.toShipQty)){
  211. return 'background-color:#ff534d;font-weight:bold;';
  212. }
  213. }
  214. });
  215. function formatBoxRollAction(value, row){
  216. var action = "";
  217. //获取当前的箱
  218. let currentBox = $('#dgDtls').datagrid('getSelected');
  219. <#if currentUser.isAdmin || (currentUser.authorities?contains("switch_order") && currentUser.authorities?contains("dispatch"))>
  220. //判断是否已封箱的
  221. let boxStatus = currentBox.status;
  222. if('Packed' == boxStatus){
  223. return '';
  224. }else{
  225. action += "<a href='javascript:delBoxRoll(\"" + row.id + "\");'>Delete</a>";
  226. }
  227. </#if>
  228. return action;
  229. }
  230. var postUrl = "";
  231. function editInfo(){
  232. var row = $('#dg').datagrid('getSelected');
  233. if (row) {
  234. $('#dlg').dialog('open').dialog('center').dialog('setTitle', 'Edit');
  235. $('#fm').form('load', row);
  236. postUrl="/shipment/"+row.id+"/update";
  237. }
  238. }
  239. function doUpdateConfirmedFlag(){
  240. var row = $('#dg').datagrid('getSelected');
  241. if (row) {
  242. $.messager.confirm('Confirm','将发货单 <b>'+row.shipNo+'</b> 标记为已确认?',function(r){
  243. if (r){
  244. $.post('/shipment/'+row.id+'/updateConfirmFlag',{},function(result){
  245. if (result.success){
  246. $('#dg').datagrid('reload'); // reload the user data
  247. } else {
  248. $.messager.alert('error',result.errorMsg, 'error');
  249. }
  250. },'json');
  251. }
  252. });
  253. }else{
  254. $.messager.alert("Warning", "Select shipment", "warning");
  255. }
  256. }
  257. function saveShipInfo(){
  258. $('#fm').form('submit',{
  259. url: postUrl,
  260. onSubmit: function(){
  261. return $(this).form('validate');
  262. },
  263. success: function(result){
  264. var result = eval("("+result+")");
  265. if (result.errorMsg){
  266. $.messager.alert("Info",result.error,"Info",);
  267. //$('#dlg').dialog('close');
  268. //$('#dg').datagrid('reload');
  269. } else {
  270. $('#dlg').dialog('close'); // close the dialog
  271. $('#dg').datagrid('reload'); // reload the user data
  272. }
  273. }
  274. });
  275. }
  276. var currentShipNo = "";
  277. function viewBoxes(shipNo){
  278. currentShipNo = shipNo;
  279. $('#dlgDtls').dialog('open').dialog('center').dialog('setTitle',shipNo+' Box List');
  280. $("#dgDtls").datagrid({url: "/shipment/boxes/"+shipNo});
  281. }
  282. //发货计划
  283. function deliveryPlan(shipNo){
  284. currentShipNo = shipNo;
  285. $('#delivery').dialog('open').dialog('center').dialog('setTitle',shipNo+' Box List');
  286. $("#deliverys").datagrid({url: "/shipment/delPlan/"+shipNo});
  287. }
  288. function viewBoxRolls(boxNo){
  289. $('#dlgRollDtls').dialog('open').dialog('center').dialog('setTitle',boxNo+' SFG roll');
  290. $("#dgRollDtls").datagrid({url: "/shipment/box/"+boxNo+"/rolls"});
  291. }
  292. function downloadList(shipNo){
  293. $.post("/shipment/downloadList", {shipNo: shipNo}, function(ret){
  294. if(ret.success){
  295. window.location.href="/prepress/download/"+ret.fileName;
  296. }else{
  297. $.messager.alert('Error',ret.errorMsg, 'error');
  298. }
  299. });
  300. }
  301. //上传至FTP
  302. function uploadFTP(shipNo){
  303. $.post("/shipment/downloadListForFTP", {shipNo: shipNo}, function(ret){
  304. if(ret.success){
  305. var fileNameList = ret.fileNameList;
  306. if(ret.flag=='Y'){
  307. $.messager.alert('Error','File uploaded!', 'error');
  308. }else{
  309. var fileName = ret.fileName;
  310. $.ajax({
  311. url : "/prepress/uploadFTP",
  312. type : "POST",
  313. data : {"fileName" : fileNameList,
  314. "shipNo":shipNo
  315. },
  316. dataType : "json",
  317. success : function(result) {
  318. console.log(result);
  319. if(result.success){
  320. alert("Uploaded!");
  321. //saveFTPRecord(result.data,shipNo);
  322. $('#dg').datagrid('reload');
  323. }else{
  324. alert("Fail to upload!");
  325. $.messager.alert('Error',result.data, 'error');
  326. }
  327. },
  328. error : function() {
  329. }
  330. });
  331. }
  332. }else{
  333. $.messager.alert('Error',ret.errorMsg, 'error');
  334. }
  335. });
  336. }
  337. //保存FTP上传的记录
  338. function saveFTPRecord(path,shipNo){
  339. $.ajax({
  340. type: 'GET',
  341. url: "/shipment/ftp/addFlag",
  342. dataType: "json",
  343. data: {"shipNo": shipNo,
  344. "ftpPath":path
  345. },
  346. success: function(result){
  347. console.log(result);
  348. if(result.success){
  349. alert("Uploaded!");
  350. }
  351. /* $('#dlgPlan').dialog('close');
  352. $('#deliverys').datagrid('reload'); */
  353. },
  354. error : function() {
  355. }
  356. });
  357. }
  358. function newShipment(){
  359. $.post("/shipment/add", {} , function(data){
  360. if (data.success){
  361. $('#dg').datagrid('reload');
  362. }else{
  363. }
  364. });
  365. }
  366. function newBox(){
  367. $.post("/shipment/boxes/add", {shipNo: currentShipNo} , function(data){
  368. if (data.success){
  369. $('#dgDtls').datagrid('reload');
  370. }else{
  371. }
  372. });
  373. }
  374. //编辑
  375. function uPlan(id,partNo,toShipQty){
  376. $('#dlgUPlan').dialog('open').dialog('center').dialog('setTitle', 'Modify shipment plan');
  377. $('#dlgUPlan form').form('clear');
  378. $("#planId").val(id);
  379. $("#upartNo").textbox('setValue', partNo);
  380. $("#utoShipQty").textbox('setValue', toShipQty);
  381. }
  382. //新增发货计划
  383. function newDelivery(){
  384. $('#dlgPlan').dialog('open').dialog('center').dialog('setTitle', 'Create shipment plan');
  385. $('#dlgPlan form').form('clear');
  386. }
  387. //新增
  388. function saveDelivery(){
  389. var partNo = $("#partNo").val();
  390. var toShipQty = $("#toShipQty").val();
  391. $.ajax({
  392. type: 'GET',
  393. url: "/shipment/Delivery/add",
  394. dataType: "json",
  395. data: {"shipNo": currentShipNo,
  396. "partNo":partNo,
  397. "qty":toShipQty
  398. },
  399. success: function(data){
  400. $('#dlgPlan').dialog('close');
  401. $('#deliverys').datagrid('reload');
  402. },
  403. error : function() {
  404. }
  405. });
  406. }
  407. //导入发货计划条件
  408. function importDlg(){
  409. $('#importDlg').dialog('open').dialog('center').dialog('setTitle', 'ifsDeliveryNoteNo');
  410. $('#importDlgFm form').form('clear');
  411. }
  412. //导入发货计划
  413. function ImportDelivery(){
  414. var IfsDNoteNo = $("#ifsDNoteNo").val();
  415. console.log(IfsDNoteNo);
  416. $.post('/shipment/importDelivery',{ifsDNoteNo:IfsDNoteNo,shipNo: currentShipNo},function(result){
  417. if (result.success){
  418. $('#importDlg').dialog('close');
  419. $('#deliverys').datagrid('reload');
  420. } else {
  421. $.messager.alert('Error',result.errorMsg, 'error');
  422. }
  423. },'json');
  424. }
  425. //修改发货计划
  426. function updateDelivery(){
  427. var planId = $("#planId").val();
  428. var partNo = $("#upartNo").val();
  429. var toShipQty = $("#utoShipQty").val();
  430. console.log(planId);
  431. $.ajax({
  432. type: 'GET',
  433. url: "/shipment/Delivery/update",
  434. dataType: "json",
  435. data: {"pId":planId,
  436. "partNo":partNo,
  437. "qty":toShipQty
  438. },
  439. success: function(data){
  440. $('#dlgUPlan').dialog('close');
  441. $('#deliverys').datagrid('reload');
  442. },
  443. error : function() {
  444. }
  445. });
  446. }
  447. function delBoxRoll(boxRollId){
  448. $.messager.confirm('Confirm','Are you sure to delete the data ?',function(r){
  449. if (r){
  450. $.post('/shipment/boxroll/'+boxRollId+'/del',{},function(result){
  451. if (result.success){
  452. $('#dgRollDtls').datagrid('reload');
  453. } else {
  454. $.messager.alert('Error',result.errorMsg, 'error');
  455. }
  456. },'json');
  457. }
  458. });
  459. }
  460. //删除出库单号
  461. function delShip(shipNo){
  462. $.messager.confirm('Confirm','Are you sure to delete the data ?',function(status){
  463. if (status){
  464. $.ajax({
  465. url : "/shipment/delShip",
  466. type : "POST",
  467. data : {shipNo: shipNo},
  468. dataType : "json",
  469. success : function(data) {
  470. var code = data.code;
  471. if(code=='0'){
  472. $('#dg').datagrid('reload');
  473. $.messager.alert("Info",data.msg,"Info");
  474. }else{
  475. $.messager.alert('Error',data.msg, 'error');
  476. }
  477. },
  478. error : function(data) {
  479. $.messager.alert('Error',data.msg, 'error');
  480. }
  481. });
  482. }
  483. });
  484. }
  485. //删除出库下的箱子
  486. function delBox(boxNo){
  487. $.messager.confirm('Confirm','Are you sure to delete the data ?',function(status){
  488. if (status){
  489. $.ajax({
  490. url : "/shipment/delBox",
  491. type : "POST",
  492. data : {boxNo: boxNo},
  493. dataType : "json",
  494. success : function(data) {
  495. var code = data.code;
  496. if(code=='0'){
  497. $('#dgDtls').datagrid('reload');
  498. $.messager.alert("Info",data.msg,"Info",);
  499. }else{
  500. $.messager.alert('Error',data.msg, 'error');
  501. }
  502. },
  503. error : function(data) {
  504. $.messager.alert('Error',data.msg, 'error');
  505. }
  506. });
  507. }
  508. });
  509. }
  510. //拆封
  511. function unPackBox(boxNo){
  512. $.messager.confirm('Confirm','Are you sure unpack the box:'+boxNo+' ?',function(status){
  513. if (status){
  514. $.ajax({
  515. url : "/shipment/unPackBox",
  516. type : "POST",
  517. data : {boxNo: boxNo},
  518. dataType : "json",
  519. success : function(data) {
  520. if(data.success){
  521. $('#dgDtls').datagrid('reload');
  522. $.messager.alert("Info",data.msg,"Info",);
  523. }else{
  524. $.messager.alert('Error',data.msg, 'error');
  525. }
  526. },
  527. error : function(data) {
  528. $.messager.alert('Error',data.msg, 'error');
  529. }
  530. });
  531. }
  532. });
  533. }
  534. //删除发货计划
  535. function delPlan(id){
  536. console.log(id);
  537. $.messager.confirm('Confirm','Are you sure to delete the data ?',function(status){
  538. if (status){
  539. $.ajax({
  540. url : "/shipment/delPlan",
  541. type : "POST",
  542. data : {id: id},
  543. dataType : "json",
  544. success : function(data) {
  545. var code = data.code;
  546. if(code=='0'){
  547. $('#deliverys').datagrid('reload');
  548. $.messager.alert("Info",data.msg,"Info",);
  549. }else{
  550. $.messager.alert('Error',data.msg, 'error');
  551. }
  552. },
  553. error : function(data) {
  554. $.messager.alert('Error',data.msg, 'error');
  555. }
  556. });
  557. }
  558. });
  559. }
  560. //2023 0528 RQ 新增
  561. // $("#scanBoxNo").on("keydown", function(event){
  562. // console.log("回车拉")
  563. // var scanBoxNo = $(this).val();
  564. // if(event.keyCode == 13){
  565. // $.post("/receive/scan/add", {shipNo:currentShipNo, finalRollNo: scanBoxNo} , function(data){
  566. // if (data.success){
  567. // $("#ifmforprint").attr('src', "/print/box/" + scanBoxNo + "/");
  568. // $("#dgDtls").datagrid({url: "/shipment/boxes/"+currentShipNo});
  569. // $.messager.alert("Info","Shipped","Info",);
  570. // $("#finalRollNo").textbox('setValue',"").focus();
  571. // }else{
  572. // $.messager.alert('Error',data.errorMsg, 'error');
  573. // $("#finalRollNo").textbox('setValue',"").focus();
  574. // }
  575. //
  576. // });
  577. // }
  578. // }).on("blur", function() {
  579. // $(this).textbox('setValue',$(this).val().trim().toUpperCase());
  580. // })
  581. $("#scanBoxNo").textbox({
  582. inputEvents: $.extend({}, $.fn.textbox.defaults.inputEvents,{
  583. keyup:function(event){
  584. if(event.keyCode == 13){
  585. console.log("回车");
  586. let scanBoxNo=$("#scanBoxNo").val();
  587. $.post("/shipment/boxes/shipBox", {shipNo:currentShipNo, scanBoxNo: scanBoxNo} , function(data){
  588. if (data.success){
  589. $("#ifmforprint").attr('src', "/print/box/" + scanBoxNo + "/");
  590. $("#dgDtls").datagrid({url: "/shipment/boxes/"+currentShipNo});
  591. $.messager.alert("Info","Shipped","Info",);
  592. $("#scanBoxNo").textbox('setValue',"").focus();
  593. }else{
  594. $.messager.alert('Error',data.errorMsg, 'error');
  595. $("#scanBoxNo").textbox('setValue',"").focus();
  596. }
  597. });
  598. }
  599. }
  600. })
  601. })
  602. function shipBox(){
  603. var scanBoxNo = $("#scanBoxNo").val();
  604. $.post("/shipment/boxes/shipBox", {shipNo:currentShipNo, scanBoxNo: scanBoxNo} , function(data){
  605. if (data.success){
  606. $("#ifmforprint").attr('src', "/print/box/" + scanBoxNo + "/");
  607. $("#dgDtls").datagrid({url: "/shipment/boxes/"+currentShipNo});
  608. $.messager.alert("Info","Shipped","Info",);
  609. $("#scanBoxNo").textbox('setValue',"").focus();
  610. }else{
  611. $.messager.alert('Error',data.errorMsg, 'error');
  612. $("#scanBoxNo").textbox('setValue',"").focus();
  613. }
  614. });
  615. }
  616. </script>
  617. </@master.layout>