cdk
2025-06-16 d27cd18610ef82671bc57151e86158d16877b5a3
js/CangKuManage_js/CGTH.js
@@ -222,8 +222,7 @@
             // }
          //var user_id = "admin";
           $.ajax({
              //url: app.API_URL_HEADER + "/WARBAB/GetBarInfo_CGTH",
                 url: app.API_URL_HEADER + "/WARBAB/GetErpInventoryTable",
              url: app.API_URL_HEADER + "/WARBAB/GetBarInfo_CGTH",
              data: {
              DBNO:$("#QTNO").val(),
               DAB001: $("#DAB001").val(),
@@ -247,13 +246,14 @@
                  $("#DAB002").val(data.data.DAB020);
                  $("#DAB003").val(data.data.txtSL);
                  $("#DAB004").val(data.data.FLSL);
                  $("#DAB005").val(data.data.FLSL);
                  //mui.toast("扫描成功!");      
                     
                  //如果条码数量大于发料数量
                  if (data.data.txtSL > data.data.FLSL)
                  {
                     mui("#DAB004")[0].focus();
                     alert("条码数量" +data.data.txtSL+"大于退货数量"+data.data.FLSL+",退货失败");
                     mui("#DAB005")[0].focus();
                     //alert("条码数量" +data.data.txtSL+"大于退货数量"+data.data.FLSL+",退货失败");
                  }
                  else
                  {
@@ -274,116 +274,122 @@
        }
};
 
 // function Is_PrintSplit() {
   //  if (event.keyCode == 13) {
   //    var txtSLValue = parseFloat($("#DAB003").val());
   //    var FLSLValue = parseFloat($("#DAB004").val());
 function Is_PrintSplit() {
    if (event.keyCode == 13) {
      var txtSLValue = parseFloat($("#DAB003").val());
      var THValue = parseFloat($("#DAB004").val());
      var FLSLValue = parseFloat($("#DAB005").val());
      if(THValue < FLSLValue){
         mui("#DAB005")[0].focus();
         alert("实退数量" +FLSLValue+"大于需退数量"+THValue+",退货失败");
      }
    
   //    // 比较数值大小
   //    if (txtSLValue <= FLSLValue) {
   //      // txtSL的值小于FLSL的值
   //       console.log("生成领料单");
   //       // CreateSCLLD();
   //       // GETGDINFO_SX();
   //    } else if (txtSLValue > FLSLValue) {
   //      // txtSL的值大于FLSL的值
   //      //console.log("确认是否拆分领料");
   //      mui.confirm('是否拆分该条码?', '请确认', ['确认', '取消'], function(e) {
   //        if (e.index === 0) {
   //          console.log("条码拆分");
   //           GetZJDBCK_PrintSplit();
   //          //GETGDINFO_SX();
   //          console.log("刷新成功!");
   //          mui("#DAB001")[0].focus();
   //          $("#DAB001").val("");//先清空一下数据源
   //        } else {
   //          // 用户点击了取消按钮
   //          mui("#DAB004")[0].focus();
   //        }
   //      });
   //    }
   //  }
 // };
      // 比较数值大小
      if (txtSLValue <= FLSLValue) {
        // txtSL的值小于FLSL的值
         console.log("生成领料单");
         // CreateSCLLD();
         // GETGDINFO_SX();
      } else if (txtSLValue > FLSLValue) {
        // txtSL的值大于FLSL的值
        //console.log("确认是否拆分领料");
        mui.confirm('是否拆分该条码?', '请确认', ['确认', '取消'], function(e) {
          if (e.index === 0) {
            console.log("条码拆分");
             GetZJDBCK_PrintSplit();
            //GETGDINFO_SX();
            console.log("刷新成功!");
            mui("#DAB001")[0].focus();
            $("#DAB001").val("");//先清空一下数据源
          } else {
            // 用户点击了取消按钮
            mui("#DAB004")[0].focus();
          }
        });
      }
    }
 };
//  function GetZJDBCK_PrintSplit() {
//       console.log("条码拆分");
//         //如果未输入条码,跳出方法
//         if($("#DAB001").val() == "") {
//            return;
//         }
 function GetZJDBCK_PrintSplit() {
      console.log("条码拆分");
        //如果未输入条码,跳出方法
        if($("#DAB001").val() == "") {
           return;
        }
       
//         //用户ID
//          var currentSession = app.loadconfig(app.CONFIG_CURRENT_SESSION);
//           //var user_id = currentSession.user_id;
//           // if($("#txtBillNo").val() == ""){
//           // var user_id =currentSession.user_id;
//           // }else{
//           // var user_id ="ADMIN";
//           // }
        //用户ID
         var currentSession = app.loadconfig(app.CONFIG_CURRENT_SESSION);
          //var user_id = currentSession.user_id;
          // if($("#txtBillNo").val() == ""){
          // var user_id =currentSession.user_id;
          // }else{
          // var user_id ="ADMIN";
          // }
         
//          //var user_id ="ADMIN";
         //var user_id ="ADMIN";
// var user_id = currentSession.user_id;
// //var user_id ="ADMIN";
//         $.ajax({
//            url: app.API_URL_HEADER + "/XKYDHD/GetZJDBCK_PrintSplit",
var user_id = currentSession.user_id;
//var user_id ="ADMIN";
        $.ajax({
           url: app.API_URL_HEADER + "/WARBAB/GetCGTH_PrintSplit",
              
//            data: {
           data: {
           
//          DBNO:$("#QTNO").val(),
//             DAB001: $("#DAB001").val(),
//             logID: user_id, //user_id,//Admin //先写死,便于调试
//           SL:$("#DAB004").val(),
         DBNO:$("#QTNO").val(),
            DAB001: $("#DAB001").val(),
            logID: user_id, //user_id,//Admin //先写死,便于调试
          SL:$("#DAB004").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("#DAB001")[0].focus();
//                    $("#DAB001").val("");
//                  });
//                  return;
//               } else {
           },
           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("#DAB001")[0].focus();
                   $("#DAB001").val("");
                 });
                 return;
              } else {
               
//                //console.log(data.data.BARID);
//                console.log("开始打印!!");
               //console.log(data.data.BARID);
               console.log("开始打印!!");
               
//                var str = data.data.BARID.toString();
//                console.log(str); // 将BARID转换为字符串并打印输出
               var str = data.data.BARID.toString();
               console.log(str); // 将BARID转换为字符串并打印输出
               
//                printByIds(str);
//                console.log("打印成功!!");
               printByIds(str);
               console.log("打印成功!!");
               
               
//   $("#DAB001").val("");
//    $("#DAB002").val("");
//     $("#DAB003").val("");
//    $("#DAB004").val("");
// mui.toast("拆分出库成功!");
//          mui("#DAB001")[0].focus();
  $("#DAB001").val("");
   $("#DAB002").val("");
    $("#DAB003").val("");
   $("#DAB004").val("");
mui.toast("拆分出库成功!");
         mui("#DAB001")[0].focus();
         
         
         
         
//                    playerAudio("OK");
//                   GetInfoZJDB();
                   playerAudio("OK");
                  GetCGTH();
           
             
//               }
//            },
//            error: function(xhr, type, errorThrown) {
//               alert("获取数据异常:" + JSON.stringify(errorThrown));
//            }
//         });
              }
           },
           error: function(xhr, type, errorThrown) {
              alert("获取数据异常:" + JSON.stringify(errorThrown));
           }
        });
     
//   };
  };
/* 当页面的文本失去焦点时,让其再次获取焦点 */