wbc
2024-09-06 8177b79722037a348b08375c63723356c07690c5
unpackage/cache/wgt/H546D0BA6/js/CangKuManage_js/GS_CKPDD.js
@@ -8,21 +8,30 @@
var WLBM = "";//物料编码
var matterTable = null;
var PopPicker = new mui.PopPicker();
var pici = '1';
mui.ready(function() {
// mui.ready(function() {
            //console.log("盘点单获取测试!");
            fetchData();
//             app.init();
//             fetchData();
            
          });
//           });
// mui.ready(function() {
//    fetchData();
//    console.log("连接测试!");
// });
//初始化,默认焦点
mui.plusReady(function(){   
   app.init();
   mui("#txtGD")[0].focus();
   fetchData();
   console.log("连接测试!");
   initBluetooth();
   // initBluetooth();
   //SetBillNo();
   $('#info').height($(window).height()- $("#row001").height() - $("#div001").height()- $("#div002").height() - 70);
   $('#info').height($(window).height() - $("#row001").height() - $("#div001").height() - $("#div002")
      .height() - 70);
});      
// $(function(){
 //   billNo= GetMaxBillNO("1201",GetSysDateTime());//调拨单号,只要不离开界面,单号不变
@@ -74,7 +83,11 @@
  // 循环遍历数据,生成表格行
  for (let i = 0; i < data["条码编号"].length; i++) {
    let tr = document.createElement("tr");
      pici = data["批次"][0];
      let td7 = document.createElement("td");
      td7.textContent = data["序号"][i];
      tr.appendChild(td7);
    // 创建表格单元格,并将数据填入
    let td1 = document.createElement("td");
    td1.textContent = data["条码编号"][i];
@@ -135,12 +148,14 @@
         //获取盘点单
         function fetchData() {
   console.log("12");
            $.ajax({
             url: app.API_URL_HEADER + "/WARBABChag/GetGSTAA",
             type: "GET",
             dataType: "json",
             success: function(response) {
               if (response.status === 0) {
                 var selectElement = document.getElementById('order');
               
                 selectElement.innerHTML = "";
@@ -230,6 +245,25 @@
                      return;
                   } else {
                      populateTable(data.data);
               var selectElement = document.getElementById("spici");
               console.log(pici);
               // 清空 <select> 元素的现有选项
               selectElement.innerHTML = "";
               // 从1开始到 pici 为止的数,添加到 <select> 元素中
               for (var i = 1; i <= parseInt(pici); i++) {
                  // 创建一个新的 <option> 元素
                  var option = document.createElement("option");
                  // 设置 <option> 元素的 value 和 text 属性
                  option.value = i;
                  option.text = i;
                  // 将 <option> 元素添加到 <select> 元素中
                  selectElement.appendChild(option);
               }
               selectElement.value = pici;
               GetInfopici();
                      mui("#MBA001")[0].focus();
                   
                   }
@@ -241,6 +275,55 @@
           });
         });
         
function refreshpdno() {
   $.ajax({
      url: app.API_URL_HEADER + "/WARBABChag/GetBarInfoTAC",
      data: {
         TAA001: $("#order").val(),
      },
      DataType: "json",
      type: "post",
      async: false,
      //timeout: 15000,
      success: function(data) {
         //console.log(JSON.stringify(data));
         if (data.status != 0) {
            playerAudio("NG");
            mui.alert(data.message, "", "", function() {
               mui("#input")[0].focus();
            });
            return;
         } else {
            populateTable(data.data);
            var selectElement = document.getElementById("spici");
            console.log(pici);
            // 清空 <select> 元素的现有选项
            selectElement.innerHTML = "";
            // 从1开始到 pici 为止的数,添加到 <select> 元素中
            for (var i = 1; i <= parseInt(pici); i++) {
               // 创建一个新的 <option> 元素
               var option = document.createElement("option");
               // 设置 <option> 元素的 value 和 text 属性
               option.value = i;
               option.text = i;
               // 将 <option> 元素添加到 <select> 元素中
               selectElement.appendChild(option);
            }
            selectElement.value = pici;
            GetInfopici();
            mui("#MBA001")[0].focus();
         }
      },
      error: function(xhr, type, errorThrown) {
         alert("获取数据异常:" + JSON.stringify(errorThrown));
      }
   });
}
         //判断库位
         function GetStoreTAA() {
             if(event.keyCode == 13) {
@@ -358,8 +441,143 @@
                      alert("获取数据异常:" + JSON.stringify(errorThrown));
                   }
                });
      if (document.getElementById('barcheck').checked) {
         confirmQuantity();
      }
             }
          };
