Advertisement
Guest User

Untitled

a guest
Apr 24th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <script>
  2.     $(document).ready(function () {
  3.         $("#TxtBarcode").keypress(function (event) {
  4.             if (event.keyCode == 13) {
  5.                 var DeliveryRegion = $('#DeliveryRegion').combobox('getValue');
  6.                 if (!DeliveryRegion) {
  7.                     alert("收貨地需指定!");
  8.                     // focus 指定到條碼輸入 input
  9.                     document.getElementById("TxtBarcode").focus();
  10.                     return;
  11.                 }
  12.                 var t = '';
  13.                 var Barcode = $('input[name="TxtBarcode"]').val().toUpperCase();
  14.                 // 上傳到Server更改狀態後回傳JSON
  15.                 if (Barcode) {
  16.                     $.ajax({
  17.                         type: "POST",
  18.                         url: '../handler/jqDataHandle.ashx?RemoteName=s_bf_carm_zslz.CARM_ZSLZ',
  19.                         data: "mode=method&method=" + "SetDeliveryData" + "&parameters=" + DeliveryRegion + ";" + Barcode,
  20.                         cache: false, async: false,
  21.                         success: function (data) {
  22.                             t = data;
  23.                         }
  24.                     });
  25.                 }
  26.                 $('input[name="TxtBarcode"]').val("");
  27.                 if (t == "NotConfirm") {
  28.                     alert("輸入的條碼(" + Barcode + ")未車載,不可對碰!");
  29.                     $('input[name="TxtBarcode"]').val("");
  30.                     // focus 指定到條碼輸入 input
  31.                     document.getElementById("TxtBarcode").focus();
  32.                     return false;
  33.                 }
  34.                 if (t == "NoData") {
  35.                     alert("輸入的條碼(" + Barcode + ")找不到對應的資料!");
  36.                     $('input[name="TxtBarcode"]').val("");
  37.                     // focus 指定到條碼輸入 input
  38.                     document.getElementById("TxtBarcode").focus();
  39.                     return false;
  40.                 }
  41.                 if (t == "Duplicate") {
  42.                     alert("輸入的條碼(" + Barcode + ")已經對碰過!");
  43.                     $('input[name="TxtBarcode"]').val("");
  44.                     // focus 指定到條碼輸入 input
  45.                     document.getElementById("TxtBarcode").focus();
  46.                     return false;
  47.                 }
  48.                
  49.                 query('#dataGridMaster');
  50.  
  51.                 // focus 指定到條碼輸入 input
  52.                 document.getElementById("TxtBarcode").focus();
  53.                 return true;
  54.             }
  55.         });
  56.     });
  57. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement