zzr99
2022-06-07 a34f918035b2386ef98b84a8e85b8e007cdce86b
WebTM/views/ÁìÁÏ·¢»õ/ÏúÊÛ³ö¿â/Kf_SellOutBill_Fast.html
@@ -8,7 +8,12 @@
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../../../layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="../../../layuiadmin/style/admin.css" media="all">
    <style>
        .layui-col-xs8 {
            width: 55.666667%;
        }
    </style>
</head>
<body>
@@ -26,6 +31,19 @@
                            </div>
                            <div class="layui-col-xs8">
                                <input type="text" name="HBarCode" id="HBarCode" lay-verify="HBarCode" autocomplete="off" class="layui-input">
                            </div>
                            <div class="layui-col-xs2">
                                <button type="button" lay-submit="" class="layui-btn" lay-filter="QueDin">确定</button>
                            </div>
                        </div>
                        <div class="layui-form-item" style="padding:0px;margin:0px">
                            <div class="layui-row">
                                <div class="layui-col-xs3">
                                    <label class="layui-form-label" style="width:40px;padding-left:0px;">数量</label>
                                </div>
                                <div class="layui-col-xs8">
                                    <input type="text" name="HQty" id="HQty" lay-verify="HQty" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                        </div>
                    </div>
@@ -61,6 +79,9 @@
                                        </div>
                                        <div class="layui-col-xs8">
                                            <input type="text" name="HSourceBillNo" id="HSourceBillNo" lay-verify="HSourceBillNo" autocomplete="off" class="layui-input">
                                        </div>
                                        <div class="layui-col-xs2">
                                            <button type="button" lay-submit="" class="layui-btn" lay-filter="QueDin2">确定</button>
                                        </div>
                                    </div>
                                </div>
@@ -177,6 +198,7 @@
                                    </div>
                                </div>
                            </div>
                            <!--物料清单-->
                            <div class="layui-tab-item">
                                <!--<div class="layui-form-item" style="padding:0px;margin:0px">
@@ -189,16 +211,7 @@
                </div>
            </div>
        </div>-->
                                <div class="layui-form-item" style="padding:0px;margin:0px">
                                    <div class="layui-row">
                                        <div class="layui-col-xs3">
                                            <label class="layui-form-label" style="width:40px;padding-left:0px;">数量</label>
                                        </div>
                                        <div class="layui-col-xs8">
                                            <input type="text" name="HQty" id="HQty" lay-verify="HQty" autocomplete="off" class="layui-input">
                                        </div>
                                    </div>
                                </div>
                                <table class="layui-hide" id="wl-table" lay-filter="wl-table"></table>
                            </div>
                            <!--明细清单-->
@@ -211,7 +224,30 @@
                            </div>
                            <!--日志-->
                            <div class="layui-tab-item">
                                <table class="layui-hide" id="fj-table-qd" lay-filter="fj-table-qd"></table>
                                <div class="layui-row">
                                    <div class="layui-col-xs3">
                                        <label class="layui-form-label" style="width:60px;padding-left:0px;">条码数量</label>
                                    </div>
                                    <div class="layui-col-xs8 layui-input-inline mobile">
                                        <input type="text" name="HBarcodeQtys" id="HBarcodeQtys" lay-verify="HBarcodeQtys" autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                                <div class="layui-row">
                                    <div class="layui-col-xs3">
                                        <label class="layui-form-label" style="width:60px;padding-left:0px;">总数量</label>
                                    </div>
                                    <div class="layui-col-xs8 layui-input-inline mobile">
                                        <input type="text" name="HSumQtys" id="HSumQtys" lay-verify="HSumQtys" value="0" autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                                <div class="layui-row">
                                    <div class="layui-col-xs3">
                                        <label class="layui-form-label" style="width:60px;padding-left:0px;">日志</label>
                                    </div>
                                    <div class="layui-col-xs8 layui-input-inline mobile">
                                        <input type="text" name="HNote" id="HNote" lay-verify="HNote" autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                            </div>
                        </div>
                        <!--<div class="layui-form-item" style="margin-bottom: 20px;">
@@ -236,6 +272,16 @@
                        <button type="button" lay-submit="" class="layui-btn" lay-filter="cmdModify">编辑</button>
                        <button type="button" lay-submit="" class="layui-btn" lay-filter="cmdDelete">删除</button>
                        <button type="button" lay-submit="" class="layui-btn" lay-filter="Cancel">退出</button>
                    </div>
                    <div id="" style="display:none;">
                        <audio id="cs" hidden controls>
                            <source src="../../video/jingbao.wav" type="audio/ogg">
                        </audio>
                    </div>
                    <div id="" style="display:none;">
                        <audio id="cs2" hidden controls>
                            <source src="../../video/success.wav" type="audio/ogg">
                        </audio>
                    </div>
                </form>
            </div>
@@ -381,6 +427,8 @@
                        $("#HBillNo").val(d.data[0].HBillNo);
                        $("#HBillType").val(d.data[0].HSourceBillType);
                        $("#HSourceBillNo").val(d.data[0].HSourceBillNo);
                        $("#HSourceBillNo").attr("disabled", "true");
                        HSourceFlag = true;
                        //$("#HWHID").val(d.data[0].HWhID);
                        //$("#HStockPlaceID").val(d.data[0].HSPID);
                        //$("#HKeeperID").val(d.data[0].HKeeperID);
@@ -436,6 +484,7 @@
                    //, url: 'http://61.130.49.162:9090/WMSAPI///ProductIn/DisBillEntryList_Webs_Json'
                    , url: GetWEBURL() + '/ProductIn/DisBillEntryList_Webs_Json'
                    , toolbar: '#toolbarDemo'
                    , defaultToolbar: []
                    , where: { HBillID: sInterID, HBillType: '1205', sWhere: '' }
                    , cols: [[
                        { type: 'radio' }
@@ -637,23 +686,47 @@
            })
            //编辑
            //form.on('submit(cmdModify)', function () {//编辑
            //    var checkStatus = table.checkStatus('wl-table')
            //        , data = checkStatus.data;
            //    if (checkStatus.data.length === 1) {
            //        var HInterID = data[0].HInterID.toString();
            //        var HMaterID = data[0].HMaterID.toString();
            //        var HAuxPropID = data[0].HAuxPropID.toString();
            //        var HMTONo = data[0].HMTONo.toString();
            //        var HWhID = data[0].HWhID.toString();
            //        var HSPID = data[0].HSPID.toString();
            //        var HSCWHID = data[0].HSCWHID.toString();
            //        var HSCSPID = data[0].HSCSPID.toString();
            //        var HBatchNo = data[0].HBatchNo.toString();
            //        var HSourceInterID = data[0].HSourceInterID.toString();
            //        var HSourceEntryID = data[0].HSourceEntryID.toString();
            //        var HBillType = '1205';
            //        var HBarCode = data[0].HBarCode.toString();
            //    layer.open({
            //        type: 2
            //        , area: ['100%', '100%']
            //        , title: '明细列表'
            //        , shade: 0.6 //遮罩透明度
            //        , maxmin: true //允许全屏最小化
            //        , anim: 0 //0-6的动画形式,-1不开启
            //        , content: ['../../../views/公共页面/Kf_BarCodeEditDlg.html?HInterID=' + HInterID + '&HMaterID = ' + HMaterID + '&HAuxPropID = ' + HAuxPropID + '& HMTONo = ' + HMTONo + '&HWhID = ' + HWhID + '&HSPID = ' + HSPID + '&HSCWHID = ' + HSCWHID + '&HSCSPID= ' + HSCSPID + '&HBatchNo= ' + HBatchNo + '&HSourceInterID= ' + HSourceInterID + '&HSourceEntryID= ' + HSourceEntryID + '&HBillType=  ' + HBillType + '&HBarCode=  ' + HBarCode + ''
            //            , 'yes']
            //        , resize: false
            //        , cancel: function () {
            //            //$(".layui-btn").removeClass("layui-btn-disabled");
            //        }
            //    })
            //    } else {
            //        layer.msg('请选择一行数据编辑!');
            //    }
            //})
            form.on('submit(cmdModify)', function () {//编辑
                //var sSubStr = table.cache['wl-table'];
                var checkStatus = table.checkStatus('wl-table')
                    , data = checkStatus.data;
                if (checkStatus.data.length === 1) {
                    var HInterID = data[0].HInterID.toString();
                    var HMaterID = data[0].HMaterID.toString();
                    var HAuxPropID = data[0].HAuxPropID.toString();
                    var HMTONo = data[0].HMTONo.toString();
                    var HWhID = data[0].HWhID.toString();
                    var HSPID = data[0].HSPID.toString();
                    var HSCWHID = data[0].HSCWHID.toString();
                    var HSCSPID = data[0].HSCSPID.toString();
                    var HBatchNo = data[0].HBatchNo.toString();
                    var HSourceInterID = data[0].HSourceInterID.toString();
                    var HSourceEntryID = data[0].HSourceEntryID.toString();
                    var HBillType = '1205';
                    var HBarCode = data[0].HBarCode.toString();
                //if (AllowLoadData(sSubStr) != false) {//非空验证
                layer.open({
                    type: 2
                    , area: ['100%', '100%']
@@ -661,17 +734,46 @@
                    , shade: 0.6 //遮罩透明度
                    , maxmin: true //允许全屏最小化
                    , anim: 0 //0-6的动画形式,-1不开启
                    , content: ['../../../views/公共页面/Kf_BarCodeEditDlg.html?HInterID=' + HInterID + '&HMaterID = ' + HMaterID + '&HAuxPropID = ' + HAuxPropID + '& HMTONo = ' + HMTONo + '&HWhID = ' + HWhID + '&HSPID = ' + HSPID + '&HSCWHID = ' + HSCWHID + '&HSCSPID= ' + HSCSPID + '&HBatchNo= ' + HBatchNo + '&HSourceInterID= ' + HSourceInterID + '&HSourceEntryID= ' + HSourceEntryID + '&HBillType=  ' + HBillType + '&HBarCode=  ' + HBarCode + ''
                        , 'yes']
                    , content: ['../../../views/公共页面/Kf_BarCodeEditDlg.html?HInterID=' + data[0].HInterID + '&HMaterID =' + data[0].HMaterID + '&HBillType =' + data[0].HBillType, 'yes']
                    , resize: false
                    , cancel: function () {
                        //$(".layui-btn").removeClass("layui-btn-disabled");
                    }
                    , end: function () {
                        //刷新页面,
                        //location.reload();
                        var sInterID = $("#HInterID").val()
                        table.render({
                            elem: '#wl-table'
                            //, url: 'http://61.130.49.162:9090/WMSAPI///ProductIn/DisBillEntryList_Webs_Json'
                            , url: GetWEBURL() + '/SellOut/DisBillEntryList_Webs_Json'
                            , toolbar: '#toolbarDemo'
                            , defaultToolbar: []
                            , where: { HBillID: sInterID, HBillType: '1205', sWhere: '' }
                            , cols: [[
                                { type: 'radio' }
                                , { field: 'HSNO', title: '序号', width: 60 }
                                , { field: 'HQty', title: '数量', width: 80 }
                                , { field: 'HQtyMust', title: '应发数量', width: 80 }
                                , { field: 'HMaterName', title: '物料名称', width: 90 }
                                , { field: 'HMaterNumber', title: '物料代码', width: 90 }
                                , { field: 'HMaterModel', title: '规格型号', width: 90 }
                                , { field: 'HSourceInterID', title: '源单主内码', width: 90 }
                                , { field: 'HSourceEntryID', title: '源单子内码', width: 90 }
                                , { field: 'HSourceBillNo', title: '源单单号', width: 90 }
                                , { field: 'HBatchNo', title: '批次', width: 90 }
                            ]]
                            // , data: [linterid]
                            // , page: true
                            , height: 500
                            , done: function () {
                                layer.closeAll("loading");
                            }
                        })
                    }
                })
                } else {
                    layer.msg('请选择一行数据编辑!');
                }
            })
                // }
            });
            //删除
            form.on('submit(cmdDelete)', function () {//删除
@@ -701,6 +803,7 @@
                                   , url: GetWEBURL() + '/SellOut/DisBillEntryList_Webs_Json'
                                   , cellMinWidth: 80
                                   , toolbar: '#toolbarDemo'
                                   , defaultToolbar: []
                                   , where: { HBillID: sInterID, HBillType: '1205', sWhere: '' }
                                   , cols: [[
                                      { type: 'radio' }
@@ -807,155 +910,15 @@
            //扫条码-直接调webservice
            $('#HBarCode').on('keydown', function (event) {
                var sBarCode = $('#HBarCode').val()//条码
                var sInterID = $("#HInterID").val()//单据号ID
                var sBillType = '1205'
                var sBillNo = $("#HBillNo").val()//单据号
                var sMaker = sessionStorage["HUserName"];
                var sHWHID = $("#HWHID").val();//仓库ID
                var sHSPID = $("#HStockPlaceID").val();//仓位ID
                var sQty = $("#HQty").val()//数量
                //var SourceFlag = sessionStorage["SourceFlag"];
                var sSourceBillNo = $("#HSourceBillNo").val();//源单号
                var sHBillType = $("#HBillType").val()  //源单类型-发货通知单:1402,销售订单1401
                if (sQty == "") {
                    sQty = 0;
                }
                if (event.keyCode == 13) {
                    if (sBarCode == '') {
                        layer.msg("条码为空,不能扫描!", { icon: 5, btn: ['确定'], time: 100000, offset: 't' });
                        return false;
                    }
                    if (sBarCode != "") {
                        $('#HBarCode').val("");
                    }
                    $.ajax({
                        url: GetWEBURL() + "/SellOut/get_CheckTypeByBarCode_Json",
                        type: "GET",
                        data: { "sCode": sBarCode, "sInterID": sInterID, "HBillType": sBillType, "sBillNo": sBillNo, "sMaker": sMaker, "WhID": sHWHID, "SPID": sHSPID, "sQty": sQty, "sRedBlue": false, "SourceFlag": HSourceFlag, "sSourceBillNo": sSourceBillNo, "sSourceType": sHBillType, "HOWNERID": sessionStorage["OrganizationID"] },
                        success: function (result) {
                            if (result.count == 1) {
                                if (result.data.HBarType == '仓库条码') {
                                    $("#HWHNAME").val(result.data.HWhName);
                                    $("#HWHID").val(result.data.HWhID);
                                    $("#HStockPlaceName").val("");
                                    $("#HNote").val(";一键扫码仓库条码");
                                    element.tabChange('tab-Kf_SellOutBill', '3');  //跳转页签
                                }
                                else if (result.data.HBarType == '仓位条码') {
                                    $("#HStockPlaceName").val(result.data.HSPName);
                                    $("#HStockPlaceID").val(result.data.HSPID);
                                    $("#HWHNAME").val(result.data.HWhName);
                                    $("#HWHID").val(result.data.HWhID);
                                    $("#HNote").val(";一键扫码仓位条码");
                                    element.tabChange('tab-Kf_SellOutBill', '3');//跳转页签
                                }
                                else if (result.data.HBarType == '部门条码') {
                                    $("#HDeptName").val(result.data.HDeptName);
                                    $("#HDeptID").val(result.data.HDeptID);
                                    $("#HNote").val(";一键扫码部门条码");
                                    element.tabChange('tab-Kf_SellOutBill', '3');//跳转页签
                                }
                                else if (result.data.HBarType == '源单条码') {
                                    //$("#HSupName").val(result.data.HSupName);
                                    $("#HSupID").val(result.data.HSupID);
                                    //$("#HDeptName").val(result.data.HDeptName);
                                    $("#HDeptID").val(result.data.HDeptID);
                                    $("#HSourceBillNo").val(result.data.HSourceBillNo);
                                    HSourceFlag = true;
                                    //获取源单类型、源单单号
                                    if (result.data.HSourceBillType == "1402") {
                                        $("#HBillType").val("1402");
                                    }
                                    else if (result.data.HSourceBillType == "1401") {
                                        $("#HBillType").val("1401");
                                    }
                                    else {
                                        $("#HBillType").val("手工录入");
                                    }
                                    $("#HNote").val(";一键扫码源单条码");
                                    element.tabChange('tab-Kf_SellOutBill', '3');
                                }
                                else {
                                    if (HSourceFlag == "true") {
                                        element.tabChange('tab-Kf_SellOutBill', '3');
                                    }
                                    else {
                                        //$("#HSupName").val(result.data.HSupName);
                                        $("#HSupID").val(result.data.HSupID);
                                        //$("#HDeptName").val(result.data.HDeptName);
                                        $("#HDeptID").val(result.data.HDeptID);
                                        $("#HSourceBillNo").val(result.data.HSourceBillNo);
                                        HSourceFlag = true;
                                        //获取源单类型、源单单号
                                        if (result.data.HSourceBillType == "1402") {
                                            $("#HBillType").val("1402");
                                        }
                                        else if (result.data.HSourceBillType == "1401") {
                                            $("#HBillType").val("1401");
                                        }
                                        //else if (result.data.HSourceBillType == "1601") {
                                        //    $("#HBillType").val("1601");
                                        //}
                                        $("#HNote").val(";物料条码");
                                        element.tabChange('tab-Kf_SellOutBill', '3');
                                    }
                                }
                                //$("#HSupID").val(result.data.HSupID);
                                //$("#HSupName").val(result.data.HSupName);
                                //$("#HDeptID").val(result.data.HDeptID);
                                //$("#HDeptName").val(result.data.HDeptName);
                                layer.load(3)
                                table.render({
                                    elem: '#wl-table'
                                    // , url: 'http://61.130.49.162:9090/WMSAPI///OtherInStockBill/DisBillEntryList_Webs_Json'
                              , url: GetWEBURL() + '/SellOut/DisBillEntryList_Webs_Json'
                              , toolbar: '#toolbarDemo'
                              , where: { HBillID: sInterID, HBillType: '1205', sWhere: '' }
                              , cols: [[
                                  { type: 'radio' }
                                , { field: 'HQty', title: '数量', width: 150 }
                                , { field: 'HQtyMust', title: '应收数量', width: 150 }
                                , { field: 'HMaterNumber', title: '物料代码', width: 150 }
                                , { field: 'HMaterName', title: '物料名称', width: 150 }
                                , { field: 'HMaterModel', title: '规格型号', width: 150 }
                                , { field: 'HSourceInterID', title: '源单主内码', width: 150 }
                                , { field: 'HSourceEntryID', title: '源单子内码', width: 150 }
                                , { field: 'HSourceBillNo', title: '源单单号', width: 150 }
                                , { field: 'HBatchNo', title: '批次', width: 150 }
                                  , { field: 'HInterID', title: '单据ID', width: 150, hide: true }
                                  , { field: 'HBilltype', title: '单据类型', width: 150, hide: true }
                                  , { field: 'Hbarcode', title: '条码编号', width: 150, hide: true }
                                  , { field: 'HSCWHID', title: '调出仓库ID', width: 150, hide: true }
                                  , { field: 'HSCSPID', title: '调出仓位ID', width: 150, hide: true }
                                  , { field: 'HAuxPropID', title: '辅助属性ID', width: 150, hide: true }
                                  , { field: 'HMTONo', title: 'MTO号', width: 150, hide: true }
                                  , { field: 'HMaterID', title: '物料ID', width: 150, hide: true }
                              ]]
                                    // , data: [linterid]
                                    // , page: true
                              //, height: 500
                              , done: function () {
                                  layer.closeAll("loading");
                              }
                                });
                            }
                            else {
                                // $("#verifycode").click();
                                //layer.msg(result.Message, { icon: 5 });
                                layer.msg(result.Message, { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                            }
                            layer.closeAll("loading");
                        },
                        error: function (err) {
                            layer.msg("接口请求失败!" + err, { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                        }
                    });
                    GetMeesageByBarCode();
                }
            });
            //确定
            form.on('submit(QueDin)', function (data) {
                GetMeesageByBarCode();
            });
            $('#HStockPlaceName').on('keydown', function (event) {      //扫仓位
                var HBarCode = $('#HStockPlaceName').val()
@@ -1058,67 +1021,16 @@
            //});
            //扫源单
            $('#HSourceBillNo').on('keydown', function (event) {    //扫源单
                var HSourceBillNo = $('#HSourceBillNo').val()
                var sInterID = $("#HInterID").val()
                var sBillNo = $("#HBillNo").val()
                var HSourceBillType = $("#HBillType").val()
            $('#HSourceBillNo').on('keydown', function (event) {
                if (event.keyCode == 13) {
                    var index = layer.load(0);
                    //判断文本框是否有数据    new
                    if (HSourceBillNo == "" || sInterID <= 0) {
                        layer.close(index);
                        layer.msg("源单号为空,或者内码不存在!", { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                        return;
                    }
                    $.ajax({
                        url: GetWEBURL() + "/SellOut/set_SavePonderationBillMain_Temp_Source_Fast_Json",
                        type: "GET",
                        data: { "HSourceBillType": HSourceBillType, "HSourceBillNo": HSourceBillNo, "sInterID": sInterID, "sBillNo": sBillNo },
                        success: function (result) {
                            if (result.count == 1) { // è¯´æ˜ŽéªŒè¯æˆåŠŸäº†ï¼Œ
                                GetSellOutFindSP();
                                $("#HSupID").val(result.data[0].HSupID);
                                $("#HSupName").val(result.data[0].HSupName);
                                //$("#HDeptID").val(result.data[0].HDeptID);
                                //$("#HDeptName").val(result.data[0].HDeptName);
                                HSourceFlag = true;
                                element.tabChange('tab-SellOutBill', '3');
                                table.render({
                                    elem: '#wl-table'
                                    , url: GetWEBURL() + '/SellOut/DisBillEntryList_Webs_Json'
                                  , toolbar: '#toolbarDemo'
                                  , where: { HBillID: sInterID, HBillType: '1205', sWhere: '' }
                                  , cols: [[
                                      { type: 'radio' }
                                    , { field: 'HQty', title: '数量', width: 150 }
                                    , { field: 'HQtyMust', title: '应发数量', width: 150 }
                                    , { field: 'HMaterNumber', title: '物料代码', width: 150 }
                                    , { field: 'HMaterName', title: '物料名称', width: 150 }
                                    , { field: 'HMaterModel', title: '规格型号', width: 150 }
                                    , { field: 'HSourceInterID', title: '源单主内码', width: 150 }
                                    , { field: 'HSourceEntryID', title: '源单子内码', width: 150 }
                                    , { field: 'HSourceBillNo', title: '源单单号', width: 150 }
                                    , { field: 'HBatchNo', title: '批次', width: 150 }
                                  ]]
                                    // , data: [linterid]
                                    // , page: true
                                  //, height: 500
                                  , done: function () {
                                      layer.close(index);
                                  }
                                });
                                layer.close(index);
                            }
                            else {
                                layer.close(index);
                                layer.msg(result.Message, { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                            }
                            layer.close(index);
                        }
                    });
                    GetMeesageBySourceBillNo();
                }
            });
            //确定
            form.on('submit(QueDin2)', function (data) {
                GetMeesageBySourceBillNo();
            });
            //刷新明细页签
            table.render({
                elem: '#mx-table'
@@ -1174,7 +1086,6 @@
                        if (result.count == 1) {
                            ZHOption.data = result.data;
                            table.render(ZHOption);
                           // layer.close(index);
                            element.tabChange('tab-SellOutBill', '5');
                        }
                        else {
@@ -1185,9 +1096,284 @@
                    }
                });
            }
            //扫条码
            function GetMeesageByBarCode(obj) {  //返回工作中心
                var sOldBarCode = $('#HBarCode').val()
                var HDeleteFlag = sOldBarCode.substring(0, 1);
                var sBarCode = sOldBarCode.slice(1);
                var sInterID = $("#HInterID").val()//单据号ID
                var sBillType = '1205'
                var sBillNo = $("#HBillNo").val()//单据号
                var sMaker = sessionStorage["HUserName"];
                var sHWHID = $("#HWHID").val();//仓库ID
                var sHSPID = $("#HStockPlaceID").val();//仓位ID
                var sQty = $("#HQty").val()//数量
                if (sQty == "") {
                    sQty = 0;
                }
                //var SourceFlag = sessionStorage["SourceFlag"];
                var sSourceBillNo = $("#HSourceBillNo").val();//源单号
                var sHBillType = $("#HBillType").val()  //源单类型-发货通知单:1402,销售订单1401
                var sBillType = '1205'
                if (HDeleteFlag == "*") {
                    if (sBarCode != "") {
                        $('#HBarCode').val("");
                    }
                    $.ajax(
                        {
                            type: "Get",
                            url: GetWEBURL() + "/ProductIn/Delete_Json",
                            async: true,
                            data: { "HInterID": sInterID, "HBillNo": sBillNo, "HBillType": sBillType, "HBarCode": sBarCode },
                            dataType: "json",
                            success: function (data) {
                                if (data.count == 1) { // è¯´æ˜ŽéªŒè¯æˆåŠŸäº†
                                    playSound1();
                                    table.reload('wl-table', {
                                        where: { HBillID: sInterID, HBillType: '1205', sWhere: '' }
                                    });
                                }
                                else {
                                    playSound();
                                    layer.msg(data.Message, { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                                }
                            },
                            error: function (err) {
                                playSound();
                                layer.msg('错误' + err, { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                            }
                        });
                }
                else {
                    var sBarCode = $('#HBarCode').val()
                    if (sBarCode == '') {
                        //
                        playSound();
                        layer.msg("条码为空,不能扫描!", { icon: 5, btn: ['确定'], time: 100000, offset: 't' });
                        //11
                        return false;
                    }
                    if (sBarCode != "") {
                        $('#HBarCode').val("");
                    }
                    $.ajax({
                        url: GetWEBURL() + "/SellOut/get_CheckTypeByBarCode_Json",
                        type: "GET",
                        data: { "sCode": sBarCode, "sInterID": sInterID, "HBillType": sBillType, "sBillNo": sBillNo, "sMaker": sMaker, "WhID": sHWHID, "SPID": sHSPID, "sQty": sQty, "sRedBlue": false, "SourceFlag": HSourceFlag, "sSourceBillNo": sSourceBillNo, "sSourceType": sHBillType, "HOWNERID": sessionStorage["OrganizationID"] },
                        success: function (result) {
                            playSound1();
                            if (result.count == 1) {
                                if (result.data.HBarType == '仓库条码') {
                                    $("#HWHNAME").val(result.data.HWhName);
                                    $("#HWHID").val(result.data.HWhID);
                                    $("#HStockPlaceName").val("");
                                    $("#HNote").val(";一键扫码仓库条码");
                                    element.tabChange('tab-Kf_SellOutBill', '3');  //跳转页签
                                }
                                else if (result.data.HBarType == '仓位条码') {
                                    $("#HStockPlaceName").val(result.data.HSPName);
                                    $("#HStockPlaceID").val(result.data.HSPID);
                                    $("#HWHNAME").val(result.data.HWhName);
                                    $("#HWHID").val(result.data.HWhID);
                                    $("#HNote").val(";一键扫码仓位条码");
                                    element.tabChange('tab-Kf_SellOutBill', '3');//跳转页签
                                }
                                else if (result.data.HBarType == '部门条码') {
                                    $("#HDeptName").val(result.data.HDeptName);
                                    $("#HDeptID").val(result.data.HDeptID);
                                    $("#HNote").val(";一键扫码部门条码");
                                    element.tabChange('tab-Kf_SellOutBill', '3');//跳转页签
                                }
                                else if (result.data.HBarType == '源单条码') {
                                    //$("#HSupName").val(result.data.HSupName);
                                    $("#HSupID").val(result.data.HSupID);
                                    //$("#HDeptName").val(result.data.HDeptName);
                                    $("#HDeptID").val(result.data.HDeptID);
                                    $("#HSourceBillNo").val(result.data.HSourceBillNo);
                                    HSourceFlag = true;
                                    //获取源单类型、源单单号
                                    if (result.data.HSourceBillType == "1402") {
                                        $("#HBillType").val("1402");
                                    }
                                    else if (result.data.HSourceBillType == "1401") {
                                        $("#HBillType").val("1401");
                                    }
                                    else {
                                        $("#HBillType").val("手工录入");
                                    }
                                    $("#HNote").val(";一键扫码源单条码");
                                    element.tabChange('tab-Kf_SellOutBill', '3');
                                }
                                else {
                                    if (HSourceFlag == "true") {
                                        element.tabChange('tab-Kf_SellOutBill', '3');
                                    }
                                    else {
                                        //$("#HSupName").val(result.data.HSupName);
                                        $("#HSupID").val(result.data.HSupID);
                                        //$("#HDeptName").val(result.data.HDeptName);
                                        $("#HDeptID").val(result.data.HDeptID);
                                        $("#HSourceBillNo").val(result.data.HSourceBillNo);
                                        HSourceFlag = true;
                                        //获取源单类型、源单单号
                                        if (result.data.HSourceBillType == "1402") {
                                            $("#HBillType").val("1402");
                                        }
                                        else if (result.data.HSourceBillType == "1401") {
                                            $("#HBillType").val("1401");
                                        }
                                        //else if (result.data.HSourceBillType == "1601") {
                                        //    $("#HBillType").val("1601");
                                        //}
                                        $("#HNote").val(";物料条码");
                                        element.tabChange('tab-Kf_SellOutBill', '3');
                                    }
                                }
                                //$("#HSupID").val(result.data.HSupID);
                                //$("#HSupName").val(result.data.HSupName);
                                //$("#HDeptID").val(result.data.HDeptID);
                                //$("#HDeptName").val(result.data.HDeptName);
                                table.render({
                                    elem: '#wl-table'
                                    , url: GetWEBURL() + '/SellOut/DisBillEntryList_Webs_Json'
                                    , toolbar: '#toolbarDemo'
                                    , where: { HBillID: sInterID, HBillType: '1205', sWhere: '' }
                                    , cols: [[
                                        { type: 'radio' }
                                        , { field: 'HSNO', title: '序号', width: 60 }
                                        , { field: 'HQty', title: '数量', width: 80 }
                                        , { field: 'HQtyMust', title: '应发数量', width: 80 }
                                        , { field: 'HMaterName', title: '物料名称', width: 90 }
                                        , { field: 'HMaterNumber', title: '物料代码', width: 90 }
                                        , { field: 'HMaterModel', title: '规格型号', width: 90 }
                                        , { field: 'HSourceInterID', title: '源单主内码', width: 90 }
                                        , { field: 'HSourceEntryID', title: '源单子内码', width: 90 }
                                        , { field: 'HSourceBillNo', title: '源单单号', width: 90 }
                                        , { field: 'HBatchNo', title: '批次', width: 90 }
                                    ]]
                                    , height: 500
                                    , done: function () {
                                        layer.closeAll("loading");
                                    }
                                });
                                var count = 0;
                                var count1 = 0;
                                for (var i = 0; i < result.data.length; i++) {
                                    count += result.data.HQty;
                                    count1 += result.data.HPieceQty;
                                }
                                $("#HSumQtys").val(count);
                                $("#HBarCodeQtys").val(count1);
                                playSound1();
                            }
                            else {
                                // $("#verifycode").click();
                                //layer.msg(result.Message, { icon: 5 });
                                //
                                playSound();
                                layer.msg(result.Message, { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                                //11
                            }
                            layer.closeAll("loading");
                        },
                        error: function (err) {
                            playSound();
                            layer.msg("接口请求失败!" + err, { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                            //11
                        }
                    });
                }
            }
            function playSound() {
                console.log("playSound");
                //var audio = document.getElementById("cs");
                //$("appendAut").html("");
                //if (audio == null)
                //$("appendAut").append('<audio id="cs" hidden controls> <source src = "../../video/jingbao.wav" type = "audio/ogg"> </audio >');
                //$("appendAut").attr("src","../../video/jingbao.wav")
                var audio = document.getElementById("cs");
                audio.play();
            }
            function playSound1() {
                console.log("playSound1");
                //var audio = document.getElementById("cs");
                //$("appendAut").html("");
                //if (audio == null)
                //$("appendAut").append('<audio id="cs" hidden controls> <source src = "../../video/success.wav" type = "audio/ogg"> </audio >');
                //$("appendAut").attr("src", "../../video/success.wav")
                var audio = document.getElementById("cs2");
                audio.play();
            }
            //扫源单
            function GetMeesageBySourceBillNo(obj) {
                var HSourceBillNo = $('#HSourceBillNo').val()
                var sInterID = $("#HInterID").val()
                var sBillNo = $("#HBillNo").val()
                var HSourceBillType = $("#HBillType").val()
                if (HSourceBillNo == "" || sInterID <= 0) {
                    layer.msg("源单号为空,或者内码不存在!", { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                    return;
                }
                $.ajax({
                    url: GetWEBURL() + "/SellOut/set_SavePonderationBillMain_Temp_Source_Fast_Json",
                    type: "GET",
                    data: { "HSourceBillType": HSourceBillType, "HSourceBillNo": HSourceBillNo, "sInterID": sInterID, "sBillNo": sBillNo },
                    success: function (result) {
                        if (result.count == 1) { // è¯´æ˜ŽéªŒè¯æˆåŠŸäº†ï¼Œ
                            GetSellOutFindSP();
                            $("#HSupID").val(result.data[0].HSupID);
                            $("#HSupName").val(result.data[0].HSupName);
                            //$("#HDeptID").val(result.data[0].HDeptID);
                            //$("#HDeptName").val(result.data[0].HDeptName);
                            HSourceFlag = true;
                            element.tabChange('tab-SellOutBill', '3');
                            //table.reload('wl-table', {
                            //    where: { HBillID: sInterID, HBillType: '1205', sWhere: '' }
                            //});
                            table.render({
                                elem: '#wl-table'
                                , url: GetWEBURL() + '/SellOut/DisBillEntryList_Webs_Json'
                                , toolbar: '#toolbarDemo'
                                , where: { HBillID: sInterID, HBillType: '1205', sWhere: '' }
                                , cols: [[
                                    { type: 'radio' }
                                    , { field: 'HSNO', title: '序号', width: 60 }
                                    , { field: 'HQty', title: '数量', width: 80 }
                                    , { field: 'HQtyMust', title: '应发数量', width: 80 }
                                    , { field: 'HMaterName', title: '物料名称', width: 90 }
                                    , { field: 'HMaterNumber', title: '物料代码', width: 90 }
                                    , { field: 'HMaterModel', title: '规格型号', width: 90 }
                                    , { field: 'HSourceInterID', title: '源单主内码', width: 90 }
                                    , { field: 'HSourceEntryID', title: '源单子内码', width: 90 }
                                    , { field: 'HSourceBillNo', title: '源单单号', width: 90 }
                                    , { field: 'HBatchNo', title: '批次', width: 90 }
                                ]]
                                , height: 500
                                , done: function () {
                                    layer.closeAll("loading");
                                }
                            });
                            $("#HSourceBillNo").attr("disabled", "true");
                        }
                        else {
                            layer.msg(result.Message, { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                        }
                    }
                });
            }
        });
        //以上为layui模块
        });
        function GetHWHValue(obj)  //返回仓库
        {
            $("#HWHNAME").val(obj[0].HName);