function GetInfopici() {
   //用户ID
   var currentSession = app.loadconfig(app.CONFIG_CURRENT_SESSION);
   var user_id = currentSession.user_id; //currentSession.user_id;
   //      var user_id = "admin";
   $.ajax({
      url: app.API_URL_HEADER + "/WARBABChag/GetInfopici",
      data: {
         DAB001: $("#order").val(),
         PICI: $("#spici").val(),
      },
      DataType: "json",
      type: "post",
      async: false,
      //timeout: 15000,
      success: function(data) {
         //console.log(JSON.stringify(data));
         if (data.status != 0) {
            playerAudio("NG");
            mui.alert(data.message, "", "", function() {
            });
            return;
         } else {
            $("#info").val(data.data.info); //填入汇总信息
         }
      },
      error: function(xhr, type, errorThrown) {
         alert("获取数据异常:" + JSON.stringify(errorThrown));
      }
   });
   if (document.getElementById('barcheck').checked) {
      confirmQuantity();
   }
}
function huizong() {
   //用户ID
   var currentSession = app.loadconfig(app.CONFIG_CURRENT_SESSION);
   var user_id = currentSession.user_id; //currentSession.user_id;
   //      var user_id = "admin";
   $.ajax({
      url: app.API_URL_HEADER + "/WARBABChag/huizong",
      data: {
         DAB001: $("#order").val(),
      },
      DataType: "json",
      type: "post",
      async: false,
      //timeout: 15000,
      success: function(data) {
         //console.log(JSON.stringify(data));
         if (data.status != 0) {
            playerAudio("NG");
            mui.alert(data.message, "", "", function() {
            });
            return;
         } else {
            refreshpdno();
            var selectElement = document.getElementById("spici");
            selectElement.value = parseInt(pici) - 1;
            GetInfopici();
            mui.toast("汇总成功!");
         }
      },
      error: function(xhr, type, errorThrown) {
         alert("获取数据异常:" + JSON.stringify(errorThrown));
      }
   });
   if (document.getElementById('barcheck').checked) {
      confirmQuantity();
   }
}
document.getElementById("huizongbt").addEventListener("click", function() {
   console.log('133');
   var element = document.getElementById("divdetail");
   var element1 = document.getElementById("info");
   if (element.style.display === "none") {
      element.style.display = "";
   } else {
      element.style.display = "none";
   }
   if (element1.style.display === "none") {
      element1.style.display = "";
   } else {
      element1.style.display = "none";
   }
});
function showdetail() {
   console.log('133');
   var element = document.getElementById("divdetail");
   var element1 = document.getElementById("info");
   if (element.style.display === "none") {
      element.style.display = "";
   } else {
      element.style.display = "none";
   }
   if (element1.style.display === "none") {
      element1.style.display = "";
   } else {
      element1.style.display = "none";
   }
}
         function confirmQuantity() {
@@ -392,6 +610,7 @@
                     TAC007: $("#SPSL").val(),
                     MBA001: $("#MBA001").val(),
                      logID: user_id,//Admin //先写死,便于调试
         PICI: $("#spici").val(),
                      
                   },
                   DataType: "json",
@@ -449,8 +668,7 @@
                           }
                        });
                        
                        if(document.getElementById('checkdefault').checked)
                        {
            if (document.getElementById('checkdefault').checked) {
                           return;
                        }
                        $("#MBA001").val("");//先清空一下数据源
@@ -460,7 +678,7 @@
                      alert("获取数据异常:" + JSON.stringify(errorThrown));
                   }
                });
   GetInfopici();
          